@kingsleyweb/bun-ui 0.0.0-stage → 3.0.0-rc.2

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 (240) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -2
  3. package/app/docs/App.tsx +72 -0
  4. package/app/docs/api/client.ts +303 -0
  5. package/app/docs/api/contract.ts +24 -0
  6. package/app/docs/api/docs.ts +38 -0
  7. package/app/docs/api/errors.ts +144 -0
  8. package/app/docs/boot.tsx +58 -0
  9. package/app/docs/components/Badge.tsx +65 -0
  10. package/app/docs/components/Button.tsx +37 -0
  11. package/app/docs/components/Card.tsx +41 -0
  12. package/app/docs/components/ConfirmDialog.tsx +173 -0
  13. package/app/docs/components/CopyButton.tsx +68 -0
  14. package/app/docs/components/Dialog.tsx +230 -0
  15. package/app/docs/components/EmptyState.tsx +34 -0
  16. package/app/docs/components/ErrorView.tsx +70 -0
  17. package/app/docs/components/Field.tsx +93 -0
  18. package/app/docs/components/JsonEditor.tsx +151 -0
  19. package/app/docs/components/JsonView.tsx +338 -0
  20. package/app/docs/components/KeyValue.tsx +63 -0
  21. package/app/docs/components/ProblemBanner.tsx +116 -0
  22. package/app/docs/components/ScreenErrorBoundary.tsx +141 -0
  23. package/app/docs/components/Spinner.tsx +33 -0
  24. package/app/docs/components/Table.tsx +33 -0
  25. package/app/docs/components/Tabs.tsx +226 -0
  26. package/app/docs/components/classNames.ts +4 -0
  27. package/app/docs/components/components.css +691 -0
  28. package/app/docs/components/copy.ts +89 -0
  29. package/app/docs/components/fieldContext.ts +29 -0
  30. package/app/docs/components/inputValues.ts +142 -0
  31. package/app/docs/components/inputs.tsx +387 -0
  32. package/app/docs/components/jsonParse.ts +338 -0
  33. package/app/docs/components/listKeys.ts +30 -0
  34. package/app/docs/config.ts +86 -0
  35. package/app/docs/context.ts +33 -0
  36. package/app/docs/embed.ts +74 -0
  37. package/app/docs/env.d.ts +2 -0
  38. package/app/docs/format.ts +9 -0
  39. package/app/docs/hooks/useUrlTab.ts +16 -0
  40. package/app/docs/main.tsx +11 -0
  41. package/app/docs/queryClient.ts +54 -0
  42. package/app/docs/router.tsx +194 -0
  43. package/app/docs/routing.ts +194 -0
  44. package/app/docs/screens/docs/document.ts +27 -0
  45. package/app/docs/screens/docs/http/OperationView.tsx +407 -0
  46. package/app/docs/screens/docs/http/Sidebar.tsx +190 -0
  47. package/app/docs/screens/docs/http/TryItPanel.tsx +603 -0
  48. package/app/docs/screens/docs/http/http.css +405 -0
  49. package/app/docs/screens/docs/http/index.tsx +395 -0
  50. package/app/docs/screens/docs/http/model.ts +604 -0
  51. package/app/docs/screens/docs/http/tryIt.ts +455 -0
  52. package/app/docs/screens/docs/permissions.ts +6 -0
  53. package/app/docs/screens/docs/schema/Prose.tsx +43 -0
  54. package/app/docs/screens/docs/schema/SchemaTree.tsx +319 -0
  55. package/app/docs/screens/docs/schema/index.ts +30 -0
  56. package/app/docs/screens/docs/schema/resolve.ts +466 -0
  57. package/app/docs/screens/docs/schema/schema.css +137 -0
  58. package/app/docs/screens/docs/schema/skeleton.ts +92 -0
  59. package/app/docs/screens/docs/viewer.tsx +154 -0
  60. package/app/docs/screens/docs/ws/InlineText.tsx +25 -0
  61. package/app/docs/screens/docs/ws/PayloadSchema.tsx +39 -0
  62. package/app/docs/screens/docs/ws/format.ts +82 -0
  63. package/app/docs/screens/docs/ws/index.tsx +286 -0
  64. package/app/docs/screens/docs/ws/items.tsx +786 -0
  65. package/app/docs/screens/docs/ws/model.ts +1178 -0
  66. package/app/docs/screens/docs/ws/panels.tsx +440 -0
  67. package/app/docs/screens/docs/ws/ws.css +231 -0
  68. package/app/docs/shortcuts.ts +94 -0
  69. package/app/docs/styles/base.css +847 -0
  70. package/app/docs/styles/tokens.css +143 -0
  71. package/app/docs/theme.ts +56 -0
  72. package/app/kit/unauthorized.ts +222 -0
  73. package/dist/docs/assets/main-0rchxtv5.js +18 -0
  74. package/dist/docs/assets/main-0rchxtv5.js.map +99 -0
  75. package/dist/docs/assets/main-cqgyvs86.css +1 -0
  76. package/dist/docs/manifest.json +26 -0
  77. package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js +6 -0
  78. package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js.map +11 -0
  79. package/dist/jobs/assets/AddFlowDialog-n7gtc84v.css +1 -0
  80. package/dist/jobs/assets/added-cbwsxv3e.js +4 -0
  81. package/dist/jobs/assets/added-cbwsxv3e.js.map +11 -0
  82. package/dist/jobs/assets/bodies-yyw5hmrp.js +6 -0
  83. package/dist/jobs/assets/bodies-yyw5hmrp.js.map +10 -0
  84. package/dist/jobs/assets/channel-tgkvqm8y.js +4 -0
  85. package/dist/jobs/assets/channel-tgkvqm8y.js.map +10 -0
  86. package/dist/jobs/assets/channelChecks-s4yz4yhw.js +4 -0
  87. package/dist/jobs/assets/channelChecks-s4yz4yhw.js.map +10 -0
  88. package/dist/jobs/assets/index-02427smp.css +1 -0
  89. package/dist/jobs/assets/index-09z2cjft.js +4 -0
  90. package/dist/jobs/assets/index-09z2cjft.js.map +16 -0
  91. package/dist/jobs/assets/index-18bn0gvy.css +1 -0
  92. package/dist/jobs/assets/index-47pxmyxn.js +4 -0
  93. package/dist/jobs/assets/index-47pxmyxn.js.map +10 -0
  94. package/dist/jobs/assets/index-4e55z986.js +4 -0
  95. package/dist/jobs/assets/index-4e55z986.js.map +11 -0
  96. package/dist/jobs/assets/index-5c933424.js +4 -0
  97. package/dist/jobs/assets/index-5c933424.js.map +18 -0
  98. package/dist/jobs/assets/index-5kbyqspm.css +1 -0
  99. package/dist/jobs/assets/index-5ng37hk6.css +1 -0
  100. package/dist/jobs/assets/index-5w8w7fvc.css +1 -0
  101. package/dist/jobs/assets/index-71qs5qyx.css +1 -0
  102. package/dist/jobs/assets/index-btpg4r8b.css +1 -0
  103. package/dist/jobs/assets/index-d5r5n0mm.js +4 -0
  104. package/dist/jobs/assets/index-d5r5n0mm.js.map +23 -0
  105. package/dist/jobs/assets/index-e0yy2skq.css +1 -0
  106. package/dist/jobs/assets/index-hs60b25v.js +10 -0
  107. package/dist/jobs/assets/index-hs60b25v.js.map +62 -0
  108. package/dist/jobs/assets/index-k2smrr70.js +4 -0
  109. package/dist/jobs/assets/index-k2smrr70.js.map +9 -0
  110. package/dist/jobs/assets/index-q24jw3w9.js +4 -0
  111. package/dist/jobs/assets/index-q24jw3w9.js.map +32 -0
  112. package/dist/jobs/assets/index-qfb80xen.css +1 -0
  113. package/dist/jobs/assets/index-rtynx6wj.js +4 -0
  114. package/dist/jobs/assets/index-rtynx6wj.js.map +10 -0
  115. package/dist/jobs/assets/live-6k7s6358.js +4 -0
  116. package/dist/jobs/assets/live-6k7s6358.js.map +10 -0
  117. package/dist/jobs/assets/main-0jmeh6mq.js +6 -0
  118. package/dist/jobs/assets/main-0jmeh6mq.js.map +12 -0
  119. package/dist/jobs/assets/main-3yj6bv90.js +5 -0
  120. package/dist/jobs/assets/main-3yj6bv90.js.map +10 -0
  121. package/dist/jobs/assets/main-4g69fn3x.js +5 -0
  122. package/dist/jobs/assets/main-4g69fn3x.js.map +10 -0
  123. package/dist/jobs/assets/main-4gte3eqq.js +5 -0
  124. package/dist/jobs/assets/main-4gte3eqq.js.map +10 -0
  125. package/dist/jobs/assets/main-4j1fcevh.js +5 -0
  126. package/dist/jobs/assets/main-4j1fcevh.js.map +10 -0
  127. package/dist/jobs/assets/main-54qwkz28.css +1 -0
  128. package/dist/jobs/assets/main-5grjvsy7.js +5 -0
  129. package/dist/jobs/assets/main-5grjvsy7.js.map +11 -0
  130. package/dist/jobs/assets/main-5zbx60gq.js +5 -0
  131. package/dist/jobs/assets/main-5zbx60gq.js.map +11 -0
  132. package/dist/jobs/assets/main-9prgjhg4.js +5 -0
  133. package/dist/jobs/assets/main-9prgjhg4.js.map +10 -0
  134. package/dist/jobs/assets/main-a250ffk7.js +17 -0
  135. package/dist/jobs/assets/main-a250ffk7.js.map +115 -0
  136. package/dist/jobs/assets/main-d6ge7w08.js +5 -0
  137. package/dist/jobs/assets/main-d6ge7w08.js.map +10 -0
  138. package/dist/jobs/assets/main-gngzht43.js +5 -0
  139. package/dist/jobs/assets/main-gngzht43.js.map +10 -0
  140. package/dist/jobs/assets/main-hg0hrg8j.js +5 -0
  141. package/dist/jobs/assets/main-hg0hrg8j.js.map +10 -0
  142. package/dist/jobs/assets/main-hm1ng3yg.js +5 -0
  143. package/dist/jobs/assets/main-hm1ng3yg.js.map +12 -0
  144. package/dist/jobs/assets/main-jkvd92z9.js +5 -0
  145. package/dist/jobs/assets/main-jkvd92z9.js.map +10 -0
  146. package/dist/jobs/assets/main-jv5xqd13.js +5 -0
  147. package/dist/jobs/assets/main-jv5xqd13.js.map +21 -0
  148. package/dist/jobs/assets/main-jxre7w93.js +5 -0
  149. package/dist/jobs/assets/main-jxre7w93.js.map +23 -0
  150. package/dist/jobs/assets/main-kwmqkjfx.js +5 -0
  151. package/dist/jobs/assets/main-kwmqkjfx.js.map +11 -0
  152. package/dist/jobs/assets/main-n9cf6bxm.js +5 -0
  153. package/dist/jobs/assets/main-n9cf6bxm.js.map +11 -0
  154. package/dist/jobs/assets/main-pegp0ygb.js +5 -0
  155. package/dist/jobs/assets/main-pegp0ygb.js.map +10 -0
  156. package/dist/jobs/assets/main-qr573853.js +5 -0
  157. package/dist/jobs/assets/main-qr573853.js.map +12 -0
  158. package/dist/jobs/assets/main-rq97rdr4.js +4 -0
  159. package/dist/jobs/assets/main-rq97rdr4.js.map +22 -0
  160. package/dist/jobs/assets/main-szjdmydc.js +5 -0
  161. package/dist/jobs/assets/main-szjdmydc.js.map +13 -0
  162. package/dist/jobs/assets/main-tnbhrm9n.js +7 -0
  163. package/dist/jobs/assets/main-tnbhrm9n.js.map +11 -0
  164. package/dist/jobs/assets/main-ts19j4n0.js +5 -0
  165. package/dist/jobs/assets/main-ts19j4n0.js.map +25 -0
  166. package/dist/jobs/assets/main-w93x1dzs.js +5 -0
  167. package/dist/jobs/assets/main-w93x1dzs.js.map +10 -0
  168. package/dist/jobs/assets/sections-0ksdxs8m.css +1 -0
  169. package/dist/jobs/assets/sections-0y7w4fb4.js +4 -0
  170. package/dist/jobs/assets/sections-0y7w4fb4.js.map +10 -0
  171. package/dist/jobs/assets/sse-mn0t0fh7.js +5 -0
  172. package/dist/jobs/assets/sse-mn0t0fh7.js.map +11 -0
  173. package/dist/jobs/assets/sseChecks-t7tcm7ra.js +4 -0
  174. package/dist/jobs/assets/sseChecks-t7tcm7ra.js.map +10 -0
  175. package/dist/jobs/assets/validation-ysjfy072.js +4 -0
  176. package/dist/jobs/assets/validation-ysjfy072.js.map +9 -0
  177. package/dist/jobs/manifest.json +511 -0
  178. package/dts/docs/assets.d.ts +144 -0
  179. package/dts/docs/assets.d.ts.map +1 -0
  180. package/dts/docs/browser/config.d.ts +61 -0
  181. package/dts/docs/browser/config.d.ts.map +1 -0
  182. package/dts/docs/browser/index.d.ts +12 -0
  183. package/dts/docs/browser/index.d.ts.map +1 -0
  184. package/dts/docs/docsUi.d.ts +42 -0
  185. package/dts/docs/docsUi.d.ts.map +1 -0
  186. package/dts/docs/hosted.d.ts +22 -0
  187. package/dts/docs/hosted.d.ts.map +1 -0
  188. package/dts/docs/index.d.ts +18 -0
  189. package/dts/docs/index.d.ts.map +1 -0
  190. package/dts/docs/shell.d.ts +57 -0
  191. package/dts/docs/shell.d.ts.map +1 -0
  192. package/dts/docs/types.d.ts +137 -0
  193. package/dts/docs/types.d.ts.map +1 -0
  194. package/dts/index.d.ts +21 -0
  195. package/dts/index.d.ts.map +1 -0
  196. package/dts/jobs/assets.d.ts +157 -0
  197. package/dts/jobs/assets.d.ts.map +1 -0
  198. package/dts/jobs/browser/config.d.ts +67 -0
  199. package/dts/jobs/browser/config.d.ts.map +1 -0
  200. package/dts/jobs/browser/index.d.ts +10 -0
  201. package/dts/jobs/browser/index.d.ts.map +1 -0
  202. package/dts/jobs/browser/unauthorized.d.ts +9 -0
  203. package/dts/jobs/browser/unauthorized.d.ts.map +1 -0
  204. package/dts/jobs/index.d.ts +24 -0
  205. package/dts/jobs/index.d.ts.map +1 -0
  206. package/dts/jobs/jobsUi.d.ts +63 -0
  207. package/dts/jobs/jobsUi.d.ts.map +1 -0
  208. package/dts/jobs/shell.d.ts +77 -0
  209. package/dts/jobs/shell.d.ts.map +1 -0
  210. package/dts/jobs/types.d.ts +146 -0
  211. package/dts/jobs/types.d.ts.map +1 -0
  212. package/dts/kit/browser/shared.d.ts +10 -0
  213. package/dts/kit/browser/shared.d.ts.map +1 -0
  214. package/dts/kit/browser/unauthorized.d.ts +74 -0
  215. package/dts/kit/browser/unauthorized.d.ts.map +1 -0
  216. package/dts/kit/unauthorized.d.ts +47 -0
  217. package/dts/kit/unauthorized.d.ts.map +1 -0
  218. package/guides/docs.md +170 -0
  219. package/guides/jobs.md +1120 -0
  220. package/lib/docs/assets.ts +427 -0
  221. package/lib/docs/browser/config.ts +66 -0
  222. package/lib/docs/browser/index.ts +24 -0
  223. package/lib/docs/docsUi.ts +623 -0
  224. package/lib/docs/hosted.ts +31 -0
  225. package/lib/docs/index.ts +37 -0
  226. package/lib/docs/shell.ts +156 -0
  227. package/lib/docs/types.ts +149 -0
  228. package/lib/index.ts +27 -0
  229. package/lib/jobs/assets.ts +448 -0
  230. package/lib/jobs/browser/config.ts +65 -0
  231. package/lib/jobs/browser/index.ts +9 -0
  232. package/lib/jobs/browser/unauthorized.ts +11 -0
  233. package/lib/jobs/index.ts +41 -0
  234. package/lib/jobs/jobsUi.ts +709 -0
  235. package/lib/jobs/shell.ts +205 -0
  236. package/lib/jobs/types.ts +162 -0
  237. package/lib/kit/browser/shared.ts +11 -0
  238. package/lib/kit/browser/unauthorized.ts +114 -0
  239. package/lib/kit/unauthorized.ts +222 -0
  240. package/package.json +198 -4
@@ -0,0 +1,10 @@
1
+ import{B,q,v,c,g,T,r,xr,Rn,Ct,ht,er,n,e,t,fe,i,m,et,J,a,be,de,nt,E,cr,d,p,R,L}from"./main-a250ffk7.js";import{At,Vt}from"./main-4gte3eqq.js";function Ts(s){return s.split(/(`[^`]+`)/).map((o,l)=>o.length>2&&o.startsWith("`")&&o.endsWith("`")?e("code",{children:o.slice(1,-1)},l):o)}function ie({text:s,className:o}){let l=s.split(/\n\s*\n/).filter((u)=>u.trim()!=="");return e(n,{children:l.map((u,f)=>e("p",{className:o,children:Ts(u)},f))})}var zt=24;function H(s){return typeof s==="object"&&s!==null&&!Array.isArray(s)}function Qt(s){let o=s;try{o=decodeURIComponent(s)}catch{}return o.replace(/~1/g,"/").replace(/~0/g,"~")}function Je(s,o){if(o==="#")return s;if(!o.startsWith("#/"))return;let l=s;for(let u of o.slice(2).split("/")){let f=Qt(u);if(Array.isArray(l)){let y=Number(f);l=Number.isInteger(y)?l[y]:void 0}else if(H(l)&&Object.hasOwn(l,f))l=l[f];else return}return l}function $e(s){let o=s.split("/");return Qt(o[o.length-1]??s)||s}function Le(s){return H(s)&&typeof s.$ref==="string"?s.$ref:void 0}function me(s,o){let l=[],u=s;for(;;){let f=Le(u);if(f===void 0)break;if(l.includes(f))return{schema:void 0,refs:l,cycle:!0};l.push(f),u=Je(o,f)}if(typeof u==="boolean"||H(u))return{schema:u,refs:l,cycle:!1};return{schema:void 0,refs:l,cycle:!1}}function Pe(s){let{type:o}=s;if(typeof o==="string")return[o];return Array.isArray(o)?o.filter((l)=>typeof l==="string"):[]}function Ie(s){if(s===void 0)return"undefined";let o=JSON.stringify(s);return o.length>80?`${o.slice(0,77)}…`:o}function Xt(s,o){let l=s[o];return Array.isArray(l)?l:[]}function Ue(s,o,l=0){if(s===!0)return"any";if(s===!1)return"never";if(!H(s))return"any";let u=Le(s);if(u!==void 0)return $e(u);let f=Pe(s);if(f.length>0){let y=f.map((h)=>{if(h==="array"&&l<2){let{items:b}=s;return b===void 0?"array":`array<${Ue(b,o,l+1)}>`}return h});if(s.nullable===!0&&!y.includes("null"))y.push("null");return y.join(" | ")}if(Object.hasOwn(s,"const"))return Ie(s.const);if(Array.isArray(s.enum)){let y=s.enum.slice(0,6).map(Ie);return s.enum.length>6?`${y.join(" | ")} | …`:y.join(" | ")}for(let y of["oneOf","anyOf","allOf"]){let h=Xt(s,y);if(h.length>0){if(y!=="allOf"&&h.length<=3&&l<2)return h.map((b)=>Ue(b,o,l+1)).join(" | ");return`${y}(${h.length})`}}if(H(s.properties)||s.additionalProperties!==void 0)return"object";if(s.items!==void 0)return"array";if(s.not!==void 0)return"not";return"any"}var Rs=[["format","format"],["const","const"],["enum","one of"],["default","default"],["minimum","min"],["exclusiveMinimum","above"],["maximum","max"],["exclusiveMaximum","below"],["multipleOf","multiple of"],["minLength","min length"],["maxLength","max length"],["pattern","pattern"],["minItems","min items"],["maxItems","max items"],["uniqueItems","unique items"],["minProperties","min fields"],["maxProperties","max fields"],["contentMediaType","media type"],["contentEncoding","encoding"]];function rt(s){if(!H(s))return[];let o=[],l=Pe(s).length>0;for(let[u,f]of Rs){if(!Object.hasOwn(s,u))continue;if((u==="enum"||u==="const")&&!l)continue;let y=s[u];if(u==="uniqueItems"&&y!==!0)continue;if(u==="enum"&&Array.isArray(y)){o.push({key:u,label:f,value:y.map(Ie).join(", ")});continue}o.push({key:u,label:f,value:typeof y==="string"&&u!=="default"&&u!=="const"?y:Ie(y)})}if(Array.isArray(s.examples)&&s.examples.length>0)o.push({key:"examples",label:"examples",value:s.examples.map(Ie).join(", ")});else if(Object.hasOwn(s,"example"))o.push({key:"example",label:"example",value:Ie(s.example)});if(s.nullable===!0)o.push({key:"nullable",label:"nullable",value:"yes"});if(s.deprecated===!0)o.push({key:"deprecated",label:"deprecated",value:"yes"});if(s.readOnly===!0)o.push({key:"readOnly",label:"read only",value:"yes"});if(s.writeOnly===!0)o.push({key:"writeOnly",label:"write only",value:"yes"});return o}function Tt(s){if(!H(s)||!Object.hasOwn(s,"additionalProperties"))return null;let o=s.additionalProperties;if(o===!1)return"closed";if(o===!0||H(o)&&Object.keys(o).length===0)return"any";return"typed"}function Yt(s){if(!H(s))return[];let o=[],l=new Set(Array.isArray(s.required)?s.required.filter((u)=>typeof u==="string"):[]);if(H(s.properties))for(let[u,f]of Object.entries(s.properties))o.push({key:`p:${u}`,kind:"property",label:u,schema:f,required:l.has(u)});if(H(s.patternProperties))for(let[u,f]of Object.entries(s.patternProperties))o.push({key:`pp:${u}`,kind:"patternProperty",label:`/${u}/`,schema:f,required:!1});if(Tt(s)==="typed")o.push({key:"additional",kind:"additional",label:"any other field",schema:s.additionalProperties,required:!1});if(Array.isArray(s.prefixItems))s.prefixItems.forEach((u,f)=>{o.push({key:`pi:${f}`,kind:"prefixItems",label:`[${f}]`,schema:u,required:!1})});if(s.items!==void 0&&typeof s.items!=="boolean")o.push({key:"items",kind:"items",label:"[]",schema:s.items,required:!1});for(let u of["oneOf","anyOf","allOf"])Xt(s,u).forEach((f,y)=>{o.push({key:`${u}:${y}`,kind:u,label:u==="allOf"?`Part ${y+1}`:`Option ${y+1}`,schema:f,required:!1})});if(s.not!==void 0)o.push({key:"not",kind:"not",label:"not",schema:s.not,required:!1});return o}var Zt={oneOf:"Exactly one of",anyOf:"Any of",allOf:"All of"};function K(...s){return s.filter(Boolean).join(" ")}function he({schema:s,root:o,depth:l=1,onRef:u,label:f="Schema",className:y}){return e("div",{className:K("schema-tree",y),role:"group","aria-label":f,children:e("ul",{className:"schema-list",children:e(en,{child:null,schema:s,root:o,level:0,depth:l,refChain:[],onRef:u})})})}function Os({refValue:s,onRef:o}){let l=$e(s);if(!o)return e("code",{className:"schema-ref",title:s,children:l});return e("button",{type:"button",className:"schema-ref schema-ref-link",title:`Open ${s}`,onClick:()=>o(s,l),children:l})}function Ds(s,o){let l=rt({...s,$ref:void 0}),u=new Set(l.map((f)=>f.key));return[...rt(o).filter((f)=>!u.has(f.key)),...l]}function en({child:s,schema:o,root:l,level:u,depth:f,refChain:y,onRef:h}){let b=Le(o),k=me(o,l),x=k.schema,w=k.cycle||k.refs.some((_)=>y.includes(_)),N=b!==void 0&&x===void 0&&!w,S=w||u>=zt?[]:Yt(x),[C,j]=r(u<f),I=H(o)?o:{},P=typeof I.description==="string"?I.description:H(x)&&typeof x.description==="string"?x.description:void 0,F=b===void 0?rt(o):Ds(I,x),V=b===void 0?Ue(o,l):w||N?null:Ue(x,l),M=Tt(x),U=s?.label??null,te=[...y,...k.refs];return t("li",{className:"schema-node","data-kind":s?.kind??"root",children:[t("div",{className:"schema-row",children:[S.length>0?e("button",{type:"button",className:"schema-toggle","aria-expanded":C,"aria-label":`${C?"Collapse":"Expand"} ${U??"schema"}`,onClick:()=>j((_)=>!_),children:e("span",{"aria-hidden":"true",children:C?"▾":"▸"})}):e("span",{className:"schema-toggle-spacer","aria-hidden":"true"}),U!==null&&e("span",{className:"schema-name",children:U}),s?.required&&e("span",{className:"schema-required",title:"Required",children:"required"}),V!==null&&e("span",{className:"schema-type",children:V}),b!==void 0&&e(Os,{refValue:b,onRef:h}),w&&e("span",{className:"schema-note-inline",title:"This schema contains itself; it is expanded above.",children:"recursive"}),N&&e("span",{className:"schema-note-inline schema-unresolved",children:"unresolved $ref"}),F.map((_)=>t("span",{className:"schema-fact","data-fact":_.key,children:[e("span",{className:"schema-fact-label",children:_.label})," ",e("code",{children:_.value})]},_.key))]}),P!==void 0&&e("div",{className:"schema-description",children:e(ie,{text:P})}),M==="closed"&&e("p",{className:"schema-closed","data-testid":"schema-closed",children:"No other fields: any field not listed is refused."}),M==="any"&&e("p",{className:"schema-open",children:"Other fields: any value."}),C&&S.length>0&&e("ul",{className:"schema-list",children:S.map((_,Y)=>{let X=S[Y-1],pe=(_.kind==="oneOf"||_.kind==="anyOf"||_.kind==="allOf")&&X?.kind!==_.kind;return e(Es,{item:_,heading:pe?Zt[_.kind]:void 0,root:l,level:u+1,depth:f,refChain:te,onRef:h},_.key)})})]})}function Es({item:s,heading:o,...l}){return t(n,{children:[o!==void 0&&e("li",{className:"schema-composition",children:o}),e(en,{...l,child:s,schema:s.schema})]})}function Me(s,o,l=[]){let{schema:u,refs:f,cycle:y}=me(s,o);if(y||f.some((x)=>l.includes(x)))return null;if(!H(u))return null;let h=[...l,...f];if(Object.hasOwn(u,"default"))return structuredClone(u.default);if(Object.hasOwn(u,"const"))return structuredClone(u.const);if(Array.isArray(u.enum)&&u.enum.length>0)return structuredClone(u.enum.find((x)=>x!==null)??null);if(Array.isArray(u.allOf)&&u.allOf.length>0){let x={};for(let w of u.allOf){let N=Me(w,o,h);if(H(N))Object.assign(x,N)}return x}for(let x of["oneOf","anyOf"]){let w=u[x];if(Array.isArray(w)&&w.length>0){let N=w.find((S)=>{let C=me(S,o).schema;return!(H(C)&&Pe(C).length===1&&Pe(C)[0]==="null")})??w[0];return Me(N,o,h)}}switch(Pe(u).filter((x)=>x!=="null")[0]??(H(u.properties)?"object":u.items?"array":void 0)){case"object":{let x={},w=H(u.properties)?u.properties:{},N=Array.isArray(u.required)?u.required:[];for(let S of N)if(typeof S==="string")x[S]=Me(w[S],o,h);return x}case"array":return(typeof u.minItems==="number"?u.minItems:0)>0?[Me(u.items,o,h)]:[];case"string":return"";case"integer":case"number":return typeof u.minimum==="number"?u.minimum:0;case"boolean":return!1;default:return null}}var ot=["x-bun-common","x-bun-jobs"];function Ke(s,o,l){for(let u of l){let f=`${u}-${o}`;if(Object.hasOwn(s,f))return s[f]}return}var As=["get","put","post","delete","options","head","patch","trace"];function ee(s){return typeof s==="string"?s:void 0}function it(s){return Array.isArray(s)?s.filter((o)=>typeof o==="string"):[]}function at(s,o){let l=Le(o);if(l===void 0)return{node:H(o)?o:void 0};let u=me(o,s).schema;return{node:H(u)?u:void 0,ref:l}}function tn(s){if(!H(s))return[];return Object.entries(s).map(([o,l])=>({contentType:o,schema:H(l)?l.schema:void 0}))}function Is(s,o){let{node:l}=at(s,o),u=ee(l?.name),f=ee(l?.in);if(!l||u===void 0||f!=="path"&&f!=="query"&&f!=="header"&&f!=="cookie")return;return{name:u,in:f,required:f==="path"||l.required===!0,description:ee(l.description),schema:l.schema,style:ee(l.style),explode:typeof l.explode==="boolean"?l.explode:void 0,deprecated:l.deprecated===!0}}function $s(s){if(!H(s))return;return{header:ee(s.header)??null,requireJson:s.requireJson===!0}}function Ls(s,o,l,u,f,y){let h=new Map;for(let x of[...f,...Array.isArray(u.parameters)?u.parameters:[]]){let w=Is(s,x);if(w)h.set(`${w.in}:${w.name}`,w)}let b=at(s,u.requestBody).node,k=[];if(H(u.responses))for(let[x,w]of Object.entries(u.responses)){let{node:N,ref:S}=at(s,w);k.push({status:x,description:ee(N?.description)??"",content:tn(N?.content),codes:it(N===void 0?void 0:Ke(N,"codes",y)),...S?{ref:S}:{}})}return{id:ee(u.operationId)??`${l.toUpperCase()} ${o}`,method:l.toUpperCase(),path:o,summary:ee(u.summary),description:ee(u.description),tags:it(u.tags),deprecated:u.deprecated===!0,parameters:[...h.values()],requestBody:b?{required:b.required===!0,description:ee(b.description),content:tn(b.content)}:void 0,responses:k,action:ee(Ke(u,"action",y)),mutation:Ke(u,"mutation",y)===!0,requires:it(Ke(u,"requires",y)),csrf:$s(Ke(u,"csrf",y))}}function sn(s,o={}){let l=o.extensions??ot,u=[];if(!H(s.paths))return u;for(let[f,y]of Object.entries(s.paths)){let h=at(s,y).node;if(!h)continue;let b=Array.isArray(h.parameters)?h.parameters:[];for(let k of As){let x=h[k];if(H(x))u.push(Ls(s,f,k,x,b,l))}}return u}function rn(s){let o=H(s.info)?s.info:{},l=Array.isArray(s.servers)?s.servers.flatMap((u)=>{let f=H(u)?ee(u.url):void 0;return f===void 0?[]:[{url:f,description:ee(u.description)}]}):[];return{openapi:ee(s.openapi)??"",title:ee(o.title)??"API",version:ee(o.version)??"",description:ee(o.description),servers:l.length>0?l:[{url:"/"}]}}function on(s,o){let l=new Map;if(Array.isArray(s.tags))for(let y of s.tags){let h=H(y)?ee(y.name):void 0;if(h!==void 0&&!l.has(h))l.set(h,{name:h,description:ee(y.description),operations:[]})}let u=[];for(let y of o){if(y.tags.length===0)u.push(y);for(let h of y.tags){let b=l.get(h);if(!b)b={name:h,operations:[]},l.set(h,b);b.operations.push(y)}}let f=[...l.values()].filter((y)=>y.operations.length>0);if(u.length>0)f.push({name:"Other",operations:u});return f}function ct(s){let o=new Map;return s.map((l,u)=>{let f=(o.get(l.name)??0)+1;return o.set(l.name,f),{key:f===1?l.name:`${l.name}#${f}`,index:u,section:l}})}var nn="Other";function Rt(s,o){let l=s["x-tagGroups"];if(!Array.isArray(l))return;let u=l.flatMap((k)=>{if(!H(k))return[];let x=ee(k.name);return x===void 0||!Array.isArray(k.tags)?[]:[{name:x,tags:it(k.tags)}]});if(u.length===0)return;let f=new Map(o.map((k)=>[k.name,k])),y=new Set,h=[];for(let{name:k,tags:x}of u){let w={name:k,tags:[]};for(let N of x){let S=f.get(N);if(S&&!w.tags.includes(S))w.tags.push(S),y.add(N)}h.push(w)}let b=o.filter((k)=>!y.has(k.name));if(b.length>0){let k=h.find((x)=>x.name===nn);if(k)k.tags.push(...b);else h.push({name:nn,tags:b})}return h.filter((k)=>k.tags.length>0)}function Ms(s,o){let l=o.toLowerCase().split(/\s+/).filter(Boolean);if(l.length===0)return!0;let u=[s.method,s.path,s.id,s.summary??"",s.action??""].join(" ").toLowerCase();return l.every((f)=>u.includes(f))}function an(s,o){return s.map((l)=>({...l,operations:l.operations.filter((u)=>Ms(u,o))})).filter((l)=>l.operations.length>0)}function Ot(s,o,l){let u=/^https?:\/\//.test(o)?new URL(o).origin:l;try{return new URL(s,`${u}/`).href.replace(/\/$/,"")}catch{return s}}function cn(s){let o=Je(s,"#/components/schemas");return H(o)?Object.keys(o):[]}function ln(s){switch(s){case"GET":return"info";case"POST":return"success";case"PUT":case"PATCH":return"warning";case"DELETE":return"danger";default:return"neutral"}}function dn(s){return s.responses.map((o)=>o.status).filter((o)=>/^2\d\d$/.test(o))}var lt=new Set(["POST","PUT","PATCH","DELETE"]),dt=new Set(["POST","PUT","PATCH"]);class ge extends Error{kind;status;code;title;detail;type;issues;context;instance;constructor(s){super(s.detail??s.title,{cause:s.cause});this.name="ApiError",this.kind=s.kind,this.status=s.status,this.code=s.code,this.title=s.title,this.detail=s.detail,this.type=s.type,this.issues=s.issues??[],this.context=s.context??{},this.instance=s.instance}static fromProblem(s){return new ge({kind:"problem",status:s.status,code:s.code,title:s.title,detail:s.detail,type:s.type,issues:s.issues,context:s.context,instance:s.instance})}get isAuth(){return this.status===401||this.status===403}}function _e(s){return s instanceof ge}function un(s){if(typeof s!=="object"||s===null)return!1;let o=s;return typeof o.status==="number"&&typeof o.code==="string"&&typeof o.title==="string"}var It="1";function $t(s){if(!s)return"";let o=new URLSearchParams;for(let[u,f]of Object.entries(s)){if(f===void 0||f===null)continue;if(Array.isArray(f)){let y=f;if(y.length===0)o.append(u,"");for(let h of y)o.append(u,String(h));continue}o.append(u,String(f))}let l=o.toString();return l?`?${l}`:""}function mn(s){return encodeURIComponent(s)}function Dt(s){let o=s.split(";")[0]?.trim().toLowerCase()??"";return o==="application/json"||o.endsWith("+json")}function qs(s,o){return o?.aborted===!0||s instanceof Error&&s.name==="AbortError"||typeof DOMException<"u"&&s instanceof DOMException&&s.name==="AbortError"}function Et(s){try{return{value:JSON.parse(s)}}catch{return}}function pn(s,o,l){let u=Dt(s.headers.get("content-type")??"")?Et(o):void 0;if(u&&un(u.value))return ge.fromProblem({...u.value,status:s.status});let f=o.trim().slice(0,300);return new ge({kind:"http",status:s.status,code:`HTTP_${s.status}`,title:s.statusText||`Request failed (${s.status})`,detail:f||void 0,instance:l})}function fn(s){let o=s.base.replace(/\/+$/,"");function l(h,b,{query:k,body:x,signal:w}){let S=`${/^https?:\/\//.test(b)?b:`${o}${b}`}${$t(k)}`,C={Accept:"application/json"};if(dt.has(h))C["Content-Type"]="application/json";if(s.csrfHeader&&lt.has(h))C[s.csrfHeader]=It;let j={method:h,headers:C,credentials:"same-origin"};if(x!==void 0)j.body=JSON.stringify(x);if(w)j.signal=w;return{url:S,init:j}}async function u(h,b,k){let x=s.fetch??globalThis.fetch;try{return await x(h,b)}catch(w){if(qs(w,b.signal??void 0))throw w;throw new ge({kind:"network",status:0,code:"NETWORK_ERROR",title:"The server could not be reached",detail:w instanceof Error?w.message:String(w),instance:k,cause:w})}}async function f(h,b,k={}){let{url:x,init:w}=l(h,b,k),N=await u(x,w,b);if(N.status===204||N.status===205)return;let S=await N.text();if(!N.ok)throw pn(N,S,b);if(S==="")return;let C=Dt(N.headers.get("content-type")??"")?Et(S):void 0;if(!C)throw new ge({kind:"parse",status:N.status,code:"INVALID_RESPONSE",title:"The server answered something other than JSON",detail:S.trim().slice(0,300)||void 0,instance:b});return C.value}async function y(h,b,k={}){let{url:x,init:w}=l(h,b,k),N=performance.now(),S=await u(x,w,b),C=S.status===204||S.status===205?"":await S.text(),j=performance.now()-N,I=C!==""&&Dt(S.headers.get("content-type")??"")?Et(C):void 0,P={};for(let[F,V]of[...S.headers.entries()].sort(([M,U])=>M<U?-1:M>U?1:0))P[F.toLowerCase()]=V;return{ok:S.ok,status:S.status,statusText:S.statusText,headers:P,body:I?I.value:C===""?void 0:C,error:S.ok?void 0:pn(S,C,b),durationMs:j}}return{base:o,request:f,requestRaw:y}}var yn=new Set(["GET","POST","PUT","PATCH","DELETE"]),Bs=new Set(["remove","drain","clean","kill","fail"]);function Mt(s){return`${s.in}:${s.name}`}function hn(s,o){let l=me(s,o).schema;if(!H(l))return;return Pe(l).find((u)=>u!=="null")}function gn(s,o){let l=me(s,o).schema;if(!H(l)||!Array.isArray(l.enum))return;return l.enum.filter((u)=>u!==null).map((u)=>String(u))}function Wt(s,o){let l=me(s.schema,o).schema,u=H(l)?l:{},f=hn(u,o);if(f==="array"){let h=gn(u.items,o);if(h)return{kind:"enum-list",options:h};let b=hn(u.items,o);return{kind:"list",item:b==="integer"||b==="number"?b:"text"}}let y=gn(u,o);if(y)return{kind:"enum",options:y};if(f==="boolean")return{kind:"boolean"};if(f==="integer"||f==="number")return{kind:"number",integer:f==="integer",min:typeof u.minimum==="number"?u.minimum:void 0,max:typeof u.maximum==="number"?u.maximum:void 0};return{kind:"text"}}function qt(s){return s.parameters.filter((o)=>o.in==="path"||o.in==="query")}function ut(s){let l=s.requestBody?.content.find((u)=>u.contentType==="application/json")?.schema;if(!H(l)||Object.keys(l).every((u)=>u==="description"||u.startsWith("x-")))return;return l}function bn(s,o){let l=ut(s);return l===void 0?"":JSON.stringify(Me(l,o),null,2)}function js(s,o,l){if(o.kind==="enum-list"){let f=Array.isArray(l)?l:[];return{value:f.length>0?[...f]:void 0}}let u=typeof l==="string"?l.trim():"";if(u==="")return s.required?{error:`${s.name} is required`}:{value:void 0};switch(o.kind){case"number":{let f=Number(u);if(!Number.isFinite(f)||o.integer&&!Number.isInteger(f))return{error:`${s.name} must be ${o.integer?"an integer":"a number"}`};return{value:f}}case"boolean":return u==="true"||u==="false"?{value:u==="true"}:{error:`${s.name} must be true or false`};case"list":{let f=u.split(",").map((h)=>h.trim()).filter(Boolean),y=[];for(let h of f){if(o.item==="text"){y.push(h);continue}let b=Number(h);if(!Number.isFinite(b)||o.item==="integer"&&!Number.isInteger(b))return{error:`${s.name}: "${h}" is not ${o.item==="integer"?"an integer":"a number"}`};y.push(b)}return{value:y.length>0?y:void 0}}default:return{value:u}}}function vn(s,o,l,u){let f={};if(!yn.has(s.method))return{ok:!1,errors:{method:`${s.method} cannot be sent from here`}};let y=s.path,h={};for(let b of qt(s)){let k=Mt(b),x=js(b,Wt(b,o),l[k]);if("error"in x){f[k]=x.error;continue}if(b.in==="path")y=y.split(`{${b.name}}`).join(mn(String(x.value)));else if(x.value!==void 0)h[b.name]=x.value}if(u===void 0&&s.requestBody?.required&&ut(s)!==void 0)f.body="A body is required";if(Object.keys(f).length>0)return{ok:!1,errors:f};return{ok:!0,request:{method:s.method,path:y,query:h,body:u}}}function xn(s,o){let l={Accept:"application/json"};if(dt.has(s))l["Content-Type"]="application/json";if(o&&lt.has(s))l[o]=It;return l}function kn(s,o){return`${o.replace(/\/+$/,"")}${s.path}${$t(s.query)}`}function Lt(s){return`'${s.replace(/'/g,"'\\''")}'`}function wn(s,o){let l=kn(s,o.apiBase),u=/^https?:\/\//.test(l)?l:`${o.origin}${l}`,f=[`curl -X ${s.method} ${Lt(u)}`];for(let[y,h]of Object.entries(xn(s.method,o.csrfHeader)))f.push(` -H ${Lt(`${y}: ${h}`)}`);if(s.body!==void 0)f.push(` --data ${Lt(JSON.stringify(s.body))}`);return["# The browser also sends this site's cookies (credentials: same-origin).","# If the API's authorize reads a session, add it: -b 'name=value'",f.join(" \\\n")].join(`
2
+ `)}function Nn(s,o){let l=xn(s.method,o.csrfHeader),u=Object.entries(l).map(([y,h])=>` ${JSON.stringify(y)}: ${JSON.stringify(h)},`).join(`
3
+ `),f=[`const response = await fetch(${JSON.stringify(kn(s,o.apiBase))}, {`,` method: ${JSON.stringify(s.method)},`," headers: {",u," },",' credentials: "same-origin",'];if(s.body!==void 0)f.push(` body: JSON.stringify(${JSON.stringify(s.body,null,2).replace(/\n/g,`
4
+ `)}),`);return f.push("});","const data = await response.json();"),f.join(`
5
+ `)}function Sn(s){if(s.method==="DELETE")return!0;let o=s.action?.split(".").pop()??"";return Bs.has(o)}function Cn(s,o){if(!yn.has(s.method))return{enabled:!1,reason:`The viewer's client does not send ${s.method}.`};if(s.mutation&&o.readOnly)return{enabled:!1,reason:"This API is read-only: it refuses every change."};if(s.action!==void 0&&!o.permitted)return{enabled:!1,reason:`You do not have the ${s.action} permission.`};return{enabled:!0}}function Pn(s,o){if(s.responses.some((u)=>u.status===String(o)))return;let l=dn(s);return`Not a documented status. Documented success: ${l.length>0?l.join(" / "):"2xx"}.`}function G({tone:s="neutral",title:o,className:l,testId:u,children:f}){return e("span",{className:K("badge",`badge-${s}`,l),title:o,"data-testid":u,children:f})}function z({title:s,actions:o,className:l,children:u}){let f=c();return t("section",{className:K("card",l),"aria-labelledby":s?f:void 0,children:[(s||o)&&t("div",{className:"card-header",children:[s&&e("h2",{id:f,className:"card-title",children:s}),o&&e("div",{className:"card-actions",children:o})]}),e("div",{className:"card-body",children:u})]})}function se({variant:s="secondary",size:o="md",type:l="button",className:u,...f}){return e("button",{...f,type:l,className:K("btn",`btn-${s}`,o==="sm"&&"btn-sm",u)})}var Tn=1500;async function On(s){try{if(typeof navigator>"u"||!navigator.clipboard)return!1;return await navigator.clipboard.writeText(s),!0}catch{return!1}}var Fs="[Circular]";function Us(s){let o=new WeakSet,l=(u)=>{if(typeof u==="bigint")return u.toString();if(typeof u==="function"||typeof u==="symbol")return;if(typeof u!=="object"||u===null)return u;if(o.has(u))return Fs;let f=u;if(typeof f.toJSON==="function")return l(f.toJSON.call(u));o.add(u);try{if(Array.isArray(u))return u.map((h)=>{let b=l(h);return b===void 0?null:b});let y={};for(let[h,b]of Object.entries(u)){let k=l(b);if(k!==void 0)y[h]=k}return y}finally{o.delete(u)}};return l(s)}function Dn(s,o=2){return JSON.stringify(Us(s),null,o)??"undefined"}function ve({text:s,label:o="Copy",ariaLabel:l,size:u="sm",className:f,onCopied:y}){let[h,b]=r("idle");v(()=>{if(h==="idle")return;let x=setTimeout(b,Tn,"idle");return()=>clearTimeout(x)},[h]);let k=async()=>{let x=await On(typeof s==="function"?s():s);b(x?"copied":"failed"),y?.(x)};return e(se,{variant:"ghost",size:u,className:K("copy-button",f),"aria-label":l,"data-status":h,onClick:()=>void k(),children:e("span",{"aria-live":"polite",children:h==="copied"?"Copied":h==="failed"?"Copy failed":o})})}var Js=["a[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","summary","[contenteditable]:not([contenteditable='false'])","[tabindex]:not([tabindex='-1'])"].join(",");function Bt(s){return Array.from(s.querySelectorAll(Js)).filter((o)=>!o.hasAttribute("inert")&&!o.closest("[inert]"))}function pt(s){return s.open?e(Ks,{...s}):null}function Ks({onClose:s,title:o,description:l,children:u,footer:f,closeOnEscape:y=!0,closeOnBackdrop:h=!0,showCloseButton:b=!0,size:k="md",initialFocusRef:x,role:w="dialog",className:N}){let S=T(null),C=T(null),j=c(),I=c();v(()=>{let M=S.current;if(!M)return;let U=document.activeElement instanceof HTMLElement?document.activeElement:null;if(!M.open)if(typeof M.showModal==="function")M.showModal();else M.setAttribute("open","");return(x?.current??(C.current&&Bt(C.current)[0])??Bt(M).find((_)=>!_.dataset.dialogClose)??M).focus(),()=>{if(M.open&&typeof M.close==="function")M.close();if(U?.isConnected)U.focus()}},[x]);let P=(M)=>{if(M.key==="Escape"){if(M.preventDefault(),M.stopPropagation(),y)s();return}if(M.key!=="Tab"||!S.current)return;let U=Bt(S.current);if(U.length===0){M.preventDefault(),S.current.focus();return}let te=U[0],_=U[U.length-1],Y=document.activeElement,X=Y instanceof Node&&S.current.contains(Y);if(M.shiftKey&&(Y===te||!X))M.preventDefault(),_.focus();else if(!M.shiftKey&&(Y===_||!X))M.preventDefault(),te.focus()},F=(M)=>{if(M.preventDefault(),y)s()},V=(M)=>{if(h&&M.target===M.currentTarget)s()};return e("dialog",{ref:S,role:w==="alertdialog"?"alertdialog":void 0,"aria-modal":"true","aria-labelledby":j,"aria-describedby":l?I:void 0,className:K("dialog",`dialog-${k}`,N),tabIndex:-1,onKeyDown:P,onCancel:F,onClick:V,children:t("div",{className:"dialog-panel",children:[t("div",{className:"dialog-header",children:[e("h2",{id:j,className:"dialog-title",children:o}),b&&e(se,{variant:"ghost",size:"sm",className:"dialog-close","aria-label":"Close","data-dialog-close":"true",onClick:s,children:e("span",{"aria-hidden":"true",children:"×"})})]}),l&&e("p",{id:I,className:"dialog-description",children:l}),u!==void 0&&e("div",{ref:C,className:"dialog-body",children:u}),f&&e("div",{className:"dialog-footer",children:f})]})})}function mt({title:s,description:o,action:l,headingLevel:u}){let f=u?`h${u}`:"p";return t("div",{className:"empty-state",children:[e(f,{className:"empty-state-title",children:s}),o&&e("p",{className:"empty-state-description",children:o}),l&&e("div",{className:"empty-state-action",children:l})]})}var ft=B(null),gt=B(null),En=B(null);function Te(){let s=q(ft);if(!s)throw Error("useDocsUiConfig must be used inside <DocsUiProviders>");return s}function jt(){let s=q(gt);if(!s)throw Error("useDocsClient must be used inside <DocsClientContext>");return s}function An(){return q(En)??void 0}function Vs(s){return s.button!==0||s.metaKey||s.altKey||s.ctrlKey||s.shiftKey||s.defaultPrevented}function oe({to:s,activeMatch:o,onClick:l,target:u,...f}){let{navigate:y,href:h,location:b}=be(),k=s.split("?")[0]||"/",x=b.path!==null&&(o==="exact"?b.path===k:o==="prefix"?k==="/"?b.path==="/":b.path===k||b.path.startsWith(`${k}/`):!1);return e("a",{...f,target:u,href:h(s),"aria-current":x?"page":void 0,onClick:(w)=>{if(l?.(w),Vs(w)||u&&u!=="_self")return;w.preventDefault(),y(s)}})}var Ht=B(null);function yt(){return q(Ht)}function We(...s){let o=s.filter(Boolean).join(" ");return o===""?void 0:o}function Se({label:s,hint:o,error:l,required:u=!1,id:f,className:y,children:h}){let b=c(),k=f??b,x=`${k}-hint`,w=`${k}-error`,N=Boolean(l),S=g(()=>({id:k,"aria-describedby":We(o?x:null,N&&w),"aria-invalid":N||void 0,required:u||void 0}),[k,o,x,N,w,u]);return t("div",{className:K("field",N&&"field-invalid",y),children:[t("label",{className:"field-label",htmlFor:k,children:[s,u&&t("span",{className:"field-required","aria-hidden":"true",children:[" ","*"]})]}),e(Ht,{value:S,children:typeof h==="function"?h(S):h}),o&&e("p",{id:x,className:"field-hint",children:o}),N&&e("p",{id:w,className:"field-error",children:l})]})}function In(s){let o=yt();return{id:s.id??o?.id,"aria-describedby":We(o?.["aria-describedby"],s["aria-describedby"]),"aria-invalid":s["aria-invalid"]??o?.["aria-invalid"],required:s.required??o?.required}}function xe({value:s,onChange:o,type:l="text",className:u,...f}){let y=In(f);return e("input",{...f,...y,type:l,className:K("input",u),value:s,onChange:(h)=>o(h.target.value,h)})}function $n({options:s,value:o,onChange:l,className:u,...f}){let y=In(f);return e("select",{...f,...y,className:K("input","select",u),value:o,onChange:(h)=>{let b=s.find((k)=>k.value===h.target.value);if(b)l(b.value,h)},children:s.map((h)=>e("option",{value:h.value,disabled:h.disabled,children:h.label??h.value},h.value))})}function Ln({checked:s,onChange:o,label:l,hint:u,id:f,className:y,...h}){let b=c(),k=f??b,x=`${k}-hint`;return t("div",{className:K("checkbox",y),children:[e("input",{...h,id:k,type:"checkbox",checked:s,"aria-describedby":u?x:void 0,onChange:(w)=>o(w.target.checked,w)}),e("label",{htmlFor:k,children:l}),u&&e("p",{id:x,className:"field-hint checkbox-hint",children:u})]})}function Gs(s){if(typeof s==="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}}function Ve({error:s,title:o,onRetry:l,onDismiss:u,className:f}){let y=_e(s)?s:null,h=o??y?.title??"Something went wrong",b=y?.detail??(s instanceof Error?s.message:String(s)),k=y?Object.entries(y.context):[];return t("div",{className:K("problem-banner",f),role:"alert",children:[t("div",{className:"problem-banner-main",children:[t("p",{className:"problem-banner-title",children:[e("strong",{children:h}),y&&t("code",{className:"problem-banner-code",children:[y.code,y.status>0?` · ${y.status}`:""]})]}),b&&b!==h&&e("p",{className:"problem-banner-detail",children:b}),k.length>0&&e("ul",{className:"problem-banner-context","aria-label":"Context",children:k.map(([x,w])=>t("li",{children:[e("span",{className:"problem-banner-key",children:x}),"=",e("code",{children:Gs(w)})]},x))}),y&&y.issues.length>0&&e("ul",{className:"problem-banner-issues",children:y.issues.map((x)=>t("li",{children:[t("code",{children:[x.target,x.path?`.${x.path}`:""]})," ",x.message]},`${x.target}:${x.path}:${x.message}`))})]}),(l||u)&&t("div",{className:"problem-banner-actions",children:[l&&e(se,{size:"sm",onClick:l,children:"Retry"}),u&&e(se,{size:"sm",variant:"ghost",onClick:u,children:"Dismiss"})]})]})}function Mn(s){return s.open?e(zs,{...s}):null}function zs({onClose:s,title:o,description:l,children:u,onConfirm:f,confirmLabel:y="Confirm",pendingLabel:h,cancelLabel:b="Cancel",variant:k="default",confirmText:x,confirmTextLabel:w,closeOnSuccess:N=!0,confirmDisabled:S=!1}){let[C,j]=r(""),[I,P]=r(!1),[F,V]=r(null),M=T(null),U=T(null),te=T(null),Y=(x===void 0||C===x)&&!I&&!S,X=k==="danger",pe=async()=>{if(!Y)return;P(!0),V(null);try{if(await f(),P(!1),N)s()}catch(ae){P(!1),V(ae)}},re=(ae)=>{ae.preventDefault(),pe()},we=()=>{if(!I)s()};return e(pt,{open:!0,onClose:we,title:o,description:l,role:X?"alertdialog":"dialog",size:"sm",closeOnEscape:!I,closeOnBackdrop:!I,initialFocusRef:x!==void 0?te:X?M:U,footer:t(n,{children:[e(se,{ref:M,onClick:we,disabled:I,children:b}),e(se,{ref:U,variant:X?"danger":"primary",disabled:!Y,"aria-busy":I||void 0,onClick:()=>void pe(),children:I?h??`${y}…`:y})]}),children:t("form",{className:"confirm-dialog-body",onSubmit:re,children:[u,x!==void 0&&e(Se,{label:w??t(n,{children:["Type ",e("code",{children:x})," to confirm"]}),children:e(xe,{ref:te,value:C,onChange:j,autoComplete:"off",spellCheck:!1,disabled:I})}),F!==null&&e(Ve,{error:F})]})})}class Ge extends Error{offset;constructor(s,o){super(s);this.offset=o}}function Qs(s,o){return o>=s.length?"end of input":`'${s[o]===`
6
+ `?"\\n":s[o]}'`}function Xs(s){let o=0,l=()=>{while(o<s.length&&(s[o]===" "||s[o]==="\t"||s[o]===`
7
+ `||s[o]==="\r"))o++},u=(k)=>{throw new Ge(`Expected ${k} but found ${Qs(s,o)}`,o)},f=(k)=>{for(let x=0;x<k.length;x++){if(s[o]!==k[x])u(`'${k}'`);o++}},y=()=>{o++;while(o<s.length){let k=s[o];if(k==='"'){o++;return}if(k==="\\"){let x=s[o+1];if(x==="u"){if(!/^[0-9a-f]{4}$/i.test(s.slice(o+2,o+6)))o+=2,u("four hex digits after \\u");o+=6;continue}if(x===void 0||!'"\\/bfnrt'.includes(x))o++,u("a valid escape");o+=2;continue}if(k<" ")throw new Ge("Control characters must be escaped in strings",o);o++}throw new Ge("Unterminated string",o)},h=()=>{let k=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:e[+-]?\d+)?/i.exec(s.slice(o,o+400));if(!k)u("a number");o+=k[0].length},b=()=>{l();let k=s[o];if(k==="{"){if(o++,l(),s[o]==="}"){o++;return}for(;;){if(l(),s[o]!=='"')u("a property name in double quotes");if(y(),l(),s[o]!==":")u("':'");if(o++,b(),l(),s[o]===","){o++;continue}if(s[o]==="}"){o++;return}u("',' or '}'")}}if(k==="["){if(o++,l(),s[o]==="]"){o++;return}for(;;){if(b(),l(),s[o]===","){o++;continue}if(s[o]==="]"){o++;return}u("',' or ']'")}}if(k==='"'){y();return}if(k==="t"){f("true");return}if(k==="f"){f("false");return}if(k==="n"){f("null");return}if(k==="-"||k!==void 0&&k>="0"&&k<="9"){h();return}u("a value")};if(b(),l(),o<s.length)u("end of input")}function Ys(s,o){let l=1,u=0,f=Math.min(o,s.length);for(let y=0;y<f;y++)if(s.charCodeAt(y)===10)l++,u=y+1;return{line:l,column:f-u+1}}function Zs(s){try{return{ok:!0,value:JSON.parse(s)}}catch(o){let l=o instanceof Error?o.message:String(o),u=0;try{Xs(s)}catch(f){if(f instanceof Ge)l=f.message,u=f.offset}return{ok:!1,error:{message:l,offset:u,...Ys(s,u)}}}}function tr(s){return new TextEncoder().encode(s).byteLength}function Oe(s){if(s<1024)return`${s} B`;if(s<1048576)return`${(s/1024).toFixed(1)} KiB`;return`${(s/1048576).toFixed(1)} MiB`}function ze(s,{maxBytes:o,allowEmpty:l=!1}={}){let u=tr(s),f=o!==void 0&&u>o;if(l&&s.trim()==="")return{text:s,value:void 0,valid:!f,error:null,bytes:u,overLimit:f};let y=Zs(s);return y.ok?{text:s,value:y.value,valid:!f,error:null,bytes:u,overLimit:f}:{text:s,value:void 0,valid:!1,error:y.error,bytes:u,overLimit:f}}function Wn({value:s,onChange:o,maxBytes:l,allowEmpty:u=!1,rows:f=10,"aria-label":y,id:h,readOnly:b=!1,disabled:k=!1,placeholder:x,className:w}){let N=yt(),S=c(),C=h??N?.id??S,j=`${C}-json-error`,I=`${C}-json-size`,P=g(()=>ze(s,{maxBytes:l,allowEmpty:u}),[s,l,u]),F=(U)=>o(ze(U,{maxBytes:l,allowEmpty:u})),V=(U)=>{if(P.error===null&&P.value!==void 0)F(JSON.stringify(P.value,null,U))},M=!b&&!k&&P.error===null&&P.value!==void 0;return t("div",{className:K("json-editor",!P.valid&&"json-editor-invalid",w),children:[e("textarea",{id:C,className:"input json-editor-text",rows:f,value:s,placeholder:x,readOnly:b,disabled:k,spellCheck:!1,autoCapitalize:"off",autoComplete:"off","aria-label":y,"aria-invalid":!P.valid||N?.["aria-invalid"]||void 0,"aria-required":N?.required,"aria-describedby":We(N?.["aria-describedby"],P.error&&j,I),onChange:(U)=>F(U.target.value)}),t("div",{className:"json-editor-bar",children:[P.error?t("p",{id:j,className:"json-editor-error",children:["Line ",P.error.line,", column ",P.error.column,":"," ",P.error.message]}):e("p",{className:"json-editor-ok muted",children:"Valid JSON"}),t("span",{id:I,className:K("json-editor-size",P.overLimit&&"is-over"),children:[l!==void 0&&e("meter",{className:"json-editor-meter",min:0,max:l,low:l*0.8,high:l,optimum:0,value:Math.min(P.bytes,l),"aria-hidden":"true"}),l===void 0?Oe(P.bytes):P.overLimit?`${Oe(P.bytes)} of ${Oe(l)}: over the limit by ${Oe(P.bytes-l)}`:`${Oe(P.bytes)} of ${Oe(l)}`]}),!b&&t("span",{className:"json-editor-actions",children:[e(se,{size:"sm",disabled:!M,onClick:()=>V(2),children:"Format"}),e(se,{size:"sm",disabled:!M,onClick:()=>V(void 0),children:"Minify"})]})]})]})}function nr(s){if(s===null)return"null";if(Array.isArray(s))return"array";switch(typeof s){case"object":return s instanceof Date?"other":"object";case"string":return"string";case"number":case"bigint":return"number";case"boolean":return"boolean";case"undefined":return"undefined";default:return"other"}}function sr(s){if(typeof s==="bigint")return`${s}n`;if(s instanceof Date)return Number.isNaN(s.getTime())?"Invalid Date":s.toISOString();if(typeof s==="symbol"||typeof s==="function")return s.toString();return String(s)}function rr(s,o){if(Array.isArray(s))return s.slice(0,o).map((u,f)=>[String(f),u]);let l=s;return Object.keys(l).slice(0,o).map((u)=>[u,l[u]])}function Qe({value:s,label:o="JSON",expandDepth:l=1,maxStringLength:u=200,maxChildren:f=100,copyable:y=!0,className:h}){let b={expandDepth:l,maxStringLength:u,maxChildren:f};return t("div",{className:K("json-view",h),children:[y&&e("div",{className:"json-view-toolbar",children:e(ve,{text:()=>Dn(s,2),ariaLabel:`Copy ${o}`})}),e("ul",{className:"json-tree","aria-label":o,children:e(qn,{name:null,value:s,depth:0,ancestors:[],limits:b})})]})}function qn({name:s,value:o,depth:l,ancestors:u,limits:f}){let y=nr(o),h=s===null?null:t("span",{className:"json-key",children:[s,": "]});if(y!=="object"&&y!=="array")return t("li",{className:"json-row",children:[h,e(ir,{value:o,kind:y,maxLength:f.maxStringLength})]});let b=o;if(u.includes(b))return t("li",{className:"json-row",children:[h,e("span",{className:"json-circular",children:"[Circular]"})]});return e(or,{nameNode:h,value:b,isArray:y==="array",depth:l,ancestors:u,limits:f})}function or({nameNode:s,value:o,isArray:l,depth:u,ancestors:f,limits:y}){let[h,b]=r(u<y.expandDepth),[k,x]=r(y.maxChildren),w=l?o.length:Object.keys(o).length,N=l?"[":"{",S=l?"]":"}",C=l?`${w} ${w===1?"item":"items"}`:`${w} ${w===1?"key":"keys"}`;if(w===0)return t("li",{className:"json-row",children:[s,t("span",{className:"json-punct",children:[N,S]})]});let j=h?rr(o,k):[],I=h?[...f,o]:f;return t("li",{className:"json-row json-container",children:[t("button",{type:"button",className:"json-toggle","aria-expanded":h,onClick:()=>b((P)=>!P),children:[e("span",{className:"json-caret","aria-hidden":"true"}),s,e("span",{className:"json-punct",children:N}),!h&&t(n,{children:[e("span",{className:"json-summary",children:C}),e("span",{className:"json-punct",children:S})]})]}),h&&t(n,{children:[t("ul",{className:"json-children",children:[j.map(([P,F])=>e(qn,{name:P,value:F,depth:u+1,ancestors:I,limits:y},P)),w>k&&e("li",{className:"json-row",children:t("button",{type:"button",className:"json-more",onClick:()=>x((P)=>P+y.maxChildren),children:["Show ",Math.min(y.maxChildren,w-k)," more (",w-k," hidden)"]})})]}),e("span",{className:"json-punct",children:S})]})]})}function ir({value:s,kind:o,maxLength:l}){let[u,f]=r(!1);if(o==="string"){let y=s,h=!u&&y.length>l;return t(n,{children:[t("span",{className:"json-string",children:['"',h?y.slice(0,l):y,h?"…":"",'"']}),y.length>l&&e("button",{type:"button",className:"json-more","aria-expanded":u,onClick:()=>f((b)=>!b),children:u?"Show less":`Show more (${y.length} chars)`})]})}return e("span",{className:`json-${o}`,children:sr(s)})}var ar=new Intl.NumberFormat(void 0,{notation:"compact"});function Bn({tabs:s,value:o,onChange:l,label:u,children:f,activation:y="auto",className:h}){let b=c(),k=T(null),x=(C)=>`${b}-tab-${C}`,w=`${b}-panel`,N=s.findIndex((C)=>C.value===o),S=(C)=>{let j=s.map((V,M)=>({tab:V,index:M})).filter(({tab:V})=>!V.disabled);if(j.length===0)return;let I=j.findIndex(({index:V})=>x(V)===C.currentTarget.id),P=null;switch(C.key){case"ArrowRight":P=(I+1)%j.length;break;case"ArrowLeft":P=(I-1+j.length)%j.length;break;case"Home":P=0;break;case"End":P=j.length-1;break;default:return}C.preventDefault();let F=j[P];if(k.current?.ownerDocument.getElementById(x(F.index))?.focus(),y==="auto")l(F.tab.value)};return t("div",{className:K("tabs",h),children:[e("div",{ref:k,className:"tabs-list",role:"tablist","aria-label":u,children:s.map((C,j)=>{let I=j===N,P=I||N===-1&&j===s.findIndex((F)=>!F.disabled);return t("button",{id:x(j),type:"button",role:"tab",className:"tab","aria-selected":I,"aria-controls":f!==void 0?w:void 0,tabIndex:P?0:-1,disabled:C.disabled,title:C.title,onClick:()=>l(C.value),onKeyDown:S,children:[e("span",{className:"tab-label",children:C.label}),C.count!==void 0&&e("span",{className:"tab-count",title:String(C.count),children:ar.format(C.count)})]},C.value)})}),f!==void 0&&e("div",{id:w,className:"tabs-panel",role:"tabpanel","aria-labelledby":N>=0?x(N):void 0,tabIndex:0,children:f})]})}function lr(s,o){switch(s.kind){case"list":return"Comma-separated; each value is sent as a repeated key (name=a&name=b).";case"enum-list":return"Each ticked value is sent as a repeated key.";case"number":{let l=[s.min!==void 0?`min ${s.min}`:void 0,s.max!==void 0?`max ${s.max}`:void 0].filter(Boolean);return[s.integer?"An integer":"A number",...l].join(", ")}default:return o.in==="path"?"Percent-encoded as one path segment.":void 0}}function dr({parameter:s,kind:o,value:l,onChange:u,disabled:f}){let y=typeof l==="string"?l:"";switch(o.kind){case"boolean":case"enum":{let h=o.kind==="boolean"?["true","false"]:o.options;return e($n,{value:y,disabled:f,options:[{value:"",label:s.required?"Choose…":"(not sent)"},...h.map((b)=>({value:b}))],onChange:u})}case"enum-list":{let h=Array.isArray(l)?l:[];return e("div",{className:"http-tryit-checks",role:"group","aria-label":s.name,children:o.options.map((b)=>e(Ln,{label:b,disabled:f,checked:h.includes(b),onChange:(k)=>u(k?[...h,b]:h.filter((x)=>x!==b))},b))})}default:return e(xe,{value:y,disabled:f,inputMode:o.kind==="number"?"decimal":void 0,placeholder:o.kind==="list"?"a, b, c":void 0,onChange:(h)=>u(h)})}}function ur({headers:s}){let o=Object.entries(s);return t("details",{className:"http-tryit-headers","data-testid":"tryit-headers",children:[e("summary",{children:`Headers (${o.length})`}),o.length===0?e("p",{className:"http-muted",children:"No headers visible to the page."}):e("dl",{children:o.map(([l,u])=>t("div",{"data-header":l,children:[e("dt",{children:e("code",{children:l})}),e("dd",{children:e("code",{children:u})})]},l))})]})}function pr({body:s,label:o}){if(s===void 0)return e("p",{className:"http-muted",children:"No body."});if(typeof s==="string")return e("pre",{className:"http-tryit-text","aria-label":o,children:e("code",{children:s})});return e(Qe,{value:s,label:o,expandDepth:2})}function mr({result:s,operation:o}){let l=s.ok?s.response:void 0,u=s.ok?s.response.error:s.error,f=_e(u)?u:void 0,y=l?Pn(o,l.status):void 0,h=l?l.durationMs:s.ok?0:s.ms;return t("section",{className:"http-tryit-result","aria-label":"Response","data-testid":"tryit-result",children:[t("div",{className:"http-tryit-status",children:[e(G,{tone:l?.ok?"success":"danger",children:e("span",{"data-testid":"tryit-status",children:l?String(l.status):f?.status===0?"No response":"Error"})}),l?.statusText&&e("span",{className:"http-muted",children:l.statusText}),f&&e("code",{children:f.code}),e("span",{className:"http-tryit-timing","data-testid":"tryit-timing",children:`${Math.round(h)} ms`})]}),y&&e("p",{className:"http-muted","data-testid":"tryit-documented",children:y}),!l&&e(Ve,{error:u}),l&&t(n,{children:[!l.ok&&e(Ve,{error:u}),e(ur,{headers:l.headers}),e(pr,{body:l.body,label:l.ok?"Response body":f?.kind==="problem"?"Problem body":"Response body"})]})]})}function fr({request:s}){let o=jt(),l=Te(),[u,f]=r("curl"),y={apiBase:o.base,origin:typeof window>"u"?"":window.location.origin,csrfHeader:l.csrfHeader},h=s?u==="curl"?wn(s,y):Nn(s,y):void 0;return e(Bn,{label:"Snippets",value:u,onChange:f,tabs:[{value:"curl",label:"curl"},{value:"fetch",label:"fetch()"}],className:"http-snippets",children:h===void 0?e("p",{className:"http-muted",children:"Fill in the required fields to see the snippet."}):t("div",{className:"http-snippet",children:[e(ve,{text:h,ariaLabel:`Copy the ${u==="curl"?"curl command":"fetch() call"}`}),e("pre",{"data-testid":`snippet-${u}`,children:e("code",{children:h})})]})})}function jn({operation:s,root:o,readOnly:l=!1,probe:u,onChanged:f}){let y=jt(),h=Te(),b=qt(s),k=ut(s),x=s.requestBody?.required!==!0,[w,N]=r({}),[S,C]=r(()=>ze(bn(s,o),{allowEmpty:x})),[j,I]=r({}),[P,F]=r(null),[V,M]=r(!1),[U,te]=r(null),_=Cn(s,{readOnly:l,permitted:s.action===void 0||u===void 0?!0:u(s.action)===!0}),Y=!_.enabled||V,X=g(()=>vn(s,o,w,k===void 0?void 0:S.value),[s,o,w,k,S.value]);async function pe(Z){M(!0);let ce=performance.now();try{let le=await y.requestRaw(Z.method,Z.path,{query:Z.query,body:Z.body});if(te({ok:!0,response:le}),s.mutation&&le.ok)f?.()}catch(le){te({ok:!1,error:le,ms:performance.now()-ce})}finally{M(!1)}}function re(){if(!_.enabled)return;if(k!==void 0&&!S.valid){I({body:S.error?`Line ${S.error.line}: ${S.error.message}`:"The body is not valid JSON"});return}if(!X.ok){I(X.errors);return}if(I({}),s.mutation){F(X.request);return}pe(X.request)}let we=Sn(s),ae=s.parameters.find((Z)=>Z.in==="header"&&Z.name===s.csrf?.header);return t("section",{className:"http-tryit","aria-labelledby":`tryit-${s.id}`,"data-testid":"tryit",children:[e("h3",{id:`tryit-${s.id}`,children:"Try it"}),!_.enabled&&e("p",{className:"http-tryit-disabled",role:"note","data-testid":"tryit-disabled",children:_.reason}),t("form",{className:"http-tryit-form",noValidate:!0,onSubmit:(Z)=>{Z.preventDefault(),re()},children:[b.length===0&&k===void 0&&e("p",{className:"http-muted",children:"No parameters."}),b.map((Z)=>{let ce=Mt(Z),le=Wt(Z,o);return e(Se,{label:t(n,{children:[e("code",{children:Z.name})," ",e("span",{className:"http-muted",children:Z.in})]}),required:Z.required,hint:lr(le,Z),error:j[ce],children:e(dr,{parameter:Z,kind:le,value:w[ce],disabled:Y,onChange:(Ze)=>N((tt)=>({...tt,[ce]:Ze}))})},ce)}),ae&&e("p",{className:"http-muted","data-testid":"tryit-csrf",children:h.csrfHeader===ae.name?`The ${ae.name} header is added by the app's client.`:h.csrfHeader?`The API asks for ${ae.name}, but this UI sends ${h.csrfHeader}: the API will refuse this with 403 CSRF_REJECTED.`:`The API asks for ${ae.name}, but this UI is configured with no CSRF header: the API will refuse this with 403 CSRF_REJECTED.`}),k!==void 0&&e(Se,{label:"Body (application/json)",required:!x,hint:x?"Optional: leave it empty to send none.":"Prefilled with the schema's required fields.",error:j.body,children:e(Wn,{value:S.text,allowEmpty:x,readOnly:Y,rows:8,onChange:C})}),t("div",{className:"http-tryit-actions",children:[e(se,{type:"submit",variant:s.mutation?we?"danger":"primary":"primary",disabled:Y,children:V?"Sending…":`Send ${s.method}`}),U&&e(se,{variant:"ghost",onClick:()=>te(null),children:"Clear response"})]})]}),e(fr,{request:X.ok?X.request:void 0}),U&&e(mr,{result:U,operation:s}),e(Mn,{open:P!==null,onClose:()=>F(null),title:`Send ${s.method} ${P?.path??s.path}?`,description:we?"This changes the real API and cannot be undone.":"This changes the real API, as the app's own buttons would.",variant:we?"danger":"default",confirmLabel:`Send ${s.method}`,confirmText:we?s.id:void 0,onConfirm:async()=>{if(P)await pe(P)}})]})}function Ft({method:s}){return e(G,{tone:ln(s),className:"http-method",children:s})}function hr(s){if(s.in!=="query"||s.style===void 0)return;if(s.style==="form"&&s.explode!==!1)return"Repeat the key for each value (state=a&state=b).";return`style: ${s.style}${s.explode===void 0?"":`, explode: ${String(s.explode)}`}`}function gr({operation:s,root:o,onRef:l}){if(s.parameters.length===0)return null;return t("section",{className:"http-section","aria-labelledby":`params-${s.id}`,children:[e("h3",{id:`params-${s.id}`,children:"Parameters"}),e("ul",{className:"http-params","data-testid":"op-parameters",children:s.parameters.map((u)=>{let f=hr(u);return t("li",{className:"http-param","data-param":u.name,children:[t("div",{className:"http-param-head",children:[e("code",{className:"http-param-name",children:u.name}),e(G,{tone:"neutral",children:u.in}),u.required?e("span",{className:"schema-required",children:"required"}):e("span",{className:"http-muted",children:"optional"}),u.deprecated&&e(G,{tone:"warning",children:"deprecated"})]}),u.description&&e("div",{className:"http-param-description",children:e(ie,{text:u.description})}),f&&e("p",{className:"http-muted http-param-style",children:f}),e(he,{schema:u.schema,root:o,depth:0,onRef:l,label:`Schema of ${u.name}`})]},`${u.in}:${u.name}`)})})]})}function yr({operation:s,root:o,onRef:l}){let u=s.requestBody;if(!u)return null;return t("section",{className:"http-section","aria-labelledby":`body-${s.id}`,"data-testid":"op-body",children:[t("h3",{id:`body-${s.id}`,children:["Request body"," ",e("span",{className:"http-muted",children:u.required?"(required)":"(optional)"})]}),u.description&&e(ie,{text:u.description}),u.content.map((f)=>t("div",{className:"http-media",children:[e("code",{className:"http-media-type",children:f.contentType}),f.schema!==void 0&&e(he,{schema:f.schema,root:o,depth:2,onRef:l,label:`Request body schema (${f.contentType})`})]},f.contentType))]})}function br(s){if(s.startsWith("2"))return"success";if(s.startsWith("4"))return"warning";if(s.startsWith("5"))return"danger";return"neutral"}function vr({response:s,root:o,onRef:l}){let u=s.status.startsWith("2");return t("li",{className:"http-response","data-status":s.status,children:[t("div",{className:"http-response-head",children:[e(G,{tone:br(s.status),children:s.status}),e("span",{children:s.description})]}),s.codes.length>0&&e("ul",{className:"http-codes","aria-label":`Problem codes for ${s.status}`,children:s.codes.map((f)=>e("li",{children:e("code",{children:f})},f))}),s.content.map((f)=>t("div",{className:"http-media",children:[e("code",{className:"http-media-type",children:f.contentType}),f.schema!==void 0&&e(he,{schema:f.schema,root:o,depth:u?1:0,onRef:l,label:`Response ${s.status} schema (${f.contentType})`})]},f.contentType))]})}function Hn({operation:s,root:o,onRef:l,probe:u,readOnly:f=!1,onChanged:y}){let h=Te(),b=s.action===void 0||u===void 0?void 0:u(s.action),k=s.csrf;return t("article",{className:"http-operation","aria-labelledby":`op-${s.id}`,"data-testid":"http-operation",children:[t("header",{className:"http-operation-head",children:[t("div",{className:"http-operation-line",children:[e(Ft,{method:s.method}),e("code",{className:"http-operation-path","data-testid":"op-path",children:s.path}),s.deprecated&&e(G,{tone:"warning",children:"deprecated"})]}),e("h2",{id:`op-${s.id}`,className:"http-operation-title",children:s.summary??s.id}),t("p",{className:"http-operation-id",children:[e("span",{className:"http-muted",children:"operationId"})," ",e("code",{children:s.id}),e(ve,{text:s.id,ariaLabel:"Copy the operation id"})]})]}),t("div",{className:"http-markers","aria-label":"Access",role:"group",children:[s.action!==void 0&&(u===void 0?e(G,{tone:"neutral",title:"The permission the API's authorize hook is asked about.",children:t("span",{"data-testid":"op-permission",children:["Needs ",e("code",{children:s.action})]})}):e(G,{tone:b?"success":"danger",title:"From the caller's permissions. authorize may still decide per target.",children:t("span",{"data-testid":"op-permission","data-allowed":String(b??!1),children:[b?"You have ":"You lack ",e("code",{children:s.action})]})})),e(G,{tone:s.mutation?"warning":"neutral",title:s.mutation?"Changes state: CSRF checks apply, and a read-only API refuses it.":"Reads only.",children:e("span",{"data-testid":"op-mutation",children:s.mutation?"Mutation":"Read"})}),s.mutation&&f&&e(G,{tone:"danger",children:"Refused: the API is read-only"}),s.requires.length>0&&t("span",{className:"http-requires","data-testid":"op-requires",children:[e("span",{className:"http-muted",children:"Needs driver support:"})," ",s.requires.map((x)=>e("code",{children:x},x))]})]}),k&&t("div",{className:"http-csrf",role:"note","data-testid":"op-csrf",children:[k.header!==null&&t("p",{children:["Every mutation must carry the ",e("code",{children:k.header})," header, with any non-empty value."," ",h.csrfHeader===k.header?"The app sends it.":"This UI is not configured to send it."]}),k.requireJson&&t("p",{children:["Send ",e("code",{children:"Content-Type: application/json"}),", even with no body; any other media type is refused with 415."]}),k.header===null&&!k.requireJson&&e("p",{children:"Cross-site requests are refused (Origin / Sec-Fetch-Site)."})]}),s.description&&e("div",{className:"http-description",children:e(ie,{text:s.description})}),e(gr,{operation:s,root:o,onRef:l}),e(yr,{operation:s,root:o,onRef:l}),t("section",{className:"http-section","aria-labelledby":`responses-${s.id}`,children:[e("h3",{id:`responses-${s.id}`,children:"Responses"}),e("ul",{className:"http-responses","data-testid":"op-responses",children:s.responses.map((x)=>e(vr,{response:x,root:o,onRef:l},x.status))})]}),e(jn,{operation:s,root:o,readOnly:f,probe:u,onChanged:y},s.id)]})}function bt(s,o,l){if(o.length===0)return null;let u=l?o.indexOf(l):-1;switch(s){case"ArrowDown":return o[u<0?0:Math.min(u+1,o.length-1)];case"ArrowUp":return o[u<=0?0:u-1];case"Home":return o[0];case"End":return o[o.length-1];default:return null}}var vt={"data-shortcut":"search","aria-keyshortcuts":"/"};function Fn(s){return s?Array.from(s.querySelectorAll("a.http-op-link")):[]}function Un({group:s,headingId:o,level:l,hrefOf:u}){return t("section",{className:"http-tag","aria-labelledby":o,children:[e(l===2?"h2":"h3",{id:o,className:"http-tag-name",title:s.description,children:s.name}),e("ul",{className:"http-tag-ops",children:s.operations.map((y)=>e("li",{children:t(oe,{to:u(y.id),className:"http-op-link",activeMatch:"exact","data-operation":y.id,children:[e(Ft,{method:y.method}),t("span",{className:"http-op-text",children:[e("span",{className:"http-op-path",children:y.path}),y.summary&&e("span",{className:"http-op-summary",children:y.summary})]})]})},y.id))})]})}function Jn({groups:s,sections:o,query:l,onQuery:u,hrefOf:f}){let y=T(null),h=s.reduce((k,x)=>k+x.operations.length,0);function b(k){let x=bt(k.key,Fn(y.current),document.activeElement);if(x)k.preventDefault(),x.focus()}return t("nav",{className:"http-sidebar","aria-label":"Operations",children:[e(xe,{type:"search",value:l,"aria-label":"Search operations",placeholder:"Search path, id, summary",...vt,onChange:(k)=>u(k),onKeyDown:(k)=>{if(k.key==="ArrowDown"){let x=Fn(y.current)[0];if(x)k.preventDefault(),x.focus()}}}),e("p",{className:"http-muted http-sidebar-count","aria-live":"polite",children:h===1?"1 operation":`${h} operations`}),t("div",{ref:y,className:"http-sidebar-list",onKeyDown:b,children:[o===void 0?s.map((k)=>e(Un,{group:k,headingId:`tag-${k.name}`,level:2,hrefOf:f},k.name)):ct(o).map(({key:k,index:x,section:w})=>t("section",{className:"http-section","aria-labelledby":`section-${x}`,children:[e("h2",{id:`section-${x}`,className:"http-section-name",children:w.name}),w.tags.map((N)=>e(Un,{group:N,headingId:`tag-${x}-${N.name}`,level:3,hrefOf:f},N.name))]},k)),s.length===0&&e("p",{className:"http-muted",children:"No operation matches."})]})]})}function _n(s,o,l=""){let u=o?`?q=${encodeURIComponent(o)}`:"";return`${l}/http/${encodeURIComponent(s)}${u}`}function kr({info:s,serverBase:o}){let l=Te(),u=typeof window>"u"?"":window.location.origin;return t(z,{className:"http-info",children:[t("div",{className:"http-info-line",children:[e(G,{tone:"accent",children:`OpenAPI ${s.openapi}`}),s.version&&e(G,{tone:"neutral",children:`v${s.version}`})]}),s.description&&e("div",{className:"http-description",children:e(ie,{text:s.description})}),t("dl",{className:"http-servers","data-testid":"http-servers",children:[s.servers.map((f)=>{let y=Ot(f.url,l.documentUrl,u);return t("div",{children:[t("dt",{children:["Server ",e("code",{children:f.url}),f.description?` (${f.description})`:""]}),t("dd",{children:[e("code",{"data-testid":"http-server-url",children:y}),e(ve,{text:y,ariaLabel:"Copy the server URL"})]})]},f.url)}),t("div",{children:[e("dt",{children:"Requests are sent to"}),e("dd",{children:e("code",{"data-testid":"http-request-base",children:o})})]})]}),e("p",{className:"http-muted",children:"Paths below are relative to the server."})]})}function Kn({group:s,query:o,pathBase:l}){return t(n,{children:[s.description&&e("p",{className:"http-muted",children:s.description}),e("ul",{className:"http-overview-ops",children:s.operations.map((u)=>t("li",{children:[t(oe,{to:_n(u.id,o,l),children:[e("code",{children:u.method})," ",u.path]}),u.summary&&e("span",{className:"http-muted",children:` ${u.summary}`})]},u.id))})]})}function wr({doc:s,groups:o,sections:l,query:u,onRef:f,pathBase:y}){let h=cn(s);return t("div",{className:"http-overview",children:[l===void 0?o.map((b)=>e(z,{title:b.name,children:e(Kn,{group:b,query:u,pathBase:y})},b.name)):ct(l).map(({key:b,section:k})=>e(z,{title:k.name,className:"http-overview-section",children:k.tags.map((x)=>t("section",{className:"http-overview-tag","aria-label":x.name,children:[e("h3",{className:"http-overview-tag-name",children:x.name}),e(Kn,{group:x,query:u,pathBase:y})]},x.name))},b)),h.length>0&&e(z,{title:"Schemas",children:e("ul",{className:"http-components","data-testid":"http-components",children:h.map((b)=>e("li",{id:`schema-${b}`,children:e("button",{type:"button",className:"schema-ref schema-ref-link",onClick:()=>f(`#/components/schemas/${b}`,b),children:b})},b))})})]})}function Nr({doc:s,refValue:o,onClose:l,onRef:u}){return e(pt,{open:o!==null,onClose:l,title:o===null?"":$e(o),description:o??void 0,size:"lg",className:"http-schema-panel",children:o!==null&&e(he,{schema:{$ref:o},root:s,depth:2,onRef:u,label:`Schema ${$e(o)}`},o)})}function Ut({doc:s,extensions:o,client:l,probe:u,readOnly:f=!1,onChanged:y,pathBase:h=""}){let b=Te(),k=o??b.extensions,{operationId:x}=de(),[w,N]=nt("q"),[S,C]=r(null),j=g(()=>rn(s),[s]),I=g(()=>sn(s,{extensions:k}),[s,k]),P=g(()=>on(s,I),[s,I]),F=g(()=>an(P,w),[P,w]),V=g(()=>Rt(s,P),[s,P]),M=g(()=>Rt(s,F),[s,F]),U=x===void 0?void 0:I.find((re)=>re.id===x),te=(re)=>C(re),_=typeof window>"u"?"":window.location.origin,Y=Ot(j.servers[0]?.url??"/",b.documentUrl,_),X=An(),pe=g(()=>l??fn({base:Y,csrfHeader:b.csrfHeader,fetch:X}),[l,Y,b.csrfHeader,X]);return t("div",{className:"screen http-docs","data-testid":"http-docs",children:[e("div",{className:"http-docs-title",children:e("h1",{className:"screen-title",children:j.title})}),t("div",{className:"http-docs-layout",children:[e(Jn,{groups:F,sections:M,query:w,onQuery:(re)=>N(re),hrefOf:(re)=>_n(re,w,h)}),e("div",{className:"http-docs-main",children:x===void 0?t(n,{children:[e(kr,{info:j,serverBase:Y}),e(wr,{doc:s,groups:P,sections:V,query:w,onRef:te,pathBase:h})]}):U?e(gt,{value:pe,children:e(Hn,{operation:U,root:s,onRef:te,probe:u,readOnly:f,onChanged:y},U.id)}):e(mt,{title:"No such operation",description:`This document has no operation "${x}".`,action:e(oe,{to:`${h}/http`,children:"All operations"})})})]}),e(Nr,{doc:s,refValue:S,onClose:()=>C(null),onRef:te})]})}function W(s){return typeof s==="object"&&s!==null&&!Array.isArray(s)}function A(s){return typeof s==="string"?s:void 0}function Ce(s){return typeof s==="number"&&Number.isFinite(s)?s:void 0}function Xe(s,o,l){if(s===void 0)return;for(let u of l){let f=`${u}-${o}`;if(Object.hasOwn(s,f))return{key:f,value:s[f]}}return}function xt(s){let o=W(s)?A(s.$ref):void 0;if(o===void 0||!o.startsWith("#/"))return;let l=o.split("/").at(-1);return l===void 0?void 0:l.replaceAll("~1","/").replaceAll("~0","~")}function Be(s,o="",l=""){return`${l}/ws/${encodeURIComponent(s)}${o?`?${new URLSearchParams({q:o}).toString()}`:""}`}function qe(s,o){return o===void 0?s:`${s}-${o}`}function Vn(s){switch(s.subprotocol.source){case"server-extension":return`from servers.${s.server?.key??"api"} (${s.subprotocolKey??"subprotocol extension"})`;case"connection-extension":return`from the connection channel (${s.subprotocolKey??"subprotocol extension"})`;case"connection-prose":return"from the connection channel's description";case"default":return s.subprotocol.value===void 0?"not stated in the document":"not stated; the configured default"}}function Sr(s){return s?.match(/subprotocol `([^`]+)`/)?.[1]}function Cr(s){switch(A(s.type)){case"http":return[A(s.scheme),A(s.bearerFormat)].filter(Boolean).join(", ");case"httpApiKey":return`${A(s.in)??"?"} ${A(s.name)??"?"}`;case"oauth2":{let l=W(s.flows)?Object.values(s.flows).flatMap((u)=>W(u)&&W(u.availableScopes)?Object.keys(u.availableScopes):[]):[];return l.length>0?`scopes: ${[...new Set(l)].join(", ")}`:void 0}case"openIdConnect":return A(s.openIdConnectUrl);default:return}}function Pr(s){if(!W(s))return null;return Object.entries(s).map(([o,l])=>({scheme:o,scopes:Array.isArray(l)?l.filter((u)=>typeof u==="string"):[]}))}function Tr(s,o){let l=xt(s);if(l!==void 0)return[{scheme:l,scopes:[]}];if(!W(s))return null;let{scopes:u,...f}=s;return[{scheme:Object.entries(o).find(([,h])=>W(h)&&Object.entries(f).every(([b,k])=>JSON.stringify(h[b])===JSON.stringify(k)))?.[0]??A(f.type)??"(inline)",scopes:Array.isArray(u)?u.filter((h)=>typeof h==="string"):[]}]}function Jt(s){return(Array.isArray(s)?s:W(s)?Object.values(s):[]).flatMap((l)=>{let u=xt(l);return u===void 0?[]:[u]})}function Rr(s){let o=/^([^.]+)\.(.+)$/.exec(s);return o?{kind:o[1],type:o[2]}:null}function Or(s){if(!W(s))return null;let o=[];for(let[u,f]of Object.entries(s)){let y=Ce(f);if(u!=="replay"&&y!==void 0)o.push([u,y])}let l=s.replay;return{values:o,replay:l===!1?!1:W(l)?{size:Ce(l.size),maxAgeMs:Ce(l.maxAgeMs)}:void 0}}function Gn(s,o={}){let l=o.extensions??ot,u=W(s.info)?s.info:{},f=W(s.components)?s.components:{},y=W(f.securitySchemes)?f.securitySchemes:{},h=W(s.servers)?s.servers:{},b=W(h.api)?"api":Object.keys(h).find((O)=>W(h[O])),k=b===void 0?void 0:h[b],x=null,w=[],N=0,S;if(k){let O=W(k.variables)?k.variables:{},D=W(O.host)?O.host:void 0,Q=A(k.host)??"",ne=/\{[^}]+\}/.test(Q),Ne=A(D?.default),st=A(k.pathname),Ee=A(k.protocol),Fe=ne&&Ne?Q.replace(/\{host\}/,Ne):Q;x={key:b,host:Q,hostIsTemplate:ne,hostDefault:Ne,pathname:st,protocol:Ee,description:A(k.description),url:Fe!==""&&Ee!==void 0?`${Ee}://${Fe}${st??""}`:void 0};let ye=Array.isArray(k.security)?k.security:[];N=ye.length;let Re=Xe(k,"security",l);S=Re?.key,w=(Re!==void 0&&Array.isArray(Re.value)?Re.value.map(Pr):ye.map((Ae)=>Tr(Ae,y))).filter((Ae)=>Ae!==null)}let C=new Set(w.flatMap((O)=>O.map((D)=>D.scheme))),j=Object.entries(y).filter(([O])=>C.has(O)||C.size===0).flatMap(([O,D])=>W(D)?[{name:O,type:A(D.type),detail:Cr(D)||void 0,description:A(D.description),note:A(Xe(D,"note",l)?.value)}]:[]),I=W(s.channels)?s.channels:{},P=Object.entries(I).flatMap(([O,D])=>{if(!W(D))return[];let Q=A(D.address)??O,ne=W(D.parameters)?D.parameters:{},Ne=[...Q.matchAll(/\{([^}]+)\}/g)].map((ye)=>ye[1]),st=[...Ne,...Object.keys(ne).filter((ye)=>!Ne.includes(ye))],Ee=W(D.bindings)?D.bindings:{},Fe=W(Ee.ws)?Ee.ws:{};return[{key:O,slug:qe("channel",O),title:A(D.title)??O,address:Q,description:A(D.description),parameters:st.map((ye)=>{let Re=W(ne[ye])?ne[ye]:void 0,Ae=Xe(Re,"schema",l)?.value;return{name:ye,description:A(Re?.description),schema:W(Ae)?Ae:void 0}}),messages:Jt(D.messages),bindingMethod:A(Fe.method),isConnection:O==="connection"||A(Fe.method)!==void 0}]}).sort((O,D)=>Number(D.isConnection)-Number(O.isConnection)),F=P.find((O)=>O.isConnection),V=F?I[F.key]:{},M=W(s.operations)?s.operations:{},U=Object.entries(M).flatMap(([O,D])=>{if(!W(D))return[];let Q=A(D.action),ne=W(D.reply)?D.reply:null;return[{key:O,slug:qe("operation",O),title:A(D.title)??O,summary:A(D.summary),action:Q==="send"||Q==="receive"?Q:void 0,channel:xt(D.channel),messages:Jt(D.messages),reply:ne?{channel:xt(ne.channel),messages:Jt(ne.messages)}:null,permission:A(Xe(D,"action",l)?.value)}]}),te=W(f.messages)?f.messages:{},_=Object.entries(te).flatMap(([O,D])=>{if(!W(D))return[];let Q=Array.isArray(D.examples)?D.examples:[];return[{key:O,slug:qe("message",O),name:A(D.name)??O,title:A(D.title),summary:A(D.summary),contentType:A(D.contentType)??A(s.defaultContentType),payload:D.payload,examples:Q.filter(W).map((ne)=>({name:A(ne.name),summary:A(ne.summary),payload:ne.payload})),event:Rr(O)}]}).sort((O,D)=>Number(O.event!==null)-Number(D.event!==null)),Y=(O)=>{for(let D of l){let Q=`${D}-${O}`;if(Object.hasOwn(V,Q))return{key:Q,value:V[Q]};let ne=Object.values(I).find((Ne)=>W(Ne)&&Object.hasOwn(Ne,Q));if(W(ne))return{key:Q,value:ne[Q]}}return},X=Y("close-codes"),pe=(Array.isArray(X?.value)?X.value:[]).flatMap((O)=>W(O)&&Ce(O.code)!==void 0?[{code:Ce(O.code),name:A(O.name)??"",description:A(O.description)??""}]:[]),re=Y("upgrade-refusals"),we=(Array.isArray(re?.value)?re.value:[]).flatMap((O)=>W(O)&&Ce(O.status)!==void 0?[{status:Ce(O.status),code:A(O.code)??"",description:A(O.description)??"",contentType:A(O.contentType),headers:W(O.headers)?Object.fromEntries(Object.entries(O.headers).flatMap(([D,Q])=>typeof Q==="string"?[[D,Q]]:[])):{}}]:[]),ae=Y("limits"),Z=(O)=>{let D=Xe(O,"subprotocol",l);return D!==void 0&&A(D.value)!==void 0?D:void 0},ce=Z(k),le=ce===void 0?Z(V):void 0,Ze=ce===void 0&&le===void 0?Sr(F?.description):void 0,tt=A(ce?.value)??A(le?.value)??Ze;return{title:A(u.title)??"WebSocket API",version:A(u.version),description:A(u.description),server:x,subprotocol:{value:tt??o.defaultSubprotocol,fromDocument:tt!==void 0,source:ce!==void 0?"server-extension":le!==void 0?"connection-extension":Ze!==void 0?"connection-prose":"default"},subprotocolKey:ce?.key??le?.key,extensionKeys:{security:S,limits:ae?.key,closeCodes:X?.key,upgradeRefusals:re?.key},securitySchemes:j,requirements:w,conjunctive:w.length>N,channels:P,operations:U,messages:_,limits:Or(ae?.value),closeCodes:pe,refusals:we}}function zn(s){let l=[s.limits&&{slug:qe("limits"),label:"Limits",hint:s.extensionKeys.limits,keywords:s.limits.values.map(([h])=>h).join(" ")},s.closeCodes.length>0&&{slug:qe("close-codes"),label:"Close codes",hint:s.extensionKeys.closeCodes,keywords:s.closeCodes.map((h)=>`${h.code} ${h.name}`).join(" ")},s.refusals.length>0&&{slug:qe("upgrade-refusals"),label:"Upgrade refusals",hint:s.extensionKeys.upgradeRefusals,keywords:s.refusals.map((h)=>`${h.status} ${h.code}`).join(" ")}].filter((h)=>Boolean(h)),u=s.messages.filter((h)=>h.event===null),f=s.messages.filter((h)=>h.event!==null),y=(h)=>({slug:h.slug,label:h.name,hint:h.summary,keywords:`${h.title??""} ${h.summary??""}`});return[{title:"Connection",items:l},{title:"Channels",items:s.channels.map((h)=>({slug:h.slug,label:h.title,hint:h.address,keywords:`${h.key} ${h.address} ${h.parameters.map((b)=>b.name).join(" ")}`}))},{title:"Operations",items:s.operations.map((h)=>({slug:h.slug,label:h.title,hint:[h.action,h.permission].filter(Boolean).join(" · "),keywords:`${h.key} ${h.summary??""} ${h.permission??""}`}))},{title:"Control messages",items:u.map(y)},{title:"Event messages",items:f.map(y)}].filter((h)=>h.items.length>0)}function Qn(s,o){let l=o.toLowerCase().split(/\s+/).filter(Boolean);if(l.length===0)return[...s];return s.map((u)=>({...u,items:u.items.filter((f)=>{let y=`${f.slug} ${f.label} ${f.hint??""} ${f.keywords}`.toLowerCase();return l.every((h)=>y.includes(h))})})).filter((u)=>u.items.length>0)}function Xn(s,o){if(o==="limits"&&s.limits)return{kind:"limits"};if(o==="close-codes"&&s.closeCodes.length>0)return{kind:"close-codes"};if(o==="upgrade-refusals"&&s.refusals.length>0)return{kind:"upgrade-refusals"};let l=s.channels.find((y)=>y.slug===o);if(l)return{kind:"channel",channel:l};let u=s.operations.find((y)=>y.slug===o);if(u)return{kind:"operation",operation:u};let f=s.messages.find((y)=>y.slug===o);return f?{kind:"message",message:f}:null}function Kt(s,o){return s.operations.filter((l)=>l.channel===o)}function Yn(s,o){return s.channels.filter((l)=>l.messages.includes(o))}function Zn(s,o){return s.operations.filter((l)=>l.messages.includes(o)||(l.reply?.messages.includes(o)??!1))}function es(s,o){return[...new Set(Kt(s,o).flatMap((l)=>l.permission===void 0?[]:[l.permission]))]}function ts(s,o){let l=o.messages.flatMap((u)=>{let f=s.messages.find((y)=>y.key===u);return f?.event?[f.event.type]:[]});return[...new Set(l)]}function Dr(s){try{return new RegExp(s,"u")}catch{return}}function Er(s,o,l){let u=[...o].length,f=Ce(s.maxLength);if(f!==void 0&&u>f)return`At most ${f} characters (this is ${u}).`;let y=Ce(s.minLength);if(y!==void 0&&u<y)return`At least ${y} characters.`;let h=A(s.pattern),b=h===void 0?void 0:Dr(h);if(b&&!b.test(o))return(h===void 0?void 0:l?.patternText?.[h])??`Must match ${h}.`;return null}function kt(s,o,l,u){if(o==="")return null;if(l!==void 0)return Er(l,o,u);return u?.nameRule?.(s,o)??null}function ns(s){return Object.fromEntries(s.map((o)=>[o.name,o.schema]))}function ss(s,o,l={},u){let f=!0,y=s.replace(/\{([^}]+)\}/g,(h,b)=>{let k=o[b]??"";if(k===""||kt(b,k,l[b],u)!==null)return f=!1,"";return u?.escapeValue?.(b,k)??k});return f?y:null}function rs(s,o,l){return s.parameters.flatMap((u)=>{let f=o[u.name]??"";if(f==="")return[`${u.name}: fill it in.`];let y=kt(u.name,f,u.schema,l);return y===null?[]:[`${u.name}: ${y}`]})}function os(s){return!s.isConnection&&!s.address.startsWith("/")}function is(s,o){let l=(y)=>{let h=y;for(let b=0;b<16&&W(h)&&A(h.$ref);b++)h=Je(o,A(h.$ref));return h},u=l(s),f=W(u)&&W(u.properties)?l(u.properties.event):void 0;return W(f)&&W(f.properties)?f.properties.payload:void 0}function as(s){let o=W(s)?s.event:void 0;return W(o)?o.payload:void 0}var Ir=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function ue(s){return Ir.format(s)}function $r(s){if(/bytes$/i.test(s))return"bytes";if(/ms$/i.test(s))return"ms";if(/persecond$/i.test(s))return"per-second";return"count"}function Lr(s){let o=["KiB","MiB","GiB"],l=s,u="";for(let f of o){if(l<1024||l%1024!==0)break;l/=1024,u=f}return u===""?`${ue(s)} bytes`:`${ue(s)} bytes (${ue(l)} ${u})`}function wt(s){let o=`${ue(s)} ms`;if(s>=60000&&s%60000===0)return`${o} (${ue(s/60000)} min)`;if(s>=1000&&s%1000===0)return`${o} (${ue(s/1000)} s)`;return o}function cs(s,o,l){switch(l?.unit??$r(s)){case"bytes":return Lr(o);case"ms":return wt(o);case"per-second":return`${ue(o)} / s`;default:return ue(o)}}function ke({text:s}){let o=s.split(/(`[^`]+`)/);return e(n,{children:o.map((l,u)=>l.length>2&&l.startsWith("`")&&l.endsWith("`")?e("code",{children:l.slice(1,-1)},u):l)})}function _t({schema:s,root:o,label:l,depth:u=2}){return e("div",{className:"ws-schema","data-testid":"ws-schema",children:e(he,{schema:s,root:o,depth:u,label:l})})}function je({items:s,layout:o="grid",empty:l="—",className:u}){return e("dl",{className:K("kv",`kv-${o}`,u),children:s.map((f,y)=>{if(!f)return null;let h=f.value===null||f.value===void 0||f.value==="",b=f.key??(typeof f.label==="string"?f.label:`row-${y}`);return t("div",{className:"kv-row",children:[e("dt",{className:"kv-label",children:f.label}),t("dd",{className:K("kv-value",h&&"muted"),children:[h?l:f.value,f.hint&&e("span",{className:"kv-hint",children:f.hint})]})]},b)})})}function De({label:s,className:o,children:l}){return e("div",{className:"table-wrap",role:"region","aria-label":s,tabIndex:0,children:t("table",{className:K("table",o),children:[e("caption",{className:"visually-hidden",children:s}),l]})})}function ls({doc:s}){let{server:o,subprotocol:l}=s;return e(z,{title:"Server",children:o===null?e("p",{className:"muted",children:"The document names no server."}):e(je,{items:[{label:"URL",value:o.url&&e("code",{"data-testid":"ws-server-url",children:o.url})},{label:"Host",value:e("code",{children:o.host}),hint:o.hostIsTemplate?`A template: the document served over HTTP fills in the request's own host${o.hostDefault?` (default ${o.hostDefault})`:""}.`:"Taken from the request that fetched this document: the host you reached the API on."},{label:"Path",value:o.pathname&&e("code",{children:o.pathname})},{label:"Protocol",value:o.protocol&&e("code",{children:o.protocol}),hint:"wss when the API was reached over HTTPS."},{label:"Subprotocol",value:l.value===void 0?e("span",{className:"muted","data-testid":"ws-subprotocol",children:"Not stated"}):e("code",{"data-testid":"ws-subprotocol",children:l.value}),hint:t(n,{children:[e("span",{"data-testid":"ws-subprotocol-source",children:Vn(s)}),l.fromDocument?". Optional: offer it in Sec-WebSocket-Protocol, or offer none. Offering others without it may be refused.":"."]})},o.description!==void 0&&{label:"About",value:o.description}]})})}function ds({doc:s}){let{requirements:o,securitySchemes:l,conjunctive:u}=s;return e(z,{title:"Security",children:e("div",{"data-testid":"ws-security",children:o.length===0?e("p",{className:"muted",children:"No security schemes are declared. The host application decides, on the upgrade and on each subscription; a browser sends its cookies with the upgrade."}):t(n,{children:[e("p",{children:o.length===1?"The connection must satisfy:":"The connection must satisfy any one of:"}),e("ul",{className:"ws-requirements","aria-label":"Security requirements",children:o.map((f)=>{let y=f.map((h)=>`${h.scheme}:${h.scopes.join(",")}`).join("+");return e("li",{children:f.map((h,b)=>t("span",{children:[b>0&&e("strong",{children:" and "}),e("code",{children:h.scheme}),h.scopes.length>0&&t("span",{className:"muted",children:[" ","(scopes: ",h.scopes.join(", "),")"]})]},h.scheme))},y)})}),u&&t("p",{className:"ws-note","data-testid":"ws-security-conjunctive",children:["AsyncAPI 3 can list only one scheme per requirement, so a requirement naming several is only in"," ",e("code",{children:s.extensionKeys.security??"the security extension"}),", which is what this list shows: every scheme within one requirement is needed together."]}),t(De,{label:"Security schemes",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Scheme"}),e("th",{scope:"col",children:"Type"}),e("th",{scope:"col",children:"In a browser"})]})}),e("tbody",{children:l.map((f)=>t("tr",{"data-testid":`ws-scheme-${f.name}`,children:[t("td",{children:[e("code",{children:f.name}),f.description&&e("div",{className:"muted",children:f.description})]}),t("td",{children:[f.type,f.detail&&e("div",{className:"muted",children:f.detail})]}),e("td",{children:f.note?e("span",{className:"ws-note",children:e(ke,{text:f.note})}):e("span",{className:"muted",children:"Can be sent."})})]},f.name))})]})]})})})}function Wr(s){if(s===!1)return"Off: a resume after a reconnect always reports a gap.";if(s===void 0)return"Not stated.";let o=[s.size!==void 0&&`the last ${ue(s.size)} events`,s.maxAgeMs!==void 0&&`at most ${wt(s.maxAgeMs)} old`].filter(Boolean);return o.length>0?`Keeps ${o.join(", ")}.`:"On."}function Nt({limits:s,extensionKey:o,limitsInfo:l}){return t(z,{title:"Limits",children:[t("p",{className:"muted",children:["What one connection is held to",o===void 0?"":t(n,{children:[" ","(",e("code",{children:o}),")"]}),"."]}),t(De,{label:"Limits",className:"ws-table",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Limit"}),e("th",{scope:"col",children:"Value"}),e("th",{scope:"col",children:"Meaning"})]})}),t("tbody",{children:[s.values.map(([u,f])=>t("tr",{"data-testid":`ws-limit-${u}`,children:[t("td",{children:[l?.[u]?.label??u,e("div",{className:"muted",children:e("code",{children:u})})]}),e("td",{className:"ws-value",children:cs(u,f,l?.[u])}),e("td",{children:l?.[u]?.meaning??""})]},u)),t("tr",{"data-testid":"ws-limit-replay",children:[t("td",{children:["Replay",e("div",{className:"muted",children:e("code",{children:"replay"})})]}),e("td",{className:"ws-value",children:s.replay===!1?"off":s.replay===void 0?"—":[s.replay.size!==void 0&&`size ${ue(s.replay.size)}`,s.replay.maxAgeMs!==void 0&&`maxAgeMs ${wt(s.replay.maxAgeMs)}`].filter(Boolean).join(", ")}),t("td",{children:["The events kept for a resume. ",Wr(s.replay)]})]})]})]})]})}function St({doc:s}){return t(z,{title:"Close codes",children:[t("p",{className:"muted",children:["How an open connection is closed",s.extensionKeys.closeCodes===void 0?"":t(n,{children:[" ","(",e("code",{children:s.extensionKeys.closeCodes}),")"]}),"."]}),t(De,{label:"Close codes",className:"ws-table",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Code"}),e("th",{scope:"col",children:"Name"}),e("th",{scope:"col",children:"When"})]})}),e("tbody",{children:s.closeCodes.map((o)=>t("tr",{"data-testid":`ws-close-${o.code}`,children:[e("td",{className:"ws-value",children:o.code}),e("td",{children:e("code",{children:o.name})}),e("td",{children:e(ke,{text:o.description})})]},`${o.code}-${o.name}`))})]})]})}function Pt({doc:s}){return t(z,{title:"Upgrade refusals",children:[t("p",{className:"muted",children:["An upgrade can be refused before any socket exists, with an ordinary HTTP response whose body is a problem carrying ",e("code",{children:"code"}),s.extensionKeys.upgradeRefusals===void 0?"":t(n,{children:[" ","(",e("code",{children:s.extensionKeys.upgradeRefusals}),")"]}),"."]}),t("p",{className:"ws-note","data-testid":"ws-refusal-1006",children:["A browser never sees these: its ",e("code",{children:"WebSocket"})," exposes no status or body for a refused upgrade, only a close with code"," ",e("strong",{children:"1006"})," (abnormal closure). To tell them apart, make the same request over HTTP, or read the server's logs."]}),t(De,{label:"Upgrade refusals",className:"ws-table",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Status"}),e("th",{scope:"col",children:"Code"}),e("th",{scope:"col",children:"When"}),e("th",{scope:"col",children:"Content type"}),e("th",{scope:"col",children:"Headers"})]})}),e("tbody",{children:s.refusals.map((o)=>t("tr",{"data-testid":`ws-refusal-${o.code}`,children:[e("td",{className:"ws-value",children:e(G,{tone:o.status>=500?"danger":"warning",children:o.status})}),e("td",{children:e("code",{children:o.code})}),e("td",{children:e(ke,{text:o.description})}),e("td",{children:o.contentType&&e("code",{children:o.contentType})}),e("td",{children:Object.keys(o.headers).length===0?e("span",{className:"muted",children:"—"}):Object.entries(o.headers).map(([l,u])=>e("div",{children:t("code",{children:[l,": ",u]})},l))})]},`${o.status}-${o.code}`))})]})]})}function us({doc:s}){return t("header",{className:"ws-header",children:[t("h1",{className:"screen-title",children:[s.title," ",s.version&&t(G,{tone:"neutral",title:"info.version",children:["v",s.version]})]}),e("p",{className:"muted ws-kicker",children:"WebSocket API (AsyncAPI 3.0)"}),s.description&&t("details",{className:"ws-description",children:[e("summary",{children:"About this socket"}),e(ie,{text:s.description})]})]})}function ms({action:s,probe:o}){if(o===void 0)return t("span",{className:"ws-permission","data-testid":`ws-permission-${s}`,children:[e("code",{children:s})," ",e(G,{tone:"neutral",children:"permission"})]});let l=o(s);return t("span",{className:"ws-permission","data-testid":`ws-permission-${s}`,"data-has":l===void 0?"unknown":String(l),children:[e("code",{children:s})," ",l===void 0?e(G,{tone:"neutral",children:"Not an action this UI knows"}):e(G,{tone:l?"success":"danger",children:l?"You have this":"You lack this"})]})}function He({items:s,pathBase:o="",empty:l="None."}){if(s.length===0)return e("span",{className:"muted",children:l});return e("ul",{className:"ws-links",children:s.map((u)=>e("li",{children:e(oe,{to:Be(u.slug,"",o),children:e("code",{children:u.label})})},u.slug))})}function fs({console:s}){return e("p",{className:"muted","data-testid":"ws-try-unavailable",children:s.unavailableReason??t(n,{children:["The ",s.label," is not available here."]})})}function qr({doc:s,channel:o,console:l,address:u}){let[f,y]=r({});if(!l.available)return e(z,{title:"Try it",children:e(fs,{console:l})});let h=ss(o.address,f,ns(o.parameters),u),b=ts(s,o),k=h===null?null:l.channelLink(h,b),x=rs(o,f,u);return e(z,{title:"Try it",children:t("div",{className:"ws-try","data-testid":"ws-try-channel",children:[t("p",{className:"muted",children:["Opens the ",l.label," subscribed to this channel",b.length>0?`, showing the ${b.length} event types it carries`:"","."]}),o.parameters.length>0&&e("div",{className:"ws-try-fields",children:o.parameters.map((w)=>{let N=f[w.name]??"",S=kt(w.name,N,w.schema,u);return e(Se,{label:w.name,hint:w.description&&e(ke,{text:w.description}),error:S,children:e(xe,{value:N,onChange:(C)=>y((j)=>({...j,[w.name]:C})),autoComplete:"off",spellCheck:!1})},w.name)})}),t("p",{className:"ws-try-channel",children:["Channel:"," ",h===null?e("span",{className:"muted",children:"fill in every parameter"}):e("code",{"data-testid":"ws-try-address",children:h})]}),k===null?t(n,{children:[t("span",{className:"btn btn-primary ws-disabled","aria-disabled":"true","aria-describedby":`ws-try-reason-${o.key}`,"data-testid":"ws-try-disabled",children:["Open in the ",l.label]}),e("ul",{className:"ws-try-reason muted",id:`ws-try-reason-${o.key}`,"data-testid":"ws-try-reason",children:x.length>0?x.map((w)=>e("li",{children:w},w)):e("li",{children:l.noChannelReason?.(h??o.address)??t(n,{children:["The ",l.label," cannot open"," ",e("code",{children:h??o.address}),"."]})})})]}):t(oe,{to:k,className:"btn btn-primary","data-testid":"ws-try-link",children:["Open in the ",l.label]})]})})}function hs({doc:s,root:o,channel:l,limitsInfo:u,console:f,probe:y,address:h,pathBase:b}){let k=Kt(s,l.key),x=es(s,l.key),w=l.messages.map((N)=>({slug:s.messages.find((C)=>C.key===N)?.slug??`message-${N}`,label:N}));return t("div",{className:"ws-pane","data-testid":`ws-pane-${l.slug}`,children:[t(z,{title:t(n,{children:[l.title," ",e(G,{tone:"info",children:"channel"})]}),children:[e(je,{items:[{label:l.isConnection?"Path":"Address",value:e("code",{"data-testid":"ws-channel-address",children:l.address}),hint:l.isConnection?"The socket itself: control messages travel here.":"A logical channel: subscribe with this name over the connection."},l.bindingMethod!==void 0&&{label:"Upgrade",value:e("code",{children:l.bindingMethod})},x.length>0&&{label:x.length===1?"Permission":"Permissions",value:e("span",{className:"ws-permissions",children:x.map((N)=>e(ms,{action:N,probe:y},N))})}]}),l.description&&e(ie,{text:l.description})]}),l.parameters.length>0&&e(z,{title:"Parameters",children:t(De,{label:"Parameters",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Name"}),e("th",{scope:"col",children:"Description"}),e("th",{scope:"col",children:"Value"})]})}),e("tbody",{children:l.parameters.map((N)=>t("tr",{children:[e("td",{children:e("code",{children:`{${N.name}}`})}),e("td",{children:N.description&&e(ke,{text:N.description})}),e("td",{"data-testid":`ws-parameter-schema-${N.name}`,children:N.schema?e(he,{schema:N.schema,root:o,label:`Schema of {${N.name}}`}):e("span",{className:"muted",children:"Any string"})})]},N.name))})]})}),e(z,{title:"Operations",children:e(He,{items:k.map((N)=>({slug:N.slug,label:`${N.action??"?"} ${N.key}`})),pathBase:b})}),e(z,{title:`Messages (${w.length})`,children:e(He,{items:w,pathBase:b})}),f!==void 0&&os(l)&&e(qr,{doc:s,channel:l,console:f,address:h},l.key),l.isConnection&&s.limits&&e(Nt,{limits:s.limits,extensionKey:s.extensionKeys.limits,limitsInfo:u}),l.isConnection&&s.closeCodes.length>0&&e(St,{doc:s}),l.isConnection&&s.refusals.length>0&&e(Pt,{doc:s})]})}function ps(s,o){return o.map((l)=>({slug:s.messages.find((u)=>u.key===l)?.slug??`message-${l}`,label:l}))}function gs({doc:s,operation:o,probe:l,pathBase:u}){let f=s.channels.find((h)=>h.key===o.channel),y=s.channels.find((h)=>h.key===o.reply?.channel);return t("div",{className:"ws-pane","data-testid":`ws-pane-${o.slug}`,children:[e(z,{title:t(n,{children:[o.title," ",e(G,{tone:"accent",children:"operation"})]}),children:e(je,{items:[{label:"Direction",value:o.action&&t("span",{"data-testid":"ws-operation-action",children:[e(G,{tone:o.action==="send"?"info":"success",children:o.action})," ",o.action==="send"?"client → server":"server → client"]})},{label:"Channel",value:f&&e(oe,{to:Be(f.slug,"",u),children:e("code",{children:f.address})})},o.permission!==void 0&&{label:"Permission",value:e(ms,{action:o.permission,probe:l})},o.summary!==void 0&&{label:"Summary",value:e(ke,{text:o.summary})}]})}),e(z,{title:o.action==="send"?"Sends":"Receives",children:e(He,{items:ps(s,o.messages),pathBase:u})}),o.reply&&e(z,{title:"Reply",children:t("div",{"data-testid":"ws-operation-reply",children:[t("p",{className:"muted",children:["The server answers on"," ",y?e(oe,{to:Be(y.slug,"",u),children:e("code",{children:y.address})}):e("code",{children:o.reply.channel??"?"})," ","with one of:"]}),e(He,{items:ps(s,o.reply.messages),pathBase:u})]})})]})}function ys({doc:s,root:o,message:l,console:u,pathBase:f}){let y=Yn(s,l.key),h=Zn(s,l.key),b=l.event?is(l.payload,o):void 0,k=u!==void 0&&l.event!==null?u.messageLink(l,s):null;return t("div",{className:"ws-pane","data-testid":`ws-pane-${l.slug}`,children:[e(z,{title:t(n,{children:[l.title??l.name," ",e(G,{tone:l.event?"success":"neutral",children:l.event?`${l.event.kind} event`:"control message"})]}),children:e(je,{items:[{label:"Name",value:e("code",{"data-testid":"ws-message-name",children:l.name})},l.summary!==void 0&&{label:"Summary",value:e(ke,{text:l.summary})},l.contentType!==void 0&&{label:"Content type",value:e("code",{children:l.contentType})},{label:"Channels",value:e(He,{items:y.map((x)=>({slug:x.slug,label:x.address})),pathBase:f})},{label:"Operations",value:e(He,{items:h.map((x)=>({slug:x.slug,label:x.key})),pathBase:f})}]})}),l.event&&b!==void 0&&t(z,{title:"Event payload",className:"ws-highlight",children:[t("p",{className:"muted",children:[e("code",{children:"event.payload"}),": what this ",l.event.kind," event says. It arrives inside the envelope below."]}),e("div",{"data-testid":"ws-event-payload",children:e(_t,{schema:b,root:o,label:`Payload of ${l.name}`})})]}),e(z,{title:l.event?"Full envelope":"Payload",children:e("div",{"data-testid":"ws-message-payload",children:e(_t,{schema:l.payload,root:o,label:`Schema of ${l.name}`,depth:l.event?1:2})})}),l.examples.length>0&&e(z,{title:l.examples.length===1?"Example":"Examples",children:l.examples.map((x,w)=>e(Br,{example:x,index:w,isEvent:l.event!==null},w))}),l.event&&u!==void 0&&e(z,{title:"Try it",children:!u.available?e(fs,{console:u}):k===null?e("p",{className:"muted",children:"No channel in this document carries it."}):t("div",{className:"ws-try",children:[t("p",{className:"muted",children:["Opens the ",u.label," on every ",l.event.kind,", showing only ",e("code",{children:l.event.type})," events."]}),t(oe,{to:k,className:"btn btn-primary","data-testid":"ws-try-link",children:["Watch ",l.event.type," events"]})]})})]})}function Br({example:s,index:o,isEvent:l}){let u=s.name??`Example ${o+1}`,f=l?as(s.payload):void 0;return t("div",{className:"ws-example","data-testid":"ws-example",children:[t("div",{className:"ws-example-head",children:[e("strong",{"data-testid":"ws-example-name",children:u}),e(ve,{text:()=>JSON.stringify(s.payload,null,2),label:"Copy JSON",ariaLabel:`Copy example ${u} as JSON`})]}),s.summary&&e("p",{className:"muted","data-testid":"ws-example-summary",children:e(ke,{text:s.summary})}),f!==void 0&&t("div",{className:"ws-example-event ws-highlight","data-testid":"ws-example-event-payload",children:[e("p",{className:"muted",children:e("code",{children:"event.payload"})}),e(Qe,{value:f,label:`event.payload of ${u}`,expandDepth:4})]}),t("div",{"data-testid":"ws-example-frame",children:[f!==void 0&&e("p",{className:"muted",children:"The whole frame"}),e(Qe,{value:s.payload,label:`Example ${u}`,expandDepth:f!==void 0?1:2})]})]})}function jr({groups:s,selected:o,query:l,onQuery:u,pathBase:f}){let y=Qn(s,l),h=T(null),b=()=>Array.from(h.current?.querySelectorAll("a.ws-nav-link")??[]),k=(x)=>{let w=bt(x.key,b(),document.activeElement);if(w)x.preventDefault(),w.focus()};return t("nav",{ref:h,className:"ws-sidebar","aria-label":"WebSocket reference",children:[e(Se,{label:"Search",children:e(xe,{type:"search",value:l,onChange:u,onKeyDown:(x)=>{let w=b()[0];if(x.key==="ArrowDown"&&w)x.preventDefault(),w.focus()},placeholder:"Channel, message, code…",...vt,autoComplete:"off",spellCheck:!1})}),y.length===0&&t("p",{className:"muted","data-testid":"ws-search-empty",children:["Nothing matches “",l,"”."]}),e("div",{className:"ws-sidebar-list",onKeyDown:k,children:y.map((x)=>t("section",{className:"ws-group","data-testid":`ws-group-${x.title}`,children:[e("h2",{className:"ws-group-title",children:x.title}),e("ul",{children:x.items.map((w)=>e("li",{children:t(oe,{to:Be(w.slug,l,f),className:"ws-nav-link",activeMatch:"exact","data-selected":w.slug===o?"true":void 0,"data-testid":`ws-nav-${w.slug}`,children:[e("span",{className:"ws-nav-label",children:w.label}),w.hint&&e("span",{className:"ws-nav-hint",children:w.hint})]})},w.slug))})]},x.title))})]})}function Gt({document:s,extensions:o,defaultSubprotocol:l,limitsInfo:u,console:f,probe:y,address:h,pathBase:b=""}){let k={console:f,probe:y,address:h,pathBase:b},x=g(()=>Gn(s,{extensions:o,defaultSubprotocol:l}),[s,o,l]),w=g(()=>zn(x),[x]),{item:N}=de(),[S,C]=nt("q"),j=x.channels.find((V)=>V.isConnection),I=N??j?.slug??x.channels[0]?.slug??"",P=Xn(x,I),F;if(P===null)F=e(mt,{title:"No such item",description:t(n,{children:["This document has nothing called ",e("code",{children:I}),"."," ",e(oe,{to:`${b}/ws`,children:"Back to the connection"}),"."]})});else switch(P.kind){case"channel":F=e(hs,{doc:x,root:s,channel:P.channel,limitsInfo:u,...k});break;case"operation":F=e(gs,{doc:x,operation:P.operation,...k});break;case"message":F=e(ys,{doc:x,root:s,message:P.message,...k});break;case"limits":F=x.limits&&e(Nt,{limits:x.limits,extensionKey:x.extensionKeys.limits,limitsInfo:u});break;case"close-codes":F=e(St,{doc:x});break;case"upgrade-refusals":F=e(Pt,{doc:x});break}return t("div",{className:"screen ws-docs","data-testid":"ws-docs",children:[e(us,{doc:x}),t("div",{className:"ws-overview",children:[e(ls,{doc:x}),e(ds,{doc:x})]}),t("div",{className:"ws-layout",children:[e(jr,{groups:w,selected:P?I:"",query:S,onQuery:C,pathBase:b}),e("section",{className:"ws-main","aria-label":"Selected item","data-testid":"ws-main","data-selected":P?I:"",children:F})]})]})}function bs(s,o){let u=(/^https?:\/\//.test(s)?new URL(s).pathname:s).replace(/\/+$/,"");return u!==""&&o.startsWith(`${u}/`)?o.slice(u.length):o}var Ye={all:["docs"],openapi:(s)=>["docs","openapi",s],asyncapi:(s)=>["docs","asyncapi",s]};function vs(s,o,l){return s.request("GET",bs(s.base,o),{signal:l})}function xs(s,o,l){return s.request("GET",bs(s.base,o),{signal:l})}function Hr(s){return s===void 0?void 0:new ge({kind:s.kind,status:s.status,code:s.code,title:s.title,detail:s.detail,type:s.type,issues:s.issues,context:s.context,instance:s.instance})}function Fr(){let s=i(),o=fe(),l=m(),u=et(),f=J(),{docs:y}=l,h=y?.openapi,b=a({queryKey:Ye.openapi(h??""),queryFn:({signal:w})=>vs(s,h,w),enabled:h!==void 0,staleTime:1/0}),k=g(()=>({base:s.base,request:(w,N,S)=>s.request(w,N,S),requestRaw:async(w,N,S)=>{let C=await s.requestRaw(w,N,S);return{...C,error:Hr(C.error)}}}),[s]),x=g(()=>({version:1,title:o.title,basePath:o.basePath,assetsPath:o.assetsPath,documentUrl:h??"",csrfHeader:o.csrfHeader,extensions:["x-bun-common","x-bun-jobs"],theme:o.theme,unauthorized:null}),[o,h]);if(h===void 0)return e("div",{className:"screen",children:e(d,{headingLevel:1,title:"No HTTP documentation",description:"This API does not serve its OpenAPI document."})});if(b.isPending)return e("div",{className:"screen",children:e(p,{label:"Loading the OpenAPI document",showLabel:!0})});if(b.isError)return e("div",{className:"screen",children:e(L,{headingLevel:1,error:b.error,title:"Could not load the OpenAPI document",onRetry:()=>void b.refetch()})});return e(ft,{value:x,children:e(Ut,{doc:b.data,pathBase:"/docs",client:k,probe:(w)=>u(w),readOnly:l.readOnly,onChanged:()=>void f.invalidateQueries({predicate:(w)=>w.queryKey[0]!==Ye.all[0]})})})}var Ur=new RegExp(Ct),Jr=`Letters, digits, "_", "." and "-" only (not "." or ".."), at most ${ht}.`,ks={nameRule:(s,o)=>{if(s==="jobId")return null;return o.length<=ht&&Ur.test(o)?null:Jr},patternText:{[Ct]:'Letters, digits, "_", "." and "-" only (not "." or "..").'},escapeValue:(s,o)=>s==="jobId"?er(o):o};function ws(s){return xr.includes(s)}var Ns=Rn;function Ss(s,o,l){let u=At(s,l);if(u===null)return null;let f=Vt(u),y=f.filter((b)=>o.includes(b)),h=new URLSearchParams({channel:s});if(y.length>0&&y.length<f.length)h.set("types",y.join(","));return`/events?${h.toString()}`}function Cs(s,o){return{available:o,label:"Events console",unavailableReason:t(n,{children:["The Events console is not available here: it needs the API's socket, the ",e("code",{children:"events.connect"})," permission and the manage screens."]}),noChannelReason:(l)=>t(n,{children:["The Events console has no channel ",e("code",{children:l})," in mode"," ",e("code",{children:s}),"."]}),channelLink:(l,u)=>Ss(l,u,s),messageLink:(l,u)=>{if(l.event===null)return null;let y=[l.event.kind==="queue"?"queues":l.event.kind==="worker"?"workers":"runners","all"].find((b)=>u.channels.some((k)=>k.key===b));if(y===void 0)return null;let h=new URLSearchParams({channel:y,types:l.event.type});return At(y,s)===null?null:`/events?${h.toString()}`}}}var Ps={maxMessageBytes:{label:"Largest client frame",meaning:"A bigger frame is refused MESSAGE_TOO_LARGE, then the socket closes 1009.",unit:"bytes"},messagesPerSecond:{label:"Client frames per second",meaning:"The sustained rate; over it, a RATE_LIMITED error.",unit:"per-second"},rateLimitBurst:{label:"Rate-limit burst",meaning:"Frames that may be sent at once before the rate applies.",unit:"count"},rateLimitBreachWindowMs:{label:"Breach window",meaning:"A second rate-limit breach within it closes the socket 1008.",unit:"ms"},maxSubscriptions:{label:"Subscriptions per connection",meaning:"Channels one connection may hold; more are refused SUBSCRIPTION_LIMIT.",unit:"count"},maxChannelsPerFrame:{label:"Channels per frame",meaning:"Channels one subscribe or unsubscribe may list: send more in several frames.",unit:"count"},maxConnections:{label:"Connections",meaning:"Open connections the API accepts; the next upgrade is refused 429 CONNECTION_LIMIT.",unit:"count"},heartbeatMs:{label:"Heartbeat",meaning:"How often a heartbeat is sent to an idle connection.",unit:"ms"},maxBufferedBytes:{label:"Send buffer",meaning:"Unsent bytes past which a connection is behind and stops receiving events.",unit:"bytes"},slowConsumerTimeoutMs:{label:"Slow-consumer timeout",meaning:"How long a connection may stay behind before it is closed 4008.",unit:"ms"},coalesceProgressMs:{label:"Progress coalescing",meaning:"A job's progress events are merged to at most one per interval.",unit:"ms"}};function Kr(){let s=i(),o=m(),l=et(),u=cr().some((x)=>x.id==="events"),{docs:f}=o,y=f?.asyncapi,h=a({queryKey:Ye.asyncapi(y??""),queryFn:({signal:x})=>xs(s,y,x),enabled:y!==void 0,staleTime:1/0}),b=g(()=>Cs(o.mode,u),[o.mode,u]),k;if(y===void 0)k=t(n,{children:[e("h1",{className:"screen-title",children:"WebSocket API"}),e(d,{title:"This API has no live-events socket",description:"There is no AsyncAPI document to show: the API was created without its WebSocket, so the screens refresh by polling over HTTP.",action:e(E,{to:"/docs",children:"Back to the API docs"})})]});else if(h.data)k=e(Gt,{document:h.data,defaultSubprotocol:Ns,limitsInfo:Ps,console:b,address:ks,probe:(x)=>ws(x)?l(x):void 0,pathBase:"/docs"});else if(h.error)k=t(n,{children:[e("h1",{className:"screen-title",children:"WebSocket API"}),e(L,{error:h.error,title:"Could not load the AsyncAPI document",onRetry:()=>void h.refetch()})]});else k=t(n,{children:[e("h1",{className:"screen-title",children:"WebSocket API"}),e(R,{children:e(p,{label:"Loading the AsyncAPI document",showLabel:!0})})]});return e("div",{className:"screen ws-docs","data-testid":"ws-docs",children:k})}function Vl(){let{docs:s}=m();return t("div",{className:"screen","data-testid":"docs-home",children:[e("h1",{className:"screen-title",children:"API docs"}),s===null?e(d,{title:"No documentation",description:"This API does not serve its OpenAPI or AsyncAPI documents."}):t("div",{className:"docs-home",children:[t(R,{title:"HTTP API",children:[e("p",{children:"Every route, its parameters, request and response schemas, the permission it needs, and a panel to try it."}),e(E,{to:"/docs/http",children:"Open the HTTP reference"})]}),s.asyncapi!==void 0&&t(R,{title:"WebSocket API",children:[e("p",{children:"The live-events socket: its channels, the messages on each, limits and close codes."}),e(E,{to:"/docs/ws",children:"Open the WebSocket reference"})]})]})]})}export{Vl as DocsHomeScreen,Fr as HttpDocsScreen,Kr as WsDocsScreen};
8
+
9
+ //# debugId=FBF3B6313393107364756E2164756E21
10
+ //# sourceMappingURL=index-hs60b25v.js.map