diff --git a/README.md b/README.md index e8152fb..8e37a9a 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ hose-use version | `HOSE_AIPRO_LICENSE_FILE` | AI PRO 凭证文件路径(默认 `~/.config/hose-use/aipro-license.token`,0600) | | `HOSE_AIPRO_LICENSE_PRIVATE_KEY` / `HOSE_AIPRO_LICENSE_PRIVATE_FILE` | 仅签发方使用,客户端运行不需要 | -AI PRO 常驻服务启动后,浏览器打开 `http://127.0.0.1:8889/report` 即为本地 Web 控制台(Vue 单页、资源全内嵌、不依赖 CDN)。前端源码在 `web/`,构建产物由 `bun run web:build` 生成并内嵌进二进制。 +AI PRO 常驻服务启动后,浏览器打开 `http://127.0.0.1:8889/report` 即为本地 Web 控制台(Vue 单页、资源全内嵌、不依赖 CDN)。前端源码在 `web/`,构建产物由 `bun run web:build` 生成并内嵌进二进制。`GET /docs` 的交互式 API 文档同样全离线——Scalar 运行时由 `GET /static/scalar.js` 本地提供,仅在升级版本时才需要 `bun run docs:fetch` 联网刷新。 --- diff --git a/package.json b/package.json index 126fd2a..dce7a75 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "openapi:bundle": "bun run scripts/generate/bundle-openapi.ts", "openapi:generate-raw": "bun run scripts/generate/generate-raw-openapi.ts", "openapi:all": "bun run scripts/generate/generate-raw-openapi.ts && bun run scripts/generate/bundle-openapi.ts", + "docs:fetch": "node scripts/build/build-docs.mjs", "web:dev": "bun --cwd web run dev", "web:build": "node scripts/build/build-webui.mjs", "build:binary": "node scripts/build/build-binary.mjs", diff --git a/scripts/build/README.build.md b/scripts/build/README.build.md index 2a85cff..547537e 100644 --- a/scripts/build/README.build.md +++ b/scripts/build/README.build.md @@ -6,6 +6,7 @@ | `build-plugin.mjs` | 打包 `dist/mcp/server.js`(MCP 单文件产物) | | `package-plugin.mjs` | 生成 `dist/bin/hose-use-plugin-v<版本>.tar.gz` 完整插件包 | | `build-webui.mjs` | 构建 `web/` 的 Vue 控制台,把 JS/CSS 内联成 `src/packaging/generated/webui.txt` 供二进制内嵌 | +| `build-docs.mjs` | 拉取固定版本 Scalar standalone 并校验 SHA-256,生成 `src/packaging/generated/scalar-standalone.js.txt` | `build-webui.mjs` 需要开发机先执行 `bun install --cwd web`;生成物随 git 提交,CI 与编译二进制不需要前端依赖。其余三个脚本只依赖根仓库的 `bun install`。 diff --git a/scripts/build/build-docs.mjs b/scripts/build/build-docs.mjs new file mode 100644 index 0000000..2188ffb --- /dev/null +++ b/scripts/build/build-docs.mjs @@ -0,0 +1,39 @@ +#!/usr/bin/env node +/** + * 刷新 /docs 页面使用的 Scalar 浏览器运行时。 + * + * 固定版本 + SHA-256 校验,产物写到 src/packaging/generated/ 并随 git 提交, + * 因此运行时完全离线,编译二进制与 CI 都不需要访问 CDN。 + * 用法:bun run docs:fetch(仅在升级 Scalar 版本时需要) + */ +import { createHash } from "node:crypto"; +import { mkdirSync, writeFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; + +const SCALAR_VERSION = "1.25.101"; +const SOURCE = `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${SCALAR_VERSION}/dist/browser/standalone.js`; +const EXPECTED_SHA256 = "045c6a1ffa88167ea7f8adb8359cdfe2d2233faead3ebe1d2ec0b1e7975d3fdc"; + +const root = resolve(import.meta.dirname, "../.."); +const target = join(root, "src", "packaging", "generated", "scalar-standalone.js.txt"); + +console.log(`[build:docs] fetching @scalar/api-reference@${SCALAR_VERSION} ...`); +const response = await fetch(SOURCE); +if (!response.ok) { + console.error(`[build:docs] 下载失败: HTTP ${response.status}`); + process.exit(1); +} + +const bytes = Buffer.from(await response.arrayBuffer()); +const actual = createHash("sha256").update(bytes).digest("hex"); +if (actual !== EXPECTED_SHA256) { + console.error(`[build:docs] SHA-256 不匹配,拒绝写入`); + console.error(` expected=${EXPECTED_SHA256}`); + console.error(` actual =${actual}`); + process.exit(1); +} + +// 后缀 .txt:Bun 对 .js 的 text import 可能被当成模块;内容仍是完整 JS。 +mkdirSync(dirname(target), { recursive: true }); +writeFileSync(target, bytes); +console.log(`[build:docs] ✓ ${target} (${(bytes.length / 1024 / 1024).toFixed(2)} MiB, sha256 ${actual.slice(0, 12)}…)`); diff --git a/src/http/docs.test.ts b/src/http/docs.test.ts new file mode 100644 index 0000000..10a2a92 --- /dev/null +++ b/src/http/docs.test.ts @@ -0,0 +1,49 @@ +import { describe, expect, test } from "bun:test"; +import { renderDocsHtml } from "./docs.js"; +import { handleHttpRequest } from "./routes.js"; +import { getScalarStandaloneJs } from "../packaging/embedded-docs.js"; + +describe("离线 API 文档", () => { + test("HTML 不引用任何 CDN,指向本地路由", () => { + const html = renderDocsHtml(); + expect(html).toContain('src="/static/scalar.js"'); + expect(html).toContain('data-url="/openapi.json"'); + expect(html).toContain('id="api-reference"'); + expect(html).not.toContain("cdn.jsdelivr.net"); + expect(html).not.toMatch(/src="https?:\/\//); + expect(html).toContain("connect-src 'self'"); + expect(html).toContain("Content-Security-Policy"); + }); + + test("内嵌运行时是完整的 Scalar standalone", () => { + const js = getScalarStandaloneJs(); + expect(js.length).toBeGreaterThan(1_000_000); + expect(js).toContain("Scalar"); + expect(js).not.toContain(""); + }); + + test("GET /static/scalar.js 返回 JS 且与内嵌产物一致", async () => { + let status = 0; + let headers: Record = {}; + let body = ""; + const res = { + setHeader: (key: string, value: unknown) => { headers[key] = String(value); }, + writeHead: (code: number, next: Record) => { + status = code; + headers = { ...headers, ...next }; + }, + end: (value?: string) => { body = value ?? ""; }, + headersSent: false, + }; + + await handleHttpRequest( + { method: "GET", url: "/static/scalar.js", headers: { host: "localhost" } } as never, + res as never, + { app: "hose-use" } + ); + + expect(status).toBe(200); + expect(headers["Content-Type"]).toContain("application/javascript"); + expect(body).toBe(getScalarStandaloneJs()); + }); +}); diff --git a/src/http/docs.ts b/src/http/docs.ts index a422545..a23c4b6 100644 --- a/src/http/docs.ts +++ b/src/http/docs.ts @@ -6,6 +6,8 @@ export function renderDocsHtml(): string { + + hose-use API Reference (v${VERSION}) `));return(e,t)=>{var n,r +;return ei(),oi(Wa,null,[ui("div",{innerHTML:I.value},null,8,hbe),ui("div",{ +ref_key:"documentEl",ref:i, +class:it(["scalar-app scalar-api-reference references-layout",[{ +"scalar-scrollbars-obtrusive":s.value, +"references-editable":e.configuration.isEditable, +"references-sidebar":e.configuration.showSidebar, +"references-sidebar-mobile-open":Vn(u), +"references-classic":"classic"===e.configuration.layout},e.$attrs.class]]), +style:tt({"--scalar-y-offset":`var(--scalar-custom-header-height, ${E.value}px)` +}),onScrollPassive:t[4]||(t[4]=(...e)=>Vn(C)&&Vn(C)(...e)) +},[ui("div",fbe,[$o(e.$slots,"header",st(pi(A.value)),void 0,!0)]),e.configuration.showSidebar?(ei(), +oi("aside",mbe,[ui("div",gbe,[di(Vn(H0),null,{default:Ar((()=>[di(Vn(pbe),{ +operationsSorter:e.configuration.operationsSorter,parsedSpec:e.parsedSpec, +tagsSorter:e.configuration.tagsSorter},{ +"sidebar-start":Ar((()=>[$o(e.$slots,"sidebar-start",st(pi(A.value)),void 0,!0)])), +"sidebar-end":Ar((()=>[$o(e.$slots,"sidebar-end",st(pi(A.value)),void 0,!0)])), +_:3},8,["operationsSorter","parsedSpec","tagsSorter"])])),_:3 +})])])):gi("",!0),Pr(ui("div",vbe,[ui("div",bbe,[$o(e.$slots,"editor",st(pi(A.value)),void 0,!0)])],512),[[hs,e.configuration.isEditable]]),T.value?(ei(), +oi(Wa,{key:1},[ui("section",{ +"aria-label":`Open API Documentation for ${null==(n=e.parsedSpec.info)?void 0:n.title}`, +class:"references-rendered"},[di(Vn(Vve),{ +baseServerURL:e.configuration.baseServerURL,layout:e.configuration.layout, +parsedSpec:e.parsedSpec,servers:e.configuration.servers},Ro({ +start:Ar((()=>[$o(e.$slots,"content-start",st(pi(A.value)),void 0,!0)])), +end:Ar((()=>[$o(e.$slots,"content-end",st(pi(A.value)),void 0,!0)])),_:2 +},[(null==(r=e.configuration)?void 0:r.isEditable)?{name:"empty-state", +fn:Ar((()=>{var n;return[di(Jve,{ +theme:(null==(n=e.configuration)?void 0:n.theme)||"default", +onChangeTheme:t[0]||(t[0]=t=>e.$emit("changeTheme",t)), +onLinkSwaggerFile:t[1]||(t[1]=t=>e.$emit("linkSwaggerFile")), +onLoadSwaggerFile:t[2]||(t[2]=t=>e.$emit("loadSwaggerFile")), +onUpdateContent:t[3]||(t[3]=t=>e.$emit("updateContent",t))},null,8,["theme"])] +})),key:"0" +}:void 0]),1032,["baseServerURL","layout","parsedSpec","servers"])],8,ybe),e.$slots.footer?(ei(), +oi("div",Obe,[$o(e.$slots,"footer",st(pi(A.value)),void 0,!0)])):gi("",!0)],64)):gi("",!0),di(Vn(A3),{ +configuration:e.configuration},null,8,["configuration"])],38),di(Vn(ZU))],64)}} +}),xbe=mhe(wbe,[["__scopeId","data-v-2bc622ac"]]),kbe={ +class:"references-classic-header-container"},Sbe={ +class:"references-classic-header"};const _be=mhe({},[["render",function(e,t){ +return ei(), +oi("div",kbe,[ui("div",Sbe,[$o(e.$slots,"default",{},void 0,!0),$o(e.$slots,"dark-mode-toggle",{},void 0,!0)])]) +}],["__scopeId","data-v-a860f78f"]]),Ebe={class:"darklight-reference-switch" +},Tbe=["aria-pressed"],Cbe=mhe(no({__name:"DarkModeToggle",props:{isDarkMode:{ +type:Boolean},hideDarkModeToggle:{type:Boolean}},emits:["toggleDarkMode"], +setup:e=>(e,t)=>(ei(),oi("div",Ebe,[t[2]||(t[2]=ui("a",{ +class:"darklight-reference-promo",href:"https://www.scalar.com",target:"_blank" +}," Powered by Scalar ",-1)),e.hideDarkModeToggle?gi("",!0):(ei(),oi("button",{ +key:0,"aria-label":"Toggle dark mode","aria-pressed":e.isDarkMode, +class:it(["darklight",{darklight_dark:e.isDarkMode}]),type:"button", +onClick:t[0]||(t[0]=t=>e.$emit("toggleDarkMode")) +},t[1]||(t[1]=[mi('
',1)]),10,Tbe))])) +}),[["__scopeId","data-v-4eddf114"]]),Abe=mhe(no({__name:"DarkModeIconToggle", +props:{isDarkMode:{type:Boolean}},emits:["toggleDarkMode"], +setup:e=>(e,t)=>(ei(),oi("button",{class:"darklight",type:"button", +onClick:t[0]||(t[0]=t=>e.$emit("toggleDarkMode"))},[di(Vn(oY),{ +icon:e.isDarkMode?"DarkMode":"LightMode"},null,8,["icon"]),di(yfe,null,{ +default:Ar((()=>[fi(" Switch to "+ht(e.isDarkMode?"Light":"Dark")+" Mode ",1)])), +_:1})]))}),[["__scopeId","data-v-3d47eee0"]]);function Pbe(e){var t,n,r;try{ +const o=null==(r=null==(n=null==(t=null==e?void 0:e.information)?void 0:t.requestBody)?void 0:n.content)?void 0:r["application/json"] +;if(!o)throw new Error("Body not found");return function(e){var t +;const n=["Body"],r=null==(t=null==e?void 0:e.schema)?void 0:t.properties +;return r&&Object.keys(r).forEach((t=>{if(!e.schema)return;n.push(function(e,t){ +let n=e +;return n+=t.required&&t.required.includes(e)?" REQUIRED ":" optional ",t.properties[e]&&(n+=t.properties[e].type, +t.properties[e].description&&(n+=" "+t.properties[e].description)),n +}(t,e.schema));const o=r[t] +;"object"===o.type&&o.properties&&o.properties&&Object.keys(o.properties).forEach((e=>{ +var t,r +;n.push(`${e} ${null==(r=null==(t=o.properties)?void 0:t[e])?void 0:r.type}`)})) +})),n}(o)}catch(o){return!1}}const Dbe={class:"sr-only"},Rbe={class:"sr-only" +},$be=mhe(no({__name:"SearchModal",props:{parsedSpec:{},modalState:{}},setup(e){ +const t=e,n=tr(t,"parsedSpec"),r=ND(),o=`${r}-search-result`,a=`${r}-search-instructions`,i=e=>`${r}${e}`,{resetSearch:s,fuseSearch:l,selectedSearchResult:c,searchResultsWithPlaceholderResults:u,searchText:d}=function({specification:e}){ +const{getHeadingId:t,getWebhookId:n,getModelId:r,getOperationId:o,getTagId:a}=U$(),{hideModels:i}=dN(),s=Fn([]),l=Fn([]),c=Fn(0),u=Fn(""),d=new fpe(s.value,{ +keys:["title","description","body"]}),p=()=>{c.value=0,l.value=d.search(u.value) +};Ma(u,(e=>{e.length?p():l.value=[]})) +;const h=Bi((()=>0===u.value.length?s.value.slice(0,25).map((e=>({item:e +}))):l.value.slice(0,25)));return Ma(e.value,(async()=>{var l,c,u,p,h,f,m,g,v +;if(s.value=[], +!(null==(c=null==(l=e.value)?void 0:l.tags)?void 0:c.length)&&!(null==(p=null==(u=e.value)?void 0:u.webhooks)?void 0:p.length))return void d.setCollection([]) +;const b=[],y=WT((null==(f=null==(h=e.value)?void 0:h.info)?void 0:f.description)??"") +;y.length&&(y.forEach((e=>{b.push({type:"heading",title:`Info > ${e.value}`, +description:"",href:`#${t(e)}`,tag:e.slug,body:""}) +})),s.value=s.value.concat(b)), +null==(g=null==(m=e.value)?void 0:m.tags)||g.forEach((e=>{const t={ +title:e["x-displayName"]??e.name,href:`#${a(e)}`,description:e.description, +type:"tag",tag:e.name,body:""} +;s.value.push(t),e.operations&&e.operations.forEach((t=>{ +const{parameterMap:n}=Q$(t),r=Pbe(t)||n.value;let a=null +;"boolean"!=typeof r&&(a=r);const i={type:"req",title:t.name??t.path, +href:`#${o(t,e)}`,operationId:t.operationId,description:t.description??"", +httpVerb:t.httpVerb,path:t.path,tag:e.name,operation:t} +;a&&(i.body=a),s.value.push(i)}))})) +;const O=null==(v=e.value)?void 0:v.webhooks,w=[] +;O&&Object.keys(O).forEach((e=>{Object.keys(O[e]).forEach((t=>{var r;w.push({ +type:"webhook",title:`Webhook: ${null==(r=O[e][t])?void 0:r.name}`, +href:`#${n(e,t)}`,description:e,httpVerb:t,tag:e,body:""}) +})),s.value=s.value.concat(w)}));const x=i.value?{}:GT(e.value),k=[] +;x&&(Object.keys(x).forEach((e=>{k.push({type:"model",title:"Model", +href:`#${r(e)}`,description:x[e].title??e,tag:e,body:""}) +})),s.value=s.value.concat(k)),d.setCollection(s.value)}),{immediate:!0}),{ +resetSearch:function(){u.value="",c.value=0,l.value=[]},fuseSearch:p, +selectedSearchResult:c,searchResultsWithPlaceholderResults:h,searchText:u}}({ +specification:n}),p={heading:"DocsPage",model:"Brackets",req:"Terminal", +tag:"CodeFolder",webhook:"Terminal"},h={heading:"Document Heading",model:"", +req:"Request",tag:"Tag",webhook:"Webhook"},f=Fn(null) +;Ma((()=>t.modalState.open),(e=>{e&&s()})) +;const{setCollapsedSidebarItem:m}=dN(),g=/#(tag\/[^/]*)/;function v(e){ +let n="models";const r=e.item.href.match(g) +;(null==r?void 0:r.length)&&r.length>1&&(n=r[1]),m(n,!0) +;const o=e.item.href.replace("#","") +;if(document.getElementById(o))w$(o),t.modalState.hide();else{ +const e=q$.on((n=>{n.id===o&&(w$(o),e(),t.modalState.hide())}))}}Ma(c,(e=>{var t +;const n=u.value[e],r=i(null==n?void 0:n.item.href) +;null==(t=document.getElementById(r))||t.scrollIntoView({behavior:"smooth", +block:"nearest"})}));const b=Bi((()=>{const e=c.value,t=u.value[e] +;return i(null==t?void 0:t.item.href)})),y=e=>{ +const t="up"===e?-1:1,n=u.value.length,r=(c.value+t+n)%n;c.value=r} +;function O(e){const t=new URL(window.location.href) +;return t.hash=e,t.toString()}return(e,t)=>(ei(),ai(Vn(k1),{state:e.modalState, +variant:"search", +onKeydown:[t[1]||(t[1]=Ys(Xs((e=>y("down")),["stop","prevent"]),["down"])),t[2]||(t[2]=Ys(Xs((e=>v(Vn(u)[Vn(c)])),["stop","prevent"]),["enter"])),t[3]||(t[3]=Ys(Xs((e=>y("up")),["stop","prevent"]),["up"]))] +},{default:Ar((()=>[ui("div",{ref_key:"searchModalRef",ref:f, +"aria-label":"Reference Search",class:"ref-search-container",role:"search" +},[di(Vn(E1),{modelValue:Vn(d), +"onUpdate:modelValue":t[0]||(t[0]=e=>Qn(d)?d.value=e:null), +"aria-activedescendant":b.value,"aria-controls":o,"aria-describedby":a, +onInput:Vn(l) +},null,8,["modelValue","aria-activedescendant","onInput"])],512),di(Vn(t1),{ +id:o,"aria-describedby":a,"aria-label":"Reference Search Results", +class:"ref-search-results custom-scroll",noResults:!Vn(u).length},{ +query:Ar((()=>[fi(ht(Vn(d)),1)])), +default:Ar((()=>[(ei(!0),oi(Wa,null,Do(Vn(u),((e,n)=>(ei(),ai(Vn(c1),{ +id:i(e.item.href),key:e.refIndex,active:Vn(c)===n,href:O(e.item.href), +icon:p[e.item.type],onClick:t=>v(e),onFocus:e=>c.value=n},Ro({default:Ar((()=>{ +var n,r,o,a;return[ui("span",{class:it({ +deprecated:null==(r=null==(n=e.item.operation)?void 0:n.information)?void 0:r.deprecated +}) +},[ui("span",Dbe,[fi(ht(h[e.item.type])+":  ",1),(null==(a=null==(o=e.item.operation)?void 0:o.information)?void 0:a.deprecated)?(ei(), +oi(Wa,{key:0 +},[fi(" (Deprecated)  ")],64)):gi("",!0)]),fi(" "+ht(e.item.title)+" ",1),t[4]||(t[4]=ui("span",{ +class:"sr-only"},",",-1))],2)]})),_:2 +},[(e.item.httpVerb||e.item.path)&&e.item.path!==e.item.title?{ +name:"description",fn:Ar((()=>[t[5]||(t[5]=ui("span",{class:"sr-only" +},"Path: ",-1)),fi(" "+ht(e.item.path),1)])),key:"0"}:e.item.description?{ +name:"description",fn:Ar((()=>[t[6]||(t[6]=ui("span",{class:"sr-only" +},"Description: ",-1)),fi(" "+ht(e.item.description),1)])),key:"1" +}:void 0,"req"===e.item.type?{name:"addon",fn:Ar((()=>[di(ebe,{ +"aria-hidden":"true",method:e.item.httpVerb??"get" +},null,8,["method"]),ui("span",Rbe," HTTP Method: "+ht(e.item.httpVerb??"get")+", ",1)])), +key:"2" +}:void 0]),1032,["id","active","href","icon","onClick","onFocus"])))),128))])), +_:1},8,["noResults"]),t[7]||(t[7]=ui("div",{class:"ref-search-meta" +},[ui("span",null,"↑↓ Navigate"),ui("span",null,"⏎ Select")],-1)),ui("div",{ +id:a,class:"sr-only" +}," Press up arrow / down arrow to navigate, enter to select, type to filter results ")])), +_:1},8,["state"]))}}),[["__scopeId","data-v-829b4762"]]),Nbe={ +class:"sidebar-search-input"},Mbe={class:"sidebar-search-shortcut"},Ibe={ +class:"sidebar-search-key"},Lbe=no({__name:"SearchButton",props:{spec:{}, +searchHotKey:{default:"k"}},setup(e){const t=e,n=w1(),{client:r}=C3(),o=e=>{ +var o +;(KT()?e.metaKey:e.ctrlKey)&&e.key===t.searchHotKey&&!(null==(o=r.value)?void 0:o.modalState.open)&&(e.preventDefault(), +e.stopPropagation(),n.open?n.hide():n.show())} +;return go((()=>window.addEventListener("keydown",o))), +yo((()=>window.removeEventListener("keydown",o))), +(e,t)=>(ei(),oi(Wa,null,[ui("button",{ +class:it(["sidebar-search",e.$attrs.class]),type:"button", +onClick:t[0]||(t[0]=(...e)=>Vn(n).show&&Vn(n).show(...e))},[di(Vn(oY),{ +class:"scalar-search-icon",icon:"Search",size:"sm",thickness:"2.5" +}),ui("div",Nbe,[t[2]||(t[2]=ui("span",{class:"sr-only" +},"Open ",-1)),t[3]||(t[3]=ui("span",{class:"sidebar-search-placeholder" +},"Search",-1)),ui("span",Mbe,[t[1]||(t[1]=ui("span",{class:"sr-only" +},"(Keyboard Shortcut)",-1)),ui("kbd",Ibe,ht(Vn(KT)()?"⌘":"⌃")+ht(e.searchHotKey),1)])])],2),di($be,{ +modalState:Vn(n),parsedSpec:e.spec},null,8,["modalState","parsedSpec"])],64))} +}),jbe=mhe(Lbe,[["__scopeId","data-v-9f0bd6b4"]]),Bbe=no({ +__name:"ClassicLayout",props:{configuration:{},parsedSpec:{},rawSpec:{},isDark:{ +type:Boolean}},emits:["toggleDarkMode","updateContent"],setup(e){ +const t=e,n=Uo(),r=Bi((()=>({...t.configuration,showSidebar:!1}))) +;return(e,o)=>(ei(),ai(xbe,{configuration:r.value,parsedSpec:e.parsedSpec, +rawSpec:e.rawSpec,onUpdateContent:o[1]||(o[1]=t=>e.$emit("updateContent",t)) +},Ro({"content-start":Ar((({spec:n})=>[di(_be,null,{ +"dark-mode-toggle":Ar((()=>[t.configuration.hideDarkModeToggle?gi("",!0):(ei(), +ai(Vn(Abe),{key:0,isDarkMode:e.isDark, +onToggleDarkMode:o[0]||(o[0]=t=>e.$emit("toggleDarkMode")) +},null,8,["isDarkMode"]))])), +default:Ar((()=>[t.configuration.hideSearch?gi("",!0):(ei(),ai(Vn(jbe),{key:0, +class:"t-doc__sidebar",searchHotKey:r.value.searchHotKey,spec:n +},null,8,["searchHotKey","spec"]))])),_:2},1024)])),_:2},[Do(n,((t,n)=>({name:n, +fn:Ar((t=>[$o(e.$slots,n,st(pi(t||{})))])) +})))]),1032,["configuration","parsedSpec","rawSpec"]))}}),Ube=["href"],Qbe=no({ +__name:"OpenApiClientButton",props:{buttonSource:{},source:{ +default:"api-reference"},isDevelopment:{type:Boolean},integration:{},url:{}}, +setup(e){const t=Bi((()=>{const t=((e,t)=>{var n +;if(!e||e.startsWith("http://")||e.startsWith("https://")||"undefined"==typeof window&&!t)return e +;const r=null==(n=window.location.href.split("?")[0])?void 0:n.split("#")[0],o=(null==r?void 0:r.endsWith("/"))?r:null==r?void 0:r.substring(0,(null==r?void 0:r.lastIndexOf("/"))+1) +;return new URL(e,o).toString() +})(e.url??(typeof window<"u"?window.location.href:void 0)) +;if(null==t||!t.length)return +;const n=new URL(e.isDevelopment?"http://localhost:5065":"https://client.scalar.com") +;if(n.searchParams.set("url",t), +null!==e.integration&&n.searchParams.set("integration",e.integration??"vue"), +n.searchParams.set("utm_source","api-reference"), +n.searchParams.set("utm_medium","button"), +n.searchParams.set("utm_campaign",e.buttonSource),"gitbook"===e.source){ +n.searchParams.set("utm_source","gitbook") +;const e=document.querySelector("img.dark\\:block[alt='Logo']"),t=document.querySelector("img.dark\\:hidden[alt='Logo']") +;e&&e instanceof HTMLImageElement&&n.searchParams.set("dark_logo",encodeURIComponent(e.src)), +t&&t instanceof HTMLImageElement&&n.searchParams.set("light_logo",encodeURIComponent(t.src)) +}return n.toString()}));return(e,n)=>t.value?(ei(),oi("a",{key:0, +class:"open-api-client-button",href:t.value,target:"_blank"},[di(Vn(oY),{ +icon:"ExternalLink",size:"xs",thickness:"2.5" +}),n[0]||(n[0]=fi(" Open API Client "))],8,Ube)):gi("",!0)} +}),Fbe=g3(Qbe,[["__scopeId","data-v-2e9f75f1"]]),zbe=no({__name:"HttpMethod", +props:{isSquare:{type:Boolean,default:!1},method:{},isEditable:{type:Boolean, +default:!1}},emits:["change"],setup(e,{emit:t}){ +const n=e,r=t,o=Bi((()=>kR(n.method))),a=Object.entries(OR).map((([e])=>({id:e, +label:e.toUpperCase(),color:kR(e).color}))),i=Bi({ +get:()=>a.find((({id:e})=>e===n.method)), +set:e=>(null==e?void 0:e.id)&&r("change",e.id)}),s=EB({ +base:"text-center font-code text-3xs justify-center items-center flex", +variants:{isSquare:{ +true:"px-2.5 whitespace-nowrap font-bold border-r h-fit m-auto", +false:"rounded-full"},isEditable:{ +true:"http-bg-gradient rounded-md border-1/2 border-r-1/2",false:"cursor-auto"}} +}),l=Bi((()=>o.value.short));return(e,t)=>e.isEditable?(ei(),ai(Vn(Y0),{key:0, +modelValue:i.value,"onUpdate:modelValue":t[0]||(t[0]=e=>i.value=e), +class:"mt-1 font-code text-sm scalar-client",options:Vn(a)},{ +default:Ar((()=>[ui("div",{class:it(["h-full",{ +"pointer-events-none":!e.isEditable}])},[ui("button",{ +class:it(["relative h-full",Vn(TB)(Vn(s)({isSquare:e.isSquare, +isEditable:e.isEditable}),o.value.color)]),type:"button" +},[ui("span",null,ht(l.value),1)],2)],2)])),_:1 +},8,["modelValue","options"])):(ei(),oi("div",{key:1, +class:it(["relative gap-1 whitespace-nowrap",Vn(TB)(Vn(s)({isSquare:e.isSquare, +isEditable:e.isEditable}),o.value.color)]),type:"button"},ht(o.value.short),3))} +}),qbe=g3(zbe,[["__scopeId","data-v-46723816"]]),Hbe={100:{color:"text-yellow"}, +200:{color:"text-green"},202:{color:"text-green"},300:{color:"text-blue"},304:{ +color:"text-blue"},400:{color:"text-red"},401:{color:"text-orange"},422:{ +color:"text-yellow"},423:{color:"text-purple"},505:{color:"text-orange"} +},Vbe=e=>Hbe[e]||{color:"text-grey"},Zbe={class:"min-w-0"},Wbe={ +class:"min-w-0 truncate text-c-1"},Xbe=no({__name:"AddressBarHistory",props:{ +open:{type:Boolean}},setup(e){ +const{activeRequest:t}=q1(),{requestHistory:n,requestExampleMutators:r}=M1(),o=o3(),a=Bi((()=>n.filter((e=>{ +var n;return e.request.requestUid===(null==(n=t.value)?void 0:n.uid) +})).slice().reverse()));return(e,n)=>{var i +;return ei(),oi(Wa,null,[null!=(i=a.value)&&i.length?(ei(),ai(Vn(BI),{key:0, +class:"addressbar-history-button mr-1 rounded-lg p-1.5 text-c-3 focus:text-c-1" +},{default:Ar((()=>[di(Vn(oY),{icon:"History",size:"sm",thickness:"2.25"})])), +_:1})):gi("",!0),ui("div",{ +class:it(["absolute bg-white left-0 top-8 w-full rounded-lg before:pointer-events-none before:absolute before:left-0 before:-top-8 before:h-[calc(100%+32px)] before:w-full before:rounded-lg z-context",{ +"before:shadow-lg":e.open}])},[di(Vn(UI),{ +class:"bg-b-1 border-t custom-scroll max-h-[300px] rounded-b-lg p-[3px] grid grid-cols-[44px,1fr,repeat(3,auto)] items-center" +},{default:Ar((()=>[(ei(!0),oi(Wa,null,Do(a.value,((e,n)=>(ei(),ai(Vn(QI),{ +key:n, +class:"contents font-code text-sm *:rounded-none first:*:rounded-l last:*:rounded-r *:h-8 *:ui-active:bg-b-2 *:flex *:items-center *:cursor-pointer *:px-1.5 text-c-2 font-medium", +value:n,onClick:n=>function(e){var n +;const a=o.currentRoute.value.params.workspace +;(null==(n=t.value)?void 0:n.uid)!==e.request.requestUid&&o.push(`/workspace/${a}/request/${e.request.requestUid}`), +r.set({...e.request})}(e)},{default:Ar((()=>{var t +;return[e.response.method?(ei(),ai(qbe,{key:0,class:"text-[11px]", +method:e.response.method +},null,8,["method"])):gi("",!0),ui("div",Zbe,[ui("div",Wbe,ht(e.response.path),1)]),ui("div",null,ht(Vn(Rfe)(e.response.duration)),1),ui("div",{ +class:it([Vn(Vbe)(e.response.status).color]) +},ht(e.response.status),3),ui("div",null,ht(null==(t=Vn(_R)[e.response.status])?void 0:t.name),1)] +})),_:2},1032,["value","onClick"])))),128))])),_:1})],2)],64)}} +}),Gbe=g3(Xbe,[["__scopeId","data-v-69d275b6"]]),Ybe={ +class:"whitespace-nowrap text-ellipsis overflow-hidden"},Kbe=no({ +__name:"AddressBarServerItem",props:{serverOption:{},type:{}},setup(e){ +const t=e,{activeCollection:n,activeRequest:r,activeServer:o}=q1(),{collectionMutators:a,requestMutators:i}=M1(),s=e=>{ +var t;return(null==(t=o.value)?void 0:t.uid)===e};return(e,o)=>(ei(),ai(Vn(y1),{ +key:"serverOption.id", +class:"flex gap-1.5 group/item items-center whitespace-nowrap text-ellipsis overflow-hidden w-full", +value:e.serverOption.id,onClick:o[0]||(o[0]=o=>(e=>{var o,s +;"collection"===t.type&&n.value?(null!=(s=null==(o=r.value)?void 0:o.servers)&&s.length&&(r.value.selectedServerUid=""), +a.edit(n.value.uid,"selectedServerUid",e)):"request"===t.type&&r.value&&i.edit(r.value.uid,"selectedServerUid",e) +})(e.serverOption.id))},{default:Ar((()=>[ui("div",{ +class:it(["flex size-4 items-center justify-center p-0.75 text-b-1 rounded-full",s(e.serverOption.id)?"bg-c-accent text-b-1":"group-hover/item:shadow-border text-transparent"]) +},[di(Vn(oY),{icon:"Checkmark",size:"xs",thickness:"2.5" +})],2),ui("span",Ybe,ht(e.serverOption.label),1)])),_:1},8,["value"]))}}),Jbe={ +class:"font-code lg:text-sm text-xs whitespace-nowrap border border-b-3 border-solid rounded px-1.5 py-0.5 text-c-2 -outline-offset-1", +type:"button"},eye={key:0,class:"text-xxs text-c-2 px-2.5 py-1"},tye={ +class:"flex items-center justify-center h-4 w-4"},nye=no({ +__name:"AddressBarServer",setup(e){ +const{activeRequest:t,activeCollection:n,activeServer:r}=q1(),{isReadOnly:o,servers:a,collectionMutators:i,events:s}=M1(),l=Bi((()=>{ +var e,n;return null==(n=null==(e=t.value)?void 0:e.servers)?void 0:n.map((e=>{ +var t;return{id:e,label:(null==(t=a[e])?void 0:t.url)??"Unknown server"}})) +})),c=Bi((()=>{var e,r +;return null==(r=null==(e=n.value)?void 0:e.servers)?void 0:r.filter((e=>{ +var n,r;return!(null!=(r=null==(n=t.value)?void 0:n.servers)&&r.includes(e)) +})).map((e=>{var t;return{id:e, +label:(null==(t=a[e])?void 0:t.url)??"Unknown server"}}))})),u=Bi((()=>{var e,t +;return(null==(e=l.value)?void 0:e.length)&&(null==(t=c.value)?void 0:t.length) +}));Ma([n,t],(([e,t])=>{var n +;if(!e||e.selectedServerUid||null!=t&&t.selectedServerUid)return +;const r=null==(n=e.servers)?void 0:n[0];r&&i.edit(e.uid,"selectedServerUid",r) +}));const d=()=>s.commandPalette.emit({commandName:"Add Server"}),p=Bi((()=>{ +var e,t,n +;return null!=(t=null==(e=r.value)?void 0:e.url)&&t.endsWith("/")?r.value.url.slice(0,-1):(null==(n=r.value)?void 0:n.url)||"" +}));return(e,t)=>(ei(),ai(Vn(F0),{class:"w-max",teleport:""},{ +items:Ar((()=>[u.value?(ei(), +oi("div",eye," Request ")):gi("",!0),(ei(!0),oi(Wa,null,Do(l.value,(e=>(ei(), +ai(Kbe,{key:e.id,serverOption:e,type:"request" +},null,8,["serverOption"])))),128)),u.value?(ei(),oi(Wa,{key:1 +},[di(Vn(m1)),t[1]||(t[1]=ui("div",{class:"text-xxs text-c-2 px-2.5 py-1" +},"Collection",-1))],64)):gi("",!0),(ei(!0), +oi(Wa,null,Do(c.value,(e=>(ei(),ai(Kbe,{key:e.id,serverOption:e, +type:"collection" +},null,8,["serverOption"])))),128)),Vn(o)?gi("",!0):(ei(),oi(Wa,{key:2 +},[di(Vn(m1)),di(Vn(y1),null,{default:Ar((()=>[ui("div",{ +class:"font-code text-xxs flex items-center gap-1.5",onClick:d +},[ui("div",tye,[di(Vn(oY),{icon:"Add",size:"sm" +})]),t[2]||(t[2]=ui("span",null,"Add Server",-1))])])),_:1})],64))])), +default:Ar((()=>[ui("button",Jbe,[t[0]||(t[0]=ui("span",{class:"sr-only" +},"Server:",-1)),fi(" "+ht(p.value),1)])])),_:1}))}}),rye={key:0, +class:"scalar-address-bar order-last lg:order-none lg:w-auto w-full"},oye={ +class:"m-auto flex flex-row items-center"},aye={ +class:"pointer-events-none absolute left-0 top-0 block h-full w-full overflow-hidden" +},iye={class:"flex gap-1"},sye={ +class:"codemirror-bg-switcher scroll-timeline-x scroll-timeline-x-hidden relative flex w-full" +},lye={"aria-hidden":"true",class:"inline-flex gap-1 items-center"},cye=no({ +__name:"AddressBar",emits:["importCurl"],setup(e){ +const{activeRequest:t,activeExample:n,activeServer:r,activeCollection:o}=q1(),{isReadOnly:a,requestMutators:i,requestHistory:s,events:l}=M1(),c=Fn(s[0]),u=Fn(null),d=function(e={}){ +const{reactive:t=!1,target:n=nd,aliasMap:r=pd,passive:o=!0,onEventFired:a=Wu}=e,i=An(new Set),s={ +toJSON:()=>({}),current:i},l=t?An(s):s,c=new Set,u=new Set;function d(e,n){ +e in l&&(t?l[e]=n:l[e].value=n)}function p(){i.clear();for(const e of u)d(e,!1)} +function h(e,t){var n,r +;const o=null==(n=e.key)?void 0:n.toLowerCase(),a=[null==(r=e.code)?void 0:r.toLowerCase(),o].filter(Boolean) +;o&&(t?i.add(o):i.delete(o));for(const i of a)u.add(i),d(i,t) +;"meta"!==o||t?"function"==typeof e.getModifierState&&e.getModifierState("Meta")&&t&&[...i,...a].forEach((e=>c.add(e))):(c.forEach((e=>{ +i.delete(e),d(e,!1)})),c.clear())}od(n,"keydown",(e=>(h(e,!0),a(e))),{passive:o +}),od(n,"keyup",(e=>(h(e,!1),a(e))),{passive:o}),od("blur",p,{passive:!0 +}),od("focus",p,{passive:!0});const f=new Proxy(l,{get(e,n,o){ +if("string"!=typeof n)return Reflect.get(e,n,o) +;if((n=n.toLowerCase())in r&&(n=r[n]),!(n in l))if(/[+_-]/.test(n)){ +const e=n.split(/[+_-]/g).map((e=>e.trim())) +;l[n]=Bi((()=>e.every((e=>zu(f[e])))))}else l[n]=Fn(!1) +;const a=Reflect.get(e,n,o);return t?zu(a):a}});return f +}(),p=Bi((()=>i3()?d.meta_enter:d.ctrl_enter));var h,f +;h=()=>l.executeRequest.emit(),Ma(p,((e,t,n)=>{e&&h(e,t,n)}),{...f,once:!1}) +;Ma((()=>{var e;return null==(e=t.value)?void 0:e.path}),(e=>{ +!t.value||!e||(e=>{!t.value||t.value.path===e||i.edit(t.value.uid,"path",e)})(e) +}));const m=Fn(100),g=Fn(0),v=Fn(!1),b=Fn();function y(){ +v.value?m.value-=(m.value-15)/60:m.value-=g.value/20, +m.value<=0&&(clearInterval(b.value),b.value=void 0,m.value=100,v.value=!1)} +function O(e){t.value&&i.edit(t.value.uid,"method",e)}function w(){ +if(!t.value)return;const{method:e}=t.value;return OR[e].backgroundColor} +function x(){v.value||(v.value=!0,l.executeRequest.emit())}function k(e){ +t.value&&i.edit(t.value.uid,"path",e)}function S(e){var t +;null!=e&&e.focusAddressBar&&(null==(t=u.value)||t.focus())} +return l.requestStatus.on((e=>{ +"start"===e&&(b.value||(v.value=!0,b.value=setInterval(y,20))), +"stop"===e&&(g.value=m.value, +v.value=!1),"abort"===e&&(clearInterval(b.value),b.value=void 0, +m.value=100,v.value=!1)})),go((()=>l.hotKeys.on(S))),yo((()=>l.hotKeys.off(S))), +(e,i)=>Vn(t)&&Vn(n)?(ei(),oi("div",rye,[ui("div",oye,[di(Vn(LI),{ +modelValue:c.value,"onUpdate:modelValue":i[1]||(i[1]=e=>c.value=e)},{ +default:Ar((({open:n})=>{var s,l,c,d,p;return[ui("div",{ +class:it(["addressbar-bg-states text-xxs relative flex w-full xl:min-w-[720px] xl:max-w-[720px] lg:min-w-[580px] lg:max-w-[580px] order-last overflow-hidden lg:order-none flex-1 flex-row items-stretch rounded-lg border-1/2 p-[3px]",{ +"border-transparent overflow-visible rounded-b-none":n}]) +},[ui("div",aye,[ui("div",{ +class:it(["bg-mix-transparent bg-mix-amount-90 absolute left-0 top-0 h-full w-full z-context",w()]), +style:tt({transform:`translate3d(-${m.value}%,0,0)`}) +},null,6)]),ui("div",iye,[di(qbe,{isEditable:!Vn(a),isSquare:"", +method:Vn(t).method,teleport:"",onChange:O +},null,8,["isEditable","method"])]),ui("div",sye,[i[2]||(i[2]=ui("div",{ +class:"fade-left" +},null,-1)),null!=(l=null==(s=Vn(o))?void 0:s.servers)&&l.length?(ei(),ai(nye,{ +key:0})):gi("",!0),di(_pe,{ref_key:"addressBarRef",ref:u,"aria-label":"Path", +class:"outline-none",disableCloseBrackets:"",disabled:Vn(a),disableEnter:"", +disableTabIndent:"",emitOnBlur:!1,importCurl:"",modelValue:Vn(t).path, +placeholder:null!=(c=Vn(r))&&c.uid&&null!=(p=null==(d=Vn(o))?void 0:d.servers)&&p.includes(Vn(r).uid)?"":"Enter a URL or cURL command", +server:"",onCurl:i[0]||(i[0]=t=>e.$emit("importCurl",t)),onSubmit:x, +"onUpdate:modelValue":k +},null,8,["disabled","modelValue","placeholder"]),i[3]||(i[3]=ui("div",{ +class:"fade-right"},null,-1))]),di(Gbe,{open:n},null,8,["open"]),di(Vn(BB),{ +class:"relative h-auto shrink-0 overflow-hidden !pl-2 !pr-2.5 !py-1 font-bold", +disabled:v.value,onClick:x},{default:Ar((()=>[ui("span",lye,[di(Vn(oY),{ +class:"relative shrink-0 fill-current",icon:"Play",size:"xs" +}),i[4]||(i[4]=ui("span",{class:"text-xxs lg:flex hidden" +},"Send",-1))]),i[5]||(i[5]=ui("span",{class:"sr-only" +}," Send Request ",-1))])),_:1},8,["disabled"])],2)]})),_:1 +},8,["modelValue"])])])):gi("",!0)} +}),uye=g3(cye,[["__scopeId","data-v-e6e6f37d"]]),dye={borderRadius:{ +DEFAULT:"var(--scalar-radius)",md:"var(--scalar-radius)", +lg:"var(--scalar-radius-lg)",xl:"var(--scalar-radius-xl)",px:"1px", +full:"9999px",none:"0px"},borderWidth:{DEFAULT:"var(--scalar-border-width)", +0:"0","1/2":"calc(var(--scalar-border-width) / 2)", +1:"var(--scalar-border-width)",2:"calc(var(--scalar-border-width) * 2)", +4:"calc(var(--scalar-border-width) * 4)"},boxShadow:{ +DEFAULT:"var(--scalar-shadow-1)",lg:"var(--scalar-shadow-2)", +md:"var(--scalar-shadow-1)",sm:"rgba(0, 0, 0, 0.09) 0px 1px 4px", +none:"0 0 #0000",border:"inset 0 0 0 1px var(--scalar-border-color)", +"border-1/2":"inset 0 0 0 .5px var(--scalar-border-color)"},fontFamily:{ +DEFAULT:"var(--scalar-font)",code:"var(--scalar-font-code)"},fontSize:{ +"3xs":"var(--scalar-font-size-7)",xxs:"var(--scalar-font-size-6)", +xs:"var(--scalar-font-size-5)",sm:"var(--scalar-font-size-4)", +base:"var(--scalar-font-size-3)",lg:"var(--scalar-font-size-2)", +xl:"var(--scalar-font-size-1)"},fontWeight:{DEFAULT:"var(--scalar-regular)", +normal:"var(--scalar-regular)",medium:"var(--scalar-semibold)", +bold:"var(--scalar-bold)"},colors:{current:"currentColor",inherit:"inherit",b:{ +1:"var(--scalar-background-1)",2:"var(--scalar-background-2)", +3:"var(--scalar-background-3)",4:"var(--scalar-background-3)", +accent:"var(--scalar-background-accent)",btn:"var(--scalar-button-1)"},c:{ +1:"var(--scalar-color-1)",2:"var(--scalar-color-2)",3:"var(--scalar-color-3)", +accent:"var(--scalar-color-accent)",ghost:"var(--scalar-color-ghost)", +disabled:"var(--scalar-color-disabled)",btn:"var(--scalar-button-1-color)"},h:{ +btn:"var(--scalar-button-1-hover)"},backdrop:"rgba(0, 0, 0, 0.22)", +backdropdark:"rgba(0, 0, 0, 0.45)",border:"var(--scalar-border-color)", +brand:"var(--scalar-brand)",green:"var(--scalar-color-green)", +red:"var(--scalar-color-red)",yellow:"var(--scalar-color-yellow)", +blue:"var(--scalar-color-blue)",orange:"var(--scalar-color-orange)", +purple:"var(--scalar-color-purple)",grey:"var(--scalar-color-3)", +indigo:"var(--scalar-color-blue)",pink:"var(--scalar-color-pink)",white:"#FFF", +transparent:"transparent"},lineHeight:{none:"1",tight:"1.25",snug:"1.375", +normal:"1.5",relaxed:"1.625",loose:"2",DEFAULT:"1.5", +1:"var(--scalar-line-height-1)",2:"var(--scalar-line-height-2)", +3:"var(--scalar-line-height-3)",4:"var(--scalar-line-height-4)", +5:"var(--scalar-line-height-5)"},screens:{xs:"400px",sm:"600px",md:"800px", +lg:"1000px",xl:"1200px"},zIndex:{"-1":"-1",0:"0",1:"1"},extend:{borderColor:{ +DEFAULT:"var(--scalar-border-color)"},brightness:{ +lifted:"var(--scalar-lifted-brightness)", +backdrop:"var(--scalar-backdrop-brightness)"},spacing:{px:"1px",header:"48px"}}} +;function pye(){ +const e=dye.screens,t=Object.fromEntries(Object.entries(e).map((([e,t])=>[e,sd(`(min-width: ${t})`)]))),n=Bi((()=>Object.fromEntries(Object.entries(t).map((([e,t])=>[e,Vn(t)]))))) +;return{screens:e,mediaQueries:t,breakpoints:n}}const hye={key:0, +class:"min-h-12 xl:min-h-client-header flex items-center justify-between px-3 py-1.5 md:px-4 md:py-2.5 text-sm" +},fye={class:"font-medium m-0 text-sm whitespace-nowrap"},mye={ +class:"relative z-10 pt-0 md:px-2.5 md:pb-2.5 sticky bottom-0 w-[inherit] has-[.empty-sidebar-item]:border-t-1/2" +},gye=no({__name:"Sidebar",props:{title:{},isSidebarOpen:{type:Boolean, +default:!0}},setup(e){ +const t=e,{isReadOnly:n,sidebarWidth:r,setSidebarWidth:o}=M1(),a=Fn(!1),i=Fn(null),{breakpoints:s}=pye(),l=e=>{ +e.preventDefault() +;const t=e.clientX,n=parseInt(getComputedStyle(i.value).width||r.value,10),s=e=>{ +a.value=!0,document.body.classList.add("dragging");let r=n+e.clientX-t +;r>420&&(r=420+.2*(r-420)),r<240&&(r=240),o(`${r}px`)},l=()=>{ +a.value=!1,document.body.classList.remove("dragging"), +document.documentElement.removeEventListener("mousemove",s,!1), +document.documentElement.removeEventListener("mouseup",l,!1), +parseInt(r.value,10)>420?o("360px"):parseInt(r.value,10)<240&&o("240px")} +;document.documentElement.addEventListener("mousemove",s,!1), +document.documentElement.addEventListener("mouseup",l,!1)} +;return(e,o)=>Pr((ei(),oi("aside",{ref_key:"sidebarRef",ref:i, +class:it(["sidebar overflow-hidden relative flex flex-col flex-1 md:flex-none bg-b-1 md:border-b-0 md:border-r-1/2 min-w-full md:min-w-fit leading-3",{ +dragging:a.value}]),style:tt({width:Vn(s).lg?Vn(r):"100%"}) +},[$o(e.$slots,"header",{},void 0,!0),!Vn(n)&&e.title?(ei(), +oi("div",hye,[ui("h2",fye,ht(e.title),1),Vn(s).lg?gi("",!0):$o(e.$slots,"button",{ +key:0},void 0,!0)])):gi("",!0),ui("div",{ +class:it(["custom-scroll sidebar-height pb-0 md:pb-[37px] w-[inherit]",{ +"sidebar-mask":!Vn(n)}]) +},[$o(e.$slots,"content",{},void 0,!0)],2),Vn(s).lg?(ei(),oi(Wa,{key:1 +},[ui("div",mye,[$o(e.$slots,"button",{},void 0,!0)]),ui("div",{class:"resizer", +onMousedown:l},null,32)],64)):gi("",!0)],6)),[[hs,t.isSidebarOpen]])} +}),vye=g3(gye,[["__scopeId","data-v-ba6d2e30"]]),bye={ +class:"references-mobile-header t-doc__header"},yye={ +class:"references-mobile-breadcrumbs"},Oye={ +class:"references-mobile-header-actions"},wye=mhe(no({__name:"MobileHeader", +props:{open:{type:Boolean}},emits:["update:open"],setup(e){ +const{breadcrumb:t}=dN();return(e,n)=>(ei(),oi("div",bye,[di(Vn(W0),{ +icon:e.open?"Close":"Menu",label:e.open?"Close Menu":"Open Menu",size:"md", +onClick:n[0]||(n[0]=t=>e.$emit("update:open",!e.open)) +},null,8,["icon","label"]),ui("span",yye,ht(Vn(t)),1),ui("div",Oye,[$o(e.$slots,"actions",{},void 0,!0)])])) +}}),[["__scopeId","data-v-b5fb4b8b"]]),xye={key:0, +class:"scalar-api-references-standalone-search"},kye={ +class:"darklight-reference"},Sye=mhe(no({__name:"ModernLayout",props:{ +configuration:{},parsedSpec:{},rawSpec:{},isDark:{type:Boolean}}, +emits:["toggleDarkMode","updateContent"],setup(e){ +const t=e,n=Uo(),{mediaQueries:r}=pye(),{isSidebarOpen:o}=dN();Ma(r.lg,((e,t)=>{ +t&&!e&&(o.value=!1)}));const{hash:a}=U$();return Ma(a,((e,t)=>{ +e&&e!==t&&(o.value=!1)})),(e,r)=>(ei(),ai(xbe,{class:it({ +"scalar-api-references-standalone-mobile":e.configuration.showSidebar}), +configuration:e.configuration,parsedSpec:e.parsedSpec,rawSpec:e.rawSpec, +onUpdateContent:r[2]||(r[2]=t=>e.$emit("updateContent",t))},Ro({ +header:Ar((()=>[t.configuration.showSidebar?(ei(),ai(wye,{key:0,open:Vn(o), +"onUpdate:open":r[0]||(r[0]=e=>Qn(o)?o.value=e:null) +},null,8,["open"])):gi("",!0)])),"sidebar-start":Ar((({spec:e})=>{var n +;return[t.configuration.hideSearch?gi("",!0):(ei(),oi("div",xye,[di(Vn(jbe),{ +searchHotKey:null==(n=t.configuration)?void 0:n.searchHotKey,spec:e +},null,8,["searchHotKey","spec"])]))]})),"sidebar-end":Ar((()=>{var n +;return[ui("div",kye,[t.configuration.hideClientButton?gi("",!0):(ei(), +ai(Vn(Fbe),{key:0,buttonSource:"sidebar", +integration:e.configuration._integration,isDevelopment:false, +url:null==(n=e.configuration.spec)?void 0:n.url +},null,8,["integration","url"])),di(Vn(Cbe),{ +hideDarkModeToggle:e.configuration.hideDarkModeToggle,isDarkMode:e.isDark, +onToggleDarkMode:r[1]||(r[1]=t=>e.$emit("toggleDarkMode")) +},null,8,["hideDarkModeToggle","isDarkMode"])])]})),_:2},[Do(n,((t,n)=>({name:n, +fn:Ar((t=>[$o(e.$slots,n,st(pi(t||{})),void 0,!0)])) +})))]),1032,["class","configuration","parsedSpec","rawSpec"]))} +}),[["__scopeId","data-v-90dab220"]]),_ye=no({__name:"Layouts",props:{ +configuration:{},parsedSpec:{},rawSpec:{},isDark:{type:Boolean}}, +emits:["toggleDarkMode","updateContent"],setup(e){const t=e,n=Uo(),r={ +modern:Sye,classic:Bbe} +;return(e,o)=>(ei(),ai(Co(r[e.configuration.layout??"modern"]??Sye),Oi(t,{ +onToggleDarkMode:o[0]||(o[0]=t=>e.$emit("toggleDarkMode")), +onUpdateContent:o[1]||(o[1]=t=>e.$emit("updateContent",t))}),Ro({_:2 +},[Do(n,((t,n)=>({name:n,fn:Ar((t=>[$o(e.$slots,n,st(pi(t||{})))]))})))]),1040)) +}}),Eye=no({__name:"ApiReference",props:{configuration:{}}, +emits:["updateContent"],setup(e){var t,n,r +;const o=e,{setColorMode:a,toggleColorMode:i,darkLightMode:s}=Qu({ +initialColorMode:(null==(t=o.configuration)?void 0:t.darkMode)?"dark":void 0, +overrideColorMode:null==(n=o.configuration)?void 0:n.forceDarkModeState}) +;Ma((()=>{var e;return null==(e=o.configuration)?void 0:e.darkMode +}),(e=>a(e?"dark":"light")));const l=Bi((()=>{var e,t +;if(null==(e=o.configuration)?void 0:e.customCss)return function(e){ +return fl.some((t=>e.includes(t)))?(console.warn("DEPRECATION WARNING: It looks like you're using legacy CSS variables in your custom CSS string. Please migrate them to use the updated prefixes. See https://github.com/scalar/scalar#theme-prefix-changes"), +hl.reduce(((e,[t,n])=>e.replaceAll(t,n)),e)):e +}(null==(t=o.configuration)?void 0:t.customCss)})),c=Bi((()=>{var e;return{ +spec:{content:void 0,url:void 0,...null==(e=o.configuration)?void 0:e.spec}, +proxyUrl:void 0,theme:"default",showSidebar:!0,isEditable:!1,...o.configuration, +customCss:l.value}}));(null==(r=c.value)?void 0:r.metaData)&&function(e,t){ +const{title:n,titleTemplate:r,...o}=e;dl({title:n,titleTemplate:r,_flatMeta:o},{ +...t,transform(e){const t=_({...e._flatMeta});return delete e._flatMeta,{...e, +meta:t}}})}(c.value.metaData);const{parsedSpec:u,rawSpec:d}=z$({ +proxyUrl:tr((()=>c.value.proxyUrl||c.value.proxy||"")), +specConfig:tr((()=>c.value.spec||{}))}) +;return dd(Bi((()=>c.value.favicon))),(e,t)=>{var n +;return ei(),oi(Wa,null,[(null==(n=c.value)?void 0:n.customCss)?(ei(), +ai(Co("style"),{key:0},{default:Ar((()=>[fi(ht(c.value.customCss),1)])),_:1 +})):gi("",!0),di(Vn(_ye),{configuration:c.value,isDark:"dark"===Vn(s), +parsedSpec:Vn(u),rawSpec:Vn(d),onToggleDarkMode:t[0]||(t[0]=()=>Vn(i)()), +onUpdateContent:t[1]||(t[1]=t=>e.$emit("updateContent",t))},{ +footer:Ar((()=>[$o(e.$slots,"footer")])), +"content-end":Ar((()=>[$o(e.$slots,"footer")])),_:3 +},8,["configuration","isDark","parsedSpec","rawSpec"])],64)}} +}),Tye=()=>document.getElementById("api-reference"),Cye=document.querySelector("[data-spec]"),Aye=document.querySelector("[data-spec-url]"),Pye=document.querySelector("#api-reference[data-configuration]"),Dye=()=>{ +if(Pye){const e=Pye.getAttribute("data-configuration");if(e)return{ +_integration:"html",...JSON.parse(e.split(""").join('"'))}}return{ +_integration:"html"}},Rye=()=>{var e,t,n +;if(null==(e=Dye().spec)?void 0:e.url)return null==(t=Dye().spec)?void 0:t.url +;const r=Tye();if(r){ +const e=null==(n=r.getAttribute("data-url"))?void 0:n.trim();if(e)return e} +if(Aye){ +console.warn('[@scalar/api-reference] The [data-spec-url] HTML API is deprecated. Use the new