payu-upi-bolt-ui-rn 0.0.1-dev2 → 0.0.1-dev4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/android/src/main/java/com/payuupiboltui/PayUUPIBoltUISdkConstants.java +1 -0
  2. package/android/src/main/java/com/payuupiboltui/PayUUPIBoltUISdkModule.java +37 -0
  3. package/ios/PayUUPIBoltUISdk.m +14 -0
  4. package/package.json +1 -1
  5. package/react-native-upi-bolt.podspec +1 -2
  6. package/ios/Framework/CommonLibrary.framework/CommonLibrary +0 -0
  7. package/ios/Framework/CommonLibrary.framework/Headers/CLServices.h +0 -312
  8. package/ios/Framework/CommonLibrary.framework/Headers/CommonLibrary-Swift.h +0 -306
  9. package/ios/Framework/CommonLibrary.framework/Headers/CommonLibrary.h +0 -23
  10. package/ios/Framework/CommonLibrary.framework/Info.plist +0 -0
  11. package/ios/Framework/CommonLibrary.framework/Modules/CommonLibrary.swiftmodule/arm64-apple-ios.abi.json +0 -235
  12. package/ios/Framework/CommonLibrary.framework/Modules/CommonLibrary.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -16
  13. package/ios/Framework/CommonLibrary.framework/Modules/CommonLibrary.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  14. package/ios/Framework/CommonLibrary.framework/Modules/CommonLibrary.swiftmodule/arm64-apple-ios.swiftinterface +0 -16
  15. package/ios/Framework/CommonLibrary.framework/Modules/module.modulemap +0 -11
  16. package/ios/Framework/CommonLibrary.framework/locked_phone.png +0 -0
  17. package/ios/Framework/CommonLibrary.framework/toolbar_back_arrow.png +0 -0
  18. package/ios/Framework/CommonLibrary.framework/xml-signature.js +0 -35
  19. package/ios/Framework/OlivePayLibrary.framework/Headers/BasicEncodingRules.h +0 -173
  20. package/ios/Framework/OlivePayLibrary.framework/Headers/Encrypt.h +0 -16
  21. package/ios/Framework/OlivePayLibrary.framework/Headers/EncryptString.h +0 -31
  22. package/ios/Framework/OlivePayLibrary.framework/Headers/IPChecker.h +0 -15
  23. package/ios/Framework/OlivePayLibrary.framework/Headers/InitializeCommon.h +0 -52
  24. package/ios/Framework/OlivePayLibrary.framework/Headers/LibInitialization.h +0 -20
  25. package/ios/Framework/OlivePayLibrary.framework/Headers/MFMessageComposeViewController+EditDisabled.h +0 -18
  26. package/ios/Framework/OlivePayLibrary.framework/Headers/NSData+Base64.h +0 -16
  27. package/ios/Framework/OlivePayLibrary.framework/Headers/NSData+SHA.h +0 -19
  28. package/ios/Framework/OlivePayLibrary.framework/Headers/OlivePayLibrary-Swift.h +0 -442
  29. package/ios/Framework/OlivePayLibrary.framework/Headers/OlivePayLibrary.h +0 -31
  30. package/ios/Framework/OlivePayLibrary.framework/Headers/RSA.h +0 -26
  31. package/ios/Framework/OlivePayLibrary.framework/Headers/SwiftyRSA.h +0 -19
  32. package/ios/Framework/OlivePayLibrary.framework/Info.plist +0 -0
  33. package/ios/Framework/OlivePayLibrary.framework/ListKeysPayload.xml +0 -59
  34. package/ios/Framework/OlivePayLibrary.framework/Modules/OlivePayLibrary.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  35. package/ios/Framework/OlivePayLibrary.framework/Modules/OlivePayLibrary.swiftmodule/arm64-apple-ios.abi.json +0 -73035
  36. package/ios/Framework/OlivePayLibrary.framework/Modules/OlivePayLibrary.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -1229
  37. package/ios/Framework/OlivePayLibrary.framework/Modules/OlivePayLibrary.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  38. package/ios/Framework/OlivePayLibrary.framework/Modules/OlivePayLibrary.swiftmodule/arm64-apple-ios.swiftinterface +0 -1229
  39. package/ios/Framework/OlivePayLibrary.framework/Modules/OlivePayLibrary.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  40. package/ios/Framework/OlivePayLibrary.framework/Modules/module.modulemap +0 -11
  41. package/ios/Framework/OlivePayLibrary.framework/OlivePayLibrary +0 -0
  42. package/ios/Framework/OlivePayLibrary.framework/upiuataxisbankcoin.cer +0 -0
  43. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/Info.plist +0 -27
  44. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/Headers/PayUUPIBoltBaseKit-Swift.h +0 -1080
  45. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/Headers/PayUUPIBoltBaseKit.h +0 -18
  46. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/Info.plist +0 -0
  47. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/Modules/PayUUPIBoltBaseKit.swiftmodule/arm64-apple-ios.abi.json +0 -57054
  48. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/Modules/PayUUPIBoltBaseKit.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -736
  49. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/Modules/PayUUPIBoltBaseKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  50. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/Modules/PayUUPIBoltBaseKit.swiftmodule/arm64-apple-ios.swiftinterface +0 -736
  51. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/Modules/module.modulemap +0 -11
  52. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/PayUUPIBoltBaseKit +0 -0
  53. package/ios/Framework/PayUUPIBoltBaseKit.xcframework/ios-arm64/PayUUPIBoltBaseKit.framework/_CodeSignature/CodeResources +0 -190
  54. package/ios/Framework/PayUUPIBoltKit.xcframework/Info.plist +0 -27
  55. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/Headers/PayUUPIBoltKit-Swift.h +0 -391
  56. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/Headers/PayUUPIBoltKit.h +0 -18
  57. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/Info.plist +0 -0
  58. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/Modules/PayUUPIBoltKit.swiftmodule/arm64-apple-ios.abi.json +0 -5093
  59. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/Modules/PayUUPIBoltKit.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -74
  60. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/Modules/PayUUPIBoltKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  61. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/Modules/PayUUPIBoltKit.swiftmodule/arm64-apple-ios.swiftinterface +0 -74
  62. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/Modules/module.modulemap +0 -11
  63. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/PayUUPIBoltKit +0 -0
  64. package/ios/Framework/PayUUPIBoltKit.xcframework/ios-arm64/PayUUPIBoltKit.framework/_CodeSignature/CodeResources +0 -190
  65. package/ios/Framework/PayUUPIBoltUIKit.xcframework/Info.plist +0 -27
  66. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Assets.car +0 -0
  67. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/BalanceErrorView.nib +0 -0
  68. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/BankAccountCell.nib +0 -0
  69. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/BottomSheetHeaderView.nib/objects-14.0+.nib +0 -0
  70. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/BottomSheetHeaderView.nib/runtime.nib +0 -0
  71. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/BrandingFooterView.nib +0 -0
  72. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/DisputeCell.nib +0 -0
  73. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Headers/PayUUPIBoltUIKit-Swift.h +0 -429
  74. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Headers/PayUUPIBoltUIKit.h +0 -18
  75. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Info.plist +0 -0
  76. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/AlertVC.nib/objects-14.0+.nib +0 -0
  77. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/AlertVC.nib/runtime.nib +0 -0
  78. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/Info.plist +0 -0
  79. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/LoaderVC.nib/objects-14.0+.nib +0 -0
  80. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/LoaderVC.nib/runtime.nib +0 -0
  81. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/SplashVC.nib/objects-14.0+.nib +0 -0
  82. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/SplashVC.nib/runtime.nib +0 -0
  83. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/Wor-5i-mMX-view-Nxk-7R-Z2i.nib/objects-14.0+.nib +0 -0
  84. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/Wor-5i-mMX-view-Nxk-7R-Z2i.nib/runtime.nib +0 -0
  85. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/Y6W-OH-hqX-view-5EZ-qb-Rvc.nib/objects-14.0+.nib +0 -0
  86. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/Y6W-OH-hqX-view-5EZ-qb-Rvc.nib/runtime.nib +0 -0
  87. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/glG-Pl-xyr-view-kkS-eo-qEF.nib/objects-14.0+.nib +0 -0
  88. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Main.storyboardc/glG-Pl-xyr-view-kkS-eo-qEF.nib/runtime.nib +0 -0
  89. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/ManageAccountCell.nib/objects-14.0+.nib +0 -0
  90. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/ManageAccountCell.nib/runtime.nib +0 -0
  91. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/23N-Hb-U9p-view-ZTP-jN-g38.nib/objects-14.0+.nib +0 -0
  92. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/23N-Hb-U9p-view-ZTP-jN-g38.nib/runtime.nib +0 -0
  93. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/DisputeListVC.nib/objects-14.0+.nib +0 -0
  94. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/DisputeListVC.nib/runtime.nib +0 -0
  95. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/Info.plist +0 -0
  96. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/LinkedUPIAccountsVC.nib/objects-14.0+.nib +0 -0
  97. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/LinkedUPIAccountsVC.nib/runtime.nib +0 -0
  98. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/ManageAccountVC.nib/objects-14.0+.nib +0 -0
  99. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/ManageAccountVC.nib/runtime.nib +0 -0
  100. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/RE9-kn-MMI-view-GNf-PN-KeK.nib/objects-14.0+.nib +0 -0
  101. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/RE9-kn-MMI-view-GNf-PN-KeK.nib/runtime.nib +0 -0
  102. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/RaiseDisputeVC.nib/objects-14.0+.nib +0 -0
  103. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/RaiseDisputeVC.nib/runtime.nib +0 -0
  104. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/TransactionDetailsVC.nib/objects-14.0+.nib +0 -0
  105. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/TransactionDetailsVC.nib/runtime.nib +0 -0
  106. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/TransactionHistoryVC.nib/objects-14.0+.nib +0 -0
  107. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/TransactionHistoryVC.nib/runtime.nib +0 -0
  108. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/Y6W-OH-hqX-view-5EZ-qb-Rvc.nib/objects-14.0+.nib +0 -0
  109. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/Y6W-OH-hqX-view-5EZ-qb-Rvc.nib/runtime.nib +0 -0
  110. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/bAM-wM-00E-view-bl7-0k-6X8.nib/objects-14.0+.nib +0 -0
  111. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/bAM-wM-00E-view-bl7-0k-6X8.nib/runtime.nib +0 -0
  112. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/g0i-NM-a5i-view-Zrd-Kr-sDW.nib/objects-14.0+.nib +0 -0
  113. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/g0i-NM-a5i-view-Zrd-Kr-sDW.nib/runtime.nib +0 -0
  114. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/vx9-s8-3lY-view-V8x-bx-en5.nib/objects-14.0+.nib +0 -0
  115. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Management.storyboardc/vx9-s8-3lY-view-V8x-bx-en5.nib/runtime.nib +0 -0
  116. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Modules/PayUUPIBoltUIKit.swiftmodule/arm64-apple-ios.abi.json +0 -6425
  117. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Modules/PayUUPIBoltUIKit.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -85
  118. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Modules/PayUUPIBoltUIKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  119. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Modules/PayUUPIBoltUIKit.swiftmodule/arm64-apple-ios.swiftinterface +0 -85
  120. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/Modules/module.modulemap +0 -11
  121. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/NavigationView.nib +0 -0
  122. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/PayUUPIBoltUIKit +0 -0
  123. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/BjH-Ss-1nk-view-hG7-Ri-AON.nib/objects-14.0+.nib +0 -0
  124. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/BjH-Ss-1nk-view-hG7-Ri-AON.nib/runtime.nib +0 -0
  125. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/DeviceBindingVC.nib/objects-14.0+.nib +0 -0
  126. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/DeviceBindingVC.nib/runtime.nib +0 -0
  127. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/Info.plist +0 -0
  128. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/PaymentBankVC.nib/objects-14.0+.nib +0 -0
  129. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/PaymentBankVC.nib/runtime.nib +0 -0
  130. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/SelectBankVC.nib/objects-14.0+.nib +0 -0
  131. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/SelectBankVC.nib/runtime.nib +0 -0
  132. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/SetPinVC.nib/objects-14.0+.nib +0 -0
  133. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/SetPinVC.nib/runtime.nib +0 -0
  134. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/SetUPIIDVC.nib/objects-14.0+.nib +0 -0
  135. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/SetUPIIDVC.nib/runtime.nib +0 -0
  136. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/SettingUpUPIAccountVC.nib/objects-14.0+.nib +0 -0
  137. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/SettingUpUPIAccountVC.nib/runtime.nib +0 -0
  138. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/WelcomeVC.nib/objects-14.0+.nib +0 -0
  139. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/WelcomeVC.nib/runtime.nib +0 -0
  140. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/Yyd-mq-ZmA-view-VAi-eC-GAA.nib/objects-14.0+.nib +0 -0
  141. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/Yyd-mq-ZmA-view-VAi-eC-GAA.nib/runtime.nib +0 -0
  142. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/apc-7P-iG4-view-wzU-3z-wbH.nib/objects-14.0+.nib +0 -0
  143. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/apc-7P-iG4-view-wzU-3z-wbH.nib/runtime.nib +0 -0
  144. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/h3Q-Em-6CV-view-V6R-Aw-5bt.nib/objects-14.0+.nib +0 -0
  145. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/h3Q-Em-6CV-view-V6R-Aw-5bt.nib/runtime.nib +0 -0
  146. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/lpa-IT-gq6-view-e2f-rO-zjr.nib/objects-14.0+.nib +0 -0
  147. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/lpa-IT-gq6-view-e2f-rO-zjr.nib/runtime.nib +0 -0
  148. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/n2u-x0-k4J-view-tpH-a0-VXl.nib/objects-14.0+.nib +0 -0
  149. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/n2u-x0-k4J-view-tpH-a0-VXl.nib/runtime.nib +0 -0
  150. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/xhg-Pf-bK2-view-lBm-v5-T4w.nib/objects-14.0+.nib +0 -0
  151. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/RegisterAndPayment.storyboardc/xhg-Pf-bK2-view-lBm-v5-T4w.nib/runtime.nib +0 -0
  152. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/SelectBankTableViewCell.nib +0 -0
  153. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/TransactionHistoryCell.nib +0 -0
  154. package/ios/Framework/PayUUPIBoltUIKit.xcframework/ios-arm64/PayUUPIBoltUIKit.framework/_CodeSignature/CodeResources +0 -1059
  155. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/Info.plist +0 -27
  156. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Headers/PayUUPIDontUseThisClass.h +0 -40
  157. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Headers/PayUUPIHdfcPluginKit-Swift.h +0 -368
  158. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Headers/PayUUPIHdfcPluginKit.h +0 -20
  159. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Info.entitlements +0 -0
  160. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Info.plist +0 -0
  161. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Modules/PayUUPIHdfcPluginKit.swiftmodule/arm64-apple-ios.abi.json +0 -5588
  162. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Modules/PayUUPIHdfcPluginKit.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -68
  163. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Modules/PayUUPIHdfcPluginKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  164. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Modules/PayUUPIHdfcPluginKit.swiftmodule/arm64-apple-ios.swiftinterface +0 -68
  165. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/Modules/module.modulemap +0 -11
  166. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/PayUUPIHdfcPluginKit +0 -0
  167. package/ios/Framework/PayUUPIHdfcPluginKit.xcframework/ios-arm64/PayUUPIHdfcPluginKit.framework/_CodeSignature/CodeResources +0 -212
@@ -1,35 +0,0 @@
1
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)r.d(n,s,function(t){return e[t]}.bind(null,s));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=25)}([function(e,t,r){"use strict";r.d(t,"r",(function(){return y})),r.d(t,"g",(function(){return v})),r.d(t,"d",(function(){return E})),r.d(t,"v",(function(){return C})),r.d(t,"w",(function(){return k})),r.d(t,"n",(function(){return O})),r.d(t,"q",(function(){return x})),r.d(t,"b",(function(){return D})),r.d(t,"m",(function(){return P})),r.d(t,"h",(function(){return R})),r.d(t,"p",(function(){return U})),r.d(t,"A",(function(){return _})),r.d(t,"c",(function(){return q})),r.d(t,"z",(function(){return G})),r.d(t,"o",(function(){return Y})),r.d(t,"s",(function(){return Q})),r.d(t,"x",(function(){return $})),r.d(t,"B",(function(){return z})),r.d(t,"l",(function(){return Z})),r.d(t,"k",(function(){return ee})),r.d(t,"C",(function(){return te})),r.d(t,"i",(function(){return re})),r.d(t,"e",(function(){return ne})),r.d(t,"y",(function(){return se})),r.d(t,"j",(function(){return ie})),r.d(t,"f",(function(){return he})),r.d(t,"a",(function(){return fe})),r.d(t,"u",(function(){return me})),r.d(t,"t",(function(){return pe})),r.d(t,"E",(function(){return ge})),r.d(t,"D",(function(){return be}));var n=r(1);function s(){if("undefined"==typeof BigInt)throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function i(e){let t=0,r=0;for(let r=0;r<e.length;r++){t+=e[r].byteLength}const n=new ArrayBuffer(t),s=new Uint8Array(n);for(let t=0;t<e.length;t++){const n=e[t];s.set(new Uint8Array(n),r),r+=n.byteLength}return n}const a=[new Uint8Array([1])],o="name",u="value",c=new ArrayBuffer(0);class l{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return i(this.items)}}class h{constructor(e={}){this.blockLength=Object(n.f)(e,"blockLength",0),this.error=Object(n.f)(e,"error",""),this.warnings=Object(n.f)(e,"warnings",[]),this.valueBeforeDecode="valueBeforeDecode"in e?e.valueBeforeDecode.slice(0):c}static blockName(){return"baseBlock"}toJSON(){return{blockName:this.constructor.blockName(),blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:Object(n.b)(this.valueBeforeDecode,0,this.valueBeforeDecode.byteLength)}}}const f=e=>class extends e{constructor(e={}){super(e),this.isHexOnly=Object(n.f)(e,"isHexOnly",!1),this.valueHex="valueHex"in e?e.valueHex.slice(0):c}static blockName(){return"hexBlock"}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;return 0===new Uint8Array(e,t,r).length?(this.warnings.push("Zero buffer length"),t):(this.valueHex=e.slice(t,t+r),this.blockLength=r,t+r)}toBER(e=!1){return!0!==this.isHexOnly?(this.error='Flag "isHexOnly" is not set, abort',c):!0===e?new ArrayBuffer(this.valueHex.byteLength):this.valueHex.slice(0)}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.blockName=this.constructor.blockName(),e.isHexOnly=this.isHexOnly,e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e}};class m extends(f(h)){constructor(e={}){super(),"idBlock"in e?(this.isHexOnly=Object(n.f)(e.idBlock,"isHexOnly",!1),this.valueHex=Object(n.f)(e.idBlock,"valueHex",c),this.tagClass=Object(n.f)(e.idBlock,"tagClass",-1),this.tagNumber=Object(n.f)(e.idBlock,"tagNumber",-1),this.isConstructed=Object(n.f)(e.idBlock,"isConstructed",!1)):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}static blockName(){return"identificationBlock"}toBER(e=!1){let t,r,s=0;switch(this.tagClass){case 1:s|=0;break;case 2:s|=64;break;case 3:s|=128;break;case 4:s|=192;break;default:return this.error="Unknown tag class",c}if(this.isConstructed&&(s|=32),this.tagNumber<31&&!this.isHexOnly){if(t=new ArrayBuffer(1),r=new Uint8Array(t),!e){let e=this.tagNumber;e&=31,s|=e,r[0]=s}return t}if(!1===this.isHexOnly){const i=Object(n.q)(this.tagNumber,7),a=new Uint8Array(i),o=i.byteLength;if(t=new ArrayBuffer(o+1),r=new Uint8Array(t),r[0]=31|s,!e){for(let e=0;e<o-1;e++)r[e+1]=128|a[e];r[o]=a[o-1]}return t}if(t=new ArrayBuffer(this.valueHex.byteLength+1),r=new Uint8Array(t),r[0]=31|s,!1===e){const e=new Uint8Array(this.valueHex);for(let t=0;t<e.length-1;t++)r[t+1]=128|e[t];r[this.valueHex.byteLength]=e[e.length-1]}return t}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;const s=new Uint8Array(e,t,r);if(0===s.length)return this.error="Zero buffer length",-1;switch(192&s[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=32==(32&s[0]),this.isHexOnly=!1;const i=31&s[0];if(31!==i)this.tagNumber=i,this.blockLength=1;else{let e=1;this.valueHex=new ArrayBuffer(255);let t=255,r=new Uint8Array(this.valueHex);for(;128&s[e];){if(r[e-1]=127&s[e],e++,e>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(e===t){t+=255;const e=new ArrayBuffer(t),n=new Uint8Array(e);for(let e=0;e<r.length;e++)n[e]=r[e];this.valueHex=new ArrayBuffer(t),r=new Uint8Array(this.valueHex)}}this.blockLength=e+1,r[e-1]=127&s[e];const i=new ArrayBuffer(e),a=new Uint8Array(i);for(let t=0;t<e;t++)a[t]=r[t];this.valueHex=new ArrayBuffer(e),r=new Uint8Array(this.valueHex),r.set(a),this.blockLength<=9?this.tagNumber=Object(n.p)(r,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.blockName=this.constructor.blockName(),e.tagClass=this.tagClass,e.tagNumber=this.tagNumber,e.isConstructed=this.isConstructed,e}}class p extends h{constructor(e={}){super(),"lenBlock"in e?(this.isIndefiniteForm=Object(n.f)(e.lenBlock,"isIndefiniteForm",!1),this.longFormUsed=Object(n.f)(e.lenBlock,"longFormUsed",!1),this.length=Object(n.f)(e.lenBlock,"length",0)):(this.isIndefiniteForm=!1,this.longFormUsed=!1,this.length=0)}static blockName(){return"lengthBlock"}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;const s=new Uint8Array(e,t,r);if(0===s.length)return this.error="Zero buffer length",-1;if(255===s[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===s[0],!0===this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(128&s[0]),!1===this.longFormUsed)return this.length=s[0],this.blockLength=1,t+this.blockLength;const i=127&s[0];if(i>8)return this.error="Too big integer",-1;if(i+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const a=new Uint8Array(i);for(let e=0;e<i;e++)a[e]=s[e+1];return 0===a[i-1]&&this.warnings.push("Needlessly long encoded length"),this.length=Object(n.p)(a,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=i+1,t+this.blockLength}toBER(e=!1){let t,r;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&(r=new Uint8Array(t),r[0]=128),t;if(!0===this.longFormUsed){const s=Object(n.q)(this.length,8);if(s.byteLength>127)return this.error="Too big length",c;if(t=new ArrayBuffer(s.byteLength+1),!0===e)return t;const i=new Uint8Array(s);r=new Uint8Array(t),r[0]=128|s.byteLength;for(let e=0;e<s.byteLength;e++)r[e+1]=i[e];return t}return t=new ArrayBuffer(1),!1===e&&(r=new Uint8Array(t),r[0]=this.length),t}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.blockName=this.constructor.blockName(),e.isIndefiniteForm=this.isIndefiniteForm,e.longFormUsed=this.longFormUsed,e.length=this.length,e}}class d extends h{constructor(e={}){super(e)}static blockName(){return"valueBlock"}fromBER(e,t,r){throw TypeError('User need to make a specific function in a class which extends "ValueBlock"')}toBER(e=!1){throw TypeError('User need to make a specific function in a class which extends "ValueBlock"')}}class g extends h{constructor(e={},t=d){super(e),o in e&&(this.name=e.name),"optional"in e&&(this.optional=e.optional),"primitiveSchema"in e&&(this.primitiveSchema=e.primitiveSchema),this.idBlock=new m(e),this.lenBlock=new p(e),this.valueBlock=new t(e)}static blockName(){return"BaseBlock"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}toBER(e=!1,t){const r=t||new l;t||function e(t){if(t.idBlock.isConstructed)for(let r=0;r<t.valueBlock.value.length;r++)e(t.valueBlock.value[r])&&(t.lenBlock.isIndefiniteForm=!0);return!!t.lenBlock.isIndefiniteForm}(this);const n=this.idBlock.toBER(e);if(r.write(n),this.lenBlock.isIndefiniteForm)r.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,r),r.write(new ArrayBuffer(2));else{const t=this.valueBlock.toBER(!0);this.lenBlock.length=t.byteLength;const n=this.lenBlock.toBER(e);r.write(n);const s=e?new ArrayBuffer(this.lenBlock.length):this.valueBlock.toBER(e);r.write(s,r)}if(!t)return r.final()}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.idBlock=this.idBlock.toJSON(),e.lenBlock=this.lenBlock.toJSON(),e.valueBlock=this.valueBlock.toJSON(),o in this&&(e.name=this.name),"optional"in this&&(e.optional=this.optional),"primitiveSchema"in this&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(){return`${this.constructor.blockName()} : ${Object(n.b)(this.valueBlock.valueHex)}`}}class b extends d{constructor(e={}){super(e),this.valueHex="valueHex"in e?e.valueHex.slice(0):c,this.isHexOnly=Object(n.f)(e,"isHexOnly",!0)}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;const s=new Uint8Array(e,t,r);if(0===s.length)return this.warnings.push("Zero buffer length"),t;this.valueHex=new ArrayBuffer(s.length);const i=new Uint8Array(this.valueHex);for(let e=0;e<s.length;e++)i[e]=s[e];return this.blockLength=r,t+r}toBER(e=!1){return this.valueHex.slice(0)}static blockName(){return"PrimitiveValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e.isHexOnly=this.isHexOnly,e}}class y extends g{constructor(e={}){super(e,b),this.idBlock.isConstructed=!1}static blockName(){return"PRIMITIVE"}}class w extends d{constructor(e={}){super(e),this.value=Object(n.f)(e,u,[]),this.isIndefiniteForm=Object(n.f)(e,"isIndefiniteForm",!1)}fromBER(e,t,r){const s=t,i=r;if(!1===Object(n.c)(this,e,t,r))return-1;if(0===new Uint8Array(e,t,r).length)return this.warnings.push("Zero buffer length"),t;let a=t;for(;o=this.isIndefiniteForm,u=r,(!0===o?1:u)>0;){const t=de(e,a,r);if(-1===t.offset)return this.error=t.result.error,this.warnings.concat(t.result.warnings),-1;if(a=t.offset,this.blockLength+=t.result.blockLength,r-=t.result.blockLength,this.value.push(t.result),!0===this.isIndefiniteForm&&t.result.constructor.blockName()===A.blockName())break}var o,u;return!0===this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.blockName()===A.blockName()?this.value.pop():this.warnings.push("No EndOfContent block encoded")),this.valueBeforeDecode=e.slice(s,s+i),a}toBER(e=!1,t){const r=t||new l;for(let t=0;t<this.value.length;t++)this.value[t].toBER(e,r);if(!t)return r.final()}static blockName(){return"ConstructedValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}e.isIndefiniteForm=this.isIndefiniteForm,e.value=[];for(let t=0;t<this.value.length;t++)e.value.push(this.value[t].toJSON());return e}}class v extends g{constructor(e={}){super(e,w),this.idBlock.isConstructed=!0}static blockName(){return"CONSTRUCTED"}fromBER(e,t,r){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}toString(){const e=[];for(const t of this.valueBlock.value)e.push(t.toString().split("\n").map(e=>" "+e).join("\n"));const t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.blockName();return e.length?`${t} :\n${e.join("\n")}`:t+" :"}}class N extends d{constructor(e={}){super(e)}fromBER(e,t,r){return t}toBER(e=!1){return c}static blockName(){return"EndOfContentValueBlock"}}class A extends g{constructor(e={}){super(e,N),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}static blockName(){return"EndOfContent"}}class S extends d{constructor(e={}){if(super(e),this.value=Object(n.f)(e,u,!1),this.isHexOnly=Object(n.f)(e,"isHexOnly",!1),"valueHex"in e)this.valueHex=e.valueHex.slice(0);else if(this.valueHex=new ArrayBuffer(1),!0===this.value){new Uint8Array(this.valueHex)[0]=255}}fromBER(e,t,r){if(!1===Object(n.c)(this,e,t,r))return-1;const s=new Uint8Array(e,t,r);r>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,this.valueHex=new ArrayBuffer(s.length);const i=new Uint8Array(this.valueHex);for(let e=0;e<s.length;e++)i[e]=s[e];return 0!==n.n.call(this)?this.value=!0:this.value=!1,this.blockLength=r,t+r}toBER(e=!1){return this.valueHex}static blockName(){return"BooleanValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e.isHexOnly=this.isHexOnly,e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e}}class E extends g{constructor(e={}){super(e,S),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}static blockName(){return"BOOLEAN"}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class C extends v{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}static blockName(){return"SEQUENCE"}}class k extends v{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}static blockName(){return"SET"}}class O extends g{constructor(e={}){super(e,h),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}static blockName(){return"NULL"}fromBER(e,t,r){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=r,t+r>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+r}toBER(e=!1,t){const r=new ArrayBuffer(2);if(!e){const e=new Uint8Array(r);e[0]=5,e[1]=0}return t&&t.write(r),r}toString(){return""+this.constructor.blockName()}}class I extends(f(w)){constructor(e={}){super(e),this.isConstructed=Object(n.f)(e,"isConstructed",!1)}fromBER(e,t,r){let n=0;if(!0===this.isConstructed){if(this.isHexOnly=!1,n=w.prototype.fromBER.call(this,e,t,r),-1===n)return n;for(let e=0;e<this.value.length;e++){const t=this.value[e].constructor.blockName();if(t===A.blockName()){if(!0===this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(t!==x.blockName())return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,n=super.fromBER(e,t,r),this.blockLength=r;return n}toBER(e=!1,t){if(!0===this.isConstructed)return w.prototype.toBER.call(this,e,t);let r=new ArrayBuffer(this.valueHex.byteLength);return!0===e||0===this.valueHex.byteLength||(r=this.valueHex.slice(0)),r}static blockName(){return"OctetStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.isConstructed=this.isConstructed,e.isHexOnly=this.isHexOnly,e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e}}class x extends g{constructor(e={}){super(e,I),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,r){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===r)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const n=e.slice(t,t+r);try{const e=ge(n);-1!==e.offset&&e.offset===r&&(this.valueBlock.value=[e.result])}catch(e){}}return super.fromBER(e,t,r)}static blockName(){return"OCTET STRING"}isEqual(e){return e instanceof x!=!1&&JSON.stringify(this)===JSON.stringify(e)}toString(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?v.prototype.toString.call(this):`${this.constructor.blockName()} : ${Object(n.b)(this.valueBlock.valueHex)}`}}class B extends(f(w)){constructor(e={}){super(e),this.unusedBits=Object(n.f)(e,"unusedBits",0),this.isConstructed=Object(n.f)(e,"isConstructed",!1),this.blockLength=this.valueHex.byteLength}fromBER(e,t,r){if(0===r)return t;let s=-1;if(!0===this.isConstructed){if(s=w.prototype.fromBER.call(this,e,t,r),-1===s)return s;for(let e=0;e<this.value.length;e++){const t=this.value[e].constructor.blockName();if(t===A.blockName()){if(!0===this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(t!==D.blockName())return this.error="BIT STRING may consists of BIT STRINGs only",-1;if(this.unusedBits>0&&this.value[e].valueBlock.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;if(this.unusedBits=this.value[e].valueBlock.unusedBits,this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1}return s}if(!1===Object(n.c)(this,e,t,r))return-1;const i=new Uint8Array(e,t,r);if(this.unusedBits=i[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const n=e.slice(t+1,t+r);try{const e=ge(n);-1!==e.offset&&e.offset===r-1&&(this.value=[e.result])}catch(e){}}this.valueHex=new ArrayBuffer(i.length-1);const a=new Uint8Array(this.valueHex);for(let e=0;e<r-1;e++)a[e]=i[e+1];return this.blockLength=i.length,t+r}toBER(e=!1,t){if(!0===this.isConstructed)return w.prototype.toBER.call(this,e,t);if(!0===e)return new ArrayBuffer(this.valueHex.byteLength+1);if(0===this.valueHex.byteLength)return c;const r=new Uint8Array(this.valueHex),n=new ArrayBuffer(this.valueHex.byteLength+1),s=new Uint8Array(n);s[0]=this.unusedBits;for(let e=0;e<this.valueHex.byteLength;e++)s[e+1]=r[e];return n}static blockName(){return"BitStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.unusedBits=this.unusedBits,e.isConstructed=this.isConstructed,e.isHexOnly=this.isHexOnly,e.valueHex=Object(n.b)(this.valueHex,0,this.valueHex.byteLength),e}}class D extends g{constructor(e={}){super(e,B),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}static blockName(){return"BIT STRING"}fromBER(e,t,r){return 0===r?t:(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,r))}isEqual(e){return e instanceof D!=!1&&JSON.stringify(this)===JSON.stringify(e)}toString(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return v.prototype.toString.call(this);{const e=[],t=new Uint8Array(this.valueBlock.valueHex);for(const r of t)e.push(r.toString(2).padStart(8,"0"));return`${this.constructor.blockName()} : ${e.join("")}`}}}class T extends(f(d)){constructor(e={}){super(e),u in e&&(this.valueDec=e.value)}set valueHex(e){this._valueHex=e.slice(0),e.byteLength>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,e.byteLength>0&&(this._valueDec=n.n.call(this)))}get valueHex(){return this._valueHex}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this._valueHex=Object(n.o)(e)}get valueDec(){return this._valueDec}fromDER(e,t,r,n=0){const s=this.fromBER(e,t,r);if(-1===s)return s;const i=new Uint8Array(this._valueHex);if(0===i[0]&&0!=(128&i[1])){const e=new ArrayBuffer(this._valueHex.byteLength-1);new Uint8Array(e).set(new Uint8Array(this._valueHex,1,this._valueHex.byteLength-1)),this._valueHex=e.slice(0)}else if(0!==n&&this._valueHex.byteLength<n){n-this._valueHex.byteLength>1&&(n=this._valueHex.byteLength+1);const e=new ArrayBuffer(n);new Uint8Array(e).set(i,n-this._valueHex.byteLength),this._valueHex=e.slice(0)}return s}toDER(e=!1){const t=new Uint8Array(this._valueHex);switch(!0){case 0!=(128&t[0]):{const e=new ArrayBuffer(this._valueHex.byteLength+1),r=new Uint8Array(e);r[0]=0,r.set(t,1),this._valueHex=e.slice(0)}break;case 0===t[0]&&0==(128&t[1]):{const e=new ArrayBuffer(this._valueHex.byteLength-1);new Uint8Array(e).set(new Uint8Array(this._valueHex,1,this._valueHex.byteLength-1)),this._valueHex=e.slice(0)}}return this.toBER(e)}fromBER(e,t,r){const n=super.fromBER(e,t,r);return-1===n?n:(this.blockLength=r,t+r)}toBER(e=!1){return this.valueHex.slice(0)}static blockName(){return"IntegerValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.valueDec=this.valueDec,e}toString(){function e(e,t){const r=new Uint8Array([0]);let s=new Uint8Array(e),i=new Uint8Array(t),a=s.slice(0);const o=a.length-1;let u=i.slice(0);const c=u.length-1;let l=0;let h=0;for(let e=c<o?o:c;e>=0;e--,h++){switch(!0){case h<u.length:l=a[o-h]+u[c-h]+r[0];break;default:l=a[o-h]+r[0]}switch(r[0]=l/10,!0){case h>=a.length:a=Object(n.m)(new Uint8Array([l%10]),a);break;default:a[o-h]=l%10}}return r[0]>0&&(a=Object(n.m)(r,a)),a.slice(0)}function t(e){if(e>=a.length)for(let t=a.length;t<=e;t++){const e=new Uint8Array([0]);let r=a[t-1].slice(0);for(let t=r.length-1;t>=0;t--){const n=new Uint8Array([(r[t]<<1)+e[0]]);e[0]=n[0]/10,r[t]=n[0]%10}e[0]>0&&(r=Object(n.m)(e,r)),a.push(r)}return a[e]}function r(e,t){let r=0,n=new Uint8Array(e),s=new Uint8Array(t),i=n.slice(0);const a=i.length-1;let o=s.slice(0);const u=o.length-1;let c,l=0;for(let e=u;e>=0;e--,l++)switch(c=i[a-l]-o[u-l]-r,!0){case c<0:r=1,i[a-l]=c+10;break;default:r=0,i[a-l]=c}if(r>0)for(let e=a-u+1;e>=0;e--,l++){if(c=i[a-l]-r,!(c<0)){r=0,i[a-l]=c;break}r=1,i[a-l]=c+10}return i.slice()}const s=8*this._valueHex.byteLength-1;let i,o=new Uint8Array(8*this._valueHex.byteLength/3),u=0;const c=new Uint8Array(this._valueHex);let l="",h=!1;for(let n=this._valueHex.byteLength-1;n>=0;n--){i=c[n];for(let n=0;n<8;n++){if(1==(1&i))switch(u){case s:o=r(t(u),o),l="-";break;default:o=e(o,t(u))}u++,i>>=1}}for(let e=0;e<o.length;e++)o[e]&&(h=!0),h&&(l+="0123456789".charAt(o[e]));return!1===h&&(l+="0123456789".charAt(0)),l}}class P extends g{constructor(e={}){super(e,T),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}static blockName(){return"INTEGER"}isEqual(e){return e instanceof P?this.valueBlock.isHexOnly&&e.valueBlock.isHexOnly?Object(n.g)(this.valueBlock.valueHex,e.valueBlock.valueHex):this.valueBlock.isHexOnly===e.valueBlock.isHexOnly&&this.valueBlock.valueDec===e.valueBlock.valueDec:e instanceof ArrayBuffer&&Object(n.g)(this.valueBlock.valueHex,e)}convertToDER(){const e=new P({valueHex:this.valueBlock.valueHex});return e.valueBlock.toDER(),e}convertFromDER(){const e=this.valueBlock.valueHex.byteLength%2?this.valueBlock.valueHex.byteLength+1:this.valueBlock.valueHex.byteLength,t=new P({valueHex:this.valueBlock.valueHex});return t.valueBlock.fromDER(t.valueBlock.valueHex,0,t.valueBlock.valueHex.byteLength,e),t}toString(){s();const e=Object(n.b)(this.valueBlock.valueHex),t=BigInt("0x"+e);return`${this.constructor.blockName()} : ${t.toString()}`}}class R extends P{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}static blockName(){return"ENUMERATED"}}class j extends(f(h)){constructor(e={}){super(e),this.valueDec=Object(n.f)(e,"valueDec",-1),this.isFirstSid=Object(n.f)(e,"isFirstSid",!1)}static blockName(){return"sidBlock"}fromBER(e,t,r){if(0===r)return t;if(!1===Object(n.c)(this,e,t,r))return-1;const s=new Uint8Array(e,t,r);this.valueHex=new ArrayBuffer(r);let i=new Uint8Array(this.valueHex);for(let e=0;e<r&&(i[e]=127&s[e],this.blockLength++,0!=(128&s[e]));e++);const a=new ArrayBuffer(this.blockLength),o=new Uint8Array(a);for(let e=0;e<this.blockLength;e++)o[e]=i[e];return this.valueHex=a.slice(0),i=new Uint8Array(this.valueHex),0!=(128&s[this.blockLength-1])?(this.error="End of input reached before message was fully decoded",-1):(0===i[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Object(n.p)(i,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){s();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const r=new Uint8Array(t.length/7);for(let e=0;e<r.length;e++)r[e]=parseInt(t.slice(7*e,7*e+7),2)+(e+1<r.length?128:0);this.fromBER(r.buffer,0,r.length)}toBER(e=!1){let t,r;if(this.isHexOnly){if(!0===e)return new ArrayBuffer(this.valueHex.byteLength);const n=new Uint8Array(this.valueHex);t=new ArrayBuffer(this.blockLength),r=new Uint8Array(t);for(let e=0;e<this.blockLength-1;e++)r[e]=128|n[e];return r[this.blockLength-1]=n[this.blockLength-1],t}const s=Object(n.q)(this.valueDec,7);if(0===s.byteLength)return this.error="Error during encoding SID value",c;if(t=new ArrayBuffer(s.byteLength),!1===e){const e=new Uint8Array(s);r=new Uint8Array(t);for(let t=0;t<s.byteLength-1;t++)r[t]=128|e[t];r[s.byteLength-1]=e[s.byteLength-1]}return t}toString(){let e="";if(!0===this.isHexOnly)e=Object(n.b)(this.valueHex,0,this.valueHex.byteLength);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.valueDec=this.valueDec,e.isFirstSid=this.isFirstSid,e}}class L extends d{constructor(e={}){super(e),this.fromString(Object(n.f)(e,u,""))}fromBER(e,t,r){let n=t;for(;r>0;){const t=new j;if(n=t.fromBER(e,n,r),-1===n)return this.blockLength=0,this.error=t.error,n;0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return n}toBER(e=!1){const t=[];for(let r=0;r<this.value.length;r++){const n=this.value[r].toBER(e);if(0===n.byteLength)return this.error=this.value[r].error,c;t.push(n)}return i(t)}fromString(e){this.value=[];let t=0,r=0,n="",i=!1;do{if(r=e.indexOf(".",t),n=-1===r?e.substr(t):e.substr(t,r-t),t=r+1,i){const e=this.value[0];let t=0;switch(e.valueDec){case 0:break;case 1:t=40;break;case 2:t=80;break;default:return this.value=[],!1}const r=parseInt(n,10);if(isNaN(r))return!0;e.valueDec=r+t,i=!1}else{const e=new j;if(n>Number.MAX_SAFE_INTEGER){s();const t=BigInt(n);e.valueBigInt=t}else if(e.valueDec=parseInt(n,10),isNaN(e.valueDec))return!0;0===this.value.length&&(e.isFirstSid=!0,i=!0),this.value.push(e)}}while(-1!==r);return!0}toString(){let e="",t=!1;for(let r=0;r<this.value.length;r++){t=this.value[r].isHexOnly;let n=this.value[r].toString();0!==r&&(e+="."),t?(n=`{${n}}`,this.value[r].isFirstSid?e=`2.{${n} - 80}`:e+=n):e+=n}return e}static blockName(){return"ObjectIdentifierValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}e.value=this.toString(),e.sidArray=[];for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}class U extends g{constructor(e={}){super(e,L),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}static blockName(){return"OBJECT IDENTIFIER"}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.toString()}`}}class V extends(f(h)){constructor(e={}){super(e),this.isHexOnly=!0,this.value=""}static blockName(){return"Utf8StringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e}}class _ extends g{constructor(e={}){super(e,V),u in e&&this.fromString(e.value),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}static blockName(){return"UTF8String"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,new Uint8Array(e));try{this.valueBlock.value=decodeURIComponent(escape(this.valueBlock.value))}catch(e){this.warnings.push(`Error during "decodeURIComponent": ${e}, using raw string`)}}fromString(e){const t=unescape(encodeURIComponent(e)),r=t.length;this.valueBlock.valueHex=new ArrayBuffer(r);const n=new Uint8Array(this.valueBlock.valueHex);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);this.valueBlock.value=e}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class H extends(f(h)){constructor(e={}){super(e),this.valueDec=Object(n.f)(e,"valueDec",-1)}static blockName(){return"relativeSidBlock"}fromBER(e,t,r){if(0===r)return t;if(!1===Object(n.c)(this,e,t,r))return-1;const s=new Uint8Array(e,t,r);this.valueHex=new ArrayBuffer(r);let i=new Uint8Array(this.valueHex);for(let e=0;e<r&&(i[e]=127&s[e],this.blockLength++,0!=(128&s[e]));e++);const a=new ArrayBuffer(this.blockLength),o=new Uint8Array(a);for(let e=0;e<this.blockLength;e++)o[e]=i[e];return this.valueHex=a.slice(0),i=new Uint8Array(this.valueHex),0!=(128&s[this.blockLength-1])?(this.error="End of input reached before message was fully decoded",-1):(0===i[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Object(n.p)(i,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e=!1){let t,r;if(this.isHexOnly){if(!0===e)return new ArrayBuffer(this.valueHex.byteLength);const n=new Uint8Array(this.valueHex);t=new ArrayBuffer(this.blockLength),r=new Uint8Array(t);for(let e=0;e<this.blockLength-1;e++)r[e]=128|n[e];return r[this.blockLength-1]=n[this.blockLength-1],t}const s=Object(n.q)(this.valueDec,7);if(0===s.byteLength)return this.error="Error during encoding SID value",c;if(t=new ArrayBuffer(s.byteLength),!1===e){const e=new Uint8Array(s);r=new Uint8Array(t);for(let t=0;t<s.byteLength-1;t++)r[t]=128|e[t];r[s.byteLength-1]=e[s.byteLength-1]}return t}toString(){let e="";return e=!0===this.isHexOnly?Object(n.b)(this.valueHex,0,this.valueHex.byteLength):this.valueDec.toString(),e}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.valueDec=this.valueDec,e}}class M extends d{constructor(e={}){super(e),this.fromString(Object(n.f)(e,u,""))}fromBER(e,t,r){let n=t;for(;r>0;){const t=new H;if(n=t.fromBER(e,n,r),-1===n)return this.blockLength=0,this.error=t.error,n;this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return n}toBER(e=!1){let t=[];for(let r=0;r<this.value.length;r++){const n=this.value[r].toBER(e);if(0===n.byteLength)return this.error=this.value[r].error,c;t.push(n)}return i(t)}fromString(e){this.value=[];let t=0,r=0,n="";do{r=e.indexOf(".",t),n=-1===r?e.substr(t):e.substr(t,r-t),t=r+1;const s=new H;if(s.valueDec=parseInt(n,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(-1!==r);return!0}toString(){let e="",t=!1;for(let r=0;r<this.value.length;r++){t=this.value[r].isHexOnly;let n=this.value[r].toString();0!==r&&(e+="."),t?(n=`{${n}}`,e+=n):e+=n}return e}static blockName(){return"RelativeObjectIdentifierValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}e.value=this.toString(),e.sidArray=[];for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}class F extends g{constructor(e={}){super(e,M),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}static blockName(){return"RelativeObjectIdentifier"}}class K extends(f(h)){constructor(e={}){super(e),this.isHexOnly=!0,this.value=""}static blockName(){return"BmpStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e}}class q extends g{constructor(e={}){super(e,K),u in e&&this.fromString(e.value),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}static blockName(){return"BMPString"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){const t=e.slice(0),r=new Uint8Array(t);for(let e=0;e<r.length;e+=2){const t=r[e];r[e]=r[e+1],r[e+1]=t}this.valueBlock.value=String.fromCharCode.apply(null,new Uint16Array(t))}fromString(e){const t=e.length;this.valueBlock.valueHex=new ArrayBuffer(2*t);const r=new Uint8Array(this.valueBlock.valueHex);for(let s=0;s<t;s++){const t=Object(n.q)(e.charCodeAt(s),8),i=new Uint8Array(t);if(i.length>2)continue;const a=2-i.length;for(let e=i.length-1;e>=0;e--)r[2*s+e+a]=i[e]}this.valueBlock.value=e}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class J extends(f(h)){constructor(e={}){super(e),this.isHexOnly=!0,this.value=""}static blockName(){return"UniversalStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e}}class G extends g{constructor(e={}){super(e,J),u in e&&this.fromString(e.value),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}static blockName(){return"UniversalString"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){const t=e.slice(0),r=new Uint8Array(t);for(let e=0;e<r.length;e+=4)r[e]=r[e+3],r[e+1]=r[e+2],r[e+2]=0,r[e+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length;this.valueBlock.valueHex=new ArrayBuffer(4*t);const r=new Uint8Array(this.valueBlock.valueHex);for(let s=0;s<t;s++){const t=Object(n.q)(e.charCodeAt(s),8),i=new Uint8Array(t);if(i.length>4)continue;const a=4-i.length;for(let e=i.length-1;e>=0;e--)r[4*s+e+a]=i[e]}this.valueBlock.value=e}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class X extends(f(h)){constructor(e={}){super(e),this.value="",this.isHexOnly=!0}static blockName(){return"SimpleStringValueBlock"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.value=this.value,e}}class W extends g{constructor(e={}){super(e,X),u in e&&this.fromString(e.value)}static blockName(){return"SIMPLESTRING"}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,new Uint8Array(e))}fromString(e){const t=e.length;this.valueBlock.valueHex=new ArrayBuffer(t);const r=new Uint8Array(this.valueBlock.valueHex);for(let n=0;n<t;n++)r[n]=e.charCodeAt(n);this.valueBlock.value=e}toString(){return`${this.constructor.blockName()} : ${this.valueBlock.value}`}}class Y extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}static blockName(){return"NumericString"}}class Q extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}static blockName(){return"PrintableString"}}class $ extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}static blockName(){return"TeletexString"}}class z extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}static blockName(){return"VideotexString"}}class Z extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}static blockName(){return"IA5String"}}class ee extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}static blockName(){return"GraphicString"}}class te extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}static blockName(){return"VisibleString"}}class re extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}static blockName(){return"GeneralString"}}class ne extends W{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}static blockName(){return"CharacterString"}}class se extends te{constructor(e={}){if(super(e),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,u in e){this.fromString(e.value),this.valueBlock.valueHex=new ArrayBuffer(e.value.length);const t=new Uint8Array(this.valueBlock.valueHex);for(let r=0;r<e.value.length;r++)t[r]=e.value.charCodeAt(r)}"valueDate"in e&&(this.fromDate(e.valueDate),this.valueBlock.valueHex=this.toBuffer()),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,new Uint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const t=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi.exec(e);if(null===t)return void(this.error="Wrong input string for conversion");const r=parseInt(t[1],10);this.year=r>=50?1900+r:2e3+r,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(){const e=new Array(7);return e[0]=Object(n.i)(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=Object(n.i)(this.month,2),e[2]=Object(n.i)(this.day,2),e[3]=Object(n.i)(this.hour,2),e[4]=Object(n.i)(this.minute,2),e[5]=Object(n.i)(this.second,2),e[6]="Z",e.join("")}static blockName(){return"UTCTime"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.year=this.year,e.month=this.month,e.day=this.day,e.hour=this.hour,e.minute=this.minute,e.second=this.second,e}}class ie extends te{constructor(e={}){if(super(e),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,this.millisecond=0,u in e){this.fromString(e.value),this.valueBlock.valueHex=new ArrayBuffer(e.value.length);const t=new Uint8Array(this.valueBlock.valueHex);for(let r=0;r<e.value.length;r++)t[r]=e.value.charCodeAt(r)}"valueDate"in e&&(this.fromDate(e.valueDate),this.valueBlock.valueHex=this.toBuffer()),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromBER(e,t,r){const n=this.valueBlock.fromBER(e,t,!0===this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);return-1===n?(this.error=this.valueBlock.error,n):(this.fromBuffer(this.valueBlock.valueHex),0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),0===this.valueBlock.error.length&&(this.blockLength+=this.valueBlock.blockLength),n)}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,new Uint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds(),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t,r=!1,n="",s="",i=0,a=0,o=0;if("Z"===e[e.length-1])n=e.substr(0,e.length-1),r=!0;else{const t=new Number(e[e.length-1]);if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(r){if(-1!==n.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==n.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let e=1,t=n.indexOf("+"),r="";if(-1===t&&(t=n.indexOf("-"),e=-1),-1!==t){if(r=n.substr(t+1),n=n.substr(0,t),2!==r.length&&4!==r.length)throw new Error("Wrong input string for conversion");let s=new Number(r.substr(0,2));if(isNaN(s.valueOf()))throw new Error("Wrong input string for conversion");if(a=e*s,4===r.length){if(s=new Number(r.substr(2,2)),isNaN(s.valueOf()))throw new Error("Wrong input string for conversion");o=e*s}}}let u=n.indexOf(".");if(-1===u&&(u=n.indexOf(",")),-1!==u){const e=new Number("0"+n.substr(u));if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");i=e.valueOf(),s=n.substr(0,u)}else s=n;switch(!0){case 8===s.length:if(t=/(\d{4})(\d{2})(\d{2})/gi,-1!==u)throw new Error("Wrong input string for conversion");break;case 10===s.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==u){let e=60*i;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===s.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==u){let e=60*i;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===s.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==u){const e=1e3*i;this.millisecond=Math.floor(e)}break;default:throw new Error("Wrong input string for conversion")}const c=t.exec(s);if(null===c)throw new Error("Wrong input string for conversion");for(let e=1;e<c.length;e++)switch(e){case 1:this.year=parseInt(c[e],10);break;case 2:this.month=parseInt(c[e],10);break;case 3:this.day=parseInt(c[e],10);break;case 4:this.hour=parseInt(c[e],10)+a;break;case 5:this.minute=parseInt(c[e],10)+o;break;case 6:this.second=parseInt(c[e],10);break;default:throw new Error("Wrong input string for conversion")}if(!1===r){const e=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=e.getUTCFullYear(),this.month=e.getUTCMonth(),this.day=e.getUTCDay(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds(),this.millisecond=e.getUTCMilliseconds()}}toString(){const e=[];return e.push(Object(n.i)(this.year,4)),e.push(Object(n.i)(this.month,2)),e.push(Object(n.i)(this.day,2)),e.push(Object(n.i)(this.hour,2)),e.push(Object(n.i)(this.minute,2)),e.push(Object(n.i)(this.second,2)),0!==this.millisecond&&(e.push("."),e.push(Object(n.i)(this.millisecond,3))),e.push("Z"),e.join("")}static blockName(){return"GeneralizedTime"}toJSON(){let e={};try{e=super.toJSON()}catch(e){}return e.year=this.year,e.month=this.month,e.day=this.day,e.hour=this.hour,e.minute=this.minute,e.second=this.second,e.millisecond=this.millisecond,e}}class ae extends _{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}static blockName(){return"DATE"}}class oe extends _{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}static blockName(){return"TimeOfDay"}}class ue extends _{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}static blockName(){return"DateTime"}}class ce extends _{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}static blockName(){return"Duration"}}class le extends _{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}static blockName(){return"TIME"}}class he{constructor(e={}){this.value=Object(n.f)(e,u,[]),this.optional=Object(n.f)(e,"optional",!1)}}class fe{constructor(e={}){this.name=Object(n.f)(e,o,""),this.optional=Object(n.f)(e,"optional",!1)}}class me{constructor(e={}){this.name=Object(n.f)(e,o,""),this.optional=Object(n.f)(e,"optional",!1),this.value=Object(n.f)(e,u,new fe),this.local=Object(n.f)(e,"local",!1)}}class pe{constructor(e={}){this.data=Object(n.f)(e,"data",c)}fromBER(e,t,r){return this.data=e.slice(t,r),t+r}toBER(e=!1){return this.data}}function de(e,t,r){const s=t;let i=new g({},Object);const a=new h;if(!1===Object(n.c)(a,e,t,r))return i.error=a.error,{offset:-1,result:i};if(0===new Uint8Array(e,t,r).length)return i.error="Zero buffer length",{offset:-1,result:i};let o=i.idBlock.fromBER(e,t,r);if(i.warnings.concat(i.idBlock.warnings),-1===o)return i.error=i.idBlock.error,{offset:-1,result:i};if(t=o,r-=i.idBlock.blockLength,o=i.lenBlock.fromBER(e,t,r),i.warnings.concat(i.lenBlock.warnings),-1===o)return i.error=i.lenBlock.error,{offset:-1,result:i};if(t=o,r-=i.lenBlock.blockLength,!1===i.idBlock.isConstructed&&!0===i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let u=g;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&!1===i.idBlock.isHexOnly)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(!0===i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};u=A;break;case 1:u=E;break;case 2:u=P;break;case 3:u=D;break;case 4:u=x;break;case 5:u=O;break;case 6:u=U;break;case 10:u=R;break;case 12:u=_;break;case 13:u=F;break;case 14:u=le;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:u=C;break;case 17:u=k;break;case 18:u=Y;break;case 19:u=Q;break;case 20:u=$;break;case 21:u=z;break;case 22:u=Z;break;case 23:u=se;break;case 24:u=ie;break;case 25:u=ee;break;case 26:u=te;break;case 27:u=re;break;case 28:u=G;break;case 29:u=ne;break;case 30:u=q;break;case 31:u=ae;break;case 32:u=oe;break;case 33:u=ue;break;case 34:u=ce;break;default:{let e;e=!0===i.idBlock.isConstructed?new v:new y,e.idBlock=i.idBlock,e.lenBlock=i.lenBlock,e.warnings=i.warnings,i=e}}break;case 2:case 3:case 4:default:u=!0===i.idBlock.isConstructed?v:y}return i=function(e,t){if(e instanceof t)return e;const r=new t;return r.idBlock=e.idBlock,r.lenBlock=e.lenBlock,r.warnings=e.warnings,r.valueBeforeDecode=e.valueBeforeDecode.slice(0),r}(i,u),o=i.fromBER(e,t,!0===i.lenBlock.isIndefiniteForm?r:i.lenBlock.length),i.valueBeforeDecode=e.slice(s,s+i.blockLength),{offset:o,result:i}}function ge(e){if(0===e.byteLength){const e=new g({},Object);return e.error="Input buffer has zero length",{offset:-1,result:e}}return de(e,0,e.byteLength)}function be(e,t,r){if(r instanceof he){const n=!1;for(let n=0;n<r.value.length;n++){if(!0===be(e,t,r.value[n]).verified)return{verified:!0,result:e}}if(!1===n){const e={verified:!1,result:{error:"Wrong values for Choice type"}};return r.hasOwnProperty(o)&&(e.name=r.name),e}}if(r instanceof fe)return r.hasOwnProperty(o)&&(e[r.name]=t),{verified:!0,result:e};if(e instanceof Object==!1)return{verified:!1,result:{error:"Wrong root object"}};if(t instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(r instanceof Object==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("idBlock"in r==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("fromBER"in r.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("toBER"in r.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const n=r.idBlock.toBER(!1);if(0===n.byteLength)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(-1===r.idBlock.fromBER(n,0,n.byteLength))return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(!1===r.idBlock.hasOwnProperty("tagClass"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagClass!==t.idBlock.tagClass)return{verified:!1,result:e};if(!1===r.idBlock.hasOwnProperty("tagNumber"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagNumber!==t.idBlock.tagNumber)return{verified:!1,result:e};if(!1===r.idBlock.hasOwnProperty("isConstructed"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isConstructed!==t.idBlock.isConstructed)return{verified:!1,result:e};if("isHexOnly"in r.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isHexOnly!==t.idBlock.isHexOnly)return{verified:!1,result:e};if(!0===r.idBlock.isHexOnly){if("valueHex"in r.idBlock==!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const n=new Uint8Array(r.idBlock.valueHex),s=new Uint8Array(t.idBlock.valueHex);if(n.length!==s.length)return{verified:!1,result:e};for(let t=0;t<n.length;t++)if(n[t]!==s[1])return{verified:!1,result:e}}if(r.hasOwnProperty(o)&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&(e[r.name]=t)),!0===r.idBlock.isConstructed){let n=0,s={verified:!1},i=r.valueBlock.value.length;if(i>0&&r.valueBlock.value[0]instanceof me&&(i=t.valueBlock.value.length),0===i)return{verified:!0,result:e};if(0===t.valueBlock.value.length&&0!==r.valueBlock.value.length){let t=!0;for(let e=0;e<r.valueBlock.value.length;e++)t=t&&(r.valueBlock.value[e].optional||!1);return!0===t?{verified:!0,result:e}:(r.hasOwnProperty(o)&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&delete e[r.name]),e.error="Inconsistent object length",{verified:!1,result:e})}for(let a=0;a<i;a++)if(a-n>=t.valueBlock.value.length){if(!1===r.valueBlock.value[a].optional){const t={verified:!1,result:e};return e.error="Inconsistent length between ASN.1 data and schema",r.hasOwnProperty(o)&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&(delete e[r.name],t.name=r.name)),t}}else if(r.valueBlock.value[0]instanceof me){if(s=be(e,t.valueBlock.value[a],r.valueBlock.value[0].value),!1===s.verified){if(!0!==r.valueBlock.value[0].optional)return r.hasOwnProperty(o)&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&delete e[r.name]),s;n++}if(o in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){let n={};n="local"in r.valueBlock.value[0]&&!0===r.valueBlock.value[0].local?t:e,void 0===n[r.valueBlock.value[0].name]&&(n[r.valueBlock.value[0].name]=[]),n[r.valueBlock.value[0].name].push(t.valueBlock.value[a])}}else if(s=be(e,t.valueBlock.value[a-n],r.valueBlock.value[a]),!1===s.verified){if(!0!==r.valueBlock.value[a].optional)return r.hasOwnProperty(o)&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&delete e[r.name]),s;n++}if(!1===s.verified){const t={verified:!1,result:e};return r.hasOwnProperty(o)&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&(delete e[r.name],t.name=r.name)),t}return{verified:!0,result:e}}if("primitiveSchema"in r&&"valueHex"in t.valueBlock){const n=ge(t.valueBlock.valueHex);if(-1===n.offset){const t={verified:!1,result:n.result};return r.hasOwnProperty(o)&&(r.name=r.name.replace(/^\s+|\s+$/g,""),""!==r.name&&(delete e[r.name],t.name=r.name)),t}return be(e,n.result,r.primitiveSchema)}return{verified:!0,result:e}}},function(e,t,r){"use strict";function n(e,t,r){var n;return e instanceof Object==!1?r:null!==(n=e[t])&&void 0!==n?n:r}function s(e,t=0,r=e.byteLength-t,n=!1){let s="";for(const i of new Uint8Array(e,t,r)){const e=i.toString(16).toUpperCase();1===e.length&&(s+="0"),s+=e,n&&(s+=" ")}return s.trim()}function i(e,t,r,n){return t instanceof ArrayBuffer?t.byteLength?r<0?(e.error="Wrong parameter: inputOffset less than zero",!1):n<0?(e.error="Wrong parameter: inputLength less than zero",!1):!(t.byteLength-r-n<0)||(e.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(e.error="Wrong parameter: inputBuffer has zero length",!1):(e.error='Wrong parameter: inputBuffer must be "ArrayBuffer"',!1)}function a(e,t){let r=0;if(1===e.length)return e[0];for(let n=e.length-1;n>=0;n--)r+=e[e.length-1-n]*Math.pow(2,t*n);return r}function o(e,t,r=-1){const n=r;let s=e,i=0,a=Math.pow(2,t);for(let r=1;r<8;r++){if(e<a){let e;if(n<0)e=new ArrayBuffer(r),i=r;else{if(n<r)return new ArrayBuffer(0);e=new ArrayBuffer(n),i=n}const a=new Uint8Array(e);for(let e=r-1;e>=0;e--){const r=Math.pow(2,e*t);a[i-e-1]=Math.floor(s/r),s-=a[i-e-1]*r}return e}a*=Math.pow(2,t)}return new ArrayBuffer(0)}function u(...e){let t=0,r=0;for(const r of e)t+=r.byteLength;const n=new ArrayBuffer(t),s=new Uint8Array(n);for(const t of e)s.set(new Uint8Array(t),r),r+=t.byteLength;return n}function c(...e){let t=0,r=0;for(const r of e)t+=r.length;const n=new ArrayBuffer(t),s=new Uint8Array(n);for(const t of e)s.set(t,r),r+=t.length;return s}function l(){const e=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const t=255===e[0]&&128&e[1],r=0===e[0]&&0==(128&e[1]);(t||r)&&this.warnings.push("Needlessly long format")}const t=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(t);for(let e=0;e<this.valueHex.byteLength;e++)r[e]=0;r[0]=128&e[0];const n=a(r,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let t=0;t<this.valueHex.byteLength;t++)i[t]=e[t];i[0]&=127;return a(i,8)-n}function h(e){const t=e<0?-1*e:e;let r=128;for(let n=1;n<8;n++){if(t<=r){if(e<0){const e=o(r-t,8,n);return new Uint8Array(e)[0]|=128,e}let s=o(t,8,n),i=new Uint8Array(s);if(128&i[0]){const e=s.slice(0),t=new Uint8Array(e);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let r=0;r<e.byteLength;r++)i[r+1]=t[r];i[0]=0}return s}r*=Math.pow(2,8)}return new ArrayBuffer(0)}function f(e,t){if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let e=0;e<r.length;e++)if(r[e]!==n[e])return!1;return!0}function m(e,t){const r=e.toString(10);if(t<r.length)return"";const n=t-r.length,s=new Array(n);for(let e=0;e<n;e++)s[e]="0";return s.join("").concat(r)}r.d(t,"a",(function(){return y})),r.d(t,"b",(function(){return s})),r.d(t,"c",(function(){return i})),r.d(t,"d",(function(){return A})),r.d(t,"e",(function(){return b})),r.d(t,"f",(function(){return n})),r.d(t,"g",(function(){return f})),r.d(t,"h",(function(){return N})),r.d(t,"i",(function(){return m})),r.d(t,"j",(function(){return w})),r.d(t,"k",(function(){return g})),r.d(t,"l",(function(){return u})),r.d(t,"m",(function(){return c})),r.d(t,"n",(function(){return l})),r.d(t,"o",(function(){return h})),r.d(t,"p",(function(){return a})),r.d(t,"q",(function(){return o}));const p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";function g(e,t=!1,r=!1,n=!1){let s=0,i=0,a=0,o="";const u=t?d:p;if(n){let t=0;for(let r=0;r<e.length;r++)if(0!==e.charCodeAt(r)){t=r;break}e=e.slice(t)}for(;s<e.length;){const t=e.charCodeAt(s++);s>=e.length&&(i=1);const n=e.charCodeAt(s++);s>=e.length&&(a=1);const c=e.charCodeAt(s++),l=t>>2,h=(3&t)<<4|n>>4;let f=(15&n)<<2|c>>6,m=63&c;1===i?f=m=64:1===a&&(m=64),o+=r?64===f?`${u.charAt(l)}${u.charAt(h)}`:64===m?`${u.charAt(l)}${u.charAt(h)}${u.charAt(f)}`:`${u.charAt(l)}${u.charAt(h)}${u.charAt(f)}${u.charAt(m)}`:`${u.charAt(l)}${u.charAt(h)}${u.charAt(f)}${u.charAt(m)}`}return o}function b(e,t=!1,r=!1){const n=t?d:p;function s(e){for(let t=0;t<64;t++)if(n.charAt(t)===e)return t;return 64}function i(e){return 64===e?0:e}let a=0,o="";for(;a<e.length;){const t=s(e.charAt(a++)),r=a>=e.length?0:s(e.charAt(a++)),n=a>=e.length?0:s(e.charAt(a++)),u=a>=e.length?0:s(e.charAt(a++)),c=i(t)<<2|i(r)>>4,l=(15&i(r))<<4|i(n)>>2,h=(3&i(n))<<6|i(u);o+=String.fromCharCode(c),64!==n&&(o+=String.fromCharCode(l)),64!==u&&(o+=String.fromCharCode(h))}if(r){let e=-1;for(let t=o.length-1;t>=0;t--)if(0!==o.charCodeAt(t)){e=t;break}o=-1!==e?o.slice(0,e+1):""}return o}function y(e){let t="";const r=new Uint8Array(e);for(const e of r)t+=String.fromCharCode(e);return t}function w(e){const t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return r}const v=Math.log(2);function N(e){const t=Math.log(e)/v,r=Math.floor(t),n=Math.round(t);return r===n?r:n}function A(e,t){for(const r of t)delete e[r]}},function(e,t,r){"use strict";(function(e,n){r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return T})),r.d(t,"d",(function(){return v})),r.d(t,"e",(function(){return w})),r.d(t,"f",(function(){return S})),r.d(t,"g",(function(){return N})),r.d(t,"h",(function(){return f})),r.d(t,"i",(function(){return o})),r.d(t,"j",(function(){return I})),r.d(t,"k",(function(){return a})),r.d(t,"l",(function(){return D})),r.d(t,"m",(function(){return i})),r.d(t,"n",(function(){return h})),r.d(t,"o",(function(){return g})),r.d(t,"p",(function(){return x})),r.d(t,"q",(function(){return B})),r.d(t,"r",(function(){return E})),r.d(t,"s",(function(){return O})),r.d(t,"t",(function(){return k}));function s(e,...t){const r=arguments[0];for(let e=1;e<arguments.length;e++){const t=arguments[e];for(const e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}return r}function i(e){return t=>{const r=t;r.localName=e.localName||r.name,r.namespaceURI=e.namespaceURI||r.namespaceURI||null,r.prefix=e.prefix||r.prefix||null,r.parser=e.parser||r.parser,r.target!==r&&(r.items=s({},r.items)),r.target=t}}function a(e={}){return(t,r)=>{const n=t.constructor,i=r;n.items||(n.items={}),n.target!==n&&(n.items=s({},n.items)),n.target=t,e.parser?n.items[i]={parser:e.parser,required:e.required||!1,maxOccurs:e.maxOccurs||1e9,minOccurs:void 0===e.minOccurs?0:e.minOccurs,noRoot:e.noRoot||!1}:n.items[i]={namespaceURI:e.namespaceURI||null,required:e.required||!1,prefix:e.prefix||null,defaultValue:e.defaultValue,converter:e.converter,noRoot:e.noRoot||!1},e.localName=e.localName||e.parser&&e.parser.localName||i,n.items[i].namespaceURI=e.namespaceURI||e.parser&&e.parser.namespaceURI||null,n.items[i].prefix=e.prefix||e.parser&&e.parser.prefix||null,n.items[i].localName=e.localName,n.items[i].type="element",u(t,i,e)}}function o(e={required:!1,namespaceURI:null}){return(t,r)=>{const n=t.constructor,i=r;e.localName||(e.localName=r),n.items||(n.items={}),n.target!==n&&(n.items=s({},n.items)),n.target=t,n.items[r]=e,n.items[r].type="attribute",u(t,i,e)}}function u(e,t,r){const n="_"+t,s={set:function(e){this[n]!==e&&(this.element=null,this[n]=e)},get:function(){if(void 0===this[n]){let e=r.defaultValue;r.parser&&(e=new r.parser,e.localName=r.localName),this[n]=e}return this[n]}};Object.defineProperty(e,n,{writable:!0,enumerable:!1}),Object.defineProperty(e,t,s)}class c{constructor(e){this.items=new Array,e&&(this.items=e)}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e)}Pop(){return this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,r)=>r!==e)}Clear(){this.items=new Array}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new c(this.GetIterator().map(e))}Filter(e){return new c(this.GetIterator().filter(e))}Sort(e){return new c(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return 0===this.Count}}function l(e,...t){let r=e;const n=/[^%](%\d+)/g;let s=null;const i=[];for(;s=n.exec(r);)i.push({arg:s[1],index:s.index});for(let e=i.length-1;e>=0;e--){const t=i[e],n=t.arg.substring(1),s=t.index+1;r=r.substring(0,s)+arguments[+n]+r.substring(s+1+n.length)}return r=r.replace("%%","%"),r}class h{constructor(e,...t){this.prefix="XMLJS",this.code=e,this.name=this.constructor.name,arguments[0]=m[e];const r=l.apply(this,arguments);this.message=`${this.prefix}${function(e,t){let r=e+"";for(;r.length<t;)r="0"+r;return r}(e,4)}: ${r}`,this.stack=new Error(this.message).stack}}var f;!function(e){e[e.NONE=0]="NONE",e[e.NULL_REFERENCE=1]="NULL_REFERENCE",e[e.NULL_PARAM=2]="NULL_PARAM",e[e.DECORATOR_NULL_PARAM=3]="DECORATOR_NULL_PARAM",e[e.COLLECTION_LIMIT=4]="COLLECTION_LIMIT",e[e.METHOD_NOT_IMPLEMENTED=5]="METHOD_NOT_IMPLEMENTED",e[e.METHOD_NOT_SUPPORTED=6]="METHOD_NOT_SUPPORTED",e[e.PARAM_REQUIRED=7]="PARAM_REQUIRED",e[e.CONVERTER_UNSUPPORTED=8]="CONVERTER_UNSUPPORTED",e[e.ELEMENT_MALFORMED=9]="ELEMENT_MALFORMED",e[e.ELEMENT_MISSING=10]="ELEMENT_MISSING",e[e.ATTRIBUTE_MISSING=11]="ATTRIBUTE_MISSING",e[e.CONTENT_MISSING=12]="CONTENT_MISSING",e[e.CRYPTOGRAPHIC=13]="CRYPTOGRAPHIC",e[e.CRYPTOGRAPHIC_NO_MODULE=14]="CRYPTOGRAPHIC_NO_MODULE",e[e.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM=15]="CRYPTOGRAPHIC_UNKNOWN_TRANSFORM",e[e.ALGORITHM_NOT_SUPPORTED=16]="ALGORITHM_NOT_SUPPORTED",e[e.ALGORITHM_WRONG_NAME=17]="ALGORITHM_WRONG_NAME",e[e.XML_EXCEPTION=18]="XML_EXCEPTION"}(f||(f={}));const m={};m[f.NONE]="No description",m[f.NULL_REFERENCE]="Null reference",m[f.NULL_PARAM]="'%1' has empty '%2' object",m[f.DECORATOR_NULL_PARAM]="Decorator '%1' has empty '%2' parameter",m[f.COLLECTION_LIMIT]="Collection of '%1' in element '%2' has wrong amount of items",m[f.METHOD_NOT_IMPLEMENTED]="Method is not implemented",m[f.METHOD_NOT_SUPPORTED]="Method is not supported",m[f.PARAM_REQUIRED]="Required parameter is missing '%1'",m[f.CONVERTER_UNSUPPORTED]="Converter is not supported",m[f.ELEMENT_MALFORMED]="Malformed element '%1'",m[f.ELEMENT_MISSING]="Element '%1' is missing in '%2'",m[f.ATTRIBUTE_MISSING]="Attribute '%1' is missing in '%2'",m[f.CONTENT_MISSING]="Content is missing in '%1'",m[f.CRYPTOGRAPHIC]="Cryptographic error: %1",m[f.CRYPTOGRAPHIC_NO_MODULE]="WebCrypto module is not found",m[f.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM]="Unknown transform %1",m[f.ALGORITHM_NOT_SUPPORTED]="Algorithm is not supported '%1'",m[f.ALGORITHM_WRONG_NAME]="Algorithm wrong name in use '%1'",m[f.XML_EXCEPTION]="XML exception: %1";class p{static ToString(e,t="utf8"){const r=new Uint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(r);case"binary":return this.ToBinary(r);case"hex":return this.ToHex(r);case"base64":return this.ToBase64(r);case"base64url":return this.ToBase64Url(r);default:throw new h(f.CONVERTER_UNSUPPORTED)}}static FromString(e,t="utf8"){switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);default:throw new h(f.CONVERTER_UNSUPPORTED)}}static ToBase64(t){if("undefined"!=typeof btoa){const e=this.ToString(t,"binary");return btoa(e)}if(void 0!==e)return e.from(t).toString("base64");throw new h(f.CONVERTER_UNSUPPORTED)}static FromBase64(t){if(t=t.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s/g,""),"undefined"!=typeof atob)return this.FromBinary(atob(t));if(void 0!==e)return new Uint8Array(e.from(t,"base64"));throw new h(f.CONVERTER_UNSUPPORTED)}static FromBase64Url(e){return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e){const t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}static ToUtf8String(e){const t=String.fromCharCode.apply(null,e);return decodeURIComponent(escape(t))}static FromBinary(e){const t=e.length,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=e.charCodeAt(n);return r}static ToBinary(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}static ToHex(e){const t=[];for(let r=0;r<e.length;r++){const n=e[r].toString(16);t.push(1===n.length?"0"+n:n)}return t.join("")}static FromHex(e){const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){const n=e.slice(r,r+2);t[r/2]=parseInt(n,16)}return t}static ToDateTime(e){return new Date(e)}static FromDateTime(e){return e.toISOString()}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let r=0;r<t;r++)e+="=";return e}}const d="application/xml";var g;!function(e){e[e.None=0]="None",e[e.Element=1]="Element",e[e.Attribute=2]="Attribute",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.EntityReference=5]="EntityReference",e[e.Entity=6]="Entity",e[e.ProcessingInstruction=7]="ProcessingInstruction",e[e.Comment=8]="Comment",e[e.Document=9]="Document",e[e.DocumentType=10]="DocumentType",e[e.DocumentFragment=11]="DocumentFragment",e[e.Notation=12]="Notation",e[e.Whitespace=13]="Whitespace",e[e.SignificantWhitespace=14]="SignificantWhitespace",e[e.EndElement=15]="EndElement",e[e.EndEntity=16]="EndEntity",e[e.XmlDeclaration=17]="XmlDeclaration"}(g||(g={}));let b,y=(e,t)=>{throw new Error("Not implemented")};if("undefined"==typeof self){b=n;const e=r(29);y=r(33),b.XMLSerializer=e.XMLSerializer,b.DOMParser=e.DOMParser,b.DOMImplementation=e.DOMImplementation,b.document=(new DOMImplementation).createDocument("http://www.w3.org/1999/xhtml","html",null)}else b=self;const w="undefined"!=typeof self?function(e,t){const r=null==e.ownerDocument?e:e.ownerDocument,n=document.createNSResolver(null==e.ownerDocument?e.documentElement:e.ownerDocument.documentElement),s=r.evaluate(t,e,n,XPathResult.ANY_TYPE,null),i=[];let a;for(;a=s.iterateNext();)i.push(a);return i}:y;function v(e){return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),(new DOMParser).parseFromString(e,d)}function N(e){return(new XMLSerializer).serializeToString(e)}function A(e,t){const r=w(e,t);return r&&r.length>0?r[0]:null}function S(e){const t={};return function e(t,r={}){if(k(t)){t.namespaceURI&&"http://www.w3.org/XML/1998/namespace"!==t.namespaceURI&&!r[t.prefix||""]&&(r[t.prefix?t.prefix:""]=t.namespaceURI);for(let n=0;n<t.childNodes.length;n++){const s=t.childNodes.item(n);s&&s.nodeType===g.Element&&e(s,r)}}}(e,t),t}function E(e,...t){const r=arguments[0];for(let e=1;e<arguments.length;e++){const t=arguments[e];for(const e in t)t.hasOwnProperty(e)&&(r[e]=t[e])}return r}function C(e,t){return e&&e.nodeType===t}function k(e){return C(e,g.Element)}function O(e){return C(e,g.Document)}const I={get:e=>{if(e)return p.ToBase64(e)},set:e=>p.FromBase64(e)},x={get:e=>e?e.toString():"0",set:e=>Number(e)};class B{constructor(e={}){if(this.prefix=this.GetStatic().prefix||null,this.localName=this.GetStatic().localName,this.namespaceURI=this.GetStatic().namespaceURI,e)for(const[t,r]of Object.entries(e))void 0!==r&&(this[t]=r)}static LoadXml(e){const t=new this;return t.LoadXml(e),t}static GetElement(e,t,r=!0){const n=e.getElementsByTagName(t);if(r&&0===n.length)throw new h(f.ELEMENT_MISSING,t,e.localName);return n[0]||null}static GetAttribute(e,t,r,n=!0){if(e.hasAttribute(t))return e.getAttribute(t);if(n)throw new h(f.ATTRIBUTE_MISSING,t,e.localName);return r}static GetElementById(e,t){if(null==e||null==t)return null;let r=null;return O(e)&&(r=e.getElementById(t)),null==r&&(r=A(e,`//*[@Id='${t}']`),null==r&&(r=A(e,`//*[@ID='${t}']`),null==r&&(r=A(e,`//*[@id='${t}']`)))),r}static CreateDocument(e="xml_root",t=null,r=null){let n="",s="",i="";r&&(n=r+":",s=":"+r),t&&(i=` xmlns${s}="${t}"`);const a=`${n}${e}`;return(new DOMParser).parseFromString(`<${a}${i}></${a}>`,d)}static GetChildren(e,t,r){e=O(e)?e.documentElement:e;const n=[];for(let s=0;s<e.childNodes.length;s++){const i=e.childNodes[s];!k(i)||i.localName!==t||i.namespaceURI!==r&&r||n.push(i)}return n}static GetFirstChild(e,t,r){e=O(e)?e.documentElement:e;for(let n=0;n<e.childNodes.length;n++){const s=e.childNodes[n];if(k(s)&&s.localName===t&&(s.namespaceURI===r||!r))return s}return null}static GetChild(e,t,r,n=!0){for(let n=0;n<e.childNodes.length;n++){const s=e.childNodes[n];if(k(s)&&s.localName===t&&(s.namespaceURI===r||!r))return s}if(n)throw new h(f.ELEMENT_MISSING,t,e.localName);return null}get Element(){return this.element}get Prefix(){return this.prefix}set Prefix(e){this.prefix=e}get LocalName(){return this.localName}get NamespaceURI(){return this.namespaceURI||null}HasChanged(){const e=this.GetStatic();if(e.items)for(const t in e.items){if(!e.items.hasOwnProperty(t))continue;const r=e.items[t],n=this[t];if(r.parser&&n&&n.HasChanged())return!0}return null===this.element}GetXml(e){if(!e&&!this.HasChanged())return this.element||null;const t=this,r=this.CreateDocument(),n=this.CreateElement(),s=this.GetStatic(),i=this.localName;if(s.items)for(const e in s.items){if(!s.items.hasOwnProperty(e))continue;const a=t[e],o=s.items[e];switch(o.type){case"content":{const e=o,t=e.converter?e.converter.get(a):a;if(e.required&&null==t)throw new h(f.CONTENT_MISSING,i);(e.defaultValue!==a||e.required)&&(n.textContent=t);break}case"attribute":{const e=o,t=e.converter?e.converter.get(a):a;if(e.required&&null==t)throw new h(f.ATTRIBUTE_MISSING,e.localName,i);(e.defaultValue!==a||e.required)&&(e.namespaceURI?n.setAttributeNS(e.namespaceURI,e.localName,t):n.setAttribute(e.localName,t));break}case"element":{const e=o;let t=null;if(e.parser){if(e.required&&!a||e.minOccurs&&!a.Count)throw new h(f.ELEMENT_MISSING,a.localName,i);a&&(t=a.GetXml(void 0===a.element&&(e.required||a.Count)))}else{const n=e.converter?e.converter.get(a):a;if(e.required&&void 0===n)throw new h(f.ELEMENT_MISSING,e.localName,i);if(a!==e.defaultValue||e.required)if(t=e.namespaceURI?r.createElementNS(e.namespaceURI,`${e.prefix?e.prefix+":":""}${e.localName}`):r.createElement(`${e.prefix?e.prefix+":":""}${e.localName}`),Array.isArray(n))for(const e of n){const r=e instanceof B?e.GetXml(!0):e;null!==r&&t.appendChild(r)}else n instanceof B?t.appendChild(n.GetXml(!0)):t.textContent=n}if(t)if(e.noRoot){const r=[];for(let e=0;e<t.childNodes.length;e++){const n=t.childNodes.item(e);k(n)&&r.push(n)}if(r.length<e.minOccurs||r.length>e.maxOccurs)throw new h(f.COLLECTION_LIMIT,a.localName,s.localName);r.forEach(e=>n.appendChild(e.cloneNode(!0)))}else{if(t.childNodes.length<e.minOccurs||t.childNodes.length>e.maxOccurs)throw new h(f.COLLECTION_LIMIT,a.localName,s.localName);n.appendChild(t)}break}}}return this.OnGetXml(n),this.element=n,n}LoadXml(e){let t;const r=this;if("string"==typeof e){t=v(e).documentElement}else t=e;if(!t)throw new h(f.PARAM_REQUIRED,"element");const n=this.GetStatic(),s=this.localName;if(t.localName!==s||t.namespaceURI!=this.NamespaceURI)throw new h(f.ELEMENT_MALFORMED,s);if(n.items)for(const e in n.items){if(!n.items.hasOwnProperty(e))continue;const i=n.items[e];switch(i.type){case"content":{const n=i;if(n.required&&!t.textContent)throw new h(f.CONTENT_MISSING,s);if(t.textContent){const s=n.converter?n.converter.set(t.textContent):t.textContent;r[e]=s}else r[e]=n.defaultValue;break}case"attribute":{const n=i;let a,o;if(!n.localName)throw new h(f.PARAM_REQUIRED,"localName");if(n.namespaceURI?(a=t.hasAttributeNS.bind(t,n.namespaceURI,n.localName),o=t.getAttributeNS.bind(t,n.namespaceURI,n.localName)):(a=t.hasAttribute.bind(t,n.localName),o=t.getAttribute.bind(t,n.localName)),n.required&&!a())throw new h(f.ATTRIBUTE_MISSING,n.localName,s);if(a()){const t=n.converter?n.converter.set(o()):o();r[e]=t}else r[e]=n.defaultValue;break}case"element":{const n=i;if(n.noRoot){if(!n.parser)throw new h(f.XML_EXCEPTION,`Schema for '${n.localName}' with flag noRoot must have 'parser'`);const i=new n.parser;if(!(i instanceof D))throw new h(f.XML_EXCEPTION,`Schema for '${n.localName}' with flag noRoot must have 'parser' like instance of XmlCollection`);if(i.OnLoadXml(t),delete i.element,i.Count<n.minOccurs||i.Count>n.maxOccurs)throw new h(f.COLLECTION_LIMIT,n.parser.localName,s);r[e]=i;continue}let a=null;for(let e=0;e<t.childNodes.length;e++){const r=t.childNodes.item(e);if(!k(r))continue;const s=r;if(s.localName===n.localName&&s.namespaceURI==n.namespaceURI){a=s;break}}if(n.required&&!a)throw new h(f.ELEMENT_MISSING,n.parser?n.parser.localName:n.localName,s);if(n.parser){if(a){const t=new n.parser;t.localName=n.localName,t.namespaceURI=n.namespaceURI,r[e]=t,t.LoadXml(a)}}else if(a){const t=n.converter?n.converter.set(a.textContent):a.textContent;r[e]=t}else r[e]=n.defaultValue;break}}}this.OnLoadXml(t),this.prefix=t.prefix||"",this.element=t}toString(){const e=this.GetXml();return e?(new XMLSerializer).serializeToString(e):""}GetElement(e,t=!0){if(!this.element)throw new h(f.NULL_PARAM,this.localName);return B.GetElement(this.element,e,t)}GetChildren(e,t){if(!this.element)throw new h(f.NULL_PARAM,this.localName);return B.GetChildren(this.element,e,t||this.NamespaceURI||void 0)}GetChild(e,t=!0){if(!this.element)throw new h(f.NULL_PARAM,this.localName);return B.GetChild(this.element,e,this.NamespaceURI||void 0,t)}GetFirstChild(e,t){if(!this.element)throw new h(f.NULL_PARAM,this.localName);return B.GetFirstChild(this.element,e,t)}GetAttribute(e,t,r=!0){if(!this.element)throw new h(f.NULL_PARAM,this.localName);return B.GetAttribute(this.element,e,t,r)}IsEmpty(){return void 0===this.Element}OnLoadXml(e){}GetStatic(){return this.constructor}GetPrefix(){return this.Prefix?this.prefix+":":""}OnGetXml(e){}CreateElement(e,t,r=null,n=null){e||(e=this.CreateDocument()),t=t||this.localName,r=r||this.NamespaceURI;const s=((n=n||this.prefix)?n+":":"")+t,i=r?e.createElementNS(r,s):e.createElement(s);return e.importNode(i,!0),i}CreateDocument(){return B.CreateDocument(this.localName,this.NamespaceURI,this.Prefix)}}class D extends B{constructor(){super(...arguments),this.MaxOccurs=Number.MAX_VALUE,this.MinOccurs=0,this.items=[]}HasChanged(){const e=super.HasChanged(),t=this.Some(e=>e.HasChanged());return e||t}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e),this.element=null}Pop(){return this.element=null,this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,r)=>r!==e),this.element=null}Clear(){this.items=new Array,this.element=null}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new c(this.GetIterator().map(e))}Filter(e){return new c(this.GetIterator().filter(e))}Sort(e){return new c(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return 0===this.Count}OnGetXml(e){for(const t of this.GetIterator()){const r=t.GetXml();r&&e.appendChild(r)}}OnLoadXml(e){const t=this.GetStatic();if(!t.parser)throw new h(f.XML_EXCEPTION,t.localName+" doesn't have required 'parser' in @XmlElement");for(let r=0;r<e.childNodes.length;r++){const n=e.childNodes.item(r);if(!k(n)||n.localName!==t.parser.localName||n.namespaceURI!=t.namespaceURI)continue;const s=n,i=new t.parser;i.LoadXml(s),this.Add(i)}}}class T extends c{Add(e){e.prefix=e.prefix||"",e.namespace=e.namespace||"",super.Add(e)}GetPrefix(e,t=this.Count-1){const r=this.Count-1;e=e||"",t>r&&(t=r);for(let r=t;r>=0;r--){const t=this.items[r];if(t.prefix===e)return t}return null}GetNamespace(e,t=this.Count-1){const r=this.Count-1;e=e||"",t>r&&(t=r);for(let r=t;r>=0;r--){const t=this.items[r];if(t.namespace===e)return t}return null}}}).call(this,r(22).Buffer,r(21))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),s=r(1);class i{constructor(e={}){this.algorithmId=Object(s.f)(e,"algorithmId",i.defaultValues("algorithmId")),"algorithmParams"in e&&(this.algorithmParams=Object(s.f)(e,"algorithmParams",i.defaultValues("algorithmParams"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"algorithmId":return"";case"algorithmParams":return new n.a;default:throw new Error("Invalid member name for AlgorithmIdentifier class: "+e)}}static compareWithDefault(e,t){switch(e){case"algorithmId":return""===t;case"algorithmParams":return t instanceof n.a;default:throw new Error("Invalid member name for AlgorithmIdentifier class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",optional:t.optional||!1,value:[new n.p({name:t.algorithmIdentifier||""}),new n.a({name:t.algorithmParams||"",optional:!0})]})}fromSchema(e){Object(s.d)(e,["algorithm","params"]);const t=n.D(e,e,i.schema({names:{algorithmIdentifier:"algorithm",algorithmParams:"params"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AlgorithmIdentifier");this.algorithmId=t.result.algorithm.valueBlock.toString(),"params"in t.result&&(this.algorithmParams=t.result.params)}toSchema(){const e=[];return e.push(new n.p({value:this.algorithmId})),"algorithmParams"in this&&this.algorithmParams instanceof n.a==!1&&e.push(this.algorithmParams),new n.v({value:e})}toJSON(){const e={algorithmId:this.algorithmId};return"algorithmParams"in this&&this.algorithmParams instanceof n.a==!1&&(e.algorithmParams=this.algorithmParams.toJSON()),e}isEqual(e){return e instanceof i!=!1&&(this.algorithmId===e.algorithmId&&("algorithmParams"in this?"algorithmParams"in e&&JSON.stringify(this.algorithmParams)===JSON.stringify(e.algorithmParams):!("algorithmParams"in e)))}}},function(e,t,r){"use strict";(function(e,n){r.d(t,"i",(function(){return u})),r.d(t,"e",(function(){return c})),r.d(t,"d",(function(){return l})),r.d(t,"g",(function(){return h})),r.d(t,"f",(function(){return f})),r.d(t,"a",(function(){return m})),r.d(t,"j",(function(){return p})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return g})),r.d(t,"h",(function(){return y}));var s=r(0),i=r(1),a=r(20);let o={name:"none",crypto:null,subtle:null};function u(t,r,s){if(void 0!==e&&"pid"in e&&void 0!==n&&"undefined"==typeof window){if(void 0===n[e.pid])n[e.pid]={};else if("object"!=typeof n[e.pid])throw new Error(`Name global.${e.pid} already exists and it is not an object`);if(void 0===n[e.pid].pkijs)n[e.pid].pkijs={};else if("object"!=typeof n[e.pid].pkijs)throw new Error(`Name global.${e.pid}.pkijs already exists and it is not an object`);n[e.pid].pkijs.engine={name:t,crypto:r,subtle:s}}else o.name!==t&&(o={name:t,crypto:r,subtle:s})}function c(){if(void 0!==e&&"pid"in e&&void 0!==n&&"undefined"==typeof window){let t;try{t=n[e.pid].pkijs.engine}catch(e){throw new Error('Please call "setEngine" before call to "getEngine"')}return t}return o}function l(){const e=c();if(null!==e.subtle)return e.subtle}function h(e){return c().subtle.getRandomValues(e)}function f(e){return c().subtle.getOIDByAlgorithm(e)}function m(e){if(e.byteLength%2!=0)return new ArrayBuffer(0);const t=e.byteLength/2,r=new ArrayBuffer(t);new Uint8Array(r).set(new Uint8Array(e,0,t));const n=new s.m({valueHex:r}),i=new ArrayBuffer(t);new Uint8Array(i).set(new Uint8Array(e,t,t));const a=new s.m({valueHex:i});return new s.v({value:[n.convertToDER(),a.convertToDER()]}).toBER(!1)}function p(e){let t=!1,r="";const n=e.trim();for(let e=0;e<n.length;e++)32===n.charCodeAt(e)?!1===t&&(t=!0):(t&&(r+=" ",t=!1),r+=n[e]);return r.toLowerCase()}function d(e){if(e instanceof s.v==!1)return new ArrayBuffer(0);if(2!==e.valueBlock.value.length)return new ArrayBuffer(0);if(e.valueBlock.value[0]instanceof s.m==!1)return new ArrayBuffer(0);if(e.valueBlock.value[1]instanceof s.m==!1)return new ArrayBuffer(0);const t=e.valueBlock.value[0].convertFromDER(),r=e.valueBlock.value[1].convertFromDER();switch(!0){case t.valueBlock.valueHex.byteLength<r.valueBlock.valueHex.byteLength:{if(r.valueBlock.valueHex.byteLength-t.valueBlock.valueHex.byteLength!=1)throw new Error("Incorrect DER integer decoding");const e=r.valueBlock.valueHex.byteLength,n=new Uint8Array(t.valueBlock.valueHex),s=new ArrayBuffer(e),a=new Uint8Array(s);return a.set(n,1),a[0]=0,Object(i.l)(s,r.valueBlock.valueHex)}case t.valueBlock.valueHex.byteLength>r.valueBlock.valueHex.byteLength:{if(t.valueBlock.valueHex.byteLength-r.valueBlock.valueHex.byteLength!=1)throw new Error("Incorrect DER integer decoding");const e=t.valueBlock.valueHex.byteLength,n=new Uint8Array(r.valueBlock.valueHex),s=new ArrayBuffer(e),a=new Uint8Array(s);return a.set(n,1),a[0]=0,Object(i.l)(t.valueBlock.valueHex,s)}default:if(t.valueBlock.valueHex.byteLength%2){const e=t.valueBlock.valueHex.byteLength+1,n=new Uint8Array(t.valueBlock.valueHex),s=new ArrayBuffer(e),a=new Uint8Array(s);a.set(n,1),a[0]=0;const o=new Uint8Array(r.valueBlock.valueHex),u=new ArrayBuffer(e),c=new Uint8Array(u);return c.set(o,1),c[0]=0,Object(i.l)(s,u)}}return Object(i.l)(t.valueBlock.valueHex,r.valueBlock.valueHex)}function g(e){return c().subtle.getAlgorithmByOID(e)}function b(e,t,r,n){switch(e.toUpperCase()){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;default:return Promise.reject("Unknown hash function: "+e)}if(t instanceof ArrayBuffer==!1)return Promise.reject('Please set "Zbuffer" as "ArrayBuffer"');if(0===t.byteLength)return Promise.reject('"Zbuffer" has zero length, error');if(n instanceof ArrayBuffer==!1)return Promise.reject('Please set "SharedInfo" as "ArrayBuffer"');if(r>255)return Promise.reject('Please set "Counter" variable to value less or equal to 255');const s=new ArrayBuffer(4),a=new Uint8Array(s);a[0]=0,a[1]=0,a[2]=0,a[3]=r;let o=new ArrayBuffer(0);const u=l();return void 0===u?Promise.reject("Unable to create WebCrypto object"):(o=Object(i.l)(o,t),o=Object(i.l)(o,s),o=Object(i.l)(o,n),u.digest({name:e},o).then(e=>({counter:r,result:e})))}function y(e,t,r,n){let s=0,a=1;const o=[];switch(e.toUpperCase()){case"SHA-1":s=160;break;case"SHA-256":s=256;break;case"SHA-384":s=384;break;case"SHA-512":s=512;break;default:return Promise.reject("Unknown hash function: "+e)}if(t instanceof ArrayBuffer==!1)return Promise.reject('Please set "Zbuffer" as "ArrayBuffer"');if(0===t.byteLength)return Promise.reject('"Zbuffer" has zero length, error');if(n instanceof ArrayBuffer==!1)return Promise.reject('Please set "SharedInfo" as "ArrayBuffer"');const u=r/s;Math.floor(u)>0&&(a=Math.floor(u),u-a>0&&a++);for(let r=1;r<=a;r++)o.push(b(e,t,r,n));return Promise.all(o).then(e=>{let t=new ArrayBuffer(0),n=1,s=!0;for(;s;){s=!1;for(const r of e)if(r.counter===n){t=Object(i.l)(t,r.result),s=!0;break}n++}if(r>>=3,t.byteLength>r){const e=new ArrayBuffer(r),n=new Uint8Array(e),s=new Uint8Array(t);for(let e=0;e<r;e++)n[e]=s[e];return e}return t})}!function(){if("undefined"!=typeof self&&"crypto"in self){let e="webcrypto";const t=self.crypto;let r;if("webkitSubtle"in self.crypto){try{r=self.crypto.webkitSubtle}catch(e){r=self.crypto.subtle}e="safari"}"subtle"in self.crypto&&(r=self.crypto.subtle),o=void 0===r?{name:e,crypto:t,subtle:null}:{name:e,crypto:t,subtle:new a.a({name:e,crypto:self.crypto,subtle:r})}}u(o.name,o.crypto,o.subtle)}()}).call(this,r(34),r(21))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),s=r(1);class i{constructor(e={}){this.type=Object(s.f)(e,"type",i.defaultValues("type")),this.values=Object(s.f)(e,"values",i.defaultValues("values")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return"";case"values":return[];default:throw new Error("Invalid member name for Attribute class: "+e)}}static compareWithDefault(e,t){switch(e){case"type":return""===t;case"values":return 0===t.length;default:throw new Error("Invalid member name for Attribute class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.p({name:t.type||""}),new n.w({name:t.setName||"",value:[new n.u({name:t.values||"",value:new n.a})]})]})}fromSchema(e){Object(s.d)(e,["type","values"]);const t=n.D(e,e,i.schema({names:{type:"type",values:"values"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Attribute");this.type=t.result.type.valueBlock.toString(),this.values=t.result.values}toSchema(){return new n.v({value:[new n.p({value:this.type}),new n.w({value:this.values})]})}toJSON(){return{type:this.type,values:Array.from(this.values,e=>e.toJSON())}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),s=r(1),i=r(3);class a{constructor(e={}){if(this.contentType=Object(s.f)(e,"contentType",a.defaultValues("contentType")),this.contentEncryptionAlgorithm=Object(s.f)(e,"contentEncryptionAlgorithm",a.defaultValues("contentEncryptionAlgorithm")),"encryptedContent"in e&&(this.encryptedContent=e.encryptedContent,1===this.encryptedContent.idBlock.tagClass&&4===this.encryptedContent.idBlock.tagNumber&&!1===this.encryptedContent.idBlock.isConstructed)){const e=new n.q({idBlock:{isConstructed:!0},isConstructed:!0});let t=0,r=this.encryptedContent.valueBlock.valueHex.byteLength;for(;r>0;){const s=new Uint8Array(this.encryptedContent.valueBlock.valueHex,t,t+1024>this.encryptedContent.valueBlock.valueHex.byteLength?this.encryptedContent.valueBlock.valueHex.byteLength-t:1024),i=new ArrayBuffer(s.length),a=new Uint8Array(i);for(let e=0;e<a.length;e++)a[e]=s[e];e.valueBlock.value.push(new n.q({valueHex:i})),r-=s.length,t+=s.length}this.encryptedContent=e}"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"contentType":return"";case"contentEncryptionAlgorithm":return new i.a;case"encryptedContent":return new n.q;default:throw new Error("Invalid member name for EncryptedContentInfo class: "+e)}}static compareWithDefault(e,t){switch(e){case"contentType":return""===t;case"contentEncryptionAlgorithm":return""===t.algorithmId&&"algorithmParams"in t==!1;case"encryptedContent":return t.isEqual(a.defaultValues(e));default:throw new Error("Invalid member name for EncryptedContentInfo class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.p({name:t.contentType||""}),i.a.schema(t.contentEncryptionAlgorithm||{}),new n.f({value:[new n.g({name:t.encryptedContent||"",idBlock:{tagClass:3,tagNumber:0},value:[new n.u({value:new n.q})]}),new n.r({name:t.encryptedContent||"",idBlock:{tagClass:3,tagNumber:0}})]})]})}fromSchema(e){Object(s.d)(e,["contentType","contentEncryptionAlgorithm","encryptedContent"]);const t=n.D(e,e,a.schema({names:{contentType:"contentType",contentEncryptionAlgorithm:{names:{blockName:"contentEncryptionAlgorithm"}},encryptedContent:"encryptedContent"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for EncryptedContentInfo");this.contentType=t.result.contentType.valueBlock.toString(),this.contentEncryptionAlgorithm=new i.a({schema:t.result.contentEncryptionAlgorithm}),"encryptedContent"in t.result&&(this.encryptedContent=t.result.encryptedContent,this.encryptedContent.idBlock.tagClass=1,this.encryptedContent.idBlock.tagNumber=4)}toSchema(){const e={isIndefiniteForm:!1},t=[];if(t.push(new n.p({value:this.contentType})),t.push(this.contentEncryptionAlgorithm.toSchema()),"encryptedContent"in this){e.isIndefiniteForm=this.encryptedContent.idBlock.isConstructed;const r=this.encryptedContent;r.idBlock.tagClass=3,r.idBlock.tagNumber=0,r.lenBlock.isIndefiniteForm=this.encryptedContent.idBlock.isConstructed,t.push(r)}return new n.v({lenBlock:e,value:t})}toJSON(){const e={contentType:this.contentType,contentEncryptionAlgorithm:this.contentEncryptionAlgorithm.toJSON()};return"encryptedContent"in this&&(e.encryptedContent=this.encryptedContent.toJSON()),e}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),s=r(1),i=r(4),a=r(3),o=r(8),u=r(15);class c{constructor(e={}){this.algorithm=Object(s.f)(e,"algorithm",c.defaultValues("algorithm")),this.subjectPublicKey=Object(s.f)(e,"subjectPublicKey",c.defaultValues("subjectPublicKey")),"parsedKey"in e&&(this.parsedKey=Object(s.f)(e,"parsedKey",c.defaultValues("parsedKey"))),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"algorithm":return new a.a;case"subjectPublicKey":return new n.b;default:throw new Error("Invalid member name for PublicKeyInfo class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[a.a.schema(t.algorithm||{}),new n.b({name:t.subjectPublicKey||""})]})}fromSchema(e){Object(s.d)(e,["algorithm","subjectPublicKey"]);const t=n.D(e,e,c.schema({names:{algorithm:{names:{blockName:"algorithm"}},subjectPublicKey:"subjectPublicKey"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PublicKeyInfo");switch(this.algorithm=new a.a({schema:t.result.algorithm}),this.subjectPublicKey=t.result.subjectPublicKey,this.algorithm.algorithmId){case"1.2.840.10045.2.1":if("algorithmParams"in this.algorithm&&this.algorithm.algorithmParams.constructor.blockName()===n.p.blockName())try{this.parsedKey=new o.a({namedCurve:this.algorithm.algorithmParams.valueBlock.toString(),schema:this.subjectPublicKey.valueBlock.valueHex})}catch(e){}break;case"1.2.840.113549.1.1.1":{const e=n.E(this.subjectPublicKey.valueBlock.valueHex);if(-1!==e.offset)try{this.parsedKey=new u.a({schema:e.result})}catch(e){}}}}toSchema(){return new n.v({value:[this.algorithm.toSchema(),this.subjectPublicKey]})}toJSON(){if("parsedKey"in this==!1)return{algorithm:this.algorithm.toJSON(),subjectPublicKey:this.subjectPublicKey.toJSON()};const e={};switch(this.algorithm.algorithmId){case"1.2.840.10045.2.1":e.kty="EC";break;case"1.2.840.113549.1.1.1":e.kty="RSA"}const t=this.parsedKey.toJSON();for(const r of Object.keys(t))e[r]=t[r];return e}fromJSON(e){if("kty"in e){switch(e.kty.toUpperCase()){case"EC":this.parsedKey=new o.a({json:e}),this.algorithm=new a.a({algorithmId:"1.2.840.10045.2.1",algorithmParams:new n.p({value:this.parsedKey.namedCurve})});break;case"RSA":this.parsedKey=new u.a({json:e}),this.algorithm=new a.a({algorithmId:"1.2.840.113549.1.1.1",algorithmParams:new n.n});break;default:throw new Error('Invalid value for "kty" parameter: '+e.kty)}this.subjectPublicKey=new n.b({valueHex:this.parsedKey.toSchema().toBER(!1)})}}importKey(e){let t=Promise.resolve();const r=this;if(void 0===e)return Promise.reject("Need to provide publicKey input parameter");const s=Object(i.d)();return void 0===s?Promise.reject("Unable to create WebCrypto object"):(t=t.then(()=>s.exportKey("spki",e)),t=t.then(e=>{const t=n.E(e);try{r.fromSchema(t.result)}catch(e){return Promise.reject("Error during initializing object from schema")}},e=>Promise.reject("Error during exporting public key: "+e)),t)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),s=r(1),i=r(11);class a{constructor(e={}){this.x=Object(s.f)(e,"x",a.defaultValues("x")),this.y=Object(s.f)(e,"y",a.defaultValues("y")),this.namedCurve=Object(s.f)(e,"namedCurve",a.defaultValues("namedCurve")),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"x":case"y":return new ArrayBuffer(0);case"namedCurve":return"";default:throw new Error("Invalid member name for ECCPublicKey class: "+e)}}static compareWithDefault(e,t){switch(e){case"x":case"y":return Object(s.g)(t,a.defaultValues(e));case"namedCurve":return""===t;default:throw new Error("Invalid member name for ECCPublicKey class: "+e)}}static schema(e={}){return new n.t}fromSchema(e){if(e instanceof ArrayBuffer==!1)throw new Error("Object's schema was not verified against input data for ECPublicKey");if(4!==new Uint8Array(e)[0])throw new Error("Object's schema was not verified against input data for ECPublicKey");const t=i.a.find(this.namedCurve);if(!t)throw new Error("Incorrect curve OID: "+this.namedCurve);const r=t.size;if(e.byteLength!==2*r+1)throw new Error("Object's schema was not verified against input data for ECPublicKey");this.x=e.slice(1,r+1),this.y=e.slice(1+r,2*r+1)}toSchema(){return new n.t({data:Object(s.l)(new Uint8Array([4]).buffer,this.x,this.y)})}toJSON(){const e=i.a.find(this.namedCurve);return{crv:e?e.name:this.namedCurve,x:Object(s.k)(Object(s.a)(this.x),!0,!0,!1),y:Object(s.k)(Object(s.a)(this.y),!0,!0,!1)}}fromJSON(e){let t=0;if(!("crv"in e))throw new Error('Absent mandatory parameter "crv"');{const r=i.a.find(e.crv);r&&(this.namedCurve=r.id,t=r.size)}if(!("x"in e))throw new Error('Absent mandatory parameter "x"');{const r=Object(s.j)(Object(s.e)(e.x,!0));if(r.byteLength<t){this.x=new ArrayBuffer(t);const e=new Uint8Array(this.x),n=new Uint8Array(r);e.set(n,1)}else this.x=r.slice(0,t)}if(!("y"in e))throw new Error('Absent mandatory parameter "y"');{const r=Object(s.j)(Object(s.e)(e.y,!0));if(r.byteLength<t){this.y=new ArrayBuffer(t);const e=new Uint8Array(this.y),n=new Uint8Array(r);e.set(n,1)}else this.y=r.slice(0,t)}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),s=r(1),i=r(3),a=r(5),o=r(16),u=r(17);class c{constructor(e={}){this.version=Object(s.f)(e,"version",c.defaultValues("version")),this.privateKeyAlgorithm=Object(s.f)(e,"privateKeyAlgorithm",c.defaultValues("privateKeyAlgorithm")),this.privateKey=Object(s.f)(e,"privateKey",c.defaultValues("privateKey")),"attributes"in e&&(this.attributes=Object(s.f)(e,"attributes",c.defaultValues("attributes"))),"parsedKey"in e&&(this.parsedKey=Object(s.f)(e,"parsedKey",c.defaultValues("parsedKey"))),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"version":return 0;case"privateKeyAlgorithm":return new i.a;case"privateKey":return new n.q;case"attributes":return[];case"parsedKey":return{};default:throw new Error("Invalid member name for PrivateKeyInfo class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.version||""}),i.a.schema(t.privateKeyAlgorithm||{}),new n.q({name:t.privateKey||""}),new n.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new n.u({name:t.attributes||"",value:a.a.schema()})]})]})}fromSchema(e){Object(s.d)(e,["version","privateKeyAlgorithm","privateKey","attributes"]);const t=n.D(e,e,c.schema({names:{version:"version",privateKeyAlgorithm:{names:{blockName:"privateKeyAlgorithm"}},privateKey:"privateKey",attributes:"attributes"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PrivateKeyInfo");switch(this.version=t.result.version.valueBlock.valueDec,this.privateKeyAlgorithm=new i.a({schema:t.result.privateKeyAlgorithm}),this.privateKey=t.result.privateKey,"attributes"in t.result&&(this.attributes=Array.from(t.result.attributes,e=>new a.a({schema:e}))),this.privateKeyAlgorithm.algorithmId){case"1.2.840.113549.1.1.1":{const e=n.E(this.privateKey.valueBlock.valueHex);-1!==e.offset&&(this.parsedKey=new u.a({schema:e.result}))}break;case"1.2.840.10045.2.1":if("algorithmParams"in this.privateKeyAlgorithm&&this.privateKeyAlgorithm.algorithmParams instanceof n.p){const e=n.E(this.privateKey.valueBlock.valueHex);-1!==e.offset&&(this.parsedKey=new o.a({namedCurve:this.privateKeyAlgorithm.algorithmParams.valueBlock.toString(),schema:e.result}))}}}toSchema(){const e=[new n.m({value:this.version}),this.privateKeyAlgorithm.toSchema(),this.privateKey];return"attributes"in this&&e.push(new n.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.attributes,e=>e.toSchema())})),new n.v({value:e})}toJSON(){if("parsedKey"in this==!1){const e={version:this.version,privateKeyAlgorithm:this.privateKeyAlgorithm.toJSON(),privateKey:this.privateKey.toJSON()};return"attributes"in this&&(e.attributes=Array.from(this.attributes,e=>e.toJSON())),e}const e={};switch(this.privateKeyAlgorithm.algorithmId){case"1.2.840.10045.2.1":e.kty="EC";break;case"1.2.840.113549.1.1.1":e.kty="RSA"}const t=this.parsedKey.toJSON();for(const r of Object.keys(t))e[r]=t[r];return e}fromJSON(e){if("kty"in e){switch(e.kty.toUpperCase()){case"EC":this.parsedKey=new o.a({json:e}),this.privateKeyAlgorithm=new i.a({algorithmId:"1.2.840.10045.2.1",algorithmParams:new n.p({value:this.parsedKey.namedCurve})});break;case"RSA":this.parsedKey=new u.a({json:e}),this.privateKeyAlgorithm=new i.a({algorithmId:"1.2.840.113549.1.1.1",algorithmParams:new n.n});break;default:throw new Error('Invalid value for "kty" parameter: '+e.kty)}this.privateKey=new n.q({valueHex:this.parsedKey.toSchema().toBER(!1)})}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),s=r(1),i=r(3);class a{constructor(e={}){this.salt=Object(s.f)(e,"salt",a.defaultValues("salt")),this.iterationCount=Object(s.f)(e,"iterationCount",a.defaultValues("iterationCount")),"keyLength"in e&&(this.keyLength=Object(s.f)(e,"keyLength",a.defaultValues("keyLength"))),"prf"in e&&(this.prf=Object(s.f)(e,"prf",a.defaultValues("prf"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"salt":return{};case"iterationCount":return-1;case"keyLength":return 0;case"prf":return new i.a({algorithmId:"1.3.14.3.2.26",algorithmParams:new n.n});default:throw new Error("Invalid member name for PBKDF2Params class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.f({value:[new n.q({name:t.saltPrimitive||""}),i.a.schema(t.saltConstructed||{})]}),new n.m({name:t.iterationCount||""}),new n.m({name:t.keyLength||"",optional:!0}),i.a.schema(t.prf||{names:{optional:!0}})]})}fromSchema(e){Object(s.d)(e,["salt","iterationCount","keyLength","prf"]);const t=n.D(e,e,a.schema({names:{saltPrimitive:"salt",saltConstructed:{names:{blockName:"salt"}},iterationCount:"iterationCount",keyLength:"keyLength",prf:{names:{blockName:"prf",optional:!0}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PBKDF2Params");this.salt=t.result.salt,this.iterationCount=t.result.iterationCount.valueBlock.valueDec,"keyLength"in t.result&&(this.keyLength=t.result.keyLength.valueBlock.valueDec),"prf"in t.result&&(this.prf=new i.a({schema:t.result.prf}))}toSchema(){const e=[];return e.push(this.salt),e.push(new n.m({value:this.iterationCount})),"keyLength"in this&&a.defaultValues("keyLength")!==this.keyLength&&e.push(new n.m({value:this.keyLength})),"prf"in this&&!1===a.defaultValues("prf").isEqual(this.prf)&&e.push(this.prf.toSchema()),new n.v({value:e})}toJSON(){const e={salt:this.salt.toJSON(),iterationCount:this.iterationCount};return"keyLength"in this&&a.defaultValues("keyLength")!==this.keyLength&&(e.keyLength=this.keyLength),"prf"in this&&!1===a.defaultValues("prf").isEqual(this.prf)&&(e.prf=this.prf.toJSON()),e}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));class n{static register(e,t,r){this.namedCurves[e.toLowerCase()]=this.namedCurves[t]={name:e,id:t,size:r}}static find(e){return this.namedCurves[e.toLowerCase()]||null}}n.namedCurves={},n.register("P-256","1.2.840.10045.3.1.7",32),n.register("P-384","1.3.132.0.34",48),n.register("P-521","1.3.132.0.35",66),n.register("brainpoolP256r1","1.3.36.3.3.2.8.1.1.7",32),n.register("brainpoolP384r1","1.3.36.3.3.2.8.1.1.11",48),n.register("brainpoolP512r1","1.3.36.3.3.2.8.1.1.13",64)},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),s=r(1);class i{constructor(e={}){this.prime=Object(s.f)(e,"prime",i.defaultValues("prime")),this.exponent=Object(s.f)(e,"exponent",i.defaultValues("exponent")),this.coefficient=Object(s.f)(e,"coefficient",i.defaultValues("coefficient")),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"prime":case"exponent":case"coefficient":return new n.m;default:throw new Error("Invalid member name for OtherPrimeInfo class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.prime||""}),new n.m({name:t.exponent||""}),new n.m({name:t.coefficient||""})]})}fromSchema(e){Object(s.d)(e,["prime","exponent","coefficient"]);const t=n.D(e,e,i.schema({names:{prime:"prime",exponent:"exponent",coefficient:"coefficient"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for OtherPrimeInfo");this.prime=t.result.prime.convertFromDER(),this.exponent=t.result.exponent.convertFromDER(),this.coefficient=t.result.coefficient.convertFromDER()}toSchema(){return new n.v({value:[this.prime.convertToDER(),this.exponent.convertToDER(),this.coefficient.convertToDER()]})}toJSON(){return{r:Object(s.k)(Object(s.a)(this.prime.valueBlock.valueHex),!0,!0),d:Object(s.k)(Object(s.a)(this.exponent.valueBlock.valueHex),!0,!0),t:Object(s.k)(Object(s.a)(this.coefficient.valueBlock.valueHex),!0,!0)}}fromJSON(e){if(!("r"in e))throw new Error('Absent mandatory parameter "r"');if(this.prime=new n.m({valueHex:Object(s.j)(Object(s.e)(e.r,!0))}),!("d"in e))throw new Error('Absent mandatory parameter "d"');if(this.exponent=new n.m({valueHex:Object(s.j)(Object(s.e)(e.d,!0))}),!("t"in e))throw new Error('Absent mandatory parameter "t"');this.coefficient=new n.m({valueHex:Object(s.j)(Object(s.e)(e.t,!0))})}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),s=r(1),i=r(3);class a{constructor(e={}){this.hashAlgorithm=Object(s.f)(e,"hashAlgorithm",a.defaultValues("hashAlgorithm")),this.maskGenAlgorithm=Object(s.f)(e,"maskGenAlgorithm",a.defaultValues("maskGenAlgorithm")),this.saltLength=Object(s.f)(e,"saltLength",a.defaultValues("saltLength")),this.trailerField=Object(s.f)(e,"trailerField",a.defaultValues("trailerField")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"hashAlgorithm":return new i.a({algorithmId:"1.3.14.3.2.26",algorithmParams:new n.n});case"maskGenAlgorithm":return new i.a({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:new i.a({algorithmId:"1.3.14.3.2.26",algorithmParams:new n.n}).toSchema()});case"saltLength":return 20;case"trailerField":return 1;default:throw new Error("Invalid member name for RSASSAPSSParams class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.g({idBlock:{tagClass:3,tagNumber:0},optional:!0,value:[i.a.schema(t.hashAlgorithm||{})]}),new n.g({idBlock:{tagClass:3,tagNumber:1},optional:!0,value:[i.a.schema(t.maskGenAlgorithm||{})]}),new n.g({idBlock:{tagClass:3,tagNumber:2},optional:!0,value:[new n.m({name:t.saltLength||""})]}),new n.g({idBlock:{tagClass:3,tagNumber:3},optional:!0,value:[new n.m({name:t.trailerField||""})]})]})}fromSchema(e){Object(s.d)(e,["hashAlgorithm","maskGenAlgorithm","saltLength","trailerField"]);const t=n.D(e,e,a.schema({names:{hashAlgorithm:{names:{blockName:"hashAlgorithm"}},maskGenAlgorithm:{names:{blockName:"maskGenAlgorithm"}},saltLength:"saltLength",trailerField:"trailerField"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RSASSAPSSParams");"hashAlgorithm"in t.result&&(this.hashAlgorithm=new i.a({schema:t.result.hashAlgorithm})),"maskGenAlgorithm"in t.result&&(this.maskGenAlgorithm=new i.a({schema:t.result.maskGenAlgorithm})),"saltLength"in t.result&&(this.saltLength=t.result.saltLength.valueBlock.valueDec),"trailerField"in t.result&&(this.trailerField=t.result.trailerField.valueBlock.valueDec)}toSchema(){const e=[];return this.hashAlgorithm.isEqual(a.defaultValues("hashAlgorithm"))||e.push(new n.g({idBlock:{tagClass:3,tagNumber:0},value:[this.hashAlgorithm.toSchema()]})),this.maskGenAlgorithm.isEqual(a.defaultValues("maskGenAlgorithm"))||e.push(new n.g({idBlock:{tagClass:3,tagNumber:1},value:[this.maskGenAlgorithm.toSchema()]})),this.saltLength!==a.defaultValues("saltLength")&&e.push(new n.g({idBlock:{tagClass:3,tagNumber:2},value:[new n.m({value:this.saltLength})]})),this.trailerField!==a.defaultValues("trailerField")&&e.push(new n.g({idBlock:{tagClass:3,tagNumber:3},value:[new n.m({value:this.trailerField})]})),new n.v({value:e})}toJSON(){const e={};return this.hashAlgorithm.isEqual(a.defaultValues("hashAlgorithm"))||(e.hashAlgorithm=this.hashAlgorithm.toJSON()),this.maskGenAlgorithm.isEqual(a.defaultValues("maskGenAlgorithm"))||(e.maskGenAlgorithm=this.maskGenAlgorithm.toJSON()),this.saltLength!==a.defaultValues("saltLength")&&(e.saltLength=this.saltLength),this.trailerField!==a.defaultValues("trailerField")&&(e.trailerField=this.trailerField),e}}},function(e,t,r){"use strict";(function(e){
2
- /*!
3
- * MIT License
4
- *
5
- * Copyright (c) 2017-2022 Peculiar Ventures, LLC
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- *
25
- */
26
- Object.defineProperty(t,"__esModule",{value:!0});class r{static isArrayBuffer(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e).slice().buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){const n=r.toUint8Array(e),s=r.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let e=0;e<n.length;e++)if(n[e]!==s[e])return!1;return!0}static concat(...e){if(Array.isArray(e[0])){const t=e[0];let r=0;for(const e of t)r+=e.byteLength;const n=new Uint8Array(r);let s=0;for(const e of t){const t=this.toUint8Array(e);n.set(t,s),s+=t.length}return e[1]?this.toView(n,e[1]):n.buffer}return this.concat(e)}}class n{static fromString(e){const t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r.buffer}static toString(e){const t=r.toUint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return decodeURIComponent(escape(n))}}class s{static toString(e,t=!1){const n=r.toArrayBuffer(e),s=new DataView(n);let i="";for(let e=0;e<n.byteLength;e+=2){const r=s.getUint16(e,t);i+=String.fromCharCode(r)}return i}static fromString(e,t=!1){const r=new ArrayBuffer(2*e.length),n=new DataView(r);for(let r=0;r<e.length;r++)n.setUint16(2*r,e.charCodeAt(r),t);return r}}class i{static isHex(e){return"string"==typeof e&&/^[a-z0-9]+$/i.test(e)}static isBase64(e){return"string"==typeof e&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}static isBase64Url(e){return"string"==typeof e&&/^[a-zA-Z0-9-_]+$/i.test(e)}static ToString(e,t="utf8"){const n=r.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return s.toString(n,!0);case"utf16":case"utf16be":return s.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return s.fromString(e,!0);case"utf16":case"utf16be":return s.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(t){const n=r.toUint8Array(t);if("undefined"!=typeof btoa){const e=this.ToString(n,"binary");return btoa(e)}return e.from(n).toString("base64")}static FromBase64(t){const r=this.formatString(t);if(!r)return new ArrayBuffer(0);if(!i.isBase64(r))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return"undefined"!=typeof atob?this.FromBinary(atob(r)):new Uint8Array(e.from(r,"base64")).buffer}static FromBase64Url(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!i.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=i.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return n.fromString(e);case"utf16":case"utf16be":return s.fromString(e);case"utf16le":case"usc2":return s.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=i.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return n.toString(e);case"utf16":case"utf16be":return s.toString(e);case"utf16le":case"usc2":return s.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=e.charCodeAt(n);return r.buffer}static ToBinary(e){const t=r.toUint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return n}static ToHex(e){const t=r.toUint8Array(e),n=[],s=t.length;for(let e=0;e<s;e++){const r=t[e].toString(16).padStart(2,"0");n.push(r)}return n.join("")}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!i.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t="0"+t);const r=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const n=t.slice(e,e+2);r[e/2]=parseInt(n,16)}return r.buffer}static ToUtf16String(e,t=!1){return s.toString(e,t)}static FromUtf16String(e,t=!1){return s.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let r=0;r<t;r++)e+="=";return e}static formatString(e){return(null==e?void 0:e.replace(/[\n\r\t ]/g,""))||""}}i.DEFAULT_UTF8_ENCODING="utf8",t.BufferSourceConverter=r,t.Convert=i,t.assign=function(e,...t){const r=arguments[0];for(let e=1;e<arguments.length;e++){const t=arguments[e];for(const e in t)r[e]=t[e]}return r},t.combine=function(...e){const t=e.map(e=>e.byteLength).reduce((e,t)=>e+t),r=new Uint8Array(t);let n=0;return e.map(e=>new Uint8Array(e)).forEach(e=>{for(const t of e)r[n++]=t}),r.buffer},t.isEqual=function(e,t){if(!e||!t)return!1;if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let t=0;t<e.byteLength;t++)if(r[t]!==n[t])return!1;return!0}}).call(this,r(22).Buffer)},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),s=r(1);class i{constructor(e={}){this.modulus=Object(s.f)(e,"modulus",i.defaultValues("modulus")),this.publicExponent=Object(s.f)(e,"publicExponent",i.defaultValues("publicExponent")),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"modulus":case"publicExponent":return new n.m;default:throw new Error("Invalid member name for RSAPublicKey class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.modulus||""}),new n.m({name:t.publicExponent||""})]})}fromSchema(e){Object(s.d)(e,["modulus","publicExponent"]);const t=n.D(e,e,i.schema({names:{modulus:"modulus",publicExponent:"publicExponent"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RSAPublicKey");this.modulus=t.result.modulus.convertFromDER(256),this.publicExponent=t.result.publicExponent}toSchema(){return new n.v({value:[this.modulus.convertToDER(),this.publicExponent]})}toJSON(){return{n:Object(s.k)(Object(s.a)(this.modulus.valueBlock.valueHex),!0,!0,!0),e:Object(s.k)(Object(s.a)(this.publicExponent.valueBlock.valueHex),!0,!0,!0)}}fromJSON(e){if(!("n"in e))throw new Error('Absent mandatory parameter "n"');{const t=Object(s.j)(Object(s.e)(e.n,!0));this.modulus=new n.m({valueHex:t.slice(0,Math.pow(2,Object(s.h)(t.byteLength)))})}if(!("e"in e))throw new Error('Absent mandatory parameter "e"');this.publicExponent=new n.m({valueHex:Object(s.j)(Object(s.e)(e.e,!0)).slice(0,3)})}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),s=r(1),i=r(8);class a{constructor(e={}){this.version=Object(s.f)(e,"version",a.defaultValues("version")),this.privateKey=Object(s.f)(e,"privateKey",a.defaultValues("privateKey")),"namedCurve"in e&&(this.namedCurve=Object(s.f)(e,"namedCurve",a.defaultValues("namedCurve"))),"publicKey"in e&&(this.publicKey=Object(s.f)(e,"publicKey",a.defaultValues("publicKey"))),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"version":return 1;case"privateKey":return new n.q;case"namedCurve":return"";case"publicKey":return new i.a;default:throw new Error("Invalid member name for ECCPrivateKey class: "+e)}}static compareWithDefault(e,t){switch(e){case"version":return t===a.defaultValues(e);case"privateKey":return t.isEqual(a.defaultValues(e));case"namedCurve":return""===t;case"publicKey":return i.a.compareWithDefault("namedCurve",t.namedCurve)&&i.a.compareWithDefault("x",t.x)&&i.a.compareWithDefault("y",t.y);default:throw new Error("Invalid member name for ECCPrivateKey class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.version||""}),new n.q({name:t.privateKey||""}),new n.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new n.p({name:t.namedCurve||""})]}),new n.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new n.b({name:t.publicKey||""})]})]})}fromSchema(e){Object(s.d)(e,["version","privateKey","namedCurve","publicKey"]);const t=n.D(e,e,a.schema({names:{version:"version",privateKey:"privateKey",namedCurve:"namedCurve",publicKey:"publicKey"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for ECPrivateKey");if(this.version=t.result.version.valueBlock.valueDec,this.privateKey=t.result.privateKey,"namedCurve"in t.result&&(this.namedCurve=t.result.namedCurve.valueBlock.toString()),"publicKey"in t.result){const e={schema:t.result.publicKey.valueBlock.valueHex};"namedCurve"in this&&(e.namedCurve=this.namedCurve),this.publicKey=new i.a(e)}}toSchema(){const e=[new n.m({value:this.version}),this.privateKey];return"namedCurve"in this&&e.push(new n.g({idBlock:{tagClass:3,tagNumber:0},value:[new n.p({value:this.namedCurve})]})),"publicKey"in this&&e.push(new n.g({idBlock:{tagClass:3,tagNumber:1},value:[new n.b({valueHex:this.publicKey.toSchema().toBER(!1)})]})),new n.v({value:e})}toJSON(){if("namedCurve"in this==!1||a.compareWithDefault("namedCurve",this.namedCurve))throw new Error('Not enough information for making JSON: absent "namedCurve" value');let e="";switch(this.namedCurve){case"1.2.840.10045.3.1.7":e="P-256";break;case"1.3.132.0.34":e="P-384";break;case"1.3.132.0.35":e="P-521"}const t={crv:e,d:Object(s.k)(Object(s.a)(this.privateKey.valueBlock.valueHex),!0,!0,!1)};if("publicKey"in this){const e=this.publicKey.toJSON();t.x=e.x,t.y=e.y}return t}fromJSON(e){let t=0;if(!("crv"in e))throw new Error('Absent mandatory parameter "crv"');switch(e.crv.toUpperCase()){case"P-256":this.namedCurve="1.2.840.10045.3.1.7",t=32;break;case"P-384":this.namedCurve="1.3.132.0.34",t=48;break;case"P-521":this.namedCurve="1.3.132.0.35",t=66}if(!("d"in e))throw new Error('Absent mandatory parameter "d"');{const r=Object(s.j)(Object(s.e)(e.d,!0));if(r.byteLength<t){const e=new ArrayBuffer(t),s=new Uint8Array(e),i=new Uint8Array(r);s.set(i,1),this.privateKey=new n.q({valueHex:e})}else this.privateKey=new n.q({valueHex:r.slice(0,t)})}"x"in e&&"y"in e&&(this.publicKey=new i.a({json:e}))}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),s=r(1),i=r(12);class a{constructor(e={}){this.version=Object(s.f)(e,"version",a.defaultValues("version")),this.modulus=Object(s.f)(e,"modulus",a.defaultValues("modulus")),this.publicExponent=Object(s.f)(e,"publicExponent",a.defaultValues("publicExponent")),this.privateExponent=Object(s.f)(e,"privateExponent",a.defaultValues("privateExponent")),this.prime1=Object(s.f)(e,"prime1",a.defaultValues("prime1")),this.prime2=Object(s.f)(e,"prime2",a.defaultValues("prime2")),this.exponent1=Object(s.f)(e,"exponent1",a.defaultValues("exponent1")),this.exponent2=Object(s.f)(e,"exponent2",a.defaultValues("exponent2")),this.coefficient=Object(s.f)(e,"coefficient",a.defaultValues("coefficient")),"otherPrimeInfos"in e&&(this.otherPrimeInfos=Object(s.f)(e,"otherPrimeInfos",a.defaultValues("otherPrimeInfos"))),"schema"in e&&this.fromSchema(e.schema),"json"in e&&this.fromJSON(e.json)}static defaultValues(e){switch(e){case"version":return 0;case"modulus":case"publicExponent":case"privateExponent":case"prime1":case"prime2":case"exponent1":case"exponent2":case"coefficient":return new n.m;case"otherPrimeInfos":return[];default:throw new Error("Invalid member name for RSAPrivateKey class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[new n.m({name:t.version||""}),new n.m({name:t.modulus||""}),new n.m({name:t.publicExponent||""}),new n.m({name:t.privateExponent||""}),new n.m({name:t.prime1||""}),new n.m({name:t.prime2||""}),new n.m({name:t.exponent1||""}),new n.m({name:t.exponent2||""}),new n.m({name:t.coefficient||""}),new n.v({optional:!0,value:[new n.u({name:t.otherPrimeInfosName||"",value:i.a.schema(t.otherPrimeInfo||{})})]})]})}fromSchema(e){Object(s.d)(e,["version","modulus","publicExponent","privateExponent","prime1","prime2","exponent1","exponent2","coefficient","otherPrimeInfos"]);const t=n.D(e,e,a.schema({names:{version:"version",modulus:"modulus",publicExponent:"publicExponent",privateExponent:"privateExponent",prime1:"prime1",prime2:"prime2",exponent1:"exponent1",exponent2:"exponent2",coefficient:"coefficient",otherPrimeInfo:{names:{blockName:"otherPrimeInfos"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RSAPrivateKey");this.version=t.result.version.valueBlock.valueDec,this.modulus=t.result.modulus.convertFromDER(256),this.publicExponent=t.result.publicExponent,this.privateExponent=t.result.privateExponent.convertFromDER(256),this.prime1=t.result.prime1.convertFromDER(128),this.prime2=t.result.prime2.convertFromDER(128),this.exponent1=t.result.exponent1.convertFromDER(128),this.exponent2=t.result.exponent2.convertFromDER(128),this.coefficient=t.result.coefficient.convertFromDER(128),"otherPrimeInfos"in t.result&&(this.otherPrimeInfos=Array.from(t.result.otherPrimeInfos,e=>new i.a({schema:e})))}toSchema(){const e=[];return e.push(new n.m({value:this.version})),e.push(this.modulus.convertToDER()),e.push(this.publicExponent),e.push(this.privateExponent.convertToDER()),e.push(this.prime1.convertToDER()),e.push(this.prime2.convertToDER()),e.push(this.exponent1.convertToDER()),e.push(this.exponent2.convertToDER()),e.push(this.coefficient.convertToDER()),"otherPrimeInfos"in this&&e.push(new n.v({value:Array.from(this.otherPrimeInfos,e=>e.toSchema())})),new n.v({value:e})}toJSON(){const e={n:Object(s.k)(Object(s.a)(this.modulus.valueBlock.valueHex),!0,!0,!0),e:Object(s.k)(Object(s.a)(this.publicExponent.valueBlock.valueHex),!0,!0,!0),d:Object(s.k)(Object(s.a)(this.privateExponent.valueBlock.valueHex),!0,!0,!0),p:Object(s.k)(Object(s.a)(this.prime1.valueBlock.valueHex),!0,!0,!0),q:Object(s.k)(Object(s.a)(this.prime2.valueBlock.valueHex),!0,!0,!0),dp:Object(s.k)(Object(s.a)(this.exponent1.valueBlock.valueHex),!0,!0,!0),dq:Object(s.k)(Object(s.a)(this.exponent2.valueBlock.valueHex),!0,!0,!0),qi:Object(s.k)(Object(s.a)(this.coefficient.valueBlock.valueHex),!0,!0,!0)};return"otherPrimeInfos"in this&&(e.oth=Array.from(this.otherPrimeInfos,e=>e.toJSON())),e}fromJSON(e){if(!("n"in e))throw new Error('Absent mandatory parameter "n"');if(this.modulus=new n.m({valueHex:Object(s.j)(Object(s.e)(e.n,!0,!0))}),!("e"in e))throw new Error('Absent mandatory parameter "e"');if(this.publicExponent=new n.m({valueHex:Object(s.j)(Object(s.e)(e.e,!0,!0))}),!("d"in e))throw new Error('Absent mandatory parameter "d"');if(this.privateExponent=new n.m({valueHex:Object(s.j)(Object(s.e)(e.d,!0,!0))}),!("p"in e))throw new Error('Absent mandatory parameter "p"');if(this.prime1=new n.m({valueHex:Object(s.j)(Object(s.e)(e.p,!0,!0))}),!("q"in e))throw new Error('Absent mandatory parameter "q"');if(this.prime2=new n.m({valueHex:Object(s.j)(Object(s.e)(e.q,!0,!0))}),!("dp"in e))throw new Error('Absent mandatory parameter "dp"');if(this.exponent1=new n.m({valueHex:Object(s.j)(Object(s.e)(e.dp,!0,!0))}),!("dq"in e))throw new Error('Absent mandatory parameter "dq"');if(this.exponent2=new n.m({valueHex:Object(s.j)(Object(s.e)(e.dq,!0,!0))}),!("qi"in e))throw new Error('Absent mandatory parameter "qi"');this.coefficient=new n.m({valueHex:Object(s.j)(Object(s.e)(e.qi,!0,!0))}),"oth"in e&&(this.otherPrimeInfos=Array.from(e.oth,e=>new i.a({json:e})))}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),s=r(1),i=r(3);class a{constructor(e={}){this.keyDerivationFunc=Object(s.f)(e,"keyDerivationFunc",a.defaultValues("keyDerivationFunc")),this.encryptionScheme=Object(s.f)(e,"encryptionScheme",a.defaultValues("encryptionScheme")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"keyDerivationFunc":case"encryptionScheme":return new i.a;default:throw new Error("Invalid member name for PBES2Params class: "+e)}}static schema(e={}){const t=Object(s.f)(e,"names",{});return new n.v({name:t.blockName||"",value:[i.a.schema(t.keyDerivationFunc||{}),i.a.schema(t.encryptionScheme||{})]})}fromSchema(e){Object(s.d)(e,["keyDerivationFunc","encryptionScheme"]);const t=n.D(e,e,a.schema({names:{keyDerivationFunc:{names:{blockName:"keyDerivationFunc"}},encryptionScheme:{names:{blockName:"encryptionScheme"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PBES2Params");this.keyDerivationFunc=new i.a({schema:t.result.keyDerivationFunc}),this.encryptionScheme=new i.a({schema:t.result.encryptionScheme})}toSchema(){return new n.v({value:[this.keyDerivationFunc.toSchema(),this.encryptionScheme.toSchema()]})}toJSON(){return{keyDerivationFunc:this.keyDerivationFunc.toJSON(),encryptionScheme:this.encryptionScheme.toJSON()}}}},function(e,t,r){"use strict";function n(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var s=n({HTML:"text/html",isHTML:function(e){return e===s.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),i=n({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===i.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.assign=function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},t.freeze=n,t.MIME_TYPE=s,t.NAMESPACE=i},function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(0),s=r(1),i=r(4),a=r(7),o=r(9),u=r(3),c=r(6),l=r(13),h=r(10),f=r(18);function m(e,t,r,n,s,i){let a,o;const u=[];switch(t.toUpperCase()){case"SHA-1":a=20,o=64;break;case"SHA-256":a=32,o=64;break;case"SHA-384":a=48,o=128;break;case"SHA-512":a=64,o=128;break;default:throw new Error("Unsupported hashing algorithm")}const c=new Uint8Array(n),l=new ArrayBuffer(2*n.byteLength+2),h=new Uint8Array(l);for(let e=0;e<c.length;e++)h[2*e]=0,h[2*e+1]=c[e];h[h.length-2]=0,h[h.length-1]=0,n=l.slice(0);const f=new ArrayBuffer(o),m=new Uint8Array(f);for(let e=0;e<f.byteLength;e++)m[e]=3;const p=s.byteLength,d=o*Math.ceil(p/o),g=new ArrayBuffer(d),b=new Uint8Array(g),y=new Uint8Array(s);for(let e=0;e<d;e++)b[e]=y[e%p];const w=n.byteLength,v=o*Math.ceil(w/o),N=new ArrayBuffer(v),A=new Uint8Array(N),S=new Uint8Array(n);for(let e=0;e<v;e++)A[e]=S[e%w];const E=g.byteLength+N.byteLength;let C=new ArrayBuffer(E),k=new Uint8Array(C);k.set(b),k.set(A,b.length);const O=Math.ceil((r>>3)/a);let I=Promise.resolve(C);for(let r=0;r<=O;r++){I=I.then(e=>{const t=new ArrayBuffer(f.byteLength+e.byteLength),r=new Uint8Array(t);return r.set(m),r.set(k,m.length),t});for(let r=0;r<i;r++)I=I.then(r=>e.digest({name:t},new Uint8Array(r)));I=I.then(e=>{const t=new ArrayBuffer(o),r=new Uint8Array(t);for(let n=0;n<t.byteLength;n++)r[n]=e[n%e.length];const n=Math.ceil(p/o)+Math.ceil(w/o),s=[];let i=0,a=o;for(let e=0;e<n;e++){const e=Array.from(new Uint8Array(C.slice(i,i+a)));i+=o,i+o>C.byteLength&&(a=C.byteLength-i);let n=511;for(let s=t.byteLength-1;s>=0;s--)n>>=8,n+=r[s]+e[s],e[s]=255&n;s.push(...e)}return C=new ArrayBuffer(s.length),k=new Uint8Array(C),k.set(s),u.push(...new Uint8Array(e)),C})}return I=I.then(()=>{const e=new ArrayBuffer(r>>3);return new Uint8Array(e).set(new Uint8Array(u).slice(0,r>>3)),e}),I}class p{constructor(e={}){this.crypto=Object(s.f)(e,"crypto",{}),this.subtle=Object(s.f)(e,"subtle",{}),this.name=Object(s.f)(e,"name","")}importKey(e,t,r,i,u){let c={};switch(t instanceof Uint8Array&&(t=t.buffer),e.toLowerCase()){case"raw":return this.subtle.importKey("raw",t,r,i,u);case"spki":{const e=n.E(t);if(-1===e.offset)return Promise.reject("Incorrect keyData");const s=new a.a;try{s.fromSchema(e.result)}catch(e){return Promise.reject("Incorrect keyData")}switch(r.name.toUpperCase()){case"RSA-PSS":switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="PS1";break;case"SHA-256":c.alg="PS256";break;case"SHA-384":c.alg="PS384";break;case"SHA-512":c.alg="PS512";break;default:return Promise.reject("Incorrect hash algorithm: "+r.hash.name.toUpperCase())}case"RSASSA-PKCS1-V1_5":{if(u=["verify"],c.kty="RSA",c.ext=i,c.key_ops=u,"1.2.840.113549.1.1.1"!==s.algorithm.algorithmId)return Promise.reject("Incorrect public key algorithm: "+s.algorithm.algorithmId);if("alg"in c==!1)switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="RS1";break;case"SHA-256":c.alg="RS256";break;case"SHA-384":c.alg="RS384";break;case"SHA-512":c.alg="RS512";break;default:return Promise.reject("Incorrect hash algorithm: "+r.hash.name.toUpperCase())}const e=s.toJSON();for(const t of Object.keys(e))c[t]=e[t]}break;case"ECDSA":u=["verify"];case"ECDH":{if(c={kty:"EC",ext:i,key_ops:u},"1.2.840.10045.2.1"!==s.algorithm.algorithmId)return Promise.reject("Incorrect public key algorithm: "+s.algorithm.algorithmId);const e=s.toJSON();for(const t of Object.keys(e))c[t]=e[t]}break;case"RSA-OAEP":{if(c.kty="RSA",c.ext=i,c.key_ops=u,"safari"===this.name.toLowerCase())c.alg="RSA-OAEP";else switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="RSA-OAEP";break;case"SHA-256":c.alg="RSA-OAEP-256";break;case"SHA-384":c.alg="RSA-OAEP-384";break;case"SHA-512":c.alg="RSA-OAEP-512";break;default:return Promise.reject("Incorrect hash algorithm: "+r.hash.name.toUpperCase())}const e=s.toJSON();for(const t of Object.keys(e))c[t]=e[t]}break;case"RSAES-PKCS1-V1_5":{c.kty="RSA",c.ext=i,c.key_ops=u,c.alg="PS1";const e=s.toJSON();for(const t of Object.keys(e))c[t]=e[t]}break;default:return Promise.reject("Incorrect algorithm name: "+r.name.toUpperCase())}}break;case"pkcs8":{const e=new o.a,s=n.E(t);if(-1===s.offset)return Promise.reject("Incorrect keyData");try{e.fromSchema(s.result)}catch(e){return Promise.reject("Incorrect keyData")}if("parsedKey"in e==!1)return Promise.reject("Incorrect keyData");switch(r.name.toUpperCase()){case"RSA-PSS":switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="PS1";break;case"SHA-256":c.alg="PS256";break;case"SHA-384":c.alg="PS384";break;case"SHA-512":c.alg="PS512";break;default:return Promise.reject("Incorrect hash algorithm: "+r.hash.name.toUpperCase())}case"RSASSA-PKCS1-V1_5":{if(u=["sign"],c.kty="RSA",c.ext=i,c.key_ops=u,"1.2.840.113549.1.1.1"!==e.privateKeyAlgorithm.algorithmId)return Promise.reject("Incorrect private key algorithm: "+e.privateKeyAlgorithm.algorithmId);if("alg"in c==!1)switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="RS1";break;case"SHA-256":c.alg="RS256";break;case"SHA-384":c.alg="RS384";break;case"SHA-512":c.alg="RS512";break;default:return Promise.reject("Incorrect hash algorithm: "+r.hash.name.toUpperCase())}const t=e.toJSON();for(const e of Object.keys(t))c[e]=t[e]}break;case"ECDSA":u=["sign"];case"ECDH":{if(c={kty:"EC",ext:i,key_ops:u},"1.2.840.10045.2.1"!==e.privateKeyAlgorithm.algorithmId)return Promise.reject("Incorrect algorithm: "+e.privateKeyAlgorithm.algorithmId);const t=e.toJSON();for(const e of Object.keys(t))c[e]=t[e]}break;case"RSA-OAEP":{if(c.kty="RSA",c.ext=i,c.key_ops=u,"safari"===this.name.toLowerCase())c.alg="RSA-OAEP";else switch(r.hash.name.toUpperCase()){case"SHA-1":c.alg="RSA-OAEP";break;case"SHA-256":c.alg="RSA-OAEP-256";break;case"SHA-384":c.alg="RSA-OAEP-384";break;case"SHA-512":c.alg="RSA-OAEP-512";break;default:return Promise.reject("Incorrect hash algorithm: "+r.hash.name.toUpperCase())}const t=e.toJSON();for(const e of Object.keys(t))c[e]=t[e]}break;case"RSAES-PKCS1-V1_5":{u=["decrypt"],c.kty="RSA",c.ext=i,c.key_ops=u,c.alg="PS1";const t=e.toJSON();for(const e of Object.keys(t))c[e]=t[e]}break;default:return Promise.reject("Incorrect algorithm name: "+r.name.toUpperCase())}}break;case"jwk":c=t;break;default:return Promise.reject("Incorrect format: "+e)}return"safari"===this.name.toLowerCase()?Promise.resolve().then(()=>this.subtle.importKey("jwk",Object(s.j)(JSON.stringify(c)),r,i,u)).then(e=>e,()=>this.subtle.importKey("jwk",c,r,i,u)):this.subtle.importKey("jwk",c,r,i,u)}exportKey(e,t){let r=this.subtle.exportKey("jwk",t);switch("safari"===this.name.toLowerCase()&&(r=r.then(e=>e instanceof ArrayBuffer?JSON.parse(Object(s.a)(e)):e)),e.toLowerCase()){case"raw":return this.subtle.exportKey("raw",t);case"spki":r=r.then(e=>{const t=new a.a;try{t.fromJSON(e)}catch(e){return Promise.reject("Incorrect key data")}return t.toSchema().toBER(!1)});break;case"pkcs8":r=r.then(e=>{const t=new o.a;try{t.fromJSON(e)}catch(e){return Promise.reject("Incorrect key data")}return t.toSchema().toBER(!1)});break;case"jwk":break;default:return Promise.reject("Incorrect format: "+e)}return r}convert(e,t,r,n,s,i){switch(e.toLowerCase()){case"raw":switch(t.toLowerCase()){case"raw":return Promise.resolve(r);case"spki":return Promise.resolve().then(()=>this.importKey("raw",r,n,s,i)).then(e=>this.exportKey("spki",e));case"pkcs8":return Promise.resolve().then(()=>this.importKey("raw",r,n,s,i)).then(e=>this.exportKey("pkcs8",e));case"jwk":return Promise.resolve().then(()=>this.importKey("raw",r,n,s,i)).then(e=>this.exportKey("jwk",e));default:return Promise.reject("Incorrect outputFormat: "+t)}case"spki":switch(t.toLowerCase()){case"raw":return Promise.resolve().then(()=>this.importKey("spki",r,n,s,i)).then(e=>this.exportKey("raw",e));case"spki":return Promise.resolve(r);case"pkcs8":return Promise.reject("Impossible to convert between SPKI/PKCS8");case"jwk":return Promise.resolve().then(()=>this.importKey("spki",r,n,s,i)).then(e=>this.exportKey("jwk",e));default:return Promise.reject("Incorrect outputFormat: "+t)}case"pkcs8":switch(t.toLowerCase()){case"raw":return Promise.resolve().then(()=>this.importKey("pkcs8",r,n,s,i)).then(e=>this.exportKey("raw",e));case"spki":return Promise.reject("Impossible to convert between SPKI/PKCS8");case"pkcs8":return Promise.resolve(r);case"jwk":return Promise.resolve().then(()=>this.importKey("pkcs8",r,n,s,i)).then(e=>this.exportKey("jwk",e));default:return Promise.reject("Incorrect outputFormat: "+t)}case"jwk":switch(t.toLowerCase()){case"raw":return Promise.resolve().then(()=>this.importKey("jwk",r,n,s,i)).then(e=>this.exportKey("raw",e));case"spki":return Promise.resolve().then(()=>this.importKey("jwk",r,n,s,i)).then(e=>this.exportKey("spki",e));case"pkcs8":return Promise.resolve().then(()=>this.importKey("jwk",r,n,s,i)).then(e=>this.exportKey("pkcs8",e));case"jwk":return Promise.resolve(r);default:return Promise.reject("Incorrect outputFormat: "+t)}default:return Promise.reject("Incorrect inputFormat: "+e)}}encrypt(...e){return this.subtle.encrypt(...e)}decrypt(...e){return this.subtle.decrypt(...e)}sign(...e){return this.subtle.sign(...e)}verify(...e){return this.subtle.verify(...e)}digest(...e){return this.subtle.digest(...e)}generateKey(...e){return this.subtle.generateKey(...e)}deriveKey(...e){return this.subtle.deriveKey(...e)}deriveBits(...e){return this.subtle.deriveBits(...e)}wrapKey(...e){return this.subtle.wrapKey(...e)}unwrapKey(...e){return this.subtle.unwrapKey(...e)}getRandomValues(e){if("getRandomValues"in this.crypto==!1)throw new Error("No support for getRandomValues");return this.crypto.getRandomValues(e)}getAlgorithmByOID(e){switch(e){case"1.2.840.113549.1.1.1":return{name:"RSAES-PKCS1-v1_5"};case"1.2.840.113549.1.1.5":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case"1.2.840.113549.1.1.11":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"1.2.840.113549.1.1.12":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"1.2.840.113549.1.1.13":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"1.2.840.113549.1.1.10":return{name:"RSA-PSS"};case"1.2.840.113549.1.1.7":return{name:"RSA-OAEP"};case"1.2.840.10045.2.1":case"1.2.840.10045.4.1":return{name:"ECDSA",hash:{name:"SHA-1"}};case"1.2.840.10045.4.3.2":return{name:"ECDSA",hash:{name:"SHA-256"}};case"1.2.840.10045.4.3.3":return{name:"ECDSA",hash:{name:"SHA-384"}};case"1.2.840.10045.4.3.4":return{name:"ECDSA",hash:{name:"SHA-512"}};case"1.3.133.16.840.63.0.2":return{name:"ECDH",kdf:"SHA-1"};case"1.3.132.1.11.1":return{name:"ECDH",kdf:"SHA-256"};case"1.3.132.1.11.2":return{name:"ECDH",kdf:"SHA-384"};case"1.3.132.1.11.3":return{name:"ECDH",kdf:"SHA-512"};case"2.16.840.1.101.3.4.1.2":return{name:"AES-CBC",length:128};case"2.16.840.1.101.3.4.1.22":return{name:"AES-CBC",length:192};case"2.16.840.1.101.3.4.1.42":return{name:"AES-CBC",length:256};case"2.16.840.1.101.3.4.1.6":return{name:"AES-GCM",length:128};case"2.16.840.1.101.3.4.1.26":return{name:"AES-GCM",length:192};case"2.16.840.1.101.3.4.1.46":return{name:"AES-GCM",length:256};case"2.16.840.1.101.3.4.1.4":return{name:"AES-CFB",length:128};case"2.16.840.1.101.3.4.1.24":return{name:"AES-CFB",length:192};case"2.16.840.1.101.3.4.1.44":return{name:"AES-CFB",length:256};case"2.16.840.1.101.3.4.1.5":return{name:"AES-KW",length:128};case"2.16.840.1.101.3.4.1.25":return{name:"AES-KW",length:192};case"2.16.840.1.101.3.4.1.45":return{name:"AES-KW",length:256};case"1.2.840.113549.2.7":return{name:"HMAC",hash:{name:"SHA-1"}};case"1.2.840.113549.2.9":return{name:"HMAC",hash:{name:"SHA-256"}};case"1.2.840.113549.2.10":return{name:"HMAC",hash:{name:"SHA-384"}};case"1.2.840.113549.2.11":return{name:"HMAC",hash:{name:"SHA-512"}};case"1.2.840.113549.1.9.16.3.5":return{name:"DH"};case"1.3.14.3.2.26":return{name:"SHA-1"};case"2.16.840.1.101.3.4.2.1":return{name:"SHA-256"};case"2.16.840.1.101.3.4.2.2":return{name:"SHA-384"};case"2.16.840.1.101.3.4.2.3":return{name:"SHA-512"};case"1.2.840.113549.1.5.12":return{name:"PBKDF2"};case"1.2.840.10045.3.1.7":return{name:"P-256"};case"1.3.132.0.34":return{name:"P-384"};case"1.3.132.0.35":return{name:"P-521"}}return{}}getOIDByAlgorithm(e){let t="";switch(e.name.toUpperCase()){case"RSAES-PKCS1-V1_5":t="1.2.840.113549.1.1.1";break;case"RSASSA-PKCS1-V1_5":switch(e.hash.name.toUpperCase()){case"SHA-1":t="1.2.840.113549.1.1.5";break;case"SHA-256":t="1.2.840.113549.1.1.11";break;case"SHA-384":t="1.2.840.113549.1.1.12";break;case"SHA-512":t="1.2.840.113549.1.1.13"}break;case"RSA-PSS":t="1.2.840.113549.1.1.10";break;case"RSA-OAEP":t="1.2.840.113549.1.1.7";break;case"ECDSA":switch(e.hash.name.toUpperCase()){case"SHA-1":t="1.2.840.10045.4.1";break;case"SHA-256":t="1.2.840.10045.4.3.2";break;case"SHA-384":t="1.2.840.10045.4.3.3";break;case"SHA-512":t="1.2.840.10045.4.3.4"}break;case"ECDH":switch(e.kdf.toUpperCase()){case"SHA-1":t="1.3.133.16.840.63.0.2";break;case"SHA-256":t="1.3.132.1.11.1";break;case"SHA-384":t="1.3.132.1.11.2";break;case"SHA-512":t="1.3.132.1.11.3"}break;case"AES-CTR":break;case"AES-CBC":switch(e.length){case 128:t="2.16.840.1.101.3.4.1.2";break;case 192:t="2.16.840.1.101.3.4.1.22";break;case 256:t="2.16.840.1.101.3.4.1.42"}break;case"AES-CMAC":break;case"AES-GCM":switch(e.length){case 128:t="2.16.840.1.101.3.4.1.6";break;case 192:t="2.16.840.1.101.3.4.1.26";break;case 256:t="2.16.840.1.101.3.4.1.46"}break;case"AES-CFB":switch(e.length){case 128:t="2.16.840.1.101.3.4.1.4";break;case 192:t="2.16.840.1.101.3.4.1.24";break;case 256:t="2.16.840.1.101.3.4.1.44"}break;case"AES-KW":switch(e.length){case 128:t="2.16.840.1.101.3.4.1.5";break;case 192:t="2.16.840.1.101.3.4.1.25";break;case 256:t="2.16.840.1.101.3.4.1.45"}break;case"HMAC":switch(e.hash.name.toUpperCase()){case"SHA-1":t="1.2.840.113549.2.7";break;case"SHA-256":t="1.2.840.113549.2.9";break;case"SHA-384":t="1.2.840.113549.2.10";break;case"SHA-512":t="1.2.840.113549.2.11"}break;case"DH":t="1.2.840.113549.1.9.16.3.5";break;case"SHA-1":t="1.3.14.3.2.26";break;case"SHA-256":t="2.16.840.1.101.3.4.2.1";break;case"SHA-384":t="2.16.840.1.101.3.4.2.2";break;case"SHA-512":t="2.16.840.1.101.3.4.2.3";break;case"CONCAT":case"HKDF":break;case"PBKDF2":t="1.2.840.113549.1.5.12";break;case"P-256":t="1.2.840.10045.3.1.7";break;case"P-384":t="1.3.132.0.34";break;case"P-521":t="1.3.132.0.35"}return t}getAlgorithmParameters(e,t){let r={algorithm:{},usages:[]};switch(e.toUpperCase()){case"RSAES-PKCS1-V1_5":case"RSASSA-PKCS1-V1_5":switch(t.toLowerCase()){case"generatekey":r={algorithm:{name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},usages:["sign","verify"]};break;case"verify":case"sign":case"importkey":r={algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},usages:["verify"]};break;case"exportkey":default:return{algorithm:{name:"RSASSA-PKCS1-v1_5"},usages:[]}}break;case"RSA-PSS":switch(t.toLowerCase()){case"sign":case"verify":r={algorithm:{name:"RSA-PSS",hash:{name:"SHA-1"},saltLength:20},usages:["sign","verify"]};break;case"generatekey":r={algorithm:{name:"RSA-PSS",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-1"}},usages:["sign","verify"]};break;case"importkey":r={algorithm:{name:"RSA-PSS",hash:{name:"SHA-1"}},usages:["verify"]};break;case"exportkey":default:return{algorithm:{name:"RSA-PSS"},usages:[]}}break;case"RSA-OAEP":switch(t.toLowerCase()){case"encrypt":case"decrypt":r={algorithm:{name:"RSA-OAEP"},usages:["encrypt","decrypt"]};break;case"generatekey":r={algorithm:{name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"importkey":r={algorithm:{name:"RSA-OAEP",hash:{name:"SHA-256"}},usages:["encrypt"]};break;case"exportkey":default:return{algorithm:{name:"RSA-OAEP"},usages:[]}}break;case"ECDSA":switch(t.toLowerCase()){case"generatekey":r={algorithm:{name:"ECDSA",namedCurve:"P-256"},usages:["sign","verify"]};break;case"importkey":r={algorithm:{name:"ECDSA",namedCurve:"P-256"},usages:["verify"]};break;case"verify":case"sign":r={algorithm:{name:"ECDSA",hash:{name:"SHA-256"}},usages:["sign"]};break;default:return{algorithm:{name:"ECDSA"},usages:[]}}break;case"ECDH":switch(t.toLowerCase()){case"exportkey":case"importkey":case"generatekey":r={algorithm:{name:"ECDH",namedCurve:"P-256"},usages:["deriveKey","deriveBits"]};break;case"derivekey":case"derivebits":r={algorithm:{name:"ECDH",namedCurve:"P-256",public:[]},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"ECDH"},usages:[]}}break;case"AES-CTR":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":r={algorithm:{name:"AES-CTR",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":r={algorithm:{name:"AES-CTR",counter:new Uint8Array(16),length:10},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-CTR"},usages:[]}}break;case"AES-CBC":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":r={algorithm:{name:"AES-CBC",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":r={algorithm:{name:"AES-CBC",iv:this.getRandomValues(new Uint8Array(16))},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-CBC"},usages:[]}}break;case"AES-GCM":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":r={algorithm:{name:"AES-GCM",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":r={algorithm:{name:"AES-GCM",iv:this.getRandomValues(new Uint8Array(16))},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-GCM"},usages:[]}}break;case"AES-KW":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":case"wrapkey":case"unwrapkey":r={algorithm:{name:"AES-KW",length:256},usages:["wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-KW"},usages:[]}}break;case"HMAC":switch(t.toLowerCase()){case"sign":case"verify":r={algorithm:{name:"HMAC"},usages:["sign","verify"]};break;case"importkey":case"exportkey":case"generatekey":r={algorithm:{name:"HMAC",length:32,hash:{name:"SHA-256"}},usages:["sign","verify"]};break;default:return{algorithm:{name:"HMAC"},usages:[]}}break;case"HKDF":switch(t.toLowerCase()){case"derivekey":r={algorithm:{name:"HKDF",hash:"SHA-256",salt:new Uint8Array([]),info:new Uint8Array([])},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"HKDF"},usages:[]}}break;case"PBKDF2":switch(t.toLowerCase()){case"derivekey":r={algorithm:{name:"PBKDF2",hash:{name:"SHA-256"},salt:new Uint8Array([]),iterations:1e4},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"PBKDF2"},usages:[]}}}return r}getHashAlgorithm(e){let t="";switch(e.algorithmId){case"1.2.840.10045.4.1":case"1.2.840.113549.1.1.5":t="SHA-1";break;case"1.2.840.10045.4.3.2":case"1.2.840.113549.1.1.11":t="SHA-256";break;case"1.2.840.10045.4.3.3":case"1.2.840.113549.1.1.12":t="SHA-384";break;case"1.2.840.10045.4.3.4":case"1.2.840.113549.1.1.13":t="SHA-512";break;case"1.2.840.113549.1.1.10":try{const r=new l.a({schema:e.algorithmParams});if("hashAlgorithm"in r){const e=this.getAlgorithmByOID(r.hashAlgorithm.algorithmId);if("name"in e==!1)return"";t=e.name}else t="SHA-1"}catch(e){}}return t}encryptEncryptedContentInfo(e){if(e instanceof Object==!1)return Promise.reject('Parameters must have type "Object"');if("password"in e==!1)return Promise.reject('Absent mandatory parameter "password"');if("contentEncryptionAlgorithm"in e==!1)return Promise.reject('Absent mandatory parameter "contentEncryptionAlgorithm"');if("hmacHashAlgorithm"in e==!1)return Promise.reject('Absent mandatory parameter "hmacHashAlgorithm"');if("iterationCount"in e==!1)return Promise.reject('Absent mandatory parameter "iterationCount"');if("contentToEncrypt"in e==!1)return Promise.reject('Absent mandatory parameter "contentToEncrypt"');if("contentType"in e==!1)return Promise.reject('Absent mandatory parameter "contentType"');const t=this.getOIDByAlgorithm(e.contentEncryptionAlgorithm);if(""===t)return Promise.reject('Wrong "contentEncryptionAlgorithm" value');const r=this.getOIDByAlgorithm({name:"PBKDF2"});if(""===r)return Promise.reject("Can not find OID for PBKDF2");const s=this.getOIDByAlgorithm({name:"HMAC",hash:{name:e.hmacHashAlgorithm}});if(""===s)return Promise.reject('Incorrect value for "hmacHashAlgorithm": '+e.hmacHashAlgorithm);let i=Promise.resolve();const a=new ArrayBuffer(16),o=new Uint8Array(a);this.getRandomValues(o);const l=new ArrayBuffer(64),m=new Uint8Array(l);this.getRandomValues(m);const p=new Uint8Array(e.contentToEncrypt),d=new h.a({salt:new n.q({valueHex:l}),iterationCount:e.iterationCount,prf:new u.a({algorithmId:s,algorithmParams:new n.n})});return i=i.then(()=>{const t=new Uint8Array(e.password);return this.importKey("raw",t,"PBKDF2",!1,["deriveKey"])},e=>Promise.reject(e)),i=i.then(t=>this.deriveKey({name:"PBKDF2",hash:{name:e.hmacHashAlgorithm},salt:m,iterations:e.iterationCount},t,e.contentEncryptionAlgorithm,!1,["encrypt"]),e=>Promise.reject(e)),i=i.then(t=>this.encrypt({name:e.contentEncryptionAlgorithm.name,iv:o},t,p),e=>Promise.reject(e)),i=i.then(s=>{const i=new f.a({keyDerivationFunc:new u.a({algorithmId:r,algorithmParams:d.toSchema()}),encryptionScheme:new u.a({algorithmId:t,algorithmParams:new n.q({valueHex:a})})});return new c.a({contentType:e.contentType,contentEncryptionAlgorithm:new u.a({algorithmId:"1.2.840.113549.1.5.13",algorithmParams:i.toSchema()}),encryptedContent:new n.q({valueHex:s})})},e=>Promise.reject(e)),i}decryptEncryptedContentInfo(e){if(e instanceof Object==!1)return Promise.reject('Parameters must have type "Object"');if("password"in e==!1)return Promise.reject('Absent mandatory parameter "password"');if("encryptedContentInfo"in e==!1)return Promise.reject('Absent mandatory parameter "encryptedContentInfo"');if("1.2.840.113549.1.5.13"!==e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId)return Promise.reject('Unknown "contentEncryptionAlgorithm": '+e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId);let t,r,n=Promise.resolve();try{t=new f.a({schema:e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams})}catch(e){return Promise.reject('Incorrectly encoded "pbes2Parameters"')}try{r=new h.a({schema:t.keyDerivationFunc.algorithmParams})}catch(e){return Promise.reject('Incorrectly encoded "pbkdf2Params"')}const i=this.getAlgorithmByOID(t.encryptionScheme.algorithmId);if("name"in i==!1)return Promise.reject('Incorrect OID for "contentEncryptionAlgorithm": '+t.encryptionScheme.algorithmId);const a=t.encryptionScheme.algorithmParams.valueBlock.valueHex,o=new Uint8Array(a),u=r.salt.valueBlock.valueHex,c=new Uint8Array(u),l=r.iterationCount;let m="SHA-1";if("prf"in r){const e=this.getAlgorithmByOID(r.prf.algorithmId);if("name"in e==!1)return Promise.reject("Incorrect OID for HMAC hash algorithm");m=e.hash.name}return n=n.then(()=>this.importKey("raw",e.password,"PBKDF2",!1,["deriveKey"]),e=>Promise.reject(e)),n=n.then(e=>this.deriveKey({name:"PBKDF2",hash:{name:m},salt:c,iterations:l},e,i,!1,["decrypt"]),e=>Promise.reject(e)),n=n.then(t=>{let r=new ArrayBuffer(0);if(!1===e.encryptedContentInfo.encryptedContent.idBlock.isConstructed)r=e.encryptedContentInfo.encryptedContent.valueBlock.valueHex;else for(const t of e.encryptedContentInfo.encryptedContent.valueBlock.value)r=Object(s.l)(r,t.valueBlock.valueHex);return this.decrypt({name:i.name,iv:o},t,r)},e=>Promise.reject(e)),n}stampDataWithPassword(e){if(e instanceof Object==!1)return Promise.reject('Parameters must have type "Object"');if("password"in e==!1)return Promise.reject('Absent mandatory parameter "password"');if("hashAlgorithm"in e==!1)return Promise.reject('Absent mandatory parameter "hashAlgorithm"');if("salt"in e==!1)return Promise.reject('Absent mandatory parameter "iterationCount"');if("iterationCount"in e==!1)return Promise.reject('Absent mandatory parameter "salt"');if("contentToStamp"in e==!1)return Promise.reject('Absent mandatory parameter "contentToStamp"');let t;switch(e.hashAlgorithm.toLowerCase()){case"sha-1":t=160;break;case"sha-256":t=256;break;case"sha-384":t=384;break;case"sha-512":t=512;break;default:return Promise.reject('Incorrect "parameters.hashAlgorithm" parameter: '+e.hashAlgorithm)}let r=Promise.resolve();const n={name:"HMAC",length:t,hash:{name:e.hashAlgorithm}};return r=r.then(()=>m(this,e.hashAlgorithm,t,e.password,e.salt,e.iterationCount)),r=r.then(e=>this.importKey("raw",new Uint8Array(e),n,!1,["sign"])),r=r.then(t=>this.sign(n,t,new Uint8Array(e.contentToStamp)),e=>Promise.reject(e)),r}verifyDataStampedWithPassword(e){if(e instanceof Object==!1)return Promise.reject('Parameters must have type "Object"');if("password"in e==!1)return Promise.reject('Absent mandatory parameter "password"');if("hashAlgorithm"in e==!1)return Promise.reject('Absent mandatory parameter "hashAlgorithm"');if("salt"in e==!1)return Promise.reject('Absent mandatory parameter "iterationCount"');if("iterationCount"in e==!1)return Promise.reject('Absent mandatory parameter "salt"');if("contentToVerify"in e==!1)return Promise.reject('Absent mandatory parameter "contentToVerify"');if("signatureToVerify"in e==!1)return Promise.reject('Absent mandatory parameter "signatureToVerify"');let t;switch(e.hashAlgorithm.toLowerCase()){case"sha-1":t=160;break;case"sha-256":t=256;break;case"sha-384":t=384;break;case"sha-512":t=512;break;default:return Promise.reject('Incorrect "parameters.hashAlgorithm" parameter: '+e.hashAlgorithm)}let r=Promise.resolve();const n={name:"HMAC",length:t,hash:{name:e.hashAlgorithm}};return r=r.then(()=>m(this,e.hashAlgorithm,t,e.password,e.salt,e.iterationCount)),r=r.then(e=>this.importKey("raw",new Uint8Array(e),n,!1,["verify"])),r=r.then(t=>this.verify(n,t,new Uint8Array(e.signatureToVerify),new Uint8Array(e.contentToVerify)),e=>Promise.reject(e)),r}getSignatureParameters(e,t="SHA-1"){if(""===this.getOIDByAlgorithm({name:t}))return Promise.reject("Unsupported hash algorithm: "+t);const r=new u.a,s=this.getAlgorithmParameters(e.algorithm.name,"sign");switch(s.algorithm.hash.name=t,e.algorithm.name.toUpperCase()){case"RSASSA-PKCS1-V1_5":case"ECDSA":r.algorithmId=this.getOIDByAlgorithm(s.algorithm);break;case"RSA-PSS":{switch(t.toUpperCase()){case"SHA-256":s.algorithm.saltLength=32;break;case"SHA-384":s.algorithm.saltLength=48;break;case"SHA-512":s.algorithm.saltLength=64}const e={};if("SHA-1"!==t.toUpperCase()){const r=this.getOIDByAlgorithm({name:t});if(""===r)return Promise.reject("Unsupported hash algorithm: "+t);e.hashAlgorithm=new u.a({algorithmId:r,algorithmParams:new n.n}),e.maskGenAlgorithm=new u.a({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:e.hashAlgorithm.toSchema()})}20!==s.algorithm.saltLength&&(e.saltLength=s.algorithm.saltLength);const i=new l.a(e);r.algorithmId="1.2.840.113549.1.1.10",r.algorithmParams=i.toSchema()}break;default:return Promise.reject("Unsupported signature algorithm: "+e.algorithm.name)}return Promise.resolve().then(()=>({signatureAlgorithm:r,parameters:s}))}signWithPrivateKey(e,t,r){return this.sign(r.algorithm,t,new Uint8Array(e)).then(e=>("ECDSA"===r.algorithm.name&&(e=Object(i.a)(e)),e),e=>Promise.reject("Signing error: "+e))}fillPublicKeyParameters(e,t){const r={},n=this.getHashAlgorithm(t);if(""===n)return Promise.reject("Unsupported signature algorithm: "+t.algorithmId);let s;s="1.2.840.113549.1.1.10"===t.algorithmId?t.algorithmId:e.algorithm.algorithmId;const i=this.getAlgorithmByOID(s);if("name"in i==="")return Promise.reject("Unsupported public key algorithm: "+t.algorithmId);if(r.algorithm=this.getAlgorithmParameters(i.name,"importkey"),"hash"in r.algorithm.algorithm&&(r.algorithm.algorithm.hash.name=n),"ECDSA"===i.name){let t=!1;if("algorithmParams"in e.algorithm==!0&&"idBlock"in e.algorithm.algorithmParams&&1===e.algorithm.algorithmParams.idBlock.tagClass&&6===e.algorithm.algorithmParams.idBlock.tagNumber&&(t=!0),!1===t)return Promise.reject("Incorrect type for ECDSA public key parameters");const n=this.getAlgorithmByOID(e.algorithm.algorithmParams.valueBlock.toString());if("name"in n==!1)return Promise.reject("Unsupported named curve algorithm: "+e.algorithm.algorithmParams.valueBlock.toString());r.algorithm.algorithm.namedCurve=n.name}return r}getPublicKey(e,t,r=null){null===r&&(r=this.fillPublicKeyParameters(e,t));const n=e.toSchema().toBER(!1),s=new Uint8Array(n);return this.importKey("spki",s,r.algorithm.algorithm,!0,r.algorithm.usages)}verifyWithPublicKey(e,t,r,s,a=null){let o=Promise.resolve();if(null===a){if(""===(a=this.getHashAlgorithm(s)))return Promise.reject("Unsupported signature algorithm: "+s.algorithmId);o=o.then(()=>this.getPublicKey(r,s))}else{const e={};let t;t="1.2.840.113549.1.1.10"===s.algorithmId?s.algorithmId:r.algorithm.algorithmId;const n=this.getAlgorithmByOID(t);if("name"in n==="")return Promise.reject("Unsupported public key algorithm: "+s.algorithmId);if(e.algorithm=this.getAlgorithmParameters(n.name,"importkey"),"hash"in e.algorithm.algorithm&&(e.algorithm.algorithm.hash.name=a),"ECDSA"===n.name){let t=!1;if("algorithmParams"in r.algorithm==!0&&"idBlock"in r.algorithm.algorithmParams&&1===r.algorithm.algorithmParams.idBlock.tagClass&&6===r.algorithm.algorithmParams.idBlock.tagNumber&&(t=!0),!1===t)return Promise.reject("Incorrect type for ECDSA public key parameters");const n=this.getAlgorithmByOID(r.algorithm.algorithmParams.valueBlock.toString());if("name"in n==!1)return Promise.reject("Unsupported named curve algorithm: "+r.algorithm.algorithmParams.valueBlock.toString());e.algorithm.algorithm.namedCurve=n.name}o=o.then(()=>this.getPublicKey(r,null,e))}return o=o.then(r=>{const o=this.getAlgorithmParameters(r.algorithm.name,"verify");"hash"in o.algorithm&&(o.algorithm.hash.name=a);let u=t.valueBlock.valueHex;if("ECDSA"===r.algorithm.name){const e=n.E(u);u=Object(i.b)(e.result)}if("RSA-PSS"===r.algorithm.name){let e;try{e=new l.a({schema:s.algorithmParams})}catch(e){return Promise.reject(e)}o.algorithm.saltLength="saltLength"in e?e.saltLength:20;let t="SHA-1";if("hashAlgorithm"in e){const r=this.getAlgorithmByOID(e.hashAlgorithm.algorithmId);if("name"in r==!1)return Promise.reject("Unrecognized hash algorithm: "+e.hashAlgorithm.algorithmId);t=r.name}o.algorithm.hash.name=t}return this.verify(o.algorithm,r,new Uint8Array(u),new Uint8Array(e))}),o}}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";(function(e){
27
- /*!
28
- * The buffer module from node.js, for the browser.
29
- *
30
- * @author Feross Aboukhadijeh <http://feross.org>
31
- * @license MIT
32
- */
33
- var n=r(26),s=r(27),i=r(28);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=f(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),s=(e=o(e,n)).write(t,r);s!==n&&(e=e.slice(0,s));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|m(t.length);return 0===(e=o(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?o(e,0):f(e,t);if("Buffer"===t.type&&i(t.data))return f(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(l(t),e=o(e,t<0?0:0|m(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|m(t.length);e=o(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function m(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return M(e).length;default:if(n)return H(e).length;t=(""+t).toLowerCase(),n=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,s);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,s){var i,a=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(s){var l=-1;for(i=r;i<o;i++)if(c(e,i)===c(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*a}else-1!==l&&(i-=i-l),l=-1}else for(r+u>o&&(r=o-u),i=r;i>=0;i--){for(var h=!0,f=0;f<u;f++)if(c(e,i+f)!==c(t,f)){h=!1;break}if(h)return i}return-1}function w(e,t,r,n){r=Number(r)||0;var s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var o=parseInt(t.substr(2*a,2),16);if(isNaN(o))return a;e[r+a]=o}return a}function v(e,t,r,n){return F(H(t,e.length-r),e,r,n)}function N(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function A(e,t,r,n){return N(e,t,r,n)}function S(e,t,r,n){return F(M(t),e,r,n)}function E(e,t,r,n){return F(function(e,t){for(var r,n,s,i=[],a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,s=r%256,i.push(s),i.push(n);return i}(t,e.length-r),e,r,n)}function C(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],s=t;s<r;){var i,a,o,u,c=e[s],l=null,h=c>239?4:c>223?3:c>191?2:1;if(s+h<=r)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[s+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[s+1],a=e[s+2],128==(192&i)&&128==(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[s+1],a=e[s+2],o=e[s+3],128==(192&i)&&128==(192&a)&&128==(192&o)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&o)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),s+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?o(e,t):void 0!==r?"string"==typeof n?o(e,t).fill(r,n):o(e,t).fill(r):o(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return h(null,e)},u.allocUnsafeSlow=function(e){return h(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,s=0,i=Math.min(r,n);s<i;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),s=0;for(r=0;r<e.length;++r){var a=e[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,s),s+=a.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?k(this,0,e):d.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,s){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(s>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),o=Math.min(i,a),c=this.slice(n,s),l=e.slice(t,r),h=0;h<o;++h)if(c[h]!==l[h]){i=c[h],a=l[h];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return N(this,e,t,r);case"latin1":case"binary":return A(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(127&e[s]);return n}function I(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}function x(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var s="",i=t;i<r;++i)s+=_(e[i]);return s}function B(e,t,r){for(var n=e.slice(t,r),s="",i=0;i<n.length;i+=2)s+=String.fromCharCode(n[i]+256*n[i+1]);return s}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,s,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n){t<0&&(t=65535+t+1);for(var s=0,i=Math.min(e.length-r,2);s<i;++s)e[r+s]=(t&255<<8*(n?s:1-s))>>>8*(n?s:1-s)}function R(e,t,r,n){t<0&&(t=4294967295+t+1);for(var s=0,i=Math.min(e.length-r,4);s<i;++s)e[r+s]=t>>>8*(n?s:3-s)&255}function j(e,t,r,n,s,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,n,i){return i||j(e,0,r,4),s.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,i){return i||j(e,0,r,8),s.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var s=t-e;r=new u(s,void 0);for(var i=0;i<s;++i)r[i]=this[i+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n},u.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var n=t,s=1,i=this[e+--n];n>0&&(s*=256);)i+=this[e+--n]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),s.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),s.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),s.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),s.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var s=1,i=0;for(this[t]=255&e;++i<r&&(s*=256);)this[t+i]=e/s&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||T(this,e,t,r,Math.pow(2,8*r)-1,0);var s=r-1,i=1;for(this[t+s]=255&e;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*r-1);T(this,e,t,r,s-1,-s)}var i=0,a=1,o=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var s=Math.pow(2,8*r-1);T(this,e,t,r,s-1,-s)}var i=r-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var s,i=n-r;if(this===e&&r<t&&t<n)for(s=i-1;s>=0;--s)e[s+t]=this[s+r];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(s=0;s<i;++s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var s=e.charCodeAt(0);s<256&&(e=s)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=u.isBuffer(e)?e:H(new u(e,n).toString()),o=a.length;for(i=0;i<r-t;++i)this[i+t]=a[i%o]}return this};var V=/[^+\/0-9A-Za-z-_]/g;function _(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){var r;t=t||1/0;for(var n=e.length,s=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),s=r;continue}r=65536+(s-55296<<10|r-56320)}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function M(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var s=0;s<n&&!(s+r>=t.length||s>=e.length);++s)t[s+r]=e[s];return s}}).call(this,r(21))},function(e,t,r){var n=r(19).NAMESPACE;function s(e){return""!==e}function i(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function a(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(s):[]}(e);return Object.keys(t.reduce(i,{}))}function o(e,t){for(var r in e)t[r]=e[r]}function u(e,t){var r=e.prototype;if(!(r instanceof t)){function n(){}n.prototype=t.prototype,o(r,n=new n),e.prototype=r=n}r.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),r.constructor=e)}var c={},l=c.ELEMENT_NODE=1,h=c.ATTRIBUTE_NODE=2,f=c.TEXT_NODE=3,m=c.CDATA_SECTION_NODE=4,p=c.ENTITY_REFERENCE_NODE=5,d=c.ENTITY_NODE=6,g=c.PROCESSING_INSTRUCTION_NODE=7,b=c.COMMENT_NODE=8,y=c.DOCUMENT_NODE=9,w=c.DOCUMENT_TYPE_NODE=10,v=c.DOCUMENT_FRAGMENT_NODE=11,N=c.NOTATION_NODE=12,A={},S={},E=(A.INDEX_SIZE_ERR=(S[1]="Index size error",1),A.DOMSTRING_SIZE_ERR=(S[2]="DOMString size error",2),A.HIERARCHY_REQUEST_ERR=(S[3]="Hierarchy request error",3)),C=(A.WRONG_DOCUMENT_ERR=(S[4]="Wrong document",4),A.INVALID_CHARACTER_ERR=(S[5]="Invalid character",5),A.NO_DATA_ALLOWED_ERR=(S[6]="No data allowed",6),A.NO_MODIFICATION_ALLOWED_ERR=(S[7]="No modification allowed",7),A.NOT_FOUND_ERR=(S[8]="Not found",8)),k=(A.NOT_SUPPORTED_ERR=(S[9]="Not supported",9),A.INUSE_ATTRIBUTE_ERR=(S[10]="Attribute in use",10));A.INVALID_STATE_ERR=(S[11]="Invalid state",11),A.SYNTAX_ERR=(S[12]="Syntax error",12),A.INVALID_MODIFICATION_ERR=(S[13]="Invalid modification",13),A.NAMESPACE_ERR=(S[14]="Invalid namespace",14),A.INVALID_ACCESS_ERR=(S[15]="Invalid access",15);function O(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,S[e]),this.message=S[e],Error.captureStackTrace&&Error.captureStackTrace(this,O);return r.code=e,t&&(this.message=this.message+": "+t),r}function I(){}function x(e,t){this._node=e,this._refresh=t,B(this)}function B(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var r=e._refresh(e._node);oe(e,"length",r.length),o(r,e),e._inc=t}}function D(){}function T(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function P(e,t,r,s){if(s?t[T(t,s)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(s&&H(i,e,s),function(e,t,r){e&&e._inc++,r.namespaceURI===n.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(i,e,r))}}function R(e,t,r){var n=T(t,r);if(!(n>=0))throw O(C,new Error(e.tagName+"@"+r));for(var s=t.length-1;n<s;)t[n]=t[++n];if(t.length=s,e){var i=e.ownerDocument;i&&(H(i,e,r),r.ownerElement=null)}}function j(){}function L(){}function U(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function V(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(V(e,t))return!0}while(e=e.nextSibling)}function _(){}function H(e,t,r,s){e&&e._inc++,r.namespaceURI===n.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function M(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var s=t.firstChild,i=0;s;)n[i++]=s,s=s.nextSibling;n.length=i,delete n[n.length]}}}function F(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,M(e.ownerDocument,e),t}function K(e,t,r){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===v){var s=t.firstChild;if(null==s)return t;var i=t.lastChild}else s=i=t;var a=r?r.previousSibling:e.lastChild;s.previousSibling=a,i.nextSibling=r,a?a.nextSibling=s:e.firstChild=s,null==r?e.lastChild=i:r.previousSibling=i;do{s.parentNode=e}while(s!==i&&(s=s.nextSibling));return M(e.ownerDocument||e,e),t.nodeType==v&&(t.firstChild=t.lastChild=null),t}function q(){this._nsMap={}}function J(){}function G(){}function X(){}function W(){}function Y(){}function Q(){}function $(){}function z(){}function Z(){}function ee(){}function te(){}function re(){}function ne(e,t){var r=[],n=9==this.nodeType&&this.documentElement||this,s=n.prefix,i=n.namespaceURI;if(i&&null==s&&null==(s=n.lookupPrefix(i)))var a=[{namespace:i,prefix:null}];return ae(this,r,e,t,a),r.join("")}function se(e,t,r){var s=e.prefix||"",i=e.namespaceURI;if(!i)return!1;if("xml"===s&&i===n.XML||i===n.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===s)return o.namespace!==i}return!0}function ie(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,U),'"')}function ae(e,t,r,s,i){if(i||(i=[]),s){if(!(e=s(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case l:var a=e.attributes,o=a.length,u=e.firstChild,c=e.tagName,d=c;if(!(r=n.isHTML(e.namespaceURI)||r)&&!e.prefix&&e.namespaceURI){for(var N,A=0;A<a.length;A++)if("xmlns"===a.item(A).name){N=a.item(A).value;break}if(!N)for(var S=i.length-1;S>=0;S--){if(""===(E=i[S]).prefix&&E.namespace===e.namespaceURI){N=E.namespace;break}}if(N!==e.namespaceURI)for(S=i.length-1;S>=0;S--){var E;if((E=i[S]).namespace===e.namespaceURI){E.prefix&&(d=E.prefix+":"+c);break}}}t.push("<",d);for(var C=0;C<o;C++){"xmlns"==(k=a.item(C)).prefix?i.push({prefix:k.localName,namespace:k.value}):"xmlns"==k.nodeName&&i.push({prefix:"",namespace:k.value})}for(C=0;C<o;C++){var k,O,I;if(se(k=a.item(C),0,i))ie(t,(O=k.prefix||"")?"xmlns:"+O:"xmlns",I=k.namespaceURI),i.push({prefix:O,namespace:I});ae(k,t,r,s,i)}if(c===d&&se(e,0,i))ie(t,(O=e.prefix||"")?"xmlns:"+O:"xmlns",I=e.namespaceURI),i.push({prefix:O,namespace:I});if(u||r&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(t.push(">"),r&&/^script$/i.test(c))for(;u;)u.data?t.push(u.data):ae(u,t,r,s,i.slice()),u=u.nextSibling;else for(;u;)ae(u,t,r,s,i.slice()),u=u.nextSibling;t.push("</",d,">")}else t.push("/>");return;case y:case v:for(u=e.firstChild;u;)ae(u,t,r,s,i.slice()),u=u.nextSibling;return;case h:return ie(t,e.name,e.value);case f:return t.push(e.data.replace(/[<&>]/g,U));case m:return t.push("<![CDATA[",e.data,"]]>");case b:return t.push("\x3c!--",e.data,"--\x3e");case w:var x=e.publicId,B=e.systemId;if(t.push("<!DOCTYPE ",e.name),x)t.push(" PUBLIC ",x),B&&"."!=B&&t.push(" ",B),t.push(">");else if(B&&"."!=B)t.push(" SYSTEM ",B,">");else{var D=e.internalSubset;D&&t.push(" [",D,"]"),t.push(">")}return;case g:return t.push("<?",e.target," ",e.data,"?>");case p:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function oe(e,t,r){e[t]=r}O.prototype=Error.prototype,o(A,O),I.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var r=[],n=0;n<this.length;n++)ae(this[n],r,e,t);return r.join("")}},x.prototype.item=function(e){return B(this),this[e]},u(x,I),D.prototype={length:0,item:I.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new O(k);var r=this.getNamedItem(e.nodeName);return P(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new O(k);return t=this.getNamedItemNS(e.namespaceURI,e.localName),P(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return R(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return R(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var n=this[r];if(n.localName==t&&n.namespaceURI==e)return n}return null}},j.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new _;if(n.implementation=this,n.childNodes=new I,n.doctype=r||null,r&&n.appendChild(r),t){var s=n.createElementNS(e,t);n.appendChild(s)}return n},createDocumentType:function(e,t,r){var n=new Q;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}},L.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return K(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return F(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,r,n){var s=new r.constructor;for(var i in r){var a=r[i];"object"!=typeof a&&a!=s[i]&&(s[i]=a)}r.childNodes&&(s.childNodes=new I);switch(s.ownerDocument=t,s.nodeType){case l:var o=r.attributes,u=s.attributes=new D,c=o.length;u._ownerElement=s;for(var f=0;f<c;f++)s.setAttributeNode(e(t,o.item(f),!0));break;case h:n=!0}if(n)for(var m=r.firstChild;m;)s.appendChild(e(t,m,n)),m=m.nextSibling;return s}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==f&&e.nodeType==f?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var n in r)if(r[n]==e)return n;t=t.nodeType==h?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&e in r)return r[e];t=t.nodeType==h?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},o(c,L),o(c,L.prototype),_.prototype={nodeName:"#document",nodeType:y,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==v){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return null==this.documentElement&&e.nodeType==l&&(this.documentElement=e),K(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),F(this,e)},importNode:function(e,t){return function e(t,r,n){var s;switch(r.nodeType){case l:(s=r.cloneNode(!1)).ownerDocument=t;case v:break;case h:n=!0}s||(s=r.cloneNode(!1));if(s.ownerDocument=t,s.parentNode=null,n)for(var i=r.firstChild;i;)s.appendChild(e(t,i,n)),i=i.nextSibling;return s}(this,e,t)},getElementById:function(e){var t=null;return V(this.documentElement,(function(r){if(r.nodeType==l&&r.getAttribute("id")==e)return t=r,!0})),t},getElementsByClassName:function(e){var t=a(e);return new x(this,(function(r){var n=[];return t.length>0&&V(r.documentElement,(function(s){if(s!==r&&s.nodeType===l){var i=s.getAttribute("class");if(i){var o=e===i;if(!o){var u=a(i);o=t.every((c=u,function(e){return c&&-1!==c.indexOf(e)}))}o&&n.push(s)}}var c})),n}))},createElement:function(e){var t=new q;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new I,(t.attributes=new D)._ownerElement=t,t},createDocumentFragment:function(){var e=new ee;return e.ownerDocument=this,e.childNodes=new I,e},createTextNode:function(e){var t=new X;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new W;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Y;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new te;return r.ownerDocument=this,r.tagName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new J;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new q,n=t.split(":"),s=r.attributes=new D;return r.childNodes=new I,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=t,s._ownerElement=r,r},createAttributeNS:function(e,t){var r=new J,n=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=t,r}},u(_,L),q.prototype={nodeType:l,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===v?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,M(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new x(this,(function(t){var r=[];return V(t,(function(n){n===t||n.nodeType!=l||"*"!==e&&n.tagName!=e||r.push(n)})),r}))},getElementsByTagNameNS:function(e,t){return new x(this,(function(r){var n=[];return V(r,(function(s){s===r||s.nodeType!==l||"*"!==e&&s.namespaceURI!==e||"*"!==t&&s.localName!=t||n.push(s)})),n}))}},_.prototype.getElementsByTagName=q.prototype.getElementsByTagName,_.prototype.getElementsByTagNameNS=q.prototype.getElementsByTagNameNS,u(q,L),J.prototype.nodeType=h,u(J,L),G.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(S[E])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},u(G,L),X.prototype={nodeName:"#text",nodeType:f,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},u(X,G),W.prototype={nodeName:"#comment",nodeType:b},u(W,G),Y.prototype={nodeName:"#cdata-section",nodeType:m},u(Y,G),Q.prototype.nodeType=w,u(Q,L),$.prototype.nodeType=N,u($,L),z.prototype.nodeType=d,u(z,L),Z.prototype.nodeType=p,u(Z,L),ee.prototype.nodeName="#document-fragment",ee.prototype.nodeType=v,u(ee,L),te.prototype.nodeType=g,u(te,L),re.prototype.serializeToString=function(e,t,r){return ne.call(e,t,r)},L.prototype.toString=ne;try{if(Object.defineProperty){Object.defineProperty(x.prototype,"length",{get:function(){return B(this),this.$$length}}),Object.defineProperty(L.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case l:case v:var r=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&r.push(e(t)),t=t.nextSibling;return r.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case l:case v:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),oe=function(e,t,r){e["$$"+t]=r}}}catch(e){}t.DocumentType=Q,t.DOMException=O,t.DOMImplementation=j,t.Element=q,t.Node=L,t.NodeList=I,t.XMLSerializer=re},function(e,t,r){!function(e){"use strict";var t=function(e,t){for(var r=0;r<t.length;r+=1)e(t[r],r,t)},r=function(e,r,n){var s=r;return t((function(t,r){s=e(s,t,r)}),n),s},n=function(e,r){var n=new Array(r.length);return t((function(t,r){n[r]=e(t)}),r),n};function s(e){return e.toString()}var i=function(e,t){return t.join(e)},a=function(e,t,r){return e+r+t},o=Array.prototype.concat;function u(e,t){for(var r=Object(e),n=1;n<arguments.length;n++){var s=arguments[n];if(null!=s)for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])}return r}function c(){this.init()}function l(e){this.expression=e}function h(e,t,r){t in e||(e[t]=r)}function f(){}function m(e){arguments.length>0&&this.init(e)}function p(e){arguments.length>0&&this.init(e)}function d(e,t){arguments.length>0&&this.init(e,t)}function g(e,t){arguments.length>0&&this.init(e,t)}function b(e,t){arguments.length>0&&this.init(e,t)}function y(e,t){arguments.length>0&&this.init(e,t)}function w(e,t){arguments.length>0&&this.init(e,t)}function v(e,t){arguments.length>0&&this.init(e,t)}function N(e,t){arguments.length>0&&this.init(e,t)}function A(e,t){arguments.length>0&&this.init(e,t)}function S(e,t){arguments.length>0&&this.init(e,t)}function E(e,t){arguments.length>0&&this.init(e,t)}function C(e,t){arguments.length>0&&this.init(e,t)}function k(e,t){arguments.length>0&&this.init(e,t)}function O(e,t){arguments.length>0&&this.init(e,t)}function I(e,t){arguments.length>0&&this.init(e,t)}function x(e,t){arguments.length>0&&this.init(e,t)}function B(e,t,r){arguments.length>0&&this.init(e,t,r)}function D(e){for(;e&&e.parentNode;)e=e.parentNode;return e}function T(e,t,r){return B.applyPredicates(e.predicates,t,B.applyStep(e,t,r))}function P(e,t,r){return function(e){for(var t=[],r=0;r<e.length;r+=32767){var n=e.slice(r,r+32767);t=o.apply(t,n)}return t}(n(T.bind(null,r,e),t))}function R(e,t){arguments.length>0&&this.init(e,t)}function j(e,t,r){arguments.length>0&&this.init(e,t,r)}function L(e,t){arguments.length>0&&this.init(e,t)}function U(e){arguments.length>0&&this.init(e)}function V(e,t){arguments.length>0&&this.init(e,t)}c.prototype=new Object,c.prototype.constructor=c,c.superclass=Object.prototype,c.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(e){return new g(e[0],e[2])},this.reduceActions[5]=function(e){return new b(e[0],e[2])},this.reduceActions[7]=function(e){return new y(e[0],e[2])},this.reduceActions[8]=function(e){return new w(e[0],e[2])},this.reduceActions[10]=function(e){return new v(e[0],e[2])},this.reduceActions[11]=function(e){return new N(e[0],e[2])},this.reduceActions[12]=function(e){return new A(e[0],e[2])},this.reduceActions[13]=function(e){return new S(e[0],e[2])},this.reduceActions[15]=function(e){return new E(e[0],e[2])},this.reduceActions[16]=function(e){return new C(e[0],e[2])},this.reduceActions[18]=function(e){return new k(e[0],e[2])},this.reduceActions[19]=function(e){return new O(e[0],e[2])},this.reduceActions[20]=function(e){return new I(e[0],e[2])},this.reduceActions[22]=function(e){return new p(e[1])},this.reduceActions[24]=function(e){return new x(e[0],e[2])},this.reduceActions[25]=function(e){return new B(void 0,void 0,e[0])},this.reduceActions[27]=function(e){return e[0].locationPath=e[2],e[0]},this.reduceActions[28]=function(e){return e[0].locationPath=e[2],e[0].locationPath.steps.unshift(new j(j.DESCENDANTORSELF,L.nodeTest,[])),e[0]},this.reduceActions[29]=function(e){return new B(e[0],[],void 0)},this.reduceActions[30]=function(e){return $.instance_of(e[0],B)?(null==e[0].filterPredicates&&(e[0].filterPredicates=[]),e[0].filterPredicates.push(e[1]),e[0]):new B(e[0],[e[1]],void 0)},this.reduceActions[32]=function(e){return e[1]},this.reduceActions[33]=function(e){return new H(e[0])},this.reduceActions[34]=function(e){return new M(e[0])},this.reduceActions[36]=function(e){return new V(e[0],[])},this.reduceActions[37]=function(e){return new V(e[0],e[2])},this.reduceActions[38]=function(e){return[e[0]]},this.reduceActions[39]=function(e){return e[2].unshift(e[0]),e[2]},this.reduceActions[43]=function(e){return new R(!0,[])},this.reduceActions[44]=function(e){return e[1].absolute=!0,e[1]},this.reduceActions[46]=function(e){return new R(!1,[e[0]])},this.reduceActions[47]=function(e){return e[0].steps.push(e[2]),e[0]},this.reduceActions[49]=function(e){return new j(e[0],e[1],[])},this.reduceActions[50]=function(e){return new j(j.CHILD,e[0],[])},this.reduceActions[51]=function(e){return new j(e[0],e[1],e[2])},this.reduceActions[52]=function(e){return new j(j.CHILD,e[0],e[1])},this.reduceActions[54]=function(e){return[e[0]]},this.reduceActions[55]=function(e){return e[1].unshift(e[0]),e[1]},this.reduceActions[56]=function(e){return"ancestor"==e[0]?j.ANCESTOR:"ancestor-or-self"==e[0]?j.ANCESTORORSELF:"attribute"==e[0]?j.ATTRIBUTE:"child"==e[0]?j.CHILD:"descendant"==e[0]?j.DESCENDANT:"descendant-or-self"==e[0]?j.DESCENDANTORSELF:"following"==e[0]?j.FOLLOWING:"following-sibling"==e[0]?j.FOLLOWINGSIBLING:"namespace"==e[0]?j.NAMESPACE:"parent"==e[0]?j.PARENT:"preceding"==e[0]?j.PRECEDING:"preceding-sibling"==e[0]?j.PRECEDINGSIBLING:"self"==e[0]?j.SELF:-1},this.reduceActions[57]=function(e){return j.ATTRIBUTE},this.reduceActions[59]=function(e){return"comment"==e[0]?L.commentTest:"text"==e[0]?L.textTest:"processing-instruction"==e[0]?L.anyPiTest:"node"==e[0]?L.nodeTest:new L(-1,void 0)},this.reduceActions[60]=function(e){return new L.PITest(e[2])},this.reduceActions[61]=function(e){return e[1]},this.reduceActions[63]=function(e){return e[1].absolute=!0,e[1].steps.unshift(new j(j.DESCENDANTORSELF,L.nodeTest,[])),e[1]},this.reduceActions[64]=function(e){return e[0].steps.push(new j(j.DESCENDANTORSELF,L.nodeTest,[])),e[0].steps.push(e[2]),e[0]},this.reduceActions[65]=function(e){return new j(j.SELF,L.nodeTest,[])},this.reduceActions[66]=function(e){return new j(j.PARENT,L.nodeTest,[])},this.reduceActions[67]=function(e){return new U(e[1])},this.reduceActions[68]=function(e){return L.nameTestAny},this.reduceActions[69]=function(e){return new L.NameTestPrefixAny(e[0].split(":")[0])},this.reduceActions[70]=function(e){return new L.NameTestQName(e[0])}},c.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],c.actionTableNumber=[" 1 0 /.-,+*)(' & %$ # \"!"," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY "," 1 0 /.-,+*)(' & %$ # \"!","K1 KKKKKKKK . +*)('KKKKKK KK# K\" "," 1 0 /.-,+*)(' & %$ # \"!"," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q "," 1 . +*)(' # \" ","b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX "," 1 0 /.-,+*)(' & %$m # \"!","_ f________ ______e __ _ "," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 . +*)(' # \" "," 1 . +*)(' # \" ","> >>>>>>>>> >>>>>>> >> >> "," 1 . +*)(' # \" "," 1 . +*)(' # \" ","Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ‡ ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," ˆ "," F‰ ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," Š ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE "," 1 0 /.-,+*)(' & %$ # \"!","] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],c.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","€456789:;<=>?@ AB CDEFGH IJ"," ‚ EFGH IJ "," ƒ EFGH IJ "," "," „ GH IJ "," … GH IJ "," i † "," i ‡ "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABŒqCDEFGH IJ "," "," "],c.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],c.DOUBLEDOT=2,c.DOUBLECOLON=3,c.DOUBLESLASH=4,c.NOTEQUAL=5,c.LESSTHANOREQUAL=6,c.GREATERTHANOREQUAL=7,c.AND=8,c.OR=9,c.MOD=10,c.DIV=11,c.MULTIPLYOPERATOR=12,c.FUNCTIONNAME=13,c.AXISNAME=14,c.LITERAL=15,c.NUMBER=16,c.ASTERISKNAMETEST=17,c.QNAME=18,c.NCNAMECOLONASTERISK=19,c.NODETYPE=20,c.PROCESSINGINSTRUCTIONWITHLITERAL=21,c.EQUALS=22,c.LESSTHAN=23,c.GREATERTHAN=24,c.PLUS=25,c.MINUS=26,c.BAR=27,c.SLASH=28,c.LEFTPARENTHESIS=29,c.RIGHTPARENTHESIS=30,c.COMMA=31,c.AT=32,c.LEFTBRACKET=33,c.RIGHTBRACKET=34,c.DOT=35,c.DOLLAR=36,c.prototype.tokenize=function(e){for(var t=[],r=[],n=e+"\0",s=0,i=n.charAt(s++);;){for(;" "==i||"\t"==i||"\r"==i||"\n"==i;)i=n.charAt(s++);if("\0"==i||s>=n.length)break;if("("!=i)if(")"!=i)if("["!=i)if("]"!=i)if("@"!=i)if(","!=i)if("|"!=i)if("+"!=i)if("-"!=i)if("="!=i)if("$"!=i)if("."!=i)if("'"!=i&&'"'!=i)if(i>="0"&&i<="9"){h=i;for(i=n.charAt(s++);i>="0"&&i<="9";)h+=i,i=n.charAt(s++);if("."==i&&n.charAt(s)>="0"&&n.charAt(s)<="9")for(h+=i,h+=n.charAt(s++),i=n.charAt(s++);i>="0"&&i<="9";)h+=i,i=n.charAt(s++);t.push(c.NUMBER),r.push(h)}else if("*"!=i)if(":"!=i||":"!=n.charAt(s))if("/"!=i)if("!"!=i||"="!=n.charAt(s))if("<"!=i)if(">"!=i){if("_"!=i&&!$.isLetter(i.charCodeAt(0)))throw new Error("Unexpected character "+i);var a=i;for(i=n.charAt(s++);$.isNCNameChar(i.charCodeAt(0));)a+=i,i=n.charAt(s++);if(t.length>0&&(o=t[t.length-1])!=c.AT&&o!=c.DOUBLECOLON&&o!=c.LEFTPARENTHESIS&&o!=c.LEFTBRACKET&&o!=c.AND&&o!=c.OR&&o!=c.MOD&&o!=c.DIV&&o!=c.MULTIPLYOPERATOR&&o!=c.SLASH&&o!=c.DOUBLESLASH&&o!=c.BAR&&o!=c.PLUS&&o!=c.MINUS&&o!=c.EQUALS&&o!=c.NOTEQUAL&&o!=c.LESSTHAN&&o!=c.LESSTHANOREQUAL&&o!=c.GREATERTHAN&&o!=c.GREATERTHANOREQUAL){if("and"==a){t.push(c.AND),r.push(a);continue}if("or"==a){t.push(c.OR),r.push(a);continue}if("mod"==a){t.push(c.MOD),r.push(a);continue}if("div"==a){t.push(c.DIV),r.push(a);continue}}if(":"==i){if("*"==n.charAt(s)){t.push(c.NCNAMECOLONASTERISK),r.push(a+":*"),s++,i=n.charAt(s++);continue}if("_"==n.charAt(s)||$.isLetter(n.charCodeAt(s))){for(a+=":",i=n.charAt(s++);$.isNCNameChar(i.charCodeAt(0));)a+=i,i=n.charAt(s++);if("("==i){t.push(c.FUNCTIONNAME),r.push(a);continue}t.push(c.QNAME),r.push(a);continue}if(":"==n.charAt(s)){t.push(c.AXISNAME),r.push(a);continue}}if("("==i){if("comment"==a||"text"==a||"node"==a){t.push(c.NODETYPE),r.push(a);continue}if("processing-instruction"==a){")"==n.charAt(s)?t.push(c.NODETYPE):t.push(c.PROCESSINGINSTRUCTIONWITHLITERAL),r.push(a);continue}t.push(c.FUNCTIONNAME),r.push(a);continue}t.push(c.QNAME),r.push(a)}else{if("="==n.charAt(s)){t.push(c.GREATERTHANOREQUAL),r.push(">="),s++,i=n.charAt(s++);continue}t.push(c.GREATERTHAN),r.push(">"),i=n.charAt(s++)}else{if("="==n.charAt(s)){t.push(c.LESSTHANOREQUAL),r.push("<="),s++,i=n.charAt(s++);continue}t.push(c.LESSTHAN),r.push("<"),i=n.charAt(s++)}else t.push(c.NOTEQUAL),r.push("!="),s++,i=n.charAt(s++);else{if("/"==(i=n.charAt(s++))){t.push(c.DOUBLESLASH),r.push("//"),i=n.charAt(s++);continue}t.push(c.SLASH),r.push("/")}else t.push(c.DOUBLECOLON),r.push("::"),s++,i=n.charAt(s++);else{var o;if(t.length>0&&(o=t[t.length-1])!=c.AT&&o!=c.DOUBLECOLON&&o!=c.LEFTPARENTHESIS&&o!=c.LEFTBRACKET&&o!=c.AND&&o!=c.OR&&o!=c.MOD&&o!=c.DIV&&o!=c.MULTIPLYOPERATOR&&o!=c.SLASH&&o!=c.DOUBLESLASH&&o!=c.BAR&&o!=c.PLUS&&o!=c.MINUS&&o!=c.EQUALS&&o!=c.NOTEQUAL&&o!=c.LESSTHAN&&o!=c.LESSTHANOREQUAL&&o!=c.GREATERTHAN&&o!=c.GREATERTHANOREQUAL){t.push(c.MULTIPLYOPERATOR),r.push(i),i=n.charAt(s++);continue}t.push(c.ASTERISKNAMETEST),r.push(i),i=n.charAt(s++)}else{for(var u=i,l="";s<n.length&&(i=n.charAt(s))!==u;)l+=i,s+=1;if(i!==u)throw z.fromMessage("Unterminated string literal: "+u+l);s+=1,t.push(c.LITERAL),r.push(l),i=n.charAt(s++)}else{if("."==(i=n.charAt(s++))){t.push(c.DOUBLEDOT),r.push(".."),i=n.charAt(s++);continue}if(i>="0"&&i<="9"){var h="."+i;for(i=n.charAt(s++);i>="0"&&i<="9";)h+=i,i=n.charAt(s++);t.push(c.NUMBER),r.push(h);continue}t.push(c.DOT),r.push(".")}else t.push(c.DOLLAR),r.push(i),i=n.charAt(s++);else t.push(c.EQUALS),r.push(i),i=n.charAt(s++);else t.push(c.MINUS),r.push(i),i=n.charAt(s++);else t.push(c.PLUS),r.push(i),i=n.charAt(s++);else t.push(c.BAR),r.push(i),i=n.charAt(s++);else t.push(c.COMMA),r.push(i),i=n.charAt(s++);else t.push(c.AT),r.push(i),i=n.charAt(s++);else t.push(c.RIGHTBRACKET),r.push(i),i=n.charAt(s++);else t.push(c.LEFTBRACKET),r.push(i),i=n.charAt(s++);else t.push(c.RIGHTPARENTHESIS),r.push(i),i=n.charAt(s++);else t.push(c.LEFTPARENTHESIS),r.push(i),i=n.charAt(s++)}return t.push(1),r.push("[EOF]"),[t,r]},c.SHIFT="s",c.REDUCE="r",c.ACCEPT="a",c.prototype.parse=function(e){var t,r,n=this.tokenize(e);if(null!=n){t=n[0],r=n[1];var s,i,a=0,o=[],u=[],h=[];for(o.push(0),u.push(1),h.push("_S"),s=t[a],i=r[a++];;)switch(e=o[o.length-1],c.actionTable[e].charAt(s-1)){case c.SHIFT:u.push(-s),h.push(i),o.push(c.actionTableNumber[e].charCodeAt(s-1)-32),s=t[a],i=r[a++];break;case c.REDUCE:for(var f=c.productions[c.actionTableNumber[e].charCodeAt(s-1)-32][1],m=[],p=0;p<f;p++)u.pop(),m.unshift(h.pop()),o.pop();var d=o[o.length-1];u.push(c.productions[c.actionTableNumber[e].charCodeAt(s-1)-32][0]),null==this.reduceActions[c.actionTableNumber[e].charCodeAt(s-1)-32]?h.push(m[0]):h.push(this.reduceActions[c.actionTableNumber[e].charCodeAt(s-1)-32](m)),o.push(c.gotoTable[d].charCodeAt(c.productions[c.actionTableNumber[e].charCodeAt(s-1)-32][0]-2)-33);break;case c.ACCEPT:return new l(h.pop());default:throw new Error("XPath parse error")}}},l.prototype=new Object,l.prototype.constructor=l,l.superclass=Object.prototype,l.prototype.toString=function(){return this.expression.toString()},l.prototype.evaluate=function(e){return e.contextNode=e.expressionContextNode,e.contextSize=1,e.contextPosition=1,e.isHtml&&(h(e,"caseInsensitive",!0),h(e,"allowAnyNamespaceForNoPrefix",!0)),h(e,"caseInsensitive",!1),this.expression.evaluate(e)},l.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",l.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",f.prototype=new Object,f.prototype.constructor=f,f.superclass=Object.prototype,f.prototype.init=function(){},f.prototype.toString=function(){return"<Expression>"},f.prototype.evaluate=function(e){throw new Error("Could not evaluate expression.")},m.prototype=new f,m.prototype.constructor=m,m.superclass=f.prototype,m.prototype.init=function(e){this.rhs=e},p.prototype=new m,p.prototype.constructor=p,p.superclass=m.prototype,p.prototype.init=function(e){p.superclass.init.call(this,e)},p.prototype.evaluate=function(e){return this.rhs.evaluate(e).number().negate()},p.prototype.toString=function(){return"-"+this.rhs.toString()},d.prototype=new f,d.prototype.constructor=d,d.superclass=f.prototype,d.prototype.init=function(e,t){this.lhs=e,this.rhs=t},g.prototype=new d,g.prototype.constructor=g,g.superclass=d.prototype,g.prototype.init=function(e,t){g.superclass.init.call(this,e,t)},g.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},g.prototype.evaluate=function(e){var t=this.lhs.evaluate(e).bool();return t.booleanValue()?t:this.rhs.evaluate(e).bool()},b.prototype=new d,b.prototype.constructor=b,b.superclass=d.prototype,b.prototype.init=function(e,t){b.superclass.init.call(this,e,t)},b.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},b.prototype.evaluate=function(e){var t=this.lhs.evaluate(e).bool();return t.booleanValue()?this.rhs.evaluate(e).bool():t},y.prototype=new d,y.prototype.constructor=y,y.superclass=d.prototype,y.prototype.init=function(e,t){y.superclass.init.call(this,e,t)},y.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},y.prototype.evaluate=function(e){return this.lhs.evaluate(e).equals(this.rhs.evaluate(e))},w.prototype=new d,w.prototype.constructor=w,w.superclass=d.prototype,w.prototype.init=function(e,t){w.superclass.init.call(this,e,t)},w.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},w.prototype.evaluate=function(e){return this.lhs.evaluate(e).notequal(this.rhs.evaluate(e))},v.prototype=new d,v.prototype.constructor=v,v.superclass=d.prototype,v.prototype.init=function(e,t){v.superclass.init.call(this,e,t)},v.prototype.evaluate=function(e){return this.lhs.evaluate(e).lessthan(this.rhs.evaluate(e))},v.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},N.prototype=new d,N.prototype.constructor=N,N.superclass=d.prototype,N.prototype.init=function(e,t){N.superclass.init.call(this,e,t)},N.prototype.evaluate=function(e){return this.lhs.evaluate(e).greaterthan(this.rhs.evaluate(e))},N.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},A.prototype=new d,A.prototype.constructor=A,A.superclass=d.prototype,A.prototype.init=function(e,t){A.superclass.init.call(this,e,t)},A.prototype.evaluate=function(e){return this.lhs.evaluate(e).lessthanorequal(this.rhs.evaluate(e))},A.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},S.prototype=new d,S.prototype.constructor=S,S.superclass=d.prototype,S.prototype.init=function(e,t){S.superclass.init.call(this,e,t)},S.prototype.evaluate=function(e){return this.lhs.evaluate(e).greaterthanorequal(this.rhs.evaluate(e))},S.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},E.prototype=new d,E.prototype.constructor=E,E.superclass=d.prototype,E.prototype.init=function(e,t){E.superclass.init.call(this,e,t)},E.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().plus(this.rhs.evaluate(e).number())},E.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},C.prototype=new d,C.prototype.constructor=C,C.superclass=d.prototype,C.prototype.init=function(e,t){C.superclass.init.call(this,e,t)},C.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().minus(this.rhs.evaluate(e).number())},C.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},k.prototype=new d,k.prototype.constructor=k,k.superclass=d.prototype,k.prototype.init=function(e,t){k.superclass.init.call(this,e,t)},k.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().multiply(this.rhs.evaluate(e).number())},k.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},O.prototype=new d,O.prototype.constructor=O,O.superclass=d.prototype,O.prototype.init=function(e,t){O.superclass.init.call(this,e,t)},O.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().div(this.rhs.evaluate(e).number())},O.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},I.prototype=new d,I.prototype.constructor=I,I.superclass=d.prototype,I.prototype.init=function(e,t){I.superclass.init.call(this,e,t)},I.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().mod(this.rhs.evaluate(e).number())},I.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},x.prototype=new d,x.prototype.constructor=x,x.superclass=d.prototype,x.prototype.init=function(e,t){x.superclass.init.call(this,e,t)},x.prototype.evaluate=function(e){return this.lhs.evaluate(e).nodeset().union(this.rhs.evaluate(e).nodeset())},x.prototype.toString=function(){return n(s,[this.lhs,this.rhs]).join(" | ")},B.prototype=new f,B.prototype.constructor=B,B.superclass=f.prototype,B.prototype.init=function(e,t,r){B.superclass.init.call(this),this.filter=e,this.filterPredicates=t,this.locationPath=r},B.applyPredicates=function(e,n,s){if(0===e.length)return s;var i=n.extend({});return r((function(e,r){return i.contextSize=e.length,n=function(e,t){return i.contextNode=e,i.contextPosition=t+1,B.predicateMatches(r,i)},s=[],t((function(e,t){n(e,t)&&s.push(e)}),e),s;var n,s}),s,e)},B.getRoot=function(e,t){var r=t[0];if(9===r.nodeType)return r;if(e.virtualRoot)return e.virtualRoot;var n=r.ownerDocument;if(n)return n;for(var s=r;null!=s.parentNode;)s=s.parentNode;return s},B.applyStep=function(e,t,r){var n=[];switch(t.contextNode=r,e.axis){case j.ANCESTOR:if(t.contextNode===t.virtualRoot)break;for(s=2==t.contextNode.nodeType?B.getOwnerElement(t.contextNode):t.contextNode.parentNode;null!=s&&(e.nodeTest.matches(s,t)&&n.push(s),s!==t.virtualRoot);)s=s.parentNode;break;case j.ANCESTORORSELF:for(var s=t.contextNode;null!=s&&(e.nodeTest.matches(s,t)&&n.push(s),s!==t.virtualRoot);s=2==s.nodeType?B.getOwnerElement(s):s.parentNode);break;case j.ATTRIBUTE:var i=t.contextNode.attributes;if(null!=i)for(var a=0;a<i.length;a++){s=i.item(a);e.nodeTest.matches(s,t)&&n.push(s)}break;case j.CHILD:for(s=t.contextNode.firstChild;null!=s;s=s.nextSibling)e.nodeTest.matches(s,t)&&n.push(s);break;case j.DESCENDANT:for(var o=[t.contextNode.firstChild];o.length>0;)for(s=o.pop();null!=s;)e.nodeTest.matches(s,t)&&n.push(s),null!=s.firstChild?(o.push(s.nextSibling),s=s.firstChild):s=s.nextSibling;break;case j.DESCENDANTORSELF:e.nodeTest.matches(t.contextNode,t)&&n.push(t.contextNode);for(o=[t.contextNode.firstChild];o.length>0;)for(s=o.pop();null!=s;)e.nodeTest.matches(s,t)&&n.push(s),null!=s.firstChild?(o.push(s.nextSibling),s=s.firstChild):s=s.nextSibling;break;case j.FOLLOWING:if(t.contextNode===t.virtualRoot)break;o=[];null!=t.contextNode.firstChild?o.unshift(t.contextNode.firstChild):o.unshift(t.contextNode.nextSibling);for(s=t.contextNode.parentNode;null!=s&&9!=s.nodeType&&s!==t.virtualRoot;s=s.parentNode)o.unshift(s.nextSibling);do{for(s=o.pop();null!=s;)e.nodeTest.matches(s,t)&&n.push(s),null!=s.firstChild?(o.push(s.nextSibling),s=s.firstChild):s=s.nextSibling}while(o.length>0);break;case j.FOLLOWINGSIBLING:if(t.contextNode===t.virtualRoot)break;for(s=t.contextNode.nextSibling;null!=s;s=s.nextSibling)e.nodeTest.matches(s,t)&&n.push(s);break;case j.NAMESPACE:var u={};if(1==t.contextNode.nodeType){u.xml=l.XML_NAMESPACE_URI,u.xmlns=l.XMLNS_NAMESPACE_URI;for(s=t.contextNode;null!=s&&1==s.nodeType;s=s.parentNode)for(a=0;a<s.attributes.length;a++){var c=s.attributes.item(a),h=String(c.name);if("xmlns"==h)null==u[""]&&(u[""]=c.value);else if(h.length>6&&"xmlns:"==h.substring(0,6)){null==u[f=h.substring(6,h.length)]&&(u[f]=c.value)}}for(var f in u){var m=new J(f,u[f],t.contextNode);e.nodeTest.matches(m,t)&&n.push(m)}}break;case j.PARENT:s=null,t.contextNode!==t.virtualRoot&&(s=2==t.contextNode.nodeType?B.getOwnerElement(t.contextNode):t.contextNode.parentNode),null!=s&&e.nodeTest.matches(s,t)&&n.push(s);break;case j.PRECEDING:o=null!=t.virtualRoot?[t.virtualRoot]:[D(t.contextNode)];e:for(;o.length>0;)for(s=o.pop();null!=s;){if(s==t.contextNode)break e;e.nodeTest.matches(s,t)&&n.unshift(s),null!=s.firstChild?(o.push(s.nextSibling),s=s.firstChild):s=s.nextSibling}break;case j.PRECEDINGSIBLING:if(t.contextNode===t.virtualRoot)break;for(s=t.contextNode.previousSibling;null!=s;s=s.previousSibling)e.nodeTest.matches(s,t)&&n.push(s);break;case j.SELF:e.nodeTest.matches(t.contextNode,t)&&n.push(t.contextNode)}return n},B.applySteps=function(e,t,n){return r(P.bind(null,t),n,e)},B.prototype.applyFilter=function(e,t){if(!this.filter)return{nodes:[e.contextNode]};var r=this.filter.evaluate(e);if(!$.instance_of(r,q)){if(null!=this.filterPredicates&&this.filterPredicates.length>0||null!=this.locationPath)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:r}}return{nodes:B.applyPredicates(this.filterPredicates||[],t,r.toUnsortedArray())}},B.applyLocationPath=function(e,t,r){if(!e)return r;var n=e.absolute?[B.getRoot(t,r)]:r;return B.applySteps(e.steps,t,n)},B.prototype.evaluate=function(e){var t=u(new G,e),r=this.applyFilter(e,t);if("nonNodes"in r)return r.nonNodes;var n=new q;return n.addArray(B.applyLocationPath(this.locationPath,t,r.nodes)),n},B.predicateMatches=function(e,t){var r=e.evaluate(t);return $.instance_of(r,M)?t.contextPosition===r.numberValue():r.booleanValue()},B.predicateString=function(e){return a("[","]",e.toString())},B.predicatesString=function(e){return i("",n(B.predicateString,e))},B.prototype.toString=function(){if(null!=this.filter){var e=s(this.filter);return $.instance_of(this.filter,H)?a("'","'",e):null!=this.filterPredicates&&this.filterPredicates.length?a("(",")",e)+B.predicatesString(this.filterPredicates):null!=this.locationPath?e+(this.locationPath.absolute?"":"/")+s(this.locationPath):e}return s(this.locationPath)},B.getOwnerElement=function(e){if(e.ownerElement)return e.ownerElement;try{if(e.selectSingleNode)return e.selectSingleNode("..")}catch(e){}for(var t=(9==e.nodeType?e:e.ownerDocument).getElementsByTagName("*"),r=0;r<t.length;r++)for(var n=t.item(r),s=n.attributes,i=0;i<s.length;i++){if(s.item(i)===e)return n}return null},R.prototype=new Object,R.prototype.constructor=R,R.superclass=Object.prototype,R.prototype.init=function(e,t){this.absolute=e,this.steps=t},R.prototype.toString=function(){return(this.absolute?"/":"")+n(s,this.steps).join("/")},j.prototype=new Object,j.prototype.constructor=j,j.superclass=Object.prototype,j.prototype.init=function(e,t,r){this.axis=e,this.nodeTest=t,this.predicates=r},j.prototype.toString=function(){return j.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+B.predicatesString(this.predicates)},j.ANCESTOR=0,j.ANCESTORORSELF=1,j.ATTRIBUTE=2,j.CHILD=3,j.DESCENDANT=4,j.DESCENDANTORSELF=5,j.FOLLOWING=6,j.FOLLOWINGSIBLING=7,j.NAMESPACE=8,j.PARENT=9,j.PRECEDING=10,j.PRECEDINGSIBLING=11,j.SELF=12,j.STEPNAMES=r((function(e,t){return e[t[0]]=t[1],e}),{},[[j.ANCESTOR,"ancestor"],[j.ANCESTORORSELF,"ancestor-or-self"],[j.ATTRIBUTE,"attribute"],[j.CHILD,"child"],[j.DESCENDANT,"descendant"],[j.DESCENDANTORSELF,"descendant-or-self"],[j.FOLLOWING,"following"],[j.FOLLOWINGSIBLING,"following-sibling"],[j.NAMESPACE,"namespace"],[j.PARENT,"parent"],[j.PRECEDING,"preceding"],[j.PRECEDINGSIBLING,"preceding-sibling"],[j.SELF,"self"]]),L.prototype=new Object,L.prototype.constructor=L,L.superclass=Object.prototype,L.prototype.init=function(e,t){this.type=e,this.value=t},L.prototype.toString=function(){return"<unknown nodetest type>"},L.prototype.matches=function(e,t){console.warn("unknown node test type")},L.NAMETESTANY=0,L.NAMETESTPREFIXANY=1,L.NAMETESTQNAME=2,L.COMMENT=3,L.TEXT=4,L.PI=5,L.NODE=6,L.isNodeType=function(e){return function(t){return function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return!0;return!1}(e,t.nodeType)}},L.makeNodeTestType=function(e,t,r){var n=r||function(){};return n.prototype=new L(e),n.prototype.constructor=n,u(n.prototype,t),n},L.makeNodeTypeTest=function(e,t,r){return new(L.makeNodeTestType(e,{matches:L.isNodeType(t),toString:(n=r,function(){return n})}));var n},L.hasPrefix=function(e){return e.prefix||-1!==(e.nodeName||e.tagName).indexOf(":")},L.isElementOrAttribute=L.isNodeType([1,2]),L.nameSpaceMatches=function(e,t,r){var n=r.namespaceURI||"";if(!e)return!n||t.allowAnyNamespaceForNoPrefix&&!L.hasPrefix(r);var s=t.namespaceResolver.getNamespace(e,t.expressionContextNode);if(null==s)throw new Error("Cannot resolve QName "+e);return s===n},L.localNameMatches=function(e,t,r){var n=r.localName||r.nodeName;return t.caseInsensitive?e.toLowerCase()===n.toLowerCase():e===n},L.NameTestPrefixAny=L.makeNodeTestType(L.NAMETESTPREFIXANY,{matches:function(e,t){return L.isElementOrAttribute(e)&&L.nameSpaceMatches(this.prefix,t,e)},toString:function(){return this.prefix+":*"}},(function(e){this.prefix=e})),L.NameTestQName=L.makeNodeTestType(L.NAMETESTQNAME,{matches:function(e,t){return L.isNodeType([1,2,J.XPATH_NAMESPACE_NODE])(e)&&L.nameSpaceMatches(this.prefix,t,e)&&L.localNameMatches(this.localName,t,e)},toString:function(){return this.name}},(function(e){var t=e.split(":");this.name=e,this.prefix=t.length>1?t[0]:null,this.localName=t[t.length>1?1:0]})),L.PITest=L.makeNodeTestType(L.PI,{matches:function(e,t){return L.isNodeType([7])(e)&&(e.target||e.nodeName)===this.name},toString:function(){return a('processing-instruction("','")',this.name)}},(function(e){this.name=e})),L.nameTestAny=L.makeNodeTypeTest(L.NAMETESTANY,[1,2,J.XPATH_NAMESPACE_NODE],"*"),L.textTest=L.makeNodeTypeTest(L.TEXT,[3,4],"text()"),L.commentTest=L.makeNodeTypeTest(L.COMMENT,[8],"comment()"),L.nodeTest=L.makeNodeTypeTest(L.NODE,[1,2,3,4,7,8,9],"node()"),L.anyPiTest=L.makeNodeTypeTest(L.PI,[7],"processing-instruction()"),U.prototype=new f,U.prototype.constructor=U,U.superclass=f.prototype,U.prototype.init=function(e){this.variable=e},U.prototype.toString=function(){return"$"+this.variable},U.prototype.evaluate=function(e){var t=$.resolveQName(this.variable,e.namespaceResolver,e.contextNode,!1);if(null==t[0])throw new Error("Cannot resolve QName "+fn);var r=e.variableResolver.getVariable(t[1],t[0]);if(!r)throw z.fromMessage("Undeclared variable: "+this.toString());return r},V.prototype=new f,V.prototype.constructor=V,V.superclass=f.prototype,V.prototype.init=function(e,t){this.functionName=e,this.arguments=t},V.prototype.toString=function(){for(var e=this.functionName+"(",t=0;t<this.arguments.length;t++)t>0&&(e+=", "),e+=this.arguments[t].toString();return e+")"},V.prototype.evaluate=function(e){var t=W.getFunctionFromContext(this.functionName,e);if(!t)throw new Error("Unknown function "+this.functionName);var r=[e].concat(this.arguments);return t.apply(e.functionResolver.thisArg,r)};var _=new Object;function H(e){arguments.length>0&&this.init(e)}function M(e){arguments.length>0&&this.init(e)}function F(e){arguments.length>0&&this.init(e)}function K(e){this.init(e)}function q(){this.init()}function J(e,t,r){this.isXPathNamespace=!0,this.ownerDocument=r.ownerDocument,this.nodeName="#namespace",this.prefix=e,this.localName=e,this.namespaceURI=t,this.nodeValue=t,this.ownerElement=r,this.nodeType=J.XPATH_NAMESPACE_NODE}function G(e,t,r){this.variableResolver=null!=e?e:new X,this.namespaceResolver=null!=t?t:new Y,this.functionResolver=null!=r?r:new W}function X(){}function W(e){this.thisArg=null!=e?e:Q,this.functions=new Object,this.addStandardFunctions()}function Y(){}_.equals=function(e,t){return e.equals(t)},_.notequal=function(e,t){return e.notequal(t)},_.lessthan=function(e,t){return e.lessthan(t)},_.greaterthan=function(e,t){return e.greaterthan(t)},_.lessthanorequal=function(e,t){return e.lessthanorequal(t)},_.greaterthanorequal=function(e,t){return e.greaterthanorequal(t)},H.prototype=new f,H.prototype.constructor=H,H.superclass=f.prototype,H.prototype.init=function(e){this.str=String(e)},H.prototype.toString=function(){return this.str},H.prototype.evaluate=function(e){return this},H.prototype.string=function(){return this},H.prototype.number=function(){return new M(this.str)},H.prototype.bool=function(){return new F(this.str)},H.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},H.prototype.stringValue=function(){return this.str},H.prototype.numberValue=function(){return this.number().numberValue()},H.prototype.booleanValue=function(){return this.bool().booleanValue()},H.prototype.equals=function(e){return $.instance_of(e,F)?this.bool().equals(e):$.instance_of(e,M)?this.number().equals(e):$.instance_of(e,q)?e.compareWithString(this,_.equals):new F(this.str==e.str)},H.prototype.notequal=function(e){return $.instance_of(e,F)?this.bool().notequal(e):$.instance_of(e,M)?this.number().notequal(e):$.instance_of(e,q)?e.compareWithString(this,_.notequal):new F(this.str!=e.str)},H.prototype.lessthan=function(e){return this.number().lessthan(e)},H.prototype.greaterthan=function(e){return this.number().greaterthan(e)},H.prototype.lessthanorequal=function(e){return this.number().lessthanorequal(e)},H.prototype.greaterthanorequal=function(e){return this.number().greaterthanorequal(e)},M.prototype=new f,M.prototype.constructor=M,M.superclass=f.prototype,M.prototype.init=function(e){this.num="string"==typeof e?this.parse(e):Number(e)},M.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,M.prototype.parse=function(e){return this.numberFormat.test(e)?parseFloat(e):Number.NaN},M.prototype.toString=function(){var e=this.num.toString();return-1!==e.indexOf("e-")?function(e){for(var t=e.split("e-"),r=t[0].replace(".",""),n=Number(t[1]),s=0;s<n-1;s+=1)r="0"+r;return"0."+r}(e):-1!==e.indexOf("e")?function(e){for(var t=e.split("e"),r=t[0].replace(".",""),n=Number(t[1])+1-r.length,s=0;s<n;s+=1)r+="0";return r}(e):e},M.prototype.evaluate=function(e){return this},M.prototype.string=function(){return new H(this.toString())},M.prototype.number=function(){return this},M.prototype.bool=function(){return new F(this.num)},M.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},M.prototype.stringValue=function(){return this.string().stringValue()},M.prototype.numberValue=function(){return this.num},M.prototype.booleanValue=function(){return this.bool().booleanValue()},M.prototype.negate=function(){return new M(-this.num)},M.prototype.equals=function(e){return $.instance_of(e,F)?this.bool().equals(e):$.instance_of(e,H)?this.equals(e.number()):$.instance_of(e,q)?e.compareWithNumber(this,_.equals):new F(this.num==e.num)},M.prototype.notequal=function(e){return $.instance_of(e,F)?this.bool().notequal(e):$.instance_of(e,H)?this.notequal(e.number()):$.instance_of(e,q)?e.compareWithNumber(this,_.notequal):new F(this.num!=e.num)},M.prototype.lessthan=function(e){return $.instance_of(e,q)?e.compareWithNumber(this,_.greaterthan):$.instance_of(e,F)||$.instance_of(e,H)?this.lessthan(e.number()):new F(this.num<e.num)},M.prototype.greaterthan=function(e){return $.instance_of(e,q)?e.compareWithNumber(this,_.lessthan):$.instance_of(e,F)||$.instance_of(e,H)?this.greaterthan(e.number()):new F(this.num>e.num)},M.prototype.lessthanorequal=function(e){return $.instance_of(e,q)?e.compareWithNumber(this,_.greaterthanorequal):$.instance_of(e,F)||$.instance_of(e,H)?this.lessthanorequal(e.number()):new F(this.num<=e.num)},M.prototype.greaterthanorequal=function(e){return $.instance_of(e,q)?e.compareWithNumber(this,_.lessthanorequal):$.instance_of(e,F)||$.instance_of(e,H)?this.greaterthanorequal(e.number()):new F(this.num>=e.num)},M.prototype.plus=function(e){return new M(this.num+e.num)},M.prototype.minus=function(e){return new M(this.num-e.num)},M.prototype.multiply=function(e){return new M(this.num*e.num)},M.prototype.div=function(e){return new M(this.num/e.num)},M.prototype.mod=function(e){return new M(this.num%e.num)},F.prototype=new f,F.prototype.constructor=F,F.superclass=f.prototype,F.prototype.init=function(e){this.b=Boolean(e)},F.prototype.toString=function(){return this.b.toString()},F.prototype.evaluate=function(e){return this},F.prototype.string=function(){return new H(this.b)},F.prototype.number=function(){return new M(this.b)},F.prototype.bool=function(){return this},F.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},F.prototype.stringValue=function(){return this.string().stringValue()},F.prototype.numberValue=function(){return this.number().numberValue()},F.prototype.booleanValue=function(){return this.b},F.prototype.not=function(){return new F(!this.b)},F.prototype.equals=function(e){return $.instance_of(e,H)||$.instance_of(e,M)?this.equals(e.bool()):$.instance_of(e,q)?e.compareWithBoolean(this,_.equals):new F(this.b==e.b)},F.prototype.notequal=function(e){return $.instance_of(e,H)||$.instance_of(e,M)?this.notequal(e.bool()):$.instance_of(e,q)?e.compareWithBoolean(this,_.notequal):new F(this.b!=e.b)},F.prototype.lessthan=function(e){return this.number().lessthan(e)},F.prototype.greaterthan=function(e){return this.number().greaterthan(e)},F.prototype.lessthanorequal=function(e){return this.number().lessthanorequal(e)},F.prototype.greaterthanorequal=function(e){return this.number().greaterthanorequal(e)},F.true_=new F(!0),F.false_=new F(!1),K.prototype=new Object,K.prototype.constructor=K,K.superclass=Object.prototype,K.prototype.init=function(e){this.left=null,this.right=null,this.node=e,this.depth=1},K.prototype.balance=function(){var e=null==this.left?0:this.left.depth,t=null==this.right?0:this.right.depth;if(e>t+1)(null==this.left.left?0:this.left.left.depth)<(null==this.left.right?0:this.left.right.depth)&&this.left.rotateRR(),this.rotateLL();else if(e+1<t){var r=null==this.right.right?0:this.right.right.depth;(null==this.right.left?0:this.right.left.depth)>r&&this.right.rotateLL(),this.rotateRR()}},K.prototype.rotateLL=function(){var e=this.node,t=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=t,this.right.node=e,this.right.updateInNewLocation(),this.updateInNewLocation()},K.prototype.rotateRR=function(){var e=this.node,t=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=t,this.left.node=e,this.left.updateInNewLocation(),this.updateInNewLocation()},K.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},K.prototype.getDepthFromChildren=function(){this.depth=null==this.node?0:1,null!=this.left&&(this.depth=this.left.depth+1),null!=this.right&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)},K.prototype.add=function(e){if(e===this.node)return!1;var t=function(e,t){if(e===t)return 0;if(e.compareDocumentPosition){var r=e.compareDocumentPosition(t);return 1&r||10&r?1:20&r?-1:0}for(var n=0,s=0,i=e;null!=i;i=i.parentNode||i.ownerElement)n++;for(var a=t;null!=a;a=a.parentNode||a.ownerElement)s++;if(n>s){for(;n>s;)e=e.parentNode||e.ownerElement,n--;if(e===t)return 1}else if(s>n){for(;s>n;)t=t.parentNode||t.ownerElement,s--;if(e===t)return-1}for(var o=e.parentNode||e.ownerElement,u=t.parentNode||t.ownerElement;o!==u;)t=u,o=(e=o).parentNode||e.ownerElement,u=t.parentNode||t.ownerElement;var c=$.isAttribute(e),l=$.isAttribute(t);if(c&&!l)return-1;if(!c&&l)return 1;if(o)for(var h=c?o.attributes:o.childNodes,f=h.length,m=0;m<f;m+=1){var p=h[m];if(p===e)return-1;if(p===t)return 1}throw new Error("Unexpected: could not determine node order")}(e,this.node),r=!1;return-1==t?null==this.left?(this.left=new K(e),r=!0):(r=this.left.add(e))&&this.balance():1==t&&(null==this.right?(this.right=new K(e),r=!0):(r=this.right.add(e))&&this.balance()),r&&this.getDepthFromChildren(),r},q.prototype=new f,q.prototype.constructor=q,q.superclass=f.prototype,q.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},q.prototype.toString=function(){var e=this.first();return null==e?"":this.stringForNode(e)},q.prototype.evaluate=function(e){return this},q.prototype.string=function(){return new H(this.toString())},q.prototype.stringValue=function(){return this.toString()},q.prototype.number=function(){return new M(this.string())},q.prototype.numberValue=function(){return Number(this.string())},q.prototype.bool=function(){return new F(this.booleanValue())},q.prototype.booleanValue=function(){return!!this.size},q.prototype.nodeset=function(){return this},q.prototype.stringForNode=function(e){return 9==e.nodeType||1==e.nodeType||11===e.nodeType?this.stringForContainerNode(e):2===e.nodeType?e.value||e.nodeValue:e.isNamespaceNode?e.namespace:e.nodeValue},q.prototype.stringForContainerNode=function(e){for(var t="",r=e.firstChild;null!=r;r=r.nextSibling){var n=r.nodeType;1!==n&&3!==n&&4!==n&&9!==n&&11!==n||(t+=this.stringForNode(r))}return t},q.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new K(this.nodes[0]);for(var e=1;e<this.nodes.length;e+=1)this.tree.add(this.nodes[e])}return this.tree},q.prototype.first=function(){var e=this.buildTree();if(null==e)return null;for(;null!=e.left;)e=e.left;return e.node},q.prototype.add=function(e){for(var t=0;t<this.nodes.length;t+=1)if(e===this.nodes[t])return;this.tree=null,this.nodes.push(e),this.size+=1},q.prototype.addArray=function(e){var r=this;t((function(e){r.add(e)}),e)},q.prototype.toArray=function(){var e=[];return this.toArrayRec(this.buildTree(),e),e},q.prototype.toArrayRec=function(e,t){null!=e&&(this.toArrayRec(e.left,t),t.push(e.node),this.toArrayRec(e.right,t))},q.prototype.toUnsortedArray=function(){return this.nodes.slice()},q.prototype.compareWithString=function(e,t){for(var r=this.toUnsortedArray(),n=0;n<r.length;n++){var s=r[n],i=t(new H(this.stringForNode(s)),e);if(i.booleanValue())return i}return new F(!1)},q.prototype.compareWithNumber=function(e,t){for(var r=this.toUnsortedArray(),n=0;n<r.length;n++){var s=r[n],i=t(new M(this.stringForNode(s)),e);if(i.booleanValue())return i}return new F(!1)},q.prototype.compareWithBoolean=function(e,t){return t(this.bool(),e)},q.prototype.compareWithNodeSet=function(e,t){for(var r=this.toUnsortedArray(),n=function(e,r){return t(r,e)},s=0;s<r.length;s++){var i=new H(this.stringForNode(r[s])),a=e.compareWithString(i,n);if(a.booleanValue())return a}return new F(!1)},q.compareWith=function(e){var t=Array.prototype.slice,r=e.length,n=function(e,r){return function(){return r.apply(this,e.concat(t.call(arguments)))}},s=function(){var i=t.call(arguments);return i.length<r?n(i,s):e.apply(this,t.apply(arguments,[0,r]))};return s}((function(e,t){return $.instance_of(t,H)?this.compareWithString(t,e):$.instance_of(t,M)?this.compareWithNumber(t,e):$.instance_of(t,F)?this.compareWithBoolean(t,e):this.compareWithNodeSet(t,e)})),q.prototype.equals=q.compareWith(_.equals),q.prototype.notequal=q.compareWith(_.notequal),q.prototype.lessthan=q.compareWith(_.lessthan),q.prototype.greaterthan=q.compareWith(_.greaterthan),q.prototype.lessthanorequal=q.compareWith(_.lessthanorequal),q.prototype.greaterthanorequal=q.compareWith(_.greaterthanorequal),q.prototype.union=function(e){var t=new q;return t.addArray(this.toUnsortedArray()),t.addArray(e.toUnsortedArray()),t},J.prototype=new Object,J.prototype.constructor=J,J.superclass=Object.prototype,J.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},G.prototype=new Object,G.prototype.constructor=G,G.superclass=Object.prototype,G.prototype.extend=function(e){return u(new G,this,e)},X.prototype=new Object,X.prototype.constructor=X,X.superclass=Object.prototype,X.prototype.getVariable=function(e,t){return null},W.prototype=new Object,W.prototype.constructor=W,W.superclass=Object.prototype,W.prototype.addStandardFunctions=function(){this.functions["{}last"]=Q.last,this.functions["{}position"]=Q.position,this.functions["{}count"]=Q.count,this.functions["{}id"]=Q.id,this.functions["{}local-name"]=Q.localName,this.functions["{}namespace-uri"]=Q.namespaceURI,this.functions["{}name"]=Q.name,this.functions["{}string"]=Q.string,this.functions["{}concat"]=Q.concat,this.functions["{}starts-with"]=Q.startsWith,this.functions["{}contains"]=Q.contains,this.functions["{}substring-before"]=Q.substringBefore,this.functions["{}substring-after"]=Q.substringAfter,this.functions["{}substring"]=Q.substring,this.functions["{}string-length"]=Q.stringLength,this.functions["{}normalize-space"]=Q.normalizeSpace,this.functions["{}translate"]=Q.translate,this.functions["{}boolean"]=Q.boolean_,this.functions["{}not"]=Q.not,this.functions["{}true"]=Q.true_,this.functions["{}false"]=Q.false_,this.functions["{}lang"]=Q.lang,this.functions["{}number"]=Q.number,this.functions["{}sum"]=Q.sum,this.functions["{}floor"]=Q.floor,this.functions["{}ceiling"]=Q.ceiling,this.functions["{}round"]=Q.round},W.prototype.addFunction=function(e,t,r){this.functions["{"+e+"}"+t]=r},W.getFunctionFromContext=function(e,t){var r=$.resolveQName(e,t.namespaceResolver,t.contextNode,!1);if(null===r[0])throw new Error("Cannot resolve QName "+name);return t.functionResolver.getFunction(r[1],r[0])},W.prototype.getFunction=function(e,t){return this.functions["{"+t+"}"+e]},Y.prototype=new Object,Y.prototype.constructor=Y,Y.superclass=Object.prototype,Y.prototype.getNamespace=function(e,t){if("xml"==e)return l.XML_NAMESPACE_URI;if("xmlns"==e)return l.XMLNS_NAMESPACE_URI;for(9==t.nodeType?t=t.documentElement:2==t.nodeType?t=B.getOwnerElement(t):1!=t.nodeType&&(t=t.parentNode);null!=t&&1==t.nodeType;){for(var r=t.attributes,n=0;n<r.length;n++){var s=r.item(n),i=s.name||s.nodeName;if("xmlns"===i&&""===e||i==="xmlns:"+e)return String(s.value||s.nodeValue)}t=t.parentNode}return null};var Q=new Object;Q.last=function(e){if(1!=arguments.length)throw new Error("Function last expects ()");return new M(e.contextSize)},Q.position=function(e){if(1!=arguments.length)throw new Error("Function position expects ()");return new M(e.contextPosition)},Q.count=function(){var e,t=arguments[0];if(2!=arguments.length||!$.instance_of(e=arguments[1].evaluate(t),q))throw new Error("Function count expects (node-set)");return new M(e.size)},Q.id=function(){var e,t=arguments[0];if(2!=arguments.length)throw new Error("Function id expects (object)");e=arguments[1].evaluate(t);for(var r=(e=$.instance_of(e,q)?e.toArray().join(" "):e.stringValue()).split(/[\x0d\x0a\x09\x20]+/),n=new q,s=9==t.contextNode.nodeType?t.contextNode:t.contextNode.ownerDocument,i=0;i<r.length;i++){var a;null!=(a=s.getElementById?s.getElementById(r[i]):$.getElementById(s,r[i]))&&(n.add(a))}return n},Q.localName=function(e,t){var r;if(1==arguments.length)r=e.contextNode;else{if(2!=arguments.length)throw new Error("Function local-name expects (node-set?)");r=t.evaluate(e).first()}return new H(null==r?"":r.localName||r.baseName||r.target||r.nodeName||"")},Q.namespaceURI=function(){var e,t=arguments[0];if(1==arguments.length)e=t.contextNode;else{if(2!=arguments.length)throw new Error("Function namespace-uri expects (node-set?)");e=arguments[1].evaluate(t).first()}return new H(null==e?"":e.namespaceURI)},Q.name=function(){var e,t=arguments[0];if(1==arguments.length)e=t.contextNode;else{if(2!=arguments.length)throw new Error("Function name expects (node-set?)");e=arguments[1].evaluate(t).first()}return null==e?new H(""):1==e.nodeType?new H(e.nodeName):2==e.nodeType?new H(e.name||e.nodeName):7===e.nodeType?new H(e.target||e.nodeName):null==e.localName?new H(""):new H(e.localName)},Q.string=function(){var e=arguments[0];if(1==arguments.length)return new H(q.prototype.stringForNode(e.contextNode));if(2==arguments.length)return arguments[1].evaluate(e).string();throw new Error("Function string expects (object?)")},Q.concat=function(e){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var t="",r=1;r<arguments.length;r++)t+=arguments[r].evaluate(e).stringValue();return new H(t)},Q.startsWith=function(){var e=arguments[0];if(3!=arguments.length)throw new Error("Function startsWith expects (string, string)");var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue();return new F(t.substring(0,r.length)==r)},Q.contains=function(){var e=arguments[0];if(3!=arguments.length)throw new Error("Function contains expects (string, string)");var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue();return new F(-1!==t.indexOf(r))},Q.substringBefore=function(){var e=arguments[0];if(3!=arguments.length)throw new Error("Function substring-before expects (string, string)");var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue();return new H(t.substring(0,t.indexOf(r)))},Q.substringAfter=function(){var e=arguments[0];if(3!=arguments.length)throw new Error("Function substring-after expects (string, string)");var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue();if(0==r.length)return new H(t);var n=t.indexOf(r);return new H(-1==n?"":t.substring(n+r.length))},Q.substring=function(){var e=arguments[0];if(3!=arguments.length&&4!=arguments.length)throw new Error("Function substring expects (string, number, number?)");var t=arguments[1].evaluate(e).stringValue(),r=Math.round(arguments[2].evaluate(e).numberValue())-1,n=4==arguments.length?r+Math.round(arguments[3].evaluate(e).numberValue()):void 0;return new H(t.substring(r,n))},Q.stringLength=function(){var e,t=arguments[0];if(1==arguments.length)e=q.prototype.stringForNode(t.contextNode);else{if(2!=arguments.length)throw new Error("Function string-length expects (string?)");e=arguments[1].evaluate(t).stringValue()}return new M(e.length)},Q.normalizeSpace=function(){var e,t=arguments[0];if(1==arguments.length)e=q.prototype.stringForNode(t.contextNode);else{if(2!=arguments.length)throw new Error("Function normalize-space expects (string?)");e=arguments[1].evaluate(t).stringValue()}for(var r=0,n=e.length-1;$.isSpace(e.charCodeAt(n));)n--;for(var s="";r<=n&&$.isSpace(e.charCodeAt(r));)r++;for(;r<=n;)if($.isSpace(e.charCodeAt(r)))for(s+=" ";r<=n&&$.isSpace(e.charCodeAt(r));)r++;else s+=e.charAt(r),r++;return new H(s)},Q.translate=function(e,t,s,a){if(4!=arguments.length)throw new Error("Function translate expects (string, string, string)");var o=t.evaluate(e).stringValue(),u=s.evaluate(e).stringValue(),c=a.evaluate(e).stringValue(),l=r((function(e,t,r){return t in e||(e[t]=r>c.length?"":c[r]),e}),{},u),h=i("",n((function(e){return e in l?l[e]:e}),o));return new H(h)},Q.boolean_=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(e).bool()},Q.not=function(e,t){if(2!=arguments.length)throw new Error("Function not expects (object)");return t.evaluate(e).bool().not()},Q.true_=function(){if(1!=arguments.length)throw new Error("Function true expects ()");return F.true_},Q.false_=function(){if(1!=arguments.length)throw new Error("Function false expects ()");return F.false_},Q.lang=function(){var e,t=arguments[0];if(2!=arguments.length)throw new Error("Function lang expects (string)");for(var r=t.contextNode;null!=r&&9!=r.nodeType;r=r.parentNode){var n=r.getAttributeNS(l.XML_NAMESPACE_URI,"lang");if(null!=n){e=String(n);break}}if(null==e)return F.false_;var s=arguments[1].evaluate(t).stringValue();return new F(e.substring(0,s.length)==s&&(e.length==s.length||"-"==e.charAt(s.length)))},Q.number=function(){var e=arguments[0];if(1!=arguments.length&&2!=arguments.length)throw new Error("Function number expects (object?)");return 1==arguments.length?new M(q.prototype.stringForNode(e.contextNode)):arguments[1].evaluate(e).number()},Q.sum=function(){var e,t=arguments[0];if(2!=arguments.length||!$.instance_of(e=arguments[1].evaluate(t),q))throw new Error("Function sum expects (node-set)");e=e.toUnsortedArray();for(var r=0,n=0;n<e.length;n++)r+=new M(q.prototype.stringForNode(e[n])).numberValue();return new M(r)},Q.floor=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function floor expects (number)");return new M(Math.floor(arguments[1].evaluate(e).numberValue()))},Q.ceiling=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function ceiling expects (number)");return new M(Math.ceil(arguments[1].evaluate(e).numberValue()))},Q.round=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function round expects (number)");return new M(Math.round(arguments[1].evaluate(e).numberValue()))};var $=new Object;$.isAttribute=function(e){return e&&(2===e.nodeType||e.ownerElement)},$.splitQName=function(e){var t=e.indexOf(":");return-1==t?[null,e]:[e.substring(0,t),e.substring(t+1)]},$.resolveQName=function(e,t,r,n){var s=$.splitQName(e);return null!=s[0]?s[0]=t.getNamespace(s[0],r):n?(s[0]=t.getNamespace("",r),null==s[0]&&(s[0]="")):s[0]="",s},$.isSpace=function(e){return 9==e||13==e||10==e||32==e},$.isLetter=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=255||e>=256&&e<=305||e>=308&&e<=318||e>=321&&e<=328||e>=330&&e<=382||e>=384&&e<=451||e>=461&&e<=496||e>=500&&e<=501||e>=506&&e<=535||e>=592&&e<=680||e>=699&&e<=705||902==e||e>=904&&e<=906||908==e||e>=910&&e<=929||e>=931&&e<=974||e>=976&&e<=982||986==e||988==e||990==e||992==e||e>=994&&e<=1011||e>=1025&&e<=1036||e>=1038&&e<=1103||e>=1105&&e<=1116||e>=1118&&e<=1153||e>=1168&&e<=1220||e>=1223&&e<=1224||e>=1227&&e<=1228||e>=1232&&e<=1259||e>=1262&&e<=1269||e>=1272&&e<=1273||e>=1329&&e<=1366||1369==e||e>=1377&&e<=1414||e>=1488&&e<=1514||e>=1520&&e<=1522||e>=1569&&e<=1594||e>=1601&&e<=1610||e>=1649&&e<=1719||e>=1722&&e<=1726||e>=1728&&e<=1742||e>=1744&&e<=1747||1749==e||e>=1765&&e<=1766||e>=2309&&e<=2361||2365==e||e>=2392&&e<=2401||e>=2437&&e<=2444||e>=2447&&e<=2448||e>=2451&&e<=2472||e>=2474&&e<=2480||2482==e||e>=2486&&e<=2489||e>=2524&&e<=2525||e>=2527&&e<=2529||e>=2544&&e<=2545||e>=2565&&e<=2570||e>=2575&&e<=2576||e>=2579&&e<=2600||e>=2602&&e<=2608||e>=2610&&e<=2611||e>=2613&&e<=2614||e>=2616&&e<=2617||e>=2649&&e<=2652||2654==e||e>=2674&&e<=2676||e>=2693&&e<=2699||2701==e||e>=2703&&e<=2705||e>=2707&&e<=2728||e>=2730&&e<=2736||e>=2738&&e<=2739||e>=2741&&e<=2745||2749==e||2784==e||e>=2821&&e<=2828||e>=2831&&e<=2832||e>=2835&&e<=2856||e>=2858&&e<=2864||e>=2866&&e<=2867||e>=2870&&e<=2873||2877==e||e>=2908&&e<=2909||e>=2911&&e<=2913||e>=2949&&e<=2954||e>=2958&&e<=2960||e>=2962&&e<=2965||e>=2969&&e<=2970||2972==e||e>=2974&&e<=2975||e>=2979&&e<=2980||e>=2984&&e<=2986||e>=2990&&e<=2997||e>=2999&&e<=3001||e>=3077&&e<=3084||e>=3086&&e<=3088||e>=3090&&e<=3112||e>=3114&&e<=3123||e>=3125&&e<=3129||e>=3168&&e<=3169||e>=3205&&e<=3212||e>=3214&&e<=3216||e>=3218&&e<=3240||e>=3242&&e<=3251||e>=3253&&e<=3257||3294==e||e>=3296&&e<=3297||e>=3333&&e<=3340||e>=3342&&e<=3344||e>=3346&&e<=3368||e>=3370&&e<=3385||e>=3424&&e<=3425||e>=3585&&e<=3630||3632==e||e>=3634&&e<=3635||e>=3648&&e<=3653||e>=3713&&e<=3714||3716==e||e>=3719&&e<=3720||3722==e||3725==e||e>=3732&&e<=3735||e>=3737&&e<=3743||e>=3745&&e<=3747||3749==e||3751==e||e>=3754&&e<=3755||e>=3757&&e<=3758||3760==e||e>=3762&&e<=3763||3773==e||e>=3776&&e<=3780||e>=3904&&e<=3911||e>=3913&&e<=3945||e>=4256&&e<=4293||e>=4304&&e<=4342||4352==e||e>=4354&&e<=4355||e>=4357&&e<=4359||4361==e||e>=4363&&e<=4364||e>=4366&&e<=4370||4412==e||4414==e||4416==e||4428==e||4430==e||4432==e||e>=4436&&e<=4437||4441==e||e>=4447&&e<=4449||4451==e||4453==e||4455==e||4457==e||e>=4461&&e<=4462||e>=4466&&e<=4467||4469==e||4510==e||4520==e||4523==e||e>=4526&&e<=4527||e>=4535&&e<=4536||4538==e||e>=4540&&e<=4546||4587==e||4592==e||4601==e||e>=7680&&e<=7835||e>=7840&&e<=7929||e>=7936&&e<=7957||e>=7960&&e<=7965||e>=7968&&e<=8005||e>=8008&&e<=8013||e>=8016&&e<=8023||8025==e||8027==e||8029==e||e>=8031&&e<=8061||e>=8064&&e<=8116||e>=8118&&e<=8124||8126==e||e>=8130&&e<=8132||e>=8134&&e<=8140||e>=8144&&e<=8147||e>=8150&&e<=8155||e>=8160&&e<=8172||e>=8178&&e<=8180||e>=8182&&e<=8188||8486==e||e>=8490&&e<=8491||8494==e||e>=8576&&e<=8578||e>=12353&&e<=12436||e>=12449&&e<=12538||e>=12549&&e<=12588||e>=44032&&e<=55203||e>=19968&&e<=40869||12295==e||e>=12321&&e<=12329},$.isNCNameChar=function(e){return e>=48&&e<=57||e>=1632&&e<=1641||e>=1776&&e<=1785||e>=2406&&e<=2415||e>=2534&&e<=2543||e>=2662&&e<=2671||e>=2790&&e<=2799||e>=2918&&e<=2927||e>=3047&&e<=3055||e>=3174&&e<=3183||e>=3302&&e<=3311||e>=3430&&e<=3439||e>=3664&&e<=3673||e>=3792&&e<=3801||e>=3872&&e<=3881||46==e||45==e||95==e||$.isLetter(e)||e>=768&&e<=837||e>=864&&e<=865||e>=1155&&e<=1158||e>=1425&&e<=1441||e>=1443&&e<=1465||e>=1467&&e<=1469||1471==e||e>=1473&&e<=1474||1476==e||e>=1611&&e<=1618||1648==e||e>=1750&&e<=1756||e>=1757&&e<=1759||e>=1760&&e<=1764||e>=1767&&e<=1768||e>=1770&&e<=1773||e>=2305&&e<=2307||2364==e||e>=2366&&e<=2380||2381==e||e>=2385&&e<=2388||e>=2402&&e<=2403||e>=2433&&e<=2435||2492==e||2494==e||2495==e||e>=2496&&e<=2500||e>=2503&&e<=2504||e>=2507&&e<=2509||2519==e||e>=2530&&e<=2531||2562==e||2620==e||2622==e||2623==e||e>=2624&&e<=2626||e>=2631&&e<=2632||e>=2635&&e<=2637||e>=2672&&e<=2673||e>=2689&&e<=2691||2748==e||e>=2750&&e<=2757||e>=2759&&e<=2761||e>=2763&&e<=2765||e>=2817&&e<=2819||2876==e||e>=2878&&e<=2883||e>=2887&&e<=2888||e>=2891&&e<=2893||e>=2902&&e<=2903||e>=2946&&e<=2947||e>=3006&&e<=3010||e>=3014&&e<=3016||e>=3018&&e<=3021||3031==e||e>=3073&&e<=3075||e>=3134&&e<=3140||e>=3142&&e<=3144||e>=3146&&e<=3149||e>=3157&&e<=3158||e>=3202&&e<=3203||e>=3262&&e<=3268||e>=3270&&e<=3272||e>=3274&&e<=3277||e>=3285&&e<=3286||e>=3330&&e<=3331||e>=3390&&e<=3395||e>=3398&&e<=3400||e>=3402&&e<=3405||3415==e||3633==e||e>=3636&&e<=3642||e>=3655&&e<=3662||3761==e||e>=3764&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=3864&&e<=3865||3893==e||3895==e||3897==e||3902==e||3903==e||e>=3953&&e<=3972||e>=3974&&e<=3979||e>=3984&&e<=3989||3991==e||e>=3993&&e<=4013||e>=4017&&e<=4023||4025==e||e>=8400&&e<=8412||8417==e||e>=12330&&e<=12335||12441==e||12442==e||183==e||720==e||721==e||903==e||1600==e||3654==e||3782==e||12293==e||e>=12337&&e<=12341||e>=12445&&e<=12446||e>=12540&&e<=12542},$.coalesceText=function(e){for(var t=e.firstChild;null!=t;t=t.nextSibling)if(3==t.nodeType||4==t.nodeType){var r=t.nodeValue,n=t;for(t=t.nextSibling;null!=t&&(3==t.nodeType||4==t.nodeType);){r+=t.nodeValue;var s=t;t=t.nextSibling,s.parentNode.removeChild(s)}if(4==n.nodeType){var i=n.parentNode;if(null==n.nextSibling)i.removeChild(n),i.appendChild(i.ownerDocument.createTextNode(r));else{var a=n.nextSibling;i.removeChild(n),i.insertBefore(i.ownerDocument.createTextNode(r),a)}}else n.nodeValue=r;if(null==t)break}else 1==t.nodeType&&$.coalesceText(t)},$.instance_of=function(e,t){for(;null!=e;){if(e.constructor===t)return!0;if(e===Object)return!1;e=e.constructor.superclass}return!1},$.getElementById=function(e,t){if(1==e.nodeType&&(e.getAttribute("id")==t||e.getAttributeNS(null,"id")==t))return e;for(var r=e.firstChild;null!=r;r=r.nextSibling){var n=$.getElementById(r,t);if(null!=n)return n}return null};var z=function(){function e(t,r,n){var s=Error.call(this,function(t,r){var n=r?": "+r.toString():"";switch(t){case e.INVALID_EXPRESSION_ERR:return"Invalid expression"+n;case e.TYPE_ERR:return"Type error"+n}return null}(t,r)||n);return s.code=t,s.exception=r,s}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.superclass=Error,e.prototype.toString=function(){return this.message},e.fromMessage=function(t,r){return new e(null,r,t)},e.INVALID_EXPRESSION_ERR=51,e.TYPE_ERR=52,e}();function Z(e,t,r){this.xpath=r.parse(e),this.context=new G,this.context.namespaceResolver=new ee(t)}function ee(e){this.xpathNSResolver=e}function te(e){this.node=e,this.namespaceResolver=new Y}function re(e,t){switch(t==re.ANY_TYPE&&(e.constructor===H?t=re.STRING_TYPE:e.constructor===M?t=re.NUMBER_TYPE:e.constructor===F?t=re.BOOLEAN_TYPE:e.constructor===q&&(t=re.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=t,t){case re.NUMBER_TYPE:return void(this.numberValue=e.numberValue());case re.STRING_TYPE:return void(this.stringValue=e.stringValue());case re.BOOLEAN_TYPE:return void(this.booleanValue=e.booleanValue());case re.ANY_UNORDERED_NODE_TYPE:case re.FIRST_ORDERED_NODE_TYPE:if(e.constructor===q)return void(this.singleNodeValue=e.first());break;case re.UNORDERED_NODE_ITERATOR_TYPE:case re.ORDERED_NODE_ITERATOR_TYPE:if(e.constructor===q)return this.invalidIteratorState=!1,this.nodes=e.toArray(),void(this.iteratorIndex=0);break;case re.UNORDERED_NODE_SNAPSHOT_TYPE:case re.ORDERED_NODE_SNAPSHOT_TYPE:if(e.constructor===q)return this.nodes=e.toArray(),void(this.snapshotLength=this.nodes.length)}throw new z(z.TYPE_ERR)}function ne(e,t){e.createExpression=function(e,r){try{return new Z(e,r,t)}catch(e){throw new z(z.INVALID_EXPRESSION_ERR,e)}},e.createNSResolver=function(e){return new te(e)},e.evaluate=function(r,n,s,i,a){if(i<0||i>9)throw{code:0,toString:function(){return"Request type not supported"}};return e.createExpression(r,s,t).evaluate(n,i,a)}}Z.prototype={},Z.prototype.constructor=Z,Z.superclass=Object.prototype,Z.getOwnerDocument=function(e){return 9===e.nodeType?e:e.ownerDocument},Z.detectHtmlDom=function(e){if(!e)return!1;var t=Z.getOwnerDocument(e);try{return t.implementation.hasFeature("HTML","2.0")}catch(e){return!0}},Z.prototype.evaluate=function(e,t,r){return this.context.expressionContextNode=e,this.context.caseInsensitive=Z.detectHtmlDom(e),new re(this.xpath.evaluate(this.context),t)},ee.prototype={},ee.prototype.constructor=ee,ee.superclass=Object.prototype,ee.prototype.getNamespace=function(e,t){return null==this.xpathNSResolver?null:this.xpathNSResolver.lookupNamespaceURI(e)},te.prototype={},te.prototype.constructor=te,te.superclass=Object.prototype,te.prototype.lookupNamespaceURI=function(e){return this.namespaceResolver.getNamespace(e,this.node)},re.prototype={},re.prototype.constructor=re,re.superclass=Object.prototype,re.prototype.iterateNext=function(){if(this.resultType!=re.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=re.ORDERED_NODE_ITERATOR_TYPE)throw new z(z.TYPE_ERR);return this.nodes[this.iteratorIndex++]},re.prototype.snapshotItem=function(e){if(this.resultType!=re.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=re.ORDERED_NODE_SNAPSHOT_TYPE)throw new z(z.TYPE_ERR);return this.nodes[e]},re.ANY_TYPE=0,re.NUMBER_TYPE=1,re.STRING_TYPE=2,re.BOOLEAN_TYPE=3,re.UNORDERED_NODE_ITERATOR_TYPE=4,re.ORDERED_NODE_ITERATOR_TYPE=5,re.UNORDERED_NODE_SNAPSHOT_TYPE=6,re.ORDERED_NODE_SNAPSHOT_TYPE=7,re.ANY_UNORDERED_NODE_TYPE=8,re.FIRST_ORDERED_NODE_TYPE=9;try{var se=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(se=!1)}catch(e){}se&&ne(document,new c)}catch(e){}ne(e,new c),function(){var t=new c,r=new Y,n=new W,s=new X;function i(e){return{getNamespace:function(t,n){return e(t,n)||r.getNamespace(t,n)}}}function a(e){return e&&"function"==typeof e.getNamespace?i((t=e).getNamespace.bind(t)):"function"==typeof e?i(e):"object"==typeof e?function(e){return i((function(t){return e[t]}))}(e):r;var t}function o(e){if(null==e||e instanceof H||e instanceof F||e instanceof M||e instanceof q)return e;switch(typeof e){case"string":return new H(e);case"boolean":return new F(e);case"number":return new M(e)}var t=new q;return t.addArray([].concat(e)),t}function u(e){return{getFunction:function(t,r){var s=e(t,r);return s?function(e){return function(t){var r=Array.prototype.slice.call(arguments,1).map((function(e){return e.evaluate(t)})),n=e.apply(this,[].concat(t,r));return o(n)}}(s):n.getFunction(t,r)}}}function l(e){return e&&"function"==typeof e.getFunction?u((t=e).getFunction.bind(t)):"function"==typeof e?u(e):"object"==typeof e?function(e){return u((function(t){return e[t]}))}(e):n;var t}function h(e){return{getVariable:function(t,r){return o(e(t,r))}}}function f(e,t,r){e in r&&(t[e]=r[e])}function m(e){var t=new G;return e?(t.namespaceResolver=a(e.namespaces),t.functionResolver=l(e.functions),t.variableResolver=function(e){if(e){if("function"==typeof e.getVariable)return h(e.getVariable.bind(e));if("function"==typeof e)return h(e);if("object"==typeof e)return h((function(t){return e[t]}))}return s}(e.variables),t.expressionContextNode=e.node,f("allowAnyNamespaceForNoPrefix",t,e),f("isHtml",t,e)):t.namespaceResolver=r,t}var p={evaluate:function(e){return function(e,t){var r=m(t);return e.evaluate(r)}(this.expression,e)},evaluateNumber:function(e){return this.evaluate(e).numberValue()},evaluateString:function(e){return this.evaluate(e).stringValue()},evaluateBoolean:function(e){return this.evaluate(e).booleanValue()},evaluateNodeSet:function(e){return this.evaluate(e).nodeset()},select:function(e){return this.evaluateNodeSet(e).toArray()},select1:function(e){return this.select(e)[0]}};e.parse=function(e){var r=t.parse(e);return Object.create(p,{expression:{value:r}})}}(),u(e,{XPath:l,XPathParser:c,XPathResult:re,Step:j,PathExpr:B,NodeTest:L,LocationPath:R,OrOperation:g,AndOperation:b,BarOperation:x,EqualsOperation:y,NotEqualOperation:w,LessThanOperation:v,GreaterThanOperation:N,LessThanOrEqualOperation:A,GreaterThanOrEqualOperation:S,PlusOperation:E,MinusOperation:C,MultiplyOperation:k,DivOperation:O,ModOperation:I,UnaryMinusOperation:p,FunctionCall:V,VariableReference:U,XPathContext:G,XNodeSet:q,XBoolean:F,XString:H,XNumber:M,NamespaceResolver:Y,FunctionResolver:W,VariableResolver:X,Utilities:$}),e.select=function(t,r,n){return e.selectWithResolver(t,r,null,n)},e.useNamespaces=function(t){var r={mappings:t||{},lookupNamespaceURI:function(e){return this.mappings[e]}};return function(t,n,s){return e.selectWithResolver(t,n,r,s)}},e.selectWithResolver=function(e,t,r,n){var s=new Z(e,r,new c),i=re.ANY_TYPE,a=s.evaluate(t,i,null);return a.resultType==re.STRING_TYPE?a=a.stringValue:a.resultType==re.NUMBER_TYPE?a=a.numberValue:a.resultType==re.BOOLEAN_TYPE?a=a.booleanValue:(a=a.nodes,n&&(a=a[0])),a},e.select1=function(t,r){return e.select(t,r,!0)}}(t)},function(e,t,r){const n=r(35);function s(e){const t=e.substring("-----BEGIN PUBLIC KEY-----".length,e.length-"-----END PUBLIC KEY-----".length).replace("\n",""),r=function(e){const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0,n=e.length;t<n;t++)r[t]=e.charCodeAt(t);return t}(window.atob(t));return window.crypto.subtle.importKey("spki",r,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"])}window.validateSignature=function(e,t){let r=n.Parse(e),i=r.getElementsByTagNameNS("http://www.w3.org/2000/09/xmldsig#","Signature"),a=new n.SignedXml(r);a.LoadXml(i[0]),s(t).then(e=>{console.log("Imported crypto key"),a.Verify(e).then(e=>{console.log("Signature status:",e),window.webkit.messageHandlers.NPCICL.postMessage(JSON.stringify({valid:e,error:!1}))}).catch(e=>{console.error("Signature verification failed:",e),window.webkit.messageHandlers.NPCICL.postMessage(JSON.stringify({valid:!1,error:!0}))})}).catch(e=>{console.error("Error in making cryptoKey:",e),window.webkit.messageHandlers.NPCICL.postMessage(JSON.stringify({valid:!1,error:!0}))})}},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),a=n[0],o=n[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,o)),l=0,h=o>0?a-4:a;for(r=0;r<h;r+=4)t=s[e.charCodeAt(r)]<<18|s[e.charCodeAt(r+1)]<<12|s[e.charCodeAt(r+2)]<<6|s[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===o&&(t=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===o&&(t=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,s=r%3,i=[],a=0,o=r-s;a<o;a+=16383)i.push(l(e,a,a+16383>o?o:a+16383));1===s?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===s&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],s=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=a.length;o<u;++o)n[o]=a[o],s[a.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var s,i,a=[],o=t;o<r;o+=3)s=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(n[(i=s)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},function(e,t){
34
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
35
- t.read=function(e,t,r,n,s){var i,a,o=8*s-n-1,u=(1<<o)-1,c=u>>1,l=-7,h=r?s-1:0,f=r?-1:1,m=e[t+h];for(h+=f,i=m&(1<<-l)-1,m>>=-l,l+=o;l>0;i=256*i+e[t+h],h+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+e[t+h],h+=f,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(m?-1:1);a+=Math.pow(2,n),i-=c}return(m?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,s,i){var a,o,u,c=8*i-s-1,l=(1<<c)-1,h=l>>1,f=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:i-1,p=n?1:-1,d=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(t*u-1)*Math.pow(2,s),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,s),a=0));s>=8;e[r+m]=255&o,m+=p,o/=256,s-=8);for(a=a<<s|o,c+=s;c>0;e[r+m]=255&a,m+=p,a/=256,c-=8);e[r+m-p]|=128*d}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){var n=r(23);t.DOMImplementation=n.DOMImplementation,t.XMLSerializer=n.XMLSerializer,t.DOMParser=r(30).DOMParser},function(e,t,r){var n=r(19),s=r(23),i=r(31),a=r(32),o=s.DOMImplementation,u=n.NAMESPACE,c=a.ParseError,l=a.XMLReader;function h(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function f(e){this.options=e||{locator:{}}}function m(){this.cdata=!1}function p(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function d(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function g(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function b(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}f.prototype.parseFromString=function(e,t){var r=this.options,n=new l,s=r.domBuilder||new m,a=r.errorHandler,o=r.locator,c=r.xmlns||{},f=/\/x?html?$/.test(t),p=f?i.HTML_ENTITIES:i.XML_ENTITIES;o&&s.setDocumentLocator(o),n.errorHandler=function(e,t,r){if(!e){if(t instanceof m)return t;e=t}var n={},s=e instanceof Function;function i(t){var i=e[t];!i&&s&&(i=2==e.length?function(r){e(t,r)}:e),n[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+d(r))}||function(){}}return r=r||{},i("warning"),i("error"),i("fatalError"),n}(a,s,o),n.domBuilder=r.domBuilder||s,f&&(c[""]=u.HTML),c.xml=c.xml||u.XML;var g=r.normalizeLineEndings||h;return e&&"string"==typeof e?n.parse(g(e),c,p):n.errorHandler.error("invalid doc source"),s.doc},m.prototype={startDocument:function(){this.doc=(new o).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var s=this.doc,i=s.createElementNS(e,r||t),a=n.length;b(this,i),this.currentElement=i,this.locator&&p(this.locator,i);for(var o=0;o<a;o++){e=n.getURI(o);var u=n.getValue(o),c=(r=n.getQName(o),s.createAttributeNS(e,r));this.locator&&p(n.getLocator(o),c),c.value=c.nodeValue=u,i.setAttributeNode(c)}},endElement:function(e,t,r){var n=this.currentElement;n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&p(this.locator,r),b(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=g.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&p(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=g.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&p(this.locator,n),b(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(e,t,r);this.locator&&p(this.locator,s),b(this,s),this.doc.doctype=s}},warning:function(e){console.warn("[xmldom warning]\t"+e,d(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,d(this.locator))},fatalError:function(e){throw new c(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){m.prototype[e]=function(){return null}})),t.__DOMHandler=m,t.normalizeLineEndings=h,t.DOMParser=f},function(e,t,r){var n=r(19).freeze;t.XML_ENTITIES=n({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=n({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES},function(e,t,r){var n=r(19).NAMESPACE,s=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,i=new RegExp("[\\-\\.0-9"+s.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),a=new RegExp("^"+s.source+i.source+"*(?::"+s.source+i.source+"*)?$");function o(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,o)}function u(){}function c(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function l(e,t,r,s,i,a){function o(e,t,n){r.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),r.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),n)}for(var u,c=++t,l=0;;){var h=e.charAt(c);switch(h){case"=":if(1===l)u=e.slice(t,c),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(a.warning('attribute value must after "="'),u=e.slice(t,c)),t=c+1,!((c=e.indexOf(h,t))>0))throw new Error("attribute value no end '"+h+"' match");o(u,f=e.slice(t,c),t-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');o(u,f=e.slice(t,c),t),a.warning('attribute "'+u+'" missed start quot('+h+")!!"),t=c+1,l=5}break;case"/":switch(l){case 0:r.setTagName(e.slice(t,c));case 5:case 6:case 7:l=7,r.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==l&&r.setTagName(e.slice(t,c)),c;case">":switch(l){case 0:r.setTagName(e.slice(t,c));case 5:case 6:case 7:break;case 4:case 1:"/"===(f=e.slice(t,c)).slice(-1)&&(r.closed=!0,f=f.slice(0,-1));case 2:2===l&&(f=u),4==l?(a.warning('attribute "'+f+'" missed quot(")!'),o(u,f,t)):(n.isHTML(s[""])&&f.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+f+'" missed value!! "'+f+'" instead!!'),o(f,f,t));break;case 3:throw new Error("attribute value missed!!")}return c;case"€":h=" ";default:if(h<=" ")switch(l){case 0:r.setTagName(e.slice(t,c)),l=6;break;case 1:u=e.slice(t,c),l=2;break;case 4:var f=e.slice(t,c);a.warning('attribute "'+f+'" missed quot(")!!'),o(u,f,t);case 5:l=6}else switch(l){case 2:r.tagName;n.isHTML(s[""])&&u.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),o(u,u,t),t=c,l=1;break;case 5:a.warning('attribute space is required"'+u+'"!!');case 6:l=1,t=c;break;case 3:l=4,t=c;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function h(e,t,r){for(var s=e.tagName,i=null,a=e.length;a--;){var o=e[a],u=o.qName,c=o.value;if((m=u.indexOf(":"))>0)var l=o.prefix=u.slice(0,m),h=u.slice(m+1),f="xmlns"===l&&h;else h=u,l=null,f="xmlns"===u&&"";o.localName=h,!1!==f&&(null==i&&(i={},p(r,r={})),r[f]=i[f]=c,o.uri=n.XMLNS,t.startPrefixMapping(f,c))}for(a=e.length;a--;){(l=(o=e[a]).prefix)&&("xml"===l&&(o.uri=n.XML),"xmlns"!==l&&(o.uri=r[l||""]))}var m;(m=s.indexOf(":"))>0?(l=e.prefix=s.slice(0,m),h=e.localName=s.slice(m+1)):(l=null,h=e.localName=s);var d=e.uri=r[l||""];if(t.startElement(d,h,s,e),!e.closed)return e.currentNSMap=r,e.localNSMap=i,!0;if(t.endElement(d,h,s),i)for(l in i)t.endPrefixMapping(l)}function f(e,t,r,n,s){if(/^(?:script|textarea)$/i.test(r)){var i=e.indexOf("</"+r+">",t),a=e.substring(t+1,i);if(/[&<]/.test(a))return/^script$/i.test(r)?(s.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,n),s.characters(a,0,a.length),i)}return t+1}function m(e,t,r,n){var s=n[r];return null==s&&((s=e.lastIndexOf("</"+r+">"))<t&&(s=e.lastIndexOf("</"+r)),n[r]=s),s<t}function p(e,t){for(var r in e)t[r]=e[r]}function d(e,t,r,n){switch(e.charAt(t+2)){case"-":return"-"===e.charAt(t+3)?(s=e.indexOf("--\x3e",t+4))>t?(r.comment(e,t+4,s-t-4),s+3):(n.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var s=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,s-t-9),r.endCDATA(),s+3}var i=function(e,t){var r,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;s.lastIndex=t,s.exec(e);for(;r=s.exec(e);)if(n.push(r),r[1])return n}(e,t),a=i.length;if(a>1&&/!doctype/i.test(i[0][0])){var o=i[1][0],u=!1,c=!1;a>3&&(/^public$/i.test(i[2][0])?(u=i[3][0],c=a>4&&i[4][0]):/^system$/i.test(i[2][0])&&(c=i[3][0]));var l=i[a-1];return r.startDTD(o,u,c),r.endDTD(),l.index+l[0].length}}return-1}function g(e,t,r){var n=e.indexOf("?>",t);if(n){var s=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(s){s[0].length;return r.processingInstruction(s[1],s[2]),n+2}return-1}return-1}function b(){this.attributeNames={}}o.prototype=new Error,o.prototype.name=o.name,u.prototype={parse:function(e,t,r){var s=this.domBuilder;s.startDocument(),p(t,t={}),function(e,t,r,s,i){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(r,t)?r[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function u(t){if(t>E){var r=e.substring(E,t).replace(/&#?\w+;/g,a);N&&p(E),s.characters(r,0,t-E),E=t}}function p(t,r){for(;t>=w&&(r=v.exec(e));)y=r.index,w=y+r[0].length,N.lineNumber++;N.columnNumber=t-y+1}var y=0,w=0,v=/.*(?:\r\n?|\n)|.*$/g,N=s.locator,A=[{currentNSMap:t}],S={},E=0;for(;;){try{var C=e.indexOf("<",E);if(C<0){if(!e.substr(E).match(/^\s*$/)){var k=s.doc,O=k.createTextNode(e.substr(E));k.appendChild(O),s.currentElement=O}return}switch(C>E&&u(C),e.charAt(C+1)){case"/":var I=e.indexOf(">",C+3),x=e.substring(C+2,I).replace(/[ \t\n\r]+$/g,""),B=A.pop();I<0?(x=e.substring(C+2).replace(/[\s<].*/,""),i.error("end tag name: "+x+" is not complete:"+B.tagName),I=C+1+x.length):x.match(/\s</)&&(x=x.replace(/[\s<].*/,""),i.error("end tag name: "+x+" maybe not complete"),I=C+1+x.length);var D=B.localNSMap,T=B.tagName==x;if(T||B.tagName&&B.tagName.toLowerCase()==x.toLowerCase()){if(s.endElement(B.uri,B.localName,x),D)for(var P in D)s.endPrefixMapping(P);T||i.fatalError("end tag name: "+x+" is not match the current start tagName:"+B.tagName)}else A.push(B);I++;break;case"?":N&&p(C),I=g(e,C,s);break;case"!":N&&p(C),I=d(e,C,s,i);break;default:N&&p(C);var R=new b,j=A[A.length-1].currentNSMap,L=(I=l(e,C,R,j,a,i),R.length);if(!R.closed&&m(e,I,R.tagName,S)&&(R.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),N&&L){for(var U=c(N,{}),V=0;V<L;V++){var _=R[V];p(_.offset),_.locator=c(N,{})}s.locator=U,h(R,s,j)&&A.push(R),s.locator=N}else h(R,s,j)&&A.push(R);n.isHTML(R.uri)&&!R.closed?I=f(e,I,R.tagName,a,s):I++}}catch(e){if(e instanceof o)throw e;i.error("element parse error: "+e),I=-1}I>E?E=I:u(Math.max(C,E)+1)}}(e,t,r,s,this.errorHandler),s.endDocument()}},b.prototype={setTagName:function(e){if(!a.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!a.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},t.XMLReader=u,t.ParseError=o},function(e,t){function r(){this.init()}function n(e){this.expression=e}function s(){}function i(e){arguments.length>0&&this.init(e)}function a(e){arguments.length>0&&this.init(e)}function o(e,t){arguments.length>0&&this.init(e,t)}function u(e,t){arguments.length>0&&this.init(e,t)}function c(e,t){arguments.length>0&&this.init(e,t)}function l(e,t){arguments.length>0&&this.init(e,t)}function h(e,t){arguments.length>0&&this.init(e,t)}function f(e,t){arguments.length>0&&this.init(e,t)}function m(e,t){arguments.length>0&&this.init(e,t)}function p(e,t){arguments.length>0&&this.init(e,t)}function d(e,t){arguments.length>0&&this.init(e,t)}function g(e,t){arguments.length>0&&this.init(e,t)}function b(e,t){arguments.length>0&&this.init(e,t)}function y(e,t){arguments.length>0&&this.init(e,t)}function w(e,t){arguments.length>0&&this.init(e,t)}function v(e,t){arguments.length>0&&this.init(e,t)}function N(e,t){arguments.length>0&&this.init(e,t)}function A(e,t,r){arguments.length>0&&this.init(e,t,r)}function S(e,t){arguments.length>0&&this.init(e,t)}function E(e,t,r){arguments.length>0&&this.init(e,t,r)}function C(e,t){arguments.length>0&&this.init(e,t)}function k(e){arguments.length>0&&this.init(e)}function O(e,t){arguments.length>0&&this.init(e,t)}function I(e){arguments.length>0&&this.init(e)}function x(e){arguments.length>0&&this.init(e)}function B(e){arguments.length>0&&this.init(e)}function D(e){this.init(e)}function T(){this.init()}function P(e,t,r){this.isXPathNamespace=!0,this.ownerDocument=r.ownerDocument,this.nodeName="#namespace",this.prefix=e,this.localName=e,this.namespaceURI=t,this.nodeValue=t,this.ownerElement=r,this.nodeType=P.XPATH_NAMESPACE_NODE}r.prototype=new Object,r.prototype.constructor=r,r.superclass=Object.prototype,r.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(e){return new u(e[0],e[2])},this.reduceActions[5]=function(e){return new c(e[0],e[2])},this.reduceActions[7]=function(e){return new l(e[0],e[2])},this.reduceActions[8]=function(e){return new h(e[0],e[2])},this.reduceActions[10]=function(e){return new f(e[0],e[2])},this.reduceActions[11]=function(e){return new m(e[0],e[2])},this.reduceActions[12]=function(e){return new p(e[0],e[2])},this.reduceActions[13]=function(e){return new d(e[0],e[2])},this.reduceActions[15]=function(e){return new g(e[0],e[2])},this.reduceActions[16]=function(e){return new b(e[0],e[2])},this.reduceActions[18]=function(e){return new y(e[0],e[2])},this.reduceActions[19]=function(e){return new w(e[0],e[2])},this.reduceActions[20]=function(e){return new v(e[0],e[2])},this.reduceActions[22]=function(e){return new a(e[1])},this.reduceActions[24]=function(e){return new N(e[0],e[2])},this.reduceActions[25]=function(e){return new A(void 0,void 0,e[0])},this.reduceActions[27]=function(e){return e[0].locationPath=e[2],e[0]},this.reduceActions[28]=function(e){return e[0].locationPath=e[2],e[0].locationPath.steps.unshift(new E(E.DESCENDANTORSELF,new C(C.NODE,void 0),[])),e[0]},this.reduceActions[29]=function(e){return new A(e[0],[],void 0)},this.reduceActions[30]=function(e){return F.instance_of(e[0],A)?(null==e[0].filterPredicates&&(e[0].filterPredicates=[]),e[0].filterPredicates.push(e[1]),e[0]):new A(e[0],[e[1]],void 0)},this.reduceActions[32]=function(e){return e[1]},this.reduceActions[33]=function(e){return new I(e[0])},this.reduceActions[34]=function(e){return new x(e[0])},this.reduceActions[36]=function(e){return new O(e[0],[])},this.reduceActions[37]=function(e){return new O(e[0],e[2])},this.reduceActions[38]=function(e){return[e[0]]},this.reduceActions[39]=function(e){return e[2].unshift(e[0]),e[2]},this.reduceActions[43]=function(e){return new S(!0,[])},this.reduceActions[44]=function(e){return e[1].absolute=!0,e[1]},this.reduceActions[46]=function(e){return new S(!1,[e[0]])},this.reduceActions[47]=function(e){return e[0].steps.push(e[2]),e[0]},this.reduceActions[49]=function(e){return new E(e[0],e[1],[])},this.reduceActions[50]=function(e){return new E(E.CHILD,e[0],[])},this.reduceActions[51]=function(e){return new E(e[0],e[1],e[2])},this.reduceActions[52]=function(e){return new E(E.CHILD,e[0],e[1])},this.reduceActions[54]=function(e){return[e[0]]},this.reduceActions[55]=function(e){return e[1].unshift(e[0]),e[1]},this.reduceActions[56]=function(e){return"ancestor"==e[0]?E.ANCESTOR:"ancestor-or-self"==e[0]?E.ANCESTORORSELF:"attribute"==e[0]?E.ATTRIBUTE:"child"==e[0]?E.CHILD:"descendant"==e[0]?E.DESCENDANT:"descendant-or-self"==e[0]?E.DESCENDANTORSELF:"following"==e[0]?E.FOLLOWING:"following-sibling"==e[0]?E.FOLLOWINGSIBLING:"namespace"==e[0]?E.NAMESPACE:"parent"==e[0]?E.PARENT:"preceding"==e[0]?E.PRECEDING:"preceding-sibling"==e[0]?E.PRECEDINGSIBLING:"self"==e[0]?E.SELF:-1},this.reduceActions[57]=function(e){return E.ATTRIBUTE},this.reduceActions[59]=function(e){return"comment"==e[0]?new C(C.COMMENT,void 0):"text"==e[0]?new C(C.TEXT,void 0):"processing-instruction"==e[0]?new C(C.PI,void 0):"node"==e[0]?new C(C.NODE,void 0):new C(-1,void 0)},this.reduceActions[60]=function(e){return new C(C.PI,e[2])},this.reduceActions[61]=function(e){return e[1]},this.reduceActions[63]=function(e){return e[1].absolute=!0,e[1].steps.unshift(new E(E.DESCENDANTORSELF,new C(C.NODE,void 0),[])),e[1]},this.reduceActions[64]=function(e){return e[0].steps.push(new E(E.DESCENDANTORSELF,new C(C.NODE,void 0),[])),e[0].steps.push(e[2]),e[0]},this.reduceActions[65]=function(e){return new E(E.SELF,new C(C.NODE,void 0),[])},this.reduceActions[66]=function(e){return new E(E.PARENT,new C(C.NODE,void 0),[])},this.reduceActions[67]=function(e){return new k(e[1])},this.reduceActions[68]=function(e){return new C(C.NAMETESTANY,void 0)},this.reduceActions[69]=function(e){var t=e[0].substring(0,e[0].indexOf(":"));return new C(C.NAMETESTPREFIXANY,t)},this.reduceActions[70]=function(e){return new C(C.NAMETESTQNAME,e[0])}},r.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],r.actionTableNumber=[" 1 0 /.-,+*)(' & %$ # \"!"," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY "," 1 0 /.-,+*)(' & %$ # \"!","K1 KKKKKKKK . +*)('KKKKKK KK# K\" "," 1 0 /.-,+*)(' & %$ # \"!"," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q "," 1 . +*)(' # \" ","b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX "," 1 0 /.-,+*)(' & %$m # \"!","_ f________ ______e __ _ "," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 . +*)(' # \" "," 1 . +*)(' # \" ","> >>>>>>>>> >>>>>>> >> >> "," 1 . +*)(' # \" "," 1 . +*)(' # \" ","Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ‡ ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," ˆ "," F‰ ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," Š ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE "," 1 0 /.-,+*)(' & %$ # \"!","] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],r.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","€456789:;<=>?@ AB CDEFGH IJ"," ‚ EFGH IJ "," ƒ EFGH IJ "," "," „ GH IJ "," … GH IJ "," i † "," i ‡ "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABŒqCDEFGH IJ "," "," "],r.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],r.DOUBLEDOT=2,r.DOUBLECOLON=3,r.DOUBLESLASH=4,r.NOTEQUAL=5,r.LESSTHANOREQUAL=6,r.GREATERTHANOREQUAL=7,r.AND=8,r.OR=9,r.MOD=10,r.DIV=11,r.MULTIPLYOPERATOR=12,r.FUNCTIONNAME=13,r.AXISNAME=14,r.LITERAL=15,r.NUMBER=16,r.ASTERISKNAMETEST=17,r.QNAME=18,r.NCNAMECOLONASTERISK=19,r.NODETYPE=20,r.PROCESSINGINSTRUCTIONWITHLITERAL=21,r.EQUALS=22,r.LESSTHAN=23,r.GREATERTHAN=24,r.PLUS=25,r.MINUS=26,r.BAR=27,r.SLASH=28,r.LEFTPARENTHESIS=29,r.RIGHTPARENTHESIS=30,r.COMMA=31,r.AT=32,r.LEFTBRACKET=33,r.RIGHTBRACKET=34,r.DOT=35,r.DOLLAR=36,r.prototype.tokenize=function(e){for(var t=[],n=[],s=e+"\0",i=0,a=s.charAt(i++);;){for(;" "==a||"\t"==a||"\r"==a||"\n"==a;)a=s.charAt(i++);if("\0"==a||i>=s.length)break;if("("!=a)if(")"!=a)if("["!=a)if("]"!=a)if("@"!=a)if(","!=a)if("|"!=a)if("+"!=a)if("-"!=a)if("="!=a)if("$"!=a)if("."!=a)if("'"!=a&&'"'!=a)if(a>="0"&&a<="9"){h=a;for(a=s.charAt(i++);a>="0"&&a<="9";)h+=a,a=s.charAt(i++);if("."==a&&s.charAt(i)>="0"&&s.charAt(i)<="9")for(h+=a,h+=s.charAt(i++),a=s.charAt(i++);a>="0"&&a<="9";)h+=a,a=s.charAt(i++);t.push(r.NUMBER),n.push(h)}else if("*"!=a)if(":"!=a||":"!=s.charAt(i))if("/"!=a)if("!"!=a||"="!=s.charAt(i))if("<"!=a)if(">"!=a){if("_"!=a&&!F.isLetter(a.charCodeAt(0)))throw new Error("Unexpected character "+a);var o=a;for(a=s.charAt(i++);F.isNCNameChar(a.charCodeAt(0));)o+=a,a=s.charAt(i++);if(t.length>0&&(u=t[t.length-1])!=r.AT&&u!=r.DOUBLECOLON&&u!=r.LEFTPARENTHESIS&&u!=r.LEFTBRACKET&&u!=r.AND&&u!=r.OR&&u!=r.MOD&&u!=r.DIV&&u!=r.MULTIPLYOPERATOR&&u!=r.SLASH&&u!=r.DOUBLESLASH&&u!=r.BAR&&u!=r.PLUS&&u!=r.MINUS&&u!=r.EQUALS&&u!=r.NOTEQUAL&&u!=r.LESSTHAN&&u!=r.LESSTHANOREQUAL&&u!=r.GREATERTHAN&&u!=r.GREATERTHANOREQUAL){if("and"==o){t.push(r.AND),n.push(o);continue}if("or"==o){t.push(r.OR),n.push(o);continue}if("mod"==o){t.push(r.MOD),n.push(o);continue}if("div"==o){t.push(r.DIV),n.push(o);continue}}if(":"==a){if("*"==s.charAt(i)){t.push(r.NCNAMECOLONASTERISK),n.push(o+":*"),i++,a=s.charAt(i++);continue}if("_"==s.charAt(i)||F.isLetter(s.charCodeAt(i))){for(o+=":",a=s.charAt(i++);F.isNCNameChar(a.charCodeAt(0));)o+=a,a=s.charAt(i++);if("("==a){t.push(r.FUNCTIONNAME),n.push(o);continue}t.push(r.QNAME),n.push(o);continue}if(":"==s.charAt(i)){t.push(r.AXISNAME),n.push(o);continue}}if("("==a){if("comment"==o||"text"==o||"node"==o){t.push(r.NODETYPE),n.push(o);continue}if("processing-instruction"==o){")"==s.charAt(i)?t.push(r.NODETYPE):t.push(r.PROCESSINGINSTRUCTIONWITHLITERAL),n.push(o);continue}t.push(r.FUNCTIONNAME),n.push(o);continue}t.push(r.QNAME),n.push(o)}else{if("="==s.charAt(i)){t.push(r.GREATERTHANOREQUAL),n.push(">="),i++,a=s.charAt(i++);continue}t.push(r.GREATERTHAN),n.push(">"),a=s.charAt(i++)}else{if("="==s.charAt(i)){t.push(r.LESSTHANOREQUAL),n.push("<="),i++,a=s.charAt(i++);continue}t.push(r.LESSTHAN),n.push("<"),a=s.charAt(i++)}else t.push(r.NOTEQUAL),n.push("!="),i++,a=s.charAt(i++);else{if("/"==(a=s.charAt(i++))){t.push(r.DOUBLESLASH),n.push("//"),a=s.charAt(i++);continue}t.push(r.SLASH),n.push("/")}else t.push(r.DOUBLECOLON),n.push("::"),i++,a=s.charAt(i++);else{var u;if(t.length>0&&(u=t[t.length-1])!=r.AT&&u!=r.DOUBLECOLON&&u!=r.LEFTPARENTHESIS&&u!=r.LEFTBRACKET&&u!=r.AND&&u!=r.OR&&u!=r.MOD&&u!=r.DIV&&u!=r.MULTIPLYOPERATOR&&u!=r.SLASH&&u!=r.DOUBLESLASH&&u!=r.BAR&&u!=r.PLUS&&u!=r.MINUS&&u!=r.EQUALS&&u!=r.NOTEQUAL&&u!=r.LESSTHAN&&u!=r.LESSTHANOREQUAL&&u!=r.GREATERTHAN&&u!=r.GREATERTHANOREQUAL){t.push(r.MULTIPLYOPERATOR),n.push(a),a=s.charAt(i++);continue}t.push(r.ASTERISKNAMETEST),n.push(a),a=s.charAt(i++)}else{for(var c=a,l="";(a=s.charAt(i++))!=c;)l+=a;t.push(r.LITERAL),n.push(l),a=s.charAt(i++)}else{if("."==(a=s.charAt(i++))){t.push(r.DOUBLEDOT),n.push(".."),a=s.charAt(i++);continue}if(a>="0"&&a<="9"){var h="."+a;for(a=s.charAt(i++);a>="0"&&a<="9";)h+=a,a=s.charAt(i++);t.push(r.NUMBER),n.push(h);continue}t.push(r.DOT),n.push(".")}else t.push(r.DOLLAR),n.push(a),a=s.charAt(i++);else t.push(r.EQUALS),n.push(a),a=s.charAt(i++);else t.push(r.MINUS),n.push(a),a=s.charAt(i++);else t.push(r.PLUS),n.push(a),a=s.charAt(i++);else t.push(r.BAR),n.push(a),a=s.charAt(i++);else t.push(r.COMMA),n.push(a),a=s.charAt(i++);else t.push(r.AT),n.push(a),a=s.charAt(i++);else t.push(r.RIGHTBRACKET),n.push(a),a=s.charAt(i++);else t.push(r.LEFTBRACKET),n.push(a),a=s.charAt(i++);else t.push(r.RIGHTPARENTHESIS),n.push(a),a=s.charAt(i++);else t.push(r.LEFTPARENTHESIS),n.push(a),a=s.charAt(i++)}return t.push(1),n.push("[EOF]"),[t,n]},r.SHIFT="s",r.REDUCE="r",r.ACCEPT="a",r.prototype.parse=function(e){var t,s,i=this.tokenize(e);if(null!=i){t=i[0],s=i[1];var a,o,u=0,c=[],l=[],h=[];for(c.push(0),l.push(1),h.push("_S"),a=t[u],o=s[u++];;)switch(e=c[c.length-1],r.actionTable[e].charAt(a-1)){case r.SHIFT:l.push(-a),h.push(o),c.push(r.actionTableNumber[e].charCodeAt(a-1)-32),a=t[u],o=s[u++];break;case r.REDUCE:for(var f=r.productions[r.actionTableNumber[e].charCodeAt(a-1)-32][1],m=[],p=0;p<f;p++)l.pop(),m.unshift(h.pop()),c.pop();var d=c[c.length-1];l.push(r.productions[r.actionTableNumber[e].charCodeAt(a-1)-32][0]),null==this.reduceActions[r.actionTableNumber[e].charCodeAt(a-1)-32]?h.push(m[0]):h.push(this.reduceActions[r.actionTableNumber[e].charCodeAt(a-1)-32](m)),c.push(r.gotoTable[d].charCodeAt(r.productions[r.actionTableNumber[e].charCodeAt(a-1)-32][0]-2)-33);break;case r.ACCEPT:return new n(h.pop());default:throw new Error("XPath parse error")}}},n.prototype=new Object,n.prototype.constructor=n,n.superclass=Object.prototype,n.prototype.toString=function(){return this.expression.toString()},n.prototype.evaluate=function(e){if(e.contextNode=e.expressionContextNode,e.contextSize=1,e.contextPosition=1,e.caseInsensitive=!1,null!=e.contextNode){var t=e.contextNode;9!=t.nodeType&&(t=t.ownerDocument);try{e.caseInsensitive=t.implementation.hasFeature("HTML","2.0")}catch(t){e.caseInsensitive=!0}}return this.expression.evaluate(e)},n.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",n.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",s.prototype=new Object,s.prototype.constructor=s,s.superclass=Object.prototype,s.prototype.init=function(){},s.prototype.toString=function(){return"<Expression>"},s.prototype.evaluate=function(e){throw new Error("Could not evaluate expression.")},i.prototype=new s,i.prototype.constructor=i,i.superclass=s.prototype,i.prototype.init=function(e){this.rhs=e},a.prototype=new i,a.prototype.constructor=a,a.superclass=i.prototype,a.prototype.init=function(e){a.superclass.init.call(this,e)},a.prototype.evaluate=function(e){return this.rhs.evaluate(e).number().negate()},a.prototype.toString=function(){return"-"+this.rhs.toString()},o.prototype=new s,o.prototype.constructor=o,o.superclass=s.prototype,o.prototype.init=function(e,t){this.lhs=e,this.rhs=t},u.prototype=new o,u.prototype.constructor=u,u.superclass=o.prototype,u.prototype.init=function(e,t){u.superclass.init.call(this,e,t)},u.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},u.prototype.evaluate=function(e){var t=this.lhs.evaluate(e).bool();return t.booleanValue()?t:this.rhs.evaluate(e).bool()},c.prototype=new o,c.prototype.constructor=c,c.superclass=o.prototype,c.prototype.init=function(e,t){c.superclass.init.call(this,e,t)},c.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},c.prototype.evaluate=function(e){var t=this.lhs.evaluate(e).bool();return t.booleanValue()?this.rhs.evaluate(e).bool():t},l.prototype=new o,l.prototype.constructor=l,l.superclass=o.prototype,l.prototype.init=function(e,t){l.superclass.init.call(this,e,t)},l.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},l.prototype.evaluate=function(e){return this.lhs.evaluate(e).equals(this.rhs.evaluate(e))},h.prototype=new o,h.prototype.constructor=h,h.superclass=o.prototype,h.prototype.init=function(e,t){h.superclass.init.call(this,e,t)},h.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},h.prototype.evaluate=function(e){return this.lhs.evaluate(e).notequal(this.rhs.evaluate(e))},f.prototype=new o,f.prototype.constructor=f,f.superclass=o.prototype,f.prototype.init=function(e,t){f.superclass.init.call(this,e,t)},f.prototype.evaluate=function(e){return this.lhs.evaluate(e).lessthan(this.rhs.evaluate(e))},f.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},m.prototype=new o,m.prototype.constructor=m,m.superclass=o.prototype,m.prototype.init=function(e,t){m.superclass.init.call(this,e,t)},m.prototype.evaluate=function(e){return this.lhs.evaluate(e).greaterthan(this.rhs.evaluate(e))},m.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},p.prototype=new o,p.prototype.constructor=p,p.superclass=o.prototype,p.prototype.init=function(e,t){p.superclass.init.call(this,e,t)},p.prototype.evaluate=function(e){return this.lhs.evaluate(e).lessthanorequal(this.rhs.evaluate(e))},p.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},d.prototype=new o,d.prototype.constructor=d,d.superclass=o.prototype,d.prototype.init=function(e,t){d.superclass.init.call(this,e,t)},d.prototype.evaluate=function(e){return this.lhs.evaluate(e).greaterthanorequal(this.rhs.evaluate(e))},d.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},g.prototype=new o,g.prototype.constructor=g,g.superclass=o.prototype,g.prototype.init=function(e,t){g.superclass.init.call(this,e,t)},g.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().plus(this.rhs.evaluate(e).number())},g.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},b.prototype=new o,b.prototype.constructor=b,b.superclass=o.prototype,b.prototype.init=function(e,t){b.superclass.init.call(this,e,t)},b.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().minus(this.rhs.evaluate(e).number())},b.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},y.prototype=new o,y.prototype.constructor=y,y.superclass=o.prototype,y.prototype.init=function(e,t){y.superclass.init.call(this,e,t)},y.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().multiply(this.rhs.evaluate(e).number())},y.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},w.prototype=new o,w.prototype.constructor=w,w.superclass=o.prototype,w.prototype.init=function(e,t){w.superclass.init.call(this,e,t)},w.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().div(this.rhs.evaluate(e).number())},w.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},v.prototype=new o,v.prototype.constructor=v,v.superclass=o.prototype,v.prototype.init=function(e,t){v.superclass.init.call(this,e,t)},v.prototype.evaluate=function(e){return this.lhs.evaluate(e).number().mod(this.rhs.evaluate(e).number())},v.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},N.prototype=new o,N.prototype.constructor=N,N.superclass=o.prototype,N.prototype.init=function(e,t){N.superclass.init.call(this,e,t)},N.prototype.evaluate=function(e){return this.lhs.evaluate(e).nodeset().union(this.rhs.evaluate(e).nodeset())},N.prototype.toString=function(){return this.lhs.toString()+" | "+this.rhs.toString()},A.prototype=new s,A.prototype.constructor=A,A.superclass=s.prototype,A.prototype.init=function(e,t,r){A.superclass.init.call(this),this.filter=e,this.filterPredicates=t,this.locationPath=r},A.prototype.evaluate=function(e){var t,r=new j;if(r.variableResolver=e.variableResolver,r.functionResolver=e.functionResolver,r.namespaceResolver=e.namespaceResolver,r.expressionContextNode=e.expressionContextNode,r.virtualRoot=e.virtualRoot,r.caseInsensitive=e.caseInsensitive,null==this.filter)t=[e.contextNode];else{var s=this.filter.evaluate(e);if(!F.instance_of(s,T)){if(null!=this.filterPredicates&&this.filterPredicates.length>0||null!=this.locationPath)throw new Error("Path expression filter must evaluate to a nodset if predicates or location path are used");return s}if(t=s.toArray(),null!=this.filterPredicates)for(var i=0;i<this.filterPredicates.length;i++){var a=this.filterPredicates[i],o=[];for(r.contextSize=t.length,r.contextPosition=1;r.contextPosition<=r.contextSize;r.contextPosition++)r.contextNode=t[r.contextPosition-1],this.predicateMatches(a,r)&&o.push(r.contextNode);t=o}}if(null!=this.locationPath){if(this.locationPath.absolute)if(9!=t[0].nodeType)if(null!=r.virtualRoot)t=[r.virtualRoot];else if(null==t[0].ownerDocument){for(var u=t[0];null!=u.parentNode;)u=u.parentNode;t=[u]}else t=[t[0].ownerDocument];else t=[t[0]];for(var c=0;c<this.locationPath.steps.length;c++){var l=this.locationPath.steps[c],h=(o=[],[]);for(i=0;i<t.length;i++)switch(r.contextNode=t[i],l.axis){case E.ANCESTOR:if(r.contextNode===r.virtualRoot)break;for(f=2==r.contextNode.nodeType?this.getOwnerElement(r.contextNode):r.contextNode.parentNode;null!=f&&(l.nodeTest.matches(f,r)&&o.push(f),f!==r.virtualRoot);)f=f.parentNode;break;case E.ANCESTORORSELF:for(var f=r.contextNode;null!=f&&(l.nodeTest.matches(f,r)&&o.push(f),f!==r.virtualRoot);f=2==f.nodeType?this.getOwnerElement(f):f.parentNode);break;case E.ATTRIBUTE:var m=r.contextNode.attributes;if(null!=m)for(var p=0;p<m.length;p++){f=m.item(p);l.nodeTest.matches(f,r)&&o.push(f)}break;case E.CHILD:var d=0,g=[];for(f=r.contextNode.firstChild;null!=f;f=f.nextSibling)l.nodeTest.matches(f,r)&&(o.push(f),g.push({contextPosition:++d}));for(p=0;p<g.length;p++)g[p].contextSize=d,h.push(g[p]);break;case E.DESCENDANT:for(var b=[r.contextNode.firstChild];b.length>0;)for(f=b.pop();null!=f;)l.nodeTest.matches(f,r)&&o.push(f),null!=f.firstChild?(b.push(f.nextSibling),f=f.firstChild):f=f.nextSibling;break;case E.DESCENDANTORSELF:l.nodeTest.matches(r.contextNode,r)&&o.push(r.contextNode);for(b=[r.contextNode.firstChild];b.length>0;)for(f=b.pop();null!=f;)l.nodeTest.matches(f,r)&&o.push(f),null!=f.firstChild?(b.push(f.nextSibling),f=f.firstChild):f=f.nextSibling;break;case E.FOLLOWING:if(r.contextNode===r.virtualRoot)break;b=[];null!=r.contextNode.firstChild?b.unshift(r.contextNode.firstChild):b.unshift(r.contextNode.nextSibling);for(f=r.contextNode;null!=f&&9!=f.nodeType&&f!==r.virtualRoot;f=f.parentNode)b.unshift(f.nextSibling);do{for(f=b.pop();null!=f;)l.nodeTest.matches(f,r)&&o.push(f),null!=f.firstChild?(b.push(f.nextSibling),f=f.firstChild):f=f.nextSibling}while(b.length>0);break;case E.FOLLOWINGSIBLING:if(r.contextNode===r.virtualRoot)break;for(f=r.contextNode.nextSibling;null!=f;f=f.nextSibling)l.nodeTest.matches(f,r)&&o.push(f);break;case E.NAMESPACE:u={};if(1==r.contextNode.nodeType){u.xml=n.XML_NAMESPACE_URI,u.xmlns=n.XMLNS_NAMESPACE_URI;for(f=r.contextNode;null!=f&&1==f.nodeType;f=f.parentNode)for(p=0;p<f.attributes.length;p++){var y=f.attributes.item(p),w=String(y.name);if("xmlns"==w)null==u[""]&&(u[""]=y.value);else if(w.length>6&&"xmlns:"==w.substring(0,6)){null==u[v=w.substring(6,w.length)]&&(u[v]=y.value)}}for(var v in u){var N=new NamespaceNode(v,u[v],r.contextNode);l.nodeTest.matches(N,r)&&o.push(N)}}break;case E.PARENT:f=null,r.contextNode!==r.virtualRoot&&(f=2==r.contextNode.nodeType?this.getOwnerElement(r.contextNode):r.contextNode.parentNode),null!=f&&l.nodeTest.matches(f,r)&&o.push(f);break;case E.PRECEDING:b=null!=r.virtualRoot?[r.virtualRoot]:9==r.contextNode.nodeType?[r.contextNode]:[r.contextNode.ownerDocument];e:for(;b.length>0;)for(f=b.pop();null!=f;){if(f==r.contextNode)break e;l.nodeTest.matches(f,r)&&o.unshift(f),null!=f.firstChild?(b.push(f.nextSibling),f=f.firstChild):f=f.nextSibling}break;case E.PRECEDINGSIBLING:if(r.contextNode===r.virtualRoot)break;for(f=r.contextNode.previousSibling;null!=f;f=f.previousSibling)l.nodeTest.matches(f,r)&&o.push(f);break;case E.SELF:l.nodeTest.matches(r.contextNode,r)&&o.push(r.contextNode)}t=o;for(i=0;i<l.predicates.length;i++){a=l.predicates[i],o=[];for(r.contextSize=t.length,r.contextPosition=1;r.contextPosition<=r.contextSize;r.contextPosition++){r.contextNode=t[r.contextPosition-1];var A=h.length>0?this.getLocalCtx(r,h[r.contextPosition-1]):r;this.predicateMatches(a,A)&&o.push(r.contextNode)}t=o}}}return(s=new T).addArray(t),s},A.prototype.getLocalCtx=function(e,t,r){var n=new j;return n.variableResolver=e.variableResolver,n.functionResolver=e.functionResolver,n.namespaceResolver=e.namespaceResolver,n.expressionContextNode=e.expressionContextNode,n.virtualRoot=e.virtualRoot,n.caseInsensitive=e.caseInsensitive,n.contextNode=e.contextNode,n.contextPosition=t.contextPosition,n.contextSize=t.contextSize,n},A.prototype.predicateMatches=function(e,t){var r=e.evaluate(t);return F.instance_of(r,x)?t.contextPosition==r.numberValue():r.booleanValue()},A.prototype.toString=function(){if(null!=this.filter){var e=this.filter.toString();if(F.instance_of(this.filter,I)&&(e="'"+e+"'"),null!=this.filterPredicates)for(var t=0;t<this.filterPredicates.length;t++)e=e+"["+this.filterPredicates[t].toString()+"]";return null!=this.locationPath&&(this.locationPath.absolute||(e+="/"),e+=this.locationPath.toString()),e}return this.locationPath.toString()},A.prototype.getOwnerElement=function(e){if(e.ownerElement)return e.ownerElement;try{if(e.selectSingleNode)return e.selectSingleNode("..")}catch(e){}for(var t=(9==e.nodeType?e:e.ownerDocument).getElementsByTagName("*"),r=0;r<t.length;r++)for(var n=t.item(r),s=n.attributes,i=0;i<s.length;i++){if(s.item(i)===e)return n}return null},S.prototype=new Object,S.prototype.constructor=S,S.superclass=Object.prototype,S.prototype.init=function(e,t){this.absolute=e,this.steps=t},S.prototype.toString=function(){var e;e=this.absolute?"/":"";for(var t=0;t<this.steps.length;t++)0!=t&&(e+="/"),e+=this.steps[t].toString();return e},E.prototype=new Object,E.prototype.constructor=E,E.superclass=Object.prototype,E.prototype.init=function(e,t,r){this.axis=e,this.nodeTest=t,this.predicates=r},E.prototype.toString=function(){var e;switch(this.axis){case E.ANCESTOR:e="ancestor";break;case E.ANCESTORORSELF:e="ancestor-or-self";break;case E.ATTRIBUTE:e="attribute";break;case E.CHILD:e="child";break;case E.DESCENDANT:e="descendant";break;case E.DESCENDANTORSELF:e="descendant-or-self";break;case E.FOLLOWING:e="following";break;case E.FOLLOWINGSIBLING:e="following-sibling";break;case E.NAMESPACE:e="namespace";break;case E.PARENT:e="parent";break;case E.PRECEDING:e="preceding";break;case E.PRECEDINGSIBLING:e="preceding-sibling";break;case E.SELF:e="self"}e+="::",e+=this.nodeTest.toString();for(var t=0;t<this.predicates.length;t++)e+="["+this.predicates[t].toString()+"]";return e},E.ANCESTOR=0,E.ANCESTORORSELF=1,E.ATTRIBUTE=2,E.CHILD=3,E.DESCENDANT=4,E.DESCENDANTORSELF=5,E.FOLLOWING=6,E.FOLLOWINGSIBLING=7,E.NAMESPACE=8,E.PARENT=9,E.PRECEDING=10,E.PRECEDINGSIBLING=11,E.SELF=12,C.prototype=new Object,C.prototype.constructor=C,C.superclass=Object.prototype,C.prototype.init=function(e,t){this.type=e,this.value=t},C.prototype.toString=function(){switch(this.type){case C.NAMETESTANY:return"*";case C.NAMETESTPREFIXANY:return this.value+":*";case C.NAMETESTRESOLVEDANY:return"{"+this.value+"}*";case C.NAMETESTQNAME:return this.value;case C.NAMETESTRESOLVEDNAME:return"{"+this.namespaceURI+"}"+this.value;case C.COMMENT:return"comment()";case C.TEXT:return"text()";case C.PI:return null!=this.value?'processing-instruction("'+this.value+'")':"processing-instruction()";case C.NODE:return"node()"}return"<unknown nodetest type>"},C.prototype.matches=function(e,t){switch(this.type){case C.NAMETESTANY:return 2==e.nodeType||1==e.nodeType||e.nodeType==P.XPATH_NAMESPACE_NODE;case C.NAMETESTPREFIXANY:if(2==e.nodeType||1==e.nodeType){if(null==t.namespaceResolver.getNamespace(this.value,t.expressionContextNode))throw new Error("Cannot resolve QName "+this.value);return!0}return!1;case C.NAMETESTQNAME:if(2==e.nodeType||1==e.nodeType||e.nodeType==P.XPATH_NAMESPACE_NODE){var r=F.resolveQName(this.value,t.namespaceResolver,t.expressionContextNode,!1);if(null==r[0])throw new Error("Cannot resolve QName "+this.value);r[0]=String(r[0]),r[1]=String(r[1]),""==r[0]&&(r[0]=null);var n=F.resolveQName(e.nodeName,t.namespaceResolver,e,1==e.nodeType);return n[0]=String(n[0]),n[1]=String(n[1]),""==n[0]&&(n[0]=null),t.caseInsensitive?r[0]==n[0]&&String(r[1]).toLowerCase()==String(n[1]).toLowerCase():r[0]==n[0]&&r[1]==n[1]}return!1;case C.COMMENT:return 8==e.nodeType;case C.TEXT:return 3==e.nodeType||4==e.nodeType;case C.PI:return 7==e.nodeType&&(null==this.value||e.nodeName==this.value);case C.NODE:return 9==e.nodeType||1==e.nodeType||2==e.nodeType||3==e.nodeType||4==e.nodeType||8==e.nodeType||7==e.nodeType}return!1},C.NAMETESTANY=0,C.NAMETESTPREFIXANY=1,C.NAMETESTQNAME=2,C.COMMENT=3,C.TEXT=4,C.PI=5,C.NODE=6,k.prototype=new s,k.prototype.constructor=k,k.superclass=s.prototype,k.prototype.init=function(e){this.variable=e},k.prototype.toString=function(){return"$"+this.variable},k.prototype.evaluate=function(e){return e.variableResolver.getVariable(this.variable,e)},O.prototype=new s,O.prototype.constructor=O,O.superclass=s.prototype,O.prototype.init=function(e,t){this.functionName=e,this.arguments=t},O.prototype.toString=function(){for(var e=this.functionName+"(",t=0;t<this.arguments.length;t++)t>0&&(e+=", "),e+=this.arguments[t].toString();return e+")"},O.prototype.evaluate=function(e){var t=e.functionResolver.getFunction(this.functionName,e);if(null==t)throw new Error("Unknown function "+this.functionName);var r=[e].concat(this.arguments);return t.apply(e.functionResolver.thisArg,r)},I.prototype=new s,I.prototype.constructor=I,I.superclass=s.prototype,I.prototype.init=function(e){this.str=e},I.prototype.toString=function(){return this.str},I.prototype.evaluate=function(e){return this},I.prototype.string=function(){return this},I.prototype.number=function(){return new x(this.str)},I.prototype.bool=function(){return new B(this.str)},I.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},I.prototype.stringValue=function(){return this.str},I.prototype.numberValue=function(){return this.number().numberValue()},I.prototype.booleanValue=function(){return this.bool().booleanValue()},I.prototype.equals=function(e){return F.instance_of(e,B)?this.bool().equals(e):F.instance_of(e,x)?this.number().equals(e):F.instance_of(e,T)?e.compareWithString(this,R.equals):new B(this.str==e.str)},I.prototype.notequal=function(e){return F.instance_of(e,B)?this.bool().notequal(e):F.instance_of(e,x)?this.number().notequal(e):F.instance_of(e,T)?e.compareWithString(this,R.notequal):new B(this.str!=e.str)},I.prototype.lessthan=function(e){return F.instance_of(e,T)?e.compareWithNumber(this.number(),R.greaterthanorequal):this.number().lessthan(e.number())},I.prototype.greaterthan=function(e){return F.instance_of(e,T)?e.compareWithNumber(this.number(),R.lessthanorequal):this.number().greaterthan(e.number())},I.prototype.lessthanorequal=function(e){return F.instance_of(e,T)?e.compareWithNumber(this.number(),R.greaterthan):this.number().lessthanorequal(e.number())},I.prototype.greaterthanorequal=function(e){return F.instance_of(e,T)?e.compareWithNumber(this.number(),R.lessthan):this.number().greaterthanorequal(e.number())},x.prototype=new s,x.prototype.constructor=x,x.superclass=s.prototype,x.prototype.init=function(e){this.num=Number(e)},x.prototype.toString=function(){return this.num},x.prototype.evaluate=function(e){return this},x.prototype.string=function(){return new I(this.num)},x.prototype.number=function(){return this},x.prototype.bool=function(){return new B(this.num)},x.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},x.prototype.stringValue=function(){return this.string().stringValue()},x.prototype.numberValue=function(){return this.num},x.prototype.booleanValue=function(){return this.bool().booleanValue()},x.prototype.negate=function(){return new x(-this.num)},x.prototype.equals=function(e){return F.instance_of(e,B)?this.bool().equals(e):F.instance_of(e,I)?this.equals(e.number()):F.instance_of(e,T)?e.compareWithNumber(this,R.equals):new B(this.num==e.num)},x.prototype.notequal=function(e){return F.instance_of(e,B)?this.bool().notequal(e):F.instance_of(e,I)?this.notequal(e.number()):F.instance_of(e,T)?e.compareWithNumber(this,R.notequal):new B(this.num!=e.num)},x.prototype.lessthan=function(e){return F.instance_of(e,T)?e.compareWithNumber(this,R.greaterthanorequal):F.instance_of(e,B)||F.instance_of(e,I)?this.lessthan(e.number()):new B(this.num<e.num)},x.prototype.greaterthan=function(e){return F.instance_of(e,T)?e.compareWithNumber(this,R.lessthanorequal):F.instance_of(e,B)||F.instance_of(e,I)?this.greaterthan(e.number()):new B(this.num>e.num)},x.prototype.lessthanorequal=function(e){return F.instance_of(e,T)?e.compareWithNumber(this,R.greaterthan):F.instance_of(e,B)||F.instance_of(e,I)?this.lessthanorequal(e.number()):new B(this.num<=e.num)},x.prototype.greaterthanorequal=function(e){return F.instance_of(e,T)?e.compareWithNumber(this,R.lessthan):F.instance_of(e,B)||F.instance_of(e,I)?this.greaterthanorequal(e.number()):new B(this.num>=e.num)},x.prototype.plus=function(e){return new x(this.num+e.num)},x.prototype.minus=function(e){return new x(this.num-e.num)},x.prototype.multiply=function(e){return new x(this.num*e.num)},x.prototype.div=function(e){return new x(this.num/e.num)},x.prototype.mod=function(e){return new x(this.num%e.num)},B.prototype=new s,B.prototype.constructor=B,B.superclass=s.prototype,B.prototype.init=function(e){this.b=Boolean(e)},B.prototype.toString=function(){return this.b.toString()},B.prototype.evaluate=function(e){return this},B.prototype.string=function(){return new I(this.b)},B.prototype.number=function(){return new x(this.b)},B.prototype.bool=function(){return this},B.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},B.prototype.stringValue=function(){return this.string().stringValue()},B.prototype.numberValue=function(){return this.num().numberValue()},B.prototype.booleanValue=function(){return this.b},B.prototype.not=function(){return new B(!this.b)},B.prototype.equals=function(e){return F.instance_of(e,I)||F.instance_of(e,x)?this.equals(e.bool()):F.instance_of(e,T)?e.compareWithBoolean(this,R.equals):new B(this.b==e.b)},B.prototype.notequal=function(e){return F.instance_of(e,I)||F.instance_of(e,x)?this.notequal(e.bool()):F.instance_of(e,T)?e.compareWithBoolean(this,R.notequal):new B(this.b!=e.b)},B.prototype.lessthan=function(e){return F.instance_of(e,T)?e.compareWithNumber(this.number(),R.greaterthanorequal):this.number().lessthan(e.number())},B.prototype.greaterthan=function(e){return F.instance_of(e,T)?e.compareWithNumber(this.number(),R.lessthanorequal):this.number().greaterthan(e.number())},B.prototype.lessthanorequal=function(e){return F.instance_of(e,T)?e.compareWithNumber(this.number(),R.greaterthan):this.number().lessthanorequal(e.number())},B.prototype.greaterthanorequal=function(e){return F.instance_of(e,T)?e.compareWithNumber(this.number(),R.lessthan):this.number().greaterthanorequal(e.number())},D.prototype=new Object,D.prototype.constructor=D,D.superclass=Object.prototype,D.prototype.init=function(e){this.left=null,this.right=null,this.node=e,this.depth=1},D.prototype.balance=function(){var e=null==this.left?0:this.left.depth,t=null==this.right?0:this.right.depth;if(e>t+1)(null==this.left.left?0:this.left.left.depth)<(null==this.left.right?0:this.left.right.depth)&&this.left.rotateRR(),this.rotateLL();else if(e+1<t){var r=null==this.right.right?0:this.right.right.depth;(null==this.right.left?0:this.right.left.depth)>r&&this.right.rotateLL(),this.rotateRR()}},D.prototype.rotateLL=function(){var e=this.node,t=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=t,this.right.node=e,this.right.updateInNewLocation(),this.updateInNewLocation()},D.prototype.rotateRR=function(){var e=this.node,t=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=t,this.left.node=e,this.left.updateInNewLocation(),this.updateInNewLocation()},D.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},D.prototype.getDepthFromChildren=function(){this.depth=null==this.node?0:1,null!=this.left&&(this.depth=this.left.depth+1),null!=this.right&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)},D.prototype.order=function(e,t){if(e===t)return 0;for(var r=0,n=0,s=e;null!=s;s=s.parentNode)r++;for(var i=t;null!=i;i=i.parentNode)n++;if(r>n){for(;r>n;)e=e.parentNode,r--;if(e==t)return 1}else if(n>r){for(;n>r;)t=t.parentNode,n--;if(e==t)return-1}for(;e.parentNode!=t.parentNode;)e=e.parentNode,t=t.parentNode;for(;null!=e.previousSibling&&null!=t.previousSibling;)e=e.previousSibling,t=t.previousSibling;return null==e.previousSibling?-1:1},D.prototype.add=function(e){if(e===this.node)return!1;var t=this.order(e,this.node),r=!1;return-1==t?null==this.left?(this.left=new D(e),r=!0):(r=this.left.add(e))&&this.balance():1==t&&(null==this.right?(this.right=new D(e),r=!0):(r=this.right.add(e))&&this.balance()),r&&this.getDepthFromChildren(),r},T.prototype=new s,T.prototype.constructor=T,T.superclass=s.prototype,T.prototype.init=function(){this.tree=null,this.size=0},T.prototype.toString=function(){var e=this.first();return null==e?"":this.stringForNode(e)},T.prototype.evaluate=function(e){return this},T.prototype.string=function(){return new I(this.toString())},T.prototype.stringValue=function(){return this.toString()},T.prototype.number=function(){return new x(this.string())},T.prototype.numberValue=function(){return Number(this.string())},T.prototype.bool=function(){return new B(null!=this.tree)},T.prototype.booleanValue=function(){return null!=this.tree},T.prototype.nodeset=function(){return this},T.prototype.stringForNode=function(e){return 9==e.nodeType&&(e=e.documentElement),1==e.nodeType?this.stringForNodeRec(e):e.isNamespaceNode?e.namespace:e.nodeValue},T.prototype.stringForNodeRec=function(e){for(var t="",r=e.firstChild;null!=r;r=r.nextSibling)3==r.nodeType?t+=r.nodeValue:1==r.nodeType&&(t+=this.stringForNodeRec(r));return t},T.prototype.first=function(){var e=this.tree;if(null==e)return null;for(;null!=e.left;)e=e.left;return e.node},T.prototype.add=function(e){var t;null==this.tree?(this.tree=new D(e),t=!0):t=this.tree.add(e),t&&this.size++},T.prototype.addArray=function(e){for(var t=0;t<e.length;t++)this.add(e[t])},T.prototype.toArray=function(){var e=[];return this.toArrayRec(this.tree,e),e},T.prototype.toArrayRec=function(e,t){null!=e&&(this.toArrayRec(e.left,t),t.push(e.node),this.toArrayRec(e.right,t))},T.prototype.compareWithString=function(e,t){for(var r=this.toArray(),n=0;n<r.length;n++){var s=r[n],i=t(new I(this.stringForNode(s)),e);if(i.booleanValue())return i}return new B(!1)},T.prototype.compareWithNumber=function(e,t){for(var r=this.toArray(),n=0;n<r.length;n++){var s=r[n],i=t(new x(this.stringForNode(s)),e);if(i.booleanValue())return i}return new B(!1)},T.prototype.compareWithBoolean=function(e,t){return t(this.bool(),e)},T.prototype.compareWithNodeSet=function(e,t){for(var r=this.toArray(),n=0;n<r.length;n++)for(var s=r[n],i=new I(this.stringForNode(s)),a=e.toArray(),o=0;o<a.length;o++){var u=a[o],c=t(i,e=new I(this.stringForNode(u)));if(c.booleanValue())return c}return new B(!1)},T.prototype.equals=function(e){return F.instance_of(e,I)?this.compareWithString(e,R.equals):F.instance_of(e,x)?this.compareWithNumber(e,R.equals):F.instance_of(e,B)?this.compareWithBoolean(e,R.equals):this.compareWithNodeSet(e,R.equals)},T.prototype.notequal=function(e){return F.instance_of(e,I)?this.compareWithString(e,R.notequal):F.instance_of(e,x)?this.compareWithNumber(e,R.notequal):F.instance_of(e,B)?this.compareWithBoolean(e,R.notequal):this.compareWithNodeSet(e,R.notequal)},T.prototype.lessthan=function(e){return F.instance_of(e,I)?this.compareWithNumber(e.number(),R.lessthan):F.instance_of(e,x)?this.compareWithNumber(e,R.lessthan):F.instance_of(e,B)?this.compareWithBoolean(e,R.lessthan):this.compareWithNodeSet(e,R.lessthan)},T.prototype.greaterthan=function(e){return F.instance_of(e,I)?this.compareWithNumber(e.number(),R.greaterthan):F.instance_of(e,x)?this.compareWithNumber(e,R.greaterthan):F.instance_of(e,B)?this.compareWithBoolean(e,R.greaterthan):this.compareWithNodeSet(e,R.greaterthan)},T.prototype.lessthanorequal=function(e){return F.instance_of(e,I)?this.compareWithNumber(e.number(),R.lessthanorequal):F.instance_of(e,x)?this.compareWithNumber(e,R.lessthanorequal):F.instance_of(e,B)?this.compareWithBoolean(e,R.lessthanorequal):this.compareWithNodeSet(e,R.lessthanorequal)},T.prototype.greaterthanorequal=function(e){return F.instance_of(e,I)?this.compareWithNumber(e.number(),R.greaterthanorequal):F.instance_of(e,x)?this.compareWithNumber(e,R.greaterthanorequal):F.instance_of(e,B)?this.compareWithBoolean(e,R.greaterthanorequal):this.compareWithNodeSet(e,R.greaterthanorequal)},T.prototype.union=function(e){var t=new T;return t.tree=this.tree,t.size=this.size,t.addArray(e.toArray()),t},P.prototype=new Object,P.prototype.constructor=P,P.superclass=Object.prototype,P.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'};var R=new Object;function j(e,t,r){this.variableResolver=null!=e?e:new L,this.namespaceResolver=null!=t?t:new V,this.functionResolver=null!=r?r:new U}function L(){}function U(e){this.thisArg=null!=e?e:_,this.functions=new Object,this.addStandardFunctions()}function V(){}R.equals=function(e,t){return e.equals(t)},R.notequal=function(e,t){return e.notequal(t)},R.lessthan=function(e,t){return e.lessthan(t)},R.greaterthan=function(e,t){return e.greaterthan(t)},R.lessthanorequal=function(e,t){return e.lessthanorequal(t)},R.greaterthanorequal=function(e,t){return e.greaterthanorequal(t)},j.prototype=new Object,j.prototype.constructor=j,j.superclass=Object.prototype,L.prototype=new Object,L.prototype.constructor=L,L.superclass=Object.prototype,L.prototype.getVariable=function(e,t){var r=F.splitQName(e);if(null!=r[0]&&(r[0]=t.namespaceResolver.getNamespace(r[0],t.expressionContextNode),null==r[0]))throw new Error("Cannot resolve QName "+fn);return this.getVariableWithName(r[0],r[1],t.expressionContextNode)},L.prototype.getVariableWithName=function(e,t,r){return null},U.prototype=new Object,U.prototype.constructor=U,U.superclass=Object.prototype,U.prototype.addStandardFunctions=function(){this.functions["{}last"]=_.last,this.functions["{}position"]=_.position,this.functions["{}count"]=_.count,this.functions["{}id"]=_.id,this.functions["{}local-name"]=_.localName,this.functions["{}namespace-uri"]=_.namespaceURI,this.functions["{}name"]=_.name,this.functions["{}string"]=_.string,this.functions["{}concat"]=_.concat,this.functions["{}starts-with"]=_.startsWith,this.functions["{}contains"]=_.contains,this.functions["{}substring-before"]=_.substringBefore,this.functions["{}substring-after"]=_.substringAfter,this.functions["{}substring"]=_.substring,this.functions["{}string-length"]=_.stringLength,this.functions["{}normalize-space"]=_.normalizeSpace,this.functions["{}translate"]=_.translate,this.functions["{}boolean"]=_.boolean_,this.functions["{}not"]=_.not,this.functions["{}true"]=_.true_,this.functions["{}false"]=_.false_,this.functions["{}lang"]=_.lang,this.functions["{}number"]=_.number,this.functions["{}sum"]=_.sum,this.functions["{}floor"]=_.floor,this.functions["{}ceiling"]=_.ceiling,this.functions["{}round"]=_.round},U.prototype.addFunction=function(e,t,r){this.functions["{"+e+"}"+t]=r},U.prototype.getFunction=function(e,t){var r=F.resolveQName(e,t.namespaceResolver,t.contextNode,!1);if(null==r[0])throw new Error("Cannot resolve QName "+e);return this.getFunctionWithName(r[0],r[1],t.contextNode)},U.prototype.getFunctionWithName=function(e,t,r){return this.functions["{"+e+"}"+t]},V.prototype=new Object,V.prototype.constructor=V,V.superclass=Object.prototype,V.prototype.getNamespace=function(e,t){if("xml"==e)return n.XML_NAMESPACE_URI;if("xmlns"==e)return n.XMLNS_NAMESPACE_URI;for(9==t.nodeType?t=t.documentElement:2==t.nodeType?t=A.prototype.getOwnerElement(t):1!=t.nodeType&&(t=t.parentNode);null!=t&&1==t.nodeType;){for(var r=t.attributes,s=0;s<r.length;s++){var i=r.item(s),a=i.nodeName;if("xmlns"==a&&""==e||a=="xmlns:"+e)return String(i.nodeValue)}t=t.parentNode}return null};var _=new Object;_.last=function(){var e=arguments[0];if(1!=arguments.length)throw new Error("Function last expects ()");return new x(e.contextSize)},_.position=function(){var e=arguments[0];if(1!=arguments.length)throw new Error("Function position expects ()");return new x(e.contextPosition)},_.count=function(){var e,t=arguments[0];if(2!=arguments.length||!F.instance_of(e=arguments[1].evaluate(t),T))throw new Error("Function count expects (node-set)");return new x(e.size)},_.id=function(){var e,t=arguments[0];if(2!=arguments.length)throw new Error("Function id expects (object)");e=arguments[1].evaluate(t);for(var r=(e=F.instance_of(e,T)?e.toArray().join(" "):e.stringValue()).split(/[\x0d\x0a\x09\x20]+/),n=new T,s=9==t.contextNode.nodeType?t.contextNode:t.contextNode.ownerDocument,i=0;i<r.length;i++){var a;null!=(a=s.getElementById?s.getElementById(r[i]):F.getElementById(s,r[i]))&&(n.add(a))}return n},_.localName=function(){var e,t=arguments[0];if(1==arguments.length)e=t.contextNode;else{if(2!=arguments.length)throw new Error("Function local-name expects (node-set?)");e=arguments[1].evaluate(t).first()}return new I(null==e?"":e.localName?e.localName:e.baseName)},_.namespaceURI=function(){var e,t=arguments[0];if(1==arguments.length)e=t.contextNode;else{if(2!=arguments.length)throw new Error("Function namespace-uri expects (node-set?)");e=arguments[1].evaluate(t).first()}return new I(null==e?"":e.namespaceURI)},_.name=function(){var e,t=arguments[0];if(1==arguments.length)e=t.contextNode;else{if(2!=arguments.length)throw new Error("Function name expects (node-set?)");e=arguments[1].evaluate(t).first()}return null==e?new I(""):1==e.nodeType||2==e.nodeType?new I(e.nodeName):null==e.localName?new I(""):new I(e.localName)},_.string=function(){var e=arguments[0];if(1==arguments.length)return T.prototype.stringForNode(e.contextNode);if(2==arguments.length)return arguments[1].evaluate(e).string();throw new Error("Function string expects (object?)")},_.concat=function(){var e=arguments[0];if(arguments.length<3)throw new Error("Function concat expects (string, string, string*)");for(var t="",r=1;r<arguments.length;r++)t+=arguments[r].evaluate(e).stringValue();return new I(t)},_.startsWith=function(){var e=arguments[0];if(3!=arguments.length)throw new Error("Function startsWith expects (string, string)");var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue();return new B(t.substring(0,r.length)==r)},_.contains=function(){var e=arguments[0];if(3!=arguments.length)throw new Error("Function contains expects (string, string)");var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue();return new B(-1!=t.indexOf(r))},_.substringBefore=function(){var e=arguments[0];if(3!=arguments.length)throw new Error("Function substring-before expects (string, string)");var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue();return new I(t.substring(0,t.indexOf(r)))},_.substringAfter=function(){var e=arguments[0];if(3!=arguments.length)throw new Error("Function substring-after expects (string, string)");var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue();if(0==r.length)return new I(t);var n=t.indexOf(r);return new I(-1==n?"":t.substring(t.indexOf(r)+1))},_.substring=function(){var e=arguments[0];if(3!=arguments.length&&4!=arguments.length)throw new Error("Function substring expects (string, number, number?)");var t=arguments[1].evaluate(e).stringValue(),r=Math.round(arguments[2].evaluate(e).numberValue())-1,n=4==arguments.length?r+Math.round(arguments[3].evaluate(e).numberValue()):void 0;return new I(t.substring(r,n))},_.stringLength=function(){var e,t=arguments[0];if(1==arguments.length)e=T.prototype.stringForNode(t.contextNode);else{if(2!=arguments.length)throw new Error("Function string-length expects (string?)");e=arguments[1].evaluate(t).stringValue()}return new x(e.length)},_.normalizeSpace=function(){var e,t=arguments[0];if(1==arguments.length)e=T.prototype.stringForNode(t.contextNode);else{if(2!=arguments.length)throw new Error("Function normalize-space expects (string?)");e=arguments[1].evaluate(t).stringValue()}for(var r=0,n=e.length-1;F.isSpace(e.charCodeAt(n));)n--;for(var s="";r<=n&&F.isSpace(e.charCodeAt(r));)r++;for(;r<=n;)if(F.isSpace(e.charCodeAt(r)))for(s+=" ";r<=n&&F.isSpace(e.charCodeAt(r));)r++;else s+=e.charAt(r),r++;return new I(s)},_.translate=function(){var e=arguments[0];if(4!=arguments.length)throw new Error("Function translate expects (string, string, string)");for(var t=arguments[1].evaluate(e).stringValue(),r=arguments[2].evaluate(e).stringValue(),n=arguments[3].evaluate(e).stringValue(),s=[],i=0;i<r.length;i++){var a=r.charCodeAt(i);if(null==s[a]){var o=i>n.length?"":n.charAt(i);s[a]=o}}var u="";for(i=0;i<t.length;i++){var c=s[e=t.charCodeAt(i)];u+=null==c?t.charAt(i):c}return new I(u)},_.boolean_=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(e).bool()},_.not=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function not expects (object)");return arguments[1].evaluate(e).bool().not()},_.true_=function(){if(1!=arguments.length)throw new Error("Function true expects ()");return new B(!0)},_.false_=function(){if(1!=arguments.length)throw new Error("Function false expects ()");return new B(!1)},_.lang=function(){var e,t=arguments[0];if(2!=arguments.length)throw new Error("Function lang expects (string)");for(var r=t.contextNode;null!=r&&9!=r.nodeType;r=r.parentNode){var s=r.getAttributeNS(n.XML_NAMESPACE_URI,"lang");if(null!=s){e=String(s);break}}if(null==e)return new B(!1);var i=arguments[1].evaluate(t).stringValue();return new B(e.substring(0,i.length)==i&&(e.length==i.length||"-"==e.charAt(i.length)))},_.number=function(){var e=arguments[0];if(1!=arguments.length&&2!=arguments.length)throw new Error("Function number expects (object?)");return 1==arguments.length?new x(T.prototype.stringForNode(e.contextNode)):arguments[1].evaluate(e).number()},_.sum=function(){var e,t=arguments[0];if(2!=arguments.length||!F.instance_of(e=arguments[1].evaluate(t),T))throw new Error("Function sum expects (node-set)");e=e.toArray();for(var r=0,n=0;n<e.length;n++)r+=new x(T.prototype.stringForNode(e[n])).numberValue();return new x(r)},_.floor=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function floor expects (number)");return new x(Math.floor(arguments[1].evaluate(e).numberValue()))},_.ceiling=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function ceiling expects (number)");return new x(Math.ceil(arguments[1].evaluate(e).numberValue()))},_.round=function(){var e=arguments[0];if(2!=arguments.length)throw new Error("Function round expects (number)");return new x(Math.round(arguments[1].evaluate(e).numberValue()))};var H,M,F=new Object;function K(e,t){this.code=e,this.exception=t}function q(e,t,r){this.xpath=r.parse(e),this.context=new j,this.context.namespaceResolver=new J(t)}function J(e){this.xpathNSResolver=e}function G(e){this.node=e,this.namespaceResolver=new V}function X(e,t){switch(t==X.ANY_TYPE&&(e.constructor===I?t=X.STRING_TYPE:e.constructor===x?t=X.NUMBER_TYPE:e.constructor===B?t=X.BOOLEAN_TYPE:e.constructor===T&&(t=X.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=t,t){case X.NUMBER_TYPE:return void(this.numberValue=e.numberValue());case X.STRING_TYPE:return void(this.stringValue=e.stringValue());case X.BOOLEAN_TYPE:return void(this.booleanValue=e.booleanValue());case X.ANY_UNORDERED_NODE_TYPE:case X.FIRST_ORDERED_NODE_TYPE:if(e.constructor===T)return void(this.singleNodeValue=e.first());break;case X.UNORDERED_NODE_ITERATOR_TYPE:case X.ORDERED_NODE_ITERATOR_TYPE:if(e.constructor===T)return this.invalidIteratorState=!1,this.nodes=e.toArray(),void(this.iteratorIndex=0);break;case X.UNORDERED_NODE_SNAPSHOT_TYPE:case X.ORDERED_NODE_SNAPSHOT_TYPE:if(e.constructor===T)return this.nodes=e.toArray(),void(this.snapshotLength=this.nodes.length)}throw new K(K.TYPE_ERR)}F.splitQName=function(e){var t=e.indexOf(":");return-1==t?[null,e]:[e.substring(0,t),e.substring(t+1)]},F.resolveQName=function(e,t,r,n){var s=F.splitQName(e);return null!=s[0]?s[0]=t.getNamespace(s[0],r):n?(s[0]=t.getNamespace("",r),null==s[0]&&(s[0]="")):s[0]="",s},F.isSpace=function(e){return 9==e||13==e||10==e||32==e},F.isLetter=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=255||e>=256&&e<=305||e>=308&&e<=318||e>=321&&e<=328||e>=330&&e<=382||e>=384&&e<=451||e>=461&&e<=496||e>=500&&e<=501||e>=506&&e<=535||e>=592&&e<=680||e>=699&&e<=705||902==e||e>=904&&e<=906||908==e||e>=910&&e<=929||e>=931&&e<=974||e>=976&&e<=982||986==e||988==e||990==e||992==e||e>=994&&e<=1011||e>=1025&&e<=1036||e>=1038&&e<=1103||e>=1105&&e<=1116||e>=1118&&e<=1153||e>=1168&&e<=1220||e>=1223&&e<=1224||e>=1227&&e<=1228||e>=1232&&e<=1259||e>=1262&&e<=1269||e>=1272&&e<=1273||e>=1329&&e<=1366||1369==e||e>=1377&&e<=1414||e>=1488&&e<=1514||e>=1520&&e<=1522||e>=1569&&e<=1594||e>=1601&&e<=1610||e>=1649&&e<=1719||e>=1722&&e<=1726||e>=1728&&e<=1742||e>=1744&&e<=1747||1749==e||e>=1765&&e<=1766||e>=2309&&e<=2361||2365==e||e>=2392&&e<=2401||e>=2437&&e<=2444||e>=2447&&e<=2448||e>=2451&&e<=2472||e>=2474&&e<=2480||2482==e||e>=2486&&e<=2489||e>=2524&&e<=2525||e>=2527&&e<=2529||e>=2544&&e<=2545||e>=2565&&e<=2570||e>=2575&&e<=2576||e>=2579&&e<=2600||e>=2602&&e<=2608||e>=2610&&e<=2611||e>=2613&&e<=2614||e>=2616&&e<=2617||e>=2649&&e<=2652||2654==e||e>=2674&&e<=2676||e>=2693&&e<=2699||2701==e||e>=2703&&e<=2705||e>=2707&&e<=2728||e>=2730&&e<=2736||e>=2738&&e<=2739||e>=2741&&e<=2745||2749==e||2784==e||e>=2821&&e<=2828||e>=2831&&e<=2832||e>=2835&&e<=2856||e>=2858&&e<=2864||e>=2866&&e<=2867||e>=2870&&e<=2873||2877==e||e>=2908&&e<=2909||e>=2911&&e<=2913||e>=2949&&e<=2954||e>=2958&&e<=2960||e>=2962&&e<=2965||e>=2969&&e<=2970||2972==e||e>=2974&&e<=2975||e>=2979&&e<=2980||e>=2984&&e<=2986||e>=2990&&e<=2997||e>=2999&&e<=3001||e>=3077&&e<=3084||e>=3086&&e<=3088||e>=3090&&e<=3112||e>=3114&&e<=3123||e>=3125&&e<=3129||e>=3168&&e<=3169||e>=3205&&e<=3212||e>=3214&&e<=3216||e>=3218&&e<=3240||e>=3242&&e<=3251||e>=3253&&e<=3257||3294==e||e>=3296&&e<=3297||e>=3333&&e<=3340||e>=3342&&e<=3344||e>=3346&&e<=3368||e>=3370&&e<=3385||e>=3424&&e<=3425||e>=3585&&e<=3630||3632==e||e>=3634&&e<=3635||e>=3648&&e<=3653||e>=3713&&e<=3714||3716==e||e>=3719&&e<=3720||3722==e||3725==e||e>=3732&&e<=3735||e>=3737&&e<=3743||e>=3745&&e<=3747||3749==e||3751==e||e>=3754&&e<=3755||e>=3757&&e<=3758||3760==e||e>=3762&&e<=3763||3773==e||e>=3776&&e<=3780||e>=3904&&e<=3911||e>=3913&&e<=3945||e>=4256&&e<=4293||e>=4304&&e<=4342||4352==e||e>=4354&&e<=4355||e>=4357&&e<=4359||4361==e||e>=4363&&e<=4364||e>=4366&&e<=4370||4412==e||4414==e||4416==e||4428==e||4430==e||4432==e||e>=4436&&e<=4437||4441==e||e>=4447&&e<=4449||4451==e||4453==e||4455==e||4457==e||e>=4461&&e<=4462||e>=4466&&e<=4467||4469==e||4510==e||4520==e||4523==e||e>=4526&&e<=4527||e>=4535&&e<=4536||4538==e||e>=4540&&e<=4546||4587==e||4592==e||4601==e||e>=7680&&e<=7835||e>=7840&&e<=7929||e>=7936&&e<=7957||e>=7960&&e<=7965||e>=7968&&e<=8005||e>=8008&&e<=8013||e>=8016&&e<=8023||8025==e||8027==e||8029==e||e>=8031&&e<=8061||e>=8064&&e<=8116||e>=8118&&e<=8124||8126==e||e>=8130&&e<=8132||e>=8134&&e<=8140||e>=8144&&e<=8147||e>=8150&&e<=8155||e>=8160&&e<=8172||e>=8178&&e<=8180||e>=8182&&e<=8188||8486==e||e>=8490&&e<=8491||8494==e||e>=8576&&e<=8578||e>=12353&&e<=12436||e>=12449&&e<=12538||e>=12549&&e<=12588||e>=44032&&e<=55203||e>=19968&&e<=40869||12295==e||e>=12321&&e<=12329},F.isNCNameChar=function(e){return e>=48&&e<=57||e>=1632&&e<=1641||e>=1776&&e<=1785||e>=2406&&e<=2415||e>=2534&&e<=2543||e>=2662&&e<=2671||e>=2790&&e<=2799||e>=2918&&e<=2927||e>=3047&&e<=3055||e>=3174&&e<=3183||e>=3302&&e<=3311||e>=3430&&e<=3439||e>=3664&&e<=3673||e>=3792&&e<=3801||e>=3872&&e<=3881||46==e||45==e||95==e||F.isLetter(e)||e>=768&&e<=837||e>=864&&e<=865||e>=1155&&e<=1158||e>=1425&&e<=1441||e>=1443&&e<=1465||e>=1467&&e<=1469||1471==e||e>=1473&&e<=1474||1476==e||e>=1611&&e<=1618||1648==e||e>=1750&&e<=1756||e>=1757&&e<=1759||e>=1760&&e<=1764||e>=1767&&e<=1768||e>=1770&&e<=1773||e>=2305&&e<=2307||2364==e||e>=2366&&e<=2380||2381==e||e>=2385&&e<=2388||e>=2402&&e<=2403||e>=2433&&e<=2435||2492==e||2494==e||2495==e||e>=2496&&e<=2500||e>=2503&&e<=2504||e>=2507&&e<=2509||2519==e||e>=2530&&e<=2531||2562==e||2620==e||2622==e||2623==e||e>=2624&&e<=2626||e>=2631&&e<=2632||e>=2635&&e<=2637||e>=2672&&e<=2673||e>=2689&&e<=2691||2748==e||e>=2750&&e<=2757||e>=2759&&e<=2761||e>=2763&&e<=2765||e>=2817&&e<=2819||2876==e||e>=2878&&e<=2883||e>=2887&&e<=2888||e>=2891&&e<=2893||e>=2902&&e<=2903||e>=2946&&e<=2947||e>=3006&&e<=3010||e>=3014&&e<=3016||e>=3018&&e<=3021||3031==e||e>=3073&&e<=3075||e>=3134&&e<=3140||e>=3142&&e<=3144||e>=3146&&e<=3149||e>=3157&&e<=3158||e>=3202&&e<=3203||e>=3262&&e<=3268||e>=3270&&e<=3272||e>=3274&&e<=3277||e>=3285&&e<=3286||e>=3330&&e<=3331||e>=3390&&e<=3395||e>=3398&&e<=3400||e>=3402&&e<=3405||3415==e||3633==e||e>=3636&&e<=3642||e>=3655&&e<=3662||3761==e||e>=3764&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=3864&&e<=3865||3893==e||3895==e||3897==e||3902==e||3903==e||e>=3953&&e<=3972||e>=3974&&e<=3979||e>=3984&&e<=3989||3991==e||e>=3993&&e<=4013||e>=4017&&e<=4023||4025==e||e>=8400&&e<=8412||8417==e||e>=12330&&e<=12335||12441==e||12442==e||183==e||720==e||721==e||903==e||1600==e||3654==e||3782==e||12293==e||e>=12337&&e<=12341||e>=12445&&e<=12446||e>=12540&&e<=12542},F.coalesceText=function(e){for(var t=e.firstChild;null!=t;t=t.nextSibling)if(3==t.nodeType||4==t.nodeType){var r=t.nodeValue,n=t;for(t=t.nextSibling;null!=t&&(3==t.nodeType||4==t.nodeType);){r+=t.nodeValue;var s=t;t=t.nextSibling,s.parentNode.removeChild(s)}if(4==n.nodeType){var i=n.parentNode;if(null==n.nextSibling)i.removeChild(n),i.appendChild(i.ownerDocument.createTextNode(r));else{var a=n.nextSibling;i.removeChild(n),i.insertBefore(i.ownerDocument.createTextNode(r),a)}}else n.nodeValue=r;if(null==t)break}else 1==t.nodeType&&F.coalesceText(t)},F.instance_of=function(e,t){for(;null!=e;){if(e.constructor===t)return!0;if(e===Object)return!1;e=e.constructor.superclass}return!1},F.getElementById=function(e,t){if(1==e.nodeType&&(e.getAttribute("id")==t||e.getAttributeNS(null,"id")==t))return e;for(var r=e.firstChild;null!=r;r=r.nextSibling){var n=F.getElementById(r,t);if(null!=n)return n}return null},K.prototype={},K.prototype.constructor=K,K.superclass=Object.prototype,K.prototype.toString=function(){var e=this.exception?": "+this.exception.toString():"";switch(this.code){case K.INVALID_EXPRESSION_ERR:return"Invalid expression"+e;case K.TYPE_ERR:return"Type error"+e}},K.INVALID_EXPRESSION_ERR=51,K.TYPE_ERR=52,q.prototype={},q.prototype.constructor=q,q.superclass=Object.prototype,q.prototype.evaluate=function(e,t,r){return this.context.expressionContextNode=e,new X(this.xpath.evaluate(this.context),t)},J.prototype={},J.prototype.constructor=J,J.superclass=Object.prototype,J.prototype.getNamespace=function(e,t){return null==this.xpathNSResolver?null:this.xpathNSResolver.lookupNamespaceURI(e)},G.prototype={},G.prototype.constructor=G,G.superclass=Object.prototype,G.prototype.lookupNamespaceURI=function(e){return this.namespaceResolver.getNamespace(e,this.node)},X.prototype={},X.prototype.constructor=X,X.superclass=Object.prototype,X.prototype.iterateNext=function(){if(this.resultType!=X.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=X.ORDERED_NODE_ITERATOR_TYPE)throw new K(K.TYPE_ERR);return this.nodes[this.iteratorIndex++]},X.prototype.snapshotItem=function(e){if(this.resultType!=X.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=X.ORDERED_NODE_SNAPSHOT_TYPE)throw new K(K.TYPE_ERR);return this.nodes[e]},X.ANY_TYPE=0,X.NUMBER_TYPE=1,X.STRING_TYPE=2,X.BOOLEAN_TYPE=3,X.UNORDERED_NODE_ITERATOR_TYPE=4,X.ORDERED_NODE_ITERATOR_TYPE=5,X.UNORDERED_NODE_SNAPSHOT_TYPE=6,X.ORDERED_NODE_SNAPSHOT_TYPE=7,X.ANY_UNORDERED_NODE_TYPE=8,X.FIRST_ORDERED_NODE_TYPE=9;try{var W=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(W=!1)}catch(e){}W&&(H=document,M=new r,H.createExpression=function(e,t){try{return new q(e,t,M)}catch(e){throw new K(K.INVALID_EXPRESSION_ERR,e)}},H.createNSResolver=function(e){return new G(e)},H.evaluate=function(e,t,r,n,s){if(n<0||n>9)throw{code:0,toString:function(){return"Request type not supported"}};return H.createExpression(e,r,M).evaluate(t,n,s)})}catch(e){}e.exports=function(e,t){t=(new r).parse(t);var n=new j;return e.documentElement?n.expressionContextNode=e.documentElement:n.expressionContextNode=e,t.evaluate(n).toArray()}},function(e,t){var r,n,s=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&m())}function m(){if(!l){var e=o(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++h<t;)u&&u[h].run();h=-1,t=c.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function d(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||l||o(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=d,s.addListener=d,s.once=d,s.off=d,s.removeListener=d,s.removeAllListeners=d,s.emit=d,s.prependListener=d,s.prependOnceListener=d,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t,r){"use strict";r.r(t),r.d(t,"Parse",(function(){return n.d})),r.d(t,"Select",(function(){return n.e})),r.d(t,"Stringify",(function(){return n.g})),r.d(t,"Application",(function(){return xe})),r.d(t,"CanonicalizationMethod",(function(){return qt})),r.d(t,"CryptoConfig",(function(){return Tr})),r.d(t,"DataObject",(function(){return Jt})),r.d(t,"DataObjects",(function(){return Gt})),r.d(t,"DigestMethod",(function(){return Xt})),r.d(t,"DomainParameters",(function(){return pr})),r.d(t,"ECDSA",(function(){return Je})),r.d(t,"ECDSA_SHA1_NAMESPACE",(function(){return Ge})),r.d(t,"ECDSA_SHA256_NAMESPACE",(function(){return Xe})),r.d(t,"ECDSA_SHA384_NAMESPACE",(function(){return We})),r.d(t,"ECDSA_SHA512_NAMESPACE",(function(){return Ye})),r.d(t,"EcdsaKeyValue",(function(){return dr})),r.d(t,"EcdsaPublicKey",(function(){return fr})),r.d(t,"EcdsaSha1",(function(){return Qe})),r.d(t,"EcdsaSha256",(function(){return $e})),r.d(t,"EcdsaSha384",(function(){return ze})),r.d(t,"EcdsaSha512",(function(){return Ze})),r.d(t,"HMAC",(function(){return et})),r.d(t,"HMAC_SHA1_NAMESPACE",(function(){return tt})),r.d(t,"HMAC_SHA256_NAMESPACE",(function(){return rt})),r.d(t,"HMAC_SHA384_NAMESPACE",(function(){return nt})),r.d(t,"HMAC_SHA512_NAMESPACE",(function(){return st})),r.d(t,"HmacSha1",(function(){return it})),r.d(t,"HmacSha256",(function(){return at})),r.d(t,"HmacSha384",(function(){return ot})),r.d(t,"HmacSha512",(function(){return ut})),r.d(t,"KeyInfo",(function(){return Wt})),r.d(t,"KeyInfoClause",(function(){return Kt})),r.d(t,"KeyInfoX509Data",(function(){return Ir})),r.d(t,"KeyValue",(function(){return Sr})),r.d(t,"MaskGenerationFunction",(function(){return Nr})),r.d(t,"NamedCurve",(function(){return mr})),r.d(t,"PssAlgorithmParams",(function(){return Ar})),r.d(t,"RSA_PKCS1",(function(){return ct})),r.d(t,"RSA_PKCS1_SHA1_NAMESPACE",(function(){return lt})),r.d(t,"RSA_PKCS1_SHA256_NAMESPACE",(function(){return ht})),r.d(t,"RSA_PKCS1_SHA384_NAMESPACE",(function(){return ft})),r.d(t,"RSA_PKCS1_SHA512_NAMESPACE",(function(){return mt})),r.d(t,"RSA_PSS",(function(){return yt})),r.d(t,"RSA_PSS_SHA1_NAMESPACE",(function(){return Ct})),r.d(t,"RSA_PSS_SHA256_NAMESPACE",(function(){return kt})),r.d(t,"RSA_PSS_SHA384_NAMESPACE",(function(){return Ot})),r.d(t,"RSA_PSS_SHA512_NAMESPACE",(function(){return It})),r.d(t,"RSA_PSS_WITH_PARAMS_NAMESPACE",(function(){return wt})),r.d(t,"Reference",(function(){return ir})),r.d(t,"References",(function(){return ar})),r.d(t,"RsaKeyValue",(function(){return wr})),r.d(t,"RsaPkcs1Sha1",(function(){return pt})),r.d(t,"RsaPkcs1Sha256",(function(){return dt})),r.d(t,"RsaPkcs1Sha384",(function(){return gt})),r.d(t,"RsaPkcs1Sha512",(function(){return bt})),r.d(t,"RsaPssBase",(function(){return vt})),r.d(t,"RsaPssSha1",(function(){return Nt})),r.d(t,"RsaPssSha256",(function(){return At})),r.d(t,"RsaPssSha384",(function(){return St})),r.d(t,"RsaPssSha512",(function(){return Et})),r.d(t,"RsaPssWithoutParamsBase",(function(){return xt})),r.d(t,"RsaPssWithoutParamsSha1",(function(){return Bt})),r.d(t,"RsaPssWithoutParamsSha256",(function(){return Dt})),r.d(t,"RsaPssWithoutParamsSha384",(function(){return Tt})),r.d(t,"RsaPssWithoutParamsSha512",(function(){return Pt})),r.d(t,"SHA1",(function(){return Pe})),r.d(t,"SHA1_NAMESPACE",(function(){return Ue})),r.d(t,"SHA256",(function(){return Re})),r.d(t,"SHA256_NAMESPACE",(function(){return Ve})),r.d(t,"SHA384",(function(){return je})),r.d(t,"SHA384_NAMESPACE",(function(){return _e})),r.d(t,"SHA512",(function(){return Le})),r.d(t,"SHA512_NAMESPACE",(function(){return He})),r.d(t,"SPKIData",(function(){return xr})),r.d(t,"SelectRootNamespaces",(function(){return Lr})),r.d(t,"Sha1",(function(){return Me})),r.d(t,"Sha256",(function(){return Fe})),r.d(t,"Sha384",(function(){return Ke})),r.d(t,"Sha512",(function(){return qe})),r.d(t,"Signature",(function(){return lr})),r.d(t,"SignatureMethod",(function(){return ur})),r.d(t,"SignatureMethodOther",(function(){return or})),r.d(t,"SignedInfo",(function(){return cr})),r.d(t,"SignedXml",(function(){return Pr})),r.d(t,"Transform",(function(){return Yt})),r.d(t,"Transforms",(function(){return nr})),r.d(t,"X509Certificate",(function(){return Cr})),r.d(t,"X509IncludeOption",(function(){return Or})),r.d(t,"X509IssuerSerial",(function(){return kr})),r.d(t,"XmlCanonicalizer",(function(){return jt})),r.d(t,"XmlCanonicalizerState",(function(){return Rt})),r.d(t,"XmlDsigBase64Transform",(function(){return Qt})),r.d(t,"XmlDsigC14NTransform",(function(){return $t})),r.d(t,"XmlDsigC14NWithCommentsTransform",(function(){return zt})),r.d(t,"XmlDsigEnvelopedSignatureTransform",(function(){return Zt})),r.d(t,"XmlDsigExcC14NTransform",(function(){return er})),r.d(t,"XmlDsigExcC14NWithCommentsTransform",(function(){return tr})),r.d(t,"XmlDsigXPathTransform",(function(){return rr})),r.d(t,"XmlSignature",(function(){return Ht})),r.d(t,"XmlSignatureCollection",(function(){return Ft})),r.d(t,"XmlSignatureObject",(function(){return Mt}));var n=r(2),s=r(4),i=r(0),a=r(1);class o{constructor(e={}){this.type=Object(a.f)(e,"type",o.defaultValues("type")),this.value=Object(a.f)(e,"value",o.defaultValues("value")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return"";case"value":return{};default:throw new Error("Invalid member name for AttributeTypeAndValue class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.type||""}),new i.a({name:t.value||""})]})}static blockName(){return"AttributeTypeAndValue"}fromSchema(e){Object(a.d)(e,["type","typeValue"]);const t=i.D(e,e,o.schema({names:{type:"type",value:"typeValue"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AttributeTypeAndValue");this.type=t.result.type.valueBlock.toString(),this.value=t.result.typeValue}toSchema(){return new i.v({value:[new i.p({value:this.type}),this.value]})}toJSON(){const e={type:this.type};return 0!==Object.keys(this.value).length?e.value=this.value.toJSON():e.value=this.value,e}isEqual(e){const t=[i.A.blockName(),i.c.blockName(),i.z.blockName(),i.o.blockName(),i.s.blockName(),i.x.blockName(),i.B.blockName(),i.l.blockName(),i.k.blockName(),i.C.blockName(),i.i.blockName(),i.e.blockName()];if(e.constructor.blockName()===o.blockName()){if(this.type!==e.type)return!1;let r=[!1,!1];const n=this.value.constructor.blockName();for(const s of t)n===s&&(r[0]=!0),e.value.constructor.blockName()===s&&(r[1]=!0);if(r[0]^r[1])return!1;if(r=r[0]&&r[1],r){const t=Object(s.j)(this.value.valueBlock.value),r=Object(s.j)(e.value.valueBlock.value);if(0!==t.localeCompare(r))return!1}else if(!1===Object(a.g)(this.value.valueBeforeDecode,e.value.valueBeforeDecode))return!1;return!0}return e instanceof ArrayBuffer&&Object(a.g)(this.value.valueBeforeDecode,e)}}class u{constructor(e={}){this.typesAndValues=Object(a.f)(e,"typesAndValues",u.defaultValues("typesAndValues")),this.valueBeforeDecode=Object(a.f)(e,"valueBeforeDecode",u.defaultValues("valueBeforeDecode")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"typesAndValues":return[];case"valueBeforeDecode":return new ArrayBuffer(0);default:throw new Error("Invalid member name for RelativeDistinguishedNames class: "+e)}}static compareWithDefault(e,t){switch(e){case"typesAndValues":return 0===t.length;case"valueBeforeDecode":return 0===t.byteLength;default:throw new Error("Invalid member name for RelativeDistinguishedNames class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.repeatedSequence||"",value:new i.w({value:[new i.u({name:t.repeatedSet||"",value:o.schema(t.typeAndValue||{})})]})})]})}fromSchema(e){Object(a.d)(e,["RDN","typesAndValues"]);const t=i.D(e,e,u.schema({names:{blockName:"RDN",repeatedSet:"typesAndValues"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RelativeDistinguishedNames");"typesAndValues"in t.result&&(this.typesAndValues=Array.from(t.result.typesAndValues,e=>new o({schema:e}))),this.valueBeforeDecode=t.result.RDN.valueBeforeDecode}toSchema(){if(0===this.valueBeforeDecode.byteLength)return new i.v({value:[new i.w({value:Array.from(this.typesAndValues,e=>e.toSchema())})]});return i.E(this.valueBeforeDecode).result}toJSON(){return{typesAndValues:Array.from(this.typesAndValues,e=>e.toJSON())}}isEqual(e){if(e instanceof u){if(this.typesAndValues.length!==e.typesAndValues.length)return!1;for(const[t,r]of this.typesAndValues.entries())if(!1===r.isEqual(e.typesAndValues[t]))return!1;return!0}return e instanceof ArrayBuffer&&Object(a.g)(this.valueBeforeDecode,e)}}function c(e={},t=!1){const r=Object(a.f)(e,"names",{});return new i.v({optional:t,value:[new i.g({optional:!0,idBlock:{tagClass:2,tagNumber:1},name:r.country_name||"",value:[new i.f({value:[new i.o,new i.s]})]}),new i.g({optional:!0,idBlock:{tagClass:2,tagNumber:2},name:r.administration_domain_name||"",value:[new i.f({value:[new i.o,new i.s]})]}),new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:0},name:r.network_address||"",isHexOnly:!0}),new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:1},name:r.terminal_identifier||"",isHexOnly:!0}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:2},name:r.private_domain_name||"",value:[new i.f({value:[new i.o,new i.s]})]}),new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:3},name:r.organization_name||"",isHexOnly:!0}),new i.r({optional:!0,name:r.numeric_user_identifier||"",idBlock:{tagClass:3,tagNumber:4},isHexOnly:!0}),new i.g({optional:!0,name:r.personal_name||"",idBlock:{tagClass:3,tagNumber:5},value:[new i.r({idBlock:{tagClass:3,tagNumber:0},isHexOnly:!0}),new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:1},isHexOnly:!0}),new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:2},isHexOnly:!0}),new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:3},isHexOnly:!0})]}),new i.g({optional:!0,name:r.organizational_unit_names||"",idBlock:{tagClass:3,tagNumber:6},value:[new i.u({value:new i.s})]})]})}function l(e=!1){return new i.v({optional:e,value:[new i.s,new i.s]})}function h(e=!1){return new i.w({optional:e,value:[new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:0},isHexOnly:!0}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new i.a]})]})}class f{constructor(e={}){this.type=Object(a.f)(e,"type",f.defaultValues("type")),this.value=Object(a.f)(e,"value",f.defaultValues("value")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return 9;case"value":return{};default:throw new Error("Invalid member name for GeneralName class: "+e)}}static compareWithDefault(e,t){switch(e){case"type":return t===f.defaultValues(e);case"value":return 0===Object.keys(t).length;default:throw new Error("Invalid member name for GeneralName class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.f({value:[new i.g({idBlock:{tagClass:3,tagNumber:0},name:t.blockName||"",value:[new i.p,new i.g({idBlock:{tagClass:3,tagNumber:0},value:[new i.a]})]}),new i.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:1}}),new i.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:2}}),new i.g({idBlock:{tagClass:3,tagNumber:3},name:t.blockName||"",value:[c(t.builtInStandardAttributes||{},!1),l(!0),h(!0)]}),new i.g({idBlock:{tagClass:3,tagNumber:4},name:t.blockName||"",value:[u.schema(t.directoryName||{})]}),new i.g({idBlock:{tagClass:3,tagNumber:5},name:t.blockName||"",value:[new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.f({value:[new i.x,new i.s,new i.z,new i.A,new i.c]})]}),new i.g({idBlock:{tagClass:3,tagNumber:1},value:[new i.f({value:[new i.x,new i.s,new i.z,new i.A,new i.c]})]})]}),new i.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:6}}),new i.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:7}}),new i.r({name:t.blockName||"",idBlock:{tagClass:3,tagNumber:8}})]})}fromSchema(e){Object(a.d)(e,["blockName","otherName","rfc822Name","dNSName","x400Address","directoryName","ediPartyName","uniformResourceIdentifier","iPAddress","registeredID"]);const t=i.D(e,e,f.schema({names:{blockName:"blockName",otherName:"otherName",rfc822Name:"rfc822Name",dNSName:"dNSName",x400Address:"x400Address",directoryName:{names:{blockName:"directoryName"}},ediPartyName:"ediPartyName",uniformResourceIdentifier:"uniformResourceIdentifier",iPAddress:"iPAddress",registeredID:"registeredID"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for GeneralName");switch(this.type=t.result.blockName.idBlock.tagNumber,this.type){case 0:this.value=t.result.blockName;break;case 1:case 2:case 6:{const e=t.result.blockName;e.idBlock.tagClass=1,e.idBlock.tagNumber=22;const r=e.toBER(!1);this.value=i.E(r).result.valueBlock.value}break;case 3:this.value=t.result.blockName;break;case 4:this.value=new u({schema:t.result.directoryName});break;case 5:this.value=t.result.ediPartyName;break;case 7:this.value=new i.q({valueHex:t.result.blockName.valueBlock.valueHex});break;case 8:{const e=t.result.blockName;e.idBlock.tagClass=1,e.idBlock.tagNumber=6;const r=e.toBER(!1);this.value=i.E(r).result.valueBlock.toString()}}}toSchema(){switch(this.type){case 0:case 3:case 5:return new i.g({idBlock:{tagClass:3,tagNumber:this.type},value:[this.value]});case 1:case 2:case 6:{const e=new i.l({value:this.value});return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}case 4:return new i.g({idBlock:{tagClass:3,tagNumber:4},value:[this.value.toSchema()]});case 7:{const e=this.value;return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}case 8:{const e=new i.p({value:this.value});return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}default:return f.schema()}}toJSON(){const e={type:this.type,value:""};if("string"==typeof this.value)e.value=this.value;else try{e.value=this.value.toJSON()}catch(e){}return e}}class m{constructor(e={}){this.accessMethod=Object(a.f)(e,"accessMethod",m.defaultValues("accessMethod")),this.accessLocation=Object(a.f)(e,"accessLocation",m.defaultValues("accessLocation")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"accessMethod":return"";case"accessLocation":return new f;default:throw new Error("Invalid member name for AccessDescription class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.accessMethod||""}),f.schema(t.accessLocation||{})]})}fromSchema(e){Object(a.d)(e,["accessMethod","accessLocation"]);const t=i.D(e,e,m.schema({names:{accessMethod:"accessMethod",accessLocation:{names:{blockName:"accessLocation"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AccessDescription");this.accessMethod=t.result.accessMethod.valueBlock.toString(),this.accessLocation=new f({schema:t.result.accessLocation})}toSchema(){return new i.v({value:[new i.p({value:this.accessMethod}),this.accessLocation.toSchema()]})}toJSON(){return{accessMethod:this.accessMethod,accessLocation:this.accessLocation.toJSON()}}}class p{constructor(e={}){"seconds"in e&&(this.seconds=Object(a.f)(e,"seconds",p.defaultValues("seconds"))),"millis"in e&&(this.millis=Object(a.f)(e,"millis",p.defaultValues("millis"))),"micros"in e&&(this.micros=Object(a.f)(e,"micros",p.defaultValues("micros"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"seconds":case"millis":case"micros":return 0;default:throw new Error("Invalid member name for Accuracy class: "+e)}}static compareWithDefault(e,t){switch(e){case"seconds":case"millis":case"micros":return t===p.defaultValues(e);default:throw new Error("Invalid member name for Accuracy class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",optional:!0,value:[new i.m({optional:!0,name:t.seconds||""}),new i.r({name:t.millis||"",optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new i.r({name:t.micros||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Object(a.d)(e,["seconds","millis","micros"]);const t=i.D(e,e,p.schema({names:{seconds:"seconds",millis:"millis",micros:"micros"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Accuracy");if("seconds"in t.result&&(this.seconds=t.result.seconds.valueBlock.valueDec),"millis"in t.result){const e=new i.m({valueHex:t.result.millis.valueBlock.valueHex});this.millis=e.valueBlock.valueDec}if("micros"in t.result){const e=new i.m({valueHex:t.result.micros.valueBlock.valueHex});this.micros=e.valueBlock.valueDec}}toSchema(){const e=[];if("seconds"in this&&e.push(new i.m({value:this.seconds})),"millis"in this){const t=new i.m({value:this.millis});e.push(new i.r({idBlock:{tagClass:3,tagNumber:0},valueHex:t.valueBlock.valueHex}))}if("micros"in this){const t=new i.m({value:this.micros});e.push(new i.r({idBlock:{tagClass:3,tagNumber:1},valueHex:t.valueBlock.valueHex}))}return new i.v({value:e})}toJSON(){const e={};return"seconds"in this&&(e.seconds=this.seconds),"millis"in this&&(e.millis=this.millis),"micros"in this&&(e.micros=this.micros),e}}var d=r(3);class g{constructor(e={}){this.altNames=Object(a.f)(e,"altNames",g.defaultValues("altNames")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"altNames":return[];default:throw new Error("Invalid member name for AltName class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.altNames||"",value:f.schema()})]})}fromSchema(e){Object(a.d)(e,["altNames"]);const t=i.D(e,e,g.schema({names:{altNames:"altNames"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AltName");"altNames"in t.result&&(this.altNames=Array.from(t.result.altNames,e=>new f({schema:e})))}toSchema(){return new i.v({value:Array.from(this.altNames,e=>e.toSchema())})}toJSON(){return{altNames:Array.from(this.altNames,e=>e.toJSON())}}}var b=r(5);var y=r(9);r(6);class w{constructor(e={}){this.type=Object(a.f)(e,"type",w.defaultValues("type")),this.value=Object(a.f)(e,"value",w.defaultValues("value")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return 0;case"value":return new Date(0,0,0);default:throw new Error("Invalid member name for Time class: "+e)}}static schema(e={},t=!1){const r=Object(a.f)(e,"names",{});return new i.f({optional:t,value:[new i.y({name:r.utcTimeName||""}),new i.j({name:r.generalTimeName||""})]})}fromSchema(e){Object(a.d)(e,["utcTimeName","generalTimeName"]);const t=i.D(e,e,w.schema({names:{utcTimeName:"utcTimeName",generalTimeName:"generalTimeName"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Time");"utcTimeName"in t.result&&(this.type=0,this.value=t.result.utcTimeName.toDate()),"generalTimeName"in t.result&&(this.type=1,this.value=t.result.generalTimeName.toDate())}toSchema(){let e={};return 0===this.type&&(e=new i.y({valueDate:this.value})),1===this.type&&(e=new i.j({valueDate:this.value})),e}toJSON(){return{type:this.type,value:this.value}}}var v=r(7);class N{constructor(e={}){this.attributes=Object(a.f)(e,"attributes",N.defaultValues("attributes")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"attributes":return[];default:throw new Error("Invalid member name for SubjectDirectoryAttributes class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.attributes||"",value:b.a.schema()})]})}fromSchema(e){Object(a.d)(e,["attributes"]);const t=i.D(e,e,N.schema({names:{attributes:"attributes"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for SubjectDirectoryAttributes");this.attributes=Array.from(t.result.attributes,e=>new b.a({schema:e}))}toSchema(){return new i.v({value:Array.from(this.attributes,e=>e.toSchema())})}toJSON(){return{attributes:Array.from(this.attributes,e=>e.toJSON())}}}class A{constructor(e={}){"notBefore"in e&&(this.notBefore=Object(a.f)(e,"notBefore",A.defaultValues("notBefore"))),"notAfter"in e&&(this.notAfter=Object(a.f)(e,"notAfter",A.defaultValues("notAfter"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"notBefore":case"notAfter":return new Date;default:throw new Error("Invalid member name for PrivateKeyUsagePeriod class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.r({name:t.notBefore||"",optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new i.r({name:t.notAfter||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Object(a.d)(e,["notBefore","notAfter"]);const t=i.D(e,e,A.schema({names:{notBefore:"notBefore",notAfter:"notAfter"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PrivateKeyUsagePeriod");if("notBefore"in t.result){const e=new i.j;e.fromBuffer(t.result.notBefore.valueBlock.valueHex),this.notBefore=e.toDate()}if("notAfter"in t.result){const e=new i.j({valueHex:t.result.notAfter.valueBlock.valueHex});e.fromBuffer(t.result.notAfter.valueBlock.valueHex),this.notAfter=e.toDate()}}toSchema(){const e=[];return"notBefore"in this&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:0},valueHex:new i.j({valueDate:this.notBefore}).valueBlock.valueHex})),"notAfter"in this&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:1},valueHex:new i.j({valueDate:this.notAfter}).valueBlock.valueHex})),new i.v({value:e})}toJSON(){const e={};return"notBefore"in this&&(e.notBefore=this.notBefore),"notAfter"in this&&(e.notAfter=this.notAfter),e}}class S{constructor(e={}){this.cA=Object(a.f)(e,"cA",!1),"pathLenConstraint"in e&&(this.pathLenConstraint=Object(a.f)(e,"pathLenConstraint",0)),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"cA":return!1;default:throw new Error("Invalid member name for BasicConstraints class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.d({optional:!0,name:t.cA||""}),new i.m({optional:!0,name:t.pathLenConstraint||""})]})}fromSchema(e){Object(a.d)(e,["cA","pathLenConstraint"]);const t=i.D(e,e,S.schema({names:{cA:"cA",pathLenConstraint:"pathLenConstraint"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for BasicConstraints");"cA"in t.result&&(this.cA=t.result.cA.valueBlock.value),"pathLenConstraint"in t.result&&(t.result.pathLenConstraint.valueBlock.isHexOnly?this.pathLenConstraint=t.result.pathLenConstraint:this.pathLenConstraint=t.result.pathLenConstraint.valueBlock.valueDec)}toSchema(){const e=[];return this.cA!==S.defaultValues("cA")&&e.push(new i.d({value:this.cA})),"pathLenConstraint"in this&&(this.pathLenConstraint instanceof i.m?e.push(this.pathLenConstraint):e.push(new i.m({value:this.pathLenConstraint}))),new i.v({value:e})}toJSON(){const e={};return this.cA!==S.defaultValues("cA")&&(e.cA=this.cA),"pathLenConstraint"in this&&(this.pathLenConstraint instanceof i.m?e.pathLenConstraint=this.pathLenConstraint.toJSON():e.pathLenConstraint=this.pathLenConstraint),e}}class E{constructor(e={}){"distributionPoint"in e&&(this.distributionPoint=Object(a.f)(e,"distributionPoint",E.defaultValues("distributionPoint"))),this.onlyContainsUserCerts=Object(a.f)(e,"onlyContainsUserCerts",E.defaultValues("onlyContainsUserCerts")),this.onlyContainsCACerts=Object(a.f)(e,"onlyContainsCACerts",E.defaultValues("onlyContainsCACerts")),"onlySomeReasons"in e&&(this.onlySomeReasons=Object(a.f)(e,"onlySomeReasons",E.defaultValues("onlySomeReasons"))),this.indirectCRL=Object(a.f)(e,"indirectCRL",E.defaultValues("indirectCRL")),this.onlyContainsAttributeCerts=Object(a.f)(e,"onlyContainsAttributeCerts",E.defaultValues("onlyContainsAttributeCerts")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"distributionPoint":return[];case"onlyContainsUserCerts":case"onlyContainsCACerts":return!1;case"onlySomeReasons":return 0;case"indirectCRL":case"onlyContainsAttributeCerts":return!1;default:throw new Error("Invalid member name for IssuingDistributionPoint class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.f({value:[new i.g({name:t.distributionPoint||"",idBlock:{tagClass:3,tagNumber:0},value:[new i.u({name:t.distributionPointNames||"",value:f.schema()})]}),new i.g({name:t.distributionPoint||"",idBlock:{tagClass:3,tagNumber:1},value:u.schema().valueBlock.value})]})]}),new i.r({name:t.onlyContainsUserCerts||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new i.r({name:t.onlyContainsCACerts||"",optional:!0,idBlock:{tagClass:3,tagNumber:2}}),new i.r({name:t.onlySomeReasons||"",optional:!0,idBlock:{tagClass:3,tagNumber:3}}),new i.r({name:t.indirectCRL||"",optional:!0,idBlock:{tagClass:3,tagNumber:4}}),new i.r({name:t.onlyContainsAttributeCerts||"",optional:!0,idBlock:{tagClass:3,tagNumber:5}})]})}fromSchema(e){Object(a.d)(e,["distributionPoint","distributionPointNames","onlyContainsUserCerts","onlyContainsCACerts","onlySomeReasons","indirectCRL","onlyContainsAttributeCerts"]);const t=i.D(e,e,E.schema({names:{distributionPoint:"distributionPoint",distributionPointNames:"distributionPointNames",onlyContainsUserCerts:"onlyContainsUserCerts",onlyContainsCACerts:"onlyContainsCACerts",onlySomeReasons:"onlySomeReasons",indirectCRL:"indirectCRL",onlyContainsAttributeCerts:"onlyContainsAttributeCerts"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for IssuingDistributionPoint");if("distributionPoint"in t.result)switch(!0){case 0===t.result.distributionPoint.idBlock.tagNumber:this.distributionPoint=Array.from(t.result.distributionPointNames,e=>new f({schema:e}));break;case 1===t.result.distributionPoint.idBlock.tagNumber:this.distributionPoint=new u({schema:new i.v({value:t.result.distributionPoint.valueBlock.value})});break;default:throw new Error("Unknown tagNumber for distributionPoint: {$asn1.result.distributionPoint.idBlock.tagNumber}")}if("onlyContainsUserCerts"in t.result){const e=new Uint8Array(t.result.onlyContainsUserCerts.valueBlock.valueHex);this.onlyContainsUserCerts=0!==e[0]}if("onlyContainsCACerts"in t.result){const e=new Uint8Array(t.result.onlyContainsCACerts.valueBlock.valueHex);this.onlyContainsCACerts=0!==e[0]}if("onlySomeReasons"in t.result){const e=new Uint8Array(t.result.onlySomeReasons.valueBlock.valueHex);this.onlySomeReasons=e[0]}if("indirectCRL"in t.result){const e=new Uint8Array(t.result.indirectCRL.valueBlock.valueHex);this.indirectCRL=0!==e[0]}if("onlyContainsAttributeCerts"in t.result){const e=new Uint8Array(t.result.onlyContainsAttributeCerts.valueBlock.valueHex);this.onlyContainsAttributeCerts=0!==e[0]}}toSchema(){const e=[];if("distributionPoint"in this){let t;this.distributionPoint instanceof Array?t=new i.g({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.distributionPoint,e=>e.toSchema())}):(t=this.distributionPoint.toSchema(),t.idBlock.tagClass=3,t.idBlock.tagNumber=1),e.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:[t]}))}if(this.onlyContainsUserCerts!==E.defaultValues("onlyContainsUserCerts")&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:1},valueHex:new Uint8Array([255]).buffer})),this.onlyContainsCACerts!==E.defaultValues("onlyContainsCACerts")&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:2},valueHex:new Uint8Array([255]).buffer})),"onlySomeReasons"in this){const t=new ArrayBuffer(1);new Uint8Array(t)[0]=this.onlySomeReasons,e.push(new i.r({idBlock:{tagClass:3,tagNumber:3},valueHex:t}))}return this.indirectCRL!==E.defaultValues("indirectCRL")&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:4},valueHex:new Uint8Array([255]).buffer})),this.onlyContainsAttributeCerts!==E.defaultValues("onlyContainsAttributeCerts")&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:5},valueHex:new Uint8Array([255]).buffer})),new i.v({value:e})}toJSON(){const e={};return"distributionPoint"in this&&(this.distributionPoint instanceof Array?e.distributionPoint=Array.from(this.distributionPoint,e=>e.toJSON()):e.distributionPoint=this.distributionPoint.toJSON()),this.onlyContainsUserCerts!==E.defaultValues("onlyContainsUserCerts")&&(e.onlyContainsUserCerts=this.onlyContainsUserCerts),this.onlyContainsCACerts!==E.defaultValues("onlyContainsCACerts")&&(e.onlyContainsCACerts=this.onlyContainsCACerts),"onlySomeReasons"in this&&(e.onlySomeReasons=this.onlySomeReasons),this.indirectCRL!==E.defaultValues("indirectCRL")&&(e.indirectCRL=this.indirectCRL),this.onlyContainsAttributeCerts!==E.defaultValues("onlyContainsAttributeCerts")&&(e.onlyContainsAttributeCerts=this.onlyContainsAttributeCerts),e}}class C{constructor(e={}){this.names=Object(a.f)(e,"names",C.defaultValues("names")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"names":return[];default:throw new Error("Invalid member name for GeneralNames class: "+e)}}static schema(e={},t=!1){const r=Object(a.f)(e,"names",{});return new i.v({optional:t,name:r.blockName||"",value:[new i.u({name:r.generalNames||"",value:f.schema()})]})}fromSchema(e){Object(a.d)(e,["names","generalNames"]);const t=i.D(e,e,C.schema({names:{blockName:"names",generalNames:"generalNames"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for GeneralNames");this.names=Array.from(t.result.generalNames,e=>new f({schema:e}))}toSchema(){return new i.v({value:Array.from(this.names,e=>e.toSchema())})}toJSON(){return{names:Array.from(this.names,e=>e.toJSON())}}}class k{constructor(e={}){this.base=Object(a.f)(e,"base",k.defaultValues("base")),this.minimum=Object(a.f)(e,"minimum",k.defaultValues("minimum")),"maximum"in e&&(this.maximum=Object(a.f)(e,"maximum",k.defaultValues("maximum"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"base":return new f;case"minimum":case"maximum":return 0;default:throw new Error("Invalid member name for GeneralSubtree class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[f.schema(t.base||{}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.m({name:t.minimum||""})]}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new i.m({name:t.maximum||""})]})]})}fromSchema(e){Object(a.d)(e,["base","minimum","maximum"]);const t=i.D(e,e,k.schema({names:{base:{names:{blockName:"base"}},minimum:"minimum",maximum:"maximum"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for GeneralSubtree");this.base=new f({schema:t.result.base}),"minimum"in t.result&&(t.result.minimum.valueBlock.isHexOnly?this.minimum=t.result.minimum:this.minimum=t.result.minimum.valueBlock.valueDec),"maximum"in t.result&&(t.result.maximum.valueBlock.isHexOnly?this.maximum=t.result.maximum:this.maximum=t.result.maximum.valueBlock.valueDec)}toSchema(){const e=[];if(e.push(this.base.toSchema()),0!==this.minimum){let t=0;t=this.minimum instanceof i.m?this.minimum:new i.m({value:this.minimum}),e.push(new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[t]}))}if("maximum"in this){let t=0;t=this.maximum instanceof i.m?this.maximum:new i.m({value:this.maximum}),e.push(new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[t]}))}return new i.v({value:e})}toJSON(){const e={base:this.base.toJSON()};return 0!==this.minimum&&("number"==typeof this.minimum?e.minimum=this.minimum:e.minimum=this.minimum.toJSON()),"maximum"in this&&("number"==typeof this.maximum?e.maximum=this.maximum:e.maximum=this.maximum.toJSON()),e}}class O{constructor(e={}){"permittedSubtrees"in e&&(this.permittedSubtrees=Object(a.f)(e,"permittedSubtrees",O.defaultValues("permittedSubtrees"))),"excludedSubtrees"in e&&(this.excludedSubtrees=Object(a.f)(e,"excludedSubtrees",O.defaultValues("excludedSubtrees"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"permittedSubtrees":case"excludedSubtrees":return[];default:throw new Error("Invalid member name for NameConstraints class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.u({name:t.permittedSubtrees||"",value:k.schema()})]}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new i.u({name:t.excludedSubtrees||"",value:k.schema()})]})]})}fromSchema(e){Object(a.d)(e,["permittedSubtrees","excludedSubtrees"]);const t=i.D(e,e,O.schema({names:{permittedSubtrees:"permittedSubtrees",excludedSubtrees:"excludedSubtrees"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for NameConstraints");"permittedSubtrees"in t.result&&(this.permittedSubtrees=Array.from(t.result.permittedSubtrees,e=>new k({schema:e}))),"excludedSubtrees"in t.result&&(this.excludedSubtrees=Array.from(t.result.excludedSubtrees,e=>new k({schema:e})))}toSchema(){const e=[];return"permittedSubtrees"in this&&e.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.permittedSubtrees,e=>e.toSchema())})),"excludedSubtrees"in this&&e.push(new i.g({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.excludedSubtrees,e=>e.toSchema())})),new i.v({value:e})}toJSON(){const e={};return"permittedSubtrees"in this&&(e.permittedSubtrees=Array.from(this.permittedSubtrees,e=>e.toJSON())),"excludedSubtrees"in this&&(e.excludedSubtrees=Array.from(this.excludedSubtrees,e=>e.toJSON())),e}}class I{constructor(e={}){"distributionPoint"in e&&(this.distributionPoint=Object(a.f)(e,"distributionPoint",I.defaultValues("distributionPoint"))),"reasons"in e&&(this.reasons=Object(a.f)(e,"reasons",I.defaultValues("reasons"))),"cRLIssuer"in e&&(this.cRLIssuer=Object(a.f)(e,"cRLIssuer",I.defaultValues("cRLIssuer"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"distributionPoint":return[];case"reasons":return new i.b;case"cRLIssuer":return[];default:throw new Error("Invalid member name for DistributionPoint class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.f({value:[new i.g({name:t.distributionPoint||"",optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.u({name:t.distributionPointNames||"",value:f.schema()})]}),new i.g({name:t.distributionPoint||"",optional:!0,idBlock:{tagClass:3,tagNumber:1},value:u.schema().valueBlock.value})]})]}),new i.r({name:t.reasons||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new i.g({name:t.cRLIssuer||"",optional:!0,idBlock:{tagClass:3,tagNumber:2},value:[new i.u({name:t.cRLIssuerNames||"",value:f.schema()})]})]})}fromSchema(e){Object(a.d)(e,["distributionPoint","distributionPointNames","reasons","cRLIssuer","cRLIssuerNames"]);const t=i.D(e,e,I.schema({names:{distributionPoint:"distributionPoint",distributionPointNames:"distributionPointNames",reasons:"reasons",cRLIssuer:"cRLIssuer",cRLIssuerNames:"cRLIssuerNames"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for DistributionPoint");"distributionPoint"in t.result&&(0===t.result.distributionPoint.idBlock.tagNumber&&(this.distributionPoint=Array.from(t.result.distributionPointNames,e=>new f({schema:e}))),1===t.result.distributionPoint.idBlock.tagNumber&&(this.distributionPoint=new u({schema:new i.v({value:t.result.distributionPoint.valueBlock.value})}))),"reasons"in t.result&&(this.reasons=new i.b({valueHex:t.result.reasons.valueBlock.valueHex})),"cRLIssuer"in t.result&&(this.cRLIssuer=Array.from(t.result.cRLIssuerNames,e=>new f({schema:e})))}toSchema(){const e=[];if("distributionPoint"in this){let t;t=this.distributionPoint instanceof Array?new i.g({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.distributionPoint,e=>e.toSchema())}):new i.g({idBlock:{tagClass:3,tagNumber:1},value:[this.distributionPoint.toSchema()]}),e.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:[t]}))}return"reasons"in this&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:1},valueHex:this.reasons.valueBlock.valueHex})),"cRLIssuer"in this&&e.push(new i.g({idBlock:{tagClass:3,tagNumber:2},value:Array.from(this.cRLIssuer,e=>e.toSchema())})),new i.v({value:e})}toJSON(){const e={};return"distributionPoint"in this&&(this.distributionPoint instanceof Array?e.distributionPoint=Array.from(this.distributionPoint,e=>e.toJSON()):e.distributionPoint=this.distributionPoint.toJSON()),"reasons"in this&&(e.reasons=this.reasons.toJSON()),"cRLIssuer"in this&&(e.cRLIssuer=Array.from(this.cRLIssuer,e=>e.toJSON())),e}}class x{constructor(e={}){this.distributionPoints=Object(a.f)(e,"distributionPoints",x.defaultValues("distributionPoints")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"distributionPoints":return[];default:throw new Error("Invalid member name for CRLDistributionPoints class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.distributionPoints||"",value:I.schema()})]})}fromSchema(e){Object(a.d)(e,["distributionPoints"]);const t=i.D(e,e,x.schema({names:{distributionPoints:"distributionPoints"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CRLDistributionPoints");this.distributionPoints=Array.from(t.result.distributionPoints,e=>new I({schema:e}))}toSchema(){return new i.v({value:Array.from(this.distributionPoints,e=>e.toSchema())})}toJSON(){return{distributionPoints:Array.from(this.distributionPoints,e=>e.toJSON())}}}class B{constructor(e={}){this.policyQualifierId=Object(a.f)(e,"policyQualifierId",B.defaultValues("policyQualifierId")),this.qualifier=Object(a.f)(e,"qualifier",B.defaultValues("qualifier")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"policyQualifierId":return"";case"qualifier":return new i.a;default:throw new Error("Invalid member name for PolicyQualifierInfo class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.policyQualifierId||""}),new i.a({name:t.qualifier||""})]})}fromSchema(e){Object(a.d)(e,["policyQualifierId","qualifier"]);const t=i.D(e,e,B.schema({names:{policyQualifierId:"policyQualifierId",qualifier:"qualifier"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyQualifierInfo");this.policyQualifierId=t.result.policyQualifierId.valueBlock.toString(),this.qualifier=t.result.qualifier}toSchema(){return new i.v({value:[new i.p({value:this.policyQualifierId}),this.qualifier]})}toJSON(){return{policyQualifierId:this.policyQualifierId,qualifier:this.qualifier.toJSON()}}}class D{constructor(e={}){this.policyIdentifier=Object(a.f)(e,"policyIdentifier",D.defaultValues("policyIdentifier")),"policyQualifiers"in e&&(this.policyQualifiers=Object(a.f)(e,"policyQualifiers",D.defaultValues("policyQualifiers"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"policyIdentifier":return"";case"policyQualifiers":return[];default:throw new Error("Invalid member name for PolicyInformation class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.policyIdentifier||""}),new i.v({optional:!0,value:[new i.u({name:t.policyQualifiers||"",value:B.schema()})]})]})}fromSchema(e){Object(a.d)(e,["policyIdentifier","policyQualifiers"]);const t=i.D(e,e,D.schema({names:{policyIdentifier:"policyIdentifier",policyQualifiers:"policyQualifiers"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyInformation");this.policyIdentifier=t.result.policyIdentifier.valueBlock.toString(),"policyQualifiers"in t.result&&(this.policyQualifiers=Array.from(t.result.policyQualifiers,e=>new B({schema:e})))}toSchema(){const e=[];return e.push(new i.p({value:this.policyIdentifier})),"policyQualifiers"in this&&e.push(new i.v({value:Array.from(this.policyQualifiers,e=>e.toSchema())})),new i.v({value:e})}toJSON(){const e={policyIdentifier:this.policyIdentifier};return"policyQualifiers"in this&&(e.policyQualifiers=Array.from(this.policyQualifiers,e=>e.toJSON())),e}}class T{constructor(e={}){this.certificatePolicies=Object(a.f)(e,"certificatePolicies",T.defaultValues("certificatePolicies")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"certificatePolicies":return[];default:throw new Error("Invalid member name for CertificatePolicies class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.certificatePolicies||"",value:D.schema()})]})}fromSchema(e){Object(a.d)(e,["certificatePolicies"]);const t=i.D(e,e,T.schema({names:{certificatePolicies:"certificatePolicies"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CertificatePolicies");this.certificatePolicies=Array.from(t.result.certificatePolicies,e=>new D({schema:e}))}toSchema(){return new i.v({value:Array.from(this.certificatePolicies,e=>e.toSchema())})}toJSON(){return{certificatePolicies:Array.from(this.certificatePolicies,e=>e.toJSON())}}}class P{constructor(e={}){this.issuerDomainPolicy=Object(a.f)(e,"issuerDomainPolicy",P.defaultValues("issuerDomainPolicy")),this.subjectDomainPolicy=Object(a.f)(e,"subjectDomainPolicy",P.defaultValues("subjectDomainPolicy")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"issuerDomainPolicy":case"subjectDomainPolicy":return"";default:throw new Error("Invalid member name for PolicyMapping class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.issuerDomainPolicy||""}),new i.p({name:t.subjectDomainPolicy||""})]})}fromSchema(e){Object(a.d)(e,["issuerDomainPolicy","subjectDomainPolicy"]);const t=i.D(e,e,P.schema({names:{issuerDomainPolicy:"issuerDomainPolicy",subjectDomainPolicy:"subjectDomainPolicy"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyMapping");this.issuerDomainPolicy=t.result.issuerDomainPolicy.valueBlock.toString(),this.subjectDomainPolicy=t.result.subjectDomainPolicy.valueBlock.toString()}toSchema(){return new i.v({value:[new i.p({value:this.issuerDomainPolicy}),new i.p({value:this.subjectDomainPolicy})]})}toJSON(){return{issuerDomainPolicy:this.issuerDomainPolicy,subjectDomainPolicy:this.subjectDomainPolicy}}}class R{constructor(e={}){this.mappings=Object(a.f)(e,"mappings",R.defaultValues("mappings")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"mappings":return[];default:throw new Error("Invalid member name for PolicyMappings class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.mappings||"",value:P.schema()})]})}fromSchema(e){Object(a.d)(e,["mappings"]);const t=i.D(e,e,R.schema({names:{mappings:"mappings"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyMappings");this.mappings=Array.from(t.result.mappings,e=>new P({schema:e}))}toSchema(){return new i.v({value:Array.from(this.mappings,e=>e.toSchema())})}toJSON(){return{mappings:Array.from(this.mappings,e=>e.toJSON())}}}class j{constructor(e={}){"keyIdentifier"in e&&(this.keyIdentifier=Object(a.f)(e,"keyIdentifier",j.defaultValues("keyIdentifier"))),"authorityCertIssuer"in e&&(this.authorityCertIssuer=Object(a.f)(e,"authorityCertIssuer",j.defaultValues("authorityCertIssuer"))),"authorityCertSerialNumber"in e&&(this.authorityCertSerialNumber=Object(a.f)(e,"authorityCertSerialNumber",j.defaultValues("authorityCertSerialNumber"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"keyIdentifier":return new i.q;case"authorityCertIssuer":return[];case"authorityCertSerialNumber":return new i.m;default:throw new Error("Invalid member name for AuthorityKeyIdentifier class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.r({name:t.keyIdentifier||"",optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new i.u({name:t.authorityCertIssuer||"",value:f.schema()})]}),new i.r({name:t.authorityCertSerialNumber||"",optional:!0,idBlock:{tagClass:3,tagNumber:2}})]})}fromSchema(e){Object(a.d)(e,["keyIdentifier","authorityCertIssuer","authorityCertSerialNumber"]);const t=i.D(e,e,j.schema({names:{keyIdentifier:"keyIdentifier",authorityCertIssuer:"authorityCertIssuer",authorityCertSerialNumber:"authorityCertSerialNumber"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AuthorityKeyIdentifier");"keyIdentifier"in t.result&&(this.keyIdentifier=new i.q({valueHex:t.result.keyIdentifier.valueBlock.valueHex})),"authorityCertIssuer"in t.result&&(this.authorityCertIssuer=Array.from(t.result.authorityCertIssuer,e=>new f({schema:e}))),"authorityCertSerialNumber"in t.result&&(this.authorityCertSerialNumber=new i.m({valueHex:t.result.authorityCertSerialNumber.valueBlock.valueHex}))}toSchema(){const e=[];return"keyIdentifier"in this&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:0},valueHex:this.keyIdentifier.valueBlock.valueHex})),"authorityCertIssuer"in this&&e.push(new i.g({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.authorityCertIssuer,e=>e.toSchema())})),"authorityCertSerialNumber"in this&&e.push(new i.r({idBlock:{tagClass:3,tagNumber:2},valueHex:this.authorityCertSerialNumber.valueBlock.valueHex})),new i.v({value:e})}toJSON(){const e={};return"keyIdentifier"in this&&(e.keyIdentifier=this.keyIdentifier.toJSON()),"authorityCertIssuer"in this&&(e.authorityCertIssuer=Array.from(this.authorityCertIssuer,e=>e.toJSON())),"authorityCertSerialNumber"in this&&(e.authorityCertSerialNumber=this.authorityCertSerialNumber.toJSON()),e}}class L{constructor(e={}){"requireExplicitPolicy"in e&&(this.requireExplicitPolicy=Object(a.f)(e,"requireExplicitPolicy",L.defaultValues("requireExplicitPolicy"))),"inhibitPolicyMapping"in e&&(this.inhibitPolicyMapping=Object(a.f)(e,"inhibitPolicyMapping",L.defaultValues("inhibitPolicyMapping"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"requireExplicitPolicy":case"inhibitPolicyMapping":return 0;default:throw new Error("Invalid member name for PolicyConstraints class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.r({name:t.requireExplicitPolicy||"",optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new i.r({name:t.inhibitPolicyMapping||"",optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Object(a.d)(e,["requireExplicitPolicy","inhibitPolicyMapping"]);const t=i.D(e,e,L.schema({names:{requireExplicitPolicy:"requireExplicitPolicy",inhibitPolicyMapping:"inhibitPolicyMapping"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for PolicyConstraints");if("requireExplicitPolicy"in t.result){const e=t.result.requireExplicitPolicy;e.idBlock.tagClass=1,e.idBlock.tagNumber=2;const r=e.toBER(!1),n=i.E(r);this.requireExplicitPolicy=n.result.valueBlock.valueDec}if("inhibitPolicyMapping"in t.result){const e=t.result.inhibitPolicyMapping;e.idBlock.tagClass=1,e.idBlock.tagNumber=2;const r=e.toBER(!1),n=i.E(r);this.inhibitPolicyMapping=n.result.valueBlock.valueDec}}toSchema(){const e=[];if("requireExplicitPolicy"in this){const t=new i.m({value:this.requireExplicitPolicy});t.idBlock.tagClass=3,t.idBlock.tagNumber=0,e.push(t)}if("inhibitPolicyMapping"in this){const t=new i.m({value:this.inhibitPolicyMapping});t.idBlock.tagClass=3,t.idBlock.tagNumber=1,e.push(t)}return new i.v({value:e})}toJSON(){const e={};return"requireExplicitPolicy"in this&&(e.requireExplicitPolicy=this.requireExplicitPolicy),"inhibitPolicyMapping"in this&&(e.inhibitPolicyMapping=this.inhibitPolicyMapping),e}}class U{constructor(e={}){this.keyPurposes=Object(a.f)(e,"keyPurposes",U.defaultValues("keyPurposes")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"keyPurposes":return[];default:throw new Error("Invalid member name for ExtKeyUsage class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.keyPurposes||"",value:new i.p})]})}fromSchema(e){Object(a.d)(e,["keyPurposes"]);const t=i.D(e,e,U.schema({names:{keyPurposes:"keyPurposes"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for ExtKeyUsage");this.keyPurposes=Array.from(t.result.keyPurposes,e=>e.valueBlock.toString())}toSchema(){return new i.v({value:Array.from(this.keyPurposes,e=>new i.p({value:e}))})}toJSON(){return{keyPurposes:Array.from(this.keyPurposes)}}}class V{constructor(e={}){this.accessDescriptions=Object(a.f)(e,"accessDescriptions",V.defaultValues("accessDescriptions")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"accessDescriptions":return[];default:throw new Error("Invalid member name for InfoAccess class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.accessDescriptions||"",value:m.schema()})]})}fromSchema(e){Object(a.d)(e,["accessDescriptions"]);const t=i.D(e,e,V.schema({names:{accessDescriptions:"accessDescriptions"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for InfoAccess");this.accessDescriptions=Array.from(t.result.accessDescriptions,e=>new m({schema:e}))}toSchema(){return new i.v({value:Array.from(this.accessDescriptions,e=>e.toSchema())})}toJSON(){return{accessDescriptions:Array.from(this.accessDescriptions,e=>e.toJSON())}}}class _{constructor(e={}){this.clear();for(const t of Object.keys(e))switch(t){case"length":this.length=e.length;break;case"stub":for(let t=0;t<this._view.length;t++)this._view[t]=e.stub;break;case"view":this.fromUint8Array(e.view);break;case"buffer":this.fromArrayBuffer(e.buffer);break;case"string":this.fromString(e.string);break;case"hexstring":this.fromHexString(e.hexstring)}}set buffer(e){this._buffer=e.slice(0),this._view=new Uint8Array(this._buffer)}get buffer(){return this._buffer}set view(e){this._buffer=new ArrayBuffer(e.length),this._view=new Uint8Array(this._buffer),this._view.set(e)}get view(){return this._view}get length(){return this._buffer.byteLength}set length(e){this._buffer=new ArrayBuffer(e),this._view=new Uint8Array(this._buffer)}clear(){this._buffer=new ArrayBuffer(0),this._view=new Uint8Array(this._buffer)}fromArrayBuffer(e){this.buffer=e}fromUint8Array(e){this._buffer=new ArrayBuffer(e.length),this._view=new Uint8Array(this._buffer),this._view.set(e)}fromString(e){const t=e.length;this.length=t;for(let r=0;r<t;r++)this.view[r]=e.charCodeAt(r)}toString(e=0,t=this.view.length-e){let r="";(e>=this.view.length||e<0)&&(e=0),(t>=this.view.length||t<0)&&(t=this.view.length-e);for(let n=e;n<e+t;n++)r+=String.fromCharCode(this.view[n]);return r}fromHexString(e){const t=e.length;this.buffer=new ArrayBuffer(t>>1),this.view=new Uint8Array(this.buffer);const r=new Map;r.set("0",0),r.set("1",1),r.set("2",2),r.set("3",3),r.set("4",4),r.set("5",5),r.set("6",6),r.set("7",7),r.set("8",8),r.set("9",9),r.set("A",10),r.set("a",10),r.set("B",11),r.set("b",11),r.set("C",12),r.set("c",12),r.set("D",13),r.set("d",13),r.set("E",14),r.set("e",14),r.set("F",15),r.set("f",15);let n=0,s=0;for(let i=0;i<t;i++)i%2?(s|=r.get(e.charAt(i)),this.view[n]=s,n++):s=r.get(e.charAt(i))<<4}toHexString(e=0,t=this.view.length-e){let r="";(e>=this.view.length||e<0)&&(e=0),(t>=this.view.length||t<0)&&(t=this.view.length-e);for(let n=e;n<e+t;n++){const e=this.view[n].toString(16).toUpperCase();r=r+(1==e.length?"0":"")+e}return r}copy(e=0,t=this._buffer.byteLength-e){if(0===e&&0===this._buffer.byteLength)return new _;if(e<0||e>this._buffer.byteLength-1)throw new Error("Wrong start position: "+e);const r=new _;return r._buffer=this._buffer.slice(e,e+t),r._view=new Uint8Array(r._buffer),r}slice(e=0,t=this._buffer.byteLength){if(0===e&&0===this._buffer.byteLength)return new _;if(e<0||e>this._buffer.byteLength-1)throw new Error("Wrong start position: "+e);const r=new _;return r._buffer=this._buffer.slice(e,t),r._view=new Uint8Array(r._buffer),r}realloc(e){const t=new ArrayBuffer(e),r=new Uint8Array(t);e>this._view.length?r.set(this._view):r.set(new Uint8Array(this._buffer,0,e)),this._buffer=t.slice(0),this._view=new Uint8Array(this._buffer)}append(e){const t=this._buffer.byteLength,r=e._buffer.byteLength,n=e._view.slice();this.realloc(t+r),this._view.set(n,t)}insert(e,t=0,r=this._buffer.byteLength-t){return!(t>this._buffer.byteLength-1)&&(r>this._buffer.byteLength-t&&(r=this._buffer.byteLength-t),r>e._buffer.byteLength&&(r=e._buffer.byteLength),r==e._buffer.byteLength?this._view.set(e._view,t):this._view.set(e._view.slice(0,r),t),!0)}isEqual(e){if(this._buffer.byteLength!=e._buffer.byteLength)return!1;for(let t=0;t<e._buffer.byteLength;t++)if(this.view[t]!=e.view[t])return!1;return!0}isEqualView(e){if(e.length!=this.view.length)return!1;for(let t=0;t<e.length;t++)if(this.view[t]!=e[t])return!1;return!0}findPattern(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));const s=e.buffer.byteLength;if(s>r)return-1;const i=[];for(let t=0;t<s;t++)i.push(e.view[t]);for(let e=0;e<=r-s;e++){let r=!0;const a=n?t-s-e:t+e;for(let e=0;e<s;e++)if(this.view[e+a]!=i[e]){r=!1;break}if(r)return n?t-s-e:t+s+e}return-1}findFirstIn(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));const s={id:-1,position:n?0:t+r,length:0};for(let i=0;i<e.length;i++){const a=this.findPattern(e[i],t,r,n);if(-1!=a){let t=!1;const r=e[i].length;n?a-r>=s.position-s.length&&(t=!0):a-r<=s.position-s.length&&(t=!0),t&&(s.position=a,s.id=i,s.length=r)}}return s}findAllIn(e,t=0,r=this.buffer.byteLength-t){const n=[];if(null==t&&(t=0),t>this.buffer.byteLength-1)return n;null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t);let s={id:-1,position:t};for(;;){const t=s.position;if(s=this.findFirstIn(e,s.position,r),-1==s.id)break;r-=s.position-t,n.push({id:s.id,position:s.position})}return n}findAllPatternIn(e,t=0,r=this.buffer.byteLength-t){null==t&&(t=0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t);const n=[],s=e.buffer.byteLength;if(s>r)return-1;const i=Array.from(e.view);for(let e=0;e<=r-s;e++){let r=!0;const a=t+e;for(let e=0;e<s;e++)if(this.view[e+a]!=i[e]){r=!1;break}r&&(n.push(t+s+e),e+=s-1)}return n}findFirstNotIn(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));const s={left:{id:-1,position:t},right:{id:-1,position:0},value:new _};let i=r;for(;i>0;){if(s.right=this.findFirstIn(e,n?t-r+i:t+r-i,i,n),-1==s.right.id){r=i,n?t-=r:t=s.left.position,s.value=new _,s.value._buffer=this._buffer.slice(t,t+r),s.value._view=new Uint8Array(s.value._buffer);break}if(s.right.position!=(n?s.left.position-e[s.right.id].buffer.byteLength:s.left.position+e[s.right.id].buffer.byteLength)){n?(t=s.right.position+e[s.right.id].buffer.byteLength,r=s.left.position-s.right.position-e[s.right.id].buffer.byteLength):(t=s.left.position,r=s.right.position-s.left.position-e[s.right.id].buffer.byteLength),s.value=new _,s.value._buffer=this._buffer.slice(t,t+r),s.value._view=new Uint8Array(s.value._buffer);break}s.left=s.right,i-=e[s.right.id]._buffer.byteLength}if(n){const e=s.right;s.right=s.left,s.left=e}return s}findAllNotIn(e,t=null,r=null){const n=[];if(null==t&&(t=0),t>this.buffer.byteLength-1)return n;null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t);let s={left:{id:-1,position:t},right:{id:-1,position:t},value:new _};do{const t=s.right.position;s=this.findFirstNotIn(e,s.right.position,r),r-=s.right.position-t,n.push({left:{id:s.left.id,position:s.left.position},right:{id:s.right.id,position:s.right.position},value:s.value})}while(-1!=s.right.id);return n}findFirstSequence(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));const s=this.skipNotPatterns(e,t,r,n);if(-1==s)return{position:-1,value:new _};const i=this.skipPatterns(e,s,r-(n?t-s:s-t),n);n?(t=i,r=s-i):(t=s,r=i-s);const a=new _;return a._buffer=this._buffer.slice(t,t+r),a._view=new Uint8Array(a._buffer),{position:i,value:a}}findAllSequences(e,t=null,r=null){const n=[];if(null==t&&(t=0),t>this.buffer.byteLength-1)return n;null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t);let s={position:t,value:new _};do{const t=s.position;s=this.findFirstSequence(e,s.position,r),-1!=s.position&&(r-=s.position-t,n.push({position:s.position,value:s.value}))}while(-1!=s.position);return n}findPairedPatterns(e,t,r=null,n=null){const s=[];if(e.isEqual(t))return s;if(null==r&&(r=0),r>this.buffer.byteLength-1)return s;null==n&&(n=this.buffer.byteLength-r),n>this.buffer.byteLength-r&&(n=this.buffer.byteLength-r);let i=0;const a=this.findAllPatternIn(e,r,n);if(0==a.length)return s;const o=this.findAllPatternIn(t,r,n);if(0==o.length)return s;for(;i<a.length&&0!=o.length;)if(a[0]!=o[0]){if(a[i]>o[0])break;for(;a[i]<o[0]&&(i++,!(i>=a.length)););s.push({left:a[i-1],right:o[0]}),a.splice(i-1,1),o.splice(0,1),i=0}else s.push({left:a[0],right:o[0]}),a.splice(0,1),o.splice(0,1);return s.sort((e,t)=>e.left-t.left),s}findPairedArrays(e,t,r=null,n=null){const s=[];if(null==r&&(r=0),r>this.buffer.byteLength-1)return s;null==n&&(n=this.buffer.byteLength-r),n>this.buffer.byteLength-r&&(n=this.buffer.byteLength-r);let i=0;const a=this.findAllIn(e,r,n);if(0==a.length)return s;const o=this.findAllIn(t,r,n);if(0==o.length)return s;for(;i<a.length&&0!=o.length;)if(a[0].position!=o[0].position){if(a[i].position>o[0].position)break;for(;a[i].position<o[0].position&&(i++,!(i>=a.length)););s.push({left:a[i-1],right:o[0]}),a.splice(i-1,1),o.splice(0,1),i=0}else s.push({left:a[0],right:o[0]}),a.splice(0,1),o.splice(0,1);return s.sort((e,t)=>e.left.position-t.left.position),s}replacePattern(e,t,r=null,n=null,s=null){let i,a;const o={status:-1,searchPatternPositions:[],replacePatternPositions:[]};if(null==r&&(r=0),r>this.buffer.byteLength-1)return!1;if(null==n&&(n=this.buffer.byteLength-r),n>this.buffer.byteLength-r&&(n=this.buffer.byteLength-r),null==s){if(i=this.findAllIn([e],r,n),0==i.length)return o}else i=s;o.searchPatternPositions.push(...Array.from(i,e=>e.position));const u=e.buffer.byteLength-t.buffer.byteLength,c=new ArrayBuffer(this.view.length-i.length*u),l=new Uint8Array(c);for(l.set(new Uint8Array(this.buffer,0,r)),a=0;a<i.length;a++){const n=0==a?r:i[a-1].position;l.set(new Uint8Array(this.buffer,n,i[a].position-e.buffer.byteLength-n),n-a*u),l.set(t.view,i[a].position-e.buffer.byteLength-a*u),o.replacePatternPositions.push(i[a].position-e.buffer.byteLength-a*u)}return a--,l.set(new Uint8Array(this.buffer,i[a].position,this.buffer.byteLength-i[a].position),i[a].position-e.buffer.byteLength+t.buffer.byteLength-a*u),this.buffer=c,this.view=new Uint8Array(this.buffer),o.status=1,o}skipPatterns(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));let s=t;for(let i=0;i<e.length;i++){const a=e[i].buffer.byteLength,o=n?s-a:s;let u=!0;for(let t=0;t<a;t++)if(this.view[t+o]!=e[i].view[t]){u=!1;break}if(u)if(i=-1,n){if(s-=a,s<=0)return s}else if(s+=a,s>=t+r)return s}return s}skipNotPatterns(e,t=null,r=null,n=!1){null==t&&(t=n?this.buffer.byteLength:0),t>this.buffer.byteLength&&(t=this.buffer.byteLength),n?(null==r&&(r=t),r>t&&(r=t)):(null==r&&(r=this.buffer.byteLength-t),r>this.buffer.byteLength-t&&(r=this.buffer.byteLength-t));let s=-1;for(let i=0;i<r;i++){for(let r=0;r<e.length;r++){const a=e[r].buffer.byteLength,o=n?t-i-a:t+i;let u=!0;for(let t=0;t<a;t++)if(this.view[t+o]!=e[r].view[t]){u=!1;break}if(u){s=n?t-i:t+i;break}}if(-1!=s)break}return s}}class H{constructor(e={}){this.stream=new _,this._length=0,this.backward=!1,this._start=0,this.appendBlock=0,this.prevLength=0,this.prevStart=0;for(const t of Object.keys(e))switch(t){case"stream":this.stream=e.stream;break;case"backward":this.backward=e.backward,this._start=this.stream.buffer.byteLength;break;case"length":this._length=e.length;break;case"start":this._start=e.start;break;case"appendBlock":this.appendBlock=e.appendBlock;break;case"view":this.stream=new _({view:e.view});break;case"buffer":this.stream=new _({buffer:e.buffer});break;case"string":this.stream=new _({string:e.string});break;case"hexstring":this.stream=new _({hexstring:e.hexstring})}}set stream(e){this._stream=e,this.prevLength=this._length,this._length=e._buffer.byteLength,this.prevStart=this._start,this._start=0}get stream(){return this._stream}set length(e){this.prevLength=this._length,this._length=e}get length(){return this.appendBlock?this.start:this._length}set start(e){e>this.stream.buffer.byteLength||(this.prevStart=this._start,this.prevLength=this._length,this._length-=this.backward?this._start-e:e-this._start,this._start=e)}get start(){return this._start}get buffer(){return this._stream._buffer.slice(0,this._length)}resetPosition(){this._start=this.prevStart,this._length=this.prevLength}findPattern(e,t=null){(null==t||t>this.length)&&(t=this.length);const r=this.stream.findPattern(e,this.start,this.length,this.backward);if(-1==r)return r;if(this.backward){if(r<this.start-e.buffer.byteLength-t)return-1}else if(r>this.start+e.buffer.byteLength+t)return-1;return this.start=r,r}findFirstIn(e,t=null){(null==t||t>this.length)&&(t=this.length);const r=this.stream.findFirstIn(e,this.start,this.length,this.backward);if(-1==r.id)return r;if(this.backward){if(r.position<this.start-e[r.id].buffer.byteLength-t)return{id:-1,position:this.backward?0:this.start+this.length}}else if(r.position>this.start+e[r.id].buffer.byteLength+t)return{id:-1,position:this.backward?0:this.start+this.length};return this.start=r.position,r}findAllIn(e){const t=this.backward?this.start-this.length:this.start;return this.stream.findAllIn(e,t,this.length)}findFirstNotIn(e,t=null){(null==t||t>this._length)&&(t=this._length);const r=this._stream.findFirstNotIn(e,this._start,this._length,this.backward);if(-1==r.left.id&&-1==r.right.id)return r;if(this.backward){if(-1!=r.right.id&&r.right.position<this._start-e[r.right.id]._buffer.byteLength-t)return{left:{id:-1,position:this._start},right:{id:-1,position:0},value:new _}}else if(-1!=r.left.id&&r.left.position>this._start+e[r.left.id]._buffer.byteLength+t)return{left:{id:-1,position:this._start},right:{id:-1,position:0},value:new _};return this.backward?-1==r.left.id?this.start=0:this.start=r.left.position:-1==r.right.id?this.start=this._start+this._length:this.start=r.right.position,r}findAllNotIn(e){const t=this.backward?this._start-this._length:this._start;return this._stream.findAllNotIn(e,t,this._length)}findFirstSequence(e,t=null,r=null){(null==t||t>this._length)&&(t=this._length),(null==r||r>t)&&(r=t);const n=this._stream.findFirstSequence(e,this._start,t,this.backward);if(0==n.value.buffer.byteLength)return n;if(this.backward){if(n.position<this._start-n.value._buffer.byteLength-r)return{position:-1,value:new _}}else if(n.position>this._start+n.value._buffer.byteLength+r)return{position:-1,value:new _};return this.start=n.position,n}findAllSequences(e){const t=this.backward?this.start-this.length:this.start;return this.stream.findAllSequences(e,t,this.length)}findPairedPatterns(e,t,r=null){(null==r||r>this.length)&&(r=this.length);const n=this.backward?this.start-this.length:this.start,s=this.stream.findPairedPatterns(e,t,n,this.length);if(s.length)if(this.backward){if(s[0].right<this.start-t.buffer.byteLength-r)return[]}else if(s[0].left>this.start+e.buffer.byteLength+r)return[];return s}findPairedArrays(e,t,r=null){(null==r||r>this.length)&&(r=this.length);const n=this.backward?this.start-this.length:this.start,s=this.stream.findPairedArrays(e,t,n,this.length);if(s.length)if(this.backward){if(s[0].right.position<this.start-t[s[0].right.id].buffer.byteLength-r)return[]}else if(s[0].left.position>this.start+e[s[0].left.id].buffer.byteLength+r)return[];return s}replacePattern(e,t){const r=this.backward?this.start-this.length:this.start;return this.stream.replacePattern(e,t,r,this.length)}skipPatterns(e){const t=this.stream.skipPatterns(e,this.start,this.length,this.backward);return this.start=t,t}skipNotPatterns(e){const t=this.stream.skipNotPatterns(e,this.start,this.length,this.backward);return-1==t?-1:(this.start=t,t)}append(e){this._start+e._buffer.byteLength>this._stream._buffer.byteLength&&(e._buffer.byteLength>this.appendBlock&&(this.appendBlock=e._buffer.byteLength+1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock)),this._stream._view.set(e._view,this._start),this._length+=2*e._buffer.byteLength,this.start=this._start+e._buffer.byteLength,this.prevLength-=2*e._buffer.byteLength}appendView(e){this._start+e.length>this._stream._buffer.byteLength&&(e.length>this.appendBlock&&(this.appendBlock=e.length+1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock)),this._stream._view.set(e,this._start),this._length+=2*e.length,this.start=this._start+e.length,this.prevLength-=2*e.length}appendChar(e){this._start+1>this._stream._buffer.byteLength&&(1>this.appendBlock&&(this.appendBlock=1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock)),this._stream._view[this._start]=e,this._length+=2,this.start=this._start+1,this.prevLength-=2}appendUint16(e){this._start+2>this._stream._buffer.byteLength&&(2>this.appendBlock&&(this.appendBlock=1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock));const t=new Uint16Array([e]),r=new Uint8Array(t.buffer);this._stream._view[this._start]=r[1],this._stream._view[this._start+1]=r[0],this._length+=4,this.start=this._start+2,this.prevLength-=4}appendUint24(e){this._start+3>this._stream._buffer.byteLength&&(3>this.appendBlock&&(this.appendBlock=1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock));const t=new Uint32Array([e]),r=new Uint8Array(t.buffer);this._stream._view[this._start]=r[2],this._stream._view[this._start+1]=r[1],this._stream._view[this._start+2]=r[0],this._length+=6,this.start=this._start+3,this.prevLength-=6}appendUint32(e){this._start+4>this._stream._buffer.byteLength&&(4>this.appendBlock&&(this.appendBlock=1e3),this._stream.realloc(this._stream._buffer.byteLength+this.appendBlock));const t=new Uint32Array([e]),r=new Uint8Array(t.buffer);this._stream._view[this._start]=r[3],this._stream._view[this._start+1]=r[2],this._stream._view[this._start+2]=r[1],this._stream._view[this._start+3]=r[0],this._length+=8,this.start=this._start+4,this.prevLength-=8}getBlock(e,t=!0){if(this._length<=0)return[];let r;if(this._length<e&&(e=this._length),this.backward){const t=this._stream._buffer.slice(this._length-e,this._length),n=new Uint8Array(t);r=new Array(e);for(let t=0;t<e;t++)r[e-1-t]=n[t]}else{const t=this._stream._buffer.slice(this._start,this._start+e);r=Array.from(new Uint8Array(t))}return t&&(this.start+=this.backward?-1*e:e),r}getUint16(e=!0){const t=this.getBlock(2,e);if(t.length<2)return 0;const r=new Uint16Array(1),n=new Uint8Array(r.buffer);return n[0]=t[1],n[1]=t[0],r[0]}getInt16(e=!0){const t=this.getBlock(2,e);if(t.length<2)return 0;const r=new Int16Array(1),n=new Uint8Array(r.buffer);return n[0]=t[1],n[1]=t[0],r[0]}getUint24(e=!0){const t=this.getBlock(3,e);if(t.length<3)return 0;const r=new Uint32Array(1),n=new Uint8Array(r.buffer);for(let e=3;e>=1;e--)n[3-e]=t[e-1];return r[0]}getUint32(e=!0){const t=this.getBlock(4,e);if(t.length<4)return 0;const r=new Uint32Array(1),n=new Uint8Array(r.buffer);for(let e=3;e>=0;e--)n[3-e]=t[e];return r[0]}getInt32(e=!0){const t=this.getBlock(4,e);if(t.length<4)return 0;const r=new Int32Array(1),n=new Uint8Array(r.buffer);for(let e=3;e>=0;e--)n[3-e]=t[e];return r[0]}}class M{constructor(e={}){this.version=Object(a.f)(e,"version",M.defaultValues("version")),this.logID=Object(a.f)(e,"logID",M.defaultValues("logID")),this.timestamp=Object(a.f)(e,"timestamp",M.defaultValues("timestamp")),this.extensions=Object(a.f)(e,"extensions",M.defaultValues("extensions")),this.hashAlgorithm=Object(a.f)(e,"hashAlgorithm",M.defaultValues("hashAlgorithm")),this.signatureAlgorithm=Object(a.f)(e,"signatureAlgorithm",M.defaultValues("signatureAlgorithm")),this.signature=Object(a.f)(e,"signature",M.defaultValues("signature")),"schema"in e&&this.fromSchema(e.schema),"stream"in e&&this.fromStream(e.stream)}static defaultValues(e){switch(e){case"version":return 0;case"logID":case"extensions":return new ArrayBuffer(0);case"timestamp":return new Date(0);case"hashAlgorithm":case"signatureAlgorithm":return"";case"signature":return new i.a;default:throw new Error("Invalid member name for SignedCertificateTimestamp class: "+e)}}fromSchema(e){if(e instanceof i.t==!1)throw new Error("Object's schema was not verified against input data for SignedCertificateTimestamp");const t=new H({stream:new _({buffer:e.data})});this.fromStream(t)}fromStream(e){const t=e.getUint16();if(this.version=e.getBlock(1)[0],0===this.version){this.logID=new Uint8Array(e.getBlock(32)).buffer.slice(0),this.timestamp=new Date(Object(a.p)(new Uint8Array(e.getBlock(8)),8));const r=e.getUint16();switch(this.extensions=new Uint8Array(e.getBlock(r)).buffer.slice(0),e.getBlock(1)[0]){case 0:this.hashAlgorithm="none";break;case 1:this.hashAlgorithm="md5";break;case 2:this.hashAlgorithm="sha1";break;case 3:this.hashAlgorithm="sha224";break;case 4:this.hashAlgorithm="sha256";break;case 5:this.hashAlgorithm="sha384";break;case 6:this.hashAlgorithm="sha512";break;default:throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}switch(e.getBlock(1)[0]){case 0:this.signatureAlgorithm="anonymous";break;case 1:this.signatureAlgorithm="rsa";break;case 2:this.signatureAlgorithm="dsa";break;case 3:this.signatureAlgorithm="ecdsa";break;default:throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}const n=e.getUint16(),s=new Uint8Array(e.getBlock(n)).buffer.slice(0),o=i.E(s);if(-1===o.offset)throw new Error("Object's stream was not correct for SignedCertificateTimestamp");if(this.signature=o.result,t!==47+r+n)throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}}toSchema(){const e=this.toStream();return new i.t({data:e.stream.buffer})}toStream(){const e=new H;e.appendUint16(47+this.extensions.byteLength+this.signature.valueBeforeDecode.byteLength),e.appendChar(this.version),e.appendView(new Uint8Array(this.logID));const t=new ArrayBuffer(8),r=new Uint8Array(t),n=Object(a.q)(this.timestamp.valueOf(),8);let s,i;switch(r.set(new Uint8Array(n),8-n.byteLength),e.appendView(r),e.appendUint16(this.extensions.byteLength),this.extensions.byteLength&&e.appendView(new Uint8Array(this.extensions)),this.hashAlgorithm.toLowerCase()){case"none":s=0;break;case"md5":s=1;break;case"sha1":s=2;break;case"sha224":s=3;break;case"sha256":s=4;break;case"sha384":s=5;break;case"sha512":s=6;break;default:throw new Error("Incorrect data for hashAlgorithm: "+this.hashAlgorithm)}switch(e.appendChar(s),this.signatureAlgorithm.toLowerCase()){case"anonymous":i=0;break;case"rsa":i=1;break;case"dsa":i=2;break;case"ecdsa":i=3;break;default:throw new Error("Incorrect data for signatureAlgorithm: "+this.signatureAlgorithm)}e.appendChar(i);const o=this.signature.toBER(!1);return e.appendUint16(o.byteLength),e.appendView(new Uint8Array(o)),e}toJSON(){return{version:this.version,logID:Object(a.b)(this.logID),timestamp:this.timestamp,extensions:Object(a.b)(this.extensions),hashAlgorithm:this.hashAlgorithm,signatureAlgorithm:this.signatureAlgorithm,signature:this.signature.toJSON()}}async verify(e,t,r=0){let n,o=Object(a.k)(Object(a.a)(this.logID)),u=null,c=new H;for(const t of e)if(t.log_id===o){u=t.key;break}if(null===u)throw new Error("Public key not found for CT with logId: "+o);const l=i.E(Object(a.j)(Object(a.e)(u)));if(-1===l.offset)throw new Error("Incorrect key value for CT Log with logId: "+o);n=new v.a({schema:l.result}),c.appendChar(0),c.appendChar(0);const h=new ArrayBuffer(8),f=new Uint8Array(h),m=Object(a.q)(this.timestamp.valueOf(),8);return f.set(new Uint8Array(m),8-m.byteLength),c.appendView(f),c.appendUint16(r),0===r&&c.appendUint24(t.byteLength),c.appendView(new Uint8Array(t)),c.appendUint16(this.extensions.byteLength),0!==this.extensions.byteLength&&c.appendView(new Uint8Array(this.extensions)),Object(s.e)().subtle.verifyWithPublicKey(c._stream._buffer.slice(0,c._length),{valueBlock:{valueHex:this.signature.toBER(!1)}},n,{algorithmId:""},"SHA-256")}}class F{constructor(e={}){this.timestamps=Object(a.f)(e,"timestamps",F.defaultValues("timestamps")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"timestamps":return[];default:throw new Error("Invalid member name for SignedCertificateTimestampList class: "+e)}}static compareWithDefault(e,t){switch(e){case"timestamps":return 0===t.length;default:throw new Error("Invalid member name for SignedCertificateTimestampList class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return"optional"in t==!1&&(t.optional=!1),new i.q({name:t.blockName||"SignedCertificateTimestampList",optional:t.optional})}fromSchema(e){if(e instanceof i.q==!1)throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList");const t=new H({stream:new _({buffer:e.valueBlock.valueHex})});if(t.getUint16()!==t.length)throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList");for(;t.length;)this.timestamps.push(new M({stream:t}))}toSchema(){const e=new H;let t=0;const r=[];for(const e of this.timestamps){const n=e.toStream();r.push(n),t+=n.stream.buffer.byteLength}e.appendUint16(t);for(const t of r)e.appendView(t.stream.view);return new i.q({valueHex:e.stream.buffer.slice(0)})}toJSON(){return{timestamps:Array.from(this.timestamps,e=>e.toJSON())}}}class K{constructor(e={}){this.templateID=Object(a.f)(e,"templateID",K.defaultValues("templateID")),"templateMajorVersion"in e&&(this.templateMajorVersion=Object(a.f)(e,"templateMajorVersion",K.defaultValues("templateMajorVersion"))),"templateMinorVersion"in e&&(this.templateMinorVersion=Object(a.f)(e,"templateMinorVersion",K.defaultValues("templateMinorVersion"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"templateID":return"";case"templateMajorVersion":case"templateMinorVersion":return 0;default:throw new Error("Invalid member name for CertificateTemplate class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.templateID||""}),new i.m({name:t.templateMajorVersion||"",optional:!0}),new i.m({name:t.templateMinorVersion||"",optional:!0})]})}fromSchema(e){Object(a.d)(e,["templateID","templateMajorVersion","templateMinorVersion"]);let t=i.D(e,e,K.schema({names:{templateID:"templateID",templateMajorVersion:"templateMajorVersion",templateMinorVersion:"templateMinorVersion"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CertificateTemplate");this.templateID=t.result.templateID.valueBlock.toString(),"templateMajorVersion"in t.result&&(this.templateMajorVersion=t.result.templateMajorVersion.valueBlock.valueDec),"templateMinorVersion"in t.result&&(this.templateMinorVersion=t.result.templateMinorVersion.valueBlock.valueDec)}toSchema(){const e=[];return e.push(new i.p({value:this.templateID})),"templateMajorVersion"in this&&e.push(new i.m({value:this.templateMajorVersion})),"templateMinorVersion"in this&&e.push(new i.m({value:this.templateMinorVersion})),new i.v({value:e})}toJSON(){const e={extnID:this.templateID};return"templateMajorVersion"in this&&(e.templateMajorVersion=this.templateMajorVersion),"templateMinorVersion"in this&&(e.templateMinorVersion=this.templateMinorVersion),e}}class q{constructor(e={}){this.certificateIndex=Object(a.f)(e,"certificateIndex",q.defaultValues("certificateIndex")),this.keyIndex=Object(a.f)(e,"keyIndex",q.defaultValues("keyIndex")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"certificateIndex":case"keyIndex":return 0;default:throw new Error("Invalid member name for CAVersion class: "+e)}}static schema(e={}){return new i.m}fromSchema(e){if(e.constructor.blockName()!==i.m.blockName())throw new Error("Object's schema was not verified against input data for CAVersion");let t=e.valueBlock.valueHex.slice(0);const r=new Uint8Array(t);switch(!0){case t.byteLength<4:{const e=new ArrayBuffer(4);new Uint8Array(e).set(r,4-t.byteLength),t=e.slice(0)}break;case t.byteLength>4:{const e=new ArrayBuffer(4);new Uint8Array(e).set(r.slice(0,4)),t=e.slice(0)}}const n=t.slice(0,2),s=new Uint8Array(n);let a=s[0];s[0]=s[1],s[1]=a;const o=new Uint16Array(n);this.keyIndex=o[0];const u=t.slice(2),c=new Uint8Array(u);a=c[0],c[0]=c[1],c[1]=a;const l=new Uint16Array(u);this.certificateIndex=l[0]}toSchema(){const e=new ArrayBuffer(2);new Uint16Array(e)[0]=this.certificateIndex;const t=new Uint8Array(e);let r=t[0];t[0]=t[1],t[1]=r;const n=new ArrayBuffer(2);new Uint16Array(n)[0]=this.keyIndex;const s=new Uint8Array(n);return r=s[0],s[0]=s[1],s[1]=r,new i.m({valueHex:Object(a.l)(n,e)})}toJSON(){return{certificateIndex:this.certificateIndex,keyIndex:this.keyIndex}}}class J{constructor(e={}){this.id=Object(a.f)(e,"id",J.defaultValues("id")),"type"in e&&(this.type=Object(a.f)(e,"type",J.defaultValues("type"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"id":return"";case"type":return new i.n;default:throw new Error("Invalid member name for QCStatement class: "+e)}}static compareWithDefault(e,t){switch(e){case"id":return""===t;case"type":return t instanceof i.n;default:throw new Error("Invalid member name for QCStatement class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.id||""}),new i.a({name:t.type||"",optional:!0})]})}fromSchema(e){Object(a.d)(e,["id","type"]);const t=i.D(e,e,J.schema({names:{id:"id",type:"type"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for QCStatement");this.id=t.result.id.valueBlock.toString(),"type"in t.result&&(this.type=t.result.type)}toSchema(){const e=[new i.p({value:this.id})];return"type"in this&&e.push(this.type),new i.v({value:e})}toJSON(){const e={id:this.id};return"type"in this&&(e.type=this.type.toJSON()),e}}class G{constructor(e={}){this.values=Object(a.f)(e,"values",G.defaultValues("values")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"values":return[];default:throw new Error("Invalid member name for QCStatements class: "+e)}}static compareWithDefault(e,t){switch(e){case"values":return 0===t.length;default:throw new Error("Invalid member name for QCStatements class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.u({name:t.values||"",value:J.schema(t.value||{})})]})}fromSchema(e){Object(a.d)(e,["values"]);const t=i.D(e,e,G.schema({names:{values:"values"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for QCStatements");this.values=Array.from(t.result.values,e=>new J({schema:e}))}toSchema(){return new i.v({value:Array.from(this.values,e=>e.toSchema())})}toJSON(){return{extensions:Array.from(this.values,e=>e.toJSON())}}}class X{constructor(e={}){this.extnID=Object(a.f)(e,"extnID",X.defaultValues("extnID")),this.critical=Object(a.f)(e,"critical",X.defaultValues("critical")),this.extnValue="extnValue"in e?new i.q({valueHex:e.extnValue}):X.defaultValues("extnValue"),"parsedValue"in e&&(this.parsedValue=Object(a.f)(e,"parsedValue",X.defaultValues("parsedValue"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"extnID":return"";case"critical":return!1;case"extnValue":return new i.q;case"parsedValue":return{};default:throw new Error("Invalid member name for Extension class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.extnID||""}),new i.d({name:t.critical||"",optional:!0}),new i.q({name:t.extnValue||""})]})}fromSchema(e){Object(a.d)(e,["extnID","critical","extnValue"]);let t=i.D(e,e,X.schema({names:{extnID:"extnID",critical:"critical",extnValue:"extnValue"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Extension");if(this.extnID=t.result.extnID.valueBlock.toString(),"critical"in t.result&&(this.critical=t.result.critical.valueBlock.value),this.extnValue=t.result.extnValue,t=i.E(this.extnValue.valueBlock.valueHex),-1!==t.offset)switch(this.extnID){case"2.5.29.9":try{this.parsedValue=new N({schema:t.result})}catch(e){this.parsedValue=new N,this.parsedValue.parsingError="Incorrectly formated SubjectDirectoryAttributes"}break;case"2.5.29.14":case"2.5.29.15":this.parsedValue=t.result;break;case"2.5.29.16":try{this.parsedValue=new A({schema:t.result})}catch(e){this.parsedValue=new A,this.parsedValue.parsingError="Incorrectly formated PrivateKeyUsagePeriod"}break;case"2.5.29.17":case"2.5.29.18":try{this.parsedValue=new g({schema:t.result})}catch(e){this.parsedValue=new g,this.parsedValue.parsingError="Incorrectly formated AltName"}break;case"2.5.29.19":try{this.parsedValue=new S({schema:t.result})}catch(e){this.parsedValue=new S,this.parsedValue.parsingError="Incorrectly formated BasicConstraints"}break;case"2.5.29.20":case"2.5.29.27":case"2.5.29.21":case"2.5.29.24":this.parsedValue=t.result;break;case"2.5.29.28":try{this.parsedValue=new E({schema:t.result})}catch(e){this.parsedValue=new E,this.parsedValue.parsingError="Incorrectly formated IssuingDistributionPoint"}break;case"2.5.29.29":try{this.parsedValue=new C({schema:t.result})}catch(e){this.parsedValue=new C,this.parsedValue.parsingError="Incorrectly formated GeneralNames"}break;case"2.5.29.30":try{this.parsedValue=new O({schema:t.result})}catch(e){this.parsedValue=new O,this.parsedValue.parsingError="Incorrectly formated NameConstraints"}break;case"2.5.29.31":case"2.5.29.46":try{this.parsedValue=new x({schema:t.result})}catch(e){this.parsedValue=new x,this.parsedValue.parsingError="Incorrectly formated CRLDistributionPoints"}break;case"2.5.29.32":case"1.3.6.1.4.1.311.21.10":try{this.parsedValue=new T({schema:t.result})}catch(e){this.parsedValue=new T,this.parsedValue.parsingError="Incorrectly formated CertificatePolicies"}break;case"2.5.29.33":try{this.parsedValue=new R({schema:t.result})}catch(e){this.parsedValue=new R,this.parsedValue.parsingError="Incorrectly formated CertificatePolicies"}break;case"2.5.29.35":try{this.parsedValue=new j({schema:t.result})}catch(e){this.parsedValue=new j,this.parsedValue.parsingError="Incorrectly formated AuthorityKeyIdentifier"}break;case"2.5.29.36":try{this.parsedValue=new L({schema:t.result})}catch(e){this.parsedValue=new L,this.parsedValue.parsingError="Incorrectly formated PolicyConstraints"}break;case"2.5.29.37":try{this.parsedValue=new U({schema:t.result})}catch(e){this.parsedValue=new U,this.parsedValue.parsingError="Incorrectly formated ExtKeyUsage"}break;case"2.5.29.54":this.parsedValue=t.result;break;case"1.3.6.1.5.5.7.1.1":case"1.3.6.1.5.5.7.1.11":try{this.parsedValue=new V({schema:t.result})}catch(e){this.parsedValue=new V,this.parsedValue.parsingError="Incorrectly formated InfoAccess"}break;case"1.3.6.1.4.1.11129.2.4.2":try{this.parsedValue=new F({schema:t.result})}catch(e){this.parsedValue=new F,this.parsedValue.parsingError="Incorrectly formated SignedCertificateTimestampList"}break;case"1.3.6.1.4.1.311.20.2":case"1.3.6.1.4.1.311.21.2":this.parsedValue=t.result;break;case"1.3.6.1.4.1.311.21.7":try{this.parsedValue=new K({schema:t.result})}catch(e){this.parsedValue=new K,this.parsedValue.parsingError="Incorrectly formated CertificateTemplate"}break;case"1.3.6.1.4.1.311.21.1":try{this.parsedValue=new q({schema:t.result})}catch(e){this.parsedValue=new q,this.parsedValue.parsingError="Incorrectly formated CAVersion"}break;case"1.3.6.1.5.5.7.1.3":try{this.parsedValue=new G({schema:t.result})}catch(e){this.parsedValue=new G,this.parsedValue.parsingError="Incorrectly formated QCStatements"}}}toSchema(){const e=[];return e.push(new i.p({value:this.extnID})),this.critical!==X.defaultValues("critical")&&e.push(new i.d({value:this.critical})),e.push(this.extnValue),new i.v({value:e})}toJSON(){const e={extnID:this.extnID,extnValue:this.extnValue.toJSON()};return this.critical!==X.defaultValues("critical")&&(e.critical=this.critical),"parsedValue"in this&&"toJSON"in this.parsedValue&&(e.parsedValue=this.parsedValue.toJSON()),e}}class W{constructor(e={}){this.extensions=Object(a.f)(e,"extensions",W.defaultValues("extensions")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"extensions":return[];default:throw new Error("Invalid member name for Extensions class: "+e)}}static schema(e={},t=!1){const r=Object(a.f)(e,"names",{});return new i.v({optional:t,name:r.blockName||"",value:[new i.u({name:r.extensions||"",value:X.schema(r.extension||{})})]})}fromSchema(e){Object(a.d)(e,["extensions"]);const t=i.D(e,e,W.schema({names:{extensions:"extensions"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Extensions");this.extensions=Array.from(t.result.extensions,e=>new X({schema:e}))}toSchema(){return new i.v({value:Array.from(this.extensions,e=>e.toSchema())})}toJSON(){return{extensions:Array.from(this.extensions,e=>e.toJSON())}}}function Y(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"tbsCertificate",value:[new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.m({name:t.tbsCertificateVersion||"tbsCertificate.version"})]}),new i.m({name:t.tbsCertificateSerialNumber||"tbsCertificate.serialNumber"}),d.a.schema(t.signature||{names:{blockName:"tbsCertificate.signature"}}),u.schema(t.issuer||{names:{blockName:"tbsCertificate.issuer"}}),new i.v({name:t.tbsCertificateValidity||"tbsCertificate.validity",value:[w.schema(t.notBefore||{names:{utcTimeName:"tbsCertificate.notBefore",generalTimeName:"tbsCertificate.notBefore"}}),w.schema(t.notAfter||{names:{utcTimeName:"tbsCertificate.notAfter",generalTimeName:"tbsCertificate.notAfter"}})]}),u.schema(t.subject||{names:{blockName:"tbsCertificate.subject"}}),v.a.schema(t.subjectPublicKeyInfo||{names:{blockName:"tbsCertificate.subjectPublicKeyInfo"}}),new i.r({name:t.tbsCertificateIssuerUniqueID||"tbsCertificate.issuerUniqueID",optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new i.r({name:t.tbsCertificateSubjectUniqueID||"tbsCertificate.subjectUniqueID",optional:!0,idBlock:{tagClass:3,tagNumber:2}}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:3},value:[W.schema(t.extensions||{names:{blockName:"tbsCertificate.extensions"}})]})]})}class Q{constructor(e={}){this.tbs=Object(a.f)(e,"tbs",Q.defaultValues("tbs")),this.version=Object(a.f)(e,"version",Q.defaultValues("version")),this.serialNumber=Object(a.f)(e,"serialNumber",Q.defaultValues("serialNumber")),this.signature=Object(a.f)(e,"signature",Q.defaultValues("signature")),this.issuer=Object(a.f)(e,"issuer",Q.defaultValues("issuer")),this.notBefore=Object(a.f)(e,"notBefore",Q.defaultValues("notBefore")),this.notAfter=Object(a.f)(e,"notAfter",Q.defaultValues("notAfter")),this.subject=Object(a.f)(e,"subject",Q.defaultValues("subject")),this.subjectPublicKeyInfo=Object(a.f)(e,"subjectPublicKeyInfo",Q.defaultValues("subjectPublicKeyInfo")),"issuerUniqueID"in e&&(this.issuerUniqueID=Object(a.f)(e,"issuerUniqueID",Q.defaultValues("issuerUniqueID"))),"subjectUniqueID"in e&&(this.subjectUniqueID=Object(a.f)(e,"subjectUniqueID",Q.defaultValues("subjectUniqueID"))),"extensions"in e&&(this.extensions=Object(a.f)(e,"extensions",Q.defaultValues("extensions"))),this.signatureAlgorithm=Object(a.f)(e,"signatureAlgorithm",Q.defaultValues("signatureAlgorithm")),this.signatureValue=Object(a.f)(e,"signatureValue",Q.defaultValues("signatureValue")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"tbs":return new ArrayBuffer(0);case"version":return 0;case"serialNumber":return new i.m;case"signature":return new d.a;case"issuer":return new u;case"notBefore":case"notAfter":return new w;case"subject":return new u;case"subjectPublicKeyInfo":return new v.a;case"issuerUniqueID":case"subjectUniqueID":return new ArrayBuffer(0);case"extensions":return[];case"signatureAlgorithm":return new d.a;case"signatureValue":return new i.b;default:throw new Error("Invalid member name for Certificate class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[Y(t.tbsCertificate),d.a.schema(t.signatureAlgorithm||{names:{blockName:"signatureAlgorithm"}}),new i.b({name:t.signatureValue||"signatureValue"})]})}fromSchema(e){Object(a.d)(e,["tbsCertificate","tbsCertificate.extensions","tbsCertificate.version","tbsCertificate.serialNumber","tbsCertificate.signature","tbsCertificate.issuer","tbsCertificate.notBefore","tbsCertificate.notAfter","tbsCertificate.subject","tbsCertificate.subjectPublicKeyInfo","tbsCertificate.issuerUniqueID","tbsCertificate.subjectUniqueID","signatureAlgorithm","signatureValue"]);const t=i.D(e,e,Q.schema({names:{tbsCertificate:{names:{extensions:{names:{extensions:"tbsCertificate.extensions"}}}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Certificate");this.tbs=t.result.tbsCertificate.valueBeforeDecode,"tbsCertificate.version"in t.result&&(this.version=t.result["tbsCertificate.version"].valueBlock.valueDec),this.serialNumber=t.result["tbsCertificate.serialNumber"],this.signature=new d.a({schema:t.result["tbsCertificate.signature"]}),this.issuer=new u({schema:t.result["tbsCertificate.issuer"]}),this.notBefore=new w({schema:t.result["tbsCertificate.notBefore"]}),this.notAfter=new w({schema:t.result["tbsCertificate.notAfter"]}),this.subject=new u({schema:t.result["tbsCertificate.subject"]}),this.subjectPublicKeyInfo=new v.a({schema:t.result["tbsCertificate.subjectPublicKeyInfo"]}),"tbsCertificate.issuerUniqueID"in t.result&&(this.issuerUniqueID=t.result["tbsCertificate.issuerUniqueID"].valueBlock.valueHex),"tbsCertificate.subjectUniqueID"in t.result&&(this.subjectUniqueID=t.result["tbsCertificate.subjectUniqueID"].valueBlock.valueHex),"tbsCertificate.extensions"in t.result&&(this.extensions=Array.from(t.result["tbsCertificate.extensions"],e=>new X({schema:e}))),this.signatureAlgorithm=new d.a({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){const e=[];return"version"in this&&this.version!==Q.defaultValues("version")&&e.push(new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.m({value:this.version})]})),e.push(this.serialNumber),e.push(this.signature.toSchema()),e.push(this.issuer.toSchema()),e.push(new i.v({value:[this.notBefore.toSchema(),this.notAfter.toSchema()]})),e.push(this.subject.toSchema()),e.push(this.subjectPublicKeyInfo.toSchema()),"issuerUniqueID"in this&&e.push(new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:1},valueHex:this.issuerUniqueID})),"subjectUniqueID"in this&&e.push(new i.r({optional:!0,idBlock:{tagClass:3,tagNumber:2},valueHex:this.subjectUniqueID})),"extensions"in this&&e.push(new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:3},value:[new i.v({value:Array.from(this.extensions,e=>e.toSchema())})]})),new i.v({value:e})}toSchema(e=!1){let t={};if(!1===e){if(0===this.tbs.length)return Q.schema().value[0];t=i.E(this.tbs).result}else t=this.encodeTBS();return new i.v({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){const e={tbs:Object(a.b)(this.tbs,0,this.tbs.byteLength),serialNumber:this.serialNumber.toJSON(),signature:this.signature.toJSON(),issuer:this.issuer.toJSON(),notBefore:this.notBefore.toJSON(),notAfter:this.notAfter.toJSON(),subject:this.subject.toJSON(),subjectPublicKeyInfo:this.subjectPublicKeyInfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return"version"in this&&this.version!==Q.defaultValues("version")&&(e.version=this.version),"issuerUniqueID"in this&&(e.issuerUniqueID=Object(a.b)(this.issuerUniqueID,0,this.issuerUniqueID.byteLength)),"subjectUniqueID"in this&&(e.subjectUniqueID=Object(a.b)(this.subjectUniqueID,0,this.subjectUniqueID.byteLength)),"extensions"in this&&(e.extensions=Array.from(this.extensions,e=>e.toJSON())),e}getPublicKey(e=null){return Object(s.e)().subtle.getPublicKey(this.subjectPublicKeyInfo,this.signatureAlgorithm,e)}getKeyHash(e="SHA-1"){const t=Object(s.d)();return void 0===t?Promise.reject("Unable to create WebCrypto object"):t.digest({name:e},new Uint8Array(this.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHex))}sign(e,t="SHA-1"){if(void 0===e)return Promise.reject("Need to provide a private key for signing");let r,n=Promise.resolve();const a=Object(s.e)();return n=n.then(()=>a.subtle.getSignatureParameters(e,t)),n=n.then(e=>{r=e.parameters,this.signature=e.signatureAlgorithm,this.signatureAlgorithm=e.signatureAlgorithm}),n=n.then(()=>{this.tbs=this.encodeTBS().toBER(!1)}),n=n.then(()=>a.subtle.signWithPrivateKey(this.tbs,e,r)),n=n.then(e=>{this.signatureValue=new i.b({valueHex:e})}),n}verify(e=null){let t={};return null!==e?t=e.subjectPublicKeyInfo:this.issuer.isEqual(this.subject)&&(t=this.subjectPublicKeyInfo),t instanceof v.a==!1?Promise.reject("Please provide issuer certificate as a parameter"):Object(s.e)().subtle.verifyWithPublicKey(this.tbs,this.signatureValue,t,this.signatureAlgorithm)}}class ${constructor(e={}){this.notBeforeTime=Object(a.f)(e,"notBeforeTime",$.defaultValues("notBeforeTime")),this.notAfterTime=Object(a.f)(e,"notAfterTime",$.defaultValues("notAfterTime")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"notBeforeTime":case"notAfterTime":return new Date(0,0,0);default:throw new Error("Invalid member name for AttCertValidityPeriod class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.j({name:t.notBeforeTime||""}),new i.j({name:t.notAfterTime||""})]})}fromSchema(e){Object(a.d)(e,["notBeforeTime","notAfterTime"]);const t=i.D(e,e,$.schema({names:{notBeforeTime:"notBeforeTime",notAfterTime:"notAfterTime"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AttCertValidityPeriod");this.notBeforeTime=t.result.notBeforeTime.toDate(),this.notAfterTime=t.result.notAfterTime.toDate()}toSchema(){return new i.v({value:[new i.j({valueDate:this.notBeforeTime}),new i.j({valueDate:this.notAfterTime})]})}toJSON(){return{notBeforeTime:this.notBeforeTime,notAfterTime:this.notAfterTime}}}class z{constructor(e={}){this.issuer=Object(a.f)(e,"issuer",z.defaultValues("issuer")),this.serialNumber=Object(a.f)(e,"serialNumber",z.defaultValues("serialNumber")),"issuerUID"in e&&(this.issuerUID=Object(a.f)(e,"issuerUID",z.defaultValues("issuerUID"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"issuer":return new C;case"serialNumber":return new i.m;case"issuerUID":return new i.b;default:throw new Error("Invalid member name for IssuerSerial class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[C.schema(t.issuer||{}),new i.m({name:t.serialNumber||""}),new i.b({optional:!0,name:t.issuerUID||""})]})}fromSchema(e){Object(a.d)(e,["issuer","serialNumber","issuerUID"]);const t=i.D(e,e,z.schema({names:{issuer:{names:{blockName:"issuer"}},serialNumber:"serialNumber",issuerUID:"issuerUID"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for IssuerSerial");this.issuer=new C({schema:t.result.issuer}),this.serialNumber=t.result.serialNumber,"issuerUID"in t.result&&(this.issuerUID=t.result.issuerUID)}toSchema(){const e=new i.v({value:[this.issuer.toSchema(),this.serialNumber]});return"issuerUID"in this&&e.valueBlock.value.push(this.issuerUID),e}toJSON(){const e={issuer:this.issuer.toJSON(),serialNumber:this.serialNumber.toJSON()};return"issuerUID"in this&&(e.issuerUID=this.issuerUID.toJSON()),e}}class Z{constructor(e={}){this.version=Object(a.f)(e,"version",Z.defaultValues("version")),"baseCertificateID"in e&&(this.baseCertificateID=Object(a.f)(e,"baseCertificateID",Z.defaultValues("baseCertificateID"))),"subjectName"in e&&(this.subjectName=Object(a.f)(e,"subjectName",Z.defaultValues("subjectName"))),this.issuer=Object(a.f)(e,"issuer",Z.defaultValues("issuer")),this.signature=Object(a.f)(e,"signature",Z.defaultValues("signature")),this.serialNumber=Object(a.f)(e,"serialNumber",Z.defaultValues("serialNumber")),this.attrCertValidityPeriod=Object(a.f)(e,"attrCertValidityPeriod",Z.defaultValues("attrCertValidityPeriod")),this.attributes=Object(a.f)(e,"attributes",Z.defaultValues("attributes")),"issuerUniqueID"in e&&(this.issuerUniqueID=Object(a.f)(e,"issuerUniqueID",Z.defaultValues("issuerUniqueID"))),"extensions"in e&&(this.extensions=Object(a.f)(e,"extensions",Z.defaultValues("extensions"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"version":return 0;case"baseCertificateID":return new z;case"subjectName":return new C;case"issuer":return{};case"signature":return new d.a;case"serialNumber":return new i.m;case"attrCertValidityPeriod":return new $;case"attributes":return[];case"issuerUniqueID":return new i.b;case"extensions":return new W;default:throw new Error("Invalid member name for AttributeCertificateInfoV1 class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.m({name:t.version||""}),new i.f({value:[new i.g({name:t.baseCertificateID||"",idBlock:{tagClass:3,tagNumber:0},value:z.schema().valueBlock.value}),new i.g({name:t.subjectName||"",idBlock:{tagClass:3,tagNumber:1},value:C.schema().valueBlock.value})]}),C.schema({names:{blockName:t.issuer||""}}),d.a.schema(t.signature||{}),new i.m({name:t.serialNumber||""}),$.schema(t.attrCertValidityPeriod||{}),new i.v({name:t.attributes||"",value:[new i.u({value:b.a.schema()})]}),new i.b({optional:!0,name:t.issuerUniqueID||""}),W.schema(t.extensions||{},!0)]})}fromSchema(e){Object(a.d)(e,["version","baseCertificateID","subjectName","issuer","signature","serialNumber","attrCertValidityPeriod","attributes","issuerUniqueID","extensions"]);const t=i.D(e,e,Z.schema({names:{version:"version",baseCertificateID:"baseCertificateID",subjectName:"subjectName",issuer:"issuer",signature:{names:{blockName:"signature"}},serialNumber:"serialNumber",attrCertValidityPeriod:{names:{blockName:"attrCertValidityPeriod"}},attributes:"attributes",issuerUniqueID:"issuerUniqueID",extensions:{names:{blockName:"extensions"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AttributeCertificateInfoV1");this.version=t.result.version.valueBlock.valueDec,"baseCertificateID"in t.result&&(this.baseCertificateID=new z({schema:new i.v({value:t.result.baseCertificateID.valueBlock.value})})),"subjectName"in t.result&&(this.subjectName=new C({schema:new i.v({value:t.result.subjectName.valueBlock.value})})),this.issuer=t.result.issuer,this.signature=new d.a({schema:t.result.signature}),this.serialNumber=t.result.serialNumber,this.attrCertValidityPeriod=new $({schema:t.result.attrCertValidityPeriod}),this.attributes=Array.from(t.result.attributes.valueBlock.value,e=>new b.a({schema:e})),"issuerUniqueID"in t.result&&(this.issuerUniqueID=t.result.issuerUniqueID),"extensions"in t.result&&(this.extensions=new W({schema:t.result.extensions}))}toSchema(){const e=new i.v({value:[new i.m({value:this.version})]});return"baseCertificateID"in this&&e.valueBlock.value.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),"subjectName"in this&&e.valueBlock.value.push(new i.g({idBlock:{tagClass:3,tagNumber:1},value:this.subjectName.toSchema().valueBlock.value})),e.valueBlock.value.push(this.issuer.toSchema()),e.valueBlock.value.push(this.signature.toSchema()),e.valueBlock.value.push(this.serialNumber),e.valueBlock.value.push(this.attrCertValidityPeriod.toSchema()),e.valueBlock.value.push(new i.v({value:Array.from(this.attributes,e=>e.toSchema())})),"issuerUniqueID"in this&&e.valueBlock.value.push(this.issuerUniqueID),"extensions"in this&&e.valueBlock.value.push(this.extensions.toSchema()),e}toJSON(){const e={version:this.version};return"baseCertificateID"in this&&(e.baseCertificateID=this.baseCertificateID.toJSON()),"subjectName"in this&&(e.subjectName=this.subjectName.toJSON()),e.issuer=this.issuer.toJSON(),e.signature=this.signature.toJSON(),e.serialNumber=this.serialNumber.toJSON(),e.attrCertValidityPeriod=this.attrCertValidityPeriod.toJSON(),e.attributes=Array.from(this.attributes,e=>e.toJSON()),"issuerUniqueID"in this&&(e.issuerUniqueID=this.issuerUniqueID.toJSON()),"extensions"in this&&(e.extensions=this.extensions.toJSON()),e}}class ee{constructor(e={}){this.acinfo=Object(a.f)(e,"acinfo",ee.defaultValues("acinfo")),this.signatureAlgorithm=Object(a.f)(e,"signatureAlgorithm",ee.defaultValues("signatureAlgorithm")),this.signatureValue=Object(a.f)(e,"signatureValue",ee.defaultValues("signatureValue")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"acinfo":return new Z;case"signatureAlgorithm":return new d.a;case"signatureValue":return new i.b;default:throw new Error("Invalid member name for AttributeCertificateV1 class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[Z.schema(t.acinfo||{}),d.a.schema(t.signatureAlgorithm||{}),new i.b({name:t.signatureValue||""})]})}fromSchema(e){Object(a.d)(e,["acinfo","signatureValue","signatureAlgorithm"]);const t=i.D(e,e,ee.schema({names:{acinfo:{names:{blockName:"acinfo"}},signatureAlgorithm:{names:{blockName:"signatureAlgorithm"}},signatureValue:"signatureValue"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AttributeCertificateV1");this.acinfo=new Z({schema:t.result.acinfo}),this.signatureAlgorithm=new d.a({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}toSchema(){return new i.v({value:[this.acinfo.toSchema(),this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){return{acinfo:this.acinfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()}}}class te{constructor(e={}){this.digestedObjectType=Object(a.f)(e,"digestedObjectType",te.defaultValues("digestedObjectType")),"otherObjectTypeID"in e&&(this.otherObjectTypeID=Object(a.f)(e,"otherObjectTypeID",te.defaultValues("otherObjectTypeID"))),this.digestAlgorithm=Object(a.f)(e,"digestAlgorithm",te.defaultValues("digestAlgorithm")),this.objectDigest=Object(a.f)(e,"objectDigest",te.defaultValues("objectDigest")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"digestedObjectType":return new i.h;case"otherObjectTypeID":return new i.p;case"digestAlgorithm":return new d.a;case"objectDigest":return new i.b;default:throw new Error("Invalid member name for ObjectDigestInfo class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.h({name:t.digestedObjectType||""}),new i.p({optional:!0,name:t.otherObjectTypeID||""}),d.a.schema(t.digestAlgorithm||{}),new i.b({name:t.objectDigest||""})]})}fromSchema(e){Object(a.d)(e,["digestedObjectType","otherObjectTypeID","digestAlgorithm","objectDigest"]);const t=i.D(e,e,te.schema({names:{digestedObjectType:"digestedObjectType",otherObjectTypeID:"otherObjectTypeID",digestAlgorithm:{names:{blockName:"digestAlgorithm"}},objectDigest:"objectDigest"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for ObjectDigestInfo");this.digestedObjectType=t.result.digestedObjectType,"otherObjectTypeID"in t.result&&(this.otherObjectTypeID=t.result.otherObjectTypeID),this.digestAlgorithm=new d.a({schema:t.result.digestAlgorithm}),this.objectDigest=t.result.objectDigest}toSchema(){const e=new i.v({value:[this.digestedObjectType]});return"otherObjectTypeID"in this&&e.valueBlock.value.push(this.otherObjectTypeID),e.valueBlock.value.push(this.digestAlgorithm.toSchema()),e.valueBlock.value.push(this.objectDigest),e}toJSON(){const e={digestedObjectType:this.digestedObjectType.toJSON()};return"otherObjectTypeID"in this&&(e.otherObjectTypeID=this.otherObjectTypeID.toJSON()),e.digestAlgorithm=this.digestAlgorithm.toJSON(),e.objectDigest=this.objectDigest.toJSON(),e}}class re{constructor(e={}){"issuerName"in e&&(this.issuerName=Object(a.f)(e,"issuerName",re.defaultValues("issuerName"))),"baseCertificateID"in e&&(this.baseCertificateID=Object(a.f)(e,"baseCertificateID",re.defaultValues("baseCertificateID"))),"objectDigestInfo"in e&&(this.objectDigestInfo=Object(a.f)(e,"objectDigestInfo",re.defaultValues("objectDigestInfo"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"issuerName":return new C;case"baseCertificateID":return new z;case"objectDigestInfo":return new te;default:throw new Error("Invalid member name for V2Form class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[C.schema({names:{blockName:t.issuerName}},!0),new i.g({optional:!0,name:t.baseCertificateID||"",idBlock:{tagClass:3,tagNumber:0},value:z.schema().valueBlock.value}),new i.g({optional:!0,name:t.objectDigestInfo||"",idBlock:{tagClass:3,tagNumber:1},value:te.schema().valueBlock.value})]})}fromSchema(e){Object(a.d)(e,["issuerName","baseCertificateID","objectDigestInfo"]);const t=i.D(e,e,re.schema({names:{issuerName:"issuerName",baseCertificateID:"baseCertificateID",objectDigestInfo:"objectDigestInfo"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for V2Form");"issuerName"in t.result&&(this.issuerName=new C({schema:t.result.issuerName})),"baseCertificateID"in t.result&&(this.baseCertificateID=new z({schema:new i.v({value:t.result.baseCertificateID.valueBlock.value})})),"objectDigestInfo"in t.result&&(this.objectDigestInfo=new te({schema:new i.v({value:t.result.objectDigestInfo.valueBlock.value})}))}toSchema(){const e=new i.v;return"issuerName"in this&&e.valueBlock.value.push(this.issuerName.toSchema()),"baseCertificateID"in this&&e.valueBlock.value.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),"objectDigestInfo"in this&&e.valueBlock.value.push(new i.g({idBlock:{tagClass:3,tagNumber:1},value:this.objectDigestInfo.toSchema().valueBlock.value})),e}toJSON(){const e={};return"issuerName"in this&&(e.issuerName=this.issuerName.toJSON()),"baseCertificateID"in this&&(e.baseCertificateID=this.baseCertificateID.toJSON()),"objectDigestInfo"in this&&(e.objectDigestInfo=this.objectDigestInfo.toJSON()),e}}class ne{constructor(e={}){"baseCertificateID"in e&&(this.baseCertificateID=Object(a.f)(e,"baseCertificateID",ne.defaultValues("baseCertificateID"))),"entityName"in e&&(this.entityName=Object(a.f)(e,"entityName",ne.defaultValues("entityName"))),"objectDigestInfo"in e&&(this.objectDigestInfo=Object(a.f)(e,"objectDigestInfo",ne.defaultValues("objectDigestInfo"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"baseCertificateID":return new z;case"entityName":return new C;case"objectDigestInfo":return new te;default:throw new Error("Invalid member name for Holder class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.g({optional:!0,name:t.baseCertificateID||"",idBlock:{tagClass:3,tagNumber:0},value:z.schema().valueBlock.value}),new i.g({optional:!0,name:t.entityName||"",idBlock:{tagClass:3,tagNumber:1},value:C.schema().valueBlock.value}),new i.g({optional:!0,name:t.objectDigestInfo||"",idBlock:{tagClass:3,tagNumber:2},value:te.schema().valueBlock.value})]})}fromSchema(e){Object(a.d)(e,["baseCertificateID","entityName","objectDigestInfo"]);const t=i.D(e,e,ne.schema({names:{baseCertificateID:"baseCertificateID",entityName:"entityName",objectDigestInfo:"objectDigestInfo"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for Holder");"baseCertificateID"in t.result&&(this.baseCertificateID=new z({schema:new i.v({value:t.result.baseCertificateID.valueBlock.value})})),"entityName"in t.result&&(this.entityName=new C({schema:new i.v({value:t.result.entityName.valueBlock.value})})),"objectDigestInfo"in t.result&&(this.objectDigestInfo=new te({schema:new i.v({value:t.result.objectDigestInfo.valueBlock.value})}))}toSchema(){const e=new i.v;return"baseCertificateID"in this&&e.valueBlock.value.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),"entityName"in this&&e.valueBlock.value.push(new i.g({idBlock:{tagClass:3,tagNumber:1},value:this.entityName.toSchema().valueBlock.value})),"objectDigestInfo"in this&&e.valueBlock.value.push(new i.g({idBlock:{tagClass:3,tagNumber:2},value:this.objectDigestInfo.toSchema().valueBlock.value})),e}toJSON(){const e={};return"baseCertificateID"in this&&(e.baseCertificateID=this.baseCertificateID.toJSON()),"entityName"in this&&(e.entityName=this.entityName.toJSON()),"objectDigestInfo"in this&&(e.objectDigestInfo=this.objectDigestInfo.toJSON()),e}}class se{constructor(e={}){this.version=Object(a.f)(e,"version",se.defaultValues("version")),this.holder=Object(a.f)(e,"holder",se.defaultValues("holder")),this.issuer=Object(a.f)(e,"issuer",se.defaultValues("issuer")),this.signature=Object(a.f)(e,"signature",se.defaultValues("signature")),this.serialNumber=Object(a.f)(e,"serialNumber",se.defaultValues("serialNumber")),this.attrCertValidityPeriod=Object(a.f)(e,"attrCertValidityPeriod",se.defaultValues("attrCertValidityPeriod")),this.attributes=Object(a.f)(e,"attributes",se.defaultValues("attributes")),"issuerUniqueID"in e&&(this.issuerUniqueID=Object(a.f)(e,"issuerUniqueID",se.defaultValues("issuerUniqueID"))),"extensions"in e&&(this.extensions=Object(a.f)(e,"extensions",se.defaultValues("extensions"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"version":return 1;case"holder":return new ne;case"issuer":return{};case"signature":return new d.a;case"serialNumber":return new i.m;case"attrCertValidityPeriod":return new $;case"attributes":return[];case"issuerUniqueID":return new i.b;case"extensions":return new W;default:throw new Error("Invalid member name for AttributeCertificateInfoV2 class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.m({name:t.version||""}),ne.schema(t.holder||{}),new i.f({value:[C.schema({names:{blockName:t.issuer||""}}),new i.g({name:t.issuer||"",idBlock:{tagClass:3,tagNumber:0},value:re.schema().valueBlock.value})]}),d.a.schema(t.signature||{}),new i.m({name:t.serialNumber||""}),$.schema(t.attrCertValidityPeriod||{}),new i.v({name:t.attributes||"",value:[new i.u({value:b.a.schema()})]}),new i.b({optional:!0,name:t.issuerUniqueID||""}),W.schema(t.extensions||{},!0)]})}fromSchema(e){Object(a.d)(e,["version","holder","issuer","signature","serialNumber","attrCertValidityPeriod","attributes","issuerUniqueID","extensions"]);const t=i.D(e,e,se.schema({names:{version:"version",holder:{names:{blockName:"holder"}},issuer:"issuer",signature:{names:{blockName:"signature"}},serialNumber:"serialNumber",attrCertValidityPeriod:{names:{blockName:"attrCertValidityPeriod"}},attributes:"attributes",issuerUniqueID:"issuerUniqueID",extensions:{names:{blockName:"extensions"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AttributeCertificateInfoV2");switch(this.version=t.result.version.valueBlock.valueDec,this.holder=new ne({schema:t.result.holder}),t.result.issuer.idBlock.tagClass){case 3:this.issuer=new re({schema:new i.v({value:t.result.issuer.valueBlock.value})});break;case 1:default:throw new Error("Incorect value for 'issuer' in AttributeCertificateInfoV2")}this.signature=new d.a({schema:t.result.signature}),this.serialNumber=t.result.serialNumber,this.attrCertValidityPeriod=new $({schema:t.result.attrCertValidityPeriod}),this.attributes=Array.from(t.result.attributes.valueBlock.value,e=>new b.a({schema:e})),"issuerUniqueID"in t.result&&(this.issuerUniqueID=t.result.issuerUniqueID),"extensions"in t.result&&(this.extensions=new W({schema:t.result.extensions}))}toSchema(){const e=new i.v({value:[new i.m({value:this.version}),this.holder.toSchema(),new i.g({idBlock:{tagClass:3,tagNumber:0},value:this.issuer.toSchema().valueBlock.value}),this.signature.toSchema(),this.serialNumber,this.attrCertValidityPeriod.toSchema(),new i.v({value:Array.from(this.attributes,e=>e.toSchema())})]});return"issuerUniqueID"in this&&e.valueBlock.value.push(this.issuerUniqueID),"extensions"in this&&e.valueBlock.value.push(this.extensions.toSchema()),e}toJSON(){const e={version:this.version,holder:this.holder.toJSON(),issuer:this.issuer.toJSON(),signature:this.signature.toJSON(),serialNumber:this.serialNumber.toJSON(),attrCertValidityPeriod:this.attrCertValidityPeriod.toJSON(),attributes:Array.from(this.attributes,e=>e.toJSON())};return"issuerUniqueID"in this&&(e.issuerUniqueID=this.issuerUniqueID.toJSON()),"extensions"in this&&(e.extensions=this.extensions.toJSON()),e}}class ie{constructor(e={}){this.acinfo=Object(a.f)(e,"acinfo",ie.defaultValues("acinfo")),this.signatureAlgorithm=Object(a.f)(e,"signatureAlgorithm",ie.defaultValues("signatureAlgorithm")),this.signatureValue=Object(a.f)(e,"signatureValue",ie.defaultValues("signatureValue")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"acinfo":return new se;case"signatureAlgorithm":return new d.a;case"signatureValue":return new i.b;default:throw new Error("Invalid member name for AttributeCertificateV2 class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[se.schema(t.acinfo||{}),d.a.schema(t.signatureAlgorithm||{}),new i.b({name:t.signatureValue||""})]})}fromSchema(e){Object(a.d)(e,["acinfo","signatureAlgorithm","signatureValue"]);const t=i.D(e,e,ie.schema({names:{acinfo:{names:{blockName:"acinfo"}},signatureAlgorithm:{names:{blockName:"signatureAlgorithm"}},signatureValue:"signatureValue"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for AttributeCertificateV2");this.acinfo=new se({schema:t.result.acinfo}),this.signatureAlgorithm=new d.a({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}toSchema(){return new i.v({value:[this.acinfo.toSchema(),this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){return{acinfo:this.acinfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()}}}class ae{constructor(e={}){this.userCertificate=Object(a.f)(e,"userCertificate",ae.defaultValues("userCertificate")),this.revocationDate=Object(a.f)(e,"revocationDate",ae.defaultValues("revocationDate")),"crlEntryExtensions"in e&&(this.crlEntryExtensions=Object(a.f)(e,"crlEntryExtensions",ae.defaultValues("crlEntryExtensions"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"userCertificate":return new i.m;case"revocationDate":return new w;case"crlEntryExtensions":return new W;default:throw new Error("Invalid member name for RevokedCertificate class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.m({name:t.userCertificate||"userCertificate"}),w.schema({names:{utcTimeName:t.revocationDate||"revocationDate",generalTimeName:t.revocationDate||"revocationDate"}}),W.schema({names:{blockName:t.crlEntryExtensions||"crlEntryExtensions"}},!0)]})}fromSchema(e){Object(a.d)(e,["userCertificate","revocationDate","crlEntryExtensions"]);const t=i.D(e,e,ae.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RevokedCertificate");this.userCertificate=t.result.userCertificate,this.revocationDate=new w({schema:t.result.revocationDate}),"crlEntryExtensions"in t.result&&(this.crlEntryExtensions=new W({schema:t.result.crlEntryExtensions}))}toSchema(){const e=[this.userCertificate,this.revocationDate.toSchema()];return"crlEntryExtensions"in this&&e.push(this.crlEntryExtensions.toSchema()),new i.v({value:e})}toJSON(){const e={userCertificate:this.userCertificate.toJSON(),revocationDate:this.revocationDate.toJSON};return"crlEntryExtensions"in this&&(e.crlEntryExtensions=this.crlEntryExtensions.toJSON()),e}}function oe(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"tbsCertList",value:[new i.m({optional:!0,name:t.tbsCertListVersion||"tbsCertList.version",value:2}),d.a.schema(t.signature||{names:{blockName:"tbsCertList.signature"}}),u.schema(t.issuer||{names:{blockName:"tbsCertList.issuer"}}),w.schema(t.tbsCertListThisUpdate||{names:{utcTimeName:"tbsCertList.thisUpdate",generalTimeName:"tbsCertList.thisUpdate"}}),w.schema(t.tbsCertListNextUpdate||{names:{utcTimeName:"tbsCertList.nextUpdate",generalTimeName:"tbsCertList.nextUpdate"}},!0),new i.v({optional:!0,value:[new i.u({name:t.tbsCertListRevokedCertificates||"tbsCertList.revokedCertificates",value:new i.v({value:[new i.m,w.schema(),W.schema({},!0)]})})]}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[W.schema(t.crlExtensions||{names:{blockName:"tbsCertList.extensions"}})]})]})}class ue{constructor(e={}){this.tbs=Object(a.f)(e,"tbs",ue.defaultValues("tbs")),this.version=Object(a.f)(e,"version",ue.defaultValues("version")),this.signature=Object(a.f)(e,"signature",ue.defaultValues("signature")),this.issuer=Object(a.f)(e,"issuer",ue.defaultValues("issuer")),this.thisUpdate=Object(a.f)(e,"thisUpdate",ue.defaultValues("thisUpdate")),"nextUpdate"in e&&(this.nextUpdate=Object(a.f)(e,"nextUpdate",ue.defaultValues("nextUpdate"))),"revokedCertificates"in e&&(this.revokedCertificates=Object(a.f)(e,"revokedCertificates",ue.defaultValues("revokedCertificates"))),"crlExtensions"in e&&(this.crlExtensions=Object(a.f)(e,"crlExtensions",ue.defaultValues("crlExtensions"))),this.signatureAlgorithm=Object(a.f)(e,"signatureAlgorithm",ue.defaultValues("signatureAlgorithm")),this.signatureValue=Object(a.f)(e,"signatureValue",ue.defaultValues("signatureValue")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"tbs":return new ArrayBuffer(0);case"version":return 1;case"signature":return new d.a;case"issuer":return new u;case"thisUpdate":case"nextUpdate":return new w;case"revokedCertificates":return[];case"crlExtensions":return new W;case"signatureAlgorithm":return new d.a;case"signatureValue":return new i.b;default:throw new Error("Invalid member name for CertificateRevocationList class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"CertificateList",value:[oe(e),d.a.schema(t.signatureAlgorithm||{names:{blockName:"signatureAlgorithm"}}),new i.b({name:t.signatureValue||"signatureValue"})]})}fromSchema(e){Object(a.d)(e,["tbsCertList","tbsCertList.version","tbsCertList.signature","tbsCertList.issuer","tbsCertList.thisUpdate","tbsCertList.nextUpdate","tbsCertList.revokedCertificates","tbsCertList.extensions","signatureAlgorithm","signatureValue"]);const t=i.D(e,e,ue.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CertificateRevocationList");this.tbs=t.result.tbsCertList.valueBeforeDecode,"tbsCertList.version"in t.result&&(this.version=t.result["tbsCertList.version"].valueBlock.valueDec),this.signature=new d.a({schema:t.result["tbsCertList.signature"]}),this.issuer=new u({schema:t.result["tbsCertList.issuer"]}),this.thisUpdate=new w({schema:t.result["tbsCertList.thisUpdate"]}),"tbsCertList.nextUpdate"in t.result&&(this.nextUpdate=new w({schema:t.result["tbsCertList.nextUpdate"]})),"tbsCertList.revokedCertificates"in t.result&&(this.revokedCertificates=Array.from(t.result["tbsCertList.revokedCertificates"],e=>new ae({schema:e}))),"tbsCertList.extensions"in t.result&&(this.crlExtensions=new W({schema:t.result["tbsCertList.extensions"]})),this.signatureAlgorithm=new d.a({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){const e=[];return this.version!==ue.defaultValues("version")&&e.push(new i.m({value:this.version})),e.push(this.signature.toSchema()),e.push(this.issuer.toSchema()),e.push(this.thisUpdate.toSchema()),"nextUpdate"in this&&e.push(this.nextUpdate.toSchema()),"revokedCertificates"in this&&e.push(new i.v({value:Array.from(this.revokedCertificates,e=>e.toSchema())})),"crlExtensions"in this&&e.push(new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.crlExtensions.toSchema()]})),new i.v({value:e})}toSchema(e=!1){let t;if(!1===e){if(0===this.tbs.length)return ue.schema();t=i.E(this.tbs).result}else t=this.encodeTBS();return new i.v({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){const e={tbs:Object(a.b)(this.tbs,0,this.tbs.byteLength),signature:this.signature.toJSON(),issuer:this.issuer.toJSON(),thisUpdate:this.thisUpdate.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return this.version!==ue.defaultValues("version")&&(e.version=this.version),"nextUpdate"in this&&(e.nextUpdate=this.nextUpdate.toJSON()),"revokedCertificates"in this&&(e.revokedCertificates=Array.from(this.revokedCertificates,e=>e.toJSON())),"crlExtensions"in this&&(e.crlExtensions=this.crlExtensions.toJSON()),e}isCertificateRevoked(e){if(!1===this.issuer.isEqual(e.issuer))return!1;if("revokedCertificates"in this==!1)return!1;for(const t of this.revokedCertificates)if(t.userCertificate.isEqual(e.serialNumber))return!0;return!1}sign(e,t="SHA-1"){if(void 0===e)return Promise.reject("Need to provide a private key for signing");let r,n=Promise.resolve();const a=Object(s.e)();return n=n.then(()=>a.subtle.getSignatureParameters(e,t)),n=n.then(e=>{r=e.parameters,this.signature=e.signatureAlgorithm,this.signatureAlgorithm=e.signatureAlgorithm}),n=n.then(()=>{this.tbs=this.encodeTBS().toBER(!1)}),n=n.then(()=>a.subtle.signWithPrivateKey(this.tbs,e,r)),n=n.then(e=>{this.signatureValue=new i.b({valueHex:e})}),n}verify(e={}){let t=Promise.resolve(),r=-1;const n=Object(s.e)();if("issuerCertificate"in e&&(r=e.issuerCertificate.subjectPublicKeyInfo,!1===this.issuer.isEqual(e.issuerCertificate.subject)))return Promise.resolve(!1);if("publicKeyInfo"in e&&(r=e.publicKeyInfo),"subjectPublicKey"in r==!1)return Promise.reject("Issuer's certificate must be provided as an input parameter");if("crlExtensions"in this)for(const e of this.crlExtensions.extensions)if(e.critical&&"parsedValue"in e==!1)return Promise.resolve(!1);return t=t.then(()=>n.subtle.verifyWithPublicKey(this.tbs,this.signatureValue,r,this.signatureAlgorithm)),t}}class ce{constructor(e={}){this.otherCertFormat=Object(a.f)(e,"otherCertFormat",ce.defaultValues("otherCertFormat")),this.otherCert=Object(a.f)(e,"otherCert",ce.defaultValues("otherCert")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"otherCertFormat":return"";case"otherCert":return new i.a;default:throw new Error("Invalid member name for OtherCertificateFormat class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.otherCertFormat||"otherCertFormat"}),new i.a({name:t.otherCert||"otherCert"})]})}fromSchema(e){Object(a.d)(e,["otherCertFormat","otherCert"]);const t=i.D(e,e,ce.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for OtherCertificateFormat");this.otherCertFormat=t.result.otherCertFormat.valueBlock.toString(),this.otherCert=t.result.otherCert}toSchema(){return new i.v({value:[new i.p({value:this.otherCertFormat}),this.otherCert]})}toJSON(){const e={otherCertFormat:this.otherCertFormat};return this.otherCert instanceof i.a||(e.otherCert=this.otherCert.toJSON()),e}}class le{constructor(e={}){this.certificates=Object(a.f)(e,"certificates",le.defaultValues("certificates")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"certificates":return[];default:throw new Error("Invalid member name for Attribute class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.w({name:t.blockName||"",value:[new i.u({name:t.certificates||"certificates",value:new i.f({value:[Q.schema(),new i.g({idBlock:{tagClass:3,tagNumber:0},value:[new i.a]}),new i.g({idBlock:{tagClass:3,tagNumber:1},value:[new i.v]}),new i.g({idBlock:{tagClass:3,tagNumber:2},value:ie.schema().valueBlock.value}),new i.g({idBlock:{tagClass:3,tagNumber:3},value:ce.schema().valueBlock.value})]})})]})}fromSchema(e){Object(a.d)(e,["certificates"]);const t=i.D(e,e,le.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CertificateSet");this.certificates=Array.from(t.result.certificates||[],e=>{const t=e.idBlock.tagNumber;if(1===e.idBlock.tagClass)return new Q({schema:e});const r=new i.v({value:e.valueBlock.value});switch(t){case 1:return 1===r.valueBlock.value[0].valueBlock.value[0].valueBlock.valueDec?new ie({schema:r}):new ee({schema:r});case 2:return new ie({schema:r});case 3:return new ce({schema:r})}return e})}toSchema(){return new i.w({value:Array.from(this.certificates,e=>{switch(!0){case e instanceof Q:return e.toSchema();case e instanceof ee:return new i.g({idBlock:{tagClass:3,tagNumber:1},value:e.toSchema().valueBlock.value});case e instanceof ie:return new i.g({idBlock:{tagClass:3,tagNumber:2},value:e.toSchema().valueBlock.value});case e instanceof ce:return new i.g({idBlock:{tagClass:3,tagNumber:3},value:e.toSchema().valueBlock.value})}return e})})}toJSON(){return{certificates:Array.from(this.certificates,e=>e.toJSON())}}}class he{constructor(e={}){this.otherRevInfoFormat=Object(a.f)(e,"otherRevInfoFormat",he.defaultValues("otherRevInfoFormat")),this.otherRevInfo=Object(a.f)(e,"otherRevInfo",he.defaultValues("otherRevInfo")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"otherRevInfoFormat":return"";case"otherRevInfo":return new i.a;default:throw new Error("Invalid member name for OtherRevocationInfoFormat class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.otherRevInfoFormat||"otherRevInfoFormat"}),new i.a({name:t.otherRevInfo||"otherRevInfo"})]})}fromSchema(e){Object(a.d)(e,["otherRevInfoFormat","otherRevInfo"]);const t=i.D(e,e,he.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for OtherRevocationInfoFormat");this.otherRevInfoFormat=t.result.otherRevInfoFormat.valueBlock.toString(),this.otherRevInfo=t.result.otherRevInfo}toSchema(){return new i.v({value:[new i.p({value:this.otherRevInfoFormat}),this.otherRevInfo]})}toJSON(){const e={otherRevInfoFormat:this.otherRevInfoFormat};return this.otherRevInfo instanceof i.a||(e.otherRevInfo=this.otherRevInfo.toJSON()),e}}class fe{constructor(e={}){this.crls=Object(a.f)(e,"crls",fe.defaultValues("crls")),this.otherRevocationInfos=Object(a.f)(e,"otherRevocationInfos",fe.defaultValues("otherRevocationInfos")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"crls":case"otherRevocationInfos":return[];default:throw new Error("Invalid member name for RevocationInfoChoices class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.w({name:t.blockName||"",value:[new i.u({name:t.crls||"",value:new i.f({value:[ue.schema(),new i.g({idBlock:{tagClass:3,tagNumber:1},value:[new i.p,new i.a]})]})})]})}fromSchema(e){Object(a.d)(e,["crls"]);const t=i.D(e,e,fe.schema({names:{crls:"crls"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for RevocationInfoChoices");for(const e of t.result.crls)1===e.idBlock.tagClass?this.crls.push(new ue({schema:e})):this.otherRevocationInfos.push(new he({schema:e}))}toSchema(){const e=[];return e.push(...Array.from(this.crls,e=>e.toSchema())),e.push(...Array.from(this.otherRevocationInfos,e=>{const t=e.toSchema();return t.idBlock.tagClass=3,t.idBlock.tagNumber=1,t})),new i.w({value:e})}toJSON(){return{crls:Array.from(this.crls,e=>e.toJSON()),otherRevocationInfos:Array.from(this.otherRevocationInfos,e=>e.toJSON())}}}class me{constructor(e={}){this.issuer=Object(a.f)(e,"issuer",me.defaultValues("issuer")),this.serialNumber=Object(a.f)(e,"serialNumber",me.defaultValues("serialNumber")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"issuer":return new u;case"serialNumber":return new i.m;default:throw new Error("Invalid member name for IssuerAndSerialNumber class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[u.schema(t.issuer||{}),new i.m({name:t.serialNumber||""})]})}fromSchema(e){Object(a.d)(e,["issuer","serialNumber"]);const t=i.D(e,e,me.schema({names:{issuer:{names:{blockName:"issuer"}},serialNumber:"serialNumber"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for IssuerAndSerialNumber");this.issuer=new u({schema:t.result.issuer}),this.serialNumber=t.result.serialNumber}toSchema(){return new i.v({value:[this.issuer.toSchema(),this.serialNumber]})}toJSON(){return{issuer:this.issuer.toJSON(),serialNumber:this.serialNumber.toJSON()}}}r(10);class pe{constructor(e={}){this.hashAlgorithm=Object(a.f)(e,"hashAlgorithm",pe.defaultValues("hashAlgorithm")),this.issuerNameHash=Object(a.f)(e,"issuerNameHash",pe.defaultValues("issuerNameHash")),this.issuerKeyHash=Object(a.f)(e,"issuerKeyHash",pe.defaultValues("issuerKeyHash")),this.serialNumber=Object(a.f)(e,"serialNumber",pe.defaultValues("serialNumber")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"hashAlgorithm":return new d.a;case"issuerNameHash":case"issuerKeyHash":return new i.q;case"serialNumber":return new i.m;default:throw new Error("Invalid member name for CertID class: "+e)}}static compareWithDefault(e,t){switch(e){case"hashAlgorithm":return""===t.algorithmId&&"algorithmParams"in t==!1;case"issuerNameHash":case"issuerKeyHash":case"serialNumber":return t.isEqual(pe.defaultValues(e));default:throw new Error("Invalid member name for CertID class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[d.a.schema(t.hashAlgorithmObject||{names:{blockName:t.hashAlgorithm||""}}),new i.q({name:t.issuerNameHash||""}),new i.q({name:t.issuerKeyHash||""}),new i.m({name:t.serialNumber||""})]})}fromSchema(e){Object(a.d)(e,["hashAlgorithm","issuerNameHash","issuerKeyHash","serialNumber"]);const t=i.D(e,e,pe.schema({names:{hashAlgorithm:"hashAlgorithm",issuerNameHash:"issuerNameHash",issuerKeyHash:"issuerKeyHash",serialNumber:"serialNumber"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for CertID");this.hashAlgorithm=new d.a({schema:t.result.hashAlgorithm}),this.issuerNameHash=t.result.issuerNameHash,this.issuerKeyHash=t.result.issuerKeyHash,this.serialNumber=t.result.serialNumber}toSchema(){return new i.v({value:[this.hashAlgorithm.toSchema(),this.issuerNameHash,this.issuerKeyHash,this.serialNumber]})}toJSON(){return{hashAlgorithm:this.hashAlgorithm.toJSON(),issuerNameHash:this.issuerNameHash.toJSON(),issuerKeyHash:this.issuerKeyHash.toJSON(),serialNumber:this.serialNumber.toJSON()}}isEqual(e){return!this.hashAlgorithm.algorithmId!==e.hashAlgorithm.algorithmId&&(!1!==Object(a.g)(this.issuerNameHash.valueBlock.valueHex,e.issuerNameHash.valueBlock.valueHex)&&(!1!==Object(a.g)(this.issuerKeyHash.valueBlock.valueHex,e.issuerKeyHash.valueBlock.valueHex)&&!!this.serialNumber.isEqual(e.serialNumber)))}createForCertificate(e,t){let r,n=Promise.resolve();const a=Object(s.d)();if(void 0===a)return Promise.reject("Unable to create WebCrypto object");if("hashAlgorithm"in t==!1)return Promise.reject('Parameter "hashAlgorithm" is mandatory for "OCSP_REQUEST.createForCertificate"');const o=Object(s.f)({name:t.hashAlgorithm});return""===o?Promise.reject('Incorrect "hashAlgorithm": '+this.hashAlgorithm):(this.hashAlgorithm=new d.a({algorithmId:o,algorithmParams:new i.n}),"issuerCertificate"in t?(r=t.issuerCertificate,this.serialNumber=e.serialNumber,n=n.then(()=>a.digest({name:t.hashAlgorithm},r.subject.toSchema().toBER(!1)),e=>Promise.reject(e)),n=n.then(e=>{this.issuerNameHash=new i.q({valueHex:e});const n=r.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHex;return a.digest({name:t.hashAlgorithm},n)},e=>Promise.reject(e)).then(e=>{this.issuerKeyHash=new i.q({valueHex:e})},e=>Promise.reject(e)),n):Promise.reject('Parameter "issuerCertificate" is mandatory for "OCSP_REQUEST.createForCertificate"'))}}class de{constructor(e={}){this.certID=Object(a.f)(e,"certID",de.defaultValues("certID")),this.certStatus=Object(a.f)(e,"certStatus",de.defaultValues("certStatus")),this.thisUpdate=Object(a.f)(e,"thisUpdate",de.defaultValues("thisUpdate")),"nextUpdate"in e&&(this.nextUpdate=Object(a.f)(e,"nextUpdate",de.defaultValues("nextUpdate"))),"singleExtensions"in e&&(this.singleExtensions=Object(a.f)(e,"singleExtensions",de.defaultValues("singleExtensions"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"certID":return new pe;case"certStatus":return{};case"thisUpdate":case"nextUpdate":return new Date(0,0,0);case"singleExtensions":return[];default:throw new Error("Invalid member name for SingleResponse class: "+e)}}static compareWithDefault(e,t){switch(e){case"certID":return pe.compareWithDefault("hashAlgorithm",t.hashAlgorithm)&&pe.compareWithDefault("issuerNameHash",t.issuerNameHash)&&pe.compareWithDefault("issuerKeyHash",t.issuerKeyHash)&&pe.compareWithDefault("serialNumber",t.serialNumber);case"certStatus":return 0===Object.keys(t).length;case"thisUpdate":case"nextUpdate":return t===de.defaultValues(e);default:throw new Error("Invalid member name for SingleResponse class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[pe.schema(t.certID||{}),new i.f({value:[new i.r({name:t.certStatus||"",idBlock:{tagClass:3,tagNumber:0},lenBlockLength:1}),new i.g({name:t.certStatus||"",idBlock:{tagClass:3,tagNumber:1},value:[new i.j,new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.h]})]}),new i.r({name:t.certStatus||"",idBlock:{tagClass:3,tagNumber:2},lenBlock:{length:1}})]}),new i.j({name:t.thisUpdate||""}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.j({name:t.nextUpdate||""})]}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[W.schema(t.singleExtensions||{})]})]})}fromSchema(e){Object(a.d)(e,["certID","certStatus","thisUpdate","nextUpdate","singleExtensions"]);const t=i.D(e,e,de.schema({names:{certID:{names:{blockName:"certID"}},certStatus:"certStatus",thisUpdate:"thisUpdate",nextUpdate:"nextUpdate",singleExtensions:{names:{blockName:"singleExtensions"}}}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for SingleResponse");this.certID=new pe({schema:t.result.certID}),this.certStatus=t.result.certStatus,this.thisUpdate=t.result.thisUpdate.toDate(),"nextUpdate"in t.result&&(this.nextUpdate=t.result.nextUpdate.toDate()),"singleExtensions"in t.result&&(this.singleExtensions=Array.from(t.result.singleExtensions.valueBlock.value,e=>new X({schema:e})))}toSchema(){const e=[];return e.push(this.certID.toSchema()),e.push(this.certStatus),e.push(new i.j({valueDate:this.thisUpdate})),"nextUpdate"in this&&e.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:[new i.j({valueDate:this.nextUpdate})]})),"singleExtensions"in this&&e.push(new i.v({value:Array.from(this.singleExtensions,e=>e.toSchema())})),new i.v({value:e})}toJSON(){const e={certID:this.certID.toJSON(),certStatus:this.certStatus.toJSON(),thisUpdate:this.thisUpdate};return"nextUpdate"in this&&(e.nextUpdate=this.nextUpdate),"singleExtensions"in this&&(e.singleExtensions=Array.from(this.singleExtensions,e=>e.toJSON())),e}}class ge{constructor(e={}){this.tbs=Object(a.f)(e,"tbs",ge.defaultValues("tbs")),this.responderID=Object(a.f)(e,"responderID",ge.defaultValues("responderID")),this.producedAt=Object(a.f)(e,"producedAt",ge.defaultValues("producedAt")),this.responses=Object(a.f)(e,"responses",ge.defaultValues("responses")),"responseExtensions"in e&&(this.responseExtensions=Object(a.f)(e,"responseExtensions",ge.defaultValues("responseExtensions"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"tbs":return new ArrayBuffer(0);case"responderID":return{};case"producedAt":return new Date(0,0,0);case"responses":case"responseExtensions":return[];default:throw new Error("Invalid member name for ResponseData class: "+e)}}static compareWithDefault(e,t){switch(e){case"tbs":return 0===t.byteLength;case"responderID":return 0===Object.keys(t).length;case"producedAt":return t===ge.defaultValues(e);case"responses":case"responseExtensions":return 0===t.length;default:throw new Error("Invalid member name for ResponseData class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"ResponseData",value:[new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.m({name:t.version||"ResponseData.version"})]}),new i.f({value:[new i.g({name:t.responderID||"ResponseData.responderID",idBlock:{tagClass:3,tagNumber:1},value:[u.schema(t.ResponseDataByName||{names:{blockName:"ResponseData.byName"}})]}),new i.g({name:t.responderID||"ResponseData.responderID",idBlock:{tagClass:3,tagNumber:2},value:[new i.q({name:t.ResponseDataByKey||"ResponseData.byKey"})]})]}),new i.j({name:t.producedAt||"ResponseData.producedAt"}),new i.v({value:[new i.u({name:"ResponseData.responses",value:de.schema(t.response||{})})]}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[W.schema(t.extensions||{names:{blockName:"ResponseData.responseExtensions"}})]})]})}fromSchema(e){Object(a.d)(e,["ResponseData","ResponseData.version","ResponseData.responderID","ResponseData.producedAt","ResponseData.responses","ResponseData.responseExtensions"]);const t=i.D(e,e,ge.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for ResponseData");this.tbs=t.result.ResponseData.valueBeforeDecode,"ResponseData.version"in t.result&&(this.version=t.result["ResponseData.version"].valueBlock.valueDec),1===t.result["ResponseData.responderID"].idBlock.tagNumber?this.responderID=new u({schema:t.result["ResponseData.responderID"].valueBlock.value[0]}):this.responderID=t.result["ResponseData.responderID"].valueBlock.value[0],this.producedAt=t.result["ResponseData.producedAt"].toDate(),this.responses=Array.from(t.result["ResponseData.responses"],e=>new de({schema:e})),"ResponseData.responseExtensions"in t.result&&(this.responseExtensions=Array.from(t.result["ResponseData.responseExtensions"].valueBlock.value,e=>new X({schema:e})))}toSchema(e=!1){let t;if(!1===e){if(0===this.tbs.length)return ge.schema();t=i.E(this.tbs).result}else{const e=[];"version"in this&&e.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:[new i.m({value:this.version})]})),this.responderID instanceof u?e.push(new i.g({idBlock:{tagClass:3,tagNumber:1},value:[this.responderID.toSchema()]})):e.push(new i.g({idBlock:{tagClass:3,tagNumber:2},value:[this.responderID]})),e.push(new i.j({valueDate:this.producedAt})),e.push(new i.v({value:Array.from(this.responses,e=>e.toSchema())})),"responseExtensions"in this&&e.push(new i.g({idBlock:{tagClass:3,tagNumber:1},value:[new i.v({value:Array.from(this.responseExtensions,e=>e.toSchema())})]})),t=new i.v({value:e})}return t}toJSON(){const e={};return"version"in this&&(e.version=this.version),"responderID"in this&&(e.responderID=this.responderID),"producedAt"in this&&(e.producedAt=this.producedAt),"responses"in this&&(e.responses=Array.from(this.responses,e=>e.toJSON())),"responseExtensions"in this&&(e.responseExtensions=Array.from(this.responseExtensions,e=>e.toJSON())),e}}class be{constructor(e={}){this.trustedCerts=Object(a.f)(e,"trustedCerts",this.defaultValues("trustedCerts")),this.certs=Object(a.f)(e,"certs",this.defaultValues("certs")),this.crls=Object(a.f)(e,"crls",this.defaultValues("crls")),this.ocsps=Object(a.f)(e,"ocsps",this.defaultValues("ocsps")),this.checkDate=Object(a.f)(e,"checkDate",this.defaultValues("checkDate")),this.findOrigin=Object(a.f)(e,"findOrigin",this.defaultValues("findOrigin")),this.findIssuer=Object(a.f)(e,"findIssuer",this.defaultValues("findIssuer"))}static defaultFindOrigin(e,t){0===e.tbs.byteLength&&(e.tbs=e.encodeTBS());for(const r of t.certs)if(0===r.tbs.byteLength&&(r.tbs=r.encodeTBS()),Object(a.g)(e.tbs,r.tbs))return"Intermediate Certificates";for(const r of t.trustedCerts)if(0===r.tbs.byteLength&&(r.tbs=r.encodeTBS()),Object(a.g)(e.tbs,r.tbs))return"Trusted Certificates";return"Unknown"}async defaultFindIssuer(e,t){let r=[],n=null,s=null,i=null;if(e.subject.isEqual(e.issuer))try{if(!0===await e.verify())return[e]}catch(e){}if("extensions"in e)for(const t of e.extensions)if("2.5.29.35"===t.extnID){"keyIdentifier"in t.parsedValue?n=t.parsedValue.keyIdentifier:("authorityCertIssuer"in t.parsedValue&&(s=t.parsedValue.authorityCertIssuer),"authorityCertSerialNumber"in t.parsedValue&&(i=t.parsedValue.authorityCertSerialNumber));break}function o(t){if(null!==n&&"extensions"in t){let e=!1;for(const s of t.extensions)if("2.5.29.14"===s.extnID){e=!0,Object(a.g)(s.parsedValue.valueBlock.valueHex,n.valueBlock.valueHex)&&r.push(t);break}if(e)return}let o=!1;null!==i&&(o=t.serialNumber.isEqual(i)),null!==s?t.subject.isEqual(s)&&o&&r.push(t):e.issuer.isEqual(t.subject)&&r.push(t)}for(const e of t.trustedCerts)o(e);for(const e of t.certs)o(e);for(let t=0;t<r.length;t++)try{!1===await e.verify(r[t])&&r.splice(t,1)}catch(e){r.splice(t,1)}return r}defaultValues(e){switch(e){case"trustedCerts":case"certs":case"crls":case"ocsps":return[];case"checkDate":return new Date;case"findOrigin":return be.defaultFindOrigin;case"findIssuer":return this.defaultFindIssuer;default:throw new Error("Invalid member name for CertificateChainValidationEngine class: "+e)}}async sort(e=!1){const t=[],r=this;async function n(e){const n=[],s=[],i=[];if(n.push(...t.filter(t=>e.issuer.isEqual(t.subject))),0===n.length)return{status:1,statusMessage:"No certificate's issuers"};if(s.push(...r.crls.filter(t=>t.issuer.isEqual(e.issuer))),0===s.length)return{status:2,statusMessage:"No CRLs for specific certificate issuer"};for(let e=0;e<s.length;e++)if(!(s[e].nextUpdate.value<r.checkDate))for(let t=0;t<n.length;t++)try{if(await s[e].verify({issuerCertificate:n[t]})){i.push({crl:s[e],certificate:n[t]});break}}catch(e){}return i.length?{status:0,statusMessage:"",result:i}:{status:3,statusMessage:"No valid CRLs found"}}async function i(e,t){const n=Object(s.c)(e.signatureAlgorithm.algorithmId);if("name"in n==!1)return 1;if("hash"in n==!1)return 1;for(let n=0;n<r.ocsps.length;n++){const s=await r.ocsps[n].getCertificateStatus(e,t);if(s.isForCertificate)return 0===s.status?0:1}return 2}async function o(e,t=!1){let r=!1,n=!1,s=!1,i=!1;if("extensions"in e){for(let t=0;t<e.extensions.length;t++){if(!0===e.extensions[t].critical&&"parsedValue"in e.extensions[t]==!1)return{result:!1,resultCode:6,resultMessage:"Unable to parse critical certificate extension: "+e.extensions[t].extnID};if("2.5.29.15"===e.extensions[t].extnID){s=!0;const r=new Uint8Array(e.extensions[t].parsedValue.valueBlock.valueHex);4==(4&r[0])&&(n=!0),2==(2&r[0])&&(i=!0)}"2.5.29.19"===e.extensions[t].extnID&&"cA"in e.extensions[t].parsedValue&&!0===e.extensions[t].parsedValue.cA&&(r=!0)}if(!0===n&&!1===r)return{result:!1,resultCode:3,resultMessage:'Unable to build certificate chain - using "keyCertSign" flag set without BasicConstaints'};if(!0===s&&!0===r&&!1===n)return{result:!1,resultCode:4,resultMessage:'Unable to build certificate chain - "keyCertSign" flag was not set'};if(!0===r&&!0===s&&t&&!1===i)return{result:!1,resultCode:5,resultMessage:'Unable to build certificate chain - intermediate certificate must have "cRLSign" key usage flag'}}return!1===r?{result:!1,resultCode:7,resultMessage:"Unable to build certificate chain - more than one possible end-user certificate"}:{result:!0,resultCode:0,resultMessage:""}}t.push(...r.trustedCerts),t.push(...r.certs);for(let e=0;e<t.length;e++)for(let r=0;r<t.length;r++)if(e!==r&&Object(a.g)(t[e].tbs,t[r].tbs)){t.splice(r,1),e=0;break}let u;const c=[t[t.length-1]];if(u=await async function e(t){const n=[];function s(e){let t=!0;for(let r=0;r<e.length;r++){for(let n=0;n<e.length;n++)if(n!==r&&e[r]===e[n]){t=!1;break}if(!t)break}return t}const i=await r.findIssuer(t,r);if(0===i.length)throw new Error("No valid certificate paths found");for(let r=0;r<i.length;r++){if(Object(a.g)(i[r].tbs,t.tbs)){n.push([i[r]]);continue}const o=await e(i[r]);for(let e=0;e<o.length;e++){const t=o[e].slice();t.splice(0,0,i[r]),s(t)?n.push(t):n.push(o[e])}}return n}(t[t.length-1]),0===u.length)return{result:!1,resultCode:60,resultMessage:"Unable to find certificate path"};for(let e=0;e<u.length;e++){let t=!1;for(let n=0;n<u[e].length;n++){const s=u[e][n];for(let e=0;e<r.trustedCerts.length;e++)if(Object(a.g)(s.tbs,r.trustedCerts[e].tbs)){t=!0;break}if(t)break}t||(u.splice(e,1),e=0)}if(0===u.length)throw{result:!1,resultCode:97,resultMessage:"No valid certificate paths found"};let l=u[0].length,h=0;for(let e=0;e<u.length;e++)u[e].length<l&&(l=u[e].length,h=e);for(let e=0;e<u[h].length;e++)c.push(u[h][e]);if(u=await async function(t,s){for(let e=0;e<t.length;e++)if(t[e].notBefore.value>s||t[e].notAfter.value<s)return{result:!1,resultCode:8,resultMessage:"The certificate is either not yet valid or expired"};if(t.length<2)return{result:!1,resultCode:9,resultMessage:"Too short certificate path"};for(let e=t.length-2;e>=0;e--)if(!1===t[e].issuer.isEqual(t[e].subject)&&!1===t[e].issuer.isEqual(t[e+1].subject))return{result:!1,resultCode:10,resultMessage:"Incorrect name chaining"};if(0!==r.crls.length||0!==r.ocsps.length)for(let s=0;s<t.length-1;s++){let a=2,u={status:0,statusMessage:""};if(0!==r.ocsps.length)switch(a=await i(t[s],t[s+1]),a){case 0:continue;case 1:return{result:!1,resultCode:12,resultMessage:"One of certificates was revoked via OCSP response"}}if(0!==r.crls.length){if(u=await n(t[s]),0===u.status)for(let e=0;e<u.result.length;e++){if(u.result[e].crl.isCertificateRevoked(t[s]))return{result:!1,resultCode:12,resultMessage:"One of certificates had been revoked"};if(!1===(await o(u.result[e].certificate,!0)).result)return{result:!1,resultCode:13,resultMessage:"CRL issuer certificate is not a CA certificate or does not have crlSign flag"}}else if(!1===e)throw{result:!1,resultCode:11,resultMessage:"No revocation values found for one of certificates: "+u.statusMessage}}else if(2===a)return{result:!1,resultCode:11,resultMessage:"No revocation values found for one of certificates"};if(2===a&&2===u.status&&e){const e=t[s+1];let r=!1;if("extensions"in e)for(const t of e.extensions)switch(t.extnID){case"2.5.29.31":case"2.5.29.46":case"1.3.6.1.5.5.7.1.1":r=!0}if(r)throw{result:!1,resultCode:11,resultMessage:"No revocation values found for one of certificates: "+u.statusMessage}}}for(let e=1;e<t.length;e++){if(!1===(await o(t[e])).result)return{result:!1,resultCode:14,resultMessage:"One of intermediate certificates is not a CA certificate"}}return{result:!0}}(c,r.checkDate),!1===u.result)throw u;return c}async verify(e={}){function t(e,t){const r=Object(s.j)(e),n=Object(s.j)(t),i=r.split("."),a=n.split("."),o=i.length,u=a.length;if(0===o||0===u||o<u)return!1;for(let e=0;e<o;e++)if(0===i[e].length)return!1;for(let e=0;e<u;e++)if(0===a[e].length){if(0===e){if(1===u)return!1;continue}return!1}for(let e=0;e<u;e++)if(0!==a[u-1-e].length&&0!==i[o-1-e].localeCompare(a[u-1-e]))return!1;return!0}function r(e,r){const n=Object(s.j)(e),i=Object(s.j)(r),a=n.split("@"),o=i.split("@");if(0===a.length||0===o.length||a.length<o.length)return!1;if(1===o.length){if(t(a[1],o[0])){const e=a[1].split("."),t=o[0].split(".");return 0===t[0].length||e.length===t.length}return!1}return 0===n.localeCompare(i)}function n(e,r){let n=Object(s.j)(e);const i=Object(s.j)(r),a=n.split("/");if(i.split("/").length>1)return!1;if(a.length>1)for(let e=0;e<a.length;e++)if(a[e].length>0&&":"!==a[e].charAt(a[e].length-1)){n=a[e].split(":")[0];break}if(t(n,i)){const e=n.split("."),t=i.split(".");return 0===t[0].length||e.length===t.length}return!1}function i(e,t){const r=new Uint8Array(e.valueBlock.valueHex),n=new Uint8Array(t.valueBlock.valueHex);if(4===r.length&&8===n.length){for(let e=0;e<4;e++)if((r[e]^n[e])&n[e+4])return!1;return!0}if(16===r.length&&32===n.length){for(let e=0;e<16;e++)if((r[e]^n[e])&n[e+16])return!1;return!0}return!1}function a(e,t){if(0===e.typesAndValues.length||0===t.typesAndValues.length)return!0;if(e.typesAndValues.length<t.typesAndValues.length)return!1;let r=!0,n=0;for(let s=0;s<t.typesAndValues.length;s++){let i=!1;for(let a=n;a<e.typesAndValues.length;a++)if(i=e.typesAndValues[a].isEqual(t.typesAndValues[s]),e.typesAndValues[a].type===t.typesAndValues[s].type&&(r=r&&i),!0===i){if(0===n||n===a){n=a+1;break}return!1}if(!1===i)return!1}return 0!==n&&r}try{if(0===this.certs.length)throw"Empty certificate array";let s=!1;"passedWhenNotRevValues"in e&&(s=e.passedWhenNotRevValues);let o=[];o.push("2.5.29.32.0");let u=!1,c=!1,l=!1,h=[],f=[],m=[];"initialPolicySet"in e&&(o=e.initialPolicySet),"initialExplicitPolicy"in e&&(u=e.initialExplicitPolicy),"initialPolicyMappingInhibit"in e&&(c=e.initialPolicyMappingInhibit),"initialInhibitPolicy"in e&&(l=e.initialInhibitPolicy),"initialPermittedSubtreesSet"in e&&(h=e.initialPermittedSubtreesSet),"initialExcludedSubtreesSet"in e&&(f=e.initialExcludedSubtreesSet),"initialRequiredNameForms"in e&&(m=e.initialRequiredNameForms);let p=u,d=c,g=l;const b=new Array(3);b[0]=!1,b[1]=!1,b[2]=!1;let y=0,w=0,v=0,N=h,A=f;const S=m;let E=1;this.certs=await this.sort(s);const C=[];C.push("2.5.29.32.0");const k=[],O=new Array(this.certs.length-1);for(let e=0;e<this.certs.length-1;e++)O[e]=!0;k.push(O);const I=new Array(this.certs.length-1),x=new Array(this.certs.length-1);let B=p?this.certs.length-1:-1;for(let e=this.certs.length-2;e>=0;e--,E++)if("extensions"in this.certs[e]){for(let t=0;t<this.certs[e].extensions.length;t++){if("2.5.29.32"===this.certs[e].extensions[t].extnID){x[e]=this.certs[e].extensions[t].parsedValue;for(let t=0;t<C.length;t++)if("2.5.29.32.0"===C[t]){delete k[t][e];break}for(let r=0;r<this.certs[e].extensions[t].parsedValue.certificatePolicies.length;r++){let n=-1;for(let s=0;s<C.length;s++)if(this.certs[e].extensions[t].parsedValue.certificatePolicies[r].policyIdentifier===C[s]){n=s;break}if(-1===n){C.push(this.certs[e].extensions[t].parsedValue.certificatePolicies[r].policyIdentifier);const n=new Array(this.certs.length-1);n[e]=!0,k.push(n)}else k[n][e]=!0}}if("2.5.29.33"===this.certs[e].extensions[t].extnID){if(d)return{result:!1,resultCode:98,resultMessage:"Policy mapping prohibited"};I[e]=this.certs[e].extensions[t].parsedValue}"2.5.29.36"===this.certs[e].extensions[t].extnID&&!1===p&&(0===this.certs[e].extensions[t].parsedValue.requireExplicitPolicy?(p=!0,B=e):!1===b[0]?(b[0]=!0,y=this.certs[e].extensions[t].parsedValue.requireExplicitPolicy):y=y>this.certs[e].extensions[t].parsedValue.requireExplicitPolicy?this.certs[e].extensions[t].parsedValue.requireExplicitPolicy:y,0===this.certs[e].extensions[t].parsedValue.inhibitPolicyMapping?d=!0:!1===b[1]?(b[1]=!0,w=this.certs[e].extensions[t].parsedValue.inhibitPolicyMapping+1):w=w>this.certs[e].extensions[t].parsedValue.inhibitPolicyMapping+1?this.certs[e].extensions[t].parsedValue.inhibitPolicyMapping+1:w),"2.5.29.54"===this.certs[e].extensions[t].extnID&&!1===g&&(0===this.certs[e].extensions[t].parsedValue.valueBlock.valueDec?g=!0:!1===b[2]?(b[2]=!0,v=this.certs[e].extensions[t].parsedValue.valueBlock.valueDec):v=v>this.certs[e].extensions[t].parsedValue.valueBlock.valueDec?this.certs[e].extensions[t].parsedValue.valueBlock.valueDec:v)}if(!0===g){let t=-1;for(let e=0;e<C.length;e++)if("2.5.29.32.0"===C[e]){t=e;break}-1!==t&&delete k[0][e]}!1===p&&!0===b[0]&&(y--,0===y&&(p=!0,B=e,b[0]=!1)),!1===d&&!0===b[1]&&(w--,0===w&&(d=!0,b[1]=!1)),!1===g&&!0===b[2]&&(v--,0===v&&(g=!0,b[2]=!1))}for(let e=0;e<this.certs.length-1;e++)if(e<this.certs.length-2&&void 0!==I[e+1])for(let t=0;t<I[e+1].mappings.length;t++){if("2.5.29.32.0"===I[e+1].mappings[t].issuerDomainPolicy||"2.5.29.32.0"===I[e+1].mappings[t].subjectDomainPolicy)return{result:!1,resultCode:99,resultMessage:'The "anyPolicy" should not be a part of policy mapping scheme'};let r=-1,n=-1;for(let s=0;s<C.length;s++)C[s]===I[e+1].mappings[t].issuerDomainPolicy&&(r=s),C[s]===I[e+1].mappings[t].subjectDomainPolicy&&(n=s);void 0!==k[r][e]&&delete k[r][e];for(let s=0;s<x[e].certificatePolicies.length;s++)if(I[e+1].mappings[t].subjectDomainPolicy===x[e].certificatePolicies[s].policyIdentifier&&-1!==r&&-1!==n)for(let t=0;t<=e;t++)void 0!==k[n][t]&&(k[r][t]=!0,delete k[n][t])}for(let e=0;e<C.length;e++)if("2.5.29.32.0"===C[e])for(let t=0;t<B;t++)delete k[e][t];const D=[];for(let e=0;e<k.length;e++){let t=!0;for(let r=0;r<this.certs.length-1;r++){let n=!1;if(r<B&&"2.5.29.32.0"===C[e]&&C.length>1){t=!1;break}if(void 0===k[e][r]){if(r>=B)for(let e=0;e<C.length;e++)if("2.5.29.32.0"===C[e]){!0===k[e][r]&&(n=!0);break}if(!n){t=!1;break}}}!0===t&&D.push(C[e])}let T=[];if(1===o.length&&"2.5.29.32.0"===o[0]&&!1===p)T=o;else if(1===D.length&&"2.5.29.32.0"===D[0])T=o;else for(let e=0;e<D.length;e++)for(let t=0;t<o.length;t++)if(o[t]===D[e]||"2.5.29.32.0"===o[t]){T.push(D[e]);break}const P={result:T.length>0,resultCode:0,resultMessage:T.length>0?"":'Zero "userConstrPolicies" array, no intersections with "authConstrPolicies"',authConstrPolicies:D,userConstrPolicies:T,explicitPolicyIndicator:p,policyMappings:I,certificatePath:this.certs};if(0===T.length)return P;if(!1===P.result)return P;E=1;for(let e=this.certs.length-2;e>=0;e--,E++){let s=[],o=[],u=[];if("extensions"in this.certs[e])for(let t=0;t<this.certs[e].extensions.length;t++)"2.5.29.30"===this.certs[e].extensions[t].extnID&&("permittedSubtrees"in this.certs[e].extensions[t].parsedValue&&(o=o.concat(this.certs[e].extensions[t].parsedValue.permittedSubtrees)),"excludedSubtrees"in this.certs[e].extensions[t].parsedValue&&(u=u.concat(this.certs[e].extensions[t].parsedValue.excludedSubtrees))),"2.5.29.17"===this.certs[e].extensions[t].extnID&&(s=s.concat(this.certs[e].extensions[t].parsedValue.altNames));let c=S.length<=0;for(let t=0;t<S.length;t++)switch(S[t].base.type){case 4:if(S[t].base.value.typesAndValues.length!==this.certs[e].subject.typesAndValues.length)continue;c=!0;for(let r=0;r<this.certs[e].subject.typesAndValues.length;r++)if(this.certs[e].subject.typesAndValues[r].type!==S[t].base.value.typesAndValues[r].type){c=!1;break}if(!0===c)break}if(!1===c)throw P.result=!1,P.resultCode=21,P.resultMessage="No neccessary name form found",P;const l=[];l[0]=[],l[1]=[],l[2]=[],l[3]=[],l[4]=[];for(let e=0;e<N.length;e++)switch(N[e].base.type){case 1:l[0].push(N[e]);break;case 2:l[1].push(N[e]);break;case 4:l[2].push(N[e]);break;case 6:l[3].push(N[e]);break;case 7:l[4].push(N[e])}for(let o=0;o<5;o++){let u=!1,c=!1;const h=l[o];for(let l=0;l<h.length;l++){switch(o){case 0:if(s.length>0)for(let e=0;e<s.length;e++)1===s[e].type&&(c=!0,u=u||r(s[e].value,h[l].base.value));else for(let t=0;t<this.certs[e].subject.typesAndValues.length;t++)"1.2.840.113549.1.9.1"!==this.certs[e].subject.typesAndValues[t].type&&"0.9.2342.19200300.100.1.3"!==this.certs[e].subject.typesAndValues[t].type||(c=!0,u=u||r(this.certs[e].subject.typesAndValues[t].value.valueBlock.value,h[l].base.value));break;case 1:if(s.length>0)for(let e=0;e<s.length;e++)2===s[e].type&&(c=!0,u=u||t(s[e].value,h[l].base.value));break;case 2:c=!0,u=a(this.certs[e].subject,h[l].base.value);break;case 3:if(s.length>0)for(let e=0;e<s.length;e++)6===s[e].type&&(c=!0,u=u||n(s[e].value,h[l].base.value));break;case 4:if(s.length>0)for(let e=0;e<s.length;e++)7===s[e].type&&(c=!0,u=u||i(s[e].value,h[l].base.value))}if(u)break}if(!1===u&&h.length>0&&c)throw P.result=!1,P.resultCode=41,P.resultMessage='Failed to meet "permitted sub-trees" name constraint',P}let h=!1;for(let o=0;o<A.length;o++){switch(A[o].base.type){case 1:if(s.length>=0)for(let e=0;e<s.length;e++)1===s[e].type&&(h=h||r(s[e].value,A[o].base.value));else for(let t=0;t<this.certs[e].subject.typesAndValues.length;t++)"1.2.840.113549.1.9.1"!==this.certs[e].subject.typesAndValues[t].type&&"0.9.2342.19200300.100.1.3"!==this.certs[e].subject.typesAndValues[t].type||(h=h||r(this.certs[e].subject.typesAndValues[t].value.valueBlock.value,A[o].base.value));break;case 2:if(s.length>0)for(let e=0;e<s.length;e++)2===s[e].type&&(h=h||t(s[e].value,A[o].base.value));break;case 4:h=h||a(this.certs[e].subject,A[o].base.value);break;case 6:if(s.length>0)for(let e=0;e<s.length;e++)6===s[e].type&&(h=h||n(s[e].value,A[o].base.value));break;case 7:if(s.length>0)for(let e=0;e<s.length;e++)7===s[e].type&&(h=h||i(s[e].value,A[o].base.value))}if(h)break}if(!0===h)throw P.result=!1,P.resultCode=42,P.resultMessage='Failed to meet "excluded sub-trees" name constraint',P;N=N.concat(o),A=A.concat(u)}return P}catch(e){if(e instanceof Object){if("resultMessage"in e)return e;if("message"in e)return{result:!1,resultCode:-1,resultMessage:e.message}}return{result:!1,resultCode:-1,resultMessage:e}}}}class ye{constructor(e={}){this.tbsResponseData=Object(a.f)(e,"tbsResponseData",ye.defaultValues("tbsResponseData")),this.signatureAlgorithm=Object(a.f)(e,"signatureAlgorithm",ye.defaultValues("signatureAlgorithm")),this.signature=Object(a.f)(e,"signature",ye.defaultValues("signature")),"certs"in e&&(this.certs=Object(a.f)(e,"certs",ye.defaultValues("certs"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"tbsResponseData":return new ge;case"signatureAlgorithm":return new d.a;case"signature":return new i.b;case"certs":return[];default:throw new Error("Invalid member name for BasicOCSPResponse class: "+e)}}static compareWithDefault(e,t){switch(e){case"type":{let e=ge.compareWithDefault("tbs",t.tbs)&&ge.compareWithDefault("responderID",t.responderID)&&ge.compareWithDefault("producedAt",t.producedAt)&&ge.compareWithDefault("responses",t.responses);return"responseExtensions"in t&&(e=e&&ge.compareWithDefault("responseExtensions",t.responseExtensions)),e}case"signatureAlgorithm":return""===t.algorithmId&&"algorithmParams"in t==!1;case"signature":return t.isEqual(ye.defaultValues(e));case"certs":return 0===t.length;default:throw new Error("Invalid member name for BasicOCSPResponse class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"BasicOCSPResponse",value:[ge.schema(t.tbsResponseData||{names:{blockName:"BasicOCSPResponse.tbsResponseData"}}),d.a.schema(t.signatureAlgorithm||{names:{blockName:"BasicOCSPResponse.signatureAlgorithm"}}),new i.b({name:t.signature||"BasicOCSPResponse.signature"}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.v({value:[new i.u({name:"BasicOCSPResponse.certs",value:Q.schema(t.certs||{})})]})]})]})}fromSchema(e){Object(a.d)(e,["BasicOCSPResponse.tbsResponseData","BasicOCSPResponse.signatureAlgorithm","BasicOCSPResponse.signature","BasicOCSPResponse.certs"]);const t=i.D(e,e,ye.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for BasicOCSPResponse");this.tbsResponseData=new ge({schema:t.result["BasicOCSPResponse.tbsResponseData"]}),this.signatureAlgorithm=new d.a({schema:t.result["BasicOCSPResponse.signatureAlgorithm"]}),this.signature=t.result["BasicOCSPResponse.signature"],"BasicOCSPResponse.certs"in t.result&&(this.certs=Array.from(t.result["BasicOCSPResponse.certs"],e=>new Q({schema:e})))}toSchema(){const e=[];return e.push(this.tbsResponseData.toSchema()),e.push(this.signatureAlgorithm.toSchema()),e.push(this.signature),"certs"in this&&e.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:[new i.v({value:Array.from(this.certs,e=>e.toSchema())})]})),new i.v({value:e})}toJSON(){const e={tbsResponseData:this.tbsResponseData.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signature:this.signature.toJSON()};return"certs"in this&&(e.certs=Array.from(this.certs,e=>e.toJSON())),e}getCertificateStatus(e,t){let r=Promise.resolve();const n={isForCertificate:!1,status:2},i={},a=[],o=[];for(const r of this.tbsResponseData.responses){const n=Object(s.c)(r.certID.hashAlgorithm.algorithmId);if("name"in n==!1)return Promise.reject("Wrong CertID hashing algorithm: "+r.certID.hashAlgorithm.algorithmId);if(n.name in i==!1){i[n.name]=1;const r=new pe;a.push(r),o.push(r.createForCertificate(e,{hashAlgorithm:n.name,issuerCertificate:t}))}}return r=r.then(()=>Promise.all(o)),r=r.then(()=>{for(const e of this.tbsResponseData.responses)for(const t of a)if(e.certID.isEqual(t)){n.isForCertificate=!0;try{switch(e.certStatus.idBlock.isConstructed){case!0:1===e.certStatus.idBlock.tagNumber&&(n.status=1);break;case!1:switch(e.certStatus.idBlock.tagNumber){case 0:n.status=0;break;case 2:n.status=2}}}catch(e){}return n}return n}),r}sign(e,t="SHA-1"){if(void 0===e)return Promise.reject("Need to provide a private key for signing");let r,n=Promise.resolve();const a=Object(s.e)();return n=n.then(()=>a.subtle.getSignatureParameters(e,t)),n=n.then(e=>{r=e.parameters,this.signatureAlgorithm=e.signatureAlgorithm}),n=n.then(()=>{this.tbsResponseData.tbs=this.tbsResponseData.toSchema(!0).toBER(!1)}),n=n.then(()=>a.subtle.signWithPrivateKey(this.tbsResponseData.tbs,e,r)),n=n.then(e=>{this.signature=new i.b({valueHex:e})}),n}verify(e={}){let t=null,r=-1,n=Promise.resolve(),o=[];const c=this,l=Object(s.e)();if("certs"in this==!1)return Promise.reject("No certificates attached to the BasicOCSPResponce");"trustedCerts"in e&&(o=e.trustedCerts);const h=Object(s.d)();if(void 0===h)return Promise.reject("Unable to create WebCrypto object");switch(!0){case this.tbsResponseData.responderID instanceof u:n=n.then(()=>{for(const[e,t]of c.certs.entries())if(t.subject.isEqual(c.tbsResponseData.responderID)){r=e;break}});break;case this.tbsResponseData.responderID instanceof i.q:n=n.then(()=>Promise.all(Array.from(c.certs,e=>h.digest({name:"sha-1"},new Uint8Array(e.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHex)))).then(e=>{for(const[t]of c.certs.entries())if(Object(a.g)(e[t],c.tbsResponseData.responderID.valueBlock.valueHex)){r=t;break}}));break;default:return Promise.reject("Wrong value for responderID")}return n=n.then(()=>-1===r?Promise.reject("Correct certificate was not found in OCSP response"):(t=this.certs[r],Promise.all(Array.from(c.certs,e=>function(e){if(!0===e.issuer.isEqual(t.issuer)&&!0===e.serialNumber.isEqual(t.serialNumber))return null;let r=!1;for(const t of e.extensions)"2.5.29.19"===t.extnID&&"cA"in t.parsedValue&&!0===t.parsedValue.cA&&(r=!0);return r?e:null}(e))).then(e=>{const r=[];r.push(t);for(const t of e)null!==t&&r.push(t);return new be({certs:r,trustedCerts:o}).verify().then(e=>!0===e.result?Promise.resolve():Promise.reject("Validation of signer's certificate failed"),e=>Promise.reject("Validation of signer's certificate failed with error: "+(e instanceof Object?e.resultMessage:e)))},e=>Promise.reject("Error during checking certificates for CA flag: "+e)))),n=n.then(()=>l.subtle.verifyWithPublicKey(this.tbsResponseData.tbs,this.signature,this.certs[r].subjectPublicKeyInfo,this.signatureAlgorithm)),n}}var we=r(20);r(16),r(8);class ve{constructor(e={}){if(this.eContentType=Object(a.f)(e,"eContentType",ve.defaultValues("eContentType")),"eContent"in e&&(this.eContent=Object(a.f)(e,"eContent",ve.defaultValues("eContent")),1===this.eContent.idBlock.tagClass&&4===this.eContent.idBlock.tagNumber&&!1===this.eContent.idBlock.isConstructed)){const e=new i.q({idBlock:{isConstructed:!0},isConstructed:!0});let t=0,r=this.eContent.valueBlock.valueHex.byteLength;for(;r>0;){const n=new Uint8Array(this.eContent.valueBlock.valueHex,t,t+65536>this.eContent.valueBlock.valueHex.byteLength?this.eContent.valueBlock.valueHex.byteLength-t:65536),s=new ArrayBuffer(n.length),a=new Uint8Array(s);for(let e=0;e<a.length;e++)a[e]=n[e];e.valueBlock.value.push(new i.q({valueHex:s})),r-=n.length,t+=n.length}this.eContent=e}"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"eContentType":return"";case"eContent":return new i.q;default:throw new Error("Invalid member name for EncapsulatedContentInfo class: "+e)}}static compareWithDefault(e,t){switch(e){case"eContentType":return""===t;case"eContent":return 1===t.idBlock.tagClass&&4===t.idBlock.tagNumber&&t.isEqual(ve.defaultValues("eContent"));default:throw new Error("Invalid member name for EncapsulatedContentInfo class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[new i.p({name:t.eContentType||""}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new i.a({name:t.eContent||""})]})]})}fromSchema(e){Object(a.d)(e,["eContentType","eContent"]);const t=i.D(e,e,ve.schema({names:{eContentType:"eContentType",eContent:"eContent"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for EncapsulatedContentInfo");this.eContentType=t.result.eContentType.valueBlock.toString(),"eContent"in t.result&&(this.eContent=t.result.eContent)}toSchema(){const e=[];return e.push(new i.p({value:this.eContentType})),"eContent"in this&&!1===ve.compareWithDefault("eContent",this.eContent)&&e.push(new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.eContent]})),new i.v({value:e})}toJSON(){const e={eContentType:this.eContentType};return"eContent"in this&&!1===ve.compareWithDefault("eContent",this.eContent)&&(e.eContent=this.eContent.toJSON()),e}}y.a;class Ne{constructor(e={}){this.hashAlgorithm=Object(a.f)(e,"hashAlgorithm",Ne.defaultValues("hashAlgorithm")),this.hashedMessage=Object(a.f)(e,"hashedMessage",Ne.defaultValues("hashedMessage")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"hashAlgorithm":return new d.a;case"hashedMessage":return new i.q;default:throw new Error("Invalid member name for MessageImprint class: "+e)}}static compareWithDefault(e,t){switch(e){case"hashAlgorithm":return""===t.algorithmId&&"algorithmParams"in t==!1;case"hashedMessage":return 0===t.isEqual(Ne.defaultValues(e));default:throw new Error("Invalid member name for MessageImprint class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"",value:[d.a.schema(t.hashAlgorithm||{}),new i.q({name:t.hashedMessage||""})]})}fromSchema(e){Object(a.d)(e,["hashAlgorithm","hashedMessage"]);const t=i.D(e,e,Ne.schema({names:{hashAlgorithm:{names:{blockName:"hashAlgorithm"}},hashedMessage:"hashedMessage"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for MessageImprint");this.hashAlgorithm=new d.a({schema:t.result.hashAlgorithm}),this.hashedMessage=t.result.hashedMessage}toSchema(){return new i.v({value:[this.hashAlgorithm.toSchema(),this.hashedMessage]})}toJSON(){return{hashAlgorithm:this.hashAlgorithm.toJSON(),hashedMessage:this.hashedMessage.toJSON()}}}r(12),r(18);class Ae{constructor(e={}){this.type=Object(a.f)(e,"type",Ae.defaultValues("type")),this.attributes=Object(a.f)(e,"attributes",Ae.defaultValues("attributes")),this.encodedValue=Object(a.f)(e,"encodedValue",Ae.defaultValues("encodedValue")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"type":return-1;case"attributes":return[];case"encodedValue":return new ArrayBuffer(0);default:throw new Error("Invalid member name for SignedAndUnsignedAttributes class: "+e)}}static compareWithDefault(e,t){switch(e){case"type":return t===Ae.defaultValues("type");case"attributes":return 0===t.length;case"encodedValue":return 0===t.byteLength;default:throw new Error("Invalid member name for SignedAndUnsignedAttributes class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.g({name:t.blockName||"",optional:!0,idBlock:{tagClass:3,tagNumber:t.tagNumber},value:[new i.u({name:t.attributes||"",value:b.a.schema()})]})}fromSchema(e){Object(a.d)(e,["attributes"]);const t=i.D(e,e,Ae.schema({names:{tagNumber:this.type,attributes:"attributes"}}));if(!1===t.verified)throw new Error("Object's schema was not verified against input data for SignedAndUnsignedAttributes");this.type=t.result.idBlock.tagNumber,this.encodedValue=t.result.valueBeforeDecode;if(new Uint8Array(this.encodedValue)[0]=49,"attributes"in t.result!=!1)this.attributes=Array.from(t.result.attributes,e=>new b.a({schema:e}));else if(0===this.type)throw new Error("Wrong structure of SignedUnsignedAttributes")}toSchema(){if(Ae.compareWithDefault("type",this.type)||Ae.compareWithDefault("attributes",this.attributes))throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class');return new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:this.type},value:Array.from(this.attributes,e=>e.toSchema())})}toJSON(){if(Ae.compareWithDefault("type",this.type)||Ae.compareWithDefault("attributes",this.attributes))throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class');return{type:this.type,attributes:Array.from(this.attributes,e=>e.toJSON())}}}class Se{constructor(e={}){this.version=Object(a.f)(e,"version",Se.defaultValues("version")),this.sid=Object(a.f)(e,"sid",Se.defaultValues("sid")),this.digestAlgorithm=Object(a.f)(e,"digestAlgorithm",Se.defaultValues("digestAlgorithm")),"signedAttrs"in e&&(this.signedAttrs=Object(a.f)(e,"signedAttrs",Se.defaultValues("signedAttrs"))),this.signatureAlgorithm=Object(a.f)(e,"signatureAlgorithm",Se.defaultValues("signatureAlgorithm")),this.signature=Object(a.f)(e,"signature",Se.defaultValues("signature")),"unsignedAttrs"in e&&(this.unsignedAttrs=Object(a.f)(e,"unsignedAttrs",Se.defaultValues("unsignedAttrs"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"version":return 0;case"sid":return new i.a;case"digestAlgorithm":return new d.a;case"signedAttrs":return new Ae({type:0});case"signatureAlgorithm":return new d.a;case"signature":return new i.q;case"unsignedAttrs":return new Ae({type:1});default:throw new Error("Invalid member name for SignerInfo class: "+e)}}static compareWithDefault(e,t){switch(e){case"version":return Se.defaultValues("version")===t;case"sid":return t instanceof i.a;case"digestAlgorithm":return t instanceof d.a!=!1&&t.isEqual(Se.defaultValues("digestAlgorithm"));case"signedAttrs":return Ae.compareWithDefault("type",t.type)&&Ae.compareWithDefault("attributes",t.attributes)&&Ae.compareWithDefault("encodedValue",t.encodedValue);case"signatureAlgorithm":return t instanceof d.a!=!1&&t.isEqual(Se.defaultValues("signatureAlgorithm"));case"signature":case"unsignedAttrs":return Ae.compareWithDefault("type",t.type)&&Ae.compareWithDefault("attributes",t.attributes)&&Ae.compareWithDefault("encodedValue",t.encodedValue);default:throw new Error("Invalid member name for SignerInfo class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:"SignerInfo",value:[new i.m({name:t.version||"SignerInfo.version"}),new i.f({value:[me.schema(t.sid||{names:{blockName:"SignerInfo.sid"}}),new i.f({value:[new i.g({optional:!0,name:t.sid||"SignerInfo.sid",idBlock:{tagClass:3,tagNumber:0},value:[new i.q]}),new i.r({optional:!0,name:t.sid||"SignerInfo.sid",idBlock:{tagClass:3,tagNumber:0},value:[new i.q]})]})]}),d.a.schema(t.digestAlgorithm||{names:{blockName:"SignerInfo.digestAlgorithm"}}),Ae.schema(t.signedAttrs||{names:{blockName:"SignerInfo.signedAttrs",tagNumber:0}}),d.a.schema(t.signatureAlgorithm||{names:{blockName:"SignerInfo.signatureAlgorithm"}}),new i.q({name:t.signature||"SignerInfo.signature"}),Ae.schema(t.unsignedAttrs||{names:{blockName:"SignerInfo.unsignedAttrs",tagNumber:1}})]})}fromSchema(e){Object(a.d)(e,["SignerInfo.version","SignerInfo.sid","SignerInfo.digestAlgorithm","SignerInfo.signedAttrs","SignerInfo.signatureAlgorithm","SignerInfo.signature","SignerInfo.unsignedAttrs"]);const t=i.D(e,e,Se.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for SignerInfo");this.version=t.result["SignerInfo.version"].valueBlock.valueDec;const r=t.result["SignerInfo.sid"];1===r.idBlock.tagClass?this.sid=new me({schema:r}):this.sid=r,this.digestAlgorithm=new d.a({schema:t.result["SignerInfo.digestAlgorithm"]}),"SignerInfo.signedAttrs"in t.result&&(this.signedAttrs=new Ae({type:0,schema:t.result["SignerInfo.signedAttrs"]})),this.signatureAlgorithm=new d.a({schema:t.result["SignerInfo.signatureAlgorithm"]}),this.signature=t.result["SignerInfo.signature"],"SignerInfo.unsignedAttrs"in t.result&&(this.unsignedAttrs=new Ae({type:1,schema:t.result["SignerInfo.unsignedAttrs"]}))}toSchema(){if(Se.compareWithDefault("sid",this.sid))throw new Error('Incorrectly initialized "SignerInfo" class');const e=[];return e.push(new i.m({value:this.version})),this.sid instanceof me?e.push(this.sid.toSchema()):e.push(this.sid),e.push(this.digestAlgorithm.toSchema()),"signedAttrs"in this&&!1===Se.compareWithDefault("signedAttrs",this.signedAttrs)&&e.push(this.signedAttrs.toSchema()),e.push(this.signatureAlgorithm.toSchema()),e.push(this.signature),"unsignedAttrs"in this&&!1===Se.compareWithDefault("unsignedAttrs",this.unsignedAttrs)&&e.push(this.unsignedAttrs.toSchema()),new i.v({value:e})}toJSON(){if(Se.compareWithDefault("sid",this.sid))throw new Error('Incorrectly initialized "SignerInfo" class');const e={version:this.version};return this.sid instanceof i.a||(e.sid=this.sid.toJSON()),e.digestAlgorithm=this.digestAlgorithm.toJSON(),!1===Se.compareWithDefault("signedAttrs",this.signedAttrs)&&(e.signedAttrs=this.signedAttrs.toJSON()),e.signatureAlgorithm=this.signatureAlgorithm.toJSON(),e.signature=this.signature.toJSON(),!1===Se.compareWithDefault("unsignedAttrs",this.unsignedAttrs)&&(e.unsignedAttrs=this.unsignedAttrs.toJSON()),e}}class Ee{constructor(e={}){this.version=Object(a.f)(e,"version",Ee.defaultValues("version")),this.policy=Object(a.f)(e,"policy",Ee.defaultValues("policy")),this.messageImprint=Object(a.f)(e,"messageImprint",Ee.defaultValues("messageImprint")),this.serialNumber=Object(a.f)(e,"serialNumber",Ee.defaultValues("serialNumber")),this.genTime=Object(a.f)(e,"genTime",Ee.defaultValues("genTime")),"accuracy"in e&&(this.accuracy=Object(a.f)(e,"accuracy",Ee.defaultValues("accuracy"))),"ordering"in e&&(this.ordering=Object(a.f)(e,"ordering",Ee.defaultValues("ordering"))),"nonce"in e&&(this.nonce=Object(a.f)(e,"nonce",Ee.defaultValues("nonce"))),"tsa"in e&&(this.tsa=Object(a.f)(e,"tsa",Ee.defaultValues("tsa"))),"extensions"in e&&(this.extensions=Object(a.f)(e,"extensions",Ee.defaultValues("extensions"))),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"version":return 0;case"policy":return"";case"messageImprint":return new Ne;case"serialNumber":return new i.m;case"genTime":return new Date(0,0,0);case"accuracy":return new p;case"ordering":return!1;case"nonce":return new i.m;case"tsa":return new f;case"extensions":return[];default:throw new Error("Invalid member name for TSTInfo class: "+e)}}static compareWithDefault(e,t){switch(e){case"version":case"policy":case"genTime":case"ordering":return t===Ee.defaultValues(e);case"messageImprint":return Ne.compareWithDefault("hashAlgorithm",t.hashAlgorithm)&&Ne.compareWithDefault("hashedMessage",t.hashedMessage);case"serialNumber":case"nonce":return t.isEqual(Ee.defaultValues(e));case"accuracy":return p.compareWithDefault("seconds",t.seconds)&&p.compareWithDefault("millis",t.millis)&&p.compareWithDefault("micros",t.micros);case"tsa":return f.compareWithDefault("type",t.type)&&f.compareWithDefault("value",t.value);case"extensions":return 0===t.length;default:throw new Error("Invalid member name for TSTInfo class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return new i.v({name:t.blockName||"TSTInfo",value:[new i.m({name:t.version||"TSTInfo.version"}),new i.p({name:t.policy||"TSTInfo.policy"}),Ne.schema(t.messageImprint||{names:{blockName:"TSTInfo.messageImprint"}}),new i.m({name:t.serialNumber||"TSTInfo.serialNumber"}),new i.j({name:t.genTime||"TSTInfo.genTime"}),p.schema(t.accuracy||{names:{blockName:"TSTInfo.accuracy"}}),new i.d({name:t.ordering||"TSTInfo.ordering",optional:!0}),new i.m({name:t.nonce||"TSTInfo.nonce",optional:!0}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[f.schema(t.tsa||{names:{blockName:"TSTInfo.tsa"}})]}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new i.u({name:t.extensions||"TSTInfo.extensions",value:X.schema(t.extension||{})})]})]})}fromSchema(e){Object(a.d)(e,["TSTInfo.version","TSTInfo.policy","TSTInfo.messageImprint","TSTInfo.serialNumber","TSTInfo.genTime","TSTInfo.accuracy","TSTInfo.ordering","TSTInfo.nonce","TSTInfo.tsa","TSTInfo.extensions"]);const t=i.D(e,e,Ee.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for TSTInfo");this.version=t.result["TSTInfo.version"].valueBlock.valueDec,this.policy=t.result["TSTInfo.policy"].valueBlock.toString(),this.messageImprint=new Ne({schema:t.result["TSTInfo.messageImprint"]}),this.serialNumber=t.result["TSTInfo.serialNumber"],this.genTime=t.result["TSTInfo.genTime"].toDate(),"TSTInfo.accuracy"in t.result&&(this.accuracy=new p({schema:t.result["TSTInfo.accuracy"]})),"TSTInfo.ordering"in t.result&&(this.ordering=t.result["TSTInfo.ordering"].valueBlock.value),"TSTInfo.nonce"in t.result&&(this.nonce=t.result["TSTInfo.nonce"]),"TSTInfo.tsa"in t.result&&(this.tsa=new f({schema:t.result["TSTInfo.tsa"]})),"TSTInfo.extensions"in t.result&&(this.extensions=Array.from(t.result["TSTInfo.extensions"],e=>new X({schema:e})))}toSchema(){const e=[];return e.push(new i.m({value:this.version})),e.push(new i.p({value:this.policy})),e.push(this.messageImprint.toSchema()),e.push(this.serialNumber),e.push(new i.j({valueDate:this.genTime})),"accuracy"in this&&e.push(this.accuracy.toSchema()),"ordering"in this&&e.push(new i.d({value:this.ordering})),"nonce"in this&&e.push(this.nonce),"tsa"in this&&e.push(new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.tsa.toSchema()]})),"extensions"in this&&e.push(new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.extensions,e=>e.toSchema())})),new i.v({value:e})}toJSON(){const e={version:this.version,policy:this.policy,messageImprint:this.messageImprint.toJSON(),serialNumber:this.serialNumber.toJSON(),genTime:this.genTime};return"accuracy"in this&&(e.accuracy=this.accuracy.toJSON()),"ordering"in this&&(e.ordering=this.ordering),"nonce"in this&&(e.nonce=this.nonce.toJSON()),"tsa"in this&&(e.tsa=this.tsa.toJSON()),"extensions"in this&&(e.extensions=Array.from(this.extensions,e=>e.toJSON())),e}verify(e={}){let t,r=Promise.resolve(),n=null,i=null;const o=Object(s.d)();if(void 0===o)return Promise.reject("Unable to create WebCrypto object");if(!("data"in e))return Promise.reject('"data" is a mandatory attribute for TST_INFO verification');if(t=e.data,"notBefore"in e&&(n=e.notBefore),"notAfter"in e&&(i=e.notAfter),null!==n&&this.genTime<n)return Promise.reject("Generation time for TSTInfo object is less than notBefore value");if(null!==i&&this.genTime>i)return Promise.reject("Generation time for TSTInfo object is more than notAfter value");const u=Object(s.c)(this.messageImprint.hashAlgorithm.algorithmId);return"name"in u==!1?Promise.reject("Unsupported signature algorithm: "+this.messageImprint.hashAlgorithm.algorithmId):(r=r.then(()=>o.digest(u.name,new Uint8Array(t))).then(e=>Object(a.g)(e,this.messageImprint.hashedMessage.valueBlock.valueHex)),r)}}class Ce{constructor(e={}){this.version=Object(a.f)(e,"version",Ce.defaultValues("version")),this.digestAlgorithms=Object(a.f)(e,"digestAlgorithms",Ce.defaultValues("digestAlgorithms")),this.encapContentInfo=Object(a.f)(e,"encapContentInfo",Ce.defaultValues("encapContentInfo")),"certificates"in e&&(this.certificates=Object(a.f)(e,"certificates",Ce.defaultValues("certificates"))),"crls"in e&&(this.crls=Object(a.f)(e,"crls",Ce.defaultValues("crls"))),"ocsps"in e&&(this.ocsps=Object(a.f)(e,"ocsps",Ce.defaultValues("ocsps"))),this.signerInfos=Object(a.f)(e,"signerInfos",Ce.defaultValues("signerInfos")),"schema"in e&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"version":return 0;case"digestAlgorithms":return[];case"encapContentInfo":return new ve;case"certificates":case"crls":case"ocsps":case"signerInfos":return[];default:throw new Error("Invalid member name for SignedData class: "+e)}}static compareWithDefault(e,t){switch(e){case"version":return t===Ce.defaultValues("version");case"encapContentInfo":return new ve;case"digestAlgorithms":case"certificates":case"crls":case"ocsps":case"signerInfos":return 0===t.length;default:throw new Error("Invalid member name for SignedData class: "+e)}}static schema(e={}){const t=Object(a.f)(e,"names",{});return"optional"in t==!1&&(t.optional=!1),new i.v({name:t.blockName||"SignedData",optional:t.optional,value:[new i.m({name:t.version||"SignedData.version"}),new i.w({value:[new i.u({name:t.digestAlgorithms||"SignedData.digestAlgorithms",value:d.a.schema()})]}),ve.schema(t.encapContentInfo||{names:{blockName:"SignedData.encapContentInfo"}}),new i.g({name:t.certificates||"SignedData.certificates",optional:!0,idBlock:{tagClass:3,tagNumber:0},value:le.schema().valueBlock.value}),new i.g({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:fe.schema(t.crls||{names:{crls:"SignedData.crls"}}).valueBlock.value}),new i.w({value:[new i.u({name:t.signerInfos||"SignedData.signerInfos",value:Se.schema()})]})]})}fromSchema(e){Object(a.d)(e,["SignedData.version","SignedData.digestAlgorithms","SignedData.encapContentInfo","SignedData.certificates","SignedData.crls","SignedData.signerInfos"]);const t=i.D(e,e,Ce.schema());if(!1===t.verified)throw new Error("Object's schema was not verified against input data for SignedData");if(this.version=t.result["SignedData.version"].valueBlock.valueDec,"SignedData.digestAlgorithms"in t.result&&(this.digestAlgorithms=Array.from(t.result["SignedData.digestAlgorithms"],e=>new d.a({schema:e}))),this.encapContentInfo=new ve({schema:t.result["SignedData.encapContentInfo"]}),"SignedData.certificates"in t.result){const e=new le({schema:new i.w({value:t.result["SignedData.certificates"].valueBlock.value})});this.certificates=e.certificates.slice(0)}"SignedData.crls"in t.result&&(this.crls=Array.from(t.result["SignedData.crls"],e=>1===e.idBlock.tagClass?new ue({schema:e}):(e.idBlock.tagClass=1,e.idBlock.tagNumber=16,new he({schema:e})))),"SignedData.signerInfos"in t.result&&(this.signerInfos=Array.from(t.result["SignedData.signerInfos"],e=>new Se({schema:e})))}toSchema(e=!1){const t=[];if(this.certificates&&this.certificates.length&&this.certificates.some(e=>e instanceof ce)||this.crls&&this.crls.length&&this.crls.some(e=>e instanceof he)?this.version=5:this.certificates&&this.certificates.length&&this.certificates.some(e=>e instanceof ie)?this.version=4:this.certificates&&this.certificates.length&&this.certificates.some(e=>e instanceof ee)||this.signerInfos.some(e=>3===e.version)||this.encapContentInfo.eContentType!==Ce.ID_DATA?this.version=3:this.version=1,t.push(new i.m({value:this.version})),t.push(new i.w({value:Array.from(this.digestAlgorithms,t=>t.toSchema(e))})),t.push(this.encapContentInfo.toSchema()),"certificates"in this){const e=new le({certificates:this.certificates}).toSchema();t.push(new i.g({idBlock:{tagClass:3,tagNumber:0},value:e.valueBlock.value}))}return"crls"in this&&t.push(new i.g({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.crls,t=>{if(t instanceof he){const r=t.toSchema(e);return r.idBlock.tagClass=3,r.idBlock.tagNumber=1,r}return t.toSchema(e)})})),t.push(new i.w({value:Array.from(this.signerInfos,t=>t.toSchema(e))})),new i.v({value:t})}toJSON(){const e={version:this.version,digestAlgorithms:Array.from(this.digestAlgorithms,e=>e.toJSON()),encapContentInfo:this.encapContentInfo.toJSON()};return"certificates"in this&&(e.certificates=Array.from(this.certificates,e=>e.toJSON())),"crls"in this&&(e.crls=Array.from(this.crls,e=>e.toJSON())),e.signerInfos=Array.from(this.signerInfos,e=>e.toJSON()),e}verify({signer:e=-1,data:t=new ArrayBuffer(0),trustedCerts:r=[],checkDate:n=new Date,checkChain:o=!1,extendedMode:u=!1,passedWhenNotRevValues:c=!1,findOrigin:l=null,findIssuer:h=null}={}){let f=Promise.resolve(),m=new ArrayBuffer(0),p="",d={},g=null,b=[];const y=Object(s.e)(),w=Object(s.d)();if(void 0===w)return Promise.reject("Unable to create WebCrypto object");if(-1===e)return u?Promise.reject({date:n,code:1,message:"Unable to get signer index from input parameters",signatureVerified:null,signerCertificate:null,signerCertificateVerified:null}):Promise.reject("Unable to get signer index from input parameters");if("certificates"in this==!1)return u?Promise.reject({date:n,code:2,message:"No certificates attached to this signed data",signatureVerified:null,signerCertificate:null,signerCertificateVerified:null}):Promise.reject("No certificates attached to this signed data");return f=this.signerInfos[e].sid instanceof me?f.then(()=>{for(const t of this.certificates)if(t instanceof Q!=!1&&t.issuer.isEqual(this.signerInfos[e].sid.issuer)&&t.serialNumber.isEqual(this.signerInfos[e].sid.serialNumber))return d=t,Promise.resolve();return u?Promise.reject({date:n,code:3,message:"Unable to find signer certificate",signatureVerified:null,signerCertificate:null,signerCertificateVerified:null}):Promise.reject("Unable to find signer certificate")}):(async()=>{try{const t=this.signerInfos[e].sid,r=t.idBlock.isConstructed?t.valueBlock.value[0].valueBlock.valueHex:t.valueBlock.valueHex;for(const e of this.certificates){if(!(e instanceof Q))continue;const t=await w.digest({name:"sha-1"},new Uint8Array(e.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHex));if(Object(a.g)(t,r)){d=e;break}}if(!d)throw new Error("Signing certificate not found")}catch(e){if(u)return Promise.reject({date:n,code:3,message:"Unable to find signer certificate",signatureVerified:null,signerCertificate:null,signerCertificateVerified:null});throw"Unable to find signer certificate"}})(),f=f.then(()=>{if("1.2.840.113549.1.9.16.1.4"===this.encapContentInfo.eContentType){if("eContent"in this.encapContentInfo==!1)return!1;const e=i.E(this.encapContentInfo.eContent.valueBlock.valueHex);let r;try{r=new Ee({schema:e.result})}catch(e){return!1}return n=r.genTime,g=r.serialNumber.valueBlock.valueHex,0===t.byteLength?u?Promise.reject({date:n,code:4,message:"Missed detached data input array",signatureVerified:null,signerCertificate:d,signerCertificateVerified:null}):Promise.reject("Missed detached data input array"):r.verify({data:t})}return!0}),o&&(f=f.then(e=>{if(!1===e)return!1;const t=Array.from(this.certificates.filter(e=>e instanceof Q),e=>function(e){if(!0===e.issuer.isEqual(d.issuer)&&!0===e.serialNumber.isEqual(d.serialNumber))return null;let t=!1;if("extensions"in e)for(const r of e.extensions)"2.5.29.19"===r.extnID&&"cA"in r.parsedValue&&!0===r.parsedValue.cA&&(t=!0);return t?e:null}(e)),s={checkDate:n,certs:Array.from(t.filter(e=>null!==e)),trustedCerts:r};null!==h&&(s.findIssuer=h),null!==l&&(s.findOrigin=l);const i=new be(s);if(i.certs.push(d),"crls"in this)for(const e of this.crls)"thisUpdate"in e?i.crls.push(e):"1.3.6.1.5.5.7.48.1.1"===e.otherRevInfoFormat&&i.ocsps.push(new ye({schema:e.otherRevInfo}));return"ocsps"in this&&i.ocsps.push(...this.ocsps),i.verify({passedWhenNotRevValues:c}).then(e=>("certificatePath"in e&&(b=e.certificatePath),!0===e.result?Promise.resolve(!0):u?Promise.reject({date:n,code:5,message:"Validation of signer's certificate failed: "+e.resultMessage,signatureVerified:null,signerCertificate:d,signerCertificateVerified:!1}):Promise.reject("Validation of signer's certificate failed")),e=>u?Promise.reject({date:n,code:5,message:"Validation of signer's certificate failed with error: "+(e instanceof Object?e.resultMessage:e),signatureVerified:null,signerCertificate:d,signerCertificateVerified:!1}):Promise.reject("Validation of signer's certificate failed with error: "+(e instanceof Object?e.resultMessage:e)))})),f=f.then(t=>{if(!1===t)return!1;const r=Object(s.c)(this.signerInfos[e].digestAlgorithm.algorithmId);return"name"in r==!1?u?Promise.reject({date:n,code:7,message:"Unsupported signature algorithm: "+this.signerInfos[e].digestAlgorithm.algorithmId,signatureVerified:null,signerCertificate:d,signerCertificateVerified:!0}):Promise.reject("Unsupported signature algorithm: "+this.signerInfos[e].digestAlgorithm.algorithmId):(p=r.name,!0)}),f=f.then(r=>{if(!1===r)return!1;if("eContent"in this.encapContentInfo)if(1===this.encapContentInfo.eContent.idBlock.tagClass&&4===this.encapContentInfo.eContent.idBlock.tagNumber)if(!1===this.encapContentInfo.eContent.idBlock.isConstructed)t=this.encapContentInfo.eContent.valueBlock.valueHex;else for(const e of this.encapContentInfo.eContent.valueBlock.value)t=Object(a.l)(t,e.valueBlock.valueHex);else t=this.encapContentInfo.eContent.valueBlock.valueBeforeDecode;else if(0===t.byteLength)return u?Promise.reject({date:n,code:8,message:"Missed detached data input array",signatureVerified:null,signerCertificate:d,signerCertificateVerified:!0}):Promise.reject("Missed detached data input array");if("signedAttrs"in this.signerInfos[e]){let t=!1,r=!1;for(const n of this.signerInfos[e].signedAttrs.attributes)if("1.2.840.113549.1.9.3"===n.type&&(t=!0),"1.2.840.113549.1.9.4"===n.type&&(r=!0,m=n.values[0].valueBlock.valueHex),t&&r)break;if(!1===t)return u?Promise.reject({date:n,code:9,message:'Attribute "content-type" is a mandatory attribute for "signed attributes"',signatureVerified:null,signerCertificate:d,signerCertificateVerified:!0}):Promise.reject('Attribute "content-type" is a mandatory attribute for "signed attributes"');if(!1===r)return u?Promise.reject({date:n,code:10,message:'Attribute "message-digest" is a mandatory attribute for "signed attributes"',signatureVerified:null,signerCertificate:d,signerCertificateVerified:!0}):Promise.reject('Attribute "message-digest" is a mandatory attribute for "signed attributes"')}return!0}),f=f.then(r=>!1!==r&&(!("signedAttrs"in this.signerInfos[e])||w.digest(p,new Uint8Array(t)))).then(r=>!1!==r&&(!("signedAttrs"in this.signerInfos[e])||!!Object(a.g)(r,m)&&(t=this.signerInfos[e].signedAttrs.encodedValue,!0))),f=f.then(r=>!1!==r&&y.subtle.verifyWithPublicKey(t,this.signerInfos[e].signature,d.subjectPublicKeyInfo,d.signatureAlgorithm,p)),f=f.then(e=>u?{date:n,code:14,message:"",signatureVerified:e,signerCertificate:d,timestampSerial:g,signerCertificateVerified:!0,certificatePath:b}:e,e=>u?"code"in e?Promise.reject(e):Promise.reject({date:n,code:15,message:"Error during verification: "+e.message,signatureVerified:null,signerCertificate:d,timestampSerial:g,signerCertificateVerified:!0}):Promise.reject(e)),f}sign(e,t,r="SHA-1",n=new ArrayBuffer(0)){if(void 0===e)return Promise.reject("Need to provide a private key for signing");let o,u=Promise.resolve();const c=Object(s.e)(),l=Object(s.f)({name:r});return""===l?Promise.reject("Unsupported hash algorithm: "+r):(0===this.digestAlgorithms.filter(e=>e.algorithmId===l).length&&this.digestAlgorithms.push(new d.a({algorithmId:l,algorithmParams:new i.n})),this.signerInfos[t].digestAlgorithm=new d.a({algorithmId:l,algorithmParams:new i.n}),u=u.then(()=>c.subtle.getSignatureParameters(e,r)),u=u.then(e=>{o=e.parameters,this.signerInfos[t].signatureAlgorithm=e.signatureAlgorithm}),u=u.then(()=>{if("signedAttrs"in this.signerInfos[t])if(0!==this.signerInfos[t].signedAttrs.encodedValue.byteLength)n=this.signerInfos[t].signedAttrs.encodedValue;else{n=this.signerInfos[t].signedAttrs.toSchema(!0).toBER(!1);new Uint8Array(n)[0]=49}else if("eContent"in this.encapContentInfo)if(1===this.encapContentInfo.eContent.idBlock.tagClass&&4===this.encapContentInfo.eContent.idBlock.tagNumber)if(!1===this.encapContentInfo.eContent.idBlock.isConstructed)n=this.encapContentInfo.eContent.valueBlock.valueHex;else for(const e of this.encapContentInfo.eContent.valueBlock.value)n=Object(a.l)(n,e.valueBlock.valueHex);else n=this.encapContentInfo.eContent.valueBlock.valueBeforeDecode;else if(0===n.byteLength)return Promise.reject("Missed detached data input array");return Promise.resolve()}),u=u.then(()=>c.subtle.signWithPrivateKey(n,e,o)),u=u.then(e=>(this.signerInfos[t].signature=new i.q({valueHex:e}),e)),u)}}Ce.ID_DATA="1.2.840.113549.1.7.1";r(17),r(15),r(13);r(11);function ke(e,t,r,n){var s,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,r,a):s(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}Object.create;Object.create;var Oe=r(14);let Ie=null;class xe{static setEngine(e,t){Ie=Object.assign(t,{name:e}),Object(s.i)(e,t,new we.a({name:e,crypto:t,subtle:t.subtle}))}static get crypto(){if(!Ie)throw new n.n(n.h.CRYPTOGRAPHIC_NO_MODULE);return Ie}static isNodePlugin(){return"undefined"==typeof self&&"undefined"==typeof window}}xe.isNodePlugin()||xe.setEngine("W3 WebCrypto module",self.crypto);class Be{getAlgorithmName(){return this.namespaceURI}}class De extends Be{async Digest(e){let t;if("string"==typeof e)t=n.b.FromString(e,"utf8");else if(ArrayBuffer.isView(e))t=new Uint8Array(e.buffer);else if(e instanceof ArrayBuffer)t=new Uint8Array(e);else{const r=(new XMLSerializer).serializeToString(e);t=n.b.FromString(r,"utf8")}const r=await xe.crypto.subtle.digest(this.algorithm,t);return new Uint8Array(r)}}class Te extends Be{async Sign(e,t,r){const s=n.b.FromString(e,"utf8");return xe.crypto.subtle.sign(r,t,s)}async Verify(e,t,r,s){const i=n.b.FromString(e,"utf8");return xe.crypto.subtle.verify(s||this.algorithm,t,r,i)}}const Pe="SHA-1",Re="SHA-256",je="SHA-384",Le="SHA-512",Ue="http://www.w3.org/2000/09/xmldsig#sha1",Ve="http://www.w3.org/2001/04/xmlenc#sha256",_e="http://www.w3.org/2001/04/xmldsig-more#sha384",He="http://www.w3.org/2001/04/xmlenc#sha512";class Me extends De{constructor(){super(...arguments),this.algorithm={name:Pe},this.namespaceURI=Ue}}class Fe extends De{constructor(){super(...arguments),this.algorithm={name:Re},this.namespaceURI=Ve}}class Ke extends De{constructor(){super(...arguments),this.algorithm={name:je},this.namespaceURI=_e}}class qe extends De{constructor(){super(...arguments),this.algorithm={name:Le},this.namespaceURI=He}}const Je="ECDSA",Ge="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1",Xe="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256",We="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384",Ye="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512";class Qe extends Te{constructor(){super(...arguments),this.algorithm={name:Je,hash:{name:Pe}},this.namespaceURI=Ge}}class $e extends Te{constructor(){super(...arguments),this.algorithm={name:Je,hash:{name:Re}},this.namespaceURI=Xe}}class ze extends Te{constructor(){super(...arguments),this.algorithm={name:Je,hash:{name:je}},this.namespaceURI=We}}class Ze extends Te{constructor(){super(...arguments),this.algorithm={name:Je,hash:{name:Le}},this.namespaceURI=Ye}}const et="HMAC",tt="http://www.w3.org/2000/09/xmldsig#hmac-sha1",rt="http://www.w3.org/2001/04/xmldsig-more#hmac-sha256",nt="http://www.w3.org/2001/04/xmldsig-more#hmac-sha384",st="http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";class it extends Te{constructor(){super(...arguments),this.algorithm={name:et,hash:{name:Pe}},this.namespaceURI=tt}}class at extends Te{constructor(){super(...arguments),this.algorithm={name:et,hash:{name:Re}},this.namespaceURI=rt}}class ot extends Te{constructor(){super(...arguments),this.algorithm={name:et,hash:{name:je}},this.namespaceURI=nt}}class ut extends Te{constructor(){super(...arguments),this.algorithm={name:et,hash:{name:Le}},this.namespaceURI=st}}const ct="RSASSA-PKCS1-v1_5",lt="http://www.w3.org/2000/09/xmldsig#rsa-sha1",ht="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",ft="http://www.w3.org/2001/04/xmldsig-more#rsa-sha384",mt="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";class pt extends Te{constructor(){super(...arguments),this.algorithm={name:ct,hash:{name:Pe}},this.namespaceURI=lt}}class dt extends Te{constructor(){super(...arguments),this.algorithm={name:ct,hash:{name:Re}},this.namespaceURI=ht}}class gt extends Te{constructor(){super(...arguments),this.algorithm={name:ct,hash:{name:je}},this.namespaceURI=ft}}class bt extends Te{constructor(){super(...arguments),this.algorithm={name:ct,hash:{name:Le}},this.namespaceURI=mt}}const yt="RSA-PSS",wt="http://www.w3.org/2007/05/xmldsig-more#rsa-pss";class vt extends Te{constructor(e){super(),this.algorithm={name:yt,hash:{name:Pe}},this.namespaceURI=wt,e&&(this.algorithm.saltLength=e)}}class Nt extends vt{constructor(e){super(e),this.algorithm.hash.name=Pe}}class At extends vt{constructor(e){super(e),this.algorithm.hash.name=Re}}class St extends vt{constructor(e){super(e),this.algorithm.hash.name=je}}class Et extends vt{constructor(e){super(e),this.algorithm.hash.name=Le}}const Ct="http://www.w3.org/2007/05/xmldsig-more#sha1-rsa-MGF1",kt="http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1",Ot="http://www.w3.org/2007/05/xmldsig-more#sha384-rsa-MGF1",It="http://www.w3.org/2007/05/xmldsig-more#sha512-rsa-MGF1";class xt extends Te{constructor(){super(),this.algorithm={name:yt,hash:{name:Pe}},this.namespaceURI=Ct}}class Bt extends xt{constructor(){super(),this.algorithm.hash.name=Pe,this.algorithm.saltLength=20}}class Dt extends xt{constructor(){super(),this.algorithm.hash.name=Re,this.algorithm.saltLength=32}}class Tt extends xt{constructor(){super(),this.algorithm.hash.name=je,this.algorithm.saltLength=48}}class Pt extends xt{constructor(){super(),this.algorithm.hash.name=Le,this.algorithm.saltLength=64}}var Rt;!function(e){e[e.BeforeDocElement=0]="BeforeDocElement",e[e.InsideDocElement=1]="InsideDocElement",e[e.AfterDocElement=2]="AfterDocElement"}(Rt||(Rt={}));class jt{constructor(e,t,r=new n.c){this.propagatedNamespaces=new n.c,this.result=[],this.visibleNamespaces=new n.c,this.inclusiveNamespacesPrefixList=[],this.state=Rt.BeforeDocElement,this.withComments=e,this.exclusive=t,this.propagatedNamespaces=r}get InclusiveNamespacesPrefixList(){return this.inclusiveNamespacesPrefixList.join(" ")}set InclusiveNamespacesPrefixList(e){this.inclusiveNamespacesPrefixList=e.split(" ")}Canonicalize(e){if(!e)throw new n.n(n.h.CRYPTOGRAPHIC,"Parameter 1 is not Node");this.WriteNode(e);return this.result.join("")}WriteNode(e){switch(e.nodeType){case n.o.Document:case n.o.DocumentFragment:this.WriteDocumentNode(e);break;case n.o.Element:this.WriteElementNode(e);break;case n.o.CDATA:case n.o.SignificantWhitespace:case n.o.Text:n.s(e.parentNode)||this.WriteTextNode(e);break;case n.o.Whitespace:this.state===Rt.InsideDocElement&&this.WriteTextNode(e);break;case n.o.Comment:this.WriteCommentNode(e);break;case n.o.ProcessingInstruction:this.WriteProcessingInstructionNode(e);break;case n.o.EntityReference:for(let t=0;t<e.childNodes.length;t++)this.WriteNode(e.childNodes[t]);break;case n.o.Attribute:case n.o.EndElement:case n.o.EndEntity:throw new n.n(n.h.CRYPTOGRAPHIC,"Attribute node is impossible here");case n.o.DocumentType:case n.o.Entity:case n.o.Notation:case n.o.XmlDeclaration:}}WriteDocumentNode(e){this.state=Rt.BeforeDocElement;for(let t=e.firstChild;null!=t;t=t.nextSibling)this.WriteNode(t)}WriteCommentNode(e){this.withComments&&(this.state===Rt.AfterDocElement?this.result.push(String.fromCharCode(10)+"\x3c!--"):this.result.push("\x3c!--"),this.result.push(this.NormalizeString(e.nodeValue,n.o.Comment)),this.state===Rt.BeforeDocElement?this.result.push("--\x3e"+String.fromCharCode(10)):this.result.push("--\x3e"))}WriteTextNode(e){this.result.push(this.NormalizeString(e.nodeValue,e.nodeType))}WriteProcessingInstructionNode(e){const t=e.nodeName||e.tagName;"xml"!==t&&(this.state===Rt.AfterDocElement?this.result.push("\n<?"):this.result.push("<?"),this.result.push(t),e.nodeValue&&(this.result.push(" "),this.result.push(this.NormalizeString(e.nodeValue,n.o.ProcessingInstruction))),this.state===Rt.BeforeDocElement?this.result.push("?>\n"):this.result.push("?>"))}WriteElementNode(e){const t=this.state;this.state===Rt.BeforeDocElement&&(this.state=Rt.InsideDocElement),this.result.push("<"),this.result.push(e.nodeName);let r=this.WriteNamespacesAxis(e);this.WriteAttributesAxis(e),this.result.push(">");for(let t=e.firstChild;null!=t;t=t.nextSibling)this.WriteNode(t);for(this.result.push("</"),this.result.push(e.nodeName),this.result.push(">"),t===Rt.BeforeDocElement&&(this.state=Rt.AfterDocElement);r--;)this.visibleNamespaces.Pop()}WriteNamespacesAxis(e){const t=[];let r=0;for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n];if(!_t(s)){if(s.prefix&&!this.IsNamespaceRendered(s.prefix,s.namespaceURI)){const e={prefix:s.prefix,namespace:s.namespaceURI};t.push(e),this.visibleNamespaces.Add(e),r++}continue}if("xmlns"===s.localName&&!s.prefix&&!s.nodeValue){const e={prefix:s.prefix,namespace:s.nodeValue};t.push(e),this.visibleNamespaces.Add(e),r++}let i,a=null;(i=/xmlns:([\w\.-]+)/.exec(s.nodeName))&&(a=i[1]);let o=!0;if(this.exclusive&&!this.IsNamespaceInclusive(e,a)){const t=Vt(e,a);if(t>1)o=!1;else if(0===t)continue}if(!this.IsNamespaceRendered(a,s.nodeValue)&&o){const e={prefix:a,namespace:s.nodeValue};t.push(e),this.visibleNamespaces.Add(e),r++}}if(!this.IsNamespaceRendered(e.prefix,e.namespaceURI)&&"http://www.w3.org/2000/xmlns/"!==e.namespaceURI){const n={prefix:e.prefix,namespace:e.namespaceURI};t.push(n),this.visibleNamespaces.Add(n),r++}t.sort(Lt);let n=null;return t.forEach(e=>{e.prefix!==n&&(n=e.prefix,this.result.push(" xmlns"),e.prefix&&this.result.push(":"+e.prefix),this.result.push('="'),this.result.push(e.namespace),this.result.push('"'))}),r}WriteAttributesAxis(e){const t=[];for(let r=0;r<e.attributes.length;r++){const n=e.attributes[r];_t(n)||t.push(n)}t.sort(Ut),t.forEach(e=>{null!=e&&(this.result.push(" "),this.result.push(e.nodeName),this.result.push('="'),this.result.push(this.NormalizeString(e.nodeValue,n.o.Attribute)),this.result.push('"'))})}NormalizeString(e,t){const r=[];if(e)for(let s=0;s<e.length;s++){const i=e[s];"<"!==i||t!==n.o.Attribute&&!this.IsTextNode(t)?">"===i&&this.IsTextNode(t)?r.push("&gt;"):"&"!==i||t!==n.o.Attribute&&!this.IsTextNode(t)?'"'===i&&t===n.o.Attribute?r.push("&quot;"):"\t"===i&&t===n.o.Attribute?r.push("&#x9;"):"\n"===i&&t===n.o.Attribute?r.push("&#xA;"):"\r"===i?r.push("&#xD;"):r.push(i):r.push("&amp;"):r.push("&lt;")}return r.join("")}IsTextNode(e){switch(e){case n.o.Text:case n.o.CDATA:case n.o.SignificantWhitespace:case n.o.Whitespace:return!0}return!1}IsNamespaceInclusive(e,t){const r=t||null;return e.prefix!==r&&-1!==this.inclusiveNamespacesPrefixList.indexOf(r||"")}IsNamespaceRendered(e,t){if(t=t||"",!(e=e||"")&&!t)return!0;if("xml"===e&&"http://www.w3.org/XML/1998/namespace"===t)return!0;const r=this.visibleNamespaces.GetPrefix(e);return!!r&&r.namespace===t}}function Lt(e,t){return e==t?0:e?t?e.prefix?t.prefix?e.prefix<t.prefix?-1:e.prefix>t.prefix?1:0:1:-1:1:-1}function Ut(e,t){if(!e.namespaceURI&&t.namespaceURI)return-1;if(!t.namespaceURI&&e.namespaceURI)return 1;const r=e.namespaceURI+e.localName,n=t.namespaceURI+t.localName;return r===n?0:r<n?-1:1}function Vt(e,t,r=0){const s=t||null;if(e.prefix===s)return++r;if(e.attributes)for(let n=0;n<e.attributes.length;n++){if(!_t(e.attributes[n])&&t&&e.attributes[n].prefix===t)return++r}for(let s=e.firstChild;s;s=s.nextSibling)if(s.nodeType===n.o.Element){const e=Vt(s,t,r);if(s.nodeType===n.o.Element&&e)return++r+e}return r}function _t(e){return!(null===e||e.nodeType!==n.o.Attribute||"xmlns"!==e.nodeName&&!/xmlns:/.test(e.nodeName))}const Ht={DefaultCanonMethod:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",DefaultDigestMethod:"http://www.w3.org/2001/04/xmlenc#sha256",DefaultPrefix:"ds",ElementNames:{CanonicalizationMethod:"CanonicalizationMethod",DigestMethod:"DigestMethod",DigestValue:"DigestValue",DSAKeyValue:"DSAKeyValue",DomainParameters:"DomainParameters",EncryptedKey:"EncryptedKey",HMACOutputLength:"HMACOutputLength",RSAPSSParams:"RSAPSSParams",MaskGenerationFunction:"MaskGenerationFunction",SaltLength:"SaltLength",KeyInfo:"KeyInfo",KeyName:"KeyName",KeyValue:"KeyValue",Modulus:"Modulus",Exponent:"Exponent",Manifest:"Manifest",Object:"Object",Reference:"Reference",RetrievalMethod:"RetrievalMethod",RSAKeyValue:"RSAKeyValue",ECDSAKeyValue:"ECDSAKeyValue",NamedCurve:"NamedCurve",PublicKey:"PublicKey",Signature:"Signature",SignatureMethod:"SignatureMethod",SignatureValue:"SignatureValue",SignedInfo:"SignedInfo",Transform:"Transform",Transforms:"Transforms",X509Data:"X509Data",PGPData:"PGPData",SPKIData:"SPKIData",SPKIexp:"SPKIexp",MgmtData:"MgmtData",X509IssuerSerial:"X509IssuerSerial",X509IssuerName:"X509IssuerName",X509SerialNumber:"X509SerialNumber",X509SKI:"X509SKI",X509SubjectName:"X509SubjectName",X509Certificate:"X509Certificate",X509CRL:"X509CRL",XPath:"XPath",X:"X",Y:"Y"},AttributeNames:{Algorithm:"Algorithm",Encoding:"Encoding",Id:"Id",MimeType:"MimeType",Type:"Type",URI:"URI"},AlgorithmNamespaces:{XmlDsigBase64Transform:"http://www.w3.org/2000/09/xmldsig#base64",XmlDsigC14NTransform:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",XmlDsigC14NWithCommentsTransform:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",XmlDsigEnvelopedSignatureTransform:"http://www.w3.org/2000/09/xmldsig#enveloped-signature",XmlDsigXPathTransform:"http://www.w3.org/TR/1999/REC-xpath-19991116",XmlDsigXsltTransform:"http://www.w3.org/TR/1999/REC-xslt-19991116",XmlDsigExcC14NTransform:"http://www.w3.org/2001/10/xml-exc-c14n#",XmlDsigExcC14NWithCommentsTransform:"http://www.w3.org/2001/10/xml-exc-c14n#WithComments",XmlDecryptionTransform:"http://www.w3.org/2002/07/decrypt#XML",XmlLicenseTransform:"urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform"},Uri:{Manifest:"http://www.w3.org/2000/09/xmldsig#Manifest"},NamespaceURI:"http://www.w3.org/2000/09/xmldsig#",NamespaceURIMore:"http://www.w3.org/2007/05/xmldsig-more#",NamespaceURIPss:"http://www.example.org/xmldsig-pss/#"};let Mt=class extends n.q{};Mt=ke([Object(n.m)({localName:"xmldsig",namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix})],Mt);let Ft=class extends n.l{};Ft=ke([Object(n.m)({localName:"xmldsig_collection",namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix})],Ft);class Kt extends Mt{}let qt=class extends Mt{};ke([Object(n.i)({localName:Ht.AttributeNames.Algorithm,required:!0,defaultValue:Ht.DefaultCanonMethod})],qt.prototype,"Algorithm",void 0),qt=ke([Object(n.m)({localName:Ht.ElementNames.CanonicalizationMethod})],qt);let Jt=class extends Mt{};ke([Object(n.i)({localName:Ht.AttributeNames.Id,defaultValue:""})],Jt.prototype,"Id",void 0),ke([Object(n.i)({localName:Ht.AttributeNames.MimeType,defaultValue:""})],Jt.prototype,"MimeType",void 0),ke([Object(n.i)({localName:Ht.AttributeNames.Encoding,defaultValue:""})],Jt.prototype,"Encoding",void 0),Jt=ke([Object(n.m)({localName:Ht.ElementNames.Object})],Jt);let Gt=class extends Ft{};Gt=ke([Object(n.m)({localName:"xmldsig_objects",parser:Jt})],Gt);let Xt=class extends Mt{constructor(e){super(),e&&(this.Algorithm=e)}};ke([Object(n.i)({localName:Ht.AttributeNames.Algorithm,required:!0,defaultValue:Ht.DefaultDigestMethod})],Xt.prototype,"Algorithm",void 0),Xt=ke([Object(n.m)({localName:Ht.ElementNames.DigestMethod})],Xt);let Wt=class extends Ft{OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){const r=e.childNodes.item(t);if(r.nodeType!==n.o.Element)continue;let s=null;switch(r.localName){case Ht.ElementNames.KeyValue:s=Sr;break;case Ht.ElementNames.X509Data:s=Ir;break;case Ht.ElementNames.SPKIData:s=xr;break;case Ht.ElementNames.KeyName:case Ht.ElementNames.RetrievalMethod:case Ht.ElementNames.PGPData:case Ht.ElementNames.MgmtData:}if(s){const e=new s;e.LoadXml(r),this.Add(e)}}}};ke([Object(n.i)({localName:Ht.AttributeNames.Id,defaultValue:""})],Wt.prototype,"Id",void 0),Wt=ke([Object(n.m)({localName:Ht.ElementNames.KeyInfo})],Wt);let Yt=class extends Mt{constructor(){super(...arguments),this.innerXml=null}GetOutput(){throw new n.n(n.h.METHOD_NOT_IMPLEMENTED)}LoadInnerXml(e){if(!e)throw new n.n(n.h.PARAM_REQUIRED,"node");this.innerXml=e}GetInnerXml(){return this.innerXml}};ke([Object(n.i)({localName:Ht.AttributeNames.Algorithm,defaultValue:""})],Yt.prototype,"Algorithm",void 0),ke([Object(n.k)({localName:Ht.ElementNames.XPath,defaultValue:""})],Yt.prototype,"XPath",void 0),Yt=ke([Object(n.m)({localName:Ht.ElementNames.Transform})],Yt);class Qt extends Yt{constructor(){super(...arguments),this.Algorithm=Ht.AlgorithmNamespaces.XmlDsigBase64Transform}GetOutput(){if(!this.innerXml)throw new n.n(n.h.PARAM_REQUIRED,"innerXml");return n.b.FromString(this.innerXml.textContent||"","base64")}}class $t extends Yt{constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",this.xmlCanonicalizer=new jt(!1,!1)}GetOutput(){if(!this.innerXml)throw new n.n(n.h.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}}class zt extends $t{constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",this.xmlCanonicalizer=new jt(!0,!1)}}class Zt extends Yt{constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"}GetOutput(){var e;if(!this.innerXml)throw new n.n(n.h.PARAM_REQUIRED,"innerXml");let t=this.innerXml.firstChild;const r=[];for(;t;)Object(n.t)(t)&&t.localName===Ht.ElementNames.Signature&&t.namespaceURI===Ht.NamespaceURI&&r.push(t),t=t.nextSibling;for(const t of r)null===(e=t.parentNode)||void 0===e||e.removeChild(t);return this.innerXml}}class er extends Yt{constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#",this.xmlCanonicalizer=new jt(!1,!0)}get InclusiveNamespacesPrefixList(){return this.xmlCanonicalizer.InclusiveNamespacesPrefixList}set InclusiveNamespacesPrefixList(e){this.xmlCanonicalizer.InclusiveNamespacesPrefixList=e}LoadXml(e){if(super.LoadXml(e),this.Element&&this.Element.childNodes)for(let e=0;e<this.Element.childNodes.length;e++){const t=this.Element.childNodes[e];if(t&&1===t.nodeType)switch(t.localName){case"InclusiveNamespaces":this.setInclusiveNamespacesElement(t)}}}GetOutput(){if(!this.innerXml)throw new n.n(n.h.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}setInclusiveNamespacesElement(e){const t=e.getAttribute("PrefixList");t&&t.length>0&&(this.xmlCanonicalizer.InclusiveNamespacesPrefixList=t)}}class tr extends er{constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments",this.xmlCanonicalizer=new jt(!0,!0)}}class rr extends Yt{constructor(){super(...arguments),this.Algorithm=Ht.AlgorithmNamespaces.XmlDsigXPathTransform}GetOutput(){if(!this.innerXml)throw new n.n(n.h.PARAM_REQUIRED,"innerXml");this.Filter(function e(t){return t.parentNode?e(t.parentNode):t}(this.innerXml),this.XPath)}Filter(e,t){const r=e.childNodes,n=[];for(let e=0;r&&e<r.length;e++){const t=r.item(e);n.push(t)}n.forEach(e=>{this.Evaluate(e,t)?e.parentNode&&e.parentNode.removeChild(e):this.Filter(e,t)})}GetEvaluator(e){return"undefined"!=typeof self?null==e.ownerDocument?e:e.ownerDocument:r(24)}Evaluate(e,t){try{const n=this.GetEvaluator(e),s=this.GetXml().firstChild,i=`boolean(${t})`;return!n.evaluate(i,e,{lookupNamespaceURI:e=>s.lookupNamespaceURI(e)},("undefined"==typeof self?r(24):self).XPathResult.ANY_TYPE,null).booleanValue}catch(e){return!1}}}ke([n.k({localName:Ht.ElementNames.XPath,namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix,required:!0})],rr.prototype,"XPath",void 0);let nr=class extends Ft{OnLoadXml(e){super.OnLoadXml(e),this.items=this.GetIterator().map(e=>{switch(e.Algorithm){case Ht.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:return sr(e,Zt);case Ht.AlgorithmNamespaces.XmlDsigC14NTransform:return sr(e,$t);case Ht.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:return sr(e,zt);case Ht.AlgorithmNamespaces.XmlDsigExcC14NTransform:return sr(e,er);case Ht.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:return sr(e,tr);case Ht.AlgorithmNamespaces.XmlDsigBase64Transform:return sr(e,Qt);case Ht.AlgorithmNamespaces.XmlDsigXPathTransform:return sr(e,rr);default:throw new n.n(n.h.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM,e.Algorithm)}})}};function sr(e,t){const r=new t;return r.LoadXml(e.Element),r}nr=ke([Object(n.m)({localName:Ht.ElementNames.Transforms,parser:Yt})],nr);let ir=class extends Mt{constructor(e){super(),this.DigestMethod=new Xt,e&&(this.Uri=e)}};ke([Object(n.i)({defaultValue:""})],ir.prototype,"Id",void 0),ke([Object(n.i)({localName:Ht.AttributeNames.URI})],ir.prototype,"Uri",void 0),ke([Object(n.i)({localName:Ht.AttributeNames.Type,defaultValue:""})],ir.prototype,"Type",void 0),ke([Object(n.k)({parser:nr})],ir.prototype,"Transforms",void 0),ke([Object(n.k)({required:!0,parser:Xt})],ir.prototype,"DigestMethod",void 0),ke([Object(n.k)({required:!0,localName:Ht.ElementNames.DigestValue,namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix,converter:n.j})],ir.prototype,"DigestValue",void 0),ir=ke([Object(n.m)({localName:Ht.ElementNames.Reference})],ir);let ar=class extends Ft{};ar=ke([Object(n.m)({localName:"References",parser:ir})],ar);let or=class extends Ft{OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){const r=e.childNodes.item(t);if(r.nodeType!==n.o.Element||r.nodeName===Ht.ElementNames.HMACOutputLength)continue;let s;switch(r.localName){case Ht.ElementNames.RSAPSSParams:s=Ar}if(s){const e=new s;e.LoadXml(r),this.Add(e)}}}};or=ke([Object(n.m)({localName:"Other"})],or);let ur=class extends Mt{};ke([Object(n.i)({localName:Ht.AttributeNames.Algorithm,required:!0,defaultValue:""})],ur.prototype,"Algorithm",void 0),ke([Object(n.k)({localName:Ht.ElementNames.HMACOutputLength,namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix,converter:n.p})],ur.prototype,"HMACOutputLength",void 0),ke([Object(n.k)({parser:or,noRoot:!0,minOccurs:0})],ur.prototype,"Any",void 0),ur=ke([Object(n.m)({localName:Ht.ElementNames.SignatureMethod})],ur);let cr=class extends Mt{};ke([Object(n.i)({localName:Ht.AttributeNames.Id,defaultValue:""})],cr.prototype,"Id",void 0),ke([Object(n.k)({parser:qt,required:!0})],cr.prototype,"CanonicalizationMethod",void 0),ke([Object(n.k)({parser:ur,required:!0})],cr.prototype,"SignatureMethod",void 0),ke([Object(n.k)({parser:ar,minOccurs:1,noRoot:!0})],cr.prototype,"References",void 0),cr=ke([Object(n.m)({localName:Ht.ElementNames.SignedInfo})],cr);let lr=class extends Mt{};ke([Object(n.i)({localName:Ht.AttributeNames.Id,defaultValue:""})],lr.prototype,"Id",void 0),ke([Object(n.k)({parser:cr,required:!0})],lr.prototype,"SignedInfo",void 0),ke([Object(n.k)({localName:Ht.ElementNames.SignatureValue,namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix,required:!0,converter:n.j,defaultValue:null})],lr.prototype,"SignatureValue",void 0),ke([Object(n.k)({parser:Wt})],lr.prototype,"KeyInfo",void 0),ke([Object(n.k)({parser:Gt,noRoot:!0})],lr.prototype,"ObjectList",void 0),lr=ke([Object(n.m)({localName:Ht.ElementNames.Signature})],lr);const hr="http://www.w3.org/2001/04/xmldsig-more#";let fr=class extends n.q{};ke([Object(n.k)({localName:Ht.ElementNames.X,namespaceURI:hr,prefix:"ecdsa",required:!0,converter:n.j})],fr.prototype,"X",void 0),ke([Object(n.k)({localName:Ht.ElementNames.Y,namespaceURI:hr,prefix:"ecdsa",required:!0,converter:n.j})],fr.prototype,"Y",void 0),fr=ke([Object(n.m)({localName:Ht.ElementNames.PublicKey,namespaceURI:hr,prefix:"ecdsa"})],fr);let mr=class extends n.q{};ke([Object(n.i)({localName:Ht.AttributeNames.URI,required:!0})],mr.prototype,"Uri",void 0),mr=ke([Object(n.m)({localName:Ht.ElementNames.NamedCurve,namespaceURI:hr,prefix:"ecdsa"})],mr);let pr=class extends n.q{};ke([Object(n.k)({parser:mr})],pr.prototype,"NamedCurve",void 0),pr=ke([Object(n.m)({localName:Ht.ElementNames.DomainParameters,namespaceURI:hr,prefix:"ecdsa"})],pr);let dr=class extends Kt{constructor(){super(...arguments),this.name=Ht.ElementNames.ECDSAKeyValue,this.key=null,this.jwk=null,this.keyUsage=null}get NamedCurve(){return gr(this.DomainParameters.NamedCurve.Uri)}async importKey(e){if("ECDSA"!==e.algorithm.name.toUpperCase())throw new n.n(n.h.ALGORITHM_WRONG_NAME,e.algorithm.name);const t=await xe.crypto.subtle.exportKey("jwk",e);return this.key=e,this.jwk=t,this.PublicKey=new fr,this.PublicKey.X=n.b.FromString(t.x,"base64url"),this.PublicKey.Y=n.b.FromString(t.y,"base64url"),this.DomainParameters||(this.DomainParameters=new pr),this.DomainParameters.NamedCurve||(this.DomainParameters.NamedCurve=new mr),this.DomainParameters.NamedCurve.Uri=gr(t.crv),this.keyUsage=e.usages,this}async exportKey(e){if(this.key)return this.key;const t=n.b.ToBase64Url(this.PublicKey.X),r=n.b.ToBase64Url(this.PublicKey.Y),s=function(e){switch(e){case"urn:oid:1.2.840.10045.3.1.7":return"P-256";case"urn:oid:1.3.132.0.34":return"P-384";case"urn:oid:1.3.132.0.35":return"P-521"}throw new n.n(n.h.CRYPTOGRAPHIC,"Unknown NamedCurve OID")}(this.DomainParameters.NamedCurve.Uri),i={kty:"EC",crv:s,x:t,y:r,ext:!0};this.keyUsage=["verify"];const a=await xe.crypto.subtle.importKey("jwk",i,{name:"ECDSA",namedCurve:s},!0,this.keyUsage);return this.key=a,this.key}};function gr(e){switch(e){case"P-256":return"urn:oid:1.2.840.10045.3.1.7";case"P-384":return"urn:oid:1.3.132.0.34";case"P-521":return"urn:oid:1.3.132.0.35"}throw new n.n(n.h.CRYPTOGRAPHIC,"Unknown NamedCurve")}var br;ke([Object(n.k)({parser:pr})],dr.prototype,"DomainParameters",void 0),ke([Object(n.k)({parser:fr,required:!0})],dr.prototype,"PublicKey",void 0),dr=ke([Object(n.m)({localName:Ht.ElementNames.ECDSAKeyValue,namespaceURI:hr,prefix:"ecdsa"})],dr);const yr={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};let wr=class extends Kt{constructor(){super(...arguments),this.key=null,this.jwk=null,this.keyUsage=[]}async importKey(e){const t=e.algorithm.name.toUpperCase();if(t!==ct.toUpperCase()&&t!==yt.toUpperCase())throw new n.n(n.h.ALGORITHM_WRONG_NAME,e.algorithm.name);this.key=e;const r=await xe.crypto.subtle.exportKey("jwk",e);return this.jwk=r,this.Modulus=n.b.FromBase64Url(r.n),this.Exponent=n.b.FromBase64Url(r.e),this.keyUsage=e.usages,this}async exportKey(e=yr){if(this.key)return this.key;if(!this.Modulus)throw new n.n(n.h.CRYPTOGRAPHIC,"RsaKeyValue has no Modulus");const t=n.b.ToBase64Url(this.Modulus);if(!this.Exponent)throw new n.n(n.h.CRYPTOGRAPHIC,"RsaKeyValue has no Exponent");const r=n.b.ToBase64Url(this.Exponent);let s;switch(e.name.toUpperCase()){case ct.toUpperCase():s="R";break;case yt.toUpperCase():s="P";break;default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,e.name)}switch(e.hash.name.toUpperCase()){case Pe:s+="S1";break;case Re:s+="S256";break;case je:s+="S384";break;case Le:s+="S512"}const i={kty:"RSA",alg:s,n:t,e:r,ext:!0};return xe.crypto.subtle.importKey("jwk",i,e,!0,this.keyUsage)}LoadXml(e){super.LoadXml(e),this.keyUsage=["verify"]}};ke([Object(n.k)({localName:Ht.ElementNames.Modulus,prefix:Ht.DefaultPrefix,namespaceURI:Ht.NamespaceURI,required:!0,converter:n.j})],wr.prototype,"Modulus",void 0),ke([Object(n.k)({localName:Ht.ElementNames.Exponent,prefix:Ht.DefaultPrefix,namespaceURI:Ht.NamespaceURI,required:!0,converter:n.j})],wr.prototype,"Exponent",void 0),wr=ke([Object(n.m)({localName:Ht.ElementNames.RSAKeyValue})],wr);const vr="http://www.w3.org/2007/05/xmldsig-more#";let Nr=class extends n.q{};ke([Object(n.k)({parser:Xt})],Nr.prototype,"DigestMethod",void 0),ke([Object(n.i)({localName:Ht.AttributeNames.Algorithm,defaultValue:"http://www.w3.org/2007/05/xmldsig-more#MGF1"})],Nr.prototype,"Algorithm",void 0),Nr=ke([Object(n.m)({localName:Ht.ElementNames.MaskGenerationFunction,prefix:"pss",namespaceURI:vr})],Nr);let Ar=br=class extends n.q{constructor(e){super(),e&&this.FromAlgorithm(e)}static FromAlgorithm(e){return new br(e)}FromAlgorithm(e){this.DigestMethod=new Xt;const t=Tr.GetHashAlgorithm(e.hash);this.DigestMethod.Algorithm=t.namespaceURI,e.saltLength&&(this.SaltLength=e.saltLength)}};ke([Object(n.k)({parser:Xt})],Ar.prototype,"DigestMethod",void 0),ke([Object(n.k)({parser:Nr})],Ar.prototype,"MGF",void 0),ke([Object(n.k)({converter:n.p,prefix:"pss",namespaceURI:vr})],Ar.prototype,"SaltLength",void 0),ke([Object(n.k)({converter:n.p})],Ar.prototype,"TrailerField",void 0),Ar=br=ke([Object(n.m)({localName:Ht.ElementNames.RSAPSSParams,prefix:"pss",namespaceURI:vr})],Ar);let Sr=class extends Kt{constructor(e){super(),e&&(this.Value=e)}set Value(e){this.element=null,this.value=e}get Value(){return this.value}async importKey(e){switch(e.algorithm.name.toUpperCase()){case yt.toUpperCase():case ct.toUpperCase():this.Value=new wr,await this.Value.importKey(e);break;case Je.toUpperCase():this.Value=new dr,await this.Value.importKey(e);break;default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,e.algorithm.name)}return this}async exportKey(e){if(!this.Value)throw new n.n(n.h.NULL_REFERENCE);return this.Value.exportKey(e)}OnGetXml(e){if(!this.Value)throw new n.n(n.h.CRYPTOGRAPHIC,"KeyValue has empty value");const t=this.Value.GetXml();t&&e.appendChild(t)}OnLoadXml(e){const t=[wr,dr];for(const r of t)try{const t=new r;for(let r=0;r<e.childNodes.length;r++){const s=e.childNodes.item(r);if(n.t(s))return t.LoadXml(s),void(this.value=t)}}catch(e){}throw new n.n(n.h.CRYPTOGRAPHIC,"Unsupported KeyValue in use")}};Sr=ke([Object(n.m)({localName:Ht.ElementNames.KeyValue})],Sr);const Er={"2.5.4.3":{short:"CN",long:"CommonName"},"2.5.4.6":{short:"C",long:"Country"},"2.5.4.5":{long:"DeviceSerialNumber"},"0.9.2342.19200300.100.1.25":{short:"DC",long:"DomainComponent"},"1.2.840.113549.1.9.1":{short:"E",long:"EMail"},"2.5.4.42":{short:"G",long:"GivenName"},"2.5.4.43":{short:"I",long:"Initials"},"2.5.4.7":{short:"L",long:"Locality"},"2.5.4.10":{short:"O",long:"Organization"},"2.5.4.11":{short:"OU",long:"OrganizationUnit"},"2.5.4.8":{short:"ST",long:"State"},"2.5.4.9":{short:"Street",long:"StreetAddress"},"2.5.4.4":{short:"SN",long:"SurName"},"2.5.4.12":{short:"T",long:"Title"},"1.2.840.113549.1.9.8":{long:"UnstructuredAddress"},"1.2.840.113549.1.9.2":{long:"UnstructuredName"}};class Cr{constructor(e){if(this.publicKey=null,e){const t=new Uint8Array(e);this.LoadRaw(t),this.raw=t}}get SerialNumber(){return this.simpl.serialNumber.valueBlock.toString()}get Issuer(){return this.NameToString(this.simpl.issuer)}get Subject(){return this.NameToString(this.simpl.subject)}async Thumbprint(e="SHA-1"){return xe.crypto.subtle.digest(e,this.raw)}get PublicKey(){return this.publicKey}GetRaw(){return this.raw}async exportKey(e){if(e){const t={algorithm:e,usages:["verify"]};t.algorithm.name.toUpperCase()===Je&&(t.algorithm.namedCurve=this.simpl.subjectPublicKeyInfo.toJSON().crv),this.isHashedAlgorithm(t.algorithm)&&"string"==typeof t.algorithm.hash&&(t.algorithm.hash={name:t.algorithm.hash});const r=await this.simpl.getPublicKey({algorithm:t});return this.publicKey=r,r}return"1.2.840.113549.1.1.1"===this.simpl.subjectPublicKeyInfo.algorithm.algorithmId?this.publicKey=await this.simpl.getPublicKey({algorithm:{algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}}},usages:["verify"]}):this.publicKey=await this.simpl.getPublicKey(),this.publicKey}NameToString(e,t=","){const r=[];return e.typesAndValues.forEach(e=>{const t=e.type,n=Er[t.toString()],s=n?n.short:null;r.push(`${s||t}=${e.value.valueBlock.value}`)}),r.join(t+" ")}LoadRaw(e){this.raw=new Uint8Array(e);const t=i.E(this.raw.buffer);this.simpl=new Q({schema:t.result})}isHashedAlgorithm(e){return!!e.hash}}let kr=class extends Mt{};var Or;ke([Object(n.k)({localName:Ht.ElementNames.X509IssuerName,namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix,required:!0})],kr.prototype,"X509IssuerName",void 0),ke([Object(n.k)({localName:Ht.ElementNames.X509SerialNumber,namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix,required:!0})],kr.prototype,"X509SerialNumber",void 0),kr=ke([Object(n.m)({localName:Ht.ElementNames.X509IssuerSerial})],kr),function(e){e[e.None=0]="None",e[e.EndCertOnly=1]="EndCertOnly",e[e.ExcludeRoot=2]="ExcludeRoot",e[e.WholeChain=3]="WholeChain"}(Or||(Or={}));let Ir=class extends Kt{constructor(e,t=Or.None){if(super(),this.x509crl=null,this.SubjectKeyIdList=[],this.key=null,e)if(e instanceof Uint8Array)this.AddCertificate(new Cr(e));else if(e instanceof Cr)switch(t){case Or.None:case Or.EndCertOnly:this.AddCertificate(e);break;case Or.ExcludeRoot:this.AddCertificatesChainFrom(e,!1);break;case Or.WholeChain:this.AddCertificatesChainFrom(e,!0)}}get Key(){return this.key}async importKey(e){throw new n.n(n.h.METHOD_NOT_SUPPORTED)}async exportKey(e){if(!this.Certificates.length)throw new n.n(n.h.NULL_REFERENCE);const t=await this.Certificates[0].exportKey(e);return this.key=t,t}get Certificates(){return this.X509CertificateList}get CRL(){return this.x509crl}set CRL(e){this.x509crl=e}get IssuerSerials(){return this.IssuerSerialList}get SubjectKeyIds(){return this.SubjectKeyIdList}get SubjectNames(){return this.SubjectNameList}AddCertificate(e){if(!e)throw new n.n(n.h.PARAM_REQUIRED,"certificate");this.X509CertificateList||(this.X509CertificateList=[]),this.X509CertificateList.push(e)}AddIssuerSerial(e,t){if(null==e)throw new n.n(n.h.PARAM_REQUIRED,"issuerName");null==this.IssuerSerialList&&(this.IssuerSerialList=[]);const r={issuerName:e,serialNumber:t};this.IssuerSerialList.push(r)}AddSubjectKeyId(e){if(this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),"string"==typeof e){if(null!=e){let t;t=n.b.FromBase64(e),this.SubjectKeyIdList.push(t)}}else this.SubjectKeyIdList.push(e)}AddSubjectName(e){null==this.SubjectNameList&&(this.SubjectNameList=[]),this.SubjectNameList.push(e)}GetXml(){const e=this.CreateDocument(),t=this.CreateElement(e),r=this.GetPrefix();if(null!=this.IssuerSerialList&&this.IssuerSerialList.length>0&&this.IssuerSerialList.forEach(n=>{const s=e.createElementNS(Ht.NamespaceURI,r+Ht.ElementNames.X509IssuerSerial),i=e.createElementNS(Ht.NamespaceURI,r+Ht.ElementNames.X509IssuerName);i.textContent=n.issuerName,s.appendChild(i);const a=e.createElementNS(Ht.NamespaceURI,r+Ht.ElementNames.X509SerialNumber);a.textContent=n.serialNumber,s.appendChild(a),t.appendChild(s)}),null!=this.SubjectKeyIdList&&this.SubjectKeyIdList.length>0&&this.SubjectKeyIdList.forEach(s=>{const i=e.createElementNS(Ht.NamespaceURI,r+Ht.ElementNames.X509SKI);i.textContent=n.b.ToBase64(s),t.appendChild(i)}),null!=this.SubjectNameList&&this.SubjectNameList.length>0&&this.SubjectNameList.forEach(n=>{const s=e.createElementNS(Ht.NamespaceURI,r+Ht.ElementNames.X509SubjectName);s.textContent=n,t.appendChild(s)}),null!=this.X509CertificateList&&this.X509CertificateList.length>0&&this.X509CertificateList.forEach(s=>{const i=e.createElementNS(Ht.NamespaceURI,r+Ht.ElementNames.X509Certificate);i.textContent=n.b.ToBase64(s.GetRaw()),t.appendChild(i)}),null!=this.x509crl){const s=e.createElementNS(Ht.NamespaceURI,r+Ht.ElementNames.X509CRL);s.textContent=n.b.ToBase64(this.x509crl),t.appendChild(s)}return t}LoadXml(e){super.LoadXml(e),this.IssuerSerialList&&(this.IssuerSerialList=[]),this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),this.SubjectNameList&&(this.SubjectNameList=[]),this.X509CertificateList&&(this.X509CertificateList=[]),this.x509crl=null;let t=this.GetChildren(Ht.ElementNames.X509IssuerSerial);t&&t.forEach(e=>{const t=Mt.GetChild(e,Ht.ElementNames.X509IssuerName,Ht.NamespaceURI,!0),r=Mt.GetChild(e,Ht.ElementNames.X509SerialNumber,Ht.NamespaceURI,!0);t&&t.textContent&&r&&r.textContent&&this.AddIssuerSerial(t.textContent,r.textContent)}),t=this.GetChildren(Ht.ElementNames.X509SKI),t&&t.forEach(e=>{if(e.textContent){const t=n.b.FromBase64(e.textContent);this.AddSubjectKeyId(t)}}),t=this.GetChildren(Ht.ElementNames.X509SubjectName),null!=t&&t.forEach(e=>{e.textContent&&this.AddSubjectName(e.textContent)}),t=this.GetChildren(Ht.ElementNames.X509Certificate),t&&t.forEach(e=>{if(e.textContent){const t=n.b.FromBase64(e.textContent);this.AddCertificate(new Cr(t))}});const r=this.GetChild(Ht.ElementNames.X509CRL,!1);r&&r.textContent&&(this.x509crl=n.b.FromBase64(r.textContent))}AddCertificatesChainFrom(e,t){throw new n.n(n.h.METHOD_NOT_IMPLEMENTED)}};Ir=ke([Object(n.m)({localName:Ht.ElementNames.X509Data})],Ir);let xr=class extends Kt{async importKey(e){const t=await xe.crypto.subtle.exportKey("spki",e);return this.SPKIexp=new Uint8Array(t),this.Key=e,this}async exportKey(e){const t=await xe.crypto.subtle.importKey("spki",this.SPKIexp,e,!0,["verify"]);return this.Key=t,t}};ke([Object(n.k)({localName:Ht.ElementNames.SPKIexp,namespaceURI:Ht.NamespaceURI,prefix:Ht.DefaultPrefix,required:!0,converter:n.j})],xr.prototype,"SPKIexp",void 0),xr=ke([Object(n.m)({localName:Ht.ElementNames.SPKIData})],xr);const Br={};Br[lt]=pt,Br[ht]=dt,Br[ft]=gt,Br[mt]=bt,Br[Ge]=Qe,Br[Xe]=$e,Br[We]=ze,Br[Ye]=Ze,Br[tt]=it,Br[rt]=at,Br[nt]=ot,Br[st]=ut,Br[Ct]=Bt,Br[kt]=Dt,Br[Ot]=Tt,Br[It]=Pt;const Dr={};Dr[Ue]=Me,Dr[Ve]=Fe,Dr[_e]=Ke,Dr[He]=qe;class Tr{static CreateFromName(e){let t;switch(e){case Ht.AlgorithmNamespaces.XmlDsigBase64Transform:t=new Qt;break;case Ht.AlgorithmNamespaces.XmlDsigC14NTransform:t=new $t;break;case Ht.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:t=new zt;break;case Ht.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:t=new Zt;break;case Ht.AlgorithmNamespaces.XmlDsigXPathTransform:case Ht.AlgorithmNamespaces.XmlDsigXsltTransform:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,e);case Ht.AlgorithmNamespaces.XmlDsigExcC14NTransform:t=new er;break;case Ht.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:t=new tr;break;case Ht.AlgorithmNamespaces.XmlDecryptionTransform:default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,e)}return t}static CreateSignatureAlgorithm(e){const t=Br[e.Algorithm]||null;if(t)return new t;if(e.Algorithm===wt){let t;if(e.Any.Some(e=>(e instanceof Ar&&(t=e),!!t)),t)switch(t.DigestMethod.Algorithm){case Ue:return new Nt(t.SaltLength);case Ve:return new At(t.SaltLength);case _e:return new St(t.SaltLength);case He:return new Et(t.SaltLength)}throw new n.n(n.h.CRYPTOGRAPHIC,"Cannot get params for RSA-PSS algoriithm")}throw new Error(`signature algorithm '${e.Algorithm}' is not supported`)}static CreateHashAlgorithm(e){const t=Dr[e];if(t)return new t;throw new Error("hash algorithm '"+e+"' is not supported")}static GetHashAlgorithm(e){const t="string"==typeof e?{name:e}:e;switch(t.name.toUpperCase()){case Pe:return new Me;case Re:return new Fe;case je:return new Ke;case Le:return new qe;default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,t.name)}}static GetSignatureAlgorithm(e){"string"==typeof e.hash&&(e.hash={name:e.hash});const t=e.hash.name;if(!t)throw new Error("Signing algorithm doesn't have name for hash");let r;switch(e.name.toUpperCase()){case ct.toUpperCase():switch(t.toUpperCase()){case Pe:r=new pt;break;case Re:r=new dt;break;case je:r=new gt;break;case Le:r=new bt;break;default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,`${e.name}:${t}`)}break;case yt.toUpperCase():const s=e.saltLength;switch(t.toUpperCase()){case Pe:r=s?new Nt(s):new Bt;break;case Re:r=s?new At(s):new Dt;break;case je:r=s?new St(s):new Tt;break;case Le:r=s?new Et(s):new Pt;break;default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,`${e.name}:${t}`)}e.saltLength=r.algorithm.saltLength;break;case Je:switch(t.toUpperCase()){case Pe:r=new Qe;break;case Re:r=new $e;break;case je:r=new ze;break;case Le:r=new Ze;break;default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,`${e.name}:${t}`)}break;case et:switch(t.toUpperCase()){case Pe:r=new it;break;case Re:r=new at;break;case je:r=new ot;break;case Le:r=new ut;break;default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,`${e.name}:${t}`)}break;default:throw new n.n(n.h.ALGORITHM_NOT_SUPPORTED,e.name)}return r}}class Pr{constructor(e){if(this.signature=new lr,e&&e.nodeType===n.o.Document)this.document=e;else if(e&&e.nodeType===n.o.Element){const t=(new XMLSerializer).serializeToString(e);this.document=(new DOMParser).parseFromString(t,n.a)}}get XmlSignature(){return this.signature}get Signature(){return this.XmlSignature.SignatureValue}async Sign(e,t,r,s={}){let i,a;n.s(r)?r=r.cloneNode(!0).documentElement:n.t(r)&&(r=r.cloneNode(!0));const o=n.r({},e);if(t.algorithm.hash&&(o.hash=t.algorithm.hash),i=Tr.GetSignatureAlgorithm(o),await this.ApplySignOptions(this.XmlSignature,e,t,s),a=this.XmlSignature.SignedInfo,await this.DigestReferences(r),a.SignatureMethod.Algorithm=i.namespaceURI,i instanceof vt){const e=n.r({},t.algorithm,o);"string"==typeof e.hash&&(e.hash={name:e.hash});const r=new Ar(e);this.XmlSignature.SignedInfo.SignatureMethod.Any.Add(r)}else if(et.toUpperCase()===e.name.toUpperCase()){let e=0;const r=t.algorithm;switch(r.hash.name.toUpperCase()){case Pe:e=r.length||160;break;case Re:e=r.length||256;break;case je:e=r.length||384;break;case Le:e=r.length||512}this.XmlSignature.SignedInfo.SignatureMethod.HMACOutputLength=e}const u=this.TransformSignedInfo(r),c=await i.Sign(u,t,o);return this.Key=t,this.XmlSignature.SignatureValue=new Uint8Array(c),n.t(r)&&(this.document=r.ownerDocument),this.XmlSignature}async Verify(e){let t,r;if(e&&("algorithm"in e&&"usages"in e&&"type"in e?r=e:(r=e.key,t=e.content)),!t){const e=this.document;if(!e||!e.documentElement)throw new n.n(n.h.NULL_PARAM,"SignedXml","document");t=e.documentElement}(n.s(t)||n.t(t))&&(t=t.cloneNode(!0));if(await this.ValidateReferences(t)){const e=r?[r]:await this.GetPublicKeys();return this.ValidateSignatureValue(e)}return!1}GetXml(){return this.signature.GetXml()}LoadXml(e){this.signature=lr.LoadXml(e)}toString(){const e=this.XmlSignature;if(e.SignedInfo.References&&e.SignedInfo.References.Some(e=>e.Transforms&&e.Transforms.Some(e=>e instanceof Zt))){const e=this.document.documentElement.cloneNode(!0),t=this.XmlSignature.GetXml();if(!t)throw new n.n(n.h.XML_EXCEPTION,"Cannot get Xml element from Signature");const r=t.cloneNode(!0);return e.appendChild(r),(new XMLSerializer).serializeToString(e)}return this.XmlSignature.toString()}async GetPublicKeys(){const e=[],t=Tr.CreateSignatureAlgorithm(this.XmlSignature.SignedInfo.SignatureMethod);for(const t of this.XmlSignature.KeyInfo.GetIterator())if(t instanceof Ir)for(const r of t.Certificates){const t=await r.exportKey();e.push(t)}else{const r=await t.exportKey();e.push(r)}if(t.algorithm.name.startsWith("RSA"))for(let r=0;r<e.length;r++){const n=e[r];if(n.algorithm.name.startsWith("RSA")){const s=await xe.crypto.subtle.exportKey("spki",n),i=await xe.crypto.subtle.importKey("spki",s,t.algorithm,!0,["verify"]);e[r]=i}}return e}GetSignatureNamespaces(){const e={};return this.XmlSignature.NamespaceURI&&(e[this.XmlSignature.Prefix||""]=this.XmlSignature.NamespaceURI),e}CopyNamespaces(e,t,r){this.InjectNamespaces(Lr(e),t,r)}InjectNamespaces(e,t,r){for(const n in e){const s=e[n];r&&""===n||t.setAttribute("xmlns"+(n?":"+n:""),s)}}async DigestReference(e,t,r){if(this.contentHandler){const r=await this.contentHandler(t,this);r&&(e=n.s(r)?r.documentElement:r)}if(t.Uri){let r;if(t.Uri.indexOf("#xpointer"))"#"===t.Uri[0]&&(r=t.Uri.substring(1));else{let e=t.Uri;e=e.substring(9).replace(/[\r\n\t\s]/g,""),e=e.length<2||"("!==e[0]||")"!==e[e.length-1]?"":e.substring(1,e.length-1),e.length>6&&0===e.indexOf("id(")&&")"===e[e.length-1]&&(r=e.substring(4,e.length-2))}if(r){let t=null;const s=[this.XmlSignature.KeyInfo.GetXml()];this.XmlSignature.ObjectList.ForEach(e=>{s.push(e.GetXml())});for(const i of s)if(i&&(t=Rr(i,r),t)){const r=t.cloneNode(!0);if(n.t(e)&&this.CopyNamespaces(e,r,!1),this.Parent){const e=this.Parent instanceof n.q?this.Parent.GetXml():this.Parent;this.CopyNamespaces(e,r,!0)}this.CopyNamespaces(t,r,!1),this.InjectNamespaces(this.GetSignatureNamespaces(),r,!0),e=r;break}if(!t&&e&&n.t(e)&&(t=n.q.GetElementById(e,r),t)){const r=t.cloneNode(!0);this.CopyNamespaces(t,r,!1),this.CopyNamespaces(e,r,!1),e=r}if(null==t)throw new n.n(n.h.CRYPTOGRAPHIC,"Cannot get object by reference: "+r)}}let s=null;if(t.Transforms&&t.Transforms.Count){if(Oe.BufferSourceConverter.isBufferSource(e))throw new Error("Transformation for argument 'source' of type BufferSource is not implemented");s=this.ApplyTransforms(t.Transforms,e)}else if(t.Uri&&"#"!==t.Uri[0])if(n.t(e)){if(!e.ownerDocument)throw new Error("Cannot get ownerDocument from the XML document");s=(new XMLSerializer).serializeToString(e.ownerDocument)}else s=Oe.BufferSourceConverter.toArrayBuffer(e);else{const t=new $t;Oe.BufferSourceConverter.isBufferSource(e)&&(e=n.d(Oe.Convert.ToUtf8String(e)).documentElement),t.LoadInnerXml(e),s=t.GetOutput()}if(!t.DigestMethod.Algorithm)throw new n.n(n.h.NULL_PARAM,"Reference","DigestMethod");return Tr.CreateHashAlgorithm(t.DigestMethod.Algorithm).Digest(s)}async DigestReferences(e){for(const t of this.XmlSignature.SignedInfo.References.GetIterator()){if(t.DigestValue)continue;t.DigestMethod.Algorithm||(t.DigestMethod.Algorithm=(new Fe).namespaceURI);const r=await this.DigestReference(e,t,!1);t.DigestValue=r}}TransformSignedInfo(e){const t=Tr.CreateFromName(this.XmlSignature.SignedInfo.CanonicalizationMethod.Algorithm),r=this.XmlSignature.SignedInfo.GetXml();if(!r)throw new n.n(n.h.XML_EXCEPTION,"Cannot get Xml element from SignedInfo");const s=r.cloneNode(!0);if(this.CopyNamespaces(r,s,!1),e&&!Oe.BufferSourceConverter.isBufferSource(e)&&(e.nodeType===n.o.Document?this.CopyNamespaces(e.documentElement,s,!1):this.CopyNamespaces(e,s,!1)),this.Parent){const e=this.Parent instanceof n.q?this.Parent.GetXml():this.Parent;e&&this.CopyNamespaces(e,s,!1)}const i=n.f(r);for(const e in i){const t=i[e];e!==s.prefix&&s.setAttribute("xmlns"+(e?":"+e:""),t)}t.LoadInnerXml(s);return t.GetOutput()}ResolveTransform(e){if("string"==typeof e)switch(e){case"enveloped":return new Zt;case"c14n":return new $t;case"c14n-com":return new zt;case"exc-c14n":return new er;case"exc-c14n-com":return new tr;case"base64":return new Qt;default:throw new n.n(n.h.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM,e)}switch(e.name){case"xpath":{const t=new rr;t.XPath=e.selector;const r=t.GetXml();if(r&&e.namespaces)for(const[t,n]of Object.entries(e.namespaces))r.firstChild.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:"+t,n);return t}default:throw new n.n(n.h.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM,e.name)}}ApplyTransforms(e,t){let r=null;if(e.Sort((e,t)=>{const r=[$t,zt,er,tr];return r.some(t=>e instanceof t)?1:r.some(e=>t instanceof e)?-1:0}).ForEach(e=>{e.LoadInnerXml(t),e instanceof rr?e.GetOutput():r=e.GetOutput()}),1===e.Count&&e.Item(0)instanceof Zt){const e=new $t;e.LoadInnerXml(t),r=e.GetOutput()}return r}async ApplySignOptions(e,t,r,s){if(s.id&&(this.XmlSignature.Id=s.id),s.keyValue&&r.algorithm.name.toUpperCase()!==et){e.KeyInfo||(e.KeyInfo=new Wt);const t=e.KeyInfo,r=new Sr;t.Add(r),await r.importKey(s.keyValue)}if(s.x509){e.KeyInfo||(e.KeyInfo=new Wt);const t=e.KeyInfo;s.x509.forEach(e=>{const r=n.b.FromBase64(e),s=new Ir(r);t.Add(s)})}if(s.references&&s.references.forEach(t=>{const r=new ir;t.id&&(r.Id=t.id),null!==t.uri&&void 0!==t.uri&&(r.Uri=t.uri),t.type&&(r.Type=t.type);const n=Tr.GetHashAlgorithm(t.hash);if(r.DigestMethod.Algorithm=n.namespaceURI,t.transforms&&t.transforms.length){const e=new nr;t.transforms.forEach(t=>{e.Add(this.ResolveTransform(t))}),r.Transforms=e}e.SignedInfo.References||(e.SignedInfo.References=new ar),e.SignedInfo.References.Add(r)}),!e.SignedInfo.References.Count){const t=new ir;e.SignedInfo.References.Add(t)}}async ValidateReferences(e){for(const t of this.XmlSignature.SignedInfo.References.GetIterator()){const r=await this.DigestReference(e,t,!1),s=n.b.ToBase64(r),i=n.b.ToString(t.DigestValue,"base64");if(s!==i){const e=`Invalid digest for uri '${t.Uri}'. Calculated digest is ${s} but the xml to validate supplies digest ${i}`;throw new n.n(n.h.CRYPTOGRAPHIC,e)}}return!0}async ValidateSignatureValue(e){let t,r;r=this.TransformSignedInfo(this.document),t=Tr.CreateSignatureAlgorithm(this.XmlSignature.SignedInfo.SignatureMethod);for(const n of e){if(await t.Verify(r,n,this.Signature))return!0}return!1}}function Rr(e,t){if(e.nodeType!==n.o.Element)return null;if(e.hasAttribute("Id")&&e.getAttribute("Id")===t)return e;if(e.childNodes&&e.childNodes.length)for(let r=0;r<e.childNodes.length;r++){const n=Rr(e.childNodes[r],t);if(n)return n}return null}function jr(e,t,r){t in e||(e[t]=r)}function Lr(e){const t={};return function e(t,r={}){if(n.t(t)){t.namespaceURI&&"http://www.w3.org/XML/1998/namespace"!==t.namespaceURI&&jr(r,t.prefix?t.prefix:"",t.namespaceURI);for(let e=0;e<t.attributes.length;e++){const n=t.attributes.item(e);n&&"xmlns"===n.prefix&&jr(r,n.localName?n.localName:"",n.value)}t.parentNode&&e(t.parentNode,r)}}(e,t),t}}]);