zudoku 0.22.0 → 0.23.0

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 (335) hide show
  1. package/dist/app/demo.js +1 -1
  2. package/dist/app/demo.js.map +1 -1
  3. package/dist/app/entry.client.js +1 -15
  4. package/dist/app/entry.client.js.map +1 -1
  5. package/dist/app/entry.server.js +1 -2
  6. package/dist/app/entry.server.js.map +1 -1
  7. package/dist/app/main.d.ts +1 -1
  8. package/dist/app/sentry.js +1 -1
  9. package/dist/app/sentry.js.map +1 -1
  10. package/dist/app/standalone.js +1 -1
  11. package/dist/app/standalone.js.map +1 -1
  12. package/dist/cli/cmds/build.js +1 -0
  13. package/dist/cli/cmds/build.js.map +1 -1
  14. package/dist/config/validators/common.d.ts +104 -104
  15. package/dist/config/validators/icon-types.d.ts +1 -1
  16. package/dist/config/validators/validate.d.ts +90 -90
  17. package/dist/lib/authentication/components/CallbackHandler.js +1 -1
  18. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  19. package/dist/lib/authentication/components/SignIn.js +1 -1
  20. package/dist/lib/authentication/components/SignIn.js.map +1 -1
  21. package/dist/lib/authentication/components/SignOut.js +1 -1
  22. package/dist/lib/authentication/components/SignOut.js.map +1 -1
  23. package/dist/lib/components/AnchorLink.d.ts +1 -1
  24. package/dist/lib/components/AnchorLink.js +1 -1
  25. package/dist/lib/components/AnchorLink.js.map +1 -1
  26. package/dist/lib/components/Bootstrap.d.ts +1 -2
  27. package/dist/lib/components/Bootstrap.js +3 -3
  28. package/dist/lib/components/Bootstrap.js.map +1 -1
  29. package/dist/lib/components/Header.js +1 -1
  30. package/dist/lib/components/Header.js.map +1 -1
  31. package/dist/lib/components/Layout.js +1 -1
  32. package/dist/lib/components/Layout.js.map +1 -1
  33. package/dist/lib/components/NotFoundPage.js +1 -1
  34. package/dist/lib/components/NotFoundPage.js.map +1 -1
  35. package/dist/lib/components/SlotletProvider.d.ts +2 -2
  36. package/dist/lib/components/TopNavigation.js +1 -1
  37. package/dist/lib/components/TopNavigation.js.map +1 -1
  38. package/dist/lib/components/Zudoku.js +1 -1
  39. package/dist/lib/components/Zudoku.js.map +1 -1
  40. package/dist/lib/components/context/ZudokuContext.js +1 -1
  41. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  42. package/dist/lib/components/index.d.ts +4 -4
  43. package/dist/lib/components/index.js +1 -1
  44. package/dist/lib/components/index.js.map +1 -1
  45. package/dist/lib/components/navigation/SidebarCategory.js +1 -1
  46. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  47. package/dist/lib/components/navigation/SidebarItem.js +1 -1
  48. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  49. package/dist/lib/components/navigation/utils.js +1 -1
  50. package/dist/lib/components/navigation/utils.js.map +1 -1
  51. package/dist/lib/core/plugins.d.ts +3 -5
  52. package/dist/lib/core/plugins.js.map +1 -1
  53. package/dist/lib/errors/RouterError.js +1 -1
  54. package/dist/lib/errors/RouterError.js.map +1 -1
  55. package/dist/lib/plugins/api-keys/CreateApiKey.js +1 -1
  56. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
  57. package/dist/lib/plugins/api-keys/ProtectedRoute.js +1 -1
  58. package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -1
  59. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +1 -1
  60. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  61. package/dist/lib/plugins/markdown/MdxPage.js +1 -1
  62. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  63. package/dist/lib/plugins/markdown/index.d.ts +1 -0
  64. package/dist/lib/plugins/markdown/index.js.map +1 -1
  65. package/dist/lib/plugins/openapi/Route.js +1 -1
  66. package/dist/lib/plugins/openapi/Route.js.map +1 -1
  67. package/dist/lib/plugins/openapi/Sidecar.js +1 -1
  68. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  69. package/dist/lib/plugins/openapi/index.js +1 -1
  70. package/dist/lib/plugins/openapi/index.js.map +1 -1
  71. package/dist/lib/plugins/redirect/index.js +1 -1
  72. package/dist/lib/plugins/redirect/index.js.map +1 -1
  73. package/dist/lib/util/MdxComponents.d.ts +16 -16
  74. package/dist/lib/util/MdxComponents.js +1 -3
  75. package/dist/lib/util/MdxComponents.js.map +1 -1
  76. package/dist/lib/util/createVariantComponent.d.ts +2 -2
  77. package/dist/lib/util/useExposedProps.js +1 -1
  78. package/dist/lib/util/useExposedProps.js.map +1 -1
  79. package/dist/lib/util/useOnScreen.d.ts +1 -1
  80. package/dist/lib/util/useScrollToAnchor.js +1 -1
  81. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  82. package/dist/lib/util/useScrollToTop.js +1 -1
  83. package/dist/lib/util/useScrollToTop.js.map +1 -1
  84. package/dist/vite/config.js +15 -8
  85. package/dist/vite/config.js.map +1 -1
  86. package/dist/vite/css/collect.d.ts +2 -0
  87. package/dist/vite/css/collect.js +27 -0
  88. package/dist/vite/css/collect.js.map +1 -0
  89. package/dist/vite/css/plugin.d.ts +5 -0
  90. package/dist/vite/css/plugin.js +79 -0
  91. package/dist/vite/css/plugin.js.map +1 -0
  92. package/dist/vite/dev-server.js +7 -3
  93. package/dist/vite/dev-server.js.map +1 -1
  94. package/dist/vite/plugin-mdx.js +2 -0
  95. package/dist/vite/plugin-mdx.js.map +1 -1
  96. package/dist/vite/plugin.js +4 -0
  97. package/dist/vite/plugin.js.map +1 -1
  98. package/lib/{AnchorLink-BR0MvI7n.js → AnchorLink-DFZZbmvr.js} +13 -14
  99. package/lib/AnchorLink-DFZZbmvr.js.map +1 -0
  100. package/lib/{AuthenticationPlugin-D0Em0SwR.js → AuthenticationPlugin-DQy635W9.js} +15 -16
  101. package/lib/AuthenticationPlugin-DQy635W9.js.map +1 -0
  102. package/lib/{Button-jK0EsymC.js → Button-DeAoTouo.js} +4 -4
  103. package/lib/{Button-jK0EsymC.js.map → Button-DeAoTouo.js.map} +1 -1
  104. package/lib/{CategoryHeading-Bb9dqxD3.js → CategoryHeading-CBconmtI.js} +3 -3
  105. package/lib/{CategoryHeading-Bb9dqxD3.js.map → CategoryHeading-CBconmtI.js.map} +1 -1
  106. package/lib/ClientOnly-E7hGysn1.js.map +1 -1
  107. package/lib/{Dialog-k70Qfukb.js → Dialog-Bxv1yEIg.js} +3 -3
  108. package/lib/{Dialog-k70Qfukb.js.map → Dialog-Bxv1yEIg.js.map} +1 -1
  109. package/lib/{Markdown-CRsmPPfY.js → Markdown-CZDLNOFc.js} +3080 -3058
  110. package/lib/{Markdown-CRsmPPfY.js.map → Markdown-CZDLNOFc.js.map} +1 -1
  111. package/lib/{MdxPage-Wp8QU0-q.js → MdxPage-CBa4X6L5.js} +9 -9
  112. package/lib/MdxPage-CBa4X6L5.js.map +1 -0
  113. package/lib/OperationList-Bj-6EKhp.js +4889 -0
  114. package/lib/{OperationList-u8xHU9-b.js.map → OperationList-Bj-6EKhp.js.map} +1 -1
  115. package/lib/Route-C9cYcP-j.js +11 -0
  116. package/lib/Route-C9cYcP-j.js.map +1 -0
  117. package/lib/{Select-O9ZM3ZgX.js → Select-Bb_Hqc70.js} +5 -5
  118. package/lib/{Select-O9ZM3ZgX.js.map → Select-Bb_Hqc70.js.map} +1 -1
  119. package/lib/{SidebarBadge-DxFJcJ6V.js → SidebarBadge-Bm793GDY.js} +3 -3
  120. package/lib/{SidebarBadge-DxFJcJ6V.js.map → SidebarBadge-Bm793GDY.js.map} +1 -1
  121. package/lib/SlotletProvider-pfc9oejW.js +221 -0
  122. package/lib/SlotletProvider-pfc9oejW.js.map +1 -0
  123. package/lib/{Spinner-3cQDBVGr.js → Spinner-DuxJLLNE.js} +2 -2
  124. package/lib/{Spinner-3cQDBVGr.js.map → Spinner-DuxJLLNE.js.map} +1 -1
  125. package/lib/{SyntaxHighlight-C31iouiO.js → SyntaxHighlight-Bz-lOJtH.js} +8 -10
  126. package/lib/{SyntaxHighlight-C31iouiO.js.map → SyntaxHighlight-Bz-lOJtH.js.map} +1 -1
  127. package/lib/assets/{index-B_Jk_Yzp.js → index-C7jnHK4b.js} +218 -197
  128. package/lib/assets/index-C7jnHK4b.js.map +1 -0
  129. package/lib/assets/{worker-C_2va8B8.js → worker-BmEAZjUP.js} +5249 -4922
  130. package/lib/assets/worker-BmEAZjUP.js.map +1 -0
  131. package/lib/chunk-D52XG6IA-Dl7HLe6j.js +1823 -0
  132. package/lib/chunk-D52XG6IA-Dl7HLe6j.js.map +1 -0
  133. package/lib/{cn-BmFQLtkS.js → cn-qaFjX9_3.js} +2 -2
  134. package/lib/cn-qaFjX9_3.js.map +1 -0
  135. package/lib/{context-D1nXWxm7.js → context-h_UkBLvr.js} +2 -2
  136. package/lib/{context-D1nXWxm7.js.map → context-h_UkBLvr.js.map} +1 -1
  137. package/lib/{createServer-BCAHdrpE.js → createServer-BVFp6Bl3.js} +4521 -4195
  138. package/lib/createServer-BVFp6Bl3.js.map +1 -0
  139. package/lib/{hook-hEqe7fPB.js → hook-DMHiUaIV.js} +3 -3
  140. package/lib/{hook-hEqe7fPB.js.map → hook-DMHiUaIV.js.map} +1 -1
  141. package/lib/{index-CmdLGbbk.js → index-B6rTMjdI.js} +47 -47
  142. package/lib/{index-CmdLGbbk.js.map → index-B6rTMjdI.js.map} +1 -1
  143. package/lib/{index-CkwDvuPt.js → index-CBXSgjaE.js} +259 -238
  144. package/lib/index-CBXSgjaE.js.map +1 -0
  145. package/lib/index-CPNSgwSb.js +36 -0
  146. package/lib/index-CPNSgwSb.js.map +1 -0
  147. package/lib/index-LNp6rxyU.js.map +1 -1
  148. package/lib/index.esm-BSV1C092.js +692 -0
  149. package/lib/{index.esm-Bm8pj-bc.js.map → index.esm-BSV1C092.js.map} +1 -1
  150. package/lib/index.esm-BnnBRKJX.js +1214 -0
  151. package/lib/index.esm-BnnBRKJX.js.map +1 -0
  152. package/lib/invariant-Caa8-XvF.js.map +1 -1
  153. package/lib/jsx-runtime-Dx-03ztt.js +446 -0
  154. package/lib/jsx-runtime-Dx-03ztt.js.map +1 -0
  155. package/lib/object_hash-BNWPnMN9.js +787 -0
  156. package/lib/object_hash-BNWPnMN9.js.map +1 -0
  157. package/lib/post-processors/removeExtensions.js.map +1 -1
  158. package/lib/post-processors/removePaths.js.map +1 -1
  159. package/lib/post-processors/traverse.js.map +1 -1
  160. package/lib/prism-csharp.min-DUwvItt4.js +63 -0
  161. package/lib/{prism-csharp.min-Yizuc34Y.js.map → prism-csharp.min-DUwvItt4.js.map} +1 -1
  162. package/lib/prism-java.min-BtgBR4yd.js +35 -0
  163. package/lib/{prism-java.min-d5iT_mOd.js.map → prism-java.min-BtgBR4yd.js.map} +1 -1
  164. package/lib/prism-markup-BNGj0Tvm.js.map +1 -1
  165. package/lib/prism-ruby.min-DeDXCp1r.js +38 -0
  166. package/lib/{prism-ruby.min-C7LwcKyz.js.map → prism-ruby.min-DeDXCp1r.js.map} +1 -1
  167. package/lib/prism-typescript.min-CD7H2IYQ.js +34 -0
  168. package/lib/{prism-typescript.min-oSVeWCAd.js.map → prism-typescript.min-CD7H2IYQ.js.map} +1 -1
  169. package/lib/state-CFQsUZUP.js +202 -0
  170. package/lib/state-CFQsUZUP.js.map +1 -0
  171. package/lib/ui/Accordion.js +2 -2
  172. package/lib/ui/Accordion.js.map +1 -1
  173. package/lib/ui/ActionButton.js +4 -4
  174. package/lib/ui/ActionButton.js.map +1 -1
  175. package/lib/ui/Alert.js +3 -3
  176. package/lib/ui/Alert.js.map +1 -1
  177. package/lib/ui/AlertDialog.js +2 -2
  178. package/lib/ui/AlertDialog.js.map +1 -1
  179. package/lib/ui/Badge.js +3 -3
  180. package/lib/ui/Badge.js.map +1 -1
  181. package/lib/ui/Breadcrumb.js +2 -2
  182. package/lib/ui/Breadcrumb.js.map +1 -1
  183. package/lib/ui/Button.js +3 -3
  184. package/lib/ui/Button.js.map +1 -1
  185. package/lib/ui/Callout.js +2 -2
  186. package/lib/ui/Callout.js.map +1 -1
  187. package/lib/ui/Card.js +2 -2
  188. package/lib/ui/Card.js.map +1 -1
  189. package/lib/ui/Carousel.js +407 -401
  190. package/lib/ui/Carousel.js.map +1 -1
  191. package/lib/ui/Checkbox.js +2 -2
  192. package/lib/ui/Checkbox.js.map +1 -1
  193. package/lib/ui/Command.js +111 -108
  194. package/lib/ui/Command.js.map +1 -1
  195. package/lib/ui/Dialog.js +2 -2
  196. package/lib/ui/Dialog.js.map +1 -1
  197. package/lib/ui/Drawer.js +2 -2
  198. package/lib/ui/Drawer.js.map +1 -1
  199. package/lib/ui/DropdownMenu.js +2 -2
  200. package/lib/ui/DropdownMenu.js.map +1 -1
  201. package/lib/ui/Form.js +3 -3
  202. package/lib/ui/Form.js.map +1 -1
  203. package/lib/ui/HoverCard.js +2 -2
  204. package/lib/ui/Input.js +2 -2
  205. package/lib/ui/Input.js.map +1 -1
  206. package/lib/ui/Label.js +3 -3
  207. package/lib/ui/Pagination.js +2 -2
  208. package/lib/ui/Pagination.js.map +1 -1
  209. package/lib/ui/Popover.js +2 -2
  210. package/lib/ui/Popover.js.map +1 -1
  211. package/lib/ui/Progress.js +2 -2
  212. package/lib/ui/Progress.js.map +1 -1
  213. package/lib/ui/RadioGroup.js +2 -2
  214. package/lib/ui/RadioGroup.js.map +1 -1
  215. package/lib/ui/ScrollArea.js +2 -2
  216. package/lib/ui/ScrollArea.js.map +1 -1
  217. package/lib/ui/Select.js +2 -2
  218. package/lib/ui/Select.js.map +1 -1
  219. package/lib/ui/Skeleton.js +2 -2
  220. package/lib/ui/Skeleton.js.map +1 -1
  221. package/lib/ui/Slider.js +2 -2
  222. package/lib/ui/Switch.js +2 -2
  223. package/lib/ui/Switch.js.map +1 -1
  224. package/lib/ui/Tabs.js +2 -2
  225. package/lib/ui/Textarea.js +2 -2
  226. package/lib/ui/Textarea.js.map +1 -1
  227. package/lib/ui/Toggle.js +3 -3
  228. package/lib/ui/Toggle.js.map +1 -1
  229. package/lib/ui/ToggleGroup.js +2 -2
  230. package/lib/ui/ToggleGroup.js.map +1 -1
  231. package/lib/ui/Tooltip.js +2 -2
  232. package/lib/useExposedProps-DE9lR6MF.js +9 -0
  233. package/lib/useExposedProps-DE9lR6MF.js.map +1 -0
  234. package/lib/{utils-DcpDOncX.js → utils-R0j3Raw1.js} +30 -31
  235. package/lib/{utils-DcpDOncX.js.map → utils-R0j3Raw1.js.map} +1 -1
  236. package/lib/zudoku.auth-auth0.js +1 -1
  237. package/lib/zudoku.auth-auth0.js.map +1 -1
  238. package/lib/zudoku.auth-clerk.js +2 -2
  239. package/lib/zudoku.auth-clerk.js.map +1 -1
  240. package/lib/zudoku.auth-openid.js +348 -346
  241. package/lib/zudoku.auth-openid.js.map +1 -1
  242. package/lib/zudoku.components.js +679 -939
  243. package/lib/zudoku.components.js.map +1 -1
  244. package/lib/zudoku.openapi-worker.js +1 -1
  245. package/lib/zudoku.openapi-worker.js.map +1 -1
  246. package/lib/zudoku.plugin-api-catalog.js +3 -3
  247. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  248. package/lib/zudoku.plugin-api-keys.js +15 -16
  249. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  250. package/lib/zudoku.plugin-custom-pages.js +4 -4
  251. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  252. package/lib/zudoku.plugin-markdown.js +2 -2
  253. package/lib/zudoku.plugin-markdown.js.map +1 -1
  254. package/lib/zudoku.plugin-openapi.js +5 -5
  255. package/lib/zudoku.plugin-redirect.js +1 -1
  256. package/lib/zudoku.plugin-redirect.js.map +1 -1
  257. package/lib/zudoku.plugin-search-inkeep.js +1 -1
  258. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  259. package/package.json +35 -35
  260. package/src/app/demo.tsx +1 -1
  261. package/src/app/entry.client.tsx +1 -15
  262. package/src/app/entry.server.tsx +2 -2
  263. package/src/app/main.tsx +1 -1
  264. package/src/app/sentry.ts +1 -1
  265. package/src/app/standalone.tsx +1 -1
  266. package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
  267. package/src/lib/authentication/components/SignIn.tsx +1 -1
  268. package/src/lib/authentication/components/SignOut.tsx +1 -1
  269. package/src/lib/components/AnchorLink.tsx +1 -1
  270. package/src/lib/components/Bootstrap.tsx +4 -6
  271. package/src/lib/components/Header.tsx +1 -1
  272. package/src/lib/components/Layout.tsx +1 -1
  273. package/src/lib/components/NotFoundPage.tsx +1 -1
  274. package/src/lib/components/SlotletProvider.tsx +1 -1
  275. package/src/lib/components/TopNavigation.tsx +1 -1
  276. package/src/lib/components/Zudoku.tsx +1 -1
  277. package/src/lib/components/context/ZudokuContext.ts +1 -1
  278. package/src/lib/components/index.ts +1 -1
  279. package/src/lib/components/navigation/SidebarCategory.tsx +1 -1
  280. package/src/lib/components/navigation/SidebarItem.tsx +1 -1
  281. package/src/lib/components/navigation/utils.ts +1 -1
  282. package/src/lib/core/plugins.ts +3 -7
  283. package/src/lib/errors/RouterError.tsx +1 -1
  284. package/src/lib/plugins/api-keys/CreateApiKey.tsx +1 -1
  285. package/src/lib/plugins/api-keys/ProtectedRoute.tsx +1 -1
  286. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +1 -1
  287. package/src/lib/plugins/api-keys/index.tsx +1 -1
  288. package/src/lib/plugins/custom-pages/index.tsx +1 -1
  289. package/src/lib/plugins/markdown/MdxPage.tsx +1 -1
  290. package/src/lib/plugins/markdown/index.tsx +2 -1
  291. package/src/lib/plugins/openapi/Route.tsx +1 -1
  292. package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
  293. package/src/lib/plugins/openapi/index.tsx +1 -1
  294. package/src/lib/plugins/redirect/index.tsx +1 -1
  295. package/src/lib/util/MdxComponents.tsx +1 -3
  296. package/src/lib/util/createVariantComponent.tsx +2 -2
  297. package/src/lib/util/useExposedProps.tsx +1 -1
  298. package/src/lib/util/useScrollToAnchor.ts +1 -1
  299. package/src/lib/util/useScrollToTop.ts +1 -1
  300. package/lib/AnchorLink-BR0MvI7n.js.map +0 -1
  301. package/lib/AuthenticationPlugin-D0Em0SwR.js.map +0 -1
  302. package/lib/MdxPage-Wp8QU0-q.js.map +0 -1
  303. package/lib/OperationList-u8xHU9-b.js +0 -4706
  304. package/lib/Route-DlG_HTMu.js +0 -11
  305. package/lib/Route-DlG_HTMu.js.map +0 -1
  306. package/lib/SlotletProvider-BgvYIPQe.js +0 -252
  307. package/lib/SlotletProvider-BgvYIPQe.js.map +0 -1
  308. package/lib/assets/index-B_Jk_Yzp.js.map +0 -1
  309. package/lib/assets/worker-C_2va8B8.js.map +0 -1
  310. package/lib/cn-BmFQLtkS.js.map +0 -1
  311. package/lib/createServer-BCAHdrpE.js.map +0 -1
  312. package/lib/index-BuAyrJe3.js +0 -46
  313. package/lib/index-BuAyrJe3.js.map +0 -1
  314. package/lib/index-CkwDvuPt.js.map +0 -1
  315. package/lib/index-Czzd9rjU.js +0 -899
  316. package/lib/index-Czzd9rjU.js.map +0 -1
  317. package/lib/index-Yn8c3UWE.js +0 -921
  318. package/lib/index-Yn8c3UWE.js.map +0 -1
  319. package/lib/index.esm-Bm8pj-bc.js +0 -675
  320. package/lib/index.esm-C5mr_sKO.js +0 -1193
  321. package/lib/index.esm-C5mr_sKO.js.map +0 -1
  322. package/lib/jsx-runtime-B6kdoens.js +0 -635
  323. package/lib/jsx-runtime-B6kdoens.js.map +0 -1
  324. package/lib/object_hash-CvlLgU-M.js +0 -785
  325. package/lib/object_hash-CvlLgU-M.js.map +0 -1
  326. package/lib/prism-csharp.min-Yizuc34Y.js +0 -35
  327. package/lib/prism-java.min-d5iT_mOd.js +0 -7
  328. package/lib/prism-ruby.min-C7LwcKyz.js +0 -10
  329. package/lib/prism-typescript.min-oSVeWCAd.js +0 -6
  330. package/lib/router-lfyopgBI.js +0 -3024
  331. package/lib/router-lfyopgBI.js.map +0 -1
  332. package/lib/state-tsXBLONe.js +0 -203
  333. package/lib/state-tsXBLONe.js.map +0 -1
  334. package/lib/useExposedProps-CTPtylCV.js +0 -10
  335. package/lib/useExposedProps-CTPtylCV.js.map +0 -1
@@ -1,4706 +0,0 @@
1
- import { j as d } from "./jsx-runtime-B6kdoens.js";
2
- import { g as Ht } from "./utils-DcpDOncX.js";
3
- import { H as Tn } from "./index.esm-Bm8pj-bc.js";
4
- import { C as nr } from "./CategoryHeading-Bb9dqxD3.js";
5
- import { I as Cn, M as be, H as _e, P as we } from "./Markdown-CRsmPPfY.js";
6
- import { c as D } from "./cn-BmFQLtkS.js";
7
- import { CheckIcon as Pn, CopyIcon as kn, ChevronDownIcon as En, CircleFadingPlusIcon as Nn, CircleDotIcon as Rn, CircleIcon as An, SquareMinusIcon as qn, SquarePlusIcon as In, ListPlusIcon as Ln } from "lucide-react";
8
- import { useContext as Un, useMemo as Jr, useTransition as Gr, useState as ve, useRef as Vr, useEffect as Qr, useLayoutEffect as Fn, Fragment as _n, useCallback as Hn } from "react";
9
- import { a as Kr } from "./state-tsXBLONe.js";
10
- import { Button as Dr } from "./ui/Button.js";
11
- import { h as Bn } from "./object_hash-CvlLgU-M.js";
12
- import { a as Mn, u as Bt } from "./context-D1nXWxm7.js";
13
- import { g as ut, S as Yr, C as Xr, P as zn } from "./index-CmdLGbbk.js";
14
- import { Tabs as Wn, TabsList as Jn, TabsTrigger as Gn, TabsContent as Vn } from "./ui/Tabs.js";
15
- import { T as fe, b as Qn } from "./SidebarBadge-DxFJcJ6V.js";
16
- import { Card as de, CardHeader as Kn, CardTitle as Dn, CardContent as Yn } from "./ui/Card.js";
17
- import { g as Xn, c as He, a as Zn } from "./_commonjsHelpers-BkfeUUK-.js";
18
- import { _ as eo } from "./__vite-browser-external-BYRIRx8p.js";
19
- import { u as to } from "./index-Yn8c3UWE.js";
20
- import { S as Mt } from "./SyntaxHighlight-C31iouiO.js";
21
- import { B as or } from "./Button-jK0EsymC.js";
22
- import * as ee from "@radix-ui/react-collapsible";
23
- import * as De from "@radix-ui/react-tabs";
24
- function ro(t, e) {
25
- return e;
26
- }
27
- const zt = (t, ...e) => {
28
- const r = Un(Mn);
29
- if (r === void 0)
30
- throw new Error("useGraphQL must be used within a GraphQLProvider");
31
- const o = Jr(() => Bn(e[0] ?? {}), [e]);
32
- return {
33
- queryFn: () => r.fetch(t, ...e),
34
- queryKey: [t, o]
35
- };
36
- }, no = ut(
37
- /* GraphQL */
38
- `
39
- query ServersQuery($input: JSON!, $type: SchemaType!) {
40
- schema(input: $input, type: $type) {
41
- url
42
- servers {
43
- url
44
- }
45
- }
46
- }
47
- `
48
- ), ar = ({ url: t }) => {
49
- const [e, r] = ve(!1);
50
- return /* @__PURE__ */ d.jsx(
51
- Dr,
52
- {
53
- onClick: () => {
54
- navigator.clipboard.writeText(t).then(() => {
55
- r(!0), setTimeout(() => r(!1), 2e3);
56
- });
57
- },
58
- variant: "ghost",
59
- size: "icon",
60
- children: e ? /* @__PURE__ */ d.jsx(Pn, { className: "text-green-600", size: 14 }) : /* @__PURE__ */ d.jsx(kn, { size: 14, strokeWidth: 1.3 })
61
- }
62
- );
63
- }, oo = () => {
64
- const { input: t, type: e } = Bt(), r = zt(no, { input: t, type: e }), o = Ht(r), [, s] = Gr(), { selectedServer: a, setSelectedServer: n } = Kr(), { servers: i } = o.data.schema;
65
- return i.length === 1 ? /* @__PURE__ */ d.jsxs("div", { className: "flex items-center gap-2", children: [
66
- /* @__PURE__ */ d.jsx("span", { className: "font-medium text-sm", children: "Endpoint:" }),
67
- /* @__PURE__ */ d.jsx(Cn, { className: "text-xs px-2 py-1.5", selectOnClick: !0, children: i[0].url }),
68
- /* @__PURE__ */ d.jsx(ar, { url: i[0].url })
69
- ] }) : /* @__PURE__ */ d.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
70
- /* @__PURE__ */ d.jsxs("span", { className: "font-medium text-sm", children: [
71
- i.length > 1 ? "Endpoints" : "Endpoint",
72
- ":"
73
- ] }),
74
- /* @__PURE__ */ d.jsx(
75
- Yr,
76
- {
77
- className: "font-mono text-xs bg-border/50 dark:bg-border/70 py-1.5 max-w-[450px] truncate",
78
- onChange: (l) => s(() => {
79
- n(l.target.value);
80
- }),
81
- value: a ?? o.data.schema.url,
82
- showChevrons: i.length > 1,
83
- options: i.map((l) => ({
84
- value: l.url,
85
- label: l.url
86
- }))
87
- }
88
- ),
89
- /* @__PURE__ */ d.jsx(ar, { url: a ?? o.data.schema.url })
90
- ] });
91
- }, Zr = (t, e) => t.reduce(
92
- (r, o) => {
93
- const s = e(o);
94
- return r[s] || (r[s] = []), r[s].push(o), r;
95
- },
96
- {}
97
- ), ao = (t, e) => t ? e(t) : void 0, io = (t) => t.schema != null && typeof t.schema == "object" ? t.schema : {
98
- type: "string"
99
- }, so = ({
100
- parameter: t,
101
- group: e,
102
- id: r
103
- }) => {
104
- const o = io(t);
105
- return /* @__PURE__ */ d.jsxs("li", { className: "p-4 bg-border/20 text-sm flex flex-col gap-1", children: [
106
- /* @__PURE__ */ d.jsxs("div", { className: "flex items-center gap-2", children: [
107
- /* @__PURE__ */ d.jsx("code", { children: e === "path" ? /* @__PURE__ */ d.jsx(
108
- Xr,
109
- {
110
- name: t.name,
111
- backgroundOpacity: "15%",
112
- slug: r + "-" + t.name.toLocaleLowerCase()
113
- }
114
- ) : t.name }),
115
- t.required && /* @__PURE__ */ d.jsx("span", { className: "py-px px-1.5 font-medium bg-primary/75 text-muted rounded-lg", children: "required" }),
116
- o.type && /* @__PURE__ */ d.jsx("span", { className: "text-muted-foreground", children: o.type === "array" ? `${o.items.type}[]` : o.type })
117
- ] }),
118
- t.description && /* @__PURE__ */ d.jsx(
119
- be,
120
- {
121
- content: t.description,
122
- className: "text-sm prose-p:my-1 prose-code:whitespace-pre-line"
123
- }
124
- )
125
- ] });
126
- }, lo = ({
127
- group: t,
128
- parameters: e,
129
- id: r
130
- }) => /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
131
- /* @__PURE__ */ d.jsx(_e, { level: 3, id: `${r}/${t}-parameters`, className: "capitalize", children: t === "header" ? "Headers" : `${t} Parameters` }),
132
- /* @__PURE__ */ d.jsx(de, { children: /* @__PURE__ */ d.jsx("ul", { className: "list-none m-0 px-0 divide-y ", children: e.sort((o, s) => o.required === s.required ? 0 : o.required ? -1 : 1).map((o) => /* @__PURE__ */ d.jsx(
133
- so,
134
- {
135
- parameter: o,
136
- id: r,
137
- group: t
138
- },
139
- `${o.name}-${o.in}`
140
- )) }) })
141
- ] });
142
- var ir = (t, e) => {
143
- const r = t[e.name];
144
- return r === void 0 ? (t[e.name] = e.value, t) : Array.isArray(r) ? (r.push(e.value), t) : (t[e.name] = [r, e.value], t);
145
- }, sr = "", lr = `
146
- `, C = class {
147
- /**
148
- * Helper object to format and aggragate lines of code.
149
- * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
150
- */
151
- constructor({ indent: t, join: e } = {}) {
152
- this.postProcessors = [], this.code = [], this.indentationCharacter = sr, this.lineJoin = lr, this.indentLine = (r, o = 0) => `${this.indentationCharacter.repeat(o)}${r}`, this.unshift = (r, o) => {
153
- const s = this.indentLine(r, o);
154
- this.code.unshift(s);
155
- }, this.push = (r, o) => {
156
- const s = this.indentLine(r, o);
157
- this.code.push(s);
158
- }, this.blank = () => {
159
- this.code.push("");
160
- }, this.join = () => {
161
- const r = this.code.join(this.lineJoin);
162
- return this.postProcessors.reduce((s, a) => a(s), r);
163
- }, this.addPostProcessor = (r) => {
164
- this.postProcessors = [...this.postProcessors, r];
165
- }, this.indentationCharacter = t || sr, this.lineJoin = e ?? lr;
166
- }
167
- }, co = function(t) {
168
- return Object.prototype.toString.call(t) === "[object RegExp]";
169
- }, uo = function(t) {
170
- var e = typeof t;
171
- return t !== null && (e === "object" || e === "function");
172
- }, Wt = {};
173
- Object.defineProperty(Wt, "__esModule", { value: !0 });
174
- Wt.default = (t) => Object.getOwnPropertySymbols(t).filter((e) => Object.prototype.propertyIsEnumerable.call(t, e));
175
- const po = co, fo = uo, ho = Wt.default;
176
- var yo = (t, e, r) => {
177
- const o = [];
178
- return function s(a, n, i) {
179
- n = n || {}, n.indent = n.indent || " ", i = i || "";
180
- let l;
181
- n.inlineCharacterLimit === void 0 ? l = {
182
- newLine: `
183
- `,
184
- newLineOrSpace: `
185
- `,
186
- pad: i,
187
- indent: i + n.indent
188
- } : l = {
189
- newLine: "@@__STRINGIFY_OBJECT_NEW_LINE__@@",
190
- newLineOrSpace: "@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@",
191
- pad: "@@__STRINGIFY_OBJECT_PAD__@@",
192
- indent: "@@__STRINGIFY_OBJECT_INDENT__@@"
193
- };
194
- const c = (u) => {
195
- if (n.inlineCharacterLimit === void 0)
196
- return u;
197
- const f = u.replace(new RegExp(l.newLine, "g"), "").replace(new RegExp(l.newLineOrSpace, "g"), " ").replace(new RegExp(l.pad + "|" + l.indent, "g"), "");
198
- return f.length <= n.inlineCharacterLimit ? f : u.replace(new RegExp(l.newLine + "|" + l.newLineOrSpace, "g"), `
199
- `).replace(new RegExp(l.pad, "g"), i).replace(new RegExp(l.indent, "g"), i + n.indent);
200
- };
201
- if (o.indexOf(a) !== -1)
202
- return '"[Circular]"';
203
- if (a == null || typeof a == "number" || typeof a == "boolean" || typeof a == "function" || typeof a == "symbol" || po(a))
204
- return String(a);
205
- if (a instanceof Date)
206
- return `new Date('${a.toISOString()}')`;
207
- if (Array.isArray(a)) {
208
- if (a.length === 0)
209
- return "[]";
210
- o.push(a);
211
- const u = "[" + l.newLine + a.map((f, p) => {
212
- const h = a.length - 1 === p ? l.newLine : "," + l.newLineOrSpace;
213
- let y = s(f, n, i + n.indent);
214
- return n.transform && (y = n.transform(a, p, y)), l.indent + y + h;
215
- }).join("") + l.pad + "]";
216
- return o.pop(), c(u);
217
- }
218
- if (fo(a)) {
219
- let u = Object.keys(a).concat(ho(a));
220
- if (n.filter && (u = u.filter((p) => n.filter(a, p))), u.length === 0)
221
- return "{}";
222
- o.push(a);
223
- const f = "{" + l.newLine + u.map((p, h) => {
224
- const y = u.length - 1 === h ? l.newLine : "," + l.newLineOrSpace, g = typeof p == "symbol", b = !g && /^[a-z$_][a-z$_0-9]*$/i.test(p), x = g || b ? p : s(p, n);
225
- let m = s(a[p], n, i + n.indent);
226
- return n.transform && (m = n.transform(a, p, m)), l.indent + String(x) + ": " + m + y;
227
- }).join("") + l.pad + "}";
228
- return o.pop(), c(f);
229
- }
230
- return a = String(a).replace(/[\r\n]/g, (u) => u === `
231
- ` ? "\\n" : "\\r"), n.singleQuotes === !1 ? (a = a.replace(/"/g, '\\"'), `"${a}"`) : (a = a.replace(/\\?'/g, "\\'"), `'${a}'`);
232
- }(t, e, r);
233
- };
234
- const z = /* @__PURE__ */ Xn(yo);
235
- function We(t, e = {}) {
236
- const { delimiter: r = '"', escapeChar: o = "\\", escapeNewlines: s = !0 } = e;
237
- return [...t.toString()].map((n) => n === "\b" ? `${o}b` : n === " " ? `${o}t` : n === `
238
- ` ? s ? `${o}n` : n : n === "\f" ? `${o}f` : n === "\r" ? s ? `${o}r` : n : n === o ? o + o : n === r ? o + r : n < " " || n > "~" ? JSON.stringify(n).slice(1, -1) : n).join("");
239
- }
240
- var Je = (t) => We(t, { delimiter: "'" }), H = (t) => We(t, { delimiter: '"' }), mo = {
241
- info: {
242
- key: "libcurl",
243
- title: "Libcurl",
244
- link: "http://curl.haxx.se/libcurl",
245
- description: "Simple REST and HTTP API Client for C",
246
- extname: ".c"
247
- },
248
- convert: ({ method: t, fullUrl: e, headersObj: r, allHeaders: o, postData: s }) => {
249
- const { push: a, blank: n, join: i } = new C();
250
- a("CURL *hnd = curl_easy_init();"), n(), a(`curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "${t.toUpperCase()}");`), a("curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);"), a(`curl_easy_setopt(hnd, CURLOPT_URL, "${e}");`);
251
- const l = Object.keys(r);
252
- return l.length && (n(), a("struct curl_slist *headers = NULL;"), l.forEach((c) => {
253
- a(`headers = curl_slist_append(headers, "${c}: ${H(r[c])}");`);
254
- }), a("curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);")), o.cookie && (n(), a(`curl_easy_setopt(hnd, CURLOPT_COOKIE, "${o.cookie}");`)), s.text && (n(), a(`curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ${JSON.stringify(s.text)});`)), n(), a("CURLcode ret = curl_easy_perform(hnd);"), i();
255
- }
256
- }, go = {
257
- info: {
258
- key: "c",
259
- title: "C",
260
- default: "libcurl",
261
- cli: "c"
262
- },
263
- clientsById: {
264
- libcurl: mo
265
- }
266
- }, J = (t, e) => Object.keys(t).find((r) => r.toLowerCase() === e.toLowerCase()), ue = (t, e) => {
267
- const r = J(t, e);
268
- if (r)
269
- return t[r];
270
- }, pt = (t, e) => !!J(t, e), bo = (t) => ["application/json", "application/x-json", "text/json", "text/x-json", "+json"].some(
271
- (e) => t.indexOf(e) > -1
272
- ), cr = class {
273
- constructor(t) {
274
- this.name = "", this.toString = () => `:${this.name}`, this.name = t;
275
- }
276
- }, vo = class {
277
- constructor(t) {
278
- this.path = "", this.toString = () => `(clojure.java.io/file "${this.path}")`, this.path = t;
279
- }
280
- }, en = (t) => t === void 0 ? null : t === null ? "null" : t.constructor.name.toLowerCase(), tn = (t) => t === void 0 ? !0 : en(t) === "object" ? Object.keys(t).length === 0 : !1, ur = (t) => (Object.keys(t).filter((e) => tn(t[e])).forEach((e) => {
281
- delete t[e];
282
- }), t), et = (t, e) => {
283
- const r = " ".repeat(t);
284
- return e.replace(/\n/g, `
285
- ${r}`);
286
- }, Ct = (t) => {
287
- switch (en(t)) {
288
- case "string":
289
- return `"${t.replace(/"/g, '\\"')}"`;
290
- case "file":
291
- return t.toString();
292
- case "keyword":
293
- return t.toString();
294
- case "null":
295
- return "nil";
296
- case "regexp":
297
- return `#"${t.source}"`;
298
- case "object": {
299
- const e = Object.keys(t).reduce((r, o) => {
300
- const s = et(o.length + 2, Ct(t[o]));
301
- return `${r}:${o} ${s}
302
- `;
303
- }, "").trim();
304
- return `{${et(1, e)}}`;
305
- }
306
- case "array": {
307
- const e = t.reduce((r, o) => `${r} ${Ct(o)}`, "").trim();
308
- return `[${et(1, e)}]`;
309
- }
310
- default:
311
- return t.toString();
312
- }
313
- }, xo = {
314
- info: {
315
- key: "clj_http",
316
- title: "clj-http",
317
- link: "https://github.com/dakrone/clj-http",
318
- description: "An idiomatic clojure http client wrapping the apache client.",
319
- extname: ".clj"
320
- },
321
- convert: ({ queryObj: t, method: e, postData: r, url: o, allHeaders: s }, a) => {
322
- const { push: n, join: i } = new C({ indent: a == null ? void 0 : a.indent }), l = ["get", "post", "put", "delete", "patch", "head", "options"];
323
- if (e = e.toLowerCase(), !l.includes(e))
324
- return n("Method not supported"), i();
325
- const c = {
326
- headers: s,
327
- "query-params": t
328
- };
329
- switch (r.mimeType) {
330
- case "application/json":
331
- {
332
- c["content-type"] = new cr("json"), c["form-params"] = r.jsonObj;
333
- const u = J(c.headers, "content-type");
334
- u && delete c.headers[u];
335
- }
336
- break;
337
- case "application/x-www-form-urlencoded":
338
- {
339
- c["form-params"] = r.paramsObj;
340
- const u = J(c.headers, "content-type");
341
- u && delete c.headers[u];
342
- }
343
- break;
344
- case "text/plain":
345
- {
346
- c.body = r.text;
347
- const u = J(c.headers, "content-type");
348
- u && delete c.headers[u];
349
- }
350
- break;
351
- case "multipart/form-data": {
352
- if (r.params) {
353
- c.multipart = r.params.map((f) => f.fileName && !f.value ? {
354
- name: f.name,
355
- content: new vo(f.fileName)
356
- } : {
357
- name: f.name,
358
- content: f.value
359
- });
360
- const u = J(c.headers, "content-type");
361
- u && delete c.headers[u];
362
- }
363
- break;
364
- }
365
- }
366
- switch (ue(c.headers, "accept")) {
367
- case "application/json":
368
- {
369
- c.accept = new cr("json");
370
- const u = J(c.headers, "accept");
371
- u && delete c.headers[u];
372
- }
373
- break;
374
- }
375
- if (n(`(require '[clj-http.client :as client])
376
- `), tn(ur(c)))
377
- n(`(client/${e} "${o}")`);
378
- else {
379
- const u = 11 + e.length + o.length, f = et(u, Ct(ur(c)));
380
- n(`(client/${e} "${o}" ${f})`);
381
- }
382
- return i();
383
- }
384
- }, $o = {
385
- info: {
386
- key: "clojure",
387
- title: "Clojure",
388
- default: "clj_http"
389
- },
390
- clientsById: {
391
- clj_http: xo
392
- }
393
- }, jo = (t) => {
394
- let e = ue(t, "accept-encoding");
395
- if (!e)
396
- return [];
397
- const r = {
398
- gzip: "DecompressionMethods.GZip",
399
- deflate: "DecompressionMethods.Deflate"
400
- }, o = [];
401
- return typeof e == "string" && (e = [e]), e.forEach((s) => {
402
- s.split(",").forEach((a) => {
403
- const n = /\s*([^;\s]+)/.exec(a);
404
- if (n) {
405
- const i = r[n[1]];
406
- i && o.push(i);
407
- }
408
- });
409
- }), o;
410
- }, wo = {
411
- info: {
412
- key: "httpclient",
413
- title: "HttpClient",
414
- link: "https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient",
415
- description: ".NET Standard HTTP Client",
416
- extname: ".cs"
417
- },
418
- convert: ({ allHeaders: t, postData: e, method: r, fullUrl: o }, s) => {
419
- var h, y;
420
- const a = {
421
- indent: " ",
422
- ...s
423
- }, { push: n, join: i } = new C({ indent: a.indent });
424
- n("using System.Net.Http.Headers;");
425
- let l = "";
426
- const c = !!t.cookie, u = jo(t);
427
- (c || u.length) && (l = "clientHandler", n("var clientHandler = new HttpClientHandler"), n("{"), c && n("UseCookies = false,", 1), u.length && n(`AutomaticDecompression = ${u.join(" | ")},`, 1), n("};")), n(`var client = new HttpClient(${l});`), n("var request = new HttpRequestMessage"), n("{");
428
- const f = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE"];
429
- r = r.toUpperCase(), r && f.includes(r) ? r = `HttpMethod.${r[0]}${r.substring(1).toLowerCase()}` : r = `new HttpMethod("${r}")`, n(`Method = ${r},`, 1), n(`RequestUri = new Uri("${o}"),`, 1);
430
- const p = Object.keys(t).filter((g) => {
431
- switch (g.toLowerCase()) {
432
- case "content-type":
433
- case "content-length":
434
- case "accept-encoding":
435
- return !1;
436
- default:
437
- return !0;
438
- }
439
- });
440
- if (p.length && (n("Headers =", 1), n("{", 1), p.forEach((g) => {
441
- n(`{ "${g}", "${H(t[g])}" },`, 2);
442
- }), n("},", 1)), e.text) {
443
- const g = e.mimeType;
444
- switch (g) {
445
- case "application/x-www-form-urlencoded":
446
- n("Content = new FormUrlEncodedContent(new Dictionary<string, string>", 1), n("{", 1), (h = e.params) == null || h.forEach((b) => {
447
- n(`{ "${b.name}", "${b.value}" },`, 2);
448
- }), n("}),", 1);
449
- break;
450
- case "multipart/form-data":
451
- n("Content = new MultipartFormDataContent", 1), n("{", 1), (y = e.params) == null || y.forEach((b) => {
452
- n(`new StringContent(${JSON.stringify(b.value || "")})`, 2), n("{", 2), n("Headers =", 3), n("{", 3), b.contentType && n(`ContentType = new MediaTypeHeaderValue("${b.contentType}"),`, 4), n('ContentDisposition = new ContentDispositionHeaderValue("form-data")', 4), n("{", 4), n(`Name = "${b.name}",`, 5), b.fileName && n(`FileName = "${b.fileName}",`, 5), n("}", 4), n("}", 3), n("},", 2);
453
- }), n("},", 1);
454
- break;
455
- default:
456
- n(`Content = new StringContent(${JSON.stringify(e.text || "")})`, 1), n("{", 1), n("Headers =", 2), n("{", 2), n(`ContentType = new MediaTypeHeaderValue("${g}")`, 3), n("}", 2), n("}", 1);
457
- break;
458
- }
459
- }
460
- return n("};"), n("using (var response = await client.SendAsync(request))"), n("{"), n("response.EnsureSuccessStatusCode();", 1), n("var body = await response.Content.ReadAsStringAsync();", 1), n("Console.WriteLine(body);", 1), n("}"), i();
461
- }
462
- };
463
- function So(t) {
464
- return t[0].toUpperCase() + t.slice(1).toLowerCase();
465
- }
466
- var Oo = {
467
- info: {
468
- key: "restsharp",
469
- title: "RestSharp",
470
- link: "http://restsharp.org/",
471
- description: "Simple REST and HTTP API Client for .NET",
472
- extname: ".cs",
473
- installation: "dotnet add package RestSharp"
474
- },
475
- convert: ({ method: t, fullUrl: e, headersObj: r, cookies: o, postData: s, uriObj: a }) => {
476
- const { push: n, join: i } = new C();
477
- if (!["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"].includes(
478
- t.toUpperCase()
479
- ))
480
- return "Method not supported";
481
- n(`using RestSharp;
482
-
483
- `), n(`var options = new RestClientOptions("${e}");`), n("var client = new RestClient(options);"), n('var request = new RestRequest("");');
484
- const c = s.mimeType && s.mimeType === "multipart/form-data";
485
- switch (c && n("request.AlwaysMultipartFormData = true;"), Object.keys(r).forEach((u) => {
486
- if (s.mimeType && u.toLowerCase() === "content-type" && s.text) {
487
- c && s.boundary && n(`request.FormBoundary = "${s.boundary}";`);
488
- return;
489
- }
490
- n(`request.AddHeader("${u}", "${H(r[u])}");`);
491
- }), o.forEach(({ name: u, value: f }) => {
492
- n(`request.AddCookie("${u}", "${H(f)}", "${a.pathname}", "${a.host}");`);
493
- }), s.mimeType) {
494
- case "multipart/form-data":
495
- if (!s.params) break;
496
- s.params.forEach((u) => {
497
- u.fileName ? n(`request.AddFile("${u.name}", "${u.fileName}");`) : n(`request.AddParameter("${u.name}", "${u.value}");`);
498
- });
499
- break;
500
- case "application/x-www-form-urlencoded":
501
- if (!s.params) break;
502
- s.params.forEach((u) => {
503
- n(`request.AddParameter("${u.name}", "${u.value}");`);
504
- });
505
- break;
506
- case "application/json": {
507
- if (!s.text) break;
508
- const u = JSON.stringify(s.text);
509
- n(`request.AddJsonBody(${u}, false);`);
510
- break;
511
- }
512
- default:
513
- if (!s.text) break;
514
- n(`request.AddStringBody("${s.text}", "${s.mimeType}");`);
515
- }
516
- return n(`var response = await client.${So(t)}Async(request);
517
- `), n(`Console.WriteLine("{0}", response.Content);
518
- `), i();
519
- }
520
- }, To = {
521
- info: {
522
- key: "csharp",
523
- title: "C#",
524
- default: "restsharp",
525
- cli: "dotnet"
526
- },
527
- clientsById: {
528
- httpclient: wo,
529
- restsharp: Oo
530
- }
531
- }, Co = {
532
- info: {
533
- key: "native",
534
- title: "NewRequest",
535
- link: "http://golang.org/pkg/net/http/#NewRequest",
536
- description: "Golang HTTP client request",
537
- extname: ".go"
538
- },
539
- convert: ({ postData: t, method: e, allHeaders: r, fullUrl: o }, s = {}) => {
540
- const { blank: a, push: n, join: i } = new C({ indent: " " }), { showBoilerplate: l = !0, checkErrors: c = !1, printBody: u = !0, timeout: f = -1 } = s, p = c ? "err" : "_", h = l ? 1 : 0, y = () => {
541
- c && (n("if err != nil {", h), n("panic(err)", h + 1), n("}", h));
542
- };
543
- l && (n("package main"), a(), n("import ("), n('"fmt"', h), f > 0 && n('"time"', h), t.text && n('"strings"', h), n('"net/http"', h), u && n('"io"', h), n(")"), a(), n("func main() {"), a());
544
- const g = f > 0, b = g, x = b ? "client" : "http.DefaultClient";
545
- return b && (n("client := http.Client{", h), g && n(`Timeout: time.Duration(${f} * time.Second),`, h + 1), n("}", h), a()), n(`url := "${o}"`, h), a(), t.text ? (n(`payload := strings.NewReader(${JSON.stringify(t.text)})`, h), a(), n(`req, ${p} := http.NewRequest("${e}", url, payload)`, h), a()) : (n(`req, ${p} := http.NewRequest("${e}", url, nil)`, h), a()), y(), Object.keys(r).length && (Object.keys(r).forEach((m) => {
546
- n(`req.Header.Add("${m}", "${H(r[m])}")`, h);
547
- }), a()), n(`res, ${p} := ${x}.Do(req)`, h), y(), u && (a(), n("defer res.Body.Close()", h), n(`body, ${p} := io.ReadAll(res.Body)`, h), y()), a(), u && n("fmt.Println(string(body))", h), l && (a(), n("}")), i();
548
- }
549
- }, Po = {
550
- info: {
551
- key: "go",
552
- title: "Go",
553
- default: "native",
554
- cli: "go"
555
- },
556
- clientsById: {
557
- native: Co
558
- }
559
- }, pr = `\r
560
- `, ko = {
561
- info: {
562
- key: "http1.1",
563
- title: "HTTP/1.1",
564
- link: "https://tools.ietf.org/html/rfc7230",
565
- description: "HTTP/1.1 request string in accordance with RFC 7230",
566
- extname: null
567
- },
568
- convert: ({ method: t, fullUrl: e, uriObj: r, httpVersion: o, allHeaders: s, postData: a }, n) => {
569
- const i = {
570
- absoluteURI: !1,
571
- autoContentLength: !0,
572
- autoHost: !0,
573
- ...n
574
- }, { blank: l, push: c, join: u } = new C({ indent: "", join: pr }), f = i.absoluteURI ? e : r.path;
575
- c(`${t} ${f} ${o}`);
576
- const p = Object.keys(s);
577
- if (p.forEach((g) => {
578
- const b = g.toLowerCase().replace(/(^|-)(\w)/g, (x) => x.toUpperCase());
579
- c(`${b}: ${s[g]}`);
580
- }), i.autoHost && !p.includes("host") && c(`Host: ${r.host}`), i.autoContentLength && a.text && !p.includes("content-length")) {
581
- const b = new TextEncoder().encode(a.text).length.toString();
582
- c(`Content-Length: ${b}`);
583
- }
584
- l();
585
- const h = u(), y = a.text || "";
586
- return `${h}${pr}${y}`;
587
- }
588
- }, Eo = {
589
- info: {
590
- key: "http",
591
- title: "HTTP",
592
- default: "http1.1"
593
- },
594
- clientsById: {
595
- "http1.1": ko
596
- }
597
- }, No = {
598
- info: {
599
- key: "asynchttp",
600
- title: "AsyncHttp",
601
- link: "https://github.com/AsyncHttpClient/async-http-client",
602
- description: "Asynchronous Http and WebSocket Client library for Java",
603
- extname: ".java"
604
- },
605
- convert: ({ method: t, allHeaders: e, postData: r, fullUrl: o }, s) => {
606
- const a = {
607
- indent: " ",
608
- ...s
609
- }, { blank: n, push: i, join: l } = new C({ indent: a.indent });
610
- return i("AsyncHttpClient client = new DefaultAsyncHttpClient();"), i(`client.prepare("${t.toUpperCase()}", "${o}")`), Object.keys(e).forEach((c) => {
611
- i(`.setHeader("${c}", "${H(e[c])}")`, 1);
612
- }), r.text && i(`.setBody(${JSON.stringify(r.text)})`, 1), i(".execute()", 1), i(".toCompletableFuture()", 1), i(".thenAccept(System.out::println)", 1), i(".join();", 1), n(), i("client.close();"), l();
613
- }
614
- }, Ro = {
615
- info: {
616
- key: "nethttp",
617
- title: "java.net.http",
618
- link: "https://openjdk.java.net/groups/net/httpclient/intro.html",
619
- description: "Java Standardized HTTP Client API",
620
- extname: ".java"
621
- },
622
- convert: ({ allHeaders: t, fullUrl: e, method: r, postData: o }, s) => {
623
- const a = {
624
- indent: " ",
625
- ...s
626
- }, { push: n, join: i } = new C({ indent: a.indent });
627
- return n("HttpRequest request = HttpRequest.newBuilder()"), n(`.uri(URI.create("${e}"))`, 2), Object.keys(t).forEach((l) => {
628
- n(`.header("${l}", "${H(t[l])}")`, 2);
629
- }), o.text ? n(
630
- `.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.ofString(${JSON.stringify(o.text)}))`,
631
- 2
632
- ) : n(`.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.noBody())`, 2), n(".build();", 2), n(
633
- "HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());"
634
- ), n("System.out.println(response.body());"), i();
635
- }
636
- }, Ao = {
637
- info: {
638
- key: "okhttp",
639
- title: "OkHttp",
640
- link: "http://square.github.io/okhttp/",
641
- description: "An HTTP Request Client Library",
642
- extname: ".java"
643
- },
644
- convert: ({ postData: t, method: e, fullUrl: r, allHeaders: o }, s) => {
645
- const a = {
646
- indent: " ",
647
- ...s
648
- }, { push: n, blank: i, join: l } = new C({ indent: a.indent }), c = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"], u = ["POST", "PUT", "DELETE", "PATCH"];
649
- return n("OkHttpClient client = new OkHttpClient();"), i(), t.text && (t.boundary ? n(`MediaType mediaType = MediaType.parse("${t.mimeType}; boundary=${t.boundary}");`) : n(`MediaType mediaType = MediaType.parse("${t.mimeType}");`), n(`RequestBody body = RequestBody.create(mediaType, ${JSON.stringify(t.text)});`)), n("Request request = new Request.Builder()"), n(`.url("${r}")`, 1), c.includes(e.toUpperCase()) ? u.includes(e.toUpperCase()) ? t.text ? n(`.${e.toLowerCase()}(body)`, 1) : n(`.${e.toLowerCase()}(null)`, 1) : n(`.${e.toLowerCase()}()`, 1) : t.text ? n(`.method("${e.toUpperCase()}", body)`, 1) : n(`.method("${e.toUpperCase()}", null)`, 1), Object.keys(o).forEach((f) => {
650
- n(`.addHeader("${f}", "${H(o[f])}")`, 1);
651
- }), n(".build();", 1), i(), n("Response response = client.newCall(request).execute();"), l();
652
- }
653
- }, qo = {
654
- info: {
655
- key: "unirest",
656
- title: "Unirest",
657
- link: "http://unirest.io/java.html",
658
- description: "Lightweight HTTP Request Client Library",
659
- extname: ".java"
660
- },
661
- convert: ({ method: t, allHeaders: e, postData: r, fullUrl: o }, s) => {
662
- const a = {
663
- indent: " ",
664
- ...s
665
- }, { join: n, push: i } = new C({ indent: a.indent });
666
- return ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"].includes(t.toUpperCase()) ? i(`HttpResponse<String> response = Unirest.${t.toLowerCase()}("${o}")`) : i(`HttpResponse<String> response = Unirest.customMethod("${t.toUpperCase()}","${o}")`), Object.keys(e).forEach((c) => {
667
- i(`.header("${c}", "${H(e[c])}")`, 1);
668
- }), r.text && i(`.body(${JSON.stringify(r.text)})`, 1), i(".asString();", 1), n();
669
- }
670
- }, Io = {
671
- info: {
672
- key: "java",
673
- title: "Java",
674
- default: "unirest"
675
- },
676
- clientsById: {
677
- asynchttp: No,
678
- nethttp: Ro,
679
- okhttp: Ao,
680
- unirest: qo
681
- }
682
- }, Lo = {
683
- info: {
684
- key: "axios",
685
- title: "Axios",
686
- link: "https://github.com/axios/axios",
687
- description: "Promise based HTTP client for the browser and node.js",
688
- extname: ".js",
689
- installation: "npm install axios --save"
690
- },
691
- convert: ({ allHeaders: t, method: e, url: r, queryObj: o, postData: s }, a) => {
692
- const n = {
693
- indent: " ",
694
- ...a
695
- }, { blank: i, push: l, join: c, addPostProcessor: u } = new C({ indent: n.indent });
696
- l("import axios from 'axios';"), i();
697
- const f = {
698
- method: e,
699
- url: r
700
- };
701
- switch (Object.keys(o).length && (f.params = o), Object.keys(t).length && (f.headers = t), s.mimeType) {
702
- case "application/x-www-form-urlencoded":
703
- s.params && (l("const encodedParams = new URLSearchParams();"), s.params.forEach((h) => {
704
- l(`encodedParams.set('${h.name}', '${h.value}');`);
705
- }), i(), f.data = "encodedParams,", u((h) => h.replace(/'encodedParams,'/, "encodedParams,")));
706
- break;
707
- case "application/json":
708
- s.jsonObj && (f.data = s.jsonObj);
709
- break;
710
- case "multipart/form-data":
711
- if (!s.params)
712
- break;
713
- l("const form = new FormData();"), s.params.forEach((h) => {
714
- l(`form.append('${h.name}', '${h.value || h.fileName || ""}');`);
715
- }), i(), f.data = "[form]";
716
- break;
717
- default:
718
- s.text && (f.data = s.text);
719
- }
720
- const p = z(f, {
721
- indent: " ",
722
- inlineCharacterLimit: 80
723
- }).replace('"[form]"', "form");
724
- return l(`const options = ${p};`), i(), l("axios"), l(".request(options)", 1), l(".then(function (response) {", 1), l("console.log(response.data);", 2), l("})", 1), l(".catch(function (error) {", 1), l("console.error(error);", 2), l("});", 1), c();
725
- }
726
- }, Uo = {
727
- info: {
728
- key: "fetch",
729
- title: "fetch",
730
- link: "https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch",
731
- description: "Perform asynchronous HTTP requests with the Fetch API",
732
- extname: ".js"
733
- },
734
- convert: ({ method: t, allHeaders: e, postData: r, fullUrl: o }, s) => {
735
- const a = {
736
- indent: " ",
737
- credentials: null,
738
- ...s
739
- }, { blank: n, join: i, push: l } = new C({ indent: a.indent }), c = {
740
- method: t
741
- };
742
- switch (Object.keys(e).length && (c.headers = e), a.credentials !== null && (c.credentials = a.credentials), r.mimeType) {
743
- case "application/x-www-form-urlencoded":
744
- c.body = r.paramsObj ? r.paramsObj : r.text;
745
- break;
746
- case "application/json":
747
- r.jsonObj && (c.body = r.jsonObj);
748
- break;
749
- case "multipart/form-data":
750
- if (!r.params)
751
- break;
752
- const u = J(e, "content-type");
753
- u && delete e[u], l("const form = new FormData();"), r.params.forEach((f) => {
754
- l(`form.append('${f.name}', '${f.value || f.fileName || ""}');`);
755
- }), n();
756
- break;
757
- default:
758
- r.text && (c.body = r.text);
759
- }
760
- return c.headers && !Object.keys(c.headers).length && delete c.headers, l(
761
- `const options = ${z(c, {
762
- indent: a.indent,
763
- inlineCharacterLimit: 80,
764
- // The Fetch API body only accepts string parameters, but stringified JSON can be difficult
765
- // to read, so we keep the object as a literal and use this transform function to wrap the
766
- // literal in a `JSON.stringify` call.
767
- transform: (u, f, p) => {
768
- if (f === "body") {
769
- if (r.mimeType === "application/x-www-form-urlencoded")
770
- return `new URLSearchParams(${p})`;
771
- if (r.mimeType === "application/json")
772
- return `JSON.stringify(${p})`;
773
- }
774
- return p;
775
- }
776
- })};`
777
- ), n(), r.params && r.mimeType === "multipart/form-data" && (l("options.body = form;"), n()), l(`fetch('${o}', options)`), l(".then(response => response.json())", 1), l(".then(response => console.log(response))", 1), l(".catch(err => console.error(err));", 1), i();
778
- }
779
- }, Fo = {
780
- info: {
781
- key: "jquery",
782
- title: "jQuery",
783
- link: "http://api.jquery.com/jquery.ajax/",
784
- description: "Perform an asynchronous HTTP (Ajax) requests with jQuery",
785
- extname: ".js"
786
- },
787
- convert: ({ fullUrl: t, method: e, allHeaders: r, postData: o }, s) => {
788
- var f;
789
- const a = {
790
- indent: " ",
791
- ...s
792
- }, { blank: n, push: i, join: l } = new C({ indent: a.indent }), c = {
793
- async: !0,
794
- crossDomain: !0,
795
- url: t,
796
- method: e,
797
- headers: r
798
- };
799
- switch (o.mimeType) {
800
- case "application/x-www-form-urlencoded":
801
- c.data = o.paramsObj ? o.paramsObj : o.text;
802
- break;
803
- case "application/json":
804
- c.processData = !1, c.data = o.text;
805
- break;
806
- case "multipart/form-data":
807
- if (!o.params)
808
- break;
809
- if (i("const form = new FormData();"), o.params.forEach((p) => {
810
- i(`form.append('${p.name}', '${p.value || p.fileName || ""}');`);
811
- }), c.processData = !1, c.contentType = !1, c.mimeType = "multipart/form-data", c.data = "[form]", pt(r, "content-type") && (f = ue(r, "content-type")) != null && f.includes("boundary")) {
812
- const p = J(r, "content-type");
813
- p && delete c.headers[p];
814
- }
815
- n();
816
- break;
817
- default:
818
- o.text && (c.data = o.text);
819
- }
820
- const u = z(c, { indent: a.indent }).replace("'[form]'", "form");
821
- return i(`const settings = ${u};`), n(), i("$.ajax(settings).done(function (response) {"), i("console.log(response);", 1), i("});"), l();
822
- }
823
- }, _o = {
824
- info: {
825
- key: "xhr",
826
- title: "XMLHttpRequest",
827
- link: "https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest",
828
- description: "W3C Standard API that provides scripted client functionality",
829
- extname: ".js"
830
- },
831
- convert: ({ postData: t, allHeaders: e, method: r, fullUrl: o }, s) => {
832
- var c;
833
- const a = {
834
- indent: " ",
835
- cors: !0,
836
- ...s
837
- }, { blank: n, push: i, join: l } = new C({ indent: a.indent });
838
- switch (t.mimeType) {
839
- case "application/json":
840
- i(
841
- `const data = JSON.stringify(${z(t.jsonObj, {
842
- indent: a.indent
843
- })});`
844
- ), n();
845
- break;
846
- case "multipart/form-data":
847
- if (!t.params)
848
- break;
849
- if (i("const data = new FormData();"), t.params.forEach((u) => {
850
- i(`data.append('${u.name}', '${u.value || u.fileName || ""}');`);
851
- }), pt(e, "content-type") && (c = ue(e, "content-type")) != null && c.includes("boundary")) {
852
- const u = J(e, "content-type");
853
- u && delete e[u];
854
- }
855
- n();
856
- break;
857
- default:
858
- i(`const data = ${t.text ? `'${t.text}'` : "null"};`), n();
859
- }
860
- return i("const xhr = new XMLHttpRequest();"), a.cors && i("xhr.withCredentials = true;"), n(), i("xhr.addEventListener('readystatechange', function () {"), i("if (this.readyState === this.DONE) {", 1), i("console.log(this.responseText);", 2), i("}", 1), i("});"), n(), i(`xhr.open('${r}', '${o}');`), Object.keys(e).forEach((u) => {
861
- i(`xhr.setRequestHeader('${u}', '${Je(e[u])}');`);
862
- }), n(), i("xhr.send(data);"), l();
863
- }
864
- }, Ho = {
865
- info: {
866
- key: "javascript",
867
- title: "JavaScript",
868
- default: "xhr"
869
- },
870
- clientsById: {
871
- xhr: _o,
872
- axios: Lo,
873
- fetch: Uo,
874
- jquery: Fo
875
- }
876
- }, Bo = {
877
- info: {
878
- key: "native",
879
- title: "Native JSON",
880
- link: "https://www.json.org/json-en.html",
881
- description: "A JSON represetation of any HAR payload.",
882
- extname: ".json"
883
- },
884
- convert: ({ postData: t }, e) => {
885
- const r = {
886
- indent: " ",
887
- ...e
888
- };
889
- let o = "";
890
- switch (t.mimeType) {
891
- case "application/x-www-form-urlencoded":
892
- o = t.paramsObj ? t.paramsObj : t.text;
893
- break;
894
- case "application/json":
895
- t.jsonObj && (o = t.jsonObj);
896
- break;
897
- case "multipart/form-data":
898
- if (!t.params)
899
- break;
900
- const s = {};
901
- t.params.forEach((a) => {
902
- s[a.name] = a.value;
903
- }), o = s;
904
- break;
905
- default:
906
- t.text && (o = t.text);
907
- }
908
- return typeof o > "u" || o === "" ? "No JSON body" : JSON.stringify(o, null, r.indent);
909
- }
910
- }, Mo = {
911
- info: {
912
- key: "json",
913
- title: "JSON",
914
- default: "native"
915
- },
916
- clientsById: {
917
- native: Bo
918
- }
919
- }, zo = {
920
- info: {
921
- key: "okhttp",
922
- title: "OkHttp",
923
- link: "http://square.github.io/okhttp/",
924
- description: "An HTTP Request Client Library",
925
- extname: ".kt"
926
- },
927
- convert: ({ postData: t, fullUrl: e, method: r, allHeaders: o }, s) => {
928
- const a = {
929
- indent: " ",
930
- ...s
931
- }, { blank: n, join: i, push: l } = new C({ indent: a.indent }), c = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"], u = ["POST", "PUT", "DELETE", "PATCH"];
932
- return l("val client = OkHttpClient()"), n(), t.text && (t.boundary ? l(`val mediaType = MediaType.parse("${t.mimeType}; boundary=${t.boundary}")`) : l(`val mediaType = MediaType.parse("${t.mimeType}")`), l(`val body = RequestBody.create(mediaType, ${JSON.stringify(t.text)})`)), l("val request = Request.Builder()"), l(`.url("${e}")`, 1), c.includes(r.toUpperCase()) ? u.includes(r.toUpperCase()) ? t.text ? l(`.${r.toLowerCase()}(body)`, 1) : l(`.${r.toLowerCase()}(null)`, 1) : l(`.${r.toLowerCase()}()`, 1) : t.text ? l(`.method("${r.toUpperCase()}", body)`, 1) : l(`.method("${r.toUpperCase()}", null)`, 1), Object.keys(o).forEach((f) => {
933
- l(`.addHeader("${f}", "${H(o[f])}")`, 1);
934
- }), l(".build()", 1), n(), l("val response = client.newCall(request).execute()"), i();
935
- }
936
- }, Wo = {
937
- info: {
938
- key: "kotlin",
939
- title: "Kotlin",
940
- default: "okhttp"
941
- },
942
- clientsById: {
943
- okhttp: zo
944
- }
945
- }, Jo = {
946
- info: {
947
- key: "axios",
948
- title: "Axios",
949
- link: "https://github.com/axios/axios",
950
- description: "Promise based HTTP client for the browser and node.js",
951
- extname: ".cjs",
952
- installation: "npm install axios --save"
953
- },
954
- convert: ({ method: t, fullUrl: e, allHeaders: r, postData: o }, s) => {
955
- const a = {
956
- indent: " ",
957
- ...s
958
- }, { blank: n, join: i, push: l, addPostProcessor: c } = new C({ indent: a.indent });
959
- l("const axios = require('axios');");
960
- const u = {
961
- method: t,
962
- url: e
963
- };
964
- switch (Object.keys(r).length && (u.headers = r), o.mimeType) {
965
- case "application/x-www-form-urlencoded":
966
- o.params && (l("const { URLSearchParams } = require('url');"), n(), l("const encodedParams = new URLSearchParams();"), o.params.forEach((p) => {
967
- l(`encodedParams.set('${p.name}', '${p.value}');`);
968
- }), n(), u.data = "encodedParams,", c((p) => p.replace(/'encodedParams,'/, "encodedParams,")));
969
- break;
970
- case "application/json":
971
- n(), o.jsonObj && (u.data = o.jsonObj);
972
- break;
973
- default:
974
- n(), o.text && (u.data = o.text);
975
- }
976
- const f = z(u, { indent: " ", inlineCharacterLimit: 80 });
977
- return l(`const options = ${f};`), n(), l("axios"), l(".request(options)", 1), l(".then(function (response) {", 1), l("console.log(response.data);", 2), l("})", 1), l(".catch(function (error) {", 1), l("console.error(error);", 2), l("});", 1), i();
978
- }
979
- }, Go = {
980
- info: {
981
- key: "fetch",
982
- title: "Fetch",
983
- link: "https://github.com/bitinn/node-fetch",
984
- description: "Simplified HTTP node-fetch client",
985
- extname: ".cjs",
986
- installation: "npm install node-fetch@2 --save"
987
- },
988
- convert: ({ method: t, fullUrl: e, postData: r, headersObj: o, cookies: s }, a) => {
989
- var g;
990
- const n = {
991
- indent: " ",
992
- ...a
993
- };
994
- let i = !1;
995
- const { blank: l, push: c, join: u, unshift: f } = new C({ indent: n.indent });
996
- c("const fetch = require('node-fetch');");
997
- const p = e, h = {
998
- method: t
999
- };
1000
- switch (Object.keys(o).length && (h.headers = o), r.mimeType) {
1001
- case "application/x-www-form-urlencoded":
1002
- f("const { URLSearchParams } = require('url');"), c("const encodedParams = new URLSearchParams();"), l(), (g = r.params) == null || g.forEach((x) => {
1003
- c(`encodedParams.set('${x.name}', '${x.value}');`);
1004
- }), h.body = "encodedParams";
1005
- break;
1006
- case "application/json":
1007
- r.jsonObj && (h.body = r.jsonObj);
1008
- break;
1009
- case "multipart/form-data":
1010
- if (!r.params)
1011
- break;
1012
- const b = J(o, "content-type");
1013
- b && delete o[b], f("const FormData = require('form-data');"), c("const formData = new FormData();"), l(), r.params.forEach((x) => {
1014
- if (!x.fileName && !x.fileName && !x.contentType) {
1015
- c(`formData.append('${x.name}', '${x.value}');`);
1016
- return;
1017
- }
1018
- x.fileName && (i = !0, c(`formData.append('${x.name}', fs.createReadStream('${x.fileName}'));`));
1019
- });
1020
- break;
1021
- default:
1022
- r.text && (h.body = r.text);
1023
- }
1024
- if (s.length) {
1025
- const b = s.map(({ name: x, value: m }) => `${encodeURIComponent(x)}=${encodeURIComponent(m)}`).join("; ");
1026
- h.headers || (h.headers = {}), h.headers.cookie = b;
1027
- }
1028
- l(), c(`const url = '${p}';`), h.headers && !Object.keys(h.headers).length && delete h.headers;
1029
- const y = z(h, {
1030
- indent: " ",
1031
- inlineCharacterLimit: 80,
1032
- // The Fetch API body only accepts string parameters, but stringified JSON can be difficult to
1033
- // read, so we keep the object as a literal and use this transform function to wrap the literal
1034
- // in a `JSON.stringify` call.
1035
- transform: (b, x, m) => x === "body" && r.mimeType === "application/json" ? `JSON.stringify(${m})` : m
1036
- });
1037
- return c(`const options = ${y};`), l(), i && f("const fs = require('fs');"), r.params && r.mimeType === "multipart/form-data" && (c("options.body = formData;"), l()), c("fetch(url, options)"), c(".then(res => res.json())", 1), c(".then(json => console.log(json))", 1), c(".catch(err => console.error('error:' + err));", 1), u().replace(/'encodedParams'/, "encodedParams").replace(/"fs\.createReadStream\(\\"(.+)\\"\)"/, 'fs.createReadStream("$1")');
1038
- }
1039
- }, Vo = {
1040
- info: {
1041
- key: "native",
1042
- title: "HTTP",
1043
- link: "http://nodejs.org/api/http.html#http_http_request_options_callback",
1044
- description: "Node.js native HTTP interface",
1045
- extname: ".cjs"
1046
- },
1047
- convert: ({ uriObj: t, method: e, allHeaders: r, postData: o }, s = {}) => {
1048
- var f;
1049
- const { indent: a = " " } = s, { blank: n, join: i, push: l, unshift: c } = new C({ indent: a }), u = {
1050
- method: e,
1051
- hostname: t.hostname,
1052
- port: t.port,
1053
- path: t.path,
1054
- headers: r
1055
- };
1056
- switch (l(`const http = require('${(f = t.protocol) == null ? void 0 : f.replace(":", "")}');`), n(), l(`const options = ${z(u, { indent: a })};`), n(), l("const req = http.request(options, function (res) {"), l("const chunks = [];", 1), n(), l("res.on('data', function (chunk) {", 1), l("chunks.push(chunk);", 2), l("});", 1), n(), l("res.on('end', function () {", 1), l("const body = Buffer.concat(chunks);", 2), l("console.log(body.toString());", 2), l("});", 1), l("});"), n(), o.mimeType) {
1057
- case "application/x-www-form-urlencoded":
1058
- o.paramsObj && (c("const qs = require('querystring');"), l(
1059
- `req.write(qs.stringify(${z(o.paramsObj, {
1060
- indent: " ",
1061
- inlineCharacterLimit: 80
1062
- })}));`
1063
- ));
1064
- break;
1065
- case "application/json":
1066
- o.jsonObj && l(
1067
- `req.write(JSON.stringify(${z(o.jsonObj, {
1068
- indent: " ",
1069
- inlineCharacterLimit: 80
1070
- })}));`
1071
- );
1072
- break;
1073
- default:
1074
- o.text && l(`req.write(${z(o.text, { indent: a })});`);
1075
- }
1076
- return l("req.end();"), i();
1077
- }
1078
- }, Qo = {
1079
- info: {
1080
- key: "request",
1081
- title: "Request",
1082
- link: "https://github.com/request/request",
1083
- description: "Simplified HTTP request client",
1084
- extname: ".cjs",
1085
- installation: "npm install request --save"
1086
- },
1087
- convert: ({ method: t, url: e, fullUrl: r, postData: o, headersObj: s, cookies: a }, n) => {
1088
- const i = {
1089
- indent: " ",
1090
- ...n
1091
- };
1092
- let l = !1;
1093
- const { push: c, blank: u, join: f, unshift: p, addPostProcessor: h } = new C({ indent: i.indent });
1094
- c("const request = require('request');"), u();
1095
- const y = {
1096
- method: t,
1097
- url: r
1098
- };
1099
- switch (Object.keys(s).length && (y.headers = s), o.mimeType) {
1100
- case "application/x-www-form-urlencoded":
1101
- y.form = o.paramsObj;
1102
- break;
1103
- case "application/json":
1104
- o.jsonObj && (y.body = o.jsonObj, y.json = !0);
1105
- break;
1106
- case "multipart/form-data":
1107
- if (!o.params)
1108
- break;
1109
- y.formData = {}, o.params.forEach((g) => {
1110
- if (!g.fileName && !g.fileName && !g.contentType) {
1111
- y.formData[g.name] = g.value;
1112
- return;
1113
- }
1114
- let b = {};
1115
- g.fileName ? (l = !0, b = {
1116
- value: `fs.createReadStream(${g.fileName})`,
1117
- options: {
1118
- filename: g.fileName,
1119
- contentType: g.contentType ? g.contentType : null
1120
- }
1121
- }) : g.value && (b.value = g.value), y.formData[g.name] = b;
1122
- }), h((g) => g.replace(/'fs\.createReadStream\((.*)\)'/, "fs.createReadStream('$1')"));
1123
- break;
1124
- default:
1125
- o.text && (y.body = o.text);
1126
- }
1127
- return a.length && (y.jar = "JAR", c("const jar = request.jar();"), a.forEach(({ name: g, value: b }) => {
1128
- c(`jar.setCookie(request.cookie('${encodeURIComponent(g)}=${encodeURIComponent(b)}'), '${e}');`);
1129
- }), u(), h((g) => g.replace(/'JAR'/, "jar"))), l && p("const fs = require('fs');"), c(`const options = ${z(y, { indent: " ", inlineCharacterLimit: 80 })};`), u(), c("request(options, function (error, response, body) {"), c("if (error) throw new Error(error);", 1), u(), c("console.log(body);", 1), c("});"), f();
1130
- }
1131
- }, Ko = {
1132
- info: {
1133
- key: "unirest",
1134
- title: "Unirest",
1135
- link: "http://unirest.io/nodejs.html",
1136
- description: "Lightweight HTTP Request Client Library",
1137
- extname: ".cjs"
1138
- },
1139
- convert: ({ method: t, url: e, cookies: r, queryObj: o, postData: s, headersObj: a }, n) => {
1140
- const i = {
1141
- indent: " ",
1142
- ...n
1143
- };
1144
- let l = !1;
1145
- const { addPostProcessor: c, blank: u, join: f, push: p, unshift: h } = new C({
1146
- indent: i.indent
1147
- });
1148
- switch (p("const unirest = require('unirest');"), u(), p(`const req = unirest('${t}', '${e}');`), u(), r.length && (p("const CookieJar = unirest.jar();"), r.forEach((y) => {
1149
- p(`CookieJar.add('${encodeURIComponent(y.name)}=${encodeURIComponent(y.value)}', '${e}');`);
1150
- }), p("req.jar(CookieJar);"), u()), Object.keys(o).length && (p(`req.query(${z(o, { indent: i.indent })});`), u()), Object.keys(a).length && (p(`req.headers(${z(a, { indent: i.indent })});`), u()), s.mimeType) {
1151
- case "application/x-www-form-urlencoded":
1152
- s.paramsObj && (p(`req.form(${z(s.paramsObj, { indent: i.indent })});`), u());
1153
- break;
1154
- case "application/json":
1155
- s.jsonObj && (p("req.type('json');"), p(`req.send(${z(s.jsonObj, { indent: i.indent })});`), u());
1156
- break;
1157
- case "multipart/form-data": {
1158
- if (!s.params)
1159
- break;
1160
- const y = [];
1161
- s.params.forEach((g) => {
1162
- const b = {};
1163
- g.fileName && !g.value ? (l = !0, b.body = `fs.createReadStream('${g.fileName}')`, c((x) => x.replace(/'fs\.createReadStream\(\\'(.+)\\'\)'/, "fs.createReadStream('$1')"))) : g.value && (b.body = g.value), b.body && (g.contentType && (b["content-type"] = g.contentType), y.push(b));
1164
- }), p(`req.multipart(${z(y, { indent: i.indent })});`), u();
1165
- break;
1166
- }
1167
- default:
1168
- s.text && (p(`req.send(${z(s.text, { indent: i.indent })});`), u());
1169
- }
1170
- return l && h("const fs = require('fs');"), p("req.end(function (res) {"), p("if (res.error) throw new Error(res.error);", 1), u(), p("console.log(res.body);", 1), p("});"), f();
1171
- }
1172
- }, Do = {
1173
- info: {
1174
- key: "node",
1175
- title: "Node.js",
1176
- default: "native",
1177
- cli: "node %s"
1178
- },
1179
- clientsById: {
1180
- native: Vo,
1181
- request: Qo,
1182
- unirest: Ko,
1183
- axios: Jo,
1184
- fetch: Go
1185
- }
1186
- }, ht = (t, e, r, o) => {
1187
- const s = `${t} *${e} = `, a = Pt(r, o ? s.length : void 0);
1188
- return `${s}${a};`;
1189
- }, Pt = (t, e) => {
1190
- const r = e === void 0 ? ", " : `,
1191
- ${" ".repeat(e)}`;
1192
- switch (Object.prototype.toString.call(t)) {
1193
- case "[object Number]":
1194
- return `@${t}`;
1195
- case "[object Array]":
1196
- return `@[ ${t.map((s) => Pt(s)).join(r)} ]`;
1197
- case "[object Object]": {
1198
- const o = [];
1199
- return Object.keys(t).forEach((s) => {
1200
- o.push(`@"${s}": ${Pt(t[s])}`);
1201
- }), `@{ ${o.join(r)} }`;
1202
- }
1203
- case "[object Boolean]":
1204
- return t ? "@YES" : "@NO";
1205
- default:
1206
- return t == null ? "" : `@"${t.toString().replace(/"/g, '\\"')}"`;
1207
- }
1208
- }, Yo = {
1209
- info: {
1210
- key: "nsurlsession",
1211
- title: "NSURLSession",
1212
- link: "https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html",
1213
- description: "Foundation's NSURLSession request",
1214
- extname: ".m"
1215
- },
1216
- convert: ({ allHeaders: t, postData: e, method: r, fullUrl: o }, s) => {
1217
- var u;
1218
- const a = {
1219
- indent: " ",
1220
- pretty: !0,
1221
- timeout: 10,
1222
- ...s
1223
- }, { push: n, join: i, blank: l } = new C({ indent: a.indent }), c = {
1224
- hasHeaders: !1,
1225
- hasBody: !1
1226
- };
1227
- if (n("#import <Foundation/Foundation.h>"), Object.keys(t).length && (c.hasHeaders = !0, l(), n(ht("NSDictionary", "headers", t, a.pretty))), e.text || e.jsonObj || e.params)
1228
- switch (c.hasBody = !0, e.mimeType) {
1229
- case "application/x-www-form-urlencoded":
1230
- if ((u = e.params) != null && u.length) {
1231
- l();
1232
- const [f, ...p] = e.params;
1233
- n(
1234
- `NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${f.name}=${f.value}" dataUsingEncoding:NSUTF8StringEncoding]];`
1235
- ), p.forEach(({ name: h, value: y }) => {
1236
- n(`[postData appendData:[@"&${h}=${y}" dataUsingEncoding:NSUTF8StringEncoding]];`);
1237
- });
1238
- } else
1239
- c.hasBody = !1;
1240
- break;
1241
- case "application/json":
1242
- e.jsonObj && (n(ht("NSDictionary", "parameters", e.jsonObj, a.pretty)), l(), n("NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];"));
1243
- break;
1244
- case "multipart/form-data":
1245
- n(ht("NSArray", "parameters", e.params || [], a.pretty)), n(`NSString *boundary = @"${e.boundary}";`), l(), n("NSError *error;"), n("NSMutableString *body = [NSMutableString string];"), n("for (NSDictionary *param in parameters) {"), n('[body appendFormat:@"--%@\\r\\n", boundary];', 1), n('if (param[@"fileName"]) {', 1), n(
1246
- '[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];',
1247
- 2
1248
- ), n('[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];', 2), n(
1249
- '[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];',
1250
- 2
1251
- ), n("if (error) {", 2), n('NSLog(@"%@", error);', 3), n("}", 2), n("} else {", 1), n('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];', 2), n('[body appendFormat:@"%@", param[@"value"]];', 2), n("}", 1), n("}"), n('[body appendFormat:@"\\r\\n--%@--\\r\\n", boundary];'), n("NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];");
1252
- break;
1253
- default:
1254
- l(), n(
1255
- `NSData *postData = [[NSData alloc] initWithData:[@"${e.text}" dataUsingEncoding:NSUTF8StringEncoding]];`
1256
- );
1257
- }
1258
- return l(), n(`NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"${o}"]`), n(" cachePolicy:NSURLRequestUseProtocolCachePolicy"), n(` timeoutInterval:${a.timeout.toFixed(1)}];`), n(`[request setHTTPMethod:@"${r}"];`), c.hasHeaders && n("[request setAllHTTPHeaderFields:headers];"), c.hasBody && n("[request setHTTPBody:postData];"), l(), n("NSURLSession *session = [NSURLSession sharedSession];"), n("NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request"), n(
1259
- " completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {"
1260
- ), n(" if (error) {", 1), n(' NSLog(@"%@", error);', 2), n(" } else {", 1), n(
1261
- " NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;",
1262
- 2
1263
- ), n(' NSLog(@"%@", httpResponse);', 2), n(" }", 1), n(" }];"), n("[dataTask resume];"), i();
1264
- }
1265
- }, Xo = {
1266
- info: {
1267
- key: "objc",
1268
- title: "Objective-C",
1269
- default: "nsurlsession"
1270
- },
1271
- clientsById: {
1272
- nsurlsession: Yo
1273
- }
1274
- }, Zo = {
1275
- info: {
1276
- key: "cohttp",
1277
- title: "CoHTTP",
1278
- link: "https://github.com/mirage/ocaml-cohttp",
1279
- description: "Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml",
1280
- extname: ".ml",
1281
- installation: "opam install cohttp-lwt-unix cohttp-async"
1282
- },
1283
- convert: ({ fullUrl: t, allHeaders: e, postData: r, method: o }, s) => {
1284
- const a = {
1285
- indent: " ",
1286
- ...s
1287
- }, n = ["get", "post", "head", "delete", "patch", "put", "options"], { push: i, blank: l, join: c } = new C({ indent: a.indent });
1288
- i("open Cohttp_lwt_unix"), i("open Cohttp"), i("open Lwt"), l(), i(`let uri = Uri.of_string "${t}" in`);
1289
- const u = Object.keys(e);
1290
- u.length === 1 ? i(
1291
- `let headers = Header.add (Header.init ()) "${u[0]}" "${H(
1292
- e[u[0]]
1293
- )}" in`
1294
- ) : u.length > 1 && (i("let headers = Header.add_list (Header.init ()) ["), u.forEach((y) => {
1295
- i(`("${y}", "${H(e[y])}");`, 1);
1296
- }), i("] in")), r.text && i(`let body = Cohttp_lwt_body.of_string ${JSON.stringify(r.text)} in`), l();
1297
- const f = u.length ? "~headers " : "", p = r.text ? "~body " : "", h = n.includes(o.toLowerCase()) ? `\`${o.toUpperCase()}` : `(Code.method_of_string "${o}")`;
1298
- return i(`Client.call ${f}${p}${h} uri`), i(">>= fun (res, body_stream) ->"), i("(* Do stuff with the result *)", 1), c();
1299
- }
1300
- }, ea = {
1301
- info: {
1302
- key: "ocaml",
1303
- title: "OCaml",
1304
- default: "cohttp"
1305
- },
1306
- clientsById: {
1307
- cohttp: Zo
1308
- }
1309
- }, N = (t, e, r) => {
1310
- switch (r = r || "", e = e || "", Object.prototype.toString.call(t)) {
1311
- case "[object Boolean]":
1312
- return t;
1313
- case "[object Null]":
1314
- return "null";
1315
- case "[object Undefined]":
1316
- return "null";
1317
- case "[object String]":
1318
- return `'${We(t, { delimiter: "'", escapeNewlines: !1 })}'`;
1319
- case "[object Number]":
1320
- return t.toString();
1321
- case "[object Array]": {
1322
- const o = t.map((s) => N(s, `${e}${e}`, e)).join(`,
1323
- ${e}`);
1324
- return `[
1325
- ${e}${o}
1326
- ${r}]`;
1327
- }
1328
- case "[object Object]": {
1329
- const o = [];
1330
- for (const s in t)
1331
- Object.prototype.hasOwnProperty.call(t, s) && o.push(`${N(s, e)} => ${N(t[s], `${e}${e}`, e)}`);
1332
- return `[
1333
- ${e}${o.join(`,
1334
- ${e}`)}
1335
- ${r}]`;
1336
- }
1337
- default:
1338
- return "null";
1339
- }
1340
- }, fr = [
1341
- "ACL",
1342
- "BASELINE_CONTROL",
1343
- "CHECKIN",
1344
- "CHECKOUT",
1345
- "CONNECT",
1346
- "COPY",
1347
- "DELETE",
1348
- "GET",
1349
- "HEAD",
1350
- "LABEL",
1351
- "LOCK",
1352
- "MERGE",
1353
- "MKACTIVITY",
1354
- "MKCOL",
1355
- "MKWORKSPACE",
1356
- "MOVE",
1357
- "OPTIONS",
1358
- "POST",
1359
- "PROPFIND",
1360
- "PROPPATCH",
1361
- "PUT",
1362
- "REPORT",
1363
- "TRACE",
1364
- "UNCHECKOUT",
1365
- "UNLOCK",
1366
- "UPDATE",
1367
- "VERSION_CONTROL"
1368
- ], ta = {
1369
- info: {
1370
- key: "curl",
1371
- title: "cURL",
1372
- link: "http://php.net/manual/en/book.curl.php",
1373
- description: "PHP with ext-curl",
1374
- extname: ".php"
1375
- },
1376
- convert: ({ uriObj: t, postData: e, fullUrl: r, method: o, httpVersion: s, cookies: a, headersObj: n }, i = {}) => {
1377
- const {
1378
- closingTag: l = !1,
1379
- indent: c = " ",
1380
- maxRedirects: u = 10,
1381
- namedErrors: f = !1,
1382
- noTags: p = !1,
1383
- shortTags: h = !1,
1384
- timeout: y = 30
1385
- } = i, { push: g, blank: b, join: x } = new C({ indent: c });
1386
- p || (g(h ? "<?" : "<?php"), b()), g("$curl = curl_init();"), b();
1387
- const m = [
1388
- {
1389
- escape: !0,
1390
- name: "CURLOPT_PORT",
1391
- value: t.port
1392
- },
1393
- {
1394
- escape: !0,
1395
- name: "CURLOPT_URL",
1396
- value: r
1397
- },
1398
- {
1399
- escape: !1,
1400
- name: "CURLOPT_RETURNTRANSFER",
1401
- value: "true"
1402
- },
1403
- {
1404
- escape: !0,
1405
- name: "CURLOPT_ENCODING",
1406
- value: ""
1407
- },
1408
- {
1409
- escape: !1,
1410
- name: "CURLOPT_MAXREDIRS",
1411
- value: u
1412
- },
1413
- {
1414
- escape: !1,
1415
- name: "CURLOPT_TIMEOUT",
1416
- value: y
1417
- },
1418
- {
1419
- escape: !1,
1420
- name: "CURLOPT_HTTP_VERSION",
1421
- value: s === "HTTP/1.0" ? "CURL_HTTP_VERSION_1_0" : "CURL_HTTP_VERSION_1_1"
1422
- },
1423
- {
1424
- escape: !0,
1425
- name: "CURLOPT_CUSTOMREQUEST",
1426
- value: o
1427
- },
1428
- {
1429
- escape: !e.jsonObj,
1430
- name: "CURLOPT_POSTFIELDS",
1431
- value: e ? e.jsonObj ? `json_encode(${N(e.jsonObj, c.repeat(2), c)})` : e.text : void 0
1432
- }
1433
- ];
1434
- g("curl_setopt_array($curl, [");
1435
- const v = new C({ indent: c, join: `
1436
- ${c}` });
1437
- m.forEach(({ value: S, name: k, escape: E }) => {
1438
- S != null && v.push(`${k} => ${E ? JSON.stringify(S) : S},`);
1439
- });
1440
- const w = a.map((S) => `${encodeURIComponent(S.name)}=${encodeURIComponent(S.value)}`);
1441
- w.length && v.push(`CURLOPT_COOKIE => "${w.join("; ")}",`);
1442
- const j = Object.keys(n).sort().map((S) => `"${S}: ${H(n[S])}"`);
1443
- return j.length && (v.push("CURLOPT_HTTPHEADER => ["), v.push(j.join(`,
1444
- ${c}${c}`), 1), v.push("],")), g(v.join(), 1), g("]);"), b(), g("$response = curl_exec($curl);"), g("$err = curl_error($curl);"), b(), g("curl_close($curl);"), b(), g("if ($err) {"), g(f ? 'echo array_flip(get_defined_constants(true)["curl"])[$err];' : 'echo "cURL Error #:" . $err;', 1), g("} else {"), g("echo $response;", 1), g("}"), !p && l && (b(), g("?>")), x();
1445
- }
1446
- }, ra = {
1447
- info: {
1448
- key: "guzzle",
1449
- title: "Guzzle",
1450
- link: "http://docs.guzzlephp.org/en/stable/",
1451
- description: "PHP with Guzzle",
1452
- extname: ".php",
1453
- installation: "composer require guzzlehttp/guzzle"
1454
- },
1455
- convert: ({ postData: t, fullUrl: e, method: r, cookies: o, headersObj: s }, a) => {
1456
- var g;
1457
- const n = {
1458
- closingTag: !1,
1459
- indent: " ",
1460
- noTags: !1,
1461
- shortTags: !1,
1462
- ...a
1463
- }, { push: i, blank: l, join: c } = new C({ indent: n.indent }), { code: u, push: f, join: p } = new C({ indent: n.indent });
1464
- switch (n.noTags || i(n.shortTags ? "<?" : "<?php"), i("require_once('vendor/autoload.php');"), l(), t.mimeType) {
1465
- case "application/x-www-form-urlencoded":
1466
- f(`'form_params' => ${N(t.paramsObj, n.indent + n.indent, n.indent)},`, 1);
1467
- break;
1468
- case "multipart/form-data": {
1469
- const b = [];
1470
- if (t.params && t.params.forEach((x) => {
1471
- if (x.fileName) {
1472
- const m = {
1473
- name: x.name,
1474
- filename: x.fileName,
1475
- contents: x.value
1476
- };
1477
- x.contentType && (m.headers = { "Content-Type": x.contentType }), b.push(m);
1478
- } else x.value && b.push({
1479
- name: x.name,
1480
- contents: x.value
1481
- });
1482
- }), b.length && (f(`'multipart' => ${N(b, n.indent + n.indent, n.indent)}`, 1), pt(s, "content-type") && (g = ue(s, "content-type")) != null && g.indexOf("boundary"))) {
1483
- const x = J(s, "content-type");
1484
- x && delete s[x];
1485
- }
1486
- break;
1487
- }
1488
- default:
1489
- t.text && f(`'body' => ${N(t.text)},`, 1);
1490
- }
1491
- const h = Object.keys(s).sort().map(function(b) {
1492
- return `${n.indent}${n.indent}'${b}' => '${Je(s[b])}',`;
1493
- }), y = o.map((b) => `${encodeURIComponent(b.name)}=${encodeURIComponent(b.value)}`).join("; ");
1494
- return y.length && h.push(`${n.indent}${n.indent}'cookie' => '${Je(y)}',`), h.length && (f("'headers' => [", 1), f(h.join(`
1495
- `)), f("],", 1)), i("$client = new \\GuzzleHttp\\Client();"), l(), u.length ? (i(`$response = $client->request('${r}', '${e}', [`), i(p()), i("]);")) : i(`$response = $client->request('${r}', '${e}');`), l(), i("echo $response->getBody();"), !n.noTags && n.closingTag && (l(), i("?>")), c();
1496
- }
1497
- }, na = {
1498
- info: {
1499
- key: "http1",
1500
- title: "HTTP v1",
1501
- link: "http://php.net/manual/en/book.http.php",
1502
- description: "PHP with pecl/http v1",
1503
- extname: ".php"
1504
- },
1505
- convert: ({ method: t, url: e, postData: r, queryObj: o, headersObj: s, cookiesObj: a }, n = {}) => {
1506
- const { closingTag: i = !1, indent: l = " ", noTags: c = !1, shortTags: u = !1 } = n, { push: f, blank: p, join: h } = new C({ indent: l });
1507
- switch (c || (f(u ? "<?" : "<?php"), p()), fr.includes(t.toUpperCase()) || f(`HttpRequest::methodRegister('${t}');`), f("$request = new HttpRequest();"), f(`$request->setUrl(${N(e)});`), fr.includes(t.toUpperCase()) ? f(`$request->setMethod(HTTP_METH_${t.toUpperCase()});`) : f(`$request->setMethod(HttpRequest::HTTP_METH_${t.toUpperCase()});`), p(), Object.keys(o).length && (f(`$request->setQueryData(${N(o, l)});`), p()), Object.keys(s).length && (f(`$request->setHeaders(${N(s, l)});`), p()), Object.keys(a).length && (f(`$request->setCookies(${N(a, l)});`), p()), r.mimeType) {
1508
- case "application/x-www-form-urlencoded":
1509
- f(`$request->setContentType(${N(r.mimeType)});`), f(`$request->setPostFields(${N(r.paramsObj, l)});`), p();
1510
- break;
1511
- case "application/json":
1512
- f(`$request->setContentType(${N(r.mimeType)});`), f(`$request->setBody(json_encode(${N(r.jsonObj, l)}));`), p();
1513
- break;
1514
- default:
1515
- r.text && (f(`$request->setBody(${N(r.text)});`), p());
1516
- }
1517
- return f("try {"), f("$response = $request->send();", 1), p(), f("echo $response->getBody();", 1), f("} catch (HttpException $ex) {"), f("echo $ex;", 1), f("}"), !c && i && (p(), f("?>")), h();
1518
- }
1519
- }, oa = {
1520
- info: {
1521
- key: "http2",
1522
- title: "HTTP v2",
1523
- link: "http://devel-m6w6.rhcloud.com/mdref/http",
1524
- description: "PHP with pecl/http v2",
1525
- extname: ".php"
1526
- },
1527
- convert: ({ postData: t, headersObj: e, method: r, queryObj: o, cookiesObj: s, url: a }, n = {}) => {
1528
- var g;
1529
- const { closingTag: i = !1, indent: l = " ", noTags: c = !1, shortTags: u = !1 } = n, { push: f, blank: p, join: h } = new C({ indent: l });
1530
- let y = !1;
1531
- switch (c || (f(u ? "<?" : "<?php"), p()), f("$client = new http\\Client;"), f("$request = new http\\Client\\Request;"), p(), t.mimeType) {
1532
- case "application/x-www-form-urlencoded":
1533
- f("$body = new http\\Message\\Body;"), f(`$body->append(new http\\QueryString(${N(t.paramsObj, l)}));`), p(), y = !0;
1534
- break;
1535
- case "multipart/form-data": {
1536
- if (!t.params)
1537
- break;
1538
- const b = [], x = {};
1539
- t.params.forEach(({ name: w, fileName: j, value: S, contentType: k }) => {
1540
- if (j) {
1541
- b.push({
1542
- name: w,
1543
- type: k,
1544
- file: j,
1545
- data: S
1546
- });
1547
- return;
1548
- }
1549
- S && (x[w] = S);
1550
- });
1551
- const m = Object.keys(x).length ? N(x, l) : "null", v = b.length ? N(b, l) : "null";
1552
- if (f("$body = new http\\Message\\Body;"), f(`$body->addForm(${m}, ${v});`), pt(e, "content-type") && (g = ue(e, "content-type")) != null && g.indexOf("boundary")) {
1553
- const w = J(e, "content-type");
1554
- w && delete e[w];
1555
- }
1556
- p(), y = !0;
1557
- break;
1558
- }
1559
- case "application/json":
1560
- f("$body = new http\\Message\\Body;"), f(`$body->append(json_encode(${N(t.jsonObj, l)}));`), y = !0;
1561
- break;
1562
- default:
1563
- t.text && (f("$body = new http\\Message\\Body;"), f(`$body->append(${N(t.text)});`), p(), y = !0);
1564
- }
1565
- return f(`$request->setRequestUrl(${N(a)});`), f(`$request->setRequestMethod(${N(r)});`), y && (f("$request->setBody($body);"), p()), Object.keys(o).length && (f(`$request->setQuery(new http\\QueryString(${N(o, l)}));`), p()), Object.keys(e).length && (f(`$request->setHeaders(${N(e, l)});`), p()), Object.keys(s).length && (p(), f(`$client->setCookies(${N(s, l)});`), p()), f("$client->enqueue($request)->send();"), f("$response = $client->getResponse();"), p(), f("echo $response->getBody();"), !c && i && (p(), f("?>")), h();
1566
- }
1567
- }, aa = {
1568
- info: {
1569
- key: "php",
1570
- title: "PHP",
1571
- default: "curl",
1572
- cli: "php %s"
1573
- },
1574
- clientsById: {
1575
- curl: ta,
1576
- guzzle: ra,
1577
- http1: na,
1578
- http2: oa
1579
- }
1580
- }, rn = (t) => ({ method: r, headersObj: o, cookies: s, uriObj: a, fullUrl: n, postData: i, allHeaders: l }) => {
1581
- const { push: c, join: u } = new C();
1582
- if (!["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"].includes(r.toUpperCase()))
1583
- return "Method not supported";
1584
- const p = [], h = Object.keys(o);
1585
- return h.length && (c("$headers=@{}"), h.forEach((y) => {
1586
- y !== "connection" && c(`$headers.Add("${y}", "${We(o[y], { escapeChar: "`" })}")`);
1587
- }), p.push("-Headers $headers")), s.length && (c("$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession"), s.forEach((y) => {
1588
- c("$cookie = New-Object System.Net.Cookie"), c(`$cookie.Name = '${y.name}'`), c(`$cookie.Value = '${y.value}'`), c(`$cookie.Domain = '${a.host}'`), c("$session.Cookies.Add($cookie)");
1589
- }), p.push("-WebSession $session")), i.text && (p.push(
1590
- `-ContentType '${We(ue(l, "content-type"), { delimiter: "'", escapeChar: "`" })}'`
1591
- ), p.push(`-Body '${i.text}'`)), c(`$response = ${t} -Uri '${n}' -Method ${r} ${p.join(" ")}`.trim()), u();
1592
- }, ia = {
1593
- info: {
1594
- key: "restmethod",
1595
- title: "Invoke-RestMethod",
1596
- link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod",
1597
- description: "Powershell Invoke-RestMethod client",
1598
- extname: ".ps1"
1599
- },
1600
- convert: rn("Invoke-RestMethod")
1601
- }, sa = {
1602
- info: {
1603
- key: "webrequest",
1604
- title: "Invoke-WebRequest",
1605
- link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest",
1606
- description: "Powershell Invoke-WebRequest client",
1607
- extname: ".ps1"
1608
- },
1609
- convert: rn("Invoke-WebRequest")
1610
- }, la = {
1611
- info: {
1612
- key: "powershell",
1613
- title: "Powershell",
1614
- default: "webrequest"
1615
- },
1616
- clientsById: {
1617
- webrequest: sa,
1618
- restmethod: ia
1619
- }
1620
- };
1621
- function dr(t, e, r, o, s) {
1622
- const a = o.repeat(s), n = o.repeat(s - 1), i = r ? `,
1623
- ${a}` : ", ", l = t === "object" ? "{" : "[", c = t === "object" ? "}" : "]";
1624
- return r ? `${l}
1625
- ${a}${e.join(i)}
1626
- ${n}${c}` : t === "object" && e.length > 0 ? `${l} ${e.join(i)} ${c}` : `${l}${e.join(i)}${c}`;
1627
- }
1628
- var ke = (t, e, r) => {
1629
- switch (r = r === void 0 ? 1 : r + 1, Object.prototype.toString.call(t)) {
1630
- case "[object Number]":
1631
- return t;
1632
- case "[object Array]": {
1633
- let o = !1;
1634
- const s = t.map((a) => (Object.prototype.toString.call(a) === "[object Object]" && (o = Object.keys(a).length > 1), ke(a, e, r)));
1635
- return dr("array", s, o, e.indent, r);
1636
- }
1637
- case "[object Object]": {
1638
- const o = [];
1639
- for (const s in t)
1640
- o.push(`"${s}": ${ke(t[s], e, r)}`);
1641
- return dr("object", o, e.pretty && o.length > 1, e.indent, r);
1642
- }
1643
- case "[object Null]":
1644
- return "None";
1645
- case "[object Boolean]":
1646
- return t ? "True" : "False";
1647
- default:
1648
- return t == null ? "" : `"${t.toString().replace(/"/g, '\\"')}"`;
1649
- }
1650
- }, ca = ["HEAD", "GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"], ua = {
1651
- info: {
1652
- key: "requests",
1653
- title: "Requests",
1654
- link: "http://docs.python-requests.org/en/latest/api/#requests.request",
1655
- description: "Requests HTTP library",
1656
- extname: ".py",
1657
- installation: "python -m pip install requests"
1658
- },
1659
- convert: ({ fullUrl: t, postData: e, allHeaders: r, method: o }, s) => {
1660
- const a = {
1661
- indent: " ",
1662
- pretty: !0,
1663
- ...s
1664
- }, { push: n, blank: i, join: l, addPostProcessor: c } = new C({ indent: a.indent });
1665
- n("import requests"), i(), n(`url = "${t}"`), i();
1666
- const u = r;
1667
- let f = {};
1668
- const p = {};
1669
- let h = !1, y = !1, g = !1;
1670
- switch (e.mimeType) {
1671
- case "application/json":
1672
- e.jsonObj && (n(`payload = ${ke(e.jsonObj, a)}`), g = !0, y = !0);
1673
- break;
1674
- case "multipart/form-data":
1675
- if (!e.params)
1676
- break;
1677
- if (f = {}, e.params.forEach((m) => {
1678
- m.fileName ? (m.contentType ? p[m.name] = `('${m.fileName}', open('${m.fileName}', 'rb'), '${m.contentType}')` : p[m.name] = `('${m.fileName}', open('${m.fileName}', 'rb'))`, h = !0) : (f[m.name] = m.value, y = !0);
1679
- }), h) {
1680
- n(`files = ${ke(p, a)}`), y && n(`payload = ${ke(f, a)}`);
1681
- const m = J(u, "content-type");
1682
- m && delete u[m];
1683
- } else {
1684
- const m = JSON.stringify(e.text);
1685
- m && (n(`payload = ${m}`), y = !0);
1686
- }
1687
- c(
1688
- (m) => m.replace(/"\('(.+)', open\('(.+)', 'rb'\)\)"/g, '("$1", open("$2", "rb"))').replace(/"\('(.+)', open\('(.+)', 'rb'\), '(.+)'\)"/g, '("$1", open("$2", "rb"), "$3")')
1689
- );
1690
- break;
1691
- default: {
1692
- if (e.mimeType === "application/x-www-form-urlencoded" && e.paramsObj) {
1693
- n(`payload = ${ke(e.paramsObj, a)}`), y = !0;
1694
- break;
1695
- }
1696
- const m = JSON.stringify(e.text);
1697
- m && (n(`payload = ${m}`), y = !0);
1698
- }
1699
- }
1700
- const b = Object.keys(u).length;
1701
- if (b === 0 && (y || h))
1702
- i();
1703
- else if (b === 1)
1704
- Object.keys(u).forEach((m) => {
1705
- n(`headers = {"${m}": "${H(u[m])}"}`), i();
1706
- });
1707
- else if (b > 1) {
1708
- let m = 1;
1709
- n("headers = {"), Object.keys(u).forEach((v) => {
1710
- n(m !== b ? `"${v}": "${H(u[v])}",` : `"${v}": "${H(u[v])}"`, 1), m += 1;
1711
- }), n("}"), i();
1712
- }
1713
- let x = ca.includes(o) ? `response = requests.${o.toLowerCase()}(url` : `response = requests.request("${o}", url`;
1714
- return y && (g ? x += ", json=payload" : x += ", data=payload"), h && (x += ", files=files"), b > 0 && (x += ", headers=headers"), x += ")", n(x), i(), n("print(response.text)"), l();
1715
- }
1716
- }, pa = {
1717
- info: {
1718
- key: "python",
1719
- title: "Python",
1720
- default: "requests",
1721
- cli: "python3 %s"
1722
- },
1723
- clientsById: {
1724
- requests: ua
1725
- }
1726
- }, fa = {
1727
- info: {
1728
- key: "httr",
1729
- title: "httr",
1730
- link: "https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html",
1731
- description: "httr: Tools for Working with URLs and HTTP",
1732
- extname: ".r"
1733
- },
1734
- convert: ({ url: t, queryObj: e, queryString: r, postData: o, allHeaders: s, method: a }) => {
1735
- const { push: n, blank: i, join: l } = new C();
1736
- n("library(httr)"), i(), n(`url <- "${t}"`), i();
1737
- const c = e;
1738
- delete e.key;
1739
- const u = Object.keys(c).length;
1740
- r.length === 1 ? (n(`queryString <- list(${Object.keys(c)} = "${Object.values(c).toString()}")`), i()) : r.length > 1 && (n("queryString <- list("), Object.keys(c).forEach((j, S) => {
1741
- S !== u - 1 ? n(` ${j} = "${c[j].toString()}",`) : n(` ${j} = "${c[j].toString()}"`);
1742
- }), n(")"), i());
1743
- const f = JSON.stringify(o.text);
1744
- if (f && (n(`payload <- ${f}`), i()), o.text || o.jsonObj || o.params)
1745
- switch (o.mimeType) {
1746
- case "application/x-www-form-urlencoded":
1747
- n('encode <- "form"'), i();
1748
- break;
1749
- case "application/json":
1750
- n('encode <- "json"'), i();
1751
- break;
1752
- case "multipart/form-data":
1753
- n('encode <- "multipart"'), i();
1754
- break;
1755
- default:
1756
- n('encode <- "raw"'), i();
1757
- break;
1758
- }
1759
- const p = ue(s, "cookie"), h = ue(s, "accept"), y = p ? `set_cookies(\`${String(p).replace(/;/g, '", `').replace(/` /g, "`").replace(/[=]/g, '` = "')}")` : void 0, g = h ? `accept("${H(h)}")` : void 0, b = `content_type("${H(o.mimeType)}")`, x = Object.entries(s).filter(([j]) => !["cookie", "accept", "content-type"].includes(j.toLowerCase())).map(([j, S]) => `'${j}' = '${Je(S)}'`).join(", "), m = x ? `add_headers(${x})` : void 0;
1760
- let v = `response <- VERB("${a}", url`;
1761
- f && (v += ", body = payload"), r.length && (v += ", query = queryString");
1762
- const w = [m, b, g, y].filter((j) => !!j).join(", ");
1763
- return w && (v += `, ${w}`), (o.text || o.jsonObj || o.params) && (v += ", encode = encode"), v += ")", n(v), i(), n('content(response, "text")'), l();
1764
- }
1765
- }, da = {
1766
- info: {
1767
- key: "r",
1768
- title: "R",
1769
- default: "httr"
1770
- },
1771
- clientsById: {
1772
- httr: fa
1773
- }
1774
- }, ha = {
1775
- info: {
1776
- key: "native",
1777
- title: "net::http",
1778
- link: "http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",
1779
- description: "Ruby HTTP client",
1780
- extname: ".rb"
1781
- },
1782
- convert: ({ uriObj: t, method: e, fullUrl: r, postData: o, allHeaders: s }) => {
1783
- const { push: a, blank: n, join: i } = new C();
1784
- a("require 'uri'"), a("require 'net/http'"), n();
1785
- const l = e.toUpperCase(), c = [
1786
- "GET",
1787
- "POST",
1788
- "HEAD",
1789
- "DELETE",
1790
- "PATCH",
1791
- "PUT",
1792
- "OPTIONS",
1793
- "COPY",
1794
- "LOCK",
1795
- "UNLOCK",
1796
- "MOVE",
1797
- "TRACE"
1798
- ], u = l.charAt(0) + l.substring(1).toLowerCase();
1799
- c.includes(l) || (a(`class Net::HTTP::${u} < Net::HTTPRequest`), a(` METHOD = '${l.toUpperCase()}'`), a(` REQUEST_HAS_BODY = '${o.text ? "true" : "false"}'`), a(" RESPONSE_HAS_BODY = true"), a("end"), n()), a(`url = URI("${r}")`), n(), a("http = Net::HTTP.new(url.host, url.port)"), t.protocol === "https:" && a("http.use_ssl = true"), n(), a(`request = Net::HTTP::${u}.new(url)`);
1800
- const f = Object.keys(s);
1801
- return f.length && f.forEach((p) => {
1802
- a(`request["${p}"] = '${Je(s[p])}'`);
1803
- }), o.text && a(`request.body = ${JSON.stringify(o.text)}`), n(), a("response = http.request(request)"), a("puts response.read_body"), i();
1804
- }
1805
- }, ya = {
1806
- info: {
1807
- key: "ruby",
1808
- title: "Ruby",
1809
- default: "native"
1810
- },
1811
- clientsById: {
1812
- native: ha
1813
- }
1814
- }, M = (t = "") => /^[a-z0-9-_/.@%^=:]+$/i.test(t) ? t : `'${t.replace(/'/g, "'\\''")}'`, ma = (t) => t.replace(/\r/g, "\\r").replace(/\n/g, "\\n"), ga = {
1815
- "http1.0": "0",
1816
- "url ": "",
1817
- cookie: "b",
1818
- data: "d",
1819
- form: "F",
1820
- globoff: "g",
1821
- header: "H",
1822
- insecure: "k",
1823
- request: "X"
1824
- }, ba = (t) => (e) => {
1825
- if (t) {
1826
- const r = ga[e];
1827
- return r ? `-${r}` : "";
1828
- }
1829
- return `--${e}`;
1830
- }, va = {
1831
- info: {
1832
- key: "curl",
1833
- title: "cURL",
1834
- link: "http://curl.haxx.se/",
1835
- description: "cURL is a command line tool and library for transferring data with URL syntax",
1836
- extname: ".sh"
1837
- },
1838
- convert: ({ fullUrl: t, method: e, httpVersion: r, headersObj: o, allHeaders: s, postData: a }, n = {}) => {
1839
- var b;
1840
- const { indent: i = " ", short: l = !1, binary: c = !1, globOff: u = !1 } = n, f = " ", { push: p, join: h } = new C({
1841
- ...typeof i == "string" ? { indent: i } : {},
1842
- join: i !== !1 ? ` \\
1843
- ${i}` : " "
1844
- }), y = ba(l);
1845
- let g = M(t);
1846
- if (p(`curl ${y("request")} ${e}`), u && (g = unescape(g), p(y("globoff"))), p(`${y("url ")}${g}`), r === "HTTP/1.0" && p(y("http1.0")), ue(s, "accept-encoding") && p("--compressed"), a.mimeType === "multipart/form-data") {
1847
- const x = J(o, "content-type");
1848
- if (x) {
1849
- const m = o[x];
1850
- if (x && m) {
1851
- const v = String(m).replace(/; boundary.+?(?=(;|$))/, "");
1852
- o[x] = v, s[x] = v;
1853
- }
1854
- }
1855
- }
1856
- switch (Object.keys(o).sort().forEach((x) => {
1857
- const m = `${x}: ${o[x]}`;
1858
- p(`${y("header")} ${M(m)}`);
1859
- }), s.cookie && p(`${y("cookie")} ${M(s.cookie)}`), a.mimeType) {
1860
- case "multipart/form-data":
1861
- (b = a.params) == null || b.forEach((m) => {
1862
- let v = "";
1863
- m.fileName ? v = `${m.name}='@${m.fileName}'` : v = M(`${m.name}=${m.value}`), p(`${y("form")} ${v}`);
1864
- });
1865
- break;
1866
- case "application/x-www-form-urlencoded":
1867
- a.params ? a.params.forEach((m) => {
1868
- const v = m.name, w = encodeURIComponent(m.name), j = w !== v, S = j ? w : v, k = c ? "--data-binary" : j ? "--data-urlencode" : y("data");
1869
- p(`${k} ${M(`${S}=${m.value}`)}`);
1870
- }) : p(`${c ? "--data-binary" : y("data")} ${M(a.text)}`);
1871
- break;
1872
- default:
1873
- if (!a.text)
1874
- break;
1875
- let x = !1;
1876
- if (bo(a.mimeType) && a.text.length > 20)
1877
- try {
1878
- const m = JSON.parse(a.text);
1879
- x = !0, a.text.indexOf("'") > 0 ? p(
1880
- `${c ? "--data-binary" : y("data")} @- <<EOF
1881
- ${JSON.stringify(
1882
- m,
1883
- null,
1884
- f
1885
- )}
1886
- EOF`
1887
- ) : p(
1888
- `${c ? "--data-binary" : y("data")} '
1889
- ${JSON.stringify(m, null, f)}
1890
- '`
1891
- );
1892
- } catch {
1893
- }
1894
- x || p(`${c ? "--data-binary" : y("data")} ${M(a.text)}`);
1895
- }
1896
- return h();
1897
- }
1898
- }, xa = {
1899
- info: {
1900
- key: "httpie",
1901
- title: "HTTPie",
1902
- link: "http://httpie.org/",
1903
- description: "a CLI, cURL-like tool for humans",
1904
- extname: ".sh",
1905
- installation: "brew install httpie"
1906
- },
1907
- convert: ({ allHeaders: t, postData: e, queryObj: r, fullUrl: o, method: s, url: a }, n) => {
1908
- const i = {
1909
- body: !1,
1910
- cert: !1,
1911
- headers: !1,
1912
- indent: " ",
1913
- pretty: !1,
1914
- print: !1,
1915
- queryParams: !1,
1916
- short: !1,
1917
- style: !1,
1918
- timeout: !1,
1919
- verbose: !1,
1920
- verify: !1,
1921
- ...n
1922
- }, { push: l, join: c, unshift: u } = new C({
1923
- indent: i.indent,
1924
- // @ts-expect-error SEEMS LEGIT
1925
- join: i.indent !== !1 ? ` \\
1926
- ${i.indent}` : " "
1927
- });
1928
- let f = !1;
1929
- const p = [];
1930
- i.headers && p.push(i.short ? "-h" : "--headers"), i.body && p.push(i.short ? "-b" : "--body"), i.verbose && p.push(i.short ? "-v" : "--verbose"), i.print && p.push(`${i.short ? "-p" : "--print"}=${i.print}`), i.verify && p.push(`--verify=${i.verify}`), i.cert && p.push(`--cert=${i.cert}`), i.pretty && p.push(`--pretty=${i.pretty}`), i.style && p.push(`--style=${i.style}`), i.timeout && p.push(`--timeout=${i.timeout}`), i.queryParams && Object.keys(r).forEach((y) => {
1931
- const g = r[y];
1932
- Array.isArray(g) ? g.forEach((b) => {
1933
- l(`${y}==${M(b)}`);
1934
- }) : l(`${y}==${M(g)}`);
1935
- }), Object.keys(t).sort().forEach((y) => {
1936
- l(`${y}:${M(t[y])}`);
1937
- }), e.mimeType === "application/x-www-form-urlencoded" ? e.params && e.params.length && (p.push(i.short ? "-f" : "--form"), e.params.forEach((y) => {
1938
- l(`${y.name}=${M(y.value)}`);
1939
- })) : f = !0;
1940
- const h = p.length ? `${p.join(" ")} ` : "";
1941
- if (a = M(i.queryParams ? a : o), u(`http ${h}${s} ${a}`), f && e.text) {
1942
- const y = M(e.text);
1943
- u(`echo ${y} | `);
1944
- }
1945
- return c();
1946
- }
1947
- }, $a = {
1948
- info: {
1949
- key: "wget",
1950
- title: "Wget",
1951
- link: "https://www.gnu.org/software/wget/",
1952
- description: "a free software package for retrieving files using HTTP, HTTPS",
1953
- extname: ".sh"
1954
- },
1955
- convert: ({ method: t, postData: e, allHeaders: r, fullUrl: o }, s) => {
1956
- const a = {
1957
- indent: " ",
1958
- short: !1,
1959
- verbose: !1,
1960
- ...s
1961
- }, { push: n, join: i } = new C({
1962
- ...typeof a.indent == "string" ? { indent: a.indent } : {},
1963
- join: a.indent !== !1 ? ` \\
1964
- ${a.indent}` : " "
1965
- });
1966
- return a.verbose ? n(`wget ${a.short ? "-v" : "--verbose"}`) : n(`wget ${a.short ? "-q" : "--quiet"}`), n(`--method ${M(t)}`), Object.keys(r).forEach((l) => {
1967
- const c = `${l}: ${r[l]}`;
1968
- n(`--header ${M(c)}`);
1969
- }), e.text && n(`--body-data ${ma(M(e.text))}`), n(a.short ? "-O" : "--output-document"), n(`- ${M(o)}`), i();
1970
- }
1971
- }, ja = {
1972
- info: {
1973
- key: "shell",
1974
- title: "Shell",
1975
- default: "curl",
1976
- cli: "%s"
1977
- },
1978
- clientsById: {
1979
- curl: va,
1980
- httpie: xa,
1981
- wget: $a
1982
- }
1983
- }, hr = (t, e) => e.repeat(t), yr = (t, e, r, o) => {
1984
- const s = hr(o, r), a = hr(o - 1, r), n = e ? `,
1985
- ${s}` : ", ";
1986
- return e ? `[
1987
- ${s}${t.join(n)}
1988
- ${a}]` : `[${t.join(n)}]`;
1989
- }, mr = (t, e, r) => `let ${t} = ${ot(e, r)}`, ot = (t, e, r) => {
1990
- switch (r = r === void 0 ? 1 : r + 1, Object.prototype.toString.call(t)) {
1991
- case "[object Number]":
1992
- return t;
1993
- case "[object Array]": {
1994
- let o = !1;
1995
- const s = t.map((a) => (Object.prototype.toString.call(a) === "[object Object]" && (o = Object.keys(a).length > 1), ot(a, e, r)));
1996
- return yr(s, o, e.indent, r);
1997
- }
1998
- case "[object Object]": {
1999
- const o = [];
2000
- for (const s in t)
2001
- o.push(`"${s}": ${ot(t[s], e, r)}`);
2002
- return yr(
2003
- o,
2004
- // @ts-expect-error needs better types
2005
- e.pretty && o.length > 1,
2006
- // @ts-expect-error needs better types
2007
- e.indent,
2008
- r
2009
- );
2010
- }
2011
- case "[object Boolean]":
2012
- return t.toString();
2013
- default:
2014
- return t == null ? "nil" : `"${t.toString().replace(/"/g, '\\"')}"`;
2015
- }
2016
- }, wa = {
2017
- info: {
2018
- key: "urlsession",
2019
- title: "URLSession",
2020
- link: "https://developer.apple.com/documentation/foundation/urlsession",
2021
- description: "Foundation's URLSession request",
2022
- extname: ".swift"
2023
- },
2024
- convert: ({ allHeaders: t, postData: e, uriObj: r, queryObj: o, method: s }, a) => {
2025
- var p;
2026
- const n = {
2027
- indent: " ",
2028
- pretty: !0,
2029
- timeout: 10,
2030
- ...a
2031
- }, { push: i, blank: l, join: c } = new C({ indent: n.indent });
2032
- i("import Foundation"), l();
2033
- const u = e.text || e.jsonObj || e.params;
2034
- if (u)
2035
- switch (e.mimeType) {
2036
- case "application/x-www-form-urlencoded":
2037
- if ((p = e.params) != null && p.length) {
2038
- const h = e.params.map((y) => `"${y.name}": "${y.value}"`);
2039
- n.pretty ? (i("let parameters = ["), h.forEach((y) => i(`${y},`, 1)), i("]")) : i(`let parameters = [${h.join(", ")}]`), i('let joinedParameters = parameters.map { "\\($0.key)=\\($0.value)" }.joined(separator: "&")'), i("let postData = Data(joinedParameters.utf8)"), l();
2040
- }
2041
- break;
2042
- case "application/json":
2043
- e.jsonObj && (i(`${mr("parameters", e.jsonObj, n)} as [String : Any?]`), l(), i("let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])"), l());
2044
- break;
2045
- case "multipart/form-data":
2046
- i(mr("parameters", e.params, n)), l(), i(`let boundary = "${e.boundary}"`), l(), i('var body = ""'), i("for param in parameters {"), i('let paramName = param["name"]!', 1), i('body += "--\\(boundary)\\r\\n"', 1), i('body += "Content-Disposition:form-data; name=\\"\\(paramName)\\""', 1), i('if let filename = param["fileName"] {', 1), i('let contentType = param["contentType"]!', 2), i("let fileContent = try String(contentsOfFile: filename, encoding: .utf8)", 2), i('body += "; filename=\\"\\(filename)\\"\\r\\n"', 2), i('body += "Content-Type: \\(contentType)\\r\\n\\r\\n"', 2), i("body += fileContent", 2), i('} else if let paramValue = param["value"] {', 1), i('body += "\\r\\n\\r\\n\\(paramValue)"', 2), i("}", 1), i("}"), l(), i("let postData = Data(body.utf8)"), l();
2047
- break;
2048
- default:
2049
- i(`let postData = Data("${e.text}".utf8)`), l();
2050
- }
2051
- i(`let url = URL(string: "${r.href}")!`);
2052
- const f = o ? Object.entries(o) : [];
2053
- return f.length < 1 ? i("var request = URLRequest(url: url)") : (i("var components = URLComponents(url: url, resolvingAgainstBaseURL: true)!"), i("let queryItems: [URLQueryItem] = ["), f.forEach((h) => {
2054
- const y = h[0], g = h[1];
2055
- switch (Object.prototype.toString.call(g)) {
2056
- case "[object String]":
2057
- i(`URLQueryItem(name: "${y}", value: "${g}"),`, 1);
2058
- break;
2059
- case "[object Array]":
2060
- g.forEach((b) => {
2061
- i(`URLQueryItem(name: "${y}", value: "${b}"),`, 1);
2062
- });
2063
- break;
2064
- }
2065
- }), i("]"), i("components.queryItems = components.queryItems.map { $0 + queryItems } ?? queryItems"), l(), i("var request = URLRequest(url: components.url!)")), i(`request.httpMethod = "${s}"`), i(`request.timeoutInterval = ${n.timeout}`), Object.keys(t).length && i(`request.allHTTPHeaderFields = ${ot(t, n)}`), u && i("request.httpBody = postData"), l(), i("let (data, _) = try await URLSession.shared.data(for: request)"), i("print(String(decoding: data, as: UTF8.self))"), c();
2066
- }
2067
- }, Sa = {
2068
- info: {
2069
- key: "swift",
2070
- title: "Swift",
2071
- default: "urlsession"
2072
- },
2073
- clientsById: {
2074
- urlsession: wa
2075
- }
2076
- }, Oa = {
2077
- c: go,
2078
- clojure: $o,
2079
- csharp: To,
2080
- go: Po,
2081
- http: Eo,
2082
- java: Io,
2083
- javascript: Ho,
2084
- json: Mo,
2085
- kotlin: Wo,
2086
- node: Do,
2087
- objc: Xo,
2088
- ocaml: ea,
2089
- php: aa,
2090
- powershell: la,
2091
- python: pa,
2092
- r: da,
2093
- ruby: ya,
2094
- shell: ja,
2095
- swift: Sa
2096
- }, at = { exports: {} };
2097
- /*! https://mths.be/punycode v1.4.1 by @mathias */
2098
- at.exports;
2099
- (function(t, e) {
2100
- (function(r) {
2101
- var o = e && !e.nodeType && e, s = t && !t.nodeType && t, a = typeof He == "object" && He;
2102
- (a.global === a || a.window === a || a.self === a) && (r = a);
2103
- var n, i = 2147483647, l = 36, c = 1, u = 26, f = 38, p = 700, h = 72, y = 128, g = "-", b = /^xn--/, x = /[^\x20-\x7E]/, m = /[\x2E\u3002\uFF0E\uFF61]/g, v = {
2104
- overflow: "Overflow: input needs wider integers to process",
2105
- "not-basic": "Illegal input >= 0x80 (not a basic code point)",
2106
- "invalid-input": "Invalid input"
2107
- }, w = l - c, j = Math.floor, S = String.fromCharCode, k;
2108
- function E($) {
2109
- throw new RangeError(v[$]);
2110
- }
2111
- function R($, O) {
2112
- for (var P = $.length, A = []; P--; )
2113
- A[P] = O($[P]);
2114
- return A;
2115
- }
2116
- function F($, O) {
2117
- var P = $.split("@"), A = "";
2118
- P.length > 1 && (A = P[0] + "@", $ = P[1]), $ = $.replace(m, ".");
2119
- var I = $.split("."), K = R(I, O).join(".");
2120
- return A + K;
2121
- }
2122
- function te($) {
2123
- for (var O = [], P = 0, A = $.length, I, K; P < A; )
2124
- I = $.charCodeAt(P++), I >= 55296 && I <= 56319 && P < A ? (K = $.charCodeAt(P++), (K & 64512) == 56320 ? O.push(((I & 1023) << 10) + (K & 1023) + 65536) : (O.push(I), P--)) : O.push(I);
2125
- return O;
2126
- }
2127
- function re($) {
2128
- return R($, function(O) {
2129
- var P = "";
2130
- return O > 65535 && (O -= 65536, P += S(O >>> 10 & 1023 | 55296), O = 56320 | O & 1023), P += S(O), P;
2131
- }).join("");
2132
- }
2133
- function L($) {
2134
- return $ - 48 < 10 ? $ - 22 : $ - 65 < 26 ? $ - 65 : $ - 97 < 26 ? $ - 97 : l;
2135
- }
2136
- function V($, O) {
2137
- return $ + 22 + 75 * ($ < 26) - ((O != 0) << 5);
2138
- }
2139
- function Q($, O, P) {
2140
- var A = 0;
2141
- for ($ = P ? j($ / p) : $ >> 1, $ += j($ / O); $ > w * u >> 1; A += l)
2142
- $ = j($ / w);
2143
- return j(A + (w + 1) * $ / ($ + f));
2144
- }
2145
- function Y($) {
2146
- var O = [], P = $.length, A, I = 0, K = y, B = h, X, ne, ie, pe, W, Z, oe, ye, $e;
2147
- for (X = $.lastIndexOf(g), X < 0 && (X = 0), ne = 0; ne < X; ++ne)
2148
- $.charCodeAt(ne) >= 128 && E("not-basic"), O.push($.charCodeAt(ne));
2149
- for (ie = X > 0 ? X + 1 : 0; ie < P; ) {
2150
- for (pe = I, W = 1, Z = l; ie >= P && E("invalid-input"), oe = L($.charCodeAt(ie++)), (oe >= l || oe > j((i - I) / W)) && E("overflow"), I += oe * W, ye = Z <= B ? c : Z >= B + u ? u : Z - B, !(oe < ye); Z += l)
2151
- $e = l - ye, W > j(i / $e) && E("overflow"), W *= $e;
2152
- A = O.length + 1, B = Q(I - pe, A, pe == 0), j(I / A) > i - K && E("overflow"), K += j(I / A), I %= A, O.splice(I++, 0, K);
2153
- }
2154
- return re(O);
2155
- }
2156
- function he($) {
2157
- var O, P, A, I, K, B, X, ne, ie, pe, W, Z = [], oe, ye, $e, dt;
2158
- for ($ = te($), oe = $.length, O = y, P = 0, K = h, B = 0; B < oe; ++B)
2159
- W = $[B], W < 128 && Z.push(S(W));
2160
- for (A = I = Z.length, I && Z.push(g); A < oe; ) {
2161
- for (X = i, B = 0; B < oe; ++B)
2162
- W = $[B], W >= O && W < X && (X = W);
2163
- for (ye = A + 1, X - O > j((i - P) / ye) && E("overflow"), P += (X - O) * ye, O = X, B = 0; B < oe; ++B)
2164
- if (W = $[B], W < O && ++P > i && E("overflow"), W == O) {
2165
- for (ne = P, ie = l; pe = ie <= K ? c : ie >= K + u ? u : ie - K, !(ne < pe); ie += l)
2166
- dt = ne - pe, $e = l - pe, Z.push(
2167
- S(V(pe + dt % $e, 0))
2168
- ), ne = j(dt / $e);
2169
- Z.push(S(V(ne, 0))), K = Q(P, ye, A == I), P = 0, ++A;
2170
- }
2171
- ++P, ++O;
2172
- }
2173
- return Z.join("");
2174
- }
2175
- function ft($) {
2176
- return F($, function(O) {
2177
- return b.test(O) ? Y(O.slice(4).toLowerCase()) : O;
2178
- });
2179
- }
2180
- function Ke($) {
2181
- return F($, function(O) {
2182
- return x.test(O) ? "xn--" + he(O) : O;
2183
- });
2184
- }
2185
- if (n = {
2186
- /**
2187
- * A string representing the current Punycode.js version number.
2188
- * @memberOf punycode
2189
- * @type String
2190
- */
2191
- version: "1.4.1",
2192
- /**
2193
- * An object of methods to convert from JavaScript's internal character
2194
- * representation (UCS-2) to Unicode code points, and back.
2195
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
2196
- * @memberOf punycode
2197
- * @type Object
2198
- */
2199
- ucs2: {
2200
- decode: te,
2201
- encode: re
2202
- },
2203
- decode: Y,
2204
- encode: he,
2205
- toASCII: Ke,
2206
- toUnicode: ft
2207
- }, o && s)
2208
- if (t.exports == o)
2209
- s.exports = n;
2210
- else
2211
- for (k in n)
2212
- n.hasOwnProperty(k) && (o[k] = n[k]);
2213
- else
2214
- r.punycode = n;
2215
- })(He);
2216
- })(at, at.exports);
2217
- var Ta = at.exports, Ca = Error, Pa = EvalError, ka = RangeError, Ea = ReferenceError, nn = SyntaxError, Ve = TypeError, Na = URIError, Ra = function() {
2218
- if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
2219
- return !1;
2220
- if (typeof Symbol.iterator == "symbol")
2221
- return !0;
2222
- var e = {}, r = Symbol("test"), o = Object(r);
2223
- if (typeof r == "string" || Object.prototype.toString.call(r) !== "[object Symbol]" || Object.prototype.toString.call(o) !== "[object Symbol]")
2224
- return !1;
2225
- var s = 42;
2226
- e[r] = s;
2227
- for (r in e)
2228
- return !1;
2229
- if (typeof Object.keys == "function" && Object.keys(e).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(e).length !== 0)
2230
- return !1;
2231
- var a = Object.getOwnPropertySymbols(e);
2232
- if (a.length !== 1 || a[0] !== r || !Object.prototype.propertyIsEnumerable.call(e, r))
2233
- return !1;
2234
- if (typeof Object.getOwnPropertyDescriptor == "function") {
2235
- var n = Object.getOwnPropertyDescriptor(e, r);
2236
- if (n.value !== s || n.enumerable !== !0)
2237
- return !1;
2238
- }
2239
- return !0;
2240
- }, gr = typeof Symbol < "u" && Symbol, Aa = Ra, qa = function() {
2241
- return typeof gr != "function" || typeof Symbol != "function" || typeof gr("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : Aa();
2242
- }, yt = {
2243
- __proto__: null,
2244
- foo: {}
2245
- }, Ia = Object, La = function() {
2246
- return { __proto__: yt }.foo === yt.foo && !(yt instanceof Ia);
2247
- }, Ua = "Function.prototype.bind called on incompatible ", Fa = Object.prototype.toString, _a = Math.max, Ha = "[object Function]", br = function(e, r) {
2248
- for (var o = [], s = 0; s < e.length; s += 1)
2249
- o[s] = e[s];
2250
- for (var a = 0; a < r.length; a += 1)
2251
- o[a + e.length] = r[a];
2252
- return o;
2253
- }, Ba = function(e, r) {
2254
- for (var o = [], s = r, a = 0; s < e.length; s += 1, a += 1)
2255
- o[a] = e[s];
2256
- return o;
2257
- }, Ma = function(t, e) {
2258
- for (var r = "", o = 0; o < t.length; o += 1)
2259
- r += t[o], o + 1 < t.length && (r += e);
2260
- return r;
2261
- }, za = function(e) {
2262
- var r = this;
2263
- if (typeof r != "function" || Fa.apply(r) !== Ha)
2264
- throw new TypeError(Ua + r);
2265
- for (var o = Ba(arguments, 1), s, a = function() {
2266
- if (this instanceof s) {
2267
- var u = r.apply(
2268
- this,
2269
- br(o, arguments)
2270
- );
2271
- return Object(u) === u ? u : this;
2272
- }
2273
- return r.apply(
2274
- e,
2275
- br(o, arguments)
2276
- );
2277
- }, n = _a(0, r.length - o.length), i = [], l = 0; l < n; l++)
2278
- i[l] = "$" + l;
2279
- if (s = Function("binder", "return function (" + Ma(i, ",") + "){ return binder.apply(this,arguments); }")(a), r.prototype) {
2280
- var c = function() {
2281
- };
2282
- c.prototype = r.prototype, s.prototype = new c(), c.prototype = null;
2283
- }
2284
- return s;
2285
- }, Wa = za, Jt = Function.prototype.bind || Wa, Ja = Function.prototype.call, Ga = Object.prototype.hasOwnProperty, Va = Jt, Qa = Va.call(Ja, Ga), T, Ka = Ca, Da = Pa, Ya = ka, Xa = Ea, Ae = nn, Ee = Ve, Za = Na, on = Function, mt = function(t) {
2286
- try {
2287
- return on('"use strict"; return (' + t + ").constructor;")();
2288
- } catch {
2289
- }
2290
- }, Se = Object.getOwnPropertyDescriptor;
2291
- if (Se)
2292
- try {
2293
- Se({}, "");
2294
- } catch {
2295
- Se = null;
2296
- }
2297
- var gt = function() {
2298
- throw new Ee();
2299
- }, ei = Se ? function() {
2300
- try {
2301
- return arguments.callee, gt;
2302
- } catch {
2303
- try {
2304
- return Se(arguments, "callee").get;
2305
- } catch {
2306
- return gt;
2307
- }
2308
- }
2309
- }() : gt, Te = qa(), ti = La(), _ = Object.getPrototypeOf || (ti ? function(t) {
2310
- return t.__proto__;
2311
- } : null), Pe = {}, ri = typeof Uint8Array > "u" || !_ ? T : _(Uint8Array), Oe = {
2312
- __proto__: null,
2313
- "%AggregateError%": typeof AggregateError > "u" ? T : AggregateError,
2314
- "%Array%": Array,
2315
- "%ArrayBuffer%": typeof ArrayBuffer > "u" ? T : ArrayBuffer,
2316
- "%ArrayIteratorPrototype%": Te && _ ? _([][Symbol.iterator]()) : T,
2317
- "%AsyncFromSyncIteratorPrototype%": T,
2318
- "%AsyncFunction%": Pe,
2319
- "%AsyncGenerator%": Pe,
2320
- "%AsyncGeneratorFunction%": Pe,
2321
- "%AsyncIteratorPrototype%": Pe,
2322
- "%Atomics%": typeof Atomics > "u" ? T : Atomics,
2323
- "%BigInt%": typeof BigInt > "u" ? T : BigInt,
2324
- "%BigInt64Array%": typeof BigInt64Array > "u" ? T : BigInt64Array,
2325
- "%BigUint64Array%": typeof BigUint64Array > "u" ? T : BigUint64Array,
2326
- "%Boolean%": Boolean,
2327
- "%DataView%": typeof DataView > "u" ? T : DataView,
2328
- "%Date%": Date,
2329
- "%decodeURI%": decodeURI,
2330
- "%decodeURIComponent%": decodeURIComponent,
2331
- "%encodeURI%": encodeURI,
2332
- "%encodeURIComponent%": encodeURIComponent,
2333
- "%Error%": Ka,
2334
- "%eval%": eval,
2335
- // eslint-disable-line no-eval
2336
- "%EvalError%": Da,
2337
- "%Float32Array%": typeof Float32Array > "u" ? T : Float32Array,
2338
- "%Float64Array%": typeof Float64Array > "u" ? T : Float64Array,
2339
- "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? T : FinalizationRegistry,
2340
- "%Function%": on,
2341
- "%GeneratorFunction%": Pe,
2342
- "%Int8Array%": typeof Int8Array > "u" ? T : Int8Array,
2343
- "%Int16Array%": typeof Int16Array > "u" ? T : Int16Array,
2344
- "%Int32Array%": typeof Int32Array > "u" ? T : Int32Array,
2345
- "%isFinite%": isFinite,
2346
- "%isNaN%": isNaN,
2347
- "%IteratorPrototype%": Te && _ ? _(_([][Symbol.iterator]())) : T,
2348
- "%JSON%": typeof JSON == "object" ? JSON : T,
2349
- "%Map%": typeof Map > "u" ? T : Map,
2350
- "%MapIteratorPrototype%": typeof Map > "u" || !Te || !_ ? T : _((/* @__PURE__ */ new Map())[Symbol.iterator]()),
2351
- "%Math%": Math,
2352
- "%Number%": Number,
2353
- "%Object%": Object,
2354
- "%parseFloat%": parseFloat,
2355
- "%parseInt%": parseInt,
2356
- "%Promise%": typeof Promise > "u" ? T : Promise,
2357
- "%Proxy%": typeof Proxy > "u" ? T : Proxy,
2358
- "%RangeError%": Ya,
2359
- "%ReferenceError%": Xa,
2360
- "%Reflect%": typeof Reflect > "u" ? T : Reflect,
2361
- "%RegExp%": RegExp,
2362
- "%Set%": typeof Set > "u" ? T : Set,
2363
- "%SetIteratorPrototype%": typeof Set > "u" || !Te || !_ ? T : _((/* @__PURE__ */ new Set())[Symbol.iterator]()),
2364
- "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? T : SharedArrayBuffer,
2365
- "%String%": String,
2366
- "%StringIteratorPrototype%": Te && _ ? _(""[Symbol.iterator]()) : T,
2367
- "%Symbol%": Te ? Symbol : T,
2368
- "%SyntaxError%": Ae,
2369
- "%ThrowTypeError%": ei,
2370
- "%TypedArray%": ri,
2371
- "%TypeError%": Ee,
2372
- "%Uint8Array%": typeof Uint8Array > "u" ? T : Uint8Array,
2373
- "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? T : Uint8ClampedArray,
2374
- "%Uint16Array%": typeof Uint16Array > "u" ? T : Uint16Array,
2375
- "%Uint32Array%": typeof Uint32Array > "u" ? T : Uint32Array,
2376
- "%URIError%": Za,
2377
- "%WeakMap%": typeof WeakMap > "u" ? T : WeakMap,
2378
- "%WeakRef%": typeof WeakRef > "u" ? T : WeakRef,
2379
- "%WeakSet%": typeof WeakSet > "u" ? T : WeakSet
2380
- };
2381
- if (_)
2382
- try {
2383
- null.error;
2384
- } catch (t) {
2385
- var ni = _(_(t));
2386
- Oe["%Error.prototype%"] = ni;
2387
- }
2388
- var oi = function t(e) {
2389
- var r;
2390
- if (e === "%AsyncFunction%")
2391
- r = mt("async function () {}");
2392
- else if (e === "%GeneratorFunction%")
2393
- r = mt("function* () {}");
2394
- else if (e === "%AsyncGeneratorFunction%")
2395
- r = mt("async function* () {}");
2396
- else if (e === "%AsyncGenerator%") {
2397
- var o = t("%AsyncGeneratorFunction%");
2398
- o && (r = o.prototype);
2399
- } else if (e === "%AsyncIteratorPrototype%") {
2400
- var s = t("%AsyncGenerator%");
2401
- s && _ && (r = _(s.prototype));
2402
- }
2403
- return Oe[e] = r, r;
2404
- }, vr = {
2405
- __proto__: null,
2406
- "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
2407
- "%ArrayPrototype%": ["Array", "prototype"],
2408
- "%ArrayProto_entries%": ["Array", "prototype", "entries"],
2409
- "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
2410
- "%ArrayProto_keys%": ["Array", "prototype", "keys"],
2411
- "%ArrayProto_values%": ["Array", "prototype", "values"],
2412
- "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
2413
- "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
2414
- "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
2415
- "%BooleanPrototype%": ["Boolean", "prototype"],
2416
- "%DataViewPrototype%": ["DataView", "prototype"],
2417
- "%DatePrototype%": ["Date", "prototype"],
2418
- "%ErrorPrototype%": ["Error", "prototype"],
2419
- "%EvalErrorPrototype%": ["EvalError", "prototype"],
2420
- "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
2421
- "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
2422
- "%FunctionPrototype%": ["Function", "prototype"],
2423
- "%Generator%": ["GeneratorFunction", "prototype"],
2424
- "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
2425
- "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
2426
- "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
2427
- "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
2428
- "%JSONParse%": ["JSON", "parse"],
2429
- "%JSONStringify%": ["JSON", "stringify"],
2430
- "%MapPrototype%": ["Map", "prototype"],
2431
- "%NumberPrototype%": ["Number", "prototype"],
2432
- "%ObjectPrototype%": ["Object", "prototype"],
2433
- "%ObjProto_toString%": ["Object", "prototype", "toString"],
2434
- "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
2435
- "%PromisePrototype%": ["Promise", "prototype"],
2436
- "%PromiseProto_then%": ["Promise", "prototype", "then"],
2437
- "%Promise_all%": ["Promise", "all"],
2438
- "%Promise_reject%": ["Promise", "reject"],
2439
- "%Promise_resolve%": ["Promise", "resolve"],
2440
- "%RangeErrorPrototype%": ["RangeError", "prototype"],
2441
- "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
2442
- "%RegExpPrototype%": ["RegExp", "prototype"],
2443
- "%SetPrototype%": ["Set", "prototype"],
2444
- "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
2445
- "%StringPrototype%": ["String", "prototype"],
2446
- "%SymbolPrototype%": ["Symbol", "prototype"],
2447
- "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
2448
- "%TypedArrayPrototype%": ["TypedArray", "prototype"],
2449
- "%TypeErrorPrototype%": ["TypeError", "prototype"],
2450
- "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
2451
- "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
2452
- "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
2453
- "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
2454
- "%URIErrorPrototype%": ["URIError", "prototype"],
2455
- "%WeakMapPrototype%": ["WeakMap", "prototype"],
2456
- "%WeakSetPrototype%": ["WeakSet", "prototype"]
2457
- }, Qe = Jt, it = Qa, ai = Qe.call(Function.call, Array.prototype.concat), ii = Qe.call(Function.apply, Array.prototype.splice), xr = Qe.call(Function.call, String.prototype.replace), st = Qe.call(Function.call, String.prototype.slice), si = Qe.call(Function.call, RegExp.prototype.exec), li = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, ci = /\\(\\)?/g, ui = function(e) {
2458
- var r = st(e, 0, 1), o = st(e, -1);
2459
- if (r === "%" && o !== "%")
2460
- throw new Ae("invalid intrinsic syntax, expected closing `%`");
2461
- if (o === "%" && r !== "%")
2462
- throw new Ae("invalid intrinsic syntax, expected opening `%`");
2463
- var s = [];
2464
- return xr(e, li, function(a, n, i, l) {
2465
- s[s.length] = i ? xr(l, ci, "$1") : n || a;
2466
- }), s;
2467
- }, pi = function(e, r) {
2468
- var o = e, s;
2469
- if (it(vr, o) && (s = vr[o], o = "%" + s[0] + "%"), it(Oe, o)) {
2470
- var a = Oe[o];
2471
- if (a === Pe && (a = oi(o)), typeof a > "u" && !r)
2472
- throw new Ee("intrinsic " + e + " exists, but is not available. Please file an issue!");
2473
- return {
2474
- alias: s,
2475
- name: o,
2476
- value: a
2477
- };
2478
- }
2479
- throw new Ae("intrinsic " + e + " does not exist!");
2480
- }, Le = function(e, r) {
2481
- if (typeof e != "string" || e.length === 0)
2482
- throw new Ee("intrinsic name must be a non-empty string");
2483
- if (arguments.length > 1 && typeof r != "boolean")
2484
- throw new Ee('"allowMissing" argument must be a boolean');
2485
- if (si(/^%?[^%]*%?$/, e) === null)
2486
- throw new Ae("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
2487
- var o = ui(e), s = o.length > 0 ? o[0] : "", a = pi("%" + s + "%", r), n = a.name, i = a.value, l = !1, c = a.alias;
2488
- c && (s = c[0], ii(o, ai([0, 1], c)));
2489
- for (var u = 1, f = !0; u < o.length; u += 1) {
2490
- var p = o[u], h = st(p, 0, 1), y = st(p, -1);
2491
- if ((h === '"' || h === "'" || h === "`" || y === '"' || y === "'" || y === "`") && h !== y)
2492
- throw new Ae("property names with quotes must have matching quotes");
2493
- if ((p === "constructor" || !f) && (l = !0), s += "." + p, n = "%" + s + "%", it(Oe, n))
2494
- i = Oe[n];
2495
- else if (i != null) {
2496
- if (!(p in i)) {
2497
- if (!r)
2498
- throw new Ee("base intrinsic for " + e + " exists, but the property is not available.");
2499
- return;
2500
- }
2501
- if (Se && u + 1 >= o.length) {
2502
- var g = Se(i, p);
2503
- f = !!g, f && "get" in g && !("originalValue" in g.get) ? i = g.get : i = i[p];
2504
- } else
2505
- f = it(i, p), i = i[p];
2506
- f && !l && (Oe[n] = i);
2507
- }
2508
- }
2509
- return i;
2510
- }, an = { exports: {} }, bt, $r;
2511
- function Gt() {
2512
- if ($r) return bt;
2513
- $r = 1;
2514
- var t = Le, e = t("%Object.defineProperty%", !0) || !1;
2515
- if (e)
2516
- try {
2517
- e({}, "a", { value: 1 });
2518
- } catch {
2519
- e = !1;
2520
- }
2521
- return bt = e, bt;
2522
- }
2523
- var fi = Le, tt = fi("%Object.getOwnPropertyDescriptor%", !0);
2524
- if (tt)
2525
- try {
2526
- tt([], "length");
2527
- } catch {
2528
- tt = null;
2529
- }
2530
- var sn = tt, jr = Gt(), di = nn, Ce = Ve, wr = sn, hi = function(e, r, o) {
2531
- if (!e || typeof e != "object" && typeof e != "function")
2532
- throw new Ce("`obj` must be an object or a function`");
2533
- if (typeof r != "string" && typeof r != "symbol")
2534
- throw new Ce("`property` must be a string or a symbol`");
2535
- if (arguments.length > 3 && typeof arguments[3] != "boolean" && arguments[3] !== null)
2536
- throw new Ce("`nonEnumerable`, if provided, must be a boolean or null");
2537
- if (arguments.length > 4 && typeof arguments[4] != "boolean" && arguments[4] !== null)
2538
- throw new Ce("`nonWritable`, if provided, must be a boolean or null");
2539
- if (arguments.length > 5 && typeof arguments[5] != "boolean" && arguments[5] !== null)
2540
- throw new Ce("`nonConfigurable`, if provided, must be a boolean or null");
2541
- if (arguments.length > 6 && typeof arguments[6] != "boolean")
2542
- throw new Ce("`loose`, if provided, must be a boolean");
2543
- var s = arguments.length > 3 ? arguments[3] : null, a = arguments.length > 4 ? arguments[4] : null, n = arguments.length > 5 ? arguments[5] : null, i = arguments.length > 6 ? arguments[6] : !1, l = !!wr && wr(e, r);
2544
- if (jr)
2545
- jr(e, r, {
2546
- configurable: n === null && l ? l.configurable : !n,
2547
- enumerable: s === null && l ? l.enumerable : !s,
2548
- value: o,
2549
- writable: a === null && l ? l.writable : !a
2550
- });
2551
- else if (i || !s && !a && !n)
2552
- e[r] = o;
2553
- else
2554
- throw new di("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
2555
- }, kt = Gt(), ln = function() {
2556
- return !!kt;
2557
- };
2558
- ln.hasArrayLengthDefineBug = function() {
2559
- if (!kt)
2560
- return null;
2561
- try {
2562
- return kt([], "length", { value: 1 }).length !== 1;
2563
- } catch {
2564
- return !0;
2565
- }
2566
- };
2567
- var yi = ln, mi = Le, Sr = hi, gi = yi(), Or = sn, Tr = Ve, bi = mi("%Math.floor%"), vi = function(e, r) {
2568
- if (typeof e != "function")
2569
- throw new Tr("`fn` is not a function");
2570
- if (typeof r != "number" || r < 0 || r > 4294967295 || bi(r) !== r)
2571
- throw new Tr("`length` must be a positive 32-bit integer");
2572
- var o = arguments.length > 2 && !!arguments[2], s = !0, a = !0;
2573
- if ("length" in e && Or) {
2574
- var n = Or(e, "length");
2575
- n && !n.configurable && (s = !1), n && !n.writable && (a = !1);
2576
- }
2577
- return (s || a || !o) && (gi ? Sr(
2578
- /** @type {Parameters<define>[0]} */
2579
- e,
2580
- "length",
2581
- r,
2582
- !0,
2583
- !0
2584
- ) : Sr(
2585
- /** @type {Parameters<define>[0]} */
2586
- e,
2587
- "length",
2588
- r
2589
- )), e;
2590
- };
2591
- (function(t) {
2592
- var e = Jt, r = Le, o = vi, s = Ve, a = r("%Function.prototype.apply%"), n = r("%Function.prototype.call%"), i = r("%Reflect.apply%", !0) || e.call(n, a), l = Gt(), c = r("%Math.max%");
2593
- t.exports = function(p) {
2594
- if (typeof p != "function")
2595
- throw new s("a function is required");
2596
- var h = i(e, n, arguments);
2597
- return o(
2598
- h,
2599
- 1 + c(0, p.length - (arguments.length - 1)),
2600
- !0
2601
- );
2602
- };
2603
- var u = function() {
2604
- return i(e, a, arguments);
2605
- };
2606
- l ? l(t.exports, "apply", { value: u }) : t.exports.apply = u;
2607
- })(an);
2608
- var xi = an.exports, cn = Le, un = xi, $i = un(cn("String.prototype.indexOf")), ji = function(e, r) {
2609
- var o = cn(e, !!r);
2610
- return typeof o == "function" && $i(e, ".prototype.") > -1 ? un(o) : o;
2611
- };
2612
- const wi = /* @__PURE__ */ Zn(eo);
2613
- var Vt = typeof Map == "function" && Map.prototype, vt = Object.getOwnPropertyDescriptor && Vt ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, lt = Vt && vt && typeof vt.get == "function" ? vt.get : null, Cr = Vt && Map.prototype.forEach, Qt = typeof Set == "function" && Set.prototype, xt = Object.getOwnPropertyDescriptor && Qt ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, ct = Qt && xt && typeof xt.get == "function" ? xt.get : null, Pr = Qt && Set.prototype.forEach, Si = typeof WeakMap == "function" && WeakMap.prototype, Be = Si ? WeakMap.prototype.has : null, Oi = typeof WeakSet == "function" && WeakSet.prototype, Me = Oi ? WeakSet.prototype.has : null, Ti = typeof WeakRef == "function" && WeakRef.prototype, kr = Ti ? WeakRef.prototype.deref : null, Ci = Boolean.prototype.valueOf, Pi = Object.prototype.toString, ki = Function.prototype.toString, Ei = String.prototype.match, Kt = String.prototype.slice, ge = String.prototype.replace, Ni = String.prototype.toUpperCase, Er = String.prototype.toLowerCase, pn = RegExp.prototype.test, Nr = Array.prototype.concat, ce = Array.prototype.join, Ri = Array.prototype.slice, Rr = Math.floor, Et = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, $t = Object.getOwnPropertySymbols, Nt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, qe = typeof Symbol == "function" && typeof Symbol.iterator == "object", G = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === qe || !0) ? Symbol.toStringTag : null, fn = Object.prototype.propertyIsEnumerable, Ar = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(t) {
2614
- return t.__proto__;
2615
- } : null);
2616
- function qr(t, e) {
2617
- if (t === 1 / 0 || t === -1 / 0 || t !== t || t && t > -1e3 && t < 1e3 || pn.call(/e/, e))
2618
- return e;
2619
- var r = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
2620
- if (typeof t == "number") {
2621
- var o = t < 0 ? -Rr(-t) : Rr(t);
2622
- if (o !== t) {
2623
- var s = String(o), a = Kt.call(e, s.length + 1);
2624
- return ge.call(s, r, "$&_") + "." + ge.call(ge.call(a, /([0-9]{3})/g, "$&_"), /_$/, "");
2625
- }
2626
- }
2627
- return ge.call(e, r, "$&_");
2628
- }
2629
- var Rt = wi, Ir = Rt.custom, Lr = hn(Ir) ? Ir : null, Ai = function t(e, r, o, s) {
2630
- var a = r || {};
2631
- if (me(a, "quoteStyle") && a.quoteStyle !== "single" && a.quoteStyle !== "double")
2632
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
2633
- if (me(a, "maxStringLength") && (typeof a.maxStringLength == "number" ? a.maxStringLength < 0 && a.maxStringLength !== 1 / 0 : a.maxStringLength !== null))
2634
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
2635
- var n = me(a, "customInspect") ? a.customInspect : !0;
2636
- if (typeof n != "boolean" && n !== "symbol")
2637
- throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
2638
- if (me(a, "indent") && a.indent !== null && a.indent !== " " && !(parseInt(a.indent, 10) === a.indent && a.indent > 0))
2639
- throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
2640
- if (me(a, "numericSeparator") && typeof a.numericSeparator != "boolean")
2641
- throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
2642
- var i = a.numericSeparator;
2643
- if (typeof e > "u")
2644
- return "undefined";
2645
- if (e === null)
2646
- return "null";
2647
- if (typeof e == "boolean")
2648
- return e ? "true" : "false";
2649
- if (typeof e == "string")
2650
- return mn(e, a);
2651
- if (typeof e == "number") {
2652
- if (e === 0)
2653
- return 1 / 0 / e > 0 ? "0" : "-0";
2654
- var l = String(e);
2655
- return i ? qr(e, l) : l;
2656
- }
2657
- if (typeof e == "bigint") {
2658
- var c = String(e) + "n";
2659
- return i ? qr(e, c) : c;
2660
- }
2661
- var u = typeof a.depth > "u" ? 5 : a.depth;
2662
- if (typeof o > "u" && (o = 0), o >= u && u > 0 && typeof e == "object")
2663
- return At(e) ? "[Array]" : "[Object]";
2664
- var f = Yi(a, o);
2665
- if (typeof s > "u")
2666
- s = [];
2667
- else if (yn(s, e) >= 0)
2668
- return "[Circular]";
2669
- function p(L, V, Q) {
2670
- if (V && (s = Ri.call(s), s.push(V)), Q) {
2671
- var Y = {
2672
- depth: a.depth
2673
- };
2674
- return me(a, "quoteStyle") && (Y.quoteStyle = a.quoteStyle), t(L, Y, o + 1, s);
2675
- }
2676
- return t(L, a, o + 1, s);
2677
- }
2678
- if (typeof e == "function" && !Ur(e)) {
2679
- var h = Mi(e), y = Ye(e, p);
2680
- return "[Function" + (h ? ": " + h : " (anonymous)") + "]" + (y.length > 0 ? " { " + ce.call(y, ", ") + " }" : "");
2681
- }
2682
- if (hn(e)) {
2683
- var g = qe ? ge.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Nt.call(e);
2684
- return typeof e == "object" && !qe ? Fe(g) : g;
2685
- }
2686
- if (Qi(e)) {
2687
- for (var b = "<" + Er.call(String(e.nodeName)), x = e.attributes || [], m = 0; m < x.length; m++)
2688
- b += " " + x[m].name + "=" + dn(qi(x[m].value), "double", a);
2689
- return b += ">", e.childNodes && e.childNodes.length && (b += "..."), b += "</" + Er.call(String(e.nodeName)) + ">", b;
2690
- }
2691
- if (At(e)) {
2692
- if (e.length === 0)
2693
- return "[]";
2694
- var v = Ye(e, p);
2695
- return f && !Di(v) ? "[" + qt(v, f) + "]" : "[ " + ce.call(v, ", ") + " ]";
2696
- }
2697
- if (Li(e)) {
2698
- var w = Ye(e, p);
2699
- return !("cause" in Error.prototype) && "cause" in e && !fn.call(e, "cause") ? "{ [" + String(e) + "] " + ce.call(Nr.call("[cause]: " + p(e.cause), w), ", ") + " }" : w.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + ce.call(w, ", ") + " }";
2700
- }
2701
- if (typeof e == "object" && n) {
2702
- if (Lr && typeof e[Lr] == "function" && Rt)
2703
- return Rt(e, { depth: u - o });
2704
- if (n !== "symbol" && typeof e.inspect == "function")
2705
- return e.inspect();
2706
- }
2707
- if (zi(e)) {
2708
- var j = [];
2709
- return Cr && Cr.call(e, function(L, V) {
2710
- j.push(p(V, e, !0) + " => " + p(L, e));
2711
- }), Fr("Map", lt.call(e), j, f);
2712
- }
2713
- if (Gi(e)) {
2714
- var S = [];
2715
- return Pr && Pr.call(e, function(L) {
2716
- S.push(p(L, e));
2717
- }), Fr("Set", ct.call(e), S, f);
2718
- }
2719
- if (Wi(e))
2720
- return jt("WeakMap");
2721
- if (Vi(e))
2722
- return jt("WeakSet");
2723
- if (Ji(e))
2724
- return jt("WeakRef");
2725
- if (Fi(e))
2726
- return Fe(p(Number(e)));
2727
- if (Hi(e))
2728
- return Fe(p(Et.call(e)));
2729
- if (_i(e))
2730
- return Fe(Ci.call(e));
2731
- if (Ui(e))
2732
- return Fe(p(String(e)));
2733
- if (typeof window < "u" && e === window)
2734
- return "{ [object Window] }";
2735
- if (typeof globalThis < "u" && e === globalThis || typeof He < "u" && e === He)
2736
- return "{ [object globalThis] }";
2737
- if (!Ii(e) && !Ur(e)) {
2738
- var k = Ye(e, p), E = Ar ? Ar(e) === Object.prototype : e instanceof Object || e.constructor === Object, R = e instanceof Object ? "" : "null prototype", F = !E && G && Object(e) === e && G in e ? Kt.call(xe(e), 8, -1) : R ? "Object" : "", te = E || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", re = te + (F || R ? "[" + ce.call(Nr.call([], F || [], R || []), ": ") + "] " : "");
2739
- return k.length === 0 ? re + "{}" : f ? re + "{" + qt(k, f) + "}" : re + "{ " + ce.call(k, ", ") + " }";
2740
- }
2741
- return String(e);
2742
- };
2743
- function dn(t, e, r) {
2744
- var o = (r.quoteStyle || e) === "double" ? '"' : "'";
2745
- return o + t + o;
2746
- }
2747
- function qi(t) {
2748
- return ge.call(String(t), /"/g, "&quot;");
2749
- }
2750
- function At(t) {
2751
- return xe(t) === "[object Array]" && (!G || !(typeof t == "object" && G in t));
2752
- }
2753
- function Ii(t) {
2754
- return xe(t) === "[object Date]" && (!G || !(typeof t == "object" && G in t));
2755
- }
2756
- function Ur(t) {
2757
- return xe(t) === "[object RegExp]" && (!G || !(typeof t == "object" && G in t));
2758
- }
2759
- function Li(t) {
2760
- return xe(t) === "[object Error]" && (!G || !(typeof t == "object" && G in t));
2761
- }
2762
- function Ui(t) {
2763
- return xe(t) === "[object String]" && (!G || !(typeof t == "object" && G in t));
2764
- }
2765
- function Fi(t) {
2766
- return xe(t) === "[object Number]" && (!G || !(typeof t == "object" && G in t));
2767
- }
2768
- function _i(t) {
2769
- return xe(t) === "[object Boolean]" && (!G || !(typeof t == "object" && G in t));
2770
- }
2771
- function hn(t) {
2772
- if (qe)
2773
- return t && typeof t == "object" && t instanceof Symbol;
2774
- if (typeof t == "symbol")
2775
- return !0;
2776
- if (!t || typeof t != "object" || !Nt)
2777
- return !1;
2778
- try {
2779
- return Nt.call(t), !0;
2780
- } catch {
2781
- }
2782
- return !1;
2783
- }
2784
- function Hi(t) {
2785
- if (!t || typeof t != "object" || !Et)
2786
- return !1;
2787
- try {
2788
- return Et.call(t), !0;
2789
- } catch {
2790
- }
2791
- return !1;
2792
- }
2793
- var Bi = Object.prototype.hasOwnProperty || function(t) {
2794
- return t in this;
2795
- };
2796
- function me(t, e) {
2797
- return Bi.call(t, e);
2798
- }
2799
- function xe(t) {
2800
- return Pi.call(t);
2801
- }
2802
- function Mi(t) {
2803
- if (t.name)
2804
- return t.name;
2805
- var e = Ei.call(ki.call(t), /^function\s*([\w$]+)/);
2806
- return e ? e[1] : null;
2807
- }
2808
- function yn(t, e) {
2809
- if (t.indexOf)
2810
- return t.indexOf(e);
2811
- for (var r = 0, o = t.length; r < o; r++)
2812
- if (t[r] === e)
2813
- return r;
2814
- return -1;
2815
- }
2816
- function zi(t) {
2817
- if (!lt || !t || typeof t != "object")
2818
- return !1;
2819
- try {
2820
- lt.call(t);
2821
- try {
2822
- ct.call(t);
2823
- } catch {
2824
- return !0;
2825
- }
2826
- return t instanceof Map;
2827
- } catch {
2828
- }
2829
- return !1;
2830
- }
2831
- function Wi(t) {
2832
- if (!Be || !t || typeof t != "object")
2833
- return !1;
2834
- try {
2835
- Be.call(t, Be);
2836
- try {
2837
- Me.call(t, Me);
2838
- } catch {
2839
- return !0;
2840
- }
2841
- return t instanceof WeakMap;
2842
- } catch {
2843
- }
2844
- return !1;
2845
- }
2846
- function Ji(t) {
2847
- if (!kr || !t || typeof t != "object")
2848
- return !1;
2849
- try {
2850
- return kr.call(t), !0;
2851
- } catch {
2852
- }
2853
- return !1;
2854
- }
2855
- function Gi(t) {
2856
- if (!ct || !t || typeof t != "object")
2857
- return !1;
2858
- try {
2859
- ct.call(t);
2860
- try {
2861
- lt.call(t);
2862
- } catch {
2863
- return !0;
2864
- }
2865
- return t instanceof Set;
2866
- } catch {
2867
- }
2868
- return !1;
2869
- }
2870
- function Vi(t) {
2871
- if (!Me || !t || typeof t != "object")
2872
- return !1;
2873
- try {
2874
- Me.call(t, Me);
2875
- try {
2876
- Be.call(t, Be);
2877
- } catch {
2878
- return !0;
2879
- }
2880
- return t instanceof WeakSet;
2881
- } catch {
2882
- }
2883
- return !1;
2884
- }
2885
- function Qi(t) {
2886
- return !t || typeof t != "object" ? !1 : typeof HTMLElement < "u" && t instanceof HTMLElement ? !0 : typeof t.nodeName == "string" && typeof t.getAttribute == "function";
2887
- }
2888
- function mn(t, e) {
2889
- if (t.length > e.maxStringLength) {
2890
- var r = t.length - e.maxStringLength, o = "... " + r + " more character" + (r > 1 ? "s" : "");
2891
- return mn(Kt.call(t, 0, e.maxStringLength), e) + o;
2892
- }
2893
- var s = ge.call(ge.call(t, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, Ki);
2894
- return dn(s, "single", e);
2895
- }
2896
- function Ki(t) {
2897
- var e = t.charCodeAt(0), r = {
2898
- 8: "b",
2899
- 9: "t",
2900
- 10: "n",
2901
- 12: "f",
2902
- 13: "r"
2903
- }[e];
2904
- return r ? "\\" + r : "\\x" + (e < 16 ? "0" : "") + Ni.call(e.toString(16));
2905
- }
2906
- function Fe(t) {
2907
- return "Object(" + t + ")";
2908
- }
2909
- function jt(t) {
2910
- return t + " { ? }";
2911
- }
2912
- function Fr(t, e, r, o) {
2913
- var s = o ? qt(r, o) : ce.call(r, ", ");
2914
- return t + " (" + e + ") {" + s + "}";
2915
- }
2916
- function Di(t) {
2917
- for (var e = 0; e < t.length; e++)
2918
- if (yn(t[e], `
2919
- `) >= 0)
2920
- return !1;
2921
- return !0;
2922
- }
2923
- function Yi(t, e) {
2924
- var r;
2925
- if (t.indent === " ")
2926
- r = " ";
2927
- else if (typeof t.indent == "number" && t.indent > 0)
2928
- r = ce.call(Array(t.indent + 1), " ");
2929
- else
2930
- return null;
2931
- return {
2932
- base: r,
2933
- prev: ce.call(Array(e + 1), r)
2934
- };
2935
- }
2936
- function qt(t, e) {
2937
- if (t.length === 0)
2938
- return "";
2939
- var r = `
2940
- ` + e.prev + e.base;
2941
- return r + ce.call(t, "," + r) + `
2942
- ` + e.prev;
2943
- }
2944
- function Ye(t, e) {
2945
- var r = At(t), o = [];
2946
- if (r) {
2947
- o.length = t.length;
2948
- for (var s = 0; s < t.length; s++)
2949
- o[s] = me(t, s) ? e(t[s], t) : "";
2950
- }
2951
- var a = typeof $t == "function" ? $t(t) : [], n;
2952
- if (qe) {
2953
- n = {};
2954
- for (var i = 0; i < a.length; i++)
2955
- n["$" + a[i]] = a[i];
2956
- }
2957
- for (var l in t)
2958
- me(t, l) && (r && String(Number(l)) === l && l < t.length || qe && n["$" + l] instanceof Symbol || (pn.call(/[^\w$]/, l) ? o.push(e(l, t) + ": " + e(t[l], t)) : o.push(l + ": " + e(t[l], t))));
2959
- if (typeof $t == "function")
2960
- for (var c = 0; c < a.length; c++)
2961
- fn.call(t, a[c]) && o.push("[" + e(a[c]) + "]: " + e(t[a[c]], t));
2962
- return o;
2963
- }
2964
- var gn = Le, Ue = ji, Xi = Ai, Zi = Ve, Xe = gn("%WeakMap%", !0), Ze = gn("%Map%", !0), es = Ue("WeakMap.prototype.get", !0), ts = Ue("WeakMap.prototype.set", !0), rs = Ue("WeakMap.prototype.has", !0), ns = Ue("Map.prototype.get", !0), os = Ue("Map.prototype.set", !0), as = Ue("Map.prototype.has", !0), Dt = function(t, e) {
2965
- for (var r = t, o; (o = r.next) !== null; r = o)
2966
- if (o.key === e)
2967
- return r.next = o.next, o.next = /** @type {NonNullable<typeof list.next>} */
2968
- t.next, t.next = o, o;
2969
- }, is = function(t, e) {
2970
- var r = Dt(t, e);
2971
- return r && r.value;
2972
- }, ss = function(t, e, r) {
2973
- var o = Dt(t, e);
2974
- o ? o.value = r : t.next = /** @type {import('.').ListNode<typeof value>} */
2975
- {
2976
- // eslint-disable-line no-param-reassign, no-extra-parens
2977
- key: e,
2978
- next: t.next,
2979
- value: r
2980
- };
2981
- }, ls = function(t, e) {
2982
- return !!Dt(t, e);
2983
- }, cs = function() {
2984
- var e, r, o, s = {
2985
- assert: function(a) {
2986
- if (!s.has(a))
2987
- throw new Zi("Side channel does not contain " + Xi(a));
2988
- },
2989
- get: function(a) {
2990
- if (Xe && a && (typeof a == "object" || typeof a == "function")) {
2991
- if (e)
2992
- return es(e, a);
2993
- } else if (Ze) {
2994
- if (r)
2995
- return ns(r, a);
2996
- } else if (o)
2997
- return is(o, a);
2998
- },
2999
- has: function(a) {
3000
- if (Xe && a && (typeof a == "object" || typeof a == "function")) {
3001
- if (e)
3002
- return rs(e, a);
3003
- } else if (Ze) {
3004
- if (r)
3005
- return as(r, a);
3006
- } else if (o)
3007
- return ls(o, a);
3008
- return !1;
3009
- },
3010
- set: function(a, n) {
3011
- Xe && a && (typeof a == "object" || typeof a == "function") ? (e || (e = new Xe()), ts(e, a, n)) : Ze ? (r || (r = new Ze()), os(r, a, n)) : (o || (o = { key: {}, next: null }), ss(o, a, n));
3012
- }
3013
- };
3014
- return s;
3015
- }, us = String.prototype.replace, ps = /%20/g, wt = {
3016
- RFC1738: "RFC1738",
3017
- RFC3986: "RFC3986"
3018
- }, Yt = {
3019
- default: wt.RFC3986,
3020
- formatters: {
3021
- RFC1738: function(t) {
3022
- return us.call(t, ps, "+");
3023
- },
3024
- RFC3986: function(t) {
3025
- return String(t);
3026
- }
3027
- },
3028
- RFC1738: wt.RFC1738,
3029
- RFC3986: wt.RFC3986
3030
- }, fs = Yt, St = Object.prototype.hasOwnProperty, je = Array.isArray, se = function() {
3031
- for (var t = [], e = 0; e < 256; ++e)
3032
- t.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase());
3033
- return t;
3034
- }(), ds = function(e) {
3035
- for (; e.length > 1; ) {
3036
- var r = e.pop(), o = r.obj[r.prop];
3037
- if (je(o)) {
3038
- for (var s = [], a = 0; a < o.length; ++a)
3039
- typeof o[a] < "u" && s.push(o[a]);
3040
- r.obj[r.prop] = s;
3041
- }
3042
- }
3043
- }, bn = function(e, r) {
3044
- for (var o = r && r.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, s = 0; s < e.length; ++s)
3045
- typeof e[s] < "u" && (o[s] = e[s]);
3046
- return o;
3047
- }, hs = function t(e, r, o) {
3048
- if (!r)
3049
- return e;
3050
- if (typeof r != "object") {
3051
- if (je(e))
3052
- e.push(r);
3053
- else if (e && typeof e == "object")
3054
- (o && (o.plainObjects || o.allowPrototypes) || !St.call(Object.prototype, r)) && (e[r] = !0);
3055
- else
3056
- return [e, r];
3057
- return e;
3058
- }
3059
- if (!e || typeof e != "object")
3060
- return [e].concat(r);
3061
- var s = e;
3062
- return je(e) && !je(r) && (s = bn(e, o)), je(e) && je(r) ? (r.forEach(function(a, n) {
3063
- if (St.call(e, n)) {
3064
- var i = e[n];
3065
- i && typeof i == "object" && a && typeof a == "object" ? e[n] = t(i, a, o) : e.push(a);
3066
- } else
3067
- e[n] = a;
3068
- }), e) : Object.keys(r).reduce(function(a, n) {
3069
- var i = r[n];
3070
- return St.call(a, n) ? a[n] = t(a[n], i, o) : a[n] = i, a;
3071
- }, s);
3072
- }, ys = function(e, r) {
3073
- return Object.keys(r).reduce(function(o, s) {
3074
- return o[s] = r[s], o;
3075
- }, e);
3076
- }, ms = function(t, e, r) {
3077
- var o = t.replace(/\+/g, " ");
3078
- if (r === "iso-8859-1")
3079
- return o.replace(/%[0-9a-f]{2}/gi, unescape);
3080
- try {
3081
- return decodeURIComponent(o);
3082
- } catch {
3083
- return o;
3084
- }
3085
- }, Ot = 1024, gs = function(e, r, o, s, a) {
3086
- if (e.length === 0)
3087
- return e;
3088
- var n = e;
3089
- if (typeof e == "symbol" ? n = Symbol.prototype.toString.call(e) : typeof e != "string" && (n = String(e)), o === "iso-8859-1")
3090
- return escape(n).replace(/%u[0-9a-f]{4}/gi, function(h) {
3091
- return "%26%23" + parseInt(h.slice(2), 16) + "%3B";
3092
- });
3093
- for (var i = "", l = 0; l < n.length; l += Ot) {
3094
- for (var c = n.length >= Ot ? n.slice(l, l + Ot) : n, u = [], f = 0; f < c.length; ++f) {
3095
- var p = c.charCodeAt(f);
3096
- if (p === 45 || p === 46 || p === 95 || p === 126 || p >= 48 && p <= 57 || p >= 65 && p <= 90 || p >= 97 && p <= 122 || a === fs.RFC1738 && (p === 40 || p === 41)) {
3097
- u[u.length] = c.charAt(f);
3098
- continue;
3099
- }
3100
- if (p < 128) {
3101
- u[u.length] = se[p];
3102
- continue;
3103
- }
3104
- if (p < 2048) {
3105
- u[u.length] = se[192 | p >> 6] + se[128 | p & 63];
3106
- continue;
3107
- }
3108
- if (p < 55296 || p >= 57344) {
3109
- u[u.length] = se[224 | p >> 12] + se[128 | p >> 6 & 63] + se[128 | p & 63];
3110
- continue;
3111
- }
3112
- f += 1, p = 65536 + ((p & 1023) << 10 | c.charCodeAt(f) & 1023), u[u.length] = se[240 | p >> 18] + se[128 | p >> 12 & 63] + se[128 | p >> 6 & 63] + se[128 | p & 63];
3113
- }
3114
- i += u.join("");
3115
- }
3116
- return i;
3117
- }, bs = function(e) {
3118
- for (var r = [{ obj: { o: e }, prop: "o" }], o = [], s = 0; s < r.length; ++s)
3119
- for (var a = r[s], n = a.obj[a.prop], i = Object.keys(n), l = 0; l < i.length; ++l) {
3120
- var c = i[l], u = n[c];
3121
- typeof u == "object" && u !== null && o.indexOf(u) === -1 && (r.push({ obj: n, prop: c }), o.push(u));
3122
- }
3123
- return ds(r), e;
3124
- }, vs = function(e) {
3125
- return Object.prototype.toString.call(e) === "[object RegExp]";
3126
- }, xs = function(e) {
3127
- return !e || typeof e != "object" ? !1 : !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e));
3128
- }, $s = function(e, r) {
3129
- return [].concat(e, r);
3130
- }, js = function(e, r) {
3131
- if (je(e)) {
3132
- for (var o = [], s = 0; s < e.length; s += 1)
3133
- o.push(r(e[s]));
3134
- return o;
3135
- }
3136
- return r(e);
3137
- }, vn = {
3138
- arrayToObject: bn,
3139
- assign: ys,
3140
- combine: $s,
3141
- compact: bs,
3142
- decode: ms,
3143
- encode: gs,
3144
- isBuffer: xs,
3145
- isRegExp: vs,
3146
- maybeMap: js,
3147
- merge: hs
3148
- }, xn = cs, rt = vn, ze = Yt, ws = Object.prototype.hasOwnProperty, $n = {
3149
- brackets: function(e) {
3150
- return e + "[]";
3151
- },
3152
- comma: "comma",
3153
- indices: function(e, r) {
3154
- return e + "[" + r + "]";
3155
- },
3156
- repeat: function(e) {
3157
- return e;
3158
- }
3159
- }, le = Array.isArray, Ss = Array.prototype.push, jn = function(t, e) {
3160
- Ss.apply(t, le(e) ? e : [e]);
3161
- }, Os = Date.prototype.toISOString, _r = ze.default, U = {
3162
- addQueryPrefix: !1,
3163
- allowDots: !1,
3164
- allowEmptyArrays: !1,
3165
- arrayFormat: "indices",
3166
- charset: "utf-8",
3167
- charsetSentinel: !1,
3168
- delimiter: "&",
3169
- encode: !0,
3170
- encodeDotInKeys: !1,
3171
- encoder: rt.encode,
3172
- encodeValuesOnly: !1,
3173
- format: _r,
3174
- formatter: ze.formatters[_r],
3175
- // deprecated
3176
- indices: !1,
3177
- serializeDate: function(e) {
3178
- return Os.call(e);
3179
- },
3180
- skipNulls: !1,
3181
- strictNullHandling: !1
3182
- }, Ts = function(e) {
3183
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint";
3184
- }, Tt = {}, Cs = function t(e, r, o, s, a, n, i, l, c, u, f, p, h, y, g, b, x, m) {
3185
- for (var v = e, w = m, j = 0, S = !1; (w = w.get(Tt)) !== void 0 && !S; ) {
3186
- var k = w.get(e);
3187
- if (j += 1, typeof k < "u") {
3188
- if (k === j)
3189
- throw new RangeError("Cyclic object value");
3190
- S = !0;
3191
- }
3192
- typeof w.get(Tt) > "u" && (j = 0);
3193
- }
3194
- if (typeof u == "function" ? v = u(r, v) : v instanceof Date ? v = h(v) : o === "comma" && le(v) && (v = rt.maybeMap(v, function($) {
3195
- return $ instanceof Date ? h($) : $;
3196
- })), v === null) {
3197
- if (n)
3198
- return c && !b ? c(r, U.encoder, x, "key", y) : r;
3199
- v = "";
3200
- }
3201
- if (Ts(v) || rt.isBuffer(v)) {
3202
- if (c) {
3203
- var E = b ? r : c(r, U.encoder, x, "key", y);
3204
- return [g(E) + "=" + g(c(v, U.encoder, x, "value", y))];
3205
- }
3206
- return [g(r) + "=" + g(String(v))];
3207
- }
3208
- var R = [];
3209
- if (typeof v > "u")
3210
- return R;
3211
- var F;
3212
- if (o === "comma" && le(v))
3213
- b && c && (v = rt.maybeMap(v, c)), F = [{ value: v.length > 0 ? v.join(",") || null : void 0 }];
3214
- else if (le(u))
3215
- F = u;
3216
- else {
3217
- var te = Object.keys(v);
3218
- F = f ? te.sort(f) : te;
3219
- }
3220
- var re = l ? r.replace(/\./g, "%2E") : r, L = s && le(v) && v.length === 1 ? re + "[]" : re;
3221
- if (a && le(v) && v.length === 0)
3222
- return L + "[]";
3223
- for (var V = 0; V < F.length; ++V) {
3224
- var Q = F[V], Y = typeof Q == "object" && typeof Q.value < "u" ? Q.value : v[Q];
3225
- if (!(i && Y === null)) {
3226
- var he = p && l ? Q.replace(/\./g, "%2E") : Q, ft = le(v) ? typeof o == "function" ? o(L, he) : L : L + (p ? "." + he : "[" + he + "]");
3227
- m.set(e, j);
3228
- var Ke = xn();
3229
- Ke.set(Tt, m), jn(R, t(
3230
- Y,
3231
- ft,
3232
- o,
3233
- s,
3234
- a,
3235
- n,
3236
- i,
3237
- l,
3238
- o === "comma" && b && le(v) ? null : c,
3239
- u,
3240
- f,
3241
- p,
3242
- h,
3243
- y,
3244
- g,
3245
- b,
3246
- x,
3247
- Ke
3248
- ));
3249
- }
3250
- }
3251
- return R;
3252
- }, Ps = function(e) {
3253
- if (!e)
3254
- return U;
3255
- if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
3256
- throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
3257
- if (typeof e.encodeDotInKeys < "u" && typeof e.encodeDotInKeys != "boolean")
3258
- throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
3259
- if (e.encoder !== null && typeof e.encoder < "u" && typeof e.encoder != "function")
3260
- throw new TypeError("Encoder has to be a function.");
3261
- var r = e.charset || U.charset;
3262
- if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
3263
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
3264
- var o = ze.default;
3265
- if (typeof e.format < "u") {
3266
- if (!ws.call(ze.formatters, e.format))
3267
- throw new TypeError("Unknown format option provided.");
3268
- o = e.format;
3269
- }
3270
- var s = ze.formatters[o], a = U.filter;
3271
- (typeof e.filter == "function" || le(e.filter)) && (a = e.filter);
3272
- var n;
3273
- if (e.arrayFormat in $n ? n = e.arrayFormat : "indices" in e ? n = e.indices ? "indices" : "repeat" : n = U.arrayFormat, "commaRoundTrip" in e && typeof e.commaRoundTrip != "boolean")
3274
- throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
3275
- var i = typeof e.allowDots > "u" ? e.encodeDotInKeys === !0 ? !0 : U.allowDots : !!e.allowDots;
3276
- return {
3277
- addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix : U.addQueryPrefix,
3278
- allowDots: i,
3279
- allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : U.allowEmptyArrays,
3280
- arrayFormat: n,
3281
- charset: r,
3282
- charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : U.charsetSentinel,
3283
- commaRoundTrip: e.commaRoundTrip,
3284
- delimiter: typeof e.delimiter > "u" ? U.delimiter : e.delimiter,
3285
- encode: typeof e.encode == "boolean" ? e.encode : U.encode,
3286
- encodeDotInKeys: typeof e.encodeDotInKeys == "boolean" ? e.encodeDotInKeys : U.encodeDotInKeys,
3287
- encoder: typeof e.encoder == "function" ? e.encoder : U.encoder,
3288
- encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly : U.encodeValuesOnly,
3289
- filter: a,
3290
- format: o,
3291
- formatter: s,
3292
- serializeDate: typeof e.serializeDate == "function" ? e.serializeDate : U.serializeDate,
3293
- skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls : U.skipNulls,
3294
- sort: typeof e.sort == "function" ? e.sort : null,
3295
- strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : U.strictNullHandling
3296
- };
3297
- }, ks = function(t, e) {
3298
- var r = t, o = Ps(e), s, a;
3299
- typeof o.filter == "function" ? (a = o.filter, r = a("", r)) : le(o.filter) && (a = o.filter, s = a);
3300
- var n = [];
3301
- if (typeof r != "object" || r === null)
3302
- return "";
3303
- var i = $n[o.arrayFormat], l = i === "comma" && o.commaRoundTrip;
3304
- s || (s = Object.keys(r)), o.sort && s.sort(o.sort);
3305
- for (var c = xn(), u = 0; u < s.length; ++u) {
3306
- var f = s[u];
3307
- o.skipNulls && r[f] === null || jn(n, Cs(
3308
- r[f],
3309
- f,
3310
- i,
3311
- l,
3312
- o.allowEmptyArrays,
3313
- o.strictNullHandling,
3314
- o.skipNulls,
3315
- o.encodeDotInKeys,
3316
- o.encode ? o.encoder : null,
3317
- o.filter,
3318
- o.sort,
3319
- o.allowDots,
3320
- o.serializeDate,
3321
- o.format,
3322
- o.formatter,
3323
- o.encodeValuesOnly,
3324
- o.charset,
3325
- c
3326
- ));
3327
- }
3328
- var p = n.join(o.delimiter), h = o.addQueryPrefix === !0 ? "?" : "";
3329
- return o.charsetSentinel && (o.charset === "iso-8859-1" ? h += "utf8=%26%2310003%3B&" : h += "utf8=%E2%9C%93&"), p.length > 0 ? h + p : "";
3330
- }, Ie = vn, It = Object.prototype.hasOwnProperty, Es = Array.isArray, q = {
3331
- allowDots: !1,
3332
- allowEmptyArrays: !1,
3333
- allowPrototypes: !1,
3334
- allowSparse: !1,
3335
- arrayLimit: 20,
3336
- charset: "utf-8",
3337
- charsetSentinel: !1,
3338
- comma: !1,
3339
- decodeDotInKeys: !1,
3340
- decoder: Ie.decode,
3341
- delimiter: "&",
3342
- depth: 5,
3343
- duplicates: "combine",
3344
- ignoreQueryPrefix: !1,
3345
- interpretNumericEntities: !1,
3346
- parameterLimit: 1e3,
3347
- parseArrays: !0,
3348
- plainObjects: !1,
3349
- strictDepth: !1,
3350
- strictNullHandling: !1
3351
- }, Ns = function(t) {
3352
- return t.replace(/&#(\d+);/g, function(e, r) {
3353
- return String.fromCharCode(parseInt(r, 10));
3354
- });
3355
- }, wn = function(t, e) {
3356
- return t && typeof t == "string" && e.comma && t.indexOf(",") > -1 ? t.split(",") : t;
3357
- }, Rs = "utf8=%26%2310003%3B", As = "utf8=%E2%9C%93", qs = function(e, r) {
3358
- var o = { __proto__: null }, s = r.ignoreQueryPrefix ? e.replace(/^\?/, "") : e;
3359
- s = s.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
3360
- var a = r.parameterLimit === 1 / 0 ? void 0 : r.parameterLimit, n = s.split(r.delimiter, a), i = -1, l, c = r.charset;
3361
- if (r.charsetSentinel)
3362
- for (l = 0; l < n.length; ++l)
3363
- n[l].indexOf("utf8=") === 0 && (n[l] === As ? c = "utf-8" : n[l] === Rs && (c = "iso-8859-1"), i = l, l = n.length);
3364
- for (l = 0; l < n.length; ++l)
3365
- if (l !== i) {
3366
- var u = n[l], f = u.indexOf("]="), p = f === -1 ? u.indexOf("=") : f + 1, h, y;
3367
- p === -1 ? (h = r.decoder(u, q.decoder, c, "key"), y = r.strictNullHandling ? null : "") : (h = r.decoder(u.slice(0, p), q.decoder, c, "key"), y = Ie.maybeMap(
3368
- wn(u.slice(p + 1), r),
3369
- function(b) {
3370
- return r.decoder(b, q.decoder, c, "value");
3371
- }
3372
- )), y && r.interpretNumericEntities && c === "iso-8859-1" && (y = Ns(y)), u.indexOf("[]=") > -1 && (y = Es(y) ? [y] : y);
3373
- var g = It.call(o, h);
3374
- g && r.duplicates === "combine" ? o[h] = Ie.combine(o[h], y) : (!g || r.duplicates === "last") && (o[h] = y);
3375
- }
3376
- return o;
3377
- }, Is = function(t, e, r, o) {
3378
- for (var s = o ? e : wn(e, r), a = t.length - 1; a >= 0; --a) {
3379
- var n, i = t[a];
3380
- if (i === "[]" && r.parseArrays)
3381
- n = r.allowEmptyArrays && (s === "" || r.strictNullHandling && s === null) ? [] : [].concat(s);
3382
- else {
3383
- n = r.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
3384
- var l = i.charAt(0) === "[" && i.charAt(i.length - 1) === "]" ? i.slice(1, -1) : i, c = r.decodeDotInKeys ? l.replace(/%2E/g, ".") : l, u = parseInt(c, 10);
3385
- !r.parseArrays && c === "" ? n = { 0: s } : !isNaN(u) && i !== c && String(u) === c && u >= 0 && r.parseArrays && u <= r.arrayLimit ? (n = [], n[u] = s) : c !== "__proto__" && (n[c] = s);
3386
- }
3387
- s = n;
3388
- }
3389
- return s;
3390
- }, Ls = function(e, r, o, s) {
3391
- if (e) {
3392
- var a = o.allowDots ? e.replace(/\.([^.[]+)/g, "[$1]") : e, n = /(\[[^[\]]*])/, i = /(\[[^[\]]*])/g, l = o.depth > 0 && n.exec(a), c = l ? a.slice(0, l.index) : a, u = [];
3393
- if (c) {
3394
- if (!o.plainObjects && It.call(Object.prototype, c) && !o.allowPrototypes)
3395
- return;
3396
- u.push(c);
3397
- }
3398
- for (var f = 0; o.depth > 0 && (l = i.exec(a)) !== null && f < o.depth; ) {
3399
- if (f += 1, !o.plainObjects && It.call(Object.prototype, l[1].slice(1, -1)) && !o.allowPrototypes)
3400
- return;
3401
- u.push(l[1]);
3402
- }
3403
- if (l) {
3404
- if (o.strictDepth === !0)
3405
- throw new RangeError("Input depth exceeded depth option of " + o.depth + " and strictDepth is true");
3406
- u.push("[" + a.slice(l.index) + "]");
3407
- }
3408
- return Is(u, r, o, s);
3409
- }
3410
- }, Us = function(e) {
3411
- if (!e)
3412
- return q;
3413
- if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
3414
- throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
3415
- if (typeof e.decodeDotInKeys < "u" && typeof e.decodeDotInKeys != "boolean")
3416
- throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
3417
- if (e.decoder !== null && typeof e.decoder < "u" && typeof e.decoder != "function")
3418
- throw new TypeError("Decoder has to be a function.");
3419
- if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
3420
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
3421
- var r = typeof e.charset > "u" ? q.charset : e.charset, o = typeof e.duplicates > "u" ? q.duplicates : e.duplicates;
3422
- if (o !== "combine" && o !== "first" && o !== "last")
3423
- throw new TypeError("The duplicates option must be either combine, first, or last");
3424
- var s = typeof e.allowDots > "u" ? e.decodeDotInKeys === !0 ? !0 : q.allowDots : !!e.allowDots;
3425
- return {
3426
- allowDots: s,
3427
- allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : q.allowEmptyArrays,
3428
- allowPrototypes: typeof e.allowPrototypes == "boolean" ? e.allowPrototypes : q.allowPrototypes,
3429
- allowSparse: typeof e.allowSparse == "boolean" ? e.allowSparse : q.allowSparse,
3430
- arrayLimit: typeof e.arrayLimit == "number" ? e.arrayLimit : q.arrayLimit,
3431
- charset: r,
3432
- charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : q.charsetSentinel,
3433
- comma: typeof e.comma == "boolean" ? e.comma : q.comma,
3434
- decodeDotInKeys: typeof e.decodeDotInKeys == "boolean" ? e.decodeDotInKeys : q.decodeDotInKeys,
3435
- decoder: typeof e.decoder == "function" ? e.decoder : q.decoder,
3436
- delimiter: typeof e.delimiter == "string" || Ie.isRegExp(e.delimiter) ? e.delimiter : q.delimiter,
3437
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
3438
- depth: typeof e.depth == "number" || e.depth === !1 ? +e.depth : q.depth,
3439
- duplicates: o,
3440
- ignoreQueryPrefix: e.ignoreQueryPrefix === !0,
3441
- interpretNumericEntities: typeof e.interpretNumericEntities == "boolean" ? e.interpretNumericEntities : q.interpretNumericEntities,
3442
- parameterLimit: typeof e.parameterLimit == "number" ? e.parameterLimit : q.parameterLimit,
3443
- parseArrays: e.parseArrays !== !1,
3444
- plainObjects: typeof e.plainObjects == "boolean" ? e.plainObjects : q.plainObjects,
3445
- strictDepth: typeof e.strictDepth == "boolean" ? !!e.strictDepth : q.strictDepth,
3446
- strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : q.strictNullHandling
3447
- };
3448
- }, Fs = function(t, e) {
3449
- var r = Us(e);
3450
- if (t === "" || t === null || typeof t > "u")
3451
- return r.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
3452
- for (var o = typeof t == "string" ? qs(t, r) : t, s = r.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, a = Object.keys(o), n = 0; n < a.length; ++n) {
3453
- var i = a[n], l = Ls(i, o[i], r, typeof t == "string");
3454
- s = Ie.merge(s, l, r);
3455
- }
3456
- return r.allowSparse === !0 ? s : Ie.compact(s);
3457
- }, _s = ks, Hs = Fs, Bs = Yt, nt = {
3458
- formats: Bs,
3459
- parse: Hs,
3460
- stringify: _s
3461
- }, Ms = Ta;
3462
- function ae() {
3463
- this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null;
3464
- }
3465
- var zs = /^([a-z0-9.+-]+:)/i, Ws = /:[0-9]*$/, Js = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/, Gs = [
3466
- "<",
3467
- ">",
3468
- '"',
3469
- "`",
3470
- " ",
3471
- "\r",
3472
- `
3473
- `,
3474
- " "
3475
- ], Vs = [
3476
- "{",
3477
- "}",
3478
- "|",
3479
- "\\",
3480
- "^",
3481
- "`"
3482
- ].concat(Gs), Lt = ["'"].concat(Vs), Hr = [
3483
- "%",
3484
- "/",
3485
- "?",
3486
- ";",
3487
- "#"
3488
- ].concat(Lt), Br = [
3489
- "/",
3490
- "?",
3491
- "#"
3492
- ], Qs = 255, Mr = /^[+a-z0-9A-Z_-]{0,63}$/, Ks = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, Ds = {
3493
- javascript: !0,
3494
- "javascript:": !0
3495
- }, Ut = {
3496
- javascript: !0,
3497
- "javascript:": !0
3498
- }, Ne = {
3499
- http: !0,
3500
- https: !0,
3501
- ftp: !0,
3502
- gopher: !0,
3503
- file: !0,
3504
- "http:": !0,
3505
- "https:": !0,
3506
- "ftp:": !0,
3507
- "gopher:": !0,
3508
- "file:": !0
3509
- }, Ft = nt;
3510
- function Xt(t, e, r) {
3511
- if (t && typeof t == "object" && t instanceof ae)
3512
- return t;
3513
- var o = new ae();
3514
- return o.parse(t, e, r), o;
3515
- }
3516
- ae.prototype.parse = function(t, e, r) {
3517
- if (typeof t != "string")
3518
- throw new TypeError("Parameter 'url' must be a string, not " + typeof t);
3519
- var o = t.indexOf("?"), s = o !== -1 && o < t.indexOf("#") ? "?" : "#", a = t.split(s), n = /\\/g;
3520
- a[0] = a[0].replace(n, "/"), t = a.join(s);
3521
- var i = t;
3522
- if (i = i.trim(), !r && t.split("#").length === 1) {
3523
- var l = Js.exec(i);
3524
- if (l)
3525
- return this.path = i, this.href = i, this.pathname = l[1], l[2] ? (this.search = l[2], e ? this.query = Ft.parse(this.search.substr(1)) : this.query = this.search.substr(1)) : e && (this.search = "", this.query = {}), this;
3526
- }
3527
- var c = zs.exec(i);
3528
- if (c) {
3529
- c = c[0];
3530
- var u = c.toLowerCase();
3531
- this.protocol = u, i = i.substr(c.length);
3532
- }
3533
- if (r || c || i.match(/^\/\/[^@/]+@[^@/]+/)) {
3534
- var f = i.substr(0, 2) === "//";
3535
- f && !(c && Ut[c]) && (i = i.substr(2), this.slashes = !0);
3536
- }
3537
- if (!Ut[c] && (f || c && !Ne[c])) {
3538
- for (var p = -1, h = 0; h < Br.length; h++) {
3539
- var y = i.indexOf(Br[h]);
3540
- y !== -1 && (p === -1 || y < p) && (p = y);
3541
- }
3542
- var g, b;
3543
- p === -1 ? b = i.lastIndexOf("@") : b = i.lastIndexOf("@", p), b !== -1 && (g = i.slice(0, b), i = i.slice(b + 1), this.auth = decodeURIComponent(g)), p = -1;
3544
- for (var h = 0; h < Hr.length; h++) {
3545
- var y = i.indexOf(Hr[h]);
3546
- y !== -1 && (p === -1 || y < p) && (p = y);
3547
- }
3548
- p === -1 && (p = i.length), this.host = i.slice(0, p), i = i.slice(p), this.parseHost(), this.hostname = this.hostname || "";
3549
- var x = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
3550
- if (!x)
3551
- for (var m = this.hostname.split(/\./), h = 0, v = m.length; h < v; h++) {
3552
- var w = m[h];
3553
- if (w && !w.match(Mr)) {
3554
- for (var j = "", S = 0, k = w.length; S < k; S++)
3555
- w.charCodeAt(S) > 127 ? j += "x" : j += w[S];
3556
- if (!j.match(Mr)) {
3557
- var E = m.slice(0, h), R = m.slice(h + 1), F = w.match(Ks);
3558
- F && (E.push(F[1]), R.unshift(F[2])), R.length && (i = "/" + R.join(".") + i), this.hostname = E.join(".");
3559
- break;
3560
- }
3561
- }
3562
- }
3563
- this.hostname.length > Qs ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), x || (this.hostname = Ms.toASCII(this.hostname));
3564
- var te = this.port ? ":" + this.port : "", re = this.hostname || "";
3565
- this.host = re + te, this.href += this.host, x && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), i[0] !== "/" && (i = "/" + i));
3566
- }
3567
- if (!Ds[u])
3568
- for (var h = 0, v = Lt.length; h < v; h++) {
3569
- var L = Lt[h];
3570
- if (i.indexOf(L) !== -1) {
3571
- var V = encodeURIComponent(L);
3572
- V === L && (V = escape(L)), i = i.split(L).join(V);
3573
- }
3574
- }
3575
- var Q = i.indexOf("#");
3576
- Q !== -1 && (this.hash = i.substr(Q), i = i.slice(0, Q));
3577
- var Y = i.indexOf("?");
3578
- if (Y !== -1 ? (this.search = i.substr(Y), this.query = i.substr(Y + 1), e && (this.query = Ft.parse(this.query)), i = i.slice(0, Y)) : e && (this.search = "", this.query = {}), i && (this.pathname = i), Ne[u] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) {
3579
- var te = this.pathname || "", he = this.search || "";
3580
- this.path = te + he;
3581
- }
3582
- return this.href = this.format(), this;
3583
- };
3584
- function Ys(t) {
3585
- return typeof t == "string" && (t = Xt(t)), t instanceof ae ? t.format() : ae.prototype.format.call(t);
3586
- }
3587
- ae.prototype.format = function() {
3588
- var t = this.auth || "";
3589
- t && (t = encodeURIComponent(t), t = t.replace(/%3A/i, ":"), t += "@");
3590
- var e = this.protocol || "", r = this.pathname || "", o = this.hash || "", s = !1, a = "";
3591
- this.host ? s = t + this.host : this.hostname && (s = t + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"), this.port && (s += ":" + this.port)), this.query && typeof this.query == "object" && Object.keys(this.query).length && (a = Ft.stringify(this.query, {
3592
- arrayFormat: "repeat",
3593
- addQueryPrefix: !1
3594
- }));
3595
- var n = this.search || a && "?" + a || "";
3596
- return e && e.substr(-1) !== ":" && (e += ":"), this.slashes || (!e || Ne[e]) && s !== !1 ? (s = "//" + (s || ""), r && r.charAt(0) !== "/" && (r = "/" + r)) : s || (s = ""), o && o.charAt(0) !== "#" && (o = "#" + o), n && n.charAt(0) !== "?" && (n = "?" + n), r = r.replace(/[?#]/g, function(i) {
3597
- return encodeURIComponent(i);
3598
- }), n = n.replace("#", "%23"), e + s + r + n + o;
3599
- };
3600
- ae.prototype.resolve = function(t) {
3601
- return this.resolveObject(Xt(t, !1, !0)).format();
3602
- };
3603
- ae.prototype.resolveObject = function(t) {
3604
- if (typeof t == "string") {
3605
- var e = new ae();
3606
- e.parse(t, !1, !0), t = e;
3607
- }
3608
- for (var r = new ae(), o = Object.keys(this), s = 0; s < o.length; s++) {
3609
- var a = o[s];
3610
- r[a] = this[a];
3611
- }
3612
- if (r.hash = t.hash, t.href === "")
3613
- return r.href = r.format(), r;
3614
- if (t.slashes && !t.protocol) {
3615
- for (var n = Object.keys(t), i = 0; i < n.length; i++) {
3616
- var l = n[i];
3617
- l !== "protocol" && (r[l] = t[l]);
3618
- }
3619
- return Ne[r.protocol] && r.hostname && !r.pathname && (r.pathname = "/", r.path = r.pathname), r.href = r.format(), r;
3620
- }
3621
- if (t.protocol && t.protocol !== r.protocol) {
3622
- if (!Ne[t.protocol]) {
3623
- for (var c = Object.keys(t), u = 0; u < c.length; u++) {
3624
- var f = c[u];
3625
- r[f] = t[f];
3626
- }
3627
- return r.href = r.format(), r;
3628
- }
3629
- if (r.protocol = t.protocol, !t.host && !Ut[t.protocol]) {
3630
- for (var v = (t.pathname || "").split("/"); v.length && !(t.host = v.shift()); )
3631
- ;
3632
- t.host || (t.host = ""), t.hostname || (t.hostname = ""), v[0] !== "" && v.unshift(""), v.length < 2 && v.unshift(""), r.pathname = v.join("/");
3633
- } else
3634
- r.pathname = t.pathname;
3635
- if (r.search = t.search, r.query = t.query, r.host = t.host || "", r.auth = t.auth, r.hostname = t.hostname || t.host, r.port = t.port, r.pathname || r.search) {
3636
- var p = r.pathname || "", h = r.search || "";
3637
- r.path = p + h;
3638
- }
3639
- return r.slashes = r.slashes || t.slashes, r.href = r.format(), r;
3640
- }
3641
- var y = r.pathname && r.pathname.charAt(0) === "/", g = t.host || t.pathname && t.pathname.charAt(0) === "/", b = g || y || r.host && t.pathname, x = b, m = r.pathname && r.pathname.split("/") || [], v = t.pathname && t.pathname.split("/") || [], w = r.protocol && !Ne[r.protocol];
3642
- if (w && (r.hostname = "", r.port = null, r.host && (m[0] === "" ? m[0] = r.host : m.unshift(r.host)), r.host = "", t.protocol && (t.hostname = null, t.port = null, t.host && (v[0] === "" ? v[0] = t.host : v.unshift(t.host)), t.host = null), b = b && (v[0] === "" || m[0] === "")), g)
3643
- r.host = t.host || t.host === "" ? t.host : r.host, r.hostname = t.hostname || t.hostname === "" ? t.hostname : r.hostname, r.search = t.search, r.query = t.query, m = v;
3644
- else if (v.length)
3645
- m || (m = []), m.pop(), m = m.concat(v), r.search = t.search, r.query = t.query;
3646
- else if (t.search != null) {
3647
- if (w) {
3648
- r.host = m.shift(), r.hostname = r.host;
3649
- var j = r.host && r.host.indexOf("@") > 0 ? r.host.split("@") : !1;
3650
- j && (r.auth = j.shift(), r.hostname = j.shift(), r.host = r.hostname);
3651
- }
3652
- return r.search = t.search, r.query = t.query, (r.pathname !== null || r.search !== null) && (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.href = r.format(), r;
3653
- }
3654
- if (!m.length)
3655
- return r.pathname = null, r.search ? r.path = "/" + r.search : r.path = null, r.href = r.format(), r;
3656
- for (var S = m.slice(-1)[0], k = (r.host || t.host || m.length > 1) && (S === "." || S === "..") || S === "", E = 0, R = m.length; R >= 0; R--)
3657
- S = m[R], S === "." ? m.splice(R, 1) : S === ".." ? (m.splice(R, 1), E++) : E && (m.splice(R, 1), E--);
3658
- if (!b && !x)
3659
- for (; E--; E)
3660
- m.unshift("..");
3661
- b && m[0] !== "" && (!m[0] || m[0].charAt(0) !== "/") && m.unshift(""), k && m.join("/").substr(-1) !== "/" && m.push("");
3662
- var F = m[0] === "" || m[0] && m[0].charAt(0) === "/";
3663
- if (w) {
3664
- r.hostname = F ? "" : m.length ? m.shift() : "", r.host = r.hostname;
3665
- var j = r.host && r.host.indexOf("@") > 0 ? r.host.split("@") : !1;
3666
- j && (r.auth = j.shift(), r.hostname = j.shift(), r.host = r.hostname);
3667
- }
3668
- return b = b || r.host && m.length, b && !F && m.unshift(""), m.length > 0 ? r.pathname = m.join("/") : (r.pathname = null, r.path = null), (r.pathname !== null || r.search !== null) && (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.auth = t.auth || r.auth, r.slashes = r.slashes || t.slashes, r.href = r.format(), r;
3669
- };
3670
- ae.prototype.parseHost = function() {
3671
- var t = this.host, e = Ws.exec(t);
3672
- e && (e = e[0], e !== ":" && (this.port = e.substr(1)), t = t.substr(0, t.length - e.length)), t && (this.hostname = t);
3673
- };
3674
- var Xs = Xt, zr = Ys, Zs = (t) => typeof t == "object" && "log" in t && typeof t.log == "object" && "entries" in t.log && Array.isArray(t.log.entries), el = class {
3675
- constructor(t, e = {}) {
3676
- this.initCalled = !1, this.entries = [], this.requests = [], this.options = {}, this.options = {
3677
- harIsAlreadyEncoded: !1,
3678
- ...e
3679
- }, this.requests = [], Zs(t) ? this.entries = t.log.entries : this.entries = [
3680
- {
3681
- request: t
3682
- }
3683
- ];
3684
- }
3685
- init() {
3686
- return this.initCalled = !0, this.requests = this.entries.map(({ request: t }) => {
3687
- var r;
3688
- const e = {
3689
- bodySize: 0,
3690
- headersSize: 0,
3691
- headers: [],
3692
- cookies: [],
3693
- httpVersion: "HTTP/1.1",
3694
- queryString: [],
3695
- postData: {
3696
- mimeType: ((r = t.postData) == null ? void 0 : r.mimeType) || "application/octet-stream"
3697
- },
3698
- ...t
3699
- };
3700
- return e.postData && !e.postData.mimeType && (e.postData.mimeType = "application/octet-stream"), this.prepare(e, this.options);
3701
- }), this;
3702
- }
3703
- prepare(t, e) {
3704
- var u, f, p;
3705
- const r = {
3706
- ...t,
3707
- fullUrl: "",
3708
- uriObj: {},
3709
- queryObj: {},
3710
- headersObj: {},
3711
- cookiesObj: {},
3712
- allHeaders: {}
3713
- };
3714
- if (r.queryString && r.queryString.length && (r.queryObj = r.queryString.reduce(ir, {})), r.headers && r.headers.length) {
3715
- const h = /^HTTP\/2/;
3716
- r.headersObj = r.headers.reduce((y, { name: g, value: b }) => {
3717
- const x = h.exec(r.httpVersion) ? g.toLocaleLowerCase() : g;
3718
- return {
3719
- ...y,
3720
- [x]: b
3721
- };
3722
- }, {});
3723
- }
3724
- r.cookies && r.cookies.length && (r.cookiesObj = r.cookies.reduceRight(
3725
- (h, { name: y, value: g }) => ({
3726
- ...h,
3727
- [y]: g
3728
- }),
3729
- {}
3730
- ));
3731
- const o = (u = r.cookies) == null ? void 0 : u.map(({ name: h, value: y }) => e.harIsAlreadyEncoded ? `${h}=${y}` : `${encodeURIComponent(h)}=${encodeURIComponent(y)}`);
3732
- switch (o != null && o.length && (r.allHeaders.cookie = o.join("; ")), r.postData.mimeType) {
3733
- case "multipart/mixed":
3734
- case "multipart/related":
3735
- case "multipart/form-data":
3736
- case "multipart/alternative":
3737
- if (r.postData.text = "", r.postData.mimeType = "multipart/form-data", (f = r.postData) != null && f.params) {
3738
- const h = "---011000010111000001101001", y = `${h}--`, g = `\r
3739
- `, b = (w) => w.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22"), x = (w) => w.replace(/\r?\n|\r/g, `\r
3740
- `), m = [`--${h}`];
3741
- (p = r.postData) == null || p.params.forEach((w, j) => {
3742
- const S = w.name, k = w.value || "", E = w.fileName || null, R = w.contentType || "application/octet-stream";
3743
- E ? (m.push(
3744
- `Content-Disposition: form-data; name="${b(x(S))}"; filename="${E}"`
3745
- ), m.push(`Content-Type: ${R}`)) : m.push(`Content-Disposition: form-data; name="${b(x(S))}"`), m.push(""), m.push(x(k)), j !== r.postData.params.length - 1 && m.push(`--${h}`);
3746
- }), m.push(`--${y}`), r.postData.boundary = h, r.postData.text = m.join(g);
3747
- const v = J(r.headersObj, "content-type") || "content-type";
3748
- r.headersObj[v] = `multipart/form-data; boundary=${h}`;
3749
- }
3750
- break;
3751
- case "application/x-www-form-urlencoded":
3752
- r.postData.params ? (r.postData.paramsObj = r.postData.params.reduce(ir, {}), r.postData.text = nt.stringify(r.postData.paramsObj)) : r.postData.text = "";
3753
- break;
3754
- case "text/json":
3755
- case "text/x-json":
3756
- case "application/json":
3757
- case "application/x-json":
3758
- if (r.postData.mimeType = "application/json", r.postData.text)
3759
- try {
3760
- r.postData.jsonObj = JSON.parse(r.postData.text);
3761
- } catch {
3762
- r.postData.mimeType = "text/plain";
3763
- }
3764
- break;
3765
- }
3766
- const s = {
3767
- ...r.allHeaders,
3768
- ...r.headersObj
3769
- }, a = Xs(r.url, !0, !0);
3770
- r.queryObj = {
3771
- ...r.queryObj,
3772
- ...a.query
3773
- };
3774
- let n;
3775
- e.harIsAlreadyEncoded ? n = nt.stringify(r.queryObj, {
3776
- encode: !1,
3777
- indices: !1
3778
- }) : n = nt.stringify(r.queryObj, {
3779
- indices: !1
3780
- });
3781
- const i = {
3782
- ...a,
3783
- query: r.queryObj,
3784
- search: n,
3785
- path: n ? `${a.pathname}?${n}` : a.pathname
3786
- }, l = zr({
3787
- ...a,
3788
- query: null,
3789
- search: null
3790
- }), c = zr({
3791
- ...a,
3792
- ...i
3793
- });
3794
- return {
3795
- ...r,
3796
- allHeaders: s,
3797
- fullUrl: c,
3798
- url: l,
3799
- uriObj: i
3800
- };
3801
- }
3802
- convert(t, e, r) {
3803
- this.initCalled || this.init(), !r && e && (r = e);
3804
- const o = Oa[t];
3805
- if (!o)
3806
- return !1;
3807
- const { convert: s } = o.clientsById[e || o.info.default];
3808
- return this.requests.map((n) => s(n, r));
3809
- }
3810
- };
3811
- const tl = ({
3812
- rootMargin: t = "0px",
3813
- threshold: e
3814
- } = {}) => {
3815
- const [r, o] = ve(!1), s = Vr(null);
3816
- return Qr(() => {
3817
- const a = new IntersectionObserver(
3818
- ([i]) => {
3819
- i && o(i.isIntersecting);
3820
- },
3821
- { rootMargin: t, threshold: e }
3822
- ), n = s.current;
3823
- if (n)
3824
- return a.observe(n), () => a.unobserve(n);
3825
- }, [t, e]), [s, r];
3826
- }, rl = ee.Root, Wr = ee.CollapsibleTrigger, nl = ee.CollapsibleContent, ol = typeof window < "u" ? Fn : Qr, Zt = ({
3827
- children: t,
3828
- maxHeight: e = 250
3829
- }) => {
3830
- const r = Vr(null), [o, s] = ve(!1), [a, n] = ve(!1);
3831
- return ol(() => {
3832
- const i = r.current;
3833
- if (!i) return;
3834
- s(i.scrollHeight > e);
3835
- const l = new ResizeObserver(() => {
3836
- s(i.scrollHeight > e);
3837
- });
3838
- return l.observe(i), () => l.disconnect();
3839
- }, [e]), /* @__PURE__ */ d.jsxs(
3840
- rl,
3841
- {
3842
- className: "group",
3843
- open: a,
3844
- onOpenChange: n,
3845
- style: { "--max-height": `${e}px` },
3846
- children: [
3847
- /* @__PURE__ */ d.jsxs(
3848
- nl,
3849
- {
3850
- forceMount: !0,
3851
- className: D(
3852
- "relative overflow-hidden",
3853
- !a && o && "max-h-[--max-height]"
3854
- ),
3855
- children: [
3856
- !a && o && /* @__PURE__ */ d.jsx("div", { className: "absolute inset-0 bg-gradient-to-b from-transparent to-zinc-50/90 dark:to-zinc-800/90 z-10" }),
3857
- /* @__PURE__ */ d.jsx("div", { ref: r, children: t }),
3858
- !a && o && /* @__PURE__ */ d.jsx(
3859
- Wr,
3860
- {
3861
- className: "absolute inset-0 grid place-items-center z-10",
3862
- asChild: !0,
3863
- children: /* @__PURE__ */ d.jsx("div", { children: /* @__PURE__ */ d.jsx(or, { className: "bg-primary/70 border border-accent-foreground/25", children: "Expand code" }) })
3864
- }
3865
- )
3866
- ]
3867
- }
3868
- ),
3869
- o && /* @__PURE__ */ d.jsx(
3870
- "div",
3871
- {
3872
- className: D("flex justify-center w-full mb-2", !a && "hidden"),
3873
- children: /* @__PURE__ */ d.jsx(Wr, { asChild: !0, children: /* @__PURE__ */ d.jsx(or, { className: "border border-accent-foreground/25", children: "Collapse code" }) })
3874
- }
3875
- )
3876
- ]
3877
- }
3878
- );
3879
- }, al = ({
3880
- server: t,
3881
- servers: e,
3882
- operation: r
3883
- }) => {
3884
- var n, i, l;
3885
- const o = (n = r.parameters) == null ? void 0 : n.filter((c) => c.in === "header").map((c) => {
3886
- var u, f;
3887
- return {
3888
- name: c.name,
3889
- defaultValue: ((f = (u = c.examples) == null ? void 0 : u.find((p) => p.value)) == null ? void 0 : f.value) ?? ""
3890
- };
3891
- }), s = (i = r.parameters) == null ? void 0 : i.filter((c) => c.in === "query").sort((c, u) => c.required && !u.required ? -1 : 1).map((c) => ({
3892
- name: c.name,
3893
- defaultActive: c.required ?? !1,
3894
- isRequired: c.required ?? !1
3895
- })), a = (l = r.parameters) == null ? void 0 : l.filter((c) => c.in === "path").map((c) => ({ name: c.name }));
3896
- return /* @__PURE__ */ d.jsx(
3897
- zn,
3898
- {
3899
- server: t,
3900
- servers: e,
3901
- method: r.method,
3902
- url: r.path,
3903
- headers: o,
3904
- queryParams: s,
3905
- pathParams: a
3906
- }
3907
- );
3908
- }, er = ({ children: t, className: e }) => /* @__PURE__ */ d.jsx(
3909
- "div",
3910
- {
3911
- className: D(
3912
- "rounded-lg overflow-hidden border dark:border-transparent",
3913
- e
3914
- ),
3915
- children: t
3916
- }
3917
- ), tr = ({ children: t, className: e }) => /* @__PURE__ */ d.jsx(
3918
- "div",
3919
- {
3920
- className: D(
3921
- "border-b dark:border-zinc-600 bg-zinc-100 dark:bg-zinc-700 p-2",
3922
- e
3923
- ),
3924
- children: t
3925
- }
3926
- ), rr = ({ children: t, className: e }) => /* @__PURE__ */ d.jsx(
3927
- "div",
3928
- {
3929
- className: D("bg-zinc-50 dark:bg-zinc-800 overflow-auto p-2", e),
3930
- children: t
3931
- }
3932
- ), Sn = ({ children: t, className: e }) => /* @__PURE__ */ d.jsx(
3933
- "div",
3934
- {
3935
- className: D(
3936
- "border-t dark:border-zinc-600 bg-zinc-100 dark:bg-zinc-700 p-2",
3937
- e
3938
- ),
3939
- children: t
3940
- }
3941
- ), Re = (t, e) => {
3942
- if (t.example !== void 0)
3943
- return t.example;
3944
- if (t.examples)
3945
- return Object.values(t.examples)[0];
3946
- if (t.default !== void 0)
3947
- return t.default;
3948
- if (t.properties || t.type === "object") {
3949
- const r = {};
3950
- if (t.properties)
3951
- for (const [o, s] of Object.entries(t.properties))
3952
- r[o] = Re(s, o);
3953
- return r;
3954
- }
3955
- if (t.type === "array")
3956
- return Array.isArray(t.items) ? t.items.map(
3957
- (r) => Re(r)
3958
- ) : t.items ? [Re(t.items)] : [];
3959
- if (t.enum)
3960
- return t.enum[0];
3961
- switch (t.type) {
3962
- case "string":
3963
- return e || "string";
3964
- case "number":
3965
- case "integer":
3966
- return 0;
3967
- case "boolean":
3968
- return !0;
3969
- case "null":
3970
- return null;
3971
- case void 0:
3972
- default:
3973
- return {};
3974
- }
3975
- }, il = ({ content: t }) => {
3976
- var o, s;
3977
- if (!t.length) return null;
3978
- const e = t.at(0), r = ((s = (o = e == null ? void 0 : e.examples) == null ? void 0 : o.at(0)) == null ? void 0 : s.value) ?? (e != null && e.schema ? Re(e.schema) : "");
3979
- return /* @__PURE__ */ d.jsx(d.Fragment, { children: /* @__PURE__ */ d.jsxs(er, { children: [
3980
- /* @__PURE__ */ d.jsx(tr, { className: "text-xs flex justify-between items-center", children: /* @__PURE__ */ d.jsx("span", { className: "font-mono", children: "Request Body Example" }) }),
3981
- /* @__PURE__ */ d.jsx(rr, { className: "p-0", children: /* @__PURE__ */ d.jsx(Zt, { children: /* @__PURE__ */ d.jsx(
3982
- Mt,
3983
- {
3984
- language: r ? "json" : "plain",
3985
- noBackground: !0,
3986
- copyable: !0,
3987
- className: "[--scrollbar-color:gray] text-xs max-h-[500px] p-2",
3988
- code: r ? JSON.stringify(r, null, 2) : "No example"
3989
- }
3990
- ) }) })
3991
- ] }) });
3992
- }, sl = ({
3993
- responses: t,
3994
- selectedResponse: e,
3995
- onSelectResponse: r
3996
- }) => {
3997
- var o;
3998
- return /* @__PURE__ */ d.jsx(er, { children: /* @__PURE__ */ d.jsxs(
3999
- De.Root,
4000
- {
4001
- defaultValue: (o = t[0]) == null ? void 0 : o.statusCode,
4002
- value: e,
4003
- onValueChange: (s) => r(s),
4004
- children: [
4005
- /* @__PURE__ */ d.jsxs(tr, { className: "text-xs flex flex-col gap-2 pb-0", children: [
4006
- /* @__PURE__ */ d.jsx("span", { className: "font-mono", children: "Example Responses" }),
4007
- /* @__PURE__ */ d.jsx(De.List, { className: "flex gap-2", children: t.map((s) => /* @__PURE__ */ d.jsx(
4008
- De.Trigger,
4009
- {
4010
- value: s.statusCode,
4011
- className: D(
4012
- "text-xs font-mono px-1.5 py-1 pb-px translate-y-px border-b-2 border-transparent rounded-t cursor-pointer",
4013
- "data-[state=active]:text-primary data-[state=active]:dark:text-inherit data-[state=active]:border-primary",
4014
- "hover:border-accent-foreground/25"
4015
- ),
4016
- children: s.statusCode
4017
- },
4018
- s.statusCode
4019
- )) })
4020
- ] }),
4021
- t.map((s) => {
4022
- var i, l, c;
4023
- const a = (i = s.content) == null ? void 0 : i.at(0), n = ((c = (l = a == null ? void 0 : a.examples) == null ? void 0 : l.at(0)) == null ? void 0 : c.value) ?? (a != null && a.schema ? Re(a.schema) : "");
4024
- return /* @__PURE__ */ d.jsxs(De.Content, { value: s.statusCode, children: [
4025
- /* @__PURE__ */ d.jsx(rr, { className: "p-0", children: /* @__PURE__ */ d.jsx(Zt, { children: /* @__PURE__ */ d.jsx(
4026
- Mt,
4027
- {
4028
- language: n ? "json" : "plain",
4029
- noBackground: !0,
4030
- className: "[--scrollbar-color:gray] text-xs max-h-[500px] p-2",
4031
- code: n ? JSON.stringify(n, null, 2) : "Empty response"
4032
- }
4033
- ) }) }),
4034
- /* @__PURE__ */ d.jsx(Sn, { className: "flex justify-end text-xs", children: s.description })
4035
- ] }, s.statusCode);
4036
- })
4037
- ]
4038
- }
4039
- ) });
4040
- }, ll = (t, e) => {
4041
- let r;
4042
- switch (e) {
4043
- case "shell":
4044
- r = t.convert("shell", "curl");
4045
- break;
4046
- case "js":
4047
- r = t.convert("javascript", "fetch");
4048
- break;
4049
- case "python":
4050
- r = t.convert("python", "requests");
4051
- break;
4052
- case "java":
4053
- r = t.convert("java", "okhttp");
4054
- break;
4055
- case "go":
4056
- r = t.convert("go", "native");
4057
- break;
4058
- case "csharp":
4059
- r = t.convert("csharp", "httpclient");
4060
- break;
4061
- case "kotlin":
4062
- r = t.convert("kotlin", "okhttp");
4063
- break;
4064
- case "objc":
4065
- r = t.convert("objc", "nsurlsession");
4066
- break;
4067
- case "php":
4068
- r = t.convert("php", "http2");
4069
- break;
4070
- case "ruby":
4071
- r = t.convert("ruby");
4072
- break;
4073
- case "swift":
4074
- r = t.convert("swift");
4075
- break;
4076
- default:
4077
- r = t.convert("shell");
4078
- break;
4079
- }
4080
- return r ? r[0] : "";
4081
- }, cl = ut(
4082
- /* GraphQL */
4083
- `
4084
- query getServerQuery($input: JSON!, $type: SchemaType!) {
4085
- schema(input: $input, type: $type) {
4086
- url
4087
- servers {
4088
- url
4089
- }
4090
- }
4091
- }
4092
- `
4093
- ), ul = {
4094
- get: fe.green,
4095
- post: fe.blue,
4096
- put: fe.yellow,
4097
- delete: fe.red,
4098
- patch: fe.purple,
4099
- options: fe.indigo,
4100
- head: fe.gray,
4101
- trace: fe.gray
4102
- }, pl = [
4103
- { value: "shell", label: "cURL" },
4104
- { value: "js", label: "JavaScript" },
4105
- { value: "python", label: "Python" },
4106
- { value: "java", label: "Java" },
4107
- { value: "go", label: "Go" },
4108
- { value: "csharp", label: "C#" },
4109
- { value: "kotlin", label: "Kotlin" },
4110
- { value: "objc", label: "Objective-C" },
4111
- { value: "php", label: "PHP" },
4112
- { value: "ruby", label: "Ruby" },
4113
- { value: "swift", label: "Swift" }
4114
- ], fl = ({
4115
- operation: t,
4116
- selectedResponse: e,
4117
- onSelectResponse: r
4118
- }) => {
4119
- var m;
4120
- const { input: o, type: s } = Bt(), a = zt(cl, { input: o, type: s }), n = Ht(a), i = ul[t.method.toLocaleLowerCase()] ?? fe.gray, [l, c] = to(), [, u] = Gr(), f = l.get("lang") ?? "shell", p = (m = t.requestBody) == null ? void 0 : m.content, h = t.path.split("/").map((v, w, j) => {
4121
- const k = v.startsWith("{") && v.endsWith("}") || v.startsWith(":") ? v.replace(/[:{}]/g, "") : void 0;
4122
- return (
4123
- // eslint-disable-next-line react/no-array-index-key
4124
- /* @__PURE__ */ d.jsxs(_n, { children: [
4125
- k ? /* @__PURE__ */ d.jsx(
4126
- Xr,
4127
- {
4128
- name: k,
4129
- backgroundOpacity: "0",
4130
- slug: `${t.slug}-${k.toLocaleLowerCase()}`,
4131
- children: v
4132
- }
4133
- ) : v,
4134
- w < j.length - 1 ? "/" : null,
4135
- /* @__PURE__ */ d.jsx("wbr", {})
4136
- ] }, v + w)
4137
- );
4138
- }), { selectedServer: y } = Kr(), g = Jr(() => {
4139
- var j;
4140
- const v = (j = p == null ? void 0 : p[0]) != null && j.schema ? Re(p[0].schema) : void 0, w = new el({
4141
- method: t.method.toLocaleUpperCase(),
4142
- url: (y ?? n.data.schema.url ?? "") + t.path.replaceAll("{", ":").replaceAll("}", ""),
4143
- postData: v ? {
4144
- text: JSON.stringify(v, null, 2),
4145
- mimeType: "application/json"
4146
- } : {},
4147
- headers: [],
4148
- queryString: [],
4149
- httpVersion: "",
4150
- cookies: [],
4151
- headersSize: 0,
4152
- bodySize: 0
4153
- });
4154
- return ll(w, f);
4155
- }, [
4156
- p,
4157
- t.method,
4158
- t.path,
4159
- y,
4160
- n.data.schema.url,
4161
- f
4162
- ]), [b, x] = tl({ rootMargin: "200px 0px 200px 0px" });
4163
- return /* @__PURE__ */ d.jsxs(
4164
- "aside",
4165
- {
4166
- ref: b,
4167
- className: "flex flex-col overflow-hidden sticky top-[--scroll-padding] gap-4",
4168
- children: [
4169
- /* @__PURE__ */ d.jsxs(er, { children: [
4170
- /* @__PURE__ */ d.jsxs(tr, { className: "flex justify-between items-center flex-nowrap py-3 gap-2 text-xs", children: [
4171
- /* @__PURE__ */ d.jsxs("span", { className: "font-mono break-words", children: [
4172
- /* @__PURE__ */ d.jsx("span", { className: D("font-semibold", i), children: t.method.toLocaleUpperCase() }),
4173
- " ",
4174
- h
4175
- ] }),
4176
- x && /* @__PURE__ */ d.jsx(
4177
- al,
4178
- {
4179
- server: n.data.schema.url ?? "",
4180
- servers: n.data.schema.servers.map((v) => v.url) ?? [],
4181
- operation: t
4182
- }
4183
- )
4184
- ] }),
4185
- x && /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
4186
- /* @__PURE__ */ d.jsx(rr, { className: "p-0", children: /* @__PURE__ */ d.jsx(Zt, { children: /* @__PURE__ */ d.jsx(
4187
- Mt,
4188
- {
4189
- language: f,
4190
- noBackground: !0,
4191
- className: "[--scrollbar-color:gray] text-xs max-h-[500px] p-2",
4192
- code: g
4193
- }
4194
- ) }) }),
4195
- /* @__PURE__ */ d.jsxs(Sn, { className: "flex items-center text-xs gap-2 justify-end py-1", children: [
4196
- /* @__PURE__ */ d.jsx("span", { children: "Show example in" }),
4197
- /* @__PURE__ */ d.jsx(
4198
- Yr,
4199
- {
4200
- className: "self-start max-w-[150px]",
4201
- value: f,
4202
- onChange: (v) => {
4203
- u(() => {
4204
- c((w) => (w.set("lang", v.target.value), w));
4205
- });
4206
- },
4207
- options: pl
4208
- }
4209
- )
4210
- ] })
4211
- ] })
4212
- ] }),
4213
- x && p && /* @__PURE__ */ d.jsx(il, { content: p }),
4214
- x && t.responses.length > 0 && /* @__PURE__ */ d.jsx(
4215
- sl,
4216
- {
4217
- selectedResponse: e,
4218
- onSelectResponse: r,
4219
- responses: t.responses
4220
- }
4221
- )
4222
- ]
4223
- }
4224
- );
4225
- }, dl = (t) => Object.entries(t), hl = {
4226
- AND: /* @__PURE__ */ d.jsx(Nn, { size: 16, className: "fill-card" }),
4227
- OR: /* @__PURE__ */ d.jsx(Rn, { size: 16, className: "fill-card" }),
4228
- ONE: /* @__PURE__ */ d.jsx(An, { size: 14, className: "fill-card" })
4229
- }, yl = {
4230
- AND: "text-green-500 dark:text-green-300/60",
4231
- OR: "text-blue-400 dark:text-blue-500",
4232
- ONE: "text-purple-500 dark:text-purple-300/60"
4233
- }, ml = ({
4234
- type: t,
4235
- isOpen: e,
4236
- className: r
4237
- }) => /* @__PURE__ */ d.jsx(
4238
- "div",
4239
- {
4240
- className: D(
4241
- yl[t],
4242
- "relative text-sm flex py-2",
4243
- "before:border-l before:absolute before:-top-2 before:-bottom-2 before:border-border before:border-dashed before:content-['']",
4244
- r
4245
- ),
4246
- children: /* @__PURE__ */ d.jsxs("div", { className: "-translate-x-[7px] flex gap-1 items-center", children: [
4247
- hl[t],
4248
- /* @__PURE__ */ d.jsx(
4249
- "div",
4250
- {
4251
- className: D(
4252
- "translate-y-px mx-px opacity-0 group-hover:opacity-100 transition",
4253
- !e && "-rotate-90"
4254
- ),
4255
- children: /* @__PURE__ */ d.jsx(En, { size: 16 })
4256
- }
4257
- )
4258
- ] })
4259
- }
4260
- ), gl = (t) => {
4261
- const [e, r] = ve(!0);
4262
- return /* @__PURE__ */ d.jsxs(
4263
- ee.Root,
4264
- {
4265
- open: e,
4266
- onOpenChange: () => r((o) => !o),
4267
- className: "group",
4268
- children: [
4269
- /* @__PURE__ */ d.jsx(ee.Trigger, { children: /* @__PURE__ */ d.jsx(ml, { type: t.type, isOpen: e }) }),
4270
- !e && /* @__PURE__ */ d.jsx("div", { className: "wavy-line bg-border translate-y-1" }),
4271
- /* @__PURE__ */ d.jsx(ee.Content, { children: /* @__PURE__ */ d.jsx(Ge, { schema: t.schema, level: t.level + 1 }) })
4272
- ]
4273
- }
4274
- );
4275
- }, bl = {
4276
- AND: "All of",
4277
- OR: "Any of",
4278
- ONE: "One of"
4279
- }, vl = ({
4280
- schemas: t,
4281
- type: e,
4282
- isOpen: r,
4283
- level: o,
4284
- toggleOpen: s
4285
- }) => /* @__PURE__ */ d.jsx(ee.Root, { open: r, onOpenChange: s, asChild: !0, children: /* @__PURE__ */ d.jsxs(de, { className: "px-6", children: [
4286
- /* @__PURE__ */ d.jsxs(ee.Trigger, { className: "flex gap-2 items-center py-2 w-full text-sm text-muted-foreground -translate-x-1.5", children: [
4287
- r ? /* @__PURE__ */ d.jsx(qn, { size: 14 }) : /* @__PURE__ */ d.jsx(In, { size: 14 }),
4288
- /* @__PURE__ */ d.jsx("span", { children: bl[e] })
4289
- ] }),
4290
- /* @__PURE__ */ d.jsx(ee.Content, { className: "pb-4", children: t.map((a, n) => (
4291
- // eslint-disable-next-line react/no-array-index-key
4292
- /* @__PURE__ */ d.jsx(
4293
- gl,
4294
- {
4295
- type: e,
4296
- schema: a,
4297
- level: o
4298
- },
4299
- n
4300
- )
4301
- )) })
4302
- ] }) }), xl = (t) => t.type === "object" || t.type === "array" && typeof t.items == "object" && (!t.items.type || t.items.type === "object"), _t = (t) => !!(t.oneOf ?? t.allOf ?? t.anyOf), $l = {
4303
- allOf: "AND",
4304
- anyOf: "OR",
4305
- oneOf: "ONE"
4306
- }, On = ({
4307
- schema: t,
4308
- level: e
4309
- }) => {
4310
- const [r, o] = ve(!0), s = Hn(() => o((a) => !a), []);
4311
- for (const [a, n] of dl($l))
4312
- if (t[a])
4313
- return /* @__PURE__ */ d.jsx(
4314
- vl,
4315
- {
4316
- schemas: t[a],
4317
- type: n,
4318
- isOpen: r,
4319
- toggleOpen: s,
4320
- level: e
4321
- }
4322
- );
4323
- }, jl = ({
4324
- name: t,
4325
- schema: e,
4326
- group: r,
4327
- level: o,
4328
- defaultOpen: s = !1,
4329
- showCollapseButton: a = !0
4330
- }) => {
4331
- const [n, i] = ve(s);
4332
- return /* @__PURE__ */ d.jsx("li", { className: "p-4 bg-border/20 hover:bg-border/30", children: /* @__PURE__ */ d.jsxs("div", { className: "flex flex-col gap-1 justify-between text-sm", children: [
4333
- /* @__PURE__ */ d.jsxs("div", { className: "flex gap-2 items-center", children: [
4334
- /* @__PURE__ */ d.jsx("code", { children: t }),
4335
- /* @__PURE__ */ d.jsx("span", { className: "text-muted-foreground", children: e.type === "array" && e.items.type ? /* @__PURE__ */ d.jsxs("span", { children: [
4336
- e.items.type,
4337
- "[]"
4338
- ] }) : Array.isArray(e.type) ? /* @__PURE__ */ d.jsx("span", { children: e.type.join(" | ") }) : /* @__PURE__ */ d.jsx("span", { children: e.type }) }),
4339
- r === "optional" && /* @__PURE__ */ d.jsx("span", { className: "py-px px-1.5 font-medium border rounded-lg", children: "optional" })
4340
- ] }),
4341
- e.description && /* @__PURE__ */ d.jsx(
4342
- be,
4343
- {
4344
- className: D(we, "text-sm leading-normal line-clamp-4"),
4345
- content: e.description
4346
- }
4347
- ),
4348
- (_t(e) || xl(e)) && /* @__PURE__ */ d.jsxs(
4349
- ee.Root,
4350
- {
4351
- defaultOpen: s,
4352
- open: n,
4353
- onOpenChange: () => i(!n),
4354
- children: [
4355
- a && /* @__PURE__ */ d.jsx(ee.Trigger, { asChild: !0, children: /* @__PURE__ */ d.jsxs(
4356
- Dr,
4357
- {
4358
- variant: "outline",
4359
- size: "sm",
4360
- className: "mt-2 flex gap-1.5",
4361
- children: [
4362
- /* @__PURE__ */ d.jsx(Ln, { size: 18 }),
4363
- n ? "Hide nested properties" : "Show nested properties"
4364
- ]
4365
- }
4366
- ) }),
4367
- /* @__PURE__ */ d.jsx(ee.Content, { children: /* @__PURE__ */ d.jsx("div", { className: "mt-2", children: _t(e) ? /* @__PURE__ */ d.jsx(On, { schema: e, level: o + 1 }) : e.type === "object" ? /* @__PURE__ */ d.jsx(Ge, { schema: e, level: o + 1 }) : e.type === "array" && typeof e.items == "object" && /* @__PURE__ */ d.jsx(Ge, { schema: e.items, level: o + 1 }) }) })
4368
- ]
4369
- }
4370
- )
4371
- ] }) });
4372
- }, Ge = ({
4373
- schema: t,
4374
- level: e = 0,
4375
- defaultOpen: r = !1
4376
- }) => {
4377
- if (!t || Object.keys(t).length === 0)
4378
- return /* @__PURE__ */ d.jsx(de, { className: "p-4", children: /* @__PURE__ */ d.jsx("span", { className: "text-sm text-muted-foreground italic", children: "No response specified" }) });
4379
- const o = (s, a) => {
4380
- if (_t(s))
4381
- return /* @__PURE__ */ d.jsx(On, { schema: s, level: a });
4382
- if (s.type === "array" && s.items) {
4383
- const n = s.items;
4384
- return typeof n.type == "string" && ["string", "number", "boolean", "integer"].includes(n.type) ? /* @__PURE__ */ d.jsxs(de, { className: "p-4", children: [
4385
- /* @__PURE__ */ d.jsxs("span", { className: "text-sm text-muted-foreground", children: [
4386
- n.type,
4387
- "[]"
4388
- ] }),
4389
- s.description && /* @__PURE__ */ d.jsx(
4390
- be,
4391
- {
4392
- className: D(
4393
- we,
4394
- "text-sm leading-normal line-clamp-4"
4395
- ),
4396
- content: s.description
4397
- }
4398
- )
4399
- ] }) : n.type === "object" ? /* @__PURE__ */ d.jsxs(de, { className: "flex flex-col gap-2 bg-border/30 p-4", children: [
4400
- /* @__PURE__ */ d.jsx("span", { className: "text-sm text-muted-foreground", children: "object[]" }),
4401
- o(n, a + 1)
4402
- ] }) : o(n, a + 1);
4403
- }
4404
- if (s.type === "object" && (!s.properties || Object.keys(s.properties).length === 0))
4405
- return /* @__PURE__ */ d.jsxs(de, { className: "p-4 flex gap-2 items-center", children: [
4406
- "name" in s && /* @__PURE__ */ d.jsx(d.Fragment, { children: s.name }),
4407
- /* @__PURE__ */ d.jsx("span", { className: "text-sm text-muted-foreground", children: "object" }),
4408
- s.description && /* @__PURE__ */ d.jsx(
4409
- be,
4410
- {
4411
- className: D(
4412
- we,
4413
- "text-sm leading-normal line-clamp-4"
4414
- ),
4415
- content: s.description
4416
- }
4417
- )
4418
- ] });
4419
- if (s.properties) {
4420
- const n = Zr(
4421
- Object.entries(s.properties),
4422
- ([l, c]) => {
4423
- var u;
4424
- return c.deprecated ? "deprecated" : (u = s.required) != null && u.includes(l) ? "required" : "optional";
4425
- }
4426
- ), i = ["required", "optional", "deprecated"];
4427
- return /* @__PURE__ */ d.jsx(de, { className: "divide-y overflow-hidden", children: i.map(
4428
- (l) => n[l] && /* @__PURE__ */ d.jsx("ul", { className: "divide-y", children: n[l].map(([c, u]) => /* @__PURE__ */ d.jsx(
4429
- jl,
4430
- {
4431
- name: c,
4432
- schema: u,
4433
- group: l,
4434
- level: a,
4435
- defaultOpen: r
4436
- },
4437
- c
4438
- )) }, l)
4439
- ) });
4440
- }
4441
- return typeof s.type == "string" && ["string", "number", "boolean", "integer", "null"].includes(s.type) ? /* @__PURE__ */ d.jsxs(de, { className: "p-4", children: [
4442
- /* @__PURE__ */ d.jsx("span", { className: "text-sm text-muted-foreground", children: s.type }),
4443
- s.description && /* @__PURE__ */ d.jsx(
4444
- be,
4445
- {
4446
- className: D(
4447
- we,
4448
- "text-sm leading-normal line-clamp-4"
4449
- ),
4450
- content: s.description
4451
- }
4452
- )
4453
- ] }) : s.additionalProperties ? /* @__PURE__ */ d.jsxs(de, { className: "my-2", children: [
4454
- /* @__PURE__ */ d.jsx(Kn, { children: /* @__PURE__ */ d.jsx(Dn, { children: "Additional Properties:" }) }),
4455
- /* @__PURE__ */ d.jsx(Yn, { children: o(
4456
- s.additionalProperties,
4457
- a + 1
4458
- ) })
4459
- ] }) : null;
4460
- };
4461
- return o(t, e);
4462
- }, wl = ["path", "query", "header", "cookie"], Sl = ({
4463
- operationFragment: t
4464
- }) => {
4465
- var n, i, l;
4466
- const e = ro(Ol, t), r = Zr(
4467
- e.parameters ?? [],
4468
- (c) => c.in
4469
- ), o = e.responses.at(0), [s, a] = ve(o == null ? void 0 : o.statusCode);
4470
- return /* @__PURE__ */ d.jsxs(
4471
- "div",
4472
- {
4473
- className: "grid grid-cols-1 lg:grid-cols-[4fr_3fr] gap-8 items-start border-b-2 mb-16 pb-16",
4474
- children: [
4475
- /* @__PURE__ */ d.jsxs("div", { className: "flex flex-col gap-4", children: [
4476
- /* @__PURE__ */ d.jsx(_e, { level: 2, id: e.slug, registerSidebarAnchor: !0, children: e.summary }),
4477
- e.description && /* @__PURE__ */ d.jsx(
4478
- be,
4479
- {
4480
- className: `${we} max-w-full prose-img:max-w-prose`,
4481
- content: e.description
4482
- }
4483
- ),
4484
- e.parameters && e.parameters.length > 0 && /* @__PURE__ */ d.jsx(d.Fragment, { children: wl.flatMap(
4485
- (c) => {
4486
- var u;
4487
- return (u = r[c]) != null && u.length ? /* @__PURE__ */ d.jsx(
4488
- lo,
4489
- {
4490
- id: e.slug,
4491
- parameters: r[c],
4492
- group: c
4493
- },
4494
- c
4495
- ) : [];
4496
- }
4497
- ) }),
4498
- ao((l = (i = (n = e.requestBody) == null ? void 0 : n.content) == null ? void 0 : i.at(0)) == null ? void 0 : l.schema, (c) => /* @__PURE__ */ d.jsxs("div", { className: "mt-4 flex flex-col gap-4", children: [
4499
- /* @__PURE__ */ d.jsx(
4500
- _e,
4501
- {
4502
- level: 3,
4503
- className: "capitalize",
4504
- id: `${e.slug}/request-body`,
4505
- registerSidebarAnchor: !0,
4506
- children: "Request Body"
4507
- }
4508
- ),
4509
- /* @__PURE__ */ d.jsx(Ge, { schema: c })
4510
- ] })),
4511
- e.responses.length > 0 && /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
4512
- /* @__PURE__ */ d.jsx(
4513
- _e,
4514
- {
4515
- level: 3,
4516
- className: "capitalize mt-8 pt-8 border-t",
4517
- id: `${e.slug}/responses`,
4518
- registerSidebarAnchor: !0,
4519
- children: "Responses"
4520
- }
4521
- ),
4522
- /* @__PURE__ */ d.jsxs(
4523
- Wn,
4524
- {
4525
- onValueChange: (c) => a(c),
4526
- value: s,
4527
- children: [
4528
- e.responses.length > 1 && /* @__PURE__ */ d.jsx(Jn, { children: e.responses.map((c) => /* @__PURE__ */ d.jsx(
4529
- Gn,
4530
- {
4531
- value: c.statusCode,
4532
- title: c.description ?? void 0,
4533
- children: c.statusCode
4534
- },
4535
- c.statusCode
4536
- )) }),
4537
- /* @__PURE__ */ d.jsx("ul", { className: "list-none m-0 px-0", children: e.responses.map((c) => {
4538
- var u, f;
4539
- return /* @__PURE__ */ d.jsx(
4540
- Vn,
4541
- {
4542
- value: c.statusCode,
4543
- children: /* @__PURE__ */ d.jsx(
4544
- Ge,
4545
- {
4546
- schema: (f = (u = c.content) == null ? void 0 : u.find((p) => p.schema)) == null ? void 0 : f.schema
4547
- }
4548
- )
4549
- },
4550
- c.statusCode
4551
- );
4552
- }) })
4553
- ]
4554
- }
4555
- )
4556
- ] })
4557
- ] }),
4558
- /* @__PURE__ */ d.jsx(
4559
- fl,
4560
- {
4561
- selectedResponse: s,
4562
- onSelectResponse: a,
4563
- operation: e
4564
- }
4565
- )
4566
- ]
4567
- },
4568
- e.operationId
4569
- );
4570
- }, Ol = ut(
4571
- /* GraphQL */
4572
- `
4573
- fragment OperationsFragment on OperationItem {
4574
- slug
4575
- summary
4576
- method
4577
- description
4578
- operationId
4579
- contentTypes
4580
- path
4581
- parameters {
4582
- name
4583
- in
4584
- description
4585
- required
4586
- schema
4587
- style
4588
- examples {
4589
- name
4590
- description
4591
- externalValue
4592
- value
4593
- summary
4594
- }
4595
- }
4596
- requestBody {
4597
- content {
4598
- mediaType
4599
- encoding {
4600
- name
4601
- }
4602
- examples {
4603
- name
4604
- description
4605
- externalValue
4606
- value
4607
- summary
4608
- }
4609
- schema
4610
- }
4611
- description
4612
- required
4613
- }
4614
- responses {
4615
- statusCode
4616
- links
4617
- description
4618
- content {
4619
- examples {
4620
- name
4621
- description
4622
- externalValue
4623
- value
4624
- summary
4625
- }
4626
- mediaType
4627
- encoding {
4628
- name
4629
- }
4630
- schema
4631
- }
4632
- }
4633
- }
4634
- `
4635
- ), Tl = ut(
4636
- /* GraphQL */
4637
- `
4638
- query AllOperations($input: JSON!, $type: SchemaType!) {
4639
- schema(input: $input, type: $type) {
4640
- description
4641
- summary
4642
- title
4643
- url
4644
- version
4645
- tags {
4646
- name
4647
- description
4648
- operations {
4649
- slug
4650
- ...OperationsFragment
4651
- }
4652
- }
4653
- }
4654
- }
4655
- `
4656
- );
4657
- function Cl(t, e = 160) {
4658
- return t ? (t = t.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1"), t = t.replace(/!\[.*?\]\(.*?\)/g, ""), t = t.replace(/[_*`~]/g, ""), t = t.replace(/^(?:>|\s*#+|-{3,}|\*{3,})/gm, ""), t = t.replace(/[|>{}[\]]/g, ""), t = t.replace(/\s+/g, " ").trim(), t = t.substring(0, e), t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;")) : "";
4659
- }
4660
- const Kl = () => {
4661
- const { input: t, type: e } = Bt(), r = zt(Tl, { input: t, type: e }), o = Ht(r), s = o.data.schema.title, a = o.data.schema.summary, n = o.data.schema.description, i = a || (n ? Cl(n) : void 0);
4662
- return /* @__PURE__ */ d.jsxs("div", { className: "pt-[--padding-content-top]", children: [
4663
- /* @__PURE__ */ d.jsxs(Tn, { children: [
4664
- /* @__PURE__ */ d.jsx("title", { children: s }),
4665
- i && /* @__PURE__ */ d.jsx("meta", { name: "description", content: i })
4666
- ] }),
4667
- /* @__PURE__ */ d.jsxs(
4668
- "div",
4669
- {
4670
- className: D(we, "mb-16 max-w-full prose-img:max-w-prose"),
4671
- children: [
4672
- /* @__PURE__ */ d.jsx(nr, { children: "Overview" }),
4673
- /* @__PURE__ */ d.jsx(_e, { level: 1, id: "description", registerSidebarAnchor: !0, children: s }),
4674
- /* @__PURE__ */ d.jsx(be, { content: o.data.schema.description ?? "" })
4675
- ]
4676
- }
4677
- ),
4678
- /* @__PURE__ */ d.jsx("hr", {}),
4679
- /* @__PURE__ */ d.jsx("div", { className: "my-4 flex justify-end", children: /* @__PURE__ */ d.jsx(oo, {}) }),
4680
- o.data.schema.tags.filter((l) => l.operations.length > 0).map((l) => (
4681
- // px, -mx is so that `content-visibility` doesn't cut off overflown heading anchor links '#'
4682
- /* @__PURE__ */ d.jsxs("div", { className: "px-6 -mx-6 [content-visibility:auto]", children: [
4683
- l.name && /* @__PURE__ */ d.jsx(nr, { children: l.name }),
4684
- l.description && /* @__PURE__ */ d.jsx(
4685
- be,
4686
- {
4687
- className: `${we} max-w-full prose-img:max-w-prose w-full mt-2 mb-12`,
4688
- content: l.description
4689
- }
4690
- ),
4691
- /* @__PURE__ */ d.jsx("div", { className: "operation mb-12", children: /* @__PURE__ */ d.jsx(Qn, { children: l.operations.map((c) => /* @__PURE__ */ d.jsx(
4692
- Sl,
4693
- {
4694
- operationFragment: c
4695
- },
4696
- c.slug
4697
- )) }) })
4698
- ] }, l.name)
4699
- ))
4700
- ] });
4701
- };
4702
- export {
4703
- Kl as OperationList,
4704
- Ol as OperationsFragment
4705
- };
4706
- //# sourceMappingURL=OperationList-u8xHU9-b.js.map