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

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-cqgyvs86.css +1 -0
  74. package/dist/docs/assets/main-pgxtmtja.js +18 -0
  75. package/dist/docs/assets/main-pgxtmtja.js.map +99 -0
  76. package/dist/docs/manifest.json +26 -0
  77. package/dist/jobs/assets/AddFlowDialog-0ec5ff4r.js +6 -0
  78. package/dist/jobs/assets/AddFlowDialog-0ec5ff4r.js.map +11 -0
  79. package/dist/jobs/assets/AddFlowDialog-n7gtc84v.css +1 -0
  80. package/dist/jobs/assets/added-ma7xb2dx.js +4 -0
  81. package/dist/jobs/assets/added-ma7xb2dx.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-a5chwqet.js +4 -0
  85. package/dist/jobs/assets/channel-a5chwqet.js.map +10 -0
  86. package/dist/jobs/assets/channelChecks-1epbhv9a.js +4 -0
  87. package/dist/jobs/assets/channelChecks-1epbhv9a.js.map +10 -0
  88. package/dist/jobs/assets/index-02427smp.css +1 -0
  89. package/dist/jobs/assets/index-18bn0gvy.css +1 -0
  90. package/dist/jobs/assets/index-5kbyqspm.css +1 -0
  91. package/dist/jobs/assets/index-5ng37hk6.css +1 -0
  92. package/dist/jobs/assets/index-5w8w7fvc.css +1 -0
  93. package/dist/jobs/assets/index-71qs5qyx.css +1 -0
  94. package/dist/jobs/assets/index-7kbae3pm.js +4 -0
  95. package/dist/jobs/assets/index-7kbae3pm.js.map +11 -0
  96. package/dist/jobs/assets/index-btpg4r8b.css +1 -0
  97. package/dist/jobs/assets/index-c7qk888t.js +4 -0
  98. package/dist/jobs/assets/index-c7qk888t.js.map +10 -0
  99. package/dist/jobs/assets/index-de1fgbgf.js +4 -0
  100. package/dist/jobs/assets/index-de1fgbgf.js.map +9 -0
  101. package/dist/jobs/assets/index-e0yy2skq.css +1 -0
  102. package/dist/jobs/assets/index-j3h4v03g.js +4 -0
  103. package/dist/jobs/assets/index-j3h4v03g.js.map +23 -0
  104. package/dist/jobs/assets/index-m7zk18cj.js +4 -0
  105. package/dist/jobs/assets/index-m7zk18cj.js.map +16 -0
  106. package/dist/jobs/assets/index-mykmd5cv.js +4 -0
  107. package/dist/jobs/assets/index-mykmd5cv.js.map +10 -0
  108. package/dist/jobs/assets/index-pjtmzrcd.js +4 -0
  109. package/dist/jobs/assets/index-pjtmzrcd.js.map +32 -0
  110. package/dist/jobs/assets/index-qfb80xen.css +1 -0
  111. package/dist/jobs/assets/index-xfq292gs.js +4 -0
  112. package/dist/jobs/assets/index-xfq292gs.js.map +18 -0
  113. package/dist/jobs/assets/index-y5zw06cs.js +10 -0
  114. package/dist/jobs/assets/index-y5zw06cs.js.map +62 -0
  115. package/dist/jobs/assets/live-erz9pvnm.js +4 -0
  116. package/dist/jobs/assets/live-erz9pvnm.js.map +10 -0
  117. package/dist/jobs/assets/main-2n5wnj51.js +5 -0
  118. package/dist/jobs/assets/main-2n5wnj51.js.map +12 -0
  119. package/dist/jobs/assets/main-3xxhy5jh.js +5 -0
  120. package/dist/jobs/assets/main-3xxhy5jh.js.map +11 -0
  121. package/dist/jobs/assets/main-47391fgm.js +5 -0
  122. package/dist/jobs/assets/main-47391fgm.js.map +23 -0
  123. package/dist/jobs/assets/main-54qwkz28.css +1 -0
  124. package/dist/jobs/assets/main-6xdkyzv1.js +5 -0
  125. package/dist/jobs/assets/main-6xdkyzv1.js.map +10 -0
  126. package/dist/jobs/assets/main-7jzem39c.js +4 -0
  127. package/dist/jobs/assets/main-7jzem39c.js.map +22 -0
  128. package/dist/jobs/assets/main-9qd3nqs5.js +5 -0
  129. package/dist/jobs/assets/main-9qd3nqs5.js.map +12 -0
  130. package/dist/jobs/assets/main-b35rfpdf.js +5 -0
  131. package/dist/jobs/assets/main-b35rfpdf.js.map +11 -0
  132. package/dist/jobs/assets/main-e8zsqez2.js +5 -0
  133. package/dist/jobs/assets/main-e8zsqez2.js.map +10 -0
  134. package/dist/jobs/assets/main-eekxtm5w.js +5 -0
  135. package/dist/jobs/assets/main-eekxtm5w.js.map +25 -0
  136. package/dist/jobs/assets/main-fcq7hfk0.js +5 -0
  137. package/dist/jobs/assets/main-fcq7hfk0.js.map +10 -0
  138. package/dist/jobs/assets/main-fn8r2zyb.js +5 -0
  139. package/dist/jobs/assets/main-fn8r2zyb.js.map +10 -0
  140. package/dist/jobs/assets/main-grcj8v1z.js +5 -0
  141. package/dist/jobs/assets/main-grcj8v1z.js.map +21 -0
  142. package/dist/jobs/assets/main-gzppw8ng.js +5 -0
  143. package/dist/jobs/assets/main-gzppw8ng.js.map +11 -0
  144. package/dist/jobs/assets/main-jex4pqaa.js +7 -0
  145. package/dist/jobs/assets/main-jex4pqaa.js.map +11 -0
  146. package/dist/jobs/assets/main-kjywj2zd.js +5 -0
  147. package/dist/jobs/assets/main-kjywj2zd.js.map +10 -0
  148. package/dist/jobs/assets/main-pqke97qp.js +5 -0
  149. package/dist/jobs/assets/main-pqke97qp.js.map +13 -0
  150. package/dist/jobs/assets/main-qahvywvw.js +5 -0
  151. package/dist/jobs/assets/main-qahvywvw.js.map +10 -0
  152. package/dist/jobs/assets/main-smabxbn4.js +6 -0
  153. package/dist/jobs/assets/main-smabxbn4.js.map +12 -0
  154. package/dist/jobs/assets/main-v2f8a4g3.js +5 -0
  155. package/dist/jobs/assets/main-v2f8a4g3.js.map +10 -0
  156. package/dist/jobs/assets/main-vargz49c.js +5 -0
  157. package/dist/jobs/assets/main-vargz49c.js.map +11 -0
  158. package/dist/jobs/assets/main-xf44bv26.js +17 -0
  159. package/dist/jobs/assets/main-xf44bv26.js.map +115 -0
  160. package/dist/jobs/assets/main-yg6scp84.js +5 -0
  161. package/dist/jobs/assets/main-yg6scp84.js.map +10 -0
  162. package/dist/jobs/assets/main-yjykmsvp.js +5 -0
  163. package/dist/jobs/assets/main-yjykmsvp.js.map +10 -0
  164. package/dist/jobs/assets/main-zk3n47nq.js +5 -0
  165. package/dist/jobs/assets/main-zk3n47nq.js.map +10 -0
  166. package/dist/jobs/assets/main-zx20z2e9.js +5 -0
  167. package/dist/jobs/assets/main-zx20z2e9.js.map +10 -0
  168. package/dist/jobs/assets/sections-0ksdxs8m.css +1 -0
  169. package/dist/jobs/assets/sections-b570mm22.js +4 -0
  170. package/dist/jobs/assets/sections-b570mm22.js.map +10 -0
  171. package/dist/jobs/assets/sse-42e8mhar.js +5 -0
  172. package/dist/jobs/assets/sse-42e8mhar.js.map +11 -0
  173. package/dist/jobs/assets/sseChecks-0jskzcs1.js +4 -0
  174. package/dist/jobs/assets/sseChecks-0jskzcs1.js.map +10 -0
  175. package/dist/jobs/assets/validation-199pberh.js +4 -0
  176. package/dist/jobs/assets/validation-199pberh.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 +194 -4
@@ -0,0 +1,10 @@
1
+ import{B,q,D,c,g,T,r,Ur,Rn,wt,ht,er,n,e,t,pe,s,m,et,J,i,ge,de,nt,b,cr,d,f,R,x}from"./main-xf44bv26.js";import{vt,Vt}from"./main-e8zsqez2.js";function Or(o){return o.split(/(`[^`]+`)/).map((a,l)=>a.length>2&&a.startsWith("`")&&a.endsWith("`")?e("code",{children:a.slice(1,-1)},l):a)}function ie({text:o,className:a}){let l=o.split(/\n\s*\n/).filter((u)=>u.trim()!=="");return e(n,{children:l.map((u,p)=>e("p",{className:a,children:Or(u)},p))})}var Et=24;function H(o){return typeof o==="object"&&o!==null&&!Array.isArray(o)}function Zt(o){let a=o;try{a=decodeURIComponent(o)}catch{}return a.replace(/~1/g,"/").replace(/~0/g,"~")}function qe(o,a){if(a==="#")return o;if(!a.startsWith("#/"))return;let l=o;for(let u of a.slice(2).split("/")){let p=Zt(u);if(Array.isArray(l)){let y=Number(p);l=Number.isInteger(y)?l[y]:void 0}else if(H(l)&&Object.hasOwn(l,p))l=l[p];else return}return l}function Oe(o){let a=o.split("/");return Zt(a[a.length-1]??o)||o}function Ee(o){return H(o)&&typeof o.$ref==="string"?o.$ref:void 0}function ue(o,a){let l=[],u=o;for(;;){let p=Ee(u);if(p===void 0)break;if(l.includes(p))return{schema:void 0,refs:l,cycle:!0};l.push(p),u=qe(a,p)}if(typeof u==="boolean"||H(u))return{schema:u,refs:l,cycle:!1};return{schema:void 0,refs:l,cycle:!1}}function Se(o){let{type:a}=o;if(typeof a==="string")return[a];return Array.isArray(a)?a.filter((l)=>typeof l==="string"):[]}function Me(o){if(o===void 0)return"undefined";let a=JSON.stringify(o);return a.length>80?`${a.slice(0,77)}…`:a}function en(o,a){let l=o[a];return Array.isArray(l)?l:[]}function We(o,a,l=0){if(o===!0)return"any";if(o===!1)return"never";if(!H(o))return"any";let u=Ee(o);if(u!==void 0)return Oe(u);let p=Se(o);if(p.length>0){let y=p.map((h)=>{if(h==="array"&&l<2){let{items:v}=o;return v===void 0?"array":`array<${We(v,a,l+1)}>`}return h});if(o.nullable===!0&&!y.includes("null"))y.push("null");return y.join(" | ")}if(Object.hasOwn(o,"const"))return Me(o.const);if(Array.isArray(o.enum)){let y=o.enum.slice(0,6).map(Me);return o.enum.length>6?`${y.join(" | ")} | …`:y.join(" | ")}for(let y of["oneOf","anyOf","allOf"]){let h=en(o,y);if(h.length>0){if(y!=="allOf"&&h.length<=3&&l<2)return h.map((v)=>We(v,a,l+1)).join(" | ");return`${y}(${h.length})`}}if(H(o.properties)||o.additionalProperties!==void 0)return"object";if(o.items!==void 0)return"array";if(o.not!==void 0)return"not";return"any"}var Er=[["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 _e(o){if(!H(o))return[];let a=[],l=Se(o).length>0;for(let[u,p]of Er){if(!Object.hasOwn(o,u))continue;if((u==="enum"||u==="const")&&!l)continue;let y=o[u];if(u==="uniqueItems"&&y!==!0)continue;if(u==="enum"&&Array.isArray(y)){a.push({key:u,label:p,value:y.map(Me).join(", ")});continue}a.push({key:u,label:p,value:typeof y==="string"&&u!=="default"&&u!=="const"?y:Me(y)})}if(Array.isArray(o.examples)&&o.examples.length>0)a.push({key:"examples",label:"examples",value:o.examples.map(Me).join(", ")});else if(Object.hasOwn(o,"example"))a.push({key:"example",label:"example",value:Me(o.example)});if(o.nullable===!0)a.push({key:"nullable",label:"nullable",value:"yes"});if(o.deprecated===!0)a.push({key:"deprecated",label:"deprecated",value:"yes"});if(o.readOnly===!0)a.push({key:"readOnly",label:"read only",value:"yes"});if(o.writeOnly===!0)a.push({key:"writeOnly",label:"write only",value:"yes"});return a}function ot(o){if(!H(o)||!Object.hasOwn(o,"additionalProperties"))return null;let a=o.additionalProperties;if(a===!1)return"closed";if(a===!0||H(a)&&Object.keys(a).length===0)return"any";return"typed"}function Dt(o){if(!H(o))return[];let a=[],l=new Set(Array.isArray(o.required)?o.required.filter((u)=>typeof u==="string"):[]);if(H(o.properties))for(let[u,p]of Object.entries(o.properties))a.push({key:`p:${u}`,kind:"property",label:u,schema:p,required:l.has(u)});if(H(o.patternProperties))for(let[u,p]of Object.entries(o.patternProperties))a.push({key:`pp:${u}`,kind:"patternProperty",label:`/${u}/`,schema:p,required:!1});if(ot(o)==="typed")a.push({key:"additional",kind:"additional",label:"any other field",schema:o.additionalProperties,required:!1});if(Array.isArray(o.prefixItems))o.prefixItems.forEach((u,p)=>{a.push({key:`pi:${p}`,kind:"prefixItems",label:`[${p}]`,schema:u,required:!1})});if(o.items!==void 0&&typeof o.items!=="boolean")a.push({key:"items",kind:"items",label:"[]",schema:o.items,required:!1});for(let u of["oneOf","anyOf","allOf"])en(o,u).forEach((p,y)=>{a.push({key:`${u}:${y}`,kind:u,label:u==="allOf"?`Part ${y+1}`:`Option ${y+1}`,schema:p,required:!1})});if(o.not!==void 0)a.push({key:"not",kind:"not",label:"not",schema:o.not,required:!1});return a}var tn={oneOf:"Exactly one of",anyOf:"Any of",allOf:"All of"};function U(...o){return o.filter(Boolean).join(" ")}function he({schema:o,root:a,depth:l=1,onRef:u,label:p="Schema",className:y}){return e("div",{className:U("schema-tree",y),role:"group","aria-label":p,children:e("ul",{className:"schema-list",children:e(nn,{child:null,schema:o,root:a,level:0,depth:l,refChain:[],onRef:u})})})}function Dr({refValue:o,onRef:a}){let l=Oe(o);if(!a)return e("code",{className:"schema-ref",title:o,children:l});return e("button",{type:"button",className:"schema-ref schema-ref-link",title:`Open ${o}`,onClick:()=>a(o,l),children:l})}function Ar(o,a){let l=_e({...o,$ref:void 0}),u=new Set(l.map((p)=>p.key));return[..._e(a).filter((p)=>!u.has(p.key)),...l]}function nn({child:o,schema:a,root:l,level:u,depth:p,refChain:y,onRef:h}){let v=Ee(a),k=ue(a,l),w=k.schema,N=k.cycle||k.refs.some((_)=>y.includes(_)),S=v!==void 0&&w===void 0&&!N,C=N||u>=Et?[]:Dt(w),[P,j]=r(u<p),L=H(a)?a:{},O=typeof L.description==="string"?L.description:H(w)&&typeof w.description==="string"?w.description:void 0,F=v===void 0?_e(a):Ar(L,w),V=v===void 0?We(a,l):N||S?null:We(w,l),M=ot(w),K=o?.label??null,te=[...y,...k.refs];return t("li",{className:"schema-node","data-kind":o?.kind??"root",children:[t("div",{className:"schema-row",children:[C.length>0?e("button",{type:"button",className:"schema-toggle","aria-expanded":P,"aria-label":`${P?"Collapse":"Expand"} ${K??"schema"}`,onClick:()=>j((_)=>!_),children:e("span",{"aria-hidden":"true",children:P?"▾":"▸"})}):e("span",{className:"schema-toggle-spacer","aria-hidden":"true"}),K!==null&&e("span",{className:"schema-name",children:K}),o?.required&&e("span",{className:"schema-required",title:"Required",children:"required"}),V!==null&&e("span",{className:"schema-type",children:V}),v!==void 0&&e(Dr,{refValue:v,onRef:h}),N&&e("span",{className:"schema-note-inline",title:"This schema contains itself; it is expanded above.",children:"recursive"}),S&&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))]}),O!==void 0&&e("div",{className:"schema-description",children:e(ie,{text:O})}),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."}),P&&C.length>0&&e("ul",{className:"schema-list",children:C.map((_,Y)=>{let X=C[Y-1],fe=(_.kind==="oneOf"||_.kind==="anyOf"||_.kind==="allOf")&&X?.kind!==_.kind;return e(Ir,{item:_,heading:fe?tn[_.kind]:void 0,root:l,level:u+1,depth:p,refChain:te,onRef:h},_.key)})})]})}function Ir({item:o,heading:a,...l}){return t(n,{children:[a!==void 0&&e("li",{className:"schema-composition",children:a}),e(nn,{...l,child:o,schema:o.schema})]})}function De(o,a,l=[]){let{schema:u,refs:p,cycle:y}=ue(o,a);if(y||p.some((w)=>l.includes(w)))return null;if(!H(u))return null;let h=[...l,...p];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((w)=>w!==null)??null);if(Array.isArray(u.allOf)&&u.allOf.length>0){let w={};for(let N of u.allOf){let S=De(N,a,h);if(H(S))Object.assign(w,S)}return w}for(let w of["oneOf","anyOf"]){let N=u[w];if(Array.isArray(N)&&N.length>0){let S=N.find((C)=>{let P=ue(C,a).schema;return!(H(P)&&Se(P).length===1&&Se(P)[0]==="null")})??N[0];return De(S,a,h)}}switch(Se(u).filter((w)=>w!=="null")[0]??(H(u.properties)?"object":u.items?"array":void 0)){case"object":{let w={},N=H(u.properties)?u.properties:{},S=Array.isArray(u.required)?u.required:[];for(let C of S)if(typeof C==="string")w[C]=De(N[C],a,h);return w}case"array":return(typeof u.minItems==="number"?u.minItems:0)>0?[De(u.items,a,h)]:[];case"string":return"";case"integer":case"number":return typeof u.minimum==="number"?u.minimum:0;case"boolean":return!1;default:return null}}var it=["x-bun-common","x-bun-jobs"];function Ve(o,a,l){for(let u of l){let p=`${u}-${a}`;if(Object.hasOwn(o,p))return o[p]}return}var $r=["get","put","post","delete","options","head","patch","trace"];function ee(o){return typeof o==="string"?o:void 0}function at(o){return Array.isArray(o)?o.filter((a)=>typeof a==="string"):[]}function ct(o,a){let l=Ee(a);if(l===void 0)return{node:H(a)?a:void 0};let u=ue(a,o).schema;return{node:H(u)?u:void 0,ref:l}}function rn(o){if(!H(o))return[];return Object.entries(o).map(([a,l])=>({contentType:a,schema:H(l)?l.schema:void 0}))}function Lr(o,a){let{node:l}=ct(o,a),u=ee(l?.name),p=ee(l?.in);if(!l||u===void 0||p!=="path"&&p!=="query"&&p!=="header"&&p!=="cookie")return;return{name:u,in:p,required:p==="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 Mr(o){if(!H(o))return;return{header:ee(o.header)??null,requireJson:o.requireJson===!0}}function Wr(o,a,l,u,p,y){let h=new Map;for(let w of[...p,...Array.isArray(u.parameters)?u.parameters:[]]){let N=Lr(o,w);if(N)h.set(`${N.in}:${N.name}`,N)}let v=ct(o,u.requestBody).node,k=[];if(H(u.responses))for(let[w,N]of Object.entries(u.responses)){let{node:S,ref:C}=ct(o,N);k.push({status:w,description:ee(S?.description)??"",content:rn(S?.content),codes:at(S===void 0?void 0:Ve(S,"codes",y)),...C?{ref:C}:{}})}return{id:ee(u.operationId)??`${l.toUpperCase()} ${a}`,method:l.toUpperCase(),path:a,summary:ee(u.summary),description:ee(u.description),tags:at(u.tags),deprecated:u.deprecated===!0,parameters:[...h.values()],requestBody:v?{required:v.required===!0,description:ee(v.description),content:rn(v.content)}:void 0,responses:k,action:ee(Ve(u,"action",y)),mutation:Ve(u,"mutation",y)===!0,requires:at(Ve(u,"requires",y)),csrf:Mr(Ve(u,"csrf",y))}}function on(o,a={}){let l=a.extensions??it,u=[];if(!H(o.paths))return u;for(let[p,y]of Object.entries(o.paths)){let h=ct(o,y).node;if(!h)continue;let v=Array.isArray(h.parameters)?h.parameters:[];for(let k of $r){let w=h[k];if(H(w))u.push(Wr(o,p,k,w,v,l))}}return u}function an(o){let a=H(o.info)?o.info:{},l=Array.isArray(o.servers)?o.servers.flatMap((u)=>{let p=H(u)?ee(u.url):void 0;return p===void 0?[]:[{url:p,description:ee(u.description)}]}):[];return{openapi:ee(o.openapi)??"",title:ee(a.title)??"API",version:ee(a.version)??"",description:ee(a.description),servers:l.length>0?l:[{url:"/"}]}}function cn(o,a){let l=new Map;if(Array.isArray(o.tags))for(let y of o.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 a){if(y.tags.length===0)u.push(y);for(let h of y.tags){let v=l.get(h);if(!v)v={name:h,operations:[]},l.set(h,v);v.operations.push(y)}}let p=[...l.values()].filter((y)=>y.operations.length>0);if(u.length>0)p.push({name:"Other",operations:u});return p}function lt(o){let a=new Map;return o.map((l,u)=>{let p=(a.get(l.name)??0)+1;return a.set(l.name,p),{key:p===1?l.name:`${l.name}#${p}`,index:u,section:l}})}var sn="Other";function At(o,a){let l=o["x-tagGroups"];if(!Array.isArray(l))return;let u=l.flatMap((k)=>{if(!H(k))return[];let w=ee(k.name);return w===void 0||!Array.isArray(k.tags)?[]:[{name:w,tags:at(k.tags)}]});if(u.length===0)return;let p=new Map(a.map((k)=>[k.name,k])),y=new Set,h=[];for(let{name:k,tags:w}of u){let N={name:k,tags:[]};for(let S of w){let C=p.get(S);if(C&&!N.tags.includes(C))N.tags.push(C),y.add(S)}h.push(N)}let v=a.filter((k)=>!y.has(k.name));if(v.length>0){let k=h.find((w)=>w.name===sn);if(k)k.tags.push(...v);else h.push({name:sn,tags:v})}return h.filter((k)=>k.tags.length>0)}function qr(o,a){let l=a.toLowerCase().split(/\s+/).filter(Boolean);if(l.length===0)return!0;let u=[o.method,o.path,o.id,o.summary??"",o.action??""].join(" ").toLowerCase();return l.every((p)=>u.includes(p))}function ln(o,a){return o.map((l)=>({...l,operations:l.operations.filter((u)=>qr(u,a))})).filter((l)=>l.operations.length>0)}function It(o,a,l){let u=/^https?:\/\//.test(a)?new URL(a).origin:l;try{return new URL(o,`${u}/`).href.replace(/\/$/,"")}catch{return o}}function dn(o){let a=qe(o,"#/components/schemas");return H(a)?Object.keys(a):[]}function un(o){switch(o){case"GET":return"info";case"POST":return"success";case"PUT":case"PATCH":return"warning";case"DELETE":return"danger";default:return"neutral"}}function pn(o){return o.responses.map((a)=>a.status).filter((a)=>/^2\d\d$/.test(a))}var dt=new Set(["POST","PUT","PATCH","DELETE"]),ut=new Set(["POST","PUT","PATCH"]);class ye extends Error{kind;status;code;title;detail;type;issues;context;instance;constructor(o){super(o.detail??o.title,{cause:o.cause});this.name="ApiError",this.kind=o.kind,this.status=o.status,this.code=o.code,this.title=o.title,this.detail=o.detail,this.type=o.type,this.issues=o.issues??[],this.context=o.context??{},this.instance=o.instance}static fromProblem(o){return new ye({kind:"problem",status:o.status,code:o.code,title:o.title,detail:o.detail,type:o.type,issues:o.issues,context:o.context,instance:o.instance})}get isAuth(){return this.status===401||this.status===403}}function Be(o){return o instanceof ye}function mn(o){if(typeof o!=="object"||o===null)return!1;let a=o;return typeof a.status==="number"&&typeof a.code==="string"&&typeof a.title==="string"}var Mt="1";function Wt(o){if(!o)return"";let a=new URLSearchParams;for(let[u,p]of Object.entries(o)){if(p===void 0||p===null)continue;if(Array.isArray(p)){let y=p;if(y.length===0)a.append(u,"");for(let h of y)a.append(u,String(h));continue}a.append(u,String(p))}let l=a.toString();return l?`?${l}`:""}function hn(o){return encodeURIComponent(o)}function $t(o){let a=o.split(";")[0]?.trim().toLowerCase()??"";return a==="application/json"||a.endsWith("+json")}function jr(o,a){return a?.aborted===!0||o instanceof Error&&o.name==="AbortError"||typeof DOMException<"u"&&o instanceof DOMException&&o.name==="AbortError"}function Lt(o){try{return{value:JSON.parse(o)}}catch{return}}function fn(o,a,l){let u=$t(o.headers.get("content-type")??"")?Lt(a):void 0;if(u&&mn(u.value))return ye.fromProblem({...u.value,status:o.status});let p=a.trim().slice(0,300);return new ye({kind:"http",status:o.status,code:`HTTP_${o.status}`,title:o.statusText||`Request failed (${o.status})`,detail:p||void 0,instance:l})}function qt(o){let a=o.base.replace(/\/+$/,"");function l(h,v,{query:k,body:w,signal:N}){let C=`${/^https?:\/\//.test(v)?v:`${a}${v}`}${Wt(k)}`,P={Accept:"application/json"};if(ut.has(h))P["Content-Type"]="application/json";if(o.csrfHeader&&dt.has(h))P[o.csrfHeader]=Mt;let j={method:h,headers:P,credentials:"same-origin"};if(w!==void 0)j.body=JSON.stringify(w);if(N)j.signal=N;return{url:C,init:j}}async function u(h,v,k){let w=o.fetch??globalThis.fetch;try{return await w(h,v)}catch(N){if(jr(N,v.signal??void 0))throw N;throw new ye({kind:"network",status:0,code:"NETWORK_ERROR",title:"The server could not be reached",detail:N instanceof Error?N.message:String(N),instance:k,cause:N})}}async function p(h,v,k={}){let{url:w,init:N}=l(h,v,k),S=await u(w,N,v);if(S.status===204||S.status===205)return;let C=await S.text();if(!S.ok)throw fn(S,C,v);if(C==="")return;let P=$t(S.headers.get("content-type")??"")?Lt(C):void 0;if(!P)throw new ye({kind:"parse",status:S.status,code:"INVALID_RESPONSE",title:"The server answered something other than JSON",detail:C.trim().slice(0,300)||void 0,instance:v});return P.value}async function y(h,v,k={}){let{url:w,init:N}=l(h,v,k),S=performance.now(),C=await u(w,N,v),P=C.status===204||C.status===205?"":await C.text(),j=performance.now()-S,L=P!==""&&$t(C.headers.get("content-type")??"")?Lt(P):void 0,O={};for(let[F,V]of[...C.headers.entries()].sort(([M,K])=>M<K?-1:M>K?1:0))O[F.toLowerCase()]=V;return{ok:C.ok,status:C.status,statusText:C.statusText,headers:O,body:L?L.value:P===""?void 0:P,error:C.ok?void 0:fn(C,P,v),durationMs:j}}return{base:a,request:p,requestRaw:y}}var bn=new Set(["GET","POST","PUT","PATCH","DELETE"]),Hr=new Set(["remove","drain","clean","kill","fail"]);function jt(o){return`${o.in}:${o.name}`}function gn(o,a){let l=ue(o,a).schema;if(!H(l))return;return Se(l).find((u)=>u!=="null")}function yn(o,a){let l=ue(o,a).schema;if(!H(l)||!Array.isArray(l.enum))return;return l.enum.filter((u)=>u!==null).map((u)=>String(u))}function Ht(o,a){let l=ue(o.schema,a).schema,u=H(l)?l:{},p=gn(u,a);if(p==="array"){let h=yn(u.items,a);if(h)return{kind:"enum-list",options:h};let v=gn(u.items,a);return{kind:"list",item:v==="integer"||v==="number"?v:"text"}}let y=yn(u,a);if(y)return{kind:"enum",options:y};if(p==="boolean")return{kind:"boolean"};if(p==="integer"||p==="number")return{kind:"number",integer:p==="integer",min:typeof u.minimum==="number"?u.minimum:void 0,max:typeof u.maximum==="number"?u.maximum:void 0};return{kind:"text"}}function Ft(o){return o.parameters.filter((a)=>a.in==="path"||a.in==="query")}function pt(o){let l=o.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 vn(o,a){let l=pt(o);return l===void 0?"":JSON.stringify(De(l,a),null,2)}function Fr(o,a,l){if(a.kind==="enum-list"){let p=Array.isArray(l)?l:[];return{value:p.length>0?[...p]:void 0}}let u=typeof l==="string"?l.trim():"";if(u==="")return o.required?{error:`${o.name} is required`}:{value:void 0};switch(a.kind){case"number":{let p=Number(u);if(!Number.isFinite(p)||a.integer&&!Number.isInteger(p))return{error:`${o.name} must be ${a.integer?"an integer":"a number"}`};return{value:p}}case"boolean":return u==="true"||u==="false"?{value:u==="true"}:{error:`${o.name} must be true or false`};case"list":{let p=u.split(",").map((h)=>h.trim()).filter(Boolean),y=[];for(let h of p){if(a.item==="text"){y.push(h);continue}let v=Number(h);if(!Number.isFinite(v)||a.item==="integer"&&!Number.isInteger(v))return{error:`${o.name}: "${h}" is not ${a.item==="integer"?"an integer":"a number"}`};y.push(v)}return{value:y.length>0?y:void 0}}default:return{value:u}}}function xn(o,a,l,u){let p={};if(!bn.has(o.method))return{ok:!1,errors:{method:`${o.method} cannot be sent from here`}};let y=o.path,h={};for(let v of Ft(o)){let k=jt(v),w=Fr(v,Ht(v,a),l[k]);if("error"in w){p[k]=w.error;continue}if(v.in==="path")y=y.split(`{${v.name}}`).join(hn(String(w.value)));else if(w.value!==void 0)h[v.name]=w.value}if(u===void 0&&o.requestBody?.required&&pt(o)!==void 0)p.body="A body is required";if(Object.keys(p).length>0)return{ok:!1,errors:p};return{ok:!0,request:{method:o.method,path:y,query:h,body:u}}}function wn(o,a){let l={Accept:"application/json"};if(ut.has(o))l["Content-Type"]="application/json";if(a&&dt.has(o))l[a]=Mt;return l}function kn(o,a){return`${a.replace(/\/+$/,"")}${o.path}${Wt(o.query)}`}function Bt(o){return`'${o.replace(/'/g,"'\\''")}'`}function Nn(o,a){let l=kn(o,a.apiBase),u=/^https?:\/\//.test(l)?l:`${a.origin}${l}`,p=[`curl -X ${o.method} ${Bt(u)}`];for(let[y,h]of Object.entries(wn(o.method,a.csrfHeader)))p.push(` -H ${Bt(`${y}: ${h}`)}`);if(o.body!==void 0)p.push(` --data ${Bt(JSON.stringify(o.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'",p.join(" \\\n")].join(`
2
+ `)}function Sn(o,a){let l=wn(o.method,a.csrfHeader),u=Object.entries(l).map(([y,h])=>` ${JSON.stringify(y)}: ${JSON.stringify(h)},`).join(`
3
+ `),p=[`const response = await fetch(${JSON.stringify(kn(o,a.apiBase))}, {`,` method: ${JSON.stringify(o.method)},`," headers: {",u," },",' credentials: "same-origin",'];if(o.body!==void 0)p.push(` body: JSON.stringify(${JSON.stringify(o.body,null,2).replace(/\n/g,`
4
+ `)}),`);return p.push("});","const data = await response.json();"),p.join(`
5
+ `)}function Cn(o){if(o.method==="DELETE")return!0;let a=o.action?.split(".").pop()??"";return Hr.has(a)}function Pn(o,a){if(!bn.has(o.method))return{enabled:!1,reason:`The viewer's client does not send ${o.method}.`};if(o.mutation&&a.readOnly)return{enabled:!1,reason:"This API is read-only: it refuses every change."};if(o.action!==void 0&&!a.permitted)return{enabled:!1,reason:`You do not have the ${o.action} permission.`};return{enabled:!0}}function Tn(o,a){if(o.responses.some((u)=>u.status===String(a)))return;let l=pn(o);return`Not a documented status. Documented success: ${l.length>0?l.join(" / "):"2xx"}.`}function z({tone:o="neutral",title:a,className:l,testId:u,children:p}){return e("span",{className:U("badge",`badge-${o}`,l),title:a,"data-testid":u,children:p})}function G({title:o,actions:a,className:l,children:u}){let p=c();return t("section",{className:U("card",l),"aria-labelledby":o?p:void 0,children:[(o||a)&&t("div",{className:"card-header",children:[o&&e("h2",{id:p,className:"card-title",children:o}),a&&e("div",{className:"card-actions",children:a})]}),e("div",{className:"card-body",children:u})]})}function re({variant:o="secondary",size:a="md",type:l="button",className:u,...p}){return e("button",{...p,type:l,className:U("btn",`btn-${o}`,a==="sm"&&"btn-sm",u)})}var On=1500;async function En(o){try{if(typeof navigator>"u"||!navigator.clipboard)return!1;return await navigator.clipboard.writeText(o),!0}catch{return!1}}var Jr="[Circular]";function _r(o){let a=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(a.has(u))return Jr;let p=u;if(typeof p.toJSON==="function")return l(p.toJSON.call(u));a.add(u);try{if(Array.isArray(u))return u.map((h)=>{let v=l(h);return v===void 0?null:v});let y={};for(let[h,v]of Object.entries(u)){let k=l(v);if(k!==void 0)y[h]=k}return y}finally{a.delete(u)}};return l(o)}function Dn(o,a=2){return JSON.stringify(_r(o),null,a)??"undefined"}function xe({text:o,label:a="Copy",ariaLabel:l,size:u="sm",className:p,onCopied:y}){let[h,v]=r("idle");D(()=>{if(h==="idle")return;let w=setTimeout(v,On,"idle");return()=>clearTimeout(w)},[h]);let k=async()=>{let w=await En(typeof o==="function"?o():o);v(w?"copied":"failed"),y?.(w)};return e(re,{variant:"ghost",size:u,className:U("copy-button",p),"aria-label":l,"data-status":h,onClick:()=>void k(),children:e("span",{"aria-live":"polite",children:h==="copied"?"Copied":h==="failed"?"Copy failed":a})})}var Vr=["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 Kt(o){return Array.from(o.querySelectorAll(Vr)).filter((a)=>!a.hasAttribute("inert")&&!a.closest("[inert]"))}function mt(o){return o.open?e(zr,{...o}):null}function zr({onClose:o,title:a,description:l,children:u,footer:p,closeOnEscape:y=!0,closeOnBackdrop:h=!0,showCloseButton:v=!0,size:k="md",initialFocusRef:w,role:N="dialog",className:S}){let C=T(null),P=T(null),j=c(),L=c();D(()=>{let M=C.current;if(!M)return;let K=document.activeElement instanceof HTMLElement?document.activeElement:null;if(!M.open)if(typeof M.showModal==="function")M.showModal();else M.setAttribute("open","");return(w?.current??(P.current&&Kt(P.current)[0])??Kt(M).find((_)=>!_.dataset.dialogClose)??M).focus(),()=>{if(M.open&&typeof M.close==="function")M.close();if(K?.isConnected)K.focus()}},[w]);let O=(M)=>{if(M.key==="Escape"){if(M.preventDefault(),M.stopPropagation(),y)o();return}if(M.key!=="Tab"||!C.current)return;let K=Kt(C.current);if(K.length===0){M.preventDefault(),C.current.focus();return}let te=K[0],_=K[K.length-1],Y=document.activeElement,X=Y instanceof Node&&C.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)o()},V=(M)=>{if(h&&M.target===M.currentTarget)o()};return e("dialog",{ref:C,role:N==="alertdialog"?"alertdialog":void 0,"aria-modal":"true","aria-labelledby":j,"aria-describedby":l?L:void 0,className:U("dialog",`dialog-${k}`,S),tabIndex:-1,onKeyDown:O,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:a}),v&&e(re,{variant:"ghost",size:"sm",className:"dialog-close","aria-label":"Close","data-dialog-close":"true",onClick:o,children:e("span",{"aria-hidden":"true",children:"×"})})]}),l&&e("p",{id:L,className:"dialog-description",children:l}),u!==void 0&&e("div",{ref:P,className:"dialog-body",children:u}),p&&e("div",{className:"dialog-footer",children:p})]})})}function ft({title:o,description:a,action:l,headingLevel:u}){let p=u?`h${u}`:"p";return t("div",{className:"empty-state",children:[e(p,{className:"empty-state-title",children:o}),a&&e("p",{className:"empty-state-description",children:a}),l&&e("div",{className:"empty-state-action",children:l})]})}var gt=B(null),yt=B(null),An=B(null);function Te(){let o=q(gt);if(!o)throw Error("useDocsUiConfig must be used inside <DocsUiProviders>");return o}function Ut(){let o=q(yt);if(!o)throw Error("useDocsClient must be used inside <DocsClientContext>");return o}function In(){return q(An)??void 0}function Qr(o){return o.button!==0||o.metaKey||o.altKey||o.ctrlKey||o.shiftKey||o.defaultPrevented}function oe({to:o,activeMatch:a,onClick:l,target:u,...p}){let{navigate:y,href:h,location:v}=ge(),k=o.split("?")[0]||"/",w=v.path!==null&&(a==="exact"?v.path===k:a==="prefix"?k==="/"?v.path==="/":v.path===k||v.path.startsWith(`${k}/`):!1);return e("a",{...p,target:u,href:h(o),"aria-current":w?"page":void 0,onClick:(N)=>{if(l?.(N),Qr(N)||u&&u!=="_self")return;N.preventDefault(),y(o)}})}var Jt=B(null);function bt(){return q(Jt)}function je(...o){let a=o.filter(Boolean).join(" ");return a===""?void 0:a}function Ce({label:o,hint:a,error:l,required:u=!1,id:p,className:y,children:h}){let v=c(),k=p??v,w=`${k}-hint`,N=`${k}-error`,S=Boolean(l),C=g(()=>({id:k,"aria-describedby":je(a?w:null,S&&N),"aria-invalid":S||void 0,required:u||void 0}),[k,a,w,S,N,u]);return t("div",{className:U("field",S&&"field-invalid",y),children:[t("label",{className:"field-label",htmlFor:k,children:[o,u&&t("span",{className:"field-required","aria-hidden":"true",children:[" ","*"]})]}),e(Jt,{value:C,children:typeof h==="function"?h(C):h}),a&&e("p",{id:w,className:"field-hint",children:a}),S&&e("p",{id:N,className:"field-error",children:l})]})}function $n(o){let a=bt();return{id:o.id??a?.id,"aria-describedby":je(a?.["aria-describedby"],o["aria-describedby"]),"aria-invalid":o["aria-invalid"]??a?.["aria-invalid"],required:o.required??a?.required}}function we({value:o,onChange:a,type:l="text",className:u,...p}){let y=$n(p);return e("input",{...p,...y,type:l,className:U("input",u),value:o,onChange:(h)=>a(h.target.value,h)})}function Ln({options:o,value:a,onChange:l,className:u,...p}){let y=$n(p);return e("select",{...p,...y,className:U("input","select",u),value:a,onChange:(h)=>{let v=o.find((k)=>k.value===h.target.value);if(v)l(v.value,h)},children:o.map((h)=>e("option",{value:h.value,disabled:h.disabled,children:h.label??h.value},h.value))})}function Mn({checked:o,onChange:a,label:l,hint:u,id:p,className:y,...h}){let v=c(),k=p??v,w=`${k}-hint`;return t("div",{className:U("checkbox",y),children:[e("input",{...h,id:k,type:"checkbox",checked:o,"aria-describedby":u?w:void 0,onChange:(N)=>a(N.target.checked,N)}),e("label",{htmlFor:k,children:l}),u&&e("p",{id:w,className:"field-hint checkbox-hint",children:u})]})}function Xr(o){if(typeof o==="string")return o;try{return JSON.stringify(o)??String(o)}catch{return String(o)}}function ze({error:o,title:a,onRetry:l,onDismiss:u,className:p}){let y=Be(o)?o:null,h=a??y?.title??"Something went wrong",v=y?.detail??(o instanceof Error?o.message:String(o)),k=y?Object.entries(y.context):[];return t("div",{className:U("problem-banner",p),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}`:""]})]}),v&&v!==h&&e("p",{className:"problem-banner-detail",children:v}),k.length>0&&e("ul",{className:"problem-banner-context","aria-label":"Context",children:k.map(([w,N])=>t("li",{children:[e("span",{className:"problem-banner-key",children:w}),"=",e("code",{children:Xr(N)})]},w))}),y&&y.issues.length>0&&e("ul",{className:"problem-banner-issues",children:y.issues.map((w)=>t("li",{children:[t("code",{children:[w.target,w.path?`.${w.path}`:""]})," ",w.message]},`${w.target}:${w.path}:${w.message}`))})]}),(l||u)&&t("div",{className:"problem-banner-actions",children:[l&&e(re,{size:"sm",onClick:l,children:"Retry"}),u&&e(re,{size:"sm",variant:"ghost",onClick:u,children:"Dismiss"})]})]})}function Wn(o){return o.open?e(Yr,{...o}):null}function Yr({onClose:o,title:a,description:l,children:u,onConfirm:p,confirmLabel:y="Confirm",pendingLabel:h,cancelLabel:v="Cancel",variant:k="default",confirmText:w,confirmTextLabel:N,closeOnSuccess:S=!0,confirmDisabled:C=!1}){let[P,j]=r(""),[L,O]=r(!1),[F,V]=r(null),M=T(null),K=T(null),te=T(null),Y=(w===void 0||P===w)&&!L&&!C,X=k==="danger",fe=async()=>{if(!Y)return;O(!0),V(null);try{if(await p(),O(!1),S)o()}catch(ae){O(!1),V(ae)}},se=(ae)=>{ae.preventDefault(),fe()},ke=()=>{if(!L)o()};return e(mt,{open:!0,onClose:ke,title:a,description:l,role:X?"alertdialog":"dialog",size:"sm",closeOnEscape:!L,closeOnBackdrop:!L,initialFocusRef:w!==void 0?te:X?M:K,footer:t(n,{children:[e(re,{ref:M,onClick:ke,disabled:L,children:v}),e(re,{ref:K,variant:X?"danger":"primary",disabled:!Y,"aria-busy":L||void 0,onClick:()=>void fe(),children:L?h??`${y}…`:y})]}),children:t("form",{className:"confirm-dialog-body",onSubmit:se,children:[u,w!==void 0&&e(Ce,{label:N??t(n,{children:["Type ",e("code",{children:w})," to confirm"]}),children:e(we,{ref:te,value:P,onChange:j,autoComplete:"off",spellCheck:!1,disabled:L})}),F!==null&&e(ze,{error:F})]})})}class Ge extends Error{offset;constructor(o,a){super(o);this.offset=a}}function Zr(o,a){return a>=o.length?"end of input":`'${o[a]===`
6
+ `?"\\n":o[a]}'`}function es(o){let a=0,l=()=>{while(a<o.length&&(o[a]===" "||o[a]==="\t"||o[a]===`
7
+ `||o[a]==="\r"))a++},u=(k)=>{throw new Ge(`Expected ${k} but found ${Zr(o,a)}`,a)},p=(k)=>{for(let w=0;w<k.length;w++){if(o[a]!==k[w])u(`'${k}'`);a++}},y=()=>{a++;while(a<o.length){let k=o[a];if(k==='"'){a++;return}if(k==="\\"){let w=o[a+1];if(w==="u"){if(!/^[0-9a-f]{4}$/i.test(o.slice(a+2,a+6)))a+=2,u("four hex digits after \\u");a+=6;continue}if(w===void 0||!'"\\/bfnrt'.includes(w))a++,u("a valid escape");a+=2;continue}if(k<" ")throw new Ge("Control characters must be escaped in strings",a);a++}throw new Ge("Unterminated string",a)},h=()=>{let k=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:e[+-]?\d+)?/i.exec(o.slice(a,a+400));if(!k)u("a number");a+=k[0].length},v=()=>{l();let k=o[a];if(k==="{"){if(a++,l(),o[a]==="}"){a++;return}for(;;){if(l(),o[a]!=='"')u("a property name in double quotes");if(y(),l(),o[a]!==":")u("':'");if(a++,v(),l(),o[a]===","){a++;continue}if(o[a]==="}"){a++;return}u("',' or '}'")}}if(k==="["){if(a++,l(),o[a]==="]"){a++;return}for(;;){if(v(),l(),o[a]===","){a++;continue}if(o[a]==="]"){a++;return}u("',' or ']'")}}if(k==='"'){y();return}if(k==="t"){p("true");return}if(k==="f"){p("false");return}if(k==="n"){p("null");return}if(k==="-"||k!==void 0&&k>="0"&&k<="9"){h();return}u("a value")};if(v(),l(),a<o.length)u("end of input")}function ts(o,a){let l=1,u=0,p=Math.min(a,o.length);for(let y=0;y<p;y++)if(o.charCodeAt(y)===10)l++,u=y+1;return{line:l,column:p-u+1}}function ns(o){try{return{ok:!0,value:JSON.parse(o)}}catch(a){let l=a instanceof Error?a.message:String(a),u=0;try{es(o)}catch(p){if(p instanceof Ge)l=p.message,u=p.offset}return{ok:!1,error:{message:l,offset:u,...ts(o,u)}}}}function rs(o){return new TextEncoder().encode(o).byteLength}function Ae(o){if(o<1024)return`${o} B`;if(o<1048576)return`${(o/1024).toFixed(1)} KiB`;return`${(o/1048576).toFixed(1)} MiB`}function Qe(o,{maxBytes:a,allowEmpty:l=!1}={}){let u=rs(o),p=a!==void 0&&u>a;if(l&&o.trim()==="")return{text:o,value:void 0,valid:!p,error:null,bytes:u,overLimit:p};let y=ns(o);return y.ok?{text:o,value:y.value,valid:!p,error:null,bytes:u,overLimit:p}:{text:o,value:void 0,valid:!1,error:y.error,bytes:u,overLimit:p}}function qn({value:o,onChange:a,maxBytes:l,allowEmpty:u=!1,rows:p=10,"aria-label":y,id:h,readOnly:v=!1,disabled:k=!1,placeholder:w,className:N}){let S=bt(),C=c(),P=h??S?.id??C,j=`${P}-json-error`,L=`${P}-json-size`,O=g(()=>Qe(o,{maxBytes:l,allowEmpty:u}),[o,l,u]),F=(K)=>a(Qe(K,{maxBytes:l,allowEmpty:u})),V=(K)=>{if(O.error===null&&O.value!==void 0)F(JSON.stringify(O.value,null,K))},M=!v&&!k&&O.error===null&&O.value!==void 0;return t("div",{className:U("json-editor",!O.valid&&"json-editor-invalid",N),children:[e("textarea",{id:P,className:"input json-editor-text",rows:p,value:o,placeholder:w,readOnly:v,disabled:k,spellCheck:!1,autoCapitalize:"off",autoComplete:"off","aria-label":y,"aria-invalid":!O.valid||S?.["aria-invalid"]||void 0,"aria-required":S?.required,"aria-describedby":je(S?.["aria-describedby"],O.error&&j,L),onChange:(K)=>F(K.target.value)}),t("div",{className:"json-editor-bar",children:[O.error?t("p",{id:j,className:"json-editor-error",children:["Line ",O.error.line,", column ",O.error.column,":"," ",O.error.message]}):e("p",{className:"json-editor-ok muted",children:"Valid JSON"}),t("span",{id:L,className:U("json-editor-size",O.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(O.bytes,l),"aria-hidden":"true"}),l===void 0?Ae(O.bytes):O.overLimit?`${Ae(O.bytes)} of ${Ae(l)}: over the limit by ${Ae(O.bytes-l)}`:`${Ae(O.bytes)} of ${Ae(l)}`]}),!v&&t("span",{className:"json-editor-actions",children:[e(re,{size:"sm",disabled:!M,onClick:()=>V(2),children:"Format"}),e(re,{size:"sm",disabled:!M,onClick:()=>V(void 0),children:"Minify"})]})]})]})}function ss(o){if(o===null)return"null";if(Array.isArray(o))return"array";switch(typeof o){case"object":return o 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 os(o){if(typeof o==="bigint")return`${o}n`;if(o instanceof Date)return Number.isNaN(o.getTime())?"Invalid Date":o.toISOString();if(typeof o==="symbol"||typeof o==="function")return o.toString();return String(o)}function is(o,a){if(Array.isArray(o))return o.slice(0,a).map((u,p)=>[String(p),u]);let l=o;return Object.keys(l).slice(0,a).map((u)=>[u,l[u]])}function Xe({value:o,label:a="JSON",expandDepth:l=1,maxStringLength:u=200,maxChildren:p=100,copyable:y=!0,className:h}){let v={expandDepth:l,maxStringLength:u,maxChildren:p};return t("div",{className:U("json-view",h),children:[y&&e("div",{className:"json-view-toolbar",children:e(xe,{text:()=>Dn(o,2),ariaLabel:`Copy ${a}`})}),e("ul",{className:"json-tree","aria-label":a,children:e(Bn,{name:null,value:o,depth:0,ancestors:[],limits:v})})]})}function Bn({name:o,value:a,depth:l,ancestors:u,limits:p}){let y=ss(a),h=o===null?null:t("span",{className:"json-key",children:[o,": "]});if(y!=="object"&&y!=="array")return t("li",{className:"json-row",children:[h,e(cs,{value:a,kind:y,maxLength:p.maxStringLength})]});let v=a;if(u.includes(v))return t("li",{className:"json-row",children:[h,e("span",{className:"json-circular",children:"[Circular]"})]});return e(as,{nameNode:h,value:v,isArray:y==="array",depth:l,ancestors:u,limits:p})}function as({nameNode:o,value:a,isArray:l,depth:u,ancestors:p,limits:y}){let[h,v]=r(u<y.expandDepth),[k,w]=r(y.maxChildren),N=l?a.length:Object.keys(a).length,S=l?"[":"{",C=l?"]":"}",P=l?`${N} ${N===1?"item":"items"}`:`${N} ${N===1?"key":"keys"}`;if(N===0)return t("li",{className:"json-row",children:[o,t("span",{className:"json-punct",children:[S,C]})]});let j=h?is(a,k):[],L=h?[...p,a]:p;return t("li",{className:"json-row json-container",children:[t("button",{type:"button",className:"json-toggle","aria-expanded":h,onClick:()=>v((O)=>!O),children:[e("span",{className:"json-caret","aria-hidden":"true"}),o,e("span",{className:"json-punct",children:S}),!h&&t(n,{children:[e("span",{className:"json-summary",children:P}),e("span",{className:"json-punct",children:C})]})]}),h&&t(n,{children:[t("ul",{className:"json-children",children:[j.map(([O,F])=>e(Bn,{name:O,value:F,depth:u+1,ancestors:L,limits:y},O)),N>k&&e("li",{className:"json-row",children:t("button",{type:"button",className:"json-more",onClick:()=>w((O)=>O+y.maxChildren),children:["Show ",Math.min(y.maxChildren,N-k)," more (",N-k," hidden)"]})})]}),e("span",{className:"json-punct",children:C})]})]})}function cs({value:o,kind:a,maxLength:l}){let[u,p]=r(!1);if(a==="string"){let y=o,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:()=>p((v)=>!v),children:u?"Show less":`Show more (${y.length} chars)`})]})}return e("span",{className:`json-${a}`,children:os(o)})}var ls=new Intl.NumberFormat(void 0,{notation:"compact"});function jn({tabs:o,value:a,onChange:l,label:u,children:p,activation:y="auto",className:h}){let v=c(),k=T(null),w=(P)=>`${v}-tab-${P}`,N=`${v}-panel`,S=o.findIndex((P)=>P.value===a),C=(P)=>{let j=o.map((V,M)=>({tab:V,index:M})).filter(({tab:V})=>!V.disabled);if(j.length===0)return;let L=j.findIndex(({index:V})=>w(V)===P.currentTarget.id),O=null;switch(P.key){case"ArrowRight":O=(L+1)%j.length;break;case"ArrowLeft":O=(L-1+j.length)%j.length;break;case"Home":O=0;break;case"End":O=j.length-1;break;default:return}P.preventDefault();let F=j[O];if(k.current?.ownerDocument.getElementById(w(F.index))?.focus(),y==="auto")l(F.tab.value)};return t("div",{className:U("tabs",h),children:[e("div",{ref:k,className:"tabs-list",role:"tablist","aria-label":u,children:o.map((P,j)=>{let L=j===S,O=L||S===-1&&j===o.findIndex((F)=>!F.disabled);return t("button",{id:w(j),type:"button",role:"tab",className:"tab","aria-selected":L,"aria-controls":p!==void 0?N:void 0,tabIndex:O?0:-1,disabled:P.disabled,title:P.title,onClick:()=>l(P.value),onKeyDown:C,children:[e("span",{className:"tab-label",children:P.label}),P.count!==void 0&&e("span",{className:"tab-count",title:String(P.count),children:ls.format(P.count)})]},P.value)})}),p!==void 0&&e("div",{id:N,className:"tabs-panel",role:"tabpanel","aria-labelledby":S>=0?w(S):void 0,tabIndex:0,children:p})]})}function ds(o,a){switch(o.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=[o.min!==void 0?`min ${o.min}`:void 0,o.max!==void 0?`max ${o.max}`:void 0].filter(Boolean);return[o.integer?"An integer":"A number",...l].join(", ")}default:return a.in==="path"?"Percent-encoded as one path segment.":void 0}}function us({parameter:o,kind:a,value:l,onChange:u,disabled:p}){let y=typeof l==="string"?l:"";switch(a.kind){case"boolean":case"enum":{let h=a.kind==="boolean"?["true","false"]:a.options;return e(Ln,{value:y,disabled:p,options:[{value:"",label:o.required?"Choose…":"(not sent)"},...h.map((v)=>({value:v}))],onChange:u})}case"enum-list":{let h=Array.isArray(l)?l:[];return e("div",{className:"http-tryit-checks",role:"group","aria-label":o.name,children:a.options.map((v)=>e(Mn,{label:v,disabled:p,checked:h.includes(v),onChange:(k)=>u(k?[...h,v]:h.filter((w)=>w!==v))},v))})}default:return e(we,{value:y,disabled:p,inputMode:a.kind==="number"?"decimal":void 0,placeholder:a.kind==="list"?"a, b, c":void 0,onChange:(h)=>u(h)})}}function ps({headers:o}){let a=Object.entries(o);return t("details",{className:"http-tryit-headers","data-testid":"tryit-headers",children:[e("summary",{children:`Headers (${a.length})`}),a.length===0?e("p",{className:"http-muted",children:"No headers visible to the page."}):e("dl",{children:a.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 ms({body:o,label:a}){if(o===void 0)return e("p",{className:"http-muted",children:"No body."});if(typeof o==="string")return e("pre",{className:"http-tryit-text","aria-label":a,children:e("code",{children:o})});return e(Xe,{value:o,label:a,expandDepth:2})}function fs({result:o,operation:a}){let l=o.ok?o.response:void 0,u=o.ok?o.response.error:o.error,p=Be(u)?u:void 0,y=l?Tn(a,l.status):void 0,h=l?l.durationMs:o.ok?0:o.ms;return t("section",{className:"http-tryit-result","aria-label":"Response","data-testid":"tryit-result",children:[t("div",{className:"http-tryit-status",children:[e(z,{tone:l?.ok?"success":"danger",children:e("span",{"data-testid":"tryit-status",children:l?String(l.status):p?.status===0?"No response":"Error"})}),l?.statusText&&e("span",{className:"http-muted",children:l.statusText}),p&&e("code",{children:p.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(ze,{error:u}),l&&t(n,{children:[!l.ok&&e(ze,{error:u}),e(ps,{headers:l.headers}),e(ms,{body:l.body,label:l.ok?"Response body":p?.kind==="problem"?"Problem body":"Response body"})]})]})}function hs({request:o}){let a=Ut(),l=Te(),[u,p]=r("curl"),y={apiBase:a.base,origin:typeof window>"u"?"":window.location.origin,csrfHeader:l.csrfHeader},h=o?u==="curl"?Nn(o,y):Sn(o,y):void 0;return e(jn,{label:"Snippets",value:u,onChange:p,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(xe,{text:h,ariaLabel:`Copy the ${u==="curl"?"curl command":"fetch() call"}`}),e("pre",{"data-testid":`snippet-${u}`,children:e("code",{children:h})})]})})}function Hn({operation:o,root:a,readOnly:l=!1,probe:u,onChanged:p}){let y=Ut(),h=Te(),v=Ft(o),k=pt(o),w=o.requestBody?.required!==!0,[N,S]=r({}),[C,P]=r(()=>Qe(vn(o,a),{allowEmpty:w})),[j,L]=r({}),[O,F]=r(null),[V,M]=r(!1),[K,te]=r(null),_=Pn(o,{readOnly:l,permitted:o.action===void 0||u===void 0?!0:u(o.action)===!0}),Y=!_.enabled||V,X=g(()=>xn(o,a,N,k===void 0?void 0:C.value),[o,a,N,k,C.value]);async function fe(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}),o.mutation&&le.ok)p?.()}catch(le){te({ok:!1,error:le,ms:performance.now()-ce})}finally{M(!1)}}function se(){if(!_.enabled)return;if(k!==void 0&&!C.valid){L({body:C.error?`Line ${C.error.line}: ${C.error.message}`:"The body is not valid JSON"});return}if(!X.ok){L(X.errors);return}if(L({}),o.mutation){F(X.request);return}fe(X.request)}let ke=Cn(o),ae=o.parameters.find((Z)=>Z.in==="header"&&Z.name===o.csrf?.header);return t("section",{className:"http-tryit","aria-labelledby":`tryit-${o.id}`,"data-testid":"tryit",children:[e("h3",{id:`tryit-${o.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(),se()},children:[v.length===0&&k===void 0&&e("p",{className:"http-muted",children:"No parameters."}),v.map((Z)=>{let ce=jt(Z),le=Ht(Z,a);return e(Ce,{label:t(n,{children:[e("code",{children:Z.name})," ",e("span",{className:"http-muted",children:Z.in})]}),required:Z.required,hint:ds(le,Z),error:j[ce],children:e(us,{parameter:Z,kind:le,value:N[ce],disabled:Y,onChange:(tt)=>S((rt)=>({...rt,[ce]:tt}))})},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(Ce,{label:"Body (application/json)",required:!w,hint:w?"Optional: leave it empty to send none.":"Prefilled with the schema's required fields.",error:j.body,children:e(qn,{value:C.text,allowEmpty:w,readOnly:Y,rows:8,onChange:P})}),t("div",{className:"http-tryit-actions",children:[e(re,{type:"submit",variant:o.mutation?ke?"danger":"primary":"primary",disabled:Y,children:V?"Sending…":`Send ${o.method}`}),K&&e(re,{variant:"ghost",onClick:()=>te(null),children:"Clear response"})]})]}),e(hs,{request:X.ok?X.request:void 0}),K&&e(fs,{result:K,operation:o}),e(Wn,{open:O!==null,onClose:()=>F(null),title:`Send ${o.method} ${O?.path??o.path}?`,description:ke?"This changes the real API and cannot be undone.":"This changes the real API, as the app's own buttons would.",variant:ke?"danger":"default",confirmLabel:`Send ${o.method}`,confirmText:ke?o.id:void 0,onConfirm:async()=>{if(O)await fe(O)}})]})}function _t({method:o}){return e(z,{tone:un(o),className:"http-method",children:o})}function gs(o){if(o.in!=="query"||o.style===void 0)return;if(o.style==="form"&&o.explode!==!1)return"Repeat the key for each value (state=a&state=b).";return`style: ${o.style}${o.explode===void 0?"":`, explode: ${String(o.explode)}`}`}function ys({operation:o,root:a,onRef:l}){if(o.parameters.length===0)return null;return t("section",{className:"http-section","aria-labelledby":`params-${o.id}`,children:[e("h3",{id:`params-${o.id}`,children:"Parameters"}),e("ul",{className:"http-params","data-testid":"op-parameters",children:o.parameters.map((u)=>{let p=gs(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(z,{tone:"neutral",children:u.in}),u.required?e("span",{className:"schema-required",children:"required"}):e("span",{className:"http-muted",children:"optional"}),u.deprecated&&e(z,{tone:"warning",children:"deprecated"})]}),u.description&&e("div",{className:"http-param-description",children:e(ie,{text:u.description})}),p&&e("p",{className:"http-muted http-param-style",children:p}),e(he,{schema:u.schema,root:a,depth:0,onRef:l,label:`Schema of ${u.name}`})]},`${u.in}:${u.name}`)})})]})}function bs({operation:o,root:a,onRef:l}){let u=o.requestBody;if(!u)return null;return t("section",{className:"http-section","aria-labelledby":`body-${o.id}`,"data-testid":"op-body",children:[t("h3",{id:`body-${o.id}`,children:["Request body"," ",e("span",{className:"http-muted",children:u.required?"(required)":"(optional)"})]}),u.description&&e(ie,{text:u.description}),u.content.map((p)=>t("div",{className:"http-media",children:[e("code",{className:"http-media-type",children:p.contentType}),p.schema!==void 0&&e(he,{schema:p.schema,root:a,depth:2,onRef:l,label:`Request body schema (${p.contentType})`})]},p.contentType))]})}function vs(o){if(o.startsWith("2"))return"success";if(o.startsWith("4"))return"warning";if(o.startsWith("5"))return"danger";return"neutral"}function xs({response:o,root:a,onRef:l}){let u=o.status.startsWith("2");return t("li",{className:"http-response","data-status":o.status,children:[t("div",{className:"http-response-head",children:[e(z,{tone:vs(o.status),children:o.status}),e("span",{children:o.description})]}),o.codes.length>0&&e("ul",{className:"http-codes","aria-label":`Problem codes for ${o.status}`,children:o.codes.map((p)=>e("li",{children:e("code",{children:p})},p))}),o.content.map((p)=>t("div",{className:"http-media",children:[e("code",{className:"http-media-type",children:p.contentType}),p.schema!==void 0&&e(he,{schema:p.schema,root:a,depth:u?1:0,onRef:l,label:`Response ${o.status} schema (${p.contentType})`})]},p.contentType))]})}function Fn({operation:o,root:a,onRef:l,probe:u,readOnly:p=!1,onChanged:y}){let h=Te(),v=o.action===void 0||u===void 0?void 0:u(o.action),k=o.csrf;return t("article",{className:"http-operation","aria-labelledby":`op-${o.id}`,"data-testid":"http-operation",children:[t("header",{className:"http-operation-head",children:[t("div",{className:"http-operation-line",children:[e(_t,{method:o.method}),e("code",{className:"http-operation-path","data-testid":"op-path",children:o.path}),o.deprecated&&e(z,{tone:"warning",children:"deprecated"})]}),e("h2",{id:`op-${o.id}`,className:"http-operation-title",children:o.summary??o.id}),t("p",{className:"http-operation-id",children:[e("span",{className:"http-muted",children:"operationId"})," ",e("code",{children:o.id}),e(xe,{text:o.id,ariaLabel:"Copy the operation id"})]})]}),t("div",{className:"http-markers","aria-label":"Access",role:"group",children:[o.action!==void 0&&(u===void 0?e(z,{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:o.action})]})}):e(z,{tone:v?"success":"danger",title:"From the caller's permissions. authorize may still decide per target.",children:t("span",{"data-testid":"op-permission","data-allowed":String(v??!1),children:[v?"You have ":"You lack ",e("code",{children:o.action})]})})),e(z,{tone:o.mutation?"warning":"neutral",title:o.mutation?"Changes state: CSRF checks apply, and a read-only API refuses it.":"Reads only.",children:e("span",{"data-testid":"op-mutation",children:o.mutation?"Mutation":"Read"})}),o.mutation&&p&&e(z,{tone:"danger",children:"Refused: the API is read-only"}),o.requires.length>0&&t("span",{className:"http-requires","data-testid":"op-requires",children:[e("span",{className:"http-muted",children:"Needs driver support:"})," ",o.requires.map((w)=>e("code",{children:w},w))]})]}),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)."})]}),o.description&&e("div",{className:"http-description",children:e(ie,{text:o.description})}),e(ys,{operation:o,root:a,onRef:l}),e(bs,{operation:o,root:a,onRef:l}),t("section",{className:"http-section","aria-labelledby":`responses-${o.id}`,children:[e("h3",{id:`responses-${o.id}`,children:"Responses"}),e("ul",{className:"http-responses","data-testid":"op-responses",children:o.responses.map((w)=>e(xs,{response:w,root:a,onRef:l},w.status))})]}),e(Hn,{operation:o,root:a,readOnly:p,probe:u,onChanged:y},o.id)]})}function xt(o,a,l){if(a.length===0)return null;let u=l?a.indexOf(l):-1;switch(o){case"ArrowDown":return a[u<0?0:Math.min(u+1,a.length-1)];case"ArrowUp":return a[u<=0?0:u-1];case"Home":return a[0];case"End":return a[a.length-1];default:return null}}var kt={"data-shortcut":"search","aria-keyshortcuts":"/"};function Kn(o){return o?Array.from(o.querySelectorAll("a.http-op-link")):[]}function Un({group:o,headingId:a,level:l,hrefOf:u}){return t("section",{className:"http-tag","aria-labelledby":a,children:[e(l===2?"h2":"h3",{id:a,className:"http-tag-name",title:o.description,children:o.name}),e("ul",{className:"http-tag-ops",children:o.operations.map((y)=>e("li",{children:t(oe,{to:u(y.id),className:"http-op-link",activeMatch:"exact","data-operation":y.id,children:[e(_t,{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:o,sections:a,query:l,onQuery:u,hrefOf:p}){let y=T(null),h=o.reduce((k,w)=>k+w.operations.length,0);function v(k){let w=xt(k.key,Kn(y.current),document.activeElement);if(w)k.preventDefault(),w.focus()}return t("nav",{className:"http-sidebar","aria-label":"Operations",children:[e(we,{type:"search",value:l,"aria-label":"Search operations",placeholder:"Search path, id, summary",...kt,onChange:(k)=>u(k),onKeyDown:(k)=>{if(k.key==="ArrowDown"){let w=Kn(y.current)[0];if(w)k.preventDefault(),w.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:v,children:[a===void 0?o.map((k)=>e(Un,{group:k,headingId:`tag-${k.name}`,level:2,hrefOf:p},k.name)):lt(a).map(({key:k,index:w,section:N})=>t("section",{className:"http-section","aria-labelledby":`section-${w}`,children:[e("h2",{id:`section-${w}`,className:"http-section-name",children:N.name}),N.tags.map((S)=>e(Un,{group:S,headingId:`tag-${w}-${S.name}`,level:3,hrefOf:p},S.name))]},k)),o.length===0&&e("p",{className:"http-muted",children:"No operation matches."})]})]})}function Vn(o,a,l=""){let u=a?`?q=${encodeURIComponent(a)}`:"";return`${l}/http/${encodeURIComponent(o)}${u}`}function ws({info:o,serverBase:a}){let l=Te(),u=typeof window>"u"?"":window.location.origin;return t(G,{className:"http-info",children:[t("div",{className:"http-info-line",children:[e(z,{tone:"accent",children:`OpenAPI ${o.openapi}`}),o.version&&e(z,{tone:"neutral",children:`v${o.version}`})]}),o.description&&e("div",{className:"http-description",children:e(ie,{text:o.description})}),t("dl",{className:"http-servers","data-testid":"http-servers",children:[o.servers.map((p)=>{let y=It(p.url,l.documentUrl,u);return t("div",{children:[t("dt",{children:["Server ",e("code",{children:p.url}),p.description?` (${p.description})`:""]}),t("dd",{children:[e("code",{"data-testid":"http-server-url",children:y}),e(xe,{text:y,ariaLabel:"Copy the server URL"})]})]},p.url)}),t("div",{children:[e("dt",{children:"Requests are sent to"}),e("dd",{children:e("code",{"data-testid":"http-request-base",children:a})})]})]}),e("p",{className:"http-muted",children:"Paths below are relative to the server."})]})}function _n({group:o,query:a,pathBase:l}){return t(n,{children:[o.description&&e("p",{className:"http-muted",children:o.description}),e("ul",{className:"http-overview-ops",children:o.operations.map((u)=>t("li",{children:[t(oe,{to:Vn(u.id,a,l),children:[e("code",{children:u.method})," ",u.path]}),u.summary&&e("span",{className:"http-muted",children:` ${u.summary}`})]},u.id))})]})}function ks({doc:o,groups:a,sections:l,query:u,onRef:p,pathBase:y}){let h=dn(o);return t("div",{className:"http-overview",children:[l===void 0?a.map((v)=>e(G,{title:v.name,children:e(_n,{group:v,query:u,pathBase:y})},v.name)):lt(l).map(({key:v,section:k})=>e(G,{title:k.name,className:"http-overview-section",children:k.tags.map((w)=>t("section",{className:"http-overview-tag","aria-label":w.name,children:[e("h3",{className:"http-overview-tag-name",children:w.name}),e(_n,{group:w,query:u,pathBase:y})]},w.name))},v)),h.length>0&&e(G,{title:"Schemas",children:e("ul",{className:"http-components","data-testid":"http-components",children:h.map((v)=>e("li",{id:`schema-${v}`,children:e("button",{type:"button",className:"schema-ref schema-ref-link",onClick:()=>p(`#/components/schemas/${v}`,v),children:v})},v))})})]})}function Ns({doc:o,refValue:a,onClose:l,onRef:u}){return e(mt,{open:a!==null,onClose:l,title:a===null?"":Oe(a),description:a??void 0,size:"lg",className:"http-schema-panel",children:a!==null&&e(he,{schema:{$ref:a},root:o,depth:2,onRef:u,label:`Schema ${Oe(a)}`},a)})}function zt({doc:o,extensions:a,client:l,probe:u,readOnly:p=!1,onChanged:y,pathBase:h=""}){let v=Te(),k=a??v.extensions,{operationId:w}=de(),[N,S]=nt("q"),[C,P]=r(null),j=g(()=>an(o),[o]),L=g(()=>on(o,{extensions:k}),[o,k]),O=g(()=>cn(o,L),[o,L]),F=g(()=>ln(O,N),[O,N]),V=g(()=>At(o,O),[o,O]),M=g(()=>At(o,F),[o,F]),K=w===void 0?void 0:L.find((se)=>se.id===w),te=(se)=>P(se),_=typeof window>"u"?"":window.location.origin,Y=It(j.servers[0]?.url??"/",v.documentUrl,_),X=In(),fe=g(()=>l??qt({base:Y,csrfHeader:v.csrfHeader,fetch:X}),[l,Y,v.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:N,onQuery:(se)=>S(se),hrefOf:(se)=>Vn(se,N,h)}),e("div",{className:"http-docs-main",children:w===void 0?t(n,{children:[e(ws,{info:j,serverBase:Y}),e(ks,{doc:o,groups:O,sections:V,query:N,onRef:te,pathBase:h})]}):K?e(yt,{value:fe,children:e(Fn,{operation:K,root:o,onRef:te,probe:u,readOnly:p,onChanged:y},K.id)}):e(ft,{title:"No such operation",description:`This document has no operation "${w}".`,action:e(oe,{to:`${h}/http`,children:"All operations"})})})]}),e(Ns,{doc:o,refValue:C,onClose:()=>P(null),onRef:te})]})}function W(o){return typeof o==="object"&&o!==null&&!Array.isArray(o)}function I(o){return typeof o==="string"?o:void 0}function Pe(o){return typeof o==="number"&&Number.isFinite(o)?o:void 0}function Ye(o,a,l){if(o===void 0)return;for(let u of l){let p=`${u}-${a}`;if(Object.hasOwn(o,p))return{key:p,value:o[p]}}return}function Nt(o){let a=W(o)?I(o.$ref):void 0;if(a===void 0||!a.startsWith("#/"))return;let l=a.split("/").at(-1);return l===void 0?void 0:l.replaceAll("~1","/").replaceAll("~0","~")}function Fe(o,a="",l=""){return`${l}/ws/${encodeURIComponent(o)}${a?`?${new URLSearchParams({q:a}).toString()}`:""}`}function He(o,a){return a===void 0?o:`${o}-${a}`}function zn(o){switch(o.subprotocol.source){case"server-extension":return`from servers.${o.server?.key??"api"} (${o.subprotocolKey??"subprotocol extension"})`;case"connection-extension":return`from the connection channel (${o.subprotocolKey??"subprotocol extension"})`;case"connection-prose":return"from the connection channel's description";case"default":return o.subprotocol.value===void 0?"not stated in the document":"not stated; the configured default"}}function Ss(o){return o?.match(/subprotocol `([^`]+)`/)?.[1]}function Cs(o){switch(I(o.type)){case"http":return[I(o.scheme),I(o.bearerFormat)].filter(Boolean).join(", ");case"httpApiKey":return`${I(o.in)??"?"} ${I(o.name)??"?"}`;case"oauth2":{let l=W(o.flows)?Object.values(o.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 I(o.openIdConnectUrl);default:return}}function Ps(o){if(!W(o))return null;return Object.entries(o).map(([a,l])=>({scheme:a,scopes:Array.isArray(l)?l.filter((u)=>typeof u==="string"):[]}))}function Ts(o,a){let l=Nt(o);if(l!==void 0)return[{scheme:l,scopes:[]}];if(!W(o))return null;let{scopes:u,...p}=o;return[{scheme:Object.entries(a).find(([,h])=>W(h)&&Object.entries(p).every(([v,k])=>JSON.stringify(h[v])===JSON.stringify(k)))?.[0]??I(p.type)??"(inline)",scopes:Array.isArray(u)?u.filter((h)=>typeof h==="string"):[]}]}function Gt(o){return(Array.isArray(o)?o:W(o)?Object.values(o):[]).flatMap((l)=>{let u=Nt(l);return u===void 0?[]:[u]})}function Rs(o){let a=/^([^.]+)\.(.+)$/.exec(o);return a?{kind:a[1],type:a[2]}:null}function Os(o){if(!W(o))return null;let a=[];for(let[u,p]of Object.entries(o)){let y=Pe(p);if(u!=="replay"&&y!==void 0)a.push([u,y])}let l=o.replay;return{values:a,replay:l===!1?!1:W(l)?{size:Pe(l.size),maxAgeMs:Pe(l.maxAgeMs)}:void 0}}function Gn(o,a={}){let l=a.extensions??it,u=W(o.info)?o.info:{},p=W(o.components)?o.components:{},y=W(p.securitySchemes)?p.securitySchemes:{},h=W(o.servers)?o.servers:{},v=W(h.api)?"api":Object.keys(h).find((E)=>W(h[E])),k=v===void 0?void 0:h[v],w=null,N=[],S=0,C;if(k){let E=W(k.variables)?k.variables:{},A=W(E.host)?E.host:void 0,Q=I(k.host)??"",ne=/\{[^}]+\}/.test(Q),Ne=I(A?.default),st=I(k.pathname),$e=I(k.protocol),Je=ne&&Ne?Q.replace(/\{host\}/,Ne):Q;w={key:v,host:Q,hostIsTemplate:ne,hostDefault:Ne,pathname:st,protocol:$e,description:I(k.description),url:Je!==""&&$e!==void 0?`${$e}://${Je}${st??""}`:void 0};let ve=Array.isArray(k.security)?k.security:[];S=ve.length;let Re=Ye(k,"security",l);C=Re?.key,N=(Re!==void 0&&Array.isArray(Re.value)?Re.value.map(Ps):ve.map((Le)=>Ts(Le,y))).filter((Le)=>Le!==null)}let P=new Set(N.flatMap((E)=>E.map((A)=>A.scheme))),j=Object.entries(y).filter(([E])=>P.has(E)||P.size===0).flatMap(([E,A])=>W(A)?[{name:E,type:I(A.type),detail:Cs(A)||void 0,description:I(A.description),note:I(Ye(A,"note",l)?.value)}]:[]),L=W(o.channels)?o.channels:{},O=Object.entries(L).flatMap(([E,A])=>{if(!W(A))return[];let Q=I(A.address)??E,ne=W(A.parameters)?A.parameters:{},Ne=[...Q.matchAll(/\{([^}]+)\}/g)].map((ve)=>ve[1]),st=[...Ne,...Object.keys(ne).filter((ve)=>!Ne.includes(ve))],$e=W(A.bindings)?A.bindings:{},Je=W($e.ws)?$e.ws:{};return[{key:E,slug:He("channel",E),title:I(A.title)??E,address:Q,description:I(A.description),parameters:st.map((ve)=>{let Re=W(ne[ve])?ne[ve]:void 0,Le=Ye(Re,"schema",l)?.value;return{name:ve,description:I(Re?.description),schema:W(Le)?Le:void 0}}),messages:Gt(A.messages),bindingMethod:I(Je.method),isConnection:E==="connection"||I(Je.method)!==void 0}]}).sort((E,A)=>Number(A.isConnection)-Number(E.isConnection)),F=O.find((E)=>E.isConnection),V=F?L[F.key]:{},M=W(o.operations)?o.operations:{},K=Object.entries(M).flatMap(([E,A])=>{if(!W(A))return[];let Q=I(A.action),ne=W(A.reply)?A.reply:null;return[{key:E,slug:He("operation",E),title:I(A.title)??E,summary:I(A.summary),action:Q==="send"||Q==="receive"?Q:void 0,channel:Nt(A.channel),messages:Gt(A.messages),reply:ne?{channel:Nt(ne.channel),messages:Gt(ne.messages)}:null,permission:I(Ye(A,"action",l)?.value)}]}),te=W(p.messages)?p.messages:{},_=Object.entries(te).flatMap(([E,A])=>{if(!W(A))return[];let Q=Array.isArray(A.examples)?A.examples:[];return[{key:E,slug:He("message",E),name:I(A.name)??E,title:I(A.title),summary:I(A.summary),contentType:I(A.contentType)??I(o.defaultContentType),payload:A.payload,examples:Q.filter(W).map((ne)=>({name:I(ne.name),summary:I(ne.summary),payload:ne.payload})),event:Rs(E)}]}).sort((E,A)=>Number(E.event!==null)-Number(A.event!==null)),Y=(E)=>{for(let A of l){let Q=`${A}-${E}`;if(Object.hasOwn(V,Q))return{key:Q,value:V[Q]};let ne=Object.values(L).find((Ne)=>W(Ne)&&Object.hasOwn(Ne,Q));if(W(ne))return{key:Q,value:ne[Q]}}return},X=Y("close-codes"),fe=(Array.isArray(X?.value)?X.value:[]).flatMap((E)=>W(E)&&Pe(E.code)!==void 0?[{code:Pe(E.code),name:I(E.name)??"",description:I(E.description)??""}]:[]),se=Y("upgrade-refusals"),ke=(Array.isArray(se?.value)?se.value:[]).flatMap((E)=>W(E)&&Pe(E.status)!==void 0?[{status:Pe(E.status),code:I(E.code)??"",description:I(E.description)??"",contentType:I(E.contentType),headers:W(E.headers)?Object.fromEntries(Object.entries(E.headers).flatMap(([A,Q])=>typeof Q==="string"?[[A,Q]]:[])):{}}]:[]),ae=Y("limits"),Z=(E)=>{let A=Ye(E,"subprotocol",l);return A!==void 0&&I(A.value)!==void 0?A:void 0},ce=Z(k),le=ce===void 0?Z(V):void 0,tt=ce===void 0&&le===void 0?Ss(F?.description):void 0,rt=I(ce?.value)??I(le?.value)??tt;return{title:I(u.title)??"WebSocket API",version:I(u.version),description:I(u.description),server:w,subprotocol:{value:rt??a.defaultSubprotocol,fromDocument:rt!==void 0,source:ce!==void 0?"server-extension":le!==void 0?"connection-extension":tt!==void 0?"connection-prose":"default"},subprotocolKey:ce?.key??le?.key,extensionKeys:{security:C,limits:ae?.key,closeCodes:X?.key,upgradeRefusals:se?.key},securitySchemes:j,requirements:N,conjunctive:N.length>S,channels:O,operations:K,messages:_,limits:Os(ae?.value),closeCodes:fe,refusals:ke}}function Qn(o){let l=[o.limits&&{slug:He("limits"),label:"Limits",hint:o.extensionKeys.limits,keywords:o.limits.values.map(([h])=>h).join(" ")},o.closeCodes.length>0&&{slug:He("close-codes"),label:"Close codes",hint:o.extensionKeys.closeCodes,keywords:o.closeCodes.map((h)=>`${h.code} ${h.name}`).join(" ")},o.refusals.length>0&&{slug:He("upgrade-refusals"),label:"Upgrade refusals",hint:o.extensionKeys.upgradeRefusals,keywords:o.refusals.map((h)=>`${h.status} ${h.code}`).join(" ")}].filter((h)=>Boolean(h)),u=o.messages.filter((h)=>h.event===null),p=o.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:o.channels.map((h)=>({slug:h.slug,label:h.title,hint:h.address,keywords:`${h.key} ${h.address} ${h.parameters.map((v)=>v.name).join(" ")}`}))},{title:"Operations",items:o.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:p.map(y)}].filter((h)=>h.items.length>0)}function Xn(o,a){let l=a.toLowerCase().split(/\s+/).filter(Boolean);if(l.length===0)return[...o];return o.map((u)=>({...u,items:u.items.filter((p)=>{let y=`${p.slug} ${p.label} ${p.hint??""} ${p.keywords}`.toLowerCase();return l.every((h)=>y.includes(h))})})).filter((u)=>u.items.length>0)}function Yn(o,a){if(a==="limits"&&o.limits)return{kind:"limits"};if(a==="close-codes"&&o.closeCodes.length>0)return{kind:"close-codes"};if(a==="upgrade-refusals"&&o.refusals.length>0)return{kind:"upgrade-refusals"};let l=o.channels.find((y)=>y.slug===a);if(l)return{kind:"channel",channel:l};let u=o.operations.find((y)=>y.slug===a);if(u)return{kind:"operation",operation:u};let p=o.messages.find((y)=>y.slug===a);return p?{kind:"message",message:p}:null}function Qt(o,a){return o.operations.filter((l)=>l.channel===a)}function Zn(o,a){return o.channels.filter((l)=>l.messages.includes(a))}function tr(o,a){return o.operations.filter((l)=>l.messages.includes(a)||(l.reply?.messages.includes(a)??!1))}function nr(o,a){return[...new Set(Qt(o,a).flatMap((l)=>l.permission===void 0?[]:[l.permission]))]}function rr(o,a){let l=a.messages.flatMap((u)=>{let p=o.messages.find((y)=>y.key===u);return p?.event?[p.event.type]:[]});return[...new Set(l)]}function Es(o){try{return new RegExp(o,"u")}catch{return}}function Ds(o,a,l){let u=[...a].length,p=Pe(o.maxLength);if(p!==void 0&&u>p)return`At most ${p} characters (this is ${u}).`;let y=Pe(o.minLength);if(y!==void 0&&u<y)return`At least ${y} characters.`;let h=I(o.pattern),v=h===void 0?void 0:Es(h);if(v&&!v.test(a))return(h===void 0?void 0:l?.patternText?.[h])??`Must match ${h}.`;return null}function St(o,a,l,u){if(a==="")return null;if(l!==void 0)return Ds(l,a,u);return u?.nameRule?.(o,a)??null}function sr(o){return Object.fromEntries(o.map((a)=>[a.name,a.schema]))}function or(o,a,l={},u){let p=!0,y=o.replace(/\{([^}]+)\}/g,(h,v)=>{let k=a[v]??"";if(k===""||St(v,k,l[v],u)!==null)return p=!1,"";return u?.escapeValue?.(v,k)??k});return p?y:null}function ir(o,a,l){return o.parameters.flatMap((u)=>{let p=a[u.name]??"";if(p==="")return[`${u.name}: fill it in.`];let y=St(u.name,p,u.schema,l);return y===null?[]:[`${u.name}: ${y}`]})}function ar(o){return!o.isConnection&&!o.address.startsWith("/")}function lr(o,a){let l=(y)=>{let h=y;for(let v=0;v<16&&W(h)&&I(h.$ref);v++)h=qe(a,I(h.$ref));return h},u=l(o),p=W(u)&&W(u.properties)?l(u.properties.event):void 0;return W(p)&&W(p.properties)?p.properties.payload:void 0}function dr(o){let a=W(o)?o.event:void 0;return W(a)?a.payload:void 0}var Is=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function me(o){return Is.format(o)}function $s(o){if(/bytes$/i.test(o))return"bytes";if(/ms$/i.test(o))return"ms";if(/persecond$/i.test(o))return"per-second";return"count"}function Ls(o){let a=["KiB","MiB","GiB"],l=o,u="";for(let p of a){if(l<1024||l%1024!==0)break;l/=1024,u=p}return u===""?`${me(o)} bytes`:`${me(o)} bytes (${me(l)} ${u})`}function Ct(o){let a=`${me(o)} ms`;if(o>=60000&&o%60000===0)return`${a} (${me(o/60000)} min)`;if(o>=1000&&o%1000===0)return`${a} (${me(o/1000)} s)`;return a}function ur(o,a,l){switch(l?.unit??$s(o)){case"bytes":return Ls(a);case"ms":return Ct(a);case"per-second":return`${me(a)} / s`;default:return me(a)}}function be({text:o}){let a=o.split(/(`[^`]+`)/);return e(n,{children:a.map((l,u)=>l.length>2&&l.startsWith("`")&&l.endsWith("`")?e("code",{children:l.slice(1,-1)},u):l)})}function Pt({schema:o,root:a,label:l,depth:u=2}){return e("div",{className:"ws-schema","data-testid":"ws-schema",children:e(he,{schema:o,root:a,depth:u,label:l})})}function Ke({items:o,layout:a="grid",empty:l="—",className:u}){return e("dl",{className:U("kv",`kv-${a}`,u),children:o.map((p,y)=>{if(!p)return null;let h=p.value===null||p.value===void 0||p.value==="",v=p.key??(typeof p.label==="string"?p.label:`row-${y}`);return t("div",{className:"kv-row",children:[e("dt",{className:"kv-label",children:p.label}),t("dd",{className:U("kv-value",h&&"muted"),children:[h?l:p.value,p.hint&&e("span",{className:"kv-hint",children:p.hint})]})]},v)})})}function Ie({label:o,className:a,children:l}){return e("div",{className:"table-wrap",role:"region","aria-label":o,tabIndex:0,children:t("table",{className:U("table",a),children:[e("caption",{className:"visually-hidden",children:o}),l]})})}function pr({doc:o}){let{server:a,subprotocol:l}=o;return e(G,{title:"Server",children:a===null?e("p",{className:"muted",children:"The document names no server."}):e(Ke,{items:[{label:"URL",value:a.url&&e("code",{"data-testid":"ws-server-url",children:a.url})},{label:"Host",value:e("code",{children:a.host}),hint:a.hostIsTemplate?`A template: the document served over HTTP fills in the request's own host${a.hostDefault?` (default ${a.hostDefault})`:""}.`:"Taken from the request that fetched this document: the host you reached the API on."},{label:"Path",value:a.pathname&&e("code",{children:a.pathname})},{label:"Protocol",value:a.protocol&&e("code",{children:a.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:zn(o)}),l.fromDocument?". Optional: offer it in Sec-WebSocket-Protocol, or offer none. Offering others without it may be refused.":"."]})},a.description!==void 0&&{label:"About",value:a.description}]})})}function mr({doc:o}){let{requirements:a,securitySchemes:l,conjunctive:u}=o;return e(G,{title:"Security",children:e("div",{"data-testid":"ws-security",children:a.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:a.length===1?"The connection must satisfy:":"The connection must satisfy any one of:"}),e("ul",{className:"ws-requirements","aria-label":"Security requirements",children:a.map((p)=>{let y=p.map((h)=>`${h.scheme}:${h.scopes.join(",")}`).join("+");return e("li",{children:p.map((h,v)=>t("span",{children:[v>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:o.extensionKeys.security??"the security extension"}),", which is what this list shows: every scheme within one requirement is needed together."]}),t(Ie,{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((p)=>t("tr",{"data-testid":`ws-scheme-${p.name}`,children:[t("td",{children:[e("code",{children:p.name}),p.description&&e("div",{className:"muted",children:p.description})]}),t("td",{children:[p.type,p.detail&&e("div",{className:"muted",children:p.detail})]}),e("td",{children:p.note?e("span",{className:"ws-note",children:e(be,{text:p.note})}):e("span",{className:"muted",children:"Can be sent."})})]},p.name))})]})]})})})}function Ws(o){if(o===!1)return"Off: a resume after a reconnect always reports a gap.";if(o===void 0)return"Not stated.";let a=[o.size!==void 0&&`the last ${me(o.size)} events`,o.maxAgeMs!==void 0&&`at most ${Ct(o.maxAgeMs)} old`].filter(Boolean);return a.length>0?`Keeps ${a.join(", ")}.`:"On."}function Tt({limits:o,extensionKey:a,limitsInfo:l}){return t(G,{title:"Limits",children:[t("p",{className:"muted",children:["What one connection is held to",a===void 0?"":t(n,{children:[" ","(",e("code",{children:a}),")"]}),"."]}),t(Ie,{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:[o.values.map(([u,p])=>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:ur(u,p,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:o.replay===!1?"off":o.replay===void 0?"—":[o.replay.size!==void 0&&`size ${me(o.replay.size)}`,o.replay.maxAgeMs!==void 0&&`maxAgeMs ${Ct(o.replay.maxAgeMs)}`].filter(Boolean).join(", ")}),t("td",{children:["The events kept for a resume. ",Ws(o.replay)]})]})]})]})]})}function Rt({doc:o}){return t(G,{title:"Close codes",children:[t("p",{className:"muted",children:["How an open connection is closed",o.extensionKeys.closeCodes===void 0?"":t(n,{children:[" ","(",e("code",{children:o.extensionKeys.closeCodes}),")"]}),"."]}),t(Ie,{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:o.closeCodes.map((a)=>t("tr",{"data-testid":`ws-close-${a.code}`,children:[e("td",{className:"ws-value",children:a.code}),e("td",{children:e("code",{children:a.name})}),e("td",{children:e(be,{text:a.description})})]},`${a.code}-${a.name}`))})]})]})}function Ot({doc:o}){return t(G,{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"}),o.extensionKeys.upgradeRefusals===void 0?"":t(n,{children:[" ","(",e("code",{children:o.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(Ie,{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:o.refusals.map((a)=>t("tr",{"data-testid":`ws-refusal-${a.code}`,children:[e("td",{className:"ws-value",children:e(z,{tone:a.status>=500?"danger":"warning",children:a.status})}),e("td",{children:e("code",{children:a.code})}),e("td",{children:e(be,{text:a.description})}),e("td",{children:a.contentType&&e("code",{children:a.contentType})}),e("td",{children:Object.keys(a.headers).length===0?e("span",{className:"muted",children:"—"}):Object.entries(a.headers).map(([l,u])=>e("div",{children:t("code",{children:[l,": ",u]})},l))})]},`${a.status}-${a.code}`))})]})]})}function fr({doc:o}){return t("header",{className:"ws-header",children:[t("h1",{className:"screen-title",children:[o.title," ",o.version&&t(z,{tone:"neutral",title:"info.version",children:["v",o.version]})]}),e("p",{className:"muted ws-kicker",children:"WebSocket API (AsyncAPI 3.0)"}),o.description&&t("details",{className:"ws-description",children:[e("summary",{children:"About this socket"}),e(ie,{text:o.description})]})]})}function Xt({action:o,probe:a}){if(a===void 0)return t("span",{className:"ws-permission","data-testid":`ws-permission-${o}`,children:[e("code",{children:o})," ",e(z,{tone:"neutral",children:"permission"})]});let l=a(o);return t("span",{className:"ws-permission","data-testid":`ws-permission-${o}`,"data-has":l===void 0?"unknown":String(l),children:[e("code",{children:o})," ",l===void 0?e(z,{tone:"neutral",children:"Not an action this UI knows"}):e(z,{tone:l?"success":"danger",children:l?"You have this":"You lack this"})]})}function Ue({items:o,pathBase:a="",empty:l="None."}){if(o.length===0)return e("span",{className:"muted",children:l});return e("ul",{className:"ws-links",children:o.map((u)=>e("li",{children:e(oe,{to:Fe(u.slug,"",a),children:e("code",{children:u.label})})},u.slug))})}function gr({console:o}){return e("p",{className:"muted","data-testid":"ws-try-unavailable",children:o.unavailableReason??t(n,{children:["The ",o.label," is not available here."]})})}function qs({doc:o,channel:a,console:l,address:u}){let[p,y]=r({});if(!l.available)return e(G,{title:"Try it",children:e(gr,{console:l})});let h=or(a.address,p,sr(a.parameters),u),v=rr(o,a),k=h===null?null:l.channelLink(h,v),w=ir(a,p,u);return e(G,{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",v.length>0?`, showing the ${v.length} event types it carries`:"","."]}),a.parameters.length>0&&e("div",{className:"ws-try-fields",children:a.parameters.map((N)=>{let S=p[N.name]??"",C=St(N.name,S,N.schema,u);return e(Ce,{label:N.name,hint:N.description&&e(be,{text:N.description}),error:C,children:e(we,{value:S,onChange:(P)=>y((j)=>({...j,[N.name]:P})),autoComplete:"off",spellCheck:!1})},N.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-${a.key}`,"data-testid":"ws-try-disabled",children:["Open in the ",l.label]}),e("ul",{className:"ws-try-reason muted",id:`ws-try-reason-${a.key}`,"data-testid":"ws-try-reason",children:w.length>0?w.map((N)=>e("li",{children:N},N)):e("li",{children:l.noChannelReason?.(h??a.address)??t(n,{children:["The ",l.label," cannot open"," ",e("code",{children:h??a.address}),"."]})})})]}):t(oe,{to:k,className:"btn btn-primary","data-testid":"ws-try-link",children:["Open in the ",l.label]})]})})}function yr({doc:o,root:a,channel:l,limitsInfo:u,console:p,probe:y,address:h,pathBase:v}){let k=Qt(o,l.key),w=nr(o,l.key),N=l.messages.map((S)=>({slug:o.messages.find((P)=>P.key===S)?.slug??`message-${S}`,label:S}));return t("div",{className:"ws-pane","data-testid":`ws-pane-${l.slug}`,children:[t(G,{title:t(n,{children:[l.title," ",e(z,{tone:"info",children:"channel"})]}),children:[e(Ke,{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})},w.length>0&&{label:w.length===1?"Permission":"Permissions",value:e("span",{className:"ws-permissions",children:w.map((S)=>e(Xt,{action:S,probe:y},S))})}]}),l.description&&e(ie,{text:l.description})]}),l.parameters.length>0&&e(G,{title:"Parameters",children:t(Ie,{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((S)=>t("tr",{children:[e("td",{children:e("code",{children:`{${S.name}}`})}),e("td",{children:S.description&&e(be,{text:S.description})}),e("td",{"data-testid":`ws-parameter-schema-${S.name}`,children:S.schema?e(he,{schema:S.schema,root:a,label:`Schema of {${S.name}}`}):e("span",{className:"muted",children:"Any string"})})]},S.name))})]})}),e(G,{title:"Operations",children:e(Ue,{items:k.map((S)=>({slug:S.slug,label:`${S.action??"?"} ${S.key}`})),pathBase:v})}),e(G,{title:`Messages (${N.length})`,children:e(Ue,{items:N,pathBase:v})}),p!==void 0&&ar(l)&&e(qs,{doc:o,channel:l,console:p,address:h},l.key),l.isConnection&&o.limits&&e(Tt,{limits:o.limits,extensionKey:o.extensionKeys.limits,limitsInfo:u}),l.isConnection&&o.closeCodes.length>0&&e(Rt,{doc:o}),l.isConnection&&o.refusals.length>0&&e(Ot,{doc:o})]})}function hr(o,a){return a.map((l)=>({slug:o.messages.find((u)=>u.key===l)?.slug??`message-${l}`,label:l}))}function br({doc:o,operation:a,probe:l,pathBase:u}){let p=o.channels.find((h)=>h.key===a.channel),y=o.channels.find((h)=>h.key===a.reply?.channel);return t("div",{className:"ws-pane","data-testid":`ws-pane-${a.slug}`,children:[e(G,{title:t(n,{children:[a.title," ",e(z,{tone:"accent",children:"operation"})]}),children:e(Ke,{items:[{label:"Direction",value:a.action&&t("span",{"data-testid":"ws-operation-action",children:[e(z,{tone:a.action==="send"?"info":"success",children:a.action})," ",a.action==="send"?"client → server":"server → client"]})},{label:"Channel",value:p&&e(oe,{to:Fe(p.slug,"",u),children:e("code",{children:p.address})})},a.permission!==void 0&&{label:"Permission",value:e(Xt,{action:a.permission,probe:l})},a.summary!==void 0&&{label:"Summary",value:e(be,{text:a.summary})}]})}),e(G,{title:a.action==="send"?"Sends":"Receives",children:e(Ue,{items:hr(o,a.messages),pathBase:u})}),a.reply&&e(G,{title:"Reply",children:t("div",{"data-testid":"ws-operation-reply",children:[t("p",{className:"muted",children:["The server answers on"," ",y?e(oe,{to:Fe(y.slug,"",u),children:e("code",{children:y.address})}):e("code",{children:a.reply.channel??"?"})," ","with one of:"]}),e(Ue,{items:hr(o,a.reply.messages),pathBase:u})]})})]})}function vr({doc:o,root:a,message:l,console:u,pathBase:p}){let y=Zn(o,l.key),h=tr(o,l.key),v=l.event?lr(l.payload,a):void 0,k=u!==void 0&&l.event!==null?u.messageLink(l,o):null;return t("div",{className:"ws-pane","data-testid":`ws-pane-${l.slug}`,children:[e(G,{title:t(n,{children:[l.title??l.name," ",e(z,{tone:l.event?"success":"neutral",children:l.event?`${l.event.kind} event`:"control message"})]}),children:e(Ke,{items:[{label:"Name",value:e("code",{"data-testid":"ws-message-name",children:l.name})},l.summary!==void 0&&{label:"Summary",value:e(be,{text:l.summary})},l.contentType!==void 0&&{label:"Content type",value:e("code",{children:l.contentType})},{label:"Channels",value:e(Ue,{items:y.map((w)=>({slug:w.slug,label:w.address})),pathBase:p})},{label:"Operations",value:e(Ue,{items:h.map((w)=>({slug:w.slug,label:w.key})),pathBase:p})}]})}),l.event&&v!==void 0&&t(G,{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(Pt,{schema:v,root:a,label:`Payload of ${l.name}`})})]}),e(G,{title:l.event?"Full envelope":"Payload",children:e("div",{"data-testid":"ws-message-payload",children:e(Pt,{schema:l.payload,root:a,label:`Schema of ${l.name}`,depth:l.event?1:2})})}),l.examples.length>0&&e(G,{title:l.examples.length===1?"Example":"Examples",children:l.examples.map((w,N)=>e(Bs,{example:w,index:N,isEvent:l.event!==null},N))}),l.event&&u!==void 0&&e(G,{title:"Try it",children:!u.available?e(gr,{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 Bs({example:o,index:a,isEvent:l}){let u=o.name??`Example ${a+1}`,p=l?dr(o.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(xe,{text:()=>JSON.stringify(o.payload,null,2),label:"Copy JSON",ariaLabel:`Copy example ${u} as JSON`})]}),o.summary&&e("p",{className:"muted","data-testid":"ws-example-summary",children:e(be,{text:o.summary})}),p!==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(Xe,{value:p,label:`event.payload of ${u}`,expandDepth:4})]}),t("div",{"data-testid":"ws-example-frame",children:[p!==void 0&&e("p",{className:"muted",children:"The whole frame"}),e(Xe,{value:o.payload,label:`Example ${u}`,expandDepth:p!==void 0?1:2})]})]})}function js({groups:o,selected:a,query:l,onQuery:u,pathBase:p}){let y=Xn(o,l),h=T(null),v=()=>Array.from(h.current?.querySelectorAll("a.ws-nav-link")??[]),k=(w)=>{let N=xt(w.key,v(),document.activeElement);if(N)w.preventDefault(),N.focus()};return t("nav",{ref:h,className:"ws-sidebar","aria-label":"WebSocket reference",children:[e(Ce,{label:"Search",children:e(we,{type:"search",value:l,onChange:u,onKeyDown:(w)=>{let N=v()[0];if(w.key==="ArrowDown"&&N)w.preventDefault(),N.focus()},placeholder:"Channel, message, code…",...kt,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((w)=>t("section",{className:"ws-group","data-testid":`ws-group-${w.title}`,children:[e("h2",{className:"ws-group-title",children:w.title}),e("ul",{children:w.items.map((N)=>e("li",{children:t(oe,{to:Fe(N.slug,l,p),className:"ws-nav-link",activeMatch:"exact","data-selected":N.slug===a?"true":void 0,"data-testid":`ws-nav-${N.slug}`,children:[e("span",{className:"ws-nav-label",children:N.label}),N.hint&&e("span",{className:"ws-nav-hint",children:N.hint})]})},N.slug))})]},w.title))})]})}function Yt({document:o,extensions:a,defaultSubprotocol:l,limitsInfo:u,console:p,probe:y,address:h,pathBase:v=""}){let k={console:p,probe:y,address:h,pathBase:v},w=g(()=>Gn(o,{extensions:a,defaultSubprotocol:l}),[o,a,l]),N=g(()=>Qn(w),[w]),{item:S}=de(),[C,P]=nt("q"),j=w.channels.find((V)=>V.isConnection),L=S??j?.slug??w.channels[0]?.slug??"",O=Yn(w,L),F;if(O===null)F=e(ft,{title:"No such item",description:t(n,{children:["This document has nothing called ",e("code",{children:L}),"."," ",e(oe,{to:`${v}/ws`,children:"Back to the connection"}),"."]})});else switch(O.kind){case"channel":F=e(yr,{doc:w,root:o,channel:O.channel,limitsInfo:u,...k});break;case"operation":F=e(br,{doc:w,operation:O.operation,...k});break;case"message":F=e(vr,{doc:w,root:o,message:O.message,...k});break;case"limits":F=w.limits&&e(Tt,{limits:w.limits,extensionKey:w.extensionKeys.limits,limitsInfo:u});break;case"close-codes":F=e(Rt,{doc:w});break;case"upgrade-refusals":F=e(Ot,{doc:w});break}return t("div",{className:"screen ws-docs","data-testid":"ws-docs",children:[e(fr,{doc:w}),t("div",{className:"ws-overview",children:[e(pr,{doc:w}),e(mr,{doc:w})]}),t("div",{className:"ws-layout",children:[e(js,{groups:N,selected:O?L:"",query:C,onQuery:P,pathBase:v}),e("section",{className:"ws-main","aria-label":"Selected item","data-testid":"ws-main","data-selected":O?L:"",children:F})]})]})}function xr(o,a){let u=(/^https?:\/\//.test(o)?new URL(o).pathname:o).replace(/\/+$/,"");return u!==""&&a.startsWith(`${u}/`)?a.slice(u.length):a}var Ze={all:["docs"],openapi:(o)=>["docs","openapi",o],asyncapi:(o)=>["docs","asyncapi",o]};function wr(o,a,l){return o.request("GET",xr(o.base,a),{signal:l})}function kr(o,a,l){return o.request("GET",xr(o.base,a),{signal:l})}function Hs(o){return o===void 0?void 0:new ye({kind:o.kind,status:o.status,code:o.code,title:o.title,detail:o.detail,type:o.type,issues:o.issues,context:o.context,instance:o.instance})}function Fs(){let o=s(),a=pe(),l=m(),u=et(),p=J(),{docs:y}=l,h=y?.openapi,v=i({queryKey:Ze.openapi(h??""),queryFn:({signal:N})=>wr(o,h,N),enabled:h!==void 0,staleTime:1/0}),k=g(()=>({base:o.base,request:(N,S,C)=>o.request(N,S,C),requestRaw:async(N,S,C)=>{let P=await o.requestRaw(N,S,C);return{...P,error:Hs(P.error)}}}),[o]),w=g(()=>({version:1,title:a.title,basePath:a.basePath,assetsPath:a.assetsPath,documentUrl:h??"",csrfHeader:a.csrfHeader,extensions:["x-bun-common","x-bun-jobs"],theme:a.theme,unauthorized:null}),[a,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(v.isPending)return e("div",{className:"screen",children:e(f,{label:"Loading the OpenAPI document",showLabel:!0})});if(v.isError)return e("div",{className:"screen",children:e(x,{headingLevel:1,error:v.error,title:"Could not load the OpenAPI document",onRetry:()=>void v.refetch()})});return e(gt,{value:w,children:e(zt,{doc:v.data,pathBase:"/docs",client:k,probe:(N)=>u(N),readOnly:l.readOnly,onChanged:()=>void p.invalidateQueries({predicate:(N)=>N.queryKey[0]!==Ze.all[0]})})})}var Ks=new RegExp(wt),Us=`Letters, digits, "_", "." and "-" only (not "." or ".."), at most ${ht}.`,Nr={nameRule:(o,a)=>{if(o==="jobId")return null;return a.length<=ht&&Ks.test(a)?null:Us},patternText:{[wt]:'Letters, digits, "_", "." and "-" only (not "." or "..").'},escapeValue:(o,a)=>o==="jobId"?er(a):a};function Sr(o){return Ur.includes(o)}var Cr=Rn;function Pr(o,a,l){let u=vt(o,l);if(u===null)return null;let p=Vt(u),y=p.filter((v)=>a.includes(v)),h=new URLSearchParams({channel:o});if(y.length>0&&y.length<p.length)h.set("types",y.join(","));return`/events?${h.toString()}`}function Tr(o,a){return{available:a,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:o}),"."]}),channelLink:(l,u)=>Pr(l,u,o),messageLink:(l,u)=>{if(l.event===null)return null;let y=[l.event.kind==="queue"?"queues":l.event.kind==="worker"?"workers":"runners","all"].find((v)=>u.channels.some((k)=>k.key===v));if(y===void 0)return null;let h=new URLSearchParams({channel:y,types:l.event.type});return vt(y,o)===null?null:`/events?${h.toString()}`}}}var Rr={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 Js(){let o=s(),a=m(),l=et(),u=cr().some((w)=>w.id==="events"),{docs:p}=a,y=p?.asyncapi,h=i({queryKey:Ze.asyncapi(y??""),queryFn:({signal:w})=>kr(o,y,w),enabled:y!==void 0,staleTime:1/0}),v=g(()=>Tr(a.mode,u),[a.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(b,{to:"/docs",children:"Back to the API docs"})})]});else if(h.data)k=e(Yt,{document:h.data,defaultSubprotocol:Cr,limitsInfo:Rr,console:v,address:Nr,probe:(w)=>Sr(w)?l(w):void 0,pathBase:"/docs"});else if(h.error)k=t(n,{children:[e("h1",{className:"screen-title",children:"WebSocket API"}),e(x,{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(f,{label:"Loading the AsyncAPI document",showLabel:!0})})]});return e("div",{className:"screen ws-docs","data-testid":"ws-docs",children:k})}function $d(){let{docs:o}=m();return t("div",{className:"screen","data-testid":"docs-home",children:[e("h1",{className:"screen-title",children:"API docs"}),o===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(b,{to:"/docs/http",children:"Open the HTTP reference"})]}),o.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(b,{to:"/docs/ws",children:"Open the WebSocket reference"})]})]})]})}export{$d as DocsHomeScreen,Fs as HttpDocsScreen,Js as WsDocsScreen};
8
+
9
+ //# debugId=D1995604E6A6BEB364756E2164756E21
10
+ //# sourceMappingURL=index-y5zw06cs.js.map