feat(core): 下沉 CORS Scalar 与限流执行器
Verify / verify (push) Canceled after 0s

This commit is contained in:
zhangdeman committed 2026-11-28 02:28:13 -08:00
1 parent 624093773b
commit 568e516b1a
18 files changed
+912 -80

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+204
View File
@@ -0,0 +1,204 @@
// Package cors 提供独立于业务身份的来源匹配、预检和跨域响应头。
package cors
import (
"errors"
"net/http"
"net/url"
"strconv"
"strings"
"time"
failure "git.zhangdeman.cn/zhangdeman/ginframework/internal/failure"
"github.com/gin-gonic/gin"
)
const (
codeOrigins = 900801
codeCredentials = 900802
codeOriginPattern = 900803
codeMaxAge = 900804
)
// Config 只保存跨域策略数据;零 MaxAge 不缓存预检,名单不会隐式扩展。
type Config struct {
AllowAllOrigins bool `json:"allow_all_origins" yaml:"allow_all_origins" dc:"允许任意来源,与凭据模式互斥"`
AllowOrigins []string `json:"allow_origins" yaml:"allow_origins" dc:"明确的 HTTP/HTTPS 来源名单"`
AllowMethods []string `json:"allow_methods" yaml:"allow_methods" dc:"预检允许的方法,星号允许任意方法"`
AllowHeaders []string `json:"allow_headers" yaml:"allow_headers" dc:"预检允许的请求头,星号允许任意请求头"`
ExposeHeaders []string `json:"expose_headers" yaml:"expose_headers" dc:"允许浏览器读取的响应头"`
AllowCredentials bool `json:"allow_credentials" yaml:"allow_credentials" dc:"允许请求携带凭据,必须回显明确来源"`
AllowWildcard bool `json:"allow_wildcard" yaml:"allow_wildcard" dc:"允许名单中出现单个星号来源规则"`
CheckActualMethod bool `json:"check_actual_method" yaml:"check_actual_method" dc:"除预检外也拒绝名单之外的实际跨域方法"`
MaxAge time.Duration `json:"max_age" yaml:"max_age" dc:"预检缓存时长,零不缓存,拒绝负值"`
}
// Options 显式提供应用自己的动态来源授权和拒绝响应,不进入配置解码。
type Options struct {
AllowOrigin func(*gin.Context, string) bool `json:"-" dc:"静态名单未匹配时的可信来源授权,可处理扩展等来源"`
OnOriginDenied gin.HandlerFunc `json:"-" dc:"来源拒绝时的可选业务响应,缺省为 403;框架始终终止处理"`
}
// DefaultConfig 返回标准方法和基础请求头、十二小时缓存;调用方仍须声明来源。
func DefaultConfig() Config {
return Config{AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}, AllowHeaders: []string{"Origin", "Content-Length", "Content-Type"}, MaxAge: 12 * time.Hour}
}
// New 校验一次策略并复制名单,返回可注册到 Gin/框架 Use 的处理器。
// 入参:cfg 为数据,options 为应用运行函数;静态来源只接受 HTTP/HTTPS origin 和显式单星号规则。
// 返回:构造失败保留内部原因链,不使用 panic;无 Origin 或同源请求直接通过,预检成功返回 204。
// 隐式逻辑:凭据模式禁止星号 Origin,方法和头的星号按请求回显;已有 Vary 会合并保留。
func New(cfg Config, options Options) (gin.HandlerFunc, error) {
cfg.AllowOrigins = normalize(cfg.AllowOrigins)
cfg.AllowMethods = normalize(cfg.AllowMethods)
cfg.AllowHeaders = normalize(cfg.AllowHeaders)
cfg.ExposeHeaders = normalize(cfg.ExposeHeaders)
if cfg.MaxAge < 0 {
return nil, failure.Wrap(codeMaxAge, "validate CORS preflight lifetime failed", errors.New("negative preflight lifetime"))
}
if contains(cfg.AllowOrigins, "*") {
cfg.AllowAllOrigins = true
}
if cfg.AllowAllOrigins && cfg.AllowCredentials {
return nil, failure.Wrap(codeCredentials, "validate CORS credential policy failed", errors.New("credentials require explicit origins"))
}
if cfg.AllowAllOrigins && (options.AllowOrigin != nil || len(cfg.AllowOrigins) > 1 || len(cfg.AllowOrigins) == 1 && cfg.AllowOrigins[0] != "*") {
return nil, failure.Wrap(codeOrigins, "validate CORS origin policy failed", errors.New("wildcard origin conflicts with explicit origin rules"))
}
if !cfg.AllowAllOrigins && len(cfg.AllowOrigins) == 0 && options.AllowOrigin == nil {
return nil, failure.Wrap(codeOrigins, "validate CORS origin policy failed", errors.New("origin rule is required"))
}
for _, origin := range cfg.AllowOrigins {
if origin == "*" {
continue
}
if !webOrigin(origin) || strings.Count(origin, "*") > 1 || strings.Contains(origin, "*") && !cfg.AllowWildcard {
return nil, failure.Wrap(codeOriginPattern, "validate CORS origin pattern failed", errors.New("invalid origin scheme, shape or wildcard declaration"))
}
}
return func(ctx *gin.Context) {
origin := strings.TrimSpace(ctx.GetHeader("Origin"))
if origin == "" || origin == "http://"+ctx.Request.Host || origin == "https://"+ctx.Request.Host {
return
}
allowed := cfg.AllowAllOrigins
for _, rule := range cfg.AllowOrigins {
if strings.EqualFold(rule, origin) {
allowed = true
break
}
if cfg.AllowWildcard && strings.Contains(rule, "*") && webOrigin(origin) {
before, after, _ := strings.Cut(rule, "*")
candidate := strings.ToLower(origin)
if strings.HasPrefix(candidate, before) && strings.HasSuffix(candidate, after) && len(candidate) >= len(before)+len(after) {
allowed = true
break
}
}
}
if !allowed && options.AllowOrigin != nil {
allowed = options.AllowOrigin(ctx, origin)
}
if !allowed {
if options.OnOriginDenied != nil {
options.OnOriginDenied(ctx)
ctx.Abort()
} else {
ctx.AbortWithStatus(http.StatusForbidden)
}
return
}
if cfg.CheckActualMethod && ctx.Request.Method != http.MethodOptions && !contains(cfg.AllowMethods, ctx.Request.Method) && !contains(cfg.AllowMethods, "*") {
ctx.AbortWithStatus(http.StatusForbidden)
return
}
header := ctx.Writer.Header()
if cfg.AllowAllOrigins {
header.Set("Access-Control-Allow-Origin", "*")
} else {
header.Set("Access-Control-Allow-Origin", origin)
appendVary(header, "Origin")
}
if cfg.AllowCredentials {
header.Set("Access-Control-Allow-Credentials", "true")
}
if ctx.Request.Method != http.MethodOptions {
if len(cfg.ExposeHeaders) > 0 {
header.Set("Access-Control-Expose-Headers", strings.Join(cfg.ExposeHeaders, ","))
}
return
}
method := strings.ToUpper(strings.TrimSpace(ctx.GetHeader("Access-Control-Request-Method")))
if !contains(cfg.AllowMethods, "*") && !contains(cfg.AllowMethods, method) {
ctx.AbortWithStatus(http.StatusForbidden)
return
}
requested := strings.TrimSpace(ctx.GetHeader("Access-Control-Request-Headers"))
if !contains(cfg.AllowHeaders, "*") {
for _, name := range strings.Split(requested, ",") {
if strings.TrimSpace(name) != "" && !contains(cfg.AllowHeaders, name) {
ctx.AbortWithStatus(http.StatusForbidden)
return
}
}
}
methods := strings.ToUpper(strings.Join(cfg.AllowMethods, ", "))
if contains(cfg.AllowMethods, "*") && cfg.AllowCredentials {
methods = method
}
header.Set("Access-Control-Allow-Methods", methods)
if requested != "" {
if cfg.AllowCredentials || contains(cfg.AllowHeaders, "*") {
header.Set("Access-Control-Allow-Headers", requested)
} else {
header.Set("Access-Control-Allow-Headers", strings.Join(cfg.AllowHeaders, ","))
}
}
if cfg.MaxAge > 0 {
header.Set("Access-Control-Max-Age", strconv.FormatInt(int64(cfg.MaxAge/time.Second), 10))
}
appendVary(header, "Access-Control-Request-Method")
appendVary(header, "Access-Control-Request-Headers")
ctx.AbortWithStatus(http.StatusNoContent)
}, nil
}
// normalize 复制并规范化构造期名单,避免请求读取调用方的可变切片。
func normalize(values []string) []string {
result := make([]string, 0, len(values))
for _, value := range values {
value = strings.ToLower(strings.TrimSpace(value))
if value != "" && !contains(result, value) {
result = append(result, value)
}
}
return result
}
// contains 对方法、来源和请求头执行大小写不敏感的完整项匹配。
func contains(values []string, value string) bool {
for _, entry := range values {
if strings.EqualFold(entry, strings.TrimSpace(value)) {
return true
}
}
return false
}
// appendVary 保留既有协商条件,合并同名项时不重复输出。
func appendVary(header http.Header, value string) {
for _, existing := range header.Values("Vary") {
for _, item := range strings.Split(existing, ",") {
if strings.EqualFold(strings.TrimSpace(item), value) {
return
}
}
}
header.Add("Vary", value)
}
// webOrigin 检查来源 URL 的 origin 形状,拒绝凭据、路径、查询和片段参与通配匹配。
func webOrigin(origin string) bool {
parsed, err := url.Parse(origin)
return err == nil && (parsed.Scheme == "http" || parsed.Scheme == "https") && parsed.Host != "" && parsed.User == nil && parsed.Path == "" && parsed.RawQuery == "" && parsed.Fragment == "" && parsed.Opaque == ""
}
+129
View File
@@ -0,0 +1,129 @@
package cors
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/gin-gonic/gin"
)
// TestCredentialedPreflightAndVary 验证真实预检凭据协议、方法/头白名单和已有 Vary 合并。
func TestCredentialedPreflightAndVary(t *testing.T) {
for _, item := range []struct {
name, origin, method, headers string
want int
}{
{"allowed", "https://app.example.test", "POST", "Authorization,Last-Event-ID", 204},
{"origin denied", "https://other.example.test", "POST", "Authorization", 403},
{"method denied", "https://app.example.test", "DELETE", "Authorization", 403},
{"header denied", "https://app.example.test", "POST", "X-Unknown", 403},
} {
t.Run(item.name, func(t *testing.T) {
middleware, err := New(Config{AllowOrigins: []string{"https://app.example.test"}, AllowMethods: []string{"GET", "POST"}, AllowHeaders: []string{"Authorization", "Last-Event-ID"}, AllowCredentials: true}, Options{})
if err != nil {
t.Fatal(err)
}
engine := gin.New()
engine.Use(func(ctx *gin.Context) { ctx.Header("Vary", "Accept-Encoding"); ctx.Next() }, middleware)
engine.OPTIONS("/api", func(*gin.Context) { t.Error("preflight reached application handler") })
request := httptest.NewRequest(http.MethodOptions, "/api", nil)
request.Header.Set("Origin", item.origin)
request.Header.Set("Access-Control-Request-Method", item.method)
request.Header.Set("Access-Control-Request-Headers", item.headers)
recorder := httptest.NewRecorder()
engine.ServeHTTP(recorder, request)
if recorder.Code != item.want {
t.Fatalf("status=%d, want %d", recorder.Code, item.want)
}
if item.want == 204 {
if recorder.Header().Get("Access-Control-Allow-Origin") != item.origin || recorder.Header().Get("Access-Control-Allow-Credentials") != "true" || recorder.Header().Get("Access-Control-Allow-Headers") != item.headers {
t.Fatal("credential preflight headers changed")
}
vary := strings.Join(recorder.Header().Values("Vary"), ",")
for _, token := range []string{"Accept-Encoding", "Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers"} {
if !strings.Contains(vary, token) {
t.Fatalf("lost Vary %s", token)
}
}
}
})
}
}
// TestCORSRejectsInvalidConfig 凭据和全来源互斥,静态来源不接受文件协议或未声明通配符。
func TestCORSRejectsInvalidConfig(t *testing.T) {
for _, cfg := range []Config{{}, {AllowAllOrigins: true, AllowCredentials: true}, {AllowOrigins: []string{"*"}, AllowCredentials: true}, {AllowOrigins: []string{"file://local"}}, {AllowOrigins: []string{"https://*.example.test"}}, {AllowOrigins: []string{"https://app.example.test/path"}}} {
if _, err := New(cfg, Options{}); err == nil {
t.Fatalf("invalid policy accepted: %#v", cfg)
}
}
}
// TestCORSRuntimePolicyAndFrozenConfig 验证应用回调处理扩展拒绝响应,配置切片不会被调用方后续修改。
func TestCORSRuntimePolicyAndFrozenConfig(t *testing.T) {
cfg := Config{AllowOrigins: []string{"https://app.example.test"}, AllowMethods: []string{"GET"}}
middleware, err := New(cfg, Options{AllowOrigin: func(_ *gin.Context, origin string) bool { return origin == "chrome-extension://registered" }, OnOriginDenied: func(ctx *gin.Context) { ctx.JSON(http.StatusUnauthorized, gin.H{"denied": true}) }})
if err != nil {
t.Fatal(err)
}
cfg.AllowOrigins[0] = "https://attacker.example.test"
engine := gin.New()
engine.Use(middleware)
engine.GET("/api", func(ctx *gin.Context) { ctx.Status(http.StatusNoContent) })
for _, item := range []struct {
origin string
want int
}{{"https://app.example.test", 204}, {"https://attacker.example.test", 401}, {"chrome-extension://registered", 204}} {
request := httptest.NewRequest(http.MethodGet, "/api", nil)
request.Header.Set("Origin", item.origin)
recorder := httptest.NewRecorder()
engine.ServeHTTP(recorder, request)
if recorder.Code != item.want {
t.Fatalf("origin %s status=%d", item.origin, recorder.Code)
}
}
}
// TestCredentialWildcardEchoesPreflight 验证显式动态来源授权下的方法和请求头通配符回显。
func TestCredentialWildcardEchoesPreflight(t *testing.T) {
middleware, err := New(Config{AllowMethods: []string{"*"}, AllowHeaders: []string{"*"}, AllowCredentials: true}, Options{AllowOrigin: func(*gin.Context, string) bool { return true }})
if err != nil {
t.Fatal(err)
}
engine := gin.New()
engine.Use(middleware)
request := httptest.NewRequest(http.MethodOptions, "/api", nil)
request.Header.Set("Origin", "https://client.example.test")
request.Header.Set("Access-Control-Request-Method", "PATCH")
request.Header.Set("Access-Control-Request-Headers", "Authorization,X-Custom")
recorder := httptest.NewRecorder()
engine.ServeHTTP(recorder, request)
if recorder.Code != 204 || recorder.Header().Get("Access-Control-Allow-Methods") != "PATCH" || recorder.Header().Get("Access-Control-Allow-Headers") != "Authorization,X-Custom" {
t.Fatal("credential wildcard was not echoed")
}
}
// TestCORSWildcardMatchesOriginsOnly 防止 URL 路径被当作主机通配来源匹配。
func TestCORSWildcardMatchesOriginsOnly(t *testing.T) {
handler, err := New(Config{AllowOrigins: []string{"https://*.example.test"}, AllowWildcard: true, AllowMethods: []string{"GET"}}, Options{})
if err != nil {
t.Fatal(err)
}
engine := gin.New()
engine.Use(handler)
engine.GET("/", func(ctx *gin.Context) { ctx.Status(http.StatusNoContent) })
for _, item := range []struct {
origin string
want int
}{{"https://client.example.test", 204}, {"https://evil.test/path.example.test", 403}, {"https://client.example.test?x=.example.test", 403}} {
request := httptest.NewRequest(http.MethodGet, "/", nil)
request.Header.Set("Origin", item.origin)
recorder := httptest.NewRecorder()
engine.ServeHTTP(recorder, request)
if recorder.Code != item.want {
t.Fatalf("origin %s status=%d", item.origin, recorder.Code)
}
}
}
+73
View File
@@ -0,0 +1,73 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+71
View File
@@ -0,0 +1,71 @@
// Package scalar 提供可选的内嵌 Scalar 页面,不负责生成或发布 OpenAPI 契约。
package scalar
import (
"embed"
"html"
"mime"
"net/http"
"path"
"strings"
"github.com/gin-gonic/gin"
)
// 文档界面固定为 Scalar,页面和脚本随二进制发布,不从 CDN 加载运行代码。
var (
//go:embed theme/scalar
scalarFiles embed.FS
)
// UI 保存固定文档界面的渲染参数,不提供主题选择能力。
type UI struct {
baseURI string `dc:"文档页面的基础路由"`
title string `dc:"文档页面标题"`
}
// New 创建使用内置资源的 Scalar 文档界面。
// 入参:title 为页面标题;baseURI 为已经注册的文档基础路径。
// 返回:绑定文档路径与标题的界面实例。
func New(title, baseURI string) *UI {
return &UI{
baseURI: strings.TrimRight(baseURI, "/"),
title: title,
}
}
// Handler 提供固定 Scalar 页面与脚本,未知资源返回 404。
// 返回:读取内嵌资源并注入安全页面参数的 Gin 处理器。
func (ui *UI) Handler() gin.HandlerFunc {
return func(ctx *gin.Context) {
var (
requested = strings.TrimPrefix(ctx.Param("any"), "/")
data []byte
err error
contentType string
page string
)
if requested == "" {
requested = "index.html"
}
// 仅公开当前文档使用的两个资源,拒绝其他主题和路径穿越请求。
if requested != "index.html" && requested != "api-reference.js" {
ctx.AbortWithStatus(http.StatusNotFound)
return
}
if data, err = scalarFiles.ReadFile(path.Join("theme/scalar", requested)); err != nil {
// 资源固定且编译时嵌入,不存在的路径按静态资源协议返回 404。
ctx.AbortWithStatus(http.StatusNotFound)
return
}
contentType = mime.TypeByExtension(path.Ext(requested))
if requested == "index.html" {
page = strings.ReplaceAll(string(data), "{{DOC_TITLE}}", html.EscapeString(ui.title))
page = strings.ReplaceAll(page, "{{BASE_URI}}", html.EscapeString(ui.baseURI))
data = []byte(page)
contentType = "text/html; charset=utf-8"
}
ctx.Data(http.StatusOK, contentType, data)
ctx.Abort()
}
}
+39
View File
@@ -0,0 +1,39 @@
package scalar
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/gin-gonic/gin"
)
func TestScalarUIHandlesQueryAndMissingAssets(t *testing.T) {
engine := gin.New()
engine.GET("/docs/*any", New("Test <API>", "/docs").Handler())
t.Run("index with query", func(t *testing.T) {
recorder := httptest.NewRecorder()
request := httptest.NewRequest(http.MethodGet, "/docs/index.html?cache=1", nil)
engine.ServeHTTP(recorder, request)
if recorder.Code != http.StatusOK {
t.Fatalf("status = %d, want %d", recorder.Code, http.StatusOK)
}
if contentType := recorder.Header().Get("Content-Type"); !strings.HasPrefix(contentType, "text/html") {
t.Fatalf("Content-Type = %q, want HTML", contentType)
}
if strings.Contains(recorder.Body.String(), "Test <API>") {
t.Fatal("document title was not HTML escaped")
}
})
t.Run("missing asset", func(t *testing.T) {
recorder := httptest.NewRecorder()
request := httptest.NewRequest(http.MethodGet, "/docs/missing.js", nil)
engine.ServeHTTP(recorder, request)
if recorder.Code != http.StatusNotFound {
t.Fatalf("status = %d, want %d", recorder.Code, http.StatusNotFound)
}
})
}
+47
View File
@@ -0,0 +1,47 @@
/**
* Minified by jsDelivr using Terser v5.39.0.
* Original file: /npm/@scalar/api-reference@1.43.0/dist/browser/standalone.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.references-classic-header[data-v-9198d025]{display:flex;align-items:center;gap:12px;max-width:var(--refs-content-max-width);margin:auto;padding:12px 0}.references-classic-header-content[data-v-9198d025]{display:flex;gap:12px;flex-grow:1}.references-classic-header-container[data-v-9198d025]{padding:0 60px}@container narrow-references-container (max-width: 900px){.references-classic-header[data-v-9198d025]{padding:12px 24px}.references-classic-header-container[data-v-9198d025]{padding:0}}.references-classic-header-icon[data-v-9198d025]{height:24px;color:var(--scalar-color-1)}.client-libraries-content[data-v-6a49c111]{container:client-libraries-content / inline-size;display:flex;justify-content:center;overflow:hidden;padding:0 12px;background-color:var(--scalar-background-1);border-left:var(--scalar-border-width) solid var(--scalar-border-color);border-right:var(--scalar-border-width) solid var(--scalar-border-color)}.client-libraries[data-v-6a49c111]{display:flex;align-items:center;justify-content:center;width:100%;position:relative;cursor:pointer;white-space:nowrap;padding:8px 2px;gap:6px;color:var(--scalar-color-3);border-bottom:1px solid transparent;-webkit-user-select:none;user-select:none}.client-libraries[data-v-6a49c111]:not(.client-libraries__active):hover:before{content:"";position:absolute;width:calc(100% - 4px);height:calc(100% - 4px);background:var(--scalar-background-2);left:2px;top:2px;z-index:0;border-radius:var(--scalar-radius)}.client-libraries[data-v-6a49c111]:active{color:var(--scalar-color-1)}.client-libraries[data-v-6a49c111]:focus-visible{outline:none;box-shadow:inset 0 0 0 1px var(--scalar-color-accent)}@media screen and (max-width: 450px){.client-libraries[data-v-6a49c111]:nth-of-type(4),.client-libraries[data-v-6a49c111]:nth-of-type(5){display:none}}.client-libraries-icon[data-v-6a49c111]{max-width:14px;max-height:14px;min-width:14px;width:100%;aspect-ratio:1;display:flex;align-items:center;justify-content:center;position:relative;box-sizing:border-box;color:currentColor}.client-libraries-icon__more svg[data-v-6a49c111]{height:initial}@container client-libraries-content (width < 400px){.client-libraries__select[data-v-6a49c111]{width:fit-content}.client-libraries__select .client-libraries-icon__more+span[data-v-6a49c111]{display:none}}@container client-libraries-content (width < 380px){.client-libraries[data-v-6a49c111]{width:100%}.client-libraries span[data-v-6a49c111]{display:none}}.client-libraries__active[data-v-6a49c111]{color:var(--scalar-color-1);border-bottom:1px solid var(--scalar-color-1)}@keyframes codeloader-6a49c111{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.client-libraries .client-libraries-text[data-v-6a49c111]{font-size:var(--scalar-small);position:relative;display:flex;align-items:center}.client-libraries__active .client-libraries-text[data-v-6a49c111]{color:var(--scalar-color-1);font-weight:var(--scalar-semibold)}@media screen and (max-width: 600px){.references-classic .client-libraries[data-v-6a49c111]{flex-direction:column}}.selected-client[data-v-e59e2ca0]{color:var(--scalar-color-1);font-size:var(--scalar-small);font-family:var(--scalar-font-code);padding:9px 12px;border-top:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:var(--scalar-background-1);border:var(--scalar-border-width) solid var(--scalar-border-color);border-bottom-left-radius:var(--scalar-radius-lg);border-bottom-right-radius:var(--scalar-radius-lg);min-height:fit-content}.client-libraries-heading[data-v-e59e2ca0]{font-size:var(--scalar-small);font-weight:var(--scalar-font-medium);color:var(--scalar-color-1);padding:9px 12px;background-color:var(--scalar-background-2);display:flex;align-items:center;max-height:32px;border:var(--scalar-border-width) solid var(--scalar-border-color);border-top-left-radius:var(--scalar-radius-lg);border-top-right-radius:var(--scalar-radius-lg)}[data-v-e59e2ca0] .scalar-codeblock-pre .hljs{margin-top:8px}.badge[data-v-3dedb7e4]{color:var(--badge-text-color, var(--scalar-color-2));font-size:var(--scalar-mini);background:var(--badge-background-color, var(--scalar-background-2));border:var(--scalar-border-width) solid var(--badge-border-color, var(--scalar-border-color));padding:2px 6px;border-radius:12px;display:inline-block}.badge.text-orange[data-v-3dedb7e4]{background:color-mix(in srgb,var(--scalar-color-orange),transparent 90%);border:transparent}.badge.text-yellow[data-v-3dedb7e4]{background:color-mix(in srgb,var(--scalar-color-yellow),transparent 90%);border:transparent}.badge.text-red[data-v-3dedb7e4]{background:color-mix(in srgb,var(--scalar-color-red),transparent 90%);border:transparent}.badge.text-purple[data-v-3dedb7e4]{background:color-mix(in srgb,var(--scalar-color-purple),transparent 90%);border:transparent}.badge.text-green[data-v-3dedb7e4]{background:color-mix(in srgb,var(--scalar-cLine truncated
/**
* @vue/shared v3.5.21
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function gu(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return e=>e in t}const vu={},bu=[],yu=()=>{},Ou=()=>!1,wu=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),xu=e=>e.startsWith("onUpdate:"),ku=Object.assign,Su=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},_u=Object.prototype.hasOwnProperty,Tu=(e,t)=>_u.call(e,t),Eu=Array.isArray,Au=e=>"[object Map]"===Lu(e),Cu=e=>"[object Set]"===Lu(e),Pu=e=>"[object Date]"===Lu(e),$u=e=>"function"==typeof e,Du=e=>"string"==typeof e,Iu=e=>"symbol"==typeof e,Mu=e=>null!==e&&"object"==typeof e,Nu=e=>(Mu(e)||$u(e))&&$u(e.then)&&$u(e.catch),Ru=Object.prototype.toString,Lu=e=>Ru.call(e),Bu=e=>"[object Object]"===Lu(e),ju=e=>Du(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,Uu=gu(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),zu=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Fu=/-\w/g,Qu=zu((e=>e.replace(Fu,(e=>e.slice(1).toUpperCase())))),Zu=/\B([A-Z])/g,Hu=zu((e=>e.replace(Zu,"-$1").toLowerCase())),Vu=zu((e=>e.charAt(0).toUpperCase()+e.slice(1))),qu=zu((e=>e?`on${Vu(e)}`:"")),Wu=(e,t)=>!Object.is(e,t),Xu=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Gu=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Yu=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let Ku;const Ju=()=>Ku||(Ku="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function ed(e){if(Eu(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],a=Du(r)?ad(r):ed(r);if(a)for(const e in a)t[e]=a[e]}return t}if(Du(e)||Mu(e))return e}const td=/;(?![^(]*\))/g,nd=/:([^]+)/,rd=/\/\*[^]*?\*\//g;function ad(e){const t={};return e.replace(rd,"").split(td).forEach((e=>{if(e){const n=e.split(nd);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function od(e){let t="";if(Du(e))t=e;else if(Eu(e))for(let n=0;n<e.length;n++){const r=od(e[n]);r&&(t+=r+" ")}else if(Mu(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function id(e){if(!e)return null;let{class:t,style:n}=e;return t&&!Du(t)&&(e.class=od(t)),n&&(e.style=ed(n)),e}const sd=gu("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function ld(e){return!!e||""===e}function cd(e,t){if(e===t)return!0;let n=Pu(e),r=Pu(t);if(n||r)return!(!n||!r)&&e.getTime()===t.getTime();if(n=Iu(e),r=Iu(t),n||r)return e===t;if(n=Eu(e),r=Eu(t),n||r)return!(!n||!r)&&function(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=cd(e[r],t[r]);return n}(e,t);if(n=Mu(e),r=Mu(t),n||r){if(!n||!r)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e){const r=e.hasOwnProperty(n),a=t.hasOwnProperty(n);if(r&&!a||!r&&a||!cd(e[n],t[n]))return!1}}return String(e)===String(t)}function ud(e,t){return e.findIndex((e=>cd(e,t)))}const dd=e=>!(!e||!0!==e.__v_isRef),pd=e=>Du(e)?e:null==e?"":Eu(e)||Mu(e)&&(e.toString===Ru||!$u(e.toString))?dd(e)?pd(e.value):JSON.stringify(e,hd,2):String(e),hd=(e,t)=>dd(t)?hd(e,t.value):Au(t)?{[`Map(${t.size})`]:[...t.entries()].reduce(((e,[t,n],r)=>(e[fd(t,r)+" =>"]=n,e)),{})}:Cu(t)?{[`Set(${t.size})`]:[...t.values()].map((e=>fd(e)))}:Iu(t)?fd(t):!Mu(t)||Eu(t)||Bu(t)?t:String(t),fd=(e,t="")=>{var n;return Iu(e)?`Symbol(${null!=(n=e.description)?n:t})`:e};function md(e){return null==e?"initial":"string"==typeof e?""===e?" ":e:String(e)}
/**
* @vue/reactivity v3.5.21
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let gd,vd;class bd{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=gd,!e&&gd&&(this.index=(gd.scopes||(gd.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=gd;try{return gd=this,e()}finally{gd=t}}}on(){1==++this._on&&(this.prevScope=gd,gd=this)}off(){this._on>0&&0==--this._on&&(gd=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){let t,n;for(this._active=!1,t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}function yd(e){return new bd(e)}function Od(){return gd}function wd(e,t=!1){gd&&gd.cleanups.push(e)}const xd=new WeakSet;class kd{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,gd&&gd.active&&gd.effects.push(this)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,xd.has(this)&&(xd.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||Ed(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,Ud(this),Pd(this);const e=vd,t=Rd;vd=this,Rd=!0;try{return this.fn()}finally{$d(this),vd=e,Rd=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)Md(e);this.deps=this.depsTail=void 0,Ud(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?xd.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Dd(this)&&this.run()}get dirty(){return Dd(this)}}let Sd,_d,Td=0;function Ed(e,t=!1){if(e.flags|=8,t)return e.next=_d,void(_d=e);e.next=Sd,Sd=e}function Ad(){Td++}function Cd(){if(--Td>0)return;if(_d){let e=_d;for(_d=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Sd;){let t=Sd;for(Sd=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,1&t.flags)try{t.trigger()}catch(t){e||(e=t)}t=n}}if(e)throw e}function Pd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function $d(e){let t,n=e.depsTail,r=n;for(;r;){const e=r.prevDep;-1===r.version?(r===n&&(n=e),Md(r),Nd(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Dd(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Id(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Id(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===zd)return;if(e.globalVersion=zd,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!Dd(e)))return;e.flags|=2;const t=e.dep,n=vd,r=Rd;vd=e,Rd=!0;try{Pd(e);const n=e.fn(e._value);(0===t.version||Wu(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{vd=n,Rd=r,$d(e),e.flags&=-3}}function Md(e,t=!1){const{dep:n,prevSub:r,nextSub:a}=e;if(r&&(r.nextSub=a,e.prevSub=void 0),a&&(a.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Md(e,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function Nd(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Rd=!0;const Ld=[];function Bd(){Ld.push(Rd),Rd=!1}function jd(){const e=Ld.pop();Rd=void 0===e||e}function Ud(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=vd;vd=void 0;try{t()}finally{vd=e}}}let zd=0;class Fd{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Qd{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!vd||!Rd||vd===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==vd)t=this.activeLink=new Fd(vd,this),vd.deps?(t.prevDep=vd.depsTail,vd.depsTail.nextDep=t,vd.depsTail=t):vd.deps=vd.depsTail=t,Zd(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=vd.depsTail,t.nextDep=void 0,vd.depsTail.nextDep=t,vd.depsTail=t,vd.deps===t&&(vd.deps=e)}return t}trigger(e){this.version++,zd++,this.notify(e)}notify(e){Ad();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{CLine truncated
/**
* @vue/runtime-core v3.5.21
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function sh(e,t,n,r){try{return r?e(...r):e()}catch(e){ch(e,t,n)}}function lh(e,t,n,r){if($u(e)){const a=sh(e,t,n,r);return a&&Nu(a)&&a.catch((e=>{ch(e,t,n)})),a}if(Eu(e)){const a=[];for(let o=0;o<e.length;o++)a.push(lh(e[o],t,n,r));return a}}function ch(e,t,n,r=!0){t&&t.vnode;const{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||vu;if(t){let r=t.parent;const o=t.proxy,i=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){const t=r.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,o,i))return;r=r.parent}if(a)return Bd(),sh(a,null,10,[e,o,i]),void jd()}!function(e,t,n,r=!0,a=!1){if(a)throw e;console.error(e)}(e,0,0,r,o)}const uh=[];let dh=-1;const ph=[];let hh=null,fh=0;const mh=Promise.resolve();let gh=null;function vh(e){const t=gh||mh;return e?t.then(this?e.bind(this):e):t}function bh(e){if(!(1&e.flags)){const t=kh(e),n=uh[uh.length-1];!n||!(2&e.flags)&&t>=kh(n)?uh.push(e):uh.splice(function(e){let t=dh+1,n=uh.length;for(;t<n;){const r=t+n>>>1,a=uh[r],o=kh(a);o<e||o===e&&2&a.flags?t=r+1:n=r}return t}(t),0,e),e.flags|=1,yh()}}function yh(){gh||(gh=mh.then(Sh))}function Oh(e){Eu(e)?ph.push(...e):hh&&-1===e.id?hh.splice(fh+1,0,e):1&e.flags||(ph.push(e),e.flags|=1),yh()}function wh(e,t,n=dh+1){for(;n<uh.length;n++){const t=uh[n];if(t&&2&t.flags){if(e&&t.id!==e.uid)continue;uh.splice(n,1),n--,4&t.flags&&(t.flags&=-2),t(),4&t.flags||(t.flags&=-2)}}}function xh(e){if(ph.length){const e=[...new Set(ph)].sort(((e,t)=>kh(e)-kh(t)));if(ph.length=0,hh)return void hh.push(...e);for(hh=e,fh=0;fh<hh.length;fh++){const e=hh[fh];4&e.flags&&(e.flags&=-2),8&e.flags||e(),e.flags&=-2}hh=null,fh=0}}const kh=e=>null==e.id?2&e.flags?-1:1/0:e.id;function Sh(e){try{for(dh=0;dh<uh.length;dh++){const e=uh[dh];!e||8&e.flags||(4&e.flags&&(e.flags&=-2),sh(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2))}}finally{for(;dh<uh.length;dh++){const e=uh[dh];e&&(e.flags&=-2)}dh=-1,uh.length=0,xh(),gh=null,(uh.length||ph.length)&&Sh()}}let _h=null,Th=null;function Eh(e){const t=_h;return _h=e,Th=e&&e.type.__scopeId||null,t}function Ah(e,t=_h,n){if(!t)return e;if(e._n)return e;const r=(...n)=>{r._d&&ig(-1);const a=Eh(t);let o;try{o=e(...n)}finally{Eh(a),r._d&&ig(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Ch(e,t){if(null===_h)return e;const n=Ug(_h),r=e.dirs||(e.dirs=[]);for(let e=0;e<t.length;e++){let[a,o,i,s=vu]=t[e];a&&($u(a)&&(a={mounted:a,updated:a}),a.deep&&ih(o),r.push({dir:a,instance:n,value:o,oldValue:void 0,arg:i,modifiers:s}))}return e}function Ph(e,t,n,r){const a=e.dirs,o=t&&t.dirs;for(let i=0;i<a.length;i++){const s=a[i];o&&(s.oldValue=o[i].value);let l=s.dir[r];l&&(Bd(),lh(l,n,8,[e.el,s,e,t]),jd())}}const $h=Symbol("_vte"),Dh=e=>e.__isTeleport,Ih=e=>e&&(e.disabled||""===e.disabled),Mh=e=>e&&(e.defer||""===e.defer),Nh=e=>"undefined"!=typeof SVGElement&&e instanceof SVGElement,Rh=e=>"function"==typeof MathMLElement&&e instanceof MathMLElement,Lh=(e,t)=>{const n=e&&e.to;return Du(n)?t?t(n):null:n},Bh={name:"Teleport",__isTeleport:!0,process(e,t,n,r,a,o,i,s,l,c){const{mc:u,pc:d,pbc:p,o:{insert:h,querySelector:f,createText:m,createComment:g}}=c,v=Ih(t.props);let{shapeFlag:b,children:y,dynamicChildren:O}=t;if(null==e){const e=t.el=m(""),c=t.anchor=m("");h(e,n,r),h(c,n,r);const d=(e,t)=>{16&b&&(a&&a.isCE&&(a.ce._teleportTarget=e),u(y,e,t,a,o,i,s,l))},p=()=>{const e=t.target=Lh(t.props,f),n=Fh(e,t,m,h);e&&("svg"!==i&&Nh(e)?i="svg":"mathml"!==i&&Rh(e)&&(i="mathml"),v||(d(e,n),zh(t,!1)))};v&&(d(n,c),zh(t,!0)),Mh(t.props)?(t.el.__isMounted=!1,Em((()=>{p(),delete t.el.__isMounted}),o)):p()}else{if(Mh(t.props)&&!1===e.el.__isMounted)return void Em((()=>{Bh.process(e,t,n,r,a,o,i,s,l,c)}),o);t.el=e.el,t.targetStart=e.targetStart;const u=t.anchor=e.anchor,h=t.target=e.target,m=t.targetAnchor=e.targetAnchor,g=Ih(e.props),b=g?n:h,y=g?u:m;if("svg"===i||Nh(h)?i="svg":("mathml"===i||Rh(h))&&(i="mathml"),O?(p(e.dynamicChildren,O,b,a,o,i,s),$m(e,t,!0)):l||d(e,t,b,y,a,o,i,s,!1),v)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):jh(t,n,u,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const e=t.target=Lh(t.props,f);e&&jh(t,e,null,c,0)}else g&&jh(t,h,m,c,1);zh(t,v)}},remove(e,t,n,{um:r,o:{remove:a}},o){const{shapeFlag:i,children:s,anchor:l,targetStart:c,targetAnchor:u,target:d,props:p}=e;if(d&&(a(c),a(u)),o&&a(l),16&i){const e=o||!Ih(p);for(let a=0;a<s.length;a++){const o=s[a];r(o,t,n,e,!!o.dynamicChildren)}}},move:jh,hydrate:function(e,t,n,r,a,o,{o:{nextSibling:i,parentNode:s,querySelector:l,insert:c,createText:u}},d){function p(e,t,l,c){t.anchor=d(i(e),t,s(e),n,r,a,o),t.targetStart=l,t.targetAnchor=c}const h=t.target=Lh(t.props,l),f=Ih(t.props);if(h){const s=h._lpa||h.firstChild;if(16&t.shapeFlag)if(f)p(e,t,s,s&&i(s));else{t.anchor=i(e);let l=s;for(;l;){if(l&&8===l.nodeType)if("teleport start anchor"===l.data)t.targetStart=l;else if("teleport anchor"===l.data){t.targetAnchor=l,h._lpa=t.targetAnchor&&i(t.targetAnchor);break}l=i(l)}t.targetAnchor||Fh(h,t,u,c),d(s&&i(s),t,h,n,r,a,o)} Line truncated
/**
* @vue/runtime-dom v3.5.21
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let Zg;const Hg="undefined"!=typeof window&&window.trustedTypes;if(Hg)try{Zg=Hg.createPolicy("vue",{createHTML:e=>e})}catch(Gb){}const Vg=Zg?e=>Zg.createHTML(e):e=>e,qg="undefined"!=typeof document?document:null,Wg=qg&&qg.createElement("template"),Xg={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const a="svg"===t?qg.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?qg.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?qg.createElement(e,{is:n}):qg.createElement(e);return"select"===e&&r&&null!=r.multiple&&a.setAttribute("multiple",r.multiple),a},createText:e=>qg.createTextNode(e),createComment:e=>qg.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>qg.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,a,o){const i=n?n.previousSibling:t.lastChild;if(a&&(a===o||a.nextSibling))for(;t.insertBefore(a.cloneNode(!0),n),a!==o&&(a=a.nextSibling););else{Wg.innerHTML=Vg("svg"===r?`<svg>${e}</svg>`:"mathml"===r?`<math>${e}</math>`:e);const a=Wg.content;if("svg"===r||"mathml"===r){const e=a.firstChild;for(;e.firstChild;)a.appendChild(e.firstChild);a.removeChild(e)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Gg="transition",Yg="animation",Kg=Symbol("_vtc"),Jg={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},ev=ku({},Vh,Jg),tv=(e=>(e.displayName="Transition",e.props=ev,e))(((e,{slots:t})=>Fg(Xh,function(e){const t={};for(const n in e)n in Jg||(t[n]=e[n]);if(!1===e.css)return t;const{name:n="v",type:r,duration:a,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:c=i,appearToClass:u=s,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:h=`${n}-leave-to`}=e,f=function(e){if(null==e)return null;if(Mu(e))return[av(e.enter),av(e.leave)];{const t=av(e);return[t,t]}}(a),m=f&&f[0],g=f&&f[1],{onBeforeEnter:v,onEnter:b,onEnterCancelled:y,onLeave:O,onLeaveCancelled:w,onBeforeAppear:x=v,onAppear:k=b,onAppearCancelled:S=y}=t,_=(e,t,n,r)=>{e._enterCancelled=r,iv(e,t?u:s),iv(e,t?c:i),n&&n()},T=(e,t)=>{e._isLeaving=!1,iv(e,d),iv(e,h),iv(e,p),t&&t()},E=e=>(t,n)=>{const a=e?k:b,i=()=>_(t,e,n);nv(a,[t,i]),sv((()=>{iv(t,e?l:o),ov(t,e?u:s),rv(a)||cv(t,r,m,i)}))};return ku(t,{onBeforeEnter(e){nv(v,[e]),ov(e,o),ov(e,i)},onBeforeAppear(e){nv(x,[e]),ov(e,l),ov(e,c)},onEnter:E(!1),onAppear:E(!0),onLeave(e,t){e._isLeaving=!0;const n=()=>T(e,t);ov(e,d),e._enterCancelled?(ov(e,p),pv()):(pv(),ov(e,p)),sv((()=>{e._isLeaving&&(iv(e,d),ov(e,h),rv(O)||cv(e,r,g,n))})),nv(O,[e,n])},onEnterCancelled(e){_(e,!1,void 0,!0),nv(y,[e])},onAppearCancelled(e){_(e,!0,void 0,!0),nv(S,[e])},onLeaveCancelled(e){T(e),nv(w,[e])}})}(e),t))),nv=(e,t=[])=>{Eu(e)?e.forEach((e=>e(...t))):e&&e(...t)},rv=e=>!!e&&(Eu(e)?e.some((e=>e.length>1)):e.length>1);function av(e){return(e=>{const t=Du(e)?Number(e):NaN;return isNaN(t)?e:t})(e)}function ov(e,t){t.split(/\s+/).forEach((t=>t&&e.classList.add(t))),(e[Kg]||(e[Kg]=new Set)).add(t)}function iv(e,t){t.split(/\s+/).forEach((t=>t&&e.classList.remove(t)));const n=e[Kg];n&&(n.delete(t),n.size||(e[Kg]=void 0))}function sv(e){requestAnimationFrame((()=>{requestAnimationFrame(e)}))}let lv=0;function cv(e,t,n,r){const a=e._endId=++lv,o=()=>{a===e._endId&&r()};if(null!=n)return setTimeout(o,n);const{type:i,timeout:s,propCount:l}=function(e,t){const n=window.getComputedStyle(e),r=e=>(n[e]||"").split(", "),a=r(`${Gg}Delay`),o=r(`${Gg}Duration`),i=uv(a,o),s=r(`${Yg}Delay`),l=r(`${Yg}Duration`),c=uv(s,l);let u=null,d=0,p=0;t===Gg?i>0&&(u=Gg,d=i,p=o.length):t===Yg?c>0&&(u=Yg,d=c,p=l.length):(d=Math.max(i,c),u=d>0?i>c?Gg:Yg:null,p=u?u===Gg?o.length:l.length:0);return{type:u,timeout:d,propCount:p,hasTransform:u===Gg&&/\b(?:transform|all)(?:,|$)/.test(r(`${Gg}Property`).toString())}}(e,t);if(!i)return r();const c=i+"end";let u=0;const d=()=>{e.removeEventListener(c,p),o()},p=t=>{t.target===e&&++u>=l&&d()};setTimeout((()=>{u<l&&d()}),s+1),e.addEventListener(c,p)}function uv(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map(((t,n)=>dv(t)+dv(e[n]))))}function dv(e){return"auto"===e?0:1e3*Number(e.slice(0,-1).replace(",","."))}function pv(){return document.body.offsetHeight}const hv=Symbol("_vod"),fv=Symbol("_vsh"),mv={name:"show",beforeMount(e,{value:t},{transition:n}){e[hv]="none"===e.style.display?"":e.style.display,n&&t?n.beforeEnter(e):gv(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),gv(e,!0),r. Line truncated
/*!
* vue-router v4.6.2
* (c) 2025 Eduardo San Martin Morote
* @license MIT
*/
const obe=()=>{},ibe=Array.isArray;function sbe(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function lbe(e,t){return ibe(e)?cbe(e,t):ibe(t)?cbe(t,e):e===t}function cbe(e,t){return ibe(t)?e.length===t.length&&e.every(((e,n)=>e===t[n])):1===e.length&&e[0]===t}const ube=Symbol(""),dbe=Symbol("");
/*!
* vue-router v4.6.2
* (c) 2025 Eduardo San Martin Morote
* @license MIT
*/function pbe(e){const t=dm(ube),n=dm(dbe),r=zg((()=>{const n=Hp(e.to);return t.resolve(n)})),a=zg((()=>{const{matched:e}=r.value,{length:t}=e,a=e[t-1],o=n.matched;if(!a||!o.length)return-1;const i=o.findIndex(sbe.bind(null,a));if(i>-1)return i;const s=fbe(e[t-2]);return t>1&&fbe(a)===s&&o[o.length-1].path!==s?o.findIndex(sbe.bind(null,e[t-2])):i})),o=zg((()=>a.value>-1&&function(e,t){for(const n in t){const r=t[n],a=e[n];if("string"==typeof r){if(r!==a)return!1}else if(!ibe(a)||a.length!==r.length||r.some(((e,t)=>e!==a[t])))return!1}return!0}(n.params,r.value.params))),i=zg((()=>a.value>-1&&a.value===n.matched.length-1&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!lbe(e[n],t[n]))return!1;return!0}(n.params,r.value.params)));return{route:r,href:zg((()=>r.value.href)),isActive:o,isExactActive:i,navigate:function(n={}){if(function(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.defaultPrevented||void 0!==e.button&&0!==e.button)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}(n)){const n=t[Hp(e.replace)?"replace":"push"](Hp(e.to)).catch(obe);return e.viewTransition&&"undefined"!=typeof document&&"startViewTransition"in document&&document.startViewTransition((()=>n)),n}return Promise.resolve()}}}const hbe=nf({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:pbe,setup(e,{slots:t}){const n=Ap(pbe(e)),{options:r}=dm(ube),a=zg((()=>({[mbe(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[mbe(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive})));return()=>{const r=t.default&&(1===(o=t.default(n)).length?o[0]:o);var o;return e.custom?r:Fg("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:a.value},r)}}});function fbe(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const mbe=(e,t,n)=>null!=e?e:null!=t?t:n;Vs({uid:es().brand(),name:es().optional().default("Default Environment"),color:es().optional().default("#FFFFFF"),value:es().default(""),isDefault:Es().optional()}),qie.domEventHandlers({keydown(e,t){if("Backspace"===e.key){const{state:n}=t,{from:r,to:a}=n.selection.main;if(0===r&&a===n.doc.length)return t.dispatch({changes:{from:0,to:n.doc.length},selection:{anchor:0}}),e.preventDefault(),!0;if(r===a&&r>0&&"}}"===n.doc.sliceString(r-2,r))return t.dispatch({changes:{from:r-2,to:a},selection:{anchor:r-2}}),e.preventDefault(),!0}return!1}});const gbe=nf({__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,a=zg((()=>aV(n.method))),o=Object.entries(rV).map((([e])=>({id:e,label:e.toUpperCase(),color:aV(e).colorClass}))),i=zg({get:()=>o.find((({id:e})=>e===n.method)),set:e=>e?.id&&r("change",e.id)}),s=Xw({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 border-r",false:"cursor-auto"}}}),l=zg((()=>a.value.short));return(e,t)=>e.isEditable?(ag(),cg(Hp(a9),{key:0,modelValue:i.value,"onUpdate:modelValue":t[0]||(t[0]=e=>i.value=e),class:"font-code scalar-client mt-1 text-sm",options:Hp(o)},{default:Ah((()=>[fg("div",{class:od(["h-full",{"pointer-events-none":!e.isEditable}])},[fg("button",{class:od(["relative h-full",Hp(Gw)(Hp(s)({isSquare:e.isSquare,isEditable:e.isEditable}),a.value.colorClass)]),type:"button"},[fg("span",null,pd(l.value),1)],2)],2)])),_:1},8,["modelValue","options"])):(ag(),lg("div",{key:1,class:od(["relative gap-1 whitespace-nowrap",Hp(Gw)(Hp(s)({isSquare:e.isSquare,isEditable:e.isEditable}),a.value.colorClass)]),type:"button"},pd(a.value.short),3))}}),vbe=Kee(gbe,[["__scopeId","data-v-076b14a1"]]),bbe=(e,t=2)=>e>1e3?(e/1e3).toFixed(t)+"s":e+"ms",ybe=Vs({description:es().optional()}),Obe=Vs({uid:HH.brand(),nameKey:es().optional().default("")}),wbe=ybe.extend({type:cl("apiKey"),name:es().optional().default(""),in:sl(["query","header","cookie"]).optional().default("header").catch("header")}),xbe=Vs({value:es().default("")}),kbe=wbe.merge(Obe).merge(xbe),Sbe=ybe.extend({type:cl("http"),scheme:es().toLowerCase().pipe(sl(["basic","bearer"])).optional().default("basic"),bearerFormat:Ws([cl("JWT"),es()]).optional().default("JWT")}),_be=Vs({username:es().default(""),password:es().default(""),token:es().default("")}),Tbe=Sbe.merge(Obe).merge(_be),Ebe=ybe.extend({type:cl("openIdConnect"),openIdConnectUrl:es().optional().default("")}),Abe=Ebe.merge(Obe),Cbe=es().default(""),Pbe=es().default(""),$be=Vs({refreshUrl:es().optional().default(""),scopes:nl(es(),es().optionalLine truncated
/*!
* tabbable 6.2.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/;var rIe=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],aIe=rIe.join(","),oIe="undefined"==typeof Element,iIe=oIe?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,sIe=!oIe&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},lIe=function e(t,n){var r;void 0===n&&(n=!0);var a=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===a||"true"===a||n&&t&&e(t.parentNode)},cIe=function(e,t,n){if(lIe(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(aIe));return t&&iIe.call(e,aIe)&&r.unshift(e),r.filter(n)},uIe=function e(t,n,r){for(var a=[],o=Array.from(t);o.length;){var i=o.shift();if(!lIe(i,!1))if("SLOT"===i.tagName){var s=i.assignedElements(),l=e(s.length?s:i.children,!0,r);r.flatten?a.push.apply(a,l):a.push({scopeParent:i,candidates:l})}else{iIe.call(i,aIe)&&r.filter(i)&&(n||!t.includes(i))&&a.push(i);var c=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),u=!lIe(c,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(c&&u){var d=e(!0===c?i.children:c.children,!0,r);r.flatten?a.push.apply(a,d):a.push({scopeParent:i,candidates:d})}else o.unshift.apply(o,i.children)}}return a},dIe=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},pIe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!dIe(e)?0:e.tabIndex},hIe=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},fIe=function(e){return"INPUT"===e.tagName},mIe=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},gIe=function(e,t){return!(t.disabled||lIe(t)||function(e){return fIe(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var a=iIe.call(e,"details>summary:first-of-type")?e.parentElement:e;if(iIe.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return mIe(e)}else{if("function"==typeof r){for(var o=e;e;){var i=e.parentElement,s=sIe(e);if(i&&!i.shadowRoot&&!0===r(i))return mIe(e);e=e.assignedSlot?e.assignedSlot:i||s===e.ownerDocument?i:s.host}e=o}if(function(e){var t,n,r,a,o=e&&sIe(e),i=null===(t=o)||void 0===t?void 0:t.host,s=!1;if(o&&o!==e)for(s=!!(null!==(n=i)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(i)||null!=e&&null!==(a=e.ownerDocument)&&void 0!==a&&a.contains(e));!s&&i;){var l,c,u;s=!(null===(c=i=null===(l=o=sIe(i))||void 0===l?void 0:l.host)||void 0===c||null===(u=c.ownerDocument)||void 0===u||!u.contains(i))}return s}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!iIe.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},vIe=function(e,t){return!(function(e){return function(e){return fIe(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||sIe(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var a=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!a||a===e}(e)}(t)||pIe(t)<0||!gIe(e,t))},bIe=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},yIe=function e(t){var n=[],r=[];return t.forEach((function(t,a){var o=!!t.scopeParent,i=o?t.scopeParent:t,s=function(e,t){var n=pIe(e);return n<0&&t&&!dIe(e)?0:n}(i,o),l=o?e(t.candidates):i;0===s?o?n.push.apply(n,l):n.push(i):r.push({documentOrder:a,tabIndex:s,item:t,isScope:o,content:l})})),r.sort(hIe).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},OIe=function(e,t){if(t=t||{},!e)throw new Error(Line truncated
/*!
* focus-trap 7.6.2
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
*/function kIe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function SIe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function TIe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_Ie(Object(n),!0).forEach((function(t){SIe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_Ie(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var EIe=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},AIe=function(e){return EIe(e)&&!e.shiftKey},CIe=function(e){return EIe(e)&&e.shiftKey},PIe=function(e){return setTimeout(e,0)},$Ie=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"function"==typeof e?e.apply(void 0,n):e},DIe=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},IIe=[],MIe=function(e,t){var n,r=(null==t?void 0:t.document)||document,a=(null==t?void 0:t.trapStack)||IIe,o=TIe({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:AIe,isKeyBackward:CIe},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},s=function(e,t,n){return e&&void 0!==e[t]?e[t]:o[n||t]},l=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return i.containerGroups.findIndex((function(t){var r=t.container,a=t.tabbableNodes;return r.contains(e)||(null==n?void 0:n.includes(r))||a.find((function(t){return t===e}))}))},c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.hasFallback,a=void 0!==n&&n,i=t.params,s=void 0===i?[]:i,l=o[e];if("function"==typeof l&&(l=l.apply(void 0,function(e){return function(e){if(Array.isArray(e))return kIe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return kIe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kIe(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(s))),!0===l&&(l=void 0),!l){if(void 0===l||!1===l)return l;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var c=l;if("string"==typeof l){try{c=r.querySelector(l)}catch(t){throw new Error("`".concat(e,'` appears to be an invalid selector; error="').concat(t.message,'"'))}if(!c&&!a)throw new Error("`".concat(e,"` as selector refers to no known node"))}return c},u=function(){var e=c("initialFocus",{hasFallback:!0});if(!1===e)return!1;if(void 0===e||e&&!xIe(e,o.tabbableOptions))if(l(r.activeElement)>=0)e=r.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||c("fallbackFocus")}else null===e&&(e=c("fallbackFocus"));if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},d=function(){if(i.containerGroups=i.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?uIe([e],t.includeContainer,{filter:vIe.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:bIe}):cIe(e,t.includeContainer,vIe.bind(null,t)),yIe(n)}(e,o.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?uIe([e],t.includeContainer,{filter:gIe.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):cIe(e,t.includeContainer,gIe.bind(null,t))}(e,o.tabbableOptions),r=t.length>0?t[0]:void 0,a=t.length>0?t[t.length-1]:void 0,i=n.find((function(e){return OIe(e)})),s=n.slice().reverse().find((function(e){return OIe(e)})),l=!!t.find((function(e){return pIe(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:l,firstTabbableNode:r,lastTabbableNode:a,firstDomTabbableNode:i,lastDomTabbableNode:s,nextTabbableNode:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=t.indexOf(e);return a<0?r?n.slice(n.indexOf(e)+1).find((function(e){return OIe(e)})):n.slice(0,n.indexOf(eLine truncated
//# sourceMappingURL=/sm/7ea4dd333ea74cfb08ca3f0085f970e2739df4317d6e214dff3b18d444729e07.map
+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{DOC_TITLE}}</title>
</head>
<body>
<script id="api-reference" data-url="{{BASE_URI}}/doc.json" data-configuration='{"showDeveloperTools":"never"}'></script>
<script src="{{BASE_URI}}/api-reference.js"></script>
</body>
</html>
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.