solid-logic 3.1.1-c9e8db8 → 3.1.1-ecb4985

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 (173) hide show
  1. package/README.md +108 -2
  2. package/dist/789.solid-logic.js +11 -0
  3. package/dist/789.solid-logic.js.map +1 -0
  4. package/dist/789.solid-logic.min.js +1 -0
  5. package/dist/841.solid-logic.js +12133 -0
  6. package/dist/841.solid-logic.js.map +1 -0
  7. package/dist/841.solid-logic.min.js +73 -0
  8. package/dist/841.solid-logic.min.js.map +1 -0
  9. package/dist/acl/aclLogic.d.ts +5 -0
  10. package/{lib → dist}/acl/aclLogic.d.ts.map +1 -1
  11. package/dist/acl/aclLogic.js +118 -0
  12. package/dist/acl/aclLogic.js.map +1 -0
  13. package/dist/authSession/authSession.js +3 -0
  14. package/dist/authSession/authSession.js.map +1 -0
  15. package/{lib → dist}/authn/SolidAuthnLogic.d.ts +3 -3
  16. package/{lib → dist}/authn/SolidAuthnLogic.d.ts.map +1 -1
  17. package/dist/authn/SolidAuthnLogic.js +110 -0
  18. package/dist/authn/SolidAuthnLogic.js.map +1 -0
  19. package/{lib → dist}/authn/authUtil.d.ts +1 -1
  20. package/dist/authn/authUtil.js +67 -0
  21. package/dist/authn/authUtil.js.map +1 -0
  22. package/{lib → dist}/chat/chatLogic.d.ts +1 -1
  23. package/dist/chat/chatLogic.js +157 -0
  24. package/dist/chat/chatLogic.js.map +1 -0
  25. package/{lib → dist}/inbox/inboxLogic.d.ts +1 -1
  26. package/{lib → dist}/inbox/inboxLogic.d.ts.map +1 -1
  27. package/dist/inbox/inboxLogic.js +52 -0
  28. package/dist/inbox/inboxLogic.js.map +1 -0
  29. package/{lib → dist}/index.d.ts +1 -1
  30. package/{lib → dist}/index.d.ts.map +1 -1
  31. package/dist/index.js +14 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/issuer/issuerLogic.js +37 -0
  34. package/dist/issuer/issuerLogic.js.map +1 -0
  35. package/{lib → dist}/logic/CustomError.d.ts.map +1 -1
  36. package/dist/logic/CustomError.js +28 -0
  37. package/dist/logic/CustomError.js.map +1 -0
  38. package/dist/logic/solidLogic.d.ts +6 -0
  39. package/{lib → dist}/logic/solidLogic.d.ts.map +1 -1
  40. package/dist/logic/solidLogic.js +65 -0
  41. package/dist/logic/solidLogic.js.map +1 -0
  42. package/dist/logic/solidLogicSingleton.js +18 -0
  43. package/dist/logic/solidLogicSingleton.js.map +1 -0
  44. package/{lib → dist}/profile/profileLogic.d.ts +1 -1
  45. package/dist/profile/profileLogic.js +129 -0
  46. package/dist/profile/profileLogic.js.map +1 -0
  47. package/dist/solid-logic.esm.external.js +7345 -0
  48. package/dist/solid-logic.esm.external.js.map +1 -0
  49. package/dist/solid-logic.esm.external.min.js +32 -0
  50. package/dist/solid-logic.esm.external.min.js.map +1 -0
  51. package/dist/solid-logic.external.js +7404 -0
  52. package/dist/solid-logic.external.js.map +1 -0
  53. package/dist/solid-logic.external.min.js +32 -0
  54. package/dist/solid-logic.external.min.js.map +1 -0
  55. package/dist/solid-logic.js +30225 -0
  56. package/dist/solid-logic.js.map +1 -0
  57. package/dist/solid-logic.min.js +41 -0
  58. package/dist/solid-logic.min.js.map +1 -0
  59. package/dist/typeIndex/typeIndexLogic.js +186 -0
  60. package/dist/typeIndex/typeIndexLogic.js.map +1 -0
  61. package/{lib → dist}/types.d.ts +2 -2
  62. package/dist/types.js +2 -0
  63. package/{lib → dist}/util/containerLogic.d.ts +1 -1
  64. package/{lib → dist}/util/containerLogic.d.ts.map +1 -1
  65. package/{src/util/containerLogic.ts → dist/util/containerLogic.js} +15 -23
  66. package/dist/util/containerLogic.js.map +1 -0
  67. package/dist/util/debug.d.ts.map +1 -0
  68. package/dist/util/debug.js +14 -0
  69. package/dist/util/debug.js.map +1 -0
  70. package/dist/util/ns.js +5 -0
  71. package/dist/util/ns.js.map +1 -0
  72. package/{lib → dist}/util/utilityLogic.d.ts +1 -1
  73. package/{lib → dist}/util/utilityLogic.d.ts.map +1 -1
  74. package/dist/util/utilityLogic.js +144 -0
  75. package/dist/util/utilityLogic.js.map +1 -0
  76. package/{lib → dist}/util/utils.d.ts +1 -1
  77. package/{lib → dist}/util/utils.d.ts.map +1 -1
  78. package/dist/util/utils.js +39 -0
  79. package/dist/util/utils.js.map +1 -0
  80. package/dist/versionInfo.js +31 -0
  81. package/dist/versionInfo.js.map +1 -0
  82. package/package.json +56 -17
  83. package/eslint.config.js +0 -29
  84. package/jest.config.js +0 -10
  85. package/lib/acl/aclLogic.d.ts +0 -5
  86. package/lib/acl/aclLogic.js +0 -168
  87. package/lib/acl/aclLogic.js.map +0 -1
  88. package/lib/authSession/authSession.js +0 -6
  89. package/lib/authSession/authSession.js.map +0 -1
  90. package/lib/authn/SolidAuthnLogic.js +0 -193
  91. package/lib/authn/SolidAuthnLogic.js.map +0 -1
  92. package/lib/authn/authUtil.js +0 -105
  93. package/lib/authn/authUtil.js.map +0 -1
  94. package/lib/chat/chatLogic.js +0 -272
  95. package/lib/chat/chatLogic.js.map +0 -1
  96. package/lib/inbox/inboxLogic.js +0 -139
  97. package/lib/inbox/inboxLogic.js.map +0 -1
  98. package/lib/index.js +0 -31
  99. package/lib/index.js.map +0 -1
  100. package/lib/issuer/issuerLogic.js +0 -52
  101. package/lib/issuer/issuerLogic.js.map +0 -1
  102. package/lib/logic/CustomError.js +0 -89
  103. package/lib/logic/CustomError.js.map +0 -1
  104. package/lib/logic/solidLogic.d.ts +0 -6
  105. package/lib/logic/solidLogic.js +0 -102
  106. package/lib/logic/solidLogic.js.map +0 -1
  107. package/lib/logic/solidLogicSingleton.js +0 -94
  108. package/lib/logic/solidLogicSingleton.js.map +0 -1
  109. package/lib/profile/profileLogic.js +0 -259
  110. package/lib/profile/profileLogic.js.map +0 -1
  111. package/lib/typeIndex/typeIndexLogic.js +0 -399
  112. package/lib/typeIndex/typeIndexLogic.js.map +0 -1
  113. package/lib/types.js +0 -3
  114. package/lib/util/containerLogic.js +0 -102
  115. package/lib/util/containerLogic.js.map +0 -1
  116. package/lib/util/debug.d.ts.map +0 -1
  117. package/lib/util/debug.js +0 -40
  118. package/lib/util/debug.js.map +0 -1
  119. package/lib/util/ns.js +0 -44
  120. package/lib/util/ns.js.map +0 -1
  121. package/lib/util/utilityLogic.js +0 -284
  122. package/lib/util/utilityLogic.js.map +0 -1
  123. package/lib/util/utils.js +0 -47
  124. package/lib/util/utils.js.map +0 -1
  125. package/src/acl/aclLogic.ts +0 -156
  126. package/src/authSession/authSession.ts +0 -7
  127. package/src/authn/SolidAuthnLogic.ts +0 -127
  128. package/src/authn/authUtil.ts +0 -70
  129. package/src/chat/chatLogic.ts +0 -226
  130. package/src/inbox/inboxLogic.ts +0 -59
  131. package/src/index.ts +0 -22
  132. package/src/issuer/issuerLogic.ts +0 -40
  133. package/src/logic/CustomError.ts +0 -29
  134. package/src/logic/solidLogic.ts +0 -76
  135. package/src/logic/solidLogicSingleton.ts +0 -20
  136. package/src/profile/profileLogic.ts +0 -125
  137. package/src/typeIndex/typeIndexLogic.ts +0 -198
  138. package/src/types.ts +0 -122
  139. package/src/util/debug.ts +0 -20
  140. package/src/util/ns.ts +0 -5
  141. package/src/util/utilityLogic.ts +0 -156
  142. package/src/util/utils.ts +0 -52
  143. package/test/aclLogic.test.ts +0 -24
  144. package/test/authUtil.test.ts +0 -23
  145. package/test/chatLogic.test.ts +0 -316
  146. package/test/container.test.ts +0 -58
  147. package/test/helpers/dataSetup.ts +0 -134
  148. package/test/helpers/setup.ts +0 -17
  149. package/test/inboxLogic.test.ts +0 -218
  150. package/test/logic.test.ts +0 -29
  151. package/test/profileLogic.test.ts +0 -246
  152. package/test/solidAuthLogic.test.ts +0 -49
  153. package/test/typeIndexLogic.test.ts +0 -255
  154. package/test/utilityLogic.test.ts +0 -179
  155. package/test/utils.test.ts +0 -32
  156. package/tsconfig.json +0 -75
  157. /package/{lib → dist}/authSession/authSession.d.ts +0 -0
  158. /package/{lib → dist}/authSession/authSession.d.ts.map +0 -0
  159. /package/{lib → dist}/authn/authUtil.d.ts.map +0 -0
  160. /package/{lib → dist}/chat/chatLogic.d.ts.map +0 -0
  161. /package/{lib → dist}/issuer/issuerLogic.d.ts +0 -0
  162. /package/{lib → dist}/issuer/issuerLogic.d.ts.map +0 -0
  163. /package/{lib → dist}/logic/CustomError.d.ts +0 -0
  164. /package/{lib → dist}/logic/solidLogicSingleton.d.ts +0 -0
  165. /package/{lib → dist}/logic/solidLogicSingleton.d.ts.map +0 -0
  166. /package/{lib → dist}/profile/profileLogic.d.ts.map +0 -0
  167. /package/{lib → dist}/typeIndex/typeIndexLogic.d.ts +0 -0
  168. /package/{lib → dist}/typeIndex/typeIndexLogic.d.ts.map +0 -0
  169. /package/{lib → dist}/types.d.ts.map +0 -0
  170. /package/{lib → dist}/types.js.map +0 -0
  171. /package/{lib → dist}/util/debug.d.ts +0 -0
  172. /package/{lib → dist}/util/ns.d.ts +0 -0
  173. /package/{lib → dist}/util/ns.d.ts.map +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid-logic.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;ACVA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS,WAAW;;AAEpB;AACA;AACA;AACA,SAAS,WAAW;;AAEpB;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA,SAAS,WAAW;;AAEpB;AACA;AACA,SAAS,UAAU;;AAEnB;AACA;;;;;;;;;;;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,UAAU,E;;;;;;;;;;;;;;;;;;ACXzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC2C;;AAE3C;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACO;AACP,aAAa,4DAAe;AAC5B;;AAEA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,SAAS;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,UAAU;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,mCAAmC;AAC7D;AACA;AACA;AACA;AACA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxM4J;AAC5J;AACO;AACP;AACA;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP,yCAAyC,gEAAkB;AAC3D;;AAEA;AACO;AACP,2FAA2F,+DAAiB,qBAAqB,8DAAgB,qBAAqB,+DAAiB,qBAAqB,gEAAkB,qBAAqB,6DAAe,qBAAqB,2DAAa;AACpS;;AAEA;AACA;AACO;AACP,2FAA2F,+DAAiB,qBAAqB,8DAAgB,qBAAqB,+DAAiB,qBAAqB,gEAAkB,qBAAqB,6DAAe,qBAAqB,2DAAa;AACpS;;AAEA;AACO;AACP,0CAA0C,+DAAiB,qBAAqB,+DAAiB,qBAAqB,8DAAgB;AACtI;;AAEA;AACO;AACP,yCAAyC,8DAAgB;AACzD;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP,4BAA4B,6DAAe;AAC3C;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP,0CAA0C,+DAAiB,qBAAqB,8DAAgB,qBAAqB,+DAAiB;AACtI;;AAEA;AACO;AACP,0CAA0C,+DAAiB,qBAAqB,8DAAgB;AAChG;;AAEA;AACO;AACP,0CAA0C,+DAAiB,qBAAqB,8DAAgB,qBAAqB,+DAAiB,qBAAqB,6DAAe;AAC1K;;AAEA;AACO;AACP,0CAA0C,+DAAiB,qBAAqB,8DAAgB,qBAAqB,+DAAiB,qBAAqB,kEAAoB;AAC/K,C;;;;;;;;;;;AChFA;AACO;AACP;AACA;AACA;AACA;AACA,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACgC;AACR;AACK;AACQ;AACrC;AACA;AACA;AAC4B;AACrB;AACP,gCAAgC,cAAc;AAC9C,aAAa,4DAAS;AACtB;AACO;AACP,aAAa,4DAAS;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,qBAAqB;AACrB;AACO;AACP;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gCAAgC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA;AACA,kBAAkB,gCAAgC;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO;AACP;AACA,eAAe,qDAAS;AACxB,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,2CAA2C,QAAQ;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,sBAAsB,sBAAsB,wBAAwB;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,oBAAoB,4BAA4B;AAChD;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA,iEAAiE,sBAAsB,sBAAsB;AAC7G,IAAI;AACJ,0BAA0B;AAC1B;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA,uBAAuB;AACvB;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACO;AACP;AACA;AACA;AACA;AAC2C;;AAE3C;AACA;AACA;AACO;AACP;AACA;AACA,MAAM,KAA6B;AACnC;AACA,kBAAkB,qDAAS;AAC3B;AACA,IAAI;AACJ;AACA,wCAAwC;AACxC,MAAM;AACN,oBAAoB,qDAAS,IAAI;AACjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO;AACP,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;;AAEA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;;AAEzB,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA,C;;;;;;;;;;;;;;;ACjTA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,GAAG;AACH;;;ACRkC;AAClC;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;;;ACVkC;AACS;AAC3C;AACA,UAAU,WAAW;AACrB,qBAAqB,OAAO;AAC5B;;;ACL+C;AAC/C;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;;ACRA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,YAAY;AACZ,YAAY;AACZ,aAAa;AACb,eAAe;AACf;AACA;AACA,iEAAe,GAAG,E;;;;;;;ACZlB;AACA;AACA;AACA;AACA,QAAQ,qBAAM,oBAAoB,qBAAM;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA,CAAC;AACD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,qBAAM,oBAAoB,qBAAM;AAC5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;;AAEA;AACA;AACA,uDAAuD;AACvD,UAAU;AACV;AACA,UAAU;AACV,8EAA8E;AAC9E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,qBAAqB;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,uCAAuC,4BAA4B;AACnE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,0BAA0B,eAAe;AACxE;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;;AAEA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iDAAiD,aAAa;;AAE9D;;AAEA,CAAC,IAAI;AACL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,kBAAe;AACf,aAAa,mCAAmC,OAAO;AACvD,eAAe;AACf,eAAe;AACf,gBAAgB;AAChB;;;;;;;;;;;;;;;;;;AC7qBoE;AAC7B;AACJ;AACS;AACE;AACP;;AAEvC;AACA;AACA;AACe,wBAAwB,+DAAI;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,oEAAS;AACnB,IAAI,0FAAe,mBAAmB,+DAAiB;AACvD,IAAI,0FAAe,qBAAqB,6DAAU;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,8DAAM;AACd;AACA;AACA;AACA;AACA,C;;;;;;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAA0C;AAChD,IAAI,iCAAO,EAAE,oCAAE,OAAO;AAAA;AAAA;AAAA,kGAAC;AACvB,IAAI,KAAK;AAAA,EAIN;AACH,CAAC;AACD;;AAEA;AACA,sBAAsB;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;AACA;;AAEA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;;AAEA;AACA,WAAW;;AAEX;AACA;AACA,WAAW;;AAEX;AACA;AACA,WAAW;;AAEX;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,0BAA0B;AACnF,yDAAyD,0BAA0B;AACnF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,0BAA0B;AACnF,yDAAyD,0BAA0B;AACnF;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,qBAAqB;AACvC;AACA;;AAEA;;AAEA;AACA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,uBAAuB;;AAEvB,mCAAmC,+BAA+B;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;;AAEX;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,8BAA8B,UAAU;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,mBAAmB;AAClD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,oBAAoB;AACpB,2CAA2C;AAC3C,wCAAwC,SAAS,OAAO,UAAU;AAClE,qCAAqC,UAAU;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb,WAAW;AACX;AACA,SAAS;AACT;AACA;AACA,kCAAkC,UAAU;AAC5C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,8BAA8B,gBAAgB;AAC9C,+BAA+B,2BAA2B;AAC1D,+BAA+B,4BAA4B;AAC3D,+BAA+B,qBAAqB,GAAG,UAAU;AACjE,+BAA+B,QAAQ,UAAU;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,QAAQ,YAAY;AACnD,kCAAkC,QAAQ,2BAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,WAAW;AACX;AACA;AACA,8BAA8B,aAAa;AAC3C;AACA;AACA,8BAA8B,cAAc;AAC5C,+BAA+B,cAAc;AAC7C;AACA;AACA,+BAA+B;AAC/B,uEAAuE,KAAK;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,iDAAiD;AACjD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,+BAA+B,gBAAgB;AAC/C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,uBAAuB;AACzD,mCAAmC,8BAA8B;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,wBAAwB;AAC9D,sCAAsC,wBAAwB;AAC9D,yCAAyC,oCAAoC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,wBAAwB;AAC9D,sCAAsC,wBAAwB;AAC9D;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,+BAA+B,YAAY;AAC3C;AACA;AACA,+BAA+B,YAAY;AAC3C;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,8BAA8B;AAC7E,+CAA+C,yCAAyC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,uGAAuG;;AAEvG;AACA;AACA,kCAAkC,oBAAoB;AACtD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,eAAe;AACf;;AAEA;AACA,eAAe;AACf;;AAEA;AACA,eAAe;AACf;;AAEA;AACA,eAAe;AACf;;AAEA;AACA,eAAe;AACf;;AAEA;AACA;;AAEA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;;;AAGA,8BAA8B;AAC9B,4CAA4C,SAAS,kBAAkB;AACvE;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,qCAAqC,gBAAgB;AACrD,WAAW;AACX,uBAAuB,gBAAgB;AACvC;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;AAGA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;;;;;;;ACrnJD;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,KAAK;AACzB;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;ACjFA,iBAAiB,GAAG,IAAiD,oBAAoB,KAAK;AAAA,aAAiI,CAAC,kBAAkB,mBAAmB,SAAS,cAAc,4BAA4B,YAAY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AAS,EAAE,mBAAmB,GAAG,G;;;;;;;;AChC9z2C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;;AAEnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,eAAe;AACf;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;;AAEA,kCAAkC,QAAQ;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,QAAQ;AACR;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;;AAEA;AACA,SAAS,yBAAyB;AAClC;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,8DAA8D,YAAY;AAC1E;AACA,8DAA8D,YAAY;AAC1E;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,qCAAqC,YAAY;AACjD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;;;;;;;;;AChfY;;AAEZ,kBAAkB;AAClB,mBAAmB;AACnB,qBAAqB;;AAErB;AACA;AACA;;AAEA;AACA,mCAAmC,SAAS;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C,UAAU;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACrJA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEY;;AAEZ,eAAe,mBAAO,CAAC,IAAW;AAClC,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA;AACA;AACA;;AAEA,UAAc;AACd,yBAAkB;AAClB,UAAyB;;AAEzB;AACA,yBAAkB;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,YAAY;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;;AAEA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,UAAyB;AACvC,iDAAiD,EAAE;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB,eAAe;AACxC;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,yBAAyB,QAAQ;AACjC;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA,qBAAqB,WAAW,GAAG,IAAI;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,gBAAgB,WAAW,GAAG,IAAI,KAAK,aAAa;AACpD;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;;AAEA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,KAAK,mDAAmD,cAAc;AACzF,GAAG;AACH;AACA;AACA,+BAA+B,IAAI;AACnC;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,MAAM,aAAa,SAAS;AACtD;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,SAAS,gBAAgB;AACzB,cAAc,oBAAoB,EAAE,IAAI;AACxC;AACA,YAAY,gBAAgB,EAAE,IAAI;AAClC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,GAAG,SAAS,GAAG,KAAK,qBAAqB,EAAE,EAAE;AACpE,QAAQ;AACR,yBAAyB,GAAG,KAAK,yBAAyB,EAAE,EAAE;AAC9D,mBAAmB,yBAAyB,EAAE,EAAE;AAChD;AACA,MAAM;AACN,oBAAoB,IAAI,EAAE,GAAG,SAAS,IAAI,EAAE,EAAE;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0CAA0C,cAAc,SAAS,OAAO;AACxE;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,YAAY;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;ACzjEA,mD;;;;;;;;;;;;ACAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;AACA,IAAI,0FAAe;AACnB;AACA,IAAI,0FAAe;AACnB;AACA,IAAI,0FAAe;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0FAAe;AACf;AACA,0FAAe,uB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3GR;AACA;AACA;AACA;AACA;AACP;AACO;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,4D;;;;;;UC/CA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;;;;WC5BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,sDAAsD;WACtD,sCAAsC,mGAAmG;WACzI;WACA;WACA;WACA;WACA;WACA,E;;;;;WCzBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,EAAE;WACF,E;;;;;WCRA;WACA;WACA;WACA;WACA,E;;;;;WCJA;WACA;WACA;WACA;WACA,GAAG;WACH;WACA;WACA,CAAC,I;;;;;WCPD;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,EAAE;WACF;WACA,E;;;;;WCVA,wF;;;;;WCAA;WACA;WACA;WACA;WACA,uBAAuB,4BAA4B;WACnD;WACA;WACA;WACA,iBAAiB,oBAAoB;WACrC;WACA,mGAAmG,YAAY;WAC/G;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,mEAAmE,iCAAiC;WACpG;WACA;WACA;WACA,E;;;;;WCzCA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;WCNA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,kC;;;;;WClBA;;WAEA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA,iCAAiC;;WAEjC;WACA;WACA;WACA,KAAK;WACL,eAAe;WACf;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;WACA;WACA,4G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrFA,uDAAuD;AAChD,SAAS,SAAG,CAAC,GAAG,IAAW;IAChC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AACtB,CAAC;AAEM,SAAS,IAAI,CAAC,GAAG,IAAW;IACjC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACvB,CAAC;AAEM,SAAS,KAAK,CAAC,GAAG,IAAW;IAClC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;AACxB,CAAC;AAEM,SAAS,KAAK,CAAC,GAAG,IAAW;IAClC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;AACxB,CAAC;;;ACfyC;AACnC;AACA;AACP,kBAAkB,uDAAO;AAClB;AACP,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,0DAA0D,cAAc,aAAa,MAAM;AAC3F;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClD0D;AACnD;AACP;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA,oBAAoB,sBAAsB;AAC1C;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA;AACO;AACP;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACpCO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,yBAAyB,SAAS,0BAA0B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,yBAAyB,SAAS,0BAA0B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,uBAAgB;AAC7B;AACA;AACA;AACA;AACA;AACA,uBAAgB;AACT;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;;;ACjHqD;AACtC;AACf,wBAAwB,cAAc;AACtC;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA,sBAAsB,uBAAgB,QAAQ,KAAK;AACnD;AACA;;;AC3BA,gDAAe,MAAM,EAAC;AACf;;;ACDP,uDAAe;AACf;AACA,gBAAgB,gBAAgB;AAChC;AACA,mCAAmC,KAAK;AACxC;AACA;AACA,CAAC,EAAC;;;ACPF;AACA,2EAA2E,MAAM,UAAU,KAAK;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,kBAAkB,OAAO,KAAK;AAC3D;AACA;AACA,6BAA6B,WAAW,KAAK,UAAU;AACvD;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;;AC5JA;AACA;AACA;AACA;AACA,8BAA8B,iBAAiB,OAAO,KAAK;AAC3D;AACA;AACA,8BAA8B,UAAU,KAAK,SAAS;AACtD;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA,4BAA4B,OAAO;AACnC;AACA;AACA,qCAAqC,YAAY;AACjD;AACA;AACA;AACA,+CAA+C,wBAAwB;AACvE;AACA;AACA;AACA;AACA,wDAAe;AACf;AACA,CAAC,EAAC;AACK;AACP,kCAAkC,KAAK;AACvC;;;AC9B6C;AAC7C,kDAAe;AACf,QAAQ,WAAW;AACnB;AACA;AACA;AACA,CAAC,EAAC;AACK;;;ACPP;AACA;AACA;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACfsC;AAC/B;AACP,WAAW,QAAQ;AACnB;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;;;ACZoC;AACiB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,8BAA8B,kBAAkB;AAClF;AACA;AACA;AACA;AACA;AACA,kCAAkC,wCAAwC,kBAAkB;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,qCAAqC;AAC1E;AACA;AACA;AACA;AACA,8BAA8B,uBAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,8BAA8B,uBAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,8BAA8B,uBAAgB;AAC9C;AACA;AACA;AACA;AACA,sBAAsB,uBAAgB;AACtC;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,YAAY,uBAAuB;AACnC;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA,WAAW,SAAM;AACjB;AACA,iDAAe,KAAK,EAAC;;;ACvGoB;AACD;AACA;AACxC,8BAA8B,MAAM;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,UAAS,GAAG,aAAa;AACrD;AACA;AACA;AACA,yBAAyB,kBAAkB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,eAAe;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAK;AACb;AACA,mBAAmB,MAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,eAAe;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,KAAK;AACb;AACA,mBAAmB,MAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,oDAAe,EAAE,yCAAyC,EAAC;;;ACnEN;AACI;AACC;AACjB;AACE;AAC5B;AACf;AACA,oBAAoB,aAAS;AAC7B;AACA;AACA,oBAAoB,aAAS;AAC7B;AACA,QAAQ,WAAW;AACnB,QAAQ,iBAAiB;AACzB;AACA;AACA;AACA;AACA,gCAAgC,iBAAe,SAAS,KAAK;AAC7D;AACA,eAAe,SAAM,gCAAgC,aAAa,cAAc,iBAAiB;AACjG;AACA,wBAAwB,iBAAe,SAAS,KAAK;AACrD;;;ACvB8C;AACV;AACe;AACC;AACpD;AACA,4BAA4B,YAAY;AACxC,IAAI,gBAAc;AAClB,sBAAsB,SAAe;AACrC;AACA,qBAAqB,SAAM;AAC3B;AACA;AACA;AACA;AACA;AACA,qDAAe,MAAM,EAAC;;;ACftB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAe,UAAU,EAAC;;;ACrB0C;AACP;AAC1B;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,qGAAqG,MAAM;AAC3G;AACA;AACA,4FAA4F,IAAI;AAChG;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,KAAS;AAC7B,YAAY,WAAe;AAC3B;AACA;AACA;AACA,SAAS,WAAS;AAClB,4BAA4B,OAAe,cAAc,KAAK;AAC9D;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;AACA;AACA,oBAAoB,KAAS;AAC7B;AACA;AACA,oBAAoB,YAAgB;AACpC;AACA;AACA;AACA,oBAAoB,WAAe;AACnC;AACA;AACA;AACA;AACA,SAAS,WAAS;AAClB,4BAA4B,OAAe,cAAc,KAAK;AAC9D;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,EAAE;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAe,mCAAmC,EAAC;AAC5C;;;AC5E8C;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uBAAgB,gCAAgC,UAAU;AAChF;AACA;AACA,yDAAyD,UAAU;AACnE;AACA;AACA,yDAAyD,UAAU;AACnE;AACA;AACA;AACA;AACA,oDAAe,YAAY,EAAC;;;ACjC5B;AACA;AACA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,0DAAe,kBAAkB,EAAC;;;ACVkC;AACD;AAChB;AACE;AACV;AACpC;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP,SAAS,QAAQ;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAe;AAClC;AACA;AACA,0BAA0B,uBAAgB;AAC1C;AACA;AACA;AACA,mBAAmB,UAAW,GAAG,aAAa;AAC9C;AACA,sBAAsB,uBAAgB;AACtC;AACA;;;AC5CiE;AACpB;AACwD;AAChC;AACnB;AACJ;AACoB;AACZ;AACY;AACtB;AACI;AACzC;AACP,SAAS,QAAQ;AACjB,kBAAkB,UAAU;AAC5B;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA,qCAAqC,QAAQ;AAC7C,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA,oCAAoC,MAAS;AAC7C,oCAAoC,OAAO;AAC3C;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA,SAAS,WAAU;AACnB,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAY,CAAC,UAAU;AAC9C;AACA;AACA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA,YAAY,MAAM;AAClB;AACA,kBAAkB,UAAU;AAC5B;AACA,kCAAkC,mBAAkB;AACpD;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B,YAAY,KAAK;AACjB,wBAAwB,SAAS;AACjC;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA,iBAAiB,MAAM,CAAC,OAAO,8BAA8B,OAAO,gDAAgD,OAAO;AAC3H;AACA;AACA,oBAAoB,MAAS;AAC7B;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA,2BAA2B,cAAM;AACjC;AACA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;AACA,sBAAsB,MAAS;AAC/B;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;;ACzHyD;AACP;AACE;AAC7C;AACP;AACA,cAAc,OAAO;AACrB;AACA;AACA,kBAAkB,UAAU;AAC5B;AACA,YAAY,uDAAuD;AACnE;AACA,kBAAkB,UAAU;AAC5B;AACA,2BAA2B,eAAe,GAAG,gDAAgD;AAC7F,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;;;ACpBA,4CAAe,2CAA2C,EAAC;;;ACA3D;AACA;AACA;AACA;AACA;AACA;AACA,2CAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAC;;;ACtDmF;AACzC;AACb;AACF;AACS;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAe,8CAA8C;AAC7D;AACA;AACA,6BAA6B,OAAO;AACpC;AACA;AACA;AACA,SAAS,QAAQ;AACjB,kBAAkB,UAAU;AAC5B;AACA,YAAY,MAAM;AAClB;AACA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA,YAAY,8DAA8D;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,wBAAwB,sBAAsB,MAAM;AAC1E;AACA;AACA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA,wBAAwB,IAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,cAAc;AAC1B,gBAAgB,KAAK;AACrB;AACA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA;AACA;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACA,oEAAoE,IAAI;AACxE;AACA,sBAAsB,UAAU;AAChC;AACA;AACA,sBAAsB,wBAAwB;AAC9C;AACA;AACA;AACA,CAAC,EAAC;;;ACvGuD;AACP;AACH;AACxC;AACP,2BAA2B,aAAa;AACxC;AACA,kBAAkB,UAAU;AAC5B;AACA,oBAAoB,cAAU;AAC9B,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;;;ACd2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,sBAAsB,WAAW;AACjC;AACA,KAAK;AACL;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA,iDAAe,SAAS,EAAC;;;ACjCoB;AACmE;AACrE;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA,gBAAgB,WAAW,IAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,gBAAgB,iBAAiB;AACjC;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA,8BAA8B,wBAAwB;AACtD,oBAAoB,UAAU;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA,0BAA0B,SAAS,GAAG,mBAAmB;AACzD;AACA,sBAAsB,WAAW;AACjC;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;;;AC3HiD;AACK;AACP;AACJ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,KAAK,GAAG,QAAQ;AACpC;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ;AACjB;AACA,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,iBAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iBAAiB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,UAAS;AAC7D;AACA,0BAA0B,iBAAiB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACO,+BAA+B,yDAAS;;;AC1IM;AACK;AACL;AACZ;AACzC;AACA;AACA;AACA;AACA,eAAe,MAAS;AACxB;AACA;AACA,SAAS,WAAW;AACpB,4BAA4B,iBAAe,SAAS,KAAK;AACzD;AACA;AACA;AACA;AACA,YAAY,iCAAiC,QAAQ,SAAM;AAC3D;AACA;AACA,iDAAe,QAAQ,EAAC;;;ACpBoC;AACE;AACd;AACzC;AACP;AACA;AACO;AACP;AACA;AACO;AACP,WAAW,UAAQ;AACnB;;;ACX8C;AACV;AACe;AACD;AAClD;AACA,4BAA4B,YAAU;AACtC,IAAI,gBAAc;AAClB,4BAA4B,SAAM,aAAa,SAAe;AAC9D;AACA;AACA,mDAAe,IAAI,EAAC;;;ACV6C;AACxB;AACS;AACA;AACmB;AACH;AACZ;AAC/C;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA,aAAa,WAAU;AACvB,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAY,CAAC,UAAU;AAClD;AACA;AACA;AACA;AACA,0BAA0B,UAAU;AACpC;AACA;AACA,gBAAgB,MAAM;AACtB;AACA,sBAAsB,UAAU;AAChC;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA,sBAAsB,OAAO,QAAQ,MAAS;AAC9C;AACA;AACA;AACA,8BAA8B,OAAO,QAAQ,MAAS;AACtD;AACA;AACA,8BAA8B,OAAO;AACrC;AACA,qBAAqB,MAAM,kBAAkB,OAAO;AACpD,gCAAgC,YAAI;AACpC;AACA,uBAAuB,MAAS;AAChC;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA,4BAA4B,OAAO;AACnC;AACA;AACA;AACA;;;AChFqD;AAC9C;AACP;AACA,8BAA8B,aAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,cAAc,GAAG,YAAY,GAAG,cAAc;AAChE;AACA;;;AChBoC;AACO;AACT;AAClC;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACO;AACP,4BAA4B;AAC5B,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA,8BAA8B,qDAAqD,KAAK;AACxF;AACA;AACA,8BAA8B,uBAAuB,KAAK,eAAe,IAAI;AAC7E;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA,8BAA8B,0DAA0D,KAAK;AAC7F;AACA;AACA,8BAA8B,uBAAuB,KAAK,eAAe,IAAI;AAC7E;AACA;AACA;AACA;AACA;AACA,8BAA8B,uBAAuB,KAAK;AAC1D;AACA;AACA,8BAA8B,oDAAoD,KAAK;AACvF;AACA;AACA;AACA;AACA,kDAAkD,KAAK,eAAe,IAAI;AAC1E;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;;;AC1EqD;AACN;AACE;AACP;AACnC,sBAAsB,UAAU;AACvC;AACA;AACA;AACA;AACA;AACA,wBAAwB,WAAW,CAAC,OAAO;AAC3C;AACA;AACA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;;;ACnBoC;AACiB;AACpB;AAC1B;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2BAA2B,OAAO;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,uBAAgB;AAClC;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,cAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,cAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iCAAiC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA,8BAA8B,uBAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA,8BAA8B,uBAAgB;AAC9C;AACA;AACA;AACA;AACA,sBAAsB,uBAAgB;AACtC;AACA,WAAW,SAAM;AACjB;;;AC9IqE;AAC9D,eAAe,iCAAe;AACrC,WAAW,eAAQ;AACnB;;;ACHA;AACA,yDAAe,EAAE,YAAY,EAAC;;;ACD9B;AACA;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACVqC;AACrC;AACA,gBAAgB,SAAS;AACzB;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAAe,yDAAS,IAAC;;;AClCQ;AACN;AACsB;AACjD;AACA,QAAQ,kBAAM;AACd,eAAe,kBAAM;AACrB;AACA;AACA,sDAAsD,GAAG;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,OAAO,GAAG,aAAa;AAC3E;AACA,wBAAwB,QAAQ;AAChC;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA,qDAAe,EAAE,EAAC;;;AC1BwE;AAChE;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,YAAY;AACZ;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,sBAAsB,wCAAwC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B,QAAQ,SAAS,UAAU,kBAAkB;AACxF;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,sDAAsD,QAAQ;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,yBAAyB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF,YAAY,iCAAiC,EAAE;AAClI;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,mDAAmD;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,cAAE;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,eAAe;AAC9D,+CAA+C,cAAc;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gEAAgE;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kCAAkC;AACzE;AACA;AACA,6BAA6B,sBAAsB;AACnD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,yBAAoB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,2DAA2D,mBAAmB;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG,UAAU,KAAK,EAAE;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,cAAc,IAAI,QAAQ;AAC/E;AACA;AACA,qDAAqD,OAAO,IAAI,QAAQ;AACxE;AACA;AACA,qDAAqD,UAAU,IAAI,QAAQ;AAC3E;AACA;AACA,qDAAqD,YAAY,IAAI,QAAQ;AAC7E;AACA;AACA;AACA;AACA,6CAA6C,SAAS;AACtD,SAAS,IAAI,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,OAAO,QAAQ,+BAA+B,yDAAyD,OAAO;AAC5J;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,IAAI;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,IAAI,cAAc,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,wBAAwB;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,cAAc;AACnF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,aAAa,cAAE;AACf,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,oCAAoC;AACpC;AACA;AACA,YAAY,wBAAwB,QAAQ,iCAAe;AAC3D;AACA;AACA,yBAAyB,SAAS;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,UAAU;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,UAAU;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,8DAA8D;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA,4CAA4C;AAC5C;;AAEs4B;AACt4B;;;;;;;ACh9CuE;AACoH;AACgC;;AAE3N;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0FAA0F,gCAAgC,iBAAiB,qCAAqC;AAChL;AACA;AACA,4FAA4F,yBAAyB,eAAe,qCAAqC;AACzK;AACA;AACA;AACA,2DAA2D,oBAAoB,IAAI,qCAAqC;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F,6BAA6B;AAC3H;AACA;AACA;AACA;AACA,0FAA0F,4CAA4C,2BAA2B;AACjK;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB,gDAAgD,qBAAqB;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+EAA+E,yBAAyB,EAAE,6BAA6B,IAAI,8BAA8B;AACzK;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,cAAc,0BAA0B,eAAe;AAC9F;AACA;AACA,wCAAwC,cAAc;AACtD;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB,mCAAmC,oBAAoB,GAAG;AAC7F,mBAAmB,gCAAgC;AACnD,iBAAiB,EAAE,sCAAsC,wBAAwB,QAAQ;AACzF;AACA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0GAA0G,yBAAyB;AACnI;AACA;AACA;AACA,yHAAyH,yBAAyB;AAClJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB;AAC3C,6BAA6B,gBAAgB;AAC7C;AACA;AACA;AACA;AACA;AACA,yCAAyC,QAAQ,gBAAgB,GAAG,oBAAoB,GAAG;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,kBAAkB,QAAQ,wBAAwB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,mBAAU;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,QAAQ,gBAAgB,GAAG,oBAAoB,GAAG;AACtF;AACA;AACA,aAAa,mBAAU;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,eAAe;AACvE;AACA;AACA,YAAY,QAAQ,QAAQ,wBAAwB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,kBAAkB;AAC9C;AACA;AACA;AACA;AACA,cAAc,kBAAkB,EAAE;AAClC;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA,uBAAuB,0BAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,qCAAqC,oCAAoB,GAAG;AAC5D;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEgG;;;ACxZyd;AACtc;AACzF;AACQ;AACyG;;AAE3I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,cAAc;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,yBAAsB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,oBAAoB;AACvE,aAAa,kBAAkB;AAC/B,+BAA+B,aAAa;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA,8BAA8B,MAAM;AACpC;AACA;AACA;AACA;AACA,6BAA6B,kBAAkB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB,+EAA+E,wBAAwB;AAC/I;AACA;AACA,sBAAsB,kBAAkB,gFAAgF,wBAAwB;AAChJ;AACA;AACA;AACA,yCAAyC,kBAAkB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,eAAe;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,wCAAwC;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,0BAAU;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,wBAAwB,0BAA0B;AAClD,gCAAgC,iCAAiC;AACjE,gCAAgC,iCAAiC;AACjE,6BAA6B,8BAA8B;AAC3D,4BAA4B,6BAA6B;AACzD,+BAA+B,gCAAgC;AAC/D;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,gCAAgC,iCAAiC;AACjE,6BAA6B,8BAA8B;AAC3D,wBAAwB,0BAA0B;AAClD,6BAA6B,+BAA+B;AAC5D,gCAAgC,iCAAiC;AACjE,4BAA4B,6BAA6B;AACzD,kCAAkC,mCAAmC;AACrE,mCAAmC,oCAAoC;AACvE,uCAAuC,uCAAuC;AAC9E,wCAAwC,wCAAwC;AAChF;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB,KAAK,kBAAkB,kCAAkC,YAAY;AAC7G;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAK;AACpB,UAAU,KAAO;AACjB,UAAU,0BAA0B;AACpC;AACA;AACA;AACA;AACA,iCAAiC,sBAAsB;AACvD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA,gDAAgD,kBAAkB;AAClE;AACA;AACA;AACA;AACA,mEAAmE,eAAe;AAClF,mEAAmE,cAAc;AACjF;AACA;AACA;AACA,wCAAwC,oBAAoB;AAC5D,+CAA+C,UAAU;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAK;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,YAAY,8DAA8D,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,YAAY,8DAA8D,EAAE;AAC5G;AACA;AACA;AACA;AACA,sEAAsE,YAAY;AAClF;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,gBAAgB,4EAA4E,QAAQ,0BAA0B;AAC9H;AACA;AACA,+DAA+D,IAAI,sEAAsE,oBAAoB;AAC7J;AACA;AACA,6DAA6D,iBAAiB;AAC9E;AACA;AACA,4DAA4D,iBAAiB;AAC7E;AACA,8DAA8D,4BAA4B;AAC1F;AACA,6BAA6B,SAAS;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+CAA+C,WAAW;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uBAAuB;AACjD;AACA;AACA;AACA;AACA,SAAS;AACT,cAAc,wBAAwB;AACtC;AACA;AACA,4DAA4D,gBAAgB;AAC5E;AACA;AACA;AACA,0BAA0B,2BAA2B;AACrD;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,gBAAgB;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,iBAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,cAAc;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,6DAA6D,cAAc;AAC3E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,YAAY,8DAA8D,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,MAAM;AACpC;AACA,eAAe,yBAAyB;AACxC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,0BAA0B;AAC5D;AACA,kEAAkE,WAAW;AAC7E;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA,4CAA4C,UAAU;AACtD;AACA,+BAA+B,OAAO;AACtC;AACA,+BAA+B,MAAM;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,eAAe;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE,uBAAuB;AAC9F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,6BAA6B,CAAC;AAC7D,2BAA2B,6BAA6B,CAAC;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,sBAAsB;AACpD;AACA;AACA;AACA,mCAAmC;AACnC,0BAA0B,MAAY;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,kFAAkF;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,cAAE;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,MAAM;AAC7B,uBAAuB,MAAM;AAC7B,uBAAuB,MAAM;AAC7B;AACA;AACA;AACA;AACA;AACA,wIAAwI,iCAAiC;AACzK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,MAAM;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,mBAAmB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qCAAqC;AAChE;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,oBAAoB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,MAAM;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,MAAM;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,MAAM;AAC7B;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B;AACA,qCAAqC,YAAY,GAAG,YAAY,GAAG,aAAa;AAChF,IAAI,6BAA6B,GAAG,eAAe,KAAK,eAAe;AACvE,4BAA4B,cAAc;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,qBAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,2BAA2B;AAC/B;AACA;AACA;AACA,MAAM,WAAM;AACZ;AACA;;AAEuG;AACvG;;;ACn7C2C;AAEpC,MAAM,WAAW,GAAG,IAAI,OAAO,EAAE;;;;;;;;;;;ACJ4B;AAC7B;AACJ;AACS;AAC5C;AACA;AACA;AACA;AACe,wBAAwB,4BAAI;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe,mBAAmB,mCAAiB;AACvD,IAAI,iCAAe,qBAAqB,0BAAU;AAClD;AACA,IAAI,iCAAe;AACnB;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAe;AACf,iCAAe,2C;;;;;;ACvFsB;AACrC,mDAAe;AACf,eAAe,yBAAS;AACxB,gBAAgB,yBAAS;AACzB,eAAe,yBAAS;AACxB,cAAc,yBAAS;AACvB,eAAe,yBAAS;AACxB,kBAAkB,yBAAS;AAC3B,cAAc,yBAAS;AACvB,CAAC,E;;ACTmE;AAC7B;AACI;AACR;AACO;AACA;AACT;AACjC;AACA;AACA;AACA;AACe,sBAAsB,4BAAI;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe,mBAAmB,iCAAe;AACrD,IAAI,iCAAe,qBAAqB,0BAAU;AAClD;AACA;AACA;AACA,IAAI,iCAAe,mBAAmB,YAAG;AACzC,IAAI,iCAAe;AACnB;AACA;AACA;AACA,IAAI,iCAAe;AACnB;AACA;AACA,sBAAsB,YAAG;AACzB,MAAM;AACN,sBAAsB,yBAAe;AACrC,MAAM;AACN,sBAAsB,YAAG;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kCAAkC,YAAG;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,YAAG;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,YAAG;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,YAAG,WAAW,YAAG;AAC5D,MAAM;AACN,iBAAiB,YAAG;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ,2BAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;;ACpKoE;AACzB;AACJ;AACP;AACG;AACU;AACN;AACvC;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,YAAY;AACZ;AACO;AACP;AACA;AACA;AACA,MAAM,wBAAM;AACZ;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACe,yBAAyB,4BAAI;AAC5C;AACA,WAAW,SAAe;AAC1B,IAAI,iCAAe,mBAAmB,oCAAkB;AACxD,IAAI,iCAAe,qBAAqB,0BAAU;AAClD,IAAI,iCAAe;AACnB,IAAI,iCAAe,sBAAsB,SAAe;AACxD;AACA;AACA;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAe;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAe,yBAAyB,oCAAkB,E;;ACnHU;AACjC;AACK;AACxC;AACA;AACA;AACe,oBAAoB,4BAAI;AACvC;AACA;AACA,IAAI,iCAAe,mBAAmB,8BAAa;AACnD;AACA;AACA;AACA;AACA,C;;ACdA;;AAEsC;AAC/B;AACA,6BAA6B,yBAAS,kB;;ACJuB;AACjC;AACY;AACa;;AAE5D;AACe,2BAA2B,4BAAI;AAC9C;AACA;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe,mBAAmB,sCAAoB;AAC1D,IAAI,iCAAe,cAAc,eAAe;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP,yCAAyC,sCAAoB;AAC7D,C;;ACtBoE;AACjC;AACY;AACoB;AACnE,yBAAyB,YAAgB;;AAEzC;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA;AACA;AACA;AACA,IAAI,iCAAe;AACnB,mBAAmB,4BAAI;AACvB,qBAAqB,4BAAI;AACzB,kBAAkB,4BAAI;AACtB,qDAAqD,4BAAI,mBAAmB;AAC5E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sIAAsI,cAAc,8DAA8D;AAClN;AACA;AACA;;AAEA;AACA;AACA;AACA,8CAA8C,sCAAoB;AAClE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,4EAA4E,cAAc;AAC1F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;;;;ACnGoE;AAC7B;AACJ;AACQ;AACd;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,uBAAuB,4BAAI;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe,mBAAmB,kCAAgB;AACtD;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe,qBAAqB,0BAAU;AAClD,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,eAAe,YAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,yCAAyC;AAC1D;AACA,eAAe,aAAa;AAC5B;AACA,C;;ACpDA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG;;AAEJ;AACA;AACA;AACA;AACA;AACA,G;;AC5BsC;AACL;AACK;AACD;AACF;AACwI;AAC/H;AACF;AACM;AACa;;AAE7D;AACA;AACA;AACA,MAAM,mCAAY,OAAO,YAAY;;AAErC;AACA;AACA;AACA,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,GAAG;AACH,sBAAsB,mCAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,wBAAM,OAAO,wBAAM;AAC3B,UAAU,wBAAM,OAAO,wBAAM;AAC7B;AACA;AACA;AACA;AACA,QAAQ,wBAAM,OAAO,wBAAM;AAC3B;AACA;AACA;AACA,GAAG;AACH;AACA,0EAA0E,KAAK;AAC/E;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,QAAQ,wBAAM;AACd;AACA;AACA;AACA,WAAW,sCAAoB;AAC/B;AACA,WAAW,kCAAgB;AAC3B,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;AAClE;AACA,GAAG;AACH;AACA,0BAA0B,SAAS;AACnC,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,QAAQ;AACR,mBAAmB,OAAO;AAC1B;AACA,MAAM;AACN,iBAAiB,OAAO;AACxB;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAS;AACxB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS,sCAAsC,mCAAY;AAC1E,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,cAAc,0BAA0B,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,wBAAwB;AAC3H,GAAG;AACH,mBAAmB,MAAM;AACzB;AACA;AACA,WAAW,mCAAiB;AAC5B;AACA,WAAW,sCAAoB;AAC/B;AACA,WAAW,8BAAa;AACxB;AACA,WAAW,iCAAe;AAC1B,eAAe,OAAO;AACtB,WAAW,+BAAa;AACxB,WAAW,mCAAiB;AAC5B;AACA,WAAW,oCAAkB;AAC7B;AACA;AACA,uEAAuE,cAAc;AACrF;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;;AAEA;AACA,6DAAe,oBAAoB,E;;;;AC3KQ;AAC3C;AACA;AACA;AACA;AACA;AACe;AACf;AACA,4BAA4B,yBAAe;AAC3C;AACA;AACA;AACA;AACA,C;;;;ACbsE;AAC/D;AACP,yFAAyF,sBAAoB;AAC7G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,sBAAoB;AACjD,0CAAe,0DAAU,I;;;;;;;ACd2C;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACqC;AACA;AACR;AACM;AACmC;AACpC;AACI;AACY;AACnC;AACf;AACA;AACA;AACO;AACP;AACA,IAAI,iCAAe,iDAAiD,YAAY,EAAE;AAClF,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB;AACA;AACA,wBAAwB;AACxB,0BAA0B;AAC1B,+BAA+B,yBAAO;AACtC;AACA,kBAAkB,yBAAO;AACzB;AACA;AACA;AACA;AACA,8EAA8E;AAC9E,gEAAgE;;AAEhE,8BAA8B;AAC9B,2BAA2B;AAC3B;AACA,0BAA0B;AAC1B,wBAAwB;AACxB;AACA,0CAA0C,sBAAoB;AAC9D,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD,6CAA6C;AAC7C,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD,6CAA6C;AAC7C,iCAAiC;AACjC,mEAAmE;AACnE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD;AACpD,qCAAqC;AACrC,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,8BAA8B;AAC9B,WAAW;AACX;AACA,OAAO;AACP;AACA,iDAAiD;AACjD;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;;AAE9B;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,aAAS;AACrB,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,QAAQ;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,wBAAoB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA,YAAY,sDAAsD;AAClE;AACA,YAAY;AACZ,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA,0DAA0D;AAC1D;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA,UAAU;AACV;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA,+BAA+B;AAC/B;AACA;AACA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,2CAA2C;AAC3C;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gBAAgB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,yIAAyI,6FAA6F;AACtO;;AAEA;;AAEA;AACA,uDAAuD;AACvD;AACA;AACA,cAAc;AACd,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA,mEAAmE;;AAEnE;;AAEA;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,iBAAiB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,UAAU,MAAM;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,wBAAwB;AACxB;AACA,0BAA0B;AAC1B;AACA;AACA,OAAO;AACP;AACA;AACA,sCAAsC,aAAc;AACpD;AACA;;AAEA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA,oBAAoB;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,6BAA6B;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qDAAqD;AACrD,gCAAgC;AAChC;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gBAAgB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,aAAc;AACtE;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA,MAAM;AACN;AACA,sBAAsB,gBAAgB;AACtC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA,8DAA8D;AAC9D,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,C;;ACj+BsC;AACuK;AAC7M;AACA;AACA;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,mCAAiB,EAAE;AAClD;AACA;AACA,aAAa,gBAAU;AACvB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,mCAAiB;AAC5B;AACA;AACA,WAAW,+BAAa;AACxB,WAAW,qCAAmB;AAC9B;AACA;AACA,WAAW,mCAAiB;AAC5B,WAAW,yCAAuB;AAClC,2BAA2B;AAC3B;AACA;AACA,WAAW,qCAAmB;AAC9B,mCAAmC;AACnC;AACA;AACA,WAAW,mCAAiB;AAC5B,8BAA8B;AAC9B,wDAAwD;AACxD;AACA,WAAW,mCAAiB;AAC5B,WAAW,sCAAoB;AAC/B;AACA,qCAAqC;AACrC,0DAA0D;AAC1D;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,C;;AC7EwB;AACQ;AACe;AAC/C;;AAEA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,GAAG;AACH;AACA;AACO;AACP;AACA;AACA;AACA,SAAS,YAAY;AACrB;AACA;AACA;AACA;AACA;AACA,C;;AC3FoE;AAC7B;AACD;AACgC;AAC9C;AACY;AACD;AACC;AACI;AACI;AACV;AACiC;AAC9B;AACrC;AACA;AACA;AACe,sBAAsB,4BAAI;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe,mBAAmB,+BAAa;AACnD,IAAI,iCAAe,qBAAqB,0BAAU;AAClD;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB;AACA;AACA;AACA;AACA,IAAI,iCAAe,aAAa,SAAS;AACzC;AACA,IAAI,iCAAe;AACnB,iDAAiD,sBAAoB;AACrE;AACA,gCAAgC,qBAAqB;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,4BAAI;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,SAAS;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA,wCAAwC,SAAS;AACjD;AACA;AACA,MAAM;AACN,yCAAyC,UAAU;AACnD;AACA;AACA,MAAM;AACN,yCAAyC,UAAU;AACnD;AACA;AACA,MAAM;AACN,yCAAyC,UAAU;AACnD,yBAAyB,yBAAS;AAClC;AACA;AACA;AACA;;AAEA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA,0CAA0C,UAAU;AACpD;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA;AACA;AACA,0CAA0C,UAAU;AACpD;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA,QAAQ;AACR;AACA,4CAA4C,UAAU;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA,0CAA0C,UAAU;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uEAAuE;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA;AACA,QAAQ,SAAS,6BAAW;AAC5B;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,MAAM;AACN;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAG,kCAAkC,8BAA8B;AACzE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,SAAS;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,mCAAmC;AAChD;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;;AC9uBA;AACA;AACyC;AACN;AACC;AACoB;AACxD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,YAAY;AACZ;AACA,4BAAI,aAAa,SAAS;AAC1B,2CAAe,4BAAI,EAAC;AACpB;AACA,OAAO,SAAS;AAChB;;AAEA;AACA;AACA;AACA;AACA,4BAAI;AACJ,MAAM,8BAAY;AAClB,6BAA6B,4BAAI,QAAQ;AACzC;AACA,OAAO,2BAAS;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEqC;AAC6C;AAC1D;AACQ;;AAEhC;AACA;AACA;AACO;AACP;AACA,mBAAmB,cAAc,IAAI;AACrC,oBAAoB;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB,yCAAyC;AACzC;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,eAAkB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA,IAAI;;AAEJ;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA,sBAAsB;AACtB;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;;AAEA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA,gBAAgB,0BAA0B;AAC1C;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,qCAAqC;AACrD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA,0BAA0B,GAAG;AAC7B,MAAM,sBAAG;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA,6BAA6B,eAAkB,GAAG;AAClD;AACA,QAAQ;AACR;AACA,QAAQ;AACR,sCAAsC;AACtC;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;;AAEP;AACA;AACA;AACA;AACA,MAAM,sBAAG;AACT;AACA;AACA,QAAQ;AACR,QAAQ,sBAAG;AACX,4EAA4E;AAC5E;AACA;AACA,oBAAoB,uBAAuB;AAC3C,gDAAgD;AAChD,+CAA+C;AAC/C;AACA,oBAAoB,uBAAuB;AAC3C,yCAAyC;AACzC;AACA;AACA;AACA;AACA,MAAM,sBAAG;AACT,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,kBAAkB,OAAO;AACzB,2BAA2B;AAC3B,wHAAwH,mBAAO;AAC/H;AACA;AACA,kBAAkB;AAClB;AACA,sHAAsH,mBAAO;AAC7H;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,IAAI,sBAAG,6EAA6E;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA,0BAA0B;AAC1B;AACA,MAAM,sBAAG;AACT;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA,UAAU,sBAAG;AACb,UAAU;AACV;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA,0BAA0B;AAC1B;AACA,8EAA8E;AAC9E;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAG;AACT;AACA,IAAI,sBAAG;AACP;AACA,MAAM,sBAAG;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,EAAE,sBAAG;AACL;AACA,kBAAkB;AAClB;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,KAAK;AACL;;AAEA,sBAAsB;AACtB,EAAE,Q;;AC1gBkE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEuC;AAC8B;AACrC;AACO;AACK;AAKrB;AACG;AACQ;AACmB;AACqH;AACrI;AACD;AACA;AACC;AACM;AACX;AAChC;AAC2B;AAC3B;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,8EAA8E;AAC9E;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,gFAAgF;AAChF;AACA;AACA,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA,eAAe;AACf;;AAEA;AACA;AACA;AACe,6BAA6B,OAAO;AACnD;AACA;AACA;AACA,sEAAsE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe;AACnB;AACA;AACA;AACA,IAAI,iCAAe;AACnB,iEAAiE,WAAW;AAC5E,IAAI,iCAAe;AACnB,gFAAgF,OAAO;AACvF,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,uBAAc;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,sBAAsB,KAAK;AAC3B;AACA;AACA,mBAAmB,aAAS;AAC5B,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,YAAY;AACpB,2EAA2E,gBAAgB;AAC3F,+DAA+D;AAC/D;AACA,qBAAqB;AACrB,OAAO,GAAG;AACV;AACA,QAAQ,YAAY;AACpB,wEAAwE,gBAAgB;AACxF;AACA;AACA,OAAO,GAAG;AACV;AACA,QAAQ,YAAY;AACpB,wEAAwE,gBAAgB;AACxF;AACA,OAAO,GAAG;AACV;AACA;;AAEA,uBAAuB,KAAK;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA,QAAQ,SAAS,wBAAM;AACvB;AACA,QAAQ,SAAS,yBAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,IAAI;AACf,oBAAoB,IAAI;AACxB,UAAU,IAAI;AACd,SAAS,iCAAe;AACxB;AACA;AACA,SAAS,mCAAiB;AAC1B,mCAAmC,MAAM;AACzC;AACA,SAAS,gCAAc;AACvB,gCAAgC,SAAS;AACzC;AACA,SAAS,yBAAO;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA,6CAA6C,kDAAkD;AAC/F,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA,6BAA6B,+BAA+B;AAC5D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,mCAAiB;AAC5B,mBAAmB,SAAS;AAC5B,WAAW,oCAAkB;AAC7B;AACA;AACA,WAAW,sCAAoB;AAC/B,mBAAmB,YAAY;AAC/B,WAAW,8BAAa;AACxB;AACA;AACA,WAAW,+BAAa;AACxB;AACA;AACA,WAAW,iCAAe;AAC1B,mBAAmB,OAAO;AAC1B,WAAW,mCAAiB;AAC5B,mBAAmB,yBAAS;AAC5B,WAAW,kCAAgB;AAC3B,mBAAmB,QAAQ;AAC3B;AACA,sEAAsE,cAAc;AACpF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA,wBAAwB,cAAc;AACtC;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,0BAAU,gBAAgB,0BAAU;AAC5C;AACA;AACA,QAAQ,0BAAU,gBAAgB,0BAAU;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,YAAY;AACpB;AACA;AACA,oBAAoB,qBAAqB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,IAAI,qBAAqB,IAAI,uBAAuB,IAAI,oBAAoB,IAAI;AACnH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,sBAAsB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,mBAAmB;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA,QAAQ,yBAAO;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qFAAqF;AACrF,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA,oEAAoE,iBAAiB;AACrF,oBAAoB,qBAAqB;AACzC;AACA;AACA;AACA;AACA;AACA,qDAAqD,iBAAiB;AACtE;AACA,4DAA4D,iBAAiB;AAC7E,0BAA0B,gBAAgB;AAC1C;AACA;AACA;AACA;AACA,uDAAuD,iBAAiB;AACxE;AACA;AACA,0BAA0B,gBAAgB;AAC1C;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA,gBAAgB,uBAAuB;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA,oBAAoB,kCAAkC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,0BAA0B;AACtD;AACA;AACA;AACA,mBAAmB;AACnB,oBAAoB;AACpB;AACA;AACA,gBAAgB,OAAO;AACvB,8BAA8B,IAAI;AAClC;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,gBAAgB,kBAAkB;AAClC,oBAAoB;AACpB;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA,sEAAsE;AACtE;AACA;AACA,oBAAoB,sBAAsB;AAC1C;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA,iCAAe;AACf,6C;;AC7jCA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,eAAe;AAC3B;AACA;AACA;;AAEA;AACA;AACsC;AACF;AACpC;;AAEA,YAAY,+NAA+N;;AAE3O,YAAY,OAAO;;AAEiB;AACpC,YAAY,SAAS;;AAErB;AACA;AACA;AACA;AACO;AACP,wCAAwC,GAAG,MAAM,GAAG,KAAK,KAAK;AAC9D;AACA,6BAA6B,SAAS;AACtC;AACA;AACA;AACA;AACA;AACA,kDAAkD,GAAG,KAAK,MAAM;AAChE,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;;AAEA;AACA;AACO;AACP;AACA;AACA;AACA,kBAAkB,UAAU;AAC5B,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA,oBAAoB,UAAU;AAC9B,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA,8EAA8E,IAAI;AAClF;AACA,6EAA6E,eAAe,YAAY,IAAI;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,UAAU;AACpC;AACA;AACA;AACA;AACA;AACA,kEAAkE,aAAa,UAAU,IAAI;AAC7F;AACA,+EAA+E,KAAK,QAAQ,cAAc;AAC1G;AACA;AACA;AACA,oCAAoC;;AAEpC;AACA;AACA,wFAAwF,cAAc,QAAQ,uBAAuB;AACrI;AACA,GAAG;AACH,C;;AC5GA;AACA;AACA;AACA;AACA;AACA;AAC6B;AACU;AACO;AAC9C,SAAS,eAAM;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,YAAQ,eAAe;AAChC;AACA,iCAAiC;AACjC;AACA;AACA,oCAAoC,sBAAsB;;AAE1D,+CAA+C;;AAE/C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,YAAY,EAAE;AAC3D;AACA;AACA;AACA,UAAU,6FAA6C;AACvD,UAAU,uFAAuC;AACjD,SAAS,2EAA2B;AACpC,qBAAqB,+EAA+B;AACpD;AACA;AACA,kBAAkB,0EAA0B;AAC5C;AACA;AACA;AACA;AACA;AACA,+CAAe,gBAAgB,EAAC;AACzB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY,4BAA4B,YAAY;AAClE;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,yBAAyB,eAAM;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,mBAAmB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,2FAA2F;AAC3F;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,wFAAwF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AAAwB;AAC9B,MAAM;AAAS;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AAAS;AACjB;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AAAS;AACf;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,QAAQ;AAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E,IAAI;AAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,YAAY;AACtB;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AAAU;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,oCAAoC,YAAY;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,yB;;ACl7CuC;AACqB;AACd;AACJ;AACgB;AACvB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,sBAAoB;AACzB;AACA,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,KAAK,OAAO;AACZ,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,GAAG;AACH;AACA,QAAQ,8BAAY;AACpB,kBAAkB;AAClB;AACA,OAAO,cAAc;AACrB;AACA,QAAQ,4BAAU;AAClB,aAAa,QAAQ;AACrB;AACA,WAAW,sBAAoB;AAC/B,GAAG;AACH;AACA,0BAA0B,oCAAkB;AAC5C,aAAa,UAAU;AACvB;AACA,WAAW,sBAAoB;AAC/B;AACA;AACA,4DAAe,mBAAmB,E;;AC/CU;;AAE5C;AACA;AACA;AACA;AACA,YAAY;AACZ;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oDAAoD,GAAG;AACvD;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC,KAAK,4BAA4B,GAAG;AACzE;AACA,gBAAgB,eAAe;AAC/B;AACe;AACf;AACA,uBAAuB,mJAAgB;AACvC;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB,gCAAgC;AACtD;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,C;;;;ACzHA,MAAM,QAAG;AACT;AACA;;AAEA,2CAAe;AACf;AACA,gBAAgB,IAAI;AACpB,gBAAgB,IAAI;AACpB,gBAAgB,IAAI;AACpB,gBAAgB,IAAI;AACpB,gBAAgB,IAAI;AACpB,GAAG;AACH;AACA,mBAAmB,QAAG,CAAC;AACvB,mBAAmB,QAAG,CAAC;AACvB,mBAAmB,QAAG,CAAC;AACvB,mBAAmB,QAAG,CAAC;AACvB,mBAAmB,QAAG,CAAC;AACvB,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,gBAAgB,KAAK;AACrB,gBAAgB,KAAK;AACrB,GAAG;AACH;AACA,gBAAgB,KAAK;AACrB,oBAAoB,KAAK;AACzB,GAAG;AACH,CAAC,EAAC;;;AC9BF;AACgC;AACA;;AAEhC,QAAQ,GAAG,gBAAG,EAAE,IAAU;;AAE1B;AACA,wCAAwC,EAAE,kBAAkB,EAAE;AAC9D;AACA;AACA;AACA;AACA,sDAAsD,KAAK;AAC3D;AACA;AACA,0CAA0C,EAAE;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACe;AACf;AACA;AACA;AACA,8BAA8B,uBAAuB,8BAA8B;AACnF,+CAA+C,EAAE,mBAAmB,iCAAiC;AACrG,2DAA2D;AAC3D;AACA;AACA;AACA,0kBAA0kB,EAAE,UAAU,mNAAmN,EAAE,UAAU,+MAA+M,EAAE,UAAU,iCAAiC,cAAc,EAAE;AACjkC,6YAA6Y,cAAc,EAAE;AAC7Z,0ZAA0Z,YAAY,EAAE;AACxa,+EAA+E,YAAY,EAAE;AAC7F,2CAA2C,WAAW,EAAE;AACxD;AACA;AACA,8CAA8C,EAAE;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0DAA0D,OAAO;AACjE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,qBAAqB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,OAAO;AAClE;AACA,mDAAmD,WAAG;AACtD,oDAAoD,WAAG,WAAW,WAAG;AACrE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uDAAuD,WAAG;AAC1D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,gEAAgE,UAAU;AAC1E;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA,gDAAgD;AAChD,oBAAoB;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,OAAO;AACzE;AACA;;AAEA;AACA;AACA;AACA,2CAA2C;AAC3C,2CAA2C;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA,yCAAyC,MAAM,YAAY,WAAW;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;;AC9gBA;AACA;;AAEgC;;AAEhC,QAAQ,GAAG,wBAAK,sBAAG,EAAE,IAAU;;AAE/B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,oDAAe,WAAW,EAAC;;AAE3B;AACO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACO,MAAM,uBAAS;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACO,MAAM,qBAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;;AAEA;AACA;AACA,eAAe,uBAAS;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD,2BAA2B,iBAAG,UAAU,iBAAG;AAC3C;;AAEA;AACA;AACA;AACA;AACA,yBAAyB,qBAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mDAAmD;AACrE;AACA;AACA;;AAEA;AACO,MAAM,uBAAS;AACtB;AACA,eAAe,KAAK;AACpB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEO,MAAM,sBAAQ;AACrB;AACA,cAAc,KAAK;AACnB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACO,MAAM,0BAAY;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,0BAAY;;AAE/B;AACA;AACA;AACA;AACA;AACO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,qBAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,WAAW;AAC9C,kCAAkC,WAAW;AAC7C;AACA,kCAAkC,WAAW;AAC7C,wBAAwB,cAAc;AACtC,gDAAgD,iBAAG,eAAe,oBAAoB,QAAQ;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,cAAc;AACjE;AACA;;;AAGA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC0B;;AAE1B;AACO;AACP,uDAAuD,2BAA2B;AAClF;;AAEA;AACO;AACP,uDAAuD,2BAA2B;AAClF;;AAEA;AACA;AACA,aAAa,uBAAS;AACtB;;AAEA;AACA;AACA,aAAa,uBAAS,eAAe,oBAAoB;AACzD;;AAEA;AACA;AACA;AACA;AACA,eAAe,qBAAO,KAAK,MAAM,IAAI,iCAAiC;;AAEtE;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAG;AACpB;AACA;AACA;AACA,6CAA6C,iBAAG,WAAW,iBAAG;AAC9D;AACA,mBAAmB,iBAAG;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,iBAAG;AAC7C,QAAQ,qBAAO,KAAK,MAAM;AAC1B,QAAQ,qBAAO,KAAK,MAAM,KAAK,SAAS;AACxC;;AAEA;AACA;AACA,aAAa,sBAAQ;AACrB;;AAEA;AACA,SAAS,0BAAY;AACrB;AACA;;AAEA;AACA;AACA;AACA;;AAEO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,cAAc;AAC7E;AACA;;AAEO;AACP;AACA;;AAEA;AACA,4CAA4C,gBAAgB;;AAE5D;AACA;;;AC/ZA;AACgC;AACY;AACZ;;AAEhC;;AAEA;AACe;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,uCAAuC,OAAO,GAAG,gEAAgE;AACjH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,kBAAkB;AAC7D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,WAAW;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,aAAa;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,WAAW;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,yCAAyC,KAAK;AAC9C;AACA;AACA,WAAW;AACX;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA,yBAAyB;AACzB,mDAAmD,WAAW;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB;AACzB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,WAAW;AACX;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA,QAAQ;AACR,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,gBAAgB;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,WAAW;AACX;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA,4DAA4D,gBAAgB;AAC5E;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2DAA2D,aAAa;AACxE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,WAAW;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,gBAAgB;AACnE;AACA;AACA;;AAEA;AACA;AACA;AACA,gDAAgD,WAAW;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,SAAS,UAAU,WAAW;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO,GAAG,kBAAkB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,kBAAkB;AACrE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,wCAAwC,IAAU;AAClD,wCAAwC,IAAU;AAClD,wCAAwC,IAAU;AAClD,wCAAwC,IAAU;AAClD,wCAAwC,IAAU;AAClD;AACA,2BAA2B,IAAU;AACrC,2BAA2B,IAAU;AACrC,2BAA2B,IAAU;AACrC,2BAA2B,IAAU;AACrC;AACA;AACA;AACA,oCAAoC,aAAa;;;AChlCjD;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEqC;AACL;AACK;AACR;AACM;AACkB;AACrD,WAAW,eAAI;AACf;AACA,MAAM,eAAI;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,sBAAG;AACd,MAAM;AACN;AACA;AACA;AACA;AACA,SAAS,sBAAG;AACZ,6BAA6B,6CAA6C;AAC1E;AACA;AACA;AACA;AACA,qCAAqC,eAAI;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,wCAAwC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA,QAAQ;AACR,6CAA6C,YAAQ;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,MAAM;AACN;AACA;AACA,0BAA0B,eAAI;AAC9B;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,sCAAsC,eAAI;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,0BAA0B,iBAAiB;AAC3C;AACA;AACA;AACA,0BAA0B,mBAAmB;AAC7C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,sBAAsB,+BAA+B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,YAAQ;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,+CAA+C;AACrE;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,eAAI;AAClD;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,eAAI;AAC/D;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,eAAI;AAClD;AACA,YAAY;AACZ;AACA,YAAY;AACZ;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,UAAU;AACV,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,UAAU;AACV,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,0BAA0B,6BAA6B;AACvD;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,UAAU;AACV;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,eAAe;AACf,cAAc;AACd;AACA;AACA;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,+BAA+B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,0CAA0C,OAAO;AACjD,+BAA+B,eAAI;AACnC;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,kCAAkC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,YAAQ,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,SAAS;AACzD;AACA;AACA;AACA,aAAa,sBAAG;AAChB;AACA;AACA;AACA;AACA;AACA,wDAAwD,SAAS;AACjE;AACA;AACA;AACA,eAAe,sBAAG;AAClB;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA,oBAAoB,oBAAgB;AACpC,SAAS;AACT,mBAAmB,OAAO,iBAAiB,yBAAS;AACpD;AACA,mBAAmB,OAAO,kBAAkB,yBAAS;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;;;AC19BoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACiC;AAClB;AACf;AACA;AACA,aAAa,UAAU;AACvB;AACA;AACA;;AAEA,wBAAwB;AACxB,sBAAsB;AACtB,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,cAAc,YAAY;AAC1B;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,sCAAsC,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,sBAAsB,uBAAuB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,cAAc;AAC3B,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;;AAEA;AACA,wCAAwC;AACxC,wBAAwB;AACxB;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,uFAAuF;AACvF;AACA;AACA,KAAK;AACL,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG,YAAY;AAC7G;AACA;AACA;AACA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA,UAAU;AACV;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,4CAA4C,SAAS;AACrD;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA,wCAAwC;AACxC,+BAA+B,YAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAe;AACf;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,iCAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;AC5dD;AACA;AACA;AACA,YAAY,KAAK,QAAQ,KAAK,aAAa;AAC3C;AACA;AACA,2BAA2B,MAAM,cAAc,MAAM,cAAc,IAAI;AACrC;AACE;AACrB;AACf;AACA;AACA,aAAa,SAAS;AACtB,UAAU,QAAQ;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,4BAA4B;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA,gBAAgB,qBAAqB;AACrC;AACA;AACA;AACA;AACA,wFAAwF,KAAK;AAC7F;AACA;AACA;AACA;AACA;AACA,sEAAsE,KAAK;AAC3E;AACA;AACA;AACA;AACA,kCAAkC;;AAElC;AACA,8EAA8E,KAAK;AACnF;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,C;;ACxF4D;AAClB;AAC1C;AAC0C,CAAC;AACT;AACU;AACL;AACS;AACb;AACuM;AAC1O;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,WAAK;AAC7B;AACA;AACA,+BAA+B,mCAAiB;AAChD,oCAAoC;AACpC;AACA,wBAAwB,+BAAa,oBAAoB,mCAAiB;AAC1E,cAAc,QAAQ;AACtB;AACA;AACA,MAAM,yBAAyB,mCAAiB;AAChD,uBAAuB,SAAS;AAChC,mBAAmB,iBAAa;AAChC;AACA,MAAM,yBAAyB,iCAAgB;AAC/C,MAAM,YAAY,CAAC,iBAAa;AAChC,qBAAqB,iCAAgB;AACrC,OAAO;AACP;AACA,MAAM,yBAAyB,iCAAe;AAC9C,MAAM,YAAY,CAAC,iBAAa;AAChC,qBAAqB,iCAAe;AACpC,OAAO;AACP;AACA,MAAM,yBAAyB,yCAAuB,oBAAoB,oDAAkC;AAC5G;AACA,MAAM,kBAAkB;AACxB;AACA,MAAM,yBAAyB,mCAAiB;AAChD;AACA;AACA;AACA,MAAM,YAAY;AAClB,MAAM,yBAAyB,mCAAiB,oBAAoB,sCAAoB;AACxF,yBAAyB,QAAU;AACnC,iBAAiB,qBAAW;AAC5B,OAAO;AACP;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,EAAE,WAAK;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,mCAAiB;AACrC;AACA,oBAAoB,mCAAiB;AACrC;AACA,oBAAoB,sCAAoB;AACxC;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,C;;;;;;;ACrIoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACqC;AACb;AACU;AACS;AACP;AACL;AACa;AACL;AACV;AAC6B;AACvB;AACC;AACc;AAC+B;AACnC;AACJ;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,mCAAiB;AAC1B,SAAS,mCAAiB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,SAAS;AACnB,UAAU,SAAS;AACnB,WAAW,SAAS;AACpB;AACA,SAAS,SAAS;AAClB,UAAU,SAAS;AACnB,QAAQ,SAAS;AACjB,SAAS,SAAS;AAClB;AACA;AACA,MAAM,UAAE;;AAER;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA;AACA;AACA;AACA;AACA,iCAAe;AACf;AACA;AACA;AACA;AACA;AACA,uBAAuB,mCAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAa;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,+BAA+B,UAAE,cAAc,UAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iCAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAa;AAC9B;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,UAAE;AACjC;AACA;;AAEA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,oBAAoB;AACxC;AACA;AACA;AACA,QAAQ,WAAQ;AAChB;AACA,QAAQ,WAAQ;AAChB;AACA;AACA;AACA,+BAA+B,UAAE,cAAc,UAAE;AACjD;AACA,2BAA2B,YAAY;AACvC;AACA;AACA,QAAQ,YAAY;AACpB,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAa;;AAE3B;AACA;AACA,oBAAoB,2BAA2B;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B,UAAE,uEAAuE;AACxG;AACA,6BAA6B,UAAE,cAAc,UAAE;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,YAAY;AACxB,0CAA0C,UAAE,cAAc,UAAE;AAC5D;AACA,MAAM;AACN,wFAAwF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA,MAAM;AACN,wFAAwF;AACxF;AACA;AACA;AACA,wCAAwC,UAAE,cAAc,UAAE;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB,8BAA8B,cAAc;AAC5C;AACA;;AAEA;AACA,0CAA0C,qBAAM,qBAAqB,qBAAM,iBAAiB,qBAAM,+FAA+F,4BAAU;AAC3M;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,QAAQ;AACR;;AAEA;AACA;AACA;AACA,IAAI,oBAAgB;AACpB;AACA;AACA;AACA;AACA,sDAAsD,IAAI;AAC1D,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,sBAAG;AACX,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA,8CAA8C;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,IAAI;AAC1D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAY;AAC3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,yCAAyC;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,uBAAuB,GAAG;AAC1B;AACA,6BAA6B;AAC7B;AACA,qCAAqC,iBAAiB;AACtD;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA,6BAA6B,SAAS;AACtC;AACA;AACA,sCAAsC,aAAa;AACnD;AACA;AACA,iCAAiC,SAAS;AAC1C;AACA;AACA,uCAAuC,SAAS;AAChD;AACA,yCAAyC,SAAS;AAClD;AACA;AACA,8BAA8B,SAAS;AACvC;AACA;AACA,8BAA8B;AAC9B;AACA,eAAe;AACf;AACA;AACA;AACA,8BAA8B,YAAY;AAC1C;AACA;AACA,4CAA4C;AAC5C,OAAO;AACP;AACA;AACA,iBAAiB,8BAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB;AACpB,qBAAqB;AACrB;AACA,eAAe,iBAAiB,uBAAuB,gBAAgB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,wBAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,8BAAS;AACzB;AACA;AACA;AACA,MAAM,qCAAqC;AAC3C;AACA,MAAM,SAAS,6BAAW;AAC1B;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,8BAAY;AACpB;AACA,MAAM;AACN,MAAM,sBAAG;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,qBAAqB,eAAW;AAChC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,YAAQ;AAC9C;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA,0CAA0C,YAAQ;AAClD;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC,YAAY,WAAW,gBAAgB,UAAU;AACxF,kCAAkC,UAAU,gBAAgB,UAAU;;AAEtE;AACA,uCAAuC,YAAY,WAAW;AAC9D,kCAAkC,aAAa;AAC/C;AACA,oCAAoC,YAAY,WAAW,kBAAkB,cAAc;AAC3F,iCAAiC,cAAc,kBAAkB,cAAc;AAC/E;AACA;AACA,oBAAoB,oBAAoB;AACxC;AACA;AACA;AACA;AACA;AACA,sBAAsB,cAAc;AACpC;AACA;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;;AAEhC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAqB,8BAAS;AAC9B,kBAAkB,yBAAe,kBAAkB;AACnD,uGAAuG,mCAAiB;AACxH;AACA;AACA,QAAQ,SAAS;AACjB;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0FAA0F,mCAAiB;AAC3G;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,UAAU;AACV;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mCAAiB;AACvC,iDAAiD;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,8BAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,uBAAuB;AACrF;AACA;AACA,MAAM;AACN,qCAAqC;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,8BAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC,yBAAyB,eAAW,MAAM;;AAE1C;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA,iBAAiB,2BAA2B;AAC5C;AACA;AACA,2BAA2B;AAC3B;AACA;AACA,oBAAoB,qBAAqB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,6BAAW;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8EAA8E,uBAAmB;AACjG;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,sCAAsC;AACtC;AACA,sBAAsB,iBAAiB;AACvC,qDAAqD,eAAW;AAChE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,eAAW;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6CAA6C;;AAE7C,mCAAmC;AACnC;AACA;AACA,qCAAqC;AACrC;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,gBAAY;AACjC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uCAAuC,kCAAkC;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,2BAA2B,YAAQ;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sGAAsG;AACtG,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAY;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;;AAEhC;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,wDAAwD,KAAK;AAC7D;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAe;AACf,iCAAe;AACf;AACA,iCAAe;AACf;AACA,kD;;ACjpDA,iDAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,gBAAgB;AAChB;AACA,gBAAgB;AAChB;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG,E;;ACpDoB;AACT;AACf;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAG;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,yBAAyB;AAC7C;AACA,MAAM,sBAAG;AACT,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;;AChEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,uCAAuC,kBAAkB;;AAEjC;AACQ;;AAEhC;AACA;AACA;AACA;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,qBAAqB;AACrD,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN,MAAM,sBAAG;AACT;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAG;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM,sBAAG;AACT,iEAAiE;AACjE;AACA;AACA;AACA;AACA,4GAA4G,QAAQ,aAAa,QAAQ,wCAAwC,QAAQ;AACzL,IAAI,sBAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,QAAQ,sBAAG;AACX;AACA,QAAQ;AACR,QAAQ,sBAAG;AACX;AACA,QAAQ;AACR,QAAQ,sBAAG;AACX;AACA;AACA,UAAU;AACV,UAAU,sBAAG;AACb;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;;AAEA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA,QAAQ,sBAAG;AACX;AACA;AACA;AACA,QAAQ;AACR,QAAQ,sBAAG;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,sBAAG;AACX,QAAQ;AACR,QAAQ,sBAAG;AACX,QAAQ;AACR,QAAQ,sBAAG;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,sBAAG;AACX;AACA,QAAQ;AACR,QAAQ,sBAAG;AACX;AACA,QAAQ;AACR,QAAQ,sBAAG;AACX;AACA,QAAQ;AACR,QAAQ,sBAAG;AACX;AACA,MAAM;AACN,MAAM,sBAAG;AACT;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA;AACA;AACA,MAAM,sBAAG;AACT,+BAA+B;AAC/B,QAAQ,sBAAG;AACX;AACA,uDAAuD,KAAK;AAC5D;AACA,QAAQ,sBAAG;AACX,QAAQ;AACR;AACA;AACA;AACA,yDAAyD,KAAK;AAC9D;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA;AACA,QAAQ,sBAAG;AACX;AACA;AACA;AACA,QAAQ,sBAAG;AACX,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA,oBAAoB,oBAAoB;AACxC;AACA;AACA;AACA;AACA;AACA,MAAM,sBAAG;AACT;AACA;AACA,kDAAkD;AAClD;AACA;AACA,sBAAsB,oBAAoB;AAC1C;AACA;AACA;AACA,QAAQ,sBAAG;AACX;AACA;AACA;AACA;AACA;AACA,oBAAoB,oBAAoB;AACxC;AACA;AACA;AACA;AACA,UAAU,sBAAG;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE,sBAAG;AACL,cAAc,KAAK;AACnB,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;;ACzdoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACqC;AACY;AACjB;AACI;AACE;AACe;AAClB;AACW;AAC9C;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;AACA;AACA;AACA,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB;AACA,IAAI,iCAAe;AACnB,yBAAyB,cAAc;AACvC;AACA;AACA;AACA;AACA,0BAA0B,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,mBAAmB,SAAS;AAC5B,oBAAoB,SAAS;AAC7B,kBAAkB,SAAS;AAC3B,kBAAkB,SAAS;AAC3B,mBAAmB,SAAS;AAC5B,kBAAkB,SAAS;AAC3B,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,KAAK,kCAAkC,MAAM;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,UAAU,8BAAS;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oEAAoE,mBAAO;AAC3E;AACA,oBAAoB,qBAAqB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,wBAAwB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,sBAAsB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA,4BAA4B,mBAAmB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,sBAAsB;AACtB;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,qBAAqB,EAAE,uBAAuB,EAAE,oBAAoB;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,6BAAW;AACxB,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA,mBAAmB;AACnB;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E;AAC9E;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,gBAAgB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,WAAW;AACnC;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA,KAAK,kBAAkB;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,4BAA4B;AAC5D,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC,8BAA8B,gBAAgB;AAC9C,MAAM;AACN,8BAA8B,mHAAmH;AACjJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC,8BAA8B,gBAAgB;AAC9C,MAAM;AACN,8BAA8B,mHAAmH;AACjJ;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA,4BAA4B,8CAA8C;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA,aAAa,gBAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,yCAAyC,eAAe,IAAI,WAAW;AACvE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,wBAAwB,eAAe;AACvC;AACA;AACA,oBAAoB;AACpB;AACA;AACA,2BAA2B;AAC3B,wBAAwB,eAAe;AACvC;AACA;AACA,oBAAoB;AACpB;AACA;AACA,MAAM;AACN;AACA;AACA,gCAAgC;AAChC,wBAAwB,eAAe;AACvC;AACA;AACA,qBAAqB;AACrB;AACA;AACA,oCAAoC;AACpC,gCAAgC;AAChC,wBAAwB,eAAe;AACvC;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,QAAQ;AACR;AACA;AACA;AACA;AACA,UAAU;AACV,QAAQ;AACR;AACA;AACA;AACA;AACA,UAAU;AACV,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,SAAS,uBAAuB;AAChC,OAAO,GAAG;AACV,MAAM;;AAEN;AACA;AACA,iCAAiC,yBAAO;AACxC,kCAAkC,yBAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,KAAK;AACvD;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,YAAY;AACZ,qEAAqE,KAAK,mBAAmB,IAAI;AACjG;AACA,SAAS;AACT;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,cAAc;AACd,4BAA4B,eAAe;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,MAAM;AACN,sEAAsE,oBAAgB;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA,sFAAsF;AACtF,oBAAoB,eAAe;AACnC,MAAM,uBAAmB;AACzB;AACA,oBAAoB,eAAe;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,gBAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sFAAsF;;AAEtF,oBAAoB,eAAe;AACnC,MAAM,uBAAmB;AACzB;AACA,oBAAoB,eAAe;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA,sBAAsB,eAAe;AACrC;AACA;AACA,6CAA6C;AAC7C,KAAK;AACL;;AAEA;AACA,cAAc,OAAO;AACrB;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,gBAAU;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA,8CAA8C;;AAE9C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,C;;AC5mCsC;AACL;AACyB;AAC1D;AACA;AACA,KAAK,qBAAmB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B,kBAAkB,qBAAmB;AACrC,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAAe,iBAAiB,E;;AC5ChC;AACA;AACA;AAC0D;AACnD;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,SAAS;AAC7C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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","sources":["webpack://SolidLogic/webpack/universalModuleDefinition","webpack://SolidLogic/./node_modules/ieee754/index.js","webpack://SolidLogic/./node_modules/rdflib/esm/class-order.js","webpack://SolidLogic/./node_modules/rdflib/esm/uri.js","webpack://SolidLogic/./node_modules/rdflib/esm/utils/terms.js","webpack://SolidLogic/./node_modules/rdflib/esm/utils/termValue.js","webpack://SolidLogic/./node_modules/rdflib/esm/utils-js.js","webpack://SolidLogic/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://SolidLogic/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://SolidLogic/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://SolidLogic/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://SolidLogic/./node_modules/rdflib/esm/log.js","webpack://SolidLogic/./node_modules/cross-fetch/dist/browser-ponyfill.js","webpack://SolidLogic/./node_modules/rdflib/esm/named-node.js","webpack://SolidLogic/./node_modules/@frogcat/ttl2jsonld/ttl2jsonld.js","webpack://SolidLogic/./node_modules/solid-namespace/index.js","webpack://SolidLogic/./node_modules/@inrupt/oidc-client/lib/oidc-client.min.js","webpack://SolidLogic/./node_modules/events/events.js","webpack://SolidLogic/./node_modules/base64-js/index.js","webpack://SolidLogic/./node_modules/buffer/index.js","webpack://SolidLogic/external umd \"window\"","webpack://SolidLogic/./node_modules/rdflib/esm/node-internal.js","webpack://SolidLogic/./node_modules/rdflib/esm/types.js","webpack://SolidLogic/webpack/bootstrap","webpack://SolidLogic/webpack/runtime/compat get default export","webpack://SolidLogic/webpack/runtime/create fake namespace object","webpack://SolidLogic/webpack/runtime/define property getters","webpack://SolidLogic/webpack/runtime/ensure chunk","webpack://SolidLogic/webpack/runtime/get javascript chunk filename","webpack://SolidLogic/webpack/runtime/global","webpack://SolidLogic/webpack/runtime/harmony module decorator","webpack://SolidLogic/webpack/runtime/hasOwnProperty shorthand","webpack://SolidLogic/webpack/runtime/load script","webpack://SolidLogic/webpack/runtime/make namespace object","webpack://SolidLogic/webpack/runtime/publicPath","webpack://SolidLogic/webpack/runtime/jsonp chunk loading","webpack://SolidLogic/./src/util/debug.ts","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/buffer_utils.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/base64url.js","webpack://SolidLogic/./node_modules/jose/dist/browser/util/errors.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/subtle_dsa.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/webcrypto.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/check_key_length.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/crypto_key.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/invalid_key_input.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/is_key_like.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/is_object.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/is_jwk.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/jwk_to_key.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/normalize_key.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/get_sign_verify_key.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/verify.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/is_disjoint.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/check_key_type.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/validate_crit.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/validate_algorithms.js","webpack://SolidLogic/./node_modules/jose/dist/browser/key/import.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jws/flattened/verify.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jws/compact/verify.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/epoch.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/secs.js","webpack://SolidLogic/./node_modules/jose/dist/browser/lib/jwt_claims_set.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jwt/verify.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/fetch_jwks.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jwks/local.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jwks/remote.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/key_to_jwk.js","webpack://SolidLogic/./node_modules/jose/dist/browser/key/export.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/sign.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jws/flattened/sign.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jws/compact/sign.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jwt/produce.js","webpack://SolidLogic/./node_modules/jose/dist/browser/jwt/sign.js","webpack://SolidLogic/./node_modules/jose/dist/browser/runtime/generate.js","webpack://SolidLogic/./node_modules/jose/dist/browser/key/generate_key_pair.js","webpack://SolidLogic/./node_modules/uuid/dist/esm-browser/native.js","webpack://SolidLogic/./node_modules/uuid/dist/esm-browser/rng.js","webpack://SolidLogic/./node_modules/uuid/dist/esm-browser/stringify.js","webpack://SolidLogic/./node_modules/uuid/dist/esm-browser/v4.js","webpack://SolidLogic/./node_modules/@inrupt/solid-client-authn-core/dist/index.mjs","webpack://SolidLogic/./node_modules/@inrupt/oidc-client-ext/dist/index.es.js","webpack://SolidLogic/./node_modules/@inrupt/solid-client-authn-browser/dist/index.mjs","webpack://SolidLogic/./src/authSession/authSession.ts","webpack://SolidLogic/./node_modules/rdflib/esm/blank-node.js","webpack://SolidLogic/./node_modules/rdflib/esm/xsd-internal.js","webpack://SolidLogic/./node_modules/rdflib/esm/literal.js","webpack://SolidLogic/./node_modules/rdflib/esm/collection.js","webpack://SolidLogic/./node_modules/rdflib/esm/empty.js","webpack://SolidLogic/./node_modules/rdflib/esm/utils/default-graph-uri.js","webpack://SolidLogic/./node_modules/rdflib/esm/default-graph.js","webpack://SolidLogic/./node_modules/rdflib/esm/statement.js","webpack://SolidLogic/./node_modules/rdflib/esm/variable.js","webpack://SolidLogic/./node_modules/rdflib/esm/factories/factory-types.js","webpack://SolidLogic/./node_modules/rdflib/esm/factories/canonical-data-factory.js","webpack://SolidLogic/./node_modules/rdflib/esm/namespace.js","webpack://SolidLogic/./node_modules/rdflib/esm/xsd.js","webpack://SolidLogic/./node_modules/rdflib/esm/serializer.js","webpack://SolidLogic/./node_modules/rdflib/esm/serialize.js","webpack://SolidLogic/./node_modules/rdflib/esm/utils.js","webpack://SolidLogic/./node_modules/rdflib/esm/formula.js","webpack://SolidLogic/./node_modules/rdflib/esm/node.js","webpack://SolidLogic/./node_modules/rdflib/esm/query.js","webpack://SolidLogic/./node_modules/rdflib/esm/store.js","webpack://SolidLogic/./node_modules/rdflib/esm/lists.js","webpack://SolidLogic/./node_modules/rdflib/esm/n3parser.js","webpack://SolidLogic/./node_modules/rdflib/esm/factories/extended-term-factory.js","webpack://SolidLogic/./node_modules/rdflib/esm/jsonldparser.js","webpack://SolidLogic/./node_modules/n3/src/IRIs.js","webpack://SolidLogic/./node_modules/n3/src/N3Lexer.js","webpack://SolidLogic/./node_modules/n3/src/N3DataFactory.js","webpack://SolidLogic/./node_modules/n3/src/N3Parser.js","webpack://SolidLogic/./node_modules/rdflib/esm/rdfaparser.js","webpack://SolidLogic/./node_modules/rdflib/esm/rdfxmlparser.js","webpack://SolidLogic/./node_modules/rdflib/esm/patch-parser.js","webpack://SolidLogic/./node_modules/rdflib/esm/parse.js","webpack://SolidLogic/./node_modules/rdflib/esm/fetcher.js","webpack://SolidLogic/./node_modules/rdflib/esm/jsonparser.js","webpack://SolidLogic/./node_modules/rdflib/esm/query-to-sparql.js","webpack://SolidLogic/./node_modules/rdflib/esm/sparql-to-query.js","webpack://SolidLogic/./node_modules/rdflib/esm/update-manager.js","webpack://SolidLogic/./node_modules/rdflib/esm/factories/rdflib-data-factory.js","webpack://SolidLogic/./node_modules/rdflib/esm/updates-via.js","webpack://SolidLogic/./node_modules/rdflib/esm/index.js","webpack://SolidLogic/./src/util/ns.ts","webpack://SolidLogic/./src/acl/aclLogic.ts","webpack://SolidLogic/./src/authn/authUtil.ts","webpack://SolidLogic/./src/authn/SolidAuthnLogic.ts","webpack://SolidLogic/./src/util/utils.ts","webpack://SolidLogic/./src/chat/chatLogic.ts","webpack://SolidLogic/./src/inbox/inboxLogic.ts","webpack://SolidLogic/./src/logic/CustomError.ts","webpack://SolidLogic/./src/profile/profileLogic.ts","webpack://SolidLogic/./src/typeIndex/typeIndexLogic.ts","webpack://SolidLogic/./src/util/containerLogic.ts","webpack://SolidLogic/./src/util/utilityLogic.ts","webpack://SolidLogic/./src/logic/solidLogic.ts","webpack://SolidLogic/./src/logic/solidLogicSingleton.ts","webpack://SolidLogic/./src/issuer/issuerLogic.ts","webpack://SolidLogic/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"window\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"window\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SolidLogic\"] = factory(require(\"window\"));\n\telse\n\t\troot[\"SolidLogic\"] = factory(root[\"window\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE__8392__) => {\nreturn ","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/**\n* Class orders\n*/\nconst ClassOrder = {\n 'Literal': 1,\n 'Collection': 3,\n 'Graph': 4,\n 'NamedNode': 5,\n 'BlankNode': 6,\n 'Variable': 7\n};\nexport default ClassOrder;","/*\n * Implements URI-specific functions\n *\n * See RFC 2386\n *\n * See also:\n * http://www.w3.org/2005/10/ajaw/uri.js\n * http://www.w3.org/2000/10/swap/uripath.py\n *\n */\nvar alert = alert || console.log;\nimport RDFlibNamedNode from './named-node';\n\n/**\n * Gets the document part of an URI\n * @param uri The URI\n */\nexport function docpart(uri) {\n var i;\n i = uri.indexOf('#');\n if (i < 0) {\n return uri;\n } else {\n return uri.slice(0, i);\n }\n}\n\n/**\n * Gets the document part of an URI as a named node\n * @param x - The URI\n */\nexport function document(x) {\n return new RDFlibNamedNode(docpart(x));\n}\n\n/**\n * Gets the hostname in an URI\n * @param u The URI\n */\nexport function hostpart(u) {\n var m = /[^\\/]*\\/\\/([^\\/]*)\\//.exec(u);\n if (m) {\n return m[1];\n } else {\n return '';\n }\n}\n\n/**\n * Joins an URI with a base\n * @param given - The relative part\n * @param base - The base URI\n */\nexport function join(given, base) {\n var baseColon, baseScheme, baseSingle;\n var colon, lastSlash, path;\n var baseHash = base.indexOf('#');\n if (baseHash > 0) {\n base = base.slice(0, baseHash);\n }\n if (given.length === 0) {\n return base;\n }\n if (given.indexOf('#') === 0) {\n return base + given;\n }\n colon = given.indexOf(':');\n if (colon >= 0) {\n return given;\n }\n baseColon = base.indexOf(':');\n if (base.length === 0) {\n return given;\n }\n if (baseColon < 0) {\n alert('Invalid base: ' + base + ' in join with given: ' + given);\n return given;\n }\n baseScheme = base.slice(0, +baseColon + 1 || 9e9);\n if (given.indexOf('//') === 0) {\n return baseScheme + given;\n }\n if (base.indexOf('//', baseColon) === baseColon + 1) {\n baseSingle = base.indexOf('/', baseColon + 3);\n if (baseSingle < 0) {\n if (base.length - baseColon - 3 > 0) {\n return base + '/' + given;\n } else {\n return baseScheme + given;\n }\n }\n } else {\n baseSingle = base.indexOf('/', baseColon + 1);\n if (baseSingle < 0) {\n if (base.length - baseColon - 1 > 0) {\n return base + '/' + given;\n } else {\n return baseScheme + given;\n }\n }\n }\n if (given.indexOf('/') === 0) {\n return base.slice(0, baseSingle) + given;\n }\n path = base.slice(baseSingle);\n lastSlash = path.lastIndexOf('/');\n if (lastSlash < 0) {\n return baseScheme + given;\n }\n if (lastSlash >= 0 && lastSlash < path.length - 1) {\n path = path.slice(0, +lastSlash + 1 || 9e9);\n }\n path += given;\n while (path.match(/[^\\/]*\\/\\.\\.\\//)) {\n path = path.replace(/[^\\/]*\\/\\.\\.\\//, '');\n }\n path = path.replace(/\\.\\//g, '');\n path = path.replace(/\\/\\.$/, '/');\n return base.slice(0, baseSingle) + path;\n}\n\n/**\n * Gets the protocol part of an URI\n * @param uri The URI\n */\nexport function protocol(uri) {\n const i = uri.indexOf(':');\n if (i < 0) {\n return null;\n } else {\n return uri.slice(0, i);\n }\n}\n\n/**\n * Gets a relative uri\n * @param base The base URI\n * @param uri The absolute URI\n */\nexport function refTo(base, uri) {\n var c, i, k, l, len, len1, n, o, p, q, ref, ref1, s;\n var commonHost = new RegExp('^[-_a-zA-Z0-9.]+:(//[^/]*)?/[^/]*$');\n if (!base) {\n return uri;\n }\n if (base === uri) {\n return '';\n }\n for (i = o = 0, len = uri.length; o < len; i = ++o) {\n const c = uri[i];\n if (c !== base[i]) {\n break;\n }\n }\n if (base.slice(0, i).match(commonHost)) {\n k = uri.indexOf('//');\n if (k < 0) {\n k = -2;\n }\n l = uri.indexOf('/', k + 2);\n if (uri[l + 1] !== '/' && base[l + 1] !== '/' && uri.slice(0, l) === base.slice(0, l)) {\n return uri.slice(l);\n }\n }\n if (uri[i] === '#' && base.length === i) {\n return uri.slice(i);\n }\n while (i > 0 && uri[i - 1] !== '/') {\n i--;\n }\n if (i < 3) {\n return uri;\n }\n if (base.indexOf('//', i - 2) > 0 || uri.indexOf('//', i - 2) > 0) {\n return uri;\n }\n if (base.indexOf(':', i) > 0) {\n return uri;\n }\n n = 0;\n ref = base.slice(i);\n for (p = 0, len1 = ref.length; p < len1; p++) {\n c = ref[p];\n if (c === '/') {\n n++;\n }\n }\n if (n === 0 && i < uri.length && uri[i] === '#') {\n return './' + uri.slice(i);\n }\n if (n === 0 && i === uri.length) {\n return './';\n }\n s = '';\n if (n > 0) {\n for (q = 1, ref1 = n; ref1 >= 1 ? q <= ref1 : q >= ref1; ref1 >= 1 ? ++q : --q) {\n s += '../';\n }\n }\n return s + uri.slice(i);\n}","import { CollectionTermType, NamedNodeTermType, VariableTermType, BlankNodeTermType, LiteralTermType, GraphTermType, DefaultGraphTermType } from '../types';\n/** TypeGuard for RDFLib Statements */\nexport function isStatement(obj) {\n return typeof obj === 'object' && obj !== null && 'subject' in obj;\n}\n\n/** TypeGuard for RDFlib Stores */\nexport function isStore(obj) {\n return typeof obj === 'object' && obj !== null && 'statements' in obj;\n}\n\n/** TypeGuard for RDFLib Collections */\nexport function isCollection(obj) {\n return isTerm(obj) && obj.termType === CollectionTermType;\n}\n\n/** TypeGuard for valid RDFlib Object types, also allows Collections, Graphs */\nexport function isRDFlibObject(obj) {\n return obj && Object.prototype.hasOwnProperty.call(obj, 'termType') && (obj.termType === NamedNodeTermType || obj.termType === VariableTermType || obj.termType === BlankNodeTermType || obj.termType === CollectionTermType || obj.termType === LiteralTermType || obj.termType === GraphTermType);\n}\n\n/** TypeGuard for valid RDFlib Subject types, same as Object as RDFLib symmetrical.\n*/\nexport function isRDFlibSubject(obj) {\n return obj && Object.prototype.hasOwnProperty.call(obj, 'termType') && (obj.termType === NamedNodeTermType || obj.termType === VariableTermType || obj.termType === BlankNodeTermType || obj.termType === CollectionTermType || obj.termType === LiteralTermType || obj.termType === GraphTermType);\n}\n\n/** TypeGuard for valid RDF/JS spec Predicate types */\nexport function isRDFlibPredicate(obj) {\n return isTerm(obj) && (obj.termType === NamedNodeTermType || obj.termType === BlankNodeTermType || obj.termType === VariableTermType);\n}\n\n/** TypeGuard for RDFLib Variables */\nexport function isVariable(obj) {\n return isTerm(obj) && obj.termType === VariableTermType;\n}\n\n/** TypeGuard for RDF/JS spec Terms */\nexport function isTerm(obj) {\n return typeof obj === 'object' && obj !== null && 'termType' in obj;\n}\n\n/** TypeGuard for RDF/JS spec Literals */\nexport function isLiteral(value) {\n return value.termType === LiteralTermType;\n}\n\n/** TypeGuard for RDF/JS spec Quads */\nexport function isQuad(obj) {\n return typeof obj === \"object\" && obj !== null && 'subject' in obj && 'predicate' in obj && 'object' in obj;\n}\n\n/** TypeGuard for RDF/JS spec NamedNodes */\nexport function isNamedNode(obj) {\n return isTerm(obj) && obj.termType === 'NamedNode';\n}\n\n/** TypeGuard for RDF/JS spec BlankNodes */\nexport function isBlankNode(obj) {\n return isTerm(obj) && 'termType' in obj && obj.termType === 'BlankNode';\n}\n\n/** TypeGuard for valid RDF/JS spec Subject types */\nexport function isSubject(obj) {\n return isTerm(obj) && (obj.termType === NamedNodeTermType || obj.termType === VariableTermType || obj.termType === BlankNodeTermType);\n}\n\n/** TypeGuard for valid RDF/JS spec Predicate types */\nexport function isPredicate(obj) {\n return isTerm(obj) && (obj.termType === NamedNodeTermType || obj.termType === VariableTermType);\n}\n\n/** TypeGuard for valid RDF/JS spec Object types */\nexport function isRDFObject(obj) {\n return isTerm(obj) && (obj.termType === NamedNodeTermType || obj.termType === VariableTermType || obj.termType === BlankNodeTermType || obj.termType === LiteralTermType);\n}\n\n/** TypeGuard for valid RDF/JS Graph types */\nexport function isGraph(obj) {\n return isTerm(obj) && (obj.termType === NamedNodeTermType || obj.termType === VariableTermType || obj.termType === BlankNodeTermType || obj.termType === DefaultGraphTermType);\n}","/** Retrieve the value of a term, or self if already a string. */\nexport function termValue(node) {\n if (typeof node === 'string') {\n return node;\n }\n return node.value;\n}","/**\n * Utility functions for $rdf\n * @module util\n */\nimport { docpart } from './uri';\nimport log from './log';\nimport * as uri from './uri';\nimport NamedNode from './named-node';\nconst string = {\n template: stringTemplate\n};\nexport { log, uri, string };\nexport function mediaTypeClass(mediaType) {\n mediaType = mediaType.split(';')[0].trim(); // remove media type parameters\n return new NamedNode('http://www.w3.org/ns/iana/media-types/' + mediaType + '#Resource');\n}\nexport function linkRelationProperty(relation) {\n return new NamedNode('http://www.w3.org/ns/iana/link-relations/relation#' + relation.trim());\n}\n\n/**\n * Adds callback functionality to an object.\n * Callback functions are indexed by a 'hook' string.\n * They return true if they want to be called again.\n * @method callbackify\n * @param obj {Object}\n * @param callbacks {Array<string>}\n */\nexport function callbackify(obj, callbacks) {\n obj.callbacks = {};\n for (var x = callbacks.length - 1; x >= 0; x--) {\n obj.callbacks[callbacks[x]] = [];\n }\n obj.addHook = function (hook) {\n if (!obj.callbacks[hook]) {\n obj.callbacks[hook] = [];\n }\n };\n obj.addCallback = function (hook, func) {\n obj.callbacks[hook].push(func);\n };\n obj.removeCallback = function (hook, funcName) {\n for (var i = 0; i < obj.callbacks[hook].length; i++) {\n if (obj.callbacks[hook][i].name === funcName) {\n obj.callbacks[hook].splice(i, 1);\n return true;\n }\n }\n return false;\n };\n obj.insertCallback = function (hook, func) {\n obj.callbacks[hook].unshift(func);\n };\n obj.fireCallbacks = function fireCallbacks(hook, args) {\n var newCallbacks = [];\n var replaceCallbacks = [];\n var len = obj.callbacks[hook].length;\n var x;\n let callback;\n\n // log.info('!@$ Firing '+hook+' call back with length'+len)\n for (x = len - 1; x >= 0; x--) {\n // log.info('@@ Firing '+hook+' callback '+ obj.callbacks[hook][x])\n callback = obj.callbacks[hook][x];\n if (callback && callback.apply(obj, args)) {\n newCallbacks.push(callback);\n }\n }\n for (x = newCallbacks.length - 1; x >= 0; x--) {\n replaceCallbacks.push(newCallbacks[x]);\n }\n for (x = len; x < obj.callbacks[hook].length; x++) {\n replaceCallbacks.push(obj.callbacks[hook][x]);\n }\n obj.callbacks[hook] = replaceCallbacks;\n };\n}\n\n/**\n * Returns a DOM parser based on current runtime environment.\n */\nexport function DOMParserFactory() {\n if (window.DOMParser) {\n return new DOMParser();\n } else if (window.ActiveXObject) {\n return new ActiveXObject('Microsoft.XMLDOM');\n } else {\n return false;\n }\n}\n\n// From https://github.com/linkeddata/dokieli\nexport function domToString(node, options) {\n options = options || {};\n var selfClosing = [];\n if (options && options.selfClosing) {\n options.selfClosing.split(' ').forEach(function (n) {\n selfClosing[n] = true;\n });\n }\n var skipAttributes = [];\n if (options && options.skipAttributes) {\n options.skipAttributes.split(' ').forEach(function (n) {\n skipAttributes[n] = true;\n });\n }\n return dumpNode(node, options, selfClosing, skipAttributes);\n}\nexport function dumpNode(node, options, selfClosing, skipAttributes) {\n var i;\n var out = '';\n var noEsc = [false];\n if (typeof node.nodeType === 'undefined') return out;\n if (node.nodeType === 1) {\n if (node.hasAttribute('class') && options && options.classWithChildText && node.matches(options.classWithChildText.class)) {\n out += node.querySelector(options.classWithChildText.element).textContent;\n } else if (!(options && options.skipNodeWithClass && node.matches('.' + options.skipNodeWithClass))) {\n var ename = node.nodeName.toLowerCase();\n out += '<' + ename;\n var attrList = [];\n for (i = node.attributes.length - 1; i >= 0; i--) {\n var atn = node.attributes[i];\n if (skipAttributes && skipAttributes.length > 0 && skipAttributes[atn.name]) continue;\n if (/^\\d+$/.test(atn.name)) continue;\n if (atn.name === 'class' && options && options.replaceClassItemWith && atn.value.split(' ').indexOf(options.replaceClassItemWith.source) > -1) {\n var re = new RegExp(options.replaceClassItemWith.source, 'g');\n atn.value = atn.value.replace(re, options.replaceClassItemWith.target).trim();\n }\n if (!(atn.name === 'class' && options && options.skipClassWithValue && options.skipClassWithValue === atn.value)) {\n attrList.push(atn.name + '=\\'' + atn.value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&quot;') + '\\'');\n }\n }\n if (attrList.length > 0) {\n if (options && options.sortAttributes) {\n attrList.sort(function (a, b) {\n return a.toLowerCase().localeCompare(b.toLowerCase());\n });\n }\n out += ' ' + attrList.join(' ');\n }\n if (selfClosing && selfClosing.ename) {\n out += ' />';\n } else {\n out += '>';\n out += ename === 'html' ? '\\n ' : '';\n noEsc.push(ename === 'style' || ename === 'script');\n for (i = 0; i < node.childNodes.length; i++) out += dumpNode(node.childNodes[i]);\n noEsc.pop();\n out += ename === 'body' ? '</' + ename + '>' + '\\n' : '</' + ename + '>';\n }\n }\n } else if (node.nodeType === 8) {\n // FIXME: If comments are not tabbed in source, a new line is not prepended\n out += '<!--' + node.nodeValue + '-->';\n } else if (node.nodeType === 3 || node.nodeType === 4) {\n // XXX: Remove new lines which were added after DOM ready\n var nl = node.nodeValue.replace(/\\n+$/, '');\n out += noEsc[noEsc.length - 1] ? nl : nl.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n } else {\n console.log('Warning; Cannot handle serialising nodes of type: ' + node.nodeType);\n console.log(node);\n }\n return out;\n}\nexport function dtstamp() {\n var now = new Date();\n var year = now.getYear() + 1900;\n var month = now.getMonth() + 1;\n var day = now.getDate();\n var hour = now.getUTCHours();\n var minute = now.getUTCMinutes();\n var second = now.getSeconds();\n if (month < 10) month = '0' + month;\n if (day < 10) day = '0' + day;\n if (hour < 10) hour = '0' + hour;\n if (minute < 10) minute = '0' + minute;\n if (second < 10) second = '0' + second;\n return year + '-' + month + '-' + day + 'T' + hour + ':' + minute + ':' + second + 'Z';\n}\n\n/**\n * Compares statements (heavy comparison for repeatable canonical ordering)\n */\nexport function heavyCompare(x, y, g, uriMap) {\n var nonBlank = function (x) {\n return x.termType === 'BlankNode' ? null : x;\n };\n var signature = function (x) {\n var lis = g.statementsMatching(x).map(function (st) {\n return '' + nonBlank(st.subject) + ' ' + nonBlank(st.predicate) + ' ' + nonBlank(st.object);\n }).concat(g.statementsMatching(undefined, undefined, x).map(function (st) {\n return '' + nonBlank(st.subject) + ' ' + nonBlank(st.predicate) + ' ' + nonBlank(st.object);\n }));\n lis.sort();\n return lis.join('\\n');\n };\n const comparison = Object.prototype.hasOwnProperty.call(g, \"compareTerms\") ? g.compareTerms(x, y) : x.compareTerm(y);\n if (x.termType === 'BlankNode' && y.termType === 'BlankNode') {\n if (comparison === 0) return 0; // Same\n if (signature(x) > signature(y)) return +1;\n if (signature(x) < signature(y)) return -1;\n return comparison; // Too bad -- this order not canonical.\n // throw \"different bnodes indistinquishable for sorting\"\n } else {\n if (uriMap && x.uri && y.uri) {\n return (uriMap[x.uri] || x.uri).localeCompare(uriMap[y.uri] || y.uri);\n }\n return comparison;\n }\n}\nexport function heavyCompareSPO(x, y, g, uriMap) {\n return heavyCompare(x.subject, y.subject, g, uriMap) || heavyCompare(x.predicate, y.predicate, g, uriMap) || heavyCompare(x.object, y.object, g, uriMap);\n}\n\n/**\n * Defines a simple debugging function\n * @method output\n * @param o {String}\n */\nexport function output(o) {\n var k = document.createElement('div');\n k.textContent = o;\n document.body.appendChild(k);\n}\nimport { DOMParser } from '@xmldom/xmldom';\n\n/**\n * Returns a DOM from parsed XML.\n */\nexport function parseXML(str, options) {\n var dparser;\n options = options || {};\n if (typeof module !== 'undefined' && module && module.exports) {\n // Node.js\n var dom = new DOMParser().parseFromString(str, options.contentType || 'application/xhtml+xml');\n return dom;\n } else {\n if (typeof window !== 'undefined' && window.DOMParser) {\n dparser = new window.DOMParser(); // seems to actually work\n } else {\n dparser = new DOMParser(); // Doc says this works\n }\n }\n return dparser.parseFromString(str, 'application/xml');\n}\n\n/**\n * Removes all statements equal to x from a\n */\nexport function RDFArrayRemove(a, x) {\n for (var i = 0; i < a.length; i++) {\n // TODO: This used to be the following, which didnt always work..why\n // if(a[i] === x)\n if (a[i].subject.equals(x.subject) && a[i].predicate.equals(x.predicate) && a[i].object.equals(x.object) && a[i].why.equals(x.why)) {\n a.splice(i, 1);\n return;\n }\n }\n throw new Error('RDFArrayRemove: Array did not contain ' + x + ' ' + x.why);\n}\nexport function string_startswith(str, pref) {\n // missing library routines\n return str.slice(0, pref.length) === pref;\n}\n\n/**\n * C++, python style %s -> subs\n */\nfunction stringTemplate(base, subs) {\n var baseA = base.split('%s');\n var result = '';\n for (var i = 0; i < subs.length; i++) {\n subs[i] += '';\n result += baseA[i] + subs[i];\n }\n return result + baseA.slice(subs.length).join();\n}\n\n// Stack dump on errors - to pass errors back\n\nexport function stackString(e) {\n var str = '' + e + '\\n';\n if (!e.stack) {\n return str + 'No stack available.\\n';\n }\n var lines = e.stack.toString().split('\\n');\n var toprint = [];\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i];\n if (line.indexOf('ecmaunit.js') > -1) {\n // remove useless bit of traceback\n break;\n }\n if (line.charAt(0) == '(') {\n line = 'function' + line;\n }\n var chunks = line.split('@');\n toprint.push(chunks);\n }\n // toprint.reverse(); No - I prefer the latest at the top by the error message -tbl\n\n for (var i = 0; i < toprint.length; i++) {\n str += ' ' + toprint[i][1] + '\\n ' + toprint[i][0];\n }\n return str;\n}","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","/**\n * A Dummy log\n * @module log\n */\nconst log = {\n debug(x) {},\n warn(x) {},\n info(x) {},\n error(x) {},\n success(x) {},\n msg(x) {}\n};\nexport default log;","// Save global object in a variable\nvar __global__ =\n(typeof globalThis !== 'undefined' && globalThis) ||\n(typeof self !== 'undefined' && self) ||\n(typeof global !== 'undefined' && global);\n// Create an object that extends from __global__ without the fetch function\nvar __globalThis__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = __global__.DOMException\n}\nF.prototype = __global__; // Needed for feature detection on whatwg-fetch's code\nreturn new F();\n})();\n// Wraps whatwg-fetch with a function scope to hijack the global object\n// \"globalThis\" that's going to be patched\n(function(globalThis) {\n\nvar irrelevant = (function (exports) {\n\n /* eslint-disable no-prototype-builtins */\n var g =\n (typeof globalThis !== 'undefined' && globalThis) ||\n (typeof self !== 'undefined' && self) ||\n // eslint-disable-next-line no-undef\n (typeof global !== 'undefined' && global) ||\n {};\n\n var support = {\n searchParams: 'URLSearchParams' in g,\n iterable: 'Symbol' in g && 'iterator' in Symbol,\n blob:\n 'FileReader' in g &&\n 'Blob' in g &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in g,\n arrayBuffer: 'ArrayBuffer' in g\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {\n throw new TypeError('Invalid character in header field name: \"' + name + '\"')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n if (header.length != 2) {\n throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)\n }\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body._noBody) return\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);\n var encoding = match ? match[1] : 'utf-8';\n reader.readAsText(blob, encoding);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n /*\n fetch-mock wraps the Response object in an ES6 Proxy to\n provide useful test harness features such as flush. However, on\n ES5 browsers without fetch or Proxy support pollyfills must be used;\n the proxy-pollyfill is unable to proxy an attribute unless it exists\n on the object before the Proxy is created. This change ensures\n Response.bodyUsed exists on the instance, while maintaining the\n semantic of setting Request.bodyUsed in the constructor before\n _initBody is called.\n */\n // eslint-disable-next-line no-self-assign\n this.bodyUsed = this.bodyUsed;\n this._bodyInit = body;\n if (!body) {\n this._noBody = true;\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n var isConsumed = consumed(this);\n if (isConsumed) {\n return isConsumed\n } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {\n return Promise.resolve(\n this._bodyArrayBuffer.buffer.slice(\n this._bodyArrayBuffer.byteOffset,\n this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength\n )\n )\n } else {\n return Promise.resolve(this._bodyArrayBuffer)\n }\n } else if (support.blob) {\n return this.blob().then(readBlobAsArrayBuffer)\n } else {\n throw new Error('could not read as ArrayBuffer')\n }\n };\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n if (!(this instanceof Request)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal || (function () {\n if ('AbortController' in g) {\n var ctrl = new AbortController();\n return ctrl.signal;\n }\n }());\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n\n if (this.method === 'GET' || this.method === 'HEAD') {\n if (options.cache === 'no-store' || options.cache === 'no-cache') {\n // Search for a '_' parameter in the query string\n var reParamSearch = /([?&])_=[^&]*/;\n if (reParamSearch.test(this.url)) {\n // If it already exists then set the value with the current time\n this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());\n } else {\n // Otherwise add a new '_' parameter to the end with the current time\n var reQueryString = /\\?/;\n this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();\n }\n }\n }\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill\n // https://github.com/github/fetch/issues/748\n // https://github.com/zloirock/core-js/issues/751\n preProcessedHeaders\n .split('\\r')\n .map(function(header) {\n return header.indexOf('\\n') === 0 ? header.substr(1, header.length) : header\n })\n .forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n try {\n headers.append(key, value);\n } catch (error) {\n console.warn('Response ' + error.message);\n }\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!(this instanceof Response)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n if (this.status < 200 || this.status > 599) {\n throw new RangeError(\"Failed to construct 'Response': The status provided (0) is outside the range [200, 599].\")\n }\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = options.statusText === undefined ? '' : '' + options.statusText;\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 200, statusText: ''});\n response.ok = false;\n response.status = 0;\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = g.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n // This check if specifically for when a user fetches a file locally from the file system\n // Only if the status is out of a normal range\n if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) {\n options.status = 200;\n } else {\n options.status = xhr.status;\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n setTimeout(function() {\n resolve(new Response(body, options));\n }, 0);\n };\n\n xhr.onerror = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'));\n }, 0);\n };\n\n xhr.ontimeout = function() {\n setTimeout(function() {\n reject(new TypeError('Network request timed out'));\n }, 0);\n };\n\n xhr.onabort = function() {\n setTimeout(function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n }, 0);\n };\n\n function fixUrl(url) {\n try {\n return url === '' && g.location.href ? g.location.href : url\n } catch (e) {\n return url\n }\n }\n\n xhr.open(request.method, fixUrl(request.url), true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr) {\n if (support.blob) {\n xhr.responseType = 'blob';\n } else if (\n support.arrayBuffer\n ) {\n xhr.responseType = 'arraybuffer';\n }\n }\n\n if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {\n var names = [];\n Object.getOwnPropertyNames(init.headers).forEach(function(name) {\n names.push(normalizeName(name));\n xhr.setRequestHeader(name, normalizeValue(init.headers[name]));\n });\n request.headers.forEach(function(value, name) {\n if (names.indexOf(name) === -1) {\n xhr.setRequestHeader(name, value);\n }\n });\n } else {\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n }\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!g.fetch) {\n g.fetch = fetch;\n g.Headers = Headers;\n g.Request = Request;\n g.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(__globalThis__);\n// This is a ponyfill, so...\n__globalThis__.fetch.ponyfill = true;\ndelete __globalThis__.fetch.polyfill;\n// Choose between native implementation (__global__) or custom implementation (__globalThis__)\nvar ctx = __global__.fetch ? __global__ : __globalThis__;\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport ClassOrder from './class-order';\nimport Node from './node-internal';\nimport { NamedNodeTermType } from './types';\nimport { termValue } from './utils/termValue';\nimport { isTerm } from './utils/terms';\n\n/**\n * A named (IRI) RDF node\n */\nexport default class NamedNode extends Node {\n /**\n * Create a named (IRI) RDF Node\n * @constructor\n * @param iri - The IRI for this node\n */\n constructor(iri) {\n super(termValue(iri));\n _defineProperty(this, \"termType\", NamedNodeTermType);\n _defineProperty(this, \"classOrder\", ClassOrder.NamedNode);\n if (!this.value) {\n throw new Error('Missing IRI for NamedNode');\n }\n if (!this.value.includes(':')) {\n throw new Error('NamedNode IRI \"' + iri + '\" must be absolute.');\n }\n if (this.value.includes(' ')) {\n var message = 'Error: NamedNode IRI \"' + iri + '\" must not contain unencoded spaces.';\n throw new Error(message);\n }\n }\n\n /**\n * Returns an $rdf node for the containing directory, ending in slash.\n */\n dir() {\n var str = this.value.split('#')[0];\n var p = str.slice(0, -1).lastIndexOf('/');\n var q = str.indexOf('//');\n if (q >= 0 && p < q + 2 || p < 0) return null;\n return new NamedNode(str.slice(0, p + 1));\n }\n\n /**\n * Returns an NN for the whole web site, ending in slash.\n * Contrast with the \"origin\" which does NOT have a trailing slash\n */\n site() {\n var str = this.value.split('#')[0];\n var p = str.indexOf('//');\n if (p < 0) throw new Error('This URI does not have a web site part (origin)');\n var q = str.indexOf('/', p + 2);\n if (q < 0) {\n return new NamedNode(str.slice(0) + '/'); // Add slash to a bare origin\n } else {\n return new NamedNode(str.slice(0, q + 1));\n }\n }\n\n /**\n * Creates the fetchable named node for the document.\n * Removes everything from the # anchor tag.\n */\n doc() {\n if (this.value.indexOf('#') < 0) {\n return this;\n } else {\n return new NamedNode(this.value.split('#')[0]);\n }\n }\n\n /**\n * Returns the URI including <brackets>\n */\n toString() {\n return '<' + this.value + '>';\n }\n\n /** The local identifier with the document */\n id() {\n return this.value.split('#')[1];\n }\n\n /** Alias for value, favored by Tim */\n get uri() {\n return this.value;\n }\n set uri(uri) {\n this.value = uri;\n }\n\n /**\n * Creates a named node from the specified input value\n * @param value - An input value\n */\n static fromValue(value) {\n if (typeof value === 'undefined' || value === null) {\n return value;\n }\n if (isTerm(value)) {\n return value;\n }\n return new NamedNode(value);\n }\n}","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n(function(root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define([], factory);\n } else if (typeof module === \"object\" && module.exports) {\n module.exports = factory();\n } else {\n root.ttl2jsonld = factory();\n }\n})(this, function() {\n \"use strict\";\n\n function peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n }\n\n function peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n }\n\n peg$subclass(peg$SyntaxError, Error);\n\n peg$SyntaxError.buildMessage = function(expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function(expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n\n \"class\": function(expectation) {\n var escapedParts = \"\",\n i;\n\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n\n any: function(expectation) {\n return \"any character\";\n },\n\n end: function(expectation) {\n return \"end of input\";\n },\n\n other: function(expectation) {\n return expectation.description;\n }\n };\n\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function(ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return '\\\\x' + hex(ch); });\n }\n\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n\n function describeExpected(expected) {\n var descriptions = new Array(expected.length),\n i, j;\n\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n\n descriptions.sort();\n\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n };\n\n function peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n\n var peg$FAILED = {},\n\n peg$startRuleFunctions = { turtleDoc: peg$parseturtleDoc },\n peg$startRuleFunction = peg$parseturtleDoc,\n\n peg$c0 = function(statements) {\n var jsonld = context.toJSON();\n jsonld[\"@graph\"] = [];\n statements.filter(a=>Array.isArray(a)).forEach(a=>{\n a.forEach(b=>{\n jsonld[\"@graph\"].push(b);\n });\n });\n\n if(jsonld[\"@graph\"].length===1){\n Object.assign(jsonld,jsonld[\"@graph\"][0]);\n delete jsonld[\"@graph\"];\n }\n\n return jsonld;\n },\n peg$c1 = \"\\uFEFF\",\n peg$c2 = peg$literalExpectation(\"\\uFEFF\", false),\n peg$c3 = \".\",\n peg$c4 = peg$literalExpectation(\".\", false),\n peg$c5 = function(a) {return a;},\n peg$c6 = \"#\",\n peg$c7 = peg$literalExpectation(\"#\", false),\n peg$c8 = /^[^\\n]/,\n peg$c9 = peg$classExpectation([\"\\n\"], true, false),\n peg$c10 = \"\\n\",\n peg$c11 = peg$literalExpectation(\"\\n\", false),\n peg$c12 = function(a) {return a.join(\"\");},\n peg$c13 = \"@prefix\",\n peg$c14 = peg$literalExpectation(\"@prefix\", false),\n peg$c15 = function(a, b) {\n context.addPrefix(a===\"\" ? \"0\" : a,b);\n return {};\n },\n peg$c16 = \"@base\",\n peg$c17 = peg$literalExpectation(\"@base\", false),\n peg$c18 = function(a) {\n context.addBase(a);\n return {};\n },\n peg$c19 = /^[Bb]/,\n peg$c20 = peg$classExpectation([\"B\", \"b\"], false, false),\n peg$c21 = /^[Aa]/,\n peg$c22 = peg$classExpectation([\"A\", \"a\"], false, false),\n peg$c23 = /^[Ss]/,\n peg$c24 = peg$classExpectation([\"S\", \"s\"], false, false),\n peg$c25 = /^[Ee]/,\n peg$c26 = peg$classExpectation([\"E\", \"e\"], false, false),\n peg$c27 = /^[Pp]/,\n peg$c28 = peg$classExpectation([\"P\", \"p\"], false, false),\n peg$c29 = /^[Rr]/,\n peg$c30 = peg$classExpectation([\"R\", \"r\"], false, false),\n peg$c31 = /^[Ff]/,\n peg$c32 = peg$classExpectation([\"F\", \"f\"], false, false),\n peg$c33 = /^[Ii]/,\n peg$c34 = peg$classExpectation([\"I\", \"i\"], false, false),\n peg$c35 = /^[Xx]/,\n peg$c36 = peg$classExpectation([\"X\", \"x\"], false, false),\n peg$c37 = function(s, p) {\n var x = {};\n if(typeof s==='string' && s!=='[]') x[\"@id\"] = s;\n else if(typeof s==='object') Object.assign(x,s);\n if(p) Object.assign(x,p);\n return [x];\n },\n peg$c38 = function(s, p) {\n var x = {};\n if(s) Object.assign(x,s);\n if(p) Object.assign(x,p);\n return [x];\n },\n peg$c39 = \";\",\n peg$c40 = peg$literalExpectation(\";\", false),\n peg$c41 = function(a, b, e, f) {var x={};x[e]=f;return x;},\n peg$c42 = function(a, b, d) {return d;},\n peg$c43 = function(a, b, c) {\n var x = {};\n c.unshift(createObject(a,b));\n c.forEach(t=>{\n if(!t) return;\n Object.keys(t).forEach(key=>{\n t[key].forEach(val=>{\n if(key===\"@type\" && val[\"@id\"]!==undefined) val = val[\"@id\"];\n if(x[key]===undefined) x[key] = val;\n else if(Array.isArray(x[key])) x[key].push(val);\n else x[key] = [x[key],val];\n });\n });\n });\n return x;\n },\n peg$c44 = \",\",\n peg$c45 = peg$literalExpectation(\",\", false),\n peg$c46 = function(a, c) {return c;},\n peg$c47 = function(a, b) {\n b.unshift(a);\n return b;\n },\n peg$c48 = \"a\",\n peg$c49 = peg$literalExpectation(\"a\", false),\n peg$c50 = function() {return '@type';},\n peg$c51 = function(a) {return expandList(a,true);},\n peg$c52 = function(a) {return expandList(a,false);},\n peg$c53 = function(a) {return a===\"[]\" ? {} : {\"@id\":a};},\n peg$c54 = function(a) {return {\"@id\":a};},\n peg$c55 = \"[\",\n peg$c56 = peg$literalExpectation(\"[\", false),\n peg$c57 = \"]\",\n peg$c58 = peg$literalExpectation(\"]\", false),\n peg$c59 = \"(\",\n peg$c60 = peg$literalExpectation(\"(\", false),\n peg$c61 = \")\",\n peg$c62 = peg$literalExpectation(\")\", false),\n peg$c63 = function(a) {return {\"@list\":a};},\n peg$c64 = function(a, b) {return {\"@value\":a,\"@language\":b};},\n peg$c65 = \"^^\",\n peg$c66 = peg$literalExpectation(\"^^\", false),\n peg$c67 = function(a, b) {\n if(b===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"true\") return true;\n if(b===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"false\") return false;\n if(b===\"http://www.w3.org/2001/XMLSchema#integer\") return parseInt(a);\n if(b===\"http://www.w3.org/2001/XMLSchema#double\") return parseFloat(a);\n\n const uri = context.resolve(b,true);\n if(uri){\n const prefix = b.split(\":\")[0];\n if(uri===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"true\"){\n context.decrement(prefix);\n return true;\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#boolean\" && a===\"false\"){\n context.decrement(prefix);\n return false;\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#integer\"){\n context.decrement(prefix);\n return parseInt(a);\n }\n if(uri===\"http://www.w3.org/2001/XMLSchema#double\"){\n context.decrement(prefix);\n return parseFloat(a);\n }\n }\n return {\"@value\":a,\"@type\":b};\n },\n peg$c68 = \"true\",\n peg$c69 = peg$literalExpectation(\"true\", false),\n peg$c70 = function() {return true;},\n peg$c71 = \"false\",\n peg$c72 = peg$literalExpectation(\"false\", false),\n peg$c73 = function() {return false;},\n peg$c74 = function(a) {return a+\":\";},\n peg$c75 = \"<\",\n peg$c76 = peg$literalExpectation(\"<\", false),\n peg$c77 = /^[^\\0- <>\"{}|\\^`\\\\]/,\n peg$c78 = peg$classExpectation([[\"\\0\", \" \"], \"<\", \">\", \"\\\"\", \"{\", \"}\", \"|\", \"^\", \"`\", \"\\\\\"], true, false),\n peg$c79 = \">\",\n peg$c80 = peg$literalExpectation(\">\", false),\n peg$c81 = function(a) {\n const decoded = a.map(s=> {\n if(0x10000 <= s.codePointAt(0) && s.codePointAt(0) <= 0xeffff) return 'a';\n if(s.length===1) return s;\n if(s.length===6) return String.fromCharCode(\"0x\"+s.substring(2));\n if(s.length===10) return String.fromCodePoint(\"0x\"+s.substring(2));\n return s;\n }).join(\"\");\n if(decoded.match(/^[^\\u0000-\\u0020<>\"{}|^`\\\\]*$/)){\n var join = a.join(\"\");\n try{\n return context.resolve(join);\n }catch(e){\n error(\"Invalid IRIREF \"+join);\n }\n }\n else error(\"Invalid IRIREF \"+a.join(\"\")+\" / \"+decoded);\n },\n peg$c82 = \":\",\n peg$c83 = peg$literalExpectation(\":\", false),\n peg$c84 = function(a) {\n a = a || \"0\";\n if(context.hasPrefix(a)===false)\n error(\"undefined prefix \"+a);\n return a;\n },\n peg$c85 = function(a) {return (a||\"\");},\n peg$c86 = function(a, b) {\n context.increment(a);\n return context.resolve(a+\":\"+b);\n },\n peg$c87 = \"_:\",\n peg$c88 = peg$literalExpectation(\"_:\", false),\n peg$c89 = /^[0-9]/,\n peg$c90 = peg$classExpectation([[\"0\", \"9\"]], false, false),\n peg$c91 = \"@\",\n peg$c92 = peg$literalExpectation(\"@\", false),\n peg$c93 = /^[a-zA-Z]/,\n peg$c94 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"]], false, false),\n peg$c95 = \"-\",\n peg$c96 = peg$literalExpectation(\"-\", false),\n peg$c97 = /^[a-zA-Z0-9]/,\n peg$c98 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], [\"0\", \"9\"]], false, false),\n peg$c99 = function(a, s) {return '-'+s.join(\"\");},\n peg$c100 = function(a, b) {return a.join(\"\")+b.join(\"\");},\n peg$c101 = /^[+\\-]/,\n peg$c102 = peg$classExpectation([\"+\", \"-\"], false, false),\n peg$c103 = function(a) {\n if(a.match(/^[0+][0-9]+$/))\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#integer\"\n };\n return parseInt(a);\n },\n peg$c104 = function(a) {\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#decimal\"\n }\n },\n peg$c105 = function(a) {\n return {\n \"@value\" : a,\n \"@type\" : \"http://www.w3.org/2001/XMLSchema#double\"\n };\n },\n peg$c106 = /^[eE]/,\n peg$c107 = peg$classExpectation([\"e\", \"E\"], false, false),\n peg$c108 = \"\\\"\",\n peg$c109 = peg$literalExpectation(\"\\\"\", false),\n peg$c110 = /^[^\"\\\\\\n\\r]/,\n peg$c111 = peg$classExpectation([\"\\\"\", \"\\\\\", \"\\n\", \"\\r\"], true, false),\n peg$c112 = \"'\",\n peg$c113 = peg$literalExpectation(\"'\", false),\n peg$c114 = /^[^'\\\\\\n\\r]/,\n peg$c115 = peg$classExpectation([\"'\", \"\\\\\", \"\\n\", \"\\r\"], true, false),\n peg$c116 = \"'''\",\n peg$c117 = peg$literalExpectation(\"'''\", false),\n peg$c118 = /^[^'\\\\]/,\n peg$c119 = peg$classExpectation([\"'\", \"\\\\\"], true, false),\n peg$c120 = \"''\",\n peg$c121 = peg$literalExpectation(\"''\", false),\n peg$c122 = function(head, a) {return \"''\"+a.join(\"\");},\n peg$c123 = function(head, a) {return \"'\" +a.join(\"\");},\n peg$c124 = function(head, body) {return head.join(\"\")+body.join(\"\");},\n peg$c125 = \"\\\"\\\"\\\"\",\n peg$c126 = peg$literalExpectation(\"\\\"\\\"\\\"\", false),\n peg$c127 = /^[^\"\\\\]/,\n peg$c128 = peg$classExpectation([\"\\\"\", \"\\\\\"], true, false),\n peg$c129 = \"\\\"\\\"\",\n peg$c130 = peg$literalExpectation(\"\\\"\\\"\", false),\n peg$c131 = function(head, a) {return '\"\"'+a.join(\"\");},\n peg$c132 = function(head, a) {return '\"' +a.join(\"\");},\n peg$c133 = \"\\\\U\",\n peg$c134 = peg$literalExpectation(\"\\\\U\", false),\n peg$c135 = function(hex) {\n return String.fromCodePoint(parseInt(hex.join(\"\"),16));\n },\n peg$c136 = \"\\\\u\",\n peg$c137 = peg$literalExpectation(\"\\\\u\", false),\n peg$c138 = function(hex) {\n return String.fromCharCode(parseInt(hex.join(\"\"),16));\n },\n peg$c139 = \"\\\\t\",\n peg$c140 = peg$literalExpectation(\"\\\\t\", false),\n peg$c141 = function() {return '\\t';},\n peg$c142 = \"\\\\b\",\n peg$c143 = peg$literalExpectation(\"\\\\b\", false),\n peg$c144 = function() {return '\\b';},\n peg$c145 = \"\\\\n\",\n peg$c146 = peg$literalExpectation(\"\\\\n\", false),\n peg$c147 = function() {return '\\n';},\n peg$c148 = \"\\\\r\",\n peg$c149 = peg$literalExpectation(\"\\\\r\", false),\n peg$c150 = function() {return '\\r';},\n peg$c151 = \"\\\\f\",\n peg$c152 = peg$literalExpectation(\"\\\\f\", false),\n peg$c153 = function() {return '\\f';},\n peg$c154 = \"\\\\\\\"\",\n peg$c155 = peg$literalExpectation(\"\\\\\\\"\", false),\n peg$c156 = function() {return '\"';},\n peg$c157 = \"\\\\'\",\n peg$c158 = peg$literalExpectation(\"\\\\'\", false),\n peg$c159 = function() {return \"'\";},\n peg$c160 = \"\\\\\\\\\",\n peg$c161 = peg$literalExpectation(\"\\\\\\\\\", false),\n peg$c162 = function() {return '\\\\';},\n peg$c163 = /^[ \\t\\r\\n]/,\n peg$c164 = peg$classExpectation([\" \", \"\\t\", \"\\r\", \"\\n\"], false, false),\n peg$c165 = function() {return \"[]\";},\n peg$c166 = /^[\\uD800-\\uDBFF]/,\n peg$c167 = peg$classExpectation([[\"\\uD800\", \"\\uDBFF\"]], false, false),\n peg$c168 = /^[\\uDC00-\\uDFFF]/,\n peg$c169 = peg$classExpectation([[\"\\uDC00\", \"\\uDFFF\"]], false, false),\n peg$c170 = function(a, b) {return a+b;},\n peg$c171 = /^[A-Za-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/,\n peg$c172 = peg$classExpectation([[\"A\", \"Z\"], [\"a\", \"z\"], [\"\\xC0\", \"\\xD6\"], [\"\\xD8\", \"\\xF6\"], [\"\\xF8\", \"\\u02FF\"], [\"\\u0370\", \"\\u037D\"], [\"\\u037F\", \"\\u1FFF\"], [\"\\u200C\", \"\\u200D\"], [\"\\u2070\", \"\\u218F\"], [\"\\u2C00\", \"\\u2FEF\"], [\"\\u3001\", \"\\uD7FF\"], [\"\\uF900\", \"\\uFDCF\"], [\"\\uFDF0\", \"\\uFFFD\"]], false, false),\n peg$c173 = \"_\",\n peg$c174 = peg$literalExpectation(\"_\", false),\n peg$c175 = \"\\xB7\",\n peg$c176 = peg$literalExpectation(\"\\xB7\", false),\n peg$c177 = /^[\\u0300-\\u036F]/,\n peg$c178 = peg$classExpectation([[\"\\u0300\", \"\\u036F\"]], false, false),\n peg$c179 = /^[\\u203F-\\u2040]/,\n peg$c180 = peg$classExpectation([[\"\\u203F\", \"\\u2040\"]], false, false),\n peg$c181 = function(head, body, a, b) {return a.join(\"\")+b.join(\"\");},\n peg$c182 = function(head, body, tail) {return head+body.join(\"\")+tail.join(\"\");},\n peg$c183 = \"%\",\n peg$c184 = peg$literalExpectation(\"%\", false),\n peg$c185 = /^[0-9A-Fa-f]/,\n peg$c186 = peg$classExpectation([[\"0\", \"9\"], [\"A\", \"F\"], [\"a\", \"f\"]], false, false),\n peg$c187 = \"\\\\\",\n peg$c188 = peg$literalExpectation(\"\\\\\", false),\n peg$c189 = /^[_~.!$&'()*+,;=\\/?#@%\\-]/,\n peg$c190 = peg$classExpectation([\"_\", \"~\", \".\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \"/\", \"?\", \"#\", \"@\", \"%\", \"-\"], false, false),\n\n peg$currPos = 0,\n peg$savedPos = 0,\n peg$posDetailsCache = [{ line: 1, column: 1 }],\n peg$maxFailPos = 0,\n peg$maxFailExpected = [],\n peg$silentFails = 0,\n\n peg$result;\n\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildStructuredError(\n [peg$otherExpectation(description)],\n input.substring(peg$savedPos, peg$currPos),\n location\n );\n }\n\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)\n\n throw peg$buildSimpleError(message, location);\n }\n\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n\n if (details) {\n return details;\n } else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n } else {\n details.column++;\n }\n\n p++;\n }\n\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos),\n endPosDetails = peg$computePosDetails(endPos);\n\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) { return; }\n\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n\n peg$maxFailExpected.push(expected);\n }\n\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(\n peg$SyntaxError.buildMessage(expected, found),\n expected,\n found,\n location\n );\n }\n\n function peg$parseturtleDoc() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseBOM();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseBOM();\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsestatement();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsestatement();\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c0(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseBOM() {\n var s0;\n\n if (input.charCodeAt(peg$currPos) === 65279) {\n s0 = peg$c1;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c2); }\n }\n\n return s0;\n }\n\n function peg$parsestatement() {\n var s0, s1, s2, s3;\n\n s0 = peg$parsedirective();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsetriples();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseIGNORE();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseIGNORE();\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s3 = peg$c3;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseCOMMENT() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 35) {\n s1 = peg$c6;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c7); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c8.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c9); }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c8.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c9); }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 10) {\n s3 = peg$c10;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c11); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c12(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseIGNORE() {\n var s0;\n\n s0 = peg$parseWS();\n if (s0 === peg$FAILED) {\n s0 = peg$parseCOMMENT();\n }\n\n return s0;\n }\n\n function peg$parsedirective() {\n var s0;\n\n s0 = peg$parseprefixID();\n if (s0 === peg$FAILED) {\n s0 = peg$parsebase();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesparqlPrefix();\n if (s0 === peg$FAILED) {\n s0 = peg$parsesparqlBase();\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseprefixID() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 7) === peg$c13) {\n s2 = peg$c13;\n peg$currPos += 7;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c14); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parsePNAME_NS_NO_CHECK();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseIRIREF();\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parseIGNORE();\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parseIGNORE();\n }\n if (s7 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c3;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s8 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c15(s4, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsebase() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c16) {\n s2 = peg$c16;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c17); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseIRIREF();\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c3;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c18(s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesparqlBase() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (peg$c19.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c20); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c21.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c22); }\n }\n if (s3 !== peg$FAILED) {\n if (peg$c23.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c24); }\n }\n if (s4 !== peg$FAILED) {\n if (peg$c25.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c26); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parseIGNORE();\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parseIGNORE();\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parseIRIREF();\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c18(s7);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsesparqlPrefix() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (peg$c27.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c28); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c29.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c30); }\n }\n if (s3 !== peg$FAILED) {\n if (peg$c25.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c26); }\n }\n if (s4 !== peg$FAILED) {\n if (peg$c31.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c32); }\n }\n if (s5 !== peg$FAILED) {\n if (peg$c33.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c34); }\n }\n if (s6 !== peg$FAILED) {\n if (peg$c35.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c36); }\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parseIGNORE();\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parseIGNORE();\n }\n if (s8 !== peg$FAILED) {\n s9 = peg$parsePNAME_NS_NO_CHECK();\n if (s9 !== peg$FAILED) {\n s10 = [];\n s11 = peg$parseIGNORE();\n while (s11 !== peg$FAILED) {\n s10.push(s11);\n s11 = peg$parseIGNORE();\n }\n if (s10 !== peg$FAILED) {\n s11 = peg$parseIRIREF();\n if (s11 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c15(s9, s11);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsetriples() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsesubject();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsepredicateObjectList();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c37(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseblankNodePropertyList();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsepredicateObjectList();\n if (s2 === peg$FAILED) {\n s2 = null;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c38(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsepredicateObjectList() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;\n\n s0 = peg$currPos;\n s1 = peg$parseverb();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseobjectList();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s6 = peg$c39;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c40); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$currPos;\n s8 = peg$parseverb();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseobjectList();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s7;\n s8 = peg$c41(s1, s2, s8, s9);\n s7 = s8;\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n if (s7 === peg$FAILED) {\n s7 = null;\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c42(s1, s2, s7);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s6 = peg$c39;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c40); }\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$currPos;\n s8 = peg$parseverb();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseobjectList();\n if (s9 !== peg$FAILED) {\n peg$savedPos = s7;\n s8 = peg$c41(s1, s2, s8, s9);\n s7 = s8;\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n } else {\n peg$currPos = s7;\n s7 = peg$FAILED;\n }\n if (s7 === peg$FAILED) {\n s7 = null;\n }\n if (s7 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c42(s1, s2, s7);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c43(s1, s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseobjectList() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = peg$parseobject();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c44;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c45); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseobject();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c46(s1, s6);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 44) {\n s5 = peg$c44;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c45); }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseobject();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c46(s1, s6);\n s3 = s4;\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n } else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c47(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseverb() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsepredicate();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 97) {\n s2 = peg$c48;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c49); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c50();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsesubject() {\n var s0, s1;\n\n s0 = peg$currPos;\n s1 = peg$parsecollection();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c51(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$parseBlankNode();\n if (s0 === peg$FAILED) {\n s0 = peg$parseiri();\n }\n }\n\n return s0;\n }\n\n function peg$parsepredicate() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseiri();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseobject() {\n var s0, s1;\n\n s0 = peg$parseliteral();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsecollection();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c52(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseBlankNode();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c53(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseblankNodePropertyList();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s1);\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parseiri();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c54(s1);\n }\n s0 = s1;\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseliteral() {\n var s0;\n\n s0 = peg$parseRDFLiteral();\n if (s0 === peg$FAILED) {\n s0 = peg$parseNumericLiteral();\n if (s0 === peg$FAILED) {\n s0 = peg$parseBooleanLiteral();\n }\n }\n\n return s0;\n }\n\n function peg$parseblankNodePropertyList() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 91) {\n s2 = peg$c55;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c56); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsepredicateObjectList();\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s5 = peg$c57;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c58); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsecollection() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 40) {\n s2 = peg$c59;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c60); }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseobject();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseobject();\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parseIGNORE();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parseIGNORE();\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s5 = peg$c61;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c62); }\n }\n if (s5 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c63(s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseNumericLiteral() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseDOUBLE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseDECIMAL();\n if (s2 === peg$FAILED) {\n s2 = peg$parseINTEGER();\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseRDFLiteral() {\n var s0, s1, s2, s3, s4, s5, s6;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parseLANGTAG();\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c64(s2, s4);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parseIGNORE();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parseIGNORE();\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 2) === peg$c65) {\n s4 = peg$c65;\n peg$currPos += 2;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c66); }\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$parseIGNORE();\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$parseIGNORE();\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseiri();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c67(s2, s6);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseString();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseBooleanLiteral() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c68) {\n s2 = peg$c68;\n peg$currPos += 4;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c69); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c70();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c71) {\n s2 = peg$c71;\n peg$currPos += 5;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c72); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c73();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseString() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_LONG_SINGLE_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_LONG_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_SINGLE_QUOTE();\n if (s2 === peg$FAILED) {\n s2 = peg$parseSTRING_LITERAL_QUOTE();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseiri() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseIRIREF();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parsePrefixedName();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parsePrefixedName() {\n var s0, s1;\n\n s0 = peg$parsePNAME_LN();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsePNAME_NS();\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c74(s1);\n }\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseBlankNode() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseBLANK_NODE_LABEL();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = [];\n s2 = peg$parseIGNORE();\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n s2 = peg$parseIGNORE();\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$parseANON();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseIRIREF() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 60) {\n s1 = peg$c75;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c76); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c77.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c78); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c77.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c78); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 62) {\n s3 = peg$c79;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c80); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c81(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_NS() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_PREFIX();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s2 = peg$c82;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c84(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_NS_NO_CHECK() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_PREFIX();\n if (s1 === peg$FAILED) {\n s1 = null;\n }\n if (s1 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s2 = peg$c82;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c85(s1);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePNAME_LN() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n s1 = peg$parsePNAME_NS();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsePN_LOCAL();\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c86(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseBLANK_NODE_LABEL() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c87) {\n s2 = peg$c87;\n peg$currPos += 2;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c88); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parsePN_CHARS_U();\n if (s3 === peg$FAILED) {\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$parsePN_CHARS();\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$parsePN_CHARS();\n }\n if (s4 !== peg$FAILED) {\n s5 = [];\n s6 = peg$currPos;\n s7 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c3;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c3;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parsePN_CHARS();\n if (s9 !== peg$FAILED) {\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parsePN_CHARS();\n }\n } else {\n s8 = peg$FAILED;\n }\n if (s8 !== peg$FAILED) {\n s7 = [s7, s8];\n s6 = s7;\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n s6 = peg$currPos;\n s7 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c3;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (input.charCodeAt(peg$currPos) === 46) {\n s8 = peg$c3;\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s8 = [];\n s9 = peg$parsePN_CHARS();\n if (s9 !== peg$FAILED) {\n while (s9 !== peg$FAILED) {\n s8.push(s9);\n s9 = peg$parsePN_CHARS();\n }\n } else {\n s8 = peg$FAILED;\n }\n if (s8 !== peg$FAILED) {\n s7 = [s7, s8];\n s6 = s7;\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n } else {\n peg$currPos = s6;\n s6 = peg$FAILED;\n }\n }\n if (s5 !== peg$FAILED) {\n s2 = [s2, s3, s4, s5];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseLANGTAG() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 64) {\n s1 = peg$c91;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c92); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c93.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c94); }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c93.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c94); }\n }\n }\n } else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 45) {\n s5 = peg$c95;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c97.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c98); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c97.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c98); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c99(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 45) {\n s5 = peg$c95;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c97.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c98); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c97.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c98); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c99(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c100(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseINTEGER() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c101.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c102); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c103(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseDECIMAL() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c101.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c102); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c3;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c104(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseDOUBLE() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$currPos;\n if (peg$c101.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c102); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$currPos;\n s5 = [];\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c3;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s8 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s8 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parseEXPONENT();\n if (s8 !== peg$FAILED) {\n s5 = [s5, s6, s7, s8];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 46) {\n s5 = peg$c3;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = peg$parseEXPONENT();\n if (s7 !== peg$FAILED) {\n s5 = [s5, s6, s7];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n s5 = [];\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s6 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parseEXPONENT();\n if (s6 !== peg$FAILED) {\n s5 = [s5, s6];\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s4 !== peg$FAILED) {\n s3 = [s3, s4];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n s1 = input.substring(s1, peg$currPos);\n } else {\n s1 = s2;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c105(s1);\n }\n s0 = s1;\n\n return s0;\n }\n\n function peg$parseEXPONENT() {\n var s0, s1, s2, s3, s4, s5;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (peg$c106.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c107); }\n }\n if (s2 !== peg$FAILED) {\n if (peg$c101.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c102); }\n }\n if (s3 === peg$FAILED) {\n s3 = null;\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s5 !== peg$FAILED) {\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s5 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n }\n } else {\n s4 = peg$FAILED;\n }\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_QUOTE() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c108;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c110.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c110.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c111); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c108;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c12(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_SINGLE_QUOTE() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s1 = peg$c112;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c113); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c114.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c115); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c114.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c115); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 39) {\n s3 = peg$c112;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c113); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c12(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_LONG_SINGLE_QUOTE() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c116) {\n s1 = peg$c116;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c120) {\n s5 = peg$c120;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c121); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c122(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s5 = peg$c112;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c113); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c123(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c120) {\n s5 = peg$c120;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c121); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c122(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 39) {\n s5 = peg$c112;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c113); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c118.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c119); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c123(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c116) {\n s4 = peg$c116;\n peg$currPos += 3;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c117); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c124(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseSTRING_LITERAL_LONG_QUOTE() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 3) === peg$c125) {\n s1 = peg$c125;\n peg$currPos += 3;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parseECHAR();\n if (s3 === peg$FAILED) {\n s3 = peg$parseUCHAR();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c129) {\n s5 = peg$c129;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c130); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c131(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s5 = peg$c108;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c132(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c129) {\n s5 = peg$c129;\n peg$currPos += 2;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c130); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c131(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n if (s4 === peg$FAILED) {\n s4 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s5 = peg$c108;\n peg$currPos++;\n } else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c109); }\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (peg$c127.test(input.charAt(peg$currPos))) {\n s7 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c128); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parseECHAR();\n if (s7 === peg$FAILED) {\n s7 = peg$parseUCHAR();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c132(s2, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n }\n if (s3 !== peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c125) {\n s4 = peg$c125;\n peg$currPos += 3;\n } else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c126); }\n }\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c124(s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parseUCHAR() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c133) {\n s1 = peg$c133;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c134); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseHEX();\n if (s6 !== peg$FAILED) {\n s7 = peg$parseHEX();\n if (s7 !== peg$FAILED) {\n s8 = peg$parseHEX();\n if (s8 !== peg$FAILED) {\n s9 = peg$parseHEX();\n if (s9 !== peg$FAILED) {\n s10 = peg$parseHEX();\n if (s10 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6, s7, s8, s9, s10];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c135(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c136) {\n s1 = peg$c136;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c137); }\n }\n if (s1 !== peg$FAILED) {\n s2 = peg$currPos;\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s5 = peg$parseHEX();\n if (s5 !== peg$FAILED) {\n s6 = peg$parseHEX();\n if (s6 !== peg$FAILED) {\n s3 = [s3, s4, s5, s6];\n s2 = s3;\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n } else {\n peg$currPos = s2;\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c138(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n\n return s0;\n }\n\n function peg$parseECHAR() {\n var s0, s1;\n\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c139) {\n s1 = peg$c139;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c140); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c141();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c142) {\n s1 = peg$c142;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c143); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c144();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c145) {\n s1 = peg$c145;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c146); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c147();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c148) {\n s1 = peg$c148;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c149); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c150();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c151) {\n s1 = peg$c151;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c152); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c153();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c154) {\n s1 = peg$c154;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c155); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c156();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c157) {\n s1 = peg$c157;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c158); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c159();\n }\n s0 = s1;\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n if (input.substr(peg$currPos, 2) === peg$c160) {\n s1 = peg$c160;\n peg$currPos += 2;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c161); }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c162();\n }\n s0 = s1;\n }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parseWS() {\n var s0;\n\n if (peg$c163.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c164); }\n }\n\n return s0;\n }\n\n function peg$parseANON() {\n var s0, s1, s2, s3;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 91) {\n s1 = peg$c55;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c56); }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parseIGNORE();\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parseIGNORE();\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s3 = peg$c57;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c58); }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c165();\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS_BASE() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (peg$c166.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c167); }\n }\n if (s1 !== peg$FAILED) {\n if (peg$c168.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c169); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c170(s1, s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n if (peg$c171.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c172); }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS_U() {\n var s0;\n\n s0 = peg$parsePN_CHARS_BASE();\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 95) {\n s0 = peg$c173;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c174); }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_CHARS() {\n var s0;\n\n s0 = peg$parsePN_CHARS_U();\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 45) {\n s0 = peg$c95;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c96); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s0 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 183) {\n s0 = peg$c175;\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c176); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c177.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c178); }\n }\n if (s0 === peg$FAILED) {\n if (peg$c179.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c180); }\n }\n }\n }\n }\n }\n }\n\n return s0;\n }\n\n function peg$parsePN_PREFIX() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n s2 = peg$parsePN_CHARS_BASE();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$parsePN_CHARS();\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$parsePN_CHARS();\n }\n if (s3 !== peg$FAILED) {\n s4 = [];\n s5 = peg$currPos;\n s6 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c3;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c3;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parsePN_CHARS();\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parsePN_CHARS();\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s6 = [s6, s7];\n s5 = s6;\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n while (s5 !== peg$FAILED) {\n s4.push(s5);\n s5 = peg$currPos;\n s6 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c3;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n if (input.charCodeAt(peg$currPos) === 46) {\n s7 = peg$c3;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n s7 = [];\n s8 = peg$parsePN_CHARS();\n if (s8 !== peg$FAILED) {\n while (s8 !== peg$FAILED) {\n s7.push(s8);\n s8 = peg$parsePN_CHARS();\n }\n } else {\n s7 = peg$FAILED;\n }\n if (s7 !== peg$FAILED) {\n s6 = [s6, s7];\n s5 = s6;\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n } else {\n peg$currPos = s5;\n s5 = peg$FAILED;\n }\n }\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parsePN_LOCAL() {\n var s0, s1, s2, s3, s4, s5, s6, s7;\n\n s0 = peg$currPos;\n s1 = peg$parsePN_CHARS_U();\n if (s1 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s1 = peg$c82;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s1 === peg$FAILED) {\n if (peg$c89.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c90); }\n }\n if (s1 === peg$FAILED) {\n s1 = peg$parsePLX();\n }\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$parsePN_CHARS();\n if (s3 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s3 = peg$c82;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parsePLX();\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$parsePN_CHARS();\n if (s3 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s3 = peg$c82;\n peg$currPos++;\n } else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s3 === peg$FAILED) {\n s3 = peg$parsePLX();\n }\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n s5 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c3;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c3;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c82;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c82;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c181(s1, s2, s5, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n s5 = [];\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c3;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n if (s6 !== peg$FAILED) {\n while (s6 !== peg$FAILED) {\n s5.push(s6);\n if (input.charCodeAt(peg$currPos) === 46) {\n s6 = peg$c3;\n peg$currPos++;\n } else {\n s6 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c4); }\n }\n }\n } else {\n s5 = peg$FAILED;\n }\n if (s5 !== peg$FAILED) {\n s6 = [];\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c82;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n if (s7 !== peg$FAILED) {\n while (s7 !== peg$FAILED) {\n s6.push(s7);\n s7 = peg$parsePN_CHARS();\n if (s7 === peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 58) {\n s7 = peg$c82;\n peg$currPos++;\n } else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c83); }\n }\n if (s7 === peg$FAILED) {\n s7 = peg$parsePLX();\n }\n }\n }\n } else {\n s6 = peg$FAILED;\n }\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c181(s1, s2, s5, s6);\n s4 = s5;\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n } else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c182(s1, s2, s3);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n function peg$parsePLX() {\n var s0;\n\n s0 = peg$parsePERCENT();\n if (s0 === peg$FAILED) {\n s0 = peg$parsePN_LOCAL_ESC();\n }\n\n return s0;\n }\n\n function peg$parsePERCENT() {\n var s0, s1, s2, s3, s4;\n\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 37) {\n s2 = peg$c183;\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c184); }\n }\n if (s2 !== peg$FAILED) {\n s3 = peg$parseHEX();\n if (s3 !== peg$FAILED) {\n s4 = peg$parseHEX();\n if (s4 !== peg$FAILED) {\n s2 = [s2, s3, s4];\n s1 = s2;\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n } else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n s0 = input.substring(s0, peg$currPos);\n } else {\n s0 = s1;\n }\n\n return s0;\n }\n\n function peg$parseHEX() {\n var s0;\n\n if (peg$c185.test(input.charAt(peg$currPos))) {\n s0 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c186); }\n }\n\n return s0;\n }\n\n function peg$parsePN_LOCAL_ESC() {\n var s0, s1, s2;\n\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 92) {\n s1 = peg$c187;\n peg$currPos++;\n } else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c188); }\n }\n if (s1 !== peg$FAILED) {\n if (peg$c189.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n } else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) { peg$fail(peg$c190); }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c5(s2);\n s0 = s1;\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n } else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n\n return s0;\n }\n\n\n var isIRI = function(a){return a.match(/^[a-z](.*?):(.+?)/g);};\n function createObject(property,value){var a={};a[property]=value;return a;}\n var context = {\n base : [],\n data : {},\n addBase : function(uri){\n if(context.base.length===0){\n context.base.push(uri);\n return;\n }\n const last = context.base[context.base.length-1];\n if(last!==uri) context.base.push(new URL(uri,last).toString());\n },\n addPrefix : function(prefix,uri){\n const list = context.data[prefix];\n if(list===undefined){\n context.data[prefix] = [{uri:uri,count:0}];\n }else if(list[list.length-1].uri!==uri){\n list.push({uri:uri,count:0});\n }\n },\n hasPrefix : function(prefix){\n return this.data[prefix]!==undefined;\n },\n resolve : function(pname,force){\n const prefix = Object.keys(context.data).find(key=>pname.indexOf(key+\":\")===0);\n if(prefix!==undefined) {\n const list = context.data[prefix];\n if(list.length===1 && force!==true && isIRI(list[0].uri)) return pname;\n const uri = list[list.length-1].uri;\n return pname.replace(prefix+\":\",uri);\n }else{\n var base = context.base.length === 0 ? options.baseIRI : context.base[context.base.length-1];\n if(!base || pname.match(/^(http:|https:|urn:|file:)/)) return pname;\n if(pname.indexOf(\"//\")===0 && base) return base.split(\"//\")[0]+pname;\n return new URL(pname,base).toString();\n }\n },\n increment : function(prefix){\n const list = context.data[prefix];\n if(list!==undefined)list[list.length-1].count++;\n },\n decrement : function(prefix){\n const list = context.data[prefix];\n if(list!==undefined)list[list.length-1].count--;\n },\n toJSON : function(){\n const root = {};\n if(context.base.length>0){\n if(root[\"@context\"]===undefined)root[\"@context\"] = {};\n root[\"@context\"][\"@base\"] = context.base[0];\n }\n Object.keys(context.data).forEach(key=>{\n const head = context.data[key][0];\n if(head.uri===\"http://www.w3.org/2001/XMLSchema#\" && head.count < 1) return;\n if(!isIRI(head.uri)) return;\n if(root[\"@context\"]===undefined) root[\"@context\"] = {};\n root[\"@context\"][key] = head.uri;\n });\n return root;\n }\n };\n\n function expandList(container,force){\n if(container[\"@list\"]===undefined) return container;\n if(!force && !container[\"@list\"].find(x=>x[\"@list\"]!==undefined)) return container;\n\n if(container[\"@list\"].length===0)\n return {\"@id\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\"};\n\n var root = {};\n var focus = null;\n container[\"@list\"].forEach(b=>{\n if(focus===null) focus = root;\n else {\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"] = {};\n focus = focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"];\n }\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#first\"] = expandList(b,true);\n focus[\"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest\"] = {\n \"@id\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\"\n };\n });\n return root;\n }\n\n\n peg$result = peg$startRuleFunction();\n\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n } else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n\n throw peg$buildStructuredError(\n peg$maxFailExpected,\n peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,\n peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)\n );\n }\n }\n\n return {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n };\n});\n","/**\n * Provides a way to access commonly used namespaces\n *\n * Usage:\n *\n * ```\n * const $rdf = require('rdflib'); //or any other RDF/JS-compatible library\n * const ns = require('solid-namespace')($rdf);\n * const store = $rdf.graph();\n *\n * let me = ...;\n * let name = store.any(me, ns.vcard(‘fn’)) || store.any(me, ns.foaf(‘name’));\n * ```\n * @module vocab\n */\nconst aliases = {\n acl: 'http://www.w3.org/ns/auth/acl#',\n arg: 'http://www.w3.org/ns/pim/arg#',\n as: 'https://www.w3.org/ns/activitystreams#',\n bookmark: 'http://www.w3.org/2002/01/bookmark#',\n cal: 'http://www.w3.org/2002/12/cal/ical#',\n cco: 'http://www.ontologyrepository.com/CommonCoreOntologies/',\n cert: 'http://www.w3.org/ns/auth/cert#',\n contact: 'http://www.w3.org/2000/10/swap/pim/contact#',\n dc: 'http://purl.org/dc/elements/1.1/',\n dct: 'http://purl.org/dc/terms/',\n doap: 'http://usefulinc.com/ns/doap#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n geo: 'http://www.w3.org/2003/01/geo/wgs84_pos#',\n gpx: 'http://www.w3.org/ns/pim/gpx#',\n gr: 'http://purl.org/goodrelations/v1#',\n http: 'http://www.w3.org/2007/ont/http#',\n httph: 'http://www.w3.org/2007/ont/httph#',\n icalTZ: 'http://www.w3.org/2002/12/cal/icaltzd#', // Beware: not cal:\n ldp: 'http://www.w3.org/ns/ldp#',\n link: 'http://www.w3.org/2007/ont/link#',\n log: 'http://www.w3.org/2000/10/swap/log#',\n meeting: 'http://www.w3.org/ns/pim/meeting#',\n mo: 'http://purl.org/ontology/mo/',\n org: 'http://www.w3.org/ns/org#',\n owl: 'http://www.w3.org/2002/07/owl#',\n pad: 'http://www.w3.org/ns/pim/pad#',\n patch: 'http://www.w3.org/ns/pim/patch#',\n prov: 'http://www.w3.org/ns/prov#',\n pto: 'http://www.productontology.org/id/',\n qu: 'http://www.w3.org/2000/10/swap/pim/qif#',\n trip: 'http://www.w3.org/ns/pim/trip#',\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n rss: 'http://purl.org/rss/1.0/',\n sched: 'http://www.w3.org/ns/pim/schedule#',\n schema: 'http://schema.org/', // @@ beware confusion with documents no 303\n sioc: 'http://rdfs.org/sioc/ns#',\n skos: 'http://www.w3.org/2004/02/skos/core#',\n solid: 'http://www.w3.org/ns/solid/terms#',\n space: 'http://www.w3.org/ns/pim/space#',\n stat: 'http://www.w3.org/ns/posix/stat#',\n tab: 'http://www.w3.org/2007/ont/link#',\n tabont: 'http://www.w3.org/2007/ont/link#',\n ui: 'http://www.w3.org/ns/ui#',\n vann: 'http://purl.org/vocab/vann/',\n vcard: 'http://www.w3.org/2006/vcard/ns#',\n wf: 'http://www.w3.org/2005/01/wf/flow#',\n xsd: 'http://www.w3.org/2001/XMLSchema#',\n}\n\n/**\n * @param [rdflib] {RDF} Optional RDF Library (such as rdflib.js or rdf-ext) to inject\n */\nfunction vocab (rdf = { namedNode: u => u }) {\n const namespaces = {}\n for (const alias in aliases) {\n const expansion = aliases[alias]\n namespaces[alias] = function (localName = '') {\n return rdf.namedNode(expansion + localName)\n }\n };\n\n return namespaces\n};\n\nmodule.exports = vocab\n","!function t(e,r){if(\"object\"==typeof exports&&\"object\"==typeof module)module.exports=r();else if(\"function\"==typeof define&&define.amd)define([],r);else{var n=r();for(var i in n)(\"object\"==typeof exports?exports:e)[i]=n[i]}}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){return t};return r.d(e,\"a\",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p=\"\",r(r.s=22)}([function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i={debug:function t(){},info:function t(){},warn:function t(){},error:function t(){}},o=void 0,s=void 0;(e.Log=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.reset=function t(){s=3,o=i},t.debug=function t(){if(s>=4){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];o.debug.apply(o,Array.from(r))}},t.info=function t(){if(s>=3){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];o.info.apply(o,Array.from(r))}},t.warn=function t(){if(s>=2){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];o.warn.apply(o,Array.from(r))}},t.error=function t(){if(s>=1){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];o.error.apply(o,Array.from(r))}},n(t,null,[{key:\"NONE\",get:function t(){return 0}},{key:\"ERROR\",get:function t(){return 1}},{key:\"WARN\",get:function t(){return 2}},{key:\"INFO\",get:function t(){return 3}},{key:\"DEBUG\",get:function t(){return 4}},{key:\"level\",get:function t(){return s},set:function t(e){if(!(0<=e&&e<=4))throw new Error(\"Invalid log level\");s=e}},{key:\"logger\",get:function t(){return o},set:function t(e){if(!e.debug&&e.info&&(e.debug=e.info),!(e.debug&&e.info&&e.warn&&e.error))throw new Error(\"Invalid logger\");o=e}}]),t}()).reset()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();var i={setInterval:function(t){function e(e,r){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t,e){return setInterval(t,e)})),clearInterval:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return clearInterval(t)}))},o=!1,s=null;e.Global=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t._testing=function t(){o=!0},t.setXMLHttpRequest=function t(e){s=e},n(t,null,[{key:\"location\",get:function t(){if(!o)return location}},{key:\"localStorage\",get:function t(){if(!o&&\"undefined\"!=typeof window)return localStorage}},{key:\"sessionStorage\",get:function t(){if(!o&&\"undefined\"!=typeof window)return sessionStorage}},{key:\"XMLHttpRequest\",get:function t(){if(!o&&\"undefined\"!=typeof window)return s||XMLHttpRequest}},{key:\"timer\",get:function t(){if(!o)return i}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.MetadataService=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0),o=r(7);function s(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}var a=\".well-known/openid-configuration\";e.MetadataService=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(s(this,t),!e)throw i.Log.error(\"MetadataService: No settings passed to MetadataService\"),new Error(\"settings\");this._settings=e,this._jsonService=new r([\"application/jwk-set+json\"])}return t.prototype.resetSigningKeys=function t(){this._settings=this._settings||{},this._settings.signingKeys=void 0},t.prototype.getMetadata=function t(){var e=this;return this._settings.metadata?(i.Log.debug(\"MetadataService.getMetadata: Returning metadata from settings\"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(i.Log.debug(\"MetadataService.getMetadata: getting metadata from\",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(t){i.Log.debug(\"MetadataService.getMetadata: json received\");var r=e._settings.metadataSeed||{};return e._settings.metadata=Object.assign({},r,t),e._settings.metadata}))):(i.Log.error(\"MetadataService.getMetadata: No authority or metadataUrl configured on settings\"),Promise.reject(new Error(\"No authority or metadataUrl configured on settings\")))},t.prototype.getIssuer=function t(){return this._getMetadataProperty(\"issuer\")},t.prototype.getAuthorizationEndpoint=function t(){return this._getMetadataProperty(\"authorization_endpoint\")},t.prototype.getUserInfoEndpoint=function t(){return this._getMetadataProperty(\"userinfo_endpoint\")},t.prototype.getTokenEndpoint=function t(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty(\"token_endpoint\",e)},t.prototype.getCheckSessionIframe=function t(){return this._getMetadataProperty(\"check_session_iframe\",!0)},t.prototype.getEndSessionEndpoint=function t(){return this._getMetadataProperty(\"end_session_endpoint\",!0)},t.prototype.getRevocationEndpoint=function t(){return this._getMetadataProperty(\"revocation_endpoint\",!0)},t.prototype.getKeysEndpoint=function t(){return this._getMetadataProperty(\"jwks_uri\",!0)},t.prototype._getMetadataProperty=function t(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.Log.debug(\"MetadataService.getMetadataProperty for: \"+e),this.getMetadata().then((function(t){if(i.Log.debug(\"MetadataService.getMetadataProperty: metadata recieved\"),void 0===t[e]){if(!0===r)return void i.Log.warn(\"MetadataService.getMetadataProperty: Metadata does not contain optional property \"+e);throw i.Log.error(\"MetadataService.getMetadataProperty: Metadata does not contain property \"+e),new Error(\"Metadata does not contain property \"+e)}return t[e]}))},t.prototype.getSigningKeys=function t(){var e=this;return this._settings.signingKeys?(i.Log.debug(\"MetadataService.getSigningKeys: Returning signingKeys from settings\"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty(\"jwks_uri\").then((function(t){return i.Log.debug(\"MetadataService.getSigningKeys: jwks_uri received\",t),e._jsonService.getJson(t).then((function(t){if(i.Log.debug(\"MetadataService.getSigningKeys: key set received\",t),!t.keys)throw i.Log.error(\"MetadataService.getSigningKeys: Missing keys on keyset\"),new Error(\"Missing keys on keyset\");return e._settings.signingKeys=t.keys,e._settings.signingKeys}))}))},n(t,[{key:\"metadataUrl\",get:function t(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(a)<0&&(\"/\"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+=\"/\"),this._metadataUrl+=a))),this._metadataUrl}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UrlUtility=void 0;var n=r(0),i=r(1);e.UrlUtility=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.addQueryParam=function t(e,r,n){return e.indexOf(\"?\")<0&&(e+=\"?\"),\"?\"!==e[e.length-1]&&(e+=\"&\"),e+=encodeURIComponent(r),e+=\"=\",e+=encodeURIComponent(n)},t.parseUrlFragment=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"#\",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.Global;\"string\"!=typeof e&&(e=o.location.href);var s=e.lastIndexOf(r);s>=0&&(e=e.substr(s+1)),\"?\"===r&&(s=e.indexOf(\"#\"))>=0&&(e=e.substr(0,s));for(var a,u={},c=/([^&=]+)=([^&]*)/g,h=0;a=c.exec(e);)if(u[decodeURIComponent(a[1])]=decodeURIComponent(a[2].replace(/\\+/g,\" \")),h++>50)return n.Log.error(\"UrlUtility.parseUrlFragment: response exceeded expected number of parameters\",e),{error:\"Response exceeded expected number of parameters\"};for(var l in u)return u;return{}},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.JoseUtil=void 0;var n=r(26),i=function o(t){return t&&t.__esModule?t:{default:t}}(r(33));e.JoseUtil=(0,i.default)({jws:n.jws,KeyUtil:n.KeyUtil,X509:n.X509,crypto:n.crypto,hextob64u:n.hextob64u,b64tohex:n.b64tohex,AllowedSigningAlgs:n.AllowedSigningAlgs})},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.OidcClientSettings=void 0;var n=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=r(0),s=r(23),a=r(6),u=r(24),c=r(2);function h(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}var l=\".well-known/openid-configuration\",f=\"id_token\",g=\"openid\",d=\"client_secret_post\";e.OidcClientSettings=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.authority,i=e.metadataUrl,o=e.metadata,l=e.signingKeys,p=e.metadataSeed,v=e.client_id,y=e.client_secret,m=e.response_type,_=void 0===m?f:m,S=e.scope,b=void 0===S?g:S,w=e.redirect_uri,F=e.post_logout_redirect_uri,E=e.client_authentication,x=void 0===E?d:E,A=e.prompt,k=e.display,P=e.max_age,C=e.ui_locales,T=e.acr_values,R=e.resource,I=e.response_mode,D=e.filterProtocolClaims,L=void 0===D||D,N=e.loadUserInfo,U=void 0===N||N,B=e.staleStateAge,O=void 0===B?900:B,j=e.clockSkew,M=void 0===j?300:j,H=e.clockService,V=void 0===H?new s.ClockService:H,K=e.userInfoJwtIssuer,q=void 0===K?\"OP\":K,J=e.mergeClaims,W=void 0!==J&&J,z=e.stateStore,Y=void 0===z?new a.WebStorageStateStore:z,G=e.ResponseValidatorCtor,X=void 0===G?u.ResponseValidator:G,$=e.MetadataServiceCtor,Q=void 0===$?c.MetadataService:$,Z=e.extraQueryParams,tt=void 0===Z?{}:Z,et=e.extraTokenParams,rt=void 0===et?{}:et;h(this,t),this._authority=r,this._metadataUrl=i,this._metadata=o,this._metadataSeed=p,this._signingKeys=l,this._client_id=v,this._client_secret=y,this._response_type=_,this._scope=b,this._redirect_uri=w,this._post_logout_redirect_uri=F,this._client_authentication=x,this._prompt=A,this._display=k,this._max_age=P,this._ui_locales=C,this._acr_values=T,this._resource=R,this._response_mode=I,this._filterProtocolClaims=!!L,this._loadUserInfo=!!U,this._staleStateAge=O,this._clockSkew=M,this._clockService=V,this._userInfoJwtIssuer=q,this._mergeClaims=!!W,this._stateStore=Y,this._validator=new X(this),this._metadataService=new Q(this),this._extraQueryParams=\"object\"===(void 0===tt?\"undefined\":n(tt))?tt:{},this._extraTokenParams=\"object\"===(void 0===rt?\"undefined\":n(rt))?rt:{}}return t.prototype.getEpochTime=function t(){return this._clockService.getEpochTime()},i(t,[{key:\"client_id\",get:function t(){return this._client_id},set:function t(e){if(this._client_id)throw o.Log.error(\"OidcClientSettings.set_client_id: client_id has already been assigned.\"),new Error(\"client_id has already been assigned.\");this._client_id=e}},{key:\"client_secret\",get:function t(){return this._client_secret}},{key:\"response_type\",get:function t(){return this._response_type}},{key:\"scope\",get:function t(){return this._scope}},{key:\"redirect_uri\",get:function t(){return this._redirect_uri}},{key:\"post_logout_redirect_uri\",get:function t(){return this._post_logout_redirect_uri}},{key:\"client_authentication\",get:function t(){return this._client_authentication}},{key:\"prompt\",get:function t(){return this._prompt}},{key:\"display\",get:function t(){return this._display}},{key:\"max_age\",get:function t(){return this._max_age}},{key:\"ui_locales\",get:function t(){return this._ui_locales}},{key:\"acr_values\",get:function t(){return this._acr_values}},{key:\"resource\",get:function t(){return this._resource}},{key:\"response_mode\",get:function t(){return this._response_mode}},{key:\"authority\",get:function t(){return this._authority},set:function t(e){if(this._authority)throw o.Log.error(\"OidcClientSettings.set_authority: authority has already been assigned.\"),new Error(\"authority has already been assigned.\");this._authority=e}},{key:\"metadataUrl\",get:function t(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(l)<0&&(\"/\"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+=\"/\"),this._metadataUrl+=l)),this._metadataUrl}},{key:\"metadata\",get:function t(){return this._metadata},set:function t(e){this._metadata=e}},{key:\"metadataSeed\",get:function t(){return this._metadataSeed},set:function t(e){this._metadataSeed=e}},{key:\"signingKeys\",get:function t(){return this._signingKeys},set:function t(e){this._signingKeys=e}},{key:\"filterProtocolClaims\",get:function t(){return this._filterProtocolClaims}},{key:\"loadUserInfo\",get:function t(){return this._loadUserInfo}},{key:\"staleStateAge\",get:function t(){return this._staleStateAge}},{key:\"clockSkew\",get:function t(){return this._clockSkew}},{key:\"userInfoJwtIssuer\",get:function t(){return this._userInfoJwtIssuer}},{key:\"mergeClaims\",get:function t(){return this._mergeClaims}},{key:\"stateStore\",get:function t(){return this._stateStore}},{key:\"validator\",get:function t(){return this._validator}},{key:\"metadataService\",get:function t(){return this._metadataService}},{key:\"extraQueryParams\",get:function t(){return this._extraQueryParams},set:function t(e){\"object\"===(void 0===e?\"undefined\":n(e))?this._extraQueryParams=e:this._extraQueryParams={}}},{key:\"extraTokenParams\",get:function t(){return this._extraTokenParams},set:function t(e){\"object\"===(void 0===e?\"undefined\":n(e))?this._extraTokenParams=e:this._extraTokenParams={}}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.WebStorageStateStore=void 0;var n=r(0),i=r(1);function o(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.WebStorageStateStore=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.prefix,n=void 0===r?\"oidc.\":r,s=e.store,a=void 0===s?i.Global.localStorage:s;o(this,t),this._store=a,this._prefix=n}return t.prototype.set=function t(e,r){return n.Log.debug(\"WebStorageStateStore.set\",e),e=this._prefix+e,this._store.setItem(e,r),Promise.resolve()},t.prototype.get=function t(e){n.Log.debug(\"WebStorageStateStore.get\",e),e=this._prefix+e;var r=this._store.getItem(e);return Promise.resolve(r)},t.prototype.remove=function t(e){n.Log.debug(\"WebStorageStateStore.remove\",e),e=this._prefix+e;var r=this._store.getItem(e);return this._store.removeItem(e),Promise.resolve(r)},t.prototype.getAllKeys=function t(){n.Log.debug(\"WebStorageStateStore.getAllKeys\");for(var e=[],r=0;r<this._store.length;r++){var i=this._store.key(r);0===i.indexOf(this._prefix)&&e.push(i.substr(this._prefix.length))}return Promise.resolve(e)},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.JsonService=void 0;var n=r(0),i=r(1);function o(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.JsonService=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.Global.XMLHttpRequest,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(this,t),e&&Array.isArray(e)?this._contentTypes=e.slice():this._contentTypes=[],this._contentTypes.push(\"application/json\"),n&&this._contentTypes.push(\"application/jwt\"),this._XMLHttpRequest=r,this._jwtHandler=n}return t.prototype.getJson=function t(e,r){var i=this;if(!e)throw n.Log.error(\"JsonService.getJson: No url passed\"),new Error(\"url\");return n.Log.debug(\"JsonService.getJson, url: \",e),new Promise((function(t,o){var s=new i._XMLHttpRequest;s.open(\"GET\",e);var a=i._contentTypes,u=i._jwtHandler;s.onload=function(){if(n.Log.debug(\"JsonService.getJson: HTTP response received, status\",s.status),200===s.status){var r=s.getResponseHeader(\"Content-Type\");if(r){var i=a.find((function(t){if(r.startsWith(t))return!0}));if(\"application/jwt\"==i)return void u(s).then(t,o);if(i)try{return void t(JSON.parse(s.responseText))}catch(t){return n.Log.error(\"JsonService.getJson: Error parsing JSON response\",t.message),void o(t)}}o(Error(\"Invalid response Content-Type: \"+r+\", from URL: \"+e))}else o(Error(s.statusText+\" (\"+s.status+\")\"))},s.onerror=function(){n.Log.error(\"JsonService.getJson: network error\"),o(Error(\"Network Error\"))},r&&(n.Log.debug(\"JsonService.getJson: token passed, setting Authorization header\"),s.setRequestHeader(\"Authorization\",\"Bearer \"+r)),s.send()}))},t.prototype.postForm=function t(e,r,i){var o=this;if(!e)throw n.Log.error(\"JsonService.postForm: No url passed\"),new Error(\"url\");return n.Log.debug(\"JsonService.postForm, url: \",e),new Promise((function(t,s){var a=new o._XMLHttpRequest;a.open(\"POST\",e);var u=o._contentTypes;a.onload=function(){if(n.Log.debug(\"JsonService.postForm: HTTP response received, status\",a.status),200!==a.status){if(400===a.status)if(i=a.getResponseHeader(\"Content-Type\"))if(u.find((function(t){if(i.startsWith(t))return!0})))try{var r=JSON.parse(a.responseText);if(r&&r.error)return n.Log.error(\"JsonService.postForm: Error from server: \",r.error),void s(new Error(r.error))}catch(t){return n.Log.error(\"JsonService.postForm: Error parsing JSON response\",t.message),void s(t)}s(Error(a.statusText+\" (\"+a.status+\")\"))}else{var i;if((i=a.getResponseHeader(\"Content-Type\"))&&u.find((function(t){if(i.startsWith(t))return!0})))try{return void t(JSON.parse(a.responseText))}catch(t){return n.Log.error(\"JsonService.postForm: Error parsing JSON response\",t.message),void s(t)}s(Error(\"Invalid response Content-Type: \"+i+\", from URL: \"+e))}},a.onerror=function(){n.Log.error(\"JsonService.postForm: network error\"),s(Error(\"Network Error\"))};var c=\"\";for(var h in r){var l=r[h];l&&(c.length>0&&(c+=\"&\"),c+=encodeURIComponent(h),c+=\"=\",c+=encodeURIComponent(l))}a.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),void 0!==i&&a.setRequestHeader(\"Authorization\",\"Basic \"+btoa(i)),a.send(c)}))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SigninRequest=void 0;var n=r(0),i=r(3),o=r(13);e.SigninRequest=function(){function t(e){var r=e.url,s=e.client_id,a=e.redirect_uri,u=e.response_type,c=e.scope,h=e.authority,l=e.data,f=e.prompt,g=e.display,d=e.max_age,p=e.ui_locales,v=e.id_token_hint,y=e.login_hint,m=e.acr_values,_=e.resource,S=e.response_mode,b=e.request,w=e.request_uri,F=e.extraQueryParams,E=e.request_type,x=e.client_secret,A=e.extraTokenParams,k=e.skipUserInfo;if(function P(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),!r)throw n.Log.error(\"SigninRequest.ctor: No url passed\"),new Error(\"url\");if(!s)throw n.Log.error(\"SigninRequest.ctor: No client_id passed\"),new Error(\"client_id\");if(!a)throw n.Log.error(\"SigninRequest.ctor: No redirect_uri passed\"),new Error(\"redirect_uri\");if(!u)throw n.Log.error(\"SigninRequest.ctor: No response_type passed\"),new Error(\"response_type\");if(!c)throw n.Log.error(\"SigninRequest.ctor: No scope passed\"),new Error(\"scope\");if(!h)throw n.Log.error(\"SigninRequest.ctor: No authority passed\"),new Error(\"authority\");var C=t.isOidc(u),T=t.isCode(u);S||(S=t.isCode(u)?\"query\":null),this.state=new o.SigninState({nonce:C,data:l,client_id:s,authority:h,redirect_uri:a,code_verifier:T,request_type:E,response_mode:S,client_secret:x,scope:c,extraTokenParams:A,skipUserInfo:k}),r=i.UrlUtility.addQueryParam(r,\"client_id\",s),r=i.UrlUtility.addQueryParam(r,\"redirect_uri\",a),r=i.UrlUtility.addQueryParam(r,\"response_type\",u),r=i.UrlUtility.addQueryParam(r,\"scope\",c),r=i.UrlUtility.addQueryParam(r,\"state\",this.state.id),C&&(r=i.UrlUtility.addQueryParam(r,\"nonce\",this.state.nonce)),T&&(r=i.UrlUtility.addQueryParam(r,\"code_challenge\",this.state.code_challenge),r=i.UrlUtility.addQueryParam(r,\"code_challenge_method\",\"S256\"));var R={prompt:f,display:g,max_age:d,ui_locales:p,id_token_hint:v,login_hint:y,acr_values:m,resource:_,request:b,request_uri:w,response_mode:S};for(var I in R)R[I]&&(r=i.UrlUtility.addQueryParam(r,I,R[I]));for(var D in F)r=i.UrlUtility.addQueryParam(r,D,F[D]);this.url=r}return t.isOidc=function t(e){return!!e.split(/\\s+/g).filter((function(t){return\"id_token\"===t}))[0]},t.isOAuth=function t(e){return!!e.split(/\\s+/g).filter((function(t){return\"token\"===t}))[0]},t.isCode=function t(e){return!!e.split(/\\s+/g).filter((function(t){return\"code\"===t}))[0]},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.State=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0),o=function s(t){return t&&t.__esModule?t:{default:t}}(r(14));function a(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.State=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.id,n=e.data,i=e.created,s=e.request_type;a(this,t),this._id=r||(0,o.default)(),this._data=n,this._created=\"number\"==typeof i&&i>0?i:parseInt(Date.now()/1e3),this._request_type=s}return t.prototype.toStorageString=function t(){return i.Log.debug(\"State.toStorageString\"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},t.fromStorageString=function e(r){return i.Log.debug(\"State.fromStorageString\"),new t(JSON.parse(r))},t.clearStaleState=function e(r,n){var o=Date.now()/1e3-n;return r.getAllKeys().then((function(e){i.Log.debug(\"State.clearStaleState: got keys\",e);for(var n=[],s=function s(a){var c=e[a];u=r.get(c).then((function(e){var n=!1;if(e)try{var s=t.fromStorageString(e);i.Log.debug(\"State.clearStaleState: got item from key: \",c,s.created),s.created<=o&&(n=!0)}catch(t){i.Log.error(\"State.clearStaleState: Error parsing state for key\",c,t.message),n=!0}else i.Log.debug(\"State.clearStaleState: no item in storage for key: \",c),n=!0;if(n)return i.Log.debug(\"State.clearStaleState: removed item for key: \",c),r.remove(c)})),n.push(u)},a=0;a<e.length;a++){var u;s(a)}return i.Log.debug(\"State.clearStaleState: waiting on promise count:\",n.length),Promise.all(n)}))},n(t,[{key:\"id\",get:function t(){return this._id}},{key:\"data\",get:function t(){return this._data}},{key:\"created\",get:function t(){return this._created}},{key:\"request_type\",get:function t(){return this._request_type}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.OidcClient=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0),o=r(5),s=r(12),a=r(8),u=r(34),c=r(35),h=r(36),l=r(13),f=r(9);function g(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.OidcClient=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,t),e instanceof o.OidcClientSettings?this._settings=e:this._settings=new o.OidcClientSettings(e)}return t.prototype.createSigninRequest=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.response_type,o=r.scope,s=r.redirect_uri,u=r.data,c=r.state,h=r.prompt,l=r.display,f=r.max_age,g=r.ui_locales,d=r.id_token_hint,p=r.login_hint,v=r.acr_values,y=r.resource,m=r.request,_=r.request_uri,S=r.response_mode,b=r.extraQueryParams,w=r.extraTokenParams,F=r.request_type,E=r.skipUserInfo,x=arguments[1];i.Log.debug(\"OidcClient.createSigninRequest\");var A=this._settings.client_id;n=n||this._settings.response_type,o=o||this._settings.scope,s=s||this._settings.redirect_uri,h=h||this._settings.prompt,l=l||this._settings.display,f=f||this._settings.max_age,g=g||this._settings.ui_locales,v=v||this._settings.acr_values,y=y||this._settings.resource,S=S||this._settings.response_mode,b=b||this._settings.extraQueryParams,w=w||this._settings.extraTokenParams;var k=this._settings.authority;return a.SigninRequest.isCode(n)&&\"code\"!==n?Promise.reject(new Error(\"OpenID Connect hybrid flow is not supported\")):this._metadataService.getAuthorizationEndpoint().then((function(t){i.Log.debug(\"OidcClient.createSigninRequest: Received authorization endpoint\",t);var r=new a.SigninRequest({url:t,client_id:A,redirect_uri:s,response_type:n,scope:o,data:u||c,authority:k,prompt:h,display:l,max_age:f,ui_locales:g,id_token_hint:d,login_hint:p,acr_values:v,resource:y,request:m,request_uri:_,extraQueryParams:b,extraTokenParams:w,request_type:F,response_mode:S,client_secret:e._settings.client_secret,skipUserInfo:E}),P=r.state;return(x=x||e._stateStore).set(P.id,P.toStorageString()).then((function(){return r}))}))},t.prototype.readSigninResponseState=function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug(\"OidcClient.readSigninResponseState\");var o=\"query\"===this._settings.response_mode||!this._settings.response_mode&&a.SigninRequest.isCode(this._settings.response_type),s=o?\"?\":\"#\",c=new u.SigninResponse(e,s);if(!c.state)return i.Log.error(\"OidcClient.readSigninResponseState: No state in response\"),Promise.reject(new Error(\"No state in response\"));r=r||this._stateStore;var h=n?r.remove.bind(r):r.get.bind(r);return h(c.state).then((function(t){if(!t)throw i.Log.error(\"OidcClient.readSigninResponseState: No matching state found in storage\"),new Error(\"No matching state found in storage\");return{state:l.SigninState.fromStorageString(t),response:c}}))},t.prototype.processSigninResponse=function t(e,r){var n=this;return i.Log.debug(\"OidcClient.processSigninResponse\"),this.readSigninResponseState(e,r,!0).then((function(t){var e=t.state,r=t.response;return i.Log.debug(\"OidcClient.processSigninResponse: Received state from storage; validating response\"),n._validator.validateSigninResponse(e,r)}))},t.prototype.createSignoutRequest=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.id_token_hint,o=r.data,s=r.state,a=r.post_logout_redirect_uri,u=r.extraQueryParams,h=r.request_type,l=arguments[1];return i.Log.debug(\"OidcClient.createSignoutRequest\"),a=a||this._settings.post_logout_redirect_uri,u=u||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(t){if(!t)throw i.Log.error(\"OidcClient.createSignoutRequest: No end session endpoint url returned\"),new Error(\"no end session endpoint\");i.Log.debug(\"OidcClient.createSignoutRequest: Received end session endpoint\",t);var r=new c.SignoutRequest({url:t,id_token_hint:n,post_logout_redirect_uri:a,data:o||s,extraQueryParams:u,request_type:h}),f=r.state;return f&&(i.Log.debug(\"OidcClient.createSignoutRequest: Signout request has state to persist\"),(l=l||e._stateStore).set(f.id,f.toStorageString())),r}))},t.prototype.readSignoutResponseState=function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug(\"OidcClient.readSignoutResponseState\");var o=new h.SignoutResponse(e);if(!o.state)return i.Log.debug(\"OidcClient.readSignoutResponseState: No state in response\"),o.error?(i.Log.warn(\"OidcClient.readSignoutResponseState: Response was error: \",o.error),Promise.reject(new s.ErrorResponse(o))):Promise.resolve({state:void 0,response:o});var a=o.state;r=r||this._stateStore;var u=n?r.remove.bind(r):r.get.bind(r);return u(a).then((function(t){if(!t)throw i.Log.error(\"OidcClient.readSignoutResponseState: No matching state found in storage\"),new Error(\"No matching state found in storage\");return{state:f.State.fromStorageString(t),response:o}}))},t.prototype.processSignoutResponse=function t(e,r){var n=this;return i.Log.debug(\"OidcClient.processSignoutResponse\"),this.readSignoutResponseState(e,r,!0).then((function(t){var e=t.state,r=t.response;return e?(i.Log.debug(\"OidcClient.processSignoutResponse: Received state from storage; validating response\"),n._validator.validateSignoutResponse(e,r)):(i.Log.debug(\"OidcClient.processSignoutResponse: No state from storage; skipping validating response\"),r)}))},t.prototype.clearStaleState=function t(e){return i.Log.debug(\"OidcClient.clearStaleState\"),e=e||this._stateStore,f.State.clearStaleState(e,this.settings.staleStateAge)},n(t,[{key:\"_stateStore\",get:function t(){return this.settings.stateStore}},{key:\"_validator\",get:function t(){return this.settings.validator}},{key:\"_metadataService\",get:function t(){return this.settings.metadataService}},{key:\"settings\",get:function t(){return this._settings}},{key:\"metadataService\",get:function t(){return this._metadataService}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.TokenClient=void 0;var n=r(7),i=r(2),o=r(0);function s(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.TokenClient=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JsonService,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(s(this,t),!e)throw o.Log.error(\"TokenClient.ctor: No settings passed\"),new Error(\"settings\");this._settings=e,this._jsonService=new r,this._metadataService=new a(this._settings)}return t.prototype.exchangeCode=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).grant_type=r.grant_type||\"authorization_code\",r.client_id=r.client_id||this._settings.client_id,r.client_secret=r.client_secret||this._settings.client_secret,r.redirect_uri=r.redirect_uri||this._settings.redirect_uri;var n=void 0,i=r._client_authentication||this._settings._client_authentication;return delete r._client_authentication,r.code?r.redirect_uri?r.code_verifier?r.client_id?r.client_secret||\"client_secret_basic\"!=i?(\"client_secret_basic\"==i&&(n=r.client_id+\":\"+r.client_secret,delete r.client_id,delete r.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(t){return o.Log.debug(\"TokenClient.exchangeCode: Received token endpoint\"),e._jsonService.postForm(t,r,n).then((function(t){return o.Log.debug(\"TokenClient.exchangeCode: response received\"),t}))}))):(o.Log.error(\"TokenClient.exchangeCode: No client_secret passed\"),Promise.reject(new Error(\"A client_secret is required\"))):(o.Log.error(\"TokenClient.exchangeCode: No client_id passed\"),Promise.reject(new Error(\"A client_id is required\"))):(o.Log.error(\"TokenClient.exchangeCode: No code_verifier passed\"),Promise.reject(new Error(\"A code_verifier is required\"))):(o.Log.error(\"TokenClient.exchangeCode: No redirect_uri passed\"),Promise.reject(new Error(\"A redirect_uri is required\"))):(o.Log.error(\"TokenClient.exchangeCode: No code passed\"),Promise.reject(new Error(\"A code is required\")))},t.prototype.exchangeRefreshToken=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).grant_type=r.grant_type||\"refresh_token\",r.client_id=r.client_id||this._settings.client_id,r.client_secret=r.client_secret||this._settings.client_secret;var n=void 0,i=r._client_authentication||this._settings._client_authentication;return delete r._client_authentication,r.refresh_token?r.client_id?(\"client_secret_basic\"==i&&(n=r.client_id+\":\"+r.client_secret,delete r.client_id,delete r.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(t){return o.Log.debug(\"TokenClient.exchangeRefreshToken: Received token endpoint\"),e._jsonService.postForm(t,r,n).then((function(t){return o.Log.debug(\"TokenClient.exchangeRefreshToken: response received\"),t}))}))):(o.Log.error(\"TokenClient.exchangeRefreshToken: No client_id passed\"),Promise.reject(new Error(\"A client_id is required\"))):(o.Log.error(\"TokenClient.exchangeRefreshToken: No refresh_token passed\"),Promise.reject(new Error(\"A refresh_token is required\")))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.ErrorResponse=void 0;var n=r(0);function i(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function o(t,e){if(!t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!e||\"object\"!=typeof e&&\"function\"!=typeof e?t:e}e.ErrorResponse=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=r.error,a=r.error_description,u=r.error_uri,c=r.state,h=r.session_state;if(i(this,e),!s)throw n.Log.error(\"No error passed to ErrorResponse\"),new Error(\"error\");var l=o(this,t.call(this,a||s));return l.name=\"ErrorResponse\",l.error=s,l.error_description=a,l.error_uri=u,l.state=c,l.session_state=h,l}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(Error)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SigninState=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0),o=r(9),s=r(4),a=function u(t){return t&&t.__esModule?t:{default:t}}(r(14));function c(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function h(t,e){if(!t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!e||\"object\"!=typeof e&&\"function\"!=typeof e?t:e}e.SigninState=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.nonce,i=r.authority,o=r.client_id,u=r.redirect_uri,l=r.code_verifier,f=r.response_mode,g=r.client_secret,d=r.scope,p=r.extraTokenParams,v=r.skipUserInfo;c(this,e);var y=h(this,t.call(this,arguments[0]));if(!0===n?y._nonce=(0,a.default)():n&&(y._nonce=n),!0===l?y._code_verifier=(0,a.default)()+(0,a.default)()+(0,a.default)():l&&(y._code_verifier=l),y.code_verifier){var m=s.JoseUtil.hashString(y.code_verifier,\"SHA256\");y._code_challenge=s.JoseUtil.hexToBase64Url(m)}return y._redirect_uri=u,y._authority=i,y._client_id=o,y._response_mode=f,y._client_secret=g,y._scope=d,y._extraTokenParams=p,y._skipUserInfo=v,y}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.toStorageString=function t(){return i.Log.debug(\"SigninState.toStorageString\"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},e.fromStorageString=function t(r){return i.Log.debug(\"SigninState.fromStorageString\"),new e(JSON.parse(r))},n(e,[{key:\"nonce\",get:function t(){return this._nonce}},{key:\"authority\",get:function t(){return this._authority}},{key:\"client_id\",get:function t(){return this._client_id}},{key:\"redirect_uri\",get:function t(){return this._redirect_uri}},{key:\"code_verifier\",get:function t(){return this._code_verifier}},{key:\"code_challenge\",get:function t(){return this._code_challenge}},{key:\"response_mode\",get:function t(){return this._response_mode}},{key:\"client_secret\",get:function t(){return this._client_secret}},{key:\"scope\",get:function t(){return this._scope}},{key:\"extraTokenParams\",get:function t(){return this._extraTokenParams}},{key:\"skipUserInfo\",get:function t(){return this._skipUserInfo}}]),e}(o.State)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.default=function n(){return(\"undefined\"!=i&&null!==i&&void 0!==i.getRandomValues?o:s)().replace(/-/g,\"\")};var i=\"undefined\"!=typeof window?window.crypto||window.msCrypto:null;function o(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^i.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}function s(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^16*Math.random()>>t/4).toString(16)}))}t.exports=e.default},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.User=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0);e.User=function(){function t(e){var r=e.id_token,n=e.session_state,i=e.access_token,o=e.refresh_token,s=e.token_type,a=e.scope,u=e.profile,c=e.expires_at,h=e.state;!function l(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this.id_token=r,this.session_state=n,this.access_token=i,this.refresh_token=o,this.token_type=s,this.scope=a,this.profile=u,this.expires_at=c,this.state=h}return t.prototype.toStorageString=function t(){return i.Log.debug(\"User.toStorageString\"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})},t.fromStorageString=function e(r){return i.Log.debug(\"User.fromStorageString\"),new t(JSON.parse(r))},n(t,[{key:\"expires_in\",get:function t(){if(this.expires_at){var e=parseInt(Date.now()/1e3);return this.expires_at-e}},set:function t(e){var r=parseInt(e);if(\"number\"==typeof r&&r>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+r}}},{key:\"expired\",get:function t(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:\"scopes\",get:function t(){return(this.scope||\"\").split(\" \")}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.AccessTokenEvents=void 0;var n=r(0),i=r(46);function o(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.AccessTokenEvents=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.accessTokenExpiringNotificationTime,n=void 0===r?60:r,s=e.accessTokenExpiringTimer,a=void 0===s?new i.Timer(\"Access token expiring\"):s,u=e.accessTokenExpiredTimer,c=void 0===u?new i.Timer(\"Access token expired\"):u;o(this,t),this._accessTokenExpiringNotificationTime=n,this._accessTokenExpiring=a,this._accessTokenExpired=c}return t.prototype.load=function t(e){if(e.access_token&&void 0!==e.expires_in){var r=e.expires_in;if(n.Log.debug(\"AccessTokenEvents.load: access token present, remaining duration:\",r),r>0){var i=r-this._accessTokenExpiringNotificationTime;i<=0&&(i=1),n.Log.debug(\"AccessTokenEvents.load: registering expiring timer in:\",i),this._accessTokenExpiring.init(i)}else n.Log.debug(\"AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration.\"),this._accessTokenExpiring.cancel();var o=r+1;n.Log.debug(\"AccessTokenEvents.load: registering expired timer in:\",o),this._accessTokenExpired.init(o)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.unload=function t(){n.Log.debug(\"AccessTokenEvents.unload: canceling existing access token timers\"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function t(e){this._accessTokenExpiring.addHandler(e)},t.prototype.removeAccessTokenExpiring=function t(e){this._accessTokenExpiring.removeHandler(e)},t.prototype.addAccessTokenExpired=function t(e){this._accessTokenExpired.addHandler(e)},t.prototype.removeAccessTokenExpired=function t(e){this._accessTokenExpired.removeHandler(e)},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.Event=void 0;var n=r(0);e.Event=function(){function t(e){!function r(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this._name=e,this._callbacks=[]}return t.prototype.addHandler=function t(e){this._callbacks.push(e)},t.prototype.removeHandler=function t(e){var r=this._callbacks.findIndex((function(t){return t===e}));r>=0&&this._callbacks.splice(r,1)},t.prototype.raise=function t(){n.Log.debug(\"Event: Raising event: \"+this._name);for(var e=0;e<this._callbacks.length;e++){var r;(r=this._callbacks)[e].apply(r,arguments)}},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SessionMonitor=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0),o=r(19),s=r(1);function a(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.SessionMonitor=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Global.timer;if(a(this,t),!e)throw i.Log.error(\"SessionMonitor.ctor: No user manager passed to SessionMonitor\"),new Error(\"userManager\");this._userManager=e,this._CheckSessionIFrameCtor=n,this._timer=u,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(t){t?r._start(t):r._settings.monitorAnonymousSession&&r._userManager.querySessionStatus().then((function(t){var e={session_state:t.session_state};t.sub&&t.sid&&(e.profile={sub:t.sub,sid:t.sid}),r._start(e)})).catch((function(t){i.Log.error(\"SessionMonitor ctor: error from querySessionStatus:\",t.message)}))})).catch((function(t){i.Log.error(\"SessionMonitor ctor: error from getUser:\",t.message)})))}return t.prototype._start=function t(e){var r=this,n=e.session_state;n&&(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,i.Log.debug(\"SessionMonitor._start: session_state:\",n,\", sub:\",this._sub)):(this._sub=void 0,this._sid=void 0,i.Log.debug(\"SessionMonitor._start: session_state:\",n,\", anonymous user\")),this._checkSessionIFrame?this._checkSessionIFrame.start(n):this._metadataService.getCheckSessionIframe().then((function(t){if(t){i.Log.debug(\"SessionMonitor._start: Initializing check session iframe\");var e=r._client_id,o=r._checkSessionInterval,s=r._stopCheckSessionOnError;r._checkSessionIFrame=new r._CheckSessionIFrameCtor(r._callback.bind(r),e,t,o,s),r._checkSessionIFrame.load().then((function(){r._checkSessionIFrame.start(n)}))}else i.Log.warn(\"SessionMonitor._start: No check session iframe found in the metadata\")})).catch((function(t){i.Log.error(\"SessionMonitor._start: Error from getCheckSessionIframe:\",t.message)})))},t.prototype._stop=function t(){var e=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(i.Log.debug(\"SessionMonitor._stop\"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var r=this._timer.setInterval((function(){e._timer.clearInterval(r),e._userManager.querySessionStatus().then((function(t){var r={session_state:t.session_state};t.sub&&t.sid&&(r.profile={sub:t.sub,sid:t.sid}),e._start(r)})).catch((function(t){i.Log.error(\"SessionMonitor: error from querySessionStatus:\",t.message)}))}),1e3)},t.prototype._callback=function t(){var e=this;this._userManager.querySessionStatus().then((function(t){var r=!0;t?t.sub===e._sub?(r=!1,e._checkSessionIFrame.start(t.session_state),t.sid===e._sid?i.Log.debug(\"SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:\",t.session_state):(i.Log.debug(\"SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:\",t.session_state),e._userManager.events._raiseUserSessionChanged())):i.Log.debug(\"SessionMonitor._callback: Different subject signed into OP:\",t.sub):i.Log.debug(\"SessionMonitor._callback: Subject no longer signed into OP\"),r&&(e._sub?(i.Log.debug(\"SessionMonitor._callback: SessionMonitor._callback; raising signed out event\"),e._userManager.events._raiseUserSignedOut()):(i.Log.debug(\"SessionMonitor._callback: SessionMonitor._callback; raising signed in event\"),e._userManager.events._raiseUserSignedIn()))})).catch((function(t){e._sub&&(i.Log.debug(\"SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event\",t.message),e._userManager.events._raiseUserSignedOut())}))},n(t,[{key:\"_settings\",get:function t(){return this._userManager.settings}},{key:\"_metadataService\",get:function t(){return this._userManager.metadataService}},{key:\"_client_id\",get:function t(){return this._settings.client_id}},{key:\"_checkSessionInterval\",get:function t(){return this._settings.checkSessionInterval}},{key:\"_stopCheckSessionOnError\",get:function t(){return this._settings.stopCheckSessionOnError}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.CheckSessionIFrame=void 0;var n=r(0);function i(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.CheckSessionIFrame=function(){function t(e,r,n,o){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];i(this,t),this._callback=e,this._client_id=r,this._url=n,this._interval=o||2e3,this._stopOnError=s;var a=n.indexOf(\"/\",n.indexOf(\"//\")+2);this._frame_origin=n.substr(0,a),this._frame=window.document.createElement(\"iframe\"),this._frame.style.visibility=\"hidden\",this._frame.style.position=\"absolute\",this._frame.style.display=\"none\",this._frame.width=0,this._frame.height=0,this._frame.src=n}return t.prototype.load=function t(){var e=this;return new Promise((function(t){e._frame.onload=function(){t()},window.document.body.appendChild(e._frame),e._boundMessageEvent=e._message.bind(e),window.addEventListener(\"message\",e._boundMessageEvent,!1)}))},t.prototype._message=function t(e){e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&(\"error\"===e.data?(n.Log.error(\"CheckSessionIFrame: error message from check session op iframe\"),this._stopOnError&&this.stop()):\"changed\"===e.data?(n.Log.debug(\"CheckSessionIFrame: changed message from check session op iframe\"),this.stop(),this._callback()):n.Log.debug(\"CheckSessionIFrame: \"+e.data+\" message from check session op iframe\"))},t.prototype.start=function t(e){var r=this;if(this._session_state!==e){n.Log.debug(\"CheckSessionIFrame.start\"),this.stop(),this._session_state=e;var i=function t(){r._frame.contentWindow.postMessage(r._client_id+\" \"+r._session_state,r._frame_origin)};i(),this._timer=window.setInterval(i,this._interval)}},t.prototype.stop=function t(){this._session_state=null,this._timer&&(n.Log.debug(\"CheckSessionIFrame.stop\"),window.clearInterval(this._timer),this._timer=null)},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.TokenRevocationClient=void 0;var n=r(0),i=r(2),o=r(1);function s(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}var a=\"access_token\",u=\"refresh_token\";e.TokenRevocationClient=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(s(this,t),!e)throw n.Log.error(\"TokenRevocationClient.ctor: No settings provided\"),new Error(\"No settings provided.\");this._settings=e,this._XMLHttpRequestCtor=r,this._metadataService=new a(this._settings)}return t.prototype.revoke=function t(e,r){var i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:\"access_token\";if(!e)throw n.Log.error(\"TokenRevocationClient.revoke: No token provided\"),new Error(\"No token provided.\");if(o!==a&&o!=u)throw n.Log.error(\"TokenRevocationClient.revoke: Invalid token type\"),new Error(\"Invalid token type.\");return this._metadataService.getRevocationEndpoint().then((function(t){if(t){n.Log.debug(\"TokenRevocationClient.revoke: Revoking \"+o);var s=i._settings.client_id,a=i._settings.client_secret;return i._revoke(t,s,a,e,o)}if(r)throw n.Log.error(\"TokenRevocationClient.revoke: Revocation not supported\"),new Error(\"Revocation not supported\")}))},t.prototype._revoke=function t(e,r,i,o,s){var a=this;return new Promise((function(t,u){var c=new a._XMLHttpRequestCtor;c.open(\"POST\",e),c.onload=function(){n.Log.debug(\"TokenRevocationClient.revoke: HTTP response received, status\",c.status),200===c.status?t():u(Error(c.statusText+\" (\"+c.status+\")\"))},c.onerror=function(){n.Log.debug(\"TokenRevocationClient.revoke: Network Error.\"),u(\"Network Error\")};var h=\"client_id=\"+encodeURIComponent(r);i&&(h+=\"&client_secret=\"+encodeURIComponent(i)),h+=\"&token_type_hint=\"+encodeURIComponent(s),h+=\"&token=\"+encodeURIComponent(o),c.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),c.send(h)}))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.CordovaPopupWindow=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0);e.CordovaPopupWindow=function(){function t(e){var r=this;!function n(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this._promise=new Promise((function(t,e){r._resolve=t,r._reject=e})),this.features=e.popupWindowFeatures||\"location=no,toolbar=no,zoom=no\",this.target=e.popupWindowTarget||\"_blank\",this.redirect_uri=e.startUrl,i.Log.debug(\"CordovaPopupWindow.ctor: redirect_uri: \"+this.redirect_uri)}return t.prototype._isInAppBrowserInstalled=function t(e){return[\"cordova-plugin-inappbrowser\",\"cordova-plugin-inappbrowser.inappbrowser\",\"org.apache.cordova.inappbrowser\"].some((function(t){return e.hasOwnProperty(t)}))},t.prototype.navigate=function t(e){if(e&&e.url){if(!window.cordova)return this._error(\"cordova is undefined\");var r=window.cordova.require(\"cordova/plugin_list\").metadata;if(!1===this._isInAppBrowserInstalled(r))return this._error(\"InAppBrowser plugin not found\");this._popup=cordova.InAppBrowser.open(e.url,this.target,this.features),this._popup?(i.Log.debug(\"CordovaPopupWindow.navigate: popup successfully created\"),this._exitCallbackEvent=this._exitCallback.bind(this),this._loadStartCallbackEvent=this._loadStartCallback.bind(this),this._popup.addEventListener(\"exit\",this._exitCallbackEvent,!1),this._popup.addEventListener(\"loadstart\",this._loadStartCallbackEvent,!1)):this._error(\"Error opening popup window\")}else this._error(\"No url provided\");return this.promise},t.prototype._loadStartCallback=function t(e){0===e.url.indexOf(this.redirect_uri)&&this._success({url:e.url})},t.prototype._exitCallback=function t(e){this._error(e)},t.prototype._success=function t(e){this._cleanup(),i.Log.debug(\"CordovaPopupWindow: Successful response from cordova popup window\"),this._resolve(e)},t.prototype._error=function t(e){this._cleanup(),i.Log.error(e),this._reject(new Error(e))},t.prototype.close=function t(){this._cleanup()},t.prototype._cleanup=function t(){this._popup&&(i.Log.debug(\"CordovaPopupWindow: cleaning up popup\"),this._popup.removeEventListener(\"exit\",this._exitCallbackEvent,!1),this._popup.removeEventListener(\"loadstart\",this._loadStartCallbackEvent,!1),this._popup.close()),this._popup=null},n(t,[{key:\"promise\",get:function t(){return this._promise}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var n=r(0),i=r(10),o=r(5),s=r(6),a=r(37),u=r(38),c=r(16),h=r(2),l=r(48),f=r(49),g=r(19),d=r(20),p=r(18),v=r(1),y=r(15),m=r(50);e.default={Version:m.Version,Log:n.Log,OidcClient:i.OidcClient,OidcClientSettings:o.OidcClientSettings,WebStorageStateStore:s.WebStorageStateStore,InMemoryWebStorage:a.InMemoryWebStorage,UserManager:u.UserManager,AccessTokenEvents:c.AccessTokenEvents,MetadataService:h.MetadataService,CordovaPopupNavigator:l.CordovaPopupNavigator,CordovaIFrameNavigator:f.CordovaIFrameNavigator,CheckSessionIFrame:g.CheckSessionIFrame,TokenRevocationClient:d.TokenRevocationClient,SessionMonitor:p.SessionMonitor,Global:v.Global,User:y.User},t.exports=e.default},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});e.ClockService=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.prototype.getEpochTime=function t(){return Promise.resolve(Date.now()/1e3|0)},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.ResponseValidator=void 0;var n=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},i=r(0),o=r(2),s=r(25),a=r(11),u=r(12),c=r(4);function h(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}var l=[\"nonce\",\"at_hash\",\"iat\",\"nbf\",\"exp\",\"aud\",\"iss\",\"c_hash\"];e.ResponseValidator=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.MetadataService,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.UserInfoService,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.JoseUtil,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:a.TokenClient;if(h(this,t),!e)throw i.Log.error(\"ResponseValidator.ctor: No settings passed to ResponseValidator\"),new Error(\"settings\");this._settings=e,this._metadataService=new r(this._settings),this._userInfoService=new n(this._settings),this._joseUtil=u,this._tokenClient=new l(this._settings)}return t.prototype.validateSigninResponse=function t(e,r){var n=this;return i.Log.debug(\"ResponseValidator.validateSigninResponse\"),this._processSigninParams(e,r).then((function(t){return i.Log.debug(\"ResponseValidator.validateSigninResponse: state processed\"),n._validateTokens(e,t).then((function(t){return i.Log.debug(\"ResponseValidator.validateSigninResponse: tokens validated\"),n._processClaims(e,t).then((function(t){return i.Log.debug(\"ResponseValidator.validateSigninResponse: claims processed\"),t}))}))}))},t.prototype.validateSignoutResponse=function t(e,r){return e.id!==r.state?(i.Log.error(\"ResponseValidator.validateSignoutResponse: State does not match\"),Promise.reject(new Error(\"State does not match\"))):(i.Log.debug(\"ResponseValidator.validateSignoutResponse: state validated\"),r.state=e.data,r.error?(i.Log.warn(\"ResponseValidator.validateSignoutResponse: Response was error\",r.error),Promise.reject(new u.ErrorResponse(r))):Promise.resolve(r))},t.prototype._processSigninParams=function t(e,r){if(e.id!==r.state)return i.Log.error(\"ResponseValidator._processSigninParams: State does not match\"),Promise.reject(new Error(\"State does not match\"));if(!e.client_id)return i.Log.error(\"ResponseValidator._processSigninParams: No client_id on state\"),Promise.reject(new Error(\"No client_id on state\"));if(!e.authority)return i.Log.error(\"ResponseValidator._processSigninParams: No authority on state\"),Promise.reject(new Error(\"No authority on state\"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==e.authority)return i.Log.error(\"ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state\"),Promise.reject(new Error(\"authority mismatch on settings vs. signin state\"))}else this._settings.authority=e.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==e.client_id)return i.Log.error(\"ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state\"),Promise.reject(new Error(\"client_id mismatch on settings vs. signin state\"))}else this._settings.client_id=e.client_id;return i.Log.debug(\"ResponseValidator._processSigninParams: state validated\"),r.state=e.data,r.error?(i.Log.warn(\"ResponseValidator._processSigninParams: Response was error\",r.error),Promise.reject(new u.ErrorResponse(r))):e.nonce&&!r.id_token?(i.Log.error(\"ResponseValidator._processSigninParams: Expecting id_token in response\"),Promise.reject(new Error(\"No id_token in response\"))):!e.nonce&&r.id_token?(i.Log.error(\"ResponseValidator._processSigninParams: Not expecting id_token in response\"),Promise.reject(new Error(\"Unexpected id_token in response\"))):e.code_verifier&&!r.code?(i.Log.error(\"ResponseValidator._processSigninParams: Expecting code in response\"),Promise.reject(new Error(\"No code in response\"))):!e.code_verifier&&r.code?(i.Log.error(\"ResponseValidator._processSigninParams: Not expecting code in response\"),Promise.reject(new Error(\"Unexpected code in response\"))):(r.scope||(r.scope=e.scope),Promise.resolve(r))},t.prototype._processClaims=function t(e,r){var n=this;if(r.isOpenIdConnect){if(i.Log.debug(\"ResponseValidator._processClaims: response is OIDC, processing claims\"),r.profile=this._filterProtocolClaims(r.profile),!0!==e.skipUserInfo&&this._settings.loadUserInfo&&r.access_token)return i.Log.debug(\"ResponseValidator._processClaims: loading user info\"),this._userInfoService.getClaims(r.access_token).then((function(t){return i.Log.debug(\"ResponseValidator._processClaims: user info claims received from user info endpoint\"),t.sub!==r.profile.sub?(i.Log.error(\"ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token\"),Promise.reject(new Error(\"sub from user info endpoint does not match sub in id_token\"))):(r.profile=n._mergeClaims(r.profile,t),i.Log.debug(\"ResponseValidator._processClaims: user info claims received, updated profile:\",r.profile),r)}));i.Log.debug(\"ResponseValidator._processClaims: not loading user info\")}else i.Log.debug(\"ResponseValidator._processClaims: response is not OIDC, not processing claims\");return Promise.resolve(r)},t.prototype._mergeClaims=function t(e,r){var i=Object.assign({},e);for(var o in r){var s=r[o];Array.isArray(s)||(s=[s]);for(var a=0;a<s.length;a++){var u=s[a];i[o]?Array.isArray(i[o])?i[o].indexOf(u)<0&&i[o].push(u):i[o]!==u&&(\"object\"===(void 0===u?\"undefined\":n(u))&&this._settings.mergeClaims?i[o]=this._mergeClaims(i[o],u):i[o]=[i[o],u]):i[o]=u}}return i},t.prototype._filterProtocolClaims=function t(e){i.Log.debug(\"ResponseValidator._filterProtocolClaims, incoming claims:\",e);var r=Object.assign({},e);return this._settings._filterProtocolClaims?(l.forEach((function(t){delete r[t]})),i.Log.debug(\"ResponseValidator._filterProtocolClaims: protocol claims filtered\",r)):i.Log.debug(\"ResponseValidator._filterProtocolClaims: protocol claims not filtered\"),r},t.prototype._validateTokens=function t(e,r){return r.code?(i.Log.debug(\"ResponseValidator._validateTokens: Validating code\"),this._processCode(e,r)):r.id_token?r.access_token?(i.Log.debug(\"ResponseValidator._validateTokens: Validating id_token and access_token\"),this._validateIdTokenAndAccessToken(e,r)):(i.Log.debug(\"ResponseValidator._validateTokens: Validating id_token\"),this._validateIdToken(e,r)):(i.Log.debug(\"ResponseValidator._validateTokens: No code to process or id_token to validate\"),Promise.resolve(r))},t.prototype._processCode=function t(e,r){var o=this,s={client_id:e.client_id,client_secret:e.client_secret,code:r.code,redirect_uri:e.redirect_uri,code_verifier:e.code_verifier};return e.extraTokenParams&&\"object\"===n(e.extraTokenParams)&&Object.assign(s,e.extraTokenParams),this._tokenClient.exchangeCode(s).then((function(t){for(var n in t)r[n]=t[n];return r.id_token?(i.Log.debug(\"ResponseValidator._processCode: token response successful, processing id_token\"),o._validateIdTokenAttributes(e,r)):(i.Log.debug(\"ResponseValidator._processCode: token response successful, returning response\"),r)}))},t.prototype._validateIdTokenAttributes=function t(e,r){var n=this;return this._metadataService.getIssuer().then((function(t){var o=e.client_id,s=n._settings.clockSkew;return i.Log.debug(\"ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: \",s),n._settings.getEpochTime().then((function(a){return n._joseUtil.validateJwtAttributes(r.id_token,t,o,s,a).then((function(t){return e.nonce&&e.nonce!==t.nonce?(i.Log.error(\"ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token\"),Promise.reject(new Error(\"Invalid nonce in id_token\"))):t.sub?(r.profile=t,r):(i.Log.error(\"ResponseValidator._validateIdTokenAttributes: No sub present in id_token\"),Promise.reject(new Error(\"No sub present in id_token\")))}))}))}))},t.prototype._validateIdTokenAndAccessToken=function t(e,r){var n=this;return this._validateIdToken(e,r).then((function(t){return n._validateAccessToken(t)}))},t.prototype._getSigningKeyForJwt=function t(e){var r=this;return this._metadataService.getSigningKeys().then((function(t){var n=e.header.kid;if(!t)return i.Log.error(\"ResponseValidator._validateIdToken: No signing keys from metadata\"),Promise.reject(new Error(\"No signing keys from metadata\"));i.Log.debug(\"ResponseValidator._validateIdToken: Received signing keys\");var o=void 0;if(n)o=t.filter((function(t){return t.kid===n}))[0];else{if((t=r._filterByAlg(t,e.header.alg)).length>1)return i.Log.error(\"ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata\"),Promise.reject(new Error(\"No kid found in id_token and more than one key found in metadata\"));o=t[0]}return Promise.resolve(o)}))},t.prototype._getSigningKeyForJwtWithSingleRetry=function t(e){var r=this;return this._getSigningKeyForJwt(e).then((function(t){return t?Promise.resolve(t):(r._metadataService.resetSigningKeys(),r._getSigningKeyForJwt(e))}))},t.prototype._validateIdToken=function t(e,r){var n=this;if(!e.nonce)return i.Log.error(\"ResponseValidator._validateIdToken: No nonce on state\"),Promise.reject(new Error(\"No nonce on state\"));var o=this._joseUtil.parseJwt(r.id_token);return o&&o.header&&o.payload?e.nonce!==o.payload.nonce?(i.Log.error(\"ResponseValidator._validateIdToken: Invalid nonce in id_token\"),Promise.reject(new Error(\"Invalid nonce in id_token\"))):this._metadataService.getIssuer().then((function(t){return i.Log.debug(\"ResponseValidator._validateIdToken: Received issuer\"),n._getSigningKeyForJwtWithSingleRetry(o).then((function(s){if(!s)return i.Log.error(\"ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys\"),Promise.reject(new Error(\"No key matching kid or alg found in signing keys\"));var a=e.client_id,u=n._settings.clockSkew;return i.Log.debug(\"ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: \",u),n._joseUtil.validateJwt(r.id_token,s,t,a,u).then((function(){return i.Log.debug(\"ResponseValidator._validateIdToken: JWT validation successful\"),o.payload.sub?(r.profile=o.payload,r):(i.Log.error(\"ResponseValidator._validateIdToken: No sub present in id_token\"),Promise.reject(new Error(\"No sub present in id_token\")))}))}))})):(i.Log.error(\"ResponseValidator._validateIdToken: Failed to parse id_token\",o),Promise.reject(new Error(\"Failed to parse id_token\")))},t.prototype._filterByAlg=function t(e,r){var n=null;if(r.startsWith(\"RS\"))n=\"RSA\";else if(r.startsWith(\"PS\"))n=\"PS\";else{if(!r.startsWith(\"ES\"))return i.Log.debug(\"ResponseValidator._filterByAlg: alg not supported: \",r),[];n=\"EC\"}return i.Log.debug(\"ResponseValidator._filterByAlg: Looking for keys that match kty: \",n),e=e.filter((function(t){return t.kty===n})),i.Log.debug(\"ResponseValidator._filterByAlg: Number of keys that match kty: \",n,e.length),e},t.prototype._validateAccessToken=function t(e){if(!e.profile)return i.Log.error(\"ResponseValidator._validateAccessToken: No profile loaded from id_token\"),Promise.reject(new Error(\"No profile loaded from id_token\"));if(!e.profile.at_hash)return i.Log.error(\"ResponseValidator._validateAccessToken: No at_hash in id_token\"),Promise.reject(new Error(\"No at_hash in id_token\"));if(!e.id_token)return i.Log.error(\"ResponseValidator._validateAccessToken: No id_token\"),Promise.reject(new Error(\"No id_token\"));var r=this._joseUtil.parseJwt(e.id_token);if(!r||!r.header)return i.Log.error(\"ResponseValidator._validateAccessToken: Failed to parse id_token\",r),Promise.reject(new Error(\"Failed to parse id_token\"));var n=r.header.alg;if(!n||5!==n.length)return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\",n),Promise.reject(new Error(\"Unsupported alg: \"+n));var o=n.substr(2,3);if(!o)return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\",n,o),Promise.reject(new Error(\"Unsupported alg: \"+n));if(256!==(o=parseInt(o))&&384!==o&&512!==o)return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\",n,o),Promise.reject(new Error(\"Unsupported alg: \"+n));var s=\"sha\"+o,a=this._joseUtil.hashString(e.access_token,s);if(!a)return i.Log.error(\"ResponseValidator._validateAccessToken: access_token hash failed:\",s),Promise.reject(new Error(\"Failed to validate at_hash\"));var u=a.substr(0,a.length/2),c=this._joseUtil.hexToBase64Url(u);return c!==e.profile.at_hash?(i.Log.error(\"ResponseValidator._validateAccessToken: Failed to validate at_hash\",c,e.profile.at_hash),Promise.reject(new Error(\"Failed to validate at_hash\"))):(i.Log.debug(\"ResponseValidator._validateAccessToken: success\"),Promise.resolve(e))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UserInfoService=void 0;var n=r(7),i=r(2),o=r(0),s=r(4);function a(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.UserInfoService=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JsonService,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.JoseUtil;if(a(this,t),!e)throw o.Log.error(\"UserInfoService.ctor: No settings passed\"),new Error(\"settings\");this._settings=e,this._jsonService=new r(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new u(this._settings),this._joseUtil=c}return t.prototype.getClaims=function t(e){var r=this;return e?this._metadataService.getUserInfoEndpoint().then((function(t){return o.Log.debug(\"UserInfoService.getClaims: received userinfo url\",t),r._jsonService.getJson(t,e).then((function(t){return o.Log.debug(\"UserInfoService.getClaims: claims received\",t),t}))})):(o.Log.error(\"UserInfoService.getClaims: No token passed\"),Promise.reject(new Error(\"A token is required\")))},t.prototype._getClaimsFromJwt=function t(e){var r=this;try{var n=this._joseUtil.parseJwt(e.responseText);if(!n||!n.header||!n.payload)return o.Log.error(\"UserInfoService._getClaimsFromJwt: Failed to parse JWT\",n),Promise.reject(new Error(\"Failed to parse id_token\"));var i=n.header.kid,s=void 0;switch(this._settings.userInfoJwtIssuer){case\"OP\":s=this._metadataService.getIssuer();break;case\"ANY\":s=Promise.resolve(n.payload.iss);break;default:s=Promise.resolve(this._settings.userInfoJwtIssuer)}return s.then((function(t){return o.Log.debug(\"UserInfoService._getClaimsFromJwt: Received issuer:\"+t),r._metadataService.getSigningKeys().then((function(s){if(!s)return o.Log.error(\"UserInfoService._getClaimsFromJwt: No signing keys from metadata\"),Promise.reject(new Error(\"No signing keys from metadata\"));o.Log.debug(\"UserInfoService._getClaimsFromJwt: Received signing keys\");var a=void 0;if(i)a=s.filter((function(t){return t.kid===i}))[0];else{if((s=r._filterByAlg(s,n.header.alg)).length>1)return o.Log.error(\"UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata\"),Promise.reject(new Error(\"No kid found in id_token and more than one key found in metadata\"));a=s[0]}if(!a)return o.Log.error(\"UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys\"),Promise.reject(new Error(\"No key matching kid or alg found in signing keys\"));var u=r._settings.client_id,c=r._settings.clockSkew;return o.Log.debug(\"UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: \",c),r._joseUtil.validateJwt(e.responseText,a,t,u,c,void 0,!0).then((function(){return o.Log.debug(\"UserInfoService._getClaimsFromJwt: JWT validation successful\"),n.payload}))}))}))}catch(t){return o.Log.error(\"UserInfoService._getClaimsFromJwt: Error parsing JWT response\",t.message),void reject(t)}},t.prototype._filterByAlg=function t(e,r){var n=null;if(r.startsWith(\"RS\"))n=\"RSA\";else if(r.startsWith(\"PS\"))n=\"PS\";else{if(!r.startsWith(\"ES\"))return o.Log.debug(\"UserInfoService._filterByAlg: alg not supported: \",r),[];n=\"EC\"}return o.Log.debug(\"UserInfoService._filterByAlg: Looking for keys that match kty: \",n),e=e.filter((function(t){return t.kty===n})),o.Log.debug(\"UserInfoService._filterByAlg: Number of keys that match kty: \",n,e.length),e},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.AllowedSigningAlgs=e.b64tohex=e.hextob64u=e.crypto=e.X509=e.KeyUtil=e.jws=void 0;var n=r(27);e.jws=n.jws,e.KeyUtil=n.KEYUTIL,e.X509=n.X509,e.crypto=n.crypto,e.hextob64u=n.hextob64u,e.b64tohex=n.b64tohex,e.AllowedSigningAlgs=[\"RS256\",\"RS384\",\"RS512\",\"PS256\",\"PS384\",\"PS512\",\"ES256\",\"ES384\",\"ES512\"]},function(t,e,r){\"use strict\";(function(t){Object.defineProperty(e,\"__esModule\",{value:!0});var r,n,i,o,s,a,u,c,h,l,f,g=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},d={userAgent:!1},p={},v=v||(r=Math,i=(n={}).lib={},o=i.Base=function(){function t(){}return{extend:function e(r){t.prototype=this;var n=new t;return r&&n.mixIn(r),n.hasOwnProperty(\"init\")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function t(){var e=this.extend();return e.init.apply(e,arguments),e},init:function t(){},mixIn:function t(e){for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r]);e.hasOwnProperty(\"toString\")&&(this.toString=e.toString)},clone:function t(){return this.init.prototype.extend(this)}}}(),s=i.WordArray=o.extend({init:function t(e,r){e=this.words=e||[],this.sigBytes=null!=r?r:4*e.length},toString:function t(e){return(e||u).stringify(this)},concat:function t(e){var r=this.words,n=e.words,i=this.sigBytes,o=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s<o;s++){var a=n[s>>>2]>>>24-s%4*8&255;r[i+s>>>2]|=a<<24-(i+s)%4*8}else for(s=0;s<o;s+=4)r[i+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function t(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=r.ceil(n/4)},clone:function t(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function t(e){for(var n=[],i=0;i<e;i+=4)n.push(4294967296*r.random()|0);return new s.init(n,e)}}),a=n.enc={},u=a.Hex={stringify:function t(e){for(var r=e.words,n=e.sigBytes,i=[],o=0;o<n;o++){var s=r[o>>>2]>>>24-o%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join(\"\")},parse:function t(e){for(var r=e.length,n=[],i=0;i<r;i+=2)n[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,r/2)}},c=a.Latin1={stringify:function t(e){for(var r=e.words,n=e.sigBytes,i=[],o=0;o<n;o++){var s=r[o>>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(s))}return i.join(\"\")},parse:function t(e){for(var r=e.length,n=[],i=0;i<r;i++)n[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,r)}},h=a.Utf8={stringify:function t(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw new Error(\"Malformed UTF-8 data\")}},parse:function t(e){return c.parse(unescape(encodeURIComponent(e)))}},l=i.BufferedBlockAlgorithm=o.extend({reset:function t(){this._data=new s.init,this._nDataBytes=0},_append:function t(e){\"string\"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function t(e){var n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,u=o/(4*a),c=(u=e?r.ceil(u):r.max((0|u)-this._minBufferSize,0))*a,h=r.min(4*c,o);if(c){for(var l=0;l<c;l+=a)this._doProcessBlock(i,l);var f=i.splice(0,c);n.sigBytes-=h}return new s.init(f,h)},clone:function t(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),i.Hasher=l.extend({cfg:o.extend(),init:function t(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function t(){l.reset.call(this),this._doReset()},update:function t(e){return this._append(e),this._process(),this},finalize:function t(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function t(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function t(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),f=n.algo={},n);!function(t){var e,r=(e=v).lib,n=r.Base,i=r.WordArray;(e=e.x64={}).Word=n.extend({init:function t(e,r){this.high=e,this.low=r}}),e.WordArray=n.extend({init:function t(e,r){e=this.words=e||[],this.sigBytes=null!=r?r:8*e.length},toX32:function t(){for(var e=this.words,r=e.length,n=[],o=0;o<r;o++){var s=e[o];n.push(s.high),n.push(s.low)}return i.create(n,this.sigBytes)},clone:function t(){for(var e=n.clone.call(this),r=e.words=this.words.slice(0),i=r.length,o=0;o<i;o++)r[o]=r[o].clone();return e}})}(),function(){var t=v,e=t.lib.WordArray;t.enc.Base64={stringify:function t(e){var r=e.words,n=e.sigBytes,i=this._map;e.clamp(),e=[];for(var o=0;o<n;o+=3)for(var s=(r[o>>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;4>a&&o+.75*a<n;a++)e.push(i.charAt(s>>>6*(3-a)&63));if(r=i.charAt(64))for(;e.length%4;)e.push(r);return e.join(\"\")},parse:function t(r){var n=r.length,i=this._map;(o=i.charAt(64))&&(-1!=(o=r.indexOf(o))&&(n=o));for(var o=[],s=0,a=0;a<n;a++)if(a%4){var u=i.indexOf(r.charAt(a-1))<<a%4*2,c=i.indexOf(r.charAt(a))>>>6-a%4*2;o[s>>>2]|=(u|c)<<24-s%4*8,s++}return e.create(o,s)},_map:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"}}(),function(t){for(var e=v,r=(i=e.lib).WordArray,n=i.Hasher,i=e.algo,o=[],s=[],a=function t(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var h;t:{h=u;for(var l=t.sqrt(h),f=2;f<=l;f++)if(!(h%f)){h=!1;break t}h=!0}h&&(8>c&&(o[c]=a(t.pow(u,.5))),s[c]=a(t.pow(u,1/3)),c++),u++}var g=[];i=i.SHA256=n.extend({_doReset:function t(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function t(e,r){for(var n=this._hash.words,i=n[0],o=n[1],a=n[2],u=n[3],c=n[4],h=n[5],l=n[6],f=n[7],d=0;64>d;d++){if(16>d)g[d]=0|e[r+d];else{var p=g[d-15],v=g[d-2];g[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+g[d-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+g[d-16]}p=f+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&h^~c&l)+s[d]+g[d],v=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&o^i&a^o&a),f=l,l=h,h=c,c=u+p|0,u=a,a=o,o=i,i=p+v|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+u|0,n[4]=n[4]+c|0,n[5]=n[5]+h|0,n[6]=n[6]+l|0,n[7]=n[7]+f|0},_doFinalize:function e(){var r=this._data,n=r.words,i=8*this._nDataBytes,o=8*r.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(i/4294967296),n[15+(o+64>>>9<<4)]=i,r.sigBytes=4*n.length,this._process(),this._hash},clone:function t(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=n._createHelper(i),e.HmacSHA256=n._createHmacHelper(i)}(Math),function(){function t(){return n.create.apply(n,arguments)}for(var e=v,r=e.lib.Hasher,n=(o=e.x64).Word,i=o.WordArray,o=e.algo,s=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=t();o=o.SHA512=r.extend({_doReset:function t(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function t(e,r){for(var n=(f=this._hash.words)[0],i=f[1],o=f[2],u=f[3],c=f[4],h=f[5],l=f[6],f=f[7],g=n.high,d=n.low,p=i.high,v=i.low,y=o.high,m=o.low,_=u.high,S=u.low,b=c.high,w=c.low,F=h.high,E=h.low,x=l.high,A=l.low,k=f.high,P=f.low,C=g,T=d,R=p,I=v,D=y,L=m,N=_,U=S,B=b,O=w,j=F,M=E,H=x,V=A,K=k,q=P,J=0;80>J;J++){var W=a[J];if(16>J)var z=W.high=0|e[r+2*J],Y=W.low=0|e[r+2*J+1];else{z=((Y=(z=a[J-15]).high)>>>1|(G=z.low)<<31)^(Y>>>8|G<<24)^Y>>>7;var G=(G>>>1|Y<<31)^(G>>>8|Y<<24)^(G>>>7|Y<<25),X=((Y=(X=a[J-2]).high)>>>19|($=X.low)<<13)^(Y<<3|$>>>29)^Y>>>6,$=($>>>19|Y<<13)^($<<3|Y>>>29)^($>>>6|Y<<26),Q=(Y=a[J-7]).high,Z=(tt=a[J-16]).high,tt=tt.low;z=(z=(z=z+Q+((Y=G+Y.low)>>>0<G>>>0?1:0))+X+((Y=Y+$)>>>0<$>>>0?1:0))+Z+((Y=Y+tt)>>>0<tt>>>0?1:0);W.high=z,W.low=Y}Q=B&j^~B&H,tt=O&M^~O&V,W=C&R^C&D^R&D;var et=T&I^T&L^I&L,rt=(G=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),X=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),($=s[J]).high),nt=$.low;Z=K+((B>>>14|O<<18)^(B>>>18|O<<14)^(B<<23|O>>>9))+(($=q+((O>>>14|B<<18)^(O>>>18|B<<14)^(O<<23|B>>>9)))>>>0<q>>>0?1:0),K=H,q=V,H=j,V=M,j=B,M=O,B=N+(Z=(Z=(Z=Z+Q+(($=$+tt)>>>0<tt>>>0?1:0))+rt+(($=$+nt)>>>0<nt>>>0?1:0))+z+(($=$+Y)>>>0<Y>>>0?1:0))+((O=U+$|0)>>>0<U>>>0?1:0)|0,N=D,U=L,D=R,L=I,R=C,I=T,C=Z+(W=G+W+((Y=X+et)>>>0<X>>>0?1:0))+((T=$+Y|0)>>>0<$>>>0?1:0)|0}d=n.low=d+T,n.high=g+C+(d>>>0<T>>>0?1:0),v=i.low=v+I,i.high=p+R+(v>>>0<I>>>0?1:0),m=o.low=m+L,o.high=y+D+(m>>>0<L>>>0?1:0),S=u.low=S+U,u.high=_+N+(S>>>0<U>>>0?1:0),w=c.low=w+O,c.high=b+B+(w>>>0<O>>>0?1:0),E=h.low=E+M,h.high=F+j+(E>>>0<M>>>0?1:0),A=l.low=A+V,l.high=x+H+(A>>>0<V>>>0?1:0),P=f.low=P+q,f.high=k+K+(P>>>0<q>>>0?1:0)},_doFinalize:function t(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[30+(i+128>>>10<<5)]=Math.floor(n/4294967296),r[31+(i+128>>>10<<5)]=n,e.sigBytes=4*r.length,this._process(),this._hash.toX32()},clone:function t(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),e.SHA512=r._createHelper(o),e.HmacSHA512=r._createHmacHelper(o)}(),function(){var t=v,e=(i=t.x64).Word,r=i.WordArray,n=(i=t.algo).SHA512,i=i.SHA384=n.extend({_doReset:function t(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function t(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}});t.SHA384=n._createHelper(i),t.HmacSHA384=n._createHmacHelper(i)}();\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\nvar y,m=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";function _(t){var e,r,n=\"\";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=m.charAt(r>>6)+m.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=m.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=m.charAt(r>>2)+m.charAt((3&r)<<4)),\"=\";(3&n.length)>0;)n+=\"=\";return n}function S(t){var e,r,n,i=\"\",o=0;for(e=0;e<t.length&&\"=\"!=t.charAt(e);++e)(n=m.indexOf(t.charAt(e)))<0||(0==o?(i+=T(n>>2),r=3&n,o=1):1==o?(i+=T(r<<2|n>>4),r=15&n,o=2):2==o?(i+=T(r),i+=T(n>>2),r=3&n,o=3):(i+=T(r<<2|n>>4),i+=T(15&n),o=0));return 1==o&&(i+=T(r<<2)),i}function b(t){var e,r=S(t),n=new Array;for(e=0;2*e<r.length;++e)n[e]=parseInt(r.substring(2*e,2*e+2),16);return n}function w(t,e,r){null!=t&&(\"number\"==typeof t?this.fromNumber(t,e,r):null==e&&\"string\"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function F(){return new w(null)}\"Microsoft Internet Explorer\"==d.appName?(w.prototype.am=function E(t,e,r,n,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i},y=30):\"Netscape\"!=d.appName?(w.prototype.am=function x(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},y=26):(w.prototype.am=function A(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+a*c,r[n++]=268435455&u}return i},y=28),w.prototype.DB=y,w.prototype.DM=(1<<y)-1,w.prototype.DV=1<<y;w.prototype.FV=Math.pow(2,52),w.prototype.F1=52-y,w.prototype.F2=2*y-52;var k,P,C=new Array;for(k=\"0\".charCodeAt(0),P=0;P<=9;++P)C[k++]=P;for(k=\"a\".charCodeAt(0),P=10;P<36;++P)C[k++]=P;for(k=\"A\".charCodeAt(0),P=10;P<36;++P)C[k++]=P;function T(t){return\"0123456789abcdefghijklmnopqrstuvwxyz\".charAt(t)}function R(t,e){var r=C[t.charCodeAt(e)];return null==r?-1:r}function I(t){var e=F();return e.fromInt(t),e}function D(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function L(t){this.m=t}function N(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function U(t,e){return t&e}function B(t,e){return t|e}function O(t,e){return t^e}function j(t,e){return t&~e}function M(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function H(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function V(){}function K(t){return t}function q(t){this.r2=F(),this.q3=F(),w.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}L.prototype.convert=function J(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},L.prototype.revert=function W(t){return t},L.prototype.reduce=function z(t){t.divRemTo(this.m,null,t)},L.prototype.mulTo=function Y(t,e,r){t.multiplyTo(e,r),this.reduce(r)},L.prototype.sqrTo=function G(t,e){t.squareTo(e),this.reduce(e)},N.prototype.convert=function X(t){var e=F();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(w.ZERO)>0&&this.m.subTo(e,e),e},N.prototype.revert=function $(t){var e=F();return t.copyTo(e),this.reduce(e),e},N.prototype.reduce=function Q(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},N.prototype.mulTo=function Z(t,e,r){t.multiplyTo(e,r),this.reduce(r)},N.prototype.sqrTo=function tt(t,e){t.squareTo(e),this.reduce(e)},w.prototype.copyTo=function et(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},w.prototype.fromInt=function rt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},w.prototype.fromString=function nt(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,o=0;--n>=0;){var s=8==r?255&t[n]:R(t,n);s<0?\"-\"==t.charAt(n)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&w.ZERO.subTo(this,this)},w.prototype.clamp=function it(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},w.prototype.dlShiftTo=function ot(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},w.prototype.drShiftTo=function st(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},w.prototype.lShiftTo=function at(t,e){var r,n=t%this.DB,i=this.DB-n,o=(1<<i)-1,s=Math.floor(t/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)e[r+s+1]=this[r]>>i|a,a=(this[r]&o)<<n;for(r=s-1;r>=0;--r)e[r]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},w.prototype.rShiftTo=function ut(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<i,e[s-r]=this[s]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}},w.prototype.subTo=function ct(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},w.prototype.multiplyTo=function ht(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&w.ZERO.subTo(e,e)},w.prototype.squareTo=function lt(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},w.prototype.divRemTo=function ft(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=F());var o=F(),s=this.s,a=t.s,u=this.DB-D(n[n.t-1]);u>0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var c=o.t,h=o[c-1];if(0!=h){var l=h*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),f=this.FV/l,g=(1<<this.F1)/l,d=1<<this.F2,p=r.t,v=p-c,y=null==e?F():e;for(o.dlShiftTo(v,y),r.compareTo(y)>=0&&(r[r.t++]=1,r.subTo(y,r)),w.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--v>=0;){var m=r[--p]==h?this.DM:Math.floor(r[p]*f+(r[p-1]+d)*g);if((r[p]+=o.am(0,m,r,v,0,c))<m)for(o.dlShiftTo(v,y),r.subTo(y,r);r[p]<--m;)r.subTo(y,r)}null!=e&&(r.drShiftTo(c,e),s!=a&&w.ZERO.subTo(e,e)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&w.ZERO.subTo(r,r)}}},w.prototype.invDigit=function gt(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},w.prototype.isEven=function dt(){return 0==(this.t>0?1&this[0]:this.s)},w.prototype.exp=function pt(t,e){if(t>4294967295||t<1)return w.ONE;var r=F(),n=F(),i=e.convert(this),o=D(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)},w.prototype.toString=function vt(t){if(this.s<0)return\"-\"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,o=\"\",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=T(r));s>=0;)a<e?(r=(this[s]&(1<<a)-1)<<e-a,r|=this[--s]>>(a+=this.DB-e)):(r=this[s]>>(a-=e)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=T(r));return i?o:\"0\"},w.prototype.negate=function yt(){var t=F();return w.ZERO.subTo(this,t),t},w.prototype.abs=function mt(){return this.s<0?this.negate():this},w.prototype.compareTo=function _t(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},w.prototype.bitLength=function St(){return this.t<=0?0:this.DB*(this.t-1)+D(this[this.t-1]^this.s&this.DM)},w.prototype.mod=function bt(t){var e=F();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(w.ZERO)>0&&t.subTo(e,e),e},w.prototype.modPowInt=function wt(t,e){var r;return r=t<256||e.isEven()?new L(e):new N(e),this.exp(t,r)},w.ZERO=I(0),w.ONE=I(1),V.prototype.convert=K,V.prototype.revert=K,V.prototype.mulTo=function Ft(t,e,r){t.multiplyTo(e,r)},V.prototype.sqrTo=function Et(t,e){t.squareTo(e)},q.prototype.convert=function xt(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=F();return t.copyTo(e),this.reduce(e),e},q.prototype.revert=function At(t){return t},q.prototype.reduce=function kt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},q.prototype.mulTo=function Pt(t,e,r){t.multiplyTo(e,r),this.reduce(r)},q.prototype.sqrTo=function Ct(t,e){t.squareTo(e),this.reduce(e)};var Tt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Rt=(1<<26)/Tt[Tt.length-1];\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\nfunction It(){this.i=0,this.j=0,this.S=new Array}w.prototype.chunkSize=function Dt(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},w.prototype.toRadix=function Lt(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return\"0\";var e=this.chunkSize(t),r=Math.pow(t,e),n=I(r),i=F(),o=F(),s=\"\";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s},w.prototype.fromRadix=function Nt(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a<t.length;++a){var u=R(t,a);u<0?\"-\"==t.charAt(a)&&0==this.signum()&&(i=!0):(s=e*s+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&w.ZERO.subTo(this,this)},w.prototype.fromNumber=function Ut(t,e,r){if(\"number\"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(w.ONE.shiftLeft(t-1),B,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(w.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},w.prototype.bitwiseTo=function Bt(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},w.prototype.changeBit=function Ot(t,e){var r=w.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},w.prototype.addTo=function jt(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},w.prototype.dMultiply=function Mt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},w.prototype.dAddOffset=function Ht(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},w.prototype.multiplyLowerTo=function Vt(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()},w.prototype.multiplyUpperTo=function Kt(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},w.prototype.modInt=function qt(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},w.prototype.millerRabin=function Jt(t){var e=this.subtract(w.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>Tt.length&&(t=Tt.length);for(var i=F(),o=0;o<t;++o){i.fromInt(Tt[Math.floor(Math.random()*Tt.length)]);var s=i.modPow(n,this);if(0!=s.compareTo(w.ONE)&&0!=s.compareTo(e)){for(var a=1;a++<r&&0!=s.compareTo(e);)if(0==(s=s.modPowInt(2,this)).compareTo(w.ONE))return!1;if(0!=s.compareTo(e))return!1}}return!0},w.prototype.clone=\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\nfunction Wt(){var t=F();return this.copyTo(t),t},w.prototype.intValue=function zt(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},w.prototype.byteValue=function Yt(){return 0==this.t?this.s:this[0]<<24>>24},w.prototype.shortValue=function Gt(){return 0==this.t?this.s:this[0]<<16>>16},w.prototype.signum=function Xt(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},w.prototype.toByteArray=function $t(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},w.prototype.equals=function Qt(t){return 0==this.compareTo(t)},w.prototype.min=function Zt(t){return this.compareTo(t)<0?this:t},w.prototype.max=function te(t){return this.compareTo(t)>0?this:t},w.prototype.and=function ee(t){var e=F();return this.bitwiseTo(t,U,e),e},w.prototype.or=function re(t){var e=F();return this.bitwiseTo(t,B,e),e},w.prototype.xor=function ne(t){var e=F();return this.bitwiseTo(t,O,e),e},w.prototype.andNot=function ie(t){var e=F();return this.bitwiseTo(t,j,e),e},w.prototype.not=function oe(){for(var t=F(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},w.prototype.shiftLeft=function se(t){var e=F();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},w.prototype.shiftRight=function ae(t){var e=F();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},w.prototype.getLowestSetBit=function ue(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+M(this[t]);return this.s<0?this.t*this.DB:-1},w.prototype.bitCount=function ce(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=H(this[r]^e);return t},w.prototype.testBit=function he(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},w.prototype.setBit=function le(t){return this.changeBit(t,B)},w.prototype.clearBit=function fe(t){return this.changeBit(t,j)},w.prototype.flipBit=function ge(t){return this.changeBit(t,O)},w.prototype.add=function de(t){var e=F();return this.addTo(t,e),e},w.prototype.subtract=function pe(t){var e=F();return this.subTo(t,e),e},w.prototype.multiply=function ve(t){var e=F();return this.multiplyTo(t,e),e},w.prototype.divide=function ye(t){var e=F();return this.divRemTo(t,e,null),e},w.prototype.remainder=function me(t){var e=F();return this.divRemTo(t,null,e),e},w.prototype.divideAndRemainder=function _e(t){var e=F(),r=F();return this.divRemTo(t,e,r),new Array(e,r)},w.prototype.modPow=function Se(t,e){var r,n,i=t.bitLength(),o=I(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new L(e):e.isEven()?new q(e):new N(e);var s=new Array,a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var h=F();for(n.sqrTo(s[1],h);a<=c;)s[a]=F(),n.mulTo(h,s[a-2],s[a]),a+=2}var l,f,g=t.t-1,d=!0,p=F();for(i=D(t[g])-1;g>=0;){for(i>=u?l=t[g]>>i-u&c:(l=(t[g]&(1<<i+1)-1)<<u-i,g>0&&(l|=t[g-1]>>this.DB+i-u)),a=r;0==(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--g),d)s[l].copyTo(o),d=!1;else{for(;a>1;)n.sqrTo(o,p),n.sqrTo(p,o),a-=2;a>0?n.sqrTo(o,p):(f=o,o=p,p=f),n.mulTo(p,s[l],o)}for(;g>=0&&0==(t[g]&1<<i);)n.sqrTo(o,p),f=o,o=p,p=f,--i<0&&(i=this.DB-1,--g)}return n.revert(o)},w.prototype.modInverse=function be(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return w.ZERO;for(var r=t.clone(),n=this.clone(),i=I(1),o=I(0),s=I(0),a=I(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}return 0!=n.compareTo(w.ONE)?w.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},w.prototype.pow=function we(t){return this.exp(t,new V)},w.prototype.gcd=function Fe(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},w.prototype.isProbablePrime=function Ee(t){var e,r=this.abs();if(1==r.t&&r[0]<=Tt[Tt.length-1]){for(e=0;e<Tt.length;++e)if(r[0]==Tt[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<Tt.length;){for(var n=Tt[e],i=e+1;i<Tt.length&&n<Rt;)n*=Tt[i++];for(n=r.modInt(n);e<i;)if(n%Tt[e++]==0)return!1}return r.millerRabin(t)},w.prototype.square=function xe(){var t=F();return this.squareTo(t),t},It.prototype.init=function Ae(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0},It.prototype.next=function ke(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var Pe,Ce,Te;\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */function Re(){!function t(e){Ce[Te++]^=255&e,Ce[Te++]^=e>>8&255,Ce[Te++]^=e>>16&255,Ce[Te++]^=e>>24&255,Te>=256&&(Te-=256)}((new Date).getTime())}if(null==Ce){var Ie;if(Ce=new Array,Te=0,void 0!==p&&(void 0!==p.crypto||void 0!==p.msCrypto)){var De=p.crypto||p.msCrypto;if(De.getRandomValues){var Le=new Uint8Array(32);for(De.getRandomValues(Le),Ie=0;Ie<32;++Ie)Ce[Te++]=Le[Ie]}else if(\"Netscape\"==d.appName&&d.appVersion<\"5\"){var Ne=p.crypto.random(32);for(Ie=0;Ie<Ne.length;++Ie)Ce[Te++]=255&Ne.charCodeAt(Ie)}}for(;Te<256;)Ie=Math.floor(65536*Math.random()),Ce[Te++]=Ie>>>8,Ce[Te++]=255&Ie;Te=0,Re()}function Ue(){if(null==Pe){for(Re(),(Pe=function t(){return new It}()).init(Ce),Te=0;Te<Ce.length;++Te)Ce[Te]=0;Te=0}return Pe.next()}function Be(){}\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\nfunction Oe(t,e){return new w(t,e)}function je(t,e,r){for(var n=\"\",i=0;n.length<e;)n+=r(String.fromCharCode.apply(String,t.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function Me(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\nfunction He(t,e){this.x=e,this.q=t}function Ve(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=null==n?w.ONE:n,this.zinv=null}function Ke(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new Ve(this,null,null)}Be.prototype.nextBytes=function qe(t){var e;for(e=0;e<t.length;++e)t[e]=Ue()},Me.prototype.doPublic=function Je(t){return t.modPowInt(this.e,this.n)},Me.prototype.setPublic=function We(t,e){if(this.isPublic=!0,this.isPrivate=!1,\"string\"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw\"Invalid RSA public key\";this.n=Oe(t,16),this.e=parseInt(e,16)}},Me.prototype.encrypt=function ze(t){var e=function r(t,e){if(e<t.length+11)throw\"Message too long for RSA\";for(var r=new Array,n=t.length-1;n>=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new Be,s=new Array;e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new w(r)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var i=n.toString(16);return 0==(1&i.length)?i:\"0\"+i},Me.prototype.encryptOAEP=function Ye(t,e,r){var n=function i(t,e,r,n){var i=Sr.crypto.MessageDigest,o=Sr.crypto.Util,s=null;if(r||(r=\"sha1\"),\"string\"==typeof r&&(s=i.getCanonicalAlgName(r),n=i.getHashLength(s),r=function t(e){return Lr(o.hashHex(Nr(e),s))}),t.length+2*n+2>e)throw\"Message too long for RSA\";var a,u=\"\";for(a=0;a<e-t.length-2*n-2;a+=1)u+=\"\\0\";var c=r(\"\")+u+\"\u0001\"+t,h=new Array(n);(new Be).nextBytes(h);var l=je(h,c.length,r),f=[];for(a=0;a<c.length;a+=1)f[a]=c.charCodeAt(a)^l.charCodeAt(a);var g=je(f,h.length,r),d=[0];for(a=0;a<h.length;a+=1)d[a+1]=h[a]^g.charCodeAt(a);return new w(d.concat(f))}(t,this.n.bitLength()+7>>3,e,r);if(null==n)return null;var o=this.doPublic(n);if(null==o)return null;var s=o.toString(16);return 0==(1&s.length)?s:\"0\"+s},Me.prototype.type=\"RSA\",He.prototype.equals=function Ge(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},He.prototype.toBigInteger=function Xe(){return this.x},He.prototype.negate=function $e(){return new He(this.q,this.x.negate().mod(this.q))},He.prototype.add=function Qe(t){return new He(this.q,this.x.add(t.toBigInteger()).mod(this.q))},He.prototype.subtract=function Ze(t){return new He(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},He.prototype.multiply=function tr(t){return new He(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},He.prototype.square=function er(){return new He(this.q,this.x.square().mod(this.q))},He.prototype.divide=function rr(t){return new He(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},Ve.prototype.getX=function nr(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Ve.prototype.getY=function ir(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Ve.prototype.equals=function or(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(w.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(w.ZERO))},Ve.prototype.isInfinity=function sr(){return null==this.x&&null==this.y||this.z.equals(w.ZERO)&&!this.y.toBigInteger().equals(w.ZERO)},Ve.prototype.negate=function ar(){return new Ve(this.curve,this.x,this.y.negate(),this.z)},Ve.prototype.add=function ur(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(w.ZERO.equals(r))return w.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new w(\"3\"),i=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),a=s.multiply(r),u=i.multiply(s),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(r).mod(this.curve.q),l=u.multiply(n).multiply(e).subtract(o.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),f=a.multiply(this.z).multiply(t.z).mod(this.curve.q);return new Ve(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(l),f)},Ve.prototype.twice=function cr(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new w(\"3\"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=e.square().multiply(t);w.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o)));var a=(s=s.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=s.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new Ve(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)},Ve.prototype.multiply=function hr(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new w(\"3\")),i=this.negate(),o=this,s=this.curve.q.subtract(t),a=s.multiply(new w(\"3\")),u=new Ve(this.curve,this.x,this.y),c=u.negate();for(e=n.bitLength()-2;e>0;--e){o=o.twice();var h=n.testBit(e);h!=r.testBit(e)&&(o=o.add(h?this:i))}for(e=a.bitLength()-2;e>0;--e){u=u.twice();var l=a.testBit(e);l!=s.testBit(e)&&(u=u.add(l?u:c))}return o},Ve.prototype.multiplyTwo=function lr(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(o):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i},Ke.prototype.getQ=function fr(){return this.q},Ke.prototype.getA=function gr(){return this.a},Ke.prototype.getB=function dr(){return this.b},Ke.prototype.equals=function pr(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},Ke.prototype.getInfinity=function vr(){return this.infinity},Ke.prototype.fromBigInteger=function yr(t){return new He(this.q,t)},Ke.prototype.decodePointHex=function mr(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,r=t.substr(2,e),n=t.substr(e+2,e);return new Ve(this,this.fromBigInteger(new w(r,16)),this.fromBigInteger(new w(n,16)));default:return null}},\n/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib\n */\nHe.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},Ve.prototype.getEncoded=function(t){var e=function t(e,r){var n=e.toByteArrayUnsigned();if(r<n.length)n=n.slice(n.length-r);else for(;r>n.length;)n.unshift(0);return n},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},Ve.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var o=new w(n),s=new w(i);return new Ve(t,t.fromBigInteger(o),t.fromBigInteger(s))},Ve.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),o=new w(n,16),s=new w(i,16);return new Ve(t,t.fromBigInteger(o),t.fromBigInteger(s))},Ve.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y).divide(e),n=r.square().subtract(this.x).subtract(t.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Ve(this.curve,n,i)},Ve.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(w.valueOf(2)),e=this.curve.fromBigInteger(w.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Ve(this.curve,n,i)},Ve.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new w(\"3\")),i=this.negate(),o=this;for(e=n.bitLength()-2;e>0;--e){o=o.twice();var s=n.testBit(e);s!=r.testBit(e)&&(o=o.add2D(s?this:i))}return o},Ve.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),o=e.multiply(e).mod(i),s=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return o.equals(s)},Ve.prototype.toString=function(){return\"(\"+this.getX().toBigInteger().toString()+\",\"+this.getY().toBigInteger().toString()+\")\"},Ve.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error(\"Point is at infinity.\");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(w.ONE)<0||e.compareTo(t.subtract(w.ONE))>0)throw new Error(\"x coordinate out of bounds\");if(r.compareTo(w.ONE)<0||r.compareTo(t.subtract(w.ONE))>0)throw new Error(\"y coordinate out of bounds\");if(!this.isOnCurve())throw new Error(\"Point is not on the curve.\");if(this.multiply(t).isInfinity())throw new Error(\"Point is not a scalar multiple of G.\");return!0};\n/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval\n */\nvar _r=function(){var t=new RegExp('(?:false|true|null|[\\\\{\\\\}\\\\[\\\\]]|(?:-?\\\\b(?:0|[1-9][0-9]*)(?:\\\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\\\b)|(?:\"(?:[^\\\\0-\\\\x08\\\\x0a-\\\\x1f\"\\\\\\\\]|\\\\\\\\(?:[\"/\\\\\\\\bfnrt]|u[0-9A-Fa-f]{4}))*\"))',\"g\"),e=new RegExp(\"\\\\\\\\(?:([^u])|u(.{4}))\",\"g\"),r={'\"':'\"',\"/\":\"/\",\"\\\\\":\"\\\\\",b:\"\\b\",f:\"\\f\",n:\"\\n\",r:\"\\r\",t:\"\\t\"};function n(t,e,n){return e?r[e]:String.fromCharCode(parseInt(n,16))}var i=new String(\"\"),o=Object.hasOwnProperty;return function(r,s){var a,u,c=r.match(t),h=c[0],l=!1;\"{\"===h?a={}:\"[\"===h?a=[]:(a=[],l=!0);for(var f=[a],d=1-l,p=c.length;d<p;++d){var v;switch((h=c[d]).charCodeAt(0)){default:(v=f[0])[u||v.length]=+h,u=void 0;break;case 34:if(-1!==(h=h.substring(1,h.length-1)).indexOf(\"\\\\\")&&(h=h.replace(e,n)),v=f[0],!u){if(!(v instanceof Array)){u=h||i;break}u=v.length}v[u]=h,u=void 0;break;case 91:v=f[0],f.unshift(v[u||v.length]=[]),u=void 0;break;case 93:f.shift();break;case 102:(v=f[0])[u||v.length]=!1,u=void 0;break;case 110:(v=f[0])[u||v.length]=null,u=void 0;break;case 116:(v=f[0])[u||v.length]=!0,u=void 0;break;case 123:v=f[0],f.unshift(v[u||v.length]={}),u=void 0;break;case 125:f.shift()}}if(l){if(1!==f.length)throw new Error;a=a[0]}else if(f.length)throw new Error;if(s){a=function t(e,r){var n=e[r];if(n&&\"object\"===(void 0===n?\"undefined\":g(n))){var i=null;for(var a in n)if(o.call(n,a)&&n!==e){var u=t(n,a);void 0!==u?n[a]=u:(i||(i=[]),i.push(a))}if(i)for(var c=i.length;--c>=0;)delete n[i[c]]}return s.call(e,r,n)}({\"\":a},\"\")}return a}}();void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.asn1&&Sr.asn1||(Sr.asn1={}),Sr.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e=\"0\"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if(\"-\"!=e.substr(0,1))e.length%2==1?e=\"0\"+e:e.match(/^[0-7]/)||(e=\"00\"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n=\"\",i=0;i<r;i++)n+=\"f\";e=new w(n,16).xor(t).add(w.ONE).toString(16).replace(/^-/,\"\")}return e},this.getPEMStringFromHex=function(t,e){return jr(t,e)},this.newObject=function(t){var e=Sr.asn1,r=e.ASN1Object,n=e.DERBoolean,i=e.DERInteger,o=e.DERBitString,s=e.DEROctetString,a=e.DERNull,u=e.DERObjectIdentifier,c=e.DEREnumerated,h=e.DERUTF8String,l=e.DERNumericString,f=e.DERPrintableString,g=e.DERTeletexString,d=e.DERIA5String,p=e.DERUTCTime,v=e.DERGeneralizedTime,y=e.DERVisibleString,m=e.DERBMPString,_=e.DERSequence,S=e.DERSet,b=e.DERTaggedObject,w=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var F=Object.keys(t);if(1!=F.length)throw new Error(\"key of param shall be only one.\");var E=F[0];if(-1==\":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:\".indexOf(\":\"+E+\":\"))throw new Error(\"undefined key: \"+E);if(\"bool\"==E)return new n(t[E]);if(\"int\"==E)return new i(t[E]);if(\"bitstr\"==E)return new o(t[E]);if(\"octstr\"==E)return new s(t[E]);if(\"null\"==E)return new a(t[E]);if(\"oid\"==E)return new u(t[E]);if(\"enum\"==E)return new c(t[E]);if(\"utf8str\"==E)return new h(t[E]);if(\"numstr\"==E)return new l(t[E]);if(\"prnstr\"==E)return new f(t[E]);if(\"telstr\"==E)return new g(t[E]);if(\"ia5str\"==E)return new d(t[E]);if(\"utctime\"==E)return new p(t[E]);if(\"gentime\"==E)return new v(t[E]);if(\"visstr\"==E)return new y(t[E]);if(\"bmpstr\"==E)return new m(t[E]);if(\"asn1\"==E)return new r(t[E]);if(\"seq\"==E){for(var x=t[E],A=[],k=0;k<x.length;k++){var P=w(x[k]);A.push(P)}return new _({array:A})}if(\"set\"==E){for(x=t[E],A=[],k=0;k<x.length;k++){P=w(x[k]);A.push(P)}return new S({array:A})}if(\"tag\"==E){var C=t[E];if(\"[object Array]\"===Object.prototype.toString.call(C)&&3==C.length){var T=w(C[2]);return new b({tag:C[0],explicit:C[1],obj:T})}return new b(C)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},Sr.asn1.ASN1Util.oidHexToInt=function(t){for(var e=\"\",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+\".\"+r%40,\"\"),i=2;i<t.length;i+=2){var o=(\"00000000\"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);if(n+=o.substr(1,7),\"0\"==o.substr(0,1))e=e+\".\"+new w(n,2).toString(10),n=\"\"}return e},Sr.asn1.ASN1Util.oidIntToHex=function(t){var e=function t(e){var r=e.toString(16);return 1==r.length&&(r=\"0\"+r),r},r=function t(r){var n=\"\",i=new w(r,10).toString(2),o=7-i.length%7;7==o&&(o=0);for(var s=\"\",a=0;a<o;a++)s+=\"0\";i=s+i;for(a=0;a<i.length-1;a+=7){var u=i.substr(a,7);a!=i.length-7&&(u=\"1\"+u),n+=e(parseInt(u,2))}return n};if(!t.match(/^[0-9.]+$/))throw\"malformed oid string: \"+t;var n=\"\",i=t.split(\".\"),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n},Sr.asn1.ASN1Object=function(t){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error(\"this.hV is null or undefined\");if(this.hV.length%2==1)throw new Error(\"value hex must be even length: n=\"+\"\".length+\",v=\"+this.hV);var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e=\"0\"+e),t<128)return e;var r=e.length/2;if(r>15)throw\"ASN.1 length too long to represent by 8x: n = \"+t.toString(16);return(128+r).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return\"\"},this.setByParam=function(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},Sr.asn1.DERAbstractString=function(t){Sr.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=Ir(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(\"string\"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},Zr(Sr.asn1.DERAbstractString,Sr.asn1.ASN1Object),Sr.asn1.DERAbstractTime=function(t){Sr.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());\"utc\"==e&&(o=o.substr(2,2));var s=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var a=i.getMilliseconds();if(0!=a){var u=n(String(a),3);s=s+\".\"+(u=u.replace(/[0]+$/,\"\"))}}return s+\"Z\"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join(\"0\")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=kr(t)},this.setByDateValue=function(t,e,r,n,i,o){var s=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},Zr(Sr.asn1.DERAbstractTime,Sr.asn1.ASN1Object),Sr.asn1.DERAbstractStructured=function(t){Sr.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},Zr(Sr.asn1.DERAbstractStructured,Sr.asn1.ASN1Object),Sr.asn1.DERBoolean=function(t){Sr.asn1.DERBoolean.superclass.constructor.call(this),this.hT=\"01\",this.hTLV=0==t?\"010100\":\"0101ff\"},Zr(Sr.asn1.DERBoolean,Sr.asn1.ASN1Object),Sr.asn1.DERInteger=function(t){Sr.asn1.DERInteger.superclass.constructor.call(this),this.hT=\"02\",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Sr.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new w(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):\"number\"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Zr(Sr.asn1.DERInteger,Sr.asn1.ASN1Object),Sr.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=Sr.asn1.ASN1Util.newObject(t.obj);t.hex=\"00\"+e.getEncodedHex()}Sr.asn1.DERBitString.superclass.constructor.call(this),this.hT=\"03\",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw\"unused bits shall be from 0 to 7: u = \"+t;var r=\"0\"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,\"\")).length%8;8==e&&(e=0);for(var r=0;r<=e;r++)t+=\"0\";var n=\"\";for(r=0;r<t.length-1;r+=8){var i=t.substr(r,8),o=parseInt(i,2).toString(16);1==o.length&&(o=\"0\"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV=\"0\"+e+n},this.setByBooleanArray=function(t){for(var e=\"\",r=0;r<t.length;r++)1==t[r]?e+=\"1\":e+=\"0\";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(\"string\"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},Zr(Sr.asn1.DERBitString,Sr.asn1.ASN1Object),Sr.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=Sr.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}Sr.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT=\"04\"},Zr(Sr.asn1.DEROctetString,Sr.asn1.DERAbstractString),Sr.asn1.DERNull=function(){Sr.asn1.DERNull.superclass.constructor.call(this),this.hT=\"05\",this.hTLV=\"0500\"},Zr(Sr.asn1.DERNull,Sr.asn1.ASN1Object),Sr.asn1.DERObjectIdentifier=function(t){Sr.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT=\"06\",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var e=function r(t){var e=function t(e){var r=e.toString(16);return 1==r.length&&(r=\"0\"+r),r},r=function t(r){var n=\"\",i=parseInt(r,10).toString(2),o=7-i.length%7;7==o&&(o=0);for(var s=\"\",a=0;a<o;a++)s+=\"0\";i=s+i;for(a=0;a<i.length-1;a+=7){var u=i.substr(a,7);a!=i.length-7&&(u=\"1\"+u),n+=e(parseInt(u,2))}return n};try{if(!t.match(/^[0-9.]+$/))return null;var n=\"\",i=t.split(\".\"),o=40*parseInt(i[0],10)+parseInt(i[1],10);n+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n}catch(t){return null}}(t);if(null==e)throw new Error(\"malformed oid string: \"+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=Sr.asn1.x509.OID.name2oid(t);if(\"\"===e)throw new Error(\"DERObjectIdentifier oidName undefined: \"+t);this.setValueOidString(e)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){\"string\"==typeof t?this.setValueNameOrOid(t):void 0!==t.oid?this.setValueNameOrOid(t.oid):void 0!==t.name?this.setValueNameOrOid(t.name):void 0!==t.hex&&this.setValueHex(t.hex)},void 0!==t&&this.setByParam(t)},Zr(Sr.asn1.DERObjectIdentifier,Sr.asn1.ASN1Object),Sr.asn1.DEREnumerated=function(t){Sr.asn1.DEREnumerated.superclass.constructor.call(this),this.hT=\"0a\",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Sr.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new w(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):\"number\"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Zr(Sr.asn1.DEREnumerated,Sr.asn1.ASN1Object),Sr.asn1.DERUTF8String=function(t){Sr.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT=\"0c\"},Zr(Sr.asn1.DERUTF8String,Sr.asn1.DERAbstractString),Sr.asn1.DERNumericString=function(t){Sr.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT=\"12\"},Zr(Sr.asn1.DERNumericString,Sr.asn1.DERAbstractString),Sr.asn1.DERPrintableString=function(t){Sr.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT=\"13\"},Zr(Sr.asn1.DERPrintableString,Sr.asn1.DERAbstractString),Sr.asn1.DERTeletexString=function(t){Sr.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT=\"14\"},Zr(Sr.asn1.DERTeletexString,Sr.asn1.DERAbstractString),Sr.asn1.DERIA5String=function(t){Sr.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT=\"16\"},Zr(Sr.asn1.DERIA5String,Sr.asn1.DERAbstractString),Sr.asn1.DERVisibleString=function(t){Sr.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT=\"1a\"},Zr(Sr.asn1.DERVisibleString,Sr.asn1.DERAbstractString),Sr.asn1.DERBMPString=function(t){Sr.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT=\"1e\"},Zr(Sr.asn1.DERBMPString,Sr.asn1.DERAbstractString),Sr.asn1.DERUTCTime=function(t){Sr.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT=\"17\",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,\"utc\"),this.hV=kr(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,\"utc\"),this.hV=kr(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):\"string\"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},Zr(Sr.asn1.DERUTCTime,Sr.asn1.DERAbstractTime),Sr.asn1.DERGeneralizedTime=function(t){Sr.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT=\"18\",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,\"gen\",this.withMillis),this.hV=kr(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,\"gen\",this.withMillis),this.hV=kr(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):\"string\"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},Zr(Sr.asn1.DERGeneralizedTime,Sr.asn1.DERAbstractTime),Sr.asn1.DERSequence=function(t){Sr.asn1.DERSequence.superclass.constructor.call(this,t),this.hT=\"30\",this.getFreshValueHex=function(){for(var t=\"\",e=0;e<this.asn1Array.length;e++){t+=this.asn1Array[e].getEncodedHex()}return this.hV=t,this.hV}},Zr(Sr.asn1.DERSequence,Sr.asn1.DERAbstractStructured),Sr.asn1.DERSet=function(t){Sr.asn1.DERSet.superclass.constructor.call(this,t),this.hT=\"31\",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(\"\"),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},Zr(Sr.asn1.DERSet,Sr.asn1.DERAbstractStructured),Sr.asn1.DERTaggedObject=function(t){Sr.asn1.DERTaggedObject.superclass.constructor.call(this);var e=Sr.asn1;this.hT=\"a0\",this.hV=\"\",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,r){this.hT=e,this.isExplicit=t,this.asn1Object=r,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=r.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){null!=t.tag&&(this.hT=t.tag),null!=t.explicit&&(this.isExplicit=t.explicit),null!=t.tage&&(this.hT=t.tage,this.isExplicit=!0),null!=t.tagi&&(this.hT=t.tagi,this.isExplicit=!1),null!=t.obj&&(t.obj instanceof e.ASN1Object?(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):\"object\"==g(t.obj)&&(this.asn1Object=e.ASN1Util.newObject(t.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=t&&this.setByParam(t)},Zr(Sr.asn1.DERTaggedObject,Sr.asn1.ASN1Object);var Sr,br,wr,Fr=new function(){};function Er(t){for(var e=new Array,r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}function xr(t){for(var e=\"\",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}function Ar(t){for(var e=\"\",r=0;r<t.length;r++){var n=t[r].toString(16);1==n.length&&(n=\"0\"+n),e+=n}return e}function kr(t){return Ar(Er(t))}function Pr(t){return t=(t=(t=t.replace(/\\=/g,\"\")).replace(/\\+/g,\"-\")).replace(/\\//g,\"_\")}function Cr(t){return t.length%4==2?t+=\"==\":t.length%4==3&&(t+=\"=\"),t=(t=t.replace(/-/g,\"+\")).replace(/_/g,\"/\")}function Tr(t){return t.length%2==1&&(t=\"0\"+t),Pr(_(t))}function Rr(t){return S(Cr(t))}function Ir(t){return Kr(Gr(t))}function Dr(t){return decodeURIComponent(qr(t))}function Lr(t){for(var e=\"\",r=0;r<t.length-1;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e}function Nr(t){for(var e=\"\",r=0;r<t.length;r++)e+=(\"0\"+t.charCodeAt(r).toString(16)).slice(-2);return e}function Ur(t){return _(t)}function Br(t){var e=Ur(t).replace(/(.{64})/g,\"$1\\r\\n\");return e=e.replace(/\\r\\n$/,\"\")}function Or(t){return S(t.replace(/[^0-9A-Za-z\\/+=]*/g,\"\"))}function jr(t,e){return\"-----BEGIN \"+e+\"-----\\r\\n\"+Br(t)+\"\\r\\n-----END \"+e+\"-----\\r\\n\"}function Mr(t,e){if(-1==t.indexOf(\"-----BEGIN \"))throw\"can't find PEM header: \"+e;return Or(t=void 0!==e?(t=t.replace(new RegExp(\"^[^]*-----BEGIN \"+e+\"-----\"),\"\")).replace(new RegExp(\"-----END \"+e+\"-----[^]*$\"),\"\"):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,\"\")).replace(/-----END [^-]+-----[^]*$/,\"\"))}function Hr(t){var e,r,n,i,o,s,a,u,c,h,l;if(l=t.match(/^(\\d{2}|\\d{4})(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(|\\.\\d+)Z$/))return u=l[1],e=parseInt(u),2===u.length&&(50<=e&&e<100?e=1900+e:0<=e&&e<50&&(e=2e3+e)),r=parseInt(l[2])-1,n=parseInt(l[3]),i=parseInt(l[4]),o=parseInt(l[5]),s=parseInt(l[6]),a=0,\"\"!==(c=l[7])&&(h=(c.substr(1)+\"00\").substr(0,3),a=parseInt(h)),Date.UTC(e,r,n,i,o,s,a);throw\"unsupported zulu format: \"+t}function Vr(t){return~~(Hr(t)/1e3)}function Kr(t){return t.replace(/%/g,\"\")}function qr(t){return t.replace(/(..)/g,\"%$1\")}function Jr(t){var e=\"malformed IPv6 address\";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var r=(t=t.toLowerCase()).split(\":\").length-1;if(r<2)throw e;var n=\":\".repeat(7-r+2),i=(t=t.replace(\"::\",n)).split(\":\");if(8!=i.length)throw e;for(var o=0;o<8;o++)i[o]=(\"0000\"+i[o]).slice(-4);return i.join(\"\")}function Wr(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw\"malformed IPv6 address octet\";for(var e=(t=t.toLowerCase()).match(/.{1,4}/g),r=0;r<8;r++)e[r]=e[r].replace(/^0+/,\"\"),\"\"==e[r]&&(e[r]=\"0\");var n=(t=\":\"+e.join(\":\")+\":\").match(/:(0:){2,}/g);if(null===n)return t.slice(1,-1);var i=\"\";for(r=0;r<n.length;r++)n[r].length>i.length&&(i=n[r]);return(t=t.replace(i,\"::\")).slice(1,-1)}function zr(t){var e=\"malformed hex value\";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?Wr(t):t;try{return parseInt(t.substr(0,2),16)+\".\"+parseInt(t.substr(2,2),16)+\".\"+parseInt(t.substr(4,2),16)+\".\"+parseInt(t.substr(6,2),16)}catch(t){throw e}}function Yr(t){return t.match(/.{4}/g).map((function e(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return Dr((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return Dr((224|(240&e)>>4).toString(16)+n.toString(16)+i.toString(16))})).join(\"\")}function Gr(t){for(var e=encodeURIComponent(t),r=\"\",n=0;n<e.length;n++)\"%\"==e[n]?(r+=e.substr(n,3),n+=2):r=r+\"%\"+kr(e[n]);return r}function Xr(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function $r(t){return t.length%2==1?\"0\"+t:t.substr(0,1)>\"7\"?\"00\"+t:t}Fr.getLblen=function(t,e){if(\"8\"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},Fr.getL=function(t,e){var r=Fr.getLblen(t,e);return r<1?\"\":t.substr(e+2,2*r)},Fr.getVblen=function(t,e){var r;return\"\"==(r=Fr.getL(t,e))?-1:(\"8\"===r.substr(0,1)?new w(r.substr(2),16):new w(r,16)).intValue()},Fr.getVidx=function(t,e){var r=Fr.getLblen(t,e);return r<0?r:e+2*(r+1)},Fr.getV=function(t,e){var r=Fr.getVidx(t,e),n=Fr.getVblen(t,e);return t.substr(r,2*n)},Fr.getTLV=function(t,e){return t.substr(e,2)+Fr.getL(t,e)+Fr.getV(t,e)},Fr.getTLVblen=function(t,e){return 2+2*Fr.getLblen(t,e)+2*Fr.getVblen(t,e)},Fr.getNextSiblingIdx=function(t,e){return Fr.getVidx(t,e)+2*Fr.getVblen(t,e)},Fr.getChildIdx=function(t,e){var r,n,i,o=Fr,s=[];r=o.getVidx(t,e),n=2*o.getVblen(t,e),\"03\"==t.substr(e,2)&&(r+=2,n-=2),i=0;for(var a=r;i<=n;){var u=o.getTLVblen(t,a);if((i+=u)<=n&&s.push(a),a+=u,i>=n)break}return s},Fr.getNthChildIdx=function(t,e,r){return Fr.getChildIdx(t,e)[r]},Fr.getIdxbyList=function(t,e,r,n){var i,o,s=Fr;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(o=s.getChildIdx(t,e)).length?-1:s.getIdxbyList(t,o[i],r,n)},Fr.getIdxbyListEx=function(t,e,r,n){var i,o,s=Fr;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),o=s.getChildIdx(t,e);for(var a=0,u=0;u<o.length;u++){var c=t.substr(o[u],2);if(\"number\"==typeof i&&!s.isContextTag(c)&&a==i||\"string\"==typeof i&&s.isContextTag(c,i))return s.getIdxbyListEx(t,o[u],r,n);s.isContextTag(c)||a++}return-1},Fr.getTLVbyList=function(t,e,r,n){var i=Fr,o=i.getIdxbyList(t,e,r,n);return-1==o||o>=t.length?null:i.getTLV(t,o)},Fr.getTLVbyListEx=function(t,e,r,n){var i=Fr,o=i.getIdxbyListEx(t,e,r,n);return-1==o?null:i.getTLV(t,o)},Fr.getVbyList=function(t,e,r,n,i){var o,s,a=Fr;return-1==(o=a.getIdxbyList(t,e,r,n))||o>=t.length?null:(s=a.getV(t,o),!0===i&&(s=s.substr(2)),s)},Fr.getVbyListEx=function(t,e,r,n,i){var o,s,a=Fr;return-1==(o=a.getIdxbyListEx(t,e,r,n))?null:(s=a.getV(t,o),\"03\"==t.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},Fr.getInt=function(t,e,r){null==r&&(r=-1);try{var n=t.substr(e,2);if(\"02\"!=n&&\"03\"!=n)return r;var i=Fr.getV(t,e);return\"02\"==n?parseInt(i,16):function o(t){try{var e=t.substr(0,2);if(\"00\"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16),n=t.substr(2),i=parseInt(n,16).toString(2);return\"0\"==i&&(i=\"00000000\"),i=i.slice(0,0-r),parseInt(i,2)}catch(t){return-1}}(i)}catch(t){return r}},Fr.getOID=function(t,e,r){null==r&&(r=null);try{return\"06\"!=t.substr(e,2)?r:function n(t){if(!Xr(t))return null;try{var e=[],r=t.substr(0,2),n=parseInt(r,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var i=t.substr(2),o=[],s=0;s<i.length/2;s++)o.push(parseInt(i.substr(2*s,2),16));var a=[],u=\"\";for(s=0;s<o.length;s++)128&o[s]?u+=Qr((127&o[s]).toString(2),7):(u+=Qr((127&o[s]).toString(2),7),a.push(new String(parseInt(u,2))),u=\"\");var c=e.join(\".\");return a.length>0&&(c=c+\".\"+a.join(\".\")),c}catch(t){return null}}(Fr.getV(t,e))}catch(t){return r}},Fr.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=Fr.getOID(t,e,r);if(n==r)return r;var i=Sr.asn1.x509.OID.oid2name(n);return\"\"==i?n:i}catch(t){return r}},Fr.getString=function(t,e,r){null==r&&(r=null);try{return Lr(Fr.getV(t,e))}catch(t){return r}},Fr.hextooidstr=function(t){var e=function t(e,r){return e.length>=r?e:new Array(r-e.length+1).join(\"0\")+e},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var o=t.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(2*a,2),16));var u=[],c=\"\";for(a=0;a<s.length;a++)128&s[a]?c+=e((127&s[a]).toString(2),7):(c+=e((127&s[a]).toString(2),7),u.push(new String(parseInt(c,2))),c=\"\");var h=r.join(\".\");return u.length>0&&(h=h+\".\"+u.join(\".\")),h},Fr.dump=function(t,e,r,n){var i=Fr,o=i.getV,s=i.dump,a=i.getChildIdx,u=t;t instanceof Sr.asn1.ASN1Object&&(u=t.getEncodedHex());var c=function t(e,r){return e.length<=2*r?e:e.substr(0,r)+\"..(total \"+e.length/2+\"bytes)..\"+e.substr(e.length-r,r)};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n=\"\");var h,l=e.ommit_long_octet;if(\"01\"==(h=u.substr(r,2)))return\"00\"==(f=o(u,r))?n+\"BOOLEAN FALSE\\n\":n+\"BOOLEAN TRUE\\n\";if(\"02\"==h)return n+\"INTEGER \"+c(f=o(u,r),l)+\"\\n\";if(\"03\"==h){var f=o(u,r);if(i.isASN1HEX(f.substr(2))){var g=n+\"BITSTRING, encapsulates\\n\";return g+=s(f.substr(2),e,0,n+\" \")}return n+\"BITSTRING \"+c(f,l)+\"\\n\"}if(\"04\"==h){f=o(u,r);if(i.isASN1HEX(f)){g=n+\"OCTETSTRING, encapsulates\\n\";return g+=s(f,e,0,n+\" \")}return n+\"OCTETSTRING \"+c(f,l)+\"\\n\"}if(\"05\"==h)return n+\"NULL\\n\";if(\"06\"==h){var d=o(u,r),p=Sr.asn1.ASN1Util.oidHexToInt(d),v=Sr.asn1.x509.OID.oid2name(p),y=p.replace(/\\./g,\" \");return\"\"!=v?n+\"ObjectIdentifier \"+v+\" (\"+y+\")\\n\":n+\"ObjectIdentifier (\"+y+\")\\n\"}if(\"0a\"==h)return n+\"ENUMERATED \"+parseInt(o(u,r))+\"\\n\";if(\"0c\"==h)return n+\"UTF8String '\"+Dr(o(u,r))+\"'\\n\";if(\"13\"==h)return n+\"PrintableString '\"+Dr(o(u,r))+\"'\\n\";if(\"14\"==h)return n+\"TeletexString '\"+Dr(o(u,r))+\"'\\n\";if(\"16\"==h)return n+\"IA5String '\"+Dr(o(u,r))+\"'\\n\";if(\"17\"==h)return n+\"UTCTime \"+Dr(o(u,r))+\"\\n\";if(\"18\"==h)return n+\"GeneralizedTime \"+Dr(o(u,r))+\"\\n\";if(\"1a\"==h)return n+\"VisualString '\"+Dr(o(u,r))+\"'\\n\";if(\"1e\"==h)return n+\"BMPString '\"+Yr(o(u,r))+\"'\\n\";if(\"30\"==h){if(\"3000\"==u.substr(r,4))return n+\"SEQUENCE {}\\n\";g=n+\"SEQUENCE\\n\";var m=e;if((2==(b=a(u,r)).length||3==b.length)&&\"06\"==u.substr(b[0],2)&&\"04\"==u.substr(b[b.length-1],2)){v=i.oidname(o(u,b[0]));var _=JSON.parse(JSON.stringify(e));_.x509ExtName=v,m=_}for(var S=0;S<b.length;S++)g+=s(u,m,b[S],n+\" \");return g}if(\"31\"==h){g=n+\"SET\\n\";var b=a(u,r);for(S=0;S<b.length;S++)g+=s(u,e,b[S],n+\" \");return g}if(0!=(128&(h=parseInt(h,16)))){var w=31&h;if(0!=(32&h)){for(g=n+\"[\"+w+\"]\\n\",b=a(u,r),S=0;S<b.length;S++)g+=s(u,e,b[S],n+\" \");return g}f=o(u,r);if(Fr.isASN1HEX(f)){var g=n+\"[\"+w+\"]\\n\";return g+=s(f,e,0,n+\" \")}return(\"68747470\"==f.substr(0,8)||\"subjectAltName\"===e.x509ExtName&&2==w)&&(f=Dr(f)),g=n+\"[\"+w+\"] \"+f+\"\\n\"}return n+\"UNKNOWN(\"+h+\") \"+o(u,r)+\"\\n\"},Fr.isContextTag=function(t,e){var r,n;t=t.toLowerCase();try{r=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&r);try{return null!=e.match(/^\\[[0-9]+\\]$/)&&(!((n=parseInt(e.substr(1,e.length-1),10))>31)&&(128==(192&r)&&(31&r)==n))}catch(t){return!1}},Fr.isASN1HEX=function(t){var e=Fr;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0);return t.length-n.length-i.length==2*r},Fr.checkStrictDER=function(t,e,r,n,i){var o=Fr;if(void 0===r){if(\"string\"!=typeof t)throw new Error(\"not hex string\");if(t=t.toLowerCase(),!Sr.lang.String.isHex(t))throw new Error(\"not hex string\");r=t.length,i=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(t,e).length>2*i)throw new Error(\"L of TLV too long: idx=\"+e);var s=o.getVblen(t,e);if(s>n)throw new Error(\"value of L too long than hex: idx=\"+e);var a=o.getTLV(t,e),u=a.length-2-o.getL(t,e).length;if(u!==2*s)throw new Error(\"V string length and L's value not the same:\"+u+\"/\"+2*s);if(0===e&&t.length!=a.length)throw new Error(\"total length and TLV length unmatch:\"+t.length+\"!=\"+a.length);var c=t.substr(e,2);if(\"02\"===c){var h=o.getVidx(t,e);if(\"00\"==t.substr(h,2)&&t.charCodeAt(h+2)<56)throw new Error(\"not least zeros for DER INTEGER\")}if(32&parseInt(c,16)){for(var l=o.getVblen(t,e),f=0,g=o.getChildIdx(t,e),d=0;d<g.length;d++){f+=o.getTLV(t,g[d]).length,o.checkStrictDER(t,g[d],r,n,i)}if(2*l!=f)throw new Error(\"sum of children's TLV length and L unmatch: \"+2*l+\"!=\"+f)}},Fr.oidname=function(t){var e=Sr.asn1;Sr.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var r=e.x509.OID.oid2name(t);return\"\"===r&&(r=t),r},void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.lang&&Sr.lang||(Sr.lang={}),Sr.lang.String=function(){},\"function\"==typeof t?(e.utf8tob64u=br=function e(r){return Pr(t.from(r,\"utf8\").toString(\"base64\"))},e.b64utoutf8=wr=function e(r){return t.from(Cr(r),\"base64\").toString(\"utf8\")}):(e.utf8tob64u=br=function t(e){return Tr(Kr(Gr(e)))},e.b64utoutf8=wr=function t(e){return decodeURIComponent(qr(Rr(e)))}),Sr.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},Sr.lang.String.isHex=function(t){return Xr(t)},Sr.lang.String.isBase64=function(t){return!(!(t=t.replace(/\\s+/g,\"\")).match(/^[0-9A-Za-z+\\/]+={0,3}$/)||t.length%4!=0)},Sr.lang.String.isBase64URL=function(t){return!t.match(/[+/=]/)&&(t=Cr(t),Sr.lang.String.isBase64(t))},Sr.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\\s+/g,\"\")).match(/^\\[[0-9,]+\\]$/)},Sr.lang.String.isPrintable=function(t){return null!==t.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},Sr.lang.String.isIA5=function(t){return null!==t.match(/^[\\x20-\\x21\\x23-\\x7f]*$/)},Sr.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\\.[A-Za-z0-9]{1,}$/)};var Qr=function t(e,r,n){return null==n&&(n=\"0\"),e.length>=r?e:new Array(r-e.length+1).join(n)+e};function Zr(t,e){var r=function t(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.crypto&&Sr.crypto||(Sr.crypto={}),Sr.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:\"3021300906052b0e03021a05000414\",sha224:\"302d300d06096086480165030402040500041c\",sha256:\"3031300d060960864801650304020105000420\",sha384:\"3041300d060960864801650304020205000430\",sha512:\"3051300d060960864801650304020305000440\",md2:\"3020300c06082a864886f70d020205000410\",md5:\"3020300c06082a864886f70d020505000410\",ripemd160:\"3021300906052b2403020105000414\"},this.DEFAULTPROVIDER={md5:\"cryptojs\",sha1:\"cryptojs\",sha224:\"cryptojs\",sha256:\"cryptojs\",sha384:\"cryptojs\",sha512:\"cryptojs\",ripemd160:\"cryptojs\",hmacmd5:\"cryptojs\",hmacsha1:\"cryptojs\",hmacsha224:\"cryptojs\",hmacsha256:\"cryptojs\",hmacsha384:\"cryptojs\",hmacsha512:\"cryptojs\",hmacripemd160:\"cryptojs\",MD5withRSA:\"cryptojs/jsrsa\",SHA1withRSA:\"cryptojs/jsrsa\",SHA224withRSA:\"cryptojs/jsrsa\",SHA256withRSA:\"cryptojs/jsrsa\",SHA384withRSA:\"cryptojs/jsrsa\",SHA512withRSA:\"cryptojs/jsrsa\",RIPEMD160withRSA:\"cryptojs/jsrsa\",MD5withECDSA:\"cryptojs/jsrsa\",SHA1withECDSA:\"cryptojs/jsrsa\",SHA224withECDSA:\"cryptojs/jsrsa\",SHA256withECDSA:\"cryptojs/jsrsa\",SHA384withECDSA:\"cryptojs/jsrsa\",SHA512withECDSA:\"cryptojs/jsrsa\",RIPEMD160withECDSA:\"cryptojs/jsrsa\",SHA1withDSA:\"cryptojs/jsrsa\",SHA224withDSA:\"cryptojs/jsrsa\",SHA256withDSA:\"cryptojs/jsrsa\",MD5withRSAandMGF1:\"cryptojs/jsrsa\",SHAwithRSAandMGF1:\"cryptojs/jsrsa\",SHA1withRSAandMGF1:\"cryptojs/jsrsa\",SHA224withRSAandMGF1:\"cryptojs/jsrsa\",SHA256withRSAandMGF1:\"cryptojs/jsrsa\",SHA384withRSAandMGF1:\"cryptojs/jsrsa\",SHA512withRSAandMGF1:\"cryptojs/jsrsa\",RIPEMD160withRSAandMGF1:\"cryptojs/jsrsa\"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:v.algo.MD5,sha1:v.algo.SHA1,sha224:v.algo.SHA224,sha256:v.algo.SHA256,sha384:v.algo.SHA384,sha512:v.algo.SHA512,ripemd160:v.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw\"alg not supported in Util.DIGESTINFOHEAD: \"+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw\"key is too short for SigAlg: keylen=\"+r+\",\"+e;for(var o=\"0001\",s=\"00\"+n,a=\"\",u=i-o.length-s.length,c=0;c<u;c+=2)a+=\"ff\";return o+a+s},this.hashString=function(t,e){return new Sr.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new Sr.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,\"sha1\")},this.sha256=function(t){return this.hashString(t,\"sha256\")},this.sha256Hex=function(t){return this.hashHex(t,\"sha256\")},this.sha512=function(t){return this.hashString(t,\"sha512\")},this.sha512Hex=function(t){return this.hashHex(t,\"sha512\")},this.isKey=function(t){return t instanceof Me||t instanceof Sr.crypto.DSA||t instanceof Sr.crypto.ECDSA}},Sr.crypto.Util.md5=function(t){return new Sr.crypto.MessageDigest({alg:\"md5\",prov:\"cryptojs\"}).digestString(t)},Sr.crypto.Util.ripemd160=function(t){return new Sr.crypto.MessageDigest({alg:\"ripemd160\",prov:\"cryptojs\"}).digestString(t)},Sr.crypto.Util.SECURERANDOMGEN=new Be,Sr.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return Sr.crypto.Util.SECURERANDOMGEN.nextBytes(e),Ar(e)},Sr.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new w(Sr.crypto.Util.getRandomHexOfNbytes(t),16)},Sr.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,r=new Array((t-e)/8+1);return Sr.crypto.Util.SECURERANDOMGEN.nextBytes(r),r[0]=(255<<e&255^255)&r[0],Ar(r)},Sr.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new w(Sr.crypto.Util.getRandomHexOfNbits(t),16)},Sr.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var r=Sr.crypto.Util.getRandomBigIntegerOfNbits(e);if(-1!=t.compareTo(r))return r}},Sr.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var r=t.compareTo(e);if(1==r)throw\"biMin is greater than biMax\";if(0==r)return t;var n=e.subtract(t);return Sr.crypto.Util.getRandomBigIntegerZeroToMax(n).add(t)},Sr.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=Sr.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=Sr.crypto.Util.DEFAULTPROVIDER[t]),-1!=\":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:\".indexOf(t)&&\"cryptojs\"==e){try{this.md=Sr.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw\"setAlgAndProvider hash alg set fail alg=\"+t+\"/\"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=v.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(v.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=\":sha256:\".indexOf(t)&&\"sjcl\"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw\"setAlgAndProvider hash alg set fail alg=\"+t+\"/\"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw\"updateString(str) not supported for this alg/prov: \"+this.algName+\"/\"+this.provName},this.updateHex=function(t){throw\"updateHex(hex) not supported for this alg/prov: \"+this.algName+\"/\"+this.provName},this.digest=function(){throw\"digest() not supported for this alg/prov: \"+this.algName+\"/\"+this.provName},this.digestString=function(t){throw\"digestString(str) not supported for this alg/prov: \"+this.algName+\"/\"+this.provName},this.digestHex=function(t){throw\"digestHex(hex) not supported for this alg/prov: \"+this.algName+\"/\"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=Sr.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},Sr.crypto.MessageDigest.getCanonicalAlgName=function(t){return\"string\"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,\"\")),t},Sr.crypto.MessageDigest.getHashLength=function(t){var e=Sr.crypto.MessageDigest,r=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[r])throw\"not supported algorithm: \"+t;return e.HASHLENGTH[r]},Sr.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},Sr.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t=\"hmacsha1\"),\"hmac\"!=(t=t.toLowerCase()).substr(0,4))throw\"setAlgAndProvider unsupported HMAC alg: \"+t;void 0===e&&(e=Sr.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+\"/\"+e;var r=t.substr(4);if(-1!=\":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:\".indexOf(r)&&\"cryptojs\"==e){try{var n=Sr.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[r];this.mac=v.algo.HMAC.create(n,this.pass)}catch(t){throw\"setAlgAndProvider hash alg set fail hashAlg=\"+r+\"/\"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=v.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(v.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw\"updateString(str) not supported for this alg/prov: \"+this.algProv},this.updateHex=function(t){throw\"updateHex(hex) not supported for this alg/prov: \"+this.algProv},this.doFinal=function(){throw\"digest() not supported for this alg/prov: \"+this.algProv},this.doFinalString=function(t){throw\"digestString(str) not supported for this alg/prov: \"+this.algProv},this.doFinalHex=function(t){throw\"digestHex(hex) not supported for this alg/prov: \"+this.algProv},this.setPassword=function(t){if(\"string\"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=Nr(t)),void(this.pass=v.enc.Hex.parse(e))}if(\"object\"!=(void 0===t?\"undefined\":g(t)))throw\"KJUR.crypto.Mac unsupported password type: \"+t;e=null;if(void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw\"Mac: wrong hex password: \"+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=Ir(t.utf8)),void 0!==t.rstr&&(e=Nr(t.rstr)),void 0!==t.b64&&(e=S(t.b64)),void 0!==t.b64u&&(e=Rr(t.b64u)),null==e)throw\"KJUR.crypto.Mac unsupported password type: \"+t;this.pass=v.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=Sr.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},Sr.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),\"rsaandmgf1\"==this.pubkeyAlgName&&\"sha\"==this.mdAlgName&&(this.mdAlgName=\"sha1\"))},this._zeroPaddingOfSignature=function(t,e){for(var r=\"\",n=e/4-t.length,i=0;i<n;i++)r+=\"0\";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),\"cryptojs/jsrsa\"!=e)throw new Error(\"provider not supported: \"+e);if(-1!=\":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:\".indexOf(this.mdAlgName)){try{this.md=new Sr.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error(\"setAlgAndProvider hash alg set fail alg=\"+this.mdAlgName+\"/\"+t)}this.init=function(t,e){var r=null;try{r=void 0===e?tn.getKey(t):tn.getKey(t,e)}catch(t){throw\"init failed:\"+t}if(!0===r.isPrivate)this.prvKey=r,this.state=\"SIGN\";else{if(!0!==r.isPublic)throw\"init failed.:\"+r;this.pubKey=r,this.state=\"VERIFY\"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==Sr.crypto.ECDSA&&(this.prvKey=new Sr.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof Me&&\"rsaandmgf1\"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof Me&&\"rsa\"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof Sr.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof Sr.crypto.DSA))throw\"Signature: unsupported private key alg: \"+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==Sr.crypto.ECDSA&&(this.pubKey=new Sr.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof Me&&\"rsaandmgf1\"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof Me&&\"rsa\"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==Sr.crypto.ECDSA&&this.pubKey instanceof Sr.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==Sr.crypto.DSA&&this.pubKey instanceof Sr.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw\"Signature: unsupported public key alg: \"+this.pubkeyAlgName}}},this.init=function(t,e){throw\"init(key, pass) not supported for this alg:prov=\"+this.algProvName},this.updateString=function(t){throw\"updateString(str) not supported for this alg:prov=\"+this.algProvName},this.updateHex=function(t){throw\"updateHex(hex) not supported for this alg:prov=\"+this.algProvName},this.sign=function(){throw\"sign() not supported for this alg:prov=\"+this.algProvName},this.signString=function(t){throw\"digestString(str) not supported for this alg:prov=\"+this.algProvName},this.signHex=function(t){throw\"digestHex(hex) not supported for this alg:prov=\"+this.algProvName},this.verify=function(t){throw\"verify(hSigVal) not supported for this alg:prov=\"+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=Sr.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+\":\"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw\"both prvkeypem and prvkeypas parameters not supported\";try{e=tn.getKey(t.prvkeypem);this.init(e)}catch(t){throw\"fatal error to load pem private key: \"+t}}},Sr.crypto.Cipher=function(t){},Sr.crypto.Cipher.encrypt=function(t,e,r){if(e instanceof Me&&e.isPublic){var n=Sr.crypto.Cipher.getAlgByKeyAndName(e,r);if(\"RSA\"===n)return e.encrypt(t);if(\"RSAOAEP\"===n)return e.encryptOAEP(t,\"sha1\");var i=n.match(/^RSAOAEP(\\d+)$/);if(null!==i)return e.encryptOAEP(t,\"sha\"+i[1]);throw\"Cipher.encrypt: unsupported algorithm for RSAKey: \"+r}throw\"Cipher.encrypt: unsupported key or algorithm\"},Sr.crypto.Cipher.decrypt=function(t,e,r){if(e instanceof Me&&e.isPrivate){var n=Sr.crypto.Cipher.getAlgByKeyAndName(e,r);if(\"RSA\"===n)return e.decrypt(t);if(\"RSAOAEP\"===n)return e.decryptOAEP(t,\"sha1\");var i=n.match(/^RSAOAEP(\\d+)$/);if(null!==i)return e.decryptOAEP(t,\"sha\"+i[1]);throw\"Cipher.decrypt: unsupported algorithm for RSAKey: \"+r}throw\"Cipher.decrypt: unsupported key or algorithm\"},Sr.crypto.Cipher.getAlgByKeyAndName=function(t,e){if(t instanceof Me){if(-1!=\":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:\".indexOf(e))return e;if(null==e)return\"RSA\";throw\"getAlgByKeyAndName: not supported algorithm name for RSAKey: \"+e}throw\"getAlgByKeyAndName: not supported algorithm name: \"+e},Sr.crypto.OID=new function(){this.oidhex2name={\"2a864886f70d010101\":\"rsaEncryption\",\"2a8648ce3d0201\":\"ecPublicKey\",\"2a8648ce380401\":\"dsa\",\"2a8648ce3d030107\":\"secp256r1\",\"2b8104001f\":\"secp192k1\",\"2b81040021\":\"secp224r1\",\"2b8104000a\":\"secp256k1\",\"2b81040023\":\"secp521r1\",\"2b81040022\":\"secp384r1\",\"2a8648ce380403\":\"SHA1withDSA\",\"608648016503040301\":\"SHA224withDSA\",\"608648016503040302\":\"SHA256withDSA\"}},void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.crypto&&Sr.crypto||(Sr.crypto={}),Sr.crypto.ECDSA=function(t){var e=Error,r=w,n=Ve,i=Sr.crypto.ECDSA,o=Sr.crypto.ECParameterDB,s=i.getName,a=Fr,u=a.getVbyListEx,c=a.isASN1HEX,h=new Be;this.type=\"EC\",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(t){return new r(t.bitLength(),h).mod(t.subtract(r.ONE)).add(r.ONE)},this.setNamedCurve=function(t){this.ecparams=o.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.getPublicKeyXYHex=function(){var t=this.pubKeyHex;if(\"04\"!==t.substr(0,2))throw\"this method supports uncompressed format(04) only\";var e=this.ecparams.keylen/4;if(t.length!==2+2*e)throw\"malformed public key hex length\";var r={};return r.x=t.substr(2,e),r.y=t.substr(2+e),r},this.getShortNISTPCurveName=function(){var t=this.curveName;return\"secp256r1\"===t||\"NIST P-256\"===t||\"P-256\"===t||\"prime256v1\"===t?\"P-256\":\"secp384r1\"===t||\"NIST P-384\"===t||\"P-384\"===t?\"P-384\":null},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),r=this.ecparams.G.multiply(e),n=r.getX().toBigInteger(),i=r.getY().toBigInteger(),o=this.ecparams.keylen/4,s=(\"0000000000\"+e.toString(16)).slice(-o),a=\"04\"+(\"0000000000\"+n.toString(16)).slice(-o)+(\"0000000000\"+i.toString(16)).slice(-o);return this.setPrivateKeyHex(s),this.setPublicKeyHex(a),{ecprvhex:s,ecpubhex:a}},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var n=new r(e,16),o=this.ecparams.n,s=new r(t.substring(0,this.ecparams.keylen/4),16);do{var a=this.getBigRandom(o),u=this.ecparams.G.multiply(a).getX().toBigInteger().mod(o)}while(u.compareTo(r.ZERO)<=0);var c=a.modInverse(o).multiply(s.add(n.multiply(u))).mod(o);return i.biRSSigToASN1Sig(u,c)},this.sign=function(t,e){var n=e,i=this.ecparams.n,o=r.fromByteArrayUnsigned(t);do{var s=this.getBigRandom(i),a=this.ecparams.G.multiply(s).getX().toBigInteger().mod(i)}while(a.compareTo(w.ZERO)<=0);var u=s.modInverse(i).multiply(o.add(n.multiply(a))).mod(i);return this.serializeSig(a,u)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,o){try{var s,a,u=i.parseSigHex(e);s=u.r,a=u.s;var c=n.decodeFromHex(this.ecparams.curve,o),h=new r(t.substring(0,this.ecparams.keylen/4),16);return this.verifyRaw(h,s,a,c)}catch(t){return!1}},this.verify=function(t,e,i){var o,s,a;if(Bitcoin.Util.isArray(e)){var u=this.parseSig(e);o=u.r,s=u.s}else{if(\"object\"!==(void 0===e?\"undefined\":g(e))||!e.r||!e.s)throw\"Invalid value for signature\";o=e.r,s=e.s}if(i instanceof Ve)a=i;else{if(!Bitcoin.Util.isArray(i))throw\"Invalid format for pubkey value, must be byte array or ECPointFp\";a=n.decodeFrom(this.ecparams.curve,i)}var c=r.fromByteArrayUnsigned(t);return this.verifyRaw(c,o,s,a)},this.verifyRaw=function(t,e,n,i){var o=this.ecparams.n,s=this.ecparams.G;if(e.compareTo(r.ONE)<0||e.compareTo(o)>=0)return!1;if(n.compareTo(r.ONE)<0||n.compareTo(o)>=0)return!1;var a=n.modInverse(o),u=t.multiply(a).mod(o),c=e.multiply(a).mod(o);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(o).equals(e)},this.serializeSig=function(t,e){var r=t.toByteArraySigned(),n=e.toByteArraySigned(),i=[];return i.push(2),i.push(r.length),(i=i.concat(r)).push(2),i.push(n.length),(i=i.concat(n)).unshift(i.length),i.unshift(48),i},this.parseSig=function(t){var e;if(48!=t[0])throw new Error(\"Signature not a valid DERSequence\");if(2!=t[e=2])throw new Error(\"First element in signature must be a DERInteger\");var n=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error(\"Second element in signature must be a DERInteger\");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:r.fromByteArrayUnsigned(n),s:r.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw\"Signature has the wrong length\";var e=t[0]-27;if(e<0||e>7)throw\"Invalid signature type\";var n=this.ecparams.n;return{r:r.fromByteArrayUnsigned(t.slice(1,33)).mod(n),s:r.fromByteArrayUnsigned(t.slice(33,65)).mod(n),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===c(t))throw new Error(\"not ASN.1 hex string\");var e,r,n;try{e=u(t,0,[\"[0]\",0],\"06\"),r=u(t,0,[1],\"04\");try{n=u(t,0,[\"[1]\",0],\"03\")}catch(t){}}catch(t){throw new Error(\"malformed PKCS#1/5 plain ECC private key\")}if(this.curveName=s(e),void 0===this.curveName)throw\"unsupported curve name\";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===c(t))throw new e(\"not ASN.1 hex string\");var r,n,i;try{u(t,0,[1,0],\"06\"),r=u(t,0,[1,1],\"06\"),n=u(t,0,[2,0,1],\"04\");try{i=u(t,0,[2,0,\"[1]\",0],\"03\")}catch(t){}}catch(t){throw new e(\"malformed PKCS#8 plain ECC private key\")}if(this.curveName=s(r),void 0===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===c(t))throw new e(\"not ASN.1 hex string\");var r,n;try{u(t,0,[0,0],\"06\"),r=u(t,0,[0,1],\"06\"),n=u(t,0,[1],\"03\")}catch(t){throw new e(\"malformed PKCS#8 ECC public key\")}if(this.curveName=s(r),null===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,r){if(!1===c(t))throw new e(\"not ASN.1 hex string\");var n,i;try{n=u(t,0,[0,5,0,1],\"06\"),i=u(t,0,[0,5,1],\"03\")}catch(t){throw new e(\"malformed X.509 certificate ECC public key\")}if(this.curveName=s(n),null===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName=\"secp256r1\"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},Sr.crypto.ECDSA.parseSigHex=function(t){var e=Sr.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new w(e.r,16),s:new w(e.s,16)}},Sr.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=Fr,r=e.getChildIdx,n=e.getV;if(e.checkStrictDER(t,0),\"30\"!=t.substr(0,2))throw new Error(\"signature is not a ASN.1 sequence\");var i=r(t,0);if(2!=i.length)throw new Error(\"signature shall have two elements\");var o=i[0],s=i[1];if(\"02\"!=t.substr(o,2))throw new Error(\"1st item not ASN.1 integer\");if(\"02\"!=t.substr(s,2))throw new Error(\"2nd item not ASN.1 integer\");return{r:n(t,o),s:n(t,s)}},Sr.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=Sr.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if(\"00\"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),\"00\"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r=\"00\"+r),n.length%32==30&&(n=\"00\"+n),r.length%32!=0)throw\"unknown ECDSA sig r length error\";if(n.length%32!=0)throw\"unknown ECDSA sig s length error\";return r+n},Sr.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw\"unknown ECDSA concatinated r-s sig length error\";var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return Sr.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},Sr.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new w(t,16),n=new w(e,16);return Sr.crypto.ECDSA.biRSSigToASN1Sig(r,n)},Sr.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=Sr.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).getEncodedHex()},Sr.crypto.ECDSA.getName=function(t){return\"2b8104001f\"===t?\"secp192k1\":\"2a8648ce3d030107\"===t?\"secp256r1\":\"2b8104000a\"===t?\"secp256k1\":\"2b81040021\"===t?\"secp224r1\":\"2b81040022\"===t?\"secp384r1\":-1!==\"|secp256r1|NIST P-256|P-256|prime256v1|\".indexOf(t)?\"secp256r1\":-1!==\"|secp256k1|\".indexOf(t)?\"secp256k1\":-1!==\"|secp224r1|NIST P-224|P-224|\".indexOf(t)?\"secp224r1\":-1!==\"|secp384r1|NIST P-384|P-384|\".indexOf(t)?\"secp384r1\":null},void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.crypto&&Sr.crypto||(Sr.crypto={}),Sr.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new w(t,16)}this.getByName=function(r){var n=r;if(void 0!==e[n]&&(n=e[r]),void 0!==t[n])return t[n];throw\"unregistered EC curve name: \"+n},this.regist=function(n,i,o,s,a,u,c,h,l,f,g,d){t[n]={};var p=r(o),v=r(s),y=r(a),m=r(u),_=r(c),S=new Ke(p,v,y),b=S.decodePointHex(\"04\"+h+l);t[n].name=n,t[n].keylen=i,t[n].curve=S,t[n].G=b,t[n].n=m,t[n].h=_,t[n].oid=g,t[n].info=d;for(var w=0;w<f.length;w++)e[f[w]]=n}},Sr.crypto.ECParameterDB.regist(\"secp128r1\",128,\"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF\",\"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC\",\"E87579C11079F43DD824993C2CEE5ED3\",\"FFFFFFFE0000000075A30D1B9038A115\",\"1\",\"161FF7528B899B2D0C28607CA52C5B86\",\"CF5AC8395BAFEB13C02DA292DDED7A83\",[],\"\",\"secp128r1 : SECG curve over a 128 bit prime field\"),Sr.crypto.ECParameterDB.regist(\"secp160k1\",160,\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73\",\"0\",\"7\",\"0100000000000000000001B8FA16DFAB9ACA16B6B3\",\"1\",\"3B4C382CE37AA192A4019E763036F4F5DD4D7EBB\",\"938CF935318FDCED6BC28286531733C3F03C4FEE\",[],\"\",\"secp160k1 : SECG curve over a 160 bit prime field\"),Sr.crypto.ECParameterDB.regist(\"secp160r1\",160,\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF\",\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC\",\"1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45\",\"0100000000000000000001F4C8F927AED3CA752257\",\"1\",\"4A96B5688EF573284664698968C38BB913CBFC82\",\"23A628553168947D59DCC912042351377AC5FB32\",[],\"\",\"secp160r1 : SECG curve over a 160 bit prime field\"),Sr.crypto.ECParameterDB.regist(\"secp192k1\",192,\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37\",\"0\",\"3\",\"FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D\",\"1\",\"DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D\",\"9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D\",[]),Sr.crypto.ECParameterDB.regist(\"secp192r1\",192,\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF\",\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC\",\"64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1\",\"FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831\",\"1\",\"188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012\",\"07192B95FFC8DA78631011ED6B24CDD573F977A11E794811\",[]),Sr.crypto.ECParameterDB.regist(\"secp224r1\",224,\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001\",\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE\",\"B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4\",\"FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D\",\"1\",\"B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21\",\"BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34\",[]),Sr.crypto.ECParameterDB.regist(\"secp256k1\",256,\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F\",\"0\",\"7\",\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141\",\"1\",\"79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798\",\"483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8\",[]),Sr.crypto.ECParameterDB.regist(\"secp256r1\",256,\"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF\",\"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC\",\"5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B\",\"FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551\",\"1\",\"6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296\",\"4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5\",[\"NIST P-256\",\"P-256\",\"prime256v1\"]),Sr.crypto.ECParameterDB.regist(\"secp384r1\",384,\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF\",\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC\",\"B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF\",\"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973\",\"1\",\"AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7\",\"3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f\",[\"NIST P-384\",\"P-384\"]),Sr.crypto.ECParameterDB.regist(\"secp521r1\",521,\"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\",\"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC\",\"051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00\",\"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409\",\"1\",\"C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66\",\"011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650\",[\"NIST P-521\",\"P-521\"]);var tn=function(){var t=function t(r,n,i){return e(v.AES,r,n,i)},e=function t(e,r,n,i){var o=v.enc.Hex.parse(r),s=v.enc.Hex.parse(n),a=v.enc.Hex.parse(i),u={};u.key=s,u.iv=a,u.ciphertext=o;var c=e.decrypt(u,s,{iv:a});return v.enc.Hex.stringify(c)},r=function t(e,r,i){return n(v.AES,e,r,i)},n=function t(e,r,n,i){var o=v.enc.Hex.parse(r),s=v.enc.Hex.parse(n),a=v.enc.Hex.parse(i),u=e.encrypt(o,s,{iv:a}),c=v.enc.Hex.parse(u.toString());return v.enc.Base64.stringify(c)},i={\"AES-256-CBC\":{proc:t,eproc:r,keylen:32,ivlen:16},\"AES-192-CBC\":{proc:t,eproc:r,keylen:24,ivlen:16},\"AES-128-CBC\":{proc:t,eproc:r,keylen:16,ivlen:16},\"DES-EDE3-CBC\":{proc:function t(r,n,i){return e(v.TripleDES,r,n,i)},eproc:function t(e,r,i){return n(v.TripleDES,e,r,i)},keylen:24,ivlen:8},\"DES-CBC\":{proc:function t(r,n,i){return e(v.DES,r,n,i)},eproc:function t(e,r,i){return n(v.DES,e,r,i)},keylen:8,ivlen:8}},o=function t(e){var r={},n=e.match(new RegExp(\"DEK-Info: ([^,]+),([0-9A-Fa-f]+)\",\"m\"));n&&(r.cipher=n[1],r.ivsalt=n[2]);var i=e.match(new RegExp(\"-----BEGIN ([A-Z]+) PRIVATE KEY-----\"));i&&(r.type=i[1]);var o=-1,s=0;-1!=e.indexOf(\"\\r\\n\\r\\n\")&&(o=e.indexOf(\"\\r\\n\\r\\n\"),s=2),-1!=e.indexOf(\"\\n\\n\")&&(o=e.indexOf(\"\\n\\n\"),s=1);var a=e.indexOf(\"-----END\");if(-1!=o&&-1!=a){var u=e.substring(o+2*s,a-s);u=u.replace(/\\s+/g,\"\"),r.data=u}return r},s=function t(e,r,n){for(var o=n.substring(0,16),s=v.enc.Hex.parse(o),a=v.enc.Utf8.parse(r),u=i[e].keylen+i[e].ivlen,c=\"\",h=null;;){var l=v.algo.MD5.create();if(null!=h&&l.update(h),l.update(a),l.update(s),h=l.finalize(),(c+=v.enc.Hex.stringify(h)).length>=2*u)break}var f={};return f.keyhex=c.substr(0,2*i[e].keylen),f.ivhex=c.substr(2*i[e].keylen,2*i[e].ivlen),f},a=function t(e,r,n,o){var s=v.enc.Base64.parse(e),a=v.enc.Hex.stringify(s);return(0,i[r].proc)(a,n,o)};return{version:\"1.0.0\",parsePKCS5PEM:function t(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function t(e,r,n){return s(e,r,n)},decryptKeyB64:function t(e,r,n,i){return a(e,r,n,i)},getDecryptedKeyHex:function t(e,r){var n=o(e),i=(n.type,n.cipher),u=n.ivsalt,c=n.data,h=s(i,r,u).keyhex;return a(c,i,h,u)},getEncryptedPKCS5PEMFromPrvKeyHex:function t(e,r,n,o,a){var u=\"\";if(void 0!==o&&null!=o||(o=\"AES-256-CBC\"),void 0===i[o])throw new Error(\"KEYUTIL unsupported algorithm: \"+o);void 0!==a&&null!=a||(a=function t(e){var r=v.lib.WordArray.random(e);return v.enc.Hex.stringify(r)}(i[o].ivlen).toUpperCase());var c=function t(e,r,n,o){return(0,i[r].eproc)(e,n,o)}(r,o,s(o,n,a).keyhex,a);u=\"-----BEGIN \"+e+\" PRIVATE KEY-----\\r\\n\";return u+=\"Proc-Type: 4,ENCRYPTED\\r\\n\",u+=\"DEK-Info: \"+o+\",\"+a+\"\\r\\n\",u+=\"\\r\\n\",u+=c.replace(/(.{64})/g,\"$1\\r\\n\"),u+=\"\\r\\n-----END \"+e+\" PRIVATE KEY-----\\r\\n\"},parseHexOfEncryptedPKCS8:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={},s=n(e,0);if(2!=s.length)throw new Error(\"malformed format: SEQUENCE(0).items != 2: \"+s.length);o.ciphertext=i(e,s[1]);var a=n(e,s[0]);if(2!=a.length)throw new Error(\"malformed format: SEQUENCE(0.0).items != 2: \"+a.length);if(\"2a864886f70d01050d\"!=i(e,a[0]))throw new Error(\"this only supports pkcs5PBES2\");var u=n(e,a[1]);if(2!=a.length)throw new Error(\"malformed format: SEQUENCE(0.0.1).items != 2: \"+u.length);var c=n(e,u[1]);if(2!=c.length)throw new Error(\"malformed format: SEQUENCE(0.0.1.1).items != 2: \"+c.length);if(\"2a864886f70d0307\"!=i(e,c[0]))throw\"this only supports TripleDES\";o.encryptionSchemeAlg=\"TripleDES\",o.encryptionSchemeIV=i(e,c[1]);var h=n(e,u[0]);if(2!=h.length)throw new Error(\"malformed format: SEQUENCE(0.0.1.0).items != 2: \"+h.length);if(\"2a864886f70d01050c\"!=i(e,h[0]))throw new Error(\"this only supports pkcs5PBKDF2\");var l=n(e,h[1]);if(l.length<2)throw new Error(\"malformed format: SEQUENCE(0.0.1.0.1).items < 2: \"+l.length);o.pbkdf2Salt=i(e,l[0]);var f=i(e,l[1]);try{o.pbkdf2Iter=parseInt(f,16)}catch(t){throw new Error(\"malformed format pbkdf2Iter: \"+f)}return o},getPBKDF2KeyHexFromParam:function t(e,r){var n=v.enc.Hex.parse(e.pbkdf2Salt),i=e.pbkdf2Iter,o=v.PBKDF2(r,n,{keySize:6,iterations:i});return v.enc.Hex.stringify(o)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function t(e,r){var n=Mr(e,\"ENCRYPTED PRIVATE KEY\"),i=this.parseHexOfEncryptedPKCS8(n),o=tn.getPBKDF2KeyHexFromParam(i,r),s={};s.ciphertext=v.enc.Hex.parse(i.ciphertext);var a=v.enc.Hex.parse(o),u=v.enc.Hex.parse(i.encryptionSchemeIV),c=v.TripleDES.decrypt(s,a,{iv:u});return v.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function t(e,r){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,r);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={algparam:null};if(\"30\"!=e.substr(0,2))throw new Error(\"malformed plain PKCS8 private key(code:001)\");var s=n(e,0);if(s.length<3)throw new Error(\"malformed plain PKCS8 private key(code:002)\");if(\"30\"!=e.substr(s[1],2))throw new Error(\"malformed PKCS8 private key(code:003)\");var a=n(e,s[1]);if(2!=a.length)throw new Error(\"malformed PKCS8 private key(code:004)\");if(\"06\"!=e.substr(a[0],2))throw new Error(\"malformed PKCS8 private key(code:005)\");if(o.algoid=i(e,a[0]),\"06\"==e.substr(a[1],2)&&(o.algparam=i(e,a[1])),\"04\"!=e.substr(s[2],2))throw new Error(\"malformed PKCS8 private key(code:006)\");return o.keyidx=r.getVidx(e,s[2]),o},getKeyFromPlainPrivatePKCS8PEM:function t(e){var r=Mr(e,\"PRIVATE KEY\");return this.getKeyFromPlainPrivatePKCS8Hex(r)},getKeyFromPlainPrivatePKCS8Hex:function t(e){var r,n=this.parsePlainPrivatePKCS8Hex(e);if(\"2a864886f70d010101\"==n.algoid)r=new Me;else if(\"2a8648ce380401\"==n.algoid)r=new Sr.crypto.DSA;else{if(\"2a8648ce3d0201\"!=n.algoid)throw new Error(\"unsupported private key algorithm\");r=new Sr.crypto.ECDSA}return r.readPKCS8PrvKeyHex(e),r},_getKeyFromPublicPKCS8Hex:function t(e){var r,n=Fr.getVbyList(e,0,[0,0],\"06\");if(\"2a864886f70d010101\"===n)r=new Me;else if(\"2a8648ce380401\"===n)r=new Sr.crypto.DSA;else{if(\"2a8648ce3d0201\"!==n)throw new Error(\"unsupported PKCS#8 public key hex\");r=new Sr.crypto.ECDSA}return r.readPKCS8PubKeyHex(e),r},parsePublicRawRSAKeyHex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={};if(\"30\"!=e.substr(0,2))throw new Error(\"malformed RSA key(code:001)\");var s=n(e,0);if(2!=s.length)throw new Error(\"malformed RSA key(code:002)\");if(\"02\"!=e.substr(s[0],2))throw new Error(\"malformed RSA key(code:003)\");if(o.n=i(e,s[0]),\"02\"!=e.substr(s[1],2))throw new Error(\"malformed RSA key(code:004)\");return o.e=i(e,s[1]),o},parsePublicPKCS8Hex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={algparam:null},s=n(e,0);if(2!=s.length)throw new Error(\"outer DERSequence shall have 2 elements: \"+s.length);var a=s[0];if(\"30\"!=e.substr(a,2))throw new Error(\"malformed PKCS8 public key(code:001)\");var u=n(e,a);if(2!=u.length)throw new Error(\"malformed PKCS8 public key(code:002)\");if(\"06\"!=e.substr(u[0],2))throw new Error(\"malformed PKCS8 public key(code:003)\");if(o.algoid=i(e,u[0]),\"06\"==e.substr(u[1],2)?o.algparam=i(e,u[1]):\"30\"==e.substr(u[1],2)&&(o.algparam={},o.algparam.p=r.getVbyList(e,u[1],[0],\"02\"),o.algparam.q=r.getVbyList(e,u[1],[1],\"02\"),o.algparam.g=r.getVbyList(e,u[1],[2],\"02\")),\"03\"!=e.substr(s[1],2))throw new Error(\"malformed PKCS8 public key(code:004)\");return o.key=i(e,s[1]).substr(2),o}}}();tn.getKey=function(t,e,r){var n=(v=Fr).getChildIdx,i=(v.getV,v.getVbyList),o=Sr.crypto,s=o.ECDSA,a=o.DSA,u=Me,c=Mr,h=tn;if(void 0!==u&&t instanceof u)return t;if(void 0!==s&&t instanceof s)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new s({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new s({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(P=new u).setPublic(t.n,t.e),P;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(P=new u).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),P;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(P=new u).setPrivate(t.n,t.e,t.d),P;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(P=new a).setPublic(t.p,t.q,t.g,t.y),P;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(P=new a).setPrivate(t.p,t.q,t.g,t.y,t.x),P;if(\"RSA\"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(P=new u).setPublic(Rr(t.n),Rr(t.e)),P;if(\"RSA\"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(P=new u).setPrivateEx(Rr(t.n),Rr(t.e),Rr(t.d),Rr(t.p),Rr(t.q),Rr(t.dp),Rr(t.dq),Rr(t.qi)),P;if(\"RSA\"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(P=new u).setPrivate(Rr(t.n),Rr(t.e),Rr(t.d)),P;if(\"EC\"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var l=(k=new s({curve:t.crv})).ecparams.keylen/4,f=\"04\"+(\"0000000000\"+Rr(t.x)).slice(-l)+(\"0000000000\"+Rr(t.y)).slice(-l);return k.setPublicKeyHex(f),k}if(\"EC\"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(k=new s({curve:t.crv})).ecparams.keylen/4,f=\"04\"+(\"0000000000\"+Rr(t.x)).slice(-l)+(\"0000000000\"+Rr(t.y)).slice(-l);var g=(\"0000000000\"+Rr(t.d)).slice(-l);return k.setPublicKeyHex(f),k.setPrivateKeyHex(g),k}if(\"pkcs5prv\"===r){var d,p=t,v=Fr;if(9===(d=n(p,0)).length)(P=new u).readPKCS5PrvKeyHex(p);else if(6===d.length)(P=new a).readPKCS5PrvKeyHex(p);else{if(!(d.length>2&&\"04\"===p.substr(d[1],2)))throw new Error(\"unsupported PKCS#1/5 hexadecimal key\");(P=new s).readPKCS5PrvKeyHex(p)}return P}if(\"pkcs8prv\"===r)return P=h.getKeyFromPlainPrivatePKCS8Hex(t);if(\"pkcs8pub\"===r)return h._getKeyFromPublicPKCS8Hex(t);if(\"x509pub\"===r)return on.getPublicKeyFromCertHex(t);if(-1!=t.indexOf(\"-END CERTIFICATE-\",0)||-1!=t.indexOf(\"-END X509 CERTIFICATE-\",0)||-1!=t.indexOf(\"-END TRUSTED CERTIFICATE-\",0))return on.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf(\"-END PUBLIC KEY-\")){var y=Mr(t,\"PUBLIC KEY\");return h._getKeyFromPublicPKCS8Hex(y)}if(-1!=t.indexOf(\"-END RSA PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){var m=c(t,\"RSA PRIVATE KEY\");return h.getKey(m,null,\"pkcs5prv\")}if(-1!=t.indexOf(\"-END DSA PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){var _=i(R=c(t,\"DSA PRIVATE KEY\"),0,[1],\"02\"),S=i(R,0,[2],\"02\"),b=i(R,0,[3],\"02\"),F=i(R,0,[4],\"02\"),E=i(R,0,[5],\"02\");return(P=new a).setPrivate(new w(_,16),new w(S,16),new w(b,16),new w(F,16),new w(E,16)),P}if(-1!=t.indexOf(\"-END EC PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){m=c(t,\"EC PRIVATE KEY\");return h.getKey(m,null,\"pkcs5prv\")}if(-1!=t.indexOf(\"-END PRIVATE KEY-\"))return h.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf(\"-END RSA PRIVATE KEY-\")&&-1!=t.indexOf(\"4,ENCRYPTED\")){var x=h.getDecryptedKeyHex(t,e),A=new Me;return A.readPKCS5PrvKeyHex(x),A}if(-1!=t.indexOf(\"-END EC PRIVATE KEY-\")&&-1!=t.indexOf(\"4,ENCRYPTED\")){var k,P=i(R=h.getDecryptedKeyHex(t,e),0,[1],\"04\"),C=i(R,0,[2,0],\"06\"),T=i(R,0,[3,0],\"03\").substr(2);if(void 0===Sr.crypto.OID.oidhex2name[C])throw new Error(\"undefined OID(hex) in KJUR.crypto.OID: \"+C);return(k=new s({curve:Sr.crypto.OID.oidhex2name[C]})).setPublicKeyHex(T),k.setPrivateKeyHex(P),k.isPublic=!1,k}if(-1!=t.indexOf(\"-END DSA PRIVATE KEY-\")&&-1!=t.indexOf(\"4,ENCRYPTED\")){var R;_=i(R=h.getDecryptedKeyHex(t,e),0,[1],\"02\"),S=i(R,0,[2],\"02\"),b=i(R,0,[3],\"02\"),F=i(R,0,[4],\"02\"),E=i(R,0,[5],\"02\");return(P=new a).setPrivate(new w(_,16),new w(S,16),new w(b,16),new w(F,16),new w(E,16)),P}if(-1!=t.indexOf(\"-END ENCRYPTED PRIVATE KEY-\"))return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error(\"not supported argument\")},tn.generateKeypair=function(t,e){if(\"RSA\"==t){var r=e;(s=new Me).generate(r,\"10001\"),s.isPrivate=!0,s.isPublic=!0;var n=new Me,i=s.n.toString(16),o=s.e.toString(16);return n.setPublic(i,o),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}if(\"EC\"==t){var s,a,u=e,c=new Sr.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new Sr.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(n=new Sr.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}throw new Error(\"unknown algorithm: \"+t)},tn.getPEM=function(t,e,r,n,i,o){var s=Sr,a=s.asn1,u=a.DERObjectIdentifier,c=a.DERInteger,h=a.ASN1Util.newObject,l=a.x509.SubjectPublicKeyInfo,f=s.crypto,g=f.DSA,d=f.ECDSA,p=Me;function y(t){return h({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function m(t){return h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:[\"a0\",!0,{oid:{name:t.curveName}}]},{tag:[\"a1\",!0,{bitstr:{hex:\"00\"+t.pubKeyHex}}]}]})}function _(t){return h({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==p&&t instanceof p||void 0!==g&&t instanceof g||void 0!==d&&t instanceof d)&&1==t.isPublic&&(void 0===e||\"PKCS8PUB\"==e))return jr(F=new l(t).getEncodedHex(),\"PUBLIC KEY\");if(\"PKCS1PRV\"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return jr(F=y(t).getEncodedHex(),\"RSA PRIVATE KEY\");if(\"PKCS1PRV\"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate){var S=new u({name:t.curveName}).getEncodedHex(),b=m(t).getEncodedHex(),w=\"\";return w+=jr(S,\"EC PARAMETERS\"),w+=jr(b,\"EC PRIVATE KEY\")}if(\"PKCS1PRV\"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate)return jr(F=_(t).getEncodedHex(),\"DSA PRIVATE KEY\");if(\"PKCS5PRV\"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate){var F=y(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"RSA\",F,r,n,o)}if(\"PKCS5PRV\"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate){F=m(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"EC\",F,r,n,o)}if(\"PKCS5PRV\"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate){F=_(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"DSA\",F,r,n,o)}var E=function t(e,r){var n=x(e,r);return new h({seq:[{seq:[{oid:{name:\"pkcs5PBES2\"}},{seq:[{seq:[{oid:{name:\"pkcs5PBKDF2\"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:\"des-EDE3-CBC\"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},x=function t(e,r){var n=v.lib.WordArray.random(8),i=v.lib.WordArray.random(8),o=v.PBKDF2(r,n,{keySize:6,iterations:100}),s=v.enc.Hex.parse(e),a=v.TripleDES.encrypt(s,o,{iv:i})+\"\",u={};return u.ciphertext=a,u.pbkdf2Salt=v.enc.Hex.stringify(n),u.pbkdf2Iter=100,u.encryptionSchemeAlg=\"DES-EDE3-CBC\",u.encryptionSchemeIV=v.enc.Hex.stringify(i),u};if(\"PKCS8PRV\"==e&&null!=p&&t instanceof p&&1==t.isPrivate){var A=y(t).getEncodedHex();F=h({seq:[{int:0},{seq:[{oid:{name:\"rsaEncryption\"}},{null:!0}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,\"PRIVATE KEY\"):jr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}if(\"PKCS8PRV\"==e&&void 0!==d&&t instanceof d&&1==t.isPrivate){A=new h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:[\"a1\",!0,{bitstr:{hex:\"00\"+t.pubKeyHex}}]}]}).getEncodedHex(),F=h({seq:[{int:0},{seq:[{oid:{name:\"ecPublicKey\"}},{oid:{name:t.curveName}}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,\"PRIVATE KEY\"):jr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}if(\"PKCS8PRV\"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){A=new c({bigint:t.x}).getEncodedHex(),F=h({seq:[{int:0},{seq:[{oid:{name:\"dsa\"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,\"PRIVATE KEY\"):jr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}throw new Error(\"unsupported object nor format\")},tn.getKeyFromCSRPEM=function(t){var e=Mr(t,\"CERTIFICATE REQUEST\");return tn.getKeyFromCSRHex(e)},tn.getKeyFromCSRHex=function(t){var e=tn.parseCSRHex(t);return tn.getKey(e.p8pubkeyhex,null,\"pkcs8pub\")},tn.parseCSRHex=function(t){var e=Fr,r=e.getChildIdx,n=e.getTLV,i={},o=t;if(\"30\"!=o.substr(0,2))throw new Error(\"malformed CSR(code:001)\");var s=r(o,0);if(s.length<1)throw new Error(\"malformed CSR(code:002)\");if(\"30\"!=o.substr(s[0],2))throw new Error(\"malformed CSR(code:003)\");var a=r(o,s[0]);if(a.length<3)throw new Error(\"malformed CSR(code:004)\");return i.p8pubkeyhex=n(o,a[2]),i},tn.getKeyID=function(t){var e=tn,r=Fr;\"string\"==typeof t&&-1!=t.indexOf(\"BEGIN \")&&(t=e.getKey(t));var n=Mr(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),o=r.getV(n,i).substring(2);return Sr.crypto.Util.hashHex(o,\"sha1\")},tn.getJWKFromKey=function(t){var e={};if(t instanceof Me&&t.isPrivate)return e.kty=\"RSA\",e.n=Tr(t.n.toString(16)),e.e=Tr(t.e.toString(16)),e.d=Tr(t.d.toString(16)),e.p=Tr(t.p.toString(16)),e.q=Tr(t.q.toString(16)),e.dp=Tr(t.dmp1.toString(16)),e.dq=Tr(t.dmq1.toString(16)),e.qi=Tr(t.coeff.toString(16)),e;if(t instanceof Me&&t.isPublic)return e.kty=\"RSA\",e.n=Tr(t.n.toString(16)),e.e=Tr(t.e.toString(16)),e;if(t instanceof Sr.crypto.ECDSA&&t.isPrivate){if(\"P-256\"!==(n=t.getShortNISTPCurveName())&&\"P-384\"!==n)throw new Error(\"unsupported curve name for JWT: \"+n);var r=t.getPublicKeyXYHex();return e.kty=\"EC\",e.crv=n,e.x=Tr(r.x),e.y=Tr(r.y),e.d=Tr(t.prvKeyHex),e}if(t instanceof Sr.crypto.ECDSA&&t.isPublic){var n;if(\"P-256\"!==(n=t.getShortNISTPCurveName())&&\"P-384\"!==n)throw new Error(\"unsupported curve name for JWT: \"+n);r=t.getPublicKeyXYHex();return e.kty=\"EC\",e.crv=n,e.x=Tr(r.x),e.y=Tr(r.y),e}throw new Error(\"not supported key object\")},Me.getPosArrayOfChildrenFromHex=function(t){return Fr.getChildIdx(t,0)},Me.getHexValueArrayOfChildrenFromHex=function(t){var e,r=Fr.getV,n=r(t,(e=Me.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),o=r(t,e[2]),s=r(t,e[3]),a=r(t,e[4]),u=r(t,e[5]),c=r(t,e[6]),h=r(t,e[7]),l=r(t,e[8]);return(e=new Array).push(n,i,o,s,a,u,c,h,l),e},Me.prototype.readPrivateKeyFromPEMString=function(t){var e=Mr(t),r=Me.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},Me.prototype.readPKCS5PrvKeyHex=function(t){var e=Me.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},Me.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,o,s,a,u,c=Fr,h=c.getVbyListEx;if(!1===c.isASN1HEX(t))throw new Error(\"not ASN.1 hex string\");try{e=h(t,0,[2,0,1],\"02\"),r=h(t,0,[2,0,2],\"02\"),n=h(t,0,[2,0,3],\"02\"),i=h(t,0,[2,0,4],\"02\"),o=h(t,0,[2,0,5],\"02\"),s=h(t,0,[2,0,6],\"02\"),a=h(t,0,[2,0,7],\"02\"),u=h(t,0,[2,0,8],\"02\")}catch(t){throw new Error(\"malformed PKCS#8 plain RSA private key\")}this.setPrivateEx(e,r,n,i,o,s,a,u)},Me.prototype.readPKCS5PubKeyHex=function(t){var e=Fr,r=e.getV;if(!1===e.isASN1HEX(t))throw new Error(\"keyHex is not ASN.1 hex string\");var n=e.getChildIdx(t,0);if(2!==n.length||\"02\"!==t.substr(n[0],2)||\"02\"!==t.substr(n[1],2))throw new Error(\"wrong hex for PKCS#5 public key\");var i=r(t,n[0]),o=r(t,n[1]);this.setPublic(i,o)},Me.prototype.readPKCS8PubKeyHex=function(t){var e=Fr;if(!1===e.isASN1HEX(t))throw new Error(\"not ASN.1 hex string\");if(\"06092a864886f70d010101\"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error(\"not PKCS8 RSA public key\");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},Me.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new on).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};new RegExp(\"[^0-9a-f]\",\"gi\");function en(t,e){for(var r=\"\",n=e/4-t.length,i=0;i<n;i++)r+=\"0\";return r+t}function rn(t,e,r){for(var n=\"\",i=0;n.length<e;)n+=Lr(r(Nr(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function nn(t){for(var e in Sr.crypto.Util.DIGESTINFOHEAD){var r=Sr.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function on(t){var e,r=Fr,n=r.getChildIdx,i=r.getV,o=r.getTLV,s=r.getVbyList,a=r.getVbyListEx,u=r.getTLVbyList,c=r.getTLVbyListEx,h=r.getIdxbyList,l=r.getIdxbyListEx,f=r.getVidx,g=r.getInt,d=r.oidname,p=r.hextooidstr,v=Mr;try{e=Sr.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={\"0c\":\"utf8\",13:\"prn\",16:\"ia5\",\"1a\":\"vis\",\"1e\":\"bmp\"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=u(this.hex,0,[0,0]);if(\"a0\"==t.substr(0,2)){var e=u(t,0,[0]),r=g(e,0);if(r<0||2<r)throw new Error(\"malformed version field\");return this.version=r+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return a(this.hex,0,[0,0],\"02\")},this.getSignatureAlgorithmField=function(){var t=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var r in e)if(t===e[r])return r;return d(a(t,0,[0],\"06\"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],\"30\")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],\"30\")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var t=s(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,\"%$1\"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=s(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,\"%$1\"),t=decodeURIComponent(t)},this.getPublicKeyHex=function(){return r.getTLVbyList(this.hex,0,[0,6+this.foffset],\"30\")},this.getPublicKeyIdx=function(){return h(this.hex,0,[0,6+this.foffset],\"30\")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return h(this.hex,t,[1,0],\"30\")},this.getPublicKey=function(){return tn.getKey(this.getPublicKeyHex(),null,\"pkcs8pub\")},this.getSignatureAlgorithmName=function(){var t=u(this.hex,0,[1],\"30\");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],\"03\",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),n=u(this.hex,0,[0],\"30\"),i=new Sr.crypto.Signature({alg:e});return i.init(t),i.updateHex(n),i.verify(r)},this.parseExt=function(t){var e,o,a;if(void 0===t){if(a=this.hex,3!==this.version)return-1;e=h(a,0,[0,7,0],\"30\"),o=n(a,e)}else{a=Mr(t);var u=h(a,0,[0,3,0,0],\"06\");if(\"2a864886f70d01090e\"!=i(a,u))return void(this.aExtInfo=new Array);e=h(a,0,[0,3,0,1,0],\"30\"),o=n(a,e),this.hex=a}this.aExtInfo=new Array;for(var c=0;c<o.length;c++){var l={critical:!1},g=0;3===n(a,o[c]).length&&(l.critical=!0,g=1),l.oid=r.hextooidstr(s(a,o[c],[0],\"06\"));var d=h(a,o[c],[1+g]);l.vidx=f(a,d),this.aExtInfo.push(l)}},this.getExtInfo=function(t){var e=this.aExtInfo,r=t;if(t.match(/^[0-9.]+$/)||(r=Sr.asn1.x509.OID.name2oid(t)),\"\"!==r)for(var n=0;n<e.length;n++)if(e[n].oid===r)return e[n]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"basicConstraints\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:\"basicConstraints\"};if(e&&(n.critical=!0),\"3000\"===t)return n;if(\"30030101ff\"===t)return n.cA=!0,n;if(\"30060101ff02\"===t.substr(0,12)){var s=i(t,10),a=parseInt(s,16);return n.cA=!0,n.pathLen=a,n}throw new Error(\"hExtV parse error: \"+t)},this.getExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"keyUsage\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:\"keyUsage\"};return e&&(n.critical=!0),n.names=this.getExtKeyUsageString(t).split(\",\"),n},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo(\"keyUsage\");if(void 0===e)return\"\";t=o(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error(\"malformed key usage value: \"+t);var r=\"000000000000000\"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(r=r.slice(-8)),10==t.length&&(r=r.slice(-16)),\"\"==(r=r.replace(/0+$/,\"\"))&&(r=\"0\"),r},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),r=new Array,n=0;n<e.length;n++)\"1\"==e.substr(n,1)&&r.push(on.KEYUSAGE_NAME[n]);return r.join(\",\")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"subjectKeyIdentifier\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:\"subjectKeyIdentifier\"};e&&(n.critical=!0);var s=i(t,0);return n.kid={hex:s},n},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"authorityKeyIdentifier\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var s={extname:\"authorityKeyIdentifier\"};e&&(s.critical=!0);for(var a=n(t,0),u=0;u<a.length;u++){var c=t.substr(a[u],2);if(\"80\"===c&&(s.kid={hex:i(t,a[u])}),\"a1\"===c){var h=o(t,a[u]),l=this.getGeneralNames(h);s.issuer=l[0].dn}\"82\"===c&&(s.sn={hex:i(t,a[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"extKeyUsage\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var s={extname:\"extKeyUsage\",array:[]};e&&(s.critical=!0);for(var a=n(t,0),u=0;u<a.length;u++)s.array.push(d(i(t,a[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo(\"extKeyUsage\");if(void 0===t)return t;var e=new Array,r=o(this.hex,t.vidx);if(\"\"===r)return e;for(var s=n(r,0),a=0;a<s.length;a++)e.push(d(i(r,s[a])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"subjectAltName\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:\"subjectAltName\",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"issuerAltName\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:\"issuerAltName\",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getGeneralNames=function(t){for(var e=n(t,0),r=[],i=0;i<e.length;i++){var s=this.getGeneralName(o(t,e[i]));void 0!==s&&r.push(s)}return r},this.getGeneralName=function(t){var e=t.substr(0,2),r=i(t,0),n=Lr(r);return\"81\"==e?{rfc822:n}:\"82\"==e?{dns:n}:\"86\"==e?{uri:n}:\"87\"==e?{ip:zr(r)}:\"a4\"==e?{dn:this.getX500Name(r)}:void 0},this.getExtSubjectAltName2=function(){var t,e,r,s=this.getExtInfo(\"subjectAltName\");if(void 0===s)return s;for(var a=new Array,u=o(this.hex,s.vidx),c=n(u,0),h=0;h<c.length;h++)r=u.substr(c[h],2),t=i(u,c[h]),\"81\"===r&&(e=Dr(t),a.push([\"MAIL\",e])),\"82\"===r&&(e=Dr(t),a.push([\"DNS\",e])),\"84\"===r&&(e=on.hex2dn(t,0),a.push([\"DN\",e])),\"86\"===r&&(e=Dr(t),a.push([\"URI\",e])),\"87\"===r&&(e=zr(t),a.push([\"IP\",e]));return a},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"cRLDistributionPoints\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:\"cRLDistributionPoints\",array:[]};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){var u=o(t,s[a]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),a=o(t,r[i]);\"a0\"==s&&(e.dpname=this.getDistributionPointName(a))}return e},this.getDistributionPointName=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),a=o(t,r[i]);\"a0\"==s&&(e.full=this.getGeneralNames(a))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtInfo(\"cRLDistributionPoints\");if(void 0===t)return t;for(var e=new Array,r=n(this.hex,t.vidx),i=0;i<r.length;i++)try{var o=Dr(s(this.hex,r[i],[0,0,0],\"86\"));e.push(o)}catch(t){}return e},this.getExtAIAInfo=function(){var t=this.getExtInfo(\"authorityInfoAccess\");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},r=n(this.hex,t.vidx),i=0;i<r.length;i++){var o=s(this.hex,r[i],[0],\"06\"),a=s(this.hex,r[i],[1],\"86\");\"2b06010505073001\"===o&&e.ocsp.push(Dr(a)),\"2b06010505073002\"===o&&e.caissuer.push(Dr(a))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"authorityInfoAccess\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:\"authorityInfoAccess\",array:[]};e&&(i.critical=!0);for(var u=n(t,0),c=0;c<u.length;c++){var h=a(t,u[c],[0],\"06\"),l=Dr(s(t,u[c],[1],\"86\"));if(\"2b06010505073001\"==h)i.array.push({ocsp:l});else{if(\"2b06010505073002\"!=h)throw new Error(\"unknown method: \"+h);i.array.push({caissuer:l})}}return i},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"certificatePolicies\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:\"certificatePolicies\",array:[]};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){var u=o(t,s[a]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(t){var e={},r=s(t,0,[0],\"06\");e.policyoid=d(r);var i=l(t,0,[1],\"30\");if(-1!=i){e.array=[];for(var a=n(t,i),u=0;u<a.length;u++){var c=o(t,a[u]),h=this.getPolicyQualifierInfo(c);e.array.push(h)}}return e},this.getPolicyQualifierInfo=function(t){var e={},r=s(t,0,[0],\"06\");if(\"2b06010505070201\"===r){var n=a(t,0,[1],\"16\");e.cps=Lr(n)}else if(\"2b06010505070202\"===r){var i=u(t,0,[1],\"30\");e.unotice=this.getUserNotice(i)}return e},this.getUserNotice=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=o(t,r[i]);\"30\"!=s.substr(0,2)&&(e.exptext=this.getDisplayText(s))}return e},this.getDisplayText=function(t){var e={};return e.type={\"0c\":\"utf8\",16:\"ia5\",\"1a\":\"vis\",\"1e\":\"bmp\"}[t.substr(0,2)],e.str=Lr(i(t,0)),e},this.getExtCRLNumber=function(t,e){var r={extname:\"cRLNumber\"};if(e&&(r.critical=!0),\"02\"==t.substr(0,2))return r.num={hex:i(t,0)},r;throw new Error(\"hExtV parse error: \"+t)},this.getExtCRLReason=function(t,e){var r={extname:\"cRLReason\"};if(e&&(r.critical=!0),\"0a\"==t.substr(0,2))return r.code=parseInt(i(t,0),16),r;throw new Error(\"hExtV parse error: \"+t)},this.getExtOcspNonce=function(t,e){var r={extname:\"ocspNonce\"};e&&(r.critical=!0);var n=i(t,0);return r.hex=n,r},this.getExtOcspNoCheck=function(t,e){var r={extname:\"ocspNoCheck\"};return e&&(r.critical=!0),r},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo(\"adobeTimeStamp\");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:\"adobeTimeStamp\"};e&&(i.critical=!0);var s=n(t,0);if(s.length>1){var a=o(t,s[1]),u=this.getGeneralName(a);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=o(t,s[2]);\"0101ff\"==c&&(i.reqauth=!0),\"010100\"==c&&(i.reqauth=!1)}return i},this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n<t.length;n++)for(var i=t[n],o=0;o<i.length;o++)r.push(i[o]);for(n=0;n<r.length;n++){var s=r[n],a=s.ds,u=s.value,c=s.type;if(\":\"+a,\"prn\"!=a&&\"utf8\"!=a&&\"ia5\"!=a)return\"mixed\";if(\"ia5\"==a){if(\"CN\"!=c)return\"mixed\";if(Sr.lang.String.isMail(u))continue;return\"mixed\"}if(\"C\"==c){if(\"prn\"==a)continue;return\"mixed\"}if(\":\"+a,null==e)e=a;else if(e!==a)return\"mixed\"}return null==e?\"prn\":e},this.getX500Name=function(t){var e=this.getX500NameArray(t);return{array:e,str:this.dnarraytostr(e)}},this.getX500NameArray=function(t){for(var e=[],r=n(t,0),i=0;i<r.length;i++)e.push(this.getRDN(o(t,r[i])));return e},this.getRDN=function(t){for(var e=[],r=n(t,0),i=0;i<r.length;i++)e.push(this.getAttrTypeAndValue(o(t,r[i])));return e},this.getAttrTypeAndValue=function(t){var e={type:null,value:null,ds:null},r=n(t,0),i=s(t,r[0],[],\"06\"),o=s(t,r[1],[]),a=Sr.asn1.ASN1Util.oidHexToInt(i);return e.type=Sr.asn1.x509.OID.oid2atype(a),e.ds=this.HEX2STAG[t.substr(r[1],2)],\"bmp\"!=e.ds?e.value=Dr(o):e.value=Yr(o),e},this.readCertPEM=function(t){this.readCertHex(v(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{h(this.hex,0,[0,7],\"a3\"),this.parseExt()}catch(t){}},this.getParam=function(){var t={};return t.version=this.getVersion(),t.serial={hex:this.getSerialNumberHex()},t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(),t.notbefore=this.getNotBefore(),t.notafter=this.getNotAfter(),t.subject=this.getSubject(),t.sbjpubkey=jr(this.getPublicKeyHex(),\"PUBLIC KEY\"),this.aExtInfo.length>0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&(-1!=l(this.hex,0,[0,\"[3]\"])&&(t=c(this.hex,0,[0,\"[3]\",0],\"30\")));for(var e=[],r=n(t,0),i=0;i<r.length;i++){var s=o(t,r[i]),a=this.getExtParam(s);null!=a&&e.push(a)}return e},this.getExtParam=function(t){var e=n(t,0).length;if(2!=e&&3!=e)throw new Error(\"wrong number elements in Extension: \"+e+\" \"+t);var r=p(s(t,0,[0],\"06\")),i=!1;3==e&&\"0101ff\"==u(t,0,[1])&&(i=!0);var o=u(t,0,[e-1,0]),a=void 0;if(\"2.5.29.14\"==r?a=this.getExtSubjectKeyIdentifier(o,i):\"2.5.29.15\"==r?a=this.getExtKeyUsage(o,i):\"2.5.29.17\"==r?a=this.getExtSubjectAltName(o,i):\"2.5.29.18\"==r?a=this.getExtIssuerAltName(o,i):\"2.5.29.19\"==r?a=this.getExtBasicConstraints(o,i):\"2.5.29.31\"==r?a=this.getExtCRLDistributionPoints(o,i):\"2.5.29.32\"==r?a=this.getExtCertificatePolicies(o,i):\"2.5.29.35\"==r?a=this.getExtAuthorityKeyIdentifier(o,i):\"2.5.29.37\"==r?a=this.getExtExtKeyUsage(o,i):\"1.3.6.1.5.5.7.1.1\"==r?a=this.getExtAuthorityInfoAccess(o,i):\"2.5.29.20\"==r?a=this.getExtCRLNumber(o,i):\"2.5.29.21\"==r?a=this.getExtCRLReason(o,i):\"1.3.6.1.5.5.7.48.1.2\"==r?a=this.getExtOcspNonce(o,i):\"1.3.6.1.5.5.7.48.1.5\"==r?a=this.getExtOcspNoCheck(o,i):\"1.2.840.113583.1.1.9.1\"==r&&(a=this.getExtAdobeTimeStamp(o,i)),null!=a)return a;var c={extname:r,extn:o};return i&&(c.critical=!0),c},this.findExt=function(t,e){for(var r=0;r<t.length;r++)if(t[r].extname==e)return t[r];return null},this.updateExtCDPFullURI=function(t,e){var r=this.findExt(t,\"cRLDistributionPoints\");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)if(null!=n[i].dpname&&null!=n[i].dpname.full)for(var o=n[i].dpname.full,s=0;s<o.length;s++){var a=o[i];null!=a.uri&&(a.uri=e)}},this.updateExtAIAOCSP=function(t,e){var r=this.findExt(t,\"authorityInfoAccess\");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].ocsp&&(n[i].ocsp=e)},this.updateExtAIACAIssuer=function(t,e){var r=this.findExt(t,\"authorityInfoAccess\");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].caissuer&&(n[i].caissuer=e)},this.dnarraytostr=function(t){return\"/\"+t.map((function(t){return function e(t){return t.map((function(t){return function e(t){return t.type+\"=\"+t.value}(t).replace(/\\+/,\"\\\\+\")})).join(\"+\")}(t).replace(/\\//,\"\\\\/\")})).join(\"/\")},this.getInfo=function(){var t,e,r,n=function t(e){return JSON.stringify(e.array).replace(/[\\[\\]\\{\\}\\\"]/g,\"\")},i=function t(e){for(var r=\"\",n=e.array,i=0;i<n.length;i++){var o=n[i];if(r+=\" policy oid: \"+o.policyoid+\"\\n\",void 0!==o.array)for(var s=0;s<o.array.length;s++){var a=o.array[s];void 0!==a.cps&&(r+=\" cps: \"+a.cps+\"\\n\")}}return r},o=function t(e){for(var r=\"\",n=e.array,i=0;i<n.length;i++){var o=n[i];try{void 0!==o.dpname.full[0].uri&&(r+=\" \"+o.dpname.full[0].uri+\"\\n\")}catch(t){}try{void 0!==o.dname.full[0].dn.hex&&(r+=\" \"+on.hex2dn(o.dpname.full[0].dn.hex)+\"\\n\")}catch(t){}}return r},s=function t(e){for(var r=\"\",n=e.array,i=0;i<n.length;i++){var o=n[i];void 0!==o.caissuer&&(r+=\" caissuer: \"+o.caissuer+\"\\n\"),void 0!==o.ocsp&&(r+=\" ocsp: \"+o.ocsp+\"\\n\")}return r};if(t=\"Basic Fields\\n\",t+=\" serial number: \"+this.getSerialNumberHex()+\"\\n\",t+=\" signature algorithm: \"+this.getSignatureAlgorithmField()+\"\\n\",t+=\" issuer: \"+this.getIssuerString()+\"\\n\",t+=\" notBefore: \"+this.getNotBefore()+\"\\n\",t+=\" notAfter: \"+this.getNotAfter()+\"\\n\",t+=\" subject: \"+this.getSubjectString()+\"\\n\",t+=\" subject public key info: \\n\",t+=\" key algorithm: \"+(e=this.getPublicKey()).type+\"\\n\",\"RSA\"===e.type&&(t+=\" n=\"+$r(e.n.toString(16)).substr(0,16)+\"...\\n\",t+=\" e=\"+$r(e.e.toString(16))+\"\\n\"),null!=(r=this.aExtInfo)){t+=\"X509v3 Extensions:\\n\";for(var a=0;a<r.length;a++){var u=r[a],c=Sr.asn1.x509.OID.oid2name(u.oid);\"\"===c&&(c=u.oid);var h=\"\";if(!0===u.critical&&(h=\"CRITICAL\"),t+=\" \"+c+\" \"+h+\":\\n\",\"basicConstraints\"===c){var l=this.getExtBasicConstraints();void 0===l.cA?t+=\" {}\\n\":(t+=\" cA=true\",void 0!==l.pathLen&&(t+=\", pathLen=\"+l.pathLen),t+=\"\\n\")}else if(\"keyUsage\"===c)t+=\" \"+this.getExtKeyUsageString()+\"\\n\";else if(\"subjectKeyIdentifier\"===c)t+=\" \"+this.getExtSubjectKeyIdentifier().kid.hex+\"\\n\";else if(\"authorityKeyIdentifier\"===c){var f=this.getExtAuthorityKeyIdentifier();void 0!==f.kid&&(t+=\" kid=\"+f.kid.hex+\"\\n\")}else{if(\"extKeyUsage\"===c)t+=\" \"+this.getExtExtKeyUsage().array.join(\", \")+\"\\n\";else if(\"subjectAltName\"===c)t+=\" \"+n(this.getExtSubjectAltName())+\"\\n\";else if(\"cRLDistributionPoints\"===c)t+=o(this.getExtCRLDistributionPoints());else if(\"authorityInfoAccess\"===c)t+=s(this.getExtAuthorityInfoAccess());else\"certificatePolicies\"===c&&(t+=i(this.getExtCertificatePolicies()))}}}return t+=\"signature algorithm: \"+this.getSignatureAlgorithmName()+\"\\n\",t+=\"signature: \"+this.getSignatureValueHex().substr(0,16)+\"...\\n\"},\"string\"==typeof t&&(-1!=t.indexOf(\"-----BEGIN\")?this.readCertPEM(t):Sr.lang.String.isHex(t)&&this.readCertHex(t))}Me.prototype.sign=function(t,e){var r=function t(r){return Sr.crypto.Util.hashString(r,e)}(t);return this.signWithMessageHash(r,e)},Me.prototype.signWithMessageHash=function(t,e){var r=Oe(Sr.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return en(this.doPrivate(r).toString(16),this.n.bitLength())},Me.prototype.signPSS=function(t,e,r){var n=function t(r){return Sr.crypto.Util.hashHex(r,e)}(Nr(t));return void 0===r&&(r=-1),this.signWithMessageHashPSS(n,e,r)},Me.prototype.signWithMessageHashPSS=function(t,e,r){var n,i=Lr(t),o=i.length,s=this.n.bitLength()-1,a=Math.ceil(s/8),u=function t(r){return Sr.crypto.Util.hashHex(r,e)};if(-1===r||void 0===r)r=o;else if(-2===r)r=a-o-2;else if(r<-2)throw new Error(\"invalid salt length\");if(a<o+r+2)throw new Error(\"data too long\");var c=\"\";r>0&&(c=new Array(r),(new Be).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=Lr(u(Nr(\"\\0\\0\\0\\0\\0\\0\\0\\0\"+i+c))),l=[];for(n=0;n<a-r-o-2;n+=1)l[n]=0;var f=String.fromCharCode.apply(String,l)+\"\u0001\"+c,g=rn(h,f.length,u),d=[];for(n=0;n<f.length;n+=1)d[n]=f.charCodeAt(n)^g.charCodeAt(n);var p=65280>>8*a-s&255;for(d[0]&=~p,n=0;n<o;n++)d.push(h.charCodeAt(n));return d.push(188),en(this.doPrivate(new w(d)).toString(16),this.n.bitLength())},Me.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var r=Oe(e,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var o=nn(i.replace(/^1f+00/,\"\"));if(0==o.length)return!1;var s=o[0];return o[1]==function t(e){return Sr.crypto.Util.hashString(e,s)}(t)},Me.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=Oe(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=nn(this.doPublic(r).toString(16).replace(/^1f+00/,\"\"));if(0==n.length)return!1;n[0];return n[1]==t},Me.prototype.verifyPSS=function(t,e,r,n){var i=function t(e){return Sr.crypto.Util.hashHex(e,r)}(Nr(t));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(i,e,r,n)},Me.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new w(e,16),s=function t(e){return Sr.crypto.Util.hashHex(e,r)},a=Lr(t),u=a.length,c=this.n.bitLength()-1,h=Math.ceil(c/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=h-u-2;else if(n<-2)throw new Error(\"invalid salt length\");if(h<u+n+2)throw new Error(\"data too long\");var l=this.doPublic(o).toByteArray();for(i=0;i<l.length;i+=1)l[i]&=255;for(;l.length<h;)l.unshift(0);if(188!==l[h-1])throw new Error(\"encoded message does not end in 0xbc\");var f=(l=String.fromCharCode.apply(String,l)).substr(0,h-u-1),g=l.substr(f.length,u),d=65280>>8*h-c&255;if(0!=(f.charCodeAt(0)&d))throw new Error(\"bits beyond keysize not zero\");var p=rn(g,f.length,s),v=[];for(i=0;i<f.length;i+=1)v[i]=f.charCodeAt(i)^p.charCodeAt(i);v[0]&=~d;var y=h-u-n-2;for(i=0;i<y;i+=1)if(0!==v[i])throw new Error(\"leftmost octets not zero\");if(1!==v[y])throw new Error(\"0x01 marker not found\");return g===Lr(s(Nr(\"\\0\\0\\0\\0\\0\\0\\0\\0\"+a+String.fromCharCode.apply(String,v.slice(-n)))))},Me.SALT_LEN_HLEN=-1,Me.SALT_LEN_MAX=-2,Me.SALT_LEN_RECOVER=-2,on.hex2dn=function(t,e){void 0===e&&(e=0);var r=new on;Fr.getTLV(t,e);return r.getX500Name(t).str},on.hex2rdn=function(t,e){if(void 0===e&&(e=0),\"31\"!==t.substr(e,2))throw new Error(\"malformed RDN\");for(var r=new Array,n=Fr.getChildIdx(t,e),i=0;i<n.length;i++)r.push(on.hex2attrTypeValue(t,n[i]));return(r=r.map((function(t){return t.replace(\"+\",\"\\\\+\")}))).join(\"+\")},on.hex2attrTypeValue=function(t,e){var r=Fr,n=r.getV;if(void 0===e&&(e=0),\"30\"!==t.substr(e,2))throw new Error(\"malformed attribute type and value\");var i=r.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var o=n(t,i[0]),s=Sr.asn1.ASN1Util.oidHexToInt(o);return Sr.asn1.x509.OID.oid2atype(s)+\"=\"+Lr(n(t,i[1]))},on.getPublicKeyFromCertHex=function(t){var e=new on;return e.readCertHex(t),e.getPublicKey()},on.getPublicKeyFromCertPEM=function(t){var e=new on;return e.readCertPEM(t),e.getPublicKey()},on.getPublicKeyInfoPropOfCertPEM=function(t){var e,r,n=Fr.getVbyList,i={};return i.algparam=null,(e=new on).readCertPEM(t),r=e.getPublicKeyHex(),i.keyhex=n(r,0,[1],\"03\").substr(2),i.algoid=n(r,0,[0,0],\"06\"),\"2a8648ce3d0201\"===i.algoid&&(i.algparam=n(r,0,[0,1],\"06\")),i},on.KEYUSAGE_NAME=[\"digitalSignature\",\"nonRepudiation\",\"keyEncipherment\",\"dataEncipherment\",\"keyAgreement\",\"keyCertSign\",\"cRLSign\",\"encipherOnly\",\"decipherOnly\"],void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.jws&&Sr.jws||(Sr.jws={}),Sr.jws.JWS=function(){var t=Sr.jws.JWS.isSafeJSONString;this.parseJWS=function(e,r){if(void 0===this.parsedJWS||!r&&void 0===this.parsedJWS.sigvalH){var n=e.match(/^([^.]+)\\.([^.]+)\\.([^.]+)$/);if(null==n)throw\"JWS signature is not a form of 'Head.Payload.SigValue'.\";var i=n[1],o=n[2],s=n[3],a=i+\".\"+o;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=o,this.parsedJWS.sigvalB64U=s,this.parsedJWS.si=a,!r){var u=Rr(s),c=Oe(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var h=wr(i),l=wr(o);if(this.parsedJWS.headS=h,this.parsedJWS.payloadS=l,!t(h,this.parsedJWS,\"headP\"))throw\"malformed JSON string for JWS Head: \"+h}}},Sr.jws.JWS.sign=function(t,e,r,n,i){var o,s,a,u=Sr,c=u.jws.JWS,h=c.readSafeJSONString,l=c.isSafeJSONString,f=u.crypto,d=(f.ECDSA,f.Mac),p=f.Signature,v=JSON;if(\"string\"!=typeof e&&\"object\"!=(void 0===e?\"undefined\":g(e)))throw\"spHeader must be JSON string or object: \"+e;if(\"object\"==(void 0===e?\"undefined\":g(e))&&(s=e,o=v.stringify(s)),\"string\"==typeof e){if(!l(o=e))throw\"JWS Head is not safe JSON string: \"+o;s=h(o)}if(a=r,\"object\"==(void 0===r?\"undefined\":g(r))&&(a=v.stringify(r)),\"\"!=t&&null!=t||void 0===s.alg||(t=s.alg),\"\"!=t&&null!=t&&void 0===s.alg&&(s.alg=t,o=v.stringify(s)),t!==s.alg)throw\"alg and sHeader.alg doesn't match: \"+t+\"!=\"+s.alg;var y=null;if(void 0===c.jwsalg2sigalg[t])throw\"unsupported alg name: \"+t;y=c.jwsalg2sigalg[t];var m=br(o)+\".\"+br(a),_=\"\";if(\"Hmac\"==y.substr(0,4)){if(void 0===n)throw\"mac key shall be specified for HS* alg\";var S=new d({alg:y,prov:\"cryptojs\",pass:n});S.updateString(m),_=S.doFinal()}else if(-1!=y.indexOf(\"withECDSA\")){(w=new p({alg:y})).init(n,i),w.updateString(m);var b=w.sign();_=Sr.crypto.ECDSA.asn1SigToConcatSig(b)}else{var w;if(\"none\"!=y)(w=new p({alg:y})).init(n,i),w.updateString(m),_=w.sign()}return m+\".\"+Tr(_)},Sr.jws.JWS.verify=function(t,e,r){var n,i=Sr,o=i.jws.JWS,s=o.readSafeJSONString,a=i.crypto,u=a.ECDSA,c=a.Mac,h=a.Signature;void 0!==g(Me)&&(n=Me);var l=t.split(\".\");if(3!==l.length)return!1;var f=l[0]+\".\"+l[1],d=Rr(l[2]),p=s(wr(l[0])),v=null,y=null;if(void 0===p.alg)throw\"algorithm not specified in header\";if((y=(v=p.alg).substr(0,2),null!=r&&\"[object Array]\"===Object.prototype.toString.call(r)&&r.length>0)&&-1==(\":\"+r.join(\":\")+\":\").indexOf(\":\"+v+\":\"))throw\"algorithm '\"+v+\"' not accepted in the list\";if(\"none\"!=v&&null===e)throw\"key shall be specified to verify.\";if(\"string\"==typeof e&&-1!=e.indexOf(\"-----BEGIN \")&&(e=tn.getKey(e)),!(\"RS\"!=y&&\"PS\"!=y||e instanceof n))throw\"key shall be a RSAKey obj for RS* and PS* algs\";if(\"ES\"==y&&!(e instanceof u))throw\"key shall be a ECDSA obj for ES* algs\";var m=null;if(void 0===o.jwsalg2sigalg[p.alg])throw\"unsupported alg name: \"+v;if(\"none\"==(m=o.jwsalg2sigalg[v]))throw\"not supported\";if(\"Hmac\"==m.substr(0,4)){if(void 0===e)throw\"hexadecimal key shall be specified for HMAC\";var _=new c({alg:m,pass:e});return _.updateString(f),d==_.doFinal()}if(-1!=m.indexOf(\"withECDSA\")){var S,b=null;try{b=u.concatSigToASN1Sig(d)}catch(t){return!1}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(b)}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(d)},Sr.jws.JWS.parse=function(t){var e,r,n,i=t.split(\".\"),o={};if(2!=i.length&&3!=i.length)throw\"malformed sJWS: wrong number of '.' splitted elements\";return e=i[0],r=i[1],3==i.length&&(n=i[2]),o.headerObj=Sr.jws.JWS.readSafeJSONString(wr(e)),o.payloadObj=Sr.jws.JWS.readSafeJSONString(wr(r)),o.headerPP=JSON.stringify(o.headerObj,null,\" \"),null==o.payloadObj?o.payloadPP=wr(r):o.payloadPP=JSON.stringify(o.payloadObj,null,\" \"),void 0!==n&&(o.sigHex=Rr(n)),o},Sr.jws.JWS.verifyJWT=function(t,e,r){var n=Sr.jws,i=n.JWS,o=i.readSafeJSONString,s=i.inArray,a=i.includedArray,u=t.split(\".\"),c=u[0],h=u[1],l=(Rr(u[2]),o(wr(c))),f=o(wr(h));if(void 0===l.alg)return!1;if(void 0===r.alg)throw\"acceptField.alg shall be specified\";if(!s(l.alg,r.alg))return!1;if(void 0!==f.iss&&\"object\"===g(r.iss)&&!s(f.iss,r.iss))return!1;if(void 0!==f.sub&&\"object\"===g(r.sub)&&!s(f.sub,r.sub))return!1;if(void 0!==f.aud&&\"object\"===g(r.aud))if(\"string\"==typeof f.aud){if(!s(f.aud,r.aud))return!1}else if(\"object\"==g(f.aud)&&!a(f.aud,r.aud))return!1;var d=n.IntDate.getNow();return void 0!==r.verifyAt&&\"number\"==typeof r.verifyAt&&(d=r.verifyAt),void 0!==r.gracePeriod&&\"number\"==typeof r.gracePeriod||(r.gracePeriod=0),!(void 0!==f.exp&&\"number\"==typeof f.exp&&f.exp+r.gracePeriod<d)&&(!(void 0!==f.nbf&&\"number\"==typeof f.nbf&&d<f.nbf-r.gracePeriod)&&(!(void 0!==f.iat&&\"number\"==typeof f.iat&&d<f.iat-r.gracePeriod)&&((void 0===f.jti||void 0===r.jti||f.jti===r.jti)&&!!i.verify(t,e,r.alg))))},Sr.jws.JWS.includedArray=function(t,e){var r=Sr.jws.JWS.inArray;if(null===t)return!1;if(\"object\"!==(void 0===t?\"undefined\":g(t)))return!1;if(\"number\"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(!r(t[n],e))return!1;return!0},Sr.jws.JWS.inArray=function(t,e){if(null===e)return!1;if(\"object\"!==(void 0===e?\"undefined\":g(e)))return!1;if(\"number\"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1},Sr.jws.JWS.jwsalg2sigalg={HS256:\"HmacSHA256\",HS384:\"HmacSHA384\",HS512:\"HmacSHA512\",RS256:\"SHA256withRSA\",RS384:\"SHA384withRSA\",RS512:\"SHA512withRSA\",ES256:\"SHA256withECDSA\",ES384:\"SHA384withECDSA\",PS256:\"SHA256withRSAandMGF1\",PS384:\"SHA384withRSAandMGF1\",PS512:\"SHA512withRSAandMGF1\",none:\"none\"},Sr.jws.JWS.isSafeJSONString=function(t,e,r){var n=null;try{return\"object\"!=(void 0===(n=_r(t))?\"undefined\":g(n))||n.constructor===Array?0:(e&&(e[r]=n),1)}catch(t){return 0}},Sr.jws.JWS.readSafeJSONString=function(t){var e=null;try{return\"object\"!=(void 0===(e=_r(t))?\"undefined\":g(e))||e.constructor===Array?null:e}catch(t){return null}},Sr.jws.JWS.getEncodedSignatureValueFromJWS=function(t){var e=t.match(/^[^.]+\\.[^.]+\\.([^.]+)$/);if(null==e)throw\"JWS signature is not a form of 'Head.Payload.SigValue'.\";return e[1]},Sr.jws.JWS.getJWKthumbprint=function(t){if(\"RSA\"!==t.kty&&\"EC\"!==t.kty&&\"oct\"!==t.kty)throw\"unsupported algorithm for JWK Thumprint\";var e=\"{\";if(\"RSA\"===t.kty){if(\"string\"!=typeof t.n||\"string\"!=typeof t.e)throw\"wrong n and e value for RSA key\";e+='\"e\":\"'+t.e+'\",',e+='\"kty\":\"'+t.kty+'\",',e+='\"n\":\"'+t.n+'\"}'}else if(\"EC\"===t.kty){if(\"string\"!=typeof t.crv||\"string\"!=typeof t.x||\"string\"!=typeof t.y)throw\"wrong crv, x and y value for EC key\";e+='\"crv\":\"'+t.crv+'\",',e+='\"kty\":\"'+t.kty+'\",',e+='\"x\":\"'+t.x+'\",',e+='\"y\":\"'+t.y+'\"}'}else if(\"oct\"===t.kty){if(\"string\"!=typeof t.k)throw\"wrong k value for oct(symmetric) key\";e+='\"kty\":\"'+t.kty+'\",',e+='\"k\":\"'+t.k+'\"}'}var r=Nr(e);return Tr(Sr.crypto.Util.hashHex(r,\"sha256\"))},Sr.jws.IntDate={},Sr.jws.IntDate.get=function(t){var e=Sr.jws.IntDate,r=e.getNow,n=e.getZulu;if(\"now\"==t)return r();if(\"now + 1hour\"==t)return r()+3600;if(\"now + 1day\"==t)return r()+86400;if(\"now + 1month\"==t)return r()+2592e3;if(\"now + 1year\"==t)return r()+31536e3;if(t.match(/Z$/))return n(t);if(t.match(/^[0-9]+$/))return parseInt(t);throw\"unsupported format: \"+t},Sr.jws.IntDate.getZulu=function(t){return Vr(t)},Sr.jws.IntDate.getNow=function(){return~~(new Date/1e3)},Sr.jws.IntDate.intDate2UTCString=function(t){return new Date(1e3*t).toUTCString()},Sr.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t);return(\"0000\"+e.getUTCFullYear()).slice(-4)+(\"00\"+(e.getUTCMonth()+1)).slice(-2)+(\"00\"+e.getUTCDate()).slice(-2)+(\"00\"+e.getUTCHours()).slice(-2)+(\"00\"+e.getUTCMinutes()).slice(-2)+(\"00\"+e.getUTCSeconds()).slice(-2)+\"Z\"},e.SecureRandom=Be,e.rng_seed_time=Re,e.BigInteger=w,e.RSAKey=Me;var sn=Sr.crypto.EDSA;e.EDSA=sn;var an=Sr.crypto.DSA;e.DSA=an;var un=Sr.crypto.Signature;e.Signature=un;var cn=Sr.crypto.MessageDigest;e.MessageDigest=cn;var hn=Sr.crypto.Mac;e.Mac=hn;var ln=Sr.crypto.Cipher;e.Cipher=ln,e.KEYUTIL=tn,e.ASN1HEX=Fr,e.X509=on,e.CryptoJS=v,e.b64tohex=S,e.b64toBA=b,e.stoBA=Er,e.BAtos=xr,e.BAtohex=Ar,e.stohex=kr,e.stob64=function fn(t){return _(kr(t))},e.stob64u=function gn(t){return Pr(_(kr(t)))},e.b64utos=function dn(t){return xr(b(Cr(t)))},e.b64tob64u=Pr,e.b64utob64=Cr,e.hex2b64=_,e.hextob64u=Tr,e.b64utohex=Rr,e.utf8tob64u=br,e.b64utoutf8=wr,e.utf8tob64=function pn(t){return _(Kr(Gr(t)))},e.b64toutf8=function vn(t){return decodeURIComponent(qr(S(t)))},e.utf8tohex=Ir,e.hextoutf8=Dr,e.hextorstr=Lr,e.rstrtohex=Nr,e.hextob64=Ur,e.hextob64nl=Br,e.b64nltohex=Or,e.hextopem=jr,e.pemtohex=Mr,e.hextoArrayBuffer=function yn(t){if(t.length%2!=0)throw\"input is not even length\";if(null==t.match(/^[0-9A-Fa-f]+$/))throw\"input is not hexadecimal\";for(var e=new ArrayBuffer(t.length/2),r=new DataView(e),n=0;n<t.length/2;n++)r.setUint8(n,parseInt(t.substr(2*n,2),16));return e},e.ArrayBuffertohex=function mn(t){for(var e=\"\",r=new DataView(t),n=0;n<t.byteLength;n++)e+=(\"00\"+r.getUint8(n).toString(16)).slice(-2);return e},e.zulutomsec=Hr,e.zulutosec=Vr,e.zulutodate=function _n(t){return new Date(Hr(t))},e.datetozulu=function Sn(t,e,r){var n,i=t.getUTCFullYear();if(e){if(i<1950||2049<i)throw\"not proper year for UTCTime: \"+i;n=(\"\"+i).slice(-2)}else n=(\"000\"+i).slice(-4);if(n+=(\"0\"+(t.getUTCMonth()+1)).slice(-2),n+=(\"0\"+t.getUTCDate()).slice(-2),n+=(\"0\"+t.getUTCHours()).slice(-2),n+=(\"0\"+t.getUTCMinutes()).slice(-2),n+=(\"0\"+t.getUTCSeconds()).slice(-2),r){var o=t.getUTCMilliseconds();0!==o&&(n+=\".\"+(o=(o=(\"00\"+o).slice(-3)).replace(/0+$/g,\"\")))}return n+=\"Z\"},e.uricmptohex=Kr,e.hextouricmp=qr,e.ipv6tohex=Jr,e.hextoipv6=Wr,e.hextoip=zr,e.iptohex=function bn(t){var e=\"malformed IP address\";if(!(t=t.toLowerCase(t)).match(/^[0-9.]+$/)){if(t.match(/^[0-9a-f:]+$/)&&-1!==t.indexOf(\":\"))return Jr(t);throw e}var r=t.split(\".\");if(4!==r.length)throw e;var n=\"\";try{for(var i=0;i<4;i++){n+=(\"0\"+parseInt(r[i]).toString(16)).slice(-2)}return n}catch(t){throw e}},e.encodeURIComponentAll=Gr,e.newline_toUnix=function wn(t){return t=t.replace(/\\r\\n/gm,\"\\n\")},e.newline_toDos=function Fn(t){return t=(t=t.replace(/\\r\\n/gm,\"\\n\")).replace(/\\n/gm,\"\\r\\n\")},e.hextoposhex=$r,e.intarystrtohex=function En(t){t=(t=(t=t.replace(/^\\s*\\[\\s*/,\"\")).replace(/\\s*\\]\\s*$/,\"\")).replace(/\\s*/g,\"\");try{return t.split(/,/).map((function(t,e,r){var n=parseInt(t);if(n<0||255<n)throw\"integer not in range 0-255\";return(\"00\"+n.toString(16)).slice(-2)})).join(\"\")}catch(t){throw\"malformed integer array string: \"+t}},e.strdiffidx=function t(e,r){var n=e.length;e.length>r.length&&(n=r.length);for(var i=0;i<n;i++)if(e.charCodeAt(i)!=r.charCodeAt(i))return i;return e.length!=r.length?n:-1},e.KJUR=Sr;var xn=Sr.crypto;e.crypto=xn;var An=Sr.asn1;e.asn1=An;var kn=Sr.jws;e.jws=kn;var Pn=Sr.lang;e.lang=Pn}).call(this,r(28).Buffer)},function(t,e,r){\"use strict\";(function(t){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <http://feross.org>\n * @license MIT\n */\nvar n=r(30),i=r(31),o=r(32);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError(\"Invalid typed array length\");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if(\"number\"==typeof t){if(\"string\"==typeof e)throw new Error(\"If encoding is specified then the first argument must be a string\");return l(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if(\"number\"==typeof e)throw new TypeError('\"value\" argument must not be a number');return\"undefined\"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function i(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError(\"'offset' is out of bounds\");if(e.byteLength<r+(n||0))throw new RangeError(\"'length' is out of bounds\");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=f(t,e);return t}(t,e,r,n):\"string\"==typeof e?function s(t,e,r){\"string\"==typeof r&&\"\"!==r||(r=\"utf8\");if(!u.isEncoding(r))throw new TypeError('\"encoding\" must be a valid string encoding');var n=0|d(e,r),i=(t=a(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function c(t,e){if(u.isBuffer(e)){var r=0|g(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if(\"undefined\"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||\"length\"in e)return\"number\"!=typeof e.length||function n(t){return t!=t}(e.length)?a(t,0):f(t,e);if(\"Buffer\"===e.type&&o(e.data))return f(t,e.data)}throw new TypeError(\"First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.\")}(t,e)}function h(t){if(\"number\"!=typeof t)throw new TypeError('\"size\" argument must be a number');if(t<0)throw new RangeError('\"size\" argument must not be negative')}function l(t,e){if(h(e),t=a(t,e<0?0:0|g(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|g(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function g(t){if(t>=s())throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+s().toString(16)+\" bytes\");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if(\"undefined\"!=typeof ArrayBuffer&&\"function\"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;\"string\"!=typeof t&&(t=\"\"+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":case void 0:return K(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return q(t).length;default:if(n)return K(t).length;e=(\"\"+e).toLowerCase(),n=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return I(this,e,r);case\"utf8\":case\"utf-8\":return A(this,e,r);case\"ascii\":return T(this,e,r);case\"latin1\":case\"binary\":return R(this,e,r);case\"base64\":return x(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return D(this,e,r);default:if(n)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if(\"string\"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if(\"string\"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if(\"number\"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&\"function\"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError(\"val must be string, number or Buffer\")}function m(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&(\"ucs2\"===(n=String(n).toLowerCase())||\"ucs-2\"===n||\"utf16le\"===n||\"utf-16le\"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var l=!0,f=0;f<u;f++)if(c(t,o+f)!==c(e,f)){l=!1;break}if(l)return o}return-1}function _(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError(\"Invalid hex string\");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function S(t,e,r,n){return J(K(e,t.length-r),t,r,n)}function b(t,e,r,n){return J(function i(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function w(t,e,r,n){return b(t,e,r,n)}function F(t,e,r,n){return J(q(e),t,r,n)}function E(t,e,r,n){return J(function i(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,c=t[i],h=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function f(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);var r=\"\",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=C));return r}(n)}e.Buffer=u,e.SlowBuffer=function k(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function P(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&\"function\"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return c(null,t,e,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(t,e,r){return function n(t,e,r,i){return h(e),e<=0?a(t,e):void 0!==r?\"string\"==typeof i?a(t,e).fill(r,i):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function t(e){return!(null==e||!e._isBuffer)},u.compare=function t(e,r){if(!u.isBuffer(e)||!u.isBuffer(r))throw new TypeError(\"Arguments must be Buffers\");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0},u.isEncoding=function t(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 t(e,r){if(!o(e))throw new TypeError('\"list\" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=u.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){var a=e[n];if(!u.isBuffer(a))throw new TypeError('\"list\" argument must be an Array of Buffers');a.copy(i,s),s+=a.length}return i},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function t(){var e=this.length;if(e%2!=0)throw new RangeError(\"Buffer size must be a multiple of 16-bits\");for(var r=0;r<e;r+=2)v(this,r,r+1);return this},u.prototype.swap32=function t(){var e=this.length;if(e%4!=0)throw new RangeError(\"Buffer size must be a multiple of 32-bits\");for(var r=0;r<e;r+=4)v(this,r,r+3),v(this,r+1,r+2);return this},u.prototype.swap64=function t(){var e=this.length;if(e%8!=0)throw new RangeError(\"Buffer size must be a multiple of 64-bits\");for(var r=0;r<e;r+=8)v(this,r,r+7),v(this,r+1,r+6),v(this,r+2,r+5),v(this,r+3,r+4);return this},u.prototype.toString=function t(){var e=0|this.length;return 0===e?\"\":0===arguments.length?A(this,0,e):p.apply(this,arguments)},u.prototype.equals=function t(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 t(){var r=\"\",n=e.INSPECT_MAX_BYTES;return this.length>0&&(r=this.toString(\"hex\",0,n).match(/.{2}/g).join(\" \"),this.length>n&&(r+=\" ... \")),\"<Buffer \"+r+\">\"},u.prototype.compare=function t(e,r,n,i,o){if(!u.isBuffer(e))throw new TypeError(\"Argument must be a Buffer\");if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError(\"out of range index\");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(i>>>=0),a=(n>>>=0)-(r>>>=0),c=Math.min(s,a),h=this.slice(i,o),l=e.slice(r,n),f=0;f<c;++f)if(h[f]!==l[f]){s=h[f],a=l[f];break}return s<a?-1:a<s?1:0},u.prototype.includes=function t(e,r,n){return-1!==this.indexOf(e,r,n)},u.prototype.indexOf=function t(e,r,n){return y(this,e,r,n,!0)},u.prototype.lastIndexOf=function t(e,r,n){return y(this,e,r,n,!1)},u.prototype.write=function t(e,r,n,i){if(void 0===r)i=\"utf8\",n=this.length,r=0;else if(void 0===n&&\"string\"==typeof r)i=r,n=this.length,r=0;else{if(!isFinite(r))throw new Error(\"Buffer.write(string, encoding, offset[, length]) is no longer supported\");r|=0,isFinite(n)?(n|=0,void 0===i&&(i=\"utf8\")):(i=n,n=void 0)}var o=this.length-r;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");i||(i=\"utf8\");for(var s=!1;;)switch(i){case\"hex\":return _(this,e,r,n);case\"utf8\":case\"utf-8\":return S(this,e,r,n);case\"ascii\":return b(this,e,r,n);case\"latin1\":case\"binary\":return w(this,e,r,n);case\"base64\":return F(this,e,r,n);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return E(this,e,r,n);default:if(s)throw new TypeError(\"Unknown encoding: \"+i);i=(\"\"+i).toLowerCase(),s=!0}},u.prototype.toJSON=function t(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function T(t,e,r){var n=\"\";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function R(t,e,r){var n=\"\";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i=\"\",o=e;o<r;++o)i+=V(t[o]);return i}function D(t,e,r){for(var n=t.slice(e,r),i=\"\",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function L(t,e,r){if(t%1!=0||t<0)throw new RangeError(\"offset is not uint\");if(t+e>r)throw new RangeError(\"Trying to access beyond buffer length\")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('\"value\" argument is out of bounds');if(r+n>t.length)throw new RangeError(\"Index out of range\")}function U(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function O(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError(\"Index out of range\");if(r<0)throw new RangeError(\"Index out of range\")}function j(t,e,r,n,o){return o||O(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,o){return o||O(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function t(e,r){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(r=void 0===r?i:~~r)<0?(r+=i)<0&&(r=0):r>i&&(r=i),r<e&&(r=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,r)).__proto__=u.prototype;else{var o=r-e;n=new u(o,void 0);for(var s=0;s<o;++s)n[s]=this[s+e]}return n},u.prototype.readUIntLE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return i},u.prototype.readUIntBE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=this[e+--r],o=1;r>0&&(o*=256);)i+=this[e+--r]*o;return i},u.prototype.readUInt8=function t(e,r){return r||L(e,1,this.length),this[e]},u.prototype.readUInt16LE=function t(e,r){return r||L(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function t(e,r){return r||L(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function t(e,r){return r||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function t(e,r){return r||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=this[e],o=1,s=0;++s<r&&(o*=256);)i+=this[e+s]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},u.prototype.readIntBE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*r)),s},u.prototype.readInt8=function t(e,r){return r||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function t(e,r){r||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function t(e,r){r||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function t(e,r){return r||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function t(e,r){return r||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function t(e,r){return r||L(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function t(e,r){return r||L(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function t(e,r){return r||L(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function t(e,r){return r||L(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function t(e,r,n,i){(e=+e,r|=0,n|=0,i)||N(this,e,r,n,Math.pow(2,8*n)-1,0);var o=1,s=0;for(this[r]=255&e;++s<n&&(o*=256);)this[r+s]=e/o&255;return r+n},u.prototype.writeUIntBE=function t(e,r,n,i){(e=+e,r|=0,n|=0,i)||N(this,e,r,n,Math.pow(2,8*n)-1,0);var o=n-1,s=1;for(this[r+o]=255&e;--o>=0&&(s*=256);)this[r+o]=e/s&255;return r+n},u.prototype.writeUInt8=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},u.prototype.writeUInt16LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},u.prototype.writeUInt16BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},u.prototype.writeUInt32LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):B(this,e,r,!0),r+4},u.prototype.writeUInt32BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):B(this,e,r,!1),r+4},u.prototype.writeIntLE=function t(e,r,n,i){if(e=+e,r|=0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=0,a=1,u=0;for(this[r]=255&e;++s<n&&(a*=256);)e<0&&0===u&&0!==this[r+s-1]&&(u=1),this[r+s]=(e/a>>0)-u&255;return r+n},u.prototype.writeIntBE=function t(e,r,n,i){if(e=+e,r|=0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=n-1,a=1,u=0;for(this[r+s]=255&e;--s>=0&&(a*=256);)e<0&&0===u&&0!==this[r+s+1]&&(u=1),this[r+s]=(e/a>>0)-u&255;return r+n},u.prototype.writeInt8=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},u.prototype.writeInt16LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},u.prototype.writeInt16BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},u.prototype.writeInt32LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):B(this,e,r,!0),r+4},u.prototype.writeInt32BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):B(this,e,r,!1),r+4},u.prototype.writeFloatLE=function t(e,r,n){return j(this,e,r,!0,n)},u.prototype.writeFloatBE=function t(e,r,n){return j(this,e,r,!1,n)},u.prototype.writeDoubleLE=function t(e,r,n){return M(this,e,r,!0,n)},u.prototype.writeDoubleBE=function t(e,r,n){return M(this,e,r,!1,n)},u.prototype.copy=function t(e,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(r<0)throw new RangeError(\"targetStart out of bounds\");if(n<0||n>=this.length)throw new RangeError(\"sourceStart out of bounds\");if(i<0)throw new RangeError(\"sourceEnd out of bounds\");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o,s=i-n;if(this===e&&n<r&&r<i)for(o=s-1;o>=0;--o)e[o+r]=this[o+n];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),r);return s},u.prototype.fill=function t(e,r,n,i){if(\"string\"==typeof e){if(\"string\"==typeof r?(i=r,r=0,n=this.length):\"string\"==typeof n&&(i=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==i&&\"string\"!=typeof i)throw new TypeError(\"encoding must be a string\");if(\"string\"==typeof i&&!u.isEncoding(i))throw new TypeError(\"Unknown encoding: \"+i)}else\"number\"==typeof e&&(e&=255);if(r<0||this.length<r||this.length<n)throw new RangeError(\"Out of range index\");if(n<=r)return this;var s;if(r>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),\"number\"==typeof e)for(s=r;s<n;++s)this[s]=e;else{var a=u.isBuffer(e)?e:K(new u(e,i).toString()),c=a.length;for(s=0;s<n-r;++s)this[s+r]=a[s%c]}return this};var H=/[^+\\/0-9A-Za-z-_]/g;function V(t){return t<16?\"0\"+t.toString(16):t.toString(16)}function K(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error(\"Invalid code point\");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(t){return n.toByteArray(function e(t){if((t=function e(t){return t.trim?t.trim():t.replace(/^\\s+|\\s+$/g,\"\")}(t).replace(H,\"\")).length<2)return\"\";for(;t.length%4!=0;)t+=\"=\";return t}(t))}function J(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(29))},function(t,e){var r;r=function(){return this}();try{r=r||new Function(\"return this\")()}catch(t){\"object\"==typeof window&&(r=window)}t.exports=r},function(t,e,r){\"use strict\";e.byteLength=function n(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function i(t){var e,r,n=f(t),i=n[0],o=n[1],s=new u(function c(t,e,r){return 3*(e+r)/4-r}(0,i,o)),h=0,l=o>0?i-4:i;for(r=0;r<l;r+=4)e=a[t.charCodeAt(r)]<<18|a[t.charCodeAt(r+1)]<<12|a[t.charCodeAt(r+2)]<<6|a[t.charCodeAt(r+3)],s[h++]=e>>16&255,s[h++]=e>>8&255,s[h++]=255&e;2===o&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,s[h++]=255&e);1===o&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,s[h++]=e>>8&255,s[h++]=255&e);return s},e.fromByteArray=function o(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,u=r-n;a<u;a+=o)i.push(g(t,a,a+o>u?u:a+o));1===n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+\"==\")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+\"=\"));return i.join(\"\")};for(var s=[],a=[],u=\"undefined\"!=typeof Uint8Array?Uint8Array:Array,c=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",h=0,l=c.length;h<l;++h)s[h]=c[h],a[c.charCodeAt(h)]=h;function f(t){var e=t.length;if(e%4>0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var r=t.indexOf(\"=\");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function g(t,e,r){for(var n,i,o=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(s[(i=n)>>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join(\"\")}a[\"-\".charCodeAt(0)]=62,a[\"_\".charCodeAt(0)]=63},function(t,e){\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\ne.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,h=-7,l=r?i-1:0,f=r?-1:1,g=t[e+l];for(l+=f,o=g&(1<<-h)-1,g>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=f,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,n),o-=c}return(g?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,h=(1<<c)-1,l=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,d=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+g]=255&a,g+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+g]=255&s,g+=d,s/=256,c-=8);t[r+g-d]|=128*p}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return\"[object Array]\"==r.call(t)}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.default=function n(t){var e=t.jws,r=t.KeyUtil,n=t.X509,o=t.crypto,s=t.hextob64u,a=t.b64tohex,u=t.AllowedSigningAlgs;return function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.parseJwt=function t(r){i.Log.debug(\"JoseUtil.parseJwt\");try{var n=e.JWS.parse(r);return{header:n.headerObj,payload:n.payloadObj}}catch(t){i.Log.error(t)}},t.validateJwt=function e(o,s,u,c,h,l,f){i.Log.debug(\"JoseUtil.validateJwt\");try{if(\"RSA\"===s.kty)if(s.e&&s.n)s=r.getKey(s);else{if(!s.x5c||!s.x5c.length)return i.Log.error(\"JoseUtil.validateJwt: RSA key missing key material\",s),Promise.reject(new Error(\"RSA key missing key material\"));var g=a(s.x5c[0]);s=n.getPublicKeyFromCertHex(g)}else{if(\"EC\"!==s.kty)return i.Log.error(\"JoseUtil.validateJwt: Unsupported key type\",s&&s.kty),Promise.reject(new Error(s.kty));if(!(s.crv&&s.x&&s.y))return i.Log.error(\"JoseUtil.validateJwt: EC key missing key material\",s),Promise.reject(new Error(\"EC key missing key material\"));s=r.getKey(s)}return t._validateJwt(o,s,u,c,h,l,f)}catch(t){return i.Log.error(t&&t.message||t),Promise.reject(\"JWT validation failed\")}},t.validateJwtAttributes=function e(r,n,o,s,a,u){s||(s=0),a||(a=parseInt(Date.now()/1e3));var c=t.parseJwt(r).payload;if(!c.iss)return i.Log.error(\"JoseUtil._validateJwt: issuer was not provided\"),Promise.reject(new Error(\"issuer was not provided\"));if(c.iss!==n)return i.Log.error(\"JoseUtil._validateJwt: Invalid issuer in token\",c.iss),Promise.reject(new Error(\"Invalid issuer in token: \"+c.iss));if(!c.aud)return i.Log.error(\"JoseUtil._validateJwt: aud was not provided\"),Promise.reject(new Error(\"aud was not provided\"));if(!(c.aud===o||Array.isArray(c.aud)&&c.aud.indexOf(o)>=0))return i.Log.error(\"JoseUtil._validateJwt: Invalid audience in token\",c.aud),Promise.reject(new Error(\"Invalid audience in token: \"+c.aud));if(c.azp&&c.azp!==o)return i.Log.error(\"JoseUtil._validateJwt: Invalid azp in token\",c.azp),Promise.reject(new Error(\"Invalid azp in token: \"+c.azp));if(!u){var h=a+s,l=a-s;if(!c.iat)return i.Log.error(\"JoseUtil._validateJwt: iat was not provided\"),Promise.reject(new Error(\"iat was not provided\"));if(h<c.iat)return i.Log.error(\"JoseUtil._validateJwt: iat is in the future\",c.iat),Promise.reject(new Error(\"iat is in the future: \"+c.iat));if(c.nbf&&h<c.nbf)return i.Log.error(\"JoseUtil._validateJwt: nbf is in the future\",c.nbf),Promise.reject(new Error(\"nbf is in the future: \"+c.nbf));if(!c.exp)return i.Log.error(\"JoseUtil._validateJwt: exp was not provided\"),Promise.reject(new Error(\"exp was not provided\"));if(c.exp<l)return i.Log.error(\"JoseUtil._validateJwt: exp is in the past\",c.exp),Promise.reject(new Error(\"exp is in the past:\"+c.exp))}return Promise.resolve(c)},t._validateJwt=function r(n,o,s,a,c,h,l){return t.validateJwtAttributes(n,s,a,c,h,l).then((function(t){try{return e.JWS.verify(n,o,u)?t:(i.Log.error(\"JoseUtil._validateJwt: signature validation failed\"),Promise.reject(new Error(\"signature validation failed\")))}catch(t){return i.Log.error(t&&t.message||t),Promise.reject(new Error(\"signature validation failed\"))}}))},t.hashString=function t(e,r){try{return o.Util.hashString(e,r)}catch(t){i.Log.error(t)}},t.hexToBase64Url=function t(e){try{return s(e)}catch(t){i.Log.error(t)}},t}()};var i=r(0);t.exports=e.default},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SigninResponse=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(3);function o(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.SigninResponse=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"#\";o(this,t);var n=i.UrlUtility.parseUrlFragment(e,r);this.error=n.error,this.error_description=n.error_description,this.error_uri=n.error_uri,this.code=n.code,this.state=n.state,this.id_token=n.id_token,this.session_state=n.session_state,this.access_token=n.access_token,this.token_type=n.token_type,this.scope=n.scope,this.profile=void 0,this.expires_in=n.expires_in}return n(t,[{key:\"expires_in\",get:function t(){if(this.expires_at){var e=parseInt(Date.now()/1e3);return this.expires_at-e}},set:function t(e){var r=parseInt(e);if(\"number\"==typeof r&&r>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+r}}},{key:\"expired\",get:function t(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:\"scopes\",get:function t(){return(this.scope||\"\").split(\" \")}},{key:\"isOpenIdConnect\",get:function t(){return this.scopes.indexOf(\"openid\")>=0||!!this.id_token}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SignoutRequest=void 0;var n=r(0),i=r(3),o=r(9);e.SignoutRequest=function t(e){var r=e.url,s=e.id_token_hint,a=e.post_logout_redirect_uri,u=e.data,c=e.extraQueryParams,h=e.request_type;if(function l(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),!r)throw n.Log.error(\"SignoutRequest.ctor: No url passed\"),new Error(\"url\");for(var f in s&&(r=i.UrlUtility.addQueryParam(r,\"id_token_hint\",s)),a&&(r=i.UrlUtility.addQueryParam(r,\"post_logout_redirect_uri\",a),u&&(this.state=new o.State({data:u,request_type:h}),r=i.UrlUtility.addQueryParam(r,\"state\",this.state.id))),c)r=i.UrlUtility.addQueryParam(r,f,c[f]);this.url=r}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SignoutResponse=void 0;var n=r(3);e.SignoutResponse=function t(e){!function r(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t);var i=n.UrlUtility.parseUrlFragment(e,\"?\");this.error=i.error,this.error_description=i.error_description,this.error_uri=i.error_uri,this.state=i.state}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.InMemoryWebStorage=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0);e.InMemoryWebStorage=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this._data={}}return t.prototype.getItem=function t(e){return i.Log.debug(\"InMemoryWebStorage.getItem\",e),this._data[e]},t.prototype.setItem=function t(e,r){i.Log.debug(\"InMemoryWebStorage.setItem\",e),this._data[e]=r},t.prototype.removeItem=function t(e){i.Log.debug(\"InMemoryWebStorage.removeItem\",e),delete this._data[e]},t.prototype.key=function t(e){return Object.getOwnPropertyNames(this._data)[e]},n(t,[{key:\"length\",get:function t(){return Object.getOwnPropertyNames(this._data).length}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UserManager=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0),o=r(10),s=r(39),a=r(15),u=r(45),c=r(47),h=r(18),l=r(8),f=r(20),g=r(11),d=r(4);function p(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function v(t,e){if(!t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!e||\"object\"!=typeof e&&\"function\"!=typeof e?t:e}e.UserManager=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.SilentRenewService,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.SessionMonitor,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:f.TokenRevocationClient,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:g.TokenClient,y=arguments.length>5&&void 0!==arguments[5]?arguments[5]:d.JoseUtil;p(this,e),r instanceof s.UserManagerSettings||(r=new s.UserManagerSettings(r));var m=v(this,t.call(this,r));return m._events=new u.UserManagerEvents(r),m._silentRenewService=new n(m),m.settings.automaticSilentRenew&&(i.Log.debug(\"UserManager.ctor: automaticSilentRenew is configured, setting up silent renew\"),m.startSilentRenew()),m.settings.monitorSession&&(i.Log.debug(\"UserManager.ctor: monitorSession is configured, setting up session monitor\"),m._sessionMonitor=new o(m)),m._tokenRevocationClient=new a(m._settings),m._tokenClient=new l(m._settings),m._joseUtil=y,m}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUser=function t(){var e=this;return this._loadUser().then((function(t){return t?(i.Log.info(\"UserManager.getUser: user loaded\"),e._events.load(t,!1),t):(i.Log.info(\"UserManager.getUser: user not found in storage\"),null)}))},e.prototype.removeUser=function t(){var e=this;return this.storeUser(null).then((function(){i.Log.info(\"UserManager.removeUser: user removed from storage\"),e._events.unload()}))},e.prototype.signinRedirect=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"si:r\";var r={useReplaceToNavigate:e.useReplaceToNavigate};return this._signinStart(e,this._redirectNavigator,r).then((function(){i.Log.info(\"UserManager.signinRedirect: successful\")}))},e.prototype.signinRedirectCallback=function t(e){return this._signinEnd(e||this._redirectNavigator.url).then((function(t){return t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinRedirectCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinRedirectCallback: no sub\"),t}))},e.prototype.signinPopup=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"si:p\";var r=e.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return r?(e.redirect_uri=r,e.display=\"popup\",this._signin(e,this._popupNavigator,{startUrl:r,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinPopup: signinPopup successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinPopup: no sub\")),t}))):(i.Log.error(\"UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured\"),Promise.reject(new Error(\"No popup_redirect_uri or redirect_uri configured\")))},e.prototype.signinPopupCallback=function t(e){return this._signinCallback(e,this._popupNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinPopupCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinPopupCallback: no sub\")),t})).catch((function(t){i.Log.error(t.message)}))},e.prototype.signinSilent=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r=Object.assign({},r),this._loadUser().then((function(t){return t&&t.refresh_token?(r.refresh_token=t.refresh_token,e._useRefreshToken(r)):(r.request_type=\"si:s\",r.id_token_hint=r.id_token_hint||e.settings.includeIdTokenInSilentRenew&&t&&t.id_token,t&&e._settings.validateSubOnSilentRenew&&(i.Log.debug(\"UserManager.signinSilent, subject prior to silent renew: \",t.profile.sub),r.current_sub=t.profile.sub),e._signinSilentIframe(r))}))},e.prototype._useRefreshToken=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(r).then((function(t){return t?t.access_token?e._loadUser().then((function(r){if(r){var n=Promise.resolve();return t.id_token&&(n=e._validateIdTokenFromTokenRefreshToken(r.profile,t.id_token)),n.then((function(){return i.Log.debug(\"UserManager._useRefreshToken: refresh token response success\"),r.id_token=t.id_token||r.id_token,r.access_token=t.access_token,r.refresh_token=t.refresh_token||r.refresh_token,r.expires_in=t.expires_in,e.storeUser(r).then((function(){return e._events.load(r),r}))}))}return null})):(i.Log.error(\"UserManager._useRefreshToken: No access token returned from token endpoint\"),Promise.reject(\"No access token returned from token endpoint\")):(i.Log.error(\"UserManager._useRefreshToken: No response returned from token endpoint\"),Promise.reject(\"No response returned from token endpoint\"))}))},e.prototype._validateIdTokenFromTokenRefreshToken=function t(e,r){var n=this;return this._metadataService.getIssuer().then((function(t){return n.settings.getEpochTime().then((function(o){return n._joseUtil.validateJwtAttributes(r,t,n._settings.client_id,n._settings.clockSkew,o).then((function(t){return t?t.sub!==e.sub?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub\"),Promise.reject(new Error(\"sub in id_token does not match current sub\"))):t.auth_time&&t.auth_time!==e.auth_time?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time\"),Promise.reject(new Error(\"auth_time in id_token does not match original auth_time\"))):t.azp&&t.azp!==e.azp?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp\"),Promise.reject(new Error(\"azp in id_token does not match original azp\"))):!t.azp&&e.azp?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token\"),Promise.reject(new Error(\"azp not in id_token, but present in original id_token\"))):void 0:(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token\"),Promise.reject(new Error(\"Failed to validate id_token\")))}))}))}))},e.prototype._signinSilentIframe=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return r?(e.redirect_uri=r,e.prompt=e.prompt||\"none\",this._signin(e,this._iframeNavigator,{startUrl:r,silentRequestTimeout:e.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinSilent: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinSilent: no sub\")),t}))):(i.Log.error(\"UserManager.signinSilent: No silent_redirect_uri configured\"),Promise.reject(new Error(\"No silent_redirect_uri configured\")))},e.prototype.signinSilentCallback=function t(e){return this._signinCallback(e,this._iframeNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinSilentCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinSilentCallback: no sub\")),t}))},e.prototype.signinCallback=function t(e){var r=this;return this.readSigninResponseState(e).then((function(t){var n=t.state;t.response;return\"si:r\"===n.request_type?r.signinRedirectCallback(e):\"si:p\"===n.request_type?r.signinPopupCallback(e):\"si:s\"===n.request_type?r.signinSilentCallback(e):Promise.reject(new Error(\"invalid response_type in state\"))}))},e.prototype.signoutCallback=function t(e,r){var n=this;return this.readSignoutResponseState(e).then((function(t){var i=t.state,o=t.response;return i?\"so:r\"===i.request_type?n.signoutRedirectCallback(e):\"so:p\"===i.request_type?n.signoutPopupCallback(e,r):Promise.reject(new Error(\"invalid response_type in state\")):o}))},e.prototype.querySessionStatus=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).request_type=\"si:s\";var n=r.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return n?(r.redirect_uri=n,r.prompt=\"none\",r.response_type=r.response_type||this.settings.query_status_response_type,r.scope=r.scope||\"openid\",r.skipUserInfo=!0,this._signinStart(r,this._iframeNavigator,{startUrl:n,silentRequestTimeout:r.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return e.processSigninResponse(t.url).then((function(t){if(i.Log.debug(\"UserManager.querySessionStatus: got signin response\"),t.session_state&&t.profile.sub)return i.Log.info(\"UserManager.querySessionStatus: querySessionStatus success for sub: \",t.profile.sub),{session_state:t.session_state,sub:t.profile.sub,sid:t.profile.sid};i.Log.info(\"querySessionStatus successful, user not authenticated\")})).catch((function(t){if(t.session_state&&e.settings.monitorAnonymousSession&&(\"login_required\"==t.message||\"consent_required\"==t.message||\"interaction_required\"==t.message||\"account_selection_required\"==t.message))return i.Log.info(\"UserManager.querySessionStatus: querySessionStatus success for anonymous user\"),{session_state:t.session_state};throw t}))}))):(i.Log.error(\"UserManager.querySessionStatus: No silent_redirect_uri configured\"),Promise.reject(new Error(\"No silent_redirect_uri configured\")))},e.prototype._signin=function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signinStart(e,r,i).then((function(t){return n._signinEnd(t.url,e)}))},e.prototype._signinStart=function t(e,r){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.prepare(o).then((function(t){return i.Log.debug(\"UserManager._signinStart: got navigator window handle\"),n.createSigninRequest(e).then((function(e){return i.Log.debug(\"UserManager._signinStart: got signin request\"),o.url=e.url,o.id=e.state.id,t.navigate(o)})).catch((function(e){throw t.close&&(i.Log.debug(\"UserManager._signinStart: Error after preparing navigator, closing navigator window\"),t.close()),e}))}))},e.prototype._signinEnd=function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.processSigninResponse(e).then((function(t){i.Log.debug(\"UserManager._signinEnd: got signin response\");var e=new a.User(t);if(n.current_sub){if(n.current_sub!==e.profile.sub)return i.Log.debug(\"UserManager._signinEnd: current user does not match user returned from signin. sub from signin: \",e.profile.sub),Promise.reject(new Error(\"login_required\"));i.Log.debug(\"UserManager._signinEnd: current user matches user returned from signin\")}return r.storeUser(e).then((function(){return i.Log.debug(\"UserManager._signinEnd: user stored\"),r._events.load(e),e}))}))},e.prototype._signinCallback=function t(e,r){i.Log.debug(\"UserManager._signinCallback\");var n=\"query\"===this._settings.response_mode||!this._settings.response_mode&&l.SigninRequest.isCode(this._settings.response_type)?\"?\":\"#\";return r.callback(e,void 0,n)},e.prototype.signoutRedirect=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"so:r\";var r=e.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;r&&(e.post_logout_redirect_uri=r);var n={useReplaceToNavigate:e.useReplaceToNavigate};return this._signoutStart(e,this._redirectNavigator,n).then((function(){i.Log.info(\"UserManager.signoutRedirect: successful\")}))},e.prototype.signoutRedirectCallback=function t(e){return this._signoutEnd(e||this._redirectNavigator.url).then((function(t){return i.Log.info(\"UserManager.signoutRedirectCallback: successful\"),t}))},e.prototype.signoutPopup=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"so:p\";var r=e.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return e.post_logout_redirect_uri=r,e.display=\"popup\",e.post_logout_redirect_uri&&(e.state=e.state||{}),this._signout(e,this._popupNavigator,{startUrl:r,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(){i.Log.info(\"UserManager.signoutPopup: successful\")}))},e.prototype.signoutPopupCallback=function t(e,r){void 0===r&&\"boolean\"==typeof e&&(r=e,e=null);return this._popupNavigator.callback(e,r,\"?\").then((function(){i.Log.info(\"UserManager.signoutPopupCallback: successful\")}))},e.prototype._signout=function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signoutStart(e,r,i).then((function(t){return n._signoutEnd(t.url)}))},e.prototype._signoutStart=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this,n=arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.prepare(o).then((function(t){return i.Log.debug(\"UserManager._signoutStart: got navigator window handle\"),r._loadUser().then((function(n){return i.Log.debug(\"UserManager._signoutStart: loaded current user from storage\"),(r._settings.revokeAccessTokenOnSignout?r._revokeInternal(n):Promise.resolve()).then((function(){var s=e.id_token_hint||n&&n.id_token;return s&&(i.Log.debug(\"UserManager._signoutStart: Setting id_token into signout request\"),e.id_token_hint=s),r.removeUser().then((function(){return i.Log.debug(\"UserManager._signoutStart: user removed, creating signout request\"),r.createSignoutRequest(e).then((function(e){return i.Log.debug(\"UserManager._signoutStart: got signout request\"),o.url=e.url,e.state&&(o.id=e.state.id),t.navigate(o)}))}))}))})).catch((function(e){throw t.close&&(i.Log.debug(\"UserManager._signoutStart: Error after preparing navigator, closing navigator window\"),t.close()),e}))}))},e.prototype._signoutEnd=function t(e){return this.processSignoutResponse(e).then((function(t){return i.Log.debug(\"UserManager._signoutEnd: got signout response\"),t}))},e.prototype.revokeAccessToken=function t(){var e=this;return this._loadUser().then((function(t){return e._revokeInternal(t,!0).then((function(r){if(r)return i.Log.debug(\"UserManager.revokeAccessToken: removing token properties from user and re-storing\"),t.access_token=null,t.refresh_token=null,t.expires_at=null,t.token_type=null,e.storeUser(t).then((function(){i.Log.debug(\"UserManager.revokeAccessToken: user stored\"),e._events.load(t)}))}))})).then((function(){i.Log.info(\"UserManager.revokeAccessToken: access token revoked successfully\")}))},e.prototype._revokeInternal=function t(e,r){var n=this;if(e){var o=e.access_token,s=e.refresh_token;return this._revokeAccessTokenInternal(o,r).then((function(t){return n._revokeRefreshTokenInternal(s,r).then((function(e){return t||e||i.Log.debug(\"UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format\"),t||e}))}))}return Promise.resolve(!1)},e.prototype._revokeAccessTokenInternal=function t(e,r){return!e||e.indexOf(\".\")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(e,r).then((function(){return!0}))},e.prototype._revokeRefreshTokenInternal=function t(e,r){return e?this._tokenRevocationClient.revoke(e,r,\"refresh_token\").then((function(){return!0})):Promise.resolve(!1)},e.prototype.startSilentRenew=function t(){this._silentRenewService.start()},e.prototype.stopSilentRenew=function t(){this._silentRenewService.stop()},e.prototype._loadUser=function t(){return this._userStore.get(this._userStoreKey).then((function(t){return t?(i.Log.debug(\"UserManager._loadUser: user storageString loaded\"),a.User.fromStorageString(t)):(i.Log.debug(\"UserManager._loadUser: no user storageString\"),null)}))},e.prototype.storeUser=function t(e){if(e){i.Log.debug(\"UserManager.storeUser: storing user\");var r=e.toStorageString();return this._userStore.set(this._userStoreKey,r)}return i.Log.debug(\"storeUser.storeUser: removing user\"),this._userStore.remove(this._userStoreKey)},n(e,[{key:\"_redirectNavigator\",get:function t(){return this.settings.redirectNavigator}},{key:\"_popupNavigator\",get:function t(){return this.settings.popupNavigator}},{key:\"_iframeNavigator\",get:function t(){return this.settings.iframeNavigator}},{key:\"_userStore\",get:function t(){return this.settings.userStore}},{key:\"events\",get:function t(){return this._events}},{key:\"_userStoreKey\",get:function t(){return\"user:\"+this.settings.authority+\":\"+this.settings.client_id}}]),e}(o.OidcClient)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UserManagerSettings=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=(r(0),r(5)),o=r(40),s=r(41),a=r(43),u=r(6),c=r(1),h=r(8);function l(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function f(t,e){if(!t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!e||\"object\"!=typeof e&&\"function\"!=typeof e?t:e}e.UserManagerSettings=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.popup_redirect_uri,i=r.popup_post_logout_redirect_uri,g=r.popupWindowFeatures,d=r.popupWindowTarget,p=r.silent_redirect_uri,v=r.silentRequestTimeout,y=r.automaticSilentRenew,m=void 0!==y&&y,_=r.validateSubOnSilentRenew,S=void 0!==_&&_,b=r.includeIdTokenInSilentRenew,w=void 0===b||b,F=r.monitorSession,E=void 0===F||F,x=r.monitorAnonymousSession,A=void 0!==x&&x,k=r.checkSessionInterval,P=void 0===k?2e3:k,C=r.stopCheckSessionOnError,T=void 0===C||C,R=r.query_status_response_type,I=r.revokeAccessTokenOnSignout,D=void 0!==I&&I,L=r.accessTokenExpiringNotificationTime,N=void 0===L?60:L,U=r.redirectNavigator,B=void 0===U?new o.RedirectNavigator:U,O=r.popupNavigator,j=void 0===O?new s.PopupNavigator:O,M=r.iframeNavigator,H=void 0===M?new a.IFrameNavigator:M,V=r.userStore,K=void 0===V?new u.WebStorageStateStore({store:c.Global.sessionStorage}):V;l(this,e);var q=f(this,t.call(this,arguments[0]));return q._popup_redirect_uri=n,q._popup_post_logout_redirect_uri=i,q._popupWindowFeatures=g,q._popupWindowTarget=d,q._silent_redirect_uri=p,q._silentRequestTimeout=v,q._automaticSilentRenew=m,q._validateSubOnSilentRenew=S,q._includeIdTokenInSilentRenew=w,q._accessTokenExpiringNotificationTime=N,q._monitorSession=E,q._monitorAnonymousSession=A,q._checkSessionInterval=P,q._stopCheckSessionOnError=T,R?q._query_status_response_type=R:arguments[0]&&arguments[0].response_type?q._query_status_response_type=h.SigninRequest.isOidc(arguments[0].response_type)?\"id_token\":\"code\":q._query_status_response_type=\"id_token\",q._revokeAccessTokenOnSignout=D,q._redirectNavigator=B,q._popupNavigator=j,q._iframeNavigator=H,q._userStore=K,q}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),n(e,[{key:\"popup_redirect_uri\",get:function t(){return this._popup_redirect_uri}},{key:\"popup_post_logout_redirect_uri\",get:function t(){return this._popup_post_logout_redirect_uri}},{key:\"popupWindowFeatures\",get:function t(){return this._popupWindowFeatures}},{key:\"popupWindowTarget\",get:function t(){return this._popupWindowTarget}},{key:\"silent_redirect_uri\",get:function t(){return this._silent_redirect_uri}},{key:\"silentRequestTimeout\",get:function t(){return this._silentRequestTimeout}},{key:\"automaticSilentRenew\",get:function t(){return this._automaticSilentRenew}},{key:\"validateSubOnSilentRenew\",get:function t(){return this._validateSubOnSilentRenew}},{key:\"includeIdTokenInSilentRenew\",get:function t(){return this._includeIdTokenInSilentRenew}},{key:\"accessTokenExpiringNotificationTime\",get:function t(){return this._accessTokenExpiringNotificationTime}},{key:\"monitorSession\",get:function t(){return this._monitorSession}},{key:\"monitorAnonymousSession\",get:function t(){return this._monitorAnonymousSession}},{key:\"checkSessionInterval\",get:function t(){return this._checkSessionInterval}},{key:\"stopCheckSessionOnError\",get:function t(){return this._stopCheckSessionOnError}},{key:\"query_status_response_type\",get:function t(){return this._query_status_response_type}},{key:\"revokeAccessTokenOnSignout\",get:function t(){return this._revokeAccessTokenOnSignout}},{key:\"redirectNavigator\",get:function t(){return this._redirectNavigator}},{key:\"popupNavigator\",get:function t(){return this._popupNavigator}},{key:\"iframeNavigator\",get:function t(){return this._iframeNavigator}},{key:\"userStore\",get:function t(){return this._userStore}}]),e}(i.OidcClientSettings)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.RedirectNavigator=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0);e.RedirectNavigator=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.prototype.prepare=function t(){return Promise.resolve(this)},t.prototype.navigate=function t(e){return e&&e.url?(e.useReplaceToNavigate?window.location.replace(e.url):window.location=e.url,Promise.resolve()):(i.Log.error(\"RedirectNavigator.navigate: No url provided\"),Promise.reject(new Error(\"No url provided\")))},n(t,[{key:\"url\",get:function t(){return window.location.href}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.PopupNavigator=void 0;var n=r(0),i=r(42);e.PopupNavigator=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.prototype.prepare=function t(e){var r=new i.PopupWindow(e);return Promise.resolve(r)},t.prototype.callback=function t(e,r,o){n.Log.debug(\"PopupNavigator.callback\");try{return i.PopupWindow.notifyOpener(e,r,o),Promise.resolve()}catch(t){return Promise.reject(t)}},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.PopupWindow=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0),o=r(3);e.PopupWindow=function(){function t(e){var r=this;!function n(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this._promise=new Promise((function(t,e){r._resolve=t,r._reject=e}));var o=e.popupWindowTarget||\"_blank\",s=e.popupWindowFeatures||\"location=no,toolbar=no,width=500,height=500,left=100,top=100;\";this._popup=window.open(\"\",o,s),this._popup&&(i.Log.debug(\"PopupWindow.ctor: popup successfully created\"),this._checkForPopupClosedTimer=window.setInterval(this._checkForPopupClosed.bind(this),500))}return t.prototype.navigate=function t(e){return this._popup?e&&e.url?(i.Log.debug(\"PopupWindow.navigate: Setting URL in popup\"),this._id=e.id,this._id&&(window[\"popupCallback_\"+e.id]=this._callback.bind(this)),this._popup.focus(),this._popup.window.location=e.url):(this._error(\"PopupWindow.navigate: no url provided\"),this._error(\"No url provided\")):this._error(\"PopupWindow.navigate: Error opening popup window\"),this.promise},t.prototype._success=function t(e){i.Log.debug(\"PopupWindow.callback: Successful response from popup window\"),this._cleanup(),this._resolve(e)},t.prototype._error=function t(e){i.Log.error(\"PopupWindow.error: \",e),this._cleanup(),this._reject(new Error(e))},t.prototype.close=function t(){this._cleanup(!1)},t.prototype._cleanup=function t(e){i.Log.debug(\"PopupWindow.cleanup\"),window.clearInterval(this._checkForPopupClosedTimer),this._checkForPopupClosedTimer=null,delete window[\"popupCallback_\"+this._id],this._popup&&!e&&this._popup.close(),this._popup=null},t.prototype._checkForPopupClosed=function t(){this._popup&&!this._popup.closed||this._error(\"Popup window closed\")},t.prototype._callback=function t(e,r){this._cleanup(r),e?(i.Log.debug(\"PopupWindow.callback success\"),this._success({url:e})):(i.Log.debug(\"PopupWindow.callback: Invalid response from popup\"),this._error(\"Invalid response from popup\"))},t.notifyOpener=function t(e,r,n){if(window.opener){if(e=e||window.location.href){var s=o.UrlUtility.parseUrlFragment(e,n);if(s.state){var a=\"popupCallback_\"+s.state,u=window.opener[a];u?(i.Log.debug(\"PopupWindow.notifyOpener: passing url message to opener\"),u(e,r)):i.Log.warn(\"PopupWindow.notifyOpener: no matching callback found on opener\")}else i.Log.warn(\"PopupWindow.notifyOpener: no state found in response url\")}}else i.Log.warn(\"PopupWindow.notifyOpener: no window.opener. Can't complete notification.\")},n(t,[{key:\"promise\",get:function t(){return this._promise}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.IFrameNavigator=void 0;var n=r(0),i=r(44);e.IFrameNavigator=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.prototype.prepare=function t(e){var r=new i.IFrameWindow(e);return Promise.resolve(r)},t.prototype.callback=function t(e){n.Log.debug(\"IFrameNavigator.callback\");try{return i.IFrameWindow.notifyParent(e),Promise.resolve()}catch(t){return Promise.reject(t)}},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.IFrameWindow=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0);e.IFrameWindow=function(){function t(e){var r=this;!function n(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this._promise=new Promise((function(t,e){r._resolve=t,r._reject=e})),this._boundMessageEvent=this._message.bind(this),window.addEventListener(\"message\",this._boundMessageEvent,!1),this._frame=window.document.createElement(\"iframe\"),this._frame.style.visibility=\"hidden\",this._frame.style.position=\"absolute\",this._frame.width=0,this._frame.height=0,window.document.body.appendChild(this._frame)}return t.prototype.navigate=function t(e){if(e&&e.url){var r=e.silentRequestTimeout||1e4;i.Log.debug(\"IFrameWindow.navigate: Using timeout of:\",r),this._timer=window.setTimeout(this._timeout.bind(this),r),this._frame.src=e.url}else this._error(\"No url provided\");return this.promise},t.prototype._success=function t(e){this._cleanup(),i.Log.debug(\"IFrameWindow: Successful response from frame window\"),this._resolve(e)},t.prototype._error=function t(e){this._cleanup(),i.Log.error(e),this._reject(new Error(e))},t.prototype.close=function t(){this._cleanup()},t.prototype._cleanup=function t(){this._frame&&(i.Log.debug(\"IFrameWindow: cleanup\"),window.removeEventListener(\"message\",this._boundMessageEvent,!1),window.clearTimeout(this._timer),window.document.body.removeChild(this._frame),this._timer=null,this._frame=null,this._boundMessageEvent=null)},t.prototype._timeout=function t(){i.Log.debug(\"IFrameWindow.timeout\"),this._error(\"Frame window timed out\")},t.prototype._message=function t(e){if(i.Log.debug(\"IFrameWindow.message\"),this._timer&&e.origin===this._origin&&e.source===this._frame.contentWindow&&\"string\"==typeof e.data&&(e.data.startsWith(\"http://\")||e.data.startsWith(\"https://\"))){var r=e.data;r?this._success({url:r}):this._error(\"Invalid response from frame\")}},t.notifyParent=function t(e){i.Log.debug(\"IFrameWindow.notifyParent\"),(e=e||window.location.href)&&(i.Log.debug(\"IFrameWindow.notifyParent: posting url message to parent\"),window.parent.postMessage(e,location.protocol+\"//\"+location.host))},n(t,[{key:\"promise\",get:function t(){return this._promise}},{key:\"_origin\",get:function t(){return location.protocol+\"//\"+location.host}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UserManagerEvents=void 0;var n=r(0),i=r(16),o=r(17);e.UserManagerEvents=function(t){function e(r){!function n(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,e);var i=function s(t,e){if(!t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!e||\"object\"!=typeof e&&\"function\"!=typeof e?t:e}(this,t.call(this,r));return i._userLoaded=new o.Event(\"User loaded\"),i._userUnloaded=new o.Event(\"User unloaded\"),i._silentRenewError=new o.Event(\"Silent renew error\"),i._userSignedIn=new o.Event(\"User signed in\"),i._userSignedOut=new o.Event(\"User signed out\"),i._userSessionChanged=new o.Event(\"User session changed\"),i}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.load=function e(r){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];n.Log.debug(\"UserManagerEvents.load\"),t.prototype.load.call(this,r),i&&this._userLoaded.raise(r)},e.prototype.unload=function e(){n.Log.debug(\"UserManagerEvents.unload\"),t.prototype.unload.call(this),this._userUnloaded.raise()},e.prototype.addUserLoaded=function t(e){this._userLoaded.addHandler(e)},e.prototype.removeUserLoaded=function t(e){this._userLoaded.removeHandler(e)},e.prototype.addUserUnloaded=function t(e){this._userUnloaded.addHandler(e)},e.prototype.removeUserUnloaded=function t(e){this._userUnloaded.removeHandler(e)},e.prototype.addSilentRenewError=function t(e){this._silentRenewError.addHandler(e)},e.prototype.removeSilentRenewError=function t(e){this._silentRenewError.removeHandler(e)},e.prototype._raiseSilentRenewError=function t(e){n.Log.debug(\"UserManagerEvents._raiseSilentRenewError\",e.message),this._silentRenewError.raise(e)},e.prototype.addUserSignedIn=function t(e){this._userSignedIn.addHandler(e)},e.prototype.removeUserSignedIn=function t(e){this._userSignedIn.removeHandler(e)},e.prototype._raiseUserSignedIn=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSignedIn\"),this._userSignedIn.raise()},e.prototype.addUserSignedOut=function t(e){this._userSignedOut.addHandler(e)},e.prototype.removeUserSignedOut=function t(e){this._userSignedOut.removeHandler(e)},e.prototype._raiseUserSignedOut=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSignedOut\"),this._userSignedOut.raise()},e.prototype.addUserSessionChanged=function t(e){this._userSessionChanged.addHandler(e)},e.prototype.removeUserSessionChanged=function t(e){this._userSessionChanged.removeHandler(e)},e.prototype._raiseUserSessionChanged=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSessionChanged\"),this._userSessionChanged.raise()},e}(i.AccessTokenEvents)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.Timer=void 0;var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=r(0),o=r(1),s=r(17);function a(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function u(t,e){if(!t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!e||\"object\"!=typeof e&&\"function\"!=typeof e?t:e}e.Timer=function(t){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.timer,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;a(this,e);var s=u(this,t.call(this,r));return s._timer=n,s._nowFunc=i||function(){return Date.now()/1e3},s}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.init=function t(e){e<=0&&(e=1),e=parseInt(e);var r=this.now+e;if(this.expiration===r&&this._timerHandle)i.Log.debug(\"Timer.init timer \"+this._name+\" skipping initialization since already initialized for expiration:\",this.expiration);else{this.cancel(),i.Log.debug(\"Timer.init timer \"+this._name+\" for duration:\",e),this._expiration=r;var n=5;e<n&&(n=e),this._timerHandle=this._timer.setInterval(this._callback.bind(this),1e3*n)}},e.prototype.cancel=function t(){this._timerHandle&&(i.Log.debug(\"Timer.cancel: \",this._name),this._timer.clearInterval(this._timerHandle),this._timerHandle=null)},e.prototype._callback=function e(){var r=this._expiration-this.now;i.Log.debug(\"Timer.callback; \"+this._name+\" timer expires in:\",r),this._expiration<=this.now&&(this.cancel(),t.prototype.raise.call(this))},n(e,[{key:\"now\",get:function t(){return parseInt(this._nowFunc())}},{key:\"expiration\",get:function t(){return this._expiration}}]),e}(s.Event)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SilentRenewService=void 0;var n=r(0);e.SilentRenewService=function(){function t(e){!function r(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this._userManager=e}return t.prototype.start=function t(){this._callback||(this._callback=this._tokenExpiring.bind(this),this._userManager.events.addAccessTokenExpiring(this._callback),this._userManager.getUser().then((function(t){})).catch((function(t){n.Log.error(\"SilentRenewService.start: Error from getUser:\",t.message)})))},t.prototype.stop=function t(){this._callback&&(this._userManager.events.removeAccessTokenExpiring(this._callback),delete this._callback)},t.prototype._tokenExpiring=function t(){var e=this;this._userManager.signinSilent().then((function(t){n.Log.debug(\"SilentRenewService._tokenExpiring: Silent token renewal successful\")}),(function(t){n.Log.error(\"SilentRenewService._tokenExpiring: Error from signinSilent:\",t.message),e._userManager.events._raiseSilentRenewError(t)}))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.CordovaPopupNavigator=void 0;var n=r(21);e.CordovaPopupNavigator=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.prototype.prepare=function t(e){var r=new n.CordovaPopupWindow(e);return Promise.resolve(r)},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.CordovaIFrameNavigator=void 0;var n=r(21);e.CordovaIFrameNavigator=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.prototype.prepare=function t(e){e.popupWindowFeatures=\"hidden=yes\";var r=new n.CordovaPopupWindow(e);return Promise.resolve(r)},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});e.Version=\"1.11.6\"}])}));","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return '<Buffer ' + str + '>'\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__8392__;","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/**\n * The superclass of all RDF Statement objects, that is\n * NamedNode, Literal, BlankNode, etc.\n * Should not be instantiated directly.\n * Also called Term.\n * @link https://rdf.js.org/data-model-spec/#term-interface\n * @class Node\n */\nexport default class Node {\n constructor(value) {\n /** The type of node */\n _defineProperty(this, \"termType\", void 0);\n /** The class order for this node */\n _defineProperty(this, \"classOrder\", void 0);\n /** The node's value */\n _defineProperty(this, \"value\", void 0);\n this.value = value;\n }\n\n /**\n * Creates the substituted node for this one, according to the specified bindings\n * @param bindings - Bindings of identifiers to nodes\n */\n substitute(bindings) {\n return this;\n }\n\n /**\n * Compares this node with another\n * @see {equals} to check if two nodes are equal\n * @param other - The other node\n */\n compareTerm(other) {\n if (this.classOrder < other.classOrder) {\n return -1;\n }\n if (this.classOrder > other.classOrder) {\n return +1;\n }\n if (this.value < other.value) {\n return -1;\n }\n if (this.value > other.value) {\n return +1;\n }\n return 0;\n }\n\n /**\n * Compares whether the two nodes are equal\n * @param other The other node\n */\n equals(other) {\n if (!other) {\n return false;\n }\n return this.termType === other.termType && this.value === other.value;\n }\n\n /**\n * Creates a hash for this node\n * @deprecated use {rdfFactory.id} instead if possible\n */\n hashString() {\n return this.toCanonical();\n }\n\n /**\n * Compares whether this node is the same as the other one\n * @param other - Another node\n */\n sameTerm(other) {\n return this.equals(other);\n }\n\n /**\n * Creates a canonical string representation of this node\n */\n toCanonical() {\n return this.toNT();\n }\n\n /**\n * Creates a n-triples string representation of this node\n */\n toNT() {\n return this.toString();\n }\n\n /**\n * Creates a n-quads string representation of this node\n */\n toNQ() {\n return this.toNT();\n }\n\n /**\n * Creates a string representation of this node\n */\n toString() {\n throw new Error('Node.toString() is abstract - see the subclasses instead');\n }\n}\n// Specified in './node.ts' to prevent circular dependency\n_defineProperty(Node, \"fromValue\", void 0);\n// Specified in './node.ts' to prevent circular dependency\n_defineProperty(Node, \"toJS\", void 0);","export const NamedNodeTermType = \"NamedNode\";\nexport const BlankNodeTermType = \"BlankNode\";\nexport const LiteralTermType = \"Literal\";\nexport const VariableTermType = \"Variable\";\nexport const DefaultGraphTermType = \"DefaultGraph\";\n// Non-RDF/JS types:\nexport const CollectionTermType = \"Collection\";\nexport const EmptyTermType = \"Empty\";\nexport const GraphTermType = \"Graph\";\nexport const HTMLContentType = \"text/html\";\nexport const JSONLDContentType = \"application/ld+json\";\nexport const N3ContentType = \"text/n3\";\nexport const N3LegacyContentType = \"application/n3\";\nexport const NQuadsAltContentType = \"application/nquads\";\nexport const NQuadsContentType = \"application/n-quads\";\nexport const NTriplesContentType = \"application/n-triples\";\nexport const RDFXMLContentType = \"application/rdf+xml\";\nexport const SPARQLUpdateContentType = \"application/sparql-update\";\nexport const SPARQLUpdateSingleMatchContentType = \"application/sparql-update-single-match\";\nexport const TurtleContentType = \"text/turtle\";\nexport const TurtleLegacyContentType = \"application/x-turtle\";\nexport const XHTMLContentType = \"application/xhtml+xml\";\n\n/**\n * A valid mime type header\n */\n\n/** A type for values that serves as inputs */\n\n/**\n * In this project, there exist two types for the same kind of RDF concept.\n * We have RDF/JS spec types (standardized, generic), and RDFlib types (internal, specific).\n * When deciding which type to use in a function, it is preferable to accept generic inputs,\n * whenever possible, and provide strict outputs.\n * In some ways, the TF types in here are a bit more strict.\n * Variables are missing, and the statement requires specific types of terms (e.g. NamedNode instead of Term).\n */\n\n/** An RDF/JS Subject */\n\n/** An RDF/JS Predicate */\n\n/** An RDF/JS Object */\n\n/** An RDF/JS Graph */\n// | Formula\n\n/** All the types that a .fromValue() method might return */","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".solid-logic.js\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.hmd = (module) => {\n\tmodule = Object.create(module);\n\tif (!module.children) module.children = [];\n\tObject.defineProperty(module, 'exports', {\n\t\tenumerable: true,\n\t\tset: () => {\n\t\t\tthrow new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);\n\t\t}\n\t});\n\treturn module;\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var inProgress = {};\nvar dataWebpackPrefix = \"SolidLogic:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/^blob:/, \"\").replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t792: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n// no on chunks loaded\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\n}\n\nvar chunkLoadingGlobal = this[\"webpackChunkSolidLogic\"] = this[\"webpackChunkSolidLogic\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function log(...args: any[]): void {\n console.log(...args)\n}\n\nexport function warn(...args: any[]): void {\n console.warn(...args)\n}\n\nexport function error(...args: any[]): void {\n console.error(...args)\n}\n\nexport function trace(...args: any[]): void {\n console.trace(...args)\n}\n","import digest from '../runtime/digest.js';\nexport const encoder = new TextEncoder();\nexport const decoder = new TextDecoder();\nconst MAX_INT32 = 2 ** 32;\nexport function concat(...buffers) {\n const size = buffers.reduce((acc, { length }) => acc + length, 0);\n const buf = new Uint8Array(size);\n let i = 0;\n for (const buffer of buffers) {\n buf.set(buffer, i);\n i += buffer.length;\n }\n return buf;\n}\nexport function p2s(alg, p2sInput) {\n return concat(encoder.encode(alg), new Uint8Array([0]), p2sInput);\n}\nfunction writeUInt32BE(buf, value, offset) {\n if (value < 0 || value >= MAX_INT32) {\n throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`);\n }\n buf.set([value >>> 24, value >>> 16, value >>> 8, value & 0xff], offset);\n}\nexport function uint64be(value) {\n const high = Math.floor(value / MAX_INT32);\n const low = value % MAX_INT32;\n const buf = new Uint8Array(8);\n writeUInt32BE(buf, high, 0);\n writeUInt32BE(buf, low, 4);\n return buf;\n}\nexport function uint32be(value) {\n const buf = new Uint8Array(4);\n writeUInt32BE(buf, value);\n return buf;\n}\nexport function lengthAndInput(input) {\n return concat(uint32be(input.length), input);\n}\nexport async function concatKdf(secret, bits, value) {\n const iterations = Math.ceil((bits >> 3) / 32);\n const res = new Uint8Array(iterations * 32);\n for (let iter = 0; iter < iterations; iter++) {\n const buf = new Uint8Array(4 + secret.length + value.length);\n buf.set(uint32be(iter + 1));\n buf.set(secret, 4);\n buf.set(value, 4 + secret.length);\n res.set(await digest('sha256', buf), iter * 32);\n }\n return res.slice(0, bits >> 3);\n}\n","import { encoder, decoder } from '../lib/buffer_utils.js';\nexport const encodeBase64 = (input) => {\n let unencoded = input;\n if (typeof unencoded === 'string') {\n unencoded = encoder.encode(unencoded);\n }\n const CHUNK_SIZE = 0x8000;\n const arr = [];\n for (let i = 0; i < unencoded.length; i += CHUNK_SIZE) {\n arr.push(String.fromCharCode.apply(null, unencoded.subarray(i, i + CHUNK_SIZE)));\n }\n return btoa(arr.join(''));\n};\nexport const encode = (input) => {\n return encodeBase64(input).replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nexport const decodeBase64 = (encoded) => {\n const binary = atob(encoded);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes;\n};\nexport const decode = (input) => {\n let encoded = input;\n if (encoded instanceof Uint8Array) {\n encoded = decoder.decode(encoded);\n }\n encoded = encoded.replace(/-/g, '+').replace(/_/g, '/').replace(/\\s/g, '');\n try {\n return decodeBase64(encoded);\n }\n catch {\n throw new TypeError('The input to be decoded is not correctly encoded.');\n }\n};\n","export class JOSEError extends Error {\n constructor(message, options) {\n super(message, options);\n this.code = 'ERR_JOSE_GENERIC';\n this.name = this.constructor.name;\n Error.captureStackTrace?.(this, this.constructor);\n }\n}\nJOSEError.code = 'ERR_JOSE_GENERIC';\nexport class JWTClaimValidationFailed extends JOSEError {\n constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {\n super(message, { cause: { claim, reason, payload } });\n this.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';\n this.claim = claim;\n this.reason = reason;\n this.payload = payload;\n }\n}\nJWTClaimValidationFailed.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';\nexport class JWTExpired extends JOSEError {\n constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {\n super(message, { cause: { claim, reason, payload } });\n this.code = 'ERR_JWT_EXPIRED';\n this.claim = claim;\n this.reason = reason;\n this.payload = payload;\n }\n}\nJWTExpired.code = 'ERR_JWT_EXPIRED';\nexport class JOSEAlgNotAllowed extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JOSE_ALG_NOT_ALLOWED';\n }\n}\nJOSEAlgNotAllowed.code = 'ERR_JOSE_ALG_NOT_ALLOWED';\nexport class JOSENotSupported extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JOSE_NOT_SUPPORTED';\n }\n}\nJOSENotSupported.code = 'ERR_JOSE_NOT_SUPPORTED';\nexport class JWEDecryptionFailed extends JOSEError {\n constructor(message = 'decryption operation failed', options) {\n super(message, options);\n this.code = 'ERR_JWE_DECRYPTION_FAILED';\n }\n}\nJWEDecryptionFailed.code = 'ERR_JWE_DECRYPTION_FAILED';\nexport class JWEInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWE_INVALID';\n }\n}\nJWEInvalid.code = 'ERR_JWE_INVALID';\nexport class JWSInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWS_INVALID';\n }\n}\nJWSInvalid.code = 'ERR_JWS_INVALID';\nexport class JWTInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWT_INVALID';\n }\n}\nJWTInvalid.code = 'ERR_JWT_INVALID';\nexport class JWKInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWK_INVALID';\n }\n}\nJWKInvalid.code = 'ERR_JWK_INVALID';\nexport class JWKSInvalid extends JOSEError {\n constructor() {\n super(...arguments);\n this.code = 'ERR_JWKS_INVALID';\n }\n}\nJWKSInvalid.code = 'ERR_JWKS_INVALID';\nexport class JWKSNoMatchingKey extends JOSEError {\n constructor(message = 'no applicable key found in the JSON Web Key Set', options) {\n super(message, options);\n this.code = 'ERR_JWKS_NO_MATCHING_KEY';\n }\n}\nJWKSNoMatchingKey.code = 'ERR_JWKS_NO_MATCHING_KEY';\nexport class JWKSMultipleMatchingKeys extends JOSEError {\n constructor(message = 'multiple matching keys found in the JSON Web Key Set', options) {\n super(message, options);\n this.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';\n }\n}\nSymbol.asyncIterator;\nJWKSMultipleMatchingKeys.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';\nexport class JWKSTimeout extends JOSEError {\n constructor(message = 'request timed out', options) {\n super(message, options);\n this.code = 'ERR_JWKS_TIMEOUT';\n }\n}\nJWKSTimeout.code = 'ERR_JWKS_TIMEOUT';\nexport class JWSSignatureVerificationFailed extends JOSEError {\n constructor(message = 'signature verification failed', options) {\n super(message, options);\n this.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';\n }\n}\nJWSSignatureVerificationFailed.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';\n","import { JOSENotSupported } from '../util/errors.js';\nexport default function subtleDsa(alg, algorithm) {\n const hash = `SHA-${alg.slice(-3)}`;\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512':\n return { hash, name: 'HMAC' };\n case 'PS256':\n case 'PS384':\n case 'PS512':\n return { hash, name: 'RSA-PSS', saltLength: alg.slice(-3) >> 3 };\n case 'RS256':\n case 'RS384':\n case 'RS512':\n return { hash, name: 'RSASSA-PKCS1-v1_5' };\n case 'ES256':\n case 'ES384':\n case 'ES512':\n return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };\n case 'Ed25519':\n return { name: 'Ed25519' };\n case 'EdDSA':\n return { name: algorithm.name };\n default:\n throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);\n }\n}\n","export default crypto;\nexport const isCryptoKey = (key) => key instanceof CryptoKey;\n","export default (alg, key) => {\n if (alg.startsWith('RS') || alg.startsWith('PS')) {\n const { modulusLength } = key.algorithm;\n if (typeof modulusLength !== 'number' || modulusLength < 2048) {\n throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);\n }\n }\n};\n","function unusable(name, prop = 'algorithm.name') {\n return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\n}\nfunction isAlgorithm(algorithm, name) {\n return algorithm.name === name;\n}\nfunction getHashLength(hash) {\n return parseInt(hash.name.slice(4), 10);\n}\nfunction getNamedCurve(alg) {\n switch (alg) {\n case 'ES256':\n return 'P-256';\n case 'ES384':\n return 'P-384';\n case 'ES512':\n return 'P-521';\n default:\n throw new Error('unreachable');\n }\n}\nfunction checkUsage(key, usages) {\n if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {\n let msg = 'CryptoKey does not support this operation, its usages must include ';\n if (usages.length > 2) {\n const last = usages.pop();\n msg += `one of ${usages.join(', ')}, or ${last}.`;\n }\n else if (usages.length === 2) {\n msg += `one of ${usages[0]} or ${usages[1]}.`;\n }\n else {\n msg += `${usages[0]}.`;\n }\n throw new TypeError(msg);\n }\n}\nexport function checkSigCryptoKey(key, alg, ...usages) {\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512': {\n if (!isAlgorithm(key.algorithm, 'HMAC'))\n throw unusable('HMAC');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'RS256':\n case 'RS384':\n case 'RS512': {\n if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5'))\n throw unusable('RSASSA-PKCS1-v1_5');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'PS256':\n case 'PS384':\n case 'PS512': {\n if (!isAlgorithm(key.algorithm, 'RSA-PSS'))\n throw unusable('RSA-PSS');\n const expected = parseInt(alg.slice(2), 10);\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n case 'EdDSA': {\n if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {\n throw unusable('Ed25519 or Ed448');\n }\n break;\n }\n case 'Ed25519': {\n if (!isAlgorithm(key.algorithm, 'Ed25519'))\n throw unusable('Ed25519');\n break;\n }\n case 'ES256':\n case 'ES384':\n case 'ES512': {\n if (!isAlgorithm(key.algorithm, 'ECDSA'))\n throw unusable('ECDSA');\n const expected = getNamedCurve(alg);\n const actual = key.algorithm.namedCurve;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.namedCurve');\n break;\n }\n default:\n throw new TypeError('CryptoKey does not support this operation');\n }\n checkUsage(key, usages);\n}\nexport function checkEncCryptoKey(key, alg, ...usages) {\n switch (alg) {\n case 'A128GCM':\n case 'A192GCM':\n case 'A256GCM': {\n if (!isAlgorithm(key.algorithm, 'AES-GCM'))\n throw unusable('AES-GCM');\n const expected = parseInt(alg.slice(1, 4), 10);\n const actual = key.algorithm.length;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.length');\n break;\n }\n case 'A128KW':\n case 'A192KW':\n case 'A256KW': {\n if (!isAlgorithm(key.algorithm, 'AES-KW'))\n throw unusable('AES-KW');\n const expected = parseInt(alg.slice(1, 4), 10);\n const actual = key.algorithm.length;\n if (actual !== expected)\n throw unusable(expected, 'algorithm.length');\n break;\n }\n case 'ECDH': {\n switch (key.algorithm.name) {\n case 'ECDH':\n case 'X25519':\n case 'X448':\n break;\n default:\n throw unusable('ECDH, X25519, or X448');\n }\n break;\n }\n case 'PBES2-HS256+A128KW':\n case 'PBES2-HS384+A192KW':\n case 'PBES2-HS512+A256KW':\n if (!isAlgorithm(key.algorithm, 'PBKDF2'))\n throw unusable('PBKDF2');\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512': {\n if (!isAlgorithm(key.algorithm, 'RSA-OAEP'))\n throw unusable('RSA-OAEP');\n const expected = parseInt(alg.slice(9), 10) || 1;\n const actual = getHashLength(key.algorithm.hash);\n if (actual !== expected)\n throw unusable(`SHA-${expected}`, 'algorithm.hash');\n break;\n }\n default:\n throw new TypeError('CryptoKey does not support this operation');\n }\n checkUsage(key, usages);\n}\n","function message(msg, actual, ...types) {\n types = types.filter(Boolean);\n if (types.length > 2) {\n const last = types.pop();\n msg += `one of type ${types.join(', ')}, or ${last}.`;\n }\n else if (types.length === 2) {\n msg += `one of type ${types[0]} or ${types[1]}.`;\n }\n else {\n msg += `of type ${types[0]}.`;\n }\n if (actual == null) {\n msg += ` Received ${actual}`;\n }\n else if (typeof actual === 'function' && actual.name) {\n msg += ` Received function ${actual.name}`;\n }\n else if (typeof actual === 'object' && actual != null) {\n if (actual.constructor?.name) {\n msg += ` Received an instance of ${actual.constructor.name}`;\n }\n }\n return msg;\n}\nexport default (actual, ...types) => {\n return message('Key must be ', actual, ...types);\n};\nexport function withAlg(alg, actual, ...types) {\n return message(`Key for the ${alg} algorithm must be `, actual, ...types);\n}\n","import { isCryptoKey } from './webcrypto.js';\nexport default (key) => {\n if (isCryptoKey(key)) {\n return true;\n }\n return key?.[Symbol.toStringTag] === 'KeyObject';\n};\nexport const types = ['CryptoKey'];\n","function isObjectLike(value) {\n return typeof value === 'object' && value !== null;\n}\nexport default function isObject(input) {\n if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') {\n return false;\n }\n if (Object.getPrototypeOf(input) === null) {\n return true;\n }\n let proto = input;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(input) === proto;\n}\n","import isObject from './is_object.js';\nexport function isJWK(key) {\n return isObject(key) && typeof key.kty === 'string';\n}\nexport function isPrivateJWK(key) {\n return key.kty !== 'oct' && typeof key.d === 'string';\n}\nexport function isPublicJWK(key) {\n return key.kty !== 'oct' && typeof key.d === 'undefined';\n}\nexport function isSecretJWK(key) {\n return isJWK(key) && key.kty === 'oct' && typeof key.k === 'string';\n}\n","import crypto from './webcrypto.js';\nimport { JOSENotSupported } from '../util/errors.js';\nfunction subtleMapping(jwk) {\n let algorithm;\n let keyUsages;\n switch (jwk.kty) {\n case 'RSA': {\n switch (jwk.alg) {\n case 'PS256':\n case 'PS384':\n case 'PS512':\n algorithm = { name: 'RSA-PSS', hash: `SHA-${jwk.alg.slice(-3)}` };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'RS256':\n case 'RS384':\n case 'RS512':\n algorithm = { name: 'RSASSA-PKCS1-v1_5', hash: `SHA-${jwk.alg.slice(-3)}` };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512':\n algorithm = {\n name: 'RSA-OAEP',\n hash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`,\n };\n keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey'];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n case 'EC': {\n switch (jwk.alg) {\n case 'ES256':\n algorithm = { name: 'ECDSA', namedCurve: 'P-256' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ES384':\n algorithm = { name: 'ECDSA', namedCurve: 'P-384' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ES512':\n algorithm = { name: 'ECDSA', namedCurve: 'P-521' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW':\n algorithm = { name: 'ECDH', namedCurve: jwk.crv };\n keyUsages = jwk.d ? ['deriveBits'] : [];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n case 'OKP': {\n switch (jwk.alg) {\n case 'Ed25519':\n algorithm = { name: 'Ed25519' };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'EdDSA':\n algorithm = { name: jwk.crv };\n keyUsages = jwk.d ? ['sign'] : ['verify'];\n break;\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW':\n algorithm = { name: jwk.crv };\n keyUsages = jwk.d ? ['deriveBits'] : [];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n break;\n }\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"kty\" (Key Type) Parameter value');\n }\n return { algorithm, keyUsages };\n}\nconst parse = async (jwk) => {\n if (!jwk.alg) {\n throw new TypeError('\"alg\" argument is required when \"jwk.alg\" is not present');\n }\n const { algorithm, keyUsages } = subtleMapping(jwk);\n const rest = [\n algorithm,\n jwk.ext ?? false,\n jwk.key_ops ?? keyUsages,\n ];\n const keyData = { ...jwk };\n delete keyData.alg;\n delete keyData.use;\n return crypto.subtle.importKey('jwk', keyData, ...rest);\n};\nexport default parse;\n","import { isJWK } from '../lib/is_jwk.js';\nimport { decode } from './base64url.js';\nimport importJWK from './jwk_to_key.js';\nconst exportKeyValue = (k) => decode(k);\nlet privCache;\nlet pubCache;\nconst isKeyObject = (key) => {\n return key?.[Symbol.toStringTag] === 'KeyObject';\n};\nconst importAndCache = async (cache, key, jwk, alg, freeze = false) => {\n let cached = cache.get(key);\n if (cached?.[alg]) {\n return cached[alg];\n }\n const cryptoKey = await importJWK({ ...jwk, alg });\n if (freeze)\n Object.freeze(key);\n if (!cached) {\n cache.set(key, { [alg]: cryptoKey });\n }\n else {\n cached[alg] = cryptoKey;\n }\n return cryptoKey;\n};\nconst normalizePublicKey = (key, alg) => {\n if (isKeyObject(key)) {\n let jwk = key.export({ format: 'jwk' });\n delete jwk.d;\n delete jwk.dp;\n delete jwk.dq;\n delete jwk.p;\n delete jwk.q;\n delete jwk.qi;\n if (jwk.k) {\n return exportKeyValue(jwk.k);\n }\n pubCache || (pubCache = new WeakMap());\n return importAndCache(pubCache, key, jwk, alg);\n }\n if (isJWK(key)) {\n if (key.k)\n return decode(key.k);\n pubCache || (pubCache = new WeakMap());\n const cryptoKey = importAndCache(pubCache, key, key, alg, true);\n return cryptoKey;\n }\n return key;\n};\nconst normalizePrivateKey = (key, alg) => {\n if (isKeyObject(key)) {\n let jwk = key.export({ format: 'jwk' });\n if (jwk.k) {\n return exportKeyValue(jwk.k);\n }\n privCache || (privCache = new WeakMap());\n return importAndCache(privCache, key, jwk, alg);\n }\n if (isJWK(key)) {\n if (key.k)\n return decode(key.k);\n privCache || (privCache = new WeakMap());\n const cryptoKey = importAndCache(privCache, key, key, alg, true);\n return cryptoKey;\n }\n return key;\n};\nexport default { normalizePublicKey, normalizePrivateKey };\n","import crypto, { isCryptoKey } from './webcrypto.js';\nimport { checkSigCryptoKey } from '../lib/crypto_key.js';\nimport invalidKeyInput from '../lib/invalid_key_input.js';\nimport { types } from './is_key_like.js';\nimport normalize from './normalize_key.js';\nexport default async function getCryptoKey(alg, key, usage) {\n if (usage === 'sign') {\n key = await normalize.normalizePrivateKey(key, alg);\n }\n if (usage === 'verify') {\n key = await normalize.normalizePublicKey(key, alg);\n }\n if (isCryptoKey(key)) {\n checkSigCryptoKey(key, alg, usage);\n return key;\n }\n if (key instanceof Uint8Array) {\n if (!alg.startsWith('HS')) {\n throw new TypeError(invalidKeyInput(key, ...types));\n }\n return crypto.subtle.importKey('raw', key, { hash: `SHA-${alg.slice(-3)}`, name: 'HMAC' }, false, [usage]);\n }\n throw new TypeError(invalidKeyInput(key, ...types, 'Uint8Array', 'JSON Web Key'));\n}\n","import subtleAlgorithm from './subtle_dsa.js';\nimport crypto from './webcrypto.js';\nimport checkKeyLength from './check_key_length.js';\nimport getVerifyKey from './get_sign_verify_key.js';\nconst verify = async (alg, key, signature, data) => {\n const cryptoKey = await getVerifyKey(alg, key, 'verify');\n checkKeyLength(alg, cryptoKey);\n const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);\n try {\n return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);\n }\n catch {\n return false;\n }\n};\nexport default verify;\n","const isDisjoint = (...headers) => {\n const sources = headers.filter(Boolean);\n if (sources.length === 0 || sources.length === 1) {\n return true;\n }\n let acc;\n for (const header of sources) {\n const parameters = Object.keys(header);\n if (!acc || acc.size === 0) {\n acc = new Set(parameters);\n continue;\n }\n for (const parameter of parameters) {\n if (acc.has(parameter)) {\n return false;\n }\n acc.add(parameter);\n }\n }\n return true;\n};\nexport default isDisjoint;\n","import { withAlg as invalidKeyInput } from './invalid_key_input.js';\nimport isKeyLike, { types } from '../runtime/is_key_like.js';\nimport * as jwk from './is_jwk.js';\nconst tag = (key) => key?.[Symbol.toStringTag];\nconst jwkMatchesOp = (alg, key, usage) => {\n if (key.use !== undefined && key.use !== 'sig') {\n throw new TypeError('Invalid key for this operation, when present its use must be sig');\n }\n if (key.key_ops !== undefined && key.key_ops.includes?.(usage) !== true) {\n throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);\n }\n if (key.alg !== undefined && key.alg !== alg) {\n throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);\n }\n return true;\n};\nconst symmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (key instanceof Uint8Array)\n return;\n if (allowJwk && jwk.isJWK(key)) {\n if (jwk.isSecretJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK \"kty\" (Key Type) equal to \"oct\" and the JWK \"k\" (Key Value) present`);\n }\n if (!isKeyLike(key)) {\n throw new TypeError(invalidKeyInput(alg, key, ...types, 'Uint8Array', allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type !== 'secret') {\n throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type \"secret\"`);\n }\n};\nconst asymmetricTypeCheck = (alg, key, usage, allowJwk) => {\n if (allowJwk && jwk.isJWK(key)) {\n switch (usage) {\n case 'sign':\n if (jwk.isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a private JWK`);\n case 'verify':\n if (jwk.isPublicJWK(key) && jwkMatchesOp(alg, key, usage))\n return;\n throw new TypeError(`JSON Web Key for this operation be a public JWK`);\n }\n }\n if (!isKeyLike(key)) {\n throw new TypeError(invalidKeyInput(alg, key, ...types, allowJwk ? 'JSON Web Key' : null));\n }\n if (key.type === 'secret') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type \"secret\"`);\n }\n if (usage === 'sign' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type \"private\"`);\n }\n if (usage === 'decrypt' && key.type === 'public') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type \"private\"`);\n }\n if (key.algorithm && usage === 'verify' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type \"public\"`);\n }\n if (key.algorithm && usage === 'encrypt' && key.type === 'private') {\n throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type \"public\"`);\n }\n};\nfunction checkKeyType(allowJwk, alg, key, usage) {\n const symmetric = alg.startsWith('HS') ||\n alg === 'dir' ||\n alg.startsWith('PBES2') ||\n /^A\\d{3}(?:GCM)?KW$/.test(alg);\n if (symmetric) {\n symmetricTypeCheck(alg, key, usage, allowJwk);\n }\n else {\n asymmetricTypeCheck(alg, key, usage, allowJwk);\n }\n}\nexport default checkKeyType.bind(undefined, false);\nexport const checkKeyTypeWithJwk = checkKeyType.bind(undefined, true);\n","import { JOSENotSupported } from '../util/errors.js';\nfunction validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {\n if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {\n throw new Err('\"crit\" (Critical) Header Parameter MUST be integrity protected');\n }\n if (!protectedHeader || protectedHeader.crit === undefined) {\n return new Set();\n }\n if (!Array.isArray(protectedHeader.crit) ||\n protectedHeader.crit.length === 0 ||\n protectedHeader.crit.some((input) => typeof input !== 'string' || input.length === 0)) {\n throw new Err('\"crit\" (Critical) Header Parameter MUST be an array of non-empty strings when present');\n }\n let recognized;\n if (recognizedOption !== undefined) {\n recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);\n }\n else {\n recognized = recognizedDefault;\n }\n for (const parameter of protectedHeader.crit) {\n if (!recognized.has(parameter)) {\n throw new JOSENotSupported(`Extension Header Parameter \"${parameter}\" is not recognized`);\n }\n if (joseHeader[parameter] === undefined) {\n throw new Err(`Extension Header Parameter \"${parameter}\" is missing`);\n }\n if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {\n throw new Err(`Extension Header Parameter \"${parameter}\" MUST be integrity protected`);\n }\n }\n return new Set(protectedHeader.crit);\n}\nexport default validateCrit;\n","const validateAlgorithms = (option, algorithms) => {\n if (algorithms !== undefined &&\n (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== 'string'))) {\n throw new TypeError(`\"${option}\" option must be an array of strings`);\n }\n if (!algorithms) {\n return undefined;\n }\n return new Set(algorithms);\n};\nexport default validateAlgorithms;\n","import { decode as decodeBase64URL } from '../runtime/base64url.js';\nimport { fromSPKI, fromPKCS8, fromX509 } from '../runtime/asn1.js';\nimport asKeyObject from '../runtime/jwk_to_key.js';\nimport { JOSENotSupported } from '../util/errors.js';\nimport isObject from '../lib/is_object.js';\nexport async function importSPKI(spki, alg, options) {\n if (typeof spki !== 'string' || spki.indexOf('-----BEGIN PUBLIC KEY-----') !== 0) {\n throw new TypeError('\"spki\" must be SPKI formatted string');\n }\n return fromSPKI(spki, alg, options);\n}\nexport async function importX509(x509, alg, options) {\n if (typeof x509 !== 'string' || x509.indexOf('-----BEGIN CERTIFICATE-----') !== 0) {\n throw new TypeError('\"x509\" must be X.509 formatted string');\n }\n return fromX509(x509, alg, options);\n}\nexport async function importPKCS8(pkcs8, alg, options) {\n if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) {\n throw new TypeError('\"pkcs8\" must be PKCS#8 formatted string');\n }\n return fromPKCS8(pkcs8, alg, options);\n}\nexport async function importJWK(jwk, alg) {\n if (!isObject(jwk)) {\n throw new TypeError('JWK must be an object');\n }\n alg || (alg = jwk.alg);\n switch (jwk.kty) {\n case 'oct':\n if (typeof jwk.k !== 'string' || !jwk.k) {\n throw new TypeError('missing \"k\" (Key Value) Parameter value');\n }\n return decodeBase64URL(jwk.k);\n case 'RSA':\n if ('oth' in jwk && jwk.oth !== undefined) {\n throw new JOSENotSupported('RSA JWK \"oth\" (Other Primes Info) Parameter value is not supported');\n }\n case 'EC':\n case 'OKP':\n return asKeyObject({ ...jwk, alg });\n default:\n throw new JOSENotSupported('Unsupported \"kty\" (Key Type) Parameter value');\n }\n}\n","import { decode as base64url } from '../../runtime/base64url.js';\nimport verify from '../../runtime/verify.js';\nimport { JOSEAlgNotAllowed, JWSInvalid, JWSSignatureVerificationFailed } from '../../util/errors.js';\nimport { concat, encoder, decoder } from '../../lib/buffer_utils.js';\nimport isDisjoint from '../../lib/is_disjoint.js';\nimport isObject from '../../lib/is_object.js';\nimport { checkKeyTypeWithJwk } from '../../lib/check_key_type.js';\nimport validateCrit from '../../lib/validate_crit.js';\nimport validateAlgorithms from '../../lib/validate_algorithms.js';\nimport { isJWK } from '../../lib/is_jwk.js';\nimport { importJWK } from '../../key/import.js';\nexport async function flattenedVerify(jws, key, options) {\n if (!isObject(jws)) {\n throw new JWSInvalid('Flattened JWS must be an object');\n }\n if (jws.protected === undefined && jws.header === undefined) {\n throw new JWSInvalid('Flattened JWS must have either of the \"protected\" or \"header\" members');\n }\n if (jws.protected !== undefined && typeof jws.protected !== 'string') {\n throw new JWSInvalid('JWS Protected Header incorrect type');\n }\n if (jws.payload === undefined) {\n throw new JWSInvalid('JWS Payload missing');\n }\n if (typeof jws.signature !== 'string') {\n throw new JWSInvalid('JWS Signature missing or incorrect type');\n }\n if (jws.header !== undefined && !isObject(jws.header)) {\n throw new JWSInvalid('JWS Unprotected Header incorrect type');\n }\n let parsedProt = {};\n if (jws.protected) {\n try {\n const protectedHeader = base64url(jws.protected);\n parsedProt = JSON.parse(decoder.decode(protectedHeader));\n }\n catch {\n throw new JWSInvalid('JWS Protected Header is invalid');\n }\n }\n if (!isDisjoint(parsedProt, jws.header)) {\n throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint');\n }\n const joseHeader = {\n ...parsedProt,\n ...jws.header,\n };\n const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options?.crit, parsedProt, joseHeader);\n let b64 = true;\n if (extensions.has('b64')) {\n b64 = parsedProt.b64;\n if (typeof b64 !== 'boolean') {\n throw new JWSInvalid('The \"b64\" (base64url-encode payload) Header Parameter must be a boolean');\n }\n }\n const { alg } = joseHeader;\n if (typeof alg !== 'string' || !alg) {\n throw new JWSInvalid('JWS \"alg\" (Algorithm) Header Parameter missing or invalid');\n }\n const algorithms = options && validateAlgorithms('algorithms', options.algorithms);\n if (algorithms && !algorithms.has(alg)) {\n throw new JOSEAlgNotAllowed('\"alg\" (Algorithm) Header Parameter value not allowed');\n }\n if (b64) {\n if (typeof jws.payload !== 'string') {\n throw new JWSInvalid('JWS Payload must be a string');\n }\n }\n else if (typeof jws.payload !== 'string' && !(jws.payload instanceof Uint8Array)) {\n throw new JWSInvalid('JWS Payload must be a string or an Uint8Array instance');\n }\n let resolvedKey = false;\n if (typeof key === 'function') {\n key = await key(parsedProt, jws);\n resolvedKey = true;\n checkKeyTypeWithJwk(alg, key, 'verify');\n if (isJWK(key)) {\n key = await importJWK(key, alg);\n }\n }\n else {\n checkKeyTypeWithJwk(alg, key, 'verify');\n }\n const data = concat(encoder.encode(jws.protected ?? ''), encoder.encode('.'), typeof jws.payload === 'string' ? encoder.encode(jws.payload) : jws.payload);\n let signature;\n try {\n signature = base64url(jws.signature);\n }\n catch {\n throw new JWSInvalid('Failed to base64url decode the signature');\n }\n const verified = await verify(alg, key, signature, data);\n if (!verified) {\n throw new JWSSignatureVerificationFailed();\n }\n let payload;\n if (b64) {\n try {\n payload = base64url(jws.payload);\n }\n catch {\n throw new JWSInvalid('Failed to base64url decode the payload');\n }\n }\n else if (typeof jws.payload === 'string') {\n payload = encoder.encode(jws.payload);\n }\n else {\n payload = jws.payload;\n }\n const result = { payload };\n if (jws.protected !== undefined) {\n result.protectedHeader = parsedProt;\n }\n if (jws.header !== undefined) {\n result.unprotectedHeader = jws.header;\n }\n if (resolvedKey) {\n return { ...result, key };\n }\n return result;\n}\n","import { flattenedVerify } from '../flattened/verify.js';\nimport { JWSInvalid } from '../../util/errors.js';\nimport { decoder } from '../../lib/buffer_utils.js';\nexport async function compactVerify(jws, key, options) {\n if (jws instanceof Uint8Array) {\n jws = decoder.decode(jws);\n }\n if (typeof jws !== 'string') {\n throw new JWSInvalid('Compact JWS must be a string or Uint8Array');\n }\n const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split('.');\n if (length !== 3) {\n throw new JWSInvalid('Invalid Compact JWS');\n }\n const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);\n const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };\n if (typeof key === 'function') {\n return { ...result, key: verified.key };\n }\n return result;\n}\n","export default (date) => Math.floor(date.getTime() / 1000);\n","const minute = 60;\nconst hour = minute * 60;\nconst day = hour * 24;\nconst week = day * 7;\nconst year = day * 365.25;\nconst REGEX = /^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;\nexport default (str) => {\n const matched = REGEX.exec(str);\n if (!matched || (matched[4] && matched[1])) {\n throw new TypeError('Invalid time period format');\n }\n const value = parseFloat(matched[2]);\n const unit = matched[3].toLowerCase();\n let numericDate;\n switch (unit) {\n case 'sec':\n case 'secs':\n case 'second':\n case 'seconds':\n case 's':\n numericDate = Math.round(value);\n break;\n case 'minute':\n case 'minutes':\n case 'min':\n case 'mins':\n case 'm':\n numericDate = Math.round(value * minute);\n break;\n case 'hour':\n case 'hours':\n case 'hr':\n case 'hrs':\n case 'h':\n numericDate = Math.round(value * hour);\n break;\n case 'day':\n case 'days':\n case 'd':\n numericDate = Math.round(value * day);\n break;\n case 'week':\n case 'weeks':\n case 'w':\n numericDate = Math.round(value * week);\n break;\n default:\n numericDate = Math.round(value * year);\n break;\n }\n if (matched[1] === '-' || matched[4] === 'ago') {\n return -numericDate;\n }\n return numericDate;\n};\n","import { JWTClaimValidationFailed, JWTExpired, JWTInvalid } from '../util/errors.js';\nimport { decoder } from './buffer_utils.js';\nimport epoch from './epoch.js';\nimport secs from './secs.js';\nimport isObject from './is_object.js';\nconst normalizeTyp = (value) => value.toLowerCase().replace(/^application\\//, '');\nconst checkAudiencePresence = (audPayload, audOption) => {\n if (typeof audPayload === 'string') {\n return audOption.includes(audPayload);\n }\n if (Array.isArray(audPayload)) {\n return audOption.some(Set.prototype.has.bind(new Set(audPayload)));\n }\n return false;\n};\nexport default (protectedHeader, encodedPayload, options = {}) => {\n let payload;\n try {\n payload = JSON.parse(decoder.decode(encodedPayload));\n }\n catch {\n }\n if (!isObject(payload)) {\n throw new JWTInvalid('JWT Claims Set must be a top-level JSON object');\n }\n const { typ } = options;\n if (typ &&\n (typeof protectedHeader.typ !== 'string' ||\n normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {\n throw new JWTClaimValidationFailed('unexpected \"typ\" JWT header value', payload, 'typ', 'check_failed');\n }\n const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;\n const presenceCheck = [...requiredClaims];\n if (maxTokenAge !== undefined)\n presenceCheck.push('iat');\n if (audience !== undefined)\n presenceCheck.push('aud');\n if (subject !== undefined)\n presenceCheck.push('sub');\n if (issuer !== undefined)\n presenceCheck.push('iss');\n for (const claim of new Set(presenceCheck.reverse())) {\n if (!(claim in payload)) {\n throw new JWTClaimValidationFailed(`missing required \"${claim}\" claim`, payload, claim, 'missing');\n }\n }\n if (issuer &&\n !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {\n throw new JWTClaimValidationFailed('unexpected \"iss\" claim value', payload, 'iss', 'check_failed');\n }\n if (subject && payload.sub !== subject) {\n throw new JWTClaimValidationFailed('unexpected \"sub\" claim value', payload, 'sub', 'check_failed');\n }\n if (audience &&\n !checkAudiencePresence(payload.aud, typeof audience === 'string' ? [audience] : audience)) {\n throw new JWTClaimValidationFailed('unexpected \"aud\" claim value', payload, 'aud', 'check_failed');\n }\n let tolerance;\n switch (typeof options.clockTolerance) {\n case 'string':\n tolerance = secs(options.clockTolerance);\n break;\n case 'number':\n tolerance = options.clockTolerance;\n break;\n case 'undefined':\n tolerance = 0;\n break;\n default:\n throw new TypeError('Invalid clockTolerance option type');\n }\n const { currentDate } = options;\n const now = epoch(currentDate || new Date());\n if ((payload.iat !== undefined || maxTokenAge) && typeof payload.iat !== 'number') {\n throw new JWTClaimValidationFailed('\"iat\" claim must be a number', payload, 'iat', 'invalid');\n }\n if (payload.nbf !== undefined) {\n if (typeof payload.nbf !== 'number') {\n throw new JWTClaimValidationFailed('\"nbf\" claim must be a number', payload, 'nbf', 'invalid');\n }\n if (payload.nbf > now + tolerance) {\n throw new JWTClaimValidationFailed('\"nbf\" claim timestamp check failed', payload, 'nbf', 'check_failed');\n }\n }\n if (payload.exp !== undefined) {\n if (typeof payload.exp !== 'number') {\n throw new JWTClaimValidationFailed('\"exp\" claim must be a number', payload, 'exp', 'invalid');\n }\n if (payload.exp <= now - tolerance) {\n throw new JWTExpired('\"exp\" claim timestamp check failed', payload, 'exp', 'check_failed');\n }\n }\n if (maxTokenAge) {\n const age = now - payload.iat;\n const max = typeof maxTokenAge === 'number' ? maxTokenAge : secs(maxTokenAge);\n if (age - tolerance > max) {\n throw new JWTExpired('\"iat\" claim timestamp check failed (too far in the past)', payload, 'iat', 'check_failed');\n }\n if (age < 0 - tolerance) {\n throw new JWTClaimValidationFailed('\"iat\" claim timestamp check failed (it should be in the past)', payload, 'iat', 'check_failed');\n }\n }\n return payload;\n};\n","import { compactVerify } from '../jws/compact/verify.js';\nimport jwtPayload from '../lib/jwt_claims_set.js';\nimport { JWTInvalid } from '../util/errors.js';\nexport async function jwtVerify(jwt, key, options) {\n const verified = await compactVerify(jwt, key, options);\n if (verified.protectedHeader.crit?.includes('b64') && verified.protectedHeader.b64 === false) {\n throw new JWTInvalid('JWTs MUST NOT use unencoded payload');\n }\n const payload = jwtPayload(verified.protectedHeader, verified.payload, options);\n const result = { payload, protectedHeader: verified.protectedHeader };\n if (typeof key === 'function') {\n return { ...result, key: verified.key };\n }\n return result;\n}\n","import { JOSEError, JWKSTimeout } from '../util/errors.js';\nconst fetchJwks = async (url, timeout, options) => {\n let controller;\n let id;\n let timedOut = false;\n if (typeof AbortController === 'function') {\n controller = new AbortController();\n id = setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeout);\n }\n const response = await fetch(url.href, {\n signal: controller ? controller.signal : undefined,\n redirect: 'manual',\n headers: options.headers,\n }).catch((err) => {\n if (timedOut)\n throw new JWKSTimeout();\n throw err;\n });\n if (id !== undefined)\n clearTimeout(id);\n if (response.status !== 200) {\n throw new JOSEError('Expected 200 OK from the JSON Web Key Set HTTP response');\n }\n try {\n return await response.json();\n }\n catch {\n throw new JOSEError('Failed to parse the JSON Web Key Set HTTP response as JSON');\n }\n};\nexport default fetchJwks;\n","import { importJWK } from '../key/import.js';\nimport { JWKSInvalid, JOSENotSupported, JWKSNoMatchingKey, JWKSMultipleMatchingKeys, } from '../util/errors.js';\nimport isObject from '../lib/is_object.js';\nfunction getKtyFromAlg(alg) {\n switch (typeof alg === 'string' && alg.slice(0, 2)) {\n case 'RS':\n case 'PS':\n return 'RSA';\n case 'ES':\n return 'EC';\n case 'Ed':\n return 'OKP';\n default:\n throw new JOSENotSupported('Unsupported \"alg\" value for a JSON Web Key Set');\n }\n}\nfunction isJWKSLike(jwks) {\n return (jwks &&\n typeof jwks === 'object' &&\n Array.isArray(jwks.keys) &&\n jwks.keys.every(isJWKLike));\n}\nfunction isJWKLike(key) {\n return isObject(key);\n}\nfunction clone(obj) {\n if (typeof structuredClone === 'function') {\n return structuredClone(obj);\n }\n return JSON.parse(JSON.stringify(obj));\n}\nclass LocalJWKSet {\n constructor(jwks) {\n this._cached = new WeakMap();\n if (!isJWKSLike(jwks)) {\n throw new JWKSInvalid('JSON Web Key Set malformed');\n }\n this._jwks = clone(jwks);\n }\n async getKey(protectedHeader, token) {\n const { alg, kid } = { ...protectedHeader, ...token?.header };\n const kty = getKtyFromAlg(alg);\n const candidates = this._jwks.keys.filter((jwk) => {\n let candidate = kty === jwk.kty;\n if (candidate && typeof kid === 'string') {\n candidate = kid === jwk.kid;\n }\n if (candidate && typeof jwk.alg === 'string') {\n candidate = alg === jwk.alg;\n }\n if (candidate && typeof jwk.use === 'string') {\n candidate = jwk.use === 'sig';\n }\n if (candidate && Array.isArray(jwk.key_ops)) {\n candidate = jwk.key_ops.includes('verify');\n }\n if (candidate) {\n switch (alg) {\n case 'ES256':\n candidate = jwk.crv === 'P-256';\n break;\n case 'ES256K':\n candidate = jwk.crv === 'secp256k1';\n break;\n case 'ES384':\n candidate = jwk.crv === 'P-384';\n break;\n case 'ES512':\n candidate = jwk.crv === 'P-521';\n break;\n case 'Ed25519':\n candidate = jwk.crv === 'Ed25519';\n break;\n case 'EdDSA':\n candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448';\n break;\n }\n }\n return candidate;\n });\n const { 0: jwk, length } = candidates;\n if (length === 0) {\n throw new JWKSNoMatchingKey();\n }\n if (length !== 1) {\n const error = new JWKSMultipleMatchingKeys();\n const { _cached } = this;\n error[Symbol.asyncIterator] = async function* () {\n for (const jwk of candidates) {\n try {\n yield await importWithAlgCache(_cached, jwk, alg);\n }\n catch { }\n }\n };\n throw error;\n }\n return importWithAlgCache(this._cached, jwk, alg);\n }\n}\nasync function importWithAlgCache(cache, jwk, alg) {\n const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);\n if (cached[alg] === undefined) {\n const key = await importJWK({ ...jwk, ext: true }, alg);\n if (key instanceof Uint8Array || key.type !== 'public') {\n throw new JWKSInvalid('JSON Web Key Set members must be public keys');\n }\n cached[alg] = key;\n }\n return cached[alg];\n}\nexport function createLocalJWKSet(jwks) {\n const set = new LocalJWKSet(jwks);\n const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);\n Object.defineProperties(localJWKSet, {\n jwks: {\n value: () => clone(set._jwks),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n });\n return localJWKSet;\n}\n","import fetchJwks from '../runtime/fetch_jwks.js';\nimport { JWKSNoMatchingKey } from '../util/errors.js';\nimport { createLocalJWKSet } from './local.js';\nimport isObject from '../lib/is_object.js';\nfunction isCloudflareWorkers() {\n return (typeof WebSocketPair !== 'undefined' ||\n (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||\n (typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));\n}\nlet USER_AGENT;\nif (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {\n const NAME = 'jose';\n const VERSION = 'v5.10.0';\n USER_AGENT = `${NAME}/${VERSION}`;\n}\nexport const jwksCache = Symbol();\nfunction isFreshJwksCache(input, cacheMaxAge) {\n if (typeof input !== 'object' || input === null) {\n return false;\n }\n if (!('uat' in input) || typeof input.uat !== 'number' || Date.now() - input.uat >= cacheMaxAge) {\n return false;\n }\n if (!('jwks' in input) ||\n !isObject(input.jwks) ||\n !Array.isArray(input.jwks.keys) ||\n !Array.prototype.every.call(input.jwks.keys, isObject)) {\n return false;\n }\n return true;\n}\nclass RemoteJWKSet {\n constructor(url, options) {\n if (!(url instanceof URL)) {\n throw new TypeError('url must be an instance of URL');\n }\n this._url = new URL(url.href);\n this._options = { agent: options?.agent, headers: options?.headers };\n this._timeoutDuration =\n typeof options?.timeoutDuration === 'number' ? options?.timeoutDuration : 5000;\n this._cooldownDuration =\n typeof options?.cooldownDuration === 'number' ? options?.cooldownDuration : 30000;\n this._cacheMaxAge = typeof options?.cacheMaxAge === 'number' ? options?.cacheMaxAge : 600000;\n if (options?.[jwksCache] !== undefined) {\n this._cache = options?.[jwksCache];\n if (isFreshJwksCache(options?.[jwksCache], this._cacheMaxAge)) {\n this._jwksTimestamp = this._cache.uat;\n this._local = createLocalJWKSet(this._cache.jwks);\n }\n }\n }\n coolingDown() {\n return typeof this._jwksTimestamp === 'number'\n ? Date.now() < this._jwksTimestamp + this._cooldownDuration\n : false;\n }\n fresh() {\n return typeof this._jwksTimestamp === 'number'\n ? Date.now() < this._jwksTimestamp + this._cacheMaxAge\n : false;\n }\n async getKey(protectedHeader, token) {\n if (!this._local || !this.fresh()) {\n await this.reload();\n }\n try {\n return await this._local(protectedHeader, token);\n }\n catch (err) {\n if (err instanceof JWKSNoMatchingKey) {\n if (this.coolingDown() === false) {\n await this.reload();\n return this._local(protectedHeader, token);\n }\n }\n throw err;\n }\n }\n async reload() {\n if (this._pendingFetch && isCloudflareWorkers()) {\n this._pendingFetch = undefined;\n }\n const headers = new Headers(this._options.headers);\n if (USER_AGENT && !headers.has('User-Agent')) {\n headers.set('User-Agent', USER_AGENT);\n this._options.headers = Object.fromEntries(headers.entries());\n }\n this._pendingFetch || (this._pendingFetch = fetchJwks(this._url, this._timeoutDuration, this._options)\n .then((json) => {\n this._local = createLocalJWKSet(json);\n if (this._cache) {\n this._cache.uat = Date.now();\n this._cache.jwks = json;\n }\n this._jwksTimestamp = Date.now();\n this._pendingFetch = undefined;\n })\n .catch((err) => {\n this._pendingFetch = undefined;\n throw err;\n }));\n await this._pendingFetch;\n }\n}\nexport function createRemoteJWKSet(url, options) {\n const set = new RemoteJWKSet(url, options);\n const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);\n Object.defineProperties(remoteJWKSet, {\n coolingDown: {\n get: () => set.coolingDown(),\n enumerable: true,\n configurable: false,\n },\n fresh: {\n get: () => set.fresh(),\n enumerable: true,\n configurable: false,\n },\n reload: {\n value: () => set.reload(),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n reloading: {\n get: () => !!set._pendingFetch,\n enumerable: true,\n configurable: false,\n },\n jwks: {\n value: () => set._local?.jwks(),\n enumerable: true,\n configurable: false,\n writable: false,\n },\n });\n return remoteJWKSet;\n}\nexport const experimental_jwksCache = jwksCache;\n","import crypto, { isCryptoKey } from './webcrypto.js';\nimport invalidKeyInput from '../lib/invalid_key_input.js';\nimport { encode as base64url } from './base64url.js';\nimport { types } from './is_key_like.js';\nconst keyToJWK = async (key) => {\n if (key instanceof Uint8Array) {\n return {\n kty: 'oct',\n k: base64url(key),\n };\n }\n if (!isCryptoKey(key)) {\n throw new TypeError(invalidKeyInput(key, ...types, 'Uint8Array'));\n }\n if (!key.extractable) {\n throw new TypeError('non-extractable CryptoKey cannot be exported as a JWK');\n }\n const { ext, key_ops, alg, use, ...jwk } = await crypto.subtle.exportKey('jwk', key);\n return jwk;\n};\nexport default keyToJWK;\n","import { toSPKI as exportPublic } from '../runtime/asn1.js';\nimport { toPKCS8 as exportPrivate } from '../runtime/asn1.js';\nimport keyToJWK from '../runtime/key_to_jwk.js';\nexport async function exportSPKI(key) {\n return exportPublic(key);\n}\nexport async function exportPKCS8(key) {\n return exportPrivate(key);\n}\nexport async function exportJWK(key) {\n return keyToJWK(key);\n}\n","import subtleAlgorithm from './subtle_dsa.js';\nimport crypto from './webcrypto.js';\nimport checkKeyLength from './check_key_length.js';\nimport getSignKey from './get_sign_verify_key.js';\nconst sign = async (alg, key, data) => {\n const cryptoKey = await getSignKey(alg, key, 'sign');\n checkKeyLength(alg, cryptoKey);\n const signature = await crypto.subtle.sign(subtleAlgorithm(alg, cryptoKey.algorithm), cryptoKey, data);\n return new Uint8Array(signature);\n};\nexport default sign;\n","import { encode as base64url } from '../../runtime/base64url.js';\nimport sign from '../../runtime/sign.js';\nimport isDisjoint from '../../lib/is_disjoint.js';\nimport { JWSInvalid } from '../../util/errors.js';\nimport { encoder, decoder, concat } from '../../lib/buffer_utils.js';\nimport { checkKeyTypeWithJwk } from '../../lib/check_key_type.js';\nimport validateCrit from '../../lib/validate_crit.js';\nexport class FlattenedSign {\n constructor(payload) {\n if (!(payload instanceof Uint8Array)) {\n throw new TypeError('payload must be an instance of Uint8Array');\n }\n this._payload = payload;\n }\n setProtectedHeader(protectedHeader) {\n if (this._protectedHeader) {\n throw new TypeError('setProtectedHeader can only be called once');\n }\n this._protectedHeader = protectedHeader;\n return this;\n }\n setUnprotectedHeader(unprotectedHeader) {\n if (this._unprotectedHeader) {\n throw new TypeError('setUnprotectedHeader can only be called once');\n }\n this._unprotectedHeader = unprotectedHeader;\n return this;\n }\n async sign(key, options) {\n if (!this._protectedHeader && !this._unprotectedHeader) {\n throw new JWSInvalid('either setProtectedHeader or setUnprotectedHeader must be called before #sign()');\n }\n if (!isDisjoint(this._protectedHeader, this._unprotectedHeader)) {\n throw new JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint');\n }\n const joseHeader = {\n ...this._protectedHeader,\n ...this._unprotectedHeader,\n };\n const extensions = validateCrit(JWSInvalid, new Map([['b64', true]]), options?.crit, this._protectedHeader, joseHeader);\n let b64 = true;\n if (extensions.has('b64')) {\n b64 = this._protectedHeader.b64;\n if (typeof b64 !== 'boolean') {\n throw new JWSInvalid('The \"b64\" (base64url-encode payload) Header Parameter must be a boolean');\n }\n }\n const { alg } = joseHeader;\n if (typeof alg !== 'string' || !alg) {\n throw new JWSInvalid('JWS \"alg\" (Algorithm) Header Parameter missing or invalid');\n }\n checkKeyTypeWithJwk(alg, key, 'sign');\n let payload = this._payload;\n if (b64) {\n payload = encoder.encode(base64url(payload));\n }\n let protectedHeader;\n if (this._protectedHeader) {\n protectedHeader = encoder.encode(base64url(JSON.stringify(this._protectedHeader)));\n }\n else {\n protectedHeader = encoder.encode('');\n }\n const data = concat(protectedHeader, encoder.encode('.'), payload);\n const signature = await sign(alg, key, data);\n const jws = {\n signature: base64url(signature),\n payload: '',\n };\n if (b64) {\n jws.payload = decoder.decode(payload);\n }\n if (this._unprotectedHeader) {\n jws.header = this._unprotectedHeader;\n }\n if (this._protectedHeader) {\n jws.protected = decoder.decode(protectedHeader);\n }\n return jws;\n }\n}\n","import { FlattenedSign } from '../flattened/sign.js';\nexport class CompactSign {\n constructor(payload) {\n this._flattened = new FlattenedSign(payload);\n }\n setProtectedHeader(protectedHeader) {\n this._flattened.setProtectedHeader(protectedHeader);\n return this;\n }\n async sign(key, options) {\n const jws = await this._flattened.sign(key, options);\n if (jws.payload === undefined) {\n throw new TypeError('use the flattened module for creating JWS with b64: false');\n }\n return `${jws.protected}.${jws.payload}.${jws.signature}`;\n }\n}\n","import epoch from '../lib/epoch.js';\nimport isObject from '../lib/is_object.js';\nimport secs from '../lib/secs.js';\nfunction validateInput(label, input) {\n if (!Number.isFinite(input)) {\n throw new TypeError(`Invalid ${label} input`);\n }\n return input;\n}\nexport class ProduceJWT {\n constructor(payload = {}) {\n if (!isObject(payload)) {\n throw new TypeError('JWT Claims Set MUST be an object');\n }\n this._payload = payload;\n }\n setIssuer(issuer) {\n this._payload = { ...this._payload, iss: issuer };\n return this;\n }\n setSubject(subject) {\n this._payload = { ...this._payload, sub: subject };\n return this;\n }\n setAudience(audience) {\n this._payload = { ...this._payload, aud: audience };\n return this;\n }\n setJti(jwtId) {\n this._payload = { ...this._payload, jti: jwtId };\n return this;\n }\n setNotBefore(input) {\n if (typeof input === 'number') {\n this._payload = { ...this._payload, nbf: validateInput('setNotBefore', input) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, nbf: validateInput('setNotBefore', epoch(input)) };\n }\n else {\n this._payload = { ...this._payload, nbf: epoch(new Date()) + secs(input) };\n }\n return this;\n }\n setExpirationTime(input) {\n if (typeof input === 'number') {\n this._payload = { ...this._payload, exp: validateInput('setExpirationTime', input) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, exp: validateInput('setExpirationTime', epoch(input)) };\n }\n else {\n this._payload = { ...this._payload, exp: epoch(new Date()) + secs(input) };\n }\n return this;\n }\n setIssuedAt(input) {\n if (typeof input === 'undefined') {\n this._payload = { ...this._payload, iat: epoch(new Date()) };\n }\n else if (input instanceof Date) {\n this._payload = { ...this._payload, iat: validateInput('setIssuedAt', epoch(input)) };\n }\n else if (typeof input === 'string') {\n this._payload = {\n ...this._payload,\n iat: validateInput('setIssuedAt', epoch(new Date()) + secs(input)),\n };\n }\n else {\n this._payload = { ...this._payload, iat: validateInput('setIssuedAt', input) };\n }\n return this;\n }\n}\n","import { CompactSign } from '../jws/compact/sign.js';\nimport { JWTInvalid } from '../util/errors.js';\nimport { encoder } from '../lib/buffer_utils.js';\nimport { ProduceJWT } from './produce.js';\nexport class SignJWT extends ProduceJWT {\n setProtectedHeader(protectedHeader) {\n this._protectedHeader = protectedHeader;\n return this;\n }\n async sign(key, options) {\n const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));\n sig.setProtectedHeader(this._protectedHeader);\n if (Array.isArray(this._protectedHeader?.crit) &&\n this._protectedHeader.crit.includes('b64') &&\n this._protectedHeader.b64 === false) {\n throw new JWTInvalid('JWTs MUST NOT use unencoded payload');\n }\n return sig.sign(key, options);\n }\n}\n","import crypto from './webcrypto.js';\nimport { JOSENotSupported } from '../util/errors.js';\nimport random from './random.js';\nexport async function generateSecret(alg, options) {\n let length;\n let algorithm;\n let keyUsages;\n switch (alg) {\n case 'HS256':\n case 'HS384':\n case 'HS512':\n length = parseInt(alg.slice(-3), 10);\n algorithm = { name: 'HMAC', hash: `SHA-${length}`, length };\n keyUsages = ['sign', 'verify'];\n break;\n case 'A128CBC-HS256':\n case 'A192CBC-HS384':\n case 'A256CBC-HS512':\n length = parseInt(alg.slice(-3), 10);\n return random(new Uint8Array(length >> 3));\n case 'A128KW':\n case 'A192KW':\n case 'A256KW':\n length = parseInt(alg.slice(1, 4), 10);\n algorithm = { name: 'AES-KW', length };\n keyUsages = ['wrapKey', 'unwrapKey'];\n break;\n case 'A128GCMKW':\n case 'A192GCMKW':\n case 'A256GCMKW':\n case 'A128GCM':\n case 'A192GCM':\n case 'A256GCM':\n length = parseInt(alg.slice(1, 4), 10);\n algorithm = { name: 'AES-GCM', length };\n keyUsages = ['encrypt', 'decrypt'];\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n return crypto.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages);\n}\nfunction getModulusLengthOption(options) {\n const modulusLength = options?.modulusLength ?? 2048;\n if (typeof modulusLength !== 'number' || modulusLength < 2048) {\n throw new JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used');\n }\n return modulusLength;\n}\nexport async function generateKeyPair(alg, options) {\n let algorithm;\n let keyUsages;\n switch (alg) {\n case 'PS256':\n case 'PS384':\n case 'PS512':\n algorithm = {\n name: 'RSA-PSS',\n hash: `SHA-${alg.slice(-3)}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['sign', 'verify'];\n break;\n case 'RS256':\n case 'RS384':\n case 'RS512':\n algorithm = {\n name: 'RSASSA-PKCS1-v1_5',\n hash: `SHA-${alg.slice(-3)}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['sign', 'verify'];\n break;\n case 'RSA-OAEP':\n case 'RSA-OAEP-256':\n case 'RSA-OAEP-384':\n case 'RSA-OAEP-512':\n algorithm = {\n name: 'RSA-OAEP',\n hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`,\n publicExponent: new Uint8Array([0x01, 0x00, 0x01]),\n modulusLength: getModulusLengthOption(options),\n };\n keyUsages = ['decrypt', 'unwrapKey', 'encrypt', 'wrapKey'];\n break;\n case 'ES256':\n algorithm = { name: 'ECDSA', namedCurve: 'P-256' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'ES384':\n algorithm = { name: 'ECDSA', namedCurve: 'P-384' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'ES512':\n algorithm = { name: 'ECDSA', namedCurve: 'P-521' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'Ed25519':\n algorithm = { name: 'Ed25519' };\n keyUsages = ['sign', 'verify'];\n break;\n case 'EdDSA': {\n keyUsages = ['sign', 'verify'];\n const crv = options?.crv ?? 'Ed25519';\n switch (crv) {\n case 'Ed25519':\n case 'Ed448':\n algorithm = { name: crv };\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported crv option provided');\n }\n break;\n }\n case 'ECDH-ES':\n case 'ECDH-ES+A128KW':\n case 'ECDH-ES+A192KW':\n case 'ECDH-ES+A256KW': {\n keyUsages = ['deriveKey', 'deriveBits'];\n const crv = options?.crv ?? 'P-256';\n switch (crv) {\n case 'P-256':\n case 'P-384':\n case 'P-521': {\n algorithm = { name: 'ECDH', namedCurve: crv };\n break;\n }\n case 'X25519':\n case 'X448':\n algorithm = { name: crv };\n break;\n default:\n throw new JOSENotSupported('Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448');\n }\n break;\n }\n default:\n throw new JOSENotSupported('Invalid or unsupported JWK \"alg\" (Algorithm) Parameter value');\n }\n return crypto.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages);\n}\n","import { generateKeyPair as generate } from '../runtime/generate.js';\nexport async function generateKeyPair(alg, options) {\n return generate(alg, options);\n}\n","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n","import { jwtVerify, createRemoteJWKSet, exportJWK, SignJWT, generateKeyPair } from 'jose';\nimport { v4 } from 'uuid';\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Intended to be used by dependent packages as a common prefix for keys into\n * storage mechanisms (so as to group all keys related to Solid Client Authn\n * within those storage mechanisms, e.g., window.localStorage).\n */\nconst SOLID_CLIENT_AUTHN_KEY_PREFIX = \"solidClientAuthn:\";\n/**\n * Ordered list of signature algorithms, from most preferred to least preferred.\n */\nconst PREFERRED_SIGNING_ALG = [\"ES256\", \"RS256\"];\nconst EVENTS = {\n // Note that an `error` events MUST be listened to: https://nodejs.org/dist/latest-v16.x/docs/api/events.html#error-events.\n ERROR: \"error\",\n LOGIN: \"login\",\n LOGOUT: \"logout\",\n NEW_REFRESH_TOKEN: \"newRefreshToken\",\n NEW_TOKENS: \"newTokens\",\n AUTHORIZATION_REQUEST: \"authorizationRequest\",\n SESSION_EXPIRED: \"sessionExpired\",\n SESSION_EXTENDED: \"sessionExtended\",\n SESSION_RESTORED: \"sessionRestore\",\n TIMEOUT_SET: \"timeoutSet\",\n};\n/**\n * We want to refresh a token 5 seconds before it expires.\n */\nconst REFRESH_BEFORE_EXPIRATION_SECONDS = 5;\n// The openid scope requests an OIDC ID token token to be returned.\nconst SCOPE_OPENID = \"openid\";\n// The offline_access scope requests a refresh token to be returned.\nconst SCOPE_OFFLINE = \"offline_access\";\n// The webid scope is required as per https://solid.github.io/solid-oidc/#webid-scope\nconst SCOPE_WEBID = \"webid\";\nconst DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID];\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass AggregateHandler {\n handleables;\n constructor(handleables) {\n this.handleables = handleables;\n this.handleables = handleables;\n }\n /**\n * Helper function that will asynchronously determine the proper handler to use. If multiple\n * handlers can handle, it will choose the first one in the list\n * @param params Paramerters to feed to the handler\n */\n async getProperHandler(params) {\n // TODO : This function doesn't currently operate as described. Tests need to be written\n // return new Promise<IHandleable<P, R> | null>((resolve, reject) => {\n // const resolvedValues: Array<boolean | null> = Array(this.handleables.length).map(() => null)\n // let numberResolved = 0\n // this.handleables.forEach(async (handleable: IHandleable<P, R>, index: number) => {\n // resolvedValues[index] = await handleable.canHandle(...params)\n // numberResolved++\n // let curResolvedValueIndex = 0\n // while (\n // resolvedValues[curResolvedValueIndex] !== null ||\n // resolvedValues[curResolvedValueIndex] !== undefined\n // ) {\n // if (resolvedValues[curResolvedValueIndex]) {\n // resolve(this.handleables[curResolvedValueIndex])\n // }\n // curResolvedValueIndex++\n // }\n // })\n // })\n const canHandleList = await Promise.all(this.handleables.map((handleable) => handleable.canHandle(...params)));\n for (let i = 0; i < canHandleList.length; i += 1) {\n if (canHandleList[i]) {\n return this.handleables[i];\n }\n }\n return null;\n }\n async canHandle(...params) {\n return (await this.getProperHandler(params)) !== null;\n }\n async handle(...params) {\n const handler = await this.getProperHandler(params);\n if (handler) {\n return handler.handle(...params);\n }\n throw new Error(`[${this.constructor.name}] cannot find a suitable handler for: ${params\n .map((param) => {\n try {\n return JSON.stringify(param);\n }\n catch (err) {\n /* eslint-disable @typescript-eslint/no-explicit-any */\n return param.toString();\n }\n })\n .join(\", \")}`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Extract a WebID and the clientID from an ID token payload based on https://github.com/solid/webid-oidc-spec.\n * Note that this does not yet implement the user endpoint lookup, and only checks\n * for `webid`, `azp` or IRI-like `sub` claims.\n *\n * @param idToken the payload of the ID token from which the WebID can be extracted.\n * @returns an object with entries webId and clientId extracted from the ID token.\n * @internal\n */\nasync function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {\n let payload;\n let clientIdInPayload;\n try {\n const { payload: verifiedPayload } = await jwtVerify(idToken, createRemoteJWKSet(new URL(jwksIri)), {\n issuer: issuerIri,\n audience: clientId,\n });\n payload = verifiedPayload;\n }\n catch (e) {\n throw new Error(`Token verification failed: ${e.stack}`);\n }\n if (typeof payload.azp === \"string\") {\n clientIdInPayload = payload.azp;\n }\n if (typeof payload.webid === \"string\") {\n return {\n webId: payload.webid,\n clientId: clientIdInPayload,\n };\n }\n if (typeof payload.sub !== \"string\") {\n throw new Error(`The token ${JSON.stringify(payload)} is invalid: it has no 'webid' claim and no 'sub' claim.`);\n }\n try {\n // This parses the 'sub' claim to check if it is a well-formed IRI.\n // However, the normalized value isn't returned to make sure the WebID is returned\n // as specified by the Identity Provider.\n // eslint-disable-next-line no-new\n new URL(payload.sub);\n return {\n webId: payload.sub,\n clientId: clientIdInPayload,\n };\n }\n catch (e) {\n throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${payload.sub}] is invalid as a URL - error [${e}].`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction normalizeScopes(scopes) {\n if (!Array.isArray(scopes)) {\n return DEFAULT_SCOPES;\n }\n return Array.from(\n // De-dupe potentia conflicts if any.\n new Set([\n ...DEFAULT_SCOPES,\n ...scopes.filter(\n // Remove user-provided scopes that are not strings or include spaces.\n (scope) => typeof scope === \"string\" && !scope.includes(\" \")),\n ]));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isValidRedirectUrl(redirectUrl) {\n // If the redirect URL is not a valid URL, an error will be thrown.\n try {\n const urlObject = new URL(redirectUrl);\n const noReservedQuery = !urlObject.searchParams.has(\"code\") &&\n !urlObject.searchParams.has(\"state\");\n // As per https://tools.ietf.org/html/rfc6749#section-3.1.2, the redirect URL\n // must not include a hash fragment.\n const noHash = urlObject.hash === \"\";\n return noReservedQuery && noHash;\n }\n catch (e) {\n return false;\n }\n}\nfunction removeOpenIdParams(redirectUrl) {\n const cleanedUpUrl = new URL(redirectUrl);\n // For auth code flow\n cleanedUpUrl.searchParams.delete(\"state\");\n cleanedUpUrl.searchParams.delete(\"code\");\n // For login error\n cleanedUpUrl.searchParams.delete(\"error\");\n cleanedUpUrl.searchParams.delete(\"error_description\");\n // For RFC9207\n cleanedUpUrl.searchParams.delete(\"iss\");\n return cleanedUpUrl;\n}\n\n/**\n * @hidden\n * @packageDocumentation\n */\nfunction booleanWithFallback(value, fallback) {\n if (typeof value === \"boolean\") {\n return Boolean(value);\n }\n return Boolean(fallback);\n}\n/**\n * @hidden\n * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth\n * PKCE: https://tools.ietf.org/html/rfc7636\n */\nclass AuthorizationCodeWithPkceOidcHandlerBase {\n storageUtility;\n redirector;\n constructor(storageUtility, redirector) {\n this.storageUtility = storageUtility;\n this.redirector = redirector;\n this.storageUtility = storageUtility;\n this.redirector = redirector;\n }\n parametersGuard = (oidcLoginOptions) => {\n return (oidcLoginOptions.issuerConfiguration.grantTypesSupported !== undefined &&\n oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf(\"authorization_code\") > -1 &&\n oidcLoginOptions.redirectUrl !== undefined);\n };\n async canHandle(oidcLoginOptions) {\n return this.parametersGuard(oidcLoginOptions);\n }\n async setupRedirectHandler({ oidcLoginOptions, state, codeVerifier, targetUrl, }) {\n if (!this.parametersGuard(oidcLoginOptions)) {\n throw new Error(\"The authorization code grant requires a redirectUrl.\");\n }\n await Promise.all([\n // We use the OAuth 'state' value (which should be crypto-random) as\n // the key in our storage to store our actual SessionID. We do this\n // 'cos we'll need to lookup our session information again when the\n // browser is redirected back to us (i.e. the OAuth client\n // application) from the Authorization Server.\n // We don't want to use our session ID as the OAuth 'state' value, as\n // that session ID can be any developer-specified value, and therefore\n // may not be appropriate (since the OAuth 'state' value should really\n // be an unguessable crypto-random value).\n this.storageUtility.setForUser(state, {\n sessionId: oidcLoginOptions.sessionId,\n }),\n // Store our login-process state using the session ID as the key.\n // Strictly speaking, this indirection from our OAuth state value to\n // our session ID is unnecessary, but it provides a slightly cleaner\n // separation of concerns.\n this.storageUtility.setForUser(oidcLoginOptions.sessionId, {\n codeVerifier,\n issuer: oidcLoginOptions.issuer.toString(),\n // The redirect URL is read after redirect, so it must be stored now.\n redirectUrl: oidcLoginOptions.redirectUrl,\n dpop: Boolean(oidcLoginOptions.dpop).toString(),\n keepAlive: booleanWithFallback(oidcLoginOptions.keepAlive, true).toString(),\n }),\n ]);\n this.redirector.redirect(targetUrl, {\n handleRedirect: oidcLoginOptions.handleRedirect,\n });\n return undefined;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass GeneralLogoutHandler {\n sessionInfoManager;\n constructor(sessionInfoManager) {\n this.sessionInfoManager = sessionInfoManager;\n this.sessionInfoManager = sessionInfoManager;\n }\n async canHandle() {\n return true;\n }\n async handle(userId) {\n await this.sessionInfoManager.clear(userId);\n }\n}\n\nclass IRpLogoutHandler {\n redirector;\n constructor(redirector) {\n this.redirector = redirector;\n this.redirector = redirector;\n }\n async canHandle(userId, options) {\n return options?.logoutType === \"idp\";\n }\n async handle(userId, options) {\n if (options?.logoutType !== \"idp\") {\n throw new Error(\"Attempting to call idp logout handler to perform app logout\");\n }\n if (options.toLogoutUrl === undefined) {\n throw new Error(\"Cannot perform IDP logout. Did you log in using the OIDC authentication flow?\");\n }\n this.redirector.redirect(options.toLogoutUrl(options), {\n handleRedirect: options.handleRedirect,\n });\n }\n}\n\nclass IWaterfallLogoutHandler {\n handlers;\n constructor(sessionInfoManager, redirector) {\n this.handlers = [\n new GeneralLogoutHandler(sessionInfoManager),\n new IRpLogoutHandler(redirector),\n ];\n }\n async canHandle() {\n return true;\n }\n async handle(userId, options) {\n for (const handler of this.handlers) {\n /* eslint-disable no-await-in-loop */\n if (await handler.canHandle(userId, options))\n await handler.handle(userId, options);\n /* eslint-enable no-await-in-loop */\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\nfunction getUnauthenticatedSession() {\n return {\n isLoggedIn: false,\n sessionId: v4(),\n fetch: (...args) => fetch(...args),\n };\n}\n/**\n * @param sessionId\n * @param storage\n * @hidden\n */\nasync function clear(sessionId, storage) {\n await Promise.all([\n storage.deleteAllUserData(sessionId, { secure: false }),\n storage.deleteAllUserData(sessionId, { secure: true }),\n ]);\n}\n/**\n * @hidden\n */\nclass SessionInfoManagerBase {\n storageUtility;\n constructor(storageUtility) {\n this.storageUtility = storageUtility;\n this.storageUtility = storageUtility;\n }\n update(_sessionId, _options) {\n throw new Error(\"Not Implemented\");\n }\n set(_sessionId, _sessionInfo) {\n throw new Error(\"Not Implemented\");\n }\n get(_) {\n throw new Error(\"Not implemented\");\n }\n // eslint-disable-next-line class-methods-use-this\n async getAll() {\n throw new Error(\"Not implemented\");\n }\n /**\n * This function removes all session-related information from storage.\n * @param sessionId the session identifier\n * @hidden\n */\n async clear(sessionId) {\n return clear(sessionId, this.storageUtility);\n }\n /**\n * Registers a new session, so that its ID can be retrieved.\n */\n async register(_sessionId) {\n throw new Error(\"Not implemented\");\n }\n /**\n * Returns all the registered session IDs. Differs from getAll, which also\n * returns additional session information.\n */\n async getRegisteredSessionIdAll() {\n throw new Error(\"Not implemented\");\n }\n /**\n * Deletes all information about all sessions, including their registrations.\n */\n async clearAll() {\n throw new Error(\"Not implemented\");\n }\n /**\n * Sets authorization request state in storage for a given session ID.\n */\n async setOidcContext(_sessionId, _authorizationRequestState) {\n throw new Error(\"Not implemented\");\n }\n}\n\n/**\n * This function is designed to isomorphically capture the behavior in oidc-client-js and node-oidc-provider\n * - https://github.com/IdentityModel/oidc-client-js/blob/edec8f59897bdeedcb0b4167586d49626203c2c1/src/OidcClient.js#L138\n * - https://github.com/panva/node-openid-client/blob/35758419489ff751a71f5b66f5020087a63e1e88/lib/client.js#L284\n *\n * @param options IEndSessionOptions\n * @returns The URL to redirect to in order to perform RP Initiated Logout\n * @hidden\n */\nfunction getEndSessionUrl({ endSessionEndpoint, idTokenHint, postLogoutRedirectUri, state, }) {\n const url = new URL(endSessionEndpoint);\n if (idTokenHint !== undefined)\n url.searchParams.append(\"id_token_hint\", idTokenHint);\n if (postLogoutRedirectUri !== undefined) {\n url.searchParams.append(\"post_logout_redirect_uri\", postLogoutRedirectUri);\n if (state !== undefined)\n url.searchParams.append(\"state\", state);\n }\n return url.toString();\n}\n/**\n * @param options.endSessionEndpoint The end_session_endpoint advertised by the server\n * @param options.idTokenHint The idToken supplied by the server after logging in\n * Redirects the window to the location required to perform RP initiated logout\n *\n * @hidden\n */\nfunction maybeBuildRpInitiatedLogout({ endSessionEndpoint, idTokenHint, }) {\n if (endSessionEndpoint === undefined)\n return undefined;\n return function logout({ state, postLogoutUrl }) {\n return getEndSessionUrl({\n endSessionEndpoint,\n idTokenHint,\n state,\n postLogoutRedirectUri: postLogoutUrl,\n });\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isSupportedTokenType(token) {\n return typeof token === \"string\" && [\"DPoP\", \"Bearer\"].includes(token);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst USER_SESSION_PREFIX = \"solidClientAuthenticationUser\";\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isValidUrl(url) {\n try {\n // Here, the URL constructor is just called to parse the given string and\n // verify if it is a well-formed IRI.\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n }\n catch {\n return false;\n }\n}\nfunction determineSigningAlg(supported, preferred) {\n return (preferred.find((signingAlg) => {\n return supported.includes(signingAlg);\n }) ?? null);\n}\nfunction isStaticClient(options) {\n return options.clientId !== undefined && !isValidUrl(options.clientId);\n}\nfunction isSolidOidcClient(options, issuerConfig) {\n return (issuerConfig.scopesSupported.includes(\"webid\") &&\n options.clientId !== undefined &&\n isValidUrl(options.clientId));\n}\nfunction isKnownClientType(clientType) {\n return (typeof clientType === \"string\" &&\n [\"dynamic\", \"static\", \"solid-oidc\"].includes(clientType));\n}\nasync function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) {\n let clientInfo;\n if (isSolidOidcClient(options, issuerConfig)) {\n clientInfo = {\n clientId: options.clientId,\n clientName: options.clientName,\n clientType: \"solid-oidc\",\n };\n }\n else if (isStaticClient(options)) {\n clientInfo = {\n clientId: options.clientId,\n clientSecret: options.clientSecret,\n clientName: options.clientName,\n clientType: \"static\",\n };\n }\n else {\n // Case of a dynamically registered client.\n return clientRegistrar.getClient({\n sessionId: options.sessionId,\n clientName: options.clientName,\n redirectUrl: options.redirectUrl,\n }, issuerConfig);\n }\n // If a client_id was provided, and the Identity Provider is Solid-OIDC compliant,\n // or it is not compliant but the client_id isn't an IRI (we assume it has already\n // been registered with the IdP), then the client registration information needs\n // to be stored so that it can be retrieved later after redirect.\n const infoToSave = {\n clientId: clientInfo.clientId,\n clientType: clientInfo.clientType,\n };\n if (clientInfo.clientType === \"static\") {\n infoToSave.clientSecret = clientInfo.clientSecret;\n }\n if (clientInfo.clientName) {\n infoToSave.clientName = clientInfo.clientName;\n }\n // Note that due to the underlying implementation, doing a `Promise.all`\n // on multiple `storageUtility.setForUser` results in the last one\n // overriding the previous calls.\n await storageUtility.setForUser(options.sessionId, infoToSave);\n return clientInfo;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst boundFetch = (request, init) => fetch(request, init);\n/**\n * @hidden\n */\nclass ClientAuthentication {\n loginHandler;\n redirectHandler;\n logoutHandler;\n sessionInfoManager;\n issuerConfigFetcher;\n boundLogout;\n constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {\n this.loginHandler = loginHandler;\n this.redirectHandler = redirectHandler;\n this.logoutHandler = logoutHandler;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.loginHandler = loginHandler;\n this.redirectHandler = redirectHandler;\n this.logoutHandler = logoutHandler;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n }\n // By default, our fetch() resolves to the environment fetch() function.\n fetch = boundFetch;\n logout = async (sessionId, options) => {\n // When doing IDP logout this will redirect away from the current page, so we should not expect\n // code after this condition to be run if it is true.\n // We also need to make sure that any other cleanup that we want to do for\n // our session takes place before this condition is run\n await this.logoutHandler.handle(sessionId, options?.logoutType === \"idp\"\n ? {\n ...options,\n toLogoutUrl: this.boundLogout,\n }\n : options);\n // Restore our fetch() function back to the environment fetch(), effectively\n // leaving us with un-authenticated fetches from now on.\n this.fetch = boundFetch;\n // Delete the bound logout function, so that it can't be called after this.\n delete this.boundLogout;\n };\n getSessionInfo = async (sessionId) => {\n // TODO complete\n return this.sessionInfoManager.get(sessionId);\n };\n getAllSessionInfo = async () => {\n return this.sessionInfoManager.getAll();\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * A helper class that will validate items taken from local storage\n */\nasync function getSessionIdFromOauthState(storageUtility, oauthState) {\n return storageUtility.getForUser(oauthState, \"sessionId\");\n}\n/**\n * Based on the provided state, this looks up contextual information stored\n * before redirecting the user to the OIDC issuer.\n * @param sessionId The state (~ correlation ID) of the OIDC request\n * @param storageUtility\n * @param configFetcher\n * @returns Information stored about the client issuing the request\n */\nasync function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) {\n try {\n const [issuerIri, codeVerifier, storedRedirectIri, dpop, keepAlive] = await Promise.all([\n storageUtility.getForUser(sessionId, \"issuer\", {\n errorIfNull: true,\n }),\n storageUtility.getForUser(sessionId, \"codeVerifier\"),\n storageUtility.getForUser(sessionId, \"redirectUrl\"),\n storageUtility.getForUser(sessionId, \"dpop\", { errorIfNull: true }),\n storageUtility.getForUser(sessionId, \"keepAlive\"),\n ]);\n // Clear the code verifier, which is one-time use.\n await storageUtility.deleteForUser(sessionId, \"codeVerifier\");\n // Unlike openid-client, this looks up the configuration from storage\n const issuerConfig = await configFetcher.fetchConfig(issuerIri);\n return {\n codeVerifier,\n redirectUrl: storedRedirectIri,\n issuerConfig,\n dpop: dpop === \"true\",\n // Default keepAlive to true if not found in storage.\n keepAlive: typeof keepAlive === \"string\" ? keepAlive === \"true\" : true,\n };\n }\n catch (e) {\n throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`);\n }\n}\n/**\n * Stores information about the session in the provided storage. Note that not\n * all storage are equally secure, and it is strongly advised not to store either\n * the refresh token or the DPoP key in the browser's local storage.\n *\n * @param storageUtility\n * @param sessionId\n * @param webId\n * @param clientId\n * @param isLoggedIn\n * @param refreshToken\n * @param secure\n * @param dpopKey\n */\nasync function saveSessionInfoToStorage(storageUtility, sessionId, webId, clientId, isLoggedIn, refreshToken, secure, dpopKey) {\n // TODO: Investigate why this does not work with a Promise.all\n if (refreshToken !== undefined) {\n await storageUtility.setForUser(sessionId, { refreshToken }, { secure });\n }\n if (webId !== undefined) {\n await storageUtility.setForUser(sessionId, { webId }, { secure });\n }\n if (clientId !== undefined) {\n await storageUtility.setForUser(sessionId, { clientId }, { secure });\n }\n if (isLoggedIn !== undefined) {\n await storageUtility.setForUser(sessionId, { isLoggedIn }, { secure });\n }\n if (dpopKey !== undefined) {\n await storageUtility.setForUser(sessionId, {\n publicKey: JSON.stringify(dpopKey.publicKey),\n privateKey: JSON.stringify(await exportJWK(dpopKey.privateKey)),\n }, { secure });\n }\n}\n// TOTEST: this does not handle all possible bad inputs for example what if it's not proper JSON\n/**\n * @hidden\n */\nclass StorageUtility {\n secureStorage;\n insecureStorage;\n constructor(secureStorage, insecureStorage) {\n this.secureStorage = secureStorage;\n this.insecureStorage = insecureStorage;\n this.secureStorage = secureStorage;\n this.insecureStorage = insecureStorage;\n }\n getKey(userId) {\n return `solidClientAuthenticationUser:${userId}`;\n }\n async getUserData(userId, secure) {\n const stored = await (secure ? this.secureStorage : this.insecureStorage).get(this.getKey(userId));\n if (stored === undefined) {\n return {};\n }\n try {\n return JSON.parse(stored);\n }\n catch (err) {\n throw new Error(`Data for user [${userId}] in [${secure ? \"secure\" : \"unsecure\"}] storage is corrupted - expected valid JSON, but got: ${stored}`);\n }\n }\n async setUserData(userId, data, secure) {\n await (secure ? this.secureStorage : this.insecureStorage).set(this.getKey(userId), JSON.stringify(data));\n }\n async get(key, options) {\n const value = await (options?.secure ? this.secureStorage : this.insecureStorage).get(key);\n if (value === undefined && options?.errorIfNull) {\n throw new Error(`[${key}] is not stored`);\n }\n return value;\n }\n async set(key, value, options) {\n return (options?.secure ? this.secureStorage : this.insecureStorage).set(key, value);\n }\n async delete(key, options) {\n return (options?.secure ? this.secureStorage : this.insecureStorage).delete(key);\n }\n async getForUser(userId, key, options) {\n const userData = await this.getUserData(userId, options?.secure);\n let value;\n if (!userData || !userData[key]) {\n value = undefined;\n }\n value = userData[key];\n if (value === undefined && options?.errorIfNull) {\n throw new Error(`Field [${key}] for user [${userId}] is not stored`);\n }\n return value || undefined;\n }\n async setForUser(userId, values, options) {\n let userData;\n try {\n userData = await this.getUserData(userId, options?.secure);\n }\n catch {\n // if reading the user data throws, the data is corrupted, and we want to write over it\n userData = {};\n }\n await this.setUserData(userId, { ...userData, ...values }, options?.secure);\n }\n async deleteForUser(userId, key, options) {\n const userData = await this.getUserData(userId, options?.secure);\n delete userData[key];\n await this.setUserData(userId, userData, options?.secure);\n }\n async deleteAllUserData(userId, options) {\n await (options?.secure ? this.secureStorage : this.insecureStorage).delete(this.getKey(userId));\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass InMemoryStorage {\n map = {};\n async get(key) {\n return this.map[key] || undefined;\n }\n async set(key, value) {\n this.map[key] = value;\n }\n async delete(key) {\n delete this.map[key];\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when a poor configuration is received\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass ConfigurationError extends Error {\n /* istanbul ignore next */\n constructor(message) {\n super(message);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered if a method is not implemented\n * @hidden\n */\nclass NotImplementedError extends Error {\n /* istanbul ignore next */\n constructor(methodName) {\n super(`[${methodName}] is not implemented`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when receiving a response missing mandatory elements\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass InvalidResponseError extends Error {\n missingFields;\n /* istanbul ignore next */\n constructor(missingFields) {\n super(`Invalid response from OIDC provider: missing fields ${missingFields}`);\n this.missingFields = missingFields;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when receiving a response missing mandatory elements\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass OidcProviderError extends Error {\n error;\n errorDescription;\n /* istanbul ignore next */\n constructor(message, error, errorDescription) {\n super(message);\n this.error = error;\n this.errorDescription = errorDescription;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Normalizes a URL in order to generate the DPoP token based on a consistent scheme.\n *\n * @param audience The URL to normalize.\n * @returns The normalized URL as a string.\n * @hidden\n */\nfunction normalizeHTU(audience) {\n const audienceUrl = new URL(audience);\n return new URL(audienceUrl.pathname, audienceUrl.origin).toString();\n}\n/**\n * Creates a DPoP header according to https://tools.ietf.org/html/draft-fett-oauth-dpop-04,\n * based on the target URL and method, using the provided key.\n *\n * @param audience Target URL.\n * @param method HTTP method allowed.\n * @param dpopKey Key used to sign the token.\n * @returns A JWT that can be used as a DPoP Authorization header.\n */\nasync function createDpopHeader(audience, method, dpopKey) {\n return new SignJWT({\n htu: normalizeHTU(audience),\n htm: method.toUpperCase(),\n jti: v4(),\n })\n .setProtectedHeader({\n alg: PREFERRED_SIGNING_ALG[0],\n jwk: dpopKey.publicKey,\n typ: \"dpop+jwt\",\n })\n .setIssuedAt()\n .sign(dpopKey.privateKey, {});\n}\nasync function generateDpopKeyPair() {\n const { privateKey, publicKey } = await generateKeyPair(PREFERRED_SIGNING_ALG[0]);\n const dpopKeyPair = {\n privateKey,\n publicKey: await exportJWK(publicKey),\n };\n // The alg property isn't set by exportJWK, so set it manually.\n [dpopKeyPair.publicKey.alg] = PREFERRED_SIGNING_ALG;\n return dpopKeyPair;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * If expires_in isn't specified for the access token, we assume its lifetime is\n * 10 minutes.\n */\nconst DEFAULT_EXPIRATION_TIME_SECONDS = 600;\nfunction isExpectedAuthError(statusCode) {\n // As per https://tools.ietf.org/html/rfc7235#section-3.1 and https://tools.ietf.org/html/rfc7235#section-3.1,\n // a response failing because the provided credentials aren't accepted by the\n // server can get a 401 or a 403 response.\n return [401, 403].includes(statusCode);\n}\nasync function buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions) {\n const headers = new Headers(defaultOptions?.headers);\n // Any pre-existing Authorization header should be overriden.\n headers.set(\"Authorization\", `DPoP ${authToken}`);\n headers.set(\"DPoP\", await createDpopHeader(targetUrl, defaultOptions?.method ?? \"get\", dpopKey));\n return {\n ...defaultOptions,\n headers,\n };\n}\nasync function buildAuthenticatedHeaders(targetUrl, authToken, dpopKey, defaultOptions) {\n if (dpopKey !== undefined) {\n return buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions);\n }\n const headers = new Headers(defaultOptions?.headers);\n // Any pre-existing Authorization header should be overriden.\n headers.set(\"Authorization\", `Bearer ${authToken}`);\n return {\n ...defaultOptions,\n headers,\n };\n}\nasync function makeAuthenticatedRequest(accessToken, url, defaultRequestInit, dpopKey, unauthFetch = fetch) {\n return unauthFetch(url, await buildAuthenticatedHeaders(url.toString(), accessToken, dpopKey, defaultRequestInit));\n}\nasync function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) {\n const tokenSet = await refreshOptions.tokenRefresher.refresh(refreshOptions.sessionId, refreshOptions.refreshToken, dpopKey);\n eventEmitter?.emit(EVENTS.SESSION_EXTENDED, tokenSet.expiresIn ?? DEFAULT_EXPIRATION_TIME_SECONDS);\n return {\n accessToken: tokenSet.accessToken,\n refreshToken: tokenSet.refreshToken,\n expiresIn: tokenSet.expiresIn,\n };\n}\n/**\n *\n * @param expiresIn Delay until the access token expires.\n * @returns a delay until the access token should be refreshed.\n */\nconst computeRefreshDelay = (expiresIn) => {\n if (expiresIn !== undefined) {\n return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0\n ? // We want to refresh the token 5 seconds before they actually expire.\n expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS\n : expiresIn;\n }\n return DEFAULT_EXPIRATION_TIME_SECONDS;\n};\n/**\n * @param accessToken an access token, either a Bearer token or a DPoP one.\n * @param options The option object may contain two objects: the DPoP key token\n * is bound to if applicable, and options to customize token renewal behavior.\n * @param {typeof fetch} [options.fetch=fetch] A custom fetch function (defaults to the global fetch).\n *\n * @returns A fetch function that adds an appropriate Authorization header with\n * the provided token, and adds a DPoP header if applicable.\n */\nfunction buildAuthenticatedFetch(accessToken, options) {\n let currentAccessToken = accessToken;\n let latestTimeout;\n const currentRefreshOptions = options?.refreshOptions;\n // Setup the refresh timeout outside of the authenticated fetch, so that\n // an idle app will not get logged out if it doesn't issue a fetch before\n // the first expiration date.\n if (currentRefreshOptions !== undefined) {\n const proactivelyRefreshToken = async () => {\n try {\n const { accessToken: refreshedAccessToken, refreshToken, expiresIn, } = await refreshAccessToken(currentRefreshOptions, \n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.dpopKey, \n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter);\n // Update the tokens in the closure if appropriate.\n currentAccessToken = refreshedAccessToken;\n if (refreshToken !== undefined) {\n currentRefreshOptions.refreshToken = refreshToken;\n }\n // Each time the access token is refreshed, we must plan for the next\n // refresh iteration.\n clearTimeout(latestTimeout);\n latestTimeout = setTimeout(proactivelyRefreshToken, computeRefreshDelay(expiresIn) * 1000);\n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter?.emit(EVENTS.TIMEOUT_SET, latestTimeout);\n }\n catch (e) {\n // It is possible that an underlying library throws an error on refresh flow failure.\n // If we used a log framework, the error could be logged at the `debug` level,\n // but otherwise the failure of the refresh flow should not blow up in the user's\n // face, so we just swallow the error.\n if (e instanceof OidcProviderError) {\n // The OIDC provider refused to refresh the access token and returned an error instead.\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n options?.eventEmitter?.emit(EVENTS.ERROR, e.error, e.errorDescription);\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n options?.eventEmitter?.emit(EVENTS.SESSION_EXPIRED);\n }\n if (e instanceof InvalidResponseError &&\n e.missingFields.includes(\"access_token\")) {\n // In this case, the OIDC provider returned a non-standard response, but\n // did not specify that it was an error. We cannot refresh nonetheless.\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n options?.eventEmitter?.emit(EVENTS.SESSION_EXPIRED);\n }\n }\n };\n latestTimeout = setTimeout(proactivelyRefreshToken, \n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n computeRefreshDelay(options.expiresIn) * 1000);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter?.emit(EVENTS.TIMEOUT_SET, latestTimeout);\n }\n else if (options !== undefined && options.eventEmitter !== undefined) {\n // If no refresh options are provided, the session expires when the access token does.\n const expirationTimeout = setTimeout(() => {\n // The event emitter is always defined in our code, and it would be tedious\n // to test for conditions when it is not.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter.emit(EVENTS.SESSION_EXPIRED);\n }, computeRefreshDelay(options.expiresIn) * 1000);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout);\n }\n return async (url, requestInit) => {\n let response = await makeAuthenticatedRequest(currentAccessToken, url, requestInit, options?.dpopKey, options?.fetch);\n const failedButNotExpectedAuthError = !response.ok && !isExpectedAuthError(response.status);\n if (response.ok || failedButNotExpectedAuthError) {\n // If there hasn't been a redirection, or if there has been a non-auth related\n // issue, it should be handled at the application level\n return response;\n }\n const hasBeenRedirected = response.url !== url;\n if (hasBeenRedirected && options?.dpopKey !== undefined) {\n // If the request failed for auth reasons, and has been redirected, we should\n // replay it generating a DPoP header for the rediration target IRI. This\n // doesn't apply to Bearer tokens, as the Bearer tokens aren't specific\n // to a given resource and method, while the DPoP header (associated to a\n // DPoP token) is.\n response = await makeAuthenticatedRequest(currentAccessToken, \n // Replace the original target IRI (`url`) by the redirection target\n response.url, requestInit, options.dpopKey, options.fetch);\n }\n return response;\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst StorageUtilityGetResponse = \"getResponse\";\nconst StorageUtilityMock = {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n get: async (key, options) => StorageUtilityGetResponse,\n set: async (key, value) => {\n /* do nothing */\n },\n delete: async (key) => {\n /* do nothing */\n },\n getForUser: async (userId, key, options) => StorageUtilityGetResponse,\n setForUser: async (userId, values, options) => {\n /* do nothing */\n },\n deleteForUser: async (userId, key, options) => {\n /* do nothing */\n },\n deleteAllUserData: async (userId, options) => {\n /* do nothing */\n },\n};\nconst mockStorage = (stored) => {\n const store = stored;\n return {\n get: async (key) => {\n if (store[key] === undefined) {\n return undefined;\n }\n if (typeof store[key] === \"string\") {\n return store[key];\n }\n return JSON.stringify(store[key]);\n },\n set: async (key, value) => {\n store[key] = value;\n },\n delete: async (key) => {\n delete store[key];\n },\n };\n};\nconst mockStorageUtility = (stored, isSecure = false) => {\n if (isSecure) {\n return new StorageUtility(mockStorage(stored), mockStorage({}));\n }\n return new StorageUtility(mockStorage({}), mockStorage(stored));\n};\n\nexport { AggregateHandler, AuthorizationCodeWithPkceOidcHandlerBase, ClientAuthentication, ConfigurationError, DEFAULT_SCOPES, EVENTS, GeneralLogoutHandler, IRpLogoutHandler, IWaterfallLogoutHandler, InMemoryStorage, InvalidResponseError, NotImplementedError, OidcProviderError, PREFERRED_SIGNING_ALG, REFRESH_BEFORE_EXPIRATION_SECONDS, SOLID_CLIENT_AUTHN_KEY_PREFIX, SessionInfoManagerBase, StorageUtility, StorageUtilityGetResponse, StorageUtilityMock, USER_SESSION_PREFIX, buildAuthenticatedFetch, clear, createDpopHeader, determineSigningAlg, generateDpopKeyPair, getEndSessionUrl, getSessionIdFromOauthState, getUnauthenticatedSession, getWebidFromTokenPayload, handleRegistration, isKnownClientType, isSupportedTokenType, isValidRedirectUrl, loadOidcContextFromStorage, maybeBuildRpInitiatedLogout, mockStorage, mockStorageUtility, normalizeScopes, removeOpenIdParams, saveSessionInfoToStorage };\n//# sourceMappingURL=index.mjs.map\n","import { OidcClient, WebStorageStateStore } from '@inrupt/oidc-client';\nexport { CordovaIFrameNavigator, CordovaPopupNavigator, InMemoryWebStorage, Log, OidcClient, SessionMonitor, User, UserManager, Version, WebStorageStateStore } from '@inrupt/oidc-client';\nimport { determineSigningAlg, PREFERRED_SIGNING_ALG, generateDpopKeyPair, createDpopHeader, getWebidFromTokenPayload, OidcProviderError, InvalidResponseError, removeOpenIdParams } from '@inrupt/solid-client-authn-core';\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction processErrorResponse(\n// The type is any here because the object is parsed from a JSON response\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nresponseBody, options) {\n // The following errors are defined by the spec, and allow providing some context.\n // See https://tools.ietf.org/html/rfc7591#section-3.2.2 for more information\n if (responseBody.error === \"invalid_redirect_uri\") {\n throw new Error(`Dynamic client registration failed: the provided redirect uri [${options.redirectUrl?.toString()}] is invalid - ${responseBody.error_description ?? \"\"}`);\n }\n if (responseBody.error === \"invalid_client_metadata\") {\n throw new Error(`Dynamic client registration failed: the provided client metadata ${JSON.stringify(options)} is invalid - ${responseBody.error_description ?? \"\"}`);\n }\n // We currently don't support software statements, so no related error should happen.\n // If an error outside of the spec happens, no additional context can be provided\n throw new Error(`Dynamic client registration failed: ${responseBody.error} - ${responseBody.error_description ?? \"\"}`);\n}\nfunction hasClientId(body) {\n return typeof body.client_id === \"string\";\n}\nfunction hasRedirectUri(body) {\n return (Array.isArray(body.redirect_uris) &&\n body.redirect_uris.every((uri) => typeof uri === \"string\"));\n}\nfunction validateRegistrationResponse(responseBody, options) {\n if (!hasClientId(responseBody)) {\n throw new Error(`Dynamic client registration failed: no client_id has been found on ${JSON.stringify(responseBody)}`);\n }\n if (options.redirectUrl &&\n hasRedirectUri(responseBody) &&\n responseBody.redirect_uris[0] !== options.redirectUrl.toString()) {\n throw new Error(`Dynamic client registration failed: the returned redirect URIs ${JSON.stringify(responseBody.redirect_uris)} don't match the provided ${JSON.stringify([\n options.redirectUrl.toString(),\n ])}`);\n }\n return true;\n}\nasync function registerClient(options, issuerConfig) {\n if (!issuerConfig.registrationEndpoint) {\n throw new Error(\"Dynamic Registration could not be completed because the issuer has no registration endpoint.\");\n }\n if (!Array.isArray(issuerConfig.idTokenSigningAlgValuesSupported)) {\n throw new Error(\"The OIDC issuer discovery profile is missing the 'id_token_signing_alg_values_supported' value, which is mandatory.\");\n }\n const signingAlg = determineSigningAlg(issuerConfig.idTokenSigningAlgValuesSupported, PREFERRED_SIGNING_ALG);\n const config = {\n /* eslint-disable camelcase */\n client_name: options.clientName,\n application_type: \"web\",\n redirect_uris: [options.redirectUrl?.toString()],\n subject_type: \"public\",\n token_endpoint_auth_method: \"client_secret_basic\",\n id_token_signed_response_alg: signingAlg,\n grant_types: [\"authorization_code\", \"refresh_token\"],\n /* eslint-enable camelcase */\n };\n const headers = {\n \"Content-Type\": \"application/json\",\n };\n const registerResponse = await fetch(issuerConfig.registrationEndpoint.toString(), {\n method: \"POST\",\n headers,\n body: JSON.stringify(config),\n });\n if (registerResponse.ok) {\n const responseBody = await registerResponse.json();\n validateRegistrationResponse(responseBody, options);\n return {\n clientId: responseBody.client_id,\n clientSecret: responseBody.client_secret,\n expiresAt: responseBody.client_secret_expires_at,\n idTokenSignedResponseAlg: responseBody.id_token_signed_response_alg,\n clientType: \"dynamic\",\n };\n }\n if (registerResponse.status === 400) {\n processErrorResponse(await registerResponse.json(), options);\n }\n throw new Error(`Dynamic client registration failed: the server returned ${registerResponse.status} ${registerResponse.statusText} - ${await registerResponse.text()}`);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// Identifiers in camelcase are mandated by the OAuth spec.\n/* eslint-disable camelcase */\nfunction hasError(value) {\n return value.error !== undefined && typeof value.error === \"string\";\n}\nfunction hasErrorDescription(value) {\n return (value.error_description !== undefined &&\n typeof value.error_description === \"string\");\n}\nfunction hasErrorUri(value) {\n return value.error_uri !== undefined && typeof value.error_uri === \"string\";\n}\nfunction hasAccessToken(value) {\n return (value.access_token !== undefined && typeof value.access_token === \"string\");\n}\nfunction hasIdToken(value) {\n return value.id_token !== undefined && typeof value.id_token === \"string\";\n}\nfunction hasRefreshToken(value) {\n return (value.refresh_token !== undefined && typeof value.refresh_token === \"string\");\n}\nfunction hasTokenType(value) {\n return value.token_type !== undefined && typeof value.token_type === \"string\";\n}\nfunction hasExpiresIn(value) {\n return value.expires_in === undefined || typeof value.expires_in === \"number\";\n}\nfunction validatePreconditions(issuer, data) {\n if (data.grantType &&\n (!issuer.grantTypesSupported ||\n !issuer.grantTypesSupported.includes(data.grantType))) {\n throw new Error(`The issuer [${issuer.issuer}] does not support the [${data.grantType}] grant`);\n }\n if (!issuer.tokenEndpoint) {\n throw new Error(`This issuer [${issuer.issuer}] does not have a token endpoint`);\n }\n}\nfunction validateTokenEndpointResponse(tokenResponse, dpop) {\n if (hasError(tokenResponse)) {\n throw new OidcProviderError(`Token endpoint returned error [${tokenResponse.error}]${hasErrorDescription(tokenResponse)\n ? `: ${tokenResponse.error_description}`\n : \"\"}${hasErrorUri(tokenResponse) ? ` (see ${tokenResponse.error_uri})` : \"\"}`, tokenResponse.error, hasErrorDescription(tokenResponse)\n ? tokenResponse.error_description\n : undefined);\n }\n if (!hasAccessToken(tokenResponse)) {\n throw new InvalidResponseError([\"access_token\"]);\n }\n if (!hasIdToken(tokenResponse)) {\n throw new InvalidResponseError([\"id_token\"]);\n }\n if (!hasTokenType(tokenResponse)) {\n throw new InvalidResponseError([\"token_type\"]);\n }\n if (!hasExpiresIn(tokenResponse)) {\n throw new InvalidResponseError([\"expires_in\"]);\n }\n // TODO: Due to a bug in both the ESS ID broker AND NSS (what were the odds), a DPoP token is returned\n // with a token_type 'Bearer'. To work around this, this test is currently disabled.\n // https://github.com/solid/oidc-op/issues/26\n // Fixed, but unreleased for the ESS (current version: inrupt-oidc-server-0.5.2)\n // if (dpop && tokenResponse.token_type.toLowerCase() !== \"dpop\") {\n // throw new Error(\n // `Invalid token endpoint response: requested a [DPoP] token, but got a 'token_type' value of [${tokenResponse.token_type}].`\n // );\n // }\n if (!dpop && tokenResponse.token_type.toLowerCase() !== \"bearer\") {\n throw new Error(`Invalid token endpoint response: requested a [Bearer] token, but got a 'token_type' value of [${tokenResponse.token_type}].`);\n }\n return tokenResponse;\n}\nasync function getTokens(issuer, client, data, dpop) {\n validatePreconditions(issuer, data);\n const headers = {\n \"content-type\": \"application/x-www-form-urlencoded\",\n };\n let dpopKey;\n if (dpop) {\n dpopKey = await generateDpopKeyPair();\n headers.DPoP = await createDpopHeader(issuer.tokenEndpoint, \"POST\", dpopKey);\n }\n // Note: this defaults to client_secret_basic. client_secret_post\n // is currently not supported. See https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication\n // for details.\n if (client.clientSecret) {\n headers.Authorization = `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`;\n }\n const requestBody = {\n /* eslint-disable camelcase */\n grant_type: data.grantType,\n redirect_uri: data.redirectUrl,\n code: data.code,\n code_verifier: data.codeVerifier,\n client_id: client.clientId,\n /* eslint-enable camelcase */\n };\n const tokenRequestInit = {\n method: \"POST\",\n headers,\n body: new URLSearchParams(requestBody).toString(),\n };\n const rawTokenResponse = await fetch(issuer.tokenEndpoint, tokenRequestInit);\n const jsonTokenResponse = (await rawTokenResponse.json());\n const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop);\n const { webId, clientId } = await getWebidFromTokenPayload(tokenResponse.id_token, issuer.jwksUri, issuer.issuer, client.clientId);\n return {\n accessToken: tokenResponse.access_token,\n idToken: tokenResponse.id_token,\n refreshToken: hasRefreshToken(tokenResponse)\n ? tokenResponse.refresh_token\n : undefined,\n webId,\n clientId,\n dpopKey,\n expiresIn: tokenResponse.expires_in,\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst isValidUrl = (url) => {\n try {\n // Here, the URL constructor is just called to parse the given string and\n // verify if it is a well-formed IRI.\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n }\n catch {\n return false;\n }\n};\n// Identifiers in snake_case are mandated by the OAuth spec.\n/* eslint-disable camelcase */\nasync function refresh(refreshToken, issuer, client, dpopKey) {\n if (client.clientId === undefined) {\n throw new Error(\"No client ID available when trying to refresh the access token.\");\n }\n const requestBody = {\n grant_type: \"refresh_token\",\n refresh_token: refreshToken,\n };\n let dpopHeader = {};\n if (dpopKey !== undefined) {\n dpopHeader = {\n DPoP: await createDpopHeader(issuer.tokenEndpoint, \"POST\", dpopKey),\n };\n }\n let authHeader = {};\n if (client.clientSecret !== undefined) {\n authHeader = {\n // We assume that client_secret_basic is the client authentication method.\n // TODO: Get the authentication method from the IClient configuration object.\n Authorization: `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`,\n };\n }\n else if (isValidUrl(client.clientId)) {\n // If the client ID is an URL, and there is no client secret, the client\n // has a Solid-OIDC Client Identifier, and it should be present in the\n // request body.\n requestBody.client_id = client.clientId;\n }\n const rawResponse = await fetch(issuer.tokenEndpoint, {\n method: \"POST\",\n body: new URLSearchParams(requestBody).toString(),\n headers: {\n ...dpopHeader,\n ...authHeader,\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n });\n let response;\n try {\n response = await rawResponse.json();\n }\n catch (e) {\n // The response is left out of the error on purpose not to leak any sensitive information.\n throw new Error(`The token endpoint of issuer ${issuer.issuer} returned a malformed response.`);\n }\n const validatedResponse = validateTokenEndpointResponse(response, dpopKey !== undefined);\n const { webId } = await getWebidFromTokenPayload(validatedResponse.id_token, issuer.jwksUri, issuer.issuer, client.clientId);\n return {\n accessToken: validatedResponse.access_token,\n idToken: validatedResponse.id_token,\n refreshToken: typeof validatedResponse.refresh_token === \"string\"\n ? validatedResponse.refresh_token\n : undefined,\n webId,\n dpopKey,\n expiresIn: validatedResponse.expires_in,\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Removes OIDC-specific query parameters from a given URL (state, code...), and\n * sanitizes the URL (e.g. removes the hash fragment).\n * @param redirectUrl The URL to clean up.\n * @returns A copy of the URL, without OIDC-specific query params.\n */\nfunction normalizeCallbackUrl(redirectUrl) {\n const cleanedUrl = removeOpenIdParams(redirectUrl);\n // As per https://tools.ietf.org/html/rfc6749#section-3.1.2, the redirect URL\n // must not include a hash fragment.\n cleanedUrl.hash = \"\";\n // Do not normalize the trailing slash, and respect the original redirect URL.\n if (\n // The trailing slash is present in the original redirect URL\n redirectUrl.includes(`${cleanedUrl.origin}/`)) {\n return cleanedUrl.href;\n }\n // Calling cleanedUrl.href appends a trailing slash to the origin, which may\n // create a redirect URL mismatch if it wasn't originally present.\n return `${cleanedUrl.origin}${cleanedUrl.href.substring(\n // Adds 1 to the origin length to remove the trailing slash\n cleanedUrl.origin.length + 1)}`;\n}\n/**\n * Clears any OIDC-related data lingering in the local storage.\n */\nasync function clearOidcPersistentStorage() {\n const client = new OidcClient({\n // TODO: We should look at the various interfaces being used for storage,\n // i.e. between oidc-client-js (WebStorageStoreState), localStorage\n // (which has an interface Storage), and our own proprietary interface\n // IStorage - i.e. we should really just be using the browser Web Storage\n // API, e.g. \"stateStore: window.localStorage,\".\n // We are instantiating a new instance here, so the only value we need to\n // explicitly provide is the response mode (default otherwise will look\n // for a hash '#' fragment!).\n // eslint-disable-next-line camelcase\n response_mode: \"query\",\n });\n await client.clearStaleState(new WebStorageStateStore({}));\n const myStorage = window.localStorage;\n const itemsToRemove = [];\n for (let i = 0; i <= myStorage.length; i += 1) {\n const key = myStorage.key(i);\n if (key &&\n (key.match(/^oidc\\..+$/) ||\n key.match(/^solidClientAuthenticationUser:.+$/))) {\n itemsToRemove.push(key);\n }\n }\n itemsToRemove.forEach((key) => myStorage.removeItem(key));\n}\n\nexport { clearOidcPersistentStorage, getTokens, normalizeCallbackUrl, refresh, registerClient };\n","import { StorageUtility, ClientAuthentication as ClientAuthentication$1, isValidRedirectUrl, EVENTS, removeOpenIdParams, ConfigurationError, handleRegistration, normalizeScopes, AuthorizationCodeWithPkceOidcHandlerBase, SessionInfoManagerBase, isSupportedTokenType, clear as clear$1, getUnauthenticatedSession, loadOidcContextFromStorage, buildAuthenticatedFetch, saveSessionInfoToStorage, maybeBuildRpInitiatedLogout, AggregateHandler, isKnownClientType, InMemoryStorage, IWaterfallLogoutHandler, SOLID_CLIENT_AUTHN_KEY_PREFIX } from '@inrupt/solid-client-authn-core';\nexport { ConfigurationError, EVENTS, InMemoryStorage, NotImplementedError } from '@inrupt/solid-client-authn-core';\nimport { v4 } from 'uuid';\nimport EventEmitter from 'events';\nimport { normalizeCallbackUrl, OidcClient, clearOidcPersistentStorage, getTokens, registerClient, refresh } from '@inrupt/oidc-client-ext';\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * This class in a no-value-added extension of StorageUtility from the core module.\n * The reason it has to be declared is for TSyringe to find the decorators in the\n * same modules as where the dependency container is declared (in this case,\n * the browser module, with the dependancy container in dependencies.ts).\n * @hidden\n */\nclass StorageUtilityBrowser extends StorageUtility {\n constructor(secureStorage, insecureStorage) {\n super(secureStorage, insecureStorage);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass ClientAuthentication extends ClientAuthentication$1 {\n // Define these functions as properties so that they don't get accidentally re-bound.\n // Isn't Javascript fun?\n login = async (options, eventEmitter) => {\n // In order to get a clean start, make sure that the session is logged out\n // on login, except when doing a silent login so that Dynamic Client information\n // is preserved.\n if (options.prompt !== \"none\") {\n await this.sessionInfoManager.clear(options.sessionId);\n }\n // In the case of the user hitting the 'back' button in their browser, they\n // could return to a previous redirect URL that contains OIDC params that\n // are now longer valid. To be safe, strip relevant params now.\n // If the user is providing a redirect IRI, it should not be modified, so\n // normalization only applies if we default to the current location (which is\n // a bad practice and should be discouraged).\n const redirectUrl = options.redirectUrl ?? normalizeCallbackUrl(window.location.href);\n if (!isValidRedirectUrl(redirectUrl)) {\n throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`);\n }\n await this.loginHandler.handle({\n ...options,\n redirectUrl,\n // If no clientName is provided, the clientId may be used instead.\n clientName: options.clientName ?? options.clientId,\n eventEmitter,\n });\n };\n // Collects session information from storage, and returns them. Returns null\n // if the expected information cannot be found.\n // Note that the ID token is not stored, which means the session information\n // cannot be validated at this point.\n validateCurrentSession = async (currentSessionId) => {\n const sessionInfo = await this.sessionInfoManager.get(currentSessionId);\n if (sessionInfo === undefined ||\n sessionInfo.clientAppId === undefined ||\n sessionInfo.issuer === undefined) {\n return null;\n }\n return sessionInfo;\n };\n handleIncomingRedirect = async (url, eventEmitter) => {\n try {\n const redirectInfo = await this.redirectHandler.handle(url, eventEmitter, undefined);\n // The `FallbackRedirectHandler` directly returns the global `fetch` for\n // his value, so we should ensure it's bound to `window` rather than to\n // ClientAuthentication, to avoid the following error:\n // > 'fetch' called on an object that does not implement interface Window.\n this.fetch = redirectInfo.fetch.bind(window);\n this.boundLogout = redirectInfo.getLogoutUrl;\n // Strip the oauth params:\n await this.cleanUrlAfterRedirect(url);\n return {\n isLoggedIn: redirectInfo.isLoggedIn,\n webId: redirectInfo.webId,\n sessionId: redirectInfo.sessionId,\n expirationDate: redirectInfo.expirationDate,\n clientAppId: redirectInfo.clientAppId,\n };\n }\n catch (err) {\n // Strip the oauth params:\n await this.cleanUrlAfterRedirect(url);\n // FIXME: EVENTS.ERROR should be errorCode, errorDescription\n //\n // I'm not sure if \"redirect\" is a good error code, and in theory `err`\n // maybe an Error object and not a string; Maybe we want to just hardcode\n // a description instead?\n eventEmitter.emit(EVENTS.ERROR, \"redirect\", err);\n return undefined;\n }\n };\n async cleanUrlAfterRedirect(url) {\n const cleanedUpUrl = removeOpenIdParams(url).href;\n // Remove OAuth-specific query params (since the login flow finishes with\n // the browser being redirected back with OAuth2 query params (e.g. for\n // 'code' and 'state'), and so if the user simply refreshes this page our\n // authentication library will be called again with what are now invalid\n // query parameters!).\n window.history.replaceState(null, \"\", cleanedUpUrl);\n while (window.location.href !== cleanedUpUrl) {\n // Poll the current URL every ms. Active polling is required because\n // window.history.replaceState is asynchronous, but the associated\n // 'popstate' event which should be listened to is only sent on active\n // navigation, which we will not have here.\n // See https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent\n // eslint-disable-next-line no-await-in-loop\n await new Promise((resolve) => {\n setTimeout(() => resolve(), 1);\n });\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction hasIssuer(options) {\n return typeof options.oidcIssuer === \"string\";\n}\nfunction hasRedirectUrl(options) {\n return typeof options.redirectUrl === \"string\";\n}\n/**\n * @hidden\n */\nclass OidcLoginHandler {\n storageUtility;\n oidcHandler;\n issuerConfigFetcher;\n clientRegistrar;\n constructor(storageUtility, oidcHandler, issuerConfigFetcher, clientRegistrar) {\n this.storageUtility = storageUtility;\n this.oidcHandler = oidcHandler;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n this.storageUtility = storageUtility;\n this.oidcHandler = oidcHandler;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n }\n async canHandle(options) {\n return hasIssuer(options) && hasRedirectUrl(options);\n }\n async handle(options) {\n if (!hasIssuer(options)) {\n throw new ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(options)}`);\n }\n if (!hasRedirectUrl(options)) {\n throw new ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(options)}`);\n }\n // Fetch issuer config.\n const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer);\n const clientRegistration = await handleRegistration(options, issuerConfig, this.storageUtility, this.clientRegistrar);\n // Construct OIDC Options\n const OidcOptions = {\n // Note that here, the issuer is not the one from the received options, but\n // from the issuer's config. This enforces the canonical URL is used and stored,\n // which is also the one present in the ID token, so storing a technically\n // valid, but different issuer URL (e.g. using a trailing slash or not) now\n // could prevent from validating the ID token later.\n issuer: issuerConfig.issuer,\n // TODO: differentiate if DPoP should be true\n dpop: options.tokenType.toLowerCase() === \"dpop\",\n ...options,\n issuerConfiguration: issuerConfig,\n client: clientRegistration,\n scopes: normalizeScopes(options.customScopes),\n };\n // Call proper OIDC Handler\n return this.oidcHandler.handle(OidcOptions);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth\n * PKCE: https://tools.ietf.org/html/rfc7636\n */\nclass AuthorizationCodeWithPkceOidcHandler extends AuthorizationCodeWithPkceOidcHandlerBase {\n async handle(oidcLoginOptions) {\n /* eslint-disable camelcase */\n const oidcOptions = {\n authority: oidcLoginOptions.issuer.toString(),\n client_id: oidcLoginOptions.client.clientId,\n client_secret: oidcLoginOptions.client.clientSecret,\n redirect_uri: oidcLoginOptions.redirectUrl,\n response_type: \"code\",\n scope: oidcLoginOptions.scopes.join(\" \"),\n filterProtocolClaims: true,\n // The userinfo endpoint on NSS fails, so disable this for now\n // Note that in Solid, information should be retrieved from the\n // profile referenced by the WebId.\n loadUserInfo: false,\n code_verifier: true,\n prompt: oidcLoginOptions.prompt ?? \"consent\",\n };\n /* eslint-enable camelcase */\n const oidcClientLibrary = new OidcClient(oidcOptions);\n try {\n const signingRequest = await oidcClientLibrary.createSigninRequest();\n // Make sure to await the promise before returning so that the error is caught.\n return await this.setupRedirectHandler({\n oidcLoginOptions,\n // eslint-disable-next-line no-underscore-dangle\n state: signingRequest.state._id,\n // eslint-disable-next-line no-underscore-dangle\n codeVerifier: signingRequest.state._code_verifier,\n targetUrl: signingRequest.url.toString(),\n });\n }\n catch (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n // The login is only completed AFTER redirect, so nothing to return here.\n return undefined;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst WELL_KNOWN_OPENID_CONFIG = \".well-known/openid-configuration\";\n/* eslint-disable camelcase */\nconst issuerConfigKeyMap = {\n issuer: {\n toKey: \"issuer\",\n convertToUrl: true,\n },\n authorization_endpoint: {\n toKey: \"authorizationEndpoint\",\n convertToUrl: true,\n },\n token_endpoint: {\n toKey: \"tokenEndpoint\",\n convertToUrl: true,\n },\n userinfo_endpoint: {\n toKey: \"userinfoEndpoint\",\n convertToUrl: true,\n },\n jwks_uri: {\n toKey: \"jwksUri\",\n convertToUrl: true,\n },\n registration_endpoint: {\n toKey: \"registrationEndpoint\",\n convertToUrl: true,\n },\n end_session_endpoint: {\n toKey: \"endSessionEndpoint\",\n convertToUrl: true,\n },\n scopes_supported: { toKey: \"scopesSupported\" },\n response_types_supported: { toKey: \"responseTypesSupported\" },\n response_modes_supported: { toKey: \"responseModesSupported\" },\n grant_types_supported: { toKey: \"grantTypesSupported\" },\n acr_values_supported: { toKey: \"acrValuesSupported\" },\n subject_types_supported: { toKey: \"subjectTypesSupported\" },\n id_token_signing_alg_values_supported: {\n toKey: \"idTokenSigningAlgValuesSupported\",\n },\n id_token_encryption_alg_values_supported: {\n toKey: \"idTokenEncryptionAlgValuesSupported\",\n },\n id_token_encryption_enc_values_supported: {\n toKey: \"idTokenEncryptionEncValuesSupported\",\n },\n userinfo_signing_alg_values_supported: {\n toKey: \"userinfoSigningAlgValuesSupported\",\n },\n userinfo_encryption_alg_values_supported: {\n toKey: \"userinfoEncryptionAlgValuesSupported\",\n },\n userinfo_encryption_enc_values_supported: {\n toKey: \"userinfoEncryptionEncValuesSupported\",\n },\n request_object_signing_alg_values_supported: {\n toKey: \"requestObjectSigningAlgValuesSupported\",\n },\n request_object_encryption_alg_values_supported: {\n toKey: \"requestObjectEncryptionAlgValuesSupported\",\n },\n request_object_encryption_enc_values_supported: {\n toKey: \"requestObjectEncryptionEncValuesSupported\",\n },\n token_endpoint_auth_methods_supported: {\n toKey: \"tokenEndpointAuthMethodsSupported\",\n },\n token_endpoint_auth_signing_alg_values_supported: {\n toKey: \"tokenEndpointAuthSigningAlgValuesSupported\",\n },\n display_values_supported: { toKey: \"displayValuesSupported\" },\n claim_types_supported: { toKey: \"claimTypesSupported\" },\n claims_supported: { toKey: \"claimsSupported\" },\n service_documentation: { toKey: \"serviceDocumentation\" },\n claims_locales_supported: { toKey: \"claimsLocalesSupported\" },\n ui_locales_supported: { toKey: \"uiLocalesSupported\" },\n claims_parameter_supported: { toKey: \"claimsParameterSupported\" },\n request_parameter_supported: { toKey: \"requestParameterSupported\" },\n request_uri_parameter_supported: { toKey: \"requestUriParameterSupported\" },\n require_request_uri_registration: { toKey: \"requireRequestUriRegistration\" },\n op_policy_uri: {\n toKey: \"opPolicyUri\",\n convertToUrl: true,\n },\n op_tos_uri: {\n toKey: \"opTosUri\",\n convertToUrl: true,\n },\n};\n/* eslint-enable camelcase */\nfunction processConfig(config) {\n const parsedConfig = {};\n Object.keys(config).forEach((key) => {\n if (issuerConfigKeyMap[key]) {\n // TODO: PMcB55: Validate URL if \"issuerConfigKeyMap[key].convertToUrl\"\n // if (issuerConfigKeyMap[key].convertToUrl) {\n // validateUrl(config[key]);\n // }\n parsedConfig[issuerConfigKeyMap[key].toKey] = config[key];\n }\n });\n if (!Array.isArray(parsedConfig.scopesSupported)) {\n parsedConfig.scopesSupported = [\"openid\"];\n }\n return parsedConfig;\n}\n/**\n * @hidden\n */\nclass IssuerConfigFetcher {\n storageUtility;\n constructor(storageUtility) {\n this.storageUtility = storageUtility;\n this.storageUtility = storageUtility;\n }\n // This method needs no state (so can be static), and can be exposed to allow\n // callers to know where this implementation puts state it needs.\n static getLocalStorageKey(issuer) {\n return `issuerConfig:${issuer}`;\n }\n async fetchConfig(issuer) {\n let issuerConfig;\n const openIdConfigUrl = new URL(WELL_KNOWN_OPENID_CONFIG, \n // Make sure to append a slash at issuer URL, so that the .well-known URL\n // includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.\n issuer.endsWith(\"/\") ? issuer : `${issuer}/`).href;\n const issuerConfigRequestBody = await fetch(openIdConfigUrl);\n // Check the validity of the fetched config\n try {\n issuerConfig = processConfig(await issuerConfigRequestBody.json());\n }\n catch (err) {\n throw new ConfigurationError(`[${issuer.toString()}] has an invalid configuration: ${err.message}`);\n }\n // Update store with fetched config\n await this.storageUtility.set(IssuerConfigFetcher.getLocalStorageKey(issuer), JSON.stringify(issuerConfig));\n return issuerConfig;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @param sessionId\n * @param storage\n * @hidden\n */\nasync function clear(sessionId, storage) {\n await clear$1(sessionId, storage);\n await clearOidcPersistentStorage();\n}\n/**\n * @hidden\n */\nclass SessionInfoManager extends SessionInfoManagerBase {\n async get(sessionId) {\n const [isLoggedIn, webId, clientId, clientSecret, redirectUrl, refreshToken, issuer, tokenType,] = await Promise.all([\n this.storageUtility.getForUser(sessionId, \"isLoggedIn\", {\n secure: true,\n }),\n this.storageUtility.getForUser(sessionId, \"webId\", {\n secure: true,\n }),\n this.storageUtility.getForUser(sessionId, \"clientId\", {\n secure: false,\n }),\n this.storageUtility.getForUser(sessionId, \"clientSecret\", {\n secure: false,\n }),\n this.storageUtility.getForUser(sessionId, \"redirectUrl\", {\n secure: false,\n }),\n this.storageUtility.getForUser(sessionId, \"refreshToken\", {\n secure: true,\n }),\n this.storageUtility.getForUser(sessionId, \"issuer\", {\n secure: false,\n }),\n this.storageUtility.getForUser(sessionId, \"tokenType\", {\n secure: false,\n }),\n ]);\n if (typeof redirectUrl === \"string\" && !isValidRedirectUrl(redirectUrl)) {\n // This resolves the issue for people experiencing https://github.com/inrupt/solid-client-authn-js/issues/2891.\n // An invalid redirect URL is present in the storage, and the session should\n // be cleared to get a fresh start. This will require the user to log back in.\n await Promise.all([\n this.storageUtility.deleteAllUserData(sessionId, { secure: false }),\n this.storageUtility.deleteAllUserData(sessionId, { secure: true }),\n ]);\n return undefined;\n }\n if (tokenType !== undefined && !isSupportedTokenType(tokenType)) {\n throw new Error(`Tokens of type [${tokenType}] are not supported.`);\n }\n if (clientId === undefined &&\n isLoggedIn === undefined &&\n webId === undefined &&\n refreshToken === undefined) {\n return undefined;\n }\n return {\n sessionId,\n webId,\n isLoggedIn: isLoggedIn === \"true\",\n redirectUrl,\n refreshToken,\n issuer,\n clientAppId: clientId,\n clientAppSecret: clientSecret,\n // Default the token type to DPoP if unspecified.\n tokenType: tokenType ?? \"DPoP\",\n };\n }\n /**\n * This function removes all session-related information from storage.\n * @param sessionId the session identifier\n * @param storage the storage where session info is stored\n * @hidden\n */\n async clear(sessionId) {\n return clear(sessionId, this.storageUtility);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * This class handles redirect IRIs without any query params, and returns an unauthenticated\n * session. It serves as a fallback so that consuming libraries don't have to test\n * for the query params themselves, and can always try to use them as a redirect IRI.\n * @hidden\n */\nclass FallbackRedirectHandler {\n async canHandle(redirectUrl) {\n try {\n // The next URL object is built for validating it.\n // eslint-disable-next-line no-new\n new URL(redirectUrl);\n return true;\n }\n catch (e) {\n throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);\n }\n }\n async handle(\n // The argument is ignored, but must be present to implement the interface\n _redirectUrl) {\n return getUnauthenticatedSession();\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass AuthCodeRedirectHandler {\n storageUtility;\n sessionInfoManager;\n issuerConfigFetcher;\n clientRegistrar;\n tokerRefresher;\n constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) {\n this.storageUtility = storageUtility;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n this.tokerRefresher = tokerRefresher;\n this.storageUtility = storageUtility;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n this.tokerRefresher = tokerRefresher;\n }\n async canHandle(redirectUrl) {\n try {\n const myUrl = new URL(redirectUrl);\n return (myUrl.searchParams.get(\"code\") !== null &&\n myUrl.searchParams.get(\"state\") !== null);\n }\n catch (e) {\n throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);\n }\n }\n async handle(redirectUrl, eventEmitter) {\n if (!(await this.canHandle(redirectUrl))) {\n throw new Error(`AuthCodeRedirectHandler cannot handle [${redirectUrl}]: it is missing one of [code, state].`);\n }\n const url = new URL(redirectUrl);\n const oauthState = url.searchParams.get(\"state\");\n const storedSessionId = (await this.storageUtility.getForUser(oauthState, \"sessionId\", {\n errorIfNull: true,\n }));\n const { issuerConfig, codeVerifier, redirectUrl: storedRedirectIri, dpop: isDpop, } = await loadOidcContextFromStorage(storedSessionId, this.storageUtility, this.issuerConfigFetcher);\n const iss = url.searchParams.get(\"iss\");\n if (typeof iss === \"string\" && iss !== issuerConfig.issuer) {\n throw new Error(`The value of the iss parameter (${iss}) does not match the issuer identifier of the authorization server (${issuerConfig.issuer}). See [rfc9207](https://www.rfc-editor.org/rfc/rfc9207.html#section-2.3-3.1.1)`);\n }\n if (codeVerifier === undefined) {\n throw new Error(`The code verifier for session ${storedSessionId} is missing from storage.`);\n }\n if (storedRedirectIri === undefined) {\n throw new Error(`The redirect URL for session ${storedSessionId} is missing from storage.`);\n }\n const client = await this.clientRegistrar.getClient({ sessionId: storedSessionId }, issuerConfig);\n const tokenCreatedAt = Date.now();\n const tokens = await getTokens(issuerConfig, client, {\n grantType: \"authorization_code\",\n // We rely on our 'canHandle' function checking that the OAuth 'code'\n // parameter is present in our query string.\n code: url.searchParams.get(\"code\"),\n codeVerifier,\n redirectUrl: storedRedirectIri,\n }, isDpop);\n // Delete oidc-client-specific session information from storage. oidc-client\n // is no longer used for the token exchange, so it doesn't perform this automatically.\n window.localStorage.removeItem(`oidc.${oauthState}`);\n let refreshOptions;\n if (tokens.refreshToken !== undefined) {\n refreshOptions = {\n sessionId: storedSessionId,\n refreshToken: tokens.refreshToken,\n tokenRefresher: this.tokerRefresher,\n };\n }\n const authFetch = buildAuthenticatedFetch(tokens.accessToken, {\n dpopKey: tokens.dpopKey,\n refreshOptions,\n eventEmitter,\n expiresIn: tokens.expiresIn,\n });\n await saveSessionInfoToStorage(this.storageUtility, storedSessionId, tokens.webId, tokens.clientId, \"true\", undefined, true);\n const sessionInfo = await this.sessionInfoManager.get(storedSessionId);\n if (!sessionInfo) {\n throw new Error(`Could not retrieve session: [${storedSessionId}].`);\n }\n return Object.assign(sessionInfo, {\n fetch: authFetch,\n getLogoutUrl: maybeBuildRpInitiatedLogout({\n idTokenHint: tokens.idToken,\n endSessionEndpoint: issuerConfig.endSessionEndpoint,\n }),\n expirationDate: typeof tokens.expiresIn === \"number\"\n ? tokenCreatedAt + tokens.expiresIn * 1000\n : undefined,\n });\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass AggregateRedirectHandler extends AggregateHandler {\n constructor(redirectHandlers) {\n super(redirectHandlers);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass BrowserStorage {\n get storage() {\n return window.localStorage;\n }\n async get(key) {\n return this.storage.getItem(key) || undefined;\n }\n async set(key, value) {\n this.storage.setItem(key, value);\n }\n async delete(key) {\n this.storage.removeItem(key);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass Redirector {\n redirect(redirectUrl, options) {\n if (options && options.handleRedirect) {\n options.handleRedirect(redirectUrl);\n }\n else if (options && options.redirectByReplacingState) {\n window.history.replaceState({}, \"\", redirectUrl);\n }\n else {\n window.location.href = redirectUrl;\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass ClientRegistrar {\n storageUtility;\n constructor(storageUtility) {\n this.storageUtility = storageUtility;\n this.storageUtility = storageUtility;\n }\n async getClient(options, issuerConfig) {\n // If client secret and/or client id are stored in storage, use those.\n const [storedClientId, storedClientSecret, expiresAt, storedClientName, storedClientType,] = await Promise.all([\n this.storageUtility.getForUser(options.sessionId, \"clientId\", {\n secure: false,\n }),\n this.storageUtility.getForUser(options.sessionId, \"clientSecret\", {\n secure: false,\n }),\n this.storageUtility.getForUser(options.sessionId, \"expiresAt\", {\n secure: false,\n }),\n this.storageUtility.getForUser(options.sessionId, \"clientName\", {\n secure: false,\n }),\n this.storageUtility.getForUser(options.sessionId, \"clientType\", {\n secure: false,\n }),\n ]);\n // -1 is used as a default to identify legacy cases when a value should\n // have been stored, but wasn't. It will be treated as an expired client.\n const expirationDate = expiresAt !== undefined ? Number.parseInt(expiresAt, 10) : -1;\n // Expiration is only applicable to confidential clients.\n // If the client registration never expires, then the expirationDate is 0.\n // Note that Date.now() is in milliseconds, and expirationDate in seconds.\n const expired = storedClientSecret !== undefined &&\n expirationDate !== 0 &&\n Math.floor(Date.now() / 1000) > expirationDate;\n if (storedClientId && isKnownClientType(storedClientType) && !expired) {\n return storedClientSecret !== undefined\n ? {\n clientId: storedClientId,\n clientSecret: storedClientSecret,\n clientName: storedClientName,\n // Note: static clients are not applicable in a browser context.\n clientType: \"dynamic\",\n expiresAt: expirationDate,\n }\n : {\n clientId: storedClientId,\n clientName: storedClientName,\n // Note: static clients are not applicable in a browser context.\n clientType: storedClientType,\n // The type assertion is required even though the type should match the declaration.\n };\n }\n try {\n const registeredClient = await registerClient(options, issuerConfig);\n // Save info\n const infoToSave = {\n clientId: registeredClient.clientId,\n clientType: \"dynamic\",\n };\n if (registeredClient.clientSecret !== undefined) {\n infoToSave.clientSecret = registeredClient.clientSecret;\n infoToSave.expiresAt = String(registeredClient.expiresAt);\n }\n if (registeredClient.idTokenSignedResponseAlg) {\n infoToSave.idTokenSignedResponseAlg =\n registeredClient.idTokenSignedResponseAlg;\n }\n await this.storageUtility.setForUser(options.sessionId, infoToSave, {\n // FIXME: figure out how to persist secure storage at reload\n // Otherwise, the client info cannot be retrieved from storage, and\n // the lib tries to re-register the client on each fetch\n secure: false,\n });\n return registeredClient;\n }\n catch (error) {\n throw new Error(`Client registration failed.`, { cause: error });\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * This class handles redirect IRIs without any query params, and returns an unauthenticated\n * session. It serves as a fallback so that consuming libraries don't have to test\n * for the query params themselves, and can always try to use them as a redirect IRI.\n * @hidden\n */\nclass ErrorOidcHandler {\n async canHandle(redirectUrl) {\n try {\n // eslint-disable-next-line no-new\n return new URL(redirectUrl).searchParams.has(\"error\");\n }\n catch (e) {\n throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);\n }\n }\n async handle(redirectUrl, eventEmitter) {\n if (eventEmitter !== undefined) {\n const url = new URL(redirectUrl);\n const errorUrl = url.searchParams.get(\"error\");\n const errorDescriptionUrl = url.searchParams.get(\"error_description\");\n eventEmitter.emit(EVENTS.ERROR, errorUrl, errorDescriptionUrl);\n }\n return getUnauthenticatedSession();\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// Some identifiers are not in camelcase on purpose, as they are named using the\n// official names from the OIDC/OAuth2 specifications.\n/* eslint-disable camelcase */\n/**\n * @hidden\n */\nclass TokenRefresher {\n storageUtility;\n issuerConfigFetcher;\n clientRegistrar;\n constructor(storageUtility, issuerConfigFetcher, clientRegistrar) {\n this.storageUtility = storageUtility;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n this.storageUtility = storageUtility;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n }\n async refresh(sessionId, refreshToken, dpopKey, eventEmitter) {\n const oidcContext = await loadOidcContextFromStorage(sessionId, this.storageUtility, this.issuerConfigFetcher);\n // This should also retrieve the client from storage\n const clientInfo = await this.clientRegistrar.getClient({ sessionId }, oidcContext.issuerConfig);\n if (refreshToken === undefined) {\n // TODO: in a next PR, look up storage for a refresh token\n throw new Error(`Session [${sessionId}] has no refresh token to allow it to refresh its access token.`);\n }\n if (oidcContext.dpop && dpopKey === undefined) {\n throw new Error(`For session [${sessionId}], the key bound to the DPoP access token must be provided to refresh said access token.`);\n }\n const tokenSet = await refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);\n if (tokenSet.refreshToken !== undefined) {\n eventEmitter?.emit(EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);\n }\n return tokenSet;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @param dependencies\n * @hidden\n */\nfunction getClientAuthenticationWithDependencies(dependencies) {\n const inMemoryStorage = new InMemoryStorage();\n const secureStorage = dependencies.secureStorage || inMemoryStorage;\n const insecureStorage = dependencies.insecureStorage || new BrowserStorage();\n const storageUtility = new StorageUtilityBrowser(secureStorage, insecureStorage);\n const issuerConfigFetcher = new IssuerConfigFetcher(storageUtility);\n const clientRegistrar = new ClientRegistrar(storageUtility);\n const sessionInfoManager = new SessionInfoManager(storageUtility);\n const tokenRefresher = new TokenRefresher(storageUtility, issuerConfigFetcher, clientRegistrar);\n const redirector = new Redirector();\n // make new handler for redirect and login\n const loginHandler = new OidcLoginHandler(storageUtility, new AuthorizationCodeWithPkceOidcHandler(storageUtility, redirector), issuerConfigFetcher, clientRegistrar);\n const redirectHandler = new AggregateRedirectHandler([\n new ErrorOidcHandler(),\n new AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),\n // This catch-all class will always be able to handle the\n // redirect IRI, so it must be registered last.\n new FallbackRedirectHandler(),\n ]);\n return new ClientAuthentication(loginHandler, redirectHandler, new IWaterfallLogoutHandler(sessionInfoManager, redirector), sessionInfoManager, issuerConfigFetcher);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst KEY_CURRENT_SESSION = `${SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`;\nconst KEY_CURRENT_URL = `${SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`;\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nasync function silentlyAuthenticate(sessionId, clientAuthn, session) {\n const storedSessionInfo = await clientAuthn.validateCurrentSession(sessionId);\n if (storedSessionInfo !== null) {\n // It can be really useful to save the user's current browser location,\n // so that we can restore it after completing the silent authentication\n // on incoming redirect. This way, the user is eventually redirected back\n // to the page they were on and not to the app's redirect page.\n window.localStorage.setItem(KEY_CURRENT_URL, window.location.href);\n await clientAuthn.login({\n sessionId,\n prompt: \"none\",\n oidcIssuer: storedSessionInfo.issuer,\n redirectUrl: storedSessionInfo.redirectUrl,\n clientId: storedSessionInfo.clientAppId,\n clientSecret: storedSessionInfo.clientAppSecret,\n tokenType: storedSessionInfo.tokenType ?? \"DPoP\",\n }, session.events);\n return true;\n }\n return false;\n}\nfunction isLoggedIn(sessionInfo) {\n return !!sessionInfo?.isLoggedIn;\n}\n/**\n * A {@link Session} object represents a user's session on an application. The session holds state, as it stores information enabling access to private resources after login for instance.\n */\nclass Session {\n /**\n * Information regarding the current session.\n */\n info;\n /**\n * Session attribute exposing the EventEmitter interface, to listen on session\n * events such as login, logout, etc.\n * @since 1.15.0\n */\n events;\n clientAuthentication;\n tokenRequestInProgress = false;\n /**\n * Session object constructor. Typically called as follows:\n *\n * ```typescript\n * const session = new Session();\n * ```\n *\n * See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession).\n *\n * @param sessionOptions The options enabling the correct instantiation of\n * the session. Either both storages or clientAuthentication are required. For\n * more information, see {@link ISessionOptions}.\n * @param sessionId A string uniquely identifying the session.\n *\n */\n constructor(sessionOptions = {}, sessionId = undefined) {\n this.events = new EventEmitter();\n if (sessionOptions.clientAuthentication) {\n this.clientAuthentication = sessionOptions.clientAuthentication;\n }\n else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {\n this.clientAuthentication = getClientAuthenticationWithDependencies({\n secureStorage: sessionOptions.secureStorage,\n insecureStorage: sessionOptions.insecureStorage,\n });\n }\n else {\n this.clientAuthentication = getClientAuthenticationWithDependencies({});\n }\n if (sessionOptions.sessionInfo) {\n this.info = {\n sessionId: sessionOptions.sessionInfo.sessionId,\n isLoggedIn: false,\n webId: sessionOptions.sessionInfo.webId,\n clientAppId: sessionOptions.sessionInfo.clientAppId,\n };\n }\n else {\n this.info = {\n sessionId: sessionId ?? v4(),\n isLoggedIn: false,\n };\n }\n // When a session is logged in, we want to track its ID in local storage to\n // enable silent refresh. The current session ID specifically stored in 'localStorage'\n // (as opposed to using our storage abstraction layer) because it is only\n // used in a browser-specific mechanism.\n this.events.on(EVENTS.LOGIN, () => window.localStorage.setItem(KEY_CURRENT_SESSION, this.info.sessionId));\n this.events.on(EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));\n this.events.on(EVENTS.ERROR, () => this.internalLogout(false));\n }\n /**\n * Triggers the login process. Note that this method will redirect the user away from your app.\n *\n * @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.\n * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by {@linkcode handleIncomingRedirect}.\n */\n // Define these functions as properties so that they don't get accidentally re-bound.\n // Isn't Javascript fun?\n login = async (options) => {\n await this.clientAuthentication.login({\n sessionId: this.info.sessionId,\n ...options,\n // Defaults the token type to DPoP\n tokenType: options.tokenType ?? \"DPoP\",\n }, this.events);\n // `login` redirects the user away from the app,\n // so unless it throws an error, there is no code that should run afterwards\n // (since there is no \"after\" in the lifetime of the script).\n // Hence, this Promise never resolves:\n return new Promise(() => { });\n };\n /**\n * Fetches data using available login information. If the user is not logged in, this will behave as a regular `fetch`. The signature of this method is identical to the [canonical `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n *\n * @param url The URL from which data should be fetched.\n * @param init Optional parameters customizing the request, by specifying an HTTP method, headers, a body, etc. Follows the [WHATWG Fetch Standard](https://fetch.spec.whatwg.org/).\n */\n fetch = (url, init) => this.clientAuthentication.fetch(url, init);\n /**\n * An internal logout function, to control whether or not the logout signal\n * should be sent, i.e. if the logout was user-initiated or is the result of\n * an external event.\n *\n * @hidden\n */\n internalLogout = async (emitSignal, options) => {\n // Clearing this value means that silent refresh will no longer be attempted.\n // In particular, in the case of a silent authentication error it prevents\n // from getting stuck in an authentication retries loop.\n window.localStorage.removeItem(KEY_CURRENT_SESSION);\n await this.clientAuthentication.logout(this.info.sessionId, options);\n this.info.isLoggedIn = false;\n if (emitSignal) {\n this.events.emit(EVENTS.LOGOUT);\n }\n };\n /**\n * Logs the user out of the application.\n *\n * There are 2 types of logout supported by this library,\n * `app` logout and `idp` logout.\n *\n * App logout will log the user out within the application\n * by clearing any session data from the browser. It does\n * not log the user out of their Solid identity provider,\n * and should not redirect the user away.\n * App logout can be performed as follows:\n * ```typescript\n * await session.logout({ logoutType: 'app' });\n * ```\n *\n * IDP logout will log the user out of their Solid identity provider,\n * and will redirect the user away from the application to do so. In order\n * for users to be redirected back to `postLogoutUrl` you MUST include the\n * `postLogoutUrl` value in the `post_logout_redirect_uris` field in the\n * [Client ID Document](https://docs.inrupt.com/ess/latest/security/authentication/#client-identifier-client-id).\n * IDP logout can be performed as follows:\n * ```typescript\n * await session.logout({\n * logoutType: 'idp',\n * // An optional URL to redirect to after logout has completed;\n * // this MUST match a logout URL listed in the Client ID Document\n * // of the application that is logged in.\n * // If the application is logged in with a Client ID that is not\n * // a URI dereferencing to a Client ID Document then users will\n * // not be redirected back to the `postLogoutUrl` after logout.\n * postLogoutUrl: 'https://example.com/logout',\n * // An optional value to be included in the query parameters\n * // when the IDP provider redirects the user to the postLogoutRedirectUrl.\n * state: \"my-state\"\n * });\n * ```\n */\n logout = async (options) => this.internalLogout(true, options);\n /**\n * Completes the login process by processing the information provided by the\n * Solid identity provider through redirect.\n *\n * @param options See {@link IHandleIncomingRedirectOptions}.\n */\n handleIncomingRedirect = async (inputOptions = {}) => {\n if (this.info.isLoggedIn) {\n return this.info;\n }\n if (this.tokenRequestInProgress) {\n return undefined;\n }\n const options = typeof inputOptions === \"string\" ? { url: inputOptions } : inputOptions;\n const url = options.url ?? window.location.href;\n this.tokenRequestInProgress = true;\n const sessionInfo = await this.clientAuthentication.handleIncomingRedirect(url, this.events);\n if (isLoggedIn(sessionInfo)) {\n this.setSessionInfo(sessionInfo);\n const currentUrl = window.localStorage.getItem(KEY_CURRENT_URL);\n if (currentUrl === null) {\n // The login event can only be triggered **after** the user has been\n // redirected from the IdP with access and ID tokens.\n this.events.emit(EVENTS.LOGIN);\n }\n else {\n // If an URL is stored in local storage, we are being logged in after a\n // silent authentication, so remove our currently stored URL location\n // to clean up our state now that we are completing the re-login process.\n window.localStorage.removeItem(KEY_CURRENT_URL);\n this.events.emit(EVENTS.SESSION_RESTORED, currentUrl);\n }\n }\n else if (options.restorePreviousSession === true) {\n // Silent authentication happens after a refresh, which means there are no\n // OAuth params in the current location IRI. It can only succeed if a session\n // was previously logged in, in which case its ID will be present with a known\n // identifier in local storage.\n // Check if we have a locally stored session ID...\n const storedSessionId = window.localStorage.getItem(KEY_CURRENT_SESSION);\n // ...if not, then there is no ID token, and so silent authentication cannot happen, but\n // if we do have a stored session ID, attempt to re-authenticate now silently.\n if (storedSessionId !== null) {\n const attemptedSilentAuthentication = await silentlyAuthenticate(storedSessionId, this.clientAuthentication, this);\n // At this point, we know that the main window will imminently be redirected.\n // However, this redirect is asynchronous and there is no way to halt execution\n // until it happens precisely. That's why the current Promise simply does not\n // resolve.\n if (attemptedSilentAuthentication) {\n return new Promise(() => { });\n }\n }\n }\n this.tokenRequestInProgress = false;\n return sessionInfo;\n };\n setSessionInfo(sessionInfo) {\n this.info.isLoggedIn = sessionInfo.isLoggedIn;\n this.info.webId = sessionInfo.webId;\n this.info.sessionId = sessionInfo.sessionId;\n this.info.clientAppId = sessionInfo.clientAppId;\n this.info.expirationDate = sessionInfo.expirationDate;\n this.events.on(EVENTS.SESSION_EXTENDED, (expiresIn) => {\n this.info.expirationDate = Date.now() + expiresIn * 1000;\n });\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nlet defaultSession;\n/**\n * Obtain the {@link Session} used when not explicitly instantiating one yourself.\n *\n * When using the top-level exports {@link fetch}, {@link login}, {@link logout},\n * {@link handleIncomingRedirect}, {@link onLogin} and {@link onLogout}, these apply to an\n * implicitly-instantiated {@link Session}.\n * This function returns a reference to that Session in order to obtain e.g. the current user's\n * WebID.\n * @since 1.3.0\n */\nfunction getDefaultSession() {\n if (typeof defaultSession === \"undefined\") {\n defaultSession = new Session();\n }\n return defaultSession;\n}\n/**\n * This function's signature is equal to `window.fetch`, but if the current user is authenticated\n * (see [[login]] and [[handleIncomingRedirect]]), requests made using it will include that user's\n * credentials. If not, this will behave just like the regular `window.fetch`.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch}\n * @since 1.3.0\n */\n/* eslint-disable-next-line no-shadow */\nconst fetch$1 = (...args) => {\n const session = getDefaultSession();\n return session.fetch(...args);\n};\n/**\n * Triggers the login process. Note that this method will redirect the user away from your app.\n *\n * @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.\n * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by [[handleIncomingRedirect]].\n * @since 1.3.0\n */\nconst login = (...args) => {\n const session = getDefaultSession();\n return session.login(...args);\n};\n/**\n * Logs the user out of the application.\n *\n * By default this does not log the user out of their Solid identity provider.\n * In order to do so, you must set the logoutType to `idp`. For usage details\n * see {@link Session.logout}.\n *\n * @since 1.3.0\n */\nconst logout = (...args) => {\n const session = getDefaultSession();\n return session.logout(...args);\n};\n/**\n * Completes the login process by processing the information provided by the Solid identity provider through redirect.\n *\n * @param url The URL of the page handling the redirect, including the query parameters — these contain the information to process the login.\n * @since 1.3.0\n */\nconst handleIncomingRedirect = (...args) => {\n const session = getDefaultSession();\n return session.handleIncomingRedirect(...args);\n};\n/**\n * {@link SessionEventEmitter} instance to subscribe to events by the default session.\n *\n * @since 1.14.0\n */\nconst events = () => {\n return getDefaultSession().events;\n};\n\nexport { Session, events, fetch$1 as fetch, getDefaultSession, handleIncomingRedirect, login, logout };\n//# sourceMappingURL=index.mjs.map\n","import {\n Session,\n} from '@inrupt/solid-client-authn-browser'\n\nexport const authSession = new Session()\n\n ","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport ClassOrder from './class-order';\nimport Node from './node-internal';\nimport { BlankNodeTermType } from './types';\n/**\n * An RDF blank node is a Node without a URI\n * @link https://rdf.js.org/data-model-spec/#blanknode-interface\n */\nexport default class BlankNode extends Node {\n static getId(id) {\n if (id) {\n if (typeof id !== 'string') {\n throw new Error('Bad id argument to new blank node: ' + id);\n }\n if (id.includes('#')) {\n // Is a URI with hash fragment\n let fragments = id.split('#');\n return fragments[fragments.length - 1];\n }\n return id;\n }\n return 'n' + BlankNode.nextId++;\n }\n /**\n * Initializes this node\n * @param [id] The identifier for the blank node\n */\n constructor(id) {\n super(BlankNode.getId(id));\n _defineProperty(this, \"termType\", BlankNodeTermType);\n _defineProperty(this, \"classOrder\", ClassOrder.BlankNode);\n /** Whether this is a blank node */\n _defineProperty(this, \"isBlank\", 1);\n /**\n * This type of node is a variable.\n *\n * Note that the existence of this property already indicates that it is a variable.\n */\n _defineProperty(this, \"isVar\", 1);\n }\n\n /**\n * The identifier for the blank node\n */\n get id() {\n return this.value;\n }\n set id(value) {\n this.value = value;\n }\n compareTerm(other) {\n if (this.classOrder < other.classOrder) {\n return -1;\n }\n if (this.classOrder > other.classOrder) {\n return +1;\n }\n if (this.id < other.id) {\n return -1;\n }\n if (this.id > other.id) {\n return +1;\n }\n return 0;\n }\n\n /**\n * Gets a copy of this blank node in the specified formula\n * @param formula The formula\n */\n copy(formula) {\n // depends on the formula\n var bnodeNew = new BlankNode();\n formula.copyTo(this, bnodeNew);\n return bnodeNew;\n }\n toCanonical() {\n return BlankNode.NTAnonymousNodePrefix + this.value;\n }\n toString() {\n return BlankNode.NTAnonymousNodePrefix + this.id;\n }\n}\n/**\n * The next unique identifier for blank nodes\n */\n_defineProperty(BlankNode, \"nextId\", 0);\n_defineProperty(BlankNode, \"NTAnonymousNodePrefix\", '_:');","import NamedNode from './named-node';\nexport default {\n boolean: new NamedNode('http://www.w3.org/2001/XMLSchema#boolean'),\n dateTime: new NamedNode('http://www.w3.org/2001/XMLSchema#dateTime'),\n decimal: new NamedNode('http://www.w3.org/2001/XMLSchema#decimal'),\n double: new NamedNode('http://www.w3.org/2001/XMLSchema#double'),\n integer: new NamedNode('http://www.w3.org/2001/XMLSchema#integer'),\n langString: new NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'),\n string: new NamedNode('http://www.w3.org/2001/XMLSchema#string')\n};","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport ClassOrder from './class-order';\nimport RDFlibNamedNode from './named-node';\nimport Node from './node-internal';\nimport { LiteralTermType } from './types';\nimport { isLiteral } from './utils/terms';\nimport XSD from './xsd-internal';\n/**\n * An RDF literal, containing some value which isn't expressed as an IRI.\n * @link https://rdf.js.org/data-model-spec/#literal-interface\n */\nexport default class Literal extends Node {\n /**\n * Initializes a literal\n * @param value - The literal's lexical value\n * @param language - The language for the literal. Defaults to ''.\n * @param datatype - The literal's datatype as a named node. Defaults to xsd:string.\n */\n constructor(value, language, datatype) {\n super(value);\n _defineProperty(this, \"termType\", LiteralTermType);\n _defineProperty(this, \"classOrder\", ClassOrder.Literal);\n /**\n * The literal's datatype as a named node\n */\n _defineProperty(this, \"datatype\", XSD.string);\n _defineProperty(this, \"isVar\", 0);\n /**\n * The language for the literal\n */\n _defineProperty(this, \"language\", '');\n if (language) {\n this.language = language;\n this.datatype = XSD.langString;\n } else if (datatype) {\n this.datatype = RDFlibNamedNode.fromValue(datatype);\n } else {\n this.datatype = XSD.string;\n }\n }\n\n /**\n * Gets a copy of this literal\n */\n copy() {\n return new Literal(this.value, this.lang, this.datatype);\n }\n\n /**\n * Gets whether two literals are the same\n * @param other The other statement\n */\n equals(other) {\n if (!other) {\n return false;\n }\n return this.termType === other.termType && this.value === other.value && this.language === other.language && (!this.datatype && !other.datatype || this.datatype && this.datatype.equals(other.datatype));\n }\n\n /**\n * The language for the literal\n * @deprecated use {language} instead\n */\n get lang() {\n return this.language;\n }\n set lang(language) {\n this.language = language || '';\n }\n toNT() {\n return Literal.toNT(this);\n }\n\n /** Serializes a literal to an N-Triples string */\n static toNT(literal) {\n if (typeof literal.value === 'number') {\n return '' + literal.value;\n } else if (typeof literal.value !== 'string') {\n throw new Error('Value of RDF literal is not string or number: ' + literal.value);\n }\n var str = literal.value;\n // #x22 (\"), #x5C (\\), #x0A (\\n) and #xD (\\r) are disallowed and need to be replaced\n // see https://www.w3.org/TR/n-triples/#grammar-production-STRING_LITERAL_QUOTE\n str = str.replace(/\\\\/g, '\\\\\\\\');\n str = str.replace(/\\\"/g, '\\\\\"');\n str = str.replace(/\\n/g, '\\\\n');\n str = str.replace(/\\r/g, '\\\\r');\n str = '\"' + str + '\"';\n if (literal.language) {\n str += '@' + literal.language;\n } else if (!literal.datatype.equals(XSD.string)) {\n // Only add datatype if it's not a string\n str += '^^' + literal.datatype.toCanonical();\n }\n return str;\n }\n toString() {\n return '' + this.value;\n }\n\n /**\n * Builds a literal node from a boolean value\n * @param value - The value\n */\n static fromBoolean(value) {\n let strValue = value ? '1' : '0';\n return new Literal(strValue, null, XSD.boolean);\n }\n\n /**\n * Builds a literal node from a date value\n * @param value The value\n */\n static fromDate(value) {\n if (!(value instanceof Date)) {\n throw new TypeError('Invalid argument to Literal.fromDate()');\n }\n let d2 = function (x) {\n return ('' + (100 + x)).slice(1, 3);\n };\n let date = '' + value.getUTCFullYear() + '-' + d2(value.getUTCMonth() + 1) + '-' + d2(value.getUTCDate()) + 'T' + d2(value.getUTCHours()) + ':' + d2(value.getUTCMinutes()) + ':' + d2(value.getUTCSeconds()) + 'Z';\n return new Literal(date, null, XSD.dateTime);\n }\n\n /**\n * Builds a literal node from a number value\n * @param value - The value\n */\n static fromNumber(value) {\n if (typeof value !== 'number') {\n throw new TypeError('Invalid argument to Literal.fromNumber()');\n }\n let datatype;\n const strValue = value.toString();\n if (strValue.indexOf('e') < 0 && Math.abs(value) <= Number.MAX_SAFE_INTEGER) {\n datatype = Number.isInteger(value) ? XSD.integer : XSD.decimal;\n } else {\n datatype = XSD.double;\n }\n return new Literal(strValue, null, datatype);\n }\n\n /**\n * Builds a literal node from an input value\n * @param value - The input value\n */\n static fromValue(value) {\n if (isLiteral(value)) {\n return value;\n }\n switch (typeof value) {\n case 'object':\n if (value instanceof Date) {\n return Literal.fromDate(value);\n }\n case 'boolean':\n return Literal.fromBoolean(value);\n case 'number':\n return Literal.fromNumber(value);\n case 'string':\n return new Literal(value);\n }\n throw new Error(\"Can't make literal from \" + value + ' of type ' + typeof value);\n }\n}","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport RdflibBlankNode from './blank-node';\nimport ClassOrder from './class-order';\nimport Literal from './literal';\nimport Node from './node-internal';\nimport { CollectionTermType } from './types';\nimport { isTerm } from './utils/terms';\n/**\n * Creates an RDF Node from a native javascript value.\n * RDF Nodes are returned unchanged, undefined returned as itself.\n * Arrays return Collections.\n * Strings, numbers and booleans return Literals.\n * @param value {Node|Date|String|Number|Boolean|Undefined}\n * @return {Node|Collection}\n */\nexport function fromValue(value) {\n if (typeof value === 'undefined' || value === null) {\n return value;\n }\n if (isTerm(value)) {\n // a Node subclass or a Collection\n return value;\n }\n if (Array.isArray(value)) {\n return new Collection(value);\n }\n return Literal.fromValue(value);\n}\n\n/**\n * A collection of other RDF nodes\n *\n * Use generic T to control the contents of the array.\n */\nexport default class Collection extends Node {\n constructor(initial) {\n super((RdflibBlankNode.nextId++).toString());\n _defineProperty(this, \"termType\", CollectionTermType);\n _defineProperty(this, \"classOrder\", ClassOrder.Collection);\n _defineProperty(this, \"closed\", false);\n _defineProperty(this, \"compareTerm\", RdflibBlankNode.prototype.compareTerm);\n /**\n * The nodes in this collection\n */\n _defineProperty(this, \"elements\", []);\n _defineProperty(this, \"isVar\", 0);\n if (initial && initial.length > 0) {\n initial.forEach(element => {\n this.elements.push(fromValue(element));\n });\n }\n }\n get id() {\n return this.value;\n }\n set id(value) {\n this.value = value;\n }\n\n /**\n * Appends an element to this collection\n * @param element - The new element\n */\n append(element) {\n return this.elements.push(element);\n }\n\n /**\n * Closes this collection\n */\n close() {\n this.closed = true;\n return this.closed;\n }\n\n /**\n * Removes the first element from the collection (and return it)\n */\n shift() {\n return this.elements.shift();\n }\n\n /**\n * Creates a new Collection with the substituting bindings applied\n * @param bindings - The bindings to substitute\n */\n substitute(bindings) {\n const elementsCopy = this.elements.map(ea => ea.substitute(bindings));\n return new Collection(elementsCopy);\n }\n toNT() {\n return Collection.toNT(this);\n }\n static toNT(collection) {\n // return '(' + collection.elements.map(x => x.toNT()).join(' ') + ')'\n // As lists are not in NT and toNT() must be a reversible function, we kludge it for a list\n return RdflibBlankNode.NTAnonymousNodePrefix + collection.id;\n }\n\n /**\n * Serializes the collection to a string.\n * Surrounded by (parentheses) and separated by spaces.\n */\n toString() {\n return '(' + this.elements.join(' ') + ')';\n }\n\n /**\n * Prepends the specified element to the collection's front\n * @param element - The element to prepend\n */\n unshift(element) {\n return this.elements.unshift(element);\n }\n}\n_defineProperty(Collection, \"termType\", CollectionTermType);","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport Node from './node-internal';\nimport { EmptyTermType } from './types';\n/**\n* An empty node\n*/\nexport default class Empty extends Node {\n constructor() {\n super('');\n _defineProperty(this, \"termType\", EmptyTermType);\n }\n toString() {\n return '()';\n }\n}","// Prevents circular dependencies between data-factory-internal and statement\n\nimport NamedNode from '../named-node';\nexport const defaultGraphURI = 'chrome:theSession';\nexport const defaultGraphNode = new NamedNode(defaultGraphURI);","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport Node from './node-internal';\nimport { DefaultGraphTermType } from './types';\nimport { defaultGraphURI } from './utils/default-graph-uri';\n\n/** The RDF default graph */\nexport default class DefaultGraph extends Node {\n constructor() {\n super('');\n _defineProperty(this, \"value\", '');\n _defineProperty(this, \"termType\", DefaultGraphTermType);\n _defineProperty(this, \"uri\", defaultGraphURI);\n }\n toCanonical() {\n return this.value;\n }\n toString() {\n return 'DefaultGraph';\n }\n}\nexport function isDefaultGraph(object) {\n return !!object && object.termType === DefaultGraphTermType;\n}","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport Node from './node-internal';\nimport { DefaultGraphTermType } from './types';\nimport DefaultGraphNode, { isDefaultGraph } from './default-graph';\nconst defaultGraph = new DefaultGraphNode();\n\n/** A Statement represents an RDF Triple or Quad. */\nexport default class Statement {\n /**\n * Construct a new statement\n *\n * @param subject - The subject of the triple. What the fact is about\n * @param predicate - The relationship which is asserted between the subject and object\n * @param object - The thing or data value which is asserted to be related to the subject\n * @param {NamedNode} graph - The document where the triple is or was or will be stored on the web.\n *\n * The graph param is a named node of the document in which the triple when it is stored\n * on the web. It exists because when you have read data from various places in the web,\n * the “graph” tells you _why_ you have the triple. (At the moment, it is just the\n * document, in future it could be an inference step)\n *\n * When you do UpdateManager.update() then the graph’s of all the statements must be the same,\n * and give the document you are patching. In future, we may have a more\n * powerful update() which can update more than one document.\n */\n constructor(subject, predicate, object, graph) {\n /** The subject of the triple. What the Statement is about. */\n _defineProperty(this, \"subject\", void 0);\n /** The relationship which is asserted between the subject and object */\n _defineProperty(this, \"predicate\", void 0);\n /** The thing or data value which is asserted to be related to the subject */\n _defineProperty(this, \"object\", void 0);\n /**\n * The graph param is a named node of the document in which the triple when\n * it is stored on the web.\n */\n _defineProperty(this, \"graph\", void 0);\n this.subject = Node.fromValue(subject);\n this.predicate = Node.fromValue(predicate);\n this.object = Node.fromValue(object);\n this.graph = graph == undefined ? defaultGraph : Node.fromValue(graph); // property currently used by rdflib\n }\n\n /** Alias for graph, favored by Tim */\n get why() {\n return this.graph;\n }\n set why(g) {\n this.graph = g;\n }\n\n /**\n * Checks whether two statements are the same\n * @param other - The other statement\n */\n equals(other) {\n return other.subject.equals(this.subject) && other.predicate.equals(this.predicate) && other.object.equals(this.object) && other.graph.equals(this.graph);\n }\n\n /**\n * Creates a statement with the bindings substituted\n * @param bindings The bindings\n */\n substitute(bindings) {\n const y = new Statement(this.subject.substitute(bindings), this.predicate.substitute(bindings), this.object.substitute(bindings), isDefaultGraph(this.graph) ? this.graph : this.graph.substitute(bindings)); // 2016\n // console.log('@@@ statement substitute:' + y)\n return y;\n }\n\n /** Creates a canonical string representation of this statement. */\n toCanonical() {\n let terms = [this.subject.toCanonical(), this.predicate.toCanonical(), this.object.toCanonical()];\n if (this.graph && this.graph.termType !== DefaultGraphTermType) {\n terms.push(this.graph.toCanonical());\n }\n return terms.join(' ') + ' .';\n }\n\n /** Creates a n-triples string representation of this statement */\n toNT() {\n return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT()].join(' ') + ' .';\n }\n\n /** Creates a n-quads string representation of this statement */\n toNQ() {\n return [this.subject.toNT(), this.predicate.toNT(), this.object.toNT(), isDefaultGraph(this.graph) ? '' : this.graph.toNT()].join(' ') + ' .';\n }\n\n /** Creates a string representation of this statement */\n toString() {\n /*\n return [\n this.subject.toString(),\n this.predicate.toString(),\n this.object.toString(),\n ].join(' ') + ' .'\n */\n return this.toNT();\n }\n}","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport ClassOrder from './class-order';\nimport Node from './node-internal';\nimport { VariableTermType } from './types';\nimport * as Uri from './uri';\n/**\n* Variables are placeholders used in patterns to be matched.\n* In cwm they are symbols which are the formula's list of quantified variables.\n* In sparql they are not visibly URIs. Here we compromise, by having\n* a common special base URI for variables. Their names are uris,\n* but the ? notation has an implicit base uri of 'varid:'\n*/\nexport default class Variable extends Node {\n /**\n * Initializes this variable\n * @param name The variable's name\n */\n constructor() {\n let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n super(name);\n _defineProperty(this, \"termType\", VariableTermType);\n /** The base string for a variable's name */\n _defineProperty(this, \"base\", 'varid:');\n _defineProperty(this, \"classOrder\", ClassOrder.Variable);\n _defineProperty(this, \"isVar\", 1);\n /** The unique identifier of this variable */\n _defineProperty(this, \"uri\", void 0);\n this.base = 'varid:';\n this.uri = Uri.join(name, this.base);\n }\n equals(other) {\n if (!other) {\n return false;\n }\n return this.termType === other.termType && this.value === other.value;\n }\n hashString() {\n return this.toString();\n }\n substitute(bindings) {\n var ref;\n return (ref = bindings[this.toNT()]) != null ? ref : this;\n }\n toString() {\n return Variable.toString(this);\n }\n static toString(variable) {\n if (variable.uri.slice(0, variable.base.length) === variable.base) {\n return `?${variable.uri.slice(variable.base.length)}`;\n }\n return `?${variable.uri}`;\n }\n}","/** A set of features that may be supported by a Data Factory */\n\nexport let Feature = /*#__PURE__*/function (Feature) {\n /** Whether the factory supports termType:Collection terms */\n Feature[\"collections\"] = \"COLLECTIONS\";\n /** Whether the factory supports termType:DefaultGraph terms */\n Feature[\"defaultGraphType\"] = \"DEFAULT_GRAPH_TYPE\";\n /** Whether the factory supports equals on produced instances */\n Feature[\"equalsMethod\"] = \"EQUALS_METHOD\";\n /** Whether the factory can create a unique idempotent identifier for the given term. */\n Feature[\"id\"] = \"ID\";\n /**\n * Whether the factory will return the same instance for subsequent calls.\n * This implies `===`, which means methods like `indexOf` can be used.\n */\n Feature[\"identity\"] = \"IDENTITY\";\n /** Whether the factory supports mapping ids back to instances (should adhere to the identity setting) */\n Feature[\"reversibleId\"] = \"REVERSIBLE_ID\";\n /** Whether the factory supports termType:Variable terms */\n Feature[\"variableType\"] = \"VARIABLE_TYPE\";\n return Feature;\n}({});\n\n/**\n * Defines a DataFactory as used in rdflib, based on the RDF/JS: Data model specification,\n * but with additional extensions\n *\n * bnIndex is optional but useful.\n */","import BlankNode from '../blank-node';\nimport Literal from '../literal';\nimport NamedNode from '../named-node';\nimport Statement from '../statement';\nimport Variable from '../variable';\nimport { EmptyTermType, DefaultGraphTermType, VariableTermType, BlankNodeTermType, LiteralTermType, NamedNodeTermType, CollectionTermType, GraphTermType } from '../types';\nimport DefaultGraph from '../default-graph';\nimport { Feature } from './factory-types';\nimport { isQuad, isTerm } from '../utils/terms';\nexport { defaultGraphURI } from '../utils/default-graph-uri';\n\n/**\n * Gets the default graph\n */\nconst defaultGraph = new DefaultGraph();\n\n/** A basic internal RDFlib datafactory, which does not support Collections */\nconst CanonicalDataFactory = {\n supports: {\n [Feature.collections]: false,\n [Feature.defaultGraphType]: false,\n [Feature.equalsMethod]: true,\n [Feature.identity]: false,\n [Feature.id]: true,\n [Feature.reversibleId]: false,\n [Feature.variableType]: true\n },\n /**\n * Creates a new blank node\n * @param value - The blank node's identifier\n */\n blankNode(value) {\n return new BlankNode(value);\n },\n defaultGraph: () => defaultGraph,\n /**\n * Compares to (rdf) objects for equality.\n */\n equals(a, b) {\n if (a === b || !a || !b) {\n return true;\n }\n if (isQuad(a) || isQuad(b)) {\n if (isQuad(a) && isQuad(b)) {\n return this.equals(a.subject, b.subject) && this.equals(a.predicate, b.predicate) && this.equals(a.object, b.object) && this.equals(a.graph, b.graph);\n }\n return false;\n }\n if (isTerm(a) && isTerm(b)) {\n return this.id(a) === this.id(b);\n }\n return false;\n },\n /**\n * Generates a uniquely identifiably *idempotent* string for the given {term}.\n *\n * Equivalent to [[Term.hashString]]\n *\n * @example Use this to associate data with a term in an object\n * { obj[id(term)] = \"myData\" }\n */\n id(term) {\n if (!term) {\n return 'undefined';\n }\n if (isQuad(term)) {\n return this.quadToNQ(term);\n }\n switch (term.termType) {\n case DefaultGraphTermType:\n return 'defaultGraph';\n case VariableTermType:\n return Variable.toString(term);\n default:\n const nq = this.termToNQ(term);\n if (nq) {\n return nq;\n }\n throw new Error(`Can't id term with type '${term.termType}'`);\n }\n },\n isQuad(obj) {\n return obj instanceof Statement;\n },\n /**\n * Creates a new literal node. Does some JS literal parsing for ease of use.\n * @param value - The lexical value\n * @param languageOrDatatype - Either the language or the datatype\n */\n literal(value, languageOrDatatype) {\n if (typeof value !== \"string\" && !languageOrDatatype) {\n return Literal.fromValue(value);\n }\n const strValue = typeof value === 'string' ? value : '' + value;\n if (typeof languageOrDatatype === 'string') {\n if (languageOrDatatype.indexOf(':') === -1) {\n return new Literal(strValue, languageOrDatatype);\n } else {\n return new Literal(strValue, null, this.namedNode(languageOrDatatype));\n }\n } else {\n return new Literal(strValue, null, languageOrDatatype);\n }\n },\n /**\n * Creates a new named node\n * @param value - The new named node\n */\n namedNode(value) {\n return new NamedNode(value);\n },\n /**\n * Creates a new statement\n * @param subject - The subject\n * @param predicate - The predicate\n * @param object - The object\n * @param graph - The containing graph\n */\n quad(subject, predicate, object, graph) {\n return new Statement(subject, predicate, object, graph || defaultGraph);\n },\n /**\n * Creates a new statement\n * @param subject - The subject\n * @param predicate - The predicate\n * @param object - The object\n * @param graph - The containing graph\n */\n triple(subject, predicate, object, graph) {\n return this.quad(subject, predicate, object, graph);\n },\n quadToNQ(q) {\n return `${this.termToNQ(q.subject)} ${this.termToNQ(q.predicate)} ${this.termToNQ(q.object)} ${this.termToNQ(q.graph)} .`;\n },\n /** Stringify a {term} to n-quads serialization. */\n termToNQ(term) {\n switch (term.termType) {\n case BlankNodeTermType:\n return '_:' + term.value;\n case DefaultGraphTermType:\n return '';\n case EmptyTermType:\n return '<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>';\n case LiteralTermType:\n return Literal.toNT(term);\n case GraphTermType:\n case NamedNodeTermType:\n return '<' + term.value + '>';\n case CollectionTermType:\n return '(' + term.elements.map(t => this.termToNQ(t)).join(' ') + ')';\n default:\n throw new Error(`Can't serialize nonstandard term type (was '${term.termType}')`);\n }\n },\n /** Convert an rdf object (term or quad) to n-quads serialization. */\n toNQ(term) {\n if (this.isQuad(term)) {\n return this.quadToNQ(term);\n }\n return this.termToNQ(term);\n },\n /**\n * Creates a new variable\n * @param name - The name for the variable\n */\n variable(name) {\n return new Variable(name);\n }\n};\n\n/** Contains the factory methods as defined in the spec, plus id */\nexport default CanonicalDataFactory;","import RDFlibNamedNode from './named-node';\n/**\n * Gets a namespace for the specified namespace's URI\n * @param nsuri - The URI for the namespace\n * @param [factory] - The factory for creating named nodes with\n */\nexport default function Namespace(nsuri, factory) {\n const dataFactory = factory || {\n namedNode: value => new RDFlibNamedNode(value)\n };\n return function (ln) {\n return dataFactory.namedNode(nsuri + (ln || ''));\n };\n}","import CanonicalDataFactory from \"./factories/canonical-data-factory\";\nexport function createXSD() {\n let localFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CanonicalDataFactory;\n return {\n boolean: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#boolean\"),\n dateTime: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#dateTime\"),\n decimal: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#decimal\"),\n double: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#double\"),\n integer: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#integer\"),\n langString: localFactory.namedNode(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString\"),\n string: localFactory.namedNode(\"http://www.w3.org/2001/XMLSchema#string\")\n };\n}\nconst defaultXSD = createXSD(CanonicalDataFactory);\nexport default defaultXSD;","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/* Serialization of RDF Graphs\n**\n** Tim Berners-Lee 2006\n** This is was http://dig.csail.mit.edu/2005/ajar/ajaw/js/rdf/serialize.js\n** This is or was https://github.com/linkeddata/rdflib.js/blob/main/src/serializer.js\n** Licence: MIT\n*/\nimport NamedNode from './named-node';\nimport BlankNode from './blank-node';\nimport * as Uri from './uri';\nimport * as Util from './utils-js';\nimport CanonicalDataFactory from './factories/canonical-data-factory';\nimport { createXSD } from './xsd';\nimport solidNs from 'solid-namespace';\nimport * as ttl2jsonld from '@frogcat/ttl2jsonld';\nexport default function createSerializer(store) {\n return new Serializer(store);\n}\n;\nexport class Serializer {\n constructor(store) {\n _defineProperty(this, \"_notQNameChars\", '\\t\\r\\n !\"#$%&\\'()*.,+/;<=>?@[\\\\]^`{|}~');\n _defineProperty(this, \"_notNameChars\", this._notQNameChars + ':');\n // stringToN3: String escaping for N3\n _defineProperty(this, \"validPrefix\", new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/));\n _defineProperty(this, \"forbidden1\", new RegExp(/[\\\\\"\\b\\f\\r\\v\\t\\n\\u0080-\\uffff]/gm));\n _defineProperty(this, \"forbidden3\", new RegExp(/[\\\\\"\\b\\f\\r\\v\\u0080-\\uffff]/gm));\n this.flags = '';\n this.base = null;\n this.prefixes = []; // suggested prefixes\n this.namespaces = []; // complementary\n const nsKeys = Object.keys(solidNs());\n for (const i in nsKeys) {\n const uri = solidNs()[nsKeys[i]]('');\n const prefix = nsKeys[i];\n this.prefixes[uri] = prefix;\n this.namespaces[prefix] = uri;\n }\n this.suggestPrefix('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); // XML code assumes this!\n this.suggestPrefix('xml', 'reserved:reservedForFutureUse'); // XML reserves xml: in the spec.\n\n this.namespacesUsed = []; // Count actually used and so needed in @prefixes\n this.keywords = ['a']; // The only one we generate at the moment\n this.prefixchars = 'abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n this.incoming = null; // Array not calculated yet\n this.formulas = []; // remembering original formulae from hashes\n this.store = store;\n this.rdfFactory = store.rdfFactory || CanonicalDataFactory;\n this.xsd = createXSD(this.rdfFactory);\n }\n setBase(base) {\n this.base = base;\n return this;\n }\n setFlags(flags) {\n this.flags = flags || '';\n return this;\n }\n toStr(x) {\n var s = x.toNT();\n if (x.termType === 'Graph') {\n this.formulas[s] = x; // remember as reverse does not work\n }\n return s;\n }\n fromStr(s) {\n if (s[0] === '{') {\n var x = this.formulas[s];\n if (!x) console.log('No formula object for ' + s);\n return x;\n }\n return this.store.fromNT(s);\n }\n\n /**\n * Defines a set of [prefix, namespace] pairs to be used by this Serializer instance.\n * Overrides previous prefixes if any\n * @param namespaces\n * @return {Serializer}\n */\n setNamespaces(namespaces) {\n for (var px in namespaces) {\n this.setPrefix(px, namespaces[px]);\n }\n return this;\n }\n\n /**\n * Defines a namespace prefix, overriding any existing prefix for that URI\n * @param prefix\n * @param uri\n */\n setPrefix(prefix, uri) {\n if (prefix.slice(0, 7) === 'default') return; // Try to weed these out\n if (prefix.slice(0, 2) === 'ns') return; // From others inferior algos\n if (!prefix || !uri) return; // empty strings not suitable\n\n // remove any existing prefix targeting this uri\n // for (let existingPrefix in this.namespaces) {\n // if (this.namespaces[existingPrefix] == uri)\n // delete this.namespaces[existingPrefix];\n // }\n\n // remove any existing mapping for this prefix\n for (let existingNs in this.prefixes) {\n if (this.prefixes[existingNs] == prefix) delete this.prefixes[existingNs];\n }\n this.prefixes[uri] = prefix;\n this.namespaces[prefix] = uri;\n }\n\n /* Accumulate Namespaces\n **\n ** These are only hints. If two overlap, only one gets used\n ** There is therefore no guarantee in general.\n */\n suggestPrefix(prefix, uri) {\n if (prefix.slice(0, 7) === 'default') return; // Try to weed these out\n if (prefix.slice(0, 2) === 'ns') return; // From others inferior algos\n if (!prefix || !uri) return; // empty strings not suitable\n if (prefix in this.namespaces || uri in this.prefixes) return; // already used\n this.prefixes[uri] = prefix;\n this.namespaces[prefix] = uri;\n }\n\n // Takes a namespace -> prefix map\n suggestNamespaces(namespaces) {\n for (var px in namespaces) {\n this.suggestPrefix(px, namespaces[px]);\n }\n return this;\n }\n checkIntegrity() {\n var p, ns;\n for (p in this.namespaces) {\n if (this.prefixes[this.namespaces[p]] !== p) {\n throw new Error('Serializer integity error 1: ' + p + ', ' + this.namespaces[p] + ', ' + this.prefixes[this.namespaces[p]] + '!');\n }\n }\n for (ns in this.prefixes) {\n if (this.namespaces[this.prefixes[ns]] !== ns) {\n throw new Error('Serializer integity error 2: ' + ns + ', ' + this.prefixs[ns] + ', ' + this.namespaces[this.prefixes[ns]] + '!');\n }\n }\n }\n\n // Make up an unused prefix for a random namespace\n makeUpPrefix(uri) {\n var p = uri;\n function canUseMethod(pp) {\n if (!this.validPrefix.test(pp)) return false; // bad format\n if (pp === 'ns') return false; // boring\n if (pp in this.namespaces) return false; // already used\n this.prefixes[uri] = pp;\n this.namespaces[pp] = uri;\n return pp;\n }\n var canUse = canUseMethod.bind(this);\n if ('#/'.indexOf(p[p.length - 1]) >= 0) p = p.slice(0, -1);\n var slash = p.lastIndexOf('/');\n if (slash >= 0) p = p.slice(slash + 1);\n var i = 0;\n while (i < p.length) {\n if (this.prefixchars.indexOf(p[i])) {\n i++;\n } else {\n break;\n }\n }\n p = p.slice(0, i);\n if (p.length < 6 && canUse(p)) return p; // exact is best\n if (canUse(p.slice(0, 3))) return p.slice(0, 3);\n if (canUse(p.slice(0, 2))) return p.slice(0, 2);\n if (canUse(p.slice(0, 4))) return p.slice(0, 4);\n if (canUse(p.slice(0, 1))) return p.slice(0, 1);\n if (canUse(p.slice(0, 5))) return p.slice(0, 5);\n if (!this.validPrefix.test(p)) {\n p = 'n'; // Otherwise the loop below may never termimnate\n }\n for (var j = 0;; j++) if (canUse(p.slice(0, 3) + j)) return p.slice(0, 3) + j;\n }\n rootSubjects(sts) {\n var incoming = {};\n var subjects = {};\n var allBnodes = {};\n\n /* This scan is to find out which nodes will have to be the roots of trees\n ** in the serialized form. This will be any symbols, and any bnodes\n ** which hve more or less than one incoming arc, and any bnodes which have\n ** one incoming arc but it is an uninterrupted loop of such nodes back to itself.\n ** This should be kept linear time with repect to the number of statements.\n ** Note it does not use any indexing of the store.\n */\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i];\n var checkMentions = function (x) {\n if (!incoming.hasOwnProperty(x)) incoming[x] = [];\n incoming[x].push(st.subject); // List of things which will cause this to be printed\n };\n var st2 = [st.subject, st.predicate, st.object];\n st2.map(function (y) {\n if (y.termType === 'BlankNode') {\n allBnodes[y.toNT()] = true;\n } else if (y.termType === 'Collection') {\n y.elements.forEach(function (z) {\n checkMentions(z); // bnodes in collections important\n });\n }\n });\n checkMentions(sts[i].object);\n var ss = subjects[this.toStr(st.subject)]; // Statements with this as subject\n if (!ss) ss = [];\n ss.push(st);\n subjects[this.toStr(st.subject)] = ss; // Make hash. @@ too slow for formula?\n }\n var roots = [];\n for (var xNT in subjects) {\n if (!subjects.hasOwnProperty(xNT)) continue;\n var y = this.fromStr(xNT);\n if (y.termType !== 'BlankNode' || !incoming[y] || incoming[y].length !== 1) {\n roots.push(y);\n continue;\n }\n }\n this.incoming = incoming; // Keep for serializing @@ Bug for nested formulas\n\n // Now do the scan using existing roots\n var rootsHash = {};\n for (var k = 0; k < roots.length; k++) {\n rootsHash[roots[k].toNT()] = true;\n }\n return {\n 'roots': roots,\n 'subjects': subjects,\n 'rootsHash': rootsHash,\n 'incoming': incoming\n };\n }\n\n // //////////////////////////////////////////////////////\n\n toN3(f) {\n return this.statementsToN3(f.statements);\n }\n explicitURI(uri) {\n if (this.flags.indexOf('r') < 0 && this.base) {\n uri = Uri.refTo(this.base, uri);\n } else if (this.flags.indexOf('u') >= 0) {\n // Unicode encoding NTriples style\n uri = backslashUify(uri);\n } else {\n uri = hexify(decodeURI(uri));\n }\n return '<' + uri + '>';\n }\n statementsToNTriples(sts) {\n var sorted = sts.slice();\n sorted.sort();\n var str = '';\n var rdfns = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';\n var self = this;\n var kb = this.store;\n var factory = this.rdfFactory;\n var termToNT = function (x) {\n if (x.termType !== 'Collection') {\n return self.atomicTermToN3(x);\n }\n var list = x.elements;\n var rest = kb.sym(rdfns + 'nill');\n for (var i = list.length - 1; i >= 0; i--) {\n var bnode = factory.blankNode();\n str += termToNT(bnode) + ' ' + termToNT(kb.sym(rdfns + 'first')) + ' ' + termToNT(list[i]) + '.\\n';\n str += termToNT(bnode) + ' ' + termToNT(kb.sym(rdfns + 'rest')) + ' ' + termToNT(rest) + '.\\n';\n rest = bnode;\n }\n return self.atomicTermToN3(rest);\n };\n for (var i = 0; i < sorted.length; i++) {\n var st = sorted[i];\n var s = '';\n s += termToNT(st.subject) + ' ';\n s += termToNT(st.predicate) + ' ';\n s += termToNT(st.object) + ' ';\n if (this.flags.indexOf('q') >= 0) {\n // Do quads not nrtiples\n s += termToNT(st.why) + ' ';\n }\n s += '.\\n';\n str += s;\n }\n return str;\n }\n statementsToN3(sts) {\n var indent = 4;\n var width = 80;\n var kb = this.store;\n // A URI Map alows us to put the type statemnts at the top.\n var uriMap = {\n 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type': 'aaa:00'\n };\n var SPO = function (x, y) {\n // Do limited canonicalization of bnodes\n return Util.heavyCompareSPO(x, y, kb, uriMap);\n };\n sts.sort(SPO);\n if (this.base && !this.defaultNamespace) {\n this.defaultNamespace = this.base + '#';\n }\n var predMap = {};\n if (this.flags.indexOf('s') < 0) {\n predMap['http://www.w3.org/2002/07/owl#sameAs'] = '=';\n }\n if (this.flags.indexOf('t') < 0) {\n predMap['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'] = 'a';\n }\n if (this.flags.indexOf('i') < 0) {\n predMap['http://www.w3.org/2000/10/swap/log#implies'] = '=>';\n }\n // //////////////////////// Arrange the bits of text\n\n var spaces = function (n) {\n var s = '';\n for (var i = 0; i < n; i++) s += ' ';\n return s;\n };\n var treeToLine = function (tree) {\n var str = '';\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i];\n var s2 = typeof branch === 'string' ? branch : treeToLine(branch);\n // Note the space before the dot in case statement ends with 123 or colon. which is in fact allowed but be conservative.\n if (i !== 0) {\n var ch = str.slice(-1) || ' ';\n if (s2 === ',' || s2 === ';') {\n // no gap\n } else if (s2 === '.' && !'0123456789.:'.includes(ch)) {// no gap except after number and colon\n // no gap\n } else {\n str += ' '; // separate from previous token\n }\n }\n str += s2;\n }\n return str;\n };\n\n // Convert a nested tree of lists and strings to a string\n var treeToString = function (tree, level) {\n var str = '';\n var lastLength = 100000;\n if (level === undefined) level = -1;\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i];\n if (typeof branch !== 'string') {\n var substr = treeToString(branch, level + 1);\n if (substr.length < 10 * (width - indent * level) && substr.indexOf('\"\"\"') < 0) {\n // Don't mess up multiline strings\n var line = treeToLine(branch);\n if (line.length < width - indent * level) {\n branch = line; // Note! treat as string below\n substr = '';\n }\n }\n if (substr) lastLength = 10000;\n str += substr;\n }\n if (typeof branch === 'string') {\n if (branch.length === 1 && str.slice(-1) === '\\n') {\n if (',.;'.indexOf(branch) >= 0) {\n str = str.slice(0, -1);\n // be conservative and ensure a whitespace between some chars and a final dot, as in treeToLine above\n if (branch == '.' && '0123456789.:'.includes(str.charAt(str.length - 1))) {\n str += ' ';\n lastLength += 1;\n }\n str += branch + '\\n'; // slip punct'n on end\n lastLength += 1;\n continue;\n }\n }\n if (lastLength < indent * level + 4 ||\n // if new line not necessary\n lastLength + branch.length + 1 < width && ';.'.indexOf(str[str.length - 2]) < 0) {\n // or the string fits on last line\n str = str.slice(0, -1) + ' ' + branch + '\\n'; // then continue on this line\n lastLength += branch.length + 1;\n } else {\n let line = spaces(indent * level) + branch;\n str += line + '\\n';\n lastLength = line.length;\n if (level < 0) {\n str += '\\n'; // extra blank line\n lastLength = 100000; // don't touch\n }\n }\n }\n }\n return str;\n };\n\n // //////////////////////////////////////////// Structure for N3\n // Convert a set of statements into a nested tree of lists and strings\n function statementListToTreeMethod(statements) {\n var stats = this.rootSubjects(statements);\n var roots = stats.roots;\n var results = [];\n for (var i = 0; i < roots.length; i++) {\n var root = roots[i];\n results.push(subjectTree(root, stats));\n }\n return results;\n }\n var statementListToTree = statementListToTreeMethod.bind(this);\n\n // The tree for a subject\n function subjectTree(subject, stats) {\n if (subject.termType === 'BlankNode' && !stats.incoming[subject]) {\n return objectTree(subject, stats, true).concat(['.']); // Anonymous bnode subject\n }\n return [termToN3(subject, stats)].concat([propertyTree(subject, stats)]).concat(['.']);\n }\n // The property tree for a single subject or anonymous node\n function propertyTreeMethod(subject, stats) {\n var results = [];\n var lastPred = null;\n var sts = stats.subjects[this.toStr(subject)] || []; // relevant statements\n if (typeof sts === 'undefined') {\n throw new Error('Cant find statements for ' + subject);\n }\n var objects = [];\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i];\n if (st.predicate.uri === lastPred) {\n objects.push(',');\n } else {\n if (lastPred) {\n results = results.concat([objects]).concat([';']);\n objects = [];\n }\n results.push(predMap[st.predicate.uri] ? predMap[st.predicate.uri] : termToN3(st.predicate, stats));\n }\n lastPred = st.predicate.uri;\n objects.push(objectTree(st.object, stats));\n }\n results = results.concat([objects]);\n return results;\n }\n var propertyTree = propertyTreeMethod.bind(this);\n function objectTreeMethod(obj, stats, force) {\n if (obj.termType === 'BlankNode' && (force || stats.rootsHash[obj.toNT()] === undefined)) {\n // if not a root\n if (stats.subjects[this.toStr(obj)]) {\n return ['[', propertyTree(obj, stats), ']'];\n } else {\n return '[]';\n }\n }\n return termToN3(obj, stats);\n }\n var objectTree = objectTreeMethod.bind(this);\n function termToN3Method(expr, stats) {\n //\n var i, res;\n switch (expr.termType) {\n case 'Graph':\n res = ['{'];\n res = res.concat(statementListToTree(expr.statements));\n return res.concat(['}']);\n case 'Collection':\n res = ['('];\n for (i = 0; i < expr.elements.length; i++) {\n res.push([objectTree(expr.elements[i], stats)]);\n }\n res.push(')');\n return res;\n default:\n return this.atomicTermToN3(expr);\n }\n }\n Serializer.prototype.termToN3 = termToN3;\n var termToN3 = termToN3Method.bind(this);\n function prefixDirectivesMethod() {\n var str = '';\n if (this.flags.indexOf('d') < 0 && this.defaultNamespace) {\n str += '@prefix : ' + this.explicitURI(this.defaultNamespace) + '.\\n';\n }\n for (var ns in this.prefixes) {\n if (!this.prefixes.hasOwnProperty(ns)) continue;\n if (!this.namespacesUsed[ns]) continue;\n str += '@prefix ' + this.prefixes[ns] + ': ' + this.explicitURI(ns) + '.\\n';\n }\n return str + '\\n';\n }\n var prefixDirectives = prefixDirectivesMethod.bind(this);\n // Body of statementsToN3:\n var tree = statementListToTree(sts);\n return prefixDirectives() + treeToString(tree);\n }\n // //////////////////////////////////////////// Atomic Terms\n\n // Deal with term level things and nesting with no bnode structure\n atomicTermToN3(expr, stats) {\n switch (expr.termType) {\n case 'BlankNode':\n case 'Variable':\n return expr.toNT();\n case 'Literal':\n var val = expr.value;\n if (typeof val !== 'string') {\n throw new TypeError('Value of RDF literal node must be a string');\n }\n // var val = expr.value.toString() // should be a string already\n if (expr.datatype && this.flags.indexOf('x') < 0) {\n // Supress native numbers\n switch (expr.datatype.uri) {\n case 'http://www.w3.org/2001/XMLSchema#integer':\n return val;\n case 'http://www.w3.org/2001/XMLSchema#decimal':\n // In Turtle, must have dot\n if (val.indexOf('.') < 0) val += '.0';\n return val;\n case 'http://www.w3.org/2001/XMLSchema#double':\n {\n // Must force use of 'e'\n const eNotation = val.toLowerCase().indexOf('e') > 0;\n if (val.indexOf('.') < 0 && !eNotation) val += '.0';\n if (!eNotation) val += 'e0';\n return val;\n }\n case 'http://www.w3.org/2001/XMLSchema#boolean':\n return expr.value === '1' ? 'true' : 'false';\n }\n }\n var str = this.stringToN3(expr.value, this.flags);\n if (expr.language) {\n str += '@' + expr.language;\n } else if (!expr.datatype.equals(this.xsd.string)) {\n str += '^^' + this.atomicTermToN3(expr.datatype, stats);\n }\n return str;\n case 'NamedNode':\n return this.symbolToN3(expr);\n case 'DefaultGraph':\n return '';\n default:\n throw new Error('Internal: atomicTermToN3 cannot handle ' + expr + ' of termType: ' + expr.termType);\n }\n }\n stringToN3(str, flags) {\n if (!flags) flags = 'e';\n var res = '';\n var i, j, k;\n var delim;\n var forbidden;\n if (str.length > 20 &&\n // Long enough to make sense\n str.slice(-1) !== '\"' &&\n // corner case'\n flags.indexOf('n') < 0 && (\n // Force single line\n str.indexOf('\\n') > 0 || str.indexOf('\"') > 0)) {\n delim = '\"\"\"';\n forbidden = this.forbidden3;\n } else {\n delim = '\"';\n forbidden = this.forbidden1;\n }\n for (i = 0; i < str.length;) {\n forbidden.lastIndex = 0;\n var m = forbidden.exec(str.slice(i));\n if (m == null) break;\n j = i + forbidden.lastIndex - 1;\n res += str.slice(i, j);\n var ch = str[j];\n if (ch === '\"' && delim === '\"\"\"' && str.slice(j, j + 3) !== '\"\"\"') {\n res += ch;\n } else {\n k = '\\b\\f\\r\\t\\v\\n\\\\\"'.indexOf(ch); // No escaping of bell (7)?\n if (k >= 0) {\n res += '\\\\' + 'bfrtvn\\\\\"'[k];\n } else {\n if (flags.indexOf('e') >= 0) {\n // Unicode escaping in strings not unix style\n res += '\\\\u' + ('000' + ch.charCodeAt(0).toString(16).toLowerCase()).slice(-4);\n } else {\n // no 'e' flag\n res += ch;\n }\n }\n }\n i = j + 1;\n }\n return delim + res + str.slice(i) + delim;\n }\n // A single symbol, either in <> or namespace notation\n\n symbolToN3(x) {\n // c.f. symbolString() in notation3.py\n var uri = x.uri;\n var j = uri.indexOf('#');\n if (j < 0 && this.flags.indexOf('/') < 0) {\n j = uri.lastIndexOf('/');\n }\n if (j >= 0 && this.flags.indexOf('p') < 0 && (\n // Can split at namespace but only if http[s]: URI or file: or ws[s] (why not others?)\n uri.indexOf('http') === 0 || uri.indexOf('ws') === 0 || uri.indexOf('file') === 0)) {\n var canSplit = true;\n for (var k = j + 1; k < uri.length; k++) {\n if (this._notNameChars.indexOf(uri[k]) >= 0) {\n canSplit = false;\n break;\n }\n }\n /*\n if (uri.slice(0, j + 1) === this.base + '#') { // base-relative\n if (canSplit) {\n return ':' + uri.slice(j + 1) // assume deafult ns is local\n } else {\n return '<#' + uri.slice(j + 1) + '>'\n }\n }\n */\n if (canSplit) {\n var localid = uri.slice(j + 1);\n var namesp = uri.slice(0, j + 1);\n if (this.defaultNamespace && this.defaultNamespace === namesp && this.flags.indexOf('d') < 0) {\n // d -> suppress default\n if (this.flags.indexOf('k') >= 0 && this.keyords.indexOf(localid) < 0) {\n return localid;\n }\n return ':' + localid;\n }\n // this.checkIntegrity() // @@@ Remove when not testing\n var prefix = this.prefixes[namesp];\n if (!prefix) prefix = this.makeUpPrefix(namesp);\n if (prefix) {\n this.namespacesUsed[namesp] = true;\n return prefix + ':' + localid;\n }\n // Fall though if can't do qname\n }\n }\n return this.explicitURI(uri);\n }\n\n // /////////////////////////// Quad store serialization\n\n // @para. write - a function taking a single string to be output\n //\n writeStore(write) {\n var kb = this.store;\n var fetcher = kb.fetcher;\n var session = fetcher && fetcher.appNode;\n\n // The core data\n\n var sources = this.store.index[3];\n for (var s in sources) {\n // -> assume we can use -> as short for log:semantics\n var source = kb.fromNT(s);\n if (session && source.equals(session)) continue;\n write('\\n' + this.atomicTermToN3(source) + ' ' + this.atomicTermToN3(kb.sym('http://www.w3.org/2000/10/swap/log#semantics')) + ' { ' + this.statementsToN3(kb.statementsMatching(undefined, undefined, undefined, source)) + ' }.\\n');\n }\n\n // The metadata from HTTP interactions:\n\n kb.statementsMatching(undefined, kb.sym('http://www.w3.org/2007/ont/link#requestedURI')).map(function (st) {\n write('\\n<' + st.object.value + '> log:metadata {\\n');\n var sts = kb.statementsMatching(undefined, undefined, undefined, st.subject);\n write(this.statementsToN3(this.statementsToN3(sts)));\n write('}.\\n');\n });\n\n // Inferences we have made ourselves not attributable to anyone else\n\n var metaSources = [];\n if (session) metaSources.push(session);\n var metadata = [];\n metaSources.map(function (source) {\n metadata = metadata.concat(kb.statementsMatching(undefined, undefined, undefined, source));\n });\n write(this.statementsToN3(metadata));\n }\n\n // ////////////////////////////////////////////// XML serialization\n\n statementsToXML(sts) {\n var indent = 4;\n var width = 80;\n var namespaceCounts = []; // which have been used\n namespaceCounts['http://www.w3.org/1999/02/22-rdf-syntax-ns#'] = true;\n var liPrefix = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_'; // prefix for ordered list items\n\n // //////////////////////// Arrange the bits of XML text\n\n var spaces = function (n) {\n var s = '';\n for (var i = 0; i < n; i++) s += ' ';\n return s;\n };\n var XMLtreeToLine = function (tree) {\n var str = '';\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i];\n var s2 = typeof branch === 'string' ? branch : XMLtreeToLine(branch);\n str += s2;\n }\n return str;\n };\n\n // Convert a nested tree of lists and strings to a string\n var XMLtreeToString = function (tree, level) {\n var str = '';\n var line;\n var lastLength = 100000;\n if (!level) level = 0;\n for (var i = 0; i < tree.length; i++) {\n var branch = tree[i];\n if (typeof branch !== 'string') {\n var substr = XMLtreeToString(branch, level + 1);\n if (substr.length < 10 * (width - indent * level) && substr.indexOf('\"\"\"') < 0) {\n // Don't mess up multiline strings\n line = XMLtreeToLine(branch);\n if (line.length < width - indent * level) {\n branch = ' ' + line; // @@ Hack: treat as string below\n substr = '';\n }\n }\n if (substr) lastLength = 10000;\n str += substr;\n }\n if (typeof branch === 'string') {\n if (lastLength < indent * level + 4) {\n // continue\n str = str.slice(0, -1) + ' ' + branch + '\\n';\n lastLength += branch.length + 1;\n } else {\n line = spaces(indent * level) + branch;\n str += line + '\\n';\n lastLength = line.length;\n }\n } else {// not string\n }\n }\n return str;\n };\n function statementListToXMLTreeMethod(statements) {\n this.suggestPrefix('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');\n var stats = this.rootSubjects(statements);\n var roots = stats.roots;\n var results = [];\n for (var i = 0; i < roots.length; i++) {\n var root = roots[i];\n results.push(subjectXMLTree(root, stats));\n }\n return results;\n }\n var statementListToXMLTree = statementListToXMLTreeMethod.bind(this);\n function escapeForXML(str) {\n if (typeof str === 'undefined') return '@@@undefined@@@@';\n return str.replace(/[&<\"]/g, function (m) {\n switch (m[0]) {\n case '&':\n return '&amp;';\n case '<':\n return '&lt;';\n case '\"':\n return '&quot;';\n // '\n }\n });\n }\n function relURIMethod(term) {\n return escapeForXML(this.base ? Util.uri.refTo(this.base, term.uri) : term.uri);\n }\n var relURI = relURIMethod.bind(this);\n\n // The tree for a subject\n function subjectXMLTreeMethod(subject, stats) {\n var results = [];\n var type, t, st, pred;\n var sts = stats.subjects[this.toStr(subject)]; // relevant statements\n if (typeof sts === 'undefined') {\n // empty bnode\n return propertyXMLTree(subject, stats);\n }\n\n // Sort only on the predicate, leave the order at object\n // level undisturbed. This leaves multilingual content in\n // the order of entry (for partner literals), which helps\n // readability.\n //\n // For the predicate sort, we attempt to split the uri\n // as a hint to the sequence\n sts.sort(function (a, b) {\n var ap = a.predicate.uri;\n var bp = b.predicate.uri;\n if (ap.substring(0, liPrefix.length) === liPrefix || bp.substring(0, liPrefix.length) === liPrefix) {\n // we're only interested in sorting list items\n return ap.localeCompare(bp);\n }\n var as = ap.substring(liPrefix.length);\n var bs = bp.substring(liPrefix.length);\n var an = parseInt(as, 10);\n var bn = parseInt(bs, 10);\n if (isNaN(an) || isNaN(bn) || an !== as || bn !== bs) {\n // we only care about integers\n return ap.localeCompare(bp);\n }\n return an - bn;\n });\n for (var i = 0; i < sts.length; i++) {\n st = sts[i];\n // look for a type\n if (st.predicate.uri === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' && !type && st.object.termType === 'NamedNode') {\n type = st.object;\n continue; // don't include it as a child element\n }\n\n // see whether predicate can be replaced with \"li\"\n pred = st.predicate;\n if (pred.uri.substr(0, liPrefix.length) === liPrefix) {\n var number = pred.uri.substr(liPrefix.length);\n // make sure these are actually numeric list items\n var intNumber = parseInt(number, 10);\n if (number === intNumber.toString()) {\n // was numeric; don't need to worry about ordering since we've already\n // sorted the statements\n pred = this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#li');\n }\n }\n t = qname(pred);\n switch (st.object.termType) {\n case 'BlankNode':\n if (stats.incoming[st.object].length === 1) {\n // there should always be something in the incoming array for a bnode\n results = results.concat(['<' + t + ' rdf:parseType=\"Resource\">', subjectXMLTree(st.object, stats), '</' + t + '>']);\n } else {\n results = results.concat(['<' + t + ' rdf:nodeID=\"' + st.object.toNT().slice(2) + '\"/>']);\n }\n break;\n case 'NamedNode':\n results = results.concat(['<' + t + ' rdf:resource=\"' + relURI(st.object) + '\"/>']);\n break;\n case 'Literal':\n results = results.concat(['<' + t + (st.object.datatype.equals(this.xsd.string) ? '' : ' rdf:datatype=\"' + escapeForXML(st.object.datatype.uri) + '\"') + (st.object.language ? ' xml:lang=\"' + st.object.language + '\"' : '') + '>' + escapeForXML(st.object.value) + '</' + t + '>']);\n break;\n case 'Collection':\n results = results.concat(['<' + t + ' rdf:parseType=\"Collection\">', collectionXMLTree(st.object, stats), '</' + t + '>']);\n break;\n default:\n throw new Error(\"Can't serialize object of type \" + st.object.termType + ' into XML');\n } // switch\n }\n var tag = type ? qname(type) : 'rdf:Description';\n var attrs = '';\n if (subject.termType === 'BlankNode') {\n if (!stats.incoming[subject] || stats.incoming[subject].length !== 1) {\n // not an anonymous bnode\n attrs = ' rdf:nodeID=\"' + subject.toNT().slice(2) + '\"';\n }\n } else {\n attrs = ' rdf:about=\"' + relURI(subject) + '\"';\n }\n return ['<' + tag + attrs + '>'].concat([results]).concat(['</' + tag + '>']);\n }\n var subjectXMLTree = subjectXMLTreeMethod.bind(this);\n function collectionXMLTree(subject, stats) {\n var res = [];\n for (var i = 0; i < subject.elements.length; i++) {\n res.push(subjectXMLTree(subject.elements[i], stats));\n }\n return res;\n }\n\n // The property tree for a single subject or anonymos node\n function propertyXMLTreeMethod(subject, stats) {\n var results = [];\n var sts = stats.subjects[this.toStr(subject)]; // relevant statements\n if (!sts) return results; // No relevant statements\n sts.sort();\n for (var i = 0; i < sts.length; i++) {\n var st = sts[i];\n switch (st.object.termType) {\n case 'BlankNode':\n if (stats.rootsHash[st.object.toNT()]) {\n // This bnode has been done as a root -- no content here @@ what bout first time\n results = results.concat(['<' + qname(st.predicate) + ' rdf:nodeID=\"' + st.object.toNT().slice(2) + '\">', '</' + qname(st.predicate) + '>']);\n } else {\n results = results.concat(['<' + qname(st.predicate) + ' rdf:parseType=\"Resource\">', propertyXMLTree(st.object, stats), '</' + qname(st.predicate) + '>']);\n }\n break;\n case 'NamedNode':\n results = results.concat(['<' + qname(st.predicate) + ' rdf:resource=\"' + relURI(st.object) + '\"/>']);\n break;\n case 'Literal':\n results = results.concat(['<' + qname(st.predicate) + (st.object.datatype.equals(this.xsd.string) ? '' : ' rdf:datatype=\"' + escapeForXML(st.object.datatype.value) + '\"') + (st.object.language ? ' xml:lang=\"' + st.object.language + '\"' : '') + '>' + escapeForXML(st.object.value) + '</' + qname(st.predicate) + '>']);\n break;\n case 'Collection':\n results = results.concat(['<' + qname(st.predicate) + ' rdf:parseType=\"Collection\">', collectionXMLTree(st.object, stats), '</' + qname(st.predicate) + '>']);\n break;\n default:\n throw new Error(\"Can't serialize object of type \" + st.object.termType + ' into XML');\n } // switch\n }\n return results;\n }\n var propertyXMLTree = propertyXMLTreeMethod.bind(this);\n function qnameMethod(term) {\n var uri = term.uri;\n var j = uri.indexOf('#');\n if (j < 0 && this.flags.indexOf('/') < 0) {\n j = uri.lastIndexOf('/');\n }\n if (j < 0) throw new Error('Cannot make qname out of <' + uri + '>');\n for (var k = j + 1; k < uri.length; k++) {\n if (this._notNameChars.indexOf(uri[k]) >= 0) {\n throw new Error('Invalid character \"' + uri[k] + '\" cannot be in XML qname for URI: ' + uri);\n }\n }\n var localid = uri.slice(j + 1);\n var namesp = uri.slice(0, j + 1);\n if (this.defaultNamespace && this.defaultNamespace === namesp && this.flags.indexOf('d') < 0) {\n // d -> suppress default\n return localid;\n }\n var prefix = this.prefixes[namesp];\n if (!prefix) prefix = this.makeUpPrefix(namesp);\n namespaceCounts[namesp] = true;\n return prefix + ':' + localid;\n }\n var qname = qnameMethod.bind(this);\n\n // Body of toXML:\n\n var tree = statementListToXMLTree(sts);\n var str = '<rdf:RDF';\n if (this.defaultNamespace) {\n str += ' xmlns=\"' + escapeForXML(this.defaultNamespace) + '\"';\n }\n for (var ns in namespaceCounts) {\n if (!namespaceCounts.hasOwnProperty(ns)) continue;\n // Rel uris in xml ns is not strictly allowed in the XMLNS spec but needed in practice often\n var ns2 = this.base && this.flags.includes('z') ? Util.uri.refTo(this.base, ns) : ns;\n str += '\\n xmlns:' + this.prefixes[ns] + '=\"' + escapeForXML(ns2) + '\"';\n }\n str += '>';\n var tree2 = [str, tree, '</rdf:RDF>']; // @@ namespace declrations\n return XMLtreeToString(tree2, -1);\n } // End @@ body\n\n statementsToJsonld(sts) {\n // ttl2jsonld creates context keys for all ttl prefix\n // context keys must be absolute IRI ttl2jsonld@0.0.8\n /* function findId (itemObj) {\n if (itemObj['@id']) {\n const item = itemObj['@id'].split(':')\n if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]\n }\n const itemValues = Object.values(itemObj)\n for (const i in itemValues) {\n if (typeof itemValues[i] !== 'string') { // @list contains array\n findId(itemValues[i])\n }\n }\n } */\n const turtleDoc = this.statementsToN3(sts);\n const jsonldObj = ttl2jsonld.parse(turtleDoc);\n return JSON.stringify(jsonldObj, null, 2);\n }\n}\n\n// String escaping utilities\n\nfunction hexify(str) {\n // also used in parser\n return encodeURI(str);\n}\nfunction backslashUify(str) {\n var res = '';\n var k;\n for (var i = 0; i < str.length; i++) {\n k = str.charCodeAt(i);\n if (k > 65535) {\n res += '\\\\U' + ('00000000' + k.toString(16)).slice(-8); // convert to upper?\n } else if (k > 126) {\n res += '\\\\u' + ('0000' + k.toString(16)).slice(-4);\n } else {\n res += str[i];\n }\n }\n return res;\n}","import Serializer from './serializer';\nimport { JSONLDContentType, N3ContentType, N3LegacyContentType, NQuadsAltContentType, NQuadsContentType, NTriplesContentType, RDFXMLContentType, TurtleContentType, TurtleLegacyContentType } from './types';\n/**\n * Serialize to the appropriate format\n */\nexport default function serialize(/** The graph or nodes that should be serialized */\ntarget, /** The store */\nkb, base,\n/**\n * The mime type.\n * Defaults to Turtle.\n */\ncontentType, callback, options) {\n base = base || target?.value;\n const opts = options || {};\n contentType = contentType || TurtleContentType; // text/n3 if complex?\n var documentString = undefined;\n try {\n var sz = Serializer(kb);\n if (opts.flags) sz.setFlags(opts.flags);\n var newSts = kb.statementsMatching(undefined, undefined, undefined, target);\n\n // If an IndexedFormula, use the namespaces from the given graph as suggestions\n if ('namespaces' in kb) {\n sz.suggestNamespaces(kb.namespaces);\n }\n\n // use the provided options.namespaces are mandatory prefixes\n if (opts.namespaces) {\n sz.setNamespaces(opts.namespaces);\n }\n sz.setBase(base);\n switch (contentType) {\n case RDFXMLContentType:\n documentString = sz.statementsToXML(newSts);\n return executeCallback(null, documentString);\n case N3ContentType:\n case N3LegacyContentType:\n documentString = sz.statementsToN3(newSts);\n return executeCallback(null, documentString);\n case TurtleContentType:\n case TurtleLegacyContentType:\n sz.setFlags('si'); // Suppress = for sameAs and => for implies\n documentString = sz.statementsToN3(newSts);\n return executeCallback(null, documentString);\n case NTriplesContentType:\n sz.setFlags('deinprstux'); // Suppress nice parts of N3 to make ntriples\n documentString = sz.statementsToNTriples(newSts);\n return executeCallback(null, documentString);\n case JSONLDContentType:\n sz.setFlags('si dr'); // turtle + dr (means no default, no relative prefix)\n documentString = sz.statementsToJsonld(newSts); // convert via turtle\n return executeCallback(null, documentString);\n case NQuadsContentType:\n case NQuadsAltContentType:\n // @@@ just outpout the quads? Does not work for collections\n sz.setFlags('deinprstux q'); // Suppress nice parts of N3 to make ntriples\n documentString = sz.statementsToNTriples(newSts); // q in flag means actually quads\n return executeCallback(null, documentString);\n default:\n throw new Error('Serialize: Content-type ' + contentType + ' not supported for data write.');\n }\n } catch (err) {\n if (callback) {\n // @ts-ignore\n return callback(err, undefined);\n }\n throw err; // Don't hide problems from caller in sync mode\n }\n function executeCallback(err, result) {\n if (callback) {\n callback(err, result);\n return;\n } else {\n return result;\n }\n }\n}","import log from './log';\nimport { docpart } from './uri';\nimport { string_startswith } from './utils-js';\n/** RDF/JS spec Typeguards */\n\n/**\n * Loads ontologies of the data we load (this is the callback from the kb to\n * the fetcher).\n */\nexport function AJAR_handleNewTerm(kb, p, requestedBy) {\n var sf = null;\n if (typeof kb.fetcher !== 'undefined') {\n sf = kb.fetcher;\n } else {\n return;\n }\n if (p.termType !== 'NamedNode') return;\n var docuri = docpart(p.uri);\n var fixuri;\n if (p.uri.indexOf('#') < 0) {\n // No hash\n // @@ major hack for dbpedia Categories, which spread indefinitely\n if (string_startswith(p.uri, 'http://dbpedia.org/resource/Category:')) return;\n\n /*\n if (string_startswith(p.uri, 'http://xmlns.com/foaf/0.1/')) {\n fixuri = \"http://dig.csail.mit.edu/2005/ajar/ajaw/test/foaf\"\n // should give HTTP 303 to ontology -- now is :-)\n } else\n */\n if (string_startswith(p.uri, 'http://purl.org/dc/elements/1.1/') || string_startswith(p.uri, 'http://purl.org/dc/terms/')) {\n fixuri = 'http://dublincore.org/2005/06/13/dcq';\n // dc fetched multiple times\n } else if (string_startswith(p.uri, 'http://xmlns.com/wot/0.1/')) {\n fixuri = 'http://xmlns.com/wot/0.1/index.rdf';\n } else if (string_startswith(p.uri, 'http://web.resource.org/cc/')) {\n // log.warn(\"creative commons links to html instead of rdf. doesn't seem to content-negotiate.\")\n fixuri = 'http://web.resource.org/cc/schema.rdf';\n }\n }\n if (fixuri) {\n docuri = fixuri;\n }\n if (sf && sf.getState(docuri) !== 'unrequested') return;\n if (fixuri) {\n // only give warning once: else happens too often\n log.warn('Assuming server still broken, faking redirect of <' + p.uri + '> to <' + docuri + '>');\n }\n return sf.fetch(docuri, {\n referringTerm: requestedBy\n });\n}\nexport const appliedFactoryMethods = ['blankNode', 'defaultGraph', 'literal', 'namedNode', 'quad', 'variable', 'supports'];\nconst rdf = {\n first: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first',\n rest: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest',\n nil: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'\n};\n\n/**\n * Expands an array of Terms to a set of statements representing the rdf:list.\n * @param rdfFactory - The factory to use\n * @param subject - The iri of the first list item.\n * @param data - The terms to expand into the list.\n * @return The {data} as a set of statements.\n */\nexport function arrayToStatements(rdfFactory, subject, data) {\n const statements = [];\n data.reduce((id, _listObj, i, listData) => {\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.first), listData[i]));\n let nextNode;\n if (i < listData.length - 1) {\n nextNode = rdfFactory.blankNode();\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.rest), nextNode));\n } else {\n statements.push(rdfFactory.quad(id, rdfFactory.namedNode(rdf.rest), rdfFactory.namedNode(rdf.nil)));\n }\n return nextNode;\n }, subject);\n return statements;\n}\nexport function ArrayIndexOf(arr, item) {\n let i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var length = arr.length;\n if (i < 0) i = length + i;\n for (; i < length; i++) {\n if (arr[i] === item) {\n return i;\n }\n }\n return -1;\n}","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport ClassOrder from './class-order';\nimport Collection from './collection';\nimport CanonicalDataFactory from './factories/canonical-data-factory';\nimport log from './log';\nimport Namespace from './namespace';\nimport Node from './node-internal';\nimport serialize from './serialize';\nimport { GraphTermType } from './types';\nimport { isStatement } from './utils/terms';\nimport Variable from './variable';\nimport { appliedFactoryMethods, arrayToStatements } from './utils';\nimport NamedNode from './named-node';\n/**\n * A formula, or store of RDF statements\n */\nexport default class Formula extends Node {\n /**\n * Initializes this formula\n * @constructor\n * @param statements - Initial array of statements\n * @param constraints - initial array of constraints\n * @param initBindings - initial bindings used in Query\n * @param optional - optional\n * @param opts\n * @param opts.rdfFactory - The rdf factory that should be used by the store\n */\n constructor() {\n var _this;\n let statements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n let constraints = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n let initBindings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n let optional = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];\n let opts = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n super('');\n _this = this;\n this.statements = statements;\n this.constraints = constraints;\n this.initBindings = initBindings;\n this.optional = optional;\n _defineProperty(this, \"termType\", GraphTermType);\n _defineProperty(this, \"classOrder\", ClassOrder.Graph);\n /**\n * The accompanying fetcher instance.\n *\n * Is set by the fetcher when initialized.\n */\n _defineProperty(this, \"fetcher\", void 0);\n _defineProperty(this, \"isVar\", 0);\n /**\n * A namespace for the specified namespace's URI\n * @param nsuri The URI for the namespace\n */\n _defineProperty(this, \"ns\", Namespace);\n /** The factory used to generate statements and terms */\n _defineProperty(this, \"rdfFactory\", void 0);\n this.rdfFactory = opts && opts.rdfFactory || CanonicalDataFactory;\n // Enable default factory methods on this while preserving factory context.\n for (const factoryMethod of appliedFactoryMethods) {\n this[factoryMethod] = function () {\n return _this.rdfFactory[factoryMethod](...arguments);\n };\n }\n }\n\n /** Add a statement from its parts\n * @param subject - the first part of the statement\n * @param predicate - the second part of the statement\n * @param object - the third part of the statement\n * @param graph - the last part of the statement\n */\n add(subject, predicate, object, graph) {\n if (arguments.length === 1) {\n subject.forEach(st => this.add(st.subject, st.predicate, st.object, st.graph));\n }\n return this.statements.push(this.rdfFactory.quad(subject, predicate, object, graph));\n }\n\n /** Add a statment object\n * @param {Statement} statement - An existing constructed statement to add\n */\n addStatement(statement) {\n return this.add(statement);\n }\n\n /**\n * Shortcut for adding blankNodes\n * @param [id]\n */\n bnode(id) {\n return this.rdfFactory.blankNode(id);\n }\n\n /**\n * Adds all the statements to this formula\n * @param statements - A collection of statements\n */\n addAll(statements) {\n statements.forEach(quad => {\n this.add(quad.subject, quad.predicate, quad.object, quad.graph);\n });\n }\n\n /** Follow link from one node, using one wildcard, looking for one\n *\n * For example, any(me, knows, null, profile) - a person I know accoring to my profile .\n * any(me, knows, null, null) - a person I know accoring to anything in store .\n * any(null, knows, me, null) - a person who know me accoring to anything in store .\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @returns A node which match the wildcard position, or null\n */\n any(s, p, o, g) {\n const st = this.anyStatementMatching(s, p, o, g);\n if (st == null) {\n return null;\n } else if (s == null) {\n return st.subject;\n } else if (p == null) {\n return st.predicate;\n } else if (o == null) {\n return st.object;\n }\n return null;\n }\n\n /**\n * Gets the value of a node that matches the specified pattern\n * @param s The subject\n * @param p The predicate\n * @param o The object\n * @param g The graph that contains the statement\n */\n anyValue(s, p, o, g) {\n const y = this.any(s, p, o, g);\n return y ? y.value : void 0;\n }\n\n /**\n * Gets the first JavaScript object equivalent to a node based on the specified pattern\n * @param s The subject\n * @param p The predicate\n * @param o The object\n * @param g The graph that contains the statement\n */\n anyJS(s, p, o, g) {\n const y = this.any(s, p, o, g);\n return y ? Node.toJS(y) : void 0;\n }\n\n /**\n * Gets the first statement that matches the specified pattern\n */\n anyStatementMatching(s, p, o, g) {\n let x = this.statementsMatching(s, p, o, g, true);\n if (!x || x.length === 0) {\n return undefined;\n }\n return x[0];\n }\n\n /**\n * Returns a unique index-safe identifier for the given term.\n *\n * Falls back to the rdflib hashString implementation if the given factory doesn't support id.\n */\n id(term) {\n return this.rdfFactory.id(term);\n }\n\n /**\n * Search the Store\n * This is really a teaching method as to do this properly you would use IndexedFormula\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @param justOne - flag - stop when found one rather than get all of them?\n * @returns {Array<Node>} - An array of nodes which match the wildcard position\n */\n statementsMatching(s, p, o, g, justOne) {\n const sts = this.statements.filter(st => (!s || s.equals(st.subject)) && (!p || p.equals(st.predicate)) && (!o || o.equals(st.object)) && (!g || g.equals(st.graph)));\n if (justOne) {\n return sts.length === 0 ? [] : [sts[0]];\n }\n return sts;\n }\n\n /**\n * Finds the types in the list which have no *stored* subtypes\n * These are a set of classes which provide by themselves complete\n * information -- the other classes are redundant for those who\n * know the class DAG.\n * @param types A map of the types\n */\n bottomTypeURIs(types) {\n let bots;\n let bottom;\n let elt;\n let i;\n let len;\n let ref;\n let subs;\n let v;\n bots = [];\n for (let k in types) {\n if (!types.hasOwnProperty(k)) continue;\n v = types[k];\n subs = this.each(void 0, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), this.rdfFactory.namedNode(k));\n bottom = true;\n i = 0;\n for (len = subs.length; i < len; i++) {\n elt = subs[i];\n ref = elt.uri;\n if (ref in types) {\n // the subclass is one we know\n bottom = false;\n break;\n }\n }\n if (bottom) {\n bots[k] = v;\n }\n }\n return bots;\n }\n\n /** Creates a new collection */\n collection() {\n return new Collection();\n }\n\n /** Follow links from one node, using one wildcard.\n *\n * For example, each(me, knows, null, profile) - people I know accoring to my profile .\n * each(me, knows, null, null) - people I know accoring to anything in store .\n * each(null, knows, me, null) - people who know me accoring to anything in store .\n *\n * @param s - A node to search for as subject, or if null, a wildcard\n * @param p - A node to search for as predicate, or if null, a wildcard\n * @param o - A node to search for as object, or if null, a wildcard\n * @param g - A node to search for as graph, or if null, a wildcard\n * @returns {Array<Node>} - An array of nodes which match the wildcard position\n */\n each(s, p, o, g) {\n const results = [];\n let sts = this.statementsMatching(s, p, o, g, false);\n if (s == null) {\n for (let i = 0, len = sts.length; i < len; i++) {\n results.push(sts[i].subject);\n }\n } else if (p == null) {\n for (let l = 0, len1 = sts.length; l < len1; l++) {\n results.push(sts[l].predicate);\n }\n } else if (o == null) {\n for (let m = 0, len2 = sts.length; m < len2; m++) {\n results.push(sts[m].object);\n }\n } else if (g == null) {\n for (let q = 0, len3 = sts.length; q < len3; q++) {\n results.push(new NamedNode(sts[q].graph.value));\n }\n }\n return results;\n }\n\n /**\n * Test whether this formula is equals to {other}\n * @param other - The other formula\n */\n equals(other) {\n if (!other) {\n return false;\n }\n return this.hashString() === other.hashString();\n }\n\n /**\n * For thisClass or any subclass, anything which has it is its type\n * or is the object of something which has the type as its range, or subject\n * of something which has the type as its domain\n * We don't bother doing subproperty (yet?)as it doesn't seeem to be used\n * much.\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * @return a hash of URIs\n */\n findMembersNT(thisClass) {\n let len2;\n let len4;\n let m;\n let members;\n let pred;\n let ref;\n let ref1;\n let ref2;\n let ref3;\n let ref4;\n let ref5;\n let seeds;\n let st;\n let u;\n seeds = {};\n seeds[thisClass.toNT()] = true;\n members = {};\n ref = this.transitiveClosure(seeds, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), true);\n for (let t in ref) {\n if (!ref.hasOwnProperty(t)) continue;\n ref1 = this.statementsMatching(void 0, this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), this.fromNT(t));\n for (let i = 0, len = ref1.length; i < len; i++) {\n st = ref1[i];\n members[st.subject.toNT()] = st;\n }\n ref2 = this.each(void 0, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#domain'), this.fromNT(t));\n for (let l = 0, len1 = ref2.length; l < len1; l++) {\n pred = ref2[l];\n ref3 = this.statementsMatching(void 0, pred);\n for (m = 0, len2 = ref3.length; m < len2; m++) {\n st = ref3[m];\n members[st.subject.toNT()] = st;\n }\n }\n ref4 = this.each(void 0, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#range'), this.fromNT(t));\n for (let q = 0, len3 = ref4.length; q < len3; q++) {\n pred = ref4[q];\n ref5 = this.statementsMatching(void 0, pred);\n for (u = 0, len4 = ref5.length; u < len4; u++) {\n st = ref5[u];\n members[st.object.toNT()] = st;\n }\n }\n }\n return members;\n }\n\n /**\n * For thisClass or any subclass, anything which has it is its type\n * or is the object of something which has the type as its range, or subject\n * of something which has the type as its domain\n * We don't bother doing subproperty (yet?)as it doesn't seeem to be used\n * much.\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * @param subject - A named node\n */\n findMemberURIs(subject) {\n return this.NTtoURI(this.findMembersNT(subject));\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a superclass\n * Returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findSubClassesNT(subject) {\n let types = {};\n types[subject.toNT()] = true;\n return this.transitiveClosure(types, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), true);\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a subclass\n * @param {RDFlibNamedNode} subject - The thing whose classes are to be found\n * @returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findSuperClassesNT(subject) {\n let types = {};\n types[subject.toNT()] = true;\n return this.transitiveClosure(types, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), false);\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * todo: This will loop is there is a class subclass loop (Sublass loops are\n * not illegal)\n * @param {RDFlibNamedNode} subject - The thing whose classes are to be found\n * @returns a hash table where key is NT of type and value is statement why we think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n */\n findTypesNT(subject) {\n let domain;\n let range;\n let rdftype;\n let ref;\n let ref1;\n let ref2;\n let ref3;\n let st;\n let types;\n rdftype = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';\n types = [];\n ref = this.statementsMatching(subject, void 0, void 0);\n for (let i = 0, len = ref.length; i < len; i++) {\n st = ref[i];\n if (st.predicate.uri === rdftype) {\n types[st.object.toNT()] = st;\n } else {\n ref1 = this.each(st.predicate, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#domain'));\n for (let l = 0, len1 = ref1.length; l < len1; l++) {\n range = ref1[l];\n types[range.toNT()] = st;\n }\n }\n }\n ref2 = this.statementsMatching(void 0, void 0, subject);\n for (let m = 0, len2 = ref2.length; m < len2; m++) {\n st = ref2[m];\n ref3 = this.each(st.predicate, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#range'));\n for (let q = 0, len3 = ref3.length; q < len3; q++) {\n domain = ref3[q];\n types[domain.toNT()] = st;\n }\n }\n return this.transitiveClosure(types, this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'), false);\n }\n\n /**\n * Get all the Classes of which we can RDFS-infer the subject is a member\n * todo: This will loop is there is a class subclass loop (Sublass loops are\n * not illegal)\n * Returns a hash table where key is NT of type and value is statement why we\n * think so.\n * Does NOT return terms, returns URI strings.\n * We use NT representations in this version because they handle blank nodes.\n * @param subject - A subject node\n */\n findTypeURIs(subject) {\n return this.NTtoURI(this.findTypesNT(subject));\n }\n\n /** Trace statements which connect directly, or through bnodes\n *\n * @param subject - The node to start looking for statments\n * @param doc - The document to be searched, or null to search all documents\n * @returns an array of statements, duplicate statements are suppresssed.\n */\n connectedStatements(subject, doc, excludePredicateURIs) {\n excludePredicateURIs = excludePredicateURIs || [];\n let todo = [subject];\n let done = {};\n let doneArcs = {};\n let result = [];\n let self = this;\n let follow = function (x) {\n let queue = function (x) {\n if (x.termType === 'BlankNode' && !done[x.value]) {\n done[x.value] = true;\n todo.push(x);\n }\n };\n let sts = self.statementsMatching(null, null, x, doc).concat(self.statementsMatching(x, null, null, doc));\n sts = sts.filter(function (st) {\n if (excludePredicateURIs[st.predicate.value]) return false;\n let hash = st.toNT();\n if (doneArcs[hash]) return false;\n doneArcs[hash] = true;\n return true;\n });\n sts.forEach(function (st) {\n queue(st.subject);\n queue(st.object);\n });\n result = result.concat(sts);\n };\n while (todo.length) {\n follow(todo.shift());\n }\n return result;\n }\n\n /**\n * Creates a new empty formula\n *\n * @param _features - Not applicable, but necessary for typing to pass\n */\n formula(_features) {\n return new Formula();\n }\n\n /**\n * Transforms an NTriples string format into a Node.\n * The blank node bit should not be used on program-external values; designed\n * for internal work such as storing a blank node id in an HTML attribute.\n * This will only parse the strings generated by the various toNT() methods.\n */\n fromNT(str) {\n let dt, k, lang;\n switch (str[0]) {\n case '<':\n return this.sym(str.slice(1, -1));\n case '\"':\n lang = void 0;\n dt = void 0;\n k = str.lastIndexOf('\"');\n if (k < str.length - 1) {\n if (str[k + 1] === '@') {\n lang = str.slice(k + 2);\n } else if (str.slice(k + 1, k + 3) === '^^') {\n dt = this.fromNT(str.slice(k + 3));\n } else {\n throw new Error(\"Can't convert string from NT: \" + str);\n }\n }\n str = str.slice(1, k);\n str = str.replace(/\\\\\"/g, '\"');\n str = str.replace(/\\\\n/g, '\\n');\n str = str.replace(/\\\\\\\\/g, '\\\\');\n return this.rdfFactory.literal(str, lang || dt);\n case '_':\n return this.rdfFactory.blankNode(str.slice(2));\n case '?':\n return new Variable(str.slice(1));\n }\n throw new Error(\"Can't convert from NT: \" + str);\n }\n\n /** Returns true if this formula holds the specified statement(s) */\n holds(s, p, o, g) {\n let i;\n if (arguments.length === 1) {\n if (!s) {\n return true;\n }\n if (s instanceof Array) {\n for (i = 0; i < s.length; i++) {\n if (!this.holds(s[i])) {\n return false;\n }\n }\n return true;\n } else if (isStatement(s)) {\n return this.holds(s.subject, s.predicate, s.object, s.graph);\n } else if (s.statements) {\n return this.holds(s.statements);\n }\n }\n let st = this.anyStatementMatching(s, p, o, g);\n return st != null;\n }\n\n /**\n * Returns true if this formula holds the specified {statement}\n */\n holdsStatement(statement) {\n return this.holds(statement.subject, statement.predicate, statement.object, statement.graph);\n }\n\n /**\n * Used by the n3parser to generate list elements\n * @param values - The values of the collection\n * @param context - The store\n * @return {BlankNode|Collection} - The term for the statement\n */\n list(values, context) {\n if (context.rdfFactory.supports[\"COLLECTIONS\"]) {\n const collection = context.rdfFactory.collection();\n values.forEach(function (val) {\n collection.append(val);\n });\n return collection;\n } else {\n const node = context.rdfFactory.blankNode();\n const statements = arrayToStatements(context.rdfFactory, node, values);\n context.addAll(statements);\n return node;\n }\n }\n\n /**\n * Transform a collection of NTriple URIs into their URI strings\n * @param t - Some iterable collection of NTriple URI strings\n * @return A collection of the URIs as strings\n * todo: explain why it is important to go through NT\n */\n NTtoURI(t) {\n let k, v;\n let uris = {};\n for (k in t) {\n if (!t.hasOwnProperty(k)) continue;\n v = t[k];\n if (k[0] === '<') {\n uris[k.slice(1, -1)] = v;\n }\n }\n return uris;\n }\n\n /**\n * Serializes this formula\n * @param base - The base string\n * @param contentType - The content type of the syntax to use\n * @param provenance - The provenance URI\n * @param options - options to pass to the serializer, as defined in serialize method\n */\n serialize(base, contentType, provenance, options) {\n // delegate the graph serialization to the implementation in ./serialize\n return serialize(provenance, this, base, contentType, undefined, options);\n }\n\n /**\n * Creates a new formula with the substituting bindings applied\n * @param bindings - The bindings to substitute\n */\n substitute(bindings) {\n let statementsCopy = this.statements.map(function (ea) {\n return ea.substitute(bindings);\n });\n // console.log('Formula subs statmnts:' + statementsCopy)\n const y = new Formula();\n y.addAll(statementsCopy);\n // console.log('indexed-form subs formula:' + y)\n return y;\n }\n sym(uri, name) {\n if (name) {\n throw new Error('This feature (kb.sym with 2 args) is removed. Do not assume prefix mappings.');\n }\n return this.rdfFactory.namedNode(uri);\n }\n\n /**\n * Gets the node matching the specified pattern. Throws when no match could be made.\n * @param s - The subject\n * @param p - The predicate\n * @param o - The object\n * @param g - The graph that contains the statement\n */\n the(s, p, o, g) {\n let x = this.any(s, p, o, g);\n if (x == null) {\n log.error('No value found for the() {' + s + ' ' + p + ' ' + o + '}.');\n }\n return x;\n }\n\n /**\n * RDFS Inference\n * These are hand-written implementations of a backward-chaining reasoner\n * over the RDFS axioms.\n * @param seeds - A hash of NTs of classes to start with\n * @param predicate - The property to trace though\n * @param inverse - Trace inverse direction\n */\n transitiveClosure(seeds, predicate, inverse) {\n let elt, i, len, s, sups, t;\n let agenda = {};\n Object.assign(agenda, seeds); // make a copy\n let done = {}; // classes we have looked up\n while (true) {\n t = function () {\n for (let p in agenda) {\n if (!agenda.hasOwnProperty(p)) continue;\n return p;\n }\n }();\n if (t == null) {\n return done;\n }\n sups = inverse ? this.each(void 0, predicate, this.fromNT(t)) : this.each(this.fromNT(t), predicate);\n for (i = 0, len = sups.length; i < len; i++) {\n elt = sups[i];\n s = elt.toNT();\n if (s in done) {\n continue;\n }\n if (s in agenda) {\n continue;\n }\n agenda[s] = agenda[t];\n }\n done[t] = agenda[t];\n delete agenda[t];\n }\n }\n\n /**\n * Finds the types in the list which have no *stored* supertypes\n * We exclude the universal class, owl:Things and rdf:Resource, as it is\n * information-free.\n * @param types - The types\n */\n topTypeURIs(types) {\n let i;\n let j;\n let k;\n let len;\n let n;\n let ref;\n let tops;\n let v;\n tops = [];\n for (k in types) {\n if (!types.hasOwnProperty(k)) continue;\n v = types[k];\n n = 0;\n ref = this.each(this.rdfFactory.namedNode(k), this.rdfFactory.namedNode('http://www.w3.org/2000/01/rdf-schema#subClassOf'));\n for (i = 0, len = ref.length; i < len; i++) {\n j = ref[i];\n if (j.uri !== 'http://www.w3.org/2000/01/rdf-schema#Resource') {\n n++;\n break;\n }\n }\n if (!n) {\n tops[k] = v;\n }\n }\n if (tops['http://www.w3.org/2000/01/rdf-schema#Resource']) {\n delete tops['http://www.w3.org/2000/01/rdf-schema#Resource'];\n }\n if (tops['http://www.w3.org/2002/07/owl#Thing']) {\n delete tops['http://www.w3.org/2002/07/owl#Thing'];\n }\n return tops;\n }\n\n /**\n * Serializes this formula to a string\n */\n toString() {\n return '{' + this.statements.join('\\n') + '}';\n }\n\n /**\n * Gets a new variable\n * @param name - The variable's name\n */\n variable(name) {\n return new Variable(name);\n }\n\n /**\n * Gets the number of statements in this formula that matches the specified pattern\n * @param s - The subject\n * @param p - The predicate\n * @param o - The object\n * @param g - The graph that contains the statement\n */\n whether(s, p, o, g) {\n return this.statementsMatching(s, p, o, g, false).length;\n }\n}","// This file attaches all functionality to Node\n// that would otherwise require circular dependencies.\nimport { fromValue } from './collection';\nimport Node from './node-internal';\nimport Namespace from './namespace';\nimport { isCollection, isLiteral } from './utils/terms';\n/**\n * Creates an RDF Node from a native javascript value.\n * RDF Nodes are returned unchanged, undefined returned as itself.\n * @method fromValue\n * @static\n * @param value {Node|Date|String|Number|Boolean|Undefined}\n * @return {Node|Collection}\n */\nNode.fromValue = fromValue;\nexport default Node;\nconst ns = {\n xsd: Namespace('http://www.w3.org/2001/XMLSchema#')\n};\n\n/**\n * Gets the javascript object equivalent to a node\n * @param term The RDF node\n */\nNode.toJS = function (term) {\n if (isCollection(term)) {\n return term.elements.map(Node.toJS); // Array node (not standard RDFJS)\n }\n if (!isLiteral(term)) return term;\n if (term.datatype.equals(ns.xsd('boolean'))) {\n return term.value === '1' || term.value === 'true';\n }\n if (term.datatype.equals(ns.xsd('dateTime')) || term.datatype.equals(ns.xsd('date'))) {\n return new Date(term.value);\n }\n if (term.datatype.equals(ns.xsd('integer')) || term.datatype.equals(ns.xsd('float')) || term.datatype.equals(ns.xsd('decimal'))) {\n return Number(term.value);\n }\n return term.value;\n};","// Matching a formula against another formula\n// Assync as well as Synchronously\n//\n// W3C open source licence 2005.\n//\n// This builds on term.js, match.js (and identity.js?)\n// to allow a query of a formula.\n//\n// Here we introduce for the first time a subclass of term: variable.\n//\n// SVN ID: $Id: query.js 25116 2008-11-15 16:13:48Z timbl $\n\n// Variable\n//\n// Compare with BlankNode. They are similar, but a variable\n// stands for something whose value is to be returned.\n// Also, users name variables and want the same name back when stuff is printed\n/* jsl:option explicit */ // Turn on JavaScriptLint variable declaration checking\n\nimport IndexedFormula from './store';\nimport { defaultGraphURI as defaultDocumentURI } from './utils/default-graph-uri';\nimport log from './log';\nimport { docpart } from './uri';\n\n/**\n * Query class, for tracking queries the user has in the UI.\n */\nexport class Query {\n constructor(name, id) {\n this.pat = new IndexedFormula(); // The pattern to search for\n this.vars = []; // Used by UI code but not in query.js\n // this.orderBy = [] // Not used yet\n this.name = name;\n this.id = id;\n }\n}\n\n/**\n * This function will match a pattern to the current Store\n *\n * The callback function is called whenever a match is found\n * When fetcher is supplied this will be called to load from the web\n * any new nodes as they are discovered. This will cause the query to traverse the\n * graph of linked data, sometimes called \"Link Following Query\"\n *\n * @param myQuery - a knowledgebase containing a pattern to use as query\n * @param callback - whenever the pattern in myQuery is met this is called with\n * the new bindings as parameter\n * @param fetcher? - If and only if, you want link following, give a fetcher\n * which has been created for the quadstore being queried.\n * @param onDone - callback when query finished\n */\nexport function indexedFormulaQuery(myQuery, callback, fetcher, onDone) {\n /** Debug strings\n */\n function bindingDebug(b) {\n var str = '';\n var v;\n for (v in b) {\n if (b.hasOwnProperty(v)) {\n str += ' ' + v + ' -> ' + b[v];\n }\n }\n return str;\n }\n function bindingsDebug(nbs) {\n var str = 'Bindings: ';\n var i;\n var n = nbs.length;\n for (i = 0; i < n; i++) {\n str += bindingDebug(nbs[i][0]) + ';\\n\\t';\n }\n return str;\n } // bindingsDebug\n\n /** Unification\n *\n * Unification finds all bindings such that when the binding is applied\n * to one term it is equal to the other.\n * @returns {Arrray}- a list of bindings, where a binding is an associative array\n * mapping variuable to value.\n */\n function unifyTerm(self, other, bindings, formula) {\n var actual = bindings[self];\n if (actual === undefined) {\n // Not mapped\n if (self.isVar) {\n var b = [];\n b[self] = other;\n return [[b, null]]; // Match\n }\n actual = self;\n }\n if (!actual.complexType) {\n if (formula.redirections[actual]) {\n actual = formula.redirections[actual];\n }\n if (formula.redirections[other]) {\n other = formula.redirections[other];\n }\n if (actual.equals(other) || actual.uri && actual.uri === defaultDocumentURI) {\n // Used to mean 'any graph' in a query\n return [[[], null]];\n }\n return [];\n }\n if (self instanceof Array) {\n if (!(other instanceof Array)) {\n return [];\n }\n return unifyContents(self, other, bindings);\n }\n throw new Error('query.js: oops - code not written yet');\n // return undefined; // for lint - no jslint objects to unreachables\n // return actual.unifyContents(other, bindings)\n } // unifyTerm\n\n function unifyContents(self, other, bindings, formula) {\n var nbs2;\n if (self.length !== other.length) {\n return []; // no way\n }\n if (!self.length) {\n return [[[], null]]; // Success\n }\n var nbs = unifyTerm(self[0], other[0], bindings, formula);\n if (nbs.length === 0) {\n return nbs;\n }\n var res = [];\n var i;\n var n = nbs.length;\n var nb;\n var j;\n var m;\n var v;\n var nb2;\n var bindings2;\n for (i = 0; i < n; i++) {\n // for each possibility from the first term\n nb = nbs[i][0]; // new bindings\n bindings2 = [];\n for (v in nb) {\n if (nb.hasOwnProperty(v)) {\n bindings2[v] = nb[v]; // copy\n }\n }\n for (v in bindings) {\n if (bindings.hasOwnProperty(v)) {\n bindings2[v] = bindings[v]; // copy\n }\n }\n nbs2 = unifyContents(self.slice(1), other.slice(1), bindings2, formula);\n m = nbs2.length;\n for (j = 0; j < m; j++) {\n nb2 = nbs2[j][0]; // @@@@ no idea whether this is used or right\n for (v in nb) {\n if (nb.hasOwnProperty(v)) {\n nb2[v] = nb[v];\n }\n }\n res.push([nb2, null]);\n }\n }\n return res;\n } // unifyContents\n\n // Matching\n //\n // Matching finds all bindings such that when the binding is applied\n // to one term it is equal to the other term. We only match formulae.\n\n /** if x is not in the bindings array, return the var; otherwise, return the bindings **/\n function bind(x, binding) {\n var y = binding[x];\n if (y === undefined) {\n return x;\n }\n return y;\n }\n\n // When there are OPTIONAL clauses, we must return bindings without them if none of them\n // succeed. However, if any of them do succeed, we should not. (This is what branchCount()\n // tracked. The problem currently is (2011/7) that when several optionals exist, and they\n // all match, multiple sets of bindings are returned, each with one optional filled in.)\n\n function union(a, b) {\n var c = {};\n var x;\n for (x in a) {\n if (a.hasOwnProperty(x)) {\n c[x] = a[x];\n }\n }\n for (x in b) {\n if (b.hasOwnProperty(x)) {\n c[x] = b[x];\n }\n }\n return c;\n }\n function OptionalBranchJunction(originalCallback, trunkBindings) {\n this.trunkBindings = trunkBindings;\n this.originalCallback = originalCallback;\n this.branches = [];\n // this.results = []; // result[i] is an array of bindings for branch i\n // this.done = {}; // done[i] means all/any results are in for branch i\n // this.count = {}\n return this;\n }\n OptionalBranchJunction.prototype.checkAllDone = function () {\n var i;\n for (i = 0; i < this.branches.length; i++) {\n if (!this.branches[i].done) {\n return;\n }\n }\n log.debug('OPTIONAL BIDNINGS ALL DONE:');\n this.doCallBacks(this.branches.length - 1, this.trunkBindings);\n };\n // Recrursively generate the cross product of the bindings\n OptionalBranchJunction.prototype.doCallBacks = function (b, bindings) {\n var j;\n if (b < 0) {\n return this.originalCallback(bindings);\n }\n for (j = 0; j < this.branches[b].results.length; j++) {\n this.doCallBacks(b - 1, union(bindings, this.branches[b].results[j]));\n }\n };\n\n // A mandatory branch is the normal one, where callbacks\n // are made immediately and no junction is needed.\n // Might be useful for onFinsihed callback for query API.\n function MandatoryBranch(callback, onDone) {\n this.count = 0;\n this.success = false;\n this.done = false;\n // this.results = []\n this.callback = callback;\n this.onDone = onDone;\n // this.junction = junction\n // junction.branches.push(this)\n return this;\n }\n MandatoryBranch.prototype.reportMatch = function (bindings) {\n // log.error(\"@@@@ query.js 1\"); // @@\n this.callback(bindings);\n this.success = true;\n };\n MandatoryBranch.prototype.reportDone = function () {\n this.done = true;\n log.info('Mandatory query branch finished.***');\n if (this.onDone !== undefined) {\n this.onDone();\n }\n };\n\n // An optional branch hoards its results.\n var OptionalBranch = function (junction) {\n this.count = 0;\n this.done = false;\n this.results = [];\n this.junction = junction;\n junction.branches.push(this);\n return this;\n };\n OptionalBranch.prototype.reportMatch = function (bindings) {\n this.results.push(bindings);\n };\n OptionalBranch.prototype.reportDone = function () {\n log.debug('Optional branch finished - results.length = ' + this.results.length);\n if (this.results.length === 0) {\n // This is what optional means: if no hits,\n this.results.push({}); // mimic success, but with no bindings\n log.debug(\"Optional branch FAILED - that's OK.\");\n }\n this.done = true;\n this.junction.checkAllDone();\n };\n\n /** prepare -- sets the index of the item to the possible matches\n * @param f - formula\n * @param item - an Statement, possibly w/ vars in it\n * @param bindings - Bindings so far\n * @returns false if the query fails -- there are no items that match\n */\n function prepare(f, item, bindings) {\n var terms, termIndex, i, ind;\n item.nvars = 0;\n item.index = null;\n // if (!f.statements) log.warn(\"@@@ prepare: f is \"+f)\n // log.debug(\"Prepare: f has \"+ f.statements.length)\n // log.debug(\"Prepare: Kb size \"+f.statements.length+\" Preparing \"+item)\n\n terms = [item.subject, item.predicate, item.object, item.why];\n ind = [f.subjectIndex, f.predicateIndex, f.objectIndex, f.whyIndex];\n for (i = 0; i < 4; i++) {\n let t = terms[i];\n // console.log(\" Prepare (\" + t + \") \"+(t in bindings))\n if (t.uri && t.uri === defaultDocumentURI) {// chrome:session\n // console.log(' query: Ignoring slot ' + i)\n } else if (t.isVar && !(bindings[t] !== undefined)) {\n item.nvars++;\n } else {\n t = bind(terms[i], bindings); // returns the RDF binding if bound, otherwise itself\n // if (terms[i]!=bind(terms[i],bindings) alert(\"Term: \"+terms[i]+\"Binding: \"+bind(terms[i], bindings))\n if (f.redirections[f.id(t)]) {\n t = f.redirections[f.id(t)]; // redirect\n }\n termIndex = ind[i][f.id(t)];\n if (!termIndex) {\n item.index = [];\n return false; // Query line cannot match\n }\n if (item.index === null || item.index.length > termIndex.length) {\n // Find smallest index\n item.index = termIndex;\n }\n }\n }\n if (item.index === null) {\n // All 4 are variables?\n item.index = f.statements;\n }\n return true;\n } // prepare\n\n /** sorting function -- negative if self is easier **/\n // We always prefer to start with a URI to be able to browse a graph\n // this is why we put off items with more variables till later.\n function easiestQuery(self, other) {\n if (self.nvars !== other.nvars) {\n return self.nvars - other.nvars;\n }\n return self.index.length - other.index.length;\n }\n var matchIndex = 0; // index\n /** matches a pattern formula against the knowledge base, e.g. to find matches for table-view\n *\n * @param f - knowledge base formula\n * @param g - pattern formula (may have vars)\n * @param bindingsSoFar - bindings accumulated in matching to date\n * @param level - spaces to indent stuff also lets you know what level of recursion you're at\n * @param fetcher - function (term, requestedBy) If you want link following\n * @param localCallback - function(bindings, pattern, branch) called on sucess\n * @returns nothing\n *\n * Will fetch linked data from the web iff the knowledge base an associated source fetcher (f.fetcher)\n ***/\n var match = function (f, g, bindingsSoFar, level, fetcher, localCallback, branch) {\n log.debug('Match begins, Branch count now: ' + branch.count + ' for ' + branch.pattern_debug);\n\n // log.debug(\"match: f has \"+f.statements.length+\", g has \"+g.statements.length)\n var pattern = g.statements;\n if (pattern.length === 0) {\n // when it's satisfied all the pattern triples\n log.debug('FOUND MATCH WITH BINDINGS:' + bindingDebug(bindingsSoFar));\n if (g.optional.length === 0) {\n branch.reportMatch(bindingsSoFar);\n } else {\n log.debug('OPTIONAL: ' + g.optional);\n var junction = new OptionalBranchJunction(callback, bindingsSoFar); // @@ won't work with nested optionals? nest callbacks\n var br = [];\n var b;\n for (b = 0; b < g.optional.length; b++) {\n br[b] = new OptionalBranch(junction); // Allocate branches to prevent premature ending\n br[b].pattern_debug = g.optional[b]; // for diagnotics only\n }\n for (b = 0; b < g.optional.length; b++) {\n br[b].count = br[b].count + 1; // Count how many matches we have yet to complete\n match(f, g.optional[b], bindingsSoFar, '', fetcher, callback, br[b]);\n }\n }\n branch.count--;\n log.debug('Match ends -- success , Branch count now: ' + branch.count + ' for ' + branch.pattern_debug);\n return; // Success\n }\n var item;\n var i;\n var n = pattern.length;\n // log.debug(level + \"Match \"+n+\" left, bs so far:\"+bindingDebug(bindingsSoFar))\n\n // Follow links from variables in query\n if (fetcher) {\n // Fetcher is used to fetch URIs, function first term is a URI term, second is the requester\n var id = 'match' + matchIndex++;\n var fetchResource = function (requestedTerm, id) {\n var docuri = requestedTerm.uri.split('#')[0];\n fetcher.nowOrWhenFetched(docuri, undefined, function (ok, body, xhr) {\n if (!ok) {\n console.log('Error following link to <' + requestedTerm.uri + '> in query: ' + body);\n }\n match(f, g, bindingsSoFar, level, fetcher,\n // match not match2 to look up any others necessary.\n localCallback, branch);\n });\n };\n for (i = 0; i < n; i++) {\n item = pattern[i]; // for each of the triples in the query\n if (bindingsSoFar[item.subject] !== undefined && bindingsSoFar[item.subject].uri && fetcher && fetcher.getState(docpart(bindingsSoFar[item.subject].uri)) === 'unrequested') {\n // fetch the subject info and return to id\n fetchResource(bindingsSoFar[item.subject], id);\n return; // only look up one per line this time, but we will come back again though match\n }\n if (bindingsSoFar[item.object] !== undefined && bindingsSoFar[item.object].uri && fetcher && fetcher.getState(docpart(bindingsSoFar[item.object].uri)) === 'unrequested') {\n fetchResource(bindingsSoFar[item.object], id);\n return;\n }\n }\n } // if fetcher\n match2(f, g, bindingsSoFar, level, fetcher, localCallback, branch);\n }; // match\n\n var constraintsSatisfied = function (bindings, constraints) {\n var res = true;\n var x;\n var test;\n for (x in bindings) {\n if (bindings.hasOwnProperty(x)) {\n if (constraints[x]) {\n test = constraints[x].test;\n if (test && !test(bindings[x])) {\n res = false;\n }\n }\n }\n }\n return res;\n };\n\n /** match2 -- stuff after the fetch **/\n var match2 = function (f, g, bindingsSoFar, level, fetcher, callback, branch) {\n // post fetch\n var pattern = g.statements;\n var n = pattern.length;\n var i;\n var k;\n var nk;\n var v;\n var bindings2;\n var newBindings1;\n var item;\n for (i = 0; i < n; i++) {\n // For each statement left in the query, run prepare\n item = pattern[i];\n // log.info('match2: item=' + item + ', bindingsSoFar=' + bindingDebug(bindingsSoFar))\n prepare(f, item, bindingsSoFar);\n // if (item.index) console.log(' item.index.length ' + item.index.length)\n }\n pattern.sort(easiestQuery);\n item = pattern[0];\n // log.debug(\"Sorted pattern:\\n\"+pattern)\n var rest = f.formula();\n rest.optional = g.optional;\n rest.constraints = g.constraints;\n rest.statements = pattern.slice(1); // No indexes: we will not query g.\n log.debug(level + 'match2 searching ' + item.index.length + ' for ' + item + '; bindings so far=' + bindingDebug(bindingsSoFar));\n // var results = []\n var c;\n var nc = item.index.length;\n var nbs1;\n var st;\n var onward = 0;\n // var x\n for (c = 0; c < nc; c++) {\n // For each candidate statement\n st = item.index[c]; // for each statement in the item's index, spawn a new match with that binding\n nbs1 = unifyContents([item.subject, item.predicate, item.object, item.why], [st.subject, st.predicate, st.object, st.why], bindingsSoFar, f);\n log.info(level + ' From first: ' + nbs1.length + ': ' + bindingsDebug(nbs1));\n nk = nbs1.length;\n // branch.count += nk\n // log.debug(\"Branch count bumped \"+nk+\" to: \"+branch.count)\n for (k = 0; k < nk; k++) {\n // For each way that statement binds\n bindings2 = [];\n newBindings1 = nbs1[k][0];\n if (!constraintsSatisfied(newBindings1, g.constraints)) {\n // branch.count--\n log.debug('Branch count CS: ' + branch.count);\n } else {\n for (v in newBindings1) {\n if (newBindings1.hasOwnProperty(v)) {\n bindings2[v] = newBindings1[v]; // copy\n }\n }\n for (v in bindingsSoFar) {\n if (bindingsSoFar.hasOwnProperty(v)) {\n bindings2[v] = bindingsSoFar[v]; // copy\n }\n }\n branch.count++; // Count how many matches we have yet to complete\n onward++;\n match(f, rest, bindings2, level + ' ', fetcher, callback, branch); // call match\n }\n }\n }\n branch.count--;\n if (onward === 0) {\n log.debug('Match2 fails completely on ' + item);\n }\n log.debug('Match2 ends, Branch count: ' + branch.count + ' for ' + branch.pattern_debug);\n if (branch.count === 0) {\n log.debug('Branch finished.');\n branch.reportDone();\n }\n }; // match2\n // ////////////////////////// Body of query() ///////////////////////\n var f = this;\n log.debug('Query on ' + this.statements.length);\n var trunck = new MandatoryBranch(callback, onDone);\n trunck.count++; // count one branch to complete at the moment\n if (myQuery.sync) {\n match(f, myQuery.pat, myQuery.pat.initBindings, '', fetcher, callback, trunck);\n } else {\n // Give up thread: Allow other activities to run\n setTimeout(function () {\n match(f, myQuery.pat, myQuery.pat.initBindings, '', fetcher, callback, trunck);\n }, 0);\n }\n\n // returns nothing; callback does the work\n} // query","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/* Identity management and indexing for RDF\n *\n * This file provides IndexedFormula a formula (set of triples) which\n * indexed by predicate, subject and object.\n *\n * It \"smushes\" (merges into a single node) things which are identical\n * according to owl:sameAs or an owl:InverseFunctionalProperty\n * or an owl:FunctionalProperty\n *\n *\n * 2005-10 Written Tim Berners-Lee\n * 2007 Changed so as not to munge statements from documents when smushing\n * 2019 Converted to typescript\n *\n *\n*/\n\n/** @module store */\n\nimport ClassOrder from './class-order';\nimport { defaultGraphURI } from './factories/canonical-data-factory';\nimport Formula from './formula';\nimport { ArrayIndexOf } from './utils';\nimport { RDFArrayRemove } from './utils-js';\nimport { isRDFlibSubject, isRDFlibPredicate, isRDFlibObject, isStore, isGraph,\n// isPredicate,\nisQuad\n// isSubject\n} from './utils/terms';\nimport Node from './node';\nimport Variable from './variable';\nimport { Query, indexedFormulaQuery } from './query';\nimport { BlankNodeTermType, CollectionTermType, DefaultGraphTermType, EmptyTermType, GraphTermType, LiteralTermType, NamedNodeTermType, VariableTermType } from './types';\nimport NamedNode from './named-node';\nimport { namedNode } from './index';\nimport serialize from \"./serialize\";\nimport BlankNode from './blank-node';\nimport DefaultGraph from './default-graph';\nimport Literal from './literal';\nconst owlNamespaceURI = 'http://www.w3.org/2002/07/owl#';\nexport { defaultGraphURI };\n// var link_ns = 'http://www.w3.org/2007/ont/link#'\n\n// Handle Functional Property\nfunction handleFP(formula, subj, pred, obj) {\n var o1 = formula.any(subj, pred, undefined);\n if (!o1) {\n return false; // First time with this value\n }\n // log.warn(\"Equating \"+o1.uri+\" and \"+obj.uri + \" because FP \"+pred.uri); //@@\n formula.equate(o1, obj);\n return true;\n} // handleFP\n\n// Handle Inverse Functional Property\nfunction handleIFP(formula, subj, pred, obj) {\n var s1 = formula.any(undefined, pred, obj);\n if (!s1) {\n return false; // First time with this value\n }\n // log.warn(\"Equating \"+s1.uri+\" and \"+subj.uri + \" because IFP \"+pred.uri); //@@\n formula.equate(s1, subj);\n return true;\n} // handleIFP\n\nfunction handleRDFType(formula, subj, pred, obj, why) {\n //@ts-ignore this method does not seem to exist in this library\n if (formula.typeCallback) {\n formula.typeCallback(formula, obj, why);\n }\n var x = formula.classActions[formula.id(obj)];\n var done = false;\n if (x) {\n for (var i = 0; i < x.length; i++) {\n done = done || x[i](formula, subj, pred, obj, why);\n }\n }\n return done; // statement given is not needed if true\n}\n\n/**\n * Indexed Formula aka Store\n */\nexport default class IndexedFormula extends Formula {\n /**\n * Creates a new formula\n * @param features - What sort of automatic processing to do? Array of string\n * @param features.sameAs - Smush together A and B nodes whenever { A sameAs B }\n * @param opts\n * @param [opts.rdfFactory] - The data factory that should be used by the store\n * @param [opts.rdfArrayRemove] - Function which removes statements from the store\n * @param [opts.dataCallback] - Callback when a statement is added to the store, will not trigger when adding duplicates\n */\n constructor(features) {\n let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n super(undefined, undefined, undefined, undefined, opts);\n // IN future - allow pass array of statements to constructor\n /**\n * An UpdateManager initialised to this store\n */\n _defineProperty(this, \"updater\", void 0);\n /**\n * Dictionary of namespace prefixes\n */\n _defineProperty(this, \"namespaces\", void 0);\n /** Map of iri predicates to functions to call when adding { s type X } */\n _defineProperty(this, \"classActions\", void 0);\n /** Map of iri predicates to functions to call when getting statement with {s X o} */\n _defineProperty(this, \"propertyActions\", void 0);\n /** Redirect to lexically smaller equivalent symbol */\n _defineProperty(this, \"redirections\", void 0);\n /** Reverse mapping to redirection: aliases for this */\n _defineProperty(this, \"aliases\", void 0);\n /** Redirections we got from HTTP */\n _defineProperty(this, \"HTTPRedirects\", void 0);\n /** Array of statements with this X as subject */\n _defineProperty(this, \"subjectIndex\", void 0);\n /** Array of statements with this X as predicate */\n _defineProperty(this, \"predicateIndex\", void 0);\n /** Array of statements with this X as object */\n _defineProperty(this, \"objectIndex\", void 0);\n /** Array of statements with X as provenance */\n _defineProperty(this, \"whyIndex\", void 0);\n _defineProperty(this, \"index\", void 0);\n _defineProperty(this, \"features\", void 0);\n _defineProperty(this, \"_universalVariables\", void 0);\n _defineProperty(this, \"_existentialVariables\", void 0);\n /** Function to remove quads from the store arrays with */\n _defineProperty(this, \"rdfArrayRemove\", void 0);\n /** Callbacks which are triggered after a statement has been added to the store */\n _defineProperty(this, \"dataCallbacks\", []);\n /** Callbacks which are triggered after a statement has been removed from the store */\n _defineProperty(this, \"dataRemovalCallbacks\", []);\n this.propertyActions = {};\n this.classActions = {};\n this.redirections = [];\n this.aliases = [];\n this.HTTPRedirects = [];\n this.subjectIndex = [];\n this.predicateIndex = [];\n this.objectIndex = [];\n this.whyIndex = [];\n this.index = [this.subjectIndex, this.predicateIndex, this.objectIndex, this.whyIndex];\n this.namespaces = {}; // Dictionary of namespace prefixes\n this.features = features || [// By default, devs do not expect these features.\n // See https://github.com/linkeddata/rdflib.js/issues/458\n // 'sameAs',\n // 'InverseFunctionalProperty',\n // 'FunctionalProperty',\n ];\n this.rdfArrayRemove = opts.rdfArrayRemove || RDFArrayRemove;\n if (opts.dataCallback) {\n this.dataCallbacks = [opts.dataCallback];\n }\n if (opts.dataRemovalCallback) {\n this.dataRemovalCallbacks = [opts.dataRemovalCallback];\n }\n this.initPropertyActions(this.features);\n }\n\n /**\n * Gets the URI of the default graph\n */\n static get defaultGraphURI() {\n return defaultGraphURI;\n }\n\n /**\n * Gets this graph with the bindings substituted\n * @param bindings The bindings\n */\n substitute(bindings) {\n var statementsCopy = this.statements.map(function (ea) {\n return ea.substitute(bindings);\n });\n var y = new IndexedFormula();\n y.add(statementsCopy);\n return y;\n }\n\n /**\n * Add a callback which will be triggered after a statement has been added to the store.\n * @param cb\n */\n addDataCallback(cb) {\n this.dataCallbacks.push(cb);\n }\n addDataRemovalCallback(cb) {\n this.dataRemovalCallbacks.push(cb);\n }\n\n /**\n * Apply a set of statements to be deleted and to be inserted\n *\n * @param patch - The set of statements to be deleted and to be inserted\n * @param target - The name of the document to patch\n * @param patchCallback - Callback to be called when patching is complete\n */\n applyPatch(patch, target, patchCallback) {\n var targetKB = this;\n var ds;\n var binding = null;\n function doPatch(onDonePatch) {\n if (patch['delete']) {\n ds = patch['delete'];\n // console.log(bindingDebug(binding))\n // console.log('ds before substitute: ' + ds)\n if (binding) ds = ds.substitute(binding);\n // console.log('applyPatch: delete: ' + ds)\n ds = ds.statements;\n var bad = [];\n var ds2 = ds.map(function (st) {\n // Find the actual statements in the store\n var sts = targetKB.statementsMatching(st.subject, st.predicate, st.object, target);\n if (sts.length === 0) {\n // log.info(\"NOT FOUND deletable \" + st)\n bad.push(st);\n return null;\n } else {\n // log.info(\"Found deletable \" + st)\n return sts[0];\n }\n });\n if (bad.length) {\n // console.log('Could not find to delete ' + bad.length + 'statements')\n // console.log('despite ' + targetKB.statementsMatching(bad[0].subject, bad[0].predicate)[0])\n return patchCallback('Could not find to delete: ' + bad.join('\\n or '));\n }\n ds2.map(function (st) {\n targetKB.remove(st);\n });\n }\n if (patch['insert']) {\n // log.info(\"doPatch insert \"+patch['insert'])\n ds = patch['insert'];\n if (binding) ds = ds.substitute(binding);\n ds = ds.statements;\n ds.map(function (st) {\n st.graph = target;\n targetKB.add(st.subject, st.predicate, st.object, st.graph);\n });\n }\n onDonePatch();\n }\n if (patch.where) {\n // log.info(\"Processing WHERE: \" + patch.where + '\\n')\n var query = new Query('patch');\n query.pat = patch.where;\n query.pat.statements.map(function (st) {\n st.graph = namedNode(target.value);\n });\n //@ts-ignore TODO: add sync property to Query when converting Query to typescript\n query.sync = true;\n var bindingsFound = [];\n targetKB.query(query, function onBinding(binding) {\n bindingsFound.push(binding);\n // console.log(' got a binding: ' + bindingDebug(binding))\n }, targetKB.fetcher, function onDone() {\n if (bindingsFound.length === 0) {\n return patchCallback('No match found to be patched:' + patch.where);\n }\n if (bindingsFound.length > 1) {\n return patchCallback('Patch ambiguous. No patch done.');\n }\n binding = bindingsFound[0];\n doPatch(patchCallback);\n });\n } else {\n doPatch(patchCallback);\n }\n }\n\n /**\n * N3 allows for declaring blank nodes, this function enables that support\n *\n * @param x The blank node to be declared, supported in N3\n */\n declareExistential(x) {\n if (!this._existentialVariables) this._existentialVariables = [];\n this._existentialVariables.push(x);\n return x;\n }\n\n /**\n * @param features\n */\n initPropertyActions(features) {\n // If the predicate is #type, use handleRDFType to create a typeCallback on the object\n this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'))] = [handleRDFType];\n\n // Assumption: these terms are not redirected @@fixme\n if (ArrayIndexOf(features, 'sameAs') >= 0) {\n this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}sameAs`))] = [function (formula, subj, pred, obj, why) {\n // log.warn(\"Equating \"+subj.uri+\" sameAs \"+obj.uri); //@@\n formula.equate(subj, obj);\n return true; // true if statement given is NOT needed in the store\n }]; // sameAs -> equate & don't add to index\n }\n if (ArrayIndexOf(features, 'InverseFunctionalProperty') >= 0) {\n this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}InverseFunctionalProperty`))] = [function (formula, subj, pred, obj, addFn) {\n // yes subj not pred!\n return formula.newPropertyAction(subj, handleIFP);\n }]; // IFP -> handleIFP, do add to index\n }\n if (ArrayIndexOf(features, 'FunctionalProperty') >= 0) {\n this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode(`${owlNamespaceURI}FunctionalProperty`))] = [function (formula, subj, proj, obj, addFn) {\n return formula.newPropertyAction(subj, handleFP);\n }]; // FP => handleFP, do add to index\n }\n }\n\n /** @deprecated Use {add} instead */\n addStatement(st) {\n this.add(st.subject, st.predicate, st.object, st.graph);\n return this.statements.length;\n }\n\n /**\n * Adds a triple (quad) to the store.\n *\n * @param subj - The thing about which the fact a relationship is asserted.\n * Also accepts a statement or an array of Statements.\n * @param pred - The relationship which is asserted\n * @param obj - The object of the relationship, e.g. another thing or a value. If passed a string, this will become a literal.\n * @param why - The document in which the triple (S,P,O) was or will be stored on the web\n * @returns The statement added to the store, or the store\n */\n add(subj, pred, obj, why) {\n var i;\n if (arguments.length === 1) {\n if (subj instanceof Array) {\n for (i = 0; i < subj.length; i++) {\n this.add(subj[i]);\n }\n } else if (isQuad(subj)) {\n this.add(subj.subject, subj.predicate, subj.object, subj.graph);\n } else if (isStore(subj)) {\n this.add(subj.statements);\n }\n return this;\n }\n var actions;\n var st;\n if (!why) {\n // system generated\n why = this.fetcher ? this.fetcher.appNode : this.rdfFactory.defaultGraph();\n }\n if (typeof subj == 'string') {\n subj = this.rdfFactory.namedNode(subj);\n }\n pred = Node.fromValue(pred);\n const objNode = Node.fromValue(obj);\n why = Node.fromValue(why);\n if (!isRDFlibSubject(subj)) {\n throw new Error('Subject is not a subject type');\n }\n if (!isRDFlibPredicate(pred)) {\n throw new Error(`Predicate ${pred} is not a predicate type`);\n }\n if (!isRDFlibObject(objNode)) {\n throw new Error(`Object ${objNode} is not an object type`);\n }\n if (!isGraph(why)) {\n throw new Error(\"Why is not a graph type\");\n }\n //@ts-ignore This is not used internally\n if (this.predicateCallback) {\n //@ts-ignore This is not used internally\n this.predicateCallback(this, pred, why);\n }\n // Action return true if the statement does not need to be added\n var predHash = this.id(this.canon(pred));\n actions = this.propertyActions[predHash]; // Predicate hash\n var done = false;\n if (actions) {\n // alert('type: '+typeof actions +' @@ actions='+actions)\n for (i = 0; i < actions.length; i++) {\n done = done || actions[i](this, subj, pred, objNode, why);\n }\n }\n if (this.holds(subj, pred, objNode, why)) {\n // Takes time but saves duplicates\n // console.log('rdflib: Ignoring dup! {' + subj + ' ' + pred + ' ' + obj + ' ' + why + '}')\n return null; // @@better to return self in all cases?\n }\n // If we are tracking provenance, every thing should be loaded into the store\n // if (done) return this.rdfFactory.quad(subj, pred, obj, why)\n // Don't put it in the store\n // still return this statement for owl:sameAs input\n var hash = [this.id(this.canon(subj)), predHash, this.id(this.canon(objNode)), this.id(this.canon(why))];\n // @ts-ignore this will fail if you pass a collection and the factory does not allow Collections\n st = this.rdfFactory.quad(subj, pred, objNode, why);\n for (i = 0; i < 4; i++) {\n var ix = this.index[i];\n var h = hash[i];\n if (!ix[h]) {\n ix[h] = [];\n }\n ix[h].push(st); // Set of things with this as subject, etc\n }\n\n // log.debug(\"ADDING {\"+subj+\" \"+pred+\" \"+objNode+\"} \"+why)\n this.statements.push(st);\n for (const callback of this.dataCallbacks) {\n callback(st);\n }\n return st;\n }\n\n /**\n * Returns the symbol with canonical URI as smushed\n * @param term - An RDF node\n */\n canon(term) {\n if (!term) {\n // @@ TODO Should improve this to return proper value - doing this to keep it backward compatible\n return term;\n }\n const y = this.redirections[this.id(term)];\n if (y) {\n return y;\n }\n switch (term.termType) {\n case BlankNodeTermType:\n return new BlankNode(term.value);\n case CollectionTermType:\n return term;\n // non-RDF/JS type, should just need to cast\n case DefaultGraphTermType:\n return new DefaultGraph();\n case EmptyTermType:\n // non-RDF/JS type, should just need to cast\n return term;\n case GraphTermType:\n // non-RDF/JS type, should just need to cast\n return term;\n case LiteralTermType:\n return new Literal(term.value, term.language, term.datatype);\n case NamedNodeTermType:\n return new NamedNode(term.value);\n case VariableTermType:\n return new Variable(term.value);\n default:\n throw new Error(`Term Type not recognized for canonization: ${term.termType}`);\n }\n }\n\n /**\n * Checks this formula for consistency\n */\n check() {\n this.checkStatementList(this.statements);\n for (var p = 0; p < 4; p++) {\n var ix = this.index[p];\n for (var key in ix) {\n if (ix.hasOwnProperty(key)) {\n // @ts-ignore should this pass an array or a single statement? checkStateMentsList expects an array.\n this.checkStatementList(ix[key], p);\n }\n }\n }\n }\n\n /**\n * Checks a list of statements for consistency\n * @param sts - The list of statements to check\n * @param from - An index with the array ['subject', 'predicate', 'object', 'why']\n */\n checkStatementList(sts, from) {\n if (from === undefined) {\n from = 0;\n }\n var names = ['subject', 'predicate', 'object', 'why'];\n var origin = ' found in ' + names[from] + ' index.';\n var st;\n for (var j = 0; j < sts.length; j++) {\n st = sts[j];\n var term = [st.subject, st.predicate, st.object, st.graph];\n var arrayContains = function (a, x) {\n for (var i = 0; i < a.length; i++) {\n if (a[i].subject.equals(x.subject) && a[i].predicate.equals(x.predicate) && a[i].object.equals(x.object) && a[i].why.equals(x.graph)) {\n return true;\n }\n }\n };\n for (var p = 0; p < 4; p++) {\n var c = this.canon(term[p]);\n var h = this.id(c);\n if (!this.index[p][h]) {\n // throw new Error('No ' + name[p] + ' index for statement ' + st + '@' + st.why + origin)\n } else {\n if (!arrayContains(this.index[p][h], st)) {\n // throw new Error('Index for ' + name[p] + ' does not have statement ' + st + '@' + st.why + origin)\n }\n }\n }\n if (!arrayContains(this.statements, st)) {\n throw new Error('Statement list does not statement ' + st + '@' + st.graph + origin);\n }\n }\n }\n\n /**\n * Closes this formula (and return it)\n */\n close() {\n return this;\n }\n compareTerms(u1, u2) {\n // Keep compatibility with downstream classOrder changes\n if (Object.prototype.hasOwnProperty.call(u1, \"compareTerm\")) {\n return u1.compareTerm(u2);\n }\n if (ClassOrder[u1.termType] < ClassOrder[u2.termType]) {\n return -1;\n }\n if (ClassOrder[u1.termType] > ClassOrder[u2.termType]) {\n return +1;\n }\n if (u1.value < u2.value) {\n return -1;\n }\n if (u1.value > u2.value) {\n return +1;\n }\n return 0;\n }\n\n /**\n * replaces @template with @target and add appropriate triples\n * removes no triples by default and is a one-direction replication\n * @param template node to copy\n * @param target node to copy to\n * @param flags Whether or not to do a two-directional copy and/or delete triples\n */\n copyTo(template, target, flags) {\n if (!flags) flags = [];\n var statList = this.statementsMatching(template);\n if (ArrayIndexOf(flags, 'two-direction') !== -1) {\n statList.concat(this.statementsMatching(undefined, undefined, template));\n }\n for (var i = 0; i < statList.length; i++) {\n var st = statList[i];\n switch (st.object.termType) {\n case 'NamedNode':\n this.add(target, st.predicate, st.object);\n break;\n case 'Literal':\n case 'BlankNode':\n // @ts-ignore Collections can appear here\n case 'Collection':\n // @ts-ignore Possible bug: copy is not available on Collections\n this.add(target, st.predicate, st.object.copy(this));\n }\n if (ArrayIndexOf(flags, 'delete') !== -1) {\n this.remove(st);\n }\n }\n }\n\n /**\n * Simplify graph in store when we realize two identifiers are equivalent\n * We replace the bigger with the smaller.\n * @param u1in The first node\n * @param u2in The second node\n */\n equate(u1in, u2in) {\n // log.warn(\"Equating \"+u1+\" and \"+u2); // @@\n // @@JAMBO Must canonicalize the uris to prevent errors from a=b=c\n // 03-21-2010\n const u1 = this.canon(u1in);\n const u2 = this.canon(u2in);\n var d = this.compareTerms(u1, u2);\n if (!d) {\n return true; // No information in {a = a}\n }\n // var big\n // var small\n if (d < 0) {\n // u1 less than u2\n return this.replaceWith(u2, u1);\n } else {\n return this.replaceWith(u1, u2);\n }\n }\n\n /**\n * Creates a new empty indexed formula\n * Only applicable for IndexedFormula, but TypeScript won't allow a subclass to override a property\n * @param features The list of features\n */\n formula(features) {\n return new IndexedFormula(features);\n }\n\n /**\n * Returns the number of statements contained in this IndexedFormula.\n * (Getter proxy to this.statements).\n * Usage:\n * ```\n * var kb = rdf.graph()\n * kb.length // -> 0\n * ```\n * @returns {Number}\n */\n get length() {\n return this.statements.length;\n }\n\n /**\n * Returns any quads matching the given arguments.\n * Standard RDFJS spec method for Source objects, implemented as an\n * alias to `statementsMatching()`\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The graph that contains the statement\n */\n match(subject, predicate, object, graph) {\n return this.statementsMatching(Node.fromValue(subject), Node.fromValue(predicate), Node.fromValue(object), Node.fromValue(graph));\n }\n\n /**\n * Find out whether a given URI is used as symbol in the formula\n * @param uri The URI to look for\n */\n mentionsURI(uri) {\n var hash = '<' + uri + '>';\n return !!this.subjectIndex[hash] || !!this.objectIndex[hash] || !!this.predicateIndex[hash];\n }\n\n /**\n * Existentials are BNodes - something exists without naming\n * @param uri An URI\n */\n newExistential(uri) {\n if (!uri) return this.bnode();\n var x = this.sym(uri);\n // @ts-ignore x should be blanknode, but is namedNode.\n return this.declareExistential(x);\n }\n\n /**\n * Adds a new property action\n * @param pred the predicate that the function should be triggered on\n * @param action the function that should trigger\n */\n newPropertyAction(pred, action) {\n // log.debug(\"newPropertyAction: \"+pred)\n var hash = this.id(pred);\n if (!this.propertyActions[hash]) {\n this.propertyActions[hash] = [];\n }\n this.propertyActions[hash].push(action);\n // Now apply the function to to statements already in the store\n var toBeFixed = this.statementsMatching(undefined, pred, undefined);\n var done = false;\n for (var i = 0; i < toBeFixed.length; i++) {\n // NOT optimized - sort toBeFixed etc\n done = done || action(this, toBeFixed[i].subject, pred, toBeFixed[i].object);\n }\n return done;\n }\n\n /**\n * Creates a new universal node\n * Universals are Variables\n * @param uri An URI\n */\n newUniversal(uri) {\n var x = this.sym(uri);\n if (!this._universalVariables) this._universalVariables = [];\n this._universalVariables.push(x);\n return x;\n }\n\n // convenience function used by N3 parser\n variable(name) {\n return new Variable(name);\n }\n\n /**\n * Find an unused id for a file being edited: return a symbol\n * (Note: Slow iff a lot of them -- could be O(log(k)) )\n * @param doc A document named node\n */\n nextSymbol(doc) {\n for (var i = 0;; i++) {\n var uri = doc.value + '#n' + i;\n if (!this.mentionsURI(uri)) return this.sym(uri);\n }\n }\n\n /**\n * Query this store asynchronously, return bindings in callback\n *\n * @param myQuery The query to be run\n * @param callback Function to call when bindings\n * @param Fetcher | null If you want the query to do link following\n * @param onDone OBSOLETE - do not use this // @@ Why not ?? Called when query complete\n */\n query(myQuery, callback, fetcher, onDone) {\n return indexedFormulaQuery.call(this, myQuery, callback, fetcher, onDone);\n }\n\n /**\n * Query this store synchronously and return bindings\n *\n * @param myQuery The query to be run\n */\n querySync(myQuery) {\n var results = [];\n function saveBinginds(bindings) {\n results.push(bindings);\n }\n function onDone() {\n done = true;\n }\n var done = false;\n // @ts-ignore TODO: Add .sync to Query\n myQuery.sync = true;\n indexedFormulaQuery.call(this, myQuery, saveBinginds, null, onDone);\n if (!done) {\n throw new Error('Sync query should have called done function');\n }\n return results;\n }\n\n /**\n * Removes one or multiple statement(s) from this formula\n * @param st - A Statement or array of Statements to remove\n */\n remove(st) {\n if (st instanceof Array) {\n for (var i = 0; i < st.length; i++) {\n this.remove(st[i]);\n }\n return this;\n }\n if (isStore(st)) {\n return this.remove(st.statements);\n }\n var sts = this.statementsMatching(st.subject, st.predicate, st.object, st.graph);\n if (!sts.length) {\n throw new Error('Statement to be removed is not on store: ' + st);\n }\n this.removeStatement(sts[0]);\n return this;\n }\n\n /**\n * Removes all statements in a doc, along with the related metadata including request/response/status\n * @param doc - The document / graph\n */\n removeDocument(doc) {\n this.removeMetadata(doc);\n // remove document\n var sts = this.statementsMatching(undefined, undefined, undefined, doc).slice(); // Take a copy as this is the actual index\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i]);\n }\n this.removeMatches(doc, null, null);\n return this;\n }\n removeMetadata(doc) {\n const meta = this.sym('chrome://TheCurrentSession'); // or this.rdfFactory.namedNode('chrome://TheCurrentSession')\n const linkNamespaceURI = 'http://www.w3.org/2007/ont/link#';\n // remove status/response/request metadata\n const requests = this.statementsMatching(undefined, this.sym(`${linkNamespaceURI}requestedURI`), this.rdfFactory.literal(doc.value), meta).map(st => st.subject);\n for (var r = 0; r < requests.length; r++) {\n const request = requests[r];\n if (request != undefined) {\n // removeMatches unresolved issue with collection https://github.com/linkeddata/rdflib.js/issues/631\n let sts;\n // status collection\n const status = this.any(request, this.sym(`${linkNamespaceURI}status`), null, meta);\n if (status != undefined) {\n sts = this.statementsMatching(status, this.sym(`${linkNamespaceURI}status`), null, meta).slice();\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i]);\n }\n }\n // response items list\n const response = this.any(request, this.sym(`${linkNamespaceURI}response`), null, meta);\n if (response != undefined) {\n sts = this.statementsMatching(response, null, null, meta).slice();\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i]);\n }\n }\n // request triples\n sts = this.statementsMatching(request, null, null, meta).slice();\n for (var i = 0; i < sts.length; i++) {\n this.removeStatement(sts[i]);\n }\n }\n }\n this.removeMatches(this.sym(doc.value), null, null, meta); // content-type\n return this;\n }\n\n /**\n * Remove all statements matching args (within limit) *\n * @param subj The subject\n * @param pred The predicate\n * @param obj The object\n * @param why The graph that contains the statement\n * @param limit The number of statements to remove\n */\n removeMany(subj, pred, obj, why, limit) {\n // log.debug(\"entering removeMany w/ subj,pred,obj,why,limit = \" + subj +\", \"+ pred+\", \" + obj+\", \" + why+\", \" + limit)\n var sts = this.statementsMatching(subj, pred, obj, why, false);\n // This is a subtle bug that occurred in updateCenter.js too.\n // The fact is, this.statementsMatching returns this.whyIndex instead of a copy of it\n // but for perfromance consideration, it's better to just do that\n // so make a copy here.\n var statements = [];\n for (var i = 0; i < sts.length; i++) statements.push(sts[i]);\n if (limit) statements = statements.slice(0, limit);\n for (i = 0; i < statements.length; i++) this.remove(statements[i]);\n }\n\n /**\n * Remove all matching statements\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The graph that contains the statement\n */\n removeMatches(subject, predicate, object, graph) {\n this.removeMany(subject, predicate, object, graph);\n return this;\n }\n\n /**\n * Remove a particular statement object from the store\n *\n * @param st - a statement which is already in the store and indexed.\n * Make sure you only use this for these.\n * Otherwise, you should use remove() above.\n */\n removeStatement(st) {\n // log.debug(\"entering remove w/ st=\" + st)\n var term = [st.subject, st.predicate, st.object, st.graph];\n for (var p = 0; p < 4; p++) {\n var c = this.canon(term[p]);\n var h = this.id(c);\n if (!this.index[p][h]) {\n // log.warn (\"Statement removal: no index '+p+': \"+st)\n } else {\n this.rdfArrayRemove(this.index[p][h], st);\n }\n }\n this.rdfArrayRemove(this.statements, st);\n for (const callback of this.dataRemovalCallbacks) {\n callback(st);\n }\n return this;\n }\n\n /**\n * Removes statements\n * @param sts The statements to remove\n */\n removeStatements(sts) {\n for (var i = 0; i < sts.length; i++) {\n this.remove(sts[i]);\n }\n return this;\n }\n\n /**\n * Replace big with small, obsoleted with obsoleting.\n */\n replaceWith(big, small) {\n // log.debug(\"Replacing \"+big+\" with \"+small) // this.id(@@\n var oldhash = this.id(big);\n var newhash = this.id(small);\n var moveIndex = function (ix) {\n var oldlist = ix[oldhash];\n if (!oldlist) {\n return; // none to move\n }\n var newlist = ix[newhash];\n if (!newlist) {\n ix[newhash] = oldlist;\n } else {\n ix[newhash] = oldlist.concat(newlist);\n }\n delete ix[oldhash];\n };\n // the canonical one carries all the indexes\n for (var i = 0; i < 4; i++) {\n moveIndex(this.index[i]);\n }\n this.redirections[oldhash] = small;\n if (big.value) {\n // @@JAMBO: must update redirections,aliases from sub-items, too.\n if (!this.aliases[newhash]) {\n this.aliases[newhash] = [];\n }\n this.aliases[newhash].push(big); // Back link\n if (this.aliases[oldhash]) {\n for (i = 0; i < this.aliases[oldhash].length; i++) {\n this.redirections[this.id(this.aliases[oldhash][i])] = small;\n this.aliases[newhash].push(this.aliases[oldhash][i]);\n }\n }\n this.add(small, this.sym('http://www.w3.org/2007/ont/link#uri'), big);\n // If two things are equal, and one is requested, we should request the other.\n if (this.fetcher) {\n this.fetcher.nowKnownAs(big, small);\n }\n }\n moveIndex(this.classActions);\n moveIndex(this.propertyActions);\n // log.debug(\"Equate done. \"+big+\" to be known as \"+small)\n return true; // true means the statement does not need to be put in\n }\n\n /**\n * Return all equivalent URIs by which this is known\n * @param x A named node\n */\n allAliases(x) {\n var a = this.aliases[this.id(this.canon(x))] || [];\n a.push(this.canon(x));\n return a;\n }\n\n /**\n * Compare by canonical URI as smushed\n * @param x A named node\n * @param y Another named node\n */\n sameThings(x, y) {\n if (x.equals(y)) {\n return true;\n }\n var x1 = this.canon(x);\n // alert('x1='+x1)\n if (!x1) return false;\n var y1 = this.canon(y);\n // alert('y1='+y1); //@@\n if (!y1) return false;\n return x1.value === y1.value;\n }\n setPrefixForURI(prefix, nsuri) {\n // TODO: This is a hack for our own issues, which ought to be fixed\n // post-release\n // See http://dig.csail.mit.edu/cgi-bin/roundup.cgi/$rdf/issue227\n if (prefix === 'tab' && this.namespaces['tab']) {\n return;\n } // There are files around with long badly generated prefixes like this\n if (prefix.slice(0, 2) === 'ns' || prefix.slice(0, 7) === 'default') {\n return;\n }\n\n // remove any prefix that currently targets nsuri\n for (let existingPrefix in this.namespaces) {\n if (this.namespaces[existingPrefix] == nsuri) delete this.namespaces[existingPrefix];\n }\n this.namespaces[prefix] = nsuri;\n }\n\n /** Search the Store\n *\n * ALL CONVENIENCE LOOKUP FUNCTIONS RELY ON THIS!\n * @param subj - A node to search for as subject, or if null, a wildcard\n * @param pred - A node to search for as predicate, or if null, a wildcard\n * @param obj - A node to search for as object, or if null, a wildcard\n * @param why - A node to search for as graph, or if null, a wildcard\n * @param justOne - flag - stop when found one rather than get all of them?\n * @returns An array of nodes which match the wildcard position\n */\n statementsMatching(subj, pred, obj, why, justOne) {\n // log.debug(\"Matching {\"+subj+\" \"+pred+\" \"+obj+\"}\")\n var pat = [subj, pred, obj, why];\n var pattern = [];\n var hash = [];\n var wild = []; // wildcards\n var given = []; // Not wild\n var p;\n var list;\n for (p = 0; p < 4; p++) {\n pattern[p] = this.canon(Node.fromValue(pat[p]));\n if (!pattern[p]) {\n wild.push(p);\n } else {\n given.push(p);\n hash[p] = this.id(pattern[p]);\n }\n }\n if (given.length === 0) {\n return this.statements;\n }\n if (given.length === 1) {\n // Easy too, we have an index for that\n p = given[0];\n list = this.index[p][hash[p]];\n if (list && justOne) {\n if (list.length > 1) {\n list = list.slice(0, 1);\n }\n }\n list = list || [];\n return list;\n }\n // Now given.length is 2, 3 or 4.\n // We hope that the scale-free nature of the data will mean we tend to get\n // a short index in there somewhere!\n var best = 1e10; // really bad\n var iBest;\n var i;\n for (i = 0; i < given.length; i++) {\n p = given[i]; // Which part we are dealing with\n list = this.index[p][hash[p]];\n if (!list) {\n return []; // No occurrences\n }\n if (list.length < best) {\n best = list.length;\n iBest = i; // (not p!)\n }\n }\n // Ok, we have picked the shortest index but now we have to filter it\n var pBest = given[iBest];\n var possibles = this.index[pBest][hash[pBest]];\n var check = given.slice(0, iBest).concat(given.slice(iBest + 1)); // remove iBest\n var results = [];\n var parts = ['subject', 'predicate', 'object', 'why'];\n for (var j = 0; j < possibles.length; j++) {\n var st = possibles[j];\n for (i = 0; i < check.length; i++) {\n // for each position to be checked\n p = check[i];\n if (!this.canon(st[parts[p]]).equals(pattern[p])) {\n st = null;\n break;\n }\n }\n if (st != null) {\n results.push(st);\n if (justOne) break;\n }\n }\n return results;\n }\n\n /**\n * A list of all the URIs by which this thing is known\n * @param term\n */\n uris(term) {\n var cterm = this.canon(term);\n var terms = this.aliases[this.id(cterm)];\n if (!cterm.value) return [];\n var res = [cterm.value];\n if (terms) {\n for (var i = 0; i < terms.length; i++) {\n res.push(terms[i].uri);\n }\n }\n return res;\n }\n serialize(base, contentType, provenance, options) {\n // override Formula.serialize to force the serializer namespace prefixes\n // to those of this IndexedFormula\n\n // if namespaces are explicitly passed in options, let them override the existing namespaces in this formula\n const namespaces = options?.namespaces ? {\n ...this.namespaces,\n ...options.namespaces\n } : {\n ...this.namespaces\n };\n options = {\n ...(options || {}),\n namespaces\n };\n return serialize(provenance, this, base, contentType, undefined, options);\n }\n}\n_defineProperty(IndexedFormula, \"handleRDFType\", void 0);\nIndexedFormula.handleRDFType = handleRDFType;","/* Lists form conversion\n*/\n\n// import DataFactory from './factories/extended-term-factory'\n// import jsonldParser from './jsonldparser'\n// @ts-ignore is this injected?\n// @@ Goal: remove this dependency\n// import N3Parser from './n3parser'\n// import { parseRDFaDOM } from './rdfaparser'\n// import RDFParser from './rdfxmlparser'\n// import sparqlUpdateParser from './patch-parser'\n// import * as Util from './utils-js'\n\n// import BlankNode from './blank-node'\n// import NamedNode from './named-node'\nimport Collection from './collection';\nimport Statement from './statement';\n// import Formula from './formula'\n\n// import { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'\n\n// import { Quad } from './tf-types'\n\nimport Namespace from './namespace';\nconst RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');\n\n/* Replace a given node with another node throughout a given document\n*\n* we do the predicate as well for complenesss though we don't expect Collections to use it\n*/\nexport function substituteInDoc(store, x, y, doc) {\n // console.log(`substituteInDoc put ${x} for ${y} in ${doc}}`)\n for (const quad of store.statementsMatching(y, null, null, doc)) {\n const newStatement = new Statement(x, quad.predicate, quad.object, doc);\n store.remove(quad);\n store.add(newStatement);\n }\n for (const quad of store.statementsMatching(null, y, null, doc)) {\n store.remove(quad);\n // console.log(` substituteInDoc predicate ${x} in ${quad}}`)\n store.add(new Statement(quad.subject, x, quad.object, doc));\n }\n for (const quad of store.statementsMatching(null, null, y, doc)) {\n store.remove(quad);\n store.add(new Statement(quad.subject, quad.predicate, x, doc));\n }\n}\n\n/* Change all lone rdf:nil nodes into empty Collections\n*/\nexport function substituteNillsInDoc(store, doc) {\n const x = RDF('nil');\n for (const quad of store.statementsMatching(x, null, null, doc)) {\n store.remove(quad);\n const y = new Collection();\n store.add(new Statement(y, quad.predicate, quad.object, doc));\n }\n for (const quad of store.statementsMatching(null, null, x, doc)) {\n if (!quad.predicate.sameTerm(RDF('rest'))) {\n // If not a tail\n store.remove(quad);\n const y = new Collection();\n store.add(new Statement(quad.subject, quad.predicate, y, doc));\n }\n }\n}\n/**\n * Convert lists reified as rdf:first, rest\n * Normal method is sync.\n * Unfortunately jsdonld is currently written to need to be called async.\n * Hence the mess below with executeCallback.\n * @param store - The quadstore\n * @param doc - The document in which the conversion is done\n */\n\nexport function convertFirstRestNil(store, doc // Do whole store?\n) {\n function preceding(ele, listSoFar, trash) {\n const rests = store.statementsMatching(ele, RDF('rest'), null, doc);\n if (rests.length !== 1) throw new Error(`Bad list structure: no rest at ${ele}`);\n const firsts = store.statementsMatching(ele, RDF('first'), null, doc);\n if (firsts.length !== 1) throw new Error(`Bad list structure: rest but ${firsts.length} firsts at ${ele}`);\n const value = firsts[0].object;\n const total = [value].concat(listSoFar);\n // console.log(' List now is: ', total)\n const totalTrash = trash.concat(rests).concat(firsts);\n const pres = store.statementsMatching(null, RDF('rest'), ele, doc);\n if (pres.length === 0) {\n // Head of the list\n const newList = new Collection(total);\n store.remove(totalTrash);\n // Replace old list with new list:\n substituteInDoc(store, newList, ele, doc);\n return;\n }\n if (pres.length !== 1) throw new Error(`Bad list structure: ${pres.length} pres at ${ele}`);\n const pre = pres[0].subject;\n if (pre.termType !== 'BlankNode') throw new Error(`Bad list element node ${pre} type: ${pre.termType} `);\n preceding(pre, total, totalTrash);\n return;\n }\n substituteNillsInDoc(store, doc); // lone ones only\n\n const tails = store.statementsMatching(null, RDF('rest'), RDF('nil'), doc);\n tails.forEach(tail => {\n if (tail.subject.termType !== 'BlankNode') throw new Error(`Bad list element node ${tail.subject} type: ${tail.subject.termType} `);\n preceding(tail.subject, [], []);\n });\n}","/**\n*\n* UTF-8 data encode / decode\n* http://www.webtoolkit.info/\n*\n**/\nimport * as Uri from './uri';\nimport { ArrayIndexOf } from './utils';\nimport { convertFirstRestNil } from './lists';\nfunction hexify(str) {\n // also used in parser\n return encodeURI(str);\n}\nvar Utf8 = {\n // public method for url encoding\n encode: function (string) {\n string = string.replace(/\\r\\n/g, \"\\n\");\n var utftext = \"\";\n for (var n = 0; n < string.length; n++) {\n var c = string.charCodeAt(n);\n if (c < 128) {\n utftext += String.fromCharCode(c);\n } else if (c > 127 && c < 2048) {\n utftext += String.fromCharCode(c >> 6 | 192);\n utftext += String.fromCharCode(c & 63 | 128);\n } else {\n utftext += String.fromCharCode(c >> 12 | 224);\n utftext += String.fromCharCode(c >> 6 & 63 | 128);\n utftext += String.fromCharCode(c & 63 | 128);\n }\n }\n return utftext;\n },\n // public method for url decoding\n decode: function (utftext) {\n var string = \"\";\n var i = 0;\n while (i < utftext.length) {\n var c = utftext.charCodeAt(i);\n if (c < 128) {\n string += String.fromCharCode(c);\n i++;\n } else if (c > 191 && c < 224) {\n string += String.fromCharCode((c & 31) << 6 | utftext.charCodeAt(i + 1) & 63);\n i += 2;\n } else {\n string += String.fromCharCode((c & 15) << 12 | (utftext.charCodeAt(i + 1) & 63) << 6 | utftext.charCodeAt(i + 2) & 63);\n i += 3;\n }\n }\n return string;\n }\n}; // Things we need to define to make converted pythn code work in js\n// environment of $rdf\n\nvar RDFSink_forSomeSym = \"http://www.w3.org/2000/10/swap/log#forSome\";\nvar RDFSink_forAllSym = \"http://www.w3.org/2000/10/swap/log#forAll\";\nvar Logic_NS = \"http://www.w3.org/2000/10/swap/log#\";\n\n// pyjs seems to reference runtime library which I didn't find\n\nvar pyjslib_Tuple = function (theList) {\n return theList;\n};\nvar pyjslib_List = function (theList) {\n return theList;\n};\nvar pyjslib_Dict = function (listOfPairs) {\n if (listOfPairs.length > 0) throw \"missing.js: oops nnonempty dict not imp\";\n return [];\n};\nvar pyjslib_len = function (s) {\n return s.length;\n};\nvar pyjslib_slice = function (str, i, j) {\n if (typeof str.slice == 'undefined') throw '@@ mising.js: No .slice function for ' + str + ' of type ' + typeof str;\n if (typeof j == 'undefined' || j == null) return str.slice(i);\n return str.slice(i, j); // @ exactly the same spec?\n};\nvar StopIteration = Error('dummy error stop iteration');\nvar pyjslib_Iterator = function (theList) {\n this.last = 0;\n this.li = theList;\n this.next = function () {\n if (this.last == this.li.length) throw StopIteration;\n return this.li[this.last++];\n };\n return this;\n};\nvar ord = function (str) {\n return str.charCodeAt(0);\n};\nvar string_find = function (str, s) {\n return str.indexOf(s);\n};\nvar assertFudge = function (condition, desc) {\n if (condition) return;\n if (desc) throw \"python Assertion failed: \" + desc;\n throw \"(python) Assertion failed.\";\n};\nvar stringFromCharCode = function (uesc) {\n return String.fromCharCode(uesc);\n};\nString.prototype.encode = function (encoding) {\n if (encoding != 'utf-8') throw \"UTF8_converter: can only do utf-8\";\n return Utf8.encode(this);\n};\nString.prototype.decode = function (encoding) {\n if (encoding != 'utf-8') throw \"UTF8_converter: can only do utf-8\";\n //return Utf8.decode(this);\n return this;\n};\nvar uripath_join = function (base, given) {\n return Uri.join(given, base); // sad but true\n};\nvar becauseSubexpression = null; // No reason needed\nvar diag_tracking = 0;\nvar diag_chatty_flag = 0;\nvar diag_progress = function (str) {/*$rdf.log.debug(str);*/};\n\n// why_BecauseOfData = function(doc, reason) { return doc };\n\nvar RDF_type_URI = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\";\nvar RDF_nil_URI = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil\";\nvar DAML_sameAs_URI = \"http://www.w3.org/2002/07/owl#sameAs\";\n\n/*\nfunction SyntaxError(details) {\n return new __SyntaxError(details);\n}\n*/\n\nfunction __SyntaxError(details) {\n this.details = details;\n}\n\n/*\n\n$Id: n3parser.js 14561 2008-02-23 06:37:26Z kennyluck $\n\nHAND EDITED FOR CONVERSION TO JAVASCRIPT\n\nThis module implements a Nptation3 parser, and the final\npart of a notation3 serializer.\n\nSee also:\n\nNotation 3\nhttp://www.w3.org/DesignIssues/Notation3\n\nClosed World Machine - and RDF Processor\nhttp://www.w3.org/2000/10/swap/cwm\n\nTo DO: See also \"@@\" in comments\n\n- Clean up interfaces\n______________________________________________\n\nModule originally by Dan Connolly, includeing notation3\nparser and RDF generator. TimBL added RDF stream model\nand N3 generation, replaced stream model with use\nof common store/formula API. Yosi Scharf developped\nthe module, including tests and test harness.\n\n*/\n\nvar ADDED_HASH = \"#\";\nvar LOG_implies_URI = \"http://www.w3.org/2000/10/swap/log#implies\";\nvar INTEGER_DATATYPE = \"http://www.w3.org/2001/XMLSchema#integer\";\nvar FLOAT_DATATYPE = \"http://www.w3.org/2001/XMLSchema#double\";\nvar DECIMAL_DATATYPE = \"http://www.w3.org/2001/XMLSchema#decimal\";\nvar DATE_DATATYPE = \"http://www.w3.org/2001/XMLSchema#date\";\nvar DATETIME_DATATYPE = \"http://www.w3.org/2001/XMLSchema#dateTime\";\nvar BOOLEAN_DATATYPE = \"http://www.w3.org/2001/XMLSchema#boolean\";\nvar option_noregen = 0;\nvar _notQNameChars = \"\\t\\r\\n !\\\"#$%&'()*.,+/;<=>?@[\\\\]^`{|}~\";\nvar _notNameChars = _notQNameChars + \":\";\nvar _rdfns = \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\";\nvar N3CommentCharacter = \"#\";\nvar eol = new RegExp(\"^[ \\\\t]*(#[^\\\\n]*)?\\\\r?\\\\n\", 'g');\nvar eof = new RegExp(\"^[ \\\\t]*(#[^\\\\n]*)?$\", 'g');\nvar ws = new RegExp(\"^[ \\\\t]*\", 'g');\nvar signed_integer = new RegExp(\"^[-+]?[0-9]+\", 'g');\nvar number_syntax = new RegExp(\"^([-+]?[0-9]+)(\\\\.[0-9]+)?([eE][-+]?[0-9]+)?\", 'g');\nvar datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\\\.[0-9]*)?)?)?Z?');\nvar digitstring = new RegExp(\"^[0-9]+\", 'g');\nvar interesting = new RegExp(\"[\\\\\\\\\\\\r\\\\n\\\\\\\"]\", 'g');\nvar langcode = new RegExp(\"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\", 'g');\nfunction createSinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {\n return new SinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why);\n}\nexport default createSinkParser;\nexport class SinkParser {\n constructor(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {\n if (typeof openFormula == 'undefined') openFormula = null;\n if (typeof thisDoc == 'undefined') thisDoc = \"\";\n if (typeof baseURI == 'undefined') baseURI = null;\n if (typeof genPrefix == 'undefined') genPrefix = \"\";\n if (typeof metaURI == 'undefined') metaURI = null;\n if (typeof flags == 'undefined') flags = \"\";\n if (typeof why == 'undefined') why = null;\n /*\n note: namespace names should *not* end in #;\n the # will get added during qname processing */\n\n this._bindings = new pyjslib_Dict([]);\n this._flags = flags;\n if (thisDoc != \"\") {\n assertFudge(thisDoc.indexOf(\":\") >= 0, \"Document URI not absolute: \" + thisDoc);\n this._bindings[\"\"] = thisDoc + \"#\";\n }\n this._store = store;\n if (genPrefix) {\n store.setGenPrefix(genPrefix);\n }\n this._thisDoc = thisDoc;\n this.source = store.sym(thisDoc);\n this.lines = 0;\n this.statementCount = 0;\n this.hasNil = false;\n this.startOfLine = 0;\n this.previousLine = 0;\n this._genPrefix = genPrefix;\n this.keywords = new pyjslib_List([\"a\", \"this\", \"bind\", \"has\", \"is\", \"of\", \"true\", \"false\"]);\n this.keywordsSet = 0;\n this._anonymousNodes = new pyjslib_Dict([]);\n this._variables = new pyjslib_Dict([]);\n this._parentVariables = new pyjslib_Dict([]);\n this._reason = why;\n this._reason2 = null;\n if (diag_tracking) {\n this._reason2 = why_BecauseOfData(store.sym(thisDoc), this._reason);\n }\n if (baseURI) {\n this._baseURI = baseURI;\n } else {\n if (thisDoc) {\n this._baseURI = thisDoc;\n } else {\n this._baseURI = null;\n }\n }\n assertFudge(!this._baseURI || this._baseURI.indexOf(\":\") >= 0);\n if (!this._genPrefix) {\n if (this._thisDoc) {\n this._genPrefix = this._thisDoc + \"#_g\";\n } else {\n this._genPrefix = RDFSink_uniqueURI();\n }\n }\n if (openFormula == null) {\n if (this._thisDoc) {\n this._formula = store.formula(thisDoc + \"#_formula\");\n } else {\n this._formula = store.formula();\n }\n } else {\n this._formula = openFormula;\n }\n this._context = this._formula;\n this._parentContext = null;\n }\n here(i) {\n return this._genPrefix + \"_L\" + this.lines + \"C\" + (i - this.startOfLine + 1);\n }\n formula() {\n return this._formula;\n }\n loadStream(stream) {\n return this.loadBuf(stream.read());\n }\n loadBuf(buf) {\n /*\n Parses a buffer and returns its top level formula*/\n\n this.startDoc();\n this.feed(buf);\n return this.endDoc();\n }\n feed(octets) {\n /*\n Feed an octet stream tothe parser\n if BadSyntax is raised, the string\n passed in the exception object is the\n remainder after any statements have been parsed.\n So if there is more data to feed to the\n parser, it should be straightforward to recover.*/\n\n var str = octets.decode(\"utf-8\");\n var i = 0;\n while (i >= 0) {\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return;\n }\n var i = this.directiveOrStatement(str, j);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected directive or statement\");\n }\n }\n }\n directiveOrStatement(str, h) {\n var i = this.skipSpace(str, h);\n if (i < 0) {\n return i;\n }\n var j = this.directive(str, i);\n if (j >= 0) {\n return this.checkDot(str, j);\n }\n var j = this.statement(str, i);\n if (j >= 0) {\n return this.checkDot(str, j);\n }\n return j;\n }\n tok(tok, str, i) {\n /*\n Check for keyword. Space must have been stripped on entry and\n we must not be at end of file.*/\n var whitespace = \"\\t\\n\\v\\f\\r \";\n if (str.slice(i, i + 1) == \"@\") {\n var i = i + 1;\n } else {\n if (ArrayIndexOf(this.keywords, tok) < 0) {\n return -1;\n }\n }\n var k = i + pyjslib_len(tok);\n if (str.slice(i, k) == tok && _notQNameChars.indexOf(str.charAt(k)) >= 0) {\n return k;\n } else {\n return -1;\n }\n }\n directive(str, i) {\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return j;\n }\n var res = new pyjslib_List([]);\n var j = this.tok(\"bind\", str, i);\n if (j > 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"keyword bind is obsolete: use @prefix\");\n }\n var j = this.tok(\"keywords\", str, i);\n if (j > 0) {\n var i = this.commaSeparatedList(str, j, res, false);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"'@keywords' needs comma separated list of words\");\n }\n this.setKeywords(pyjslib_slice(res, null, null));\n if (diag_chatty_flag > 80) {\n diag_progress(\"Keywords \", this.keywords);\n }\n return i;\n }\n var j = this.tok(\"forAll\", str, i);\n if (j > 0) {\n var i = this.commaSeparatedList(str, j, res, true);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad variable list after @forAll\");\n }\n var __x = new pyjslib_Iterator(res);\n try {\n while (true) {\n var x = __x.next();\n if (ArrayIndexOf(this._variables, x) < 0 || ArrayIndexOf(this._parentVariables, x) >= 0) {\n this._variables[x] = this._context.newUniversal(x);\n }\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n return i;\n }\n var j = this.tok(\"forSome\", str, i);\n if (j > 0) {\n var i = this.commaSeparatedList(str, j, res, this.uri_ref2);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad variable list after @forSome\");\n }\n var __x = new pyjslib_Iterator(res);\n try {\n while (true) {\n var x = __x.next();\n this._context.declareExistential(x);\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n return i;\n }\n var j = this.tok(\"prefix\", str, i);\n if (j >= 0) {\n var t = new pyjslib_List([]);\n var i = this.qname(str, j, t);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected qname after @prefix\");\n }\n var j = this.uri_ref2(str, i, t);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected <uriref> after @prefix _qname_\");\n }\n var ns = t[1].uri;\n if (this._baseURI) {\n var ns = uripath_join(this._baseURI, ns);\n } else {\n assertFudge(ns.indexOf(\":\") >= 0, \"With no base URI, cannot handle relative URI for NS\");\n }\n assertFudge(ns.indexOf(\":\") >= 0);\n this._bindings[t[0][0]] = ns;\n this.bind(t[0][0], hexify(ns));\n return j;\n }\n var j = this.tok(\"base\", str, i);\n if (j >= 0) {\n var t = new pyjslib_List([]);\n var i = this.uri_ref2(str, j, t);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected <uri> after @base \");\n }\n var ns = t[0].uri;\n if (this._baseURI) {\n var ns = uripath_join(this._baseURI, ns);\n } else {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"With no previous base URI, cannot use relative URI in @base <\" + ns + \">\");\n }\n assertFudge(ns.indexOf(\":\") >= 0);\n this._baseURI = ns;\n return i;\n }\n return -1;\n }\n bind(qn, uri) {\n if (qn == \"\") {} else {\n this._store.setPrefixForURI(qn, uri);\n }\n }\n setKeywords(k) {\n /*\n Takes a list of strings*/\n\n if (k == null) {\n this.keywordsSet = 0;\n } else {\n this.keywords = k;\n this.keywordsSet = 1;\n }\n }\n startDoc() {}\n /* Signal end of document and stop parsing. returns formula */\n endDoc() {\n if (this.hasNil && this._store.rdfFactory.supports[\"COLLECTIONS\"]) {\n convertFirstRestNil(this._store, this.source);\n }\n return this._formula;\n }\n makeStatement(quad) {\n quad[0].add(quad[2], quad[1], quad[3], this.source);\n if (quad[2].uri && quad[2].uri === RDF_nil_URI || quad[3].uri && quad[3].uri === RDF_nil_URI) {\n this.hasNil = true;\n }\n this.statementCount += 1;\n }\n statement(str, i) {\n var r = new pyjslib_List([]);\n var i = this.object(str, i, r);\n if (i < 0) {\n return i;\n }\n var j = this.property_list(str, i, r[0]);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected propertylist\");\n }\n return j;\n }\n subject(str, i, res) {\n return this.item(str, i, res);\n }\n verb(str, i, res) {\n /*\n has _prop_\n is _prop_ of\n a\n =\n _prop_\n >- prop ->\n <- prop -<\n _operator_*/\n\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return j;\n }\n var r = new pyjslib_List([]);\n var j = this.tok(\"has\", str, i);\n if (j >= 0) {\n var i = this.prop(str, j, r);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected property after 'has'\");\n }\n res.push(new pyjslib_Tuple([\"->\", r[0]]));\n return i;\n }\n var j = this.tok(\"is\", str, i);\n if (j >= 0) {\n var i = this.prop(str, j, r);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected <property> after 'is'\");\n }\n var j = this.skipSpace(str, i);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"End of file found, expected property after 'is'\");\n return j;\n }\n var i = j;\n var j = this.tok(\"of\", str, i);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected 'of' after 'is' <prop>\");\n }\n res.push(new pyjslib_Tuple([\"<-\", r[0]]));\n return j;\n }\n var j = this.tok(\"a\", str, i);\n if (j >= 0) {\n res.push(new pyjslib_Tuple([\"->\", this._store.sym(RDF_type_URI)]));\n return j;\n }\n if (str.slice(i, i + 2) == \"<=\") {\n res.push(new pyjslib_Tuple([\"<-\", this._store.sym(Logic_NS + \"implies\")]));\n return i + 2;\n }\n if (str.slice(i, i + 1) == \"=\") {\n if (str.slice(i + 1, i + 2) == \">\") {\n res.push(new pyjslib_Tuple([\"->\", this._store.sym(Logic_NS + \"implies\")]));\n return i + 2;\n }\n res.push(new pyjslib_Tuple([\"->\", this._store.sym(DAML_sameAs_URI)]));\n return i + 1;\n }\n if (str.slice(i, i + 2) == \":=\") {\n res.push(new pyjslib_Tuple([\"->\", Logic_NS + \"becomes\"]));\n return i + 2;\n }\n var j = this.prop(str, i, r);\n if (j >= 0) {\n res.push(new pyjslib_Tuple([\"->\", r[0]]));\n return j;\n }\n if (str.slice(i, i + 2) == \">-\" || str.slice(i, i + 2) == \"<-\") {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \">- ... -> syntax is obsolete.\");\n }\n return -1;\n }\n prop(str, i, res) {\n return this.item(str, i, res);\n }\n item(str, i, res) {\n return this.path(str, i, res);\n }\n blankNode(uri) {\n return this._context.bnode(uri, this._reason2);\n }\n path(str, i, res) {\n /*\n Parse the path production.\n */\n\n var j = this.nodeOrLiteral(str, i, res);\n if (j < 0) {\n return j;\n }\n while (\"!^.\".indexOf(str.slice(j, j + 1)) >= 0) {\n var ch = str.slice(j, j + 1);\n if (ch == \".\") {\n var ahead = str.slice(j + 1, j + 2);\n if (!ahead || _notNameChars.indexOf(ahead) >= 0 && \":?<[{(\".indexOf(ahead) < 0) {\n break;\n }\n }\n var subj = res.pop();\n var obj = this.blankNode(this.here(j));\n var j = this.node(str, j + 1, res);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found in middle of path syntax\");\n }\n var pred = res.pop();\n if (ch == \"^\") {\n this.makeStatement(new pyjslib_Tuple([this._context, pred, obj, subj]));\n } else {\n this.makeStatement(new pyjslib_Tuple([this._context, pred, subj, obj]));\n }\n res.push(obj);\n }\n return j;\n }\n anonymousNode(ln) {\n /*\n Remember or generate a term for one of these _: anonymous nodes*/\n\n var term = this._anonymousNodes[ln];\n if (term) {\n return term;\n }\n var term = this._store.bnode(ln);\n // var term = this._store.bnode(this._context, this._reason2); eh?\n this._anonymousNodes[ln] = term;\n return term;\n }\n node(str, i, res, subjectAlready) {\n if (typeof subjectAlready == 'undefined') subjectAlready = null;\n /*\n Parse the <node> production.\n Space is now skipped once at the beginning\n instead of in multipe calls to self.skipSpace().\n */\n\n var subj = subjectAlready;\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return j;\n }\n var i = j;\n var ch = str.slice(i, i + 1);\n if (ch == \"[\") {\n var bnodeID = this.here(i);\n var j = this.skipSpace(str, i + 1);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF after '['\");\n }\n if (str.slice(j, j + 1) == \"=\") {\n var i = j + 1;\n var objs = new pyjslib_List([]);\n var j = this.objectList(str, i, objs);\n if (j >= 0) {\n var subj = objs[0];\n if (pyjslib_len(objs) > 1) {\n var __obj = new pyjslib_Iterator(objs);\n try {\n while (true) {\n var obj = __obj.next();\n this.makeStatement(new pyjslib_Tuple([this._context, this._store.sym(DAML_sameAs_URI), subj, obj]));\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n }\n var j = this.skipSpace(str, j);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF when objectList expected after [ = \");\n }\n if (str.slice(j, j + 1) == \";\") {\n var j = j + 1;\n }\n } else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"objectList expected after [= \");\n }\n }\n if (subj == null) {\n var subj = this.blankNode(bnodeID);\n }\n var i = this.property_list(str, j, subj);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"property_list expected\");\n }\n var j = this.skipSpace(str, i);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF when ']' expected after [ <propertyList>\");\n }\n if (str.slice(j, j + 1) != \"]\") {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"']' expected\");\n }\n res.push(subj);\n return j + 1;\n }\n if (ch == \"{\") {\n var ch2 = str.slice(i + 1, i + 2);\n if (ch2 == \"$\") {\n i += 1;\n var j = i + 1;\n var mylist = new pyjslib_List([]);\n var first_run = true;\n while (1) {\n var i = this.skipSpace(str, j);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed '$}', found end.\");\n }\n if (str.slice(i, i + 2) == \"$}\") {\n var j = i + 2;\n break;\n }\n if (!first_run) {\n if (str.slice(i, i + 1) == \",\") {\n i += 1;\n } else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected: ','\");\n }\n } else {\n var first_run = false;\n }\n var item = new pyjslib_List([]);\n var j = this.item(str, i, item);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected item in set or '$}'\");\n }\n mylist.push(item[0]);\n }\n res.push(this._store.newSet(mylist, this._context));\n return j;\n } else {\n var j = i + 1;\n var oldParentContext = this._parentContext;\n this._parentContext = this._context;\n var parentAnonymousNodes = this._anonymousNodes;\n var grandParentVariables = this._parentVariables;\n this._parentVariables = this._variables;\n this._anonymousNodes = new pyjslib_Dict([]);\n this._variables = this._variables.slice();\n var reason2 = this._reason2;\n this._reason2 = becauseSubexpression;\n if (subj == null) {\n var subj = this._store.formula();\n }\n this._context = subj;\n while (1) {\n var i = this.skipSpace(str, j);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed '}', found end.\");\n }\n if (str.slice(i, i + 1) == \"}\") {\n var j = i + 1;\n break;\n }\n var j = this.directiveOrStatement(str, i);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected statement or '}'\");\n }\n }\n this._anonymousNodes = parentAnonymousNodes;\n this._variables = this._parentVariables;\n this._parentVariables = grandParentVariables;\n this._context = this._parentContext;\n this._reason2 = reason2;\n this._parentContext = oldParentContext;\n res.push(subj.close());\n return j;\n }\n }\n if (ch == \"(\") {\n var thing_type = this._store.list;\n var ch2 = str.slice(i + 1, i + 2);\n if (ch2 == \"$\") {\n var thing_type = this._store.newSet;\n i += 1;\n }\n var j = i + 1;\n var mylist = new pyjslib_List([]);\n while (1) {\n var i = this.skipSpace(str, j);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"needed ')', found end.\");\n }\n if (str.slice(i, i + 1) == \")\") {\n var j = i + 1;\n break;\n }\n var item = new pyjslib_List([]);\n var j = this.item(str, i, item);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"expected item in list or ')'\");\n }\n mylist.push(item[0]);\n }\n res.push(thing_type(mylist, this._context));\n return j;\n }\n var j = this.tok(\"this\", str, i);\n if (j >= 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.\");\n res.push(this._context);\n return j;\n }\n var j = this.tok(\"true\", str, i);\n if (j >= 0) {\n res.push(true);\n return j;\n }\n var j = this.tok(\"false\", str, i);\n if (j >= 0) {\n res.push(false);\n return j;\n }\n if (subj == null) {\n var j = this.uri_ref2(str, i, res);\n if (j >= 0) {\n return j;\n }\n }\n return -1;\n }\n property_list(str, i, subj) {\n /*\n Parse property list\n Leaves the terminating punctuation in the buffer\n */\n\n while (1) {\n var j = this.skipSpace(str, i);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF found when expected verb in property list\");\n return j;\n }\n if (str.slice(j, j + 2) == \":-\") {\n var i = j + 2;\n var res = new pyjslib_List([]);\n var j = this.node(str, i, res, subj);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad {} or () or [] node after :- \");\n }\n var i = j;\n continue;\n }\n var i = j;\n var v = new pyjslib_List([]);\n var j = this.verb(str, i, v);\n if (j <= 0) {\n return i;\n }\n var objs = new pyjslib_List([]);\n var i = this.objectList(str, j, objs);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"objectList expected\");\n }\n var __obj = new pyjslib_Iterator(objs);\n try {\n while (true) {\n var obj = __obj.next();\n var pairFudge = v[0];\n var dir = pairFudge[0];\n var sym = pairFudge[1];\n if (dir == \"->\") {\n this.makeStatement(new pyjslib_Tuple([this._context, sym, subj, obj]));\n } else {\n this.makeStatement(new pyjslib_Tuple([this._context, sym, obj, subj]));\n }\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n var j = this.skipSpace(str, i);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found in list of objects\");\n return j;\n }\n if (str.slice(i, i + 1) != \";\") {\n return i;\n }\n var i = i + 1;\n }\n }\n commaSeparatedList(str, j, res, ofUris) {\n /*\n return value: -1 bad syntax; >1 new position in str\n res has things found appended\n Used to use a final value of the function to be called, e.g. this.bareWord\n but passing the function didn't work fo js converion pyjs\n */\n\n var i = this.skipSpace(str, j);\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"EOF found expecting comma sep list\");\n return i;\n }\n if (str.charAt(i) == \".\") {\n return j;\n }\n if (ofUris) {\n var i = this.uri_ref2(str, i, res);\n } else {\n var i = this.bareWord(str, i, res);\n }\n if (i < 0) {\n return -1;\n }\n while (1) {\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return j;\n }\n var ch = str.slice(j, j + 1);\n if (ch != \",\") {\n if (ch != \".\") {\n return -1;\n }\n return j;\n }\n if (ofUris) {\n var i = this.uri_ref2(str, j + 1, res);\n } else {\n var i = this.bareWord(str, j + 1, res);\n }\n if (i < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad list content\");\n return i;\n }\n }\n }\n objectList(str, i, res) {\n var i = this.object(str, i, res);\n if (i < 0) {\n return -1;\n }\n while (1) {\n var j = this.skipSpace(str, i);\n if (j < 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"EOF found after object\");\n return j;\n }\n if (str.slice(j, j + 1) != \",\") {\n return j;\n }\n var i = this.object(str, j + 1, res);\n if (i < 0) {\n return i;\n }\n }\n }\n checkDot(str, i) {\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return j;\n }\n if (str.slice(j, j + 1) == \".\") {\n return j + 1;\n }\n if (str.slice(j, j + 1) == \"}\") {\n return j;\n }\n if (str.slice(j, j + 1) == \"]\") {\n return j;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"expected '.' or '}' or ']' at end of statement\");\n return i;\n }\n uri_ref2(str, i, res) {\n /*\n Generate uri from n3 representation.\n Note that the RDF convention of directly concatenating\n NS and local name is now used though I prefer inserting a '#'\n to make the namesapces look more like what XML folks expect.\n */\n\n var qn = new pyjslib_List([]);\n var j = this.qname(str, i, qn);\n if (j >= 0) {\n var pairFudge = qn[0];\n var pfx = pairFudge[0];\n var ln = pairFudge[1];\n if (pfx == null) {\n assertFudge(0, \"not used?\");\n var ns = this._baseURI + ADDED_HASH;\n } else {\n var ns = this._bindings[pfx];\n if (!ns) {\n if (pfx == \"_\") {\n res.push(this.anonymousNode(ln));\n return j;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Prefix \" + pfx + \" not bound.\");\n }\n }\n var symb = this._store.sym(ns + ln);\n if (ArrayIndexOf(this._variables, symb) >= 0) {\n res.push(this._variables[symb]);\n } else {\n res.push(symb);\n }\n return j;\n }\n var i = this.skipSpace(str, i);\n if (i < 0) {\n return -1;\n }\n if (str.charAt(i) == \"?\") {\n var v = new pyjslib_List([]);\n var j = this.variable(str, i, v);\n if (j > 0) {\n res.push(v[0]);\n return j;\n }\n return -1;\n } else if (str.charAt(i) == \"<\") {\n var i = i + 1;\n var st = i;\n while (i < pyjslib_len(str)) {\n if (str.charAt(i) == \">\") {\n var uref = str.slice(st, i);\n if (this._baseURI) {\n var uref = uripath_join(this._baseURI, uref);\n } else {\n assertFudge(uref.indexOf(\":\") >= 0, \"With no base URI, cannot deal with relative URIs\");\n }\n if (str.slice(i - 1, i) == \"#\" && !(pyjslib_slice(uref, -1, null) == \"#\")) {\n var uref = uref + \"#\";\n }\n var symb = this._store.sym(uref);\n if (ArrayIndexOf(this._variables, symb) >= 0) {\n res.push(this._variables[symb]);\n } else {\n res.push(symb);\n }\n return i + 1;\n }\n var i = i + 1;\n }\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"unterminated URI reference\");\n } else if (this.keywordsSet) {\n var v = new pyjslib_List([]);\n var j = this.bareWord(str, i, v);\n if (j < 0) {\n return -1;\n }\n if (ArrayIndexOf(this.keywords, v[0]) >= 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Keyword \\\"\" + v[0] + \"\\\" not allowed here.\");\n }\n res.push(this._store.sym(this._bindings[\"\"] + v[0]));\n return j;\n } else {\n return -1;\n }\n }\n skipSpace(str, i) {\n /*\n Skip white space, newlines and comments.\n return -1 if EOF, else position of first non-ws character*/\n\n var whitespace = ' \\n\\r\\t\\f\\x0b\\xa0\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u200b\\u2028\\u2029\\u3000';\n for (var j = i ? i : 0; j < str.length; j++) {\n var ch = str.charAt(j);\n // console.log(\" skipspace j= \"+j + \" i= \" + i + \" n= \" + str.length);\n // console.log(\" skipspace ch <\" + ch + \">\");\n if (whitespace.indexOf(ch) < 0) {\n //not ws\n // console.log(\" skipspace 2 ch <\" + ch + \">\");\n if (str.charAt(j) === '#') {\n for (;; j++) {\n // console.log(\" skipspace2 j= \"+j + \" i= \" + i + \" n= \" + str.length);\n if (j === str.length) {\n return -1; // EOF\n }\n if (str.charAt(j) === '\\n') {\n this.lines = this.lines + 1;\n break;\n }\n }\n ;\n } else {\n // Not hash - something interesting\n // console.log(\" skipspace 3 ch <\" + ch + \">\");\n return j;\n }\n } else {\n // Whitespace\n // console.log(\" skipspace 5 ch <\" + ch + \">\");\n if (str.charAt(j) === '\\n') {\n this.lines = this.lines + 1;\n }\n }\n } // next j\n return -1; // EOF\n }\n variable(str, i, res) {\n /*\n ?abc -> variable(:abc)\n */\n\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return -1;\n }\n if (str.slice(j, j + 1) != \"?\") {\n return -1;\n }\n var j = j + 1;\n var i = j;\n if (\"0123456789-\".indexOf(str.charAt(j)) >= 0) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"Varible name can't start with '\" + str.charAt(j) + \"s'\");\n return -1;\n }\n while (i < pyjslib_len(str) && _notNameChars.indexOf(str.charAt(i)) < 0) {\n var i = i + 1;\n }\n if (this._parentContext == null) {\n throw BadSyntax(this._thisDoc, this.lines, str, j, \"Can't use ?xxx syntax for variable in outermost level: \" + str.slice(j - 1, i));\n }\n res.push(this._store.variable(str.slice(j, i)));\n return i;\n }\n bareWord(str, i, res) {\n /*\n abc -> :abc\n */\n\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return -1;\n }\n var ch = str.charAt(j);\n if (\"0123456789-\".indexOf(ch) >= 0) {\n return -1;\n }\n if (_notNameChars.indexOf(ch) >= 0) {\n return -1;\n }\n var i = j;\n while (i < pyjslib_len(str) && _notNameChars.indexOf(str.charAt(i)) < 0) {\n var i = i + 1;\n }\n res.push(str.slice(j, i));\n return i;\n }\n qname(str, i, res) {\n /*\n xyz:def -> ('xyz', 'def')\n If not in keywords and keywordsSet: def -> ('', 'def')\n :def -> ('', 'def')\n */\n\n var i = this.skipSpace(str, i);\n if (i < 0) {\n return -1;\n }\n var c = str.charAt(i);\n if (\"0123456789-+\".indexOf(c) >= 0) {\n return -1;\n }\n if (_notNameChars.indexOf(c) < 0) {\n var ln = c;\n var i = i + 1;\n while (i < pyjslib_len(str)) {\n var c = str.charAt(i);\n if (_notNameChars.indexOf(c) < 0) {\n var ln = ln + c;\n var i = i + 1;\n } else {\n break;\n }\n }\n } else {\n var ln = \"\";\n }\n if (i < pyjslib_len(str) && str.charAt(i) == \":\") {\n var pfx = ln;\n var i = i + 1;\n var ln = \"\";\n while (i < pyjslib_len(str)) {\n var c = str.charAt(i);\n if (_notNameChars.indexOf(c) < 0) {\n var ln = ln + c;\n var i = i + 1;\n } else {\n break;\n }\n }\n res.push(new pyjslib_Tuple([pfx, ln]));\n return i;\n } else {\n if (ln && this.keywordsSet && ArrayIndexOf(this.keywords, ln) < 0) {\n res.push(new pyjslib_Tuple([\"\", ln]));\n return i;\n }\n return -1;\n }\n }\n object(str, i, res) {\n var j = this.subject(str, i, res);\n if (j >= 0) {\n return j;\n } else {\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return -1;\n } else {\n var i = j;\n }\n var delim = null;\n let ch = str.charAt(i);\n if (ch == \"\\\"\" || ch == \"'\") {\n if (str.slice(i, i + 3 == ch + ch)) {\n delim = ch + ch + ch;\n } else {\n delim = ch;\n }\n var i = i + pyjslib_len(delim);\n var pairFudge = this.strconst(str, i, delim);\n var j = pairFudge[0];\n var s = pairFudge[1];\n res.push(this._store.literal(s));\n diag_progress(\"New string const \", s, j);\n return j;\n } else {\n return -1;\n }\n }\n }\n nodeOrLiteral(str, i, res) {\n var j = this.node(str, i, res);\n if (j >= 0) {\n return j;\n } else {\n var j = this.skipSpace(str, i);\n if (j < 0) {\n return -1;\n } else {\n var i = j;\n }\n var ch = str.charAt(i);\n if (\"-+0987654321\".indexOf(ch) >= 0) {\n datetime_syntax.lastIndex = 0;\n var m = datetime_syntax.exec(str.slice(i));\n if (m != null) {\n // j = ( i + datetime_syntax.lastIndex ) ;\n var val = m[0];\n j = i + val.length;\n if (val.indexOf(\"T\") >= 0) {\n res.push(this._store.literal(val, this._store.sym(DATETIME_DATATYPE)));\n } else {\n res.push(this._store.literal(val, this._store.sym(DATE_DATATYPE)));\n }\n } else {\n number_syntax.lastIndex = 0;\n var m = number_syntax.exec(str.slice(i));\n if (m == null) {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"Bad number or date syntax\");\n }\n j = i + number_syntax.lastIndex;\n var val = str.slice(i, j);\n if (val.indexOf(\"e\") >= 0) {\n res.push(this._store.literal(parseFloat(val), this._store.sym(FLOAT_DATATYPE)));\n } else if (str.slice(i, j).indexOf(\".\") >= 0) {\n res.push(this._store.literal(parseFloat(val), this._store.sym(DECIMAL_DATATYPE)));\n } else {\n res.push(this._store.literal(parseInt(val), this._store.sym(INTEGER_DATATYPE)));\n }\n }\n ;\n return j; // Where we have got up to\n }\n if (str.charAt(i) == \"\\\"\") {\n if (str.slice(i, i + 3) == \"\\\"\\\"\\\"\") {\n var delim = \"\\\"\\\"\\\"\";\n } else {\n var delim = \"\\\"\";\n }\n var i = i + pyjslib_len(delim);\n var dt = null;\n var pairFudge = this.strconst(str, i, delim);\n var j = pairFudge[0];\n var s = pairFudge[1];\n var lang = null;\n if (str.slice(j, j + 1) == \"@\") {\n langcode.lastIndex = 0;\n var m = langcode.exec(str.slice(j + 1));\n if (m == null) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"Bad language code syntax on string literal, after @\");\n }\n var i = langcode.lastIndex + j + 1;\n var lang = str.slice(j + 1, i);\n var j = i;\n }\n if (str.slice(j, j + 2) == \"^^\") {\n var res2 = new pyjslib_List([]);\n var j = this.uri_ref2(str, j + 2, res2);\n var dt = res2[0];\n }\n res.push(this._store.literal(s, lang || dt));\n return j;\n } else {\n return -1;\n }\n }\n }\n strconst(str, i, delim) {\n /*\n parse an N3 string constant delimited by delim.\n return index, val\n */\n\n var j = i;\n var ustr = \"\";\n var startline = this.lines;\n while (j < pyjslib_len(str)) {\n var i = j + pyjslib_len(delim);\n if (str.slice(j, i) == delim) {\n return new pyjslib_Tuple([i, ustr]);\n }\n if (str.charAt(j) == \"\\\"\") {\n var ustr = ustr + \"\\\"\";\n var j = j + 1;\n continue;\n }\n interesting.lastIndex = 0;\n var m = interesting.exec(str.slice(j));\n if (!m) {\n throw BadSyntax(this._thisDoc, startline, str, j, \"Closing quote missing in string at ^ in \" + str.slice(j - 20, j) + \"^\" + str.slice(j, j + 20));\n }\n var i = j + interesting.lastIndex - 1;\n var ustr = ustr + str.slice(j, i);\n var ch = str.charAt(i);\n if (ch == \"\\\"\") {\n var j = i;\n continue;\n } else if (ch == \"\\r\") {\n var j = i + 1;\n continue;\n } else if (ch == \"\\n\") {\n if (delim == \"\\\"\") {\n throw BadSyntax(this._thisDoc, startline, str, i, \"newline found in string literal\");\n }\n this.lines = this.lines + 1;\n var ustr = ustr + ch;\n var j = i + 1;\n this.previousLine = this.startOfLine;\n this.startOfLine = j;\n } else if (ch == \"\\\\\") {\n var j = i + 1;\n var ch = str.slice(j, j + 1);\n if (!ch) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal (2)\");\n }\n var k = string_find(\"abfrtvn\\\\\\\"\", ch);\n if (k >= 0) {\n var uch = \"\\a\\b\\f\\r\\t\\v\\n\\\\\\\"\".charAt(k);\n var ustr = ustr + uch;\n var j = j + 1;\n } else if (ch == \"u\") {\n var pairFudge = this.uEscape(str, j + 1, startline);\n var j = pairFudge[0];\n var ch = pairFudge[1];\n var ustr = ustr + ch;\n } else if (ch == \"U\") {\n var pairFudge = this.UEscape(str, j + 1, startline);\n var j = pairFudge[0];\n var ch = pairFudge[1];\n var ustr = ustr + ch;\n } else {\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"bad escape\");\n }\n }\n }\n throw BadSyntax(this._thisDoc, this.lines, str, i, \"unterminated string literal\");\n }\n uEscape(str, i, startline) {\n var j = i;\n var count = 0;\n var value = 0;\n while (count < 4) {\n var chFudge = str.slice(j, j + 1);\n var ch = chFudge.toLowerCase();\n var j = j + 1;\n if (ch == \"\") {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal(3)\");\n }\n var k = string_find(\"0123456789abcdef\", ch);\n if (k < 0) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"bad string literal hex escape\");\n }\n var value = value * 16 + k;\n var count = count + 1;\n }\n var uch = String.fromCharCode(value);\n return new pyjslib_Tuple([j, uch]);\n }\n UEscape(str, i, startline) {\n var j = i;\n var count = 0;\n var value = \"\\\\U\";\n while (count < 8) {\n var chFudge = str.slice(j, j + 1);\n var ch = chFudge.toLowerCase();\n var j = j + 1;\n if (ch == \"\") {\n throw BadSyntax(this._thisDoc, startline, str, i, \"unterminated string literal(3)\");\n }\n var k = string_find(\"0123456789abcdef\", ch);\n if (k < 0) {\n throw BadSyntax(this._thisDoc, startline, str, i, \"bad string literal hex escape\");\n }\n var value = value + ch;\n var count = count + 1;\n }\n var uch = stringFromCharCode(\"0x\" + pyjslib_slice(value, 2, 10) - 0);\n return new pyjslib_Tuple([j, uch]);\n }\n}\nfunction OLD_BadSyntax(uri, lines, str, i, why) {\n return new __OLD_BadSyntax(uri, lines, str, i, why);\n}\nfunction __OLD_BadSyntax(uri, lines, str, i, why) {\n this._str = str.encode(\"utf-8\");\n this._str = str;\n this._i = i;\n this._why = why;\n this.lines = lines;\n this._uri = uri;\n}\n__OLD_BadSyntax.prototype.toString = function () {\n var str = this._str;\n var i = this._i;\n var st = 0;\n if (i > 60) {\n var pre = \"...\";\n var st = i - 60;\n } else {\n var pre = \"\";\n }\n if (pyjslib_len(str) - i > 60) {\n var post = \"...\";\n } else {\n var post = \"\";\n }\n return \"Line %i of <%s>: Bad syntax (%s) at ^ in:\\n\\\"%s%s^%s%s\\\"\" % new pyjslib_Tuple([this.lines + 1, this._uri, this._why, pre, str.slice(st, i), str.slice(i, i + 60), post]);\n};\nfunction BadSyntax(uri, lines, str, i, why) {\n let lineNo = lines + 1;\n let msg = \"Line \" + lineNo + \" of <\" + uri + \">: Bad syntax: \" + why + \"\\nat: \\\"\" + str.slice(i, i + 30) + \"\\\"\";\n let e = new SyntaxError(msg, uri, lineNo);\n e.lineNo = lineNo;\n e.characterInFile = i;\n e.syntaxProblem = why;\n return e;\n}\nfunction stripCR(str) {\n var res = \"\";\n var __ch = new pyjslib_Iterator(str);\n try {\n while (true) {\n var ch = __ch.next();\n if (ch != \"\\r\") {\n var res = res + ch;\n }\n }\n } catch (e) {\n if (e != StopIteration) {\n throw e;\n }\n }\n return res;\n}\nfunction dummyWrite(x) {}","import Collection from '../collection';\nimport CanonicalDataFactory from './canonical-data-factory';\nimport { CollectionTermType } from '../types';\nimport { Feature } from './factory-types';\nimport { isCollection, isVariable } from '../utils/terms';\nimport Variable from '../variable';\n/**\n * Data factory which also supports Collections\n *\n * Necessary for preventing circular dependencies.\n */\nconst ExtendedTermFactory = {\n ...CanonicalDataFactory,\n supports: {\n [Feature.collections]: true,\n [Feature.defaultGraphType]: false,\n [Feature.equalsMethod]: true,\n [Feature.identity]: false,\n [Feature.id]: true,\n [Feature.reversibleId]: false,\n [Feature.variableType]: true\n },\n /**\n * Creates a new collection\n * @param elements - The initial element\n */\n collection(elements) {\n return new Collection(elements);\n },\n id(term) {\n if (isCollection(term)) {\n return `( ${term.elements.map(e => {\n return this.id(e);\n }).join(', ')} )`;\n }\n if (isVariable(term)) {\n return Variable.toString(term);\n }\n return CanonicalDataFactory.id(term);\n },\n termToNQ(term) {\n if (term.termType === CollectionTermType) {\n return Collection.toNT(term);\n }\n return CanonicalDataFactory.termToNQ(term);\n }\n};\nexport default ExtendedTermFactory;","import { arrayToStatements } from './utils';\n\n/**\n * Parses json-ld formatted JS objects to a rdf Term.\n * @param kb - The DataFactory to use.\n * @param obj - The json-ld object to process.\n * @return {Literal|NamedNode|BlankNode|Collection}\n */\nexport function jsonldObjectToTerm(kb, obj) {\n if (typeof obj === 'string') {\n return kb.rdfFactory.literal(obj);\n }\n if (Object.prototype.hasOwnProperty.call(obj, '@list')) {\n if (kb.rdfFactory.supports[\"COLLECTIONS\"] === true) {\n return listToCollection(kb, obj['@list']);\n }\n return listToStatements(kb, obj);\n }\n if (Object.prototype.hasOwnProperty.call(obj, '@id')) {\n return nodeType(kb, obj);\n }\n if (Object.prototype.hasOwnProperty.call(obj, '@language')) {\n return kb.rdfFactory.literal(obj['@value'], obj['@language']);\n }\n if (Object.prototype.hasOwnProperty.call(obj, '@type')) {\n return kb.rdfFactory.literal(obj['@value'], kb.rdfFactory.namedNode(obj['@type']));\n }\n if (Object.prototype.hasOwnProperty.call(obj, '@value')) {\n return kb.rdfFactory.literal(obj['@value']);\n }\n return kb.rdfFactory.literal(obj);\n}\n\n/**\n * Adds the statements in a json-ld list object to {kb}.\n */\nfunction listToStatements(kb, obj) {\n const listId = obj['@id'] ? nodeType(kb, obj) : kb.rdfFactory.blankNode();\n const items = obj['@list'].map(listItem => jsonldObjectToTerm(kb, listItem));\n const statements = arrayToStatements(kb.rdfFactory, listId, items);\n kb.addAll(statements);\n return listId;\n}\nfunction listToCollection(kb, obj) {\n if (!Array.isArray(obj)) {\n throw new TypeError(\"Object must be an array\");\n }\n return kb.rdfFactory.collection(obj.map(o => jsonldObjectToTerm(kb, o)));\n}\n\n/**\n * Takes a json-ld formatted string {str} and adds its statements to {kb}.\n *\n * Ensure that {kb.rdfFactory} is a DataFactory.\n */\nexport default async function jsonldParser(str, kb, base) {\n const baseString = base && Object.prototype.hasOwnProperty.call(base, 'termType') ? base.value : base;\n const jsonld = await import('jsonld');\n // ⚠ Unit tests also work without accessing `jsonld.default` explicitly, but real browser usage will fail with\n // just calling `jsonld.flatten`, so please do not remove `default`\n const flattened = await jsonld.default.flatten(JSON.parse(str), null, {\n base: baseString\n });\n return flattened.reduce((store, flatResource) => processResource(store, base, flatResource), kb);\n}\nfunction nodeType(kb, obj) {\n if (obj['@id'].startsWith('_:')) {\n // This object is a Blank Node. Pass the id without the `_:` prefix\n return kb.rdfFactory.blankNode(obj['@id'].substring(2));\n } else {\n // This object is a Named Node\n return kb.rdfFactory.namedNode(obj['@id']);\n }\n}\nfunction processResource(kb, base, flatResource) {\n const id = flatResource['@id'] ? nodeType(kb, flatResource) : kb.rdfFactory.blankNode();\n for (const property of Object.keys(flatResource)) {\n if (property === '@id') {\n continue;\n } else if (property == '@graph') {\n // the JSON-LD flattened structure may contain nested graphs\n // the id value for this object is the new base (named graph id) for all nested flat resources\n const graphId = id;\n // this is an array of resources\n const nestedFlatResources = flatResource[property];\n\n // recursively process all flat resources in the array, but with the graphId as base.\n for (let i = 0; i < nestedFlatResources.length; i++) {\n kb = processResource(kb, graphId, nestedFlatResources[i]);\n }\n }\n const value = flatResource[property];\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n kb.addStatement(createStatement(kb, id, property, value[i], base));\n }\n } else {\n kb.addStatement(createStatement(kb, id, property, value, base));\n }\n }\n return kb;\n}\n\n/**\n * Create statement quad depending on @type being a type node\n * @param kb\n * @param subject id\n * @param property\n * @param value\n * @return quad statement\n */\nfunction createStatement(kb, id, property, value, base) {\n let predicate, object;\n if (property === \"@type\") {\n predicate = kb.rdfFactory.namedNode(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\");\n object = kb.rdfFactory.namedNode(value);\n } else {\n predicate = kb.rdfFactory.namedNode(property);\n object = jsonldObjectToTerm(kb, value);\n }\n return kb.rdfFactory.quad(id, predicate, object, kb.rdfFactory.namedNode(base));\n}","const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n XSD = 'http://www.w3.org/2001/XMLSchema#',\n SWAP = 'http://www.w3.org/2000/10/swap/';\n\nexport default {\n xsd: {\n decimal: `${XSD}decimal`,\n boolean: `${XSD}boolean`,\n double: `${XSD}double`,\n integer: `${XSD}integer`,\n string: `${XSD}string`,\n },\n rdf: {\n type: `${RDF}type`,\n nil: `${RDF}nil`,\n first: `${RDF}first`,\n rest: `${RDF}rest`,\n langString: `${RDF}langString`,\n },\n owl: {\n sameAs: 'http://www.w3.org/2002/07/owl#sameAs',\n },\n r: {\n forSome: `${SWAP}reify#forSome`,\n forAll: `${SWAP}reify#forAll`,\n },\n log: {\n implies: `${SWAP}log#implies`,\n isImpliedBy: `${SWAP}log#isImpliedBy`,\n },\n};\n","// **N3Lexer** tokenizes N3 documents.\nimport { Buffer } from 'buffer';\nimport namespaces from './IRIs';\n\nconst { xsd } = namespaces;\n\n// Regular expression and replacement string to escape N3 strings\nconst escapeSequence = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{8})|\\\\([^])/g;\nconst escapeReplacements = {\n '\\\\': '\\\\', \"'\": \"'\", '\"': '\"',\n 'n': '\\n', 'r': '\\r', 't': '\\t', 'f': '\\f', 'b': '\\b',\n '_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&',\n '(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=',\n '/': '/', '?': '?', '#': '#', '@': '@', '%': '%',\n};\nconst illegalIriChars = /[\\x00-\\x20<>\\\\\"\\{\\}\\|\\^\\`]/;\n\nconst lineModeRegExps = {\n _iri: true,\n _unescapedIri: true,\n _simpleQuotedString: true,\n _langcode: true,\n _blank: true,\n _newline: true,\n _comment: true,\n _whitespace: true,\n _endOfFile: true,\n};\nconst invalidRegExp = /$0^/;\n\n// ## Constructor\nexport default class N3Lexer {\n constructor(options) {\n // ## Regular expressions\n // It's slightly faster to have these as properties than as in-scope variables\n this._iri = /^<((?:[^ <>{}\\\\]|\\\\[uU])+)>[ \\t]*/; // IRI with escape sequences; needs sanity check after unescaping\n this._unescapedIri = /^<([^\\x00-\\x20<>\\\\\"\\{\\}\\|\\^\\`]*)>[ \\t]*/; // IRI without escape sequences; no unescaping\n this._simpleQuotedString = /^\"([^\"\\\\\\r\\n]*)\"(?=[^\"])/; // string without escape sequences\n this._simpleApostropheString = /^'([^'\\\\\\r\\n]*)'(?=[^'])/;\n this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\\-])/i;\n this._prefix = /^((?:[A-Za-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)?:(?=[#\\s<])/;\n this._prefixed = /^((?:[A-Za-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)?:((?:(?:[0-:A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~])(?:(?:[\\.\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~])*(?:[\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~]))?)?)(?:[ \\t]+|(?=\\.?[,;!\\^\\s#()\\[\\]\\{\\}\"'<>]))/;\n this._variable = /^\\?(?:(?:[A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:[\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)(?=[.,;!\\^\\s#()\\[\\]\\{\\}\"'<>])/;\n this._blank = /^_:((?:[0-9A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)(?:[ \\t]+|(?=\\.?[,;:\\s#()\\[\\]\\{\\}\"'<>]))/;\n this._number = /^[\\-+]?(?:(\\d+\\.\\d*|\\.?\\d+)[eE][\\-+]?|\\d*(\\.)?)\\d+(?=\\.?[,;:\\s#()\\[\\]\\{\\}\"'<>])/;\n this._boolean = /^(?:true|false)(?=[.,;\\s#()\\[\\]\\{\\}\"'<>])/;\n this._keyword = /^@[a-z]+(?=[\\s#<:])/i;\n this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\\s#<])/i;\n this._shortPredicates = /^a(?=[\\s#()\\[\\]\\{\\}\"'<>])/;\n this._newline = /^[ \\t]*(?:#[^\\n\\r]*)?(?:\\r\\n|\\n|\\r)[ \\t]*/;\n this._comment = /#([^\\n\\r]*)/;\n this._whitespace = /^[ \\t]+/;\n this._endOfFile = /^(?:#[^\\n\\r]*)?$/;\n options = options || {};\n\n // Whether the log:isImpliedBy predicate is supported\n this._isImpliedBy = options.isImpliedBy;\n\n // In line mode (N-Triples or N-Quads), only simple features may be parsed\n if (this._lineMode = !!options.lineMode) {\n this._n3Mode = false;\n // Don't tokenize special literals\n for (const key in this) {\n if (!(key in lineModeRegExps) && this[key] instanceof RegExp)\n this[key] = invalidRegExp;\n }\n }\n // When not in line mode, enable N3 functionality by default\n else {\n this._n3Mode = options.n3 !== false;\n }\n // Don't output comment tokens by default\n this.comments = !!options.comments;\n // Cache the last tested closing position of long literals\n this._literalClosingPos = 0;\n }\n\n // ## Private methods\n\n // ### `_tokenizeToEnd` tokenizes as for as possible, emitting tokens through the callback\n _tokenizeToEnd(callback, inputFinished) {\n // Continue parsing as far as possible; the loop will return eventually\n let input = this._input;\n let currentLineLength = input.length;\n while (true) {\n // Count and skip whitespace lines\n let whiteSpaceMatch, comment;\n while (whiteSpaceMatch = this._newline.exec(input)) {\n // Try to find a comment\n if (this.comments && (comment = this._comment.exec(whiteSpaceMatch[0])))\n emitToken('comment', comment[1], '', this._line, whiteSpaceMatch[0].length);\n // Advance the input\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n currentLineLength = input.length;\n this._line++;\n }\n // Skip whitespace on current line\n if (!whiteSpaceMatch && (whiteSpaceMatch = this._whitespace.exec(input)))\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n\n // Stop for now if we're at the end\n if (this._endOfFile.test(input)) {\n // If the input is finished, emit EOF\n if (inputFinished) {\n // Try to find a final comment\n if (this.comments && (comment = this._comment.exec(input)))\n emitToken('comment', comment[1], '', this._line, input.length);\n input = null;\n emitToken('eof', '', '', this._line, 0);\n }\n return this._input = input;\n }\n\n // Look for specific token types based on the first character\n const line = this._line, firstChar = input[0];\n let type = '', value = '', prefix = '',\n match = null, matchLength = 0, inconclusive = false;\n switch (firstChar) {\n case '^':\n // We need at least 3 tokens lookahead to distinguish ^^<IRI> and ^^pre:fixed\n if (input.length < 3)\n break;\n // Try to match a type\n else if (input[1] === '^') {\n this._previousMarker = '^^';\n // Move to type IRI or prefixed name\n input = input.substr(2);\n if (input[0] !== '<') {\n inconclusive = true;\n break;\n }\n }\n // If no type, it must be a path expression\n else {\n if (this._n3Mode) {\n matchLength = 1;\n type = '^';\n }\n break;\n }\n // Fall through in case the type is an IRI\n case '<':\n // Try to find a full IRI without escape sequences\n if (match = this._unescapedIri.exec(input))\n type = 'IRI', value = match[1];\n // Try to find a full IRI with escape sequences\n else if (match = this._iri.exec(input)) {\n value = this._unescape(match[1]);\n if (value === null || illegalIriChars.test(value))\n return reportSyntaxError(this);\n type = 'IRI';\n }\n // Try to find a nested triple\n else if (input.length > 1 && input[1] === '<')\n type = '<<', matchLength = 2;\n // Try to find a backwards implication arrow\n else if (this._n3Mode && input.length > 1 && input[1] === '=') {\n matchLength = 2;\n if (this._isImpliedBy) type = 'abbreviation', value = '<';\n else type = 'inverse', value = '>';\n }\n break;\n\n case '>':\n if (input.length > 1 && input[1] === '>')\n type = '>>', matchLength = 2;\n break;\n\n case '_':\n // Try to find a blank node. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a blank node.\n // Therefore, try inserting a space if we're at the end of the input.\n if ((match = this._blank.exec(input)) ||\n inputFinished && (match = this._blank.exec(`${input} `)))\n type = 'blank', prefix = '_', value = match[1];\n break;\n\n case '\"':\n // Try to find a literal without escape sequences\n if (match = this._simpleQuotedString.exec(input))\n value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({ value, matchLength } = this._parseLiteral(input));\n if (value === null)\n return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n break;\n\n case \"'\":\n if (!this._lineMode) {\n // Try to find a literal without escape sequences\n if (match = this._simpleApostropheString.exec(input))\n value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({ value, matchLength } = this._parseLiteral(input));\n if (value === null)\n return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n }\n break;\n\n case '?':\n // Try to find a variable\n if (this._n3Mode && (match = this._variable.exec(input)))\n type = 'var', value = match[0];\n break;\n\n case '@':\n // Try to find a language code\n if (this._previousMarker === 'literal' && (match = this._langcode.exec(input)))\n type = 'langcode', value = match[1];\n // Try to find a keyword\n else if (match = this._keyword.exec(input))\n type = match[0];\n break;\n\n case '.':\n // Try to find a dot as punctuation\n if (input.length === 1 ? inputFinished : (input[1] < '0' || input[1] > '9')) {\n type = '.';\n matchLength = 1;\n break;\n }\n // Fall through to numerical case (could be a decimal dot)\n\n case '0':\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n case '+':\n case '-':\n // Try to find a number. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a number.\n // Therefore, try inserting a space if we're at the end of the input.\n if (match = this._number.exec(input) ||\n inputFinished && (match = this._number.exec(`${input} `))) {\n type = 'literal', value = match[0];\n prefix = (typeof match[1] === 'string' ? xsd.double :\n (typeof match[2] === 'string' ? xsd.decimal : xsd.integer));\n }\n break;\n\n case 'B':\n case 'b':\n case 'p':\n case 'P':\n case 'G':\n case 'g':\n // Try to find a SPARQL-style keyword\n if (match = this._sparqlKeyword.exec(input))\n type = match[0].toUpperCase();\n else\n inconclusive = true;\n break;\n\n case 'f':\n case 't':\n // Try to match a boolean\n if (match = this._boolean.exec(input))\n type = 'literal', value = match[0], prefix = xsd.boolean;\n else\n inconclusive = true;\n break;\n\n case 'a':\n // Try to find an abbreviated predicate\n if (match = this._shortPredicates.exec(input))\n type = 'abbreviation', value = 'a';\n else\n inconclusive = true;\n break;\n\n case '=':\n // Try to find an implication arrow or equals sign\n if (this._n3Mode && input.length > 1) {\n type = 'abbreviation';\n if (input[1] !== '>')\n matchLength = 1, value = '=';\n else\n matchLength = 2, value = '>';\n }\n break;\n\n case '!':\n if (!this._n3Mode)\n break;\n case ',':\n case ';':\n case '[':\n case ']':\n case '(':\n case ')':\n case '}':\n if (!this._lineMode) {\n matchLength = 1;\n type = firstChar;\n }\n break;\n case '{':\n // We need at least 2 tokens lookahead to distinguish \"{|\" and \"{ \"\n if (!this._lineMode && input.length >= 2) {\n // Try to find a quoted triple annotation start\n if (input[1] === '|')\n type = '{|', matchLength = 2;\n else\n type = firstChar, matchLength = 1;\n }\n break;\n case '|':\n // We need 2 tokens lookahead to parse \"|}\"\n // Try to find a quoted triple annotation end\n if (input.length >= 2 && input[1] === '}')\n type = '|}', matchLength = 2;\n break;\n\n default:\n inconclusive = true;\n }\n\n // Some first characters do not allow an immediate decision, so inspect more\n if (inconclusive) {\n // Try to find a prefix\n if ((this._previousMarker === '@prefix' || this._previousMarker === 'PREFIX') &&\n (match = this._prefix.exec(input)))\n type = 'prefix', value = match[1] || '';\n // Try to find a prefixed name. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a prefixed name.\n // Therefore, try inserting a space if we're at the end of the input.\n else if ((match = this._prefixed.exec(input)) ||\n inputFinished && (match = this._prefixed.exec(`${input} `)))\n type = 'prefixed', prefix = match[1] || '', value = this._unescape(match[2]);\n }\n\n // A type token is special: it can only be emitted after an IRI or prefixed name is read\n if (this._previousMarker === '^^') {\n switch (type) {\n case 'prefixed': type = 'type'; break;\n case 'IRI': type = 'typeIRI'; break;\n default: type = '';\n }\n }\n\n // What if nothing of the above was found?\n if (!type) {\n // We could be in streaming mode, and then we just wait for more input to arrive.\n // Otherwise, a syntax error has occurred in the input.\n // One exception: error on an unaccounted linebreak (= not inside a triple-quoted literal).\n if (inputFinished || (!/^'''|^\"\"\"/.test(input) && /\\n|\\r/.test(input)))\n return reportSyntaxError(this);\n else\n return this._input = input;\n }\n\n // Emit the parsed token\n const length = matchLength || match[0].length;\n const token = emitToken(type, value, prefix, line, length);\n this.previousToken = token;\n this._previousMarker = type;\n\n // Advance to next part to tokenize\n input = input.substr(length, input.length);\n }\n\n // Emits the token through the callback\n function emitToken(type, value, prefix, line, length) {\n const start = input ? currentLineLength - input.length : currentLineLength;\n const end = start + length;\n const token = { type, value, prefix, line, start, end };\n callback(null, token);\n return token;\n }\n // Signals the syntax error through the callback\n function reportSyntaxError(self) { callback(self._syntaxError(/^\\S*/.exec(input)[0])); }\n }\n\n // ### `_unescape` replaces N3 escape codes by their corresponding characters\n _unescape(item) {\n let invalid = false;\n const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => {\n // 4-digit unicode character\n if (typeof unicode4 === 'string')\n return String.fromCharCode(Number.parseInt(unicode4, 16));\n // 8-digit unicode character\n if (typeof unicode8 === 'string') {\n let charCode = Number.parseInt(unicode8, 16);\n return charCode <= 0xFFFF ? String.fromCharCode(Number.parseInt(unicode8, 16)) :\n String.fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF));\n }\n // fixed escape sequence\n if (escapedChar in escapeReplacements)\n return escapeReplacements[escapedChar];\n // invalid escape sequence\n invalid = true;\n return '';\n });\n return invalid ? null : replaced;\n }\n\n // ### `_parseLiteral` parses a literal into an unescaped value\n _parseLiteral(input) {\n // Ensure we have enough lookahead to identify triple-quoted strings\n if (input.length >= 3) {\n // Identify the opening quote(s)\n const opening = input.match(/^(?:\"\"\"|\"|'''|'|)/)[0];\n const openingLength = opening.length;\n\n // Find the next candidate closing quotes\n let closingPos = Math.max(this._literalClosingPos, openingLength);\n while ((closingPos = input.indexOf(opening, closingPos)) > 0) {\n // Count backslashes right before the closing quotes\n let backslashCount = 0;\n while (input[closingPos - backslashCount - 1] === '\\\\')\n backslashCount++;\n\n // An even number of backslashes (in particular 0)\n // means these are actual, non-escaped closing quotes\n if (backslashCount % 2 === 0) {\n // Extract and unescape the value\n const raw = input.substring(openingLength, closingPos);\n const lines = raw.split(/\\r\\n|\\r|\\n/).length - 1;\n const matchLength = closingPos + openingLength;\n // Only triple-quoted strings can be multi-line\n if (openingLength === 1 && lines !== 0 ||\n openingLength === 3 && this._lineMode)\n break;\n this._line += lines;\n return { value: this._unescape(raw), matchLength };\n }\n closingPos++;\n }\n this._literalClosingPos = input.length - openingLength + 1;\n }\n return { value: '', matchLength: 0 };\n }\n\n // ### `_syntaxError` creates a syntax error for the given issue\n _syntaxError(issue) {\n this._input = null;\n const err = new Error(`Unexpected \"${issue}\" on line ${this._line}.`);\n err.context = {\n token: undefined,\n line: this._line,\n previousToken: this.previousToken,\n };\n return err;\n }\n\n // ### Strips off any starting UTF BOM mark.\n _readStartingBom(input) {\n return input.startsWith('\\ufeff') ? input.substr(1) : input;\n }\n\n // ## Public methods\n\n // ### `tokenize` starts the transformation of an N3 document into an array of tokens.\n // The input can be a string or a stream.\n tokenize(input, callback) {\n this._line = 1;\n\n // If the input is a string, continuously emit tokens through the callback until the end\n if (typeof input === 'string') {\n this._input = this._readStartingBom(input);\n // If a callback was passed, asynchronously call it\n if (typeof callback === 'function')\n queueMicrotask(() => this._tokenizeToEnd(callback, true));\n // If no callback was passed, tokenize synchronously and return\n else {\n const tokens = [];\n let error;\n this._tokenizeToEnd((e, t) => e ? (error = e) : tokens.push(t), true);\n if (error) throw error;\n return tokens;\n }\n }\n // Otherwise, the input must be a stream\n else {\n this._pendingBuffer = null;\n if (typeof input.setEncoding === 'function')\n input.setEncoding('utf8');\n // Adds the data chunk to the buffer and parses as far as possible\n input.on('data', data => {\n if (this._input !== null && data.length !== 0) {\n // Prepend any previous pending writes\n if (this._pendingBuffer) {\n data = Buffer.concat([this._pendingBuffer, data]);\n this._pendingBuffer = null;\n }\n // Hold if the buffer ends in an incomplete unicode sequence\n if (data[data.length - 1] & 0x80) {\n this._pendingBuffer = data;\n }\n // Otherwise, tokenize as far as possible\n else {\n // Only read a BOM at the start\n if (typeof this._input === 'undefined')\n this._input = this._readStartingBom(typeof data === 'string' ? data : data.toString());\n else\n this._input += data;\n this._tokenizeToEnd(callback, false);\n }\n }\n });\n // Parses until the end\n input.on('end', () => {\n if (typeof this._input === 'string')\n this._tokenizeToEnd(callback, true);\n });\n input.on('error', callback);\n }\n }\n}\n","// N3.js implementations of the RDF/JS core data types\n// See http://rdf.js.org/data-model-spec/\n\nimport namespaces from './IRIs';\n\nconst { rdf, xsd } = namespaces;\n\n// eslint-disable-next-line prefer-const\nlet DEFAULTGRAPH;\nlet _blankNodeCounter = 0;\n\nconst escapedLiteral = /^\"(.*\".*)(?=\"[^\"]*$)/;\n\n// ## DataFactory singleton\nconst DataFactory = {\n namedNode,\n blankNode,\n variable,\n literal,\n defaultGraph,\n quad,\n triple: quad,\n fromTerm,\n fromQuad,\n};\nexport default DataFactory;\n\n// ## Term constructor\nexport class Term {\n constructor(id) {\n this.id = id;\n }\n\n // ### The value of this term\n get value() {\n return this.id;\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both terms were created by this library,\n // equality can be computed through ids\n if (other instanceof Term)\n return this.id === other.id;\n // Otherwise, compare term type and value\n return !!other && this.termType === other.termType &&\n this.value === other.value;\n }\n\n // ### Implement hashCode for Immutable.js, since we implement `equals`\n // https://immutable-js.com/docs/v4.0.0/ValueObject/#hashCode()\n hashCode() {\n return 0;\n }\n\n // ### Returns a plain object representation of this term\n toJSON() {\n return {\n termType: this.termType,\n value: this.value,\n };\n }\n}\n\n\n// ## NamedNode constructor\nexport class NamedNode extends Term {\n // ### The term type of this term\n get termType() {\n return 'NamedNode';\n }\n}\n\n// ## Literal constructor\nexport class Literal extends Term {\n // ### The term type of this term\n get termType() {\n return 'Literal';\n }\n\n // ### The text value of this literal\n get value() {\n return this.id.substring(1, this.id.lastIndexOf('\"'));\n }\n\n // ### The language of this literal\n get language() {\n // Find the last quotation mark (e.g., '\"abc\"@en-us')\n const id = this.id;\n let atPos = id.lastIndexOf('\"') + 1;\n // If \"@\" it follows, return the remaining substring; empty otherwise\n return atPos < id.length && id[atPos++] === '@' ? id.substr(atPos).toLowerCase() : '';\n }\n\n // ### The datatype IRI of this literal\n get datatype() {\n return new NamedNode(this.datatypeString);\n }\n\n // ### The datatype string of this literal\n get datatypeString() {\n // Find the last quotation mark (e.g., '\"abc\"^^http://ex.org/types#t')\n const id = this.id, dtPos = id.lastIndexOf('\"') + 1;\n const char = dtPos < id.length ? id[dtPos] : '';\n // If \"^\" it follows, return the remaining substring\n return char === '^' ? id.substr(dtPos + 2) :\n // If \"@\" follows, return rdf:langString; xsd:string otherwise\n (char !== '@' ? xsd.string : rdf.langString);\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both literals were created by this library,\n // equality can be computed through ids\n if (other instanceof Literal)\n return this.id === other.id;\n // Otherwise, compare term type, value, language, and datatype\n return !!other && !!other.datatype &&\n this.termType === other.termType &&\n this.value === other.value &&\n this.language === other.language &&\n this.datatype.value === other.datatype.value;\n }\n\n toJSON() {\n return {\n termType: this.termType,\n value: this.value,\n language: this.language,\n datatype: { termType: 'NamedNode', value: this.datatypeString },\n };\n }\n}\n\n// ## BlankNode constructor\nexport class BlankNode extends Term {\n constructor(name) {\n super(`_:${name}`);\n }\n\n // ### The term type of this term\n get termType() {\n return 'BlankNode';\n }\n\n // ### The name of this blank node\n get value() {\n return this.id.substr(2);\n }\n}\n\nexport class Variable extends Term {\n constructor(name) {\n super(`?${name}`);\n }\n\n // ### The term type of this term\n get termType() {\n return 'Variable';\n }\n\n // ### The name of this variable\n get value() {\n return this.id.substr(1);\n }\n}\n\n// ## DefaultGraph constructor\nexport class DefaultGraph extends Term {\n constructor() {\n super('');\n return DEFAULTGRAPH || this;\n }\n\n // ### The term type of this term\n get termType() {\n return 'DefaultGraph';\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both terms were created by this library,\n // equality can be computed through strict equality;\n // otherwise, compare term types.\n return (this === other) || (!!other && (this.termType === other.termType));\n }\n}\n\n// ## DefaultGraph singleton\nDEFAULTGRAPH = new DefaultGraph();\n\n// ### Constructs a term from the given internal string ID\n// The third 'nested' parameter of this function is to aid\n// with recursion over nested terms. It should not be used\n// by consumers of this library.\n// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725\nexport function termFromId(id, factory, nested) {\n factory = factory || DataFactory;\n\n // Falsy value or empty string indicate the default graph\n if (!id)\n return factory.defaultGraph();\n\n // Identify the term type based on the first character\n switch (id[0]) {\n case '?':\n return factory.variable(id.substr(1));\n case '_':\n return factory.blankNode(id.substr(2));\n case '\"':\n // Shortcut for internal literals\n if (factory === DataFactory)\n return new Literal(id);\n // Literal without datatype or language\n if (id[id.length - 1] === '\"')\n return factory.literal(id.substr(1, id.length - 2));\n // Literal with datatype or language\n const endPos = id.lastIndexOf('\"', id.length - 1);\n return factory.literal(id.substr(1, endPos - 1),\n id[endPos + 1] === '@' ? id.substr(endPos + 2)\n : factory.namedNode(id.substr(endPos + 3)));\n case '[':\n id = JSON.parse(id);\n break;\n default:\n if (!nested || !Array.isArray(id)) {\n return factory.namedNode(id);\n }\n }\n return factory.quad(\n termFromId(id[0], factory, true),\n termFromId(id[1], factory, true),\n termFromId(id[2], factory, true),\n id[3] && termFromId(id[3], factory, true),\n );\n}\n\n// ### Constructs an internal string ID from the given term or ID string\n// The third 'nested' parameter of this function is to aid\n// with recursion over nested terms. It should not be used\n// by consumers of this library.\n// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725\nexport function termToId(term, nested) {\n if (typeof term === 'string')\n return term;\n if (term instanceof Term && term.termType !== 'Quad')\n return term.id;\n if (!term)\n return DEFAULTGRAPH.id;\n\n // Term instantiated with another library\n switch (term.termType) {\n case 'NamedNode': return term.value;\n case 'BlankNode': return `_:${term.value}`;\n case 'Variable': return `?${term.value}`;\n case 'DefaultGraph': return '';\n case 'Literal': return `\"${term.value}\"${\n term.language ? `@${term.language}` :\n (term.datatype && term.datatype.value !== xsd.string ? `^^${term.datatype.value}` : '')}`;\n case 'Quad':\n const res = [\n termToId(term.subject, true),\n termToId(term.predicate, true),\n termToId(term.object, true),\n ];\n if (term.graph && term.graph.termType !== 'DefaultGraph') {\n res.push(termToId(term.graph, true));\n }\n return nested ? res : JSON.stringify(res);\n default: throw new Error(`Unexpected termType: ${term.termType}`);\n }\n}\n\n\n// ## Quad constructor\nexport class Quad extends Term {\n constructor(subject, predicate, object, graph) {\n super('');\n this._subject = subject;\n this._predicate = predicate;\n this._object = object;\n this._graph = graph || DEFAULTGRAPH;\n }\n\n // ### The term type of this term\n get termType() {\n return 'Quad';\n }\n\n get subject() {\n return this._subject;\n }\n\n get predicate() {\n return this._predicate;\n }\n\n get object() {\n return this._object;\n }\n\n get graph() {\n return this._graph;\n }\n\n // ### Returns a plain object representation of this quad\n toJSON() {\n return {\n termType: this.termType,\n subject: this._subject.toJSON(),\n predicate: this._predicate.toJSON(),\n object: this._object.toJSON(),\n graph: this._graph.toJSON(),\n };\n }\n\n // ### Returns whether this object represents the same quad as the other\n equals(other) {\n return !!other && this._subject.equals(other.subject) &&\n this._predicate.equals(other.predicate) &&\n this._object.equals(other.object) &&\n this._graph.equals(other.graph);\n }\n}\nexport { Quad as Triple };\n\n// ### Escapes the quotes within the given literal\nexport function escapeQuotes(id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"/g, '\"\"')}`);\n}\n\n// ### Unescapes the quotes within the given literal\nexport function unescapeQuotes(id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"\"/g, '\"')}`);\n}\n\n// ### Creates an IRI\nfunction namedNode(iri) {\n return new NamedNode(iri);\n}\n\n// ### Creates a blank node\nfunction blankNode(name) {\n return new BlankNode(name || `n3-${_blankNodeCounter++}`);\n}\n\n// ### Creates a literal\nfunction literal(value, languageOrDataType) {\n // Create a language-tagged string\n if (typeof languageOrDataType === 'string')\n return new Literal(`\"${value}\"@${languageOrDataType.toLowerCase()}`);\n\n // Automatically determine datatype for booleans and numbers\n let datatype = languageOrDataType ? languageOrDataType.value : '';\n if (datatype === '') {\n // Convert a boolean\n if (typeof value === 'boolean')\n datatype = xsd.boolean;\n // Convert an integer or double\n else if (typeof value === 'number') {\n if (Number.isFinite(value))\n datatype = Number.isInteger(value) ? xsd.integer : xsd.double;\n else {\n datatype = xsd.double;\n if (!Number.isNaN(value))\n value = value > 0 ? 'INF' : '-INF';\n }\n }\n }\n\n // Create a datatyped literal\n return (datatype === '' || datatype === xsd.string) ?\n new Literal(`\"${value}\"`) :\n new Literal(`\"${value}\"^^${datatype}`);\n}\n\n// ### Creates a variable\nfunction variable(name) {\n return new Variable(name);\n}\n\n// ### Returns the default graph\nfunction defaultGraph() {\n return DEFAULTGRAPH;\n}\n\n// ### Creates a quad\nfunction quad(subject, predicate, object, graph) {\n return new Quad(subject, predicate, object, graph);\n}\n\nexport function fromTerm(term) {\n if (term instanceof Term)\n return term;\n\n // Term instantiated with another library\n switch (term.termType) {\n case 'NamedNode': return namedNode(term.value);\n case 'BlankNode': return blankNode(term.value);\n case 'Variable': return variable(term.value);\n case 'DefaultGraph': return DEFAULTGRAPH;\n case 'Literal': return literal(term.value, term.language || term.datatype);\n case 'Quad': return fromQuad(term);\n default: throw new Error(`Unexpected termType: ${term.termType}`);\n }\n}\n\nexport function fromQuad(inQuad) {\n if (inQuad instanceof Quad)\n return inQuad;\n\n if (inQuad.termType !== 'Quad')\n throw new Error(`Unexpected termType: ${inQuad.termType}`);\n\n return quad(fromTerm(inQuad.subject), fromTerm(inQuad.predicate), fromTerm(inQuad.object), fromTerm(inQuad.graph));\n}\n","// **N3Parser** parses N3 documents.\nimport N3Lexer from './N3Lexer';\nimport N3DataFactory from './N3DataFactory';\nimport namespaces from './IRIs';\n\nlet blankNodePrefix = 0;\n\n// ## Constructor\nexport default class N3Parser {\n constructor(options) {\n this._contextStack = [];\n this._graph = null;\n\n // Set the document IRI\n options = options || {};\n this._setBase(options.baseIRI);\n options.factory && initDataFactory(this, options.factory);\n\n // Set supported features depending on the format\n const format = (typeof options.format === 'string') ?\n options.format.match(/\\w*$/)[0].toLowerCase() : '',\n isTurtle = /turtle/.test(format), isTriG = /trig/.test(format),\n isNTriples = /triple/.test(format), isNQuads = /quad/.test(format),\n isN3 = this._n3Mode = /n3/.test(format),\n isLineMode = isNTriples || isNQuads;\n if (!(this._supportsNamedGraphs = !(isTurtle || isN3)))\n this._readPredicateOrNamedGraph = this._readPredicate;\n // Support triples in other graphs\n this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);\n // Whether the log:isImpliedBy predicate is supported\n this._isImpliedBy = options.isImpliedBy;\n // Support nesting of triples\n this._supportsRDFStar = format === '' || /star|\\*$/.test(format);\n // Disable relative IRIs in N-Triples or N-Quads mode\n if (isLineMode)\n this._resolveRelativeIRI = iri => { return null; };\n this._blankNodePrefix = typeof options.blankNodePrefix !== 'string' ? '' :\n options.blankNodePrefix.replace(/^(?!_:)/, '_:');\n this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3, isImpliedBy: this._isImpliedBy });\n // Disable explicit quantifiers by default\n this._explicitQuantifiers = !!options.explicitQuantifiers;\n }\n\n // ## Static class methods\n\n // ### `_resetBlankNodePrefix` restarts blank node prefix identification\n static _resetBlankNodePrefix() {\n blankNodePrefix = 0;\n }\n\n // ## Private methods\n\n // ### `_setBase` sets the base IRI to resolve relative IRIs\n _setBase(baseIRI) {\n if (!baseIRI) {\n this._base = '';\n this._basePath = '';\n }\n else {\n // Remove fragment if present\n const fragmentPos = baseIRI.indexOf('#');\n if (fragmentPos >= 0)\n baseIRI = baseIRI.substr(0, fragmentPos);\n // Set base IRI and its components\n this._base = baseIRI;\n this._basePath = baseIRI.indexOf('/') < 0 ? baseIRI :\n baseIRI.replace(/[^\\/?]*(?:\\?.*)?$/, '');\n baseIRI = baseIRI.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\\/\\/[^\\/]*)?/i);\n this._baseRoot = baseIRI[0];\n this._baseScheme = baseIRI[1];\n }\n }\n\n // ### `_saveContext` stores the current parsing context\n // when entering a new scope (list, blank node, formula)\n _saveContext(type, graph, subject, predicate, object) {\n const n3Mode = this._n3Mode;\n this._contextStack.push({\n type,\n subject, predicate, object, graph,\n inverse: n3Mode ? this._inversePredicate : false,\n blankPrefix: n3Mode ? this._prefixes._ : '',\n quantified: n3Mode ? this._quantified : null,\n });\n // The settings below only apply to N3 streams\n if (n3Mode) {\n // Every new scope resets the predicate direction\n this._inversePredicate = false;\n // In N3, blank nodes are scoped to a formula\n // (using a dot as separator, as a blank node label cannot start with it)\n this._prefixes._ = (this._graph ? `${this._graph.value}.` : '.');\n // Quantifiers are scoped to a formula\n this._quantified = Object.create(this._quantified);\n }\n }\n\n // ### `_restoreContext` restores the parent context\n // when leaving a scope (list, blank node, formula)\n _restoreContext(type, token) {\n // Obtain the previous context\n const context = this._contextStack.pop();\n if (!context || context.type !== type)\n return this._error(`Unexpected ${token.type}`, token);\n\n // Restore the quad of the previous context\n this._subject = context.subject;\n this._predicate = context.predicate;\n this._object = context.object;\n this._graph = context.graph;\n\n // Restore N3 context settings\n if (this._n3Mode) {\n this._inversePredicate = context.inverse;\n this._prefixes._ = context.blankPrefix;\n this._quantified = context.quantified;\n }\n }\n\n // ### `_readInTopContext` reads a token when in the top context\n _readInTopContext(token) {\n switch (token.type) {\n // If an EOF token arrives in the top context, signal that we're done\n case 'eof':\n if (this._graph !== null)\n return this._error('Unclosed graph', token);\n delete this._prefixes._;\n return this._callback(null, null, this._prefixes);\n // It could be a prefix declaration\n case 'PREFIX':\n this._sparqlStyle = true;\n case '@prefix':\n return this._readPrefix;\n // It could be a base declaration\n case 'BASE':\n this._sparqlStyle = true;\n case '@base':\n return this._readBaseIRI;\n // It could be a graph\n case '{':\n if (this._supportsNamedGraphs) {\n this._graph = '';\n this._subject = null;\n return this._readSubject;\n }\n case 'GRAPH':\n if (this._supportsNamedGraphs)\n return this._readNamedGraphLabel;\n // Otherwise, the next token must be a subject\n default:\n return this._readSubject(token);\n }\n }\n\n // ### `_readEntity` reads an IRI, prefixed name, blank node, or variable\n _readEntity(token, quantifier) {\n let value;\n switch (token.type) {\n // Read a relative or absolute IRI\n case 'IRI':\n case 'typeIRI':\n const iri = this._resolveIRI(token.value);\n if (iri === null)\n return this._error('Invalid IRI', token);\n value = this._factory.namedNode(iri);\n break;\n // Read a prefixed name\n case 'type':\n case 'prefixed':\n const prefix = this._prefixes[token.prefix];\n if (prefix === undefined)\n return this._error(`Undefined prefix \"${token.prefix}:\"`, token);\n value = this._factory.namedNode(prefix + token.value);\n break;\n // Read a blank node\n case 'blank':\n value = this._factory.blankNode(this._prefixes[token.prefix] + token.value);\n break;\n // Read a variable\n case 'var':\n value = this._factory.variable(token.value.substr(1));\n break;\n // Everything else is not an entity\n default:\n return this._error(`Expected entity but got ${token.type}`, token);\n }\n // In N3 mode, replace the entity if it is quantified\n if (!quantifier && this._n3Mode && (value.id in this._quantified))\n value = this._quantified[value.id];\n return value;\n }\n\n // ### `_readSubject` reads a quad's subject\n _readSubject(token) {\n this._predicate = null;\n switch (token.type) {\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph,\n this._subject = this._factory.blankNode(), null, null);\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this.RDF_NIL, null, null);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph,\n this._graph = this._factory.blankNode(), null, null);\n return this._readSubject;\n case '}':\n // No subject; the graph in which we are reading is closed instead\n return this._readPunctuation(token);\n case '@forSome':\n if (!this._n3Mode)\n return this._error('Unexpected \"@forSome\"', token);\n this._subject = null;\n this._predicate = this.N3_FORSOME;\n this._quantifier = 'blankNode';\n return this._readQuantifierList;\n case '@forAll':\n if (!this._n3Mode)\n return this._error('Unexpected \"@forAll\"', token);\n this._subject = null;\n this._predicate = this.N3_FORALL;\n this._quantifier = 'variable';\n return this._readQuantifierList;\n case 'literal':\n if (!this._n3Mode)\n return this._error('Unexpected literal', token);\n\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._completeSubjectLiteral;\n }\n else\n this._subject = this._factory.literal(token.value, this._factory.namedNode(token.prefix));\n\n break;\n case '<<':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF-star syntax', token);\n this._saveContext('<<', this._graph, null, null, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the subject entity\n if ((this._subject = this._readEntity(token)) === undefined)\n return;\n // In N3 mode, the subject might be a path\n if (this._n3Mode)\n return this._getPathReader(this._readPredicateOrNamedGraph);\n }\n\n // The next token must be a predicate,\n // or, if the subject was actually a graph IRI, a named graph\n return this._readPredicateOrNamedGraph;\n }\n\n // ### `_readPredicate` reads a quad's predicate\n _readPredicate(token) {\n const type = token.type;\n switch (type) {\n case 'inverse':\n this._inversePredicate = true;\n case 'abbreviation':\n this._predicate = this.ABBREVIATIONS[token.value];\n break;\n case '.':\n case ']':\n case '}':\n // Expected predicate didn't come, must have been trailing semicolon\n if (this._predicate === null)\n return this._error(`Unexpected ${type}`, token);\n this._subject = null;\n return type === ']' ? this._readBlankNodeTail(token) : this._readPunctuation(token);\n case ';':\n // Additional semicolons can be safely ignored\n return this._predicate !== null ? this._readPredicate :\n this._error('Expected predicate but got ;', token);\n case '[':\n if (this._n3Mode) {\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject,\n this._subject = this._factory.blankNode(), null);\n return this._readBlankNodeHead;\n }\n case 'blank':\n if (!this._n3Mode)\n return this._error('Disallowed blank node as predicate', token);\n default:\n if ((this._predicate = this._readEntity(token)) === undefined)\n return;\n }\n // The next token must be an object\n return this._readObject;\n }\n\n // ### `_readObject` reads a quad's object\n _readObject(token) {\n switch (token.type) {\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._readDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else\n this._object = this._factory.literal(token.value, this._factory.namedNode(token.prefix));\n break;\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject, this._predicate,\n this._subject = this._factory.blankNode());\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this._subject, this._predicate, this.RDF_NIL);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate,\n this._graph = this._factory.blankNode());\n return this._readSubject;\n case '<<':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF-star syntax', token);\n this._saveContext('<<', this._graph, this._subject, this._predicate, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the object entity\n if ((this._object = this._readEntity(token)) === undefined)\n return;\n // In N3 mode, the object might be a path\n if (this._n3Mode)\n return this._getPathReader(this._getContextEndReader());\n }\n return this._getContextEndReader();\n }\n\n // ### `_readPredicateOrNamedGraph` reads a quad's predicate, or a named graph\n _readPredicateOrNamedGraph(token) {\n return token.type === '{' ? this._readGraph(token) : this._readPredicate(token);\n }\n\n // ### `_readGraph` reads a graph\n _readGraph(token) {\n if (token.type !== '{')\n return this._error(`Expected graph but got ${token.type}`, token);\n // The \"subject\" we read is actually the GRAPH's label\n this._graph = this._subject, this._subject = null;\n return this._readSubject;\n }\n\n // ### `_readBlankNodeHead` reads the head of a blank node\n _readBlankNodeHead(token) {\n if (token.type === ']') {\n this._subject = null;\n return this._readBlankNodeTail(token);\n }\n else {\n this._predicate = null;\n return this._readPredicate(token);\n }\n }\n\n // ### `_readBlankNodeTail` reads the end of a blank node\n _readBlankNodeTail(token) {\n if (token.type !== ']')\n return this._readBlankNodePunctuation(token);\n\n // Store blank node quad\n if (this._subject !== null)\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n // Restore the parent context containing this blank node\n const empty = this._predicate === null;\n this._restoreContext('blank', token);\n // If the blank node was the object, restore previous context and read punctuation\n if (this._object !== null)\n return this._getContextEndReader();\n // If the blank node was the predicate, continue reading the object\n else if (this._predicate !== null)\n return this._readObject;\n // If the blank node was the subject, continue reading the predicate\n else\n // If the blank node was empty, it could be a named graph label\n return empty ? this._readPredicateOrNamedGraph : this._readPredicateAfterBlank;\n }\n\n // ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node\n _readPredicateAfterBlank(token) {\n switch (token.type) {\n case '.':\n case '}':\n // No predicate is coming if the triple is terminated here\n this._subject = null;\n return this._readPunctuation(token);\n default:\n return this._readPredicate(token);\n }\n }\n\n // ### `_readListItem` reads items from a list\n _readListItem(token) {\n let item = null, // The item of the list\n list = null, // The list itself\n next = this._readListItem; // The next function to execute\n const previousList = this._subject, // The previous list that contains this list\n stack = this._contextStack, // The stack of parent contexts\n parent = stack[stack.length - 1]; // The parent containing the current list\n\n switch (token.type) {\n case '[':\n // Stack the current list quad and start a new quad with a blank node as subject\n this._saveContext('blank', this._graph,\n list = this._factory.blankNode(), this.RDF_FIRST,\n this._subject = item = this._factory.blankNode());\n next = this._readBlankNodeHead;\n break;\n case '(':\n // Stack the current list quad and start a new list\n this._saveContext('list', this._graph,\n list = this._factory.blankNode(), this.RDF_FIRST, this.RDF_NIL);\n this._subject = null;\n break;\n case ')':\n // Closing the list; restore the parent context\n this._restoreContext('list', token);\n // If this list is contained within a parent list, return the membership quad here.\n // This will be `<parent list element> rdf:first <this list>.`.\n if (stack.length !== 0 && stack[stack.length - 1].type === 'list')\n this._emit(this._subject, this._predicate, this._object, this._graph);\n // Was this list the parent's subject?\n if (this._predicate === null) {\n // The next token is the predicate\n next = this._readPredicate;\n // No list tail if this was an empty list\n if (this._subject === this.RDF_NIL)\n return next;\n }\n // The list was in the parent context's object\n else {\n next = this._getContextEndReader();\n // No list tail if this was an empty list\n if (this._object === this.RDF_NIL)\n return next;\n }\n // Close the list by making the head nil\n list = this.RDF_NIL;\n break;\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n next = this._readListItemDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else {\n item = this._factory.literal(token.value, this._factory.namedNode(token.prefix));\n next = this._getContextEndReader();\n }\n break;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate,\n this._graph = this._factory.blankNode());\n return this._readSubject;\n default:\n if ((item = this._readEntity(token)) === undefined)\n return;\n }\n\n // Create a new blank node if no item head was assigned yet\n if (list === null)\n this._subject = list = this._factory.blankNode();\n\n // Is this the first element of the list?\n if (previousList === null) {\n // This list is either the subject or the object of its parent\n if (parent.predicate === null)\n parent.subject = list;\n else\n parent.object = list;\n }\n else {\n // Continue the previous list with the current list\n this._emit(previousList, this.RDF_REST, list, this._graph);\n }\n // If an item was read, add it to the list\n if (item !== null) {\n // In N3 mode, the item might be a path\n if (this._n3Mode && (token.type === 'IRI' || token.type === 'prefixed')) {\n // Create a new context to add the item's path\n this._saveContext('item', this._graph, list, this.RDF_FIRST, item);\n this._subject = item, this._predicate = null;\n // _readPath will restore the context and output the item\n return this._getPathReader(this._readListItem);\n }\n // Output the item\n this._emit(list, this.RDF_FIRST, item, this._graph);\n }\n return next;\n }\n\n // ### `_readDataTypeOrLang` reads an _optional_ datatype or language\n _readDataTypeOrLang(token) {\n return this._completeObjectLiteral(token, false);\n }\n\n\n // ### `_readListItemDataTypeOrLang` reads an _optional_ datatype or language in a list\n _readListItemDataTypeOrLang(token) {\n return this._completeObjectLiteral(token, true);\n }\n\n // ### `_completeLiteral` completes a literal with an optional datatype or language\n _completeLiteral(token) {\n // Create a simple string literal by default\n let literal = this._factory.literal(this._literalValue);\n\n switch (token.type) {\n // Create a datatyped literal\n case 'type':\n case 'typeIRI':\n const datatype = this._readEntity(token);\n if (datatype === undefined) return; // No datatype means an error occurred\n literal = this._factory.literal(this._literalValue, datatype);\n token = null;\n break;\n // Create a language-tagged string\n case 'langcode':\n literal = this._factory.literal(this._literalValue, token.value);\n token = null;\n break;\n }\n\n return { token, literal };\n }\n\n // Completes a literal in subject position\n _completeSubjectLiteral(token) {\n this._subject = this._completeLiteral(token).literal;\n return this._readPredicateOrNamedGraph;\n }\n\n // Completes a literal in object position\n _completeObjectLiteral(token, listItem) {\n const completed = this._completeLiteral(token);\n if (!completed)\n return;\n this._object = completed.literal;\n\n // If this literal was part of a list, write the item\n // (we could also check the context stack, but passing in a flag is faster)\n if (listItem)\n this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);\n // If the token was consumed, continue with the rest of the input\n if (completed.token === null)\n return this._getContextEndReader();\n // Otherwise, consume the token now\n else {\n this._readCallback = this._getContextEndReader();\n return this._readCallback(completed.token);\n }\n }\n\n // ### `_readFormulaTail` reads the end of a formula\n _readFormulaTail(token) {\n if (token.type !== '}')\n return this._readPunctuation(token);\n\n // Store the last quad of the formula\n if (this._subject !== null)\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n // Restore the parent context containing this formula\n this._restoreContext('formula', token);\n // If the formula was the subject, continue reading the predicate.\n // If the formula was the object, read punctuation.\n return this._object === null ? this._readPredicate : this._getContextEndReader();\n }\n\n // ### `_readPunctuation` reads punctuation between quads or quad parts\n _readPunctuation(token) {\n let next, graph = this._graph;\n const subject = this._subject, inversePredicate = this._inversePredicate;\n switch (token.type) {\n // A closing brace ends a graph\n case '}':\n if (this._graph === null)\n return this._error('Unexpected graph closing', token);\n if (this._n3Mode)\n return this._readFormulaTail(token);\n this._graph = null;\n // A dot just ends the statement, without sharing anything with the next\n case '.':\n this._subject = null;\n next = this._contextStack.length ? this._readSubject : this._readInTopContext;\n if (inversePredicate) this._inversePredicate = false;\n break;\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n // {| means that the current triple is annotated with predicate-object pairs.\n case '{|':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF-star syntax', token);\n // Continue using the last triple as quoted triple subject for the predicate-object pairs.\n const predicate = this._predicate, object = this._object;\n this._subject = this._factory.quad(subject, predicate, object, this.DEFAULTGRAPH);\n next = this._readPredicate;\n break;\n // |} means that the current quoted triple in annotation syntax is finalized.\n case '|}':\n if (this._subject.termType !== 'Quad')\n return this._error('Unexpected asserted triple closing', token);\n this._subject = null;\n next = this._readPunctuation;\n break;\n default:\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (graph = this._readEntity(token)) !== undefined) {\n next = this._readQuadPunctuation;\n break;\n }\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n if (subject !== null) {\n const predicate = this._predicate, object = this._object;\n if (!inversePredicate)\n this._emit(subject, predicate, object, graph);\n else\n this._emit(object, predicate, subject, graph);\n }\n return next;\n }\n\n // ### `_readBlankNodePunctuation` reads punctuation in a blank node\n _readBlankNodePunctuation(token) {\n let next;\n switch (token.type) {\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n default:\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n this._emit(this._subject, this._predicate, this._object, this._graph);\n return next;\n }\n\n // ### `_readQuadPunctuation` reads punctuation after a quad\n _readQuadPunctuation(token) {\n if (token.type !== '.')\n return this._error('Expected dot to follow quad', token);\n return this._readInTopContext;\n }\n\n // ### `_readPrefix` reads the prefix of a prefix declaration\n _readPrefix(token) {\n if (token.type !== 'prefix')\n return this._error('Expected prefix to follow @prefix', token);\n this._prefix = token.value;\n return this._readPrefixIRI;\n }\n\n // ### `_readPrefixIRI` reads the IRI of a prefix declaration\n _readPrefixIRI(token) {\n if (token.type !== 'IRI')\n return this._error(`Expected IRI to follow prefix \"${this._prefix}:\"`, token);\n const prefixNode = this._readEntity(token);\n this._prefixes[this._prefix] = prefixNode.value;\n this._prefixCallback(this._prefix, prefixNode);\n return this._readDeclarationPunctuation;\n }\n\n // ### `_readBaseIRI` reads the IRI of a base declaration\n _readBaseIRI(token) {\n const iri = token.type === 'IRI' && this._resolveIRI(token.value);\n if (!iri)\n return this._error('Expected valid IRI to follow base declaration', token);\n this._setBase(iri);\n return this._readDeclarationPunctuation;\n }\n\n // ### `_readNamedGraphLabel` reads the label of a named graph\n _readNamedGraphLabel(token) {\n switch (token.type) {\n case 'IRI':\n case 'blank':\n case 'prefixed':\n return this._readSubject(token), this._readGraph;\n case '[':\n return this._readNamedGraphBlankLabel;\n default:\n return this._error('Invalid graph label', token);\n }\n }\n\n // ### `_readNamedGraphLabel` reads a blank node label of a named graph\n _readNamedGraphBlankLabel(token) {\n if (token.type !== ']')\n return this._error('Invalid graph label', token);\n this._subject = this._factory.blankNode();\n return this._readGraph;\n }\n\n // ### `_readDeclarationPunctuation` reads the punctuation of a declaration\n _readDeclarationPunctuation(token) {\n // SPARQL-style declarations don't have punctuation\n if (this._sparqlStyle) {\n this._sparqlStyle = false;\n return this._readInTopContext(token);\n }\n\n if (token.type !== '.')\n return this._error('Expected declaration to end with a dot', token);\n return this._readInTopContext;\n }\n\n // Reads a list of quantified symbols from a @forSome or @forAll statement\n _readQuantifierList(token) {\n let entity;\n switch (token.type) {\n case 'IRI':\n case 'prefixed':\n if ((entity = this._readEntity(token, true)) !== undefined)\n break;\n default:\n return this._error(`Unexpected ${token.type}`, token);\n }\n // Without explicit quantifiers, map entities to a quantified entity\n if (!this._explicitQuantifiers)\n this._quantified[entity.id] = this._factory[this._quantifier](this._factory.blankNode().value);\n // With explicit quantifiers, output the reified quantifier\n else {\n // If this is the first item, start a new quantifier list\n if (this._subject === null)\n this._emit(this._graph || this.DEFAULTGRAPH, this._predicate,\n this._subject = this._factory.blankNode(), this.QUANTIFIERS_GRAPH);\n // Otherwise, continue the previous list\n else\n this._emit(this._subject, this.RDF_REST,\n this._subject = this._factory.blankNode(), this.QUANTIFIERS_GRAPH);\n // Output the list item\n this._emit(this._subject, this.RDF_FIRST, entity, this.QUANTIFIERS_GRAPH);\n }\n return this._readQuantifierPunctuation;\n }\n\n // Reads punctuation from a @forSome or @forAll statement\n _readQuantifierPunctuation(token) {\n // Read more quantifiers\n if (token.type === ',')\n return this._readQuantifierList;\n // End of the quantifier list\n else {\n // With explicit quantifiers, close the quantifier list\n if (this._explicitQuantifiers) {\n this._emit(this._subject, this.RDF_REST, this.RDF_NIL, this.QUANTIFIERS_GRAPH);\n this._subject = null;\n }\n // Read a dot\n this._readCallback = this._getContextEndReader();\n return this._readCallback(token);\n }\n }\n\n // ### `_getPathReader` reads a potential path and then resumes with the given function\n _getPathReader(afterPath) {\n this._afterPath = afterPath;\n return this._readPath;\n }\n\n // ### `_readPath` reads a potential path\n _readPath(token) {\n switch (token.type) {\n // Forward path\n case '!': return this._readForwardPath;\n // Backward path\n case '^': return this._readBackwardPath;\n // Not a path; resume reading where we left off\n default:\n const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];\n // If we were reading a list item, we still need to output it\n if (parent && parent.type === 'item') {\n // The list item is the remaining subejct after reading the path\n const item = this._subject;\n // Switch back to the context of the list\n this._restoreContext('item', token);\n // Output the list item\n this._emit(this._subject, this.RDF_FIRST, item, this._graph);\n }\n return this._afterPath(token);\n }\n }\n\n // ### `_readForwardPath` reads a '!' path\n _readForwardPath(token) {\n let subject, predicate;\n const object = this._factory.blankNode();\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's object\n if (this._predicate === null)\n subject = this._subject, this._subject = object;\n // If we were reading an object, replace the subject by the path's object\n else\n subject = this._object, this._object = object;\n // Emit the path's current quad and read its next section\n this._emit(subject, predicate, object, this._graph);\n return this._readPath;\n }\n\n // ### `_readBackwardPath` reads a '^' path\n _readBackwardPath(token) {\n const subject = this._factory.blankNode();\n let predicate, object;\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's subject\n if (this._predicate === null)\n object = this._subject, this._subject = subject;\n // If we were reading an object, replace the subject by the path's subject\n else\n object = this._object, this._object = subject;\n // Emit the path's current quad and read its next section\n this._emit(subject, predicate, object, this._graph);\n return this._readPath;\n }\n\n // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF-star quad or the end of a nested RDF-star triple\n _readRDFStarTailOrGraph(token) {\n if (token.type !== '>>') {\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token)) !== undefined)\n return this._readRDFStarTail;\n return this._error(`Expected >> to follow \"${this._object.id}\"`, token);\n }\n return this._readRDFStarTail(token);\n }\n\n // ### `_readRDFStarTail` reads the end of a nested RDF-star triple\n _readRDFStarTail(token) {\n if (token.type !== '>>')\n return this._error(`Expected >> but got ${token.type}`, token);\n // Read the quad and restore the previous context\n const quad = this._factory.quad(this._subject, this._predicate, this._object,\n this._graph || this.DEFAULTGRAPH);\n this._restoreContext('<<', token);\n // If the triple was the subject, continue by reading the predicate.\n if (this._subject === null) {\n this._subject = quad;\n return this._readPredicate;\n }\n // If the triple was the object, read context end.\n else {\n this._object = quad;\n return this._getContextEndReader();\n }\n }\n\n // ### `_getContextEndReader` gets the next reader function at the end of a context\n _getContextEndReader() {\n const contextStack = this._contextStack;\n if (!contextStack.length)\n return this._readPunctuation;\n\n switch (contextStack[contextStack.length - 1].type) {\n case 'blank':\n return this._readBlankNodeTail;\n case 'list':\n return this._readListItem;\n case 'formula':\n return this._readFormulaTail;\n case '<<':\n return this._readRDFStarTailOrGraph;\n }\n }\n\n // ### `_emit` sends a quad through the callback\n _emit(subject, predicate, object, graph) {\n this._callback(null, this._factory.quad(subject, predicate, object, graph || this.DEFAULTGRAPH));\n }\n\n // ### `_error` emits an error message through the callback\n _error(message, token) {\n const err = new Error(`${message} on line ${token.line}.`);\n err.context = {\n token: token,\n line: token.line,\n previousToken: this._lexer.previousToken,\n };\n this._callback(err);\n this._callback = noop;\n }\n\n // ### `_resolveIRI` resolves an IRI against the base path\n _resolveIRI(iri) {\n return /^[a-z][a-z0-9+.-]*:/i.test(iri) ? iri : this._resolveRelativeIRI(iri);\n }\n\n // ### `_resolveRelativeIRI` resolves an IRI against the base path,\n // assuming that a base path has been set and that the IRI is indeed relative\n _resolveRelativeIRI(iri) {\n // An empty relative IRI indicates the base IRI\n if (!iri.length)\n return this._base;\n // Decide resolving strategy based in the first character\n switch (iri[0]) {\n // Resolve relative fragment IRIs against the base IRI\n case '#': return this._base + iri;\n // Resolve relative query string IRIs by replacing the query string\n case '?': return this._base.replace(/(?:\\?.*)?$/, iri);\n // Resolve root-relative IRIs at the root of the base IRI\n case '/':\n // Resolve scheme-relative IRIs to the scheme\n return (iri[1] === '/' ? this._baseScheme : this._baseRoot) + this._removeDotSegments(iri);\n // Resolve all other IRIs at the base IRI's path\n default:\n // Relative IRIs cannot contain a colon in the first path segment\n return (/^[^/:]*:/.test(iri)) ? null : this._removeDotSegments(this._basePath + iri);\n }\n }\n\n // ### `_removeDotSegments` resolves './' and '../' path segments in an IRI as per RFC3986\n _removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri))\n return iri;\n\n // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n const length = iri.length;\n let result = '', i = -1, pathStart = -1, segmentStart = 0, next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/')\n // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/')\n i = pathStart;\n }\n break;\n // Don't modify a query string or fragment\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n case '.':\n next = iri[++i + 1];\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2);\n // Try to remove the parent path from result\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart)\n result = result.substr(0, segmentStart);\n // Remove a trailing '/..' segment\n if (next !== '/')\n return `${result}/${iri.substr(i + 1)}`;\n segmentStart = i + 1;\n }\n }\n }\n }\n next = iri[++i];\n }\n return result + iri.substring(segmentStart);\n }\n\n // ## Public methods\n\n // ### `parse` parses the N3 input and emits each parsed quad through the onQuad callback.\n parse(input, quadCallback, prefixCallback) {\n // The second parameter accepts an object { onQuad: ..., onPrefix: ..., onComment: ...}\n // As a second and third parameter it still accepts a separate quadCallback and prefixCallback for backward compatibility as well\n let onQuad, onPrefix, onComment;\n if (quadCallback && (quadCallback.onQuad || quadCallback.onPrefix || quadCallback.onComment)) {\n onQuad = quadCallback.onQuad;\n onPrefix = quadCallback.onPrefix;\n onComment = quadCallback.onComment;\n }\n else {\n onQuad = quadCallback;\n onPrefix = prefixCallback;\n }\n // The read callback is the next function to be executed when a token arrives.\n // We start reading in the top context.\n this._readCallback = this._readInTopContext;\n this._sparqlStyle = false;\n this._prefixes = Object.create(null);\n this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2)\n : `b${blankNodePrefix++}_`;\n this._prefixCallback = onPrefix || noop;\n this._inversePredicate = false;\n this._quantified = Object.create(null);\n\n // Parse synchronously if no quad callback is given\n if (!onQuad) {\n const quads = [];\n let error;\n this._callback = (e, t) => { e ? (error = e) : t && quads.push(t); };\n this._lexer.tokenize(input).every(token => {\n return this._readCallback = this._readCallback(token);\n });\n if (error) throw error;\n return quads;\n }\n\n let processNextToken = (error, token) => {\n if (error !== null)\n this._callback(error), this._callback = noop;\n else if (this._readCallback)\n this._readCallback = this._readCallback(token);\n };\n\n // Enable checking for comments on every token when a commentCallback has been set\n if (onComment) {\n // Enable the lexer to return comments as tokens first (disabled by default)\n this._lexer.comments = true;\n // Patch the processNextToken function\n processNextToken = (error, token) => {\n if (error !== null)\n this._callback(error), this._callback = noop;\n else if (this._readCallback) {\n if (token.type === 'comment')\n onComment(token.value);\n else\n this._readCallback = this._readCallback(token);\n }\n };\n }\n\n // Parse asynchronously otherwise, executing the read callback when a token arrives\n this._callback = onQuad;\n this._lexer.tokenize(input, processNextToken);\n }\n}\n\n// The empty function\nfunction noop() {}\n\n// Initializes the parser with the given data factory\nfunction initDataFactory(parser, factory) {\n parser._factory = factory;\n\n parser.DEFAULTGRAPH = factory.defaultGraph();\n\n // Set common named nodes\n parser.RDF_FIRST = factory.namedNode(namespaces.rdf.first);\n parser.RDF_REST = factory.namedNode(namespaces.rdf.rest);\n parser.RDF_NIL = factory.namedNode(namespaces.rdf.nil);\n parser.N3_FORALL = factory.namedNode(namespaces.r.forAll);\n parser.N3_FORSOME = factory.namedNode(namespaces.r.forSome);\n parser.ABBREVIATIONS = {\n 'a': factory.namedNode(namespaces.rdf.type),\n '=': factory.namedNode(namespaces.owl.sameAs),\n '>': factory.namedNode(namespaces.log.implies),\n '<': factory.namedNode(namespaces.log.isImpliedBy),\n };\n parser.QUANTIFIERS_GRAPH = factory.namedNode('urn:n3:quantifiers');\n}\ninitDataFactory(N3Parser.prototype, N3DataFactory);\n","// RDFa Parser for rdflib.js\n\n// Originally by: Alex Milowski\n// From https://github.com/alexmilowski/green-turtle\n// Converted: timbl 2015-08-25 not yet working\n// Added wrapper: csarven 2016-05-09 working\n\n// RDFaProcessor.prototype = new Object() // Was URIResolver\n\n// RDFaProcessor.prototype.constructor=RDFaProcessor\n\n// options.base = base URI not really an option, shopuld always be set.\n//\n\nimport BlankNode from './blank-node';\nimport Literal from './literal';\nimport NamedNode from './named-node';\nimport * as Uri from './uri';\nimport * as Util from './utils-js';\nimport rdf from './factories/canonical-data-factory';\nif (typeof Node === 'undefined') {\n // @@@@@@ Global. Interface to xmldom.\n var Node = {\n ELEMENT_NODE: 1,\n ATTRIBUTE_NODE: 2,\n TEXT_NODE: 3,\n CDATA_SECTION_NODE: 4,\n ENTITY_REFERENCE_NODE: 5,\n ENTITY_NODE: 6,\n PROCESSING_INSTRUCTION_NODE: 7,\n COMMENT_NODE: 8,\n DOCUMENT_NODE: 9,\n DOCUMENT_TYPE_NODE: 10,\n DOCUMENT_FRAGMENT_NODE: 11,\n NOTATION_NODE: 12\n };\n}\nexport default class RDFaProcessor {\n constructor(kb, options) {\n this.options = options || {};\n this.kb = kb;\n this.target = options.target || {\n graph: {\n subjects: {},\n prefixes: {},\n terms: {}\n }\n };\n // XXX: Added to track bnodes\n this.blankNodes = [];\n // XXX: Added for normalisation\n this.htmlOptions = {\n 'selfClosing': 'br img input area base basefont col colgroup source wbr isindex link meta param hr'\n };\n this.theOne = '_:' + new Date().getTime();\n this.language = null;\n this.vocabulary = null;\n this.blankCounter = 0;\n this.langAttributes = [{\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang'\n }];\n this.inXHTMLMode = false;\n this.absURIRE = /[\\w\\_\\-]+:\\S+/;\n this.finishedHandlers = [];\n this.init();\n }\n addTriple(origin, subject, predicate, object) {\n var su, ob, pr, or;\n if (typeof subject === 'undefined') {\n su = rdf.namedNode(this.options.base);\n } else {\n su = this.toRDFNodeObject(subject);\n }\n pr = this.toRDFNodeObject(predicate);\n ob = this.toRDFNodeObject(object);\n or = rdf.namedNode(this.options.base);\n // console.log('Adding { ' + su + ' ' + pr + ' ' + ob + ' ' + or + ' }')\n this.kb.add(su, pr, ob, or);\n }\n ancestorPath(node) {\n var path = '';\n while (node && node.nodeType !== Node.DOCUMENT_NODE) {\n path = '/' + node.localName + path;\n node = node.parentNode;\n }\n return path;\n }\n copyMappings(mappings) {\n var newMappings = {};\n for (var k in mappings) {\n newMappings[k] = mappings[k];\n }\n return newMappings;\n }\n copyProperties() {}\n deriveDateTimeType(value) {\n for (var i = 0; i < RDFaProcessor.dateTimeTypes.length; i++) {\n // console.log(\"Checking \"+value+\" against \"+RDFaProcessor.dateTimeTypes[i].type)\n var matched = RDFaProcessor.dateTimeTypes[i].pattern.exec(value);\n if (matched && matched[0].length === value.length) {\n // console.log(\"Matched!\")\n return RDFaProcessor.dateTimeTypes[i].type;\n }\n }\n return null;\n }\n init() {}\n newBlankNode() {\n this.blankCounter++;\n return '_:' + this.blankCounter;\n }\n newSubjectOrigin(origin, subject) {}\n parseCURIE(value, prefixes, base) {\n var colon = value.indexOf(':');\n var uri;\n if (colon >= 0) {\n var prefix = value.substring(0, colon);\n if (prefix === '') {\n // default prefix\n uri = prefixes[''];\n return uri ? uri + value.substring(colon + 1) : null;\n } else if (prefix === '_') {\n // blank node\n return '_:' + value.substring(colon + 1);\n } else if (RDFaProcessor.NCNAME.test(prefix)) {\n uri = prefixes[prefix];\n if (uri) {\n return uri + value.substring(colon + 1);\n }\n }\n }\n return null;\n }\n parseCURIEOrURI(value, prefixes, base) {\n var curie = this.parseCURIE(value, prefixes, base);\n if (curie) {\n return curie;\n }\n return this.resolveAndNormalize(base, value);\n }\n parsePredicate(value, defaultVocabulary, terms, prefixes, base, ignoreTerms) {\n if (value === '') {\n return null;\n }\n var predicate = this.parseTermOrCURIEOrAbsURI(value, defaultVocabulary, ignoreTerms ? null : terms, prefixes, base);\n if (predicate && predicate.indexOf('_:') === 0) {\n return null;\n }\n return predicate;\n }\n parsePrefixMappings(str, target) {\n var values = this.tokenize(str);\n var prefix = null;\n // var uri = null\n for (var i = 0; i < values.length; i++) {\n if (values[i][values[i].length - 1] === ':') {\n prefix = values[i].substring(0, values[i].length - 1);\n } else if (prefix) {\n target[prefix] = this.options.base ? Uri.join(values[i], this.options.base) : values[i];\n prefix = null;\n }\n }\n }\n static parseRDFaDOM(dom, kb, base) {\n var p = new RDFaProcessor(kb, {\n 'base': base\n });\n // Cannot assign to read only property 'baseURI' of object '#<XMLDocument>':\n if (!dom.baseURI) {\n // Note this became a read-only attribute some time before 2018\n dom.baseURI = base; // oinly set if not already set\n }\n p.process(dom, {\n baseURI: base\n });\n }\n parseSafeCURIEOrCURIEOrURI(value, prefixes, base) {\n value = this.trim(value);\n if (value.charAt(0) === '[' && value.charAt(value.length - 1) === ']') {\n value = value.substring(1, value.length - 1);\n value = value.trim(value);\n if (value.length === 0) {\n return null;\n }\n if (value === '_:') {\n // the one node\n return this.theOne;\n }\n return this.parseCURIE(value, prefixes, base);\n } else {\n return this.parseCURIEOrURI(value, prefixes, base);\n }\n }\n parseTermOrCURIEOrAbsURI(value, defaultVocabulary, terms, prefixes, base) {\n // alert(\"Parsing \"+value+\" with default vocab \"+defaultVocabulary)\n value = this.trim(value);\n var curie = this.parseCURIE(value, prefixes, base);\n if (curie) {\n return curie;\n } else if (terms) {\n if (defaultVocabulary && !this.absURIRE.exec(value)) {\n return defaultVocabulary + value;\n }\n var term = terms[value];\n if (term) {\n return term;\n }\n var lcvalue = value.toLowerCase();\n term = terms[lcvalue];\n if (term) {\n return term;\n }\n }\n if (this.absURIRE.exec(value)) {\n return this.resolveAndNormalize(base, value);\n }\n return null;\n }\n parseTermOrCURIEOrURI(value, defaultVocabulary, terms, prefixes, base) {\n // alert(\"Parsing \"+value+\" with default vocab \"+defaultVocabulary)\n value = this.trim(value);\n var curie = this.parseCURIE(value, prefixes, base);\n if (curie) {\n return curie;\n } else {\n var term = terms[value];\n if (term) {\n return term;\n }\n var lcvalue = value.toLowerCase();\n term = terms[lcvalue];\n if (term) {\n return term;\n }\n if (defaultVocabulary && !this.absURIRE.exec(value)) {\n return defaultVocabulary + value;\n }\n }\n return this.resolveAndNormalize(base, value);\n }\n parseURI(uri) {\n return uri; // We just use strings as URIs, not objects now.\n }\n process(node, options) {\n /*\n if (!window.console) {\n window.console = { log: function() {} }\n } */\n options = options || {};\n var base;\n if (node.nodeType === Node.DOCUMENT_NODE) {\n if (node.baseURI && !options.baseURI) {\n options.baseURI = node.baseURI; // be defensive as DOM implementations vary\n }\n base = node.baseURI;\n node = node.documentElement;\n if (!node.baseURI) {\n node.baseURI = base;\n }\n this.setContext(node);\n } else if (node.parentNode.nodeType === Node.DOCUMENT_NODE) {\n this.setContext(node);\n }\n var queue = [];\n // Fix for Firefox that includes the hash in the base URI\n var removeHash = function (baseURI) {\n // Fix for undefined baseURI property\n if (!baseURI && options && options.baseURI) {\n return options.baseURI;\n }\n var hash = baseURI.indexOf('#');\n if (hash >= 0) {\n baseURI = baseURI.substring(0, hash);\n }\n if (options && options.baseURIMap) {\n baseURI = options.baseURIMap(baseURI);\n }\n return baseURI;\n };\n queue.push({\n current: node,\n context: this.push(null, removeHash(node.baseURI))\n });\n while (queue.length > 0) {\n var item = queue.shift();\n if (item.parent) {\n // Sequence Step 14: list triple generation\n if (item.context.parent && item.context.parent.listMapping === item.listMapping) {\n // Skip a child context with exactly the same mapping\n continue;\n }\n // console.log(\"Generating lists for \"+item.subject+\", tag \"+item.parent.localName)\n for (let predicate in item.listMapping) {\n var list = item.listMapping[predicate];\n if (list.length === 0) {\n this.addTriple(item.parent, item.subject, predicate, {\n type: RDFaProcessor.objectURI,\n value: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'\n });\n continue;\n }\n var bnodes = [];\n for (let i = 0; i < list.length; i++) {\n bnodes.push(this.newBlankNode());\n // this.newSubject(item.parent,bnodes[i])\n }\n for (let i = 0; i < bnodes.length; i++) {\n this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#first', list[i]);\n this.addTriple(item.parent, bnodes[i], 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest', {\n type: RDFaProcessor.objectURI,\n value: i + 1 < bnodes.length ? bnodes[i + 1] : 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nil'\n });\n }\n this.addTriple(item.parent, item.subject, predicate, {\n type: RDFaProcessor.objectURI,\n value: bnodes[0]\n });\n }\n continue;\n }\n var current = item.current;\n var context = item.context;\n // console.log(\"Tag: \"+current.localName+\", listMapping=\"+JSON.stringify(context.listMapping))\n // Sequence Step 1\n var skip = false;\n var newSubject = null;\n var currentObjectResource = null;\n var typedResource = null;\n var prefixes = context.prefixes;\n var prefixesCopied = false;\n var incomplete = [];\n var listMapping = context.listMapping;\n var listMappingDifferent = !context.parent;\n var language = context.language;\n var vocabulary = context.vocabulary;\n // TODO: the \"base\" element may be used for HTML+RDFa 1.1\n base = this.parseURI(removeHash(current.baseURI));\n current.item = null;\n // Sequence Step 2: set the default vocabulary\n var vocabAtt = current.getAttributeNode('vocab');\n if (vocabAtt) {\n let value = this.trim(vocabAtt.value);\n if (value.length > 0) {\n vocabulary = value;\n var baseSubject = base.spec;\n // this.newSubject(current,baseSubject)\n this.addTriple(current, baseSubject, 'http://www.w3.org/ns/rdfa#usesVocabulary', {\n type: RDFaProcessor.objectURI,\n value: vocabulary\n });\n } else {\n vocabulary = this.vocabulary;\n }\n }\n // Sequence Step 3: IRI mappings\n // handle xmlns attributes\n for (var i = 0; i < current.attributes.length; i++) {\n var att = current.attributes[i];\n // if (att.namespaceURI==\"http://www.w3.org/2000/xmlns/\") {\n if (att.nodeName.charAt(0) === 'x' && att.nodeName.indexOf('xmlns:') === 0) {\n if (!prefixesCopied) {\n prefixes = this.copyMappings(prefixes);\n prefixesCopied = true;\n }\n var prefix = att.nodeName.substring(6);\n // TODO: resolve relative?\n var ref = RDFaProcessor.trim(att.value);\n prefixes[prefix] = this.options.base ? Uri.join(ref, this.options.base) : ref;\n }\n }\n // Handle prefix mappings (@prefix)\n var prefixAtt = current.getAttributeNode('prefix');\n if (prefixAtt) {\n if (!prefixesCopied) {\n prefixes = this.copyMappings(prefixes);\n prefixesCopied = true;\n }\n this.parsePrefixMappings(prefixAtt.value, prefixes);\n }\n // Sequence Step 4: language\n var xmlLangAtt = null;\n for (let i = 0; !xmlLangAtt && i < this.langAttributes.length; i++) {\n xmlLangAtt = current.getAttributeNodeNS(this.langAttributes[i].namespaceURI, this.langAttributes[i].localName);\n }\n if (xmlLangAtt) {\n let value = RDFaProcessor.trim(xmlLangAtt.value);\n if (value.length > 0) {\n language = value;\n } else {\n language = null;\n }\n }\n var relAtt = current.getAttributeNode('rel');\n var revAtt = current.getAttributeNode('rev');\n var typeofAtt = current.getAttributeNode('typeof');\n var propertyAtt = current.getAttributeNode('property');\n var datatypeAtt = current.getAttributeNode('datatype');\n var datetimeAtt = this.inHTMLMode ? current.getAttributeNode('datetime') : null;\n var contentAtt = current.getAttributeNode('content');\n var aboutAtt = current.getAttributeNode('about');\n var srcAtt = current.getAttributeNode('src');\n var resourceAtt = current.getAttributeNode('resource');\n var hrefAtt = current.getAttributeNode('href');\n var inlistAtt = current.getAttributeNode('inlist');\n var relAttPredicates = [];\n var predicate, values;\n if (relAtt) {\n values = this.tokenize(relAtt.value);\n for (let i = 0; i < values.length; i++) {\n predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt !== null);\n if (predicate) {\n relAttPredicates.push(predicate);\n }\n }\n }\n var revAttPredicates = [];\n if (revAtt) {\n values = this.tokenize(revAtt.value);\n for (let i = 0; i < values.length; i++) {\n predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base, this.inHTMLMode && propertyAtt);\n if (predicate) {\n revAttPredicates.push(predicate);\n }\n }\n }\n // Section 3.1, bullet 7\n if (this.inHTMLMode && (relAtt || revAtt) && propertyAtt) {\n if (relAttPredicates.length === 0) {\n relAtt = null;\n }\n if (revAttPredicates.length === 0) {\n revAtt = null;\n }\n }\n if (relAtt || revAtt) {\n // Sequence Step 6: establish new subject and value\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);\n }\n if (typeofAtt) {\n typedResource = newSubject;\n }\n if (!newSubject) {\n if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI);\n } else if (context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;\n }\n }\n if (resourceAtt) {\n currentObjectResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);\n }\n if (!currentObjectResource) {\n if (hrefAtt) {\n currentObjectResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));\n } else if (srcAtt) {\n currentObjectResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));\n } else if (typeofAtt && !aboutAtt && !(this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body'))) {\n currentObjectResource = this.newBlankNode();\n }\n }\n if (typeofAtt && !aboutAtt && this.inXHTMLMode && (current.localName === 'head' || current.localName === 'body')) {\n typedResource = newSubject;\n } else if (typeofAtt && !aboutAtt) {\n typedResource = currentObjectResource;\n }\n } else if (propertyAtt && !contentAtt && !datatypeAtt) {\n // Sequence Step 5.1: establish a new subject\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);\n if (typeofAtt) {\n typedResource = newSubject;\n }\n }\n if (!newSubject && current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI);\n if (typeofAtt) {\n typedResource = newSubject;\n }\n } else if (!newSubject && context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;\n }\n if (typeofAtt && !typedResource) {\n if (resourceAtt) {\n typedResource = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);\n }\n if (!typedResource && hrefAtt) {\n typedResource = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));\n }\n if (!typedResource && srcAtt) {\n typedResource = this.resolveAndNormalize(base, encodeURI(srcAtt.value));\n }\n if (!typedResource && (this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {\n typedResource = newSubject;\n }\n if (!typedResource) {\n typedResource = this.newBlankNode();\n }\n currentObjectResource = typedResource;\n }\n // console.log(current.localName+\", newSubject=\"+newSubject+\", typedResource=\"+typedResource+\", currentObjectResource=\"+currentObjectResource)\n } else {\n // Sequence Step 5.2: establish a new subject\n if (aboutAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(aboutAtt.value, prefixes, base);\n }\n if (!newSubject && resourceAtt) {\n newSubject = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);\n }\n if (!newSubject && hrefAtt) {\n newSubject = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));\n }\n if (!newSubject && srcAtt) {\n newSubject = this.resolveAndNormalize(base, encodeURI(srcAtt.value));\n }\n if (!newSubject) {\n if (current.parentNode.nodeType === Node.DOCUMENT_NODE) {\n newSubject = removeHash(current.baseURI);\n } else if ((this.inXHTMLMode || this.inHTMLMode) && (current.localName === 'head' || current.localName === 'body')) {\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;\n } else if (typeofAtt) {\n newSubject = this.newBlankNode();\n } else if (context.parentObject) {\n // TODO: Verify: If the xml:base has been set and the parentObject is the baseURI of the parent, then the subject needs to be the new base URI\n newSubject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;\n if (!propertyAtt) {\n skip = true;\n }\n }\n }\n if (typeofAtt) {\n typedResource = newSubject;\n }\n }\n // console.log(current.tagName+\": newSubject=\"+newSubject+\", currentObjectResource=\"+currentObjectResource+\", typedResource=\"+typedResource+\", skip=\"+skip)\n // var rdfaData = null\n if (newSubject) {\n // this.newSubject(current,newSubject)\n if (aboutAtt || resourceAtt || typedResource) {\n var id = newSubject;\n if (typeofAtt && !aboutAtt && !resourceAtt && currentObjectResource) {\n id = currentObjectResource;\n }\n // console.log(\"Setting data attribute for \"+current.localName+\" for subject \"+id)\n this.newSubjectOrigin(current, id);\n }\n }\n // Sequence Step 7: generate type triple\n if (typedResource) {\n values = this.tokenize(typeofAtt.value);\n for (let i = 0; i < values.length; i++) {\n var object = this.parseTermOrCURIEOrAbsURI(values[i], vocabulary, context.terms, prefixes, base);\n if (object) {\n this.addTriple(current, typedResource, RDFaProcessor.typeURI, {\n type: RDFaProcessor.objectURI,\n value: object\n });\n }\n }\n }\n // Sequence Step 8: new list mappings if there is a new subject\n // console.log(\"Step 8: newSubject=\"+newSubject+\", context.parentObject=\"+context.parentObject)\n if (newSubject && newSubject !== context.parentObject) {\n // console.log(\"Generating new list mapping for \"+newSubject)\n listMapping = {};\n listMappingDifferent = true;\n }\n // Sequence Step 9: generate object triple\n if (currentObjectResource) {\n if (relAtt && inlistAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n let list = listMapping[relAttPredicates[i]];\n if (!list) {\n list = [];\n listMapping[relAttPredicates[i]] = list;\n }\n list.push({\n type: RDFaProcessor.objectURI,\n value: currentObjectResource\n });\n }\n } else if (relAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n this.addTriple(current, newSubject, relAttPredicates[i], {\n type: RDFaProcessor.objectURI,\n value: currentObjectResource\n });\n }\n }\n if (revAtt) {\n for (let i = 0; i < revAttPredicates.length; i++) {\n this.addTriple(current, currentObjectResource, revAttPredicates[i], {\n type: RDFaProcessor.objectURI,\n value: newSubject\n });\n }\n }\n } else {\n // Sequence Step 10: incomplete triples\n if (newSubject && !currentObjectResource && (relAtt || revAtt)) {\n currentObjectResource = this.newBlankNode();\n // alert(current.tagName+\": generated blank node, newSubject=\"+newSubject+\" currentObjectResource=\"+currentObjectResource)\n }\n if (relAtt && inlistAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n let list = listMapping[relAttPredicates[i]];\n if (!list) {\n list = [];\n listMapping[predicate] = list;\n }\n // console.log(\"Adding incomplete list for \"+predicate)\n incomplete.push({\n predicate: relAttPredicates[i],\n list: list\n });\n }\n } else if (relAtt) {\n for (let i = 0; i < relAttPredicates.length; i++) {\n incomplete.push({\n predicate: relAttPredicates[i],\n forward: true\n });\n }\n }\n if (revAtt) {\n for (let i = 0; i < revAttPredicates.length; i++) {\n incomplete.push({\n predicate: revAttPredicates[i],\n forward: false\n });\n }\n }\n }\n // Step 11: Current property values\n if (propertyAtt) {\n var datatype = null;\n var content = null;\n if (datatypeAtt) {\n datatype = datatypeAtt.value === '' ? RDFaProcessor.PlainLiteralURI : this.parseTermOrCURIEOrAbsURI(datatypeAtt.value, vocabulary, context.terms, prefixes, base);\n if (datetimeAtt && !contentAtt) {\n content = datetimeAtt.value;\n } else {\n content = datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? null : contentAtt ? contentAtt.value : current.textContent;\n }\n } else if (contentAtt) {\n datatype = RDFaProcessor.PlainLiteralURI;\n content = contentAtt.value;\n } else if (datetimeAtt) {\n content = datetimeAtt.value;\n datatype = RDFaProcessor.deriveDateTimeType(content);\n if (!datatype) {\n datatype = RDFaProcessor.PlainLiteralURI;\n }\n } else if (!relAtt && !revAtt) {\n if (resourceAtt) {\n content = this.parseSafeCURIEOrCURIEOrURI(resourceAtt.value, prefixes, base);\n }\n if (!content && hrefAtt) {\n content = this.resolveAndNormalize(base, encodeURI(hrefAtt.value));\n } else if (!content && srcAtt) {\n content = this.resolveAndNormalize(base, encodeURI(srcAtt.value));\n }\n if (content) {\n datatype = RDFaProcessor.objectURI;\n }\n }\n if (!datatype) {\n if (typeofAtt && !aboutAtt) {\n datatype = RDFaProcessor.objectURI;\n content = typedResource;\n } else {\n content = current.textContent;\n if (this.inHTMLMode && current.localName === 'time') {\n datatype = RDFaProcessor.deriveDateTimeType(content);\n }\n if (!datatype) {\n datatype = RDFaProcessor.PlainLiteralURI;\n }\n }\n }\n values = this.tokenize(propertyAtt.value);\n for (let i = 0; i < values.length; i++) {\n let predicate = this.parsePredicate(values[i], vocabulary, context.terms, prefixes, base);\n if (predicate) {\n if (inlistAtt) {\n let list = listMapping[predicate];\n if (!list) {\n list = [];\n listMapping[predicate] = list;\n }\n list.push(datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI ? {\n type: datatype,\n value: current.childNodes\n } : {\n type: datatype || RDFaProcessor.PlainLiteralURI,\n value: content,\n language: language\n });\n } else {\n if (datatype === RDFaProcessor.XMLLiteralURI || datatype === RDFaProcessor.HTMLLiteralURI) {\n this.addTriple(current, newSubject, predicate, {\n type: datatype,\n value: current.childNodes\n });\n } else {\n this.addTriple(current, newSubject, predicate, {\n type: datatype || RDFaProcessor.PlainLiteralURI,\n value: content,\n language: language\n });\n // console.log(newSubject+\" \"+predicate+\"=\"+content)\n }\n }\n }\n }\n }\n // Sequence Step 12: complete incomplete triples with new subject\n if (newSubject && !skip) {\n for (let i = 0; i < context.incomplete.length; i++) {\n if (context.incomplete[i].list) {\n // console.log(\"Adding subject \"+newSubject+\" to list for \"+context.incomplete[i].predicate)\n // TODO: it is unclear what to do here\n context.incomplete[i].list.push({\n type: RDFaProcessor.objectURI,\n value: newSubject\n });\n } else if (context.incomplete[i].forward) {\n // console.log(current.tagName+\": completing forward triple \"+context.incomplete[i].predicate+\" with object=\"+newSubject)\n this.addTriple(current, context.subject, context.incomplete[i].predicate, {\n type: RDFaProcessor.objectURI,\n value: newSubject\n });\n } else {\n // console.log(current.tagName+\": completing reverse triple with object=\"+context.subject)\n this.addTriple(current, newSubject, context.incomplete[i].predicate, {\n type: RDFaProcessor.objectURI,\n value: context.subject\n });\n }\n }\n }\n var childContext = null;\n var listSubject = newSubject;\n if (skip) {\n // TODO: should subject be null?\n childContext = this.push(context, context.subject);\n // TODO: should the entObject be passed along? If not, then intermediary children will keep properties from being associated with incomplete triples.\n // TODO: Verify: if the current baseURI has changed and the parentObject is the parent's base URI, then the baseURI should change\n childContext.parentObject = removeHash(current.parentNode.baseURI) === context.parentObject ? removeHash(current.baseURI) : context.parentObject;\n childContext.incomplete = context.incomplete;\n childContext.language = language;\n childContext.prefixes = prefixes;\n childContext.vocabulary = vocabulary;\n } else {\n childContext = this.push(context, newSubject);\n childContext.parentObject = currentObjectResource || newSubject || context.subject;\n childContext.prefixes = prefixes;\n childContext.incomplete = incomplete;\n if (currentObjectResource) {\n // console.log(\"Generating new list mapping for \"+currentObjectResource)\n listSubject = currentObjectResource;\n listMapping = {};\n listMappingDifferent = true;\n }\n childContext.listMapping = listMapping;\n childContext.language = language;\n childContext.vocabulary = vocabulary;\n }\n if (listMappingDifferent) {\n // console.log(\"Pushing list parent \"+current.localName)\n queue.unshift({\n parent: current,\n context: context,\n subject: listSubject,\n listMapping: listMapping\n });\n }\n for (var child = current.lastChild; child; child = child.previousSibling) {\n if (child.nodeType === Node.ELEMENT_NODE) {\n // console.log(\"Pushing child \"+child.localName)\n // child.baseURI = current.baseURI\n queue.unshift({\n current: child,\n context: childContext\n });\n }\n }\n }\n if (this.inHTMLMode) {\n this.copyProperties();\n }\n for (let i = 0; i < this.finishedHandlers.length; i++) {\n this.finishedHandlers[i](node);\n }\n }\n push(parent, subject) {\n return {\n parent: parent,\n subject: subject || (parent ? parent.subject : null),\n parentObject: null,\n incomplete: [],\n listMapping: parent ? parent.listMapping : {},\n language: parent ? parent.language : this.language,\n prefixes: parent ? parent.prefixes : this.target.graph.prefixes,\n terms: parent ? parent.terms : this.target.graph.terms,\n vocabulary: parent ? parent.vocabulary : this.vocabulary\n };\n }\n resolveAndNormalize(base, uri) {\n // console.log(\"Joining \" + uri + \" to \" + base + \" making \" + Uri.join(uri, base))\n return Uri.join(uri, base); // @@ normalize?\n }\n setContext(node) {\n // We only recognized XHTML+RDFa 1.1 if the version is set propertyly\n if (node.localName === 'html' && node.getAttribute('version') === 'XHTML+RDFa 1.1') {\n this.setXHTMLContext();\n } else if (node.localName === 'html' || node.namespaceURI === 'http://www.w3.org/1999/xhtml') {\n if (typeof document !== 'undefined' && document.doctype) {\n if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.0//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd') {\n console.log('WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode.');\n this.setHTMLContext();\n } else if (document.doctype.publicId === '-//W3C//DTD XHTML+RDFa 1.1//EN' && document.doctype.systemId === 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd') {\n this.setXHTMLContext();\n } else {\n this.setHTMLContext();\n }\n } else {\n this.setHTMLContext();\n }\n } else {\n this.setXMLContext();\n }\n }\n setHTMLContext() {\n this.setInitialContext();\n this.langAttributes = [{\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang'\n }, {\n namespaceURI: null,\n localName: 'lang'\n }];\n this.inXHTMLMode = false;\n this.inHTMLMode = true;\n }\n setInitialContext() {\n this.vocabulary = null;\n // By default, the prefixes are terms are loaded to the RDFa 1.1. standard within the graph constructor\n this.langAttributes = [{\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang'\n }];\n }\n setXHTMLContext() {\n this.setInitialContext();\n this.inXHTMLMode = true;\n this.inHTMLMode = false;\n this.langAttributes = [{\n namespaceURI: 'http://www.w3.org/XML/1998/namespace',\n localName: 'lang'\n }, {\n namespaceURI: null,\n localName: 'lang'\n }];\n // From http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1\n this.target.graph.terms['alternate'] = 'http://www.w3.org/1999/xhtml/vocab#alternate';\n this.target.graph.terms['appendix'] = 'http://www.w3.org/1999/xhtml/vocab#appendix';\n this.target.graph.terms['bookmark'] = 'http://www.w3.org/1999/xhtml/vocab#bookmark';\n this.target.graph.terms['cite'] = 'http://www.w3.org/1999/xhtml/vocab#cite';\n this.target.graph.terms['chapter'] = 'http://www.w3.org/1999/xhtml/vocab#chapter';\n this.target.graph.terms['contents'] = 'http://www.w3.org/1999/xhtml/vocab#contents';\n this.target.graph.terms['copyright'] = 'http://www.w3.org/1999/xhtml/vocab#copyright';\n this.target.graph.terms['first'] = 'http://www.w3.org/1999/xhtml/vocab#first';\n this.target.graph.terms['glossary'] = 'http://www.w3.org/1999/xhtml/vocab#glossary';\n this.target.graph.terms['help'] = 'http://www.w3.org/1999/xhtml/vocab#help';\n this.target.graph.terms['icon'] = 'http://www.w3.org/1999/xhtml/vocab#icon';\n this.target.graph.terms['index'] = 'http://www.w3.org/1999/xhtml/vocab#index';\n this.target.graph.terms['last'] = 'http://www.w3.org/1999/xhtml/vocab#last';\n this.target.graph.terms['license'] = 'http://www.w3.org/1999/xhtml/vocab#license';\n this.target.graph.terms['meta'] = 'http://www.w3.org/1999/xhtml/vocab#meta';\n this.target.graph.terms['next'] = 'http://www.w3.org/1999/xhtml/vocab#next';\n this.target.graph.terms['prev'] = 'http://www.w3.org/1999/xhtml/vocab#prev';\n this.target.graph.terms['previous'] = 'http://www.w3.org/1999/xhtml/vocab#previous';\n this.target.graph.terms['section'] = 'http://www.w3.org/1999/xhtml/vocab#section';\n this.target.graph.terms['stylesheet'] = 'http://www.w3.org/1999/xhtml/vocab#stylesheet';\n this.target.graph.terms['subsection'] = 'http://www.w3.org/1999/xhtml/vocab#subsection';\n this.target.graph.terms['start'] = 'http://www.w3.org/1999/xhtml/vocab#start';\n this.target.graph.terms['top'] = 'http://www.w3.org/1999/xhtml/vocab#top';\n this.target.graph.terms['up'] = 'http://www.w3.org/1999/xhtml/vocab#up';\n this.target.graph.terms['p3pv1'] = 'http://www.w3.org/1999/xhtml/vocab#p3pv1';\n // other\n this.target.graph.terms['related'] = 'http://www.w3.org/1999/xhtml/vocab#related';\n this.target.graph.terms['role'] = 'http://www.w3.org/1999/xhtml/vocab#role';\n this.target.graph.terms['transformation'] = 'http://www.w3.org/1999/xhtml/vocab#transformation';\n }\n setXMLContext() {\n this.setInitialContext();\n this.inXHTMLMode = false;\n this.inHTMLMode = false;\n }\n tokenize(str) {\n return this.trim(str).split(/\\s+/);\n }\n static tokenize(str) {\n return this.trim(str).split(/\\s+/);\n }\n toRDFNodeObject(x) {\n if (typeof x === 'undefined') return undefined;\n if (typeof x === 'string') {\n if (x.substring(0, 2) === '_:') {\n if (typeof this.blankNodes[x.substring(2)] === 'undefined') {\n this.blankNodes[x.substring(2)] = new BlankNode(x.substring(2));\n }\n return this.blankNodes[x.substring(2)];\n }\n return rdf.namedNode(x);\n }\n switch (x.type) {\n case RDFaProcessor.objectURI:\n if (x.value.substring(0, 2) === '_:') {\n if (typeof this.blankNodes[x.value.substring(2)] === 'undefined') {\n this.blankNodes[x.value.substring(2)] = new BlankNode(x.value.substring(2));\n }\n return this.blankNodes[x.value.substring(2)];\n }\n return rdf.namedNode(x.value);\n case RDFaProcessor.PlainLiteralURI:\n return new Literal(x.value, x.language || '');\n case RDFaProcessor.XMLLiteralURI:\n case RDFaProcessor.HTMLLiteralURI:\n var string = '';\n Object.keys(x.value).forEach(i => {\n string += Util.domToString(x.value[i], this.htmlOptions);\n });\n return new Literal(string, '', new NamedNode(x.type));\n default:\n return new Literal(x.value, '', new NamedNode(x.type));\n }\n }\n trim(str) {\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n }\n static trim(str) {\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n }\n}\nRDFaProcessor.XMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral';\nRDFaProcessor.HTMLLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML';\nRDFaProcessor.PlainLiteralURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral';\nRDFaProcessor.objectURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#object';\nRDFaProcessor.typeURI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';\nRDFaProcessor.nameChar = '[-A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u10000-\\uEFFFF\\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]';\nRDFaProcessor.nameStartChar = '[\\u0041-\\u005A\\u0061-\\u007A\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u00FF\\u0100-\\u0131\\u0134-\\u013E\\u0141-\\u0148\\u014A-\\u017E\\u0180-\\u01C3\\u01CD-\\u01F0\\u01F4-\\u01F5\\u01FA-\\u0217\\u0250-\\u02A8\\u02BB-\\u02C1\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03D0-\\u03D6\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2-\\u03F3\\u0401-\\u040C\\u040E-\\u044F\\u0451-\\u045C\\u045E-\\u0481\\u0490-\\u04C4\\u04C7-\\u04C8\\u04CB-\\u04CC\\u04D0-\\u04EB\\u04EE-\\u04F5\\u04F8-\\u04F9\\u0531-\\u0556\\u0559\\u0561-\\u0586\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u063A\\u0641-\\u064A\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D3\\u06D5\\u06E5-\\u06E6\\u0905-\\u0939\\u093D\\u0958-\\u0961\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8B\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AE0\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B36-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB5\\u0BB7-\\u0BB9\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C60-\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CDE\\u0CE0-\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D60-\\u0D61\\u0E01-\\u0E2E\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E45\\u0E81-\\u0E82\\u0E84\\u0E87-\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA-\\u0EAB\\u0EAD-\\u0EAE\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0F40-\\u0F47\\u0F49-\\u0F69\\u10A0-\\u10C5\\u10D0-\\u10F6\\u1100\\u1102-\\u1103\\u1105-\\u1107\\u1109\\u110B-\\u110C\\u110E-\\u1112\\u113C\\u113E\\u1140\\u114C\\u114E\\u1150\\u1154-\\u1155\\u1159\\u115F-\\u1161\\u1163\\u1165\\u1167\\u1169\\u116D-\\u116E\\u1172-\\u1173\\u1175\\u119E\\u11A8\\u11AB\\u11AE-\\u11AF\\u11B7-\\u11B8\\u11BA\\u11BC-\\u11C2\\u11EB\\u11F0\\u11F9\\u1E00-\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2126\\u212A-\\u212B\\u212E\\u2180-\\u2182\\u3041-\\u3094\\u30A1-\\u30FA\\u3105-\\u312C\\uAC00-\\uD7A3\\u4E00-\\u9FA5\\u3007\\u3021-\\u3029_]';\nRDFaProcessor.NCNAME = new RegExp('^' + RDFaProcessor.nameStartChar + RDFaProcessor.nameChar + '*$');\n\n/*\nRDFaProcessor.prototype.resolveAndNormalize = function(base,href) {\n var u = base.resolve(href)\n var parsed = this.parseURI(u)\n parsed.normalize()\n return parsed.spec\n}\n*/\n\nRDFaProcessor.dateTimeTypes = [{\n pattern: /-?P(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?(?:[0-9]+(?:\\.[0-9]+)?S)?)?/,\n type: 'http://www.w3.org/2001/XMLSchema#duration'\n}, {\n pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9]T(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#dateTime'\n}, {\n pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9](?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#date'\n}, {\n pattern: /(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]+)?(?:Z|[+\\-][0-9][0-9]:[0-9][0-9])?/,\n type: 'http://www.w3.org/2001/XMLSchema#time'\n}, {\n pattern: /-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]/,\n type: 'http://www.w3.org/2001/XMLSchema#gYearMonth'\n}, {\n pattern: /-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,\n type: 'http://www.w3.org/2001/XMLSchema#gYear'\n}];\nconst parseRDFaDOM = RDFaProcessor.parseRDFaDOM;\nexport { parseRDFaDOM };","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/**\n * RDF/XML PARSER\n *\n * Parser believed to be in full positive RDF/XML parsing compliance\n * with the possible exception of handling deprecated RDF attributes\n * appropriately. Parser is believed to comply fully with other W3C\n * and industry standards where appropriate (DOM, ECMAScript, &c.)\n *\n * Author: David Sheets <dsheets@mit.edu>\n *\n * W3C® SOFTWARE NOTICE AND LICENSE\n * http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231\n * This work (and included software, documentation such as READMEs, or\n * other related items) is being provided by the copyright holders under\n * the following license. By obtaining, using and/or copying this work,\n * you (the licensee) agree that you have read, understood, and will\n * comply with the following terms and conditions.\n *\n * Permission to copy, modify, and distribute this software and its\n * documentation, with or without modification, for any purpose and\n * without fee or royalty is hereby granted, provided that you include\n * the following on ALL copies of the software and documentation or\n * portions thereof, including modifications:\n *\n * 1. The full text of this NOTICE in a location viewable to users of\n * the redistributed or derivative work.\n * 2. Any pre-existing intellectual property disclaimers, notices, or terms and\n * conditions. If none exist, the W3C Software Short Notice should be\n * included (hypertext is preferred, text is permitted) within the body\n * of any redistributed or derivative code.\n * 3. Notice of any changes or modifications to the files, including the\n * date changes were made. (We recommend you provide URIs to the location\n * from which the code is derived.)\n *\n * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED \"AS IS,\" AND COPYRIGHT\n * HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,\n * INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS\n * FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR\n * DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,\n * TRADEMARKS OR OTHER RIGHTS.\n *\n * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL\n * OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR\n * DOCUMENTATION.\n *\n * The name and trademarks of copyright holders may NOT be used in\n * advertising or publicity pertaining to the software without specific,\n * written prior permission. Title to copyright in this software and any\n * associated documentation will at all times remain with copyright\n * holders.\n */\n/**\n * @class RDFParser resource object tied to an RDFStore\n *\n * @author David Sheets <dsheets@mit.edu>\n *\n*/\nimport * as uriUtil from './uri';\nexport default class RDFParser {\n /*\n * @constructor\n * @param {RDFStore} store An RDFStore object\n */\n constructor(store) {\n /** Our triple store reference @private */\n\n this.store = store; /** Our identified blank nodes @private */\n this.bnodes = {}; /** A context for context-aware stores @private */\n this.why = null; /** Reification flag */\n this.reify = false;\n }\n\n /** Standard namespaces that we know how to handle @final\n * @member RDFParser\n */\n\n /**\n * Frame class for namespace and base URI lookups\n * Base lookups will always resolve because the parser knows\n * the default base.\n *\n * @private\n */\n\n frameFactory(parser, parent, element) {\n return {\n 'NODE': 1,\n 'ARC': 2,\n 'parent': parent,\n 'parser': parser,\n 'store': parser.store,\n 'element': element,\n 'lastChild': 0,\n 'base': null,\n 'lang': null,\n 'node': null,\n 'nodeType': null,\n 'listIndex': 1,\n 'rdfid': null,\n 'datatype': null,\n 'collection': false,\n /** Terminate the frame and notify the store that we're done */\n 'terminateFrame': function () {\n if (this.collection) {\n this.node.close();\n }\n },\n /** Add a symbol of a certain type to the this frame */'addSymbol': function (type, uri) {\n uri = uriUtil.join(uri, this.base);\n this.node = this.store.sym(uri);\n this.nodeType = type;\n },\n /** Load any constructed triples into the store */'loadTriple': function () {\n if (this.parent.parent.collection) {\n this.parent.parent.node.append(this.node);\n } else {\n this.store.add(this.parent.parent.node, this.parent.node, this.node, this.parser.why);\n }\n if (this.parent.rdfid != null) {\n // reify\n var triple = this.store.sym(uriUtil.join('#' + this.parent.rdfid, this.base));\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(RDFParser.ns.RDF + 'Statement'), this.parser.why);\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'subject'), this.parent.parent.node, this.parser.why);\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'predicate'), this.parent.node, this.parser.why);\n this.store.add(triple, this.store.sym(RDFParser.ns.RDF + 'object'), this.node, this.parser.why);\n }\n },\n /** Check if it's OK to load a triple */'isTripleToLoad': function () {\n return this.parent != null && this.parent.parent != null && this.nodeType === this.NODE && this.parent.nodeType === this.ARC && this.parent.parent.nodeType === this.NODE;\n },\n /** Add a symbolic node to this frame */'addNode': function (uri) {\n this.addSymbol(this.NODE, uri);\n if (this.isTripleToLoad()) {\n this.loadTriple();\n }\n },\n /** Add a collection node to this frame */'addCollection': function () {\n this.nodeType = this.NODE;\n this.node = this.store.collection();\n this.collection = true;\n if (this.isTripleToLoad()) {\n this.loadTriple();\n }\n },\n /** Add a collection arc to this frame */'addCollectionArc': function () {\n this.nodeType = this.ARC;\n },\n /** Add a bnode to this frame */'addBNode': function (id) {\n if (id != null) {\n if (this.parser.bnodes[id] != null) {\n this.node = this.parser.bnodes[id];\n } else {\n this.node = this.parser.bnodes[id] = this.store.bnode();\n }\n } else {\n this.node = this.store.bnode();\n }\n this.nodeType = this.NODE;\n if (this.isTripleToLoad()) {\n this.loadTriple();\n }\n },\n /** Add an arc or property to this frame */'addArc': function (uri) {\n if (uri === RDFParser.ns.RDF + 'li') {\n uri = RDFParser.ns.RDF + '_' + this.parent.listIndex;\n this.parent.listIndex++;\n }\n this.addSymbol(this.ARC, uri);\n },\n /** Add a literal to this frame */'addLiteral': function (value) {\n if (this.parent.datatype && this.parent.datatype !== RDFParser.ns.RDF + 'langString') {\n this.node = this.store.literal(value, this.store.sym(this.parent.datatype));\n } else {\n this.node = this.store.literal(value, this.lang);\n }\n this.nodeType = this.NODE;\n if (this.isTripleToLoad()) {\n this.loadTriple();\n }\n }\n };\n }\n\n // from the OpenLayers source .. needed to get around IE problems.\n getAttributeNodeNS(node, uri, name) {\n var attributeNode = null;\n if (node.getAttributeNodeNS) {\n attributeNode = node.getAttributeNodeNS(uri, name);\n } else {\n var attributes = node.attributes;\n var potentialNode, fullName;\n for (var i = 0; i < attributes.length; ++i) {\n potentialNode = attributes[i];\n if (potentialNode.namespaceURI === uri) {\n fullName = potentialNode.prefix ? potentialNode.prefix + ':' + name : name;\n if (fullName === potentialNode.nodeName) {\n attributeNode = potentialNode;\n break;\n }\n }\n }\n }\n return attributeNode;\n }\n\n /**\n * Build our initial scope frame and parse the DOM into triples\n * @param {HTMLDocument} document The DOM to parse\n * @param {String} base The base URL to use\n * @param {Object} why The context to which this resource belongs\n */\n\n parse(document, base, why) {\n var children = document.childNodes; // clean up for the next run\n this.cleanParser(); // figure out the root element\n var root;\n if (document.nodeType === RDFParser.nodeType.DOCUMENT) {\n for (var c = 0; c < children.length; c++) {\n if (children[c].nodeType === RDFParser.nodeType.ELEMENT) {\n root = children[c];\n break;\n }\n }\n } else if (document.nodeType === RDFParser.nodeType.ELEMENT) {\n root = document;\n } else {\n throw new Error(\"RDFParser: can't find root in \" + base + '. Halting. ');\n // return false\n }\n this.why = why; // our topmost frame\n var f = this.frameFactory(this);\n this.base = base;\n f.base = base;\n f.lang = null; // was '' but can't have langs like that 2015 (!)\n this.parseDOM(this.buildFrame(f, root));\n return true;\n }\n parseDOM(frame) {\n // a DOM utility function used in parsing\n var rdfid;\n var elementURI = function (el) {\n var result = '';\n if (el.namespaceURI == null) {\n throw new Error('RDF/XML syntax error: No namespace for ' + el.localName + ' in ' + this.base);\n }\n if (el.namespaceURI) {\n result = result + el.namespaceURI;\n }\n if (el.localName) {\n result = result + el.localName;\n } else if (el.nodeName) {\n if (el.nodeName.indexOf(':') >= 0) result = result + el.nodeName.split(':')[1];else result = result + el.nodeName;\n }\n return result;\n }.bind(this);\n var dig = true; // if we'll dig down in the tree on the next iter\n while (frame.parent) {\n var dom = frame.element;\n var attrs = dom.attributes;\n if (dom.nodeType === RDFParser.nodeType.TEXT || dom.nodeType === RDFParser.nodeType.CDATA_SECTION) {\n // we have a literal\n if (frame.parent.nodeType === frame.NODE) {\n // must have had attributes, store as rdf:value\n frame.addArc(RDFParser.ns.RDF + 'value');\n frame = this.buildFrame(frame);\n }\n frame.addLiteral(dom.nodeValue);\n } else if (elementURI(dom) !== RDFParser.ns.RDF + 'RDF') {\n // not root\n if (frame.parent && frame.parent.collection) {\n // we're a collection element\n frame.addCollectionArc();\n frame = this.buildFrame(frame, frame.element);\n frame.parent.element = null;\n }\n if (!frame.parent || !frame.parent.nodeType || frame.parent.nodeType === frame.ARC) {\n // we need a node\n var about = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'about');\n rdfid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'ID');\n if (about && rdfid) {\n throw new Error('RDFParser: ' + dom.nodeName + ' has both rdf:id and rdf:about.' + ' Halting. Only one of these' + ' properties may be specified on a' + ' node.');\n }\n if (!about && rdfid) {\n frame.addNode('#' + rdfid.nodeValue);\n dom.removeAttributeNode(rdfid);\n } else if (about == null && rdfid == null) {\n var bnid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID');\n if (bnid) {\n frame.addBNode(bnid.nodeValue);\n dom.removeAttributeNode(bnid);\n } else {\n frame.addBNode();\n }\n } else {\n frame.addNode(about.nodeValue);\n dom.removeAttributeNode(about);\n }\n // Typed nodes\n var rdftype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'type');\n if (RDFParser.ns.RDF + 'Description' !== elementURI(dom)) {\n rdftype = {\n 'nodeValue': elementURI(dom)\n };\n }\n if (rdftype != null) {\n this.store.add(frame.node, this.store.sym(RDFParser.ns.RDF + 'type'), this.store.sym(uriUtil.join(rdftype.nodeValue, frame.base)), this.why);\n if (rdftype.nodeName) {\n dom.removeAttributeNode(rdftype);\n }\n }\n // Property Attributes\n for (var x = attrs.length - 1; x >= 0; x--) {\n this.store.add(frame.node, this.store.sym(elementURI(attrs[x])), this.store.literal(attrs[x].nodeValue, frame.lang), this.why);\n }\n } else {\n // we should add an arc (or implicit bnode+arc)\n frame.addArc(elementURI(dom)); // save the arc's rdf:ID if it has one\n if (this.reify) {\n rdfid = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'ID');\n if (rdfid) {\n frame.rdfid = rdfid.nodeValue;\n dom.removeAttributeNode(rdfid);\n }\n }\n var parsetype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'parseType');\n var datatype = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'datatype');\n if (datatype) {\n frame.datatype = datatype.nodeValue;\n dom.removeAttributeNode(datatype);\n }\n if (parsetype) {\n var nv = parsetype.nodeValue;\n if (nv === 'Literal') {\n frame.datatype = RDFParser.ns.RDF + 'XMLLiteral';\n frame = this.buildFrame(frame);\n // Don't include the literal node, only its children\n // see https://github.com/linkeddata/rdflib.js/issues/75\n frame.addLiteral(dom.innerHTML || dom.childNodes);\n dig = false;\n } else if (nv === 'Resource') {\n frame = this.buildFrame(frame, frame.element);\n frame.parent.element = null;\n frame.addBNode();\n } else if (nv === 'Collection') {\n frame = this.buildFrame(frame, frame.element);\n frame.parent.element = null;\n frame.addCollection();\n }\n dom.removeAttributeNode(parsetype);\n }\n if (attrs.length !== 0) {\n var resource = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'resource');\n var bnid2 = this.getAttributeNodeNS(dom, RDFParser.ns.RDF, 'nodeID');\n frame = this.buildFrame(frame);\n if (resource) {\n frame.addNode(resource.nodeValue);\n dom.removeAttributeNode(resource);\n } else {\n if (bnid2) {\n frame.addBNode(bnid2.nodeValue);\n dom.removeAttributeNode(bnid2);\n } else {\n frame.addBNode();\n }\n }\n for (var x1 = attrs.length - 1; x1 >= 0; x1--) {\n var f = this.buildFrame(frame);\n f.addArc(elementURI(attrs[x1]));\n if (elementURI(attrs[x1]) === RDFParser.ns.RDF + 'type') {\n this.buildFrame(f).addNode(attrs[x1].nodeValue);\n } else {\n this.buildFrame(f).addLiteral(attrs[x1].nodeValue);\n }\n }\n } else if (dom.childNodes.length === 0) {\n this.buildFrame(frame).addLiteral('');\n }\n }\n } // rdf:RDF\n // dig dug\n dom = frame.element;\n while (frame.parent) {\n var pframe = frame;\n while (dom == null) {\n frame = frame.parent;\n dom = frame.element;\n }\n var candidate = dom.childNodes && dom.childNodes[frame.lastChild];\n if (!candidate || !dig) {\n frame.terminateFrame();\n if (!(frame = frame.parent)) {\n break;\n } // done\n dom = frame.element;\n dig = true;\n } else if (candidate.nodeType !== RDFParser.nodeType.ELEMENT && candidate.nodeType !== RDFParser.nodeType.TEXT && candidate.nodeType !== RDFParser.nodeType.CDATA_SECTION || (candidate.nodeType === RDFParser.nodeType.TEXT || candidate.nodeType === RDFParser.nodeType.CDATA_SECTION) && dom.childNodes.length !== 1) {\n frame.lastChild++;\n } else {\n // not a leaf\n frame.lastChild++;\n frame = this.buildFrame(pframe, dom.childNodes[frame.lastChild - 1]);\n break;\n }\n }\n } // while\n }\n\n /**\n * Cleans out state from a previous parse run\n * @private\n */\n cleanParser() {\n this.bnodes = {};\n this.why = null;\n }\n\n /**\n * Builds scope frame\n * @private\n */\n buildFrame(parent, element) {\n var frame = this.frameFactory(this, parent, element);\n if (parent) {\n frame.base = parent.base;\n frame.lang = parent.lang;\n }\n if (!element || element.nodeType === RDFParser.nodeType.TEXT || element.nodeType === RDFParser.nodeType.CDATA_SECTION) {\n return frame;\n }\n var attrs = element.attributes;\n var base = element.getAttributeNode('xml:base');\n if (base != null) {\n frame.base = base.nodeValue;\n element.removeAttribute('xml:base');\n }\n var lang = element.getAttributeNode('xml:lang');\n if (lang != null) {\n frame.lang = lang.nodeValue;\n element.removeAttribute('xml:lang');\n }\n // remove all extraneous xml and xmlns attributes\n for (var x = attrs.length - 1; x >= 0; x--) {\n if (attrs[x].nodeName.substr(0, 3) === 'xml') {\n if (attrs[x].name.slice(0, 6) === 'xmlns:') {\n var uri = attrs[x].nodeValue; // alert('base for namespac attr:'+this.base)\n if (this.base) uri = uriUtil.join(uri, this.base);\n this.store.setPrefixForURI(attrs[x].name.slice(6), uri);\n }\n //\t\talert('rdfparser: xml atribute: '+attrs[x].name) //@@\n element.removeAttributeNode(attrs[x]);\n }\n }\n return frame;\n }\n}\n_defineProperty(RDFParser, \"ns\", {\n 'RDF': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n 'RDFS': 'http://www.w3.org/2000/01/rdf-schema#'\n});\n/** DOM Level 2 node type magic numbers @final\n * @member RDFParser\n */\n_defineProperty(RDFParser, \"nodeType\", {\n 'ELEMENT': 1,\n 'ATTRIBUTE': 2,\n 'TEXT': 3,\n 'CDATA_SECTION': 4,\n 'ENTITY_REFERENCE': 5,\n 'ENTITY': 6,\n 'PROCESSING_INSTRUCTION': 7,\n 'COMMENT': 8,\n 'DOCUMENT': 9,\n 'DOCUMENT_TYPE': 10,\n 'DOCUMENT_FRAGMENT': 11,\n 'NOTATION': 12\n});","// Parse a simple SPARL-Update subset syntax for patches.\n//\n// This parses\n// WHERE {xxx} DELETE {yyy} INSERT DATA {zzz}\n// (not necessarily in that order)\n// as though it were the n3\n// <#query> patch:where {xxx}; patch:delete {yyy}; patch:insert {zzz}.\nimport N3Parser from './n3parser';\nimport Namespace from './namespace';\nexport default function sparqlUpdateParser(str, kb, base) {\n var i, j, k;\n var keywords = ['INSERT', 'DELETE', 'WHERE'];\n var SQNS = Namespace('http://www.w3.org/ns/pim/patch#');\n var p = N3Parser(kb, kb, base, base, null, null, '', null);\n var clauses = {};\n var badSyntax = function (uri, lines, str, i, why) {\n return 'Line ' + (lines + 1) + ' of <' + uri + '>: Bad syntax:\\n ' + why + '\\n at: \"' + str.slice(i, i + 30) + '\"';\n };\n\n // var check = function (next, last, message) {\n // if (next < 0) {\n // throw badSyntax(p._thisDoc, p.lines, str, j, last, message)\n // }\n // return next\n // }\n i = 0;\n var query = kb.sym(base + '#query'); // Invent a URI for the query\n clauses['query'] = query; // A way of accessing it in its N3 model.\n\n while (true) {\n // console.log(\"A Now at i = \" + i)\n j = p.skipSpace(str, i);\n if (j < 0) {\n return clauses;\n }\n // console.log(\"B After space at j= \" + j)\n if (str[j] === ';') {\n i = p.skipSpace(str, j + 1);\n if (i < 0) {\n return clauses; // Allow end in a\n }\n j = i;\n }\n var found = false;\n for (k = 0; k < keywords.length; k++) {\n var key = keywords[k];\n if (str.slice(j, j + key.length) === key) {\n i = p.skipSpace(str, j + key.length);\n if (i < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, j + key.length, 'found EOF, needed {...} after ' + key);\n }\n if ((key === 'INSERT' || key === 'DELETE') && str.slice(i, i + 4) === 'DATA') {\n // Some wanted 'DATA'. Whatever\n j = p.skipSpace(str, i + 4);\n if (j < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i + 4, 'needed {...} after INSERT DATA ' + key);\n }\n i = j;\n }\n var res2 = [];\n j = p.node(str, i, res2); // Parse all the complexity of the clause\n\n if (j < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i, 'bad syntax or EOF in {...} after ' + key);\n }\n clauses[key.toLowerCase()] = res2[0];\n kb.add(query, SQNS(key.toLowerCase()), res2[0]); // , kb.sym(base)\n // key is the keyword and res2 has the contents\n found = true;\n i = j;\n }\n }\n if (!found && str.slice(j, j + 7) === '@prefix') {\n i = p.directive(str, j);\n if (i < 0) {\n throw badSyntax(p._thisDoc, p.lines, str, i, 'bad syntax or EOF after @prefix ');\n }\n // console.log(\"P before dot i= \" + i)\n i = p.checkDot(str, i);\n // console.log(\"Q after dot i= \" + i)\n found = true;\n }\n if (!found) {\n // console.log(\"Bad syntax \" + j)\n throw badSyntax(p._thisDoc, p.lines, str, j, \"Unknown syntax at start of statememt: '\" + str.slice(j).slice(0, 20) + \"'\");\n }\n } // while\n // return clauses\n}","import DataFactory from './factories/extended-term-factory';\nimport jsonldParser from './jsonldparser';\n// @ts-ignore is this injected?\nimport { Parser as N3jsParser } from 'n3'; // @@ Goal: remove this dependency\nimport N3Parser from './n3parser';\nimport { parseRDFaDOM } from './rdfaparser';\nimport RDFParser from './rdfxmlparser';\nimport sparqlUpdateParser from './patch-parser';\nimport * as Util from './utils-js';\nimport { TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types';\n/**\n * Parse a string and put the result into the graph kb.\n * Normal method is sync.\n * Unfortunately jsdonld is currently written to need to be called async.\n * If you are parsing JSON-LD and want to know when and whether it succeeded, you need to use the callback param.\n * @param str - The input string to parse\n * @param kb - The store to use\n * @param base - The base URI to use\n * @param contentType - The MIME content type string for the input - defaults to text/turtle\n * @param [callback] - The callback to call when the data has been loaded\n */\nexport default function parse(str, kb, base) {\n let contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/turtle';\n let callback = arguments.length > 4 ? arguments[4] : undefined;\n contentType = contentType || TurtleContentType;\n contentType = contentType.split(';')[0];\n try {\n if (contentType === N3ContentType || contentType === TurtleContentType) {\n var p = N3Parser(kb, kb, base, base, null, null, '', null);\n p.loadBuf(str);\n executeCallback();\n } else if (contentType === RDFXMLContentType) {\n var parser = new RDFParser(kb);\n parser.parse(Util.parseXML(str), base, kb.sym(base));\n executeCallback();\n } else if (contentType === XHTMLContentType) {\n parseRDFaDOM(Util.parseXML(str, {\n contentType: XHTMLContentType\n }), kb, base);\n executeCallback();\n } else if (contentType === HTMLContentType) {\n parseRDFaDOM(Util.parseXML(str, {\n contentType: HTMLContentType\n }), kb, base);\n executeCallback();\n } else if (contentType === SPARQLUpdateContentType || contentType === SPARQLUpdateSingleMatchContentType) {\n // @@ we handle a subset\n sparqlUpdateParser(str, kb, base);\n executeCallback();\n } else if (contentType === JSONLDContentType) {\n // since we do not await the promise here, rejections will not be covered by the surrounding try catch\n // we do not use await, because parse() should stay sync\n // so, to not lose the async error, we need to catch the rejection and call the error callback here too\n jsonldParser(str, kb, base).then(executeCallback).catch(executeErrorCallback);\n } else if (contentType === NQuadsContentType || contentType === NQuadsAltContentType) {\n var n3Parser = new N3jsParser({\n factory: DataFactory\n });\n nquadCallback(null, str);\n } else if (contentType === undefined) {\n throw new Error(\"contentType is undefined\");\n } else {\n throw new Error(\"Don't know how to parse \" + contentType + ' yet');\n }\n } catch (e) {\n // @ts-ignore\n executeErrorCallback(e);\n }\n parse.handled = {\n 'text/n3': true,\n 'text/turtle': true,\n 'application/rdf+xml': true,\n 'application/xhtml+xml': true,\n 'text/html': true,\n 'application/sparql-update': true,\n 'application/sparql-update-single-match': true,\n 'application/ld+json': true,\n 'application/nquads': true,\n 'application/n-quads': true\n };\n function executeCallback() {\n if (callback) {\n callback(null, kb);\n } else {\n return;\n }\n }\n function executeErrorCallback(e) {\n if (\n // TODO: Always true, what is the right behavior\n contentType !== JSONLDContentType ||\n // @ts-ignore always true?\n contentType !== NQuadsContentType ||\n // @ts-ignore always true?\n contentType !== NQuadsAltContentType) {\n if (callback) {\n callback(e, kb);\n } else {\n let e2 = new Error('' + e + ' while trying to parse <' + base + '> as ' + contentType);\n //@ts-ignore .cause is not a default error property\n e2.cause = e;\n throw e2;\n }\n }\n }\n /*\n function setJsonLdBase (doc, base) {\n if (doc instanceof Array) {\n return\n }\n if (!('@context' in doc)) {\n doc['@context'] = {}\n }\n doc['@context']['@base'] = base\n }\n */\n function nquadCallback(err, nquads) {\n if (err) {\n callback(err, kb);\n }\n try {\n n3Parser.parse(nquads, tripleCallback);\n } catch (err) {\n callback(err, kb);\n }\n }\n function tripleCallback(err, triple) {\n if (triple) {\n kb.add(triple.subject, triple.predicate, triple.object, triple.graph);\n } else {\n callback(err, kb);\n }\n }\n}","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/* global $SolidTestEnvironment */\n/**\n *\n * Project: rdflib.js\n *\n * @file: fetcher.js\n *\n * Description: contains functions for requesting/fetching/retracting\n * This implements quite a lot of the web architecture.\n * A fetcher is bound to a specific quad store, into which\n * it loads stuff and into which it writes its metadata\n * @@ The metadata could be optionally a separate graph\n *\n * - implements semantics of HTTP headers, Internet Content Types\n * - selects parsers for rdf/xml, n3, rdfa, grddl\n *\n * TO do:\n * - Implement a runtime registry for parsers and serializers\n * -\n */\n\n/**\n * Things to test: callbacks on request, refresh, retract\n * loading from HTTP, HTTPS, FTP, FILE, others?\n * To do:\n * Firing up a mail client for mid: (message:) URLs\n */\nimport IndexedFormula from './store';\nimport log from './log';\nimport N3Parser from './n3parser';\nimport RDFlibNamedNode from './named-node';\nimport Namespace from './namespace';\nimport rdfParse from './parse';\nimport { parseRDFaDOM } from './rdfaparser';\nimport RDFParser from './rdfxmlparser';\nimport * as Uri from './uri';\nimport { isCollection, isNamedNode } from './utils/terms';\nimport * as Util from './utils-js';\nimport serialize from './serialize';\nimport crossFetch, { Headers } from 'cross-fetch';\nimport { TurtleContentType, RDFXMLContentType, XHTMLContentType } from './types';\nimport { termValue } from './utils/termValue';\nimport jsonldParser from './jsonldparser';\nconst Parsable = {\n 'text/n3': true,\n 'text/turtle': true,\n 'application/rdf+xml': true,\n 'application/xhtml+xml': true,\n 'text/html': true,\n 'application/ld+json': true\n};\n\n// This is a minimal set to allow the use of damaged servers if necessary\nconst CONTENT_TYPE_BY_EXT = {\n 'rdf': RDFXMLContentType,\n 'owl': RDFXMLContentType,\n 'n3': 'text/n3',\n 'ttl': 'text/turtle',\n 'nt': 'text/n3',\n 'acl': 'text/n3',\n 'html': 'text/html',\n 'xml': 'text/xml'\n};\n\n// Convenience namespaces needed in this module.\n// These are deliberately not exported as the user application should\n// make its own list and not rely on the prefixes used here,\n// and not be tempted to add to them, and them clash with those of another\n// application.\nconst getNS = factory => {\n return {\n link: Namespace('http://www.w3.org/2007/ont/link#', factory),\n http: Namespace('http://www.w3.org/2007/ont/http#', factory),\n httph: Namespace('http://www.w3.org/2007/ont/httph#', factory),\n // headers\n rdf: Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#', factory),\n rdfs: Namespace('http://www.w3.org/2000/01/rdf-schema#', factory),\n dc: Namespace('http://purl.org/dc/elements/1.1/', factory),\n ldp: Namespace('http://www.w3.org/ns/ldp#', factory)\n };\n};\nconst ns = getNS();\n\n/** An extended interface of Response, since RDFlib.js adds some properties. */\n\n/** tell typescript that a 'panes' child may exist on Window */\n\n/** All valid inputs for initFetchOptions */\n\n/** Initiated by initFetchOptions, which runs on load */\n\nclass Handler {\n constructor(response, dom) {\n // TODO: Document, type\n _defineProperty(this, \"response\", void 0);\n // TODO: Document, type\n _defineProperty(this, \"dom\", void 0);\n this.response = response;\n // The type assertion operator here might need to be removed.\n this.dom = dom;\n }\n}\n_defineProperty(Handler, \"pattern\", void 0);\nclass RDFXMLHandler extends Handler {\n static toString() {\n return 'RDFXMLHandler';\n }\n static register(fetcher) {\n fetcher.mediatypes[RDFXMLContentType] = {\n 'q': 0.9\n };\n }\n parse(fetcher, /** An XML String */\n responseText, /** Requires .original */\n options) {\n let kb = fetcher.store;\n if (!this.dom) {\n this.dom = Util.parseXML(responseText);\n }\n let root = this.dom.documentElement;\n if (root.nodeName === 'parsererror') {\n // Mozilla only See issue/issue110\n // have to fail the request\n return fetcher.failFetch(options, 'Badly formed XML in ' + options.resource.value, 'parse_error');\n }\n let parser = new RDFParser(kb);\n try {\n parser.parse(this.dom, options.original.value, options.original);\n } catch (err) {\n return fetcher.failFetch(options, 'Syntax error parsing RDF/XML! ' + err, 'parse_error');\n }\n if (!options.noMeta) {\n kb.add(options.original, ns.rdf('type'), ns.link('RDFDocument'), fetcher.appNode);\n }\n return fetcher.doneFetch(options, this.response);\n }\n}\nRDFXMLHandler.pattern = new RegExp('application/rdf\\\\+xml');\nclass XHTMLHandler extends Handler {\n static toString() {\n return 'XHTMLHandler';\n }\n static register(fetcher) {\n fetcher.mediatypes[XHTMLContentType] = {\n 'q': 0.8\n };\n }\n parse(fetcher, responseText, options) {\n let relation, reverse;\n if (!this.dom) {\n this.dom = Util.parseXML(responseText);\n }\n let kb = fetcher.store;\n\n // dc:title\n let title = this.dom.getElementsByTagName('title');\n if (title.length > 0) {\n kb.add(options.resource, ns.dc('title'), kb.rdfFactory.literal(title[0].textContent), options.resource);\n // log.info(\"Inferring title of \" + xhr.resource)\n }\n\n // link rel\n let links = this.dom.getElementsByTagName('link');\n for (let x = links.length - 1; x >= 0; x--) {\n // @@ rev\n relation = links[x].getAttribute('rel');\n reverse = false;\n if (!relation) {\n relation = links[x].getAttribute('rev');\n reverse = true;\n }\n if (relation) {\n fetcher.linkData(options.original, relation, links[x].getAttribute('href'), options.resource, reverse);\n }\n }\n\n // Data Islands\n let scripts = this.dom.getElementsByTagName('script');\n for (let i = 0; i < scripts.length; i++) {\n let contentType = scripts[i].getAttribute('type');\n if (Parsable[contentType]) {\n // @ts-ignore incompatibility between Store.add and Formula.add\n rdfParse(scripts[i].textContent, kb, options.original.value, contentType);\n // @ts-ignore incompatibility between Store.add and Formula.add\n rdfParse(scripts[i].textContent, kb, options.original.value, contentType);\n }\n }\n if (!options.noMeta) {\n kb.add(options.resource, ns.rdf('type'), ns.link('WebPage'), fetcher.appNode);\n }\n if (!options.noRDFa && parseRDFaDOM) {\n // enable by default\n try {\n parseRDFaDOM(this.dom, kb, options.original.value);\n } catch (err) {\n // @ts-ignore\n let msg = 'Error trying to parse ' + options.resource + ' as RDFa:\\n' + err + ':\\n' + err.stack;\n return fetcher.failFetch(options, msg, 'parse_error');\n }\n }\n return fetcher.doneFetch(options, this.response);\n }\n}\nXHTMLHandler.pattern = new RegExp('application/xhtml');\nclass XMLHandler extends Handler {\n static toString() {\n return 'XMLHandler';\n }\n static register(fetcher) {\n fetcher.mediatypes['text/xml'] = {\n 'q': 0.5\n };\n fetcher.mediatypes['application/xml'] = {\n 'q': 0.5\n };\n }\n static isElement(node) {\n return node.nodeType === Node.ELEMENT_NODE;\n }\n parse(fetcher, responseText, options) {\n let dom = Util.parseXML(responseText);\n\n // XML Semantics defined by root element namespace\n // figure out the root element\n for (let c = 0; c < dom.childNodes.length; c++) {\n const node = dom.childNodes[c];\n // is this node an element?\n if (XMLHandler.isElement(node)) {\n // We've found the first element, it's the root\n let ns = node.namespaceURI;\n\n // Is it RDF/XML?\n if (ns && ns === ns['rdf']) {\n fetcher.addStatus(options.req, 'Has XML root element in the RDF namespace, so assume RDF/XML.');\n let rdfHandler = new RDFXMLHandler(this.response, dom);\n return rdfHandler.parse(fetcher, responseText, options);\n }\n break;\n }\n }\n\n // Or it could be XHTML?\n // Maybe it has an XHTML DOCTYPE?\n if (dom.doctype) {\n // log.info(\"We found a DOCTYPE in \" + xhr.resource)\n if (dom.doctype.name === 'html' && dom.doctype.publicId.match(/^-\\/\\/W3C\\/\\/DTD XHTML/) && dom.doctype.systemId.match(/http:\\/\\/www.w3.org\\/TR\\/xhtml/)) {\n fetcher.addStatus(options.req, 'Has XHTML DOCTYPE. Switching to XHTML Handler.\\n');\n let xhtmlHandler = new XHTMLHandler(this.response, dom);\n return xhtmlHandler.parse(fetcher, responseText, options);\n }\n }\n\n // Or what about an XHTML namespace?\n let html = dom.getElementsByTagName('html')[0];\n if (html) {\n let xmlns = html.getAttribute('xmlns');\n if (xmlns && xmlns.match(/^http:\\/\\/www.w3.org\\/1999\\/xhtml/)) {\n fetcher.addStatus(options.req, 'Has a default namespace for ' + 'XHTML. Switching to XHTMLHandler.\\n');\n let xhtmlHandler = new XHTMLHandler(this.response, dom);\n return xhtmlHandler.parse(fetcher, responseText, options);\n }\n }\n\n // At this point we should check the namespace document (cache it!) and\n // look for a GRDDL transform\n // @@ Get namespace document <n>, parse it, look for <n> grddl:namespaceTransform ?y\n // Apply ?y to dom\n // We give up. What dialect is this?\n return fetcher.failFetch(options, 'Unsupported dialect of XML: not RDF or XHTML namespace, etc.\\n' + responseText.slice(0, 80), 901);\n }\n}\nXMLHandler.pattern = new RegExp('(text|application)/(.*)xml');\nclass HTMLHandler extends Handler {\n static toString() {\n return 'HTMLHandler';\n }\n static register(fetcher) {\n fetcher.mediatypes['text/html'] = {\n 'q': 0.8\n };\n }\n parse(fetcher, responseText, options) {\n let kb = fetcher.store;\n\n // We only handle XHTML so we have to figure out if this is XML\n // log.info(\"Sniffing HTML \" + xhr.resource + \" for XHTML.\")\n if (isXML(responseText)) {\n fetcher.addStatus(options.req, \"Has an XML declaration. We'll assume \" + \"it's XHTML as the content-type was text/html.\\n\");\n let xhtmlHandler = new XHTMLHandler(this.response);\n return xhtmlHandler.parse(fetcher, responseText, options);\n }\n\n // DOCTYPE html\n if (isXHTML(responseText)) {\n fetcher.addStatus(options.req, 'Has XHTML DOCTYPE. Switching to XHTMLHandler.\\n');\n let xhtmlHandler = new XHTMLHandler(this.response);\n return xhtmlHandler.parse(fetcher, responseText, options);\n }\n\n // xmlns\n if (isXMLNS(responseText)) {\n fetcher.addStatus(options.req, 'Has default namespace for XHTML, so switching to XHTMLHandler.\\n');\n let xhtmlHandler = new XHTMLHandler(this.response);\n return xhtmlHandler.parse(fetcher, responseText, options);\n }\n\n // dc:title\n // no need to escape '/' here\n let titleMatch = new RegExp('<title>([\\\\s\\\\S]+?)</title>', 'im').exec(responseText);\n if (titleMatch) {\n kb.add(options.resource, ns.dc('title'), kb.rdfFactory.literal(titleMatch[1]), options.resource); // think about xml:lang later\n }\n kb.add(options.resource, ns.rdf('type'), ns.link('WebPage'), fetcher.appNode);\n fetcher.addStatus(options.req, 'non-XML HTML document, not parsed for data.');\n return fetcher.doneFetch(options, this.response);\n }\n}\nHTMLHandler.pattern = new RegExp('text/html');\nclass JsonLdHandler extends Handler {\n static toString() {\n return 'JsonLdHandler';\n }\n static register(fetcher) {\n fetcher.mediatypes['application/ld+json'] = {\n 'q': 0.9\n };\n }\n async parse(fetcher, responseText, options, response) {\n const kb = fetcher.store;\n try {\n await jsonldParser(responseText, kb, options.original.value);\n fetcher.store.add(options.original, ns.rdf('type'), ns.link('RDFDocument'), fetcher.appNode);\n return fetcher.doneFetch(options, response);\n } catch (err) {\n const msg = 'Error trying to parse ' + options.resource + ' as JSON-LD:\\n' + err; // not err.stack -- irrelevant\n return fetcher.failFetch(options, msg, 'parse_error', response);\n }\n }\n}\nJsonLdHandler.pattern = /application\\/(ld\\+json|activity\\+json)/;\nclass TextHandler extends Handler {\n static toString() {\n return 'TextHandler';\n }\n static register(fetcher) {\n fetcher.mediatypes['text/plain'] = {\n 'q': 0.5\n };\n }\n parse(fetcher, responseText, options) {\n // We only speak dialects of XML right now. Is this XML?\n\n // Look for an XML declaration\n if (isXML(responseText)) {\n fetcher.addStatus(options.req, 'Warning: ' + options.resource + \" has an XML declaration. We'll assume \" + \"it's XML but its content-type wasn't XML.\\n\");\n let xmlHandler = new XMLHandler(this.response);\n return xmlHandler.parse(fetcher, responseText, options);\n }\n\n // Look for an XML declaration\n if (responseText.slice(0, 500).match(/xmlns:/)) {\n fetcher.addStatus(options.req, \"May have an XML namespace. We'll assume \" + \"it's XML but its content-type wasn't XML.\\n\");\n let xmlHandler = new XMLHandler(this.response);\n return xmlHandler.parse(fetcher, responseText, options);\n }\n\n // We give up finding semantics - this is not an error, just no data\n fetcher.addStatus(options.req, 'Plain text document, no known RDF semantics.');\n return fetcher.doneFetch(options, this.response);\n }\n}\nTextHandler.pattern = new RegExp('text/plain');\nclass N3Handler extends Handler {\n static toString() {\n return 'N3Handler';\n }\n static register(fetcher) {\n fetcher.mediatypes['text/n3'] = {};\n fetcher.mediatypes['text/turtle'] = {};\n }\n parse(fetcher, responseText, options, response) {\n // Parse the text of this N3 file\n let kb = fetcher.store;\n let p = N3Parser(kb, kb, options.original.value, options.original.value, null, null, '', null);\n // p.loadBuf(xhr.responseText)\n try {\n p.loadBuf(responseText);\n } catch (err) {\n let msg = 'Error trying to parse ' + options.resource + ' as Notation3:\\n' + err; // not err.stack -- irrelevant\n return fetcher.failFetch(options, msg, 'parse_error', response);\n }\n fetcher.addStatus(options.req, 'N3 parsed: ' + p.statementCount + ' triples in ' + p.lines + ' lines.');\n fetcher.store.add(options.original, ns.rdf('type'), ns.link('RDFDocument'), fetcher.appNode);\n return fetcher.doneFetch(options, this.response);\n }\n}\nN3Handler.pattern = new RegExp('(application|text)/(x-)?(rdf\\\\+)?(n3|turtle)');\nconst defaultHandlers = {\n RDFXMLHandler,\n XHTMLHandler,\n XMLHandler,\n HTMLHandler,\n TextHandler,\n N3Handler,\n JsonLdHandler\n};\nfunction isXHTML(responseText) {\n const docTypeStart = responseText.indexOf('<!DOCTYPE html');\n const docTypeEnd = responseText.indexOf('>');\n if (docTypeStart === -1 || docTypeEnd === -1 || docTypeStart > docTypeEnd) {\n return false;\n }\n return responseText.substr(docTypeStart, docTypeEnd - docTypeStart).indexOf('XHTML') !== -1;\n}\nfunction isXML(responseText) {\n const match = responseText.match(/\\s*<\\?xml\\s+version\\s*=[^<>]+\\?>/);\n return !!match;\n}\nfunction isXMLNS(responseText) {\n const match = responseText.match(/[^(<html)]*<html\\s+[^<]*xmlns=['\"]http:\\/\\/www.w3.org\\/1999\\/xhtml[\"'][^<]*>/);\n return !!match;\n}\n\n// Not sure about the shapes of this. Response? FetchError?\n\n/** Differs from normal Fetch, has an extended Response type */\n\n/** Fetcher\n *\n * The Fetcher object is a helper object for a quadstore\n * which turns it from an offline store to an online store.\n * The fetcher deals with loading data files rom the web,\n * figuring how to parse them. It will also refresh, remove, the data\n * and put back the data to the web.\n */\nexport default class Fetcher {\n constructor(store) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _defineProperty(this, \"store\", void 0);\n _defineProperty(this, \"timeout\", void 0);\n _defineProperty(this, \"_fetch\", void 0);\n _defineProperty(this, \"mediatypes\", void 0);\n /** Denoting this session */\n _defineProperty(this, \"appNode\", void 0);\n /**\n * this.requested[uri] states:\n * undefined no record of web access or records reset\n * true has been requested, fetch in progress\n * 'done' received, Ok\n * 401 Not logged in\n * 403 HTTP status unauthorized\n * 404 Resource does not exist. Can be created etc.\n * 'redirected' In attempt to counter CORS problems retried.\n * 'parse_error' Parse error\n * 'unsupported_protocol' URI is not a protocol Fetcher can deal with\n * other strings mean various other errors.\n */\n _defineProperty(this, \"requested\", void 0);\n /** List of timeouts associated with a requested URL */\n _defineProperty(this, \"timeouts\", void 0);\n /** Redirected from *key uri* to *value uri* */\n _defineProperty(this, \"redirectedTo\", void 0);\n _defineProperty(this, \"fetchQueue\", void 0);\n /** fetchCallbacks[uri].push(callback) */\n _defineProperty(this, \"fetchCallbacks\", void 0);\n /** Keep track of explicit 404s -> we can overwrite etc */\n _defineProperty(this, \"nonexistent\", void 0);\n _defineProperty(this, \"lookedUp\", void 0);\n _defineProperty(this, \"handlers\", void 0);\n _defineProperty(this, \"ns\", void 0);\n /** Methods added by calling Util.callbackify in the constructor*/\n _defineProperty(this, \"fireCallbacks\", void 0);\n this.store = store || new IndexedFormula();\n this.ns = getNS(this.store.rdfFactory);\n this.timeout = options.timeout || 30000;\n\n // solidFetcher is deprecated\n this._fetch = options.fetch || typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch) || typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch) || crossFetch;\n if (!this._fetch) {\n throw new Error('No _fetch function available for Fetcher');\n }\n // This is the name of the graph we store all the HTTP metadata in\n this.appNode = this.store.sym('chrome://TheCurrentSession');\n // this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests\n this.store.fetcher = this; // Bi-linked\n this.requested = {};\n this.timeouts = {};\n this.redirectedTo = {};\n this.fetchQueue = {};\n this.fetchCallbacks = {};\n this.nonexistent = {};\n this.lookedUp = {};\n this.handlers = [];\n this.mediatypes = {\n 'image/*': {\n 'q': 0.9\n },\n '*/*': {\n 'q': 0.1\n } // Must allow access to random content\n };\n\n // Util.callbackify(this, ['request', 'recv', 'headers', 'load', 'fail',\n // 'refresh', 'retract', 'done'])\n // In switching to fetch(), 'recv', 'headers' and 'load' do not make sense\n Util.callbackify(this, ['request', 'fail', 'refresh', 'retract', 'done']);\n Object.keys(options.handlers || defaultHandlers).map(key => this.addHandler(defaultHandlers[key]));\n }\n static crossSiteProxy(uri) {\n if (Fetcher.crossSiteProxyTemplate) {\n return Fetcher.crossSiteProxyTemplate.replace('{uri}', encodeURIComponent(uri));\n } else {\n return undefined;\n }\n }\n static offlineOverride(uri) {\n // Map the URI to a localhost proxy if we are running on localhost\n // This is used for working offline, e.g. on planes.\n // Is the script itself is running in localhost, then access all\n // data in a localhost mirror.\n // Do not remove without checking with TimBL\n let requestedURI = uri;\n var UI;\n if (typeof window !== 'undefined' && window.panes && (UI = window.panes.UI) && UI.preferences && UI.preferences.get('offlineModeUsingLocalhost')) {\n if (requestedURI.slice(0, 7) === 'http://' && requestedURI.slice(7, 17) !== 'localhost/') {\n requestedURI = 'http://localhost/' + requestedURI.slice(7);\n log.warn('Localhost kludge for offline use: actually getting <' + requestedURI + '>');\n } else {\n // log.warn(\"Localhost kludge NOT USED <\" + requestedURI + \">\")\n }\n } else {\n // log.warn(\"Localhost kludge OFF offline use: actually getting <\" +\n // requestedURI + \">\")\n }\n return requestedURI;\n }\n static proxyIfNecessary(uri) {\n var UI;\n if (typeof window !== 'undefined' && window.panes && (UI = window.panes.UI) && UI.isExtension) {\n return uri;\n } // Extension does not need proxy\n\n if (typeof $SolidTestEnvironment !== 'undefined' && $SolidTestEnvironment.localSiteMap) {\n // nested dictionaries of URI parts from origin down\n let hostpath = uri.split('/').slice(2); // the bit after the //\n\n const lookup = (parts, index) => {\n let z = index[parts.shift()];\n if (!z) {\n return null;\n }\n if (typeof z === 'string') {\n return z + parts.join('/');\n }\n if (!parts) {\n return null;\n }\n return lookup(parts, z);\n };\n const y = lookup(hostpath, $SolidTestEnvironment.localSiteMap);\n if (y) {\n return y;\n }\n }\n\n // browser does 2014 on as https browser script not trusted\n // If the web app origin is https: then the mixed content rules\n // prevent it loading insecure http: stuff so we need proxy.\n if (Fetcher.crossSiteProxyTemplate && typeof document !== 'undefined' && document.location && ('' + document.location).slice(0, 6) === 'https:' &&\n // origin is secure\n uri.slice(0, 5) === 'http:') {\n // requested data is not\n return Fetcher.crossSiteProxyTemplate.replace('{uri}', encodeURIComponent(uri));\n }\n return uri;\n }\n\n /**\n * Tests whether the uri's protocol is supported by the Fetcher.\n * @param uri\n */\n static unsupportedProtocol(uri) {\n let pcol = Uri.protocol(uri);\n return pcol === 'tel' || pcol === 'mailto' || pcol === 'urn';\n }\n\n /** Decide on credentials using old XXHR api or new fetch() one\n * @param requestedURI\n * @param options\n */\n static setCredentials(requestedURI) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n // 2014 CORS problem:\n // XMLHttpRequest cannot load http://www.w3.org/People/Berners-Lee/card.\n // A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin'\n // header when the credentials flag is true.\n // @ Many ontology files under http: and need CORS wildcard ->\n // can't have credentials\n if (options.credentials === undefined) {\n // Caller using new fetch convention\n if (options.withCredentials !== undefined) {\n // XHR style is what Fetcher specified before\n options.credentials = options.withCredentials ? 'include' : 'omit';\n } else {\n options.credentials = 'include'; // default is to be logged on\n }\n }\n }\n\n /**\n * Promise-based load function\n *\n * Loads a web resource or resources into the store.\n *\n * A resource may be given as NamedNode object, or as a plain URI.\n * an array of resources will be given, in which they will be fetched in parallel.\n * By default, the HTTP headers are recorded also, in the same store, in a separate graph.\n * This allows code like editable() for example to test things about the resource.\n *\n * @param uri {Array<RDFlibNamedNode>|Array<string>|RDFlibNamedNode|string}\n *\n * @param [options={}] {Object}\n *\n * @param [options.fetch] {Function}\n *\n * @param [options.referringTerm] {RDFlibNamedNode} Referring term, the resource which\n * referred to this (for tracking bad links)\n *\n * @param [options.contentType] {string} Provided content type (for writes)\n *\n * @param [options.forceContentType] {string} Override the incoming header to\n * force the data to be treated as this content-type (for reads)\n *\n * @param [options.force] {boolean} Load the data even if loaded before.\n * Also sets the `Cache-Control:` header to `no-cache`\n *\n * @param [options.baseURI=docuri] {Node|string} Original uri to preserve\n * through proxying etc (`xhr.original`).\n *\n * @param [options.proxyUsed] {boolean} Whether this request is a retry via\n * a proxy (generally done from an error handler)\n *\n * @param [options.withCredentials] {boolean} flag for XHR/CORS etc\n *\n * @param [options.clearPreviousData] {boolean} Before we parse new data,\n * clear old, but only on status 200 responses\n *\n * @param [options.noMeta] {boolean} Prevents the addition of various metadata\n * triples (about the fetch request) to the store\n *\n * @param [options.noRDFa] {boolean}\n *\n * @returns {Promise<Result>}\n */\n load(uri) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n options = Object.assign({}, options); // Take a copy as we add stuff to the options!!\n if (uri instanceof Array) {\n return Promise.all(uri.map(x => {\n return this.load(x, Object.assign({}, options));\n }));\n }\n const uriIn = uri;\n let docuri = termValue(uriIn);\n docuri = docuri.split('#')[0];\n options = this.initFetchOptions(docuri, options);\n // if metadata flaged clear cache and removeDocument\n const meta = this.appNode;\n const kb = this.store;\n const requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), kb.sym(docuri), meta).map(st => st.subject);\n for (const request of requests) {\n const response = kb.any(request, this.ns.link('response'), null, meta);\n if (response != undefined) {\n // ts\n const quad = kb.statementsMatching(response, this.ns.link('outOfDate'), true, meta);\n kb.remove(quad);\n options.force = true;\n options.clearPreviousData = true;\n }\n }\n const initialisedOptions = this.initFetchOptions(docuri, options);\n return this.pendingFetchPromise(docuri, initialisedOptions.baseURI, initialisedOptions);\n }\n async pendingFetchPromise(uri, originalUri, options) {\n let pendingPromise;\n\n // Check to see if some request is already dealing with this uri\n if (!options.force && (await this.fetchQueue[originalUri])) {\n pendingPromise = this.fetchQueue[originalUri];\n } else {\n pendingPromise = Promise.race([this.setRequestTimeout(uri, options), this.fetchUri(uri, options)]);\n this.fetchQueue[originalUri] = pendingPromise;\n\n // Clean up the queued promise after a time, if it's resolved\n this.cleanupFetchRequest(originalUri, undefined, this.timeout);\n }\n return pendingPromise.then(x => {\n if (uri in this.timeouts) {\n this.timeouts[uri].forEach(clearTimeout);\n delete this.timeouts[uri];\n }\n return x;\n });\n }\n\n /**\n * @param _options - DEPRECATED\n */\n cleanupFetchRequest(originalUri, _options, timeout) {\n if (_options !== undefined) {\n console.warn(\"_options is deprecated\");\n }\n this.timeouts[originalUri] = (this.timeouts[originalUri] || []).concat(setTimeout(() => {\n if (!this.isPending(originalUri)) {\n delete this.fetchQueue[originalUri];\n }\n }, timeout));\n }\n initFetchOptions(uri, options) {\n let kb = this.store;\n let isGet = !options.method || options.method.toUpperCase() === 'GET';\n if (!isGet) {\n options.force = true;\n }\n options.resource = kb.rdfFactory.namedNode(uri); // This might be proxified\n options.baseURI = options.baseURI || uri; // Preserve though proxying etc\n options.original = kb.rdfFactory.namedNode(options.baseURI);\n options.req = kb.bnode();\n options.headers = options.headers || {};\n if (options.contentType) {\n // @ts-ignore\n options.headers['content-type'] = options.contentType;\n }\n if (options.force) {\n options.cache = 'no-cache';\n }\n let acceptString = this.acceptString();\n // @ts-ignore\n options.headers['accept'] = acceptString;\n let requestedURI = Fetcher.offlineOverride(uri);\n options.requestedURI = requestedURI;\n Fetcher.setCredentials(requestedURI, options);\n let actualProxyURI = Fetcher.proxyIfNecessary(requestedURI);\n if (requestedURI !== actualProxyURI) {\n options.proxyUsed = true;\n }\n options.actualProxyURI = actualProxyURI;\n return options;\n }\n\n /**\n * (The promise chain ends in either a `failFetch()` or a `doneFetch()`)\n *\n * @param docuri {string}\n * @param options {Object}\n *\n * @returns {Promise<Object>} fetch() result or an { error, status } object\n */\n fetchUri(docuri, options) {\n if (!docuri) {\n return Promise.reject(new Error('Cannot fetch an empty uri'));\n }\n if (Fetcher.unsupportedProtocol(docuri)) {\n return this.failFetch(options, 'fetcher: Unsupported protocol', 'unsupported_protocol');\n }\n let state = this.getState(docuri);\n if (!options.force) {\n if (state === 'fetched') {\n // URI already fetched and added to store\n return Promise.resolve(\n // @ts-ignore This is not a valid response object\n this.doneFetch(options, {\n status: 200,\n ok: true,\n statusText: 'Already loaded into quadstore.'\n }));\n }\n if (state === 'failed' && this.requested[docuri] === 404) {\n // Remember nonexistence\n let message = 'Previously failed: ' + this.requested[docuri];\n // @ts-ignore This is not a valid response object\n let dummyResponse = {\n url: docuri,\n // This does not comply to Fetch spec, it can be a string value in rdflib\n status: this.requested[docuri],\n statusText: message,\n responseText: message,\n headers: new Headers(),\n // Headers() ???\n ok: false,\n body: null,\n bodyUsed: false,\n size: 0,\n timeout: 0\n };\n return this.failFetch(options, message, this.requested[docuri], dummyResponse);\n }\n } else {\n // options.force == true\n delete this.nonexistent[docuri];\n }\n this.fireCallbacks('request', [docuri]);\n this.requested[docuri] = true; // mark this uri as 'requested'\n\n if (!options.noMeta) {\n this.saveRequestMetadata(docuri, options);\n }\n let {\n actualProxyURI\n } = options;\n\n // Map might get mistakenly added into headers\n // error TS2339: Property 'map' does not exist on type 'Headers'.\n /* let map\n if (options.headers && map in options.headers) {\n delete options.headers.map\n } */\n\n return this._fetch(actualProxyURI, options).then(response => this.handleResponse(response, docuri, options), error => {\n // @@ handleError?\n // @ts-ignore Invalid response object\n let dummyResponse = {\n url: actualProxyURI,\n status: 999,\n // @@ what number/string should fetch failures report?\n statusText: (error.name || 'network failure') + ': ' + (error.errno || error.code || error.type),\n responseText: error.message,\n headers: new Headers(),\n // Headers() ???\n ok: false,\n body: null,\n bodyUsed: false,\n size: 0,\n timeout: 0\n };\n // console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)\n return this.handleError(dummyResponse, docuri, options); // possible credentials retry\n // return this.failFetch(options, 'fetch failed: ' + error, 999, dummyResponse) // Fake status code: fetch exception\n\n // handleError expects a response so we fake some important bits.\n /*\n this.handleError(, docuri, options)\n */\n });\n }\n\n /**\n * Asks for a doc to be loaded if necessary then calls back\n *\n * Calling methods:\n * nowOrWhenFetched (uri, userCallback)\n * nowOrWhenFetched (uri, options, userCallback)\n * nowOrWhenFetched (uri, referringTerm, userCallback, options) <-- old\n * nowOrWhenFetched (uri, referringTerm, userCallback) <-- old\n *\n * Options include:\n * referringTerm The document in which this link was found.\n * this is valuable when finding the source of bad URIs\n * force boolean. Never mind whether you have tried before,\n * load this from scratch.\n * forceContentType Override the incoming header to force the data to be\n * treated as this content-type.\n *\n * Callback function takes:\n *\n * ok True if the fetch worked, and got a 200 response.\n * False if any error happened\n *\n * errmessage Text error message if not OK.\n *\n * response The fetch Response object (was: XHR) if there was was one\n * includes response.status as the HTTP status if any.\n */\n nowOrWhenFetched(uriIn, p2, userCallback) {\n let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n const uri = termValue(uriIn);\n if (typeof p2 === 'function') {\n // nowOrWhenFetched (uri, userCallback)\n userCallback = p2;\n } else if (typeof p2 === 'undefined') {// original calling signature\n // referringTerm = undefined\n } else if (isNamedNode(p2)) {\n // referringTerm = p2\n options.referringTerm = p2;\n } else {\n // nowOrWhenFetched (uri, options, userCallback)\n options = p2;\n }\n this.load(uri, options).then(fetchResponse => {\n if (userCallback) {\n if (fetchResponse) {\n if (fetchResponse.ok) {\n userCallback(true, 'OK', fetchResponse);\n } else {\n let oops = 'HTTP error: Status ' + fetchResponse.status + ' (' + fetchResponse.statusText + ')';\n if (fetchResponse.responseText) {\n oops += ' ' + fetchResponse.responseText; // not in 404, dns error, nock failure\n }\n userCallback(false, oops, fetchResponse);\n }\n } else {\n let oops = '@@ nowOrWhenFetched: no response object!';\n userCallback(false, oops);\n }\n }\n }, function (err) {\n var message = err.message || err.statusText;\n message = 'Failed to load <' + uri + '> ' + message;\n if (err.response && err.response.status) {\n message += ' status: ' + err.response.status;\n }\n userCallback(false, message, err.response);\n });\n }\n\n /**\n * Records a status message (as a literal node) by appending it to the\n * request's metadata status collection.\n *\n */\n addStatus(req, statusMessage) {\n // <Debug about=\"parsePerformance\">\n let now = new Date();\n statusMessage = '[' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() + '.' + now.getMilliseconds() + '] ' + statusMessage;\n // </Debug>\n let kb = this.store;\n const statusNode = kb.the(req, this.ns.link('status'));\n if (isCollection(statusNode)) {\n statusNode.append(kb.rdfFactory.literal(statusMessage));\n } else {\n log.warn('web.js: No list to add to: ' + statusNode + ',' + statusMessage);\n }\n }\n\n /**\n * Records errors in the system on failure:\n *\n * - Adds an entry to the request status collection\n * - Adds an error triple with the fail message to the metadata\n * - Fires the 'fail' callback\n * - Rejects with an error result object, which has a response object if any\n */\n failFetch(options, errorMessage, statusCode, response) {\n this.addStatus(options.req, errorMessage);\n if (!options.noMeta) {\n this.store.add(options.original, this.ns.link('error'), this.store.rdfFactory.literal(errorMessage));\n }\n let meth = (options.method || 'GET').toUpperCase();\n let isGet = meth === 'GET' || meth === 'HEAD';\n if (isGet) {\n // only cache the status code on GET or HEAD\n if (!options.resource.equals(options.original)) {\n // console.log('@@ Recording failure ' + meth + ' original ' + options.original +option '( as ' + options.resource + ') : ' + statusCode)\n } else {\n // console.log('@@ Recording ' + meth + ' failure for ' + options.original + ': ' + statusCode)\n }\n this.requested[Uri.docpart(options.original.value)] = statusCode;\n this.fireCallbacks('fail', [options.original.value, errorMessage]);\n }\n var err = new Error('Fetcher: ' + errorMessage);\n\n // err.ok = false // Is taken as a response, will work too @@ phase out?\n err.status = statusCode;\n err.statusText = errorMessage;\n err.response = response;\n return Promise.reject(err);\n }\n\n // in the why part of the quad distinguish between HTML and HTTP header\n // Reverse is set iif the link was rev= as opposed to rel=\n linkData(originalUri, rel, uri, why, reverse) {\n if (!uri) return;\n let kb = this.store;\n let predicate;\n // See http://www.w3.org/TR/powder-dr/#httplink for describedby 2008-12-10\n let obj = kb.rdfFactory.namedNode(Uri.join(uri, originalUri.value));\n if (rel === 'alternate' || rel === 'seeAlso' || rel === 'meta' || rel === 'describedby') {\n if (obj.value === originalUri.value) {\n return;\n }\n predicate = this.ns.rdfs('seeAlso');\n } else if (rel === 'type') {\n predicate = kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type');\n } else {\n // See https://www.iana.org/assignments/link-relations/link-relations.xml\n // Alas not yet in RDF yet for each predicate\n // encode space in e.g. rel=\"shortcut icon\"\n predicate = kb.rdfFactory.namedNode(Uri.join(encodeURIComponent(rel), 'http://www.iana.org/assignments/link-relations/'));\n }\n if (reverse) {\n kb.add(obj, predicate, originalUri, why);\n } else {\n kb.add(originalUri, predicate, obj, why);\n }\n }\n parseLinkHeader(linkHeader, originalUri, reqNode) {\n if (!linkHeader) {\n return;\n }\n\n // const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} \\t]+=(([^()<>@,;:\"/[]?={} \\t]+)|(\"[^\"]*\")))*(,|$)/g\n // const paramexp = /[^()<>@,;:\"/[]?={} \\t]+=(([^()<>@,;:\"/[]?={} \\t]+)|(\"[^\"]*\"))/g\n\n // From https://www.dcode.fr/regular-expression-simplificator:\n // const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} t]+=[\"]))*[,$]/g\n // const paramexp = /[^\\\\<>@,;:\"\\/\\[\\]?={} \\t]+=[\"])/g\n // Original:\n const linkexp = /<[^>]*>\\s*(\\s*;\\s*[^()<>@,;:\"/[\\]?={} \\t]+=(([^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+)|(\"[^\"]*\")))*(,|$)/g;\n const paramexp = /[^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+=(([^\\(\\)<>@,;:\"\\/\\[\\]\\?={} \\t]+)|(\"[^\"]*\"))/g;\n const matches = linkHeader.match(linkexp);\n if (matches == null) return;\n for (let i = 0; i < matches.length; i++) {\n let split = matches[i].split('>');\n let href = split[0].substring(1);\n let ps = split[1];\n let s = ps.match(paramexp);\n if (s == null) return;\n for (let j = 0; j < s.length; j++) {\n let p = s[j];\n let paramsplit = p.split('=');\n // var name = paramsplit[0]\n let rel = paramsplit[1].replace(/[\"']/g, ''); // '\"\n this.linkData(originalUri, rel, href, reqNode);\n }\n }\n }\n doneFetch(options, response) {\n this.addStatus(options.req, 'Done.');\n this.requested[options.original.value] = 'done';\n this.fireCallbacks('done', [options.original.value]);\n response.req = options.req; // Set the request meta blank node\n\n return response;\n }\n\n /**\n * Note two nodes are now smushed\n * If only one was flagged as looked up, then the new node is looked up again,\n * which will make sure all the URIs are dereferenced\n */\n nowKnownAs(was, now) {\n if (this.lookedUp[was.value]) {\n // Transfer userCallback\n if (!this.lookedUp[now.value]) {\n this.lookUpThing(now, was);\n }\n } else if (this.lookedUp[now.value]) {\n if (!this.lookedUp[was.value]) {\n this.lookUpThing(was, now);\n }\n }\n }\n\n /**\n * Writes back to the web what we have in the store for this uri\n */\n putBack(uri) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n const uriSting = termValue(uri);\n let doc = new RDFlibNamedNode(uriSting).doc(); // strip off #\n options.contentType = options[\"content-type\"] || options[\"Content-Type\"] || options.contentType || TurtleContentType;\n if (options.contentType === 'application/ld+json') {\n return new Promise((resolve, reject) => {\n serialize(doc, this.store, doc.uri, options.contentType, (err, jsonString) => {\n if (err) {\n reject(err);\n } else {\n // @ts-ignore\n options.data = jsonString;\n this.webOperation('PUT', uri, options).then(res => resolve(res)).catch(error => reject(error));\n }\n });\n });\n }\n options.data = serialize(doc, this.store, doc.value, options.contentType);\n return this.webOperation('PUT', uriSting, options);\n }\n webCopy(here, there, contentType) {\n return this.webOperation('GET', here).then(result => {\n return this.webOperation('PUT',\n // change to binary from text\n there, {\n data: result.responseText,\n contentType\n });\n });\n }\n delete(uri, options) {\n return this.webOperation('DELETE', uri, options).then(response => {\n this.requested[uri] = 404;\n this.nonexistent[uri] = true;\n this.unload(this.store.rdfFactory.namedNode(uri));\n return response;\n });\n }\n\n /** Create an empty resource if it really does not exist\n * Be absolutely sure something does not exist before creating a new empty file\n * as otherwise existing could be deleted.\n * @param doc - The resource\n */\n async createIfNotExists(doc) {\n let contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TurtleContentType;\n let data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n const fetcher = this;\n try {\n var response = await fetcher.load(doc);\n } catch (err) {\n // @ts-ignore\n if (err.response.status === 404) {\n // console.log('createIfNotExists: doc does NOT exist, will create... ' + doc)\n try {\n response = await fetcher.webOperation('PUT', doc.value, {\n data,\n contentType\n });\n } catch (err) {\n // console.log('createIfNotExists doc FAILED: ' + doc + ': ' + err)\n throw err;\n }\n delete fetcher.requested[doc.value]; // delete cached 404 error\n // console.log('createIfNotExists doc created ok ' + doc)\n return response;\n } else {\n // console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + err)\n throw err;\n }\n }\n // console.log('createIfNotExists: doc exists, all good: ' + doc)\n return response;\n }\n\n /**\n * @param parentURI URI of parent container\n * @param folderName - Optional folder name (slug)\n * @param data - Optional folder metadata\n */\n createContainer(parentURI, folderName, data) {\n let headers = {\n // Force the right mime type for containers\n 'content-type': TurtleContentType,\n 'link': this.ns.ldp('BasicContainer') + '; rel=\"type\"'\n };\n if (folderName) {\n headers['slug'] = folderName;\n }\n\n // @ts-ignore These headers lack some of the required operators.\n let options = {\n headers\n };\n if (data) {\n options.body = data;\n }\n return this.webOperation('POST', parentURI, options);\n }\n invalidateCache(iri) {\n const uri = termValue(iri);\n const fetcher = this;\n // @ts-ignore\n if (fetcher.fetchQueue && fetcher.fetchQueue[uri]) {\n // console.log('Internal error - fetchQueue exists ' + uri)\n var promise = fetcher.fetchQueue[uri];\n if (promise['PromiseStatus'] === 'resolved') {\n delete fetcher.fetchQueue[uri];\n } else {\n // pending\n delete fetcher.fetchQueue[uri];\n // console.log('*** Fetcher: pending fetchQueue deleted ' + uri)\n }\n }\n if (fetcher.requested[uri] && fetcher.requested[uri] !== 'done' && fetcher.requested[uri] !== 'failed' && fetcher.requested[uri] !== 404) {\n let msg = `Rdflib: fetcher: Destructive operation on <${fetcher.requested[uri]}> file being fetched! ` + uri;\n console.error(msg);\n // alert(msg)\n } else {\n delete fetcher.requested[uri]; // invalidate read cache -- @@ messes up logic if request in progress ??\n delete fetcher.nonexistent[uri];\n }\n }\n\n /**\n * A generic web operation, at the fetch() level.\n * does not involve the quad store.\n *\n * Returns promise of Response\n * If data is returned, copies it to response.responseText before returning\n */\n webOperation(method, uriIn) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n const uri = termValue(uriIn);\n options.method = method;\n options.body = options.data || options.body;\n options.force = true;\n const fetcher = this;\n if (options.body && !options.contentType) {\n throw new Error('Web operation sending data must have a defined contentType.');\n }\n if (options.contentType) {\n options.headers = options.headers || {};\n options.headers['content-type'] = options.contentType;\n }\n Fetcher.setCredentials(uri, options);\n return new Promise(function (resolve, reject) {\n fetcher._fetch(uri, options).then(response => {\n if (response.ok) {\n if (method === 'PUT' || method === 'PATCH' || method === 'POST' || method === 'DELETE') {\n fetcher.invalidateCache(uri);\n } // response.body with Chrome can't be relied on\n if (response.text) {\n // Was: response.body https://github.com/linkeddata/rdflib.js/issues/506\n response.text().then(data => {\n response.responseText = data;\n resolve(response);\n });\n } else {\n resolve(response);\n }\n } else {\n let msg = 'Web error: ' + response.status;\n if (response.statusText) msg += ' (' + response.statusText + ')';\n msg += ' on ' + method + ' of <' + uri + '>';\n if (response.responseText) msg += ': ' + response.responseText;\n let e2 = new Error(msg);\n e2.response = response;\n reject(e2);\n }\n }, err => {\n let msg = 'Fetch error for ' + method + ' of <' + uri + '>:' + err;\n reject(new Error(msg));\n });\n });\n }\n\n /**\n * Looks up something.\n * Looks up all the URIs a things has.\n *\n * @param term - canonical term for the thing whose URI is\n * to be dereferenced\n * @param rterm - the resource which referred to this\n * (for tracking bad links)\n */\n lookUpThing(term, rterm) {\n let uris = this.store.uris(term); // Get all URIs\n uris = uris.map(u => Uri.docpart(u)); // Drop hash fragments\n\n uris.forEach(u => {\n this.lookedUp[u] = true;\n });\n\n // @ts-ignore Recursive type\n return this.load(uris, {\n referringTerm: rterm\n });\n }\n\n /**\n * Looks up response header.\n *\n * @returns {Array|undefined} a list of header values found in a stored HTTP\n * response, or [] if response was found but no header found,\n * or undefined if no response is available.\n * Looks for { [] link:requestedURI ?uri; link:response [ httph:header-name ?value ] }\n */\n getHeader(doc, header) {\n const kb = this.store; // look for the URI (AS A STRING NOT A NODE) for a stored request\n const docuri = doc.value;\n const requests = kb.each(undefined, this.ns.link('requestedURI'), kb.rdfFactory.literal(docuri));\n for (let r = 0; r < requests.length; r++) {\n let request = requests[r];\n if (request !== undefined) {\n let response = kb.any(request, this.ns.link('response'));\n if (response !== undefined && kb.anyValue(response, this.ns.http('status')) && kb.anyValue(response, this.ns.http('status')).startsWith('2')) {\n // Only look at success returns - not 401 error messagess etc\n let results = kb.each(response, this.ns.httph(header.toLowerCase()));\n if (results.length) {\n return results.map(v => {\n return v.value;\n });\n }\n return [];\n }\n }\n }\n return undefined;\n }\n saveRequestMetadata(docuri, options) {\n let req = options.req;\n let kb = this.store;\n let rterm = options.referringTerm;\n this.addStatus(options.req, 'Accept: ' + options.headers['accept']);\n if (isNamedNode(rterm)) {\n kb.add(kb.rdfFactory.namedNode(docuri), this.ns.link('requestedBy'), rterm, this.appNode);\n }\n if (options.original && options.original.value !== docuri) {\n kb.add(req, this.ns.link('orginalURI'), kb.rdfFactory.literal(options.original.value), this.appNode);\n }\n const now = new Date();\n const timeNow = '[' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() + '] ';\n kb.add(req, this.ns.rdfs('label'), kb.rdfFactory.literal(timeNow + ' Request for ' + docuri), this.appNode);\n // We store the docuri as a string, not as a node,\n // see https://github.com/linkeddata/rdflib.js/pull/427#pullrequestreview-447910061\n kb.add(req, this.ns.link('requestedURI'), kb.rdfFactory.literal(docuri), this.appNode);\n kb.add(req, this.ns.link('status'), kb.collection(), this.appNode);\n }\n saveResponseMetadata(response, options) {\n const kb = this.store;\n let responseNode = kb.bnode();\n kb.add(options.req, this.ns.link('response'), responseNode, this.appNode);\n kb.add(responseNode, this.ns.http('status'), kb.rdfFactory.literal(response.status), this.appNode);\n kb.add(responseNode, this.ns.http('statusText'), kb.rdfFactory.literal(response.statusText), this.appNode);\n\n // Save the response headers\n response.headers.forEach((value, header) => {\n kb.add(responseNode, this.ns.httph(header), this.store.rdfFactory.literal(value), this.appNode);\n if (header === 'content-type') {\n kb.add(options.resource, this.ns.rdf('type'), kb.rdfFactory.namedNode(Util.mediaTypeClass(value).value), this.appNode // responseNode\n );\n }\n });\n return responseNode;\n }\n objectRefresh(term) {\n let uris = this.store.uris(term); // Get all URIs\n if (typeof uris !== 'undefined') {\n for (let i = 0; i < uris.length; i++) {\n this.refresh(this.store.rdfFactory.namedNode(Uri.docpart(uris[i])));\n // what about rterm?\n }\n }\n }\n\n /* refresh Reload data from a given document\n **\n ** @param term - An RDF Named Node for the eodcument in question\n ** @param userCallback - A function userCallback(ok, message, response)\n */\n refresh(term, userCallback) {\n // sources_refresh\n this.fireCallbacks('refresh', arguments);\n this.nowOrWhenFetched(term, {\n force: true,\n clearPreviousData: true\n }, userCallback);\n }\n\n /* refreshIfExpired Conditional refresh if Expired\n **\n ** @param term - An RDF Named Node for the eodcument in question\n ** @param userCallback - A function userCallback(ok, message, response)\n */\n refreshIfExpired(term, userCallback) {\n let exp = this.getHeader(term, 'Expires');\n if (!exp || new Date(exp[0]).getTime() <= new Date().getTime()) {\n this.refresh(term, userCallback);\n } else {\n userCallback(true, 'Not expired', {});\n }\n }\n retract(term) {\n // sources_retract\n this.store.removeMany(undefined, undefined, undefined, term);\n if (term.value) {\n delete this.requested[Uri.docpart(term.value)];\n }\n this.fireCallbacks('retract', arguments);\n }\n getState(docuri) {\n if (typeof this.requested[docuri] === 'undefined') {\n return 'unrequested';\n } else if (this.requested[docuri] === true) {\n return 'requested';\n } else if (this.requested[docuri] === 'done') {\n return 'fetched';\n } else if (this.requested[docuri] === 'redirected') {\n return this.getState(this.redirectedTo[docuri]);\n } else {\n // An non-200 HTTP error status\n return 'failed';\n }\n }\n isPending(docuri) {\n // sources_pending\n // doing anyStatementMatching is wasting time\n // if it's not pending: false -> flailed\n // 'done' -> done 'redirected' -> redirected\n return this.requested[docuri] === true;\n }\n unload(term) {\n this.store.removeDocument(term);\n delete this.requested[term.value]; // So it can be load2ed again\n }\n addHandler(handler) {\n this.handlers.push(handler);\n handler.register(this);\n }\n retryNoCredentials(docuri, options) {\n // console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)\n\n options.retriedWithNoCredentials = true; // protect against being called twice\n\n delete this.requested[docuri]; // forget the original request happened\n delete this.fetchQueue[docuri];\n // Note: XHR property was withCredentials, but fetch property is just credentials\n let newOptions = Object.assign({}, options, {\n credentials: 'omit'\n });\n this.addStatus(options.req, 'Abort: Will retry with credentials SUPPRESSED to see if that helps');\n return this.load(docuri, newOptions);\n }\n\n /**\n * Tests whether a request is being made to a cross-site URI (for purposes\n * of retrying with a proxy)\n */\n isCrossSite(uri) {\n // Mashup situation, not node etc\n if (typeof document === 'undefined' || !document.location) {\n return false;\n }\n const hostpart = Uri.hostpart;\n const here = '' + document.location;\n return (hostpart(here) && hostpart(uri) && hostpart(here)) !== hostpart(uri);\n }\n\n /**\n * Called when there's a network error in fetch(), or a response\n * with status of 0.\n */\n handleError(response, docuri, options) {\n if (this.isCrossSite(docuri)) {\n // Make sure we haven't retried already\n if (options.credentials && options.credentials === 'include' && !options.retriedWithNoCredentials) {\n return this.retryNoCredentials(docuri, options);\n }\n\n // Now attempt retry via proxy\n let proxyUri = Fetcher.crossSiteProxy(docuri);\n if (proxyUri && !options.proxyUsed) {\n // console.log('web: Direct failed so trying proxy ' + proxyUri)\n return this.redirectToProxy(proxyUri, options);\n }\n }\n var message;\n if (response instanceof Error) {\n message = 'Fetch error: ' + response.message;\n } else {\n message = response.statusText;\n if (response.responseText) {\n message += ` ${response.responseText}`;\n }\n }\n\n // This is either not a CORS error, or retries have been made\n return this.failFetch(options, message, response.status || 998, response);\n }\n\n // deduce some things from the HTTP transaction\n addType(rdfType, req, kb, locURI) {\n // add type to all redirected resources too\n let prev = req;\n if (locURI) {\n var reqURI = kb.any(prev, this.ns.link('requestedURI'));\n if (reqURI && reqURI.value !== locURI) {\n kb.add(kb.rdfFactory.namedNode(locURI), this.ns.rdf('type'), rdfType, this.appNode);\n }\n }\n for (;;) {\n const doc = kb.any(prev, this.ns.link('requestedURI'));\n if (doc && doc.value) {\n kb.add(kb.rdfFactory.namedNode(doc.value), this.ns.rdf('type'), rdfType, this.appNode);\n } // convert Literal\n prev = kb.any(undefined, kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#redirectedRequest'), prev);\n if (!prev) {\n break;\n }\n var response = kb.any(prev, kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#response'));\n if (!response) {\n break;\n }\n var redirection = kb.any(response, kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/http#status'));\n if (!redirection) {\n break;\n }\n // @ts-ignore always true?\n if (redirection !== '301' && redirection !== '302') {\n break;\n }\n }\n }\n\n /**\n * Handle fetch() response\n */\n handleResponse(response, docuri, options) {\n const kb = this.store;\n const headers = response.headers;\n const reqNode = options.req;\n const responseNode = this.saveResponseMetadata(response, options);\n const contentType = this.normalizedContentType(options, headers) || '';\n let contentLocation = headers.get('content-location');\n\n // this.fireCallbacks('recv', xhr.args)\n // this.fireCallbacks('headers', [{uri: docuri, headers: xhr.headers}])\n\n // Check for masked errors (CORS, etc)\n if (response.status === 0) {\n // console.log('Masked error - status 0 for ' + docuri)\n return this.handleError(response, docuri, options);\n }\n if (response.status >= 400) {\n if (response.status === 404) {\n this.nonexistent[options.original.value] = true;\n this.nonexistent[docuri] = true;\n }\n return this.saveErrorResponse(response, responseNode).then(() => {\n let errorMessage = options.resource + ' ' + response.statusText;\n return this.failFetch(options, errorMessage, response.status, response);\n });\n }\n var diffLocation = null;\n var absContentLocation = null;\n if (contentLocation) {\n absContentLocation = Uri.join(contentLocation, docuri);\n if (absContentLocation !== docuri) {\n diffLocation = absContentLocation;\n }\n }\n if (response.status === 200) {\n this.addType(this.ns.link('Document'), reqNode, kb, docuri);\n if (diffLocation) {\n this.addType(this.ns.link('Document'), reqNode, kb, diffLocation);\n }\n\n // Before we parse new data clear old but only on 200\n if (options.clearPreviousData) {\n // kb.removeDocument(options.resource)\n // only remove content, keep metatdata\n const sts = kb.statementsMatching(undefined, undefined, undefined, options.resource).slice(); // Take a copy as this is the actual index\n for (let i = 0; i < sts.length; i++) {\n kb.removeStatement(sts[i]);\n }\n }\n let isImage = contentType.includes('image/') || contentType.includes('application/pdf');\n if (contentType && isImage) {\n this.addType(kb.rdfFactory.namedNode('http://purl.org/dc/terms/Image'), reqNode, kb, docuri);\n if (diffLocation) {\n this.addType(kb.rdfFactory.namedNode('http://purl.org/dc/terms/Image'), reqNode, kb, diffLocation);\n }\n }\n }\n\n // If we have already got the thing at this location, abort\n if (contentLocation) {\n if (!options.force && diffLocation && this.requested[absContentLocation] === 'done') {\n // we have already fetched this\n // should we smush too?\n // log.info(\"HTTP headers indicate we have already\" + \" retrieved \" +\n // xhr.resource + \" as \" + absContentLocation + \". Aborting.\")\n return this.doneFetch(options, response);\n }\n this.requested[absContentLocation] = true;\n }\n this.parseLinkHeader(headers.get('link'), options.original, reqNode);\n let handler = this.handlerForContentType(contentType, response);\n if (!handler) {\n // Not a problem, we just don't extract data\n this.addStatus(reqNode, 'Fetch over. No data handled.');\n return this.doneFetch(options, response);\n }\n return response.text()\n // @ts-ignore Types seem right\n .then(responseText => {\n response.responseText = responseText;\n return handler.parse(this, responseText, options, response);\n });\n }\n saveErrorResponse(response, responseNode) {\n let kb = this.store;\n return response.text().then(content => {\n if (content.length > 10) {\n kb.add(responseNode, this.ns.http('content'), kb.rdfFactory.literal(content), responseNode);\n }\n });\n }\n handlerForContentType(contentType, response) {\n if (!contentType) {\n return null;\n }\n let Handler = this.handlers.find(handler => {\n return contentType.match(handler.pattern);\n });\n\n // @ts-ignore in practice all Handlers have constructors.\n return Handler ? new Handler(response) : null;\n }\n guessContentType(uri) {\n return CONTENT_TYPE_BY_EXT[uri.split('.').pop()];\n }\n normalizedContentType(options, headers) {\n if (options.forceContentType) {\n return options.forceContentType;\n }\n let contentType = headers.get('content-type');\n if (!contentType || contentType.includes('application/octet-stream')) {\n let guess = this.guessContentType(options.resource.value);\n if (guess) {\n return guess;\n }\n }\n let protocol = Uri.protocol(options.resource.value);\n if (!contentType && ['file', 'chrome'].includes(protocol)) {\n return 'text/xml';\n }\n return contentType;\n }\n\n /**\n * Sends a new request to the specified uri. (Extracted from `onerrorFactory()`)\n */\n redirectToProxy(newURI, options) {\n this.addStatus(options.req, 'BLOCKED -> Cross-site Proxy to <' + newURI + '>');\n options.proxyUsed = true;\n const kb = this.store;\n const oldReq = options.req; // request metadata blank node\n\n if (!options.noMeta) {\n kb.add(oldReq, this.ns.link('redirectedTo'), kb.rdfFactory.namedNode(newURI), oldReq);\n this.addStatus(oldReq, 'redirected to new request'); // why\n }\n this.requested[options.resource.value] = 'redirected';\n this.redirectedTo[options.resource.value] = newURI;\n let newOptions = Object.assign({}, options);\n newOptions.baseURI = options.resource.value;\n return this.fetchUri(newURI, newOptions).then(response => {\n if (!newOptions.noMeta) {\n kb.add(oldReq, this.ns.link('redirectedRequest'), newOptions.req, this.appNode);\n }\n return response;\n });\n }\n setRequestTimeout(uri, options) {\n return new Promise(resolve => {\n this.timeouts[uri] = (this.timeouts[uri] || []).concat(setTimeout(() => {\n if (this.isPending(uri) && !options.retriedWithNoCredentials && !options.proxyUsed) {\n resolve(this.failFetch(options, `Request to ${uri} timed out`, 'timeout'));\n }\n }, this.timeout));\n });\n }\n addFetchCallback(uri, callback) {\n if (!this.fetchCallbacks[uri]) {\n this.fetchCallbacks[uri] = [callback];\n } else {\n this.fetchCallbacks[uri].push(callback);\n }\n }\n acceptString() {\n let acceptstring = '';\n for (let mediaType in this.mediatypes) {\n if (acceptstring !== '') {\n acceptstring += ', ';\n }\n acceptstring += mediaType;\n for (let property in this.mediatypes[mediaType]) {\n acceptstring += ';' + property + '=' + this.mediatypes[mediaType][property];\n }\n }\n return acceptstring;\n }\n // var updatesVia = new $rdf.UpdatesVia(this) // Subscribe to headers\n // @@@@@@@@ This is turned off because it causes a websocket to be set up for ANY fetch\n // whether we want to track it ot not. including ontologies loaed though the XSSproxy\n}\n_defineProperty(Fetcher, \"HANDLERS\", void 0);\n_defineProperty(Fetcher, \"CONTENT_TYPE_BY_EXT\", void 0);\n// TODO: Document this\n_defineProperty(Fetcher, \"crossSiteProxyTemplate\", void 0);\nFetcher.HANDLERS = defaultHandlers;\nFetcher.CONTENT_TYPE_BY_EXT = CONTENT_TYPE_BY_EXT;","export default (function () {\n return {\n parseJSON: function (data, source, store) {\n var subject, predicate, object;\n var bnodes = {};\n var why = store.sym(source);\n for (var x in data) {\n if (x.indexOf('_:') === 0) {\n if (bnodes[x]) {\n subject = bnodes[x];\n } else {\n subject = store.bnode(x);\n bnodes[x] = subject;\n }\n } else {\n subject = store.sym(x);\n }\n var preds = data[x];\n for (var y in preds) {\n var objects = preds[y];\n predicate = store.sym(y);\n for (var z in objects) {\n var obj = objects[z];\n if (obj.type === 'uri') {\n object = store.sym(obj.value);\n store.add(subject, predicate, object, why);\n } else if (obj.type === 'BlankNode') {\n if (bnodes[obj.value]) {\n object = bnodes[obj.value];\n } else {\n object = store.bnode(obj.value);\n bnodes[obj.value] = object;\n }\n store.add(subject, predicate, object, why);\n } else if (obj.type === 'Literal') {\n // var datatype\n if (obj.datatype) {\n object = store.literal(obj.value, undefined, store.sym(obj.datatype));\n } else if (obj.lang) {\n object = store.literal(obj.value, obj.lang);\n } else {\n object = store.literal(obj.value);\n }\n store.add(subject, predicate, object, why);\n } else {\n throw new Error('error: unexpected termtype: ' + z.type);\n }\n }\n }\n }\n }\n };\n})();","import log from './log';\nexport default function queryToSPARQL(query) {\n var indent = 0;\n function getSelect(query) {\n var str = addIndent() + 'SELECT ';\n for (var i = 0; i < query.vars.length; i++) {\n str += query.vars[i] + ' ';\n }\n str += '\\n';\n return str;\n }\n function getPattern(pat) {\n var str = '';\n var st = pat.statements;\n for (var x in st) {\n log.debug('Found statement: ' + st);\n str += addIndent() + st[x] + '\\n';\n }\n return str;\n }\n function getConstraints(pat) {\n var str = '';\n for (var v in pat.constraints) {\n var foo = pat.constraints[v];\n str += addIndent() + 'FILTER ( ' + foo.describe(v) + ' ) ' + '\\n';\n }\n return str;\n }\n function getOptionals(pat) {\n var str = '';\n for (var x = 0; x < pat.optional.length; x++) {\n // alert(pat.optional.termType)\n log.debug('Found optional query');\n str += addIndent() + 'OPTIONAL { ' + '\\n';\n indent++;\n str += getPattern(pat.optional[x]);\n str += getConstraints(pat.optional[x]);\n str += getOptionals(pat.optional[x]);\n indent--;\n str += addIndent() + '}' + '\\n';\n }\n return str;\n }\n function getWhere(pat) {\n var str = addIndent() + 'WHERE \\n' + '{ \\n';\n indent++;\n str += getPattern(pat);\n str += getConstraints(pat);\n str += getOptionals(pat);\n indent--;\n str += '}';\n return str;\n }\n function addIndent() {\n var str = '';\n for (var i = 0; i < indent; i++) {\n str += ' ';\n }\n return str;\n }\n function getSPARQL(query) {\n return getSelect(query) + getWhere(query.pat);\n }\n return getSPARQL(query);\n}","// Converting between SPARQL queries and the $rdf query API\n/*\n\nfunction SQuery () {\n this.terms = []\n return this\n}\n\nSTerm.prototype.toString = STerm.val\nSQuery.prototype.add = function (str) {this.terms.push()}*/\n\nimport log from './log';\nimport { Query } from './query';\n\n/**\n * @SPARQL: SPARQL text that is converted to a query object which is returned.\n * @testMode: testing flag. Prevents loading of sources.\n */\nexport default function SPARQLToQuery(SPARQL, testMode, kb) {\n // AJAR_ClearTable()\n var variableHash = [];\n function makeVar(name) {\n if (variableHash[name]) {\n return variableHash[name];\n }\n var newVar = kb.variable(name);\n variableHash[name] = newVar;\n return newVar;\n }\n\n // term type functions\n function isRealText(term) {\n return typeof term === 'string' && term.match(/[^ \\n\\t]/);\n }\n function isVar(term) {\n return typeof term === 'string' && term.match(/^[\\?\\$]/);\n }\n function fixSymbolBrackets(term) {\n if (typeof term === 'string') {\n return term.replace(/^&lt;/, '<').replace(/&gt;$/, '>');\n } else {\n return term;\n }\n }\n function isSymbol(term) {\n return typeof term === 'string' && term.match(/^<[^>]*>$/);\n }\n function isBnode(term) {\n return typeof term === 'string' && (term.match(/^_:/) || term.match(/^$/));\n }\n function isPrefix(term) {\n return typeof term === 'string' && term.match(/:$/);\n }\n function isPrefixedSymbol(term) {\n return typeof term === 'string' && term.match(/^:|^[^_][^:]*:/);\n }\n function getPrefix(term) {\n var a = term.split(':');\n return a[0];\n }\n function getSuffix(term) {\n var a = term.split(':');\n return a[1];\n }\n function removeBrackets(term) {\n if (isSymbol(term)) {\n return term.slice(1, term.length - 1);\n } else {\n return term;\n }\n }\n // takes a string and returns an array of strings and Literals in the place of literals\n function parseLiterals(str) {\n // var sin = (str.indexOf(/[ \\n]\\'/)==-1)?null:str.indexOf(/[ \\n]\\'/), doub = (str.indexOf(/[ \\n]\\\"/)==-1)?null:str.indexOf(/[ \\n]\\\"/)\n var sin = str.indexOf(\"'\") === -1 ? null : str.indexOf(\"'\");\n var doub = str.indexOf('\"') === -1 ? null : str.indexOf('\"');\n // alert(\"S: \"+sin+\" D: \"+doub)\n if (!sin && !doub) {\n var a = new Array(1);\n a[0] = str;\n return a;\n }\n var res = new Array(2);\n var br;\n var ind;\n if (!sin || doub && doub < sin) {\n br = '\"';\n ind = doub;\n } else if (!doub || sin && sin < doub) {\n br = \"'\";\n ind = sin;\n } else {\n log.error('SQARQL QUERY OOPS!');\n return res;\n }\n res[0] = str.slice(0, ind);\n var end = str.slice(ind + 1).indexOf(br);\n if (end === -1) {\n log.error('SPARQL parsing error: no matching parentheses in literal ' + str);\n return str;\n }\n // alert(str.slice(end + ind + 2).match(/^\\^\\^/))\n var end2;\n if (str.slice(end + ind + 2).match(/^\\^\\^/)) {\n end2 = str.slice(end + ind + 2).indexOf(' ');\n // alert(end2)\n res[1] = kb.literal(str.slice(ind + 1, ind + 1 + end), kb.sym(removeBrackets(str.slice(ind + 4 + end, ind + 2 + end + end2))));\n // alert(res[1].datatype.uri)\n res = res.concat(parseLiterals(str.slice(end + ind + 3 + end2)));\n } else if (str.slice(end + ind + 2).match(/^@/)) {\n end2 = str.slice(end + ind + 2).indexOf(' ');\n // alert(end2)\n res[1] = kb.literal(str.slice(ind + 1, ind + 1 + end), str.slice(ind + 3 + end, ind + 2 + end + end2), null);\n // alert(res[1].datatype.uri)\n res = res.concat(parseLiterals(str.slice(end + ind + 2 + end2)));\n } else {\n res[1] = kb.literal(str.slice(ind + 1, ind + 1 + end));\n log.info('Literal found: ' + res[1]);\n res = res.concat(parseLiterals(str.slice(end + ind + 2))); // finds any other literals\n }\n return res;\n }\n function spaceDelimit(str) {\n str = str.replace(/\\(/g, ' ( ').replace(/\\)/g, ' ) ').replace(/</g, ' <').replace(/>/g, '> ').replace(/{/g, ' { ').replace(/}/g, ' } ').replace(/[\\t\\n\\r]/g, ' ').replace(/; /g, ' ; ').replace(/\\. /g, ' . ').replace(/, /g, ' , ');\n log.info('New str into spaceDelimit: \\n' + str);\n var res = [];\n var br = str.split(' ');\n for (var x in br) {\n if (isRealText(br[x])) {\n res = res.concat(br[x]);\n }\n }\n return res;\n }\n function replaceKeywords(input) {\n var strarr = input;\n for (var x = 0; x < strarr.length; x++) {\n if (strarr[x] === 'a') {\n strarr[x] = '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>';\n }\n if (strarr[x] === 'is' && strarr[x + 2] === 'of') {\n strarr.splice(x, 1);\n strarr.splice(x + 1, 1);\n var s = strarr[x - 1];\n strarr[x - 1] = strarr[x + 1];\n strarr[x + 1] = s;\n }\n }\n return strarr;\n }\n function toTerms(input) {\n var res = [];\n for (var x = 0; x < input.length; x++) {\n if (typeof input[x] !== 'string') {\n res[x] = input[x];\n continue;\n }\n input[x] = fixSymbolBrackets(input[x]);\n if (isVar(input[x])) {\n res[x] = makeVar(input[x].slice(1));\n } else if (isBnode(input[x])) {\n log.info(input[x] + ' was identified as a bnode.');\n res[x] = kb.bnode();\n } else if (isSymbol(input[x])) {\n log.info(input[x] + ' was identified as a symbol.');\n res[x] = kb.sym(removeBrackets(input[x]));\n } else if (isPrefixedSymbol(input[x])) {\n log.info(input[x] + ' was identified as a prefixed symbol');\n if (prefixes[getPrefix(input[x])]) {\n res[x] = kb.sym(input[x] = prefixes[getPrefix(input[x])] + getSuffix(input[x]));\n } else {\n log.error('SPARQL error: ' + input[x] + ' with prefix ' + getPrefix(input[x]) + ' does not have a correct prefix entry.');\n res[x] = input[x];\n }\n } else {\n res[x] = input[x];\n }\n }\n return res;\n }\n function tokenize(str) {\n var token1 = parseLiterals(str);\n var token2 = [];\n for (var x in token1) {\n if (typeof token1[x] === 'string') {\n token2 = token2.concat(spaceDelimit(token1[x]));\n } else {\n token2 = token2.concat(token1[x]);\n }\n }\n token2 = replaceKeywords(token2);\n log.info('SPARQL Tokens: ' + token2);\n return token2;\n }\n\n // CASE-INSENSITIVE\n function arrayIndexOf(str, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (typeof arr[i] !== 'string') {\n continue;\n }\n if (arr[i].toLowerCase() === str.toLowerCase()) {\n return i;\n }\n }\n // log.warn(\"No instance of \"+str+\" in array \"+arr)\n return null;\n }\n\n // CASE-INSENSITIVE\n function arrayIndicesOf(str, arr) {\n var ind = [];\n for (var i = 0; i < arr.length; i++) {\n if (typeof arr[i] !== 'string') {\n continue;\n }\n if (arr[i].toLowerCase() === str.toLowerCase()) {\n ind.push(i);\n }\n }\n return ind;\n }\n function setVars(input, query) {\n log.info('SPARQL vars: ' + input);\n for (var x in input) {\n if (isVar(input[x])) {\n log.info('Added ' + input[x] + ' to query variables from SPARQL');\n var v = makeVar(input[x].slice(1));\n query.vars.push(v);\n v.label = input[x].slice(1);\n } else {\n log.warn('Incorrect SPARQL variable in SELECT: ' + input[x]);\n }\n }\n }\n function getPrefixDeclarations(input) {\n var prefInd = arrayIndicesOf('PREFIX', input);\n var res = [];\n for (var i in prefInd) {\n var a = input[prefInd[i] + 1];\n var b = input[prefInd[i] + 2];\n if (!isPrefix(a)) {\n log.error('Invalid SPARQL prefix: ' + a);\n } else if (!isSymbol(b)) {\n log.error('Invalid SPARQL symbol: ' + b);\n } else {\n log.info('Prefix found: ' + a + ' -> ' + b);\n var pref = getPrefix(a);\n var symbol = removeBrackets(b);\n res[pref] = symbol;\n }\n }\n return res;\n }\n function getMatchingBracket(arr, open, close) {\n log.info('Looking for a close bracket of type ' + close + ' in ' + arr);\n var index = 0;\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === open) {\n index++;\n }\n if (arr[i] === close) {\n index--;\n }\n if (index < 0) {\n return i;\n }\n }\n log.error('Statement had no close parenthesis in SPARQL query');\n return 0;\n }\n function constraintGreaterThan(value) {\n this.describe = function (varstr) {\n return varstr + ' > ' + value.toNT();\n };\n this.test = function (term) {\n if (term.value.match(/[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?/)) {\n return parseFloat(term.value) > parseFloat(value);\n } else {\n return term.toNT() > value.toNT();\n }\n };\n return this;\n }\n function constraintLessThan(value) {\n // this is not the recommended usage. Should only work on literal, numeric, dateTime\n this.describe = function (varstr) {\n return varstr + ' < ' + value.toNT();\n };\n this.test = function (term) {\n // this.describe = function (varstr) { return varstr + \" < \"+value }\n if (term.value.match(/[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?/)) {\n return parseFloat(term.value) < parseFloat(value);\n } else {\n return term.toNT() < value.toNT();\n }\n };\n return this;\n }\n // This should only work on literals but doesn't.\n function ConstraintEqualTo(value) {\n this.describe = function (varstr) {\n return varstr + ' = ' + value.toNT();\n };\n this.test = function (term) {\n return value.equals(term);\n };\n return this;\n }\n\n // value must be a literal\n function ConstraintRegexp(value) {\n this.describe = function (varstr) {\n return \"REGEXP( '\" + value + \"' , \" + varstr + ' )';\n };\n this.test = function (term) {\n var str = value;\n // str = str.replace(/^//,\"\").replace(//$/,\"\")\n var rg = new RegExp(str);\n if (term.value) {\n return rg.test(term.value);\n } else {\n return false;\n }\n };\n }\n function setConstraint(input, pat) {\n if (input.length === 3 && input[0].termType === 'Variable' && (input[2].termType === 'NamedNode' || input[2].termType === 'Literal')) {\n if (input[1] === '=') {\n log.debug('Constraint added: ' + input);\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2]);\n } else if (input[1] === '>') {\n log.debug('Constraint added: ' + input);\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2]);\n } else if (input[1] === '<') {\n log.debug('Constraint added: ' + input);\n pat.constraints[input[0]] = new ConstraintEqualTo(input[2]);\n } else {\n log.warn(\"I don't know how to handle the constraint: \" + input);\n }\n } else if (input.length === 6 && typeof input[0] === 'string' && input[0].toLowerCase() === 'regexp' && input[1] === '(' && input[5] === ')' && input[3] === ',' && input[4].termType === 'Variable' && input[2].termType === 'Literal') {\n log.debug('Constraint added: ' + input);\n pat.constraints[input[4]] = new ConstraintRegexp(input[2].value);\n }\n // log.warn(\"I don't know how to handle the constraint: \"+input)\n // alert(\"length: \"+input.length+\" input 0 type: \"+input[0].termType+\" input 1: \"+input[1]+\" input[2] type: \"+input[2].termType)\n }\n function setOptional(terms, pat) {\n log.debug('Optional query: ' + terms + ' not yet implemented.');\n var opt = kb.formula();\n setWhere(terms, opt);\n pat.optional.push(opt);\n }\n function setWhere(input, pat) {\n var terms = toTerms(input);\n var end;\n log.debug('WHERE: ' + terms);\n var opt;\n // var opt = arrayIndicesOf(\"OPTIONAL\",terms)\n while (arrayIndexOf('OPTIONAL', terms)) {\n opt = arrayIndexOf('OPTIONAL', terms);\n log.debug('OPT: ' + opt + ' ' + terms[opt] + ' in ' + terms);\n if (terms[opt + 1] !== '{') {\n log.warn('Bad optional opening bracket in word ' + opt);\n }\n end = getMatchingBracket(terms.slice(opt + 2), '{', '}');\n if (end === -1) {\n log.error('No matching bracket in word ' + opt);\n } else {\n setOptional(terms.slice(opt + 2, opt + 2 + end), pat);\n // alert(pat.statements[0].toNT())\n opt = arrayIndexOf('OPTIONAL', terms);\n end = getMatchingBracket(terms.slice(opt + 2), '{', '}');\n terms.splice(opt, end + 3);\n }\n }\n log.debug('WHERE after optionals: ' + terms);\n while (arrayIndexOf('FILTER', terms)) {\n var filt = arrayIndexOf('FILTER', terms);\n if (terms[filt + 1] !== '(') {\n log.warn('Bad filter opening bracket in word ' + filt);\n }\n end = getMatchingBracket(terms.slice(filt + 2), '(', ')');\n if (end === -1) {\n log.error('No matching bracket in word ' + filt);\n } else {\n setConstraint(terms.slice(filt + 2, filt + 2 + end), pat);\n filt = arrayIndexOf('FILTER', terms);\n end = getMatchingBracket(terms.slice(filt + 2), '(', ')');\n terms.splice(filt, end + 3);\n }\n }\n log.debug('WHERE after filters and optionals: ' + terms);\n extractStatements(terms, pat);\n }\n function extractStatements(terms, formula) {\n var arrayZero = new Array(1);\n arrayZero[0] = -1; // this is just to add the beginning of the where to the periods index.\n var per = arrayZero.concat(arrayIndicesOf('.', terms));\n var stat = [];\n for (var x = 0; x < per.length - 1; x++) {\n stat[x] = terms.slice(per[x] + 1, per[x + 1]);\n }\n // Now it's in an array of statements\n for (x in stat) {\n // THIS MUST BE CHANGED FOR COMMA, SEMICOLON\n log.info('s+p+o ' + x + ' = ' + stat[x]);\n var subj = stat[x][0];\n stat[x].splice(0, 1);\n var sem = arrayZero.concat(arrayIndicesOf(';', stat[x]));\n sem.push(stat[x].length);\n var stat2 = [];\n for (var y = 0; y < sem.length - 1; y++) {\n stat2[y] = stat[x].slice(sem[y] + 1, sem[y + 1]);\n }\n for (x in stat2) {\n log.info('p+o ' + x + ' = ' + stat[x]);\n var pred = stat2[x][0];\n stat2[x].splice(0, 1);\n var com = arrayZero.concat(arrayIndicesOf(',', stat2[x]));\n com.push(stat2[x].length);\n var stat3 = [];\n for (y = 0; y < com.length - 1; y++) {\n stat3[y] = stat2[x].slice(com[y] + 1, com[y + 1]);\n }\n for (x in stat3) {\n var obj = stat3[x][0];\n log.info('Subj=' + subj + ' Pred=' + pred + ' Obj=' + obj);\n formula.add(subj, pred, obj);\n }\n }\n }\n }\n\n // ******************************* Body of SPARQLToQuery ***************************//\n log.info('SPARQL input: \\n' + SPARQL);\n var q = new Query();\n var sp = tokenize(SPARQL); // first tokenize everything\n var prefixes = getPrefixDeclarations(sp);\n if (!prefixes.rdf) {\n prefixes.rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';\n }\n if (!prefixes.rdfs) {\n prefixes.rdfs = 'http://www.w3.org/2000/01/rdf-schema#';\n }\n var selectLoc = arrayIndexOf('SELECT', sp);\n var whereLoc = arrayIndexOf('WHERE', sp);\n if (selectLoc < 0 || whereLoc < 0 || selectLoc > whereLoc) {\n log.error('Invalid or nonexistent SELECT and WHERE tags in SPARQL query');\n return false;\n }\n setVars(sp.slice(selectLoc + 1, whereLoc), q);\n setWhere(sp.slice(whereLoc + 2, sp.length - 1), q.pat);\n if (testMode) {\n return q;\n }\n for (var x in q.pat.statements) {\n var st = q.pat.statements[x];\n if (st.subject.termType === 'NamedNode') {\n if (kb.fetcher) {\n kb.fetcher.lookUpThing(st.subject, 'sparql:' + st.subject);\n }\n }\n if (st.object.termType === 'NamedNode') {\n if (kb.fetcher) {\n kb.fetcher.lookUpThing(st.object, 'sparql:' + st.object);\n }\n }\n }\n // alert(q.pat)\n return q;\n // checkVars()\n // *******************************************************************//\n}","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/* @file Update Manager Class\n**\n** 2007-07-15 original SPARQL Update module by Joe Presbrey <presbrey@mit.edu>\n** 2010-08-08 TimBL folded in Kenny's WEBDAV\n** 2010-12-07 TimBL added local file write code\n*/\nimport IndexedFormula from './store';\nimport { docpart, join as uriJoin } from './uri';\nimport Fetcher from './fetcher';\nimport Namespace from './namespace';\nimport Serializer from './serializer';\nimport { isBlankNode, isStore } from './utils/terms';\nimport * as Util from './utils-js';\nimport { termValue } from './utils/termValue';\n/**\n* The UpdateManager is a helper object for a store.\n* Just as a Fetcher provides the store with the ability to read and write,\n* the Update Manager provides functionality for making small patches in real time,\n* and also looking out for concurrent updates from other agents\n*/\nexport default class UpdateManager {\n /**\n * @param store - The quadstore to store data and metadata. Created if not passed.\n */\n constructor(store) {\n _defineProperty(this, \"store\", void 0);\n _defineProperty(this, \"ifps\", void 0);\n _defineProperty(this, \"fps\", void 0);\n /** Index of objects for coordinating incoming and outgoing patches */\n _defineProperty(this, \"patchControl\", void 0);\n /** Object of namespaces */\n _defineProperty(this, \"ns\", void 0);\n store = store || new IndexedFormula();\n if (store.updater) {\n throw new Error(\"You can't have two UpdateManagers for the same store\");\n }\n if (!store.fetcher) {\n store.fetcher = new Fetcher(store);\n }\n this.store = store;\n store.updater = this;\n this.ifps = {};\n this.fps = {};\n this.ns = {};\n this.ns.link = Namespace('http://www.w3.org/2007/ont/link#');\n this.ns.http = Namespace('http://www.w3.org/2007/ont/http#');\n this.ns.httph = Namespace('http://www.w3.org/2007/ont/httph#');\n this.ns.ldp = Namespace('http://www.w3.org/ns/ldp#');\n this.ns.rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');\n this.ns.rdfs = Namespace('http://www.w3.org/2000/01/rdf-schema#');\n this.ns.rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');\n this.ns.owl = Namespace('http://www.w3.org/2002/07/owl#');\n this.patchControl = [];\n }\n patchControlFor(doc) {\n if (!this.patchControl[doc.value]) {\n this.patchControl[doc.value] = [];\n }\n return this.patchControl[doc.value];\n }\n isHttpUri(uri) {\n return uri.slice(0, 4) === 'http';\n }\n\n /** Remove from the store HTTP authorization metadata\n * The editable function below relies on copies we have in the store\n * of the results of previous HTTP transactions. However, when\n * the user logs in, then that data misrepresents what would happen\n * if the user tried again.\n */\n flagAuthorizationMetadata(kb) {\n if (!kb) {\n kb = this.store;\n }\n const meta = kb.fetcher?.appNode;\n const requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(st => st.subject);\n for (const request of requests) {\n const response = kb.any(request, this.ns.link('response'), null, meta);\n if (response != undefined) {\n // ts\n kb.add(response, this.ns.link('outOfDate'), true, meta); // @@ Boolean is fine - fix types\n }\n }\n }\n\n /**\n * Tests whether a file is editable.\n * If the file has a specific annotation that it is machine written,\n * for safety, it is editable (this doesn't actually check for write access)\n * If the file has wac-allow and accept patch headers, those are respected.\n * and local write access is determined by those headers.\n * This async version not only looks at past HTTP requests, it also makes new ones if necessary.\n *\n * @returns The method string N3PATCH or SPARQL or DAV or\n * LOCALFILE or false if known, undefined if not known.\n */\n async checkEditable(uri, kb) {\n if (!uri) {\n return false; // Eg subject is bnode, no known doc to write to\n }\n if (!kb) {\n kb = this.store;\n }\n const initial = this.editable(uri, kb);\n if (initial !== undefined) {\n return initial;\n }\n await kb.fetcher?.load(uri);\n const final = this.editable(uri, kb);\n // console.log(`Loaded ${uri} just to check editable, result: ${final}.`)\n return final;\n }\n /**\n * Tests whether a file is editable.\n * If the file has a specific annotation that it is machine written,\n * for safety, it is editable (this doesn't actually check for write access)\n * If the file has wac-allow and accept patch headers, those are respected.\n * and local write access is determined by those headers.\n * This synchronous version only looks at past HTTP requests, does not make new ones.\n *\n * @returns The method string SPARQL or DAV or\n * LOCALFILE or false if known, undefined if not known.\n */\n editable(uri, kb) {\n if (!uri) {\n return false; // Eg subject is bnode, no known doc to write to\n }\n if (!kb) {\n kb = this.store;\n }\n uri = termValue(uri);\n if (!this.isHttpUri(uri)) {\n if (kb.holds(kb.rdfFactory.namedNode(uri), kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {\n return 'LOCALFILE';\n }\n }\n var request;\n var definitive = false;\n const meta = kb.fetcher?.appNode;\n // const kb = s\n\n // @ts-ignore passes a string to kb.each, which expects a term. Should this work?\n var requests = kb.each(undefined, this.ns.link('requestedURI'), docpart(uri), meta);\n var method;\n for (var r = 0; r < requests.length; r++) {\n request = requests[r];\n if (request !== undefined) {\n const response = kb.any(request, this.ns.link('response'), null, meta);\n if (response !== undefined) {\n // ts\n\n const outOfDate = kb.anyJS(response, this.ns.link('outOfDate'), null, meta);\n if (outOfDate) continue;\n var wacAllow = kb.anyValue(response, this.ns.httph('wac-allow'));\n if (wacAllow) {\n for (var bit of wacAllow.split(',')) {\n var lr = bit.split('=');\n if (lr[0].includes('user') && !lr[1].includes('write') && !lr[1].includes('append')) {\n // console.log(' editable? excluded by WAC-Allow: ', wacAllow)\n return false;\n }\n }\n }\n var acceptPatch = kb.each(response, this.ns.httph('accept-patch'));\n if (acceptPatch.length) {\n for (let i = 0; i < acceptPatch.length; i++) {\n method = acceptPatch[i].value.trim();\n // 2025/02 temporarily priorize SPARQL until N3PATCH spec revised on inserts with blankNodes\n if (method.indexOf('application/sparql-update') >= 0) return 'SPARQL';\n if (method.indexOf('application/sparql-update-single-match') >= 0) return 'SPARQL';\n if (method.indexOf('text/n3') >= 0) return 'N3PATCH';\n }\n }\n var authorVia = kb.each(response, this.ns.httph('ms-author-via'));\n if (authorVia.length) {\n for (let i = 0; i < authorVia.length; i++) {\n method = authorVia[i].value.trim();\n if (method.indexOf('SPARQL') >= 0) {\n return 'SPARQL';\n }\n if (method.indexOf('DAV') >= 0) {\n return 'DAV';\n }\n }\n }\n if (!this.isHttpUri(uri)) {\n if (!wacAllow) return false;else return 'LOCALFILE';\n }\n var status = kb.each(response, this.ns.http('status'));\n if (status.length) {\n for (let i = 0; i < status.length; i++) {\n // @ts-ignore since statuses should be TFTerms, this should always be false\n if (status[i] === 200 || status[i] === 404) {\n definitive = true;\n // return false // A definitive answer\n }\n }\n }\n } else {\n // console.log('UpdateManager.editable: No response for ' + uri + '\\n')\n }\n }\n }\n if (requests.length === 0) {\n // console.log('UpdateManager.editable: No request for ' + uri + '\\n')\n } else {\n if (definitive) {\n return false; // We have got a request and it did NOT say editable => not editable\n }\n }\n // console.log('UpdateManager.editable: inconclusive for ' + uri + '\\n')\n return undefined; // We don't know (yet) as we haven't had a response (yet)\n }\n anonymize(obj) {\n let anonymized = obj.toNT().substr(0, 2) === '_:' && this.mentioned(obj) ? '?' + obj.toNT().substr(2) : obj.toNT();\n return anonymized;\n }\n anonymizeNT(stmt) {\n return this.anonymize(stmt.subject) + ' ' + this.anonymize(stmt.predicate) + ' ' + this.anonymize(stmt.object) + ' .';\n }\n nTriples(stmt) {\n return `${stmt.subject.toNT()} ${stmt.predicate.toNT()} ${stmt.object.toNT()} .`;\n }\n\n /**\n * Returns a list of all bnodes occurring in a statement\n * @private\n */\n statementBnodes(st) {\n return [st.subject, st.predicate, st.object].filter(function (x) {\n return isBlankNode(x);\n });\n }\n\n /**\n * Returns a list of all bnodes occurring in a list of statements\n * @private\n */\n statementArrayBnodes(sts) {\n var bnodes = [];\n for (let i = 0; i < sts.length; i++) {\n bnodes = bnodes.concat(this.statementBnodes(sts[i]));\n }\n bnodes.sort(); // in place sort - result may have duplicates\n var bnodes2 = [];\n for (let j = 0; j < bnodes.length; j++) {\n if (j === 0 || !bnodes[j].equals(bnodes[j - 1])) {\n bnodes2.push(bnodes[j]);\n }\n }\n return bnodes2;\n }\n\n /**\n * Makes a cached list of [Inverse-]Functional properties\n * @private\n */\n cacheIfps() {\n this.ifps = {};\n var a = this.store.each(undefined, this.ns.rdf('type'), this.ns.owl('InverseFunctionalProperty'));\n for (let i = 0; i < a.length; i++) {\n this.ifps[a[i].value] = true;\n }\n this.fps = {};\n a = this.store.each(undefined, this.ns.rdf('type'), this.ns.owl('FunctionalProperty'));\n for (let i = 0; i < a.length; i++) {\n this.fps[a[i].value] = true;\n }\n }\n\n /**\n * Returns a context to bind a given node, up to a given depth\n * @private\n */\n bnodeContext2(x, source, depth) {\n // Return a list of statements which indirectly identify a node\n // Depth > 1 if try further indirection.\n // Return array of statements (possibly empty), or null if failure\n var sts = this.store.statementsMatching(undefined, undefined, x, source); // incoming links\n var y;\n var res;\n for (let i = 0; i < sts.length; i++) {\n if (this.fps[sts[i].predicate.value]) {\n y = sts[i].subject;\n if (!y.isBlank) {\n return [sts[i]];\n }\n if (depth) {\n res = this.bnodeContext2(y, source, depth - 1);\n if (res) {\n return res.concat([sts[i]]);\n }\n }\n }\n }\n // outgoing links\n sts = this.store.statementsMatching(x, undefined, undefined, source);\n for (let i = 0; i < sts.length; i++) {\n if (this.ifps[sts[i].predicate.value]) {\n y = sts[i].object;\n if (!y.isBlank) {\n return [sts[i]];\n }\n if (depth) {\n res = this.bnodeContext2(y, source, depth - 1);\n if (res) {\n return res.concat([sts[i]]);\n }\n }\n }\n }\n return null; // Failure\n }\n\n /**\n * Returns the smallest context to bind a given single bnode\n * @private\n */\n bnodeContext1(x, source) {\n // Return a list of statements which indirectly identify a node\n // Breadth-first\n for (var depth = 0; depth < 3; depth++) {\n // Try simple first\n var con = this.bnodeContext2(x, source, depth);\n if (con !== null) return con;\n }\n // If we can't guarantee unique with logic just send all info about node\n return this.store.connectedStatements(x, source); // was:\n // throw new Error('Unable to uniquely identify bnode: ' + x.toNT())\n }\n\n /**\n * @private\n */\n mentioned(x) {\n return this.store.statementsMatching(x, null, null, null).length !== 0 ||\n // Don't pin fresh bnodes\n this.store.statementsMatching(null, x).length !== 0 || this.store.statementsMatching(null, null, x).length !== 0;\n }\n\n /**\n * @private\n */\n bnodeContext(bnodes, doc) {\n var context = [];\n if (bnodes.length) {\n this.cacheIfps();\n for (let i = 0; i < bnodes.length; i++) {\n // Does this occur in old graph?\n var bnode = bnodes[i];\n if (!this.mentioned(bnode)) continue;\n context = context.concat(this.bnodeContext1(bnode, doc));\n }\n }\n return context;\n }\n\n /**\n * Returns the best context for a single statement\n * @private\n */\n statementContext(st) {\n var bnodes = this.statementBnodes(st);\n return this.bnodeContext(bnodes, st.graph);\n }\n\n /**\n * @private\n */\n contextWhere(context) {\n var updater = this;\n return !context || context.length === 0 ? '' : 'WHERE { ' + context.map(function (x) {\n return updater.anonymizeNT(x);\n }).join('\\n') + ' }\\n';\n }\n\n /**\n * @private\n */\n fire(uri, query, callbackFunction) {\n let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n return Promise.resolve().then(() => {\n if (!uri) {\n throw new Error('No URI given for remote editing operation: ' + query);\n }\n // console.log('UpdateManager: sending update to <' + uri + '>')\n\n options.noMeta = true;\n options.contentType = options.contentType || 'application/sparql-update';\n options.body = query;\n return this.store.fetcher.webOperation('PATCH', uri, options);\n }).then(response => {\n if (!response.ok) {\n let message = 'UpdateManager: update failed for <' + uri + '> status=' + response.status + ', ' + response.statusText + '\\n for query: ' + query;\n // console.log(message)\n throw new Error(message);\n }\n\n // console.log('UpdateManager: update Ok for <' + uri + '>')\n\n callbackFunction(uri, response.ok, response.responseText, response);\n }).catch(err => {\n callbackFunction(uri, false, err.message, err);\n });\n }\n\n // ARE THESE THREE FUNCTIONS USED? DEPRECATE?\n\n /** return a statemnet updating function\n *\n * This does NOT update the statement.\n * It returns an object which includes\n * function which can be used to change the object of the statement.\n */\n update_statement(statement) {\n if (statement && !statement.graph) {\n return;\n }\n var updater = this;\n var context = this.statementContext(statement);\n return {\n statement: statement ? [statement.subject, statement.predicate, statement.object, statement.graph] : undefined,\n statementNT: statement ? this.anonymizeNT(statement) : undefined,\n where: updater.contextWhere(context),\n set_object: function (obj, callbackFunction) {\n var query = this.where;\n query += 'DELETE DATA { ' + this.statementNT + ' } ;\\n';\n query += 'INSERT DATA { ' +\n // @ts-ignore `this` might refer to the wrong scope. Does this work?\n this.anonymize(this.statement[0]) + ' ' +\n // @ts-ignore\n this.anonymize(this.statement[1]) + ' ' +\n // @ts-ignore\n this.anonymize(obj) + ' ' + ' . }\\n';\n updater.fire(this.statement[3].value, query, callbackFunction);\n }\n };\n }\n insert_statement(st, callbackFunction) {\n var st0 = st instanceof Array ? st[0] : st;\n var query = this.contextWhere(this.statementContext(st0));\n if (st instanceof Array) {\n var stText = '';\n for (let i = 0; i < st.length; i++) stText += st[i] + '\\n';\n query += 'INSERT DATA { ' + stText + ' }\\n';\n } else {\n query += 'INSERT DATA { ' + this.anonymize(st.subject) + ' ' + this.anonymize(st.predicate) + ' ' + this.anonymize(st.object) + ' ' + ' . }\\n';\n }\n this.fire(st0.graph.value, query, callbackFunction);\n }\n delete_statement(st, callbackFunction) {\n var st0 = st instanceof Array ? st[0] : st;\n var query = this.contextWhere(this.statementContext(st0));\n if (st instanceof Array) {\n var stText = '';\n for (let i = 0; i < st.length; i++) stText += st[i] + '\\n';\n query += 'DELETE DATA { ' + stText + ' }\\n';\n } else {\n query += 'DELETE DATA { ' + this.anonymize(st.subject) + ' ' + this.anonymize(st.predicate) + ' ' + this.anonymize(st.object) + ' ' + ' . }\\n';\n }\n this.fire(st0.graph.value, query, callbackFunction);\n }\n\n /// //////////////////////\n\n /**\n * Requests a now or future action to refresh changes coming downstream\n * This is designed to allow the system to re-request the server version,\n * when a websocket has pinged to say there are changes.\n * If the websocket, by contrast, has sent a patch, then this may not be necessary.\n *\n * @param doc\n * @param action\n */\n requestDownstreamAction(doc, action) {\n var control = this.patchControlFor(doc);\n if (!control.pendingUpstream) {\n action(doc);\n } else {\n if (control.downstreamAction) {\n if ('' + control.downstreamAction !== '' + action) {\n // Kludge compare\n throw new Error(\"Can't wait for > 1 different downstream actions\");\n }\n } else {\n control.downstreamAction = action;\n }\n }\n }\n\n /**\n * We want to start counting websocket notifications\n * to distinguish the ones from others from our own.\n */\n clearUpstreamCount(doc) {\n var control = this.patchControlFor(doc);\n control.upstreamCount = 0;\n }\n getUpdatesVia(doc) {\n var linkHeaders = this.store.fetcher.getHeader(doc, 'updates-via');\n if (!linkHeaders || !linkHeaders.length) return null;\n return linkHeaders[0].trim();\n }\n addDownstreamChangeListener(doc, listener) {\n var control = this.patchControlFor(doc);\n if (!control.downstreamChangeListeners) {\n control.downstreamChangeListeners = [];\n }\n control.downstreamChangeListeners.push(listener);\n this.setRefreshHandler(doc, doc => {\n this.reloadAndSync(doc);\n });\n }\n reloadAndSync(doc) {\n var control = this.patchControlFor(doc);\n var updater = this;\n if (control.reloading) {\n // console.log(' Already reloading - note this load may be out of date')\n control.outOfDate = true;\n return; // once only needed @@ Not true, has changed again\n }\n control.reloading = true;\n var retryTimeout = 1000; // ms\n var tryReload = function () {\n // console.log('try reload - timeout = ' + retryTimeout)\n updater.reload(updater.store, doc, function (ok, message, response) {\n if (ok) {\n if (control.downstreamChangeListeners) {\n for (let i = 0; i < control.downstreamChangeListeners.length; i++) {\n // console.log(' Calling downstream listener ' + i)\n control.downstreamChangeListeners[i]();\n }\n }\n control.reloading = false;\n if (control.outOfDate) {\n // console.log(' Extra reload because of extra update.')\n control.outOfDate = false;\n tryReload();\n }\n } else {\n control.reloading = false;\n if (response && response.status === 0) {\n // console.log('Network error refreshing the data. Retrying in ' +\n // retryTimeout / 1000)\n control.reloading = true;\n retryTimeout = retryTimeout * 2;\n setTimeout(tryReload, retryTimeout);\n } else {\n // console.log('Error ' + (response as Response).status + 'refreshing the data:' +\n // message + '. Stopped' + doc)\n }\n }\n });\n };\n tryReload();\n }\n\n /**\n * Sets up websocket to listen on\n *\n * There is coordination between upstream changes and downstream ones\n * so that a reload is not done in the middle of an upstream patch.\n * If you use this API then you get called when a change happens, and you\n * have to reload the file yourself, and then refresh the UI.\n * Alternative is addDownstreamChangeListener(), where you do not\n * have to do the reload yourself. Do mot mix them.\n *\n * kb contains the HTTP metadata from previous operations\n *\n * @param doc\n * @param handler\n *\n * @returns {boolean}\n */\n setRefreshHandler(doc, handler) {\n let wssURI = this.getUpdatesVia(doc); // relative\n // var kb = this.store\n var theHandler = handler;\n var self = this;\n var updater = this;\n var retryTimeout = 1500; // *2 will be 3 Seconds, 6, 12, etc\n var retries = 0;\n if (!wssURI) {\n // console.log('Server does not support live updates through Updates-Via :-(')\n return false;\n }\n wssURI = uriJoin(wssURI, doc.value);\n const validWssURI = wssURI.replace(/^http:/, 'ws:').replace(/^https:/, 'wss:');\n // console.log('Web socket URI ' + wssURI)\n\n var openWebsocket = function () {\n // From https://github.com/solid/solid-spec#live-updates\n var socket;\n if (typeof WebSocket !== 'undefined') {\n socket = new WebSocket(validWssURI);\n } else if (typeof window !== 'undefined' && window.WebSocket) {\n socket = window.WebSocket(validWssURI);\n } else {\n // console.log('Live update disabled, as WebSocket not supported by platform :-(')\n return;\n }\n socket.onopen = function () {\n // console.log(' websocket open')\n retryTimeout = 1500; // reset timeout to fast on success\n this.send('sub ' + doc.value);\n if (retries) {\n // console.log('Web socket has been down, better check for any news.')\n updater.requestDownstreamAction(doc, theHandler);\n }\n };\n var control = self.patchControlFor(doc);\n control.upstreamCount = 0;\n socket.onerror = function onerror(err) {\n // console.log('Error on Websocket:', err)\n };\n\n // https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent\n //\n // 1000 CLOSE_NORMAL Normal closure; the connection successfully completed whatever purpose for which it was created.\n // 1001 CLOSE_GOING_AWAY The endpoint is going away, either\n // because of a server failure or because the browser is navigating away from the page that opened the connection.\n // 1002 CLOSE_PROTOCOL_ERROR The endpoint is terminating the connection due to a protocol error.\n // 1003 CLOSE_UNSUPPORTED The connection is being terminated because the endpoint\n // received data of a type it cannot accept (for example, a text-only endpoint received binary data).\n // 1004 Reserved. A meaning might be defined in the future.\n // 1005 CLOSE_NO_STATUS Reserved. Indicates that no status code was provided even though one was expected.\n // 1006 CLOSE_ABNORMAL Reserved. Used to indicate that a connection was closed abnormally (\n //\n //\n socket.onclose = function (event) {\n // console.log('*** Websocket closed with code ' + event.code +\n // \", reason '\" + event.reason + \"' clean = \" + event.wasClean)\n retryTimeout *= 2;\n retries += 1;\n // console.log('Retrying in ' + retryTimeout + 'ms') // (ask user?)\n setTimeout(function () {\n // console.log('Trying websocket again')\n openWebsocket();\n }, retryTimeout);\n };\n socket.onmessage = function (msg) {\n if (msg.data && msg.data.slice(0, 3) === 'pub') {\n if ('upstreamCount' in control) {\n control.upstreamCount -= 1;\n if (control.upstreamCount >= 0) {\n // console.log('just an echo: ' + control.upstreamCount)\n return; // Just an echo\n }\n }\n // console.log('Assume a real downstream change: ' + control.upstreamCount + ' -> 0')\n control.upstreamCount = 0;\n self.requestDownstreamAction(doc, theHandler);\n }\n };\n }; // openWebsocket\n openWebsocket();\n return true;\n }\n\n /**\n * This high-level function updates the local store iff the web is changed successfully.\n * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).\n * The `why` property of each statement must be the give the web document to be updated.\n * The statements to be deleted and inserted may span more than one web document.\n * @param deletions - Statement or statements to be deleted.\n * @param insertions - Statement or statements to be inserted.\n * @returns a promise\n */\n updateMany(deletions) {\n let insertions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n const docs = deletions.concat(insertions).map(st => st.why);\n const thisUpdater = this;\n const uniqueDocs = [];\n docs.forEach(doc => {\n if (!uniqueDocs.find(uniqueDoc => uniqueDoc.equals(doc))) uniqueDocs.push(doc);\n });\n const updates = uniqueDocs.map(doc => thisUpdater.update(deletions.filter(st => st.why.equals(doc)), insertions.filter(st => st.why.equals(doc))));\n if (updates.length > 1) {\n // console.log(`@@ updateMany to ${updates.length}: ${uniqueDocs}`)\n }\n return Promise.all(updates);\n }\n\n /**\n * @private\n * \n * This helper function constructs SPARQL Update query from resolved arguments.\n * \n * @param ds: deletions array.\n * @param is: insertions array.\n * @param bnodes_context: Additional context to uniquely identify any blank nodes.\n */\n constructSparqlUpdateQuery(ds, is, bnodes_context) {\n var whereClause = this.contextWhere(bnodes_context);\n var query = '';\n if (whereClause.length) {\n // Is there a WHERE clause?\n if (ds.length) {\n query += 'DELETE { ';\n for (let i = 0; i < ds.length; i++) {\n query += this.anonymizeNT(ds[i]) + '\\n';\n }\n query += ' }\\n';\n }\n if (is.length) {\n query += 'INSERT { ';\n for (let i = 0; i < is.length; i++) {\n query += this.anonymizeNT(is[i]) + '\\n';\n }\n query += ' }\\n';\n }\n query += whereClause;\n } else {\n // no where clause\n if (ds.length) {\n query += 'DELETE DATA { ';\n for (let i = 0; i < ds.length; i++) {\n query += this.anonymizeNT(ds[i]) + '\\n';\n }\n query += ' } \\n';\n }\n if (is.length) {\n if (ds.length) query += ' ; ';\n query += 'INSERT DATA { ';\n for (let i = 0; i < is.length; i++) {\n query += this.nTriples(is[i]) + '\\n';\n }\n query += ' }\\n';\n }\n }\n return query;\n }\n\n /**\n * @private\n * \n * This helper function constructs n3-patch query from resolved arguments.\n * \n * @param ds: deletions array.\n * @param is: insertions array.\n * @param bnodes_context: Additional context to uniquely identify any blanknodes.\n */\n constructN3PatchQuery(ds, is, bnodes_context) {\n var query = `\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n@prefix ex: <http://www.example.org/terms#>.\n\n_:patch\n`;\n // If bnode context is non trivial, express it as ?conditions formula.\n if (bnodes_context && bnodes_context.length > 0) {\n query += `\n solid:where {\n ${bnodes_context.map(x => this.anonymizeNT(x)).join('\\n ')}\n };`;\n }\n if (ds.length > 0) {\n query += `\n solid:deletes {\n ${ds.map(x => this.anonymizeNT(x)).join('\\n ')}\n };`;\n }\n if (is.length > 0) {\n query += `\n solid:inserts {\n ${is.map(x => this.anonymizeNT(x)).join('\\n ')}\n };`;\n }\n query += \" a solid:InsertDeletePatch .\\n\";\n return query;\n }\n\n /**\n * This high-level function updates the local store if the web is changed successfully.\n * Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause).\n * The `why` property of each statement must be the same and give the web document to be updated.\n * @param deletions - Statement or statements to be deleted.\n * @param insertions - Statement or statements to be inserted.\n * @param callback - called as callbackFunction(uri, success, errorbody)\n * OR returns a promise\n * @param options - Options for the fetch call\n */\n update(deletions, insertions, callback, secondTry) {\n let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n if (!callback) {\n var thisUpdater = this;\n return new Promise(function (resolve, reject) {\n // Promise version\n thisUpdater.update(deletions, insertions, function (uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody));\n } else {\n resolve();\n }\n }, secondTry, options); // callbackFunction\n }); // promise\n } // if\n\n try {\n var kb = this.store;\n var ds = !deletions ? [] : isStore(deletions) ? deletions.statements : deletions instanceof Array ? deletions : [deletions];\n var is = !insertions ? [] : isStore(insertions) ? insertions.statements : insertions instanceof Array ? insertions : [insertions];\n if (!(ds instanceof Array)) {\n throw new Error('Type Error ' + typeof ds + ': ' + ds);\n }\n if (!(is instanceof Array)) {\n throw new Error('Type Error ' + typeof is + ': ' + is);\n }\n if (ds.length === 0 && is.length === 0) {\n return callback(null, true); // success -- nothing needed to be done.\n }\n var doc = ds.length ? ds[0].graph : is[0].graph;\n if (!doc) {\n let message = 'Error patching: statement does not specify which document to patch:' + ds[0] + ', ' + is[0];\n // console.log(message)\n throw new Error(message);\n }\n if (doc.termType !== 'NamedNode') {\n let message = 'Error patching: document not a NamedNode:' + ds[0] + ', ' + is[0];\n // console.log(message)\n throw new Error(message);\n }\n var control = this.patchControlFor(doc);\n var startTime = Date.now();\n var props = ['subject', 'predicate', 'object', 'why'];\n var verbs = ['insert', 'delete'];\n var clauses = {\n 'delete': ds,\n 'insert': is\n };\n verbs.map(function (verb) {\n clauses[verb].map(function (st) {\n if (!doc.equals(st.graph)) {\n throw new Error('update: destination ' + doc + ' inconsistent with delete quad ' + st.graph);\n }\n props.map(function (prop) {\n if (typeof st[prop] === 'undefined') {\n throw new Error('update: undefined ' + prop + ' of statement.');\n }\n });\n });\n });\n var protocol = this.editable(doc.value, kb);\n if (protocol === false) {\n throw new Error('Update: Can\\'t make changes in uneditable ' + doc);\n }\n if (protocol === undefined) {\n // Not enough metadata\n if (secondTry) {\n throw new Error('Update: Loaded ' + doc + \"but still can't figure out what editing protocol it supports.\");\n }\n // console.log(`Update: have not loaded ${doc} before: loading now...`);\n this.store.fetcher.load(doc).then(response => {\n this.update(deletions, insertions, callback, true, options);\n }, err => {\n if (err.response.status === 404) {\n // nonexistent files are fine\n this.update(deletions, insertions, callback, true, options);\n } else {\n throw new Error(`Update: Can't get updatability status ${doc} before patching: ${err}`);\n }\n });\n return;\n } else if (protocol.indexOf('SPARQL') >= 0 || protocol.indexOf('N3PATCH') >= 0) {\n var isSparql = protocol.indexOf('SPARQL') >= 0;\n var bnodes = [];\n // change ReadOnly type to Mutable type\n\n if (ds.length) bnodes = this.statementArrayBnodes(ds);\n if (is.length) bnodes = bnodes.concat(this.statementArrayBnodes(is));\n var context = this.bnodeContext(bnodes, doc);\n var query = isSparql ? this.constructSparqlUpdateQuery(ds, is, context) : this.constructN3PatchQuery(ds, is, context);\n options.contentType = isSparql ? 'application/sparql-update' : 'text/n3';\n\n // Track pending upstream patches until they have finished their callbackFunction\n control.pendingUpstream = control.pendingUpstream ? control.pendingUpstream + 1 : 1;\n if ('upstreamCount' in control) {\n control.upstreamCount += 1; // count changes we originated ourselves\n // console.log('upstream count up to : ' + control.upstreamCount)\n }\n this.fire(doc.value, query, (uri, success, body, response) => {\n response.elapsedTimeMs = Date.now() - startTime;\n /* console.log(' UpdateManager: Return ' +\n (success ? 'success ' : 'FAILURE ') + (response as Response).status +\n ' elapsed ' + (response as any).elapsedTimeMs + 'ms')\n */\n if (success) {\n try {\n kb.remove(ds);\n } catch (e) {\n success = false;\n body = 'Remote Ok BUT error deleting ' + ds.length + ' from store!!! ' + e;\n } // Add in any case -- help recover from weirdness??\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc);\n }\n }\n callback(uri, success, body, response);\n control.pendingUpstream -= 1;\n // When upstream patches have been sent, reload state if downstream waiting\n if (control.pendingUpstream === 0 && control.downstreamAction) {\n var downstreamAction = control.downstreamAction;\n delete control.downstreamAction;\n // console.log('delayed downstream action:')\n downstreamAction(doc);\n }\n }, options);\n } else if (protocol.indexOf('DAV') >= 0) {\n this.updateDav(doc, ds, is, callback, options);\n } else {\n if (protocol.indexOf('LOCALFILE') >= 0) {\n try {\n this.updateLocalFile(doc, ds, is, callback, options);\n } catch (e) {\n callback(doc.value, false, 'Exception trying to write back file <' + doc.value + '>\\n'\n // + tabulator.Util.stackString(e))\n );\n }\n } else {\n throw new Error(\"Unhandled edit method: '\" + protocol + \"' for \" + doc);\n }\n }\n } catch (e) {\n callback(undefined, false, 'Exception in update: ' + e + '\\n' + Util.stackString(e));\n }\n }\n updateDav(doc, ds, is, callbackFunction) {\n let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n let kb = this.store;\n // The code below is derived from Kenny's UpdateCenter.js\n var request = kb.any(doc, this.ns.link('request'));\n if (!request) {\n throw new Error('No record of our HTTP GET request for document: ' + doc);\n } // should not happen\n var response = kb.any(request, this.ns.link('response'));\n if (!response) {\n return null; // throw \"No record HTTP GET response for document: \"+doc\n }\n var contentType = kb.the(response, this.ns.httph('content-type')).value;\n\n // prepare contents of revised document\n let newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy!\n for (let i = 0; i < ds.length; i++) {\n Util.RDFArrayRemove(newSts, ds[i]);\n }\n for (let i = 0; i < is.length; i++) {\n newSts.push(is[i]);\n }\n const documentString = this.serialize(doc.value, newSts, contentType);\n\n // Write the new version back\n var candidateTarget = kb.the(response, this.ns.httph('content-location'));\n var targetURI;\n if (candidateTarget) {\n targetURI = uriJoin(candidateTarget.value, targetURI);\n }\n options.contentType = contentType;\n options.noMeta = true;\n options.body = documentString;\n return kb.fetcher.webOperation('PUT', targetURI, options).then(response => {\n if (!response.ok) {\n throw new Error(response.error);\n }\n for (let i = 0; i < ds.length; i++) {\n kb.remove(ds[i]);\n }\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc);\n }\n callbackFunction(doc.value, response.ok, response.responseText, response);\n }).catch(err => {\n callbackFunction(doc.value, false, err.message, err);\n });\n }\n\n /**\n * Likely deprecated, since this lib no longer deals with browser extension\n *\n * @param doc\n * @param ds\n * @param is\n * @param callbackFunction\n * @param options\n */\n updateLocalFile(doc, ds, is, callbackFunction) {\n let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n const kb = this.store;\n // console.log('Writing back to local file\\n')\n\n // prepare contents of revised document\n let newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy!\n\n for (let i = 0; i < ds.length; i++) {\n Util.RDFArrayRemove(newSts, ds[i]);\n }\n for (let i = 0; i < is.length; i++) {\n newSts.push(is[i]);\n }\n // serialize to the appropriate format\n var dot = doc.value.lastIndexOf('.');\n if (dot < 1) {\n throw new Error('Rewriting file: No filename extension: ' + doc.value);\n }\n var ext = doc.value.slice(dot + 1);\n let contentType = Fetcher.CONTENT_TYPE_BY_EXT[ext];\n if (!contentType) {\n throw new Error('File extension .' + ext + ' not supported for data write');\n }\n options.body = this.serialize(doc.value, newSts, contentType);\n options.contentType = contentType;\n kb.fetcher.webOperation('PUT', doc.value, options).then(response => {\n if (!response.ok) return callbackFunction(doc.value, false, response.error);\n for (let i = 0; i < ds.length; i++) {\n kb.remove(ds[i]);\n }\n for (let i = 0; i < is.length; i++) {\n kb.add(is[i].subject, is[i].predicate, is[i].object, doc);\n }\n callbackFunction(doc.value, true, ''); // success!\n });\n }\n\n /**\n * @throws {Error} On unsupported content type\n *\n * @returns {string}\n */\n serialize(uri, data, contentType) {\n const kb = this.store;\n let documentString;\n if (typeof data === 'string') {\n return data;\n }\n\n // serialize to the appropriate format\n var sz = Serializer(kb);\n sz.suggestNamespaces(kb.namespaces);\n sz.setBase(uri);\n switch (contentType) {\n case 'text/xml':\n case 'application/rdf+xml':\n documentString = sz.statementsToXML(data);\n break;\n case 'text/n3':\n case 'text/turtle':\n case 'application/x-turtle': // Legacy\n case 'application/n3':\n // Legacy\n documentString = sz.statementsToN3(data);\n break;\n default:\n throw new Error('Content-type ' + contentType + ' not supported for data serialization');\n }\n return documentString;\n }\n\n /**\n * This is suitable for an initial creation of a document.\n */\n put(doc, data, contentType, callback) {\n const kb = this.store;\n let documentString;\n return Promise.resolve().then(() => {\n documentString = this.serialize(doc.value, data, contentType);\n return kb.fetcher.webOperation('PUT', doc.value, {\n contentType,\n body: documentString\n });\n }).then(response => {\n if (!response.ok) {\n return callback(doc.value, response.ok, response.error, response);\n }\n delete kb.fetcher.nonexistent[doc.value];\n delete kb.fetcher.requested[doc.value]; // @@ could this mess with the requested state machine? if a fetch is in progress\n\n if (typeof data !== 'string') {\n data.map(st => {\n kb.addStatement(st);\n });\n }\n callback(doc.value, response.ok, '', response);\n }).catch(err => {\n callback(doc.value, false, err.message);\n });\n }\n\n /**\n * Reloads a document.\n *\n * Fast and cheap, no metadata. Measure times for the document.\n * Load it provisionally.\n * Don't delete the statements before the load, or it will leave a broken\n * document in the meantime.\n *\n * @param kb\n * @param doc {RDFlibNamedNode}\n * @param callbackFunction\n */\n reload(kb, doc, callbackFunction) {\n var startTime = Date.now();\n // force sets no-cache and\n const options = {\n force: true,\n noMeta: true,\n clearPreviousData: true\n };\n kb.fetcher.nowOrWhenFetched(doc.value, options, function (ok, body, response) {\n if (!ok) {\n // console.log(' ERROR reloading data: ' + body)\n callbackFunction(false, 'Error reloading data: ' + body, response);\n //@ts-ignore Where does onErrorWasCalled come from?\n } else if (response.onErrorWasCalled || response.status !== 200) {\n // console.log(' Non-HTTP error reloading data! onErrorWasCalled=' +\n //@ts-ignore Where does onErrorWasCalled come from?\n // response.onErrorWasCalled + ' status: ' + response.status)\n callbackFunction(false, 'Non-HTTP error reloading data: ' + body, response);\n } else {\n var elapsedTimeMs = Date.now() - startTime;\n if (!doc.reloadTimeTotal) doc.reloadTimeTotal = 0;\n if (!doc.reloadTimeCount) doc.reloadTimeCount = 0;\n doc.reloadTimeTotal += elapsedTimeMs;\n doc.reloadTimeCount += 1;\n\n // console.log(' Fetch took ' + elapsedTimeMs + 'ms, av. of ' +\n // doc.reloadTimeCount + ' = ' +\n // (doc.reloadTimeTotal / doc.reloadTimeCount) + 'ms.')\n\n callbackFunction(true);\n }\n });\n }\n}","import IndexedFormula from '../store';\nimport Fetcher from '../fetcher';\nimport ExtendedTermFactory from './extended-term-factory';\n/** Full RDFLib.js Data Factory */\nconst RDFlibDataFactory = {\n ...ExtendedTermFactory,\n /**\n * Creates a new fetcher\n * @param store - The store to use\n * @param options - The options\n */\n fetcher(store, options) {\n return new Fetcher(store, options);\n },\n /**\n * Creates a new graph (store)\n */\n graph() {\n let features = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n return new IndexedFormula(features, opts || {\n rdfFactory: ExtendedTermFactory\n });\n },\n /**\n * Creates a new literal node\n * @param val The lexical value\n * @param lang The language\n * @param dt The datatype\n */\n lit(val, lang, dt) {\n return this.literal('' + val, lang || dt);\n },\n /**\n * Creates a new statement\n * @param subject The subject\n * @param predicate The predicate\n * @param object The object\n * @param graph The containing graph\n */\n st(subject, predicate, object, graph) {\n return this.quad(subject, predicate, object, graph);\n }\n};\nexport default RDFlibDataFactory;","/*\n * Updates-Via\n */\nimport DataFactory from './factories/rdflib-data-factory';\nexport class UpdatesSocket {\n constructor(parent, via) {\n this.parent = parent;\n this.via = via;\n this.connected = false;\n this.pending = {};\n this.subscribed = {};\n this.socket = {};\n try {\n this.socket = new WebSocket(via);\n this.socket.onopen = this.onOpen;\n this.socket.onclose = this.onClose;\n this.socket.onmessage = this.onMessage;\n this.socket.onerror = this.onError;\n } catch (error) {\n this.onError(error);\n }\n }\n _decode(q) {\n var elt;\n var i;\n var k;\n var r;\n var ref;\n var ref1;\n var v;\n r = {};\n ref = function () {\n var j, len, ref, results;\n ref = q.split('&');\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n elt = ref[j];\n results.push(elt.split('='));\n }\n return results;\n }();\n for (i in ref) {\n elt = ref[i];\n ref1 = [decodeURIComponent(elt[0]), decodeURIComponent(elt[1])];\n k = ref1[0];\n v = ref1[1];\n if (r[k] == null) {\n r[k] = [];\n }\n r[k].push(v);\n }\n return r;\n }\n _send(method, uri, data) {\n var base, message;\n message = [method, uri, data].join(' ');\n return typeof (base = this.socket).send === 'function' ? base.send(message) : void 0;\n }\n _subscribe(uri) {\n this._send('sub', uri, '');\n this.subscribed[uri] = true;\n return this.subscribed[uri];\n }\n onClose(e) {\n var uri;\n this.connected = false;\n for (uri in this.subscribed) {\n this.pending[uri] = true;\n }\n this.subscribed = {};\n return this.subscribed;\n }\n onError(e) {\n throw new Error('onError' + e);\n }\n onMessage(e) {\n var base, message;\n message = e.data.split(' ');\n if (message[0] === 'ping') {\n return typeof (base = this.socket).send === 'function' ? base.send('pong ' + message.slice(1).join(' ')) : void 0;\n } else if (message[0] === 'pub') {\n return this.parent.onUpdate(message[1], this._decode(message[2]));\n }\n }\n onOpen(e) {\n var results, uri;\n this.connected = true;\n results = [];\n for (uri in this.pending) {\n delete this.pending[uri];\n results.push(this._subscribe(uri));\n }\n return results;\n }\n subscribe(uri) {\n if (this.connected) {\n return this._subscribe(uri);\n } else {\n this.pending[uri] = true;\n return this.pending[uri];\n }\n }\n}\nexport class UpdatesVia {\n constructor(fetcher) {\n this.fetcher = fetcher;\n this.graph = {};\n this.via = {};\n this.fetcher.addCallback('headers', this.onHeaders);\n }\n onHeaders(d) {\n var etag, uri, via;\n if (d.headers == null) {\n return true;\n }\n if (typeof WebSocket === 'undefined' || WebSocket === null) {\n return true;\n }\n etag = d.headers['etag'];\n via = d.headers['updates-via'];\n uri = d.uri;\n if (etag && via) {\n this.graph[uri] = {\n etag: etag,\n via: via\n };\n this.register(via, uri);\n }\n return true;\n }\n onUpdate(uri, d) {\n return this.fetcher.refresh(DataFactory.namedNode(uri));\n }\n register(via, uri) {\n if (this.via[via] == null) {\n this.via[via] = new UpdatesSocket(this, via);\n }\n return this.via[via].subscribe(uri);\n }\n}","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport BlankNode from './blank-node';\nimport Collection from './collection';\nimport Empty from './empty';\nimport Fetcher from './fetcher';\nimport Formula from './formula';\nimport Store from './store';\nimport jsonParser from './jsonparser';\nimport Literal from './literal';\nimport log from './log';\nimport N3Parser from './n3parser';\nimport NamedNode from './named-node';\nimport Namespace from './namespace';\nimport Node from './node';\nimport parse from './parse';\nimport { Query } from './query';\nimport queryToSPARQL from './query-to-sparql';\nimport RDFaProcessor from './rdfaparser';\nimport RDFParser from './rdfxmlparser';\nimport serialize from './serialize';\nimport Serializer from './serializer';\nimport SPARQLToQuery from './sparql-to-query';\nimport sparqlUpdateParser from './patch-parser';\nimport Statement from './statement';\nimport UpdateManager from './update-manager';\nimport { UpdatesSocket } from './updates-via';\nimport { UpdatesVia } from './updates-via';\nimport * as uri from './uri';\nimport * as Util from './utils-js';\nimport Variable from './variable';\nimport DataFactory from './factories/rdflib-data-factory';\n\n// Prepare bound versions of data factory methods for export\nconst boundDataFactory = {};\nfor (const name in DataFactory) {\n if (typeof DataFactory[name] === 'function') boundDataFactory[name] = DataFactory[name].bind(DataFactory);\n}\nconst {\n fetcher,\n graph,\n lit,\n st,\n namedNode,\n variable,\n blankNode,\n defaultGraph,\n literal,\n quad,\n triple\n} = boundDataFactory;\nconst formula = new Formula();\nconst fromNT = str => formula.fromNT(str);\nconst term = Node.fromValue;\n\n// TODO: this export is broken;\n// it exports the _current_ value of nextId, which is always 0\nconst NextId = BlankNode.nextId;\nexport * from './utils/terms';\nexport { BlankNode, Collection, DataFactory, Empty, Fetcher, Formula, Store, jsonParser, Literal, log, N3Parser, NamedNode, Namespace, Node, parse, Query, queryToSPARQL, RDFaProcessor, RDFParser, serialize, Serializer, SPARQLToQuery, sparqlUpdateParser, Statement, term, UpdateManager, UpdatesSocket, UpdatesVia, uri, Util, Variable, Store as IndexedFormula,\n// Alias\n\nNextId, fromNT, fetcher, graph, lit, st, namedNode as sym,\n// RDFJS DataFactory interface\nblankNode, defaultGraph, literal, namedNode, quad, triple, variable };\nexport { termValue } from './utils/termValue';\nexport class ConnectedStore extends Store {\n constructor(features) {\n super(features);\n _defineProperty(this, \"fetcher\", void 0);\n this.fetcher = new Fetcher(this, {});\n }\n}\nexport class LiveStore extends ConnectedStore {\n constructor(features) {\n super(features);\n _defineProperty(this, \"updater\", void 0);\n this.updater = new UpdateManager(this);\n }\n}","// Namespaces we commonly use and have common prefixes for around Solid\nimport solidNamespace from 'solid-namespace' // Delegate to this which takes RDFlib as param.\nimport * as $rdf from 'rdflib'\n\nexport const ns = solidNamespace($rdf)","import { graph, NamedNode, Namespace, serialize, sym } from 'rdflib'\nimport { AclLogic } from '../types'\nimport { ns as namespace } from '../util/ns'\n\n\nexport const ACL_LINK = sym(\n 'http://www.iana.org/assignments/link-relations/acl'\n)\n\nexport function createAclLogic(store): AclLogic {\n\n const ns = namespace\n \n async function findAclDocUrl(url: NamedNode) {\n await store.fetcher.load(url)\n const docNode = store.any(url, ACL_LINK)\n if (!docNode) {\n throw new Error(`No ACL link discovered for ${url}`)\n }\n return docNode.value\n }\n /**\n * Simple Access Control\n *\n * This function sets up a simple default ACL for a resource, with\n * RWC for the owner, and a specified access (default none) for the public.\n * In all cases owner has read write control.\n * Parameter lists modes allowed to public\n *\n * @param options\n * @param options.public eg ['Read', 'Write']\n *\n * @returns Resolves with aclDoc uri on successful write\n */\n function setACLUserPublic ( \n docURI: string,\n me: NamedNode,\n options: {\n defaultForNew?: boolean,\n public?: []\n }\n ): Promise<NamedNode> {\n const aclDoc = store.any(\n store.sym(docURI),\n ACL_LINK\n )\n\n return Promise.resolve()\n .then(() => {\n if (aclDoc) {\n return aclDoc as NamedNode\n }\n\n return fetchACLRel(docURI).catch(err => {\n throw new Error(`Error fetching rel=ACL header for ${docURI}: ${err}`)\n })\n })\n .then(aclDoc => {\n const aclText = genACLText(docURI, me, aclDoc.uri, options)\n if (!store.fetcher) {\n throw new Error('Cannot PUT this, store has no fetcher')\n }\n return store.fetcher\n .webOperation('PUT', aclDoc.uri, {\n data: aclText,\n contentType: 'text/turtle'\n })\n .then(result => {\n if (!result.ok) {\n throw new Error('Error writing ACL text: ' + result.error)\n }\n\n return aclDoc\n })\n })\n }\n\n /**\n * @param docURI\n * @returns\n */\n function fetchACLRel (docURI: string): Promise<NamedNode> {\n const fetcher = store.fetcher\n if (!fetcher) {\n throw new Error('Cannot fetch ACL rel, store has no fetcher')\n }\n\n return fetcher.load(docURI).then(result => {\n if (!result.ok) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n throw new Error('fetchACLRel: While loading:' + (result as any).error)\n }\n\n const aclDoc = store.any(\n store.sym(docURI),\n ACL_LINK\n )\n\n if (!aclDoc) {\n throw new Error('fetchACLRel: No Link rel=ACL header for ' + docURI)\n }\n\n return aclDoc as NamedNode\n })\n }\n\n /**\n * @param docURI\n * @param me\n * @param aclURI\n * @param options\n *\n * @returns Serialized ACL\n */\n function genACLText (\n docURI: string,\n me: NamedNode,\n aclURI: string,\n options: {\n defaultForNew?: boolean,\n public?: []\n } = {}\n ): string | undefined {\n const optPublic = options.public || []\n const g = graph()\n const auth = Namespace('http://www.w3.org/ns/auth/acl#')\n let a = g.sym(`${aclURI}#a1`)\n const acl = g.sym(aclURI)\n const doc = g.sym(docURI)\n g.add(a, ns.rdf('type'), auth('Authorization'), acl)\n g.add(a, auth('accessTo'), doc, acl)\n if (options.defaultForNew) {\n g.add(a, auth('default'), doc, acl)\n }\n g.add(a, auth('agent'), me, acl)\n g.add(a, auth('mode'), auth('Read'), acl)\n g.add(a, auth('mode'), auth('Write'), acl)\n g.add(a, auth('mode'), auth('Control'), acl)\n\n if (optPublic.length) {\n a = g.sym(`${aclURI}#a2`)\n g.add(a, ns.rdf('type'), auth('Authorization'), acl)\n g.add(a, auth('accessTo'), doc, acl)\n g.add(a, auth('agentClass'), ns.foaf('Agent'), acl)\n for (let p = 0; p < optPublic.length; p++) {\n g.add(a, auth('mode'), auth(optPublic[p]), acl) // Like 'Read' etc\n }\n }\n return serialize(acl, g, aclURI)\n }\n return {\n findAclDocUrl,\n setACLUserPublic,\n genACLText\n }\n}","import { NamedNode, sym } from 'rdflib'\nimport * as debug from '../util/debug'\n\n/**\n * find a user or app's context as set in window.SolidAppContext\n * this is a const, not a function, because we have problems to jest mock it otherwise\n * see: https://github.com/facebook/jest/issues/936#issuecomment-545080082 for more\n * @return {any} - an appContext object\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const appContext = ():any => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let { SolidAppContext }: any = window\n SolidAppContext ||= {}\n SolidAppContext.viewingNoAuthPage = false\n if (SolidAppContext.noAuth && window.document) {\n const currentPage = window.document.location.href\n if (currentPage.startsWith(SolidAppContext.noAuth)) {\n SolidAppContext.viewingNoAuthPage = true\n const params = new URLSearchParams(window.document.location.search)\n if (params) {\n let viewedPage = SolidAppContext.viewedPage = params.get('uri') || null\n if (viewedPage) {\n viewedPage = decodeURI(viewedPage)\n if (!viewedPage.startsWith(SolidAppContext.noAuth)) {\n const ary = viewedPage.split(/\\//)\n SolidAppContext.idp = ary[0] + '//' + ary[2]\n SolidAppContext.viewingNoAuthPage = false\n }\n }\n }\n }\n }\n return SolidAppContext\n}\n\n/**\n * Returns `sym($SolidTestEnvironment.username)` if\n * `$SolidTestEnvironment.username` is defined as a global\n * or \n * returns testID defined in the HTML page\n * @returns {NamedNode|null}\n */\nexport function offlineTestID (): NamedNode | null {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any \n const { $SolidTestEnvironment }: any = window\n if (\n typeof $SolidTestEnvironment !== 'undefined' &&\n $SolidTestEnvironment.username\n ) {\n // Test setup\n debug.log('Assuming the user is ' + $SolidTestEnvironment.username)\n return sym($SolidTestEnvironment.username)\n }\n // hack that makes SolidOS work in offline mode by adding the webId directly in html\n // example usage: https://github.com/solidos/mashlib/blob/29b8b53c46bf02e0e219f0bacd51b0e9951001dd/test/contact/local.html#L37\n if (\n typeof document !== 'undefined' &&\n document.location &&\n ('' + document.location).slice(0, 16) === 'http://localhost'\n ) {\n const div = document.getElementById('appTarget')\n if (!div) return null\n const id = div.getAttribute('testID')\n if (!id) return null\n debug.log('Assuming user is ' + id)\n return sym(id)\n }\n return null\n}\n","import { namedNode, NamedNode, sym } from 'rdflib'\nimport { appContext, offlineTestID } from './authUtil'\nimport * as debug from '../util/debug'\nimport { EVENTS, Session } from '@inrupt/solid-client-authn-browser'\nimport { AuthenticationContext, AuthnLogic } from '../types'\n\nexport class SolidAuthnLogic implements AuthnLogic {\n private session: Session\n\n constructor(solidAuthSession: Session) {\n this.session = solidAuthSession\n }\n\n // we created authSession getter because we want to access it as authn.authSession externally\n get authSession():Session { return this.session }\n\n currentUser(): NamedNode | null {\n const app = appContext()\n if (app.viewingNoAuthPage) {\n return sym(app.webId)\n }\n if (this && this.session && this.session.info && this.session.info.webId && this.session.info.isLoggedIn) {\n return sym(this.session.info.webId)\n }\n return offlineTestID() // null unless testing\n }\n\n /**\n * Retrieves currently logged in webId from either\n * defaultTestUser or SolidAuth\n * Also activates a session after login\n * @param [setUserCallback] Optional callback\n * @returns Resolves with webId uri, if no callback provided\n */\n async checkUser<T> (\n setUserCallback?: (me: NamedNode | null) => T\n ): Promise<NamedNode | T | null> {\n // Save hash for \"restorePreviousSession\"\n const preLoginRedirectHash = new URL(window.location.href).hash\n if (preLoginRedirectHash) {\n window.localStorage.setItem('preLoginRedirectHash', preLoginRedirectHash)\n }\n this.session.events.on(EVENTS.SESSION_RESTORED, (url) => {\n debug.log(`Session restored to ${url}`)\n if (document.location.toString() !== url) history.replaceState(null, '', url)\n })\n\n /**\n * Handle a successful authentication redirect\n */\n const redirectUrl = new URL(window.location.href)\n redirectUrl.hash = ''\n await this.session\n .handleIncomingRedirect({\n restorePreviousSession: true,\n url: redirectUrl.href\n })\n\n // Check to see if a hash was stored in local storage\n const postLoginRedirectHash = window.localStorage.getItem('preLoginRedirectHash')\n if (postLoginRedirectHash) {\n const curUrl = new URL(window.location.href)\n if (curUrl.hash !== postLoginRedirectHash) {\n if (history.pushState) {\n // debug.log('Setting window.location.has using pushState')\n history.pushState(null, document.title, postLoginRedirectHash)\n } else {\n // debug.warn('Setting window.location.has using location.hash')\n location.hash = postLoginRedirectHash\n }\n curUrl.hash = postLoginRedirectHash\n }\n // See https://stackoverflow.com/questions/3870057/how-can-i-update-window-location-hash-without-jumping-the-document\n // window.location.href = curUrl.toString()// @@ See https://developer.mozilla.org/en-US/docs/Web/API/Window/location\n window.localStorage.setItem('preLoginRedirectHash', '')\n }\n\n // Check to see if already logged in / have the WebID\n let me = offlineTestID()\n if (me) {\n return Promise.resolve(setUserCallback ? setUserCallback(me) : me)\n }\n\n const webId = this.webIdFromSession(this.session.info)\n if (webId) {\n me = this.saveUser(webId)\n }\n\n if (me) {\n debug.log(`(Logged in as ${me} by authentication)`)\n }\n\n return Promise.resolve(setUserCallback ? setUserCallback(me) : me)\n }\n\n /**\n * Saves `webId` in `context.me`\n * @param webId\n * @param context\n *\n * @returns Returns the WebID, after setting it\n */\n saveUser (\n webId: NamedNode | string | null,\n context?: AuthenticationContext\n ): NamedNode | null {\n let webIdUri: string\n if (webId) {\n webIdUri = (typeof webId === 'string') ? webId : webId.uri\n const me = namedNode(webIdUri)\n if (context) {\n context.me = me\n }\n return me\n }\n return null\n }\n\n /**\n * @returns {Promise<string|null>} Resolves with WebID URI or null\n */\n webIdFromSession (session?: { webId?: string, isLoggedIn: boolean }): string | null {\n const webId = session?.webId && session.isLoggedIn ? session.webId : null\n return webId\n }\n\n}\n","import { NamedNode, sym } from 'rdflib'\n\nexport function newThing(doc: NamedNode): NamedNode {\n return sym(doc.uri + '#' + 'id' + ('' + Date.now()))\n}\n\nexport function uniqueNodes (arr: NamedNode[]): NamedNode[] {\n const uris = arr.map(x => x.uri)\n const set = new Set(uris)\n const uris2 = Array.from(set)\n const arr2 = uris2.map(u => new NamedNode(u))\n return arr2 // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))\n}\n\nexport function getArchiveUrl(baseUrl: string, date: Date) {\n const year = date.getUTCFullYear()\n const month = ('0' + (date.getUTCMonth()+1)).slice(-2)\n const day = ('0' + (date.getUTCDate())).slice(-2)\n const parts = baseUrl.split('/')\n const filename = parts[parts.length -1 ]\n return new URL(`./archive/${year}/${month}/${day}/${filename}`, baseUrl).toString()\n}\n\nexport function differentOrigin(doc): boolean {\n if (!doc) {\n return true\n }\n return (\n `${window.location.origin}/` !== new URL(doc.value).origin\n )\n}\n\nexport function suggestPreferencesFile (me:NamedNode) {\n const stripped = me.uri.replace('/profile/', '/').replace('/public/', '/')\n // const stripped = me.uri.replace(\\/[p|P]rofile/\\g, '/').replace(\\/[p|P]ublic/\\g, '/')\n const folderURI = stripped.split('/').slice(0,-1).join('/') + '/Settings/'\n const fileURI = folderURI + 'Preferences.ttl'\n return sym(fileURI)\n}\n\nexport function determineChatContainer(\n invitee: NamedNode,\n podRoot: NamedNode\n): NamedNode {\n // Create chat\n // See https://gitter.im/solid/chat-app?at=5f3c800f855be416a23ae74a\n const chatContainerStr = new URL(\n `IndividualChats/${new URL(invitee.value).host}/`,\n podRoot.value\n ).toString()\n return new NamedNode(chatContainerStr)\n}\n","import { NamedNode, Node, st, term } from 'rdflib'\nimport { ChatLogic, CreatedPaneOptions, NewPaneOptions, Chat } from '../types'\nimport { ns as namespace } from '../util/ns'\nimport { determineChatContainer, newThing } from '../util/utils'\n\nconst CHAT_LOCATION_IN_CONTAINER = 'index.ttl#this'\n\nexport function createChatLogic(store, profileLogic): ChatLogic {\n const ns = namespace\n\n async function setAcl(\n chatContainer: NamedNode,\n me: NamedNode,\n invitee: NamedNode\n ): Promise<void> {\n // Some servers don't present a Link http response header\n // if the container doesn't exist yet, so refetch the container\n // now that it has been created:\n await store.fetcher.load(chatContainer)\n\n // FIXME: check the Why value on this quad:\n const chatAclDoc = store.any(\n chatContainer,\n new NamedNode('http://www.iana.org/assignments/link-relations/acl')\n )\n if (!chatAclDoc) {\n throw new Error('Chat ACL doc not found!')\n }\n\n const aclBody = `\n @prefix acl: <http://www.w3.org/ns/auth/acl#>.\n <#owner>\n a acl:Authorization;\n acl:agent <${me.value}>;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Write, acl:Control.\n <#invitee>\n a acl:Authorization;\n acl:agent <${invitee.value}>;\n acl:accessTo <.>;\n acl:default <.>;\n acl:mode\n acl:Read, acl:Append.\n `\n await store.fetcher.webOperation('PUT', chatAclDoc.value, {\n data: aclBody,\n contentType: 'text/turtle',\n })\n }\n\n async function addToPrivateTypeIndex(chatThing, me) {\n // Add to private type index\n const privateTypeIndex = store.any(\n me,\n ns.solid('privateTypeIndex')\n ) as NamedNode | null\n if (!privateTypeIndex) {\n throw new Error('Private type index not found!')\n }\n await store.fetcher.load(privateTypeIndex)\n const reg = newThing(privateTypeIndex)\n const ins = [\n st(\n reg,\n ns.rdf('type'),\n ns.solid('TypeRegistration'),\n privateTypeIndex.doc()\n ),\n st(\n reg,\n ns.solid('forClass'),\n ns.meeting('LongChat'),\n privateTypeIndex.doc()\n ),\n st(reg, ns.solid('instance'), chatThing, privateTypeIndex.doc()),\n ]\n await new Promise((resolve, reject) => {\n store.updater.update([], ins, function (_uri, ok, errm) {\n if (!ok) {\n reject(new Error(errm))\n } else {\n resolve(null)\n }\n })\n })\n }\n\n async function findChat(invitee: NamedNode): Promise<Chat> {\n const me = await profileLogic.loadMe()\n const podRoot = await profileLogic.getPodRoot(me)\n const chatContainer = determineChatContainer(invitee, podRoot)\n let exists = true\n try {\n await store.fetcher.load(\n new NamedNode(chatContainer.value + 'index.ttl#this')\n )\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n exists = false\n }\n return { me, chatContainer, exists }\n }\n\n async function createChatThing(\n chatContainer: NamedNode,\n me: NamedNode\n ): Promise<NamedNode> {\n const created = await mintNew({\n me,\n newBase: chatContainer.value,\n })\n return created.newInstance\n }\n\n function mintNew(newPaneOptions: NewPaneOptions): Promise<CreatedPaneOptions> {\n const kb = store\n const updater = kb.updater\n if (newPaneOptions.me && !newPaneOptions.me.uri) {\n throw new Error('chat mintNew: Invalid userid ' + newPaneOptions.me)\n }\n\n const newInstance = (newPaneOptions.newInstance =\n newPaneOptions.newInstance ||\n kb.sym(newPaneOptions.newBase + CHAT_LOCATION_IN_CONTAINER))\n const newChatDoc = newInstance.doc()\n\n kb.add(\n newInstance,\n ns.rdf('type'),\n ns.meeting('LongChat'),\n newChatDoc\n )\n kb.add(newInstance, ns.dc('title'), 'Chat channel', newChatDoc)\n kb.add(\n newInstance,\n ns.dc('created'),\n term<Node>(new Date(Date.now())),\n newChatDoc\n )\n if (newPaneOptions.me) {\n kb.add(newInstance, ns.dc('author'), newPaneOptions.me, newChatDoc)\n }\n\n return new Promise(function (resolve, reject) {\n updater?.put(\n newChatDoc,\n kb.statementsMatching(undefined, undefined, undefined, newChatDoc),\n 'text/turtle',\n function (uri2, ok, message) {\n if (ok) {\n resolve({\n ...newPaneOptions,\n newInstance,\n })\n } else {\n reject(\n new Error(\n 'FAILED to save new chat channel at: ' + uri2 + ' : ' + message\n )\n )\n }\n }\n )\n })\n }\n\n /**\n * Find (and optionally create) an individual chat between the current user and the given invitee\n * @param invitee - The person to chat with\n * @param createIfMissing - Whether the chat should be created, if missing\n * @returns null if missing, or a node referring to an already existing chat, or the newly created chat\n */\n async function getChat(\n invitee: NamedNode,\n createIfMissing = true\n ): Promise<NamedNode | null> {\n const { me, chatContainer, exists } = await findChat(invitee)\n if (exists) {\n return new NamedNode(chatContainer.value + CHAT_LOCATION_IN_CONTAINER)\n }\n\n if (createIfMissing) {\n const chatThing = await createChatThing(chatContainer, me)\n await sendInvite(invitee, chatThing)\n await setAcl(chatContainer, me, invitee)\n await addToPrivateTypeIndex(chatThing, me)\n return chatThing\n }\n return null\n }\n\n async function sendInvite(invitee: NamedNode, chatThing: NamedNode) {\n await store.fetcher.load(invitee.doc())\n const inviteeInbox = store.any(\n invitee,\n ns.ldp('inbox'),\n undefined,\n invitee.doc()\n )\n if (!inviteeInbox) {\n throw new Error(`Invitee inbox not found! ${invitee.value}`)\n }\n const inviteBody = `\n <> a <http://www.w3.org/ns/pim/meeting#LongChatInvite> ;\n ${ns.rdf('seeAlso')} <${chatThing.value}> .\n `\n\n const inviteResponse = await store.fetcher?.webOperation(\n 'POST',\n inviteeInbox.value,\n {\n data: inviteBody,\n contentType: 'text/turtle',\n }\n )\n const locationStr = inviteResponse?.headers.get('location')\n if (!locationStr) {\n throw new Error(`Invite sending returned a ${inviteResponse?.status}`)\n }\n }\n return {\n setAcl, addToPrivateTypeIndex, findChat, createChatThing, getChat, sendInvite, mintNew\n }\n}\n","import { NamedNode } from 'rdflib'\nimport { InboxLogic } from '../types'\nimport { getArchiveUrl } from '../util/utils'\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, aclLogic): InboxLogic {\n\n async function createInboxFor(peerWebId: string, nick: string) {\n const myWebId: NamedNode = await profileLogic.loadMe()\n const podRoot: NamedNode = await profileLogic.getPodRoot(myWebId)\n const ourInbox = `${podRoot.value}p2p-inboxes/${encodeURIComponent(nick)}/`\n await containerLogic.createContainer(ourInbox)\n // const aclDocUrl = await aclLogic.findAclDocUrl(ourInbox);\n await utilityLogic.setSinglePeerAccess({\n ownerWebId: myWebId.value,\n peerWebId,\n accessToModes: 'acl:Append',\n target: ourInbox\n })\n return ourInbox\n }\n\n async function getNewMessages(\n user?: NamedNode\n ): Promise<NamedNode[]> {\n if (!user) {\n user = await profileLogic.loadMe()\n }\n const inbox = await profileLogic.getMainInbox(user)\n const urls = await containerLogic.getContainerMembers(inbox)\n return urls.filter(url => !containerLogic.isContainer(url))\n }\n\n async function markAsRead(url: string, date: Date) {\n const downloaded = await store.fetcher._fetch(url)\n if (downloaded.status !== 200) {\n throw new Error(`Not OK! ${url}`)\n }\n const archiveUrl = getArchiveUrl(url, date)\n const options = {\n method: 'PUT',\n body: await downloaded.text(),\n headers: [\n ['Content-Type', downloaded.headers.get('Content-Type') || 'application/octet-stream']\n ]\n }\n const uploaded = await store.fetcher._fetch(archiveUrl, options)\n if (uploaded.status.toString()[0] === '2') {\n await store.fetcher._fetch(url, {\n method: 'DELETE'\n })\n }\n }\n return {\n createInboxFor,\n getNewMessages,\n markAsRead\n }\n}\n","class CustomError extends Error {\n constructor(message?: string) {\n super(message)\n // see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html\n Object.setPrototypeOf(this, new.target.prototype) // restore prototype chain\n this.name = new.target.name // stack traces display correctly now\n }\n}\n\nexport class UnauthorizedError extends CustomError {}\n\nexport class CrossOriginForbiddenError extends CustomError {}\n\nexport class SameOriginForbiddenError extends CustomError {}\n\nexport class NotFoundError extends CustomError {}\n\nexport class NotEditableError extends CustomError { }\n\nexport class WebOperationError extends CustomError {}\n\nexport class FetchError extends CustomError {\n status: number\n\n constructor(status: number, message?: string) {\n super(message)\n this.status = status\n }\n}","import { NamedNode } from 'rdflib'\nimport { CrossOriginForbiddenError, FetchError, NotEditableError, SameOriginForbiddenError, UnauthorizedError, WebOperationError } from '../logic/CustomError'\nimport * as debug from '../util/debug'\nimport { ns as namespace } from '../util/ns'\nimport { differentOrigin, suggestPreferencesFile } from '../util/utils'\nimport { ProfileLogic } from '../types'\n\nexport function createProfileLogic(store, authn, utilityLogic): ProfileLogic {\n const ns = namespace\n\n /**\n * loads the preference without throwing errors - if it can create it it does so.\n * remark: it still throws error if it cannot load profile.\n * @param user\n * @returns undefined if preferenceFile cannot be returned or NamedNode if it can find it or create it\n */\n async function silencedLoadPreferences(user: NamedNode): Promise <NamedNode | undefined> {\n try {\n return await loadPreferences(user)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n return undefined\n }\n }\n\n /**\n * loads the preference without returning different errors if it cannot create or load it.\n * remark: it also throws error if it cannot load profile.\n * @param user\n * @returns undefined if preferenceFile cannot be an Error or NamedNode if it can find it or create it\n */\n async function loadPreferences (user: NamedNode): Promise <NamedNode> {\n await loadProfile(user)\n\n const possiblePreferencesFile = suggestPreferencesFile(user)\n let preferencesFile\n try {\n preferencesFile = await utilityLogic.followOrCreateLink(user, ns.space('preferencesFile') as NamedNode, possiblePreferencesFile, user.doc())\n } catch (err) {\n const message = `User ${user} has no pointer in profile to preferences file.`\n debug.warn(message)\n // we are listing the possible errors\n if (err instanceof NotEditableError) { throw err }\n if (err instanceof WebOperationError) { throw err }\n if (err instanceof UnauthorizedError) { throw err }\n if (err instanceof CrossOriginForbiddenError) { throw err }\n if (err instanceof SameOriginForbiddenError) { throw err }\n if (err instanceof FetchError) { throw err }\n throw err\n }\n\n try {\n await store.fetcher.load(preferencesFile as NamedNode)\n } catch (err) { // Maybe a permission problem or origin problem\n const msg = `Unable to load preference of user ${user}: ${err}`\n debug.warn(msg)\n if (err.response.status === 401) {\n throw new UnauthorizedError()\n }\n if (err.response.status === 403) {\n if (differentOrigin(preferencesFile)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n /*if (err.response.status === 404) {\n throw new NotFoundError();\n }*/\n throw new Error(msg)\n }\n return preferencesFile as NamedNode\n }\n\n async function loadProfile (user: NamedNode):Promise <NamedNode> {\n if (!user) {\n throw new Error('loadProfile: no user given.')\n }\n try {\n await store.fetcher.load(user.doc())\n } catch (err) {\n throw new Error(`Unable to load profile of user ${user}: ${err}`)\n }\n return user.doc()\n }\n\n async function loadMe(): Promise<NamedNode> {\n const me = authn.currentUser()\n if (me === null) {\n throw new Error('Current user not found! Not logged in?')\n }\n await store.fetcher.load(me.doc())\n return me\n }\n\n function getPodRoot(user: NamedNode): NamedNode {\n const podRoot = findStorage(user)\n if (!podRoot) {\n throw new Error('User pod root not found!')\n }\n return podRoot as NamedNode\n }\n\n async function getMainInbox(user: NamedNode): Promise<NamedNode> {\n await store.fetcher.load(user)\n const mainInbox = store.any(user, ns.ldp('inbox'), undefined, user.doc())\n if (!mainInbox) {\n throw new Error('User main inbox not found!')\n }\n return mainInbox as NamedNode\n }\n\n function findStorage(me: NamedNode) {\n return store.any(me, ns.space('storage'), undefined, me.doc())\n }\n\n return {\n loadMe,\n getPodRoot,\n getMainInbox,\n findStorage,\n loadPreferences,\n loadProfile,\n silencedLoadPreferences\n }\n}\n","import { NamedNode, st, sym } from 'rdflib'\nimport { ScopedApp, TypeIndexLogic, TypeIndexScope } from '../types'\nimport * as debug from '../util/debug'\nimport { ns as namespace } from '../util/ns'\nimport { newThing } from '../util/utils'\n\nexport function createTypeIndexLogic(store, authn, profileLogic, utilityLogic): TypeIndexLogic {\n const ns = namespace\n\n function getRegistrations(instance, theClass) {\n return store\n .each(undefined, ns.solid('instance'), instance)\n .filter((r) => {\n return store.holds(r, ns.solid('forClass'), theClass)\n })\n }\n\n async function loadTypeIndexesFor(user: NamedNode): Promise<Array<TypeIndexScope>> {\n if (!user) throw new Error('loadTypeIndexesFor: No user given')\n const profile = await profileLogic.loadProfile(user)\n\n const suggestion = suggestPublicTypeIndex(user)\n let publicTypeIndex\n try {\n publicTypeIndex = await utilityLogic.followOrCreateLink(user, ns.solid('publicTypeIndex') as NamedNode, suggestion, profile)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n const message = `User ${user} has no pointer in profile to publicTypeIndex file.`\n debug.warn(message)\n }\n const publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex as NamedNode, agent: user }] : []\n\n let preferencesFile\n try {\n preferencesFile = await profileLogic.silencedLoadPreferences(user)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n preferencesFile = null\n }\n\n let privateScopes\n if (preferencesFile) { // watch out - can be in either as spec was not clear. Legacy is profile.\n // If there is a legacy one linked from the profile, use that.\n // Otherwiae use or make one linked from Preferences\n const suggestedPrivateTypeIndex = suggestPrivateTypeIndex(preferencesFile)\n let privateTypeIndex\n try {\n privateTypeIndex = store.any(user, ns.solid('privateTypeIndex'), undefined, profile) ||\n await utilityLogic.followOrCreateLink(user, ns.solid('privateTypeIndex') as NamedNode, suggestedPrivateTypeIndex, preferencesFile)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n const message = `User ${user} has no pointer in preference file to privateTypeIndex file.`\n debug.warn(message)\n }\n privateScopes = privateTypeIndex ? [{ label: 'private', index: privateTypeIndex as NamedNode, agent: user }] : []\n } else {\n privateScopes = []\n }\n const scopes = publicScopes.concat(privateScopes)\n if (scopes.length === 0) return scopes\n const files = scopes.map(scope => scope.index)\n try {\n await store.fetcher.load(files)\n } catch (err) {\n debug.warn('Problems loading type index: ', err)\n }\n return scopes\n }\n\n async function loadCommunityTypeIndexes(user: NamedNode): Promise<TypeIndexScope[][]> {\n let preferencesFile\n try {\n preferencesFile = await profileLogic.silencedLoadPreferences(user)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n const message = `User ${user} has no pointer in profile to preferences file.`\n debug.warn(message)\n }\n if (preferencesFile) { // For now, pick up communities as simple links from the preferences file.\n const communities = store.each(user, ns.solid('community'), undefined, preferencesFile as NamedNode).concat(\n store.each(user, ns.solid('community'), undefined, user.doc() as NamedNode)\n )\n let result = []\n for (const org of communities) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result = result.concat(await loadTypeIndexesFor(org as NamedNode) as any)\n }\n return result\n }\n return [] // No communities\n }\n\n async function loadAllTypeIndexes(user: NamedNode) {\n return (await loadTypeIndexesFor(user)).concat((await loadCommunityTypeIndexes(user)).flat())\n }\n\n async function getScopedAppInstances(klass: NamedNode, user: NamedNode): Promise<ScopedApp[]> {\n const scopes = await loadAllTypeIndexes(user)\n let scopedApps = []\n for (const scope of scopes) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const scopedApps0 = await getScopedAppsFromIndex(scope, klass) as any\n scopedApps = scopedApps.concat(scopedApps0)\n }\n return scopedApps\n }\n\n // This is the function signature which used to be in solid-ui/logic\n // Recommended to use getScopedAppInstances instead as it provides more information.\n //\n async function getAppInstances(klass: NamedNode): Promise<NamedNode[]> {\n const user = authn.currentUser()\n if (!user) throw new Error('getAppInstances: Must be logged in to find apps.')\n const scopedAppInstances = await getScopedAppInstances(klass, user)\n return scopedAppInstances.map(scoped => scoped.instance)\n }\n\n function suggestPublicTypeIndex(me: NamedNode) {\n return sym(me.doc().dir()?.uri + 'publicTypeIndex.ttl')\n }\n // Note this one is based off the pref file not the profile\n\n function suggestPrivateTypeIndex(preferencesFile: NamedNode) {\n return sym(preferencesFile.doc().dir()?.uri + 'privateTypeIndex.ttl')\n }\n\n /*\n * Register a new app in a type index\n * used in chat in bookmark.js (solid-ui)\n * Returns the registration object if successful else null\n */\n async function registerInTypeIndex(\n instance: NamedNode,\n index: NamedNode,\n theClass: NamedNode,\n // agent: NamedNode\n ): Promise<NamedNode | null> {\n const registration = newThing(index)\n const ins = [\n // See https://github.com/solid/solid/blob/main/proposals/data-discovery.md\n st(registration, ns.rdf('type'), ns.solid('TypeRegistration'), index),\n st(registration, ns.solid('forClass'), theClass, index),\n st(registration, ns.solid('instance'), instance, index)\n ]\n try {\n await store.updater.update([], ins)\n } catch (err) {\n const msg = `Unable to register ${instance} in index ${index}: ${err}`\n console.warn(msg)\n return null\n }\n return registration\n }\n\n async function deleteTypeIndexRegistration(item) {\n const reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index) as NamedNode\n if (!reg) throw new Error(`deleteTypeIndexRegistration: No registration found for ${item.instance}`)\n const statements = store.statementsMatching(reg, null, null, item.scope.index)\n await store.updater.update(statements, [])\n }\n\n async function getScopedAppsFromIndex(scope: TypeIndexScope, theClass: NamedNode | null): Promise<ScopedApp[]> {\n const index = scope.index\n const results: ScopedApp[] = []\n const registrations = store.statementsMatching(null, ns.solid('instance'), null, index)\n .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))\n .map(st => st.subject)\n for (const reg of registrations) {\n const klass = store.any(reg, ns.solid('forClass'), null, index)\n if (!theClass || klass.sameTerm(theClass)) {\n const instances = store.each(reg, ns.solid('instance'), null, index)\n for (const instance of instances) {\n results.push({ instance, type: klass, scope })\n }\n const containers = store.each(reg, ns.solid('instanceContainer'), null, index)\n for (const instance of containers) {\n await store.fetcher.load(instance)\n results.push({ instance: sym(instance.value), type: klass, scope })\n }\n }\n }\n return results\n }\n\n return {\n registerInTypeIndex,\n getRegistrations,\n loadTypeIndexesFor,\n loadCommunityTypeIndexes,\n loadAllTypeIndexes,\n getScopedAppInstances,\n getAppInstances,\n suggestPublicTypeIndex,\n suggestPrivateTypeIndex,\n deleteTypeIndexRegistration,\n getScopedAppsFromIndex\n }\n}\n","import { NamedNode, Statement, sym } from 'rdflib'\n\n/**\n * Container-related class\n */\nexport function createContainerLogic(store) {\n\n function getContainerElements(containerNode: NamedNode): NamedNode[] {\n return store\n .statementsMatching(\n containerNode,\n sym('http://www.w3.org/ns/ldp#contains'),\n undefined\n )\n .map((st: Statement) => st.object as NamedNode)\n }\n\n function isContainer(url: NamedNode) {\n const nodeToString = url.value\n return nodeToString.charAt(nodeToString.length - 1) === '/'\n }\n\n async function createContainer(url: string) {\n const stringToNode = sym(url)\n if (!isContainer(stringToNode)) {\n throw new Error(`Not a container URL ${url}`)\n }\n // Copied from https://github.com/solidos/solid-crud-tests/blob/v3.1.0/test/surface/create-container.test.ts#L56-L64\n const result = await store.fetcher._fetch(url, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'text/turtle',\n 'If-None-Match': '*',\n Link: '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"', // See https://github.com/solidos/node-solid-server/issues/1465\n },\n body: ' ', // work around https://github.com/michielbdejong/community-server/issues/4#issuecomment-776222863\n })\n if (result.status.toString()[0] !== '2') {\n throw new Error(`Not OK: got ${result.status} response while creating container at ${url}`)\n }\n }\n\n async function getContainerMembers(containerUrl: NamedNode): Promise<NamedNode[]> {\n await store.fetcher.load(containerUrl)\n return getContainerElements(containerUrl)\n }\n return {\n isContainer,\n createContainer,\n getContainerElements,\n getContainerMembers\n }\n}","import { NamedNode, st, sym } from 'rdflib'\nimport { CrossOriginForbiddenError, FetchError, NotEditableError, SameOriginForbiddenError, UnauthorizedError, WebOperationError } from '../logic/CustomError'\nimport * as debug from '../util/debug'\nimport { differentOrigin } from './utils'\n\nexport function createUtilityLogic(store, aclLogic, containerLogic) {\n\n async function recursiveDelete(containerNode: NamedNode) {\n try {\n if (containerLogic.isContainer(containerNode)) {\n const aclDocUrl = await aclLogic.findAclDocUrl(containerNode)\n await store.fetcher._fetch(aclDocUrl, { method: 'DELETE' })\n const containerMembers = await containerLogic.getContainerMembers(containerNode)\n await Promise.all(\n containerMembers.map((url) => recursiveDelete(url))\n )\n }\n const nodeToStringHere = containerNode.value\n return store.fetcher._fetch(nodeToStringHere, { method: 'DELETE' })\n } catch (e) {\n debug.log(`Please manually remove ${containerNode.value} from your system.`, e)\n }\n }\n\n /**\n * Create a resource if it really does not exist\n * Be absolutely sure something does not exist before creating a new empty file\n * as otherwise existing could be deleted.\n * @param doc {NamedNode} - The resource\n */\n async function loadOrCreateIfNotExists(doc: NamedNode) {\n let response\n try {\n response = await store.fetcher.load(doc)\n } catch (err) {\n if (err.response.status === 404) {\n try {\n await store.fetcher.webOperation('PUT', doc, { data: '', contentType: 'text/turtle' })\n } catch (err) {\n const msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err\n throw new WebOperationError(msg)\n }\n await store.fetcher.load(doc)\n } else {\n if (err.response.status === 401) {\n throw new UnauthorizedError()\n }\n if (err.response.status === 403) {\n if (differentOrigin(doc)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n const msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err\n throw new FetchError(err.status, err.message + msg)\n }\n }\n return response\n }\n\n /* Follow link from this doc to another thing, or else make a new link\n **\n ** @returns existing object, or creates it if non existent\n */\n async function followOrCreateLink(subject: NamedNode, predicate: NamedNode,\n object: NamedNode, doc: NamedNode\n ): Promise<NamedNode | null> {\n await store.fetcher.load(doc)\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLink: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLink: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(err)\n }\n\n try {\n await loadOrCreateIfNotExists(object)\n // store.fetcher.webOperation('PUT', object, { data: '', contentType: 'text/turtle'})\n } catch (err) {\n debug.warn(`followOrCreateLink: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n // Copied from https://github.com/solidos/web-access-control-tests/blob/v3.0.0/test/surface/delete.test.ts#L5\n async function setSinglePeerAccess(options: {\n ownerWebId: string,\n peerWebId: string,\n accessToModes?: string,\n defaultModes?: string,\n target: string\n }) {\n let str = [\n '@prefix acl: <http://www.w3.org/ns/auth/acl#>.',\n '',\n `<#alice> a acl:Authorization;\\n acl:agent <${options.ownerWebId}>;`,\n ` acl:accessTo <${options.target}>;`,\n ` acl:default <${options.target}>;`,\n ' acl:mode acl:Read, acl:Write, acl:Control.',\n ''\n ].join('\\n')\n if (options.accessToModes) {\n str += [\n '<#bobAccessTo> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:accessTo <${options.target}>;`,\n ` acl:mode ${options.accessToModes}.`,\n ''\n ].join('\\n')\n }\n if (options.defaultModes) {\n str += [\n '<#bobDefault> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:default <${options.target}>;`,\n ` acl:mode ${options.defaultModes}.`,\n ''\n ].join('\\n')\n }\n const aclDocUrl = await aclLogic.findAclDocUrl(sym(options.target))\n return store.fetcher._fetch(aclDocUrl, {\n method: 'PUT',\n body: str,\n headers: [\n ['Content-Type', 'text/turtle']\n ]\n })\n }\n\n async function createEmptyRdfDoc(doc: NamedNode, comment: string) {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: `# ${new Date()} ${comment}\n `,\n contentType: 'text/turtle',\n })\n }\n \n return {\n recursiveDelete,\n setSinglePeerAccess,\n createEmptyRdfDoc,\n followOrCreateLink,\n loadOrCreateIfNotExists\n }\n}\n\n","import { Session } from '@inrupt/solid-client-authn-browser'\nimport * as rdf from 'rdflib'\nimport { LiveStore, NamedNode, Statement } from 'rdflib'\nimport { createAclLogic } from '../acl/aclLogic'\nimport { SolidAuthnLogic } from '../authn/SolidAuthnLogic'\nimport { createChatLogic } from '../chat/chatLogic'\nimport { createInboxLogic } from '../inbox/inboxLogic'\nimport { createProfileLogic } from '../profile/profileLogic'\nimport { createTypeIndexLogic } from '../typeIndex/typeIndexLogic'\nimport { createContainerLogic } from '../util/containerLogic'\nimport { createUtilityLogic } from '../util/utilityLogic'\nimport { AuthnLogic, SolidLogic } from '../types'\nimport * as debug from '../util/debug'\n/*\n** It is important to distinquish `fetch`, a function provided by the browser\n** and `Fetcher`, a helper object for the rdflib Store which turns it\n** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is\n** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,\n*/\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: Session): SolidLogic {\n\n debug.log('SolidLogic: Unique instance created. There should only be one of these.')\n const store: LiveStore = rdf.graph() as LiveStore\n rdf.fetcher(store, {fetch: specialFetch.fetch}) // Attach a web I/O module, store.fetcher\n store.updater = new rdf.UpdateManager(store) // Add real-time live updates store.updater\n store.features = [] // disable automatic node merging on store load\n\n const authn: AuthnLogic = new SolidAuthnLogic(session)\n \n const acl = createAclLogic(store)\n const containerLogic = createContainerLogic(store)\n const utilityLogic = createUtilityLogic(store, acl, containerLogic)\n const profile = createProfileLogic(store, authn, utilityLogic)\n const chat = createChatLogic(store, profile)\n const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl)\n const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic)\n debug.log('SolidAuthnLogic initialized')\n\n function load(doc: NamedNode | NamedNode[] | string) {\n return store.fetcher.load(doc)\n }\n\n // @@@@ use the one in rdflib.js when it is available and delete this\n function updatePromise(\n del: Array<Statement>,\n ins: Array<Statement> = []\n ): Promise<void> {\n return new Promise((resolve, reject) => {\n store.updater.update(del, ins, function (_uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody))\n } else {\n resolve()\n }\n }) // callback\n }) // promise\n }\n\n function clearStore() {\n store.statements.slice().forEach(store.remove.bind(store))\n }\n\n return {\n store,\n authn,\n acl,\n inbox,\n chat,\n profile,\n typeIndex,\n load,\n updatePromise,\n clearStore\n }\n}\n","import * as debug from '../util/debug'\nimport { authSession } from '../authSession/authSession'\nimport { createSolidLogic } from './solidLogic'\n\nconst _fetch = async (url, requestInit) => {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'\n if (authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n return authSession.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\n//this const makes solidLogicSingleton global accessible in mashlib\nconst solidLogicSingleton = createSolidLogic({ fetch: _fetch }, authSession)\n\ndebug.log('Unique quadstore initialized.')\n\nexport { solidLogicSingleton }","const DEFAULT_ISSUERS = [\n {\n name: 'Solid Community',\n uri: 'https://solidcommunity.net'\n },\n {\n name: 'Solid Web',\n uri: 'https://solidweb.org'\n },\n {\n name: 'Solid Web ME',\n uri: 'https://solidweb.me'\n },\n {\n name: 'Inrupt.com',\n uri: 'https://login.inrupt.com'\n }\n]\n\n/**\n * @returns - A list of suggested OIDC issuers\n */\nexport function getSuggestedIssuers (): { name: string, uri: string }[] {\n // Suggest a default list of OIDC issuers\n const issuers = [...DEFAULT_ISSUERS]\n \n // Suggest the current host if not already included\n const { host, origin } = new URL(location.href)\n const hosts = issuers.map(({ uri }) => new URL(uri).host)\n if (!hosts.includes(host) && !hosts.some(existing => isSubdomainOf(host, existing))) {\n issuers.unshift({ name: host, uri: origin })\n }\n \n return issuers\n }\n \nfunction isSubdomainOf (subdomain: string, domain: string): boolean {\n const dot = subdomain.length - domain.length - 1\n return dot > 0 && subdomain[dot] === '.' && subdomain.endsWith(domain)\n}","// Make these variables directly accessible as it is what you need most of the time\n// This also makes these variable globaly accesible in mashlib\nimport { solidLogicSingleton } from './logic/solidLogicSingleton'\n\nconst authn = solidLogicSingleton.authn\nconst authSession = solidLogicSingleton.authn.authSession\nconst store = solidLogicSingleton.store\n\nexport { ACL_LINK } from './acl/aclLogic'\nexport { offlineTestID, appContext } from './authn/authUtil'\nexport { getSuggestedIssuers } from './issuer/issuerLogic'\nexport { createTypeIndexLogic } from './typeIndex/typeIndexLogic'\nexport type { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic, ChatLogic } from './types'\nexport { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError'\n\nexport {\n solidLogicSingleton, // solidLogicSingleton is exported entirely because it is used in solid-panes\n store,\n authn,\n authSession\n}\n\n"],"names":[],"sourceRoot":""}