diff --git a/.gitignore b/.gitignore index ea7a71a2..c67a6e18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .idea .vscode !*.example -config.yaml +/config.yaml *.log paopao-ce* /release diff --git a/Makefile b/Makefile index 4d0b94a2..3104045c 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,28 @@ windows-x64: @echo Build paopao-ce [windows-x64] CGO_ENABLED=$(CGO_ENABLED) @CGO_ENABLED=$(CGO_ENABLED) GOOS=windows GOARCH=amd64 go build -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $(RELEASE_WINDOWS_AMD64)/$(basename $(TARGET)).exe +.PHONY: generate +generate: gen-mir gen-grpc + +.PHONY: gen-mir +gen-mir: + @go generate mirc/main.go + @go fmt ./auto/api/... + +.PHONY: gen-grpc +gen-grpc: + @rm -rf auto/rpc + @buf generate proto + @go fmt ./auto/rpc/... + +.PHONY: proto-mod +proto-mod: + @cd proto/ && buf mod update + +.PHONY: proto-lint +proto-lint: + @cd proto/ && buf lint + clean: @go clean @find ./release -type f -exec rm -r {} + @@ -83,7 +105,15 @@ test: @go test ./... pre-commit: fmt - go mod tidy + @go mod tidy + +.PHONY: install-protobuf-plugins +install-protobuf-plugins: + @go install github.com/bufbuild/buf/cmd/buf@v1.11.0 + @go install github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking@v1.11.0 + @go install github.com/bufbuild/buf/cmd/protoc-gen-buf-lint@v1.11.0 + @go install google.golang.org/protobuf/cmd/protoc-gen-go@latest + @go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest help: @echo "make: make" diff --git a/README.md b/README.md index 525d564a..240248c5 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Web端: 更多演示请前往[官网](https://www.paopao.info)体验(谢绝灌水) 桌面端: -![](docs/proposal/.assets/00-00.png) +![](docs/proposal/.assets/000-00.png)

(back to top)

@@ -316,13 +316,15 @@ release/paopao-ce --no-default-features --features sqlite3,localoss,loggerfile,r 目前支持的功能集合: | 功能项 | 类别 | 状态 | 备注 | | ----- | ----- | ----- | ----- | -|`OldWeb` | 子服务 | 稳定(默认) | 开启旧的Web服务 | -|`Web` | 子服务 | WIP | 开启Web服务| +|`Web` | 子服务 | 内测 | 开启Web服务| |`Admin` | 子服务 | WIP | 开启Admin后台运维服务| |`SpaceX` | 子服务 | WIP | 开启SpaceX服务| |`Bot` | 子服务 | WIP | 开启Bot服务| |`NativeOBS` | 子服务 | WIP | 开启NativeOBS服务| -|`Deprecated:Web` | 子服务 | 稳定 | Deprecated(关闭) OldWeb服务| +|`Docs` | 子服务 | WIP | 开启开发者文档服务| +|`Frontend:Web` | 子服务 | 内测 | 开启独立前端服务| +|`Frontend:EmbedWeb` | 子服务 | 内测 | 开启内嵌于后端Web API服务中的前端服务| +|`Deprecated:Web` | 子服务 | 稳定 | 开启旧的Web服务| |`Gorm` | 数据库 | 稳定(默认) | 使用[gorm](https://github.com/go-gorm/gorm)作为数据库的ORM,默认使用 `Gorm` + `MySQL`组合| |`Sqlx`| 数据库 | WIP | 使用[sqlx](https://github.com/jmoiron/sqlx)作为数据库的ORM| |`MySQL`| 数据库 | 稳定(默认) | 使用MySQL作为数据库| @@ -494,7 +496,7 @@ jc/alimy * `jc/*`是代码库维护者的开发分支,一般包含一些局部优化或者bug修复代码,有时可以直接将代码merge到`dev/beta`分支,原则上不允许直接merge代码到`main`主分支。 **代码分支演进图** -![](docs/proposal/.assets/00-01.png) +![](docs/proposal/.assets/000-01.png) ### 其他说明 diff --git a/ROADMAP.md b/ROADMAP.md new file mode 100644 index 00000000..5efdb9cd --- /dev/null +++ b/ROADMAP.md @@ -0,0 +1,30 @@ +## Roadmap for paopao-ce +paopao-ce roadmap. + +### v0.2.0 +* [x] add `Friendship` feature +* [ ] add `Lightship` feature +* [ ] add `Sqlx` feature +* [ ] add new `Web` service +* [x] add `Deprecated:OldWeb` feature +* [x] support run multiple service in single paopao-ce instance +* [x] use [go-mir](https://github.com/alimy/mir) optimize paopao-ce source code architecture + +### Next +* [ ] add `Followship` feature +* [ ] add `Bleve` feature +* [ ] add `SpaceX` feature +* [ ] add `Bot` feature +* [ ] add `Admin` feature +* [ ] add `NativeOBS` feature +* [ ] add `Mobile` gRPC API service feature +* [ ] add admin web frontend +* [ ] add tweet forwarding support +* [ ] add tweet resource access control base on simple RBAC support +* [ ] add user's `Activation Code` feature support +* [ ] add user block feature support +* [ ] optimize current message push logic service use `ims` module +* [ ] optimize media tweet submit logic +* [ ] optimize topics service +* [ ] optimize backend data logic service(optimize database CRUD operate) +* [ ] optimize search logic service diff --git a/auto/api/m/v1/user.go b/auto/api/m/v1/user.go new file mode 100644 index 00000000..431343e7 --- /dev/null +++ b/auto/api/m/v1/user.go @@ -0,0 +1,140 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" +) + +type LoginReq struct { + AgentInfo AgentInfo `json:"agent_info"` + Name string `json:"name"` + Passwd string `json:"passwd"` +} + +type AgentInfo struct { + Platform string `json:"platform"` + UserAgent string `json:"user_agent"` +} + +type LoginResp struct { + UserInfo + ServerInfo ServerInfo `json:"server_info"` + JwtToken string `json:"jwt_token"` +} + +type ServerInfo struct { + ApiVer string `json:"api_ver"` +} + +type UserInfo struct { + Name string `json:"name"` +} + +type User interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) + + mustEmbedUnimplementedUserServant() +} + +type UserBinding interface { + BindLogin(*gin.Context) (*LoginReq, mir.Error) + + mustEmbedUnimplementedUserBinding() +} + +type UserRender interface { + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) + + mustEmbedUnimplementedUserRender() +} + +// RegisterUserServant register User servant to gin +func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { + router := e.Group("m/v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("POST", "/user/logout/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + r.RenderLogout(c, s.Logout()) + }) + + router.Handle("POST", "/user/login/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindLogin(c) + if err != nil { + r.RenderLogin(c, nil, err) + return + } + resp, err := s.Login(req) + r.RenderLogin(c, resp, err) + }) + +} + +// UnimplementedUserServant can be embedded to have forward compatible implementations. +type UnimplementedUserServant struct { +} + +func (UnimplementedUserServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedUserServant) Logout() mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) mustEmbedUnimplementedUserServant() {} + +// UnimplementedUserRender can be embedded to have forward compatible implementations. +type UnimplementedUserRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedUserRender) RenderLogout(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedUserRender) RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedUserRender) mustEmbedUnimplementedUserRender() {} + +// UnimplementedUserBinding can be embedded to have forward compatible implementations. +type UnimplementedUserBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedUserBinding) BindLogin(c *gin.Context) (*LoginReq, mir.Error) { + obj := new(LoginReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedUserBinding) mustEmbedUnimplementedUserBinding() {} diff --git a/auto/api/r/v1/user.go b/auto/api/r/v1/user.go new file mode 100644 index 00000000..1850b157 --- /dev/null +++ b/auto/api/r/v1/user.go @@ -0,0 +1,140 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" +) + +type LoginReq struct { + AgentInfo AgentInfo `json:"agent_info"` + Name string `json:"name"` + Passwd string `json:"passwd"` +} + +type AgentInfo struct { + Platform string `json:"platform"` + UserAgent string `json:"user_agent"` +} + +type LoginResp struct { + UserInfo + ServerInfo ServerInfo `json:"server_info"` + JwtToken string `json:"jwt_token"` +} + +type ServerInfo struct { + ApiVer string `json:"api_ver"` +} + +type UserInfo struct { + Name string `json:"name"` +} + +type User interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) + + mustEmbedUnimplementedUserServant() +} + +type UserBinding interface { + BindLogin(*gin.Context) (*LoginReq, mir.Error) + + mustEmbedUnimplementedUserBinding() +} + +type UserRender interface { + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) + + mustEmbedUnimplementedUserRender() +} + +// RegisterUserServant register User servant to gin +func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { + router := e.Group("r/v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("POST", "/user/logout/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + r.RenderLogout(c, s.Logout()) + }) + + router.Handle("POST", "/user/login/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindLogin(c) + if err != nil { + r.RenderLogin(c, nil, err) + return + } + resp, err := s.Login(req) + r.RenderLogin(c, resp, err) + }) + +} + +// UnimplementedUserServant can be embedded to have forward compatible implementations. +type UnimplementedUserServant struct { +} + +func (UnimplementedUserServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedUserServant) Logout() mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) mustEmbedUnimplementedUserServant() {} + +// UnimplementedUserRender can be embedded to have forward compatible implementations. +type UnimplementedUserRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedUserRender) RenderLogout(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedUserRender) RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedUserRender) mustEmbedUnimplementedUserRender() {} + +// UnimplementedUserBinding can be embedded to have forward compatible implementations. +type UnimplementedUserBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedUserBinding) BindLogin(c *gin.Context) (*LoginReq, mir.Error) { + obj := new(LoginReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedUserBinding) mustEmbedUnimplementedUserBinding() {} diff --git a/auto/api/s/v1/user.go b/auto/api/s/v1/user.go new file mode 100644 index 00000000..ef2c855b --- /dev/null +++ b/auto/api/s/v1/user.go @@ -0,0 +1,150 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" +) + +type LoginReq struct { + AgentInfo AgentInfo `json:"agent_info"` + Name string `json:"name"` + Passwd string `json:"passwd"` +} + +type AgentInfo struct { + Platform string `json:"platform"` + UserAgent string `json:"user_agent"` +} + +type LoginResp struct { + UserInfo + ServerInfo ServerInfo `json:"server_info"` + JwtToken string `json:"jwt_token"` +} + +type ServerInfo struct { + ApiVer string `json:"api_ver"` +} + +type UserInfo struct { + Name string `json:"name"` +} + +type User interface { + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) + Index() mir.Error + + mustEmbedUnimplementedUserServant() +} + +type UserBinding interface { + BindLogin(*gin.Context) (*LoginReq, mir.Error) + + mustEmbedUnimplementedUserBinding() +} + +type UserRender interface { + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) + RenderIndex(*gin.Context, mir.Error) + + mustEmbedUnimplementedUserRender() +} + +// RegisterUserServant register User servant to gin +func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { + router := e.Group("s/v1") + + // register routes info to router + router.Handle("POST", "/user/logout/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + r.RenderLogout(c, s.Logout()) + }) + + router.Handle("POST", "/user/login/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindLogin(c) + if err != nil { + r.RenderLogin(c, nil, err) + return + } + resp, err := s.Login(req) + r.RenderLogin(c, resp, err) + }) + + router.Handle("GET", "/index/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + r.RenderIndex(c, s.Index()) + }) + +} + +// UnimplementedUserServant can be embedded to have forward compatible implementations. +type UnimplementedUserServant struct { +} + +func (UnimplementedUserServant) Logout() mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) Index() mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) mustEmbedUnimplementedUserServant() {} + +// UnimplementedUserRender can be embedded to have forward compatible implementations. +type UnimplementedUserRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedUserRender) RenderLogout(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedUserRender) RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedUserRender) RenderIndex(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedUserRender) mustEmbedUnimplementedUserRender() {} + +// UnimplementedUserBinding can be embedded to have forward compatible implementations. +type UnimplementedUserBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedUserBinding) BindLogin(c *gin.Context) (*LoginReq, mir.Error) { + obj := new(LoginReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedUserBinding) mustEmbedUnimplementedUserBinding() {} diff --git a/auto/api/v1/admin.go b/auto/api/v1/admin.go new file mode 100644 index 00000000..6872d123 --- /dev/null +++ b/auto/api/v1/admin.go @@ -0,0 +1,95 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type Admin interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + ChangeUserStatus(*web.ChangeUserStatusReq) mir.Error + + mustEmbedUnimplementedAdminServant() +} + +type AdminBinding interface { + BindChangeUserStatus(*gin.Context) (*web.ChangeUserStatusReq, mir.Error) + + mustEmbedUnimplementedAdminBinding() +} + +type AdminRender interface { + RenderChangeUserStatus(*gin.Context, mir.Error) + + mustEmbedUnimplementedAdminRender() +} + +// RegisterAdminServant register Admin servant to gin +func RegisterAdminServant(e *gin.Engine, s Admin, b AdminBinding, r AdminRender) { + router := e.Group("v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("POST", "/admin/user/status", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindChangeUserStatus(c) + if err != nil { + r.RenderChangeUserStatus(c, err) + return + } + r.RenderChangeUserStatus(c, s.ChangeUserStatus(req)) + }) + +} + +// UnimplementedAdminServant can be embedded to have forward compatible implementations. +type UnimplementedAdminServant struct { +} + +func (UnimplementedAdminServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedAdminServant) ChangeUserStatus(req *web.ChangeUserStatusReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedAdminServant) mustEmbedUnimplementedAdminServant() {} + +// UnimplementedAdminRender can be embedded to have forward compatible implementations. +type UnimplementedAdminRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedAdminRender) RenderChangeUserStatus(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedAdminRender) mustEmbedUnimplementedAdminRender() {} + +// UnimplementedAdminBinding can be embedded to have forward compatible implementations. +type UnimplementedAdminBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedAdminBinding) BindChangeUserStatus(c *gin.Context) (*web.ChangeUserStatusReq, mir.Error) { + obj := new(web.ChangeUserStatusReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedAdminBinding) mustEmbedUnimplementedAdminBinding() {} diff --git a/auto/api/v1/alipay_priv.go b/auto/api/v1/alipay_priv.go new file mode 100644 index 00000000..4cb3fe0a --- /dev/null +++ b/auto/api/v1/alipay_priv.go @@ -0,0 +1,162 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type AlipayPriv interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + UserWalletBills(*web.UserWalletBillsReq) (*web.UserWalletBillsResp, mir.Error) + UserRechargeResult(*web.UserRechargeResultReq) (*web.UserRechargeResultResp, mir.Error) + UserRechargeLink(*web.UserRechargeLinkReq) (*web.UserRechargeLinkResp, mir.Error) + + mustEmbedUnimplementedAlipayPrivServant() +} + +type AlipayPrivBinding interface { + BindUserWalletBills(*gin.Context) (*web.UserWalletBillsReq, mir.Error) + BindUserRechargeResult(*gin.Context) (*web.UserRechargeResultReq, mir.Error) + BindUserRechargeLink(*gin.Context) (*web.UserRechargeLinkReq, mir.Error) + + mustEmbedUnimplementedAlipayPrivBinding() +} + +type AlipayPrivRender interface { + RenderUserWalletBills(*gin.Context, *web.UserWalletBillsResp, mir.Error) + RenderUserRechargeResult(*gin.Context, *web.UserRechargeResultResp, mir.Error) + RenderUserRechargeLink(*gin.Context, *web.UserRechargeLinkResp, mir.Error) + + mustEmbedUnimplementedAlipayPrivRender() +} + +// RegisterAlipayPrivServant register AlipayPriv servant to gin +func RegisterAlipayPrivServant(e *gin.Engine, s AlipayPriv, b AlipayPrivBinding, r AlipayPrivRender) { + router := e.Group("v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("GET", "/user/wallet/bills", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindUserWalletBills(c) + if err != nil { + r.RenderUserWalletBills(c, nil, err) + return + } + resp, err := s.UserWalletBills(req) + r.RenderUserWalletBills(c, resp, err) + }) + + router.Handle("GET", "/user/recharge", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindUserRechargeResult(c) + if err != nil { + r.RenderUserRechargeResult(c, nil, err) + return + } + resp, err := s.UserRechargeResult(req) + r.RenderUserRechargeResult(c, resp, err) + }) + + router.Handle("POST", "/user/recharge", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindUserRechargeLink(c) + if err != nil { + r.RenderUserRechargeLink(c, nil, err) + return + } + resp, err := s.UserRechargeLink(req) + r.RenderUserRechargeLink(c, resp, err) + }) + +} + +// UnimplementedAlipayPrivServant can be embedded to have forward compatible implementations. +type UnimplementedAlipayPrivServant struct { +} + +func (UnimplementedAlipayPrivServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedAlipayPrivServant) UserWalletBills(req *web.UserWalletBillsReq) (*web.UserWalletBillsResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedAlipayPrivServant) UserRechargeResult(req *web.UserRechargeResultReq) (*web.UserRechargeResultResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedAlipayPrivServant) UserRechargeLink(req *web.UserRechargeLinkReq) (*web.UserRechargeLinkResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedAlipayPrivServant) mustEmbedUnimplementedAlipayPrivServant() {} + +// UnimplementedAlipayPrivRender can be embedded to have forward compatible implementations. +type UnimplementedAlipayPrivRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedAlipayPrivRender) RenderUserWalletBills(c *gin.Context, data *web.UserWalletBillsResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedAlipayPrivRender) RenderUserRechargeResult(c *gin.Context, data *web.UserRechargeResultResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedAlipayPrivRender) RenderUserRechargeLink(c *gin.Context, data *web.UserRechargeLinkResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedAlipayPrivRender) mustEmbedUnimplementedAlipayPrivRender() {} + +// UnimplementedAlipayPrivBinding can be embedded to have forward compatible implementations. +type UnimplementedAlipayPrivBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedAlipayPrivBinding) BindUserWalletBills(c *gin.Context) (*web.UserWalletBillsReq, mir.Error) { + obj := new(web.UserWalletBillsReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedAlipayPrivBinding) BindUserRechargeResult(c *gin.Context) (*web.UserRechargeResultReq, mir.Error) { + obj := new(web.UserRechargeResultReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedAlipayPrivBinding) BindUserRechargeLink(c *gin.Context) (*web.UserRechargeLinkReq, mir.Error) { + obj := new(web.UserRechargeLinkReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedAlipayPrivBinding) mustEmbedUnimplementedAlipayPrivBinding() {} diff --git a/auto/api/v1/alipay_pub.go b/auto/api/v1/alipay_pub.go new file mode 100644 index 00000000..3119119e --- /dev/null +++ b/auto/api/v1/alipay_pub.go @@ -0,0 +1,85 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type AlipayPub interface { + AlipayNotify(*web.AlipayNotifyReq) mir.Error + + mustEmbedUnimplementedAlipayPubServant() +} + +type AlipayPubBinding interface { + BindAlipayNotify(*gin.Context) (*web.AlipayNotifyReq, mir.Error) + + mustEmbedUnimplementedAlipayPubBinding() +} + +type AlipayPubRender interface { + RenderAlipayNotify(*gin.Context, mir.Error) + + mustEmbedUnimplementedAlipayPubRender() +} + +// RegisterAlipayPubServant register AlipayPub servant to gin +func RegisterAlipayPubServant(e *gin.Engine, s AlipayPub, b AlipayPubBinding, r AlipayPubRender) { + router := e.Group("v1") + + // register routes info to router + router.Handle("POST", "/alipay/notify", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindAlipayNotify(c) + if err != nil { + r.RenderAlipayNotify(c, err) + return + } + r.RenderAlipayNotify(c, s.AlipayNotify(req)) + }) + +} + +// UnimplementedAlipayPubServant can be embedded to have forward compatible implementations. +type UnimplementedAlipayPubServant struct { +} + +func (UnimplementedAlipayPubServant) AlipayNotify(req *web.AlipayNotifyReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedAlipayPubServant) mustEmbedUnimplementedAlipayPubServant() {} + +// UnimplementedAlipayPubRender can be embedded to have forward compatible implementations. +type UnimplementedAlipayPubRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedAlipayPubRender) RenderAlipayNotify(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedAlipayPubRender) mustEmbedUnimplementedAlipayPubRender() {} + +// UnimplementedAlipayPubBinding can be embedded to have forward compatible implementations. +type UnimplementedAlipayPubBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedAlipayPubBinding) BindAlipayNotify(c *gin.Context) (*web.AlipayNotifyReq, mir.Error) { + obj := new(web.AlipayNotifyReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedAlipayPubBinding) mustEmbedUnimplementedAlipayPubBinding() {} diff --git a/auto/api/v1/core.go b/auto/api/v1/core.go new file mode 100644 index 00000000..8e633c53 --- /dev/null +++ b/auto/api/v1/core.go @@ -0,0 +1,584 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type Core interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + TweetCollectionStatus(*web.TweetCollectionStatusReq) (*web.TweetCollectionStatusResp, mir.Error) + TweetStarStatus(*web.TweetStarStatusReq) (*web.TweetStarStatusResp, mir.Error) + SuggestTags(*web.SuggestTagsReq) (*web.SuggestTagsResp, mir.Error) + SuggestUsers(*web.SuggestUsersReq) (*web.SuggestUsersResp, mir.Error) + ChangeAvatar(*web.ChangeAvatarReq) mir.Error + ChangeNickname(*web.ChangeNicknameReq) mir.Error + ChangePassword(*web.ChangePasswordReq) mir.Error + UserPhoneBind(*web.UserPhoneBindReq) mir.Error + GetStars(*web.GetStarsReq) (*web.GetStarsResp, mir.Error) + GetCollections(*web.GetCollectionsReq) (*web.GetCollectionsResp, mir.Error) + SendUserWhisper(*web.SendWhisperReq) mir.Error + ReadMessage(*web.ReadMessageReq) mir.Error + GetMessages(*web.GetMessagesReq) (*web.GetMessagesResp, mir.Error) + GetUnreadMsgCount(*web.GetUnreadMsgCountReq) (*web.GetUnreadMsgCountResp, mir.Error) + GetUserInfo(*web.UserInfoReq) (*web.UserInfoResp, mir.Error) + SyncSearchIndex(*web.SyncSearchIndexReq) mir.Error + + mustEmbedUnimplementedCoreServant() +} + +type CoreBinding interface { + BindTweetCollectionStatus(*gin.Context) (*web.TweetCollectionStatusReq, mir.Error) + BindTweetStarStatus(*gin.Context) (*web.TweetStarStatusReq, mir.Error) + BindSuggestTags(*gin.Context) (*web.SuggestTagsReq, mir.Error) + BindSuggestUsers(*gin.Context) (*web.SuggestUsersReq, mir.Error) + BindChangeAvatar(*gin.Context) (*web.ChangeAvatarReq, mir.Error) + BindChangeNickname(*gin.Context) (*web.ChangeNicknameReq, mir.Error) + BindChangePassword(*gin.Context) (*web.ChangePasswordReq, mir.Error) + BindUserPhoneBind(*gin.Context) (*web.UserPhoneBindReq, mir.Error) + BindGetStars(*gin.Context) (*web.GetStarsReq, mir.Error) + BindGetCollections(*gin.Context) (*web.GetCollectionsReq, mir.Error) + BindSendUserWhisper(*gin.Context) (*web.SendWhisperReq, mir.Error) + BindReadMessage(*gin.Context) (*web.ReadMessageReq, mir.Error) + BindGetMessages(*gin.Context) (*web.GetMessagesReq, mir.Error) + BindGetUnreadMsgCount(*gin.Context) (*web.GetUnreadMsgCountReq, mir.Error) + BindGetUserInfo(*gin.Context) (*web.UserInfoReq, mir.Error) + BindSyncSearchIndex(*gin.Context) (*web.SyncSearchIndexReq, mir.Error) + + mustEmbedUnimplementedCoreBinding() +} + +type CoreRender interface { + RenderTweetCollectionStatus(*gin.Context, *web.TweetCollectionStatusResp, mir.Error) + RenderTweetStarStatus(*gin.Context, *web.TweetStarStatusResp, mir.Error) + RenderSuggestTags(*gin.Context, *web.SuggestTagsResp, mir.Error) + RenderSuggestUsers(*gin.Context, *web.SuggestUsersResp, mir.Error) + RenderChangeAvatar(*gin.Context, mir.Error) + RenderChangeNickname(*gin.Context, mir.Error) + RenderChangePassword(*gin.Context, mir.Error) + RenderUserPhoneBind(*gin.Context, mir.Error) + RenderGetStars(*gin.Context, *web.GetStarsResp, mir.Error) + RenderGetCollections(*gin.Context, *web.GetCollectionsResp, mir.Error) + RenderSendUserWhisper(*gin.Context, mir.Error) + RenderReadMessage(*gin.Context, mir.Error) + RenderGetMessages(*gin.Context, *web.GetMessagesResp, mir.Error) + RenderGetUnreadMsgCount(*gin.Context, *web.GetUnreadMsgCountResp, mir.Error) + RenderGetUserInfo(*gin.Context, *web.UserInfoResp, mir.Error) + RenderSyncSearchIndex(*gin.Context, mir.Error) + + mustEmbedUnimplementedCoreRender() +} + +// RegisterCoreServant register Core servant to gin +func RegisterCoreServant(e *gin.Engine, s Core, b CoreBinding, r CoreRender) { + router := e.Group("v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("GET", "/post/collection", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindTweetCollectionStatus(c) + if err != nil { + r.RenderTweetCollectionStatus(c, nil, err) + return + } + resp, err := s.TweetCollectionStatus(req) + r.RenderTweetCollectionStatus(c, resp, err) + }) + + router.Handle("GET", "/post/star", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindTweetStarStatus(c) + if err != nil { + r.RenderTweetStarStatus(c, nil, err) + return + } + resp, err := s.TweetStarStatus(req) + r.RenderTweetStarStatus(c, resp, err) + }) + + router.Handle("GET", "/suggest/tags", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindSuggestTags(c) + if err != nil { + r.RenderSuggestTags(c, nil, err) + return + } + resp, err := s.SuggestTags(req) + r.RenderSuggestTags(c, resp, err) + }) + + router.Handle("GET", "/suggest/users", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindSuggestUsers(c) + if err != nil { + r.RenderSuggestUsers(c, nil, err) + return + } + resp, err := s.SuggestUsers(req) + r.RenderSuggestUsers(c, resp, err) + }) + + router.Handle("POST", "/user/avatar", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindChangeAvatar(c) + if err != nil { + r.RenderChangeAvatar(c, err) + return + } + r.RenderChangeAvatar(c, s.ChangeAvatar(req)) + }) + + router.Handle("POST", "/user/nickname", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindChangeNickname(c) + if err != nil { + r.RenderChangeNickname(c, err) + return + } + r.RenderChangeNickname(c, s.ChangeNickname(req)) + }) + + router.Handle("POST", "/user/password", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindChangePassword(c) + if err != nil { + r.RenderChangePassword(c, err) + return + } + r.RenderChangePassword(c, s.ChangePassword(req)) + }) + + router.Handle("POST", "/user/phone", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindUserPhoneBind(c) + if err != nil { + r.RenderUserPhoneBind(c, err) + return + } + r.RenderUserPhoneBind(c, s.UserPhoneBind(req)) + }) + + router.Handle("GET", "/user/stars", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindGetStars(c) + if err != nil { + r.RenderGetStars(c, nil, err) + return + } + resp, err := s.GetStars(req) + r.RenderGetStars(c, resp, err) + }) + + router.Handle("GET", "/user/collections", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindGetCollections(c) + if err != nil { + r.RenderGetCollections(c, nil, err) + return + } + resp, err := s.GetCollections(req) + r.RenderGetCollections(c, resp, err) + }) + + router.Handle("POST", "/user/whisper", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindSendUserWhisper(c) + if err != nil { + r.RenderSendUserWhisper(c, err) + return + } + r.RenderSendUserWhisper(c, s.SendUserWhisper(req)) + }) + + router.Handle("POST", "/user/message/read", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindReadMessage(c) + if err != nil { + r.RenderReadMessage(c, err) + return + } + r.RenderReadMessage(c, s.ReadMessage(req)) + }) + + router.Handle("GET", "/user/messages", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindGetMessages(c) + if err != nil { + r.RenderGetMessages(c, nil, err) + return + } + resp, err := s.GetMessages(req) + r.RenderGetMessages(c, resp, err) + }) + + router.Handle("GET", "/user/msgcount/unread", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindGetUnreadMsgCount(c) + if err != nil { + r.RenderGetUnreadMsgCount(c, nil, err) + return + } + resp, err := s.GetUnreadMsgCount(req) + r.RenderGetUnreadMsgCount(c, resp, err) + }) + + router.Handle("GET", "/user/info", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindGetUserInfo(c) + if err != nil { + r.RenderGetUserInfo(c, nil, err) + return + } + resp, err := s.GetUserInfo(req) + r.RenderGetUserInfo(c, resp, err) + }) + + router.Handle("GET", "/sync/index", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindSyncSearchIndex(c) + if err != nil { + r.RenderSyncSearchIndex(c, err) + return + } + r.RenderSyncSearchIndex(c, s.SyncSearchIndex(req)) + }) + +} + +// UnimplementedCoreServant can be embedded to have forward compatible implementations. +type UnimplementedCoreServant struct { +} + +func (UnimplementedCoreServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedCoreServant) TweetCollectionStatus(req *web.TweetCollectionStatusReq) (*web.TweetCollectionStatusResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) TweetStarStatus(req *web.TweetStarStatusReq) (*web.TweetStarStatusResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) SuggestTags(req *web.SuggestTagsReq) (*web.SuggestTagsResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) SuggestUsers(req *web.SuggestUsersReq) (*web.SuggestUsersResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) ChangeAvatar(req *web.ChangeAvatarReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) ChangeNickname(req *web.ChangeNicknameReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) ChangePassword(req *web.ChangePasswordReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) UserPhoneBind(req *web.UserPhoneBindReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) GetStars(req *web.GetStarsReq) (*web.GetStarsResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) GetCollections(req *web.GetCollectionsReq) (*web.GetCollectionsResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) SendUserWhisper(req *web.SendWhisperReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) ReadMessage(req *web.ReadMessageReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) GetMessages(req *web.GetMessagesReq) (*web.GetMessagesResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) GetUnreadMsgCount(req *web.GetUnreadMsgCountReq) (*web.GetUnreadMsgCountResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) GetUserInfo(req *web.UserInfoReq) (*web.UserInfoResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) SyncSearchIndex(req *web.SyncSearchIndexReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedCoreServant) mustEmbedUnimplementedCoreServant() {} + +// UnimplementedCoreRender can be embedded to have forward compatible implementations. +type UnimplementedCoreRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedCoreRender) RenderTweetCollectionStatus(c *gin.Context, data *web.TweetCollectionStatusResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderTweetStarStatus(c *gin.Context, data *web.TweetStarStatusResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderSuggestTags(c *gin.Context, data *web.SuggestTagsResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderSuggestUsers(c *gin.Context, data *web.SuggestUsersResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderChangeAvatar(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedCoreRender) RenderChangeNickname(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedCoreRender) RenderChangePassword(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedCoreRender) RenderUserPhoneBind(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedCoreRender) RenderGetStars(c *gin.Context, data *web.GetStarsResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderGetCollections(c *gin.Context, data *web.GetCollectionsResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderSendUserWhisper(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedCoreRender) RenderReadMessage(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedCoreRender) RenderGetMessages(c *gin.Context, data *web.GetMessagesResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderGetUnreadMsgCount(c *gin.Context, data *web.GetUnreadMsgCountResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderGetUserInfo(c *gin.Context, data *web.UserInfoResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedCoreRender) RenderSyncSearchIndex(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedCoreRender) mustEmbedUnimplementedCoreRender() {} + +// UnimplementedCoreBinding can be embedded to have forward compatible implementations. +type UnimplementedCoreBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedCoreBinding) BindTweetCollectionStatus(c *gin.Context) (*web.TweetCollectionStatusReq, mir.Error) { + obj := new(web.TweetCollectionStatusReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindTweetStarStatus(c *gin.Context) (*web.TweetStarStatusReq, mir.Error) { + obj := new(web.TweetStarStatusReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindSuggestTags(c *gin.Context) (*web.SuggestTagsReq, mir.Error) { + obj := new(web.SuggestTagsReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindSuggestUsers(c *gin.Context) (*web.SuggestUsersReq, mir.Error) { + obj := new(web.SuggestUsersReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindChangeAvatar(c *gin.Context) (*web.ChangeAvatarReq, mir.Error) { + obj := new(web.ChangeAvatarReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindChangeNickname(c *gin.Context) (*web.ChangeNicknameReq, mir.Error) { + obj := new(web.ChangeNicknameReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindChangePassword(c *gin.Context) (*web.ChangePasswordReq, mir.Error) { + obj := new(web.ChangePasswordReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindUserPhoneBind(c *gin.Context) (*web.UserPhoneBindReq, mir.Error) { + obj := new(web.UserPhoneBindReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindGetStars(c *gin.Context) (*web.GetStarsReq, mir.Error) { + obj := new(web.GetStarsReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindGetCollections(c *gin.Context) (*web.GetCollectionsReq, mir.Error) { + obj := new(web.GetCollectionsReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindSendUserWhisper(c *gin.Context) (*web.SendWhisperReq, mir.Error) { + obj := new(web.SendWhisperReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindReadMessage(c *gin.Context) (*web.ReadMessageReq, mir.Error) { + obj := new(web.ReadMessageReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindGetMessages(c *gin.Context) (*web.GetMessagesReq, mir.Error) { + obj := new(web.GetMessagesReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindGetUnreadMsgCount(c *gin.Context) (*web.GetUnreadMsgCountReq, mir.Error) { + obj := new(web.GetUnreadMsgCountReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindGetUserInfo(c *gin.Context) (*web.UserInfoReq, mir.Error) { + obj := new(web.UserInfoReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) BindSyncSearchIndex(c *gin.Context) (*web.SyncSearchIndexReq, mir.Error) { + obj := new(web.SyncSearchIndexReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedCoreBinding) mustEmbedUnimplementedCoreBinding() {} diff --git a/auto/api/v1/followship.go b/auto/api/v1/followship.go new file mode 100644 index 00000000..7e83efc9 --- /dev/null +++ b/auto/api/v1/followship.go @@ -0,0 +1,193 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type Followship interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + ListFollowers(*web.ListFollowersReq) (*web.ListFollowersResp, mir.Error) + ListFollowings(*web.ListFollowingsReq) (*web.ListFollowingsResp, mir.Error) + DeleteFollowing(*web.DeleteFollowingReq) mir.Error + AddFollowing(*web.AddFollowingReq) mir.Error + + mustEmbedUnimplementedFollowshipServant() +} + +type FollowshipBinding interface { + BindListFollowers(*gin.Context) (*web.ListFollowersReq, mir.Error) + BindListFollowings(*gin.Context) (*web.ListFollowingsReq, mir.Error) + BindDeleteFollowing(*gin.Context) (*web.DeleteFollowingReq, mir.Error) + BindAddFollowing(*gin.Context) (*web.AddFollowingReq, mir.Error) + + mustEmbedUnimplementedFollowshipBinding() +} + +type FollowshipRender interface { + RenderListFollowers(*gin.Context, *web.ListFollowersResp, mir.Error) + RenderListFollowings(*gin.Context, *web.ListFollowingsResp, mir.Error) + RenderDeleteFollowing(*gin.Context, mir.Error) + RenderAddFollowing(*gin.Context, mir.Error) + + mustEmbedUnimplementedFollowshipRender() +} + +// RegisterFollowshipServant register Followship servant to gin +func RegisterFollowshipServant(e *gin.Engine, s Followship, b FollowshipBinding, r FollowshipRender) { + router := e.Group("v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("GET", "/follower/list", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindListFollowers(c) + if err != nil { + r.RenderListFollowers(c, nil, err) + return + } + resp, err := s.ListFollowers(req) + r.RenderListFollowers(c, resp, err) + }) + + router.Handle("GET", "/following/list", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindListFollowings(c) + if err != nil { + r.RenderListFollowings(c, nil, err) + return + } + resp, err := s.ListFollowings(req) + r.RenderListFollowings(c, resp, err) + }) + + router.Handle("POST", "/following/delete", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindDeleteFollowing(c) + if err != nil { + r.RenderDeleteFollowing(c, err) + return + } + r.RenderDeleteFollowing(c, s.DeleteFollowing(req)) + }) + + router.Handle("POST", "/following/add", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindAddFollowing(c) + if err != nil { + r.RenderAddFollowing(c, err) + return + } + r.RenderAddFollowing(c, s.AddFollowing(req)) + }) + +} + +// UnimplementedFollowshipServant can be embedded to have forward compatible implementations. +type UnimplementedFollowshipServant struct { +} + +func (UnimplementedFollowshipServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedFollowshipServant) ListFollowers(req *web.ListFollowersReq) (*web.ListFollowersResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFollowshipServant) ListFollowings(req *web.ListFollowingsReq) (*web.ListFollowingsResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFollowshipServant) DeleteFollowing(req *web.DeleteFollowingReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFollowshipServant) AddFollowing(req *web.AddFollowingReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFollowshipServant) mustEmbedUnimplementedFollowshipServant() {} + +// UnimplementedFollowshipRender can be embedded to have forward compatible implementations. +type UnimplementedFollowshipRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedFollowshipRender) RenderListFollowers(c *gin.Context, data *web.ListFollowersResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedFollowshipRender) RenderListFollowings(c *gin.Context, data *web.ListFollowingsResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedFollowshipRender) RenderDeleteFollowing(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedFollowshipRender) RenderAddFollowing(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedFollowshipRender) mustEmbedUnimplementedFollowshipRender() {} + +// UnimplementedFollowshipBinding can be embedded to have forward compatible implementations. +type UnimplementedFollowshipBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedFollowshipBinding) BindListFollowers(c *gin.Context) (*web.ListFollowersReq, mir.Error) { + obj := new(web.ListFollowersReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFollowshipBinding) BindListFollowings(c *gin.Context) (*web.ListFollowingsReq, mir.Error) { + obj := new(web.ListFollowingsReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFollowshipBinding) BindDeleteFollowing(c *gin.Context) (*web.DeleteFollowingReq, mir.Error) { + obj := new(web.DeleteFollowingReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFollowshipBinding) BindAddFollowing(c *gin.Context) (*web.AddFollowingReq, mir.Error) { + obj := new(web.AddFollowingReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFollowshipBinding) mustEmbedUnimplementedFollowshipBinding() {} diff --git a/auto/api/v1/friendship.go b/auto/api/v1/friendship.go new file mode 100644 index 00000000..fbec2417 --- /dev/null +++ b/auto/api/v1/friendship.go @@ -0,0 +1,224 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type Friendship interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + GetContacts(*web.GetContactsReq) (*web.GetContactsResp, mir.Error) + DeleteFriend(*web.DeleteFriendReq) mir.Error + RejectFriend(*web.RejectFriendReq) mir.Error + AddFriend(*web.AddFriendReq) mir.Error + RequestingFriend(*web.RequestingFriendReq) mir.Error + + mustEmbedUnimplementedFriendshipServant() +} + +type FriendshipBinding interface { + BindGetContacts(*gin.Context) (*web.GetContactsReq, mir.Error) + BindDeleteFriend(*gin.Context) (*web.DeleteFriendReq, mir.Error) + BindRejectFriend(*gin.Context) (*web.RejectFriendReq, mir.Error) + BindAddFriend(*gin.Context) (*web.AddFriendReq, mir.Error) + BindRequestingFriend(*gin.Context) (*web.RequestingFriendReq, mir.Error) + + mustEmbedUnimplementedFriendshipBinding() +} + +type FriendshipRender interface { + RenderGetContacts(*gin.Context, *web.GetContactsResp, mir.Error) + RenderDeleteFriend(*gin.Context, mir.Error) + RenderRejectFriend(*gin.Context, mir.Error) + RenderAddFriend(*gin.Context, mir.Error) + RenderRequestingFriend(*gin.Context, mir.Error) + + mustEmbedUnimplementedFriendshipRender() +} + +// RegisterFriendshipServant register Friendship servant to gin +func RegisterFriendshipServant(e *gin.Engine, s Friendship, b FriendshipBinding, r FriendshipRender) { + router := e.Group("v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("GET", "/user/contacts", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindGetContacts(c) + if err != nil { + r.RenderGetContacts(c, nil, err) + return + } + resp, err := s.GetContacts(req) + r.RenderGetContacts(c, resp, err) + }) + + router.Handle("POST", "/friend/delete", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindDeleteFriend(c) + if err != nil { + r.RenderDeleteFriend(c, err) + return + } + r.RenderDeleteFriend(c, s.DeleteFriend(req)) + }) + + router.Handle("POST", "/friend/reject", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindRejectFriend(c) + if err != nil { + r.RenderRejectFriend(c, err) + return + } + r.RenderRejectFriend(c, s.RejectFriend(req)) + }) + + router.Handle("POST", "/friend/add", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindAddFriend(c) + if err != nil { + r.RenderAddFriend(c, err) + return + } + r.RenderAddFriend(c, s.AddFriend(req)) + }) + + router.Handle("POST", "/friend/requesting", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindRequestingFriend(c) + if err != nil { + r.RenderRequestingFriend(c, err) + return + } + r.RenderRequestingFriend(c, s.RequestingFriend(req)) + }) + +} + +// UnimplementedFriendshipServant can be embedded to have forward compatible implementations. +type UnimplementedFriendshipServant struct { +} + +func (UnimplementedFriendshipServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedFriendshipServant) GetContacts(req *web.GetContactsReq) (*web.GetContactsResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFriendshipServant) DeleteFriend(req *web.DeleteFriendReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFriendshipServant) RejectFriend(req *web.RejectFriendReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFriendshipServant) AddFriend(req *web.AddFriendReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFriendshipServant) RequestingFriend(req *web.RequestingFriendReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedFriendshipServant) mustEmbedUnimplementedFriendshipServant() {} + +// UnimplementedFriendshipRender can be embedded to have forward compatible implementations. +type UnimplementedFriendshipRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedFriendshipRender) RenderGetContacts(c *gin.Context, data *web.GetContactsResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedFriendshipRender) RenderDeleteFriend(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedFriendshipRender) RenderRejectFriend(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedFriendshipRender) RenderAddFriend(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedFriendshipRender) RenderRequestingFriend(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedFriendshipRender) mustEmbedUnimplementedFriendshipRender() {} + +// UnimplementedFriendshipBinding can be embedded to have forward compatible implementations. +type UnimplementedFriendshipBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedFriendshipBinding) BindGetContacts(c *gin.Context) (*web.GetContactsReq, mir.Error) { + obj := new(web.GetContactsReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFriendshipBinding) BindDeleteFriend(c *gin.Context) (*web.DeleteFriendReq, mir.Error) { + obj := new(web.DeleteFriendReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFriendshipBinding) BindRejectFriend(c *gin.Context) (*web.RejectFriendReq, mir.Error) { + obj := new(web.RejectFriendReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFriendshipBinding) BindAddFriend(c *gin.Context) (*web.AddFriendReq, mir.Error) { + obj := new(web.AddFriendReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFriendshipBinding) BindRequestingFriend(c *gin.Context) (*web.RequestingFriendReq, mir.Error) { + obj := new(web.RequestingFriendReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedFriendshipBinding) mustEmbedUnimplementedFriendshipBinding() {} diff --git a/auto/api/v1/loose.go b/auto/api/v1/loose.go new file mode 100644 index 00000000..7d4d1046 --- /dev/null +++ b/auto/api/v1/loose.go @@ -0,0 +1,162 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type Loose interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + GetUserProfile(*web.GetUserProfileReq) (*web.GetUserProfileResp, mir.Error) + GetUserTweets(*web.GetUserTweetsReq) (*web.GetUserTweetsResp, mir.Error) + Timeline(*web.TimelineReq) (*web.TimelineResp, mir.Error) + + mustEmbedUnimplementedLooseServant() +} + +type LooseBinding interface { + BindGetUserProfile(*gin.Context) (*web.GetUserProfileReq, mir.Error) + BindGetUserTweets(*gin.Context) (*web.GetUserTweetsReq, mir.Error) + BindTimeline(*gin.Context) (*web.TimelineReq, mir.Error) + + mustEmbedUnimplementedLooseBinding() +} + +type LooseRender interface { + RenderGetUserProfile(*gin.Context, *web.GetUserProfileResp, mir.Error) + RenderGetUserTweets(*gin.Context, *web.GetUserTweetsResp, mir.Error) + RenderTimeline(*gin.Context, *web.TimelineResp, mir.Error) + + mustEmbedUnimplementedLooseRender() +} + +// RegisterLooseServant register Loose servant to gin +func RegisterLooseServant(e *gin.Engine, s Loose, b LooseBinding, r LooseRender) { + router := e.Group("v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("GET", "/user/profile", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindGetUserProfile(c) + if err != nil { + r.RenderGetUserProfile(c, nil, err) + return + } + resp, err := s.GetUserProfile(req) + r.RenderGetUserProfile(c, resp, err) + }) + + router.Handle("GET", "/user/posts", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindGetUserTweets(c) + if err != nil { + r.RenderGetUserTweets(c, nil, err) + return + } + resp, err := s.GetUserTweets(req) + r.RenderGetUserTweets(c, resp, err) + }) + + router.Handle("GET", "/posts", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindTimeline(c) + if err != nil { + r.RenderTimeline(c, nil, err) + return + } + resp, err := s.Timeline(req) + r.RenderTimeline(c, resp, err) + }) + +} + +// UnimplementedLooseServant can be embedded to have forward compatible implementations. +type UnimplementedLooseServant struct { +} + +func (UnimplementedLooseServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedLooseServant) GetUserProfile(req *web.GetUserProfileReq) (*web.GetUserProfileResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedLooseServant) GetUserTweets(req *web.GetUserTweetsReq) (*web.GetUserTweetsResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedLooseServant) Timeline(req *web.TimelineReq) (*web.TimelineResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedLooseServant) mustEmbedUnimplementedLooseServant() {} + +// UnimplementedLooseRender can be embedded to have forward compatible implementations. +type UnimplementedLooseRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedLooseRender) RenderGetUserProfile(c *gin.Context, data *web.GetUserProfileResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedLooseRender) RenderGetUserTweets(c *gin.Context, data *web.GetUserTweetsResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedLooseRender) RenderTimeline(c *gin.Context, data *web.TimelineResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedLooseRender) mustEmbedUnimplementedLooseRender() {} + +// UnimplementedLooseBinding can be embedded to have forward compatible implementations. +type UnimplementedLooseBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedLooseBinding) BindGetUserProfile(c *gin.Context) (*web.GetUserProfileReq, mir.Error) { + obj := new(web.GetUserProfileReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedLooseBinding) BindGetUserTweets(c *gin.Context) (*web.GetUserTweetsReq, mir.Error) { + obj := new(web.GetUserTweetsReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedLooseBinding) BindTimeline(c *gin.Context) (*web.TimelineReq, mir.Error) { + obj := new(web.TimelineReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedLooseBinding) mustEmbedUnimplementedLooseBinding() {} diff --git a/auto/api/v1/priv.go b/auto/api/v1/priv.go new file mode 100644 index 00000000..8e9b4856 --- /dev/null +++ b/auto/api/v1/priv.go @@ -0,0 +1,522 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type Priv interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + DeleteCommentReply(*web.DeleteCommentReplyReq) mir.Error + CreateCommentReply(*web.CreateCommentReplyReq) (*web.CreateCommentReplyResp, mir.Error) + DeleteComment(*web.DeleteCommentReq) mir.Error + CreateComment(*web.CreateCommentReq) (*web.CreateCommentResp, mir.Error) + VisiblePost(*web.VisiblePostReq) (*web.VisiblePostResp, mir.Error) + StickTweet(*web.StickTweetReq) (*web.StickTweetResp, mir.Error) + LockTweet(*web.LockTweetReq) (*web.LockTweetResp, mir.Error) + CollectionTweet(*web.CollectionTweetReq) (*web.CollectionTweetResp, mir.Error) + StarTweet(*web.StarTweetReq) (*web.StarTweetResp, mir.Error) + DeleteTweet(*web.DeleteTweetReq) mir.Error + CreateTweet(*web.CreateTweetReq) (*web.CreateTweetResp, mir.Error) + DownloadAttachment(*web.DownloadAttachmentReq) (*web.DownloadAttachmentResp, mir.Error) + DownloadAttachmentPrecheck(*web.DownloadAttachmentPrecheckReq) (*web.DownloadAttachmentPrecheckResp, mir.Error) + UploadAttachment(*web.UploadAttachmentReq) (*web.UploadAttachmentResp, mir.Error) + + mustEmbedUnimplementedPrivServant() +} + +type PrivBinding interface { + BindDeleteCommentReply(*gin.Context) (*web.DeleteCommentReplyReq, mir.Error) + BindCreateCommentReply(*gin.Context) (*web.CreateCommentReplyReq, mir.Error) + BindDeleteComment(*gin.Context) (*web.DeleteCommentReq, mir.Error) + BindCreateComment(*gin.Context) (*web.CreateCommentReq, mir.Error) + BindVisiblePost(*gin.Context) (*web.VisiblePostReq, mir.Error) + BindStickTweet(*gin.Context) (*web.StickTweetReq, mir.Error) + BindLockTweet(*gin.Context) (*web.LockTweetReq, mir.Error) + BindCollectionTweet(*gin.Context) (*web.CollectionTweetReq, mir.Error) + BindStarTweet(*gin.Context) (*web.StarTweetReq, mir.Error) + BindDeleteTweet(*gin.Context) (*web.DeleteTweetReq, mir.Error) + BindCreateTweet(*gin.Context) (*web.CreateTweetReq, mir.Error) + BindDownloadAttachment(*gin.Context) (*web.DownloadAttachmentReq, mir.Error) + BindDownloadAttachmentPrecheck(*gin.Context) (*web.DownloadAttachmentPrecheckReq, mir.Error) + BindUploadAttachment(*gin.Context) (*web.UploadAttachmentReq, mir.Error) + + mustEmbedUnimplementedPrivBinding() +} + +type PrivRender interface { + RenderDeleteCommentReply(*gin.Context, mir.Error) + RenderCreateCommentReply(*gin.Context, *web.CreateCommentReplyResp, mir.Error) + RenderDeleteComment(*gin.Context, mir.Error) + RenderCreateComment(*gin.Context, *web.CreateCommentResp, mir.Error) + RenderVisiblePost(*gin.Context, *web.VisiblePostResp, mir.Error) + RenderStickTweet(*gin.Context, *web.StickTweetResp, mir.Error) + RenderLockTweet(*gin.Context, *web.LockTweetResp, mir.Error) + RenderCollectionTweet(*gin.Context, *web.CollectionTweetResp, mir.Error) + RenderStarTweet(*gin.Context, *web.StarTweetResp, mir.Error) + RenderDeleteTweet(*gin.Context, mir.Error) + RenderCreateTweet(*gin.Context, *web.CreateTweetResp, mir.Error) + RenderDownloadAttachment(*gin.Context, *web.DownloadAttachmentResp, mir.Error) + RenderDownloadAttachmentPrecheck(*gin.Context, *web.DownloadAttachmentPrecheckResp, mir.Error) + RenderUploadAttachment(*gin.Context, *web.UploadAttachmentResp, mir.Error) + + mustEmbedUnimplementedPrivRender() +} + +// RegisterPrivServant register Priv servant to gin +func RegisterPrivServant(e *gin.Engine, s Priv, b PrivBinding, r PrivRender) { + router := e.Group("v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("DELETE", "/post/comment/reply", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindDeleteCommentReply(c) + if err != nil { + r.RenderDeleteCommentReply(c, err) + return + } + r.RenderDeleteCommentReply(c, s.DeleteCommentReply(req)) + }) + + router.Handle("POST", "/post/comment/reply", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindCreateCommentReply(c) + if err != nil { + r.RenderCreateCommentReply(c, nil, err) + return + } + resp, err := s.CreateCommentReply(req) + r.RenderCreateCommentReply(c, resp, err) + }) + + router.Handle("DELETE", "/post/comment", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindDeleteComment(c) + if err != nil { + r.RenderDeleteComment(c, err) + return + } + r.RenderDeleteComment(c, s.DeleteComment(req)) + }) + + router.Handle("POST", "/post/comment", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindCreateComment(c) + if err != nil { + r.RenderCreateComment(c, nil, err) + return + } + resp, err := s.CreateComment(req) + r.RenderCreateComment(c, resp, err) + }) + + router.Handle("POST", "/post/visibility", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindVisiblePost(c) + if err != nil { + r.RenderVisiblePost(c, nil, err) + return + } + resp, err := s.VisiblePost(req) + r.RenderVisiblePost(c, resp, err) + }) + + router.Handle("POST", "/post/stick", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindStickTweet(c) + if err != nil { + r.RenderStickTweet(c, nil, err) + return + } + resp, err := s.StickTweet(req) + r.RenderStickTweet(c, resp, err) + }) + + router.Handle("POST", "/post/lock", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindLockTweet(c) + if err != nil { + r.RenderLockTweet(c, nil, err) + return + } + resp, err := s.LockTweet(req) + r.RenderLockTweet(c, resp, err) + }) + + router.Handle("POST", "/post/collection", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindCollectionTweet(c) + if err != nil { + r.RenderCollectionTweet(c, nil, err) + return + } + resp, err := s.CollectionTweet(req) + r.RenderCollectionTweet(c, resp, err) + }) + + router.Handle("POST", "/post/start", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindStarTweet(c) + if err != nil { + r.RenderStarTweet(c, nil, err) + return + } + resp, err := s.StarTweet(req) + r.RenderStarTweet(c, resp, err) + }) + + router.Handle("DELETE", "/post", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindDeleteTweet(c) + if err != nil { + r.RenderDeleteTweet(c, err) + return + } + r.RenderDeleteTweet(c, s.DeleteTweet(req)) + }) + + router.Handle("POST", "/post", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindCreateTweet(c) + if err != nil { + r.RenderCreateTweet(c, nil, err) + return + } + resp, err := s.CreateTweet(req) + r.RenderCreateTweet(c, resp, err) + }) + + router.Handle("GET", "/attachment", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindDownloadAttachment(c) + if err != nil { + r.RenderDownloadAttachment(c, nil, err) + return + } + resp, err := s.DownloadAttachment(req) + r.RenderDownloadAttachment(c, resp, err) + }) + + router.Handle("GET", "/attachment/precheck", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindDownloadAttachmentPrecheck(c) + if err != nil { + r.RenderDownloadAttachmentPrecheck(c, nil, err) + return + } + resp, err := s.DownloadAttachmentPrecheck(req) + r.RenderDownloadAttachmentPrecheck(c, resp, err) + }) + + router.Handle("POST", "/attachment", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindUploadAttachment(c) + if err != nil { + r.RenderUploadAttachment(c, nil, err) + return + } + resp, err := s.UploadAttachment(req) + r.RenderUploadAttachment(c, resp, err) + }) + +} + +// UnimplementedPrivServant can be embedded to have forward compatible implementations. +type UnimplementedPrivServant struct { +} + +func (UnimplementedPrivServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedPrivServant) DeleteCommentReply(req *web.DeleteCommentReplyReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) CreateCommentReply(req *web.CreateCommentReplyReq) (*web.CreateCommentReplyResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) DeleteComment(req *web.DeleteCommentReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) CreateComment(req *web.CreateCommentReq) (*web.CreateCommentResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) VisiblePost(req *web.VisiblePostReq) (*web.VisiblePostResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) StickTweet(req *web.StickTweetReq) (*web.StickTweetResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) LockTweet(req *web.LockTweetReq) (*web.LockTweetResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) CollectionTweet(req *web.CollectionTweetReq) (*web.CollectionTweetResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) StarTweet(req *web.StarTweetReq) (*web.StarTweetResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) DeleteTweet(req *web.DeleteTweetReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) CreateTweet(req *web.CreateTweetReq) (*web.CreateTweetResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) DownloadAttachment(req *web.DownloadAttachmentReq) (*web.DownloadAttachmentResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) DownloadAttachmentPrecheck(req *web.DownloadAttachmentPrecheckReq) (*web.DownloadAttachmentPrecheckResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) UploadAttachment(req *web.UploadAttachmentReq) (*web.UploadAttachmentResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPrivServant) mustEmbedUnimplementedPrivServant() {} + +// UnimplementedPrivRender can be embedded to have forward compatible implementations. +type UnimplementedPrivRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedPrivRender) RenderDeleteCommentReply(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedPrivRender) RenderCreateCommentReply(c *gin.Context, data *web.CreateCommentReplyResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderDeleteComment(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedPrivRender) RenderCreateComment(c *gin.Context, data *web.CreateCommentResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderVisiblePost(c *gin.Context, data *web.VisiblePostResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderStickTweet(c *gin.Context, data *web.StickTweetResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderLockTweet(c *gin.Context, data *web.LockTweetResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderCollectionTweet(c *gin.Context, data *web.CollectionTweetResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderStarTweet(c *gin.Context, data *web.StarTweetResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderDeleteTweet(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedPrivRender) RenderCreateTweet(c *gin.Context, data *web.CreateTweetResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderDownloadAttachment(c *gin.Context, data *web.DownloadAttachmentResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderDownloadAttachmentPrecheck(c *gin.Context, data *web.DownloadAttachmentPrecheckResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) RenderUploadAttachment(c *gin.Context, data *web.UploadAttachmentResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPrivRender) mustEmbedUnimplementedPrivRender() {} + +// UnimplementedPrivBinding can be embedded to have forward compatible implementations. +type UnimplementedPrivBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedPrivBinding) BindDeleteCommentReply(c *gin.Context) (*web.DeleteCommentReplyReq, mir.Error) { + obj := new(web.DeleteCommentReplyReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindCreateCommentReply(c *gin.Context) (*web.CreateCommentReplyReq, mir.Error) { + obj := new(web.CreateCommentReplyReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindDeleteComment(c *gin.Context) (*web.DeleteCommentReq, mir.Error) { + obj := new(web.DeleteCommentReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindCreateComment(c *gin.Context) (*web.CreateCommentReq, mir.Error) { + obj := new(web.CreateCommentReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindVisiblePost(c *gin.Context) (*web.VisiblePostReq, mir.Error) { + obj := new(web.VisiblePostReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindStickTweet(c *gin.Context) (*web.StickTweetReq, mir.Error) { + obj := new(web.StickTweetReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindLockTweet(c *gin.Context) (*web.LockTweetReq, mir.Error) { + obj := new(web.LockTweetReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindCollectionTweet(c *gin.Context) (*web.CollectionTweetReq, mir.Error) { + obj := new(web.CollectionTweetReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindStarTweet(c *gin.Context) (*web.StarTweetReq, mir.Error) { + obj := new(web.StarTweetReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindDeleteTweet(c *gin.Context) (*web.DeleteTweetReq, mir.Error) { + obj := new(web.DeleteTweetReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindCreateTweet(c *gin.Context) (*web.CreateTweetReq, mir.Error) { + obj := new(web.CreateTweetReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindDownloadAttachment(c *gin.Context) (*web.DownloadAttachmentReq, mir.Error) { + obj := new(web.DownloadAttachmentReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindDownloadAttachmentPrecheck(c *gin.Context) (*web.DownloadAttachmentPrecheckReq, mir.Error) { + obj := new(web.DownloadAttachmentPrecheckReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) BindUploadAttachment(c *gin.Context) (*web.UploadAttachmentReq, mir.Error) { + obj := new(web.UploadAttachmentReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPrivBinding) mustEmbedUnimplementedPrivBinding() {} diff --git a/auto/api/v1/pub.go b/auto/api/v1/pub.go new file mode 100644 index 00000000..7fe417e7 --- /dev/null +++ b/auto/api/v1/pub.go @@ -0,0 +1,292 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +type Pub interface { + TopicList(*web.TopicListReq) (*web.TopicListResp, mir.Error) + TweetComments(*web.TweetCommentsReq) (*web.TweetCommentsResp, mir.Error) + TweetDetail(*web.TweetDetailReq) (*web.TweetDetailResp, mir.Error) + SendCaptcha(*web.SendCaptchaReq) mir.Error + GetCaptcha() (*web.GetCaptchaResp, mir.Error) + Register(*web.RegisterReq) (*web.RegisterResp, mir.Error) + Login(*web.LoginReq) (*web.LoginResp, mir.Error) + Version() (*web.VersionResp, mir.Error) + + mustEmbedUnimplementedPubServant() +} + +type PubBinding interface { + BindTopicList(*gin.Context) (*web.TopicListReq, mir.Error) + BindTweetComments(*gin.Context) (*web.TweetCommentsReq, mir.Error) + BindTweetDetail(*gin.Context) (*web.TweetDetailReq, mir.Error) + BindSendCaptcha(*gin.Context) (*web.SendCaptchaReq, mir.Error) + BindRegister(*gin.Context) (*web.RegisterReq, mir.Error) + BindLogin(*gin.Context) (*web.LoginReq, mir.Error) + + mustEmbedUnimplementedPubBinding() +} + +type PubRender interface { + RenderTopicList(*gin.Context, *web.TopicListResp, mir.Error) + RenderTweetComments(*gin.Context, *web.TweetCommentsResp, mir.Error) + RenderTweetDetail(*gin.Context, *web.TweetDetailResp, mir.Error) + RenderSendCaptcha(*gin.Context, mir.Error) + RenderGetCaptcha(*gin.Context, *web.GetCaptchaResp, mir.Error) + RenderRegister(*gin.Context, *web.RegisterResp, mir.Error) + RenderLogin(*gin.Context, *web.LoginResp, mir.Error) + RenderVersion(*gin.Context, *web.VersionResp, mir.Error) + + mustEmbedUnimplementedPubRender() +} + +// RegisterPubServant register Pub servant to gin +func RegisterPubServant(e *gin.Engine, s Pub, b PubBinding, r PubRender) { + router := e.Group("v1") + + // register routes info to router + router.Handle("GET", "/tags", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindTopicList(c) + if err != nil { + r.RenderTopicList(c, nil, err) + return + } + resp, err := s.TopicList(req) + r.RenderTopicList(c, resp, err) + }) + + router.Handle("GET", "/post/comments", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindTweetComments(c) + if err != nil { + r.RenderTweetComments(c, nil, err) + return + } + resp, err := s.TweetComments(req) + r.RenderTweetComments(c, resp, err) + }) + + router.Handle("GET", "/post", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindTweetDetail(c) + if err != nil { + r.RenderTweetDetail(c, nil, err) + return + } + resp, err := s.TweetDetail(req) + r.RenderTweetDetail(c, resp, err) + }) + + router.Handle("POST", "/captcha", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindSendCaptcha(c) + if err != nil { + r.RenderSendCaptcha(c, err) + return + } + r.RenderSendCaptcha(c, s.SendCaptcha(req)) + }) + + router.Handle("GET", "/captcha", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + resp, err := s.GetCaptcha() + r.RenderGetCaptcha(c, resp, err) + }) + + router.Handle("POST", "/auth/register", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindRegister(c) + if err != nil { + r.RenderRegister(c, nil, err) + return + } + resp, err := s.Register(req) + r.RenderRegister(c, resp, err) + }) + + router.Handle("POST", "/auth/login", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindLogin(c) + if err != nil { + r.RenderLogin(c, nil, err) + return + } + resp, err := s.Login(req) + r.RenderLogin(c, resp, err) + }) + + router.Handle("GET", "/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + resp, err := s.Version() + r.RenderVersion(c, resp, err) + }) + +} + +// UnimplementedPubServant can be embedded to have forward compatible implementations. +type UnimplementedPubServant struct { +} + +func (UnimplementedPubServant) TopicList(req *web.TopicListReq) (*web.TopicListResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPubServant) TweetComments(req *web.TweetCommentsReq) (*web.TweetCommentsResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPubServant) TweetDetail(req *web.TweetDetailReq) (*web.TweetDetailResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPubServant) SendCaptcha(req *web.SendCaptchaReq) mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPubServant) GetCaptcha() (*web.GetCaptchaResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPubServant) Register(req *web.RegisterReq) (*web.RegisterResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPubServant) Login(req *web.LoginReq) (*web.LoginResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPubServant) Version() (*web.VersionResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedPubServant) mustEmbedUnimplementedPubServant() {} + +// UnimplementedPubRender can be embedded to have forward compatible implementations. +type UnimplementedPubRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedPubRender) RenderTopicList(c *gin.Context, data *web.TopicListResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPubRender) RenderTweetComments(c *gin.Context, data *web.TweetCommentsResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPubRender) RenderTweetDetail(c *gin.Context, data *web.TweetDetailResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPubRender) RenderSendCaptcha(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedPubRender) RenderGetCaptcha(c *gin.Context, data *web.GetCaptchaResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPubRender) RenderRegister(c *gin.Context, data *web.RegisterResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPubRender) RenderLogin(c *gin.Context, data *web.LoginResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPubRender) RenderVersion(c *gin.Context, data *web.VersionResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedPubRender) mustEmbedUnimplementedPubRender() {} + +// UnimplementedPubBinding can be embedded to have forward compatible implementations. +type UnimplementedPubBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedPubBinding) BindTopicList(c *gin.Context) (*web.TopicListReq, mir.Error) { + obj := new(web.TopicListReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPubBinding) BindTweetComments(c *gin.Context) (*web.TweetCommentsReq, mir.Error) { + obj := new(web.TweetCommentsReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPubBinding) BindTweetDetail(c *gin.Context) (*web.TweetDetailReq, mir.Error) { + obj := new(web.TweetDetailReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPubBinding) BindSendCaptcha(c *gin.Context) (*web.SendCaptchaReq, mir.Error) { + obj := new(web.SendCaptchaReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPubBinding) BindRegister(c *gin.Context) (*web.RegisterReq, mir.Error) { + obj := new(web.RegisterReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPubBinding) BindLogin(c *gin.Context) (*web.LoginReq, mir.Error) { + obj := new(web.LoginReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedPubBinding) mustEmbedUnimplementedPubBinding() {} diff --git a/auto/api/x/v1/user.go b/auto/api/x/v1/user.go new file mode 100644 index 00000000..89a3b086 --- /dev/null +++ b/auto/api/x/v1/user.go @@ -0,0 +1,140 @@ +// Code generated by go-mir. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" +) + +type LoginReq struct { + AgentInfo AgentInfo `json:"agent_info"` + Name string `json:"name"` + Passwd string `json:"passwd"` +} + +type AgentInfo struct { + Platform string `json:"platform"` + UserAgent string `json:"user_agent"` +} + +type LoginResp struct { + UserInfo + ServerInfo ServerInfo `json:"server_info"` + JwtToken string `json:"jwt_token"` +} + +type ServerInfo struct { + ApiVer string `json:"api_ver"` +} + +type UserInfo struct { + Name string `json:"name"` +} + +type User interface { + // Chain provide handlers chain for gin + Chain() gin.HandlersChain + + Logout() mir.Error + Login(*LoginReq) (*LoginResp, mir.Error) + + mustEmbedUnimplementedUserServant() +} + +type UserBinding interface { + BindLogin(*gin.Context) (*LoginReq, mir.Error) + + mustEmbedUnimplementedUserBinding() +} + +type UserRender interface { + RenderLogout(*gin.Context, mir.Error) + RenderLogin(*gin.Context, *LoginResp, mir.Error) + + mustEmbedUnimplementedUserRender() +} + +// RegisterUserServant register User servant to gin +func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender) { + router := e.Group("x/v1") + // use chain for router + middlewares := s.Chain() + router.Use(middlewares...) + + // register routes info to router + router.Handle("POST", "/user/logout/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + r.RenderLogout(c, s.Logout()) + }) + + router.Handle("POST", "/user/login/", func(c *gin.Context) { + select { + case <-c.Request.Context().Done(): + return + default: + } + + req, err := b.BindLogin(c) + if err != nil { + r.RenderLogin(c, nil, err) + return + } + resp, err := s.Login(req) + r.RenderLogin(c, resp, err) + }) + +} + +// UnimplementedUserServant can be embedded to have forward compatible implementations. +type UnimplementedUserServant struct { +} + +func (UnimplementedUserServant) Chain() gin.HandlersChain { + return nil +} + +func (UnimplementedUserServant) Logout() mir.Error { + return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error) { + return nil, mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) +} + +func (UnimplementedUserServant) mustEmbedUnimplementedUserServant() {} + +// UnimplementedUserRender can be embedded to have forward compatible implementations. +type UnimplementedUserRender struct { + RenderAny func(*gin.Context, any, mir.Error) +} + +func (r *UnimplementedUserRender) RenderLogout(c *gin.Context, err mir.Error) { + r.RenderAny(c, nil, err) +} + +func (r *UnimplementedUserRender) RenderLogin(c *gin.Context, data *LoginResp, err mir.Error) { + r.RenderAny(c, data, err) +} + +func (r *UnimplementedUserRender) mustEmbedUnimplementedUserRender() {} + +// UnimplementedUserBinding can be embedded to have forward compatible implementations. +type UnimplementedUserBinding struct { + BindAny func(*gin.Context, any) mir.Error +} + +func (b *UnimplementedUserBinding) BindLogin(c *gin.Context) (*LoginReq, mir.Error) { + obj := new(LoginReq) + err := b.BindAny(c, obj) + return obj, err +} + +func (b *UnimplementedUserBinding) mustEmbedUnimplementedUserBinding() {} diff --git a/auto/rpc/v1/auth.pb.go b/auto/rpc/v1/auth.pb.go new file mode 100644 index 00000000..ab5109a6 --- /dev/null +++ b/auto/rpc/v1/auth.pb.go @@ -0,0 +1,371 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: v1/auth.proto + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PhoneNum string `protobuf:"bytes,1,opt,name=phoneNum,proto3" json:"phoneNum,omitempty"` +} + +func (x *User) Reset() { + *x = User{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_v1_auth_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_v1_auth_proto_rawDescGZIP(), []int{0} +} + +func (x *User) GetPhoneNum() string { + if x != nil { + return x.PhoneNum + } + return "" +} + +type UserVerify struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PhoneNum string `protobuf:"bytes,1,opt,name=phoneNum,proto3" json:"phoneNum,omitempty"` + VerificationCode string `protobuf:"bytes,2,opt,name=VerificationCode,proto3" json:"VerificationCode,omitempty"` +} + +func (x *UserVerify) Reset() { + *x = UserVerify{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_auth_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserVerify) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserVerify) ProtoMessage() {} + +func (x *UserVerify) ProtoReflect() protoreflect.Message { + mi := &file_v1_auth_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserVerify.ProtoReflect.Descriptor instead. +func (*UserVerify) Descriptor() ([]byte, []int) { + return file_v1_auth_proto_rawDescGZIP(), []int{1} +} + +func (x *UserVerify) GetPhoneNum() string { + if x != nil { + return x.PhoneNum + } + return "" +} + +func (x *UserVerify) GetVerificationCode() string { + if x != nil { + return x.VerificationCode + } + return "" +} + +type LoginReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StatuCode int32 `protobuf:"varint,1,opt,name=statuCode,proto3" json:"statuCode,omitempty"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *LoginReply) Reset() { + *x = LoginReply{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_auth_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoginReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginReply) ProtoMessage() {} + +func (x *LoginReply) ProtoReflect() protoreflect.Message { + mi := &file_v1_auth_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoginReply.ProtoReflect.Descriptor instead. +func (*LoginReply) Descriptor() ([]byte, []int) { + return file_v1_auth_proto_rawDescGZIP(), []int{2} +} + +func (x *LoginReply) GetStatuCode() int32 { + if x != nil { + return x.StatuCode + } + return 0 +} + +func (x *LoginReply) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type ActionReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StatusCode int32 `protobuf:"varint,1,opt,name=statusCode,proto3" json:"statusCode,omitempty"` +} + +func (x *ActionReply) Reset() { + *x = ActionReply{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_auth_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActionReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActionReply) ProtoMessage() {} + +func (x *ActionReply) ProtoReflect() protoreflect.Message { + mi := &file_v1_auth_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ActionReply.ProtoReflect.Descriptor instead. +func (*ActionReply) Descriptor() ([]byte, []int) { + return file_v1_auth_proto_rawDescGZIP(), []int{3} +} + +func (x *ActionReply) GetStatusCode() int32 { + if x != nil { + return x.StatusCode + } + return 0 +} + +var File_v1_auth_proto protoreflect.FileDescriptor + +var file_v1_auth_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x04, 0x61, 0x75, 0x74, 0x68, 0x22, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x22, 0x54, 0x0a, 0x0a, 0x55, 0x73, 0x65, + 0x72, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, + 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x68, 0x6f, 0x6e, 0x65, + 0x4e, 0x75, 0x6d, 0x12, 0x2a, 0x0a, 0x10, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x22, + 0x40, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0x2d, 0x0a, 0x0b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, + 0x32, 0x89, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x12, 0x29, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0a, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x25, 0x0a, 0x05, + 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0a, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x1a, 0x10, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x12, 0x27, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x0a, 0x2e, + 0x61, 0x75, 0x74, 0x68, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x6f, 0x0a, 0x08, + 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x42, 0x09, 0x41, 0x75, 0x74, 0x68, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x72, 0x6f, 0x63, 0x62, 0x6f, 0x73, 0x73, 0x2f, 0x70, 0x61, 0x6f, 0x70, 0x61, 0x6f, + 0x2d, 0x63, 0x65, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0xa2, + 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x41, 0x75, 0x74, 0x68, 0xca, 0x02, 0x04, 0x41, + 0x75, 0x74, 0x68, 0xe2, 0x02, 0x10, 0x41, 0x75, 0x74, 0x68, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x41, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_v1_auth_proto_rawDescOnce sync.Once + file_v1_auth_proto_rawDescData = file_v1_auth_proto_rawDesc +) + +func file_v1_auth_proto_rawDescGZIP() []byte { + file_v1_auth_proto_rawDescOnce.Do(func() { + file_v1_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_auth_proto_rawDescData) + }) + return file_v1_auth_proto_rawDescData +} + +var file_v1_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_v1_auth_proto_goTypes = []interface{}{ + (*User)(nil), // 0: auth.User + (*UserVerify)(nil), // 1: auth.UserVerify + (*LoginReply)(nil), // 2: auth.LoginReply + (*ActionReply)(nil), // 3: auth.ActionReply +} +var file_v1_auth_proto_depIdxs = []int32{ + 0, // 0: auth.Authenticate.preLogin:input_type -> auth.User + 0, // 1: auth.Authenticate.login:input_type -> auth.User + 0, // 2: auth.Authenticate.logout:input_type -> auth.User + 3, // 3: auth.Authenticate.preLogin:output_type -> auth.ActionReply + 2, // 4: auth.Authenticate.login:output_type -> auth.LoginReply + 3, // 5: auth.Authenticate.logout:output_type -> auth.ActionReply + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_v1_auth_proto_init() } +func file_v1_auth_proto_init() { + if File_v1_auth_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_v1_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*User); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserVerify); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoginReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActionReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_v1_auth_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v1_auth_proto_goTypes, + DependencyIndexes: file_v1_auth_proto_depIdxs, + MessageInfos: file_v1_auth_proto_msgTypes, + }.Build() + File_v1_auth_proto = out.File + file_v1_auth_proto_rawDesc = nil + file_v1_auth_proto_goTypes = nil + file_v1_auth_proto_depIdxs = nil +} diff --git a/auto/rpc/v1/auth_grpc.pb.go b/auto/rpc/v1/auth_grpc.pb.go new file mode 100644 index 00000000..64fdc1d1 --- /dev/null +++ b/auto/rpc/v1/auth_grpc.pb.go @@ -0,0 +1,177 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc (unknown) +// source: v1/auth.proto + +package v1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// AuthenticateClient is the client API for Authenticate service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AuthenticateClient interface { + PreLogin(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) + Login(ctx context.Context, in *User, opts ...grpc.CallOption) (*LoginReply, error) + Logout(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) +} + +type authenticateClient struct { + cc grpc.ClientConnInterface +} + +func NewAuthenticateClient(cc grpc.ClientConnInterface) AuthenticateClient { + return &authenticateClient{cc} +} + +func (c *authenticateClient) PreLogin(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) { + out := new(ActionReply) + err := c.cc.Invoke(ctx, "/auth.Authenticate/preLogin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authenticateClient) Login(ctx context.Context, in *User, opts ...grpc.CallOption) (*LoginReply, error) { + out := new(LoginReply) + err := c.cc.Invoke(ctx, "/auth.Authenticate/login", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authenticateClient) Logout(ctx context.Context, in *User, opts ...grpc.CallOption) (*ActionReply, error) { + out := new(ActionReply) + err := c.cc.Invoke(ctx, "/auth.Authenticate/logout", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuthenticateServer is the server API for Authenticate service. +// All implementations must embed UnimplementedAuthenticateServer +// for forward compatibility +type AuthenticateServer interface { + PreLogin(context.Context, *User) (*ActionReply, error) + Login(context.Context, *User) (*LoginReply, error) + Logout(context.Context, *User) (*ActionReply, error) + mustEmbedUnimplementedAuthenticateServer() +} + +// UnimplementedAuthenticateServer must be embedded to have forward compatible implementations. +type UnimplementedAuthenticateServer struct { +} + +func (UnimplementedAuthenticateServer) PreLogin(context.Context, *User) (*ActionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method PreLogin not implemented") +} +func (UnimplementedAuthenticateServer) Login(context.Context, *User) (*LoginReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") +} +func (UnimplementedAuthenticateServer) Logout(context.Context, *User) (*ActionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") +} +func (UnimplementedAuthenticateServer) mustEmbedUnimplementedAuthenticateServer() {} + +// UnsafeAuthenticateServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuthenticateServer will +// result in compilation errors. +type UnsafeAuthenticateServer interface { + mustEmbedUnimplementedAuthenticateServer() +} + +func RegisterAuthenticateServer(s grpc.ServiceRegistrar, srv AuthenticateServer) { + s.RegisterService(&Authenticate_ServiceDesc, srv) +} + +func _Authenticate_PreLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(User) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthenticateServer).PreLogin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/auth.Authenticate/preLogin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthenticateServer).PreLogin(ctx, req.(*User)) + } + return interceptor(ctx, in, info, handler) +} + +func _Authenticate_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(User) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthenticateServer).Login(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/auth.Authenticate/login", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthenticateServer).Login(ctx, req.(*User)) + } + return interceptor(ctx, in, info, handler) +} + +func _Authenticate_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(User) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthenticateServer).Logout(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/auth.Authenticate/logout", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthenticateServer).Logout(ctx, req.(*User)) + } + return interceptor(ctx, in, info, handler) +} + +// Authenticate_ServiceDesc is the grpc.ServiceDesc for Authenticate service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Authenticate_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "auth.Authenticate", + HandlerType: (*AuthenticateServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "preLogin", + Handler: _Authenticate_PreLogin_Handler, + }, + { + MethodName: "login", + Handler: _Authenticate_Login_Handler, + }, + { + MethodName: "logout", + Handler: _Authenticate_Logout_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "v1/auth.proto", +} diff --git a/buf.gen.yaml b/buf.gen.yaml new file mode 100644 index 00000000..bf9ba452 --- /dev/null +++ b/buf.gen.yaml @@ -0,0 +1,16 @@ +version: v1 +managed: + enabled: true + go_package_prefix: + default: github.com/rocboss/paopao-ce/auto/rpc + except: + - buf.build/googleapis/googleapis +plugins: + - plugin: go + out: auto/rpc + opt: paths=source_relative + - plugin: go-grpc + out: auto/rpc + opt: + - paths=source_relative + - require_unimplemented_servers=true diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100644 index 00000000..1878b341 --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,3 @@ +version: v1 +directories: + - proto diff --git a/config.yaml.sample b/config.yaml.sample index d776769b..ec33d9eb 100644 --- a/config.yaml.sample +++ b/config.yaml.sample @@ -1,4 +1,5 @@ App: # APP基础设置项 + RunMode: debug AttachmentIncomeRate: 0.8 MaxCommentCount: 10 DefaultContextTimeout: 60 @@ -11,19 +12,59 @@ Server: # 服务设置 ReadTimeout: 60 WriteTimeout: 60 Features: - Default: ["Base", "MySQL", "Option", "Zinc", "LocalOSS", "LoggerFile", "Friendship"] + Default: ["Base", "MySQL", "Option", "Zinc", "LocalOSS", "LoggerFile", "Friendship", "Deprecated"] Develop: ["Base", "MySQL", "BigCacheIndex", "Meili", "Sms", "AliOSS", "LoggerMeili", "OSS:Retention"] Demo: ["Base", "MySQL", "Option", "Zinc", "Sms", "MinIO", "LoggerZinc", "Migration"] Slim: ["Base", "Sqlite3", "LocalOSS", "LoggerFile", "OSS:TempDir"] Base: ["Redis", "PhoneBind"] Docs: ["Docs:OpenAPI"] + Deprecated: ["Deprecated:OldWeb"] + Service: ["Web", "Admin", "SpaceX", "Bot", "LocalOSS", "Mobile", "Frontend:Web", "Fronetend:EmbedWeb", "Docs"] Option: ["SimpleCacheIndex"] Sms: "SmsJuhe" +WebServer: # Web服务 + HttpIp: 0.0.0.0 + HttpPort: 8010 + ReadTimeout: 60 + WriteTimeout: 60 +AdminServer: # Admin后台运维服务 + HttpIp: 0.0.0.0 + HttpPort: 8014 + ReadTimeout: 60 + WriteTimeout: 60 +SpaceXServer: # SpaceX服务 + HttpIp: 0.0.0.0 + HttpPort: 8012 + ReadTimeout: 60 + WriteTimeout: 60 +BotServer: # Bot服务 + HttpIp: 0.0.0.0 + HttpPort: 8016 + ReadTimeout: 60 + WriteTimeout: 60 +LocalossServer: # Localoss服务 + HttpIp: 0.0.0.0 + HttpPort: 8018 + ReadTimeout: 60 + WriteTimeout: 60 +FrontendWebServer: # Web前端服务 + HttpIp: 0.0.0.0 + HttpPort: 8006 + ReadTimeout: 60 + WriteTimeout: 60 +DocsServer: # 开发文档服务 + HttpIp: 0.0.0.0 + HttpPort: 8011 + ReadTimeout: 60 + WriteTimeout: 60 +MobileServer: # 移动端grpc api服务 + Host: 0.0.0.0 + Port: 8020 SmsJuhe: Gateway: https://v.juhe.cn/sms/send Key: TplID: - TplVal: "#code#=%d&#m#=%d" + TplVal: "#code#=%s&#m#=%d" Alipay: AppID: InProduction: True diff --git a/docs/README.md b/docs/README.md index d2c7b192..fda64147 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,3 +4,4 @@ * [openapi](openapi): api相关文档 * [proposal](proposal): 开发/设计 提按相关文档 * [deploy](deploy): 部署相关文档 +* [discuss](discuss): 开发者交流 diff --git a/docs/deploy/README.md b/docs/deploy/README.md index a870fd7b..cedbe93f 100644 --- a/docs/deploy/README.md +++ b/docs/deploy/README.md @@ -1,2 +1,9 @@ ## 部署文档 -TODO \ No newline at end of file +本目录包含一些paopao-ce部署相关的帮助文档 + +* [core](./core) - paopao-ce部署帮助文档 +* [aliyun](./aliyun) - Aliyun平台部署文档 +* [huawei](./huawei) - Huawei Cloud平台部署文档 +* [tencnet](./tencent) - Tencent Cloud平台部署文档 +* [local](./local) - 本地部署文档 +* [k8s](./k8s) - 使用Kubernetes部署paopao-ce相关文档 diff --git a/docs/deploy/aliyun/README.md b/docs/deploy/aliyun/README.md new file mode 100644 index 00000000..bae5e98a --- /dev/null +++ b/docs/deploy/aliyun/README.md @@ -0,0 +1,2 @@ +### Aliyun平台部署文档 +本目录包含一些阿里云平台部署paopao-ce的一些帮助文档。 diff --git a/docs/deploy/core/001-配置文件说明.md b/docs/deploy/core/001-配置文件说明.md new file mode 100644 index 00000000..b1af7e2b --- /dev/null +++ b/docs/deploy/core/001-配置文件说明.md @@ -0,0 +1,95 @@ +### 配置文件说明 +paopao-ce使用YAML格式的`conf.yml`作为配置文件。[`config.yaml.sample`](../../../config.yaml.sample) 是一份完整的配置文件模版,paopao-ce启动时会读取`./custom/config.yaml`、`./config.yaml`任意一份配置文件(优先读取最先找到的文件)。 + +```sh +cp config.yaml.sample config.yaml +vim config.yaml # 修改参数 +paopao-ce +``` + +配置文件中的 `Features` 小节是声明paopao-ce运行时开启哪些功能项: + +```yaml +... + +Features: + Default: ["Base", "MySQL", "Option", "LocalOSS", "LoggerFile"] + Develop: ["Base", "MySQL", "Option", "Sms", "AliOSS", "LoggerZinc"] + Demo: ["Base", "MySQL", "Option", "Sms", "MinIO", "LoggerZinc"] + Slim: ["Base", "Sqlite3", "LocalOSS", "LoggerFile"] + Base: ["Zinc", "Redis", "Alipay",] + Option: ["SimpleCacheIndex"] + Sms: "SmsJuhe" + +... +``` + +如上: +Default/Develop/Demo/Slim 是不同 功能集套件(Features Suite), Base/Option 是子功能套件, Sms是关于短信验证码功能的参数选项。 + +这里 `Default`套件 代表的意思是: 使用`Base/Option` 中的功能,外加 `MySQL/LocalOSS/LoggerFile`功能,也就是说开启了`Zinc/Redis/Alipay/SimpleCacheIndex/MySQL/LocalOSS/LoggerFile` 7项功能; +`Develop`套件依例类推。 + +使用Feautures: + +```sh +release/paopao-ce --help +Usage of release/paopao-ce: + -features value + use special features + -no-default-features + whether use default features + +# 默认使用 Default 功能套件 +release/paopao-ce + +# 不包含 default 中的功能集,仅仅使用 develop 中声明的功能集 +release/paopao-ce --no-default-features --features develop + +# 使用 default 中的功能集,外加 sms 功能 +release/paopao-ce --features sms + +# 手动指定需要开启的功能集 +release/paopao-ce --no-default-features --features sqlite3,localoss,loggerfile,redis +``` + +目前支持的功能集合: +| 功能项 | 类别 | 状态 | 备注 | +| ----- | ----- | ----- | ----- | +|`OldWeb` | 子服务 | 稳定(默认) | 开启旧的Web服务 | +|`Web` | 子服务 | WIP | 开启Web服务| +|`Admin` | 子服务 | WIP | 开启Admin后台运维服务| +|`SpaceX` | 子服务 | WIP | 开启SpaceX服务| +|`Bot` | 子服务 | WIP | 开启Bot服务| +|`NativeOBS` | 子服务 | WIP | 开启NativeOBS服务| +|`Deprecated:Web` | 子服务 | 稳定 | Deprecated(关闭) OldWeb服务| +|`Gorm` | 数据库 | 稳定(默认) | 使用[gorm](https://github.com/go-gorm/gorm)作为数据库的ORM,默认使用 `Gorm` + `MySQL`组合| +|`Sqlx`| 数据库 | WIP | 使用[sqlx](https://github.com/jmoiron/sqlx)作为数据库的ORM| +|`MySQL`| 数据库 | 稳定(默认) | 使用MySQL作为数据库| +|`Postgres`| 数据库 | 稳定 | 使用PostgreSQL作为数据库| +|`Sqlite3`| 数据库 | 稳定 | 使用Sqlite3作为数据库| +|`AliOSS` | 对象存储 | 稳定(推荐) |阿里云对象存储服务| +|`COS` | 对象存储 | 内测 |腾讯云对象存储服务| +|`HuaweiOBS` | 对象存储 | 内测 |华为云对象存储服务| +|`MinIO` | 对象存储 | 稳定 |[MinIO](https://github.com/minio/minio)对象存储服务| +|`S3` | 对象存储 | 内测 |AWS S3兼容的对象存储服务| +|`LocalOSS` | 对象存储 | 内测 |提供使用本地目录文件作为对象存储的功能,仅用于开发调试环境| +|`OSS:Retention` | 对象存储 | 内测 |基于对象存储系统的对象过期自动删除特性实现 先创建临时对象再持久化的功能| +|`OSS:TempDir` | 对象存储 | 内测 |基于对象存储系统的对象拷贝/移动特性实现 先创建临时对象再持久化的功能| +|`Redis` | 缓存 | 稳定 | Redis缓存功能 | +|`SimpleCacheIndex` | 缓存 | 稳定 | 提供简单的 广场推文列表 的缓存功能 | +|`BigCacheIndex` | 缓存 | 稳定(推荐) | 使用[BigCache](https://github.com/allegro/bigcache)缓存 广场推文列表,缓存每个用户每一页,简单做到千人千面 | +|`Zinc` | 搜索 | 稳定(推荐) | 基于[Zinc](https://github.com/zinclabs/zinc)搜索引擎提供推文搜索服务 | +|`Meili` | 搜索 | 稳定(推荐) | 基于[Meilisearch](https://github.com/meilisearch/meilisearch)搜索引擎提供推文搜索服务 | +|`Bleve` | 搜索 | WIP | 基于[Bleve](https://github.com/blevesearch/bleve)搜索引擎提供推文搜索服务 | +|`LoggerFile` | 日志 | 稳定 | 使用文件写日志 | +|`LoggerZinc` | 日志 | 稳定(推荐) | 使用[Zinc](https://github.com/zinclabs/zinc)写日志 | +|`LoggerMeili` | 日志 | 内测 | 使用[Meilisearch](https://github.com/meilisearch/meilisearch)写日志 | +|`Friendship` | 关系模式 | 内测(默认) | 弱关系好友模式,类似微信朋友圈 | +|`Followship` | 关系模式 | WIP | 关注者模式,类似Twitter的Follow模式 | +|`Alipay` | 支付 | 稳定 | 开启基于[支付宝开放平台](https://open.alipay.com/)的钱包功能 | +|`Sms` | 短信验证 | 稳定 | 开启短信验证码功能,用于手机绑定验证手机是否注册者的;功能如果没有开启,手机绑定时任意短信验证码都可以绑定手机 | +|`Docs:OpenAPI` | 开发文档 | 稳定 | 开启openapi文档功能,提供web api文档说明(visit http://127.0.0.1:8008/docs/openapi) | +|`PhoneBind` | 其他 | 稳定 | 手机绑定功能 | + +> 功能项状态详情参考 [features-status](../../../features-status.md). diff --git a/docs/deploy/core/README.md b/docs/deploy/core/README.md new file mode 100644 index 00000000..fc82b4c2 --- /dev/null +++ b/docs/deploy/core/README.md @@ -0,0 +1,4 @@ +### paopao-ce部署帮助文档 +本目录包含一些部署paopao-ce的一些帮助文档。 + +* [001-配置文件说明](./001-配置文件说明.md '001-配置文件说明') diff --git a/docs/deploy/huawei/README.md b/docs/deploy/huawei/README.md new file mode 100644 index 00000000..8052deaf --- /dev/null +++ b/docs/deploy/huawei/README.md @@ -0,0 +1,2 @@ +### Huawei Cloud平台部署文档 +本目录包含一些华为云平台部署paopao-ce的一些帮助文档。 diff --git a/docs/deploy/k8s/README.md b/docs/deploy/k8s/README.md new file mode 100644 index 00000000..e3b23686 --- /dev/null +++ b/docs/deploy/k8s/README.md @@ -0,0 +1,2 @@ +### 使用Kubernetes部署paopao-ce相关文档 +本目录包含一些k8s环境部署paopao-ce的一些帮助文档。 diff --git a/docs/deploy/local/001-本地开发依赖环境部署.md b/docs/deploy/local/001-本地开发依赖环境部署.md new file mode 100644 index 00000000..9fd293f4 --- /dev/null +++ b/docs/deploy/local/001-本地开发依赖环境部署.md @@ -0,0 +1,119 @@ +### 本地开发依赖环境部署 +本地开发依赖的环境部署帮助文档,包括Zinc/Meili/Minio的部署。 + +#### [Zinc](https://github.com/zinclabs/zinc) 搜索引擎: +* Zinc运行 +```sh +# 创建用于存放zinc数据的目录 +mkdir -p data/zinc/data + +# 使用Docker运行zinc +docker run -d --name zinc --user root -v ${PWD}/data/zinc/data:/data -p 4080:4080 -e ZINC_FIRST_ADMIN_USER=admin -e ZINC_FIRST_ADMIN_PASSWORD=admin -e DATA_PATH=/data public.ecr.aws/zinclabs/zinc:latest + +# 查看zinc运行状态 +docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +41465feea2ff getmeili/meilisearch:v0.27.0 "tini -- /bin/sh -c …" 20 hours ago Up 20 hours 0.0.0.0:7700->7700/tcp paopao-ce-meili-1 +7daf982ca062 public.ecr.aws/prabhat/zinc:latest "/go/bin/zinc" 3 weeks ago Up 6 days 0.0.0.0:4080->4080/tcp zinc + +# 使用docker compose运行 +docker compose up -d zinc +# visit http://localhost:4080 打开自带的ui管理界面 +``` + +* 修改Zinc配置 +```yaml +# features中加上 Zinc 和 LoggerZinc +Features: + Default: ["Zinc", "LoggerZinc", "Base", "Sqlite3", "BigCacheIndex","MinIO"] +... +LoggerZinc: # 使用Zinc写日志 + Host: 127.0.0.1:4080 # 这里的host就是paopao-ce能访问到的zinc主机 + Index: paopao-log + User: admin + Password: admin + Secure: False # 如果使用https访问zinc就设置为True +... +Zinc: # Zinc搜索配置 + Host: 127.0.0.1:4080 + Index: paopao-data + User: admin + Password: admin + Secure: False +``` + +#### [Meilisearch](https://github.com/meilisearch/meilisearch) 搜索引擎: +* Meili运行 +```sh +mkdir -p data/meili/data + +# 使用Docker运行 +docker run -d --name meili -v ${PWD}/data/meili/data:/meili_data -p 7700:7700 -e MEILI_MASTER_KEY=paopao-meilisearch getmeili/meilisearch:v0.29.0 +# visit http://localhost:7700 打开自带的搜索前端ui + +# 使用docker compose运行,需要删除docker-compose.yaml中关于meili的注释 +docker compose up -d meili + +# 使用docker运行meilisearch的ui管理前端 +docker run -d --name uirecord -p 7701:3000 bitriory/uirecord +# visit http://localhost:7701 + +# 使用docker compose运行meilisearch的ui管理前端,需要删除docker-compose.yaml中关于uirecord的注释 +docker compose up -d uirecord +# visit http://loclahost:7701 + +# 查看meili运行状态 +docker compose ps +NAME COMMAND SERVICE STATUS PORTS +paopao-ce-meili-1 "tini -- /bin/sh -c …" meili running 0.0.0.0:7700->7700/tcp +paopao-ce-uirecord-1 "docker-entrypoint.s…" uirecord running 0.0.0.0:7701->3000/tcp +``` + +* 修改Meili配置 +```yaml +# features中加上 Meili 和 LoggerMeili +Features: + Default: ["Meili", "LoggerMeili", "Base", "Sqlite3", "BigCacheIndex","MinIO"] +... +LoggerMeili: # 使用Meili写日志 + Host: 127.0.0.1:7700 + Index: paopao-log + ApiKey: paopao-meilisearch + Secure: False + MinWorker: 5 # 最小后台工作者, 设置范围[5, 100], 默认5 + MaxLogBuffer: 100 # 最大log缓存条数, 设置范围[10, 10000], 默认100 +... +Meili: # Meili搜索配置 + Host: 127.0.0.1:7700 # 这里的host就是paopao-ce能访问到的meili主机 + Index: paopao-data + ApiKey: paopao-meilisearch + Secure: False # 如果使用https访问meili就设置为True +``` + +#### [MinIO](https://github.com/minio/minio) 对象存储服务 +* MinIO运行 +```sh +mkdir -p data/minio/data + +# 使用Docker运行 +docker run -d --name minio -v ${PWD}/data/minio/data:/data -p 9000:9000 -p 9001:9001 -e MINIO_ROOT_USER=minio-root-user -e MINIO_ROOT_PASSWORD=minio-root-password -e MINIO_DEFAULT_BUCKETS=paopao:public bitnami/minio:latest + +# 使用docker compose运行, 需要删除docker-compose.yaml中关于minio的注释 +docker compose up -d minio +``` + +* 修改Minio配置 +```yaml +# features中加上 MinIO +Features: + Default: ["MinIO", "Meili", "LoggerMeili", "Base", "Sqlite3", "BigCacheIndex"] +... +MinIO: # MinIO 存储配置 + AccessKey: Q3AM3UQ867SPQQA43P2F # AccessKey/SecretKey 需要登入minio管理界面手动创建,管理界面地址: http://127.0.0.1:9001 + SecretKey: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG + Secure: False + Endpoint: 127.0.0.1:9000 # 根据部署的minio主机修改对应地址 + Bucket: paopao # 如上,需要在管理界面创建bucket并赋予外部可读写权限 + Domain: 127.0.0.1:9000 # minio外网访问的地址(如果想让外网访问,这里需要设置为外网可访问到的minio主机地址) +... +``` \ No newline at end of file diff --git a/docs/deploy/local/README.md b/docs/deploy/local/README.md new file mode 100644 index 00000000..a04b93e1 --- /dev/null +++ b/docs/deploy/local/README.md @@ -0,0 +1,4 @@ +### 本地部署文档 +本目录包含一些本地开发环境部署paopao-ce的一些帮助文档。 + +* [001-本地开发依赖环境部署](001-本地开发依赖环境部署.md '001-本地开发依赖环境部署') diff --git a/docs/deploy/tencent/README.md b/docs/deploy/tencent/README.md new file mode 100644 index 00000000..4674183d --- /dev/null +++ b/docs/deploy/tencent/README.md @@ -0,0 +1,2 @@ +### Tencent Cloud平台部署文档 +本目录包含一些腾讯云平台部署paopao-ce的一些帮助文档。 diff --git a/docs/discuss/0000-讨论样式模版.md b/docs/discuss/0000-讨论样式模版.md new file mode 100644 index 00000000..a7e50871 --- /dev/null +++ b/docs/discuss/0000-讨论样式模版.md @@ -0,0 +1,26 @@ +### <主题标题> +====== <这里写主题描述> ===== + +#### <话题标题> +====== <这里写话题描述> ===== +* [北野](https://alimy.me) - 2022/12/14 10:07 + > 这里就是你的观点论述了 + +* [北野](https://alimy.me) - 2022/12/14 10:07 + > 这里就是你的观点论述了 + +* [北野](https://alimy.me) - 2022/12/14 10:07 + > 这里就是你的观点论述了 + +* [北野](https://alimy.me) - 2022/12/14 10:07 + > 这里就是你的观点论述了 + +* [北野](https://alimy.me) - 2022/12/14 10:07 + > 这里就是你的回复 + >> 这里就是你的观点论述了 + +* [北野](https://alimy.me) - 2022/12/14 10:07 + > 你的回复 + >> 这里就是你的回复 + >>> 这里就是你的观点论述了 + diff --git a/docs/discuss/0001-FAQs.md b/docs/discuss/0001-FAQs.md new file mode 100644 index 00000000..83fb01e9 --- /dev/null +++ b/docs/discuss/0001-FAQs.md @@ -0,0 +1,19 @@ +### FAQs 常见问题 +一些常见问题的解答。 + + +#### 为什么要在代码库[docs](../../docs/)中写开发文档,比如[proposal](../proposal/)提按文档? +* [北野](https://alimy.me) - 2022/12/14 10:20 + > 这里有几个原因 + > * 开发文档跟随代码库对开发者友好; + > * paopao-ce的开发是离散组织式开发,代码寄存在GitHub,并没有一个统一的开发平台; + > * 为什么没有使用GitHub的Wiki写档?这个后续会把一些文档Copy到WiKi。 + > * 文档跟随代码,将更好的与代码共存,而且Markdown足够用于写文档,这才是最核心的,怎么简单怎么来。 + + +#### 为什么要在代码库[docs](../../docs/)中包含一个[discuss](../discuss/)?难道没有其他可用工具更好完成这种工作吗,比瑞slack/discord? +* [北野](https://alimy.me) - 2022/12/14 10:32 + > discuss目录包含一些关于代码库开发的一些方案讨论,偏静态内容,代码库内置这些方案讨论,也便于git进行跟踪归档。 + > 确实有其他一些社交类开发聊天工具可用,比如slack/discord,但是目前paopao-ce的开发者社区还比较小,暂时还没有开通的必要。 +* [北野](https://alimy.me) - 2022/12/14 10:50 + > 再一个国内访问也不是特别方便,暂时采用目前这种土办法过渡一下,或许后期会选择一个社交平台供开发者交流,比如飞书~ diff --git a/docs/discuss/README.md b/docs/discuss/README.md new file mode 100644 index 00000000..3b983ca6 --- /dev/null +++ b/docs/discuss/README.md @@ -0,0 +1,5 @@ +### Discuss 开发者交流 +本目录包含一些开发相关的问题交流论述。 + +* [0000-讨论样式模版](./0000-讨论样式模版.md "讨论样式模版") +* [0001-FAQs](./0001-FAQs.md "FAQs") diff --git a/docs/openapi/embed.go b/docs/openapi/embed.go index 8500ca3c..e72721fb 100644 --- a/docs/openapi/embed.go +++ b/docs/openapi/embed.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build docs // +build docs diff --git a/docs/proposal/.assets/00-00.png b/docs/proposal/.assets/000-00.png similarity index 100% rename from docs/proposal/.assets/00-00.png rename to docs/proposal/.assets/000-00.png diff --git a/docs/proposal/.assets/00-01.png b/docs/proposal/.assets/000-01.png similarity index 100% rename from docs/proposal/.assets/00-01.png rename to docs/proposal/.assets/000-01.png diff --git a/docs/proposal/.assets/001-01.drawio b/docs/proposal/.assets/001-01.drawio new file mode 100644 index 00000000..e3bd7cc0 --- /dev/null +++ b/docs/proposal/.assets/001-01.drawio @@ -0,0 +1 @@ +7V1rc+I4Fv01fEzKevj1MaQzs1vVvd1b2arpmW8GHOJtglnjdJL59SuDZawrGYTxQ26c6qrGxjZw79HR1dGV7oTcv7z/ngSb5y/xIlxNsLV4n5BPE4yRSyn7LzvzsT/jk/zEMokW+UWHE4/R32F+0srPvkaLcCtcmMbxKo024sl5vF6H81Q4FyRJ/CZe9hSvxE/dBMtQOvE4D1by2T+iRfq8P+th93D+H2G0fOafjBx//85LwC/Of8n2OVjEb6VT5GFC7pM4TvevXt7vw1VmPG6X/X2/VbxbfLEkXKc6N0Tf//rvNEbTP5LHT/aN/Z+3zQzdYC//IT+D1Wv+k/Ovm35wGyTx63oRZo+xJmT69hyl4eMmmGfvvjGvs3PP6cuKHSH2sviZ2bXLVbDd5q+3P8J0/pwfPMXrNHd2ZonpMgkWEfsh9/EqTtjJdbwOs8ui1Qqc2qZJ/CMEJ2Vb5Ob5GSZp+F46ldvm9zB+CdPkg12Sv0tyN+U4tfPDt4PTkU3zk88lj7v8yiBH2rJ49MEZ7EXuj7N843XuG6Twze44/8Ts/cymEWshd6touWbn0jj7mCA/WoVPaTMeQVh0iSO7xPYVHnH89jziSx7ZBDH7d8MszvwSJj+jOaOri7xUtj8C9rcU9p/FaRq/QI+WXS24twHPYJcKniGW7Bqscg2yWnMN/7iSa/4IZx23F+R0Z+DClmUDk/bsiyT77gz3faAmpg4wMenfxFgy8d3iJVr/KhY2AMREsvCXeBYxuw7TxMRAnqCSiacsxB2mfSUeNoAkbMm+t7u/gZpYgrABJnYkE0vGZfbaZC9fX1Z38zQbixRx2edgFq6+xdsojWIhPlMHziUnxK/pKlqzwQ0fy2YOEN14fgjfVMxHfMFPSEE1RBWNt+cmjaHr9bmJAjeh3t2kMYq9PjfZwE24dzfJQ9vRTYRzjCmkVwR4o5vKIw0LuKlv0iOWPFoe3UQRcFPfpEcsecQ9usm2kWmkJw/bRzfZDnBT/6QnD/1HN9muOIthAOnJCoLkJvacaLMNT+sGwXazN/lT9J4Z2xSzE9DXFLqJICvIZkftmV1DVRi82SmYsyvkwP7MrqESDN7sNvJNM7vGqH/wZseOaHZCZW7v2Owao/jBm922XcPMjjRG5Qez8xhovopfF6fdYIjVPZHZiSKOcRRGby09hiB5jP2vMH2Lkx/G2H43SVLO33AacITrgD4WK8geK1zhOq254oxxNIvUfxwzsjZ0w4WQuifbSzWDlISrII1+hsKTVAbJH/ctjtjHlmZBsGB7xPPn+CO28WsyD/O7DmaVH8Rl8aoHpUGyDFPpQXdJEnyULttkF2yrv3DREYPPqfxe7tHr2Yv9NziApTD4Jfg5Y4A/aPwQHx13uy5+KOgD28IPddSfU/m9yNHr28LPGcrDoPFj04b4x6nghabx46Dz+Mf2euGfa5BEMBQMvb4HiegqJBEwNjfA7FchibgQ7X0LgEhHElkv7rJVK5NiaYN2P8VMlXx8z968tfnhn/mdu4NP7/md+6MPfvQepaXb2NGfpXcON2UH/J5K/+y7n2NW4Orzvn/RIeVz+ln7yAj00tANDICpB5CiHbqBpSYUZrJVdL3N9XaySKRKlc/svpuTAQ0+n4WZM9+H5fkbPj3zEi0W2TOmSbiN/g5mxcKFPFZgD7enE/uTYqgs4+pEU4J0UCwEyz92Ul5rpaIJ6xYVS9LqAoRfEj89bcN2XIZ1BKYeuaPEHKg15nC0mcMZmaMdGMqSW/T1MQvK14skZvcOiEOKJtUAh2Aw6r0ZAKPgjhilXizilBjlhpE0i1mP0Up28C1MImaWDE8XUk2xEkeDatyRatrBpywJ/jMji3WQ3ateF2Uy2/Dm1gDbWD62RbpB5tONrNB9CthvDtgYE//2dZp1Io9hkLAhIfRqB+tY1BlGK5CQJOEHZiwVOAKLocUV1JePbRER/U9VS6NVk3EY0kFzo1usktCcVfbzt5tgLbjU+d9rzO1ys9354Y5dgOjmfdek+Pvs1XL3/wOdTL3JdMqfyL7i/qH5+/npWXLRx3z5ePz3Zwl+xYzhxypiOEzIaRDO9oj9PCtOBPMfyx2Ov+5T1ThacwzaEkhEjFII4AZAhIFAYvOc5RKIPKVA0h6GZD1wxwymeqTNNfbI9oxzj6wb3gfzZ3nxrDEOatgnMLqyFWsVu/aJLCrybtR6WC8zu12LdyiP2g1qMbLSVrFYtw+nEDBua4PGbJ6JaE6TIQotLQswphPvIXs0DDbGqOKcbgv42zHA34q1WKO/m+oSQUKUCf5WKFsP9uSOTrJcgtHHF3esJvhYI2GsnnqJuPJ47pyoSoIszasgqj2zckNvSXFxc6pm0fGdVjWxWVOvFIl6hw3FSG1V0wHCCdRD2lY1iSyDGY5bz+4ft3zjz6HhFlMiEmddNR57/q3tl/7Ex1Ln1rGt4g98z9YxrZM8dzmmURnRBb7rYLqM59KEd9WclArNi2D7vPvGR7vYJimZNwJjoA3ifFoX2r51DNpWv9DWSVBsgK6bgjZqANqXoBkPFM3EE+OC2mgm1L2lloRXQ9As67el3WsBrFveWLhoDuVxTGm35wkmiyD0nuYTuOUze8eZe+HsqSHB4vQuw8rFVK1tP0dIe3miYo4FPiNIPASE+KwMsQvYhE8Zn2STYltmQ9iEUhFS1K07XPHBg3DXwxXVcuK9ghLBydcMZxeJKrupvmJ+d/848SPY6dLHwiZhbvIHaTBd1XLFMYX5mWa8NbTOZ7XobGSzU5E+iI1qsxmxnVvwKLjYom0+o/JUgErI7ZhKKIiFsC6vFC2riRRWh4jEgs0nFtwRsbi1mMUdqeVUoIQbohaKRdmge2KR5yMqshl74BZtOuHtqZFVNWBf70tzVMFjuqCX9rR6KtALKie7s4jkfAFoP0LmBarwZXSCzNJmpNFUXREd7sRHqN0xSbQnlIuA8sQO6xJF8YaNODCQFanTsa7I2Xx4HVxT2JWUgK6XY1CVEl6hBLzWlgZQhTTw8F6s/Lhnt4S7LSdOSQXS1zBJPlBz9AneuLhfzlZS8TmNC6HdYT/cfYlCqFb3WQbP5z+3WqDuuAweobJCfY1l8JDFd1TjEUX/dfAIlSXb4dbB07Jwt9WBCA8NfokCVwg7wMC9l18itizSDbkMnmxiAzAsK2eDroOHkIE8oZCEhlwwU+ZiA6hClmgGXQxPxrEBNtZQLa6uqgOy+FTSB3BKb2Ud7LFqocpPsJhN71VS7LFsocpPcHPK3suk2GPdQlUHBRJ0DeA9jZIH1+cnbAE/9c57jjxuHv2EMNwdtnfec+Th9+gnVAznjOE9Rx7Dj35CxAF+6p/3xuKFKj+52DTe00n3GPqu2AhJlcL63hbbuYa991GRT1nYve9d4J1r2HwfFVvWmmP3a9h9H1lgd7n+a7Q511CREBXDYXPsfsb4fNC1eZBFxJTX2sV5UPGVqp7UUHUeVITH4IMqv5nlHb1h0k59HvcM7WDYGEI+Oe55bQxhwAStYQhWQT2JIUyO3tAWhs7QNYaNIUKb4iFaQQ+NYwjWjT6JIeL3wkMamsvwYwgLaii9V6xydbb7GrzdMRirGGD3q9BEiAvx3rcm4ra2UuSwlqPG8ueOS4VxRe70djKclw1Z9oGQhwVE1V73gWDB4c4XfriyTDSwYmFuY8snBlIszNVRmH7xYmGOdplBTv4jdzQPRFlyG2y5sKJRXWe5MFdDxbvWcmHFigUNsqEj2bRENp6sEQ65YFjR4K60YJgny3VjwbDaa0hBh2NCwTDOPK0UDOPb/B+rIDZTrA9voaoYc3e6TEJTCgaA3redIiBwkzoDSvF4soR4tbXFfMcyzj2y0nhdtcWkUMyASkmeLENea3ExhGEhKwPajCzNXVl1MUR8cb2kCY1Gpb6pwpGq+lOq0GSMQc7u4wAyDCha5Cky0OoWInvLv3LmdmpZR6Pg4+G0zpPK+KmIlQ2AVTfdNEjyMgFXCm3unIJnI5YMiSkMwJIvq2iSP8wqUGVAYTXe5Z/Wf3mMb4r+i5EoDNWurIawAySmrkur+Rr5fWYh14DSajwkGR5yLQpK9tSeubB8dAtixX4LqvFym2NBtVap2DMN0BCE9QGNIaD7LTzld1SttSlAowYAfQmG/aFiuMgPvxjDiPq3IDjuGcOyQG1y8bQQLewwS4KQiqf5jkuCrNksk2ARMXTy9/JmVwncRres7bimmt9eQq2YiGJ4TTU+q36aWqhh1IKpiKnatULYqBs8qeuqav4Ze6mPVdVOt+mrrKrmt5fkWzfVv4eqasPlMwuESvX5DNle33XVfHlmY8h11fwmc32HV1fNV8wntEIthtdVGy65YNwUuWBeqbsnaqGWPCExvMpqRYsaK6vtfKqS6osAWCPYxSfyPodZgciMWnL1CZNahi2lomAbFanimzYNwu3quq4dRy3cVp88hNpxrdQ3HF63zogPRPqXIFpsG12v1ynIQm9vgSIHZBW/Lk5rqqZsLUBhPQfFNpeqdRd2W0ootTS2dKixDQ5gkTKHHF/jW2/lX1PThZb2VAtPb+hjRx8P7I5DITx0W71/6kGtN3qVDl8Rs5WTYIOX3fqq7OjxYz0XojBrmpmd19axviVxGs/jVXEXjMBU635eTRFAzxhVHJpyE3UhLWyJXYvxOgW1dHYwPcRE84z4o/nRjkKIM1Q5gJWTNuXjRuaJT1MSH4obEp6AWrcEJilq12mGRXM7j0zOk9abxhUBIbM3wqqMhrqwQhYMnYtgujNg6WxB2x6wkCMCyx4JSwSEVxdZ3q3tl/7A1sdQfG0dZufp9xfDDGwK5Hn99ovGyVC201DPiBzUc9fIP78vaLkg5hqh1ZTCaRPv1jtk13G9sb/OEqkmCTqEWq9BmPlAg9Xl9YFGjwLN7h5oWAE0WYI4ax4JV81QZW9OHtzJ3XSSTQqemkGaVeoSbMSftidJBK9pzJfGTWASaT65UM445adAe6psAPoSKgEbzruKZFJXAXyYedycgopUwnVbeJmOeDkPLwh5TleAYYdJnLnrwEdJsHn+Ei8yufDh/w== \ No newline at end of file diff --git a/docs/proposal/.assets/001-01.png b/docs/proposal/.assets/001-01.png new file mode 100644 index 00000000..35fc33a3 Binary files /dev/null and b/docs/proposal/.assets/001-01.png differ diff --git a/docs/proposal/.assets/001-02.drawio b/docs/proposal/.assets/001-02.drawio new file mode 100644 index 00000000..e87a4da3 --- /dev/null +++ b/docs/proposal/.assets/001-02.drawio @@ -0,0 +1 @@ +7Ztbc6M2FIB/jWbah2SQhAA/+rbdmaZNut6Zbh4xyDYNRh4ir+3++kpGYJDkeNPgS2s7mQQdXYDznSN0DjLA/fn6lzxczH5jMU0BcuI1wAOAEPRdV/yTkk0h6WAlmOZJrBrtBKPkb6qEjpIuk5i+NhpyxlKeLJrCiGUZjXhDFuY5WzWbTVjaPOsinFJDMIrC1JT+mcR8VkgD5O/kn2kynZVnhl6nqJmHZWN1J6+zMGarmggPAe7njPHiaL7u01Qqr9RL0e/TntrqwnKa8R/p8OUJr1d3vz4/Pj0PvqGHh8Fw9eWuo2h8D9OlumN1tXxTqiBnyyymchQH4N5qlnA6WoSRrF0J6EI24/NUlKA4fH2hPJqptpMkTUdqoHDJmRSxjCvK0FNN+ixluRBkLKNyCJ6zF6oJ1WXSnNP1XgXASq3CHimbU55vRJOyA1RolCkiR5FZ7cCSjpLNalCJr4ShMqZpNfZO3+JAqfw96ieG+hchE793Qr0f4lDTM3LKshqrwQlqEADCFMaE+gYJUdPxfBx6drItEMLEbRByPWgQgshCyD0aIM/0jyEBAQE9DIa+/NvrgaEHBMmeIw+CAegOZZteF3RwS84ELZ4jNZ2IiaqbJtNMCDlbaJyJKIeqNqUT3pIb4aYbkcCERIgFEjyeG/kGpdEfD4buxQy8kIfRJk0EhBwfJjAucD2MK0EYvUy3EB+XXAxT+ZMiQzRSwV5SJlx1pagNSKQJyUMWT8IWSJ2jMQoMRr+HPPne3jwHkaHIt+e5OKTBJLLNc14U0PFEm+deWSrvsBUfCjQ8pXZqeHwLHUSORadz8yDtWeSigx6ET+pBsFyv1CAJhWyW2flcaDKZoMjqQrE39oi+VGjRhbAPL8uFoAMNPF9pFsn7ucIpzi3XZJfDBxl8Pi/DFU3O6D5BRO3uMw6IS/QYqkU8BF4cHmzgud9+2sPjaXjwITxE/qhONXnxsXrV9rMHm/4UmydxnLYU3Far8MvhaUktiLCo+wn0OmAYgB4EXbiVDIC4WBlVIdANPkb7PxExIctS4sQRE3TMzMNjb3TNCz49ZEL+uUMm6JjZh1vMVPLB7tlnODPt8Dga/fQ4/ktmopEz4iyX6WVxtHnldP7zNbuXHk/Z3OvU8ZSZkjhLPKU7y/tjrDb4aPHUBbiXmZO4xVMXxAea6YhbPHVBeMx0xMnjqb0Rz3EDrTZ4BhfH00xfbF88OaDT376KckF3G2H1+vJtlKzCIBh+jPZFxlNEe5HrQstK3QYHHu09IYRm9mILpS8pVEHu/4+FHttaWXgnZmFmHkY0zIXukDPMpnKJfMULcaItxF0X3xOT2WmX4tBMR5wl0j2wFP+B5V8bhPwmITHfWQid+OljpiL6YTS7ak+CRPckdAGeZCYlrjlnpHtScH5PMrMOBhqaxV25eRFU+99qKJrc9I1eQjP55pusvCdl8Vn13BYGa9WzKG3K0jrhtW6i9Fyr2XWShbJPcd00NrZQanzEvbFlHtE31FLuhONhPqX8Lf0V7xVM5PVkum0Tn5LlNC3coX55NsrqDE8skQmHKgzX1juepw1R3KnqtbMVcyB9CwjUBio0YQy0Nbrqtj9ih2Z65WaH1Ya/g3ZYGOzNDD9qhsjMIrVqhsqcYN2YKtOym9POdOuGW7PjPabbohlW8eTNDk9lh2a67DjT4fts6t/Y71key0V66maHe+1QFHdf9iia774yg4f/AA== \ No newline at end of file diff --git a/docs/proposal/.assets/001-02.png b/docs/proposal/.assets/001-02.png new file mode 100644 index 00000000..488c0a4e Binary files /dev/null and b/docs/proposal/.assets/001-02.png differ diff --git a/docs/proposal/.assets/001-03.drawio b/docs/proposal/.assets/001-03.drawio new file mode 100644 index 00000000..a28d892b --- /dev/null +++ b/docs/proposal/.assets/001-03.drawio @@ -0,0 +1 @@ +7Vxdc5s4FP01zOw+JAMS4uPRjp3tzrZNd/LQ7dOObGSbDQYX48Tur18JJBAI2ySBGCdOOwm6ErK45+j66iDQ4M1y+0eMV4svkUcCDejeVoMjDQADIUD/MMsus7jQzAzz2Pd4o8Jw7/8i3Khz68b3yLrUMImiIPFXZeM0CkMyTUo2HMfRU7nZLArKn7rCc6IY7qc4UK3ffS9ZZFYH2IX9E/HnC/HJhuVmNUssGvMrWS+wFz1JJjjW4E0cRUl2tNzekIA5T/glO+92T20+sJiESZMTfv5aPPl/TR7n/66mzv1/Xx6/bu+uLD64Rxxs+BXz0SY74YI42oQeYb3oGhw+LfyE3K/wlNU+UdCpbZEsA1oy6GGAJyQY4unDPD3tJgqimFaFUUjbD9cPJJkueE/rJI4ecq+yk2dRmHAKGBYr+0FQ7SE9qWLk10DihGz3esfIfU7JSqIlSeIdbZIzlXuC89TkxacCdCRsCwlwSxAVc6LN864LLOgBh+M50BgKNN/iaLt7HT6Si4EuyrwvJCNkVPyvAegh4nimAgKtccAEWgIx0R3eJBE1MVh8OqEGgT8PqTmJ2JAwL00pPiRuB0Mg5h7HEECggAj1GhDtzjAECoYrHNH/VxSeznA0juBIDIqkXYeja9kQ78GxjUnmlgGCDlQAMkANQGZnAMELQBJAEPUOIFMB6Dr9+YDoIL136KDj6QMJvQFLxIqvawmHMmhk6yf/sONrxEs/pJrRVi7sRCGkF5KdBJAo/+Ddp4XivLQkTswGSjwl/6vAQS8m2sRT0iDMJziek+Tod7oKsJxl1OAnbDEJcOI/lgdcByr/hG+RTy+lmN1uOcdBeoUX2YXys+RUstKRaVaSJVTpKHOE0lHKsfyyX0E7q0+0Oxnr4IV1b8o6u0+ss09GO/NCuzelnaPQboQTPMFrmqHe3g3v6e97gmOaroDbGzxddJi4HlshzmbEmk7rUiPPdie6fvIVom6WSQHUDMqEhkpKt7MMylXQvf/7s4LgeoFX7HC6C3wKZQyP4zjJQP88yQ25KnO3SWg3ea7LFRcF3DYcDsopK3JUXcWqk1W68rdY6kv+TqeQFSTs8lc4LDne+rlh+txwmjF5wOLSfIJ/o73Qz9crf35PnaazGXM1w0s/2GWnLKMwWmdA5fWZ11mtvtpmdurm5IrTfpAOA8dJWiWGQY/m2V9U1VwRdQKzpoJiXhJOQalbqGXEjtkaATE3IOrLY22NvK3A/UXdgKKbzPd5Tcp3UZe5Pq/LeM+KBfNpSeY+q0zZz+wp/5nFSIvSHJCMyjwo6lJU0iLKytl8KBpIV5HNiyZ+yqtyFxUzBbG5UnhJ8qm+K+zIluzZ3MnrLKmKz6HaOjqXcvtc+vwqgGkxR1E2lrnF2ykkzKYSnZ3ZbBKMfScRDRp6zyKaqhPXZwFn63EX9MzjqqorEjB9HM7TiPJOfG8KdvXG96pgu0cPPFeXI9Q3l6sSrOLs56x7X6icFOtl0HzBrLW47uXrsOPrXlCP74nWvdUblC9e91YJ1vG6125ZW3417XrOOnhhXRusa1lafjXr7J7TzrzQrg3aqdryV5pIbhXuPUvKa13NcZySl4DIhCW03Rq0YWepiaqNfhq0sEumrHFKAqjeghehiDG98aKqQbZxj32vE40WnGhaPXOiyNIPfXGIJclmGQymCRMUc+37M9s39y1a+4kfMdV7EiVJtNwrjktujrKVyU2+AVJXvoXyrYesMA/wei0qFIi48N9WwIBlvd1SlzLwLZcyjqqVXECiX34lkOxTg6TKKxeQACqDVCMKvC1Iqg5zAamqVJ483DVQbj4cSKZeBunk4a6BzvHxQDLKIJ083DWQBT4cSMgs5+AnD3cNNmh9PJBQGaSThzt1yX4BCYmN1H0Jd6oisBck6tSHQxJovbuOq5QHNUVD7OZ7pYAIxIN83PGGaZe7aCogAhce7miPgDiIY7yTmq1Yg/X+AUO9/nP2jss+2J4eZCNoVc10n6GFnDV9oGMdRr2x/iyek+2YPqZV/zl7xwUPtu+IPs9Qac6aPgi2FH2sPVGhbfpYxvOiD3JOEX0a6Ee0G3+1JsdFbLxeZdnCzN8yUvUlYwCoGnn4Wr9EU01JGTp7XNltIAidvddNw+yZ15vszTl3ryOrynV0Yq9ftqZILyg4ukfA7dXWFOX5nRfvEag+UdTxHgG3ToM68txC5VEDw+LPGlQfKPDv2GNEg9CLI7Zpv9kWbsaidD1eCSPVB3eqS/Ol73msj2FM6NDwhN9Zh0OeftDO0VBDo0PRg7/vhZ+s5W9ZkYl8YO7ujTX6tY7cyq3l19FQNIlmszXphhgtP5h4rhs0G8cjcIlHbdCuTslrKR59J5P3HYXsI1HIMPXy2vAKtsK+q8oZHUalBhriR9hJ2Tgq9Won5dlGpVyb6SIs/cliSYjZIAbe0g/fd4xyj8UoB5h9z40MvYGYmD3ZU/NCurrdjMz9Hl4v0sjU0grXcN3r8h0gKO73yE+m172ArrNFriH2SfTcc+WvSbPm/uZb+62BEtYDv1UZB/TTe65GzRrbGv1mHDja2NIcRxvaii/78X5K9vYLxP7lZ0o1Vvqjqe8ZY2WpXfbTGsIlfI2am8ri6U4ZXhHTO4C3RjYbI8251ZwRO6ApiGtoY1MbDrUBTJHXNXGHrY+AN3khZsv73pVXKBonR7VGlhq7mgPTSWtrw5E2THEejDV3nMI71hw1R+oNqk3e79c6quVYnGffp0O1RlOiEZiOc6inoXjE8GSojjTXSacxYID3FtXZbAb2vJrImljoTVC11btFLaGq8ZdzSLlz8VoOOP4f \ No newline at end of file diff --git a/docs/proposal/.assets/001-03.png b/docs/proposal/.assets/001-03.png new file mode 100644 index 00000000..7626ab79 Binary files /dev/null and b/docs/proposal/.assets/001-03.png differ diff --git a/docs/proposal/.assets/06-01.drawio b/docs/proposal/.assets/006-01.drawio similarity index 100% rename from docs/proposal/.assets/06-01.drawio rename to docs/proposal/.assets/006-01.drawio diff --git a/docs/proposal/.assets/06-01.png b/docs/proposal/.assets/006-01.png similarity index 100% rename from docs/proposal/.assets/06-01.png rename to docs/proposal/.assets/006-01.png diff --git a/docs/proposal/001-关于paopao-ce的设计定位.md b/docs/proposal/001-关于paopao-ce的设计定位.md index 36b3789a..a1d084cb 100644 --- a/docs/proposal/001-关于paopao-ce的设计定位.md +++ b/docs/proposal/001-关于paopao-ce的设计定位.md @@ -1,11 +1,73 @@ | 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 | | ----- | ----- | ----- | ----- | ----- | ----- | -| 001| 北野 | 2022-11-04 | 2022-11-04 | v0.0 | 提议 | +| 001| 北野 | 2022-11-04 | 2022-12-19 | v1.0 | 提议 | -### 概述 +## 概述 +paopao-ce是一个清新文艺的微社区,提供类似Twiter/微博的推文分享服务。paopao-ce的运营形态有点类似WordPress,只不过WordPress是使用PHP语言开发的博客平台,提供的是博客服务,而paopao-ce提供的是类似Twitter的推文分享服务。paopao-ce 让 **个人或小组织** 可以快速、方便的部署一个提供**推文分享服务**的小站点,在有限范围内形成一个友善的社交小圈子微社区。 +![](.assets/001-01.png) -TODO - -### 更新记录 +## 从运维角度思考 + +| 实例部署 | 站点部署 | +| ----- | ----- | +| ![](.assets/001-02.png)| ![](.assets/001-03.png) | + +部署paopao-ce实例 数据存储需要使用 关系数据库、对象存储、搜索引擎、缓存;paopao-ce支持多实例部署,具体文档请参考[deploy](../deploy/)。 +#### 关系数据库 +* 本地(Native) - 部署 MySQL/PostgreSQL或者paopao-ce内嵌Sqlite3数据库 + MySQL/PostgreSQL 可以采用 一主多从+备、一主+备、多主+备 的模式部署,具体部署方式由运维者决定,paopao-ce本身不关心 关系数据库 的部署方式,仅仅使用标准的方式连接关系数据库使用其数据存储服务。 +* 云关系数据库 - 部署 云关系数据库 + 阿里云、腾讯云、华为云都提供云关系数据库服务,如何开启服务请参考相应文档进行部署。paopao-ce采用标准方式连接其相应的数据库使用数据存储服务。 + +#### 对象存储 +paopao-ce使用对象存储服务存储 图片/视频/附件 等推文资源。 + +* 本地(Native) - 部署OBS(Object Blob Storage System) + 目前开发环境可以使用`localoss`功能提供简单的OBS服务, 也可以自行部署[MinIO](https://github.com/minio/minio)来提供对象存储服务。 +* 云对象存储服务 + 阿里云、腾讯云、华为云都提供云对象存储服务,如何开启服务请参考相应文档进行部署。 + +#### 搜索引擎 +paopao-ce目前支持 使用[Zinc](https://github.com/zinclabs/zinc) /[Meilisearch](https://github.com/meilisearch/meilisearch) 提供推文搜索服务,搜索引擎实例的部署请参考相应官方文档。 + +#### 缓存 +paopao-ce目前支持Redis作为缓存存储引擎提供缓存服务,请参考Redis官方文档进行实例部署。 + +## 从代码实现角度思考 +paopao-ce在代码实现上采用 **单体架构模式、分层设计、功能模块化**,架构设计上可能略显保守,但是在使用新技术上却非常积极,比如搜索引擎就采用了近来新星[Zinc](https://github.com/zinclabs/zinc) /[Meilisearch](https://github.com/meilisearch/meilisearch),同时也不排斥各种云端服务,包括阿里云、腾讯云、华为云的对象存储服务、关系数据库服务等。paopao-ce始终秉持着 **包容并蓄、能用就上、去繁就简** 的架构思维,努力打造一个能 **稳定运行、代码清晰、功能可扩展** 的开源项目。 +![](.assets/006-01.png) + +## 从人文角度思考 +现在的互联网世界已经非常精彩,各种社交媒体平台琳琅满目,使用体验也非常友好。每个社交平台都有自己的运营方式,都有自己的核心用户群体,也有自己的产品灵魂,都在不断的进行生态演进。比如Twitter、微博都已经从最初的推文分享服务演进到一个成熟的传媒平台,注册用户非常庞大,日均访问PV也是一个惊人的数字,这就注定了平台的运营思维是多维度考量均衡的结果,只能做到让用户群体的大多数人用户体验友好,并不能满足所有人的需求。大平台有大平台的运营模式,小站点有小站点的维系空间。对于类似Twitter这样的推文分享服务,paopao-ce提供一种小站点部署模式,采用类似WordPress的运维模式,让 **个人/小组织** 能快速、便捷的拥有一个提供推文分享服务的小站点,以填补那些在大平台下难以享受到的用户体验,享受小圈子内的自由空间。 + +就像许巍唱的「曾经的你」这首歌中所说:"曾梦想仗剑走天涯~ 看一看世界的繁华~ 年少的心总有些轻狂~ 如今你四海为家~ ......" 曾经的你我也在 疯狂刷朋友圈、狂奔微博空间、畅游Twitter世界,但是随着环境的改变、岁月的洗礼、心路的淬炼后,你我可能已经不复当年的热情,逐渐淡出朋友圈、沦为微博的稀客,或许Twitter世界还有点吸引力,但是总感觉表达的欲望不复从前了。是什么原因变成这样的呢,原因可能很多,也各自有自己的不同情形所至于此。但是总归一条,那就是 **自由**; 如果有那么一个有限空间内,可以自由的 *谈天说地、品头论足、唠唠叨叨亦或自言自语*,你我是否又能燃起表达的激情呢?!从这个角度来说,paopao-ce就很契合这种需求,曾经你我想拥有一个自己的博客小站点而使用WordPress,那么今天想拥有一个自己的类似Twitter的推文分享服务小站点,部署paopao-ce或许也是一个不错的选择。 + +一个产品应该有一个**属于自己的灵魂**,可以说 paopao-ce的宗旨就是 **打造一个清新文艺的微社区**。 + +## 疑问 + +1. paopao-ce主要针对哪些站点运营者? +其实paopao-ce的运营形态有点类似WordPress,只不过WordPress是使用PHP语言开发的博客平台,提供的是博客服务,而paopao-ce提供的是类似Twitter的推文分享服务。paopao-ce 让 **个人或小组织** 可以快速、方便的部署一个提供**推文分享服务**的小站点,有限范围内形成一个友善的社交小圈子微社区。 +1. paopao-ce是一个清新文艺的微社区,微社区的 `微` 是如何界定的? + * 首先从站点用户流量层面,paopao-ce的部署一般针对的是小站点,注册用户不是很多,用户流量(QPS)也不会很高,这种情形本身很契合paopao-ce对自身微社区的服务定位; + * 从代码实现层面思考,在数据存储层面的架构设计中已经假定paopao-ce提供服务的QPS不会很高,因此不会考虑类似数据库 **分库分表** 这样的设计优化来应对数据库CRUD的流量冲击,对站点推文数据的总容量也假定是单个SQL数据库提供满足查询需求的数据容量极限。 +1. paopao-ce在代码实现上为什么采用单体架构模式? +一个项目的架构设计是多方面考量均衡的结果,最终的目的是满足项目的需求与长远发展。 + * 从架构模式的角度来说,单体架构模式可以满足paopao-ce对自身服务定位的需求,完全有能力承载预期的用户流量QPS,所以采用单体模式架构设计是没有问题的; + * 从运营者的角度来说,在能保障服务质量的前提下,最看重的还是运营成本的考量。提供一项保质保量的服务,可持续性是评价一项服务的重要指标。单体架构模式的项目部署简单,成本相对于分布式架构模式的项目也更低,假设门槛也没有那么高。黑猫白猫,能抓老鼠就是好猫, 在什么阶段就用什么技术,根据部署运营场景选择适合的技术来支撑服务,才是运营者明智的选择。 + * 现在不管是单体架构模式亦或是云原生的分布式架构模式,相应的技术栈生态都已经非常成熟,技术本身没有优劣之分,需要根据具体环境来适配合适的技术,这样才能在你保证服务质量的同时保证服务的可持续性与经济性。说白了就是paopao-ce目前采用单体架构模式的设计,满足优质服务的同时性价比最高。 +1. 如果一个paopao-ce部署站点运营一段时间后QPS逐渐提高到一定程度,目前架构的paopao-ce无法满足进一步的用户流量冲击,是否会采用分布式技术栈进行优化? +不会。paopao-ce将保守的采用目前的单体架构模式提供极致的QPS用户体验,如果确实需要超高QPS需求的实例部署,将另起炉灶开发另一款相应的产品,或许会采用云原生的分布式技术栈生态进行架构设计,这将是另一个paopao产品的故事序章了(前提是paopao能火出圈)。 + +## 更新记录 #### v0.0(2022-11-04) - 北野 -* 初始文档,先占个位置 \ No newline at end of file +* 初始文档,先占个位置 + +#### v0.1(2022-12-17) - 北野 +* 添加部署结构示意图 + +#### v0.2(2022-12-18) - 北野 +* 添加部分内容 + +#### v1.0(2022-12-19) - 北野 +* 补充部分内容 diff --git a/docs/proposal/002-关于Friendship功能项的设计.md b/docs/proposal/002-关于Friendship功能项的设计.md index 37a2ed80..bdc3e69b 100644 --- a/docs/proposal/002-关于Friendship功能项的设计.md +++ b/docs/proposal/002-关于Friendship功能项的设计.md @@ -39,24 +39,19 @@ Friendship功能提供好友间分享推文信息的机制,更好的帮助用 ### 疑问 1. 什么是弱关系好友体系? - -**弱关系好友** 在Friendship中的表现就是 **你只能通过对方发表的推文去判断这个人的思想三观是否符合你的脾胃进而让你决定是否要与对方建立好友关系;这种好友关系前期是非常薄弱,只能通过相互间的推文产生灵魂共鸣,进而互为兴趣、互为好友。** 有别于弱关系,微信的生态就天然建立在强关系之上,微信好友大部分都是自己熟人、朋友甚至亲人,因此微信的朋友圈就是强关系好友体系下的小圈子社交,有时谨言慎行就非常必要,导致有很多人随着年龄成长到某个阶段,对微信朋友圈非常不感冒,很少甚至没有发朋友圈的欲望了,究其原因有一部分可能是圈内好友太熟了甚至有点“严肃”。需要注意的是,有些人的表达欲望并没有因为微信朋友圈这种 **强关系好友** *圈内社交环境* 而降低,仅仅只是被压抑住了,那么一个**弱关系好友**体系或许可以打开这部分人的表达欲望,使得他们可以在有限可控圈子内尽情表达、享受言论的自由。 - -2. 如何形成这种好友体系? - -形成好友体系分 **建立、维持、解除** 好友关系。Friendship提供 *建立/解除* 好友关系的机制,泡泡广场的推文列表依据这个好友体系为每个用户生成个性化推文列表。而好友关系的**维持**,本质上就是用户推文的持久更新、思想的持续演化,使得好友对你一直保持兴趣;Friendship也为每一条推文的访问权限进行**标记(私密/好友可见)**,这可以传达这样一种信息: **“时刻让好友知道我非常在乎好友、对好友特殊关照,你看这条推文就是只有我的好友(也就是你)才可以看到,够意思吧”!** 顺便一说,每一条推文的访问权限标记(公开/私密/好友可见)是建立Friendship弱关系体系的隐性催化剂,可以加速Friendship的形成。 - -3. 如何开启这个功能? - +**弱关系好友** 在Friendship中的表现就是 **你只能通过对方发表的推文去判断这个人的思想三观是否符合你的脾胃进而让你决定是否要与对方建立好友关系;这种好友关系前期是非常薄弱,只能通过相互间的推文产生灵魂共鸣,进而互为兴趣、互为好友。** 有别于弱关系,微信的生态就天然建立在强关系之上,微信好友大部分都是自己熟人、朋友甚至亲人,因此微信的朋友圈就是强关系好友体系下的小圈子社交,有时谨言慎行就非常必要,导致有很多人随着年龄成长到某个阶段,对微信朋友圈非常不感冒,很少甚至没有发朋友圈的欲望了,究其原因有一部分可能是圈内好友太熟了甚至有点“严肃”。需要注意的是,有些人的表达欲望并没有因为微信朋友圈这种 **强关系好友** *圈内社交环境* 而降低,仅仅只是被压抑住了,那么一个**弱关系好友**体系或许可以打开这部分人的表达欲望,使得他们可以在有限可控圈子内尽情表达、享受言论的自由。 +2. 如何形成这种好友体系? +形成好友体系分 **建立、维持、解除** 好友关系。Friendship提供 *建立/解除* 好友关系的机制,泡泡广场的推文列表依据这个好友体系为每个用户生成个性化推文列表。而好友关系的**维持**,本质上就是用户推文的持久更新、思想的持续演化,使得好友对你一直保持兴趣;Friendship也为每一条推文的访问权限进行**标记(私密/好友可见)**,这可以传达这样一种信息: **“时刻让好友知道我非常在乎好友、对好友特殊关照,你看这条推文就是只有我的好友(也就是你)才可以看到,够意思吧”!** 顺便一说,每一条推文的访问权限标记(公开/私密/好友可见)是建立Friendship弱关系体系的隐性催化剂,可以加速Friendship的形成。 +3. 如何开启这个功能? 在配置文件config.yaml中的`Features`中添加`Friendship`功能项开启该功能: -```yaml -... -# features中加上 Friendship -Features: - Default: ["Meili", "LoggerMeili", "Base", "Sqlite3", "BigCacheIndex", "MinIO", "Friendship"] - Base: ["Redis", "PhoneBind"] -... -``` + ```yaml + ... + # features中加上 Friendship + Features: + Default: ["Meili", "LoggerMeili", "Base", "Sqlite3", "BigCacheIndex", "MinIO", "Friendship"] + Base: ["Redis", "PhoneBind"] + ... + ``` ### 更新记录 #### v0.1(2022-11-04) - 北野 diff --git a/docs/proposal/005-引入go-mir优化后端架构设计.md b/docs/proposal/005-引入go-mir优化后端架构设计.md new file mode 100644 index 00000000..24643b8c --- /dev/null +++ b/docs/proposal/005-引入go-mir优化后端架构设计.md @@ -0,0 +1,37 @@ +| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 | +| ----- | ----- | ----- | ----- | ----- | ----- | +| 005| 北野 | 2022-11-21 | 2022-12-10 | v1.0 | 提议 | + +### 引入go-mir优化后端架构设计 + 引入[github.com/alimy/mir/v3](https://github.com/alimy/mir)优化后端的架构设计,使得后端代码更具扩展型。 +![](.assets/06-01.png) + +### 需求 +* 更方便添加后端功能项的实现; +* 优化代码结构,模块化、清晰化代码布局,使得更具扩展性; +* 兼容RESTful/gRPC 服务代码,RESTful API是服务于Web/Admin,gRPC API是提供给移动端(iOS/Android)的服务; + +### 方案 + +依赖库: +* [go-mir](https://github.com/alimy/mir) + +### 疑问 + +1. 为什么引入go-mir? + * [go-mir](https://github.com/alimy/mir)是一套提供类似gRPC服务开发体验的快速开发RESTful API后端开发脚手架,巧妙的借用golang语法作为DSL描述RESTful API,通过代码生成的方式自动生成相对应的API接口、HTTP服务器框架初始化代码等,提供类似gRPC的开发体验,对后端开发者非常友好; + * 引入go-mir的另一个主要目的是加速后端服务的开发,更好的保证代码风格的一致性; + * 践行 [006-关于paopao-ce的结构设计](006-关于paopao-ce的结构设计.md); +1. 为什么要兼容RESTful/gRPC服务? + * RESTful API是提供给Web端使用的,包括paopao-ce web端以及后期的运维端admin; gRPC API是提供给移动端(iOS/Android)使用的服务; + * RESTful API天然对web端浏览器友好,而gRPC生态对后端、移动端天然友好,可以根据google-protocol-buffers DSL定义服务API自动生成服务端、客户端代码,非常利于开发,特别是移动端开发,省去了编写客户端网络数据服务相关的业务逻辑,只需要专注于页面逻辑编写,后端数据获取的网络数据访问逻辑直接调用自动生成的gRPC API客户端代码即可,大大的减轻移动端开发的心智负担; + * 后端引入gRPC主要就是考虑到移动端(iOS/Android)开发的开发效率,在减轻移动端开发网络数据获取业务逻辑的心智负担上,gRPC生态与RESTful生态相比优势明显,因此强力引入; + * 再一个就是[go-mir](https://github.com/alimy/mir) v3为RESTful服务的开发提供类似gRPC服务的开发体验,也为后端兼容RESTful/gRPC服务创造了很好的条件,只要代码结构组织清晰,将会有很好的后端开发体验; + >*目前移动端 iOS/Android APP还在规划中,这里后续的后端gRPC API服务也是为此做准备,敬请期待~* + +### 更新记录 +#### v0.0(2022-11-21) - 北野 +* 初始文档 + +#### v1.0(2022-12-10) - 北野 +* 添加内容 diff --git a/docs/proposal/006-关于paopao-ce的结构设计.md b/docs/proposal/006-关于paopao-ce的结构设计.md index d60999a5..705a2d21 100644 --- a/docs/proposal/006-关于paopao-ce的结构设计.md +++ b/docs/proposal/006-关于paopao-ce的结构设计.md @@ -1,17 +1,19 @@ | 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 | | ----- | ----- | ----- | ----- | ----- | ----- | -| 006| 北野 | 2022-11-23 | 2022-11-23 | v0.0 | 提议 | +| 006| 北野 | 2022-11-23 | 2022-12-23 | v0.1 | 提议 | ### 关于paopao-ce的结构设计 -![](.assets/06-01.png) +![](.assets/006-01.png) ### 疑问 -1. 为什么要引入[go-mir](https://github.com/alimy/mir)? -TODO; -1. 为什么要兼容RESTful服务与gRPC服务? -TODO; +1. 为什么要引入[go-mir](https://github.com/alimy/mir)? +工欲善其事,必先利其器。为了RESTFul API的后端开发体验可以媲美gRPC,本人特意打造[go-mir](https://github.com/alimy/mir) v3版本来满足需求。[go-mir](https://github.com/alimy/mir)是一套使用golang自身语言生态实现的RESTFul API从接口定义到代码自动生成的脚手架辅助工具集,便捷的实现快速后端开发体验,颇有“程咬金的三板斧,简单抡着就完事”的韵味。而从[go-mir](https://github.com/alimy/mir)的官方文档参考也可以看出,其生成的代码也确实就将一个HTTP的请求/响应简单分成 `请求绑定`->`业务逻辑`->`结果渲染`三个步骤去完成,生成的代码结构简单清晰,与gRPC的生成代码有点类似。 +1. 为什么要兼容RESTful服务与gRPC服务? +RESTful服务与gRPC服务各自有擅长的场景,在合适的场景使用最适合的技术去做相应的适配,这是paopao-ce秉持的代码开发原则之一。 ### 更新记录 -#### v0.0(2022-11-23) - 北野 -* 初始文档, 先占个位置 \ No newline at end of file +#### v0.0(2022-11-23) - 北野 +* 初始文档, 先占个位置 +#### v0.1(2022-12-23) - 北野 +* 添加部分内容 \ No newline at end of file diff --git a/docs/proposal/README.md b/docs/proposal/README.md index b1812170..12f8096e 100644 --- a/docs/proposal/README.md +++ b/docs/proposal/README.md @@ -2,4 +2,5 @@ * [001-关于paopao-ce的设计定位](001-关于paopao-ce的设计定位.md "关于paopao-ce的设计定位") * [002-关于Friendship功能项的设计](002-关于Friendship功能项的设计.md "关于Friendship功能项的设计") * [003-关于Followship功能项的设计](003-关于Followship功能项的设计.md "关于Followship功能项的设计") -* [006-关于paopao-ce的结构设计](006-关于paopao-ce的结构设计.md "关于paopao-ce的结构设计") \ No newline at end of file +* [005-引入go-mir优化后端架构设计](005-引入go-mir优化后端架构设计.md "引入go-mir优化后端架构设计") +* [006-关于paopao-ce的结构设计](006-关于paopao-ce的结构设计.md "关于paopao-ce的结构设计") diff --git a/features-status.md b/features-status.md index 082c2f6b..bfc6f80c 100644 --- a/features-status.md +++ b/features-status.md @@ -11,8 +11,8 @@ * `Web` 开启Web服务(目前状态: WIP) * [ ] 提按文档 * [x] 服务初始化逻辑 - * [ ] 接口定义 - * [ ] 业务逻辑实现 + * [x] 接口定义 + * [x] 业务逻辑实现 * `Admin` 开启Admin后台运维服务(目前状态: WIP) * [ ] 提按文档 * [x] 服务初始化逻辑 @@ -33,7 +33,16 @@ * [ ] 服务初始化逻辑 * [ ] 接口定义 * [ ] 业务逻辑实现 -* `Deprecated:OldWeb` Deprecated(关闭)旧的Web服务(目前状态: WIP) +* `Docs` 开启NativeOBS服务(目前状态: WIP) + * [ ] 提按文档 + * [x] 服务初始化逻辑 +* `Frontend:Web` 开启独立前端服务(目前状态: 内测) + * [ ] 提按文档 + * [x] 服务初始化逻辑 +* `Frontend:EmbedWeb` 开启内嵌于后端Web API服务中的前端服务(目前状态: 内测) + * [ ] 提按文档 + * [x] 服务初始化逻辑 +* `Deprecated:OldWeb` 开启旧的Web服务(目前状态: 内测) * [ ] 提按文档 * [x] 服务初始化逻辑 diff --git a/go.mod b/go.mod index 0215af0f..7bd04004 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,8 @@ go 1.18 require ( github.com/Masterminds/semver/v3 v3.1.1 github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868 - github.com/alimy/cfg v0.1.0 + github.com/alimy/cfg v0.3.0 + github.com/alimy/mir/v3 v3.0.0-beta.4 github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible github.com/allegro/bigcache/v3 v3.0.2 github.com/bytedance/sonic v1.5.0 @@ -24,13 +25,14 @@ require ( github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.12+incompatible github.com/json-iterator/go v1.1.12 github.com/meilisearch/meilisearch-go v0.21.0 - github.com/minio/minio-go/v7 v7.0.27 - github.com/sirupsen/logrus v1.8.1 + github.com/minio/minio-go/v7 v7.0.45 + github.com/sirupsen/logrus v1.9.0 github.com/smartwalle/alipay/v3 v3.1.7 - github.com/spf13/viper v1.10.1 + github.com/spf13/viper v1.14.0 github.com/tencentyun/cos-go-sdk-v5 v0.7.35 github.com/yinheli/mahonia v0.0.0-20131226213531-0eef680515cc - google.golang.org/protobuf v1.28.0 + google.golang.org/grpc v1.50.1 + google.golang.org/protobuf v1.28.1 gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/resty.v1 v1.12.0 gorm.io/driver/mysql v1.3.4 @@ -51,7 +53,7 @@ require ( github.com/clbanning/mxj v1.8.4 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustin/go-humanize v1.0.0 // indirect - github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect @@ -59,7 +61,6 @@ require ( github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.7 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -77,51 +78,50 @@ require ( github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/klauspost/compress v1.15.6 // indirect - github.com/klauspost/cpuid v1.3.1 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/klauspost/compress v1.15.9 // indirect + github.com/klauspost/cpuid/v2 v2.1.0 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/lib/pq v1.10.2 // indirect - github.com/magiconair/properties v1.8.5 // indirect + github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-sqlite3 v1.14.12 // indirect - github.com/minio/md5-simd v1.1.0 // indirect - github.com/minio/sha256-simd v0.1.1 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/minio/md5-simd v1.1.2 // indirect + github.com/minio/sha256-simd v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mozillazg/go-httpheader v0.3.1 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect - github.com/pelletier/go-toml/v2 v2.0.1 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect - github.com/rs/xid v1.2.1 // indirect + github.com/rs/xid v1.4.0 // indirect github.com/smartwalle/crypto4go v1.0.2 // indirect - github.com/spf13/afero v1.6.0 // indirect - github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/afero v1.9.2 // indirect + github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/subosito/gotenv v1.4.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.37.1-0.20220607072126-8a320890c08d // indirect - go.uber.org/atomic v1.7.0 // indirect + go.uber.org/atomic v1.9.0 // indirect golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect - golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect + golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect - golang.org/x/mod v0.5.0 // indirect - golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect - golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect - golang.org/x/tools v0.1.5 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - gopkg.in/ini.v1 v1.66.2 // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect + golang.org/x/sys v0.0.0-20220908164124-27713097b956 // indirect + golang.org/x/text v0.4.0 // indirect + golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect + golang.org/x/tools v0.1.12 // indirect + google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/uint128 v1.1.1 // indirect modernc.org/cc/v3 v3.36.0 // indirect modernc.org/ccgo/v3 v3.16.6 // indirect diff --git a/go.sum b/go.sum index 7262bc9a..bb2a4603 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,7 @@ cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSR cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -19,6 +20,7 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -51,6 +53,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= @@ -142,8 +145,10 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= -github.com/alimy/cfg v0.1.0 h1:J7KDLEoVIjEBMGlQJb2ljad/d49gJ4Tsl2ogZ9XNhaY= -github.com/alimy/cfg v0.1.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c= +github.com/alimy/cfg v0.3.0 h1:9xgA0QWVCPSq9fFNRcYahVCAX22IL9ts2wrTQPfAStY= +github.com/alimy/cfg v0.3.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c= +github.com/alimy/mir/v3 v3.0.0-beta.4 h1:4++lea7OWmykHRVbF1nCnKOJXCvBifmnhe47e91aV6c= +github.com/alimy/mir/v3 v3.0.0-beta.4/go.mod h1:ybhT2ijOiDn0lLwWzIY6vXdv+uzZrctS7VFfczcXBWU= github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible h1:9gWa46nstkJ9miBReJcN8Gq34cBFbzSpQZVVT9N09TM= github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= @@ -500,10 +505,11 @@ github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoD github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= @@ -700,8 +706,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= github.com/google/go-github/v39 v39.2.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= @@ -724,6 +729,7 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -744,6 +750,7 @@ github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0 github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -948,14 +955,15 @@ github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.6 h1:6D9PcO8QWu0JyaQ2zUMmu16T1T+zjjEpP91guRsvDfY= github.com/klauspost/compress v1.15.6/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s= -github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.1.0 h1:eyi1Ad2aNJMW95zcSbmGg7Cg6cq3ADwLpMAP96d8rF0= +github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -994,8 +1002,8 @@ github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -1050,16 +1058,15 @@ github.com/meilisearch/meilisearch-go v0.21.0 h1:SwYMWJVi6vDdSDJdOmbkJ4T26PavjYc github.com/meilisearch/meilisearch-go v0.21.0/go.mod h1:3dvPYZGUWu40qHoTK187fmqF2lrarboPa5m2Yu2Seh4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4= -github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw= -github.com/minio/minio-go/v7 v7.0.27 h1:yJCvm78B+2+ll1PqO9eSD1as6Ibw3IYnnD8PyBEB2zo= -github.com/minio/minio-go/v7 v7.0.27/go.mod h1:x81+AX5gHSfCSqw7jxRKHvxUXMlE5uKX0Vb75Xk5yYg= -github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= -github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= +github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= +github.com/minio/minio-go/v7 v7.0.45 h1:g4IeM9M9pW/Lo8AGGNOjBZYlvmtlE1N5TQEYWXRWzIs= +github.com/minio/minio-go/v7 v7.0.45/go.mod h1:nCrRzjoSUQh8hgKKtu3Y708OLvRLtuASMg2/nvmbarw= +github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= @@ -1183,10 +1190,10 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= -github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= +github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= @@ -1204,6 +1211,7 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -1256,8 +1264,9 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/xid v1.4.0 h1:qd7wPTDkN6KQx2VmMBLrpHkiyQwgFXRnkOLacUiaSNY= +github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1289,8 +1298,9 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartwalle/alipay/v3 v3.1.7 h1:J4U5slABafKVD/b9gPCZe/3HAPB8Pa2NOYOPcugEJBo= github.com/smartwalle/alipay/v3 v3.1.7/go.mod h1:cZUMCCnsux9YAxA0/f3PWUR+7wckWtE1BqxbVRtGij0= github.com/smartwalle/crypto4go v1.0.2 h1:9DUEOOsPhmp00438L4oBdcL8EZG1zumecft5bWj5phI= @@ -1305,11 +1315,12 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= +github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= @@ -1325,8 +1336,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= -github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= +github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= +github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= @@ -1344,10 +1355,11 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= +github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1466,8 +1478,9 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -1511,14 +1524,16 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 h1:syTAU9FwmvzEoIYMqcPHOcVm4H3U5u90WsvuYgwpETU= -golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1568,8 +1583,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1641,8 +1657,9 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1762,6 +1779,7 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1800,8 +1818,11 @@ golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf h1:Fm4IcnUL803i92qDlmB0obyHmosDrxZWxJL3gIeNqOw= golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956 h1:XeJjHH1KiLpKGb6lvMiksZ9l0fVUh+AmGcm0nOMEBOY= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1815,8 +1836,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1826,8 +1848,9 @@ golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 h1:M73Iuj3xbbb9Uk1DYhzydthsj6oOd6l9bpuFcNoUvTs= golang.org/x/time v0.0.0-20220224211638-0e9765cccd65/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220609170525-579cf78fd858 h1:Dpdu/EMxGMFgq0CeYMh4fazTD2vtlZRYE7wyynxJb9U= +golang.org/x/time v0.0.0-20220609170525-579cf78fd858/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1902,19 +1925,20 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= @@ -2010,7 +2034,9 @@ google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -2038,8 +2064,9 @@ google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 h1:ErU+UA6wxadoU8nWrsy5MZUVBs75K17zUCsUCIfrXCE= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e h1:S9GbmC1iCgvbLyAokVCwiO6tVIrU9Y7c5oMx1V/ki/Y= +google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -2072,8 +2099,9 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2088,8 +2116,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -2108,8 +2136,8 @@ gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWd gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= -gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= diff --git a/internal/conf/conf.go b/internal/conf/conf.go index 3ede82d6..950d2d8a 100644 --- a/internal/conf/conf.go +++ b/internal/conf/conf.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package conf import ( @@ -19,7 +23,15 @@ var ( MysqlSetting *MySQLSettingS PostgresSetting *PostgresSettingS Sqlite3Setting *Sqlite3SettingS - ServerSetting *ServerSettingS + ServerSetting *HttpServerSettingS + WebServerSetting *HttpServerSettingS + AdminServerSetting *HttpServerSettingS + SpaceXServerSetting *HttpServerSettingS + BotServerSetting *HttpServerSettingS + LocalossServerSetting *HttpServerSettingS + FrontendWebSetting *HttpServerSettingS + DocsServerSetting *HttpServerSettingS + MobileServerSetting *GRPCServerSettingS AppSetting *AppSettingS CacheIndexSetting *CacheIndexSettingS SimpleCacheIndexSetting *SimpleCacheIndexSettingS @@ -54,41 +66,47 @@ func setupSetting(suite []string, noDefault bool) error { } objects := map[string]any{ - "App": &AppSetting, - "Server": &ServerSetting, - "CacheIndex": &CacheIndexSetting, - "SimpleCacheIndex": &SimpleCacheIndexSetting, - "BigCacheIndex": &BigCacheIndexSetting, - "Alipay": &AlipaySetting, - "SmsJuhe": &SmsJuheSetting, - "Logger": &loggerSetting, - "LoggerFile": &loggerFileSetting, - "LoggerZinc": &loggerZincSetting, - "LoggerMeili": &loggerMeiliSetting, - "Database": &DatabaseSetting, - "MySQL": &MysqlSetting, - "Postgres": &PostgresSetting, - "Sqlite3": &Sqlite3Setting, - "TweetSearch": &TweetSearchSetting, - "Zinc": &ZincSetting, - "Meili": &MeiliSetting, - "Redis": &redisSetting, - "JWT": &JWTSetting, - "ObjectStorage": &ObjectStorage, - "AliOSS": &AliOSSSetting, - "COS": &COSSetting, - "HuaweiOBS": &HuaweiOBSSetting, - "MinIO": &MinIOSetting, - "LocalOSS": &LocalOSSSetting, - "S3": &S3Setting, + "App": &AppSetting, + "Server": &ServerSetting, + "WebServer": &WebServerSetting, + "AdminServer": &AdminServerSetting, + "SpaceXServer": &SpaceXServerSetting, + "BotServer": &BotServerSetting, + "LocalossServer": &LocalossServerSetting, + "FrontendWebServer": &FrontendWebSetting, + "DocsServer": &DocsServerSetting, + "MobileServer": &MobileServerSetting, + "CacheIndex": &CacheIndexSetting, + "SimpleCacheIndex": &SimpleCacheIndexSetting, + "BigCacheIndex": &BigCacheIndexSetting, + "Alipay": &AlipaySetting, + "SmsJuhe": &SmsJuheSetting, + "Logger": &loggerSetting, + "LoggerFile": &loggerFileSetting, + "LoggerZinc": &loggerZincSetting, + "LoggerMeili": &loggerMeiliSetting, + "Database": &DatabaseSetting, + "MySQL": &MysqlSetting, + "Postgres": &PostgresSetting, + "Sqlite3": &Sqlite3Setting, + "TweetSearch": &TweetSearchSetting, + "Zinc": &ZincSetting, + "Meili": &MeiliSetting, + "Redis": &redisSetting, + "JWT": &JWTSetting, + "ObjectStorage": &ObjectStorage, + "AliOSS": &AliOSSSetting, + "COS": &COSSetting, + "HuaweiOBS": &HuaweiOBSSetting, + "MinIO": &MinIOSetting, + "LocalOSS": &LocalOSSSetting, + "S3": &S3Setting, } if err = setting.Unmarshal(objects); err != nil { return err } JWTSetting.Expire *= time.Second - ServerSetting.ReadTimeout *= time.Second - ServerSetting.WriteTimeout *= time.Second SimpleCacheIndexSetting.CheckTickDuration *= time.Second SimpleCacheIndexSetting.ExpireTickDuration *= time.Second BigCacheIndexSetting.ExpireInSecond *= time.Second @@ -134,3 +152,10 @@ func GetOssDomain() string { } return uri + AliOSSSetting.Domain + "/" } + +func RunMode() string { + if !cfg.If("Deprecated:OldWeb") { + return ServerSetting.RunMode + } + return AppSetting.RunMode +} diff --git a/internal/conf/config.yaml b/internal/conf/config.yaml new file mode 100644 index 00000000..c86d168a --- /dev/null +++ b/internal/conf/config.yaml @@ -0,0 +1,178 @@ +App: # APP基础设置项 + RunMode: debug + AttachmentIncomeRate: 0.8 + MaxCommentCount: 10 + DefaultContextTimeout: 60 + DefaultPageSize: 10 + MaxPageSize: 100 +Server: # 服务设置 + RunMode: debug + HttpIp: 0.0.0.0 + HttpPort: 8008 + ReadTimeout: 60 + WriteTimeout: 60 +Features: + Default: [] +WebServer: # Web服务 + HttpIp: 0.0.0.0 + HttpPort: 8010 + ReadTimeout: 60 + WriteTimeout: 60 +AdminServer: # Admin后台运维服务 + HttpIp: 0.0.0.0 + HttpPort: 8014 + ReadTimeout: 60 + WriteTimeout: 60 +SpaceXServer: # SpaceX服务 + HttpIp: 0.0.0.0 + HttpPort: 8012 + ReadTimeout: 60 + WriteTimeout: 60 +BotServer: # Bot服务 + HttpIp: 0.0.0.0 + HttpPort: 8016 + ReadTimeout: 60 + WriteTimeout: 60 +LocalossServer: # Localoss服务 + HttpIp: 0.0.0.0 + HttpPort: 8018 + ReadTimeout: 60 + WriteTimeout: 60 +FrontendWebServer: # Web前端静态资源服务 + HttpIp: 0.0.0.0 + HttpPort: 8006 + ReadTimeout: 60 + WriteTimeout: 60 +DocsServer: # 开发文档服务 + HttpIp: 0.0.0.0 + HttpPort: 8011 + ReadTimeout: 60 + WriteTimeout: 60 +MobileServer: # 移动端grpc api服务 + Host: 0.0.0.0 + Port: 8020 +SmsJuhe: + Gateway: https://v.juhe.cn/sms/send + Key: + TplID: + TplVal: "#code#=%s&#m#=%d" +Alipay: + AppID: + InProduction: True + RootCertFile: "custom/alipay/RootCert.crt" + PublicCertFile: "custom/alipay/CertPublicKey_RSA2.crt" + AppPublicCertFile: "custom/alipay/AppCertPublicKey.crt" +CacheIndex: + MaxUpdateQPS: 100 # 最大添加/删除/更新Post的QPS, 设置范围[10, 10000], 默认100 +SimpleCacheIndex: # 缓存泡泡广场消息流 + MaxIndexSize: 200 # 最大缓存条数 + CheckTickDuration: 60 # 循环自检查每多少秒一次 + ExpireTickDuration: 300 # 每多少秒后强制过期缓存, 设置为0禁止强制使缓存过期 +BigCacheIndex: # 使用BigCache缓存泡泡广场消息流 + MaxIndexPage: 1024 # 最大缓存页数,必须是2^n, 代表最大同时缓存多少页数据 + Verbose: False # 是否打印cache操作的log + ExpireInSecond: 300 # 多少秒(>0)后强制过期缓存 +Logger: # 日志通用配置 + Level: debug # 日志级别 panic|fatal|error|warn|info|debug|trace +LoggerFile: # 使用File写日志 + SavePath: data/paopao-ce/logs + FileName: app + FileExt: .log +LoggerZinc: # 使用Zinc写日志 + Host: zinc:4080 + Index: paopao-log + User: admin + Password: admin + Secure: False +LoggerMeili: # 使用Meili写日志 + Host: meili:7700 + Index: paopao-log + ApiKey: paopao-meilisearch + Secure: False + MinWorker: 5 # 最小后台工作者, 设置范围[5, 100], 默认5 + MaxLogBuffer: 100 # 最大log缓存条数, 设置范围[10, 10000], 默认100 +JWT: # 鉴权加密 + Secret: 18a6413dc4fe394c66345ebe501b2f26 + Issuer: paopao-api + Expire: 86400 +TweetSearch: # 推文关键字搜索相关配置 + MaxUpdateQPS: 100 # 最大添加/删除/更新Post的QPS,设置范围[10, 10000], 默认100 + MinWorker: 10 # 最小后台更新工作者, 设置范围[5, 1000], 默认10 +Zinc: # Zinc搜索配置 + Host: zinc:4080 + Index: paopao-data + User: admin + Password: admin + Secure: False +Meili: # Meili搜索配置 + Host: meili:7700 + Index: paopao-data + ApiKey: paopao-meilisearch + Secure: False +ObjectStorage: # 对象存储通用配置 + RetainInDays: 2 # 临时对象过期时间多少天 + TempDir: tmp # 临时对象存放目录名 +AliOSS: # 阿里云OSS存储配置 + Endpoint: + AccessKeyID: + AccessKeySecret: + Bucket: + Domain: +COS: # 腾讯云COS存储配置 + SecretID: + SecretKey: + Region: ap-shanghai + Bucket: demo-1888888888 + Domain: +HuaweiOBS: # 华为云OBS存储配置 + AccessKey: + SecretKey: + Endpoint: + Bucket: paopao + Domain: +MinIO: # MinIO 存储配置 + AccessKey: Q3AM3UQ867SPQQA43P2F + SecretKey: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG + Secure: False + Endpoint: minio:9000 + Bucket: paopao + Domain: 127.0.0.1:9000 +S3: # Amazon S3 存储配置 + AccessKey: "YOUR-ACCESSKEYID" + SecretKey: "YOUR-SECRETACCESSKEY" + Secure: True + Endpoint: s3.amazonaws.com + Bucket: paopao + Domain: +LocalOSS: # 本地文件OSS存储配置 + SavePath: data/paopao-ce/oss + Secure: False + Bucket: paopao + Domain: 127.0.0.1:8008 +Database: # Database通用配置 + LogLevel: error # 日志级别 silent|error|warn|info + TablePrefix: p_ # 表名前缀 +MySQL: # MySQL数据库 + Username: paopao + Password: paopao + Host: db:3306 + DBName: paopao + Charset: utf8mb4 + ParseTime: True + MaxIdleConns: 10 + MaxOpenConns: 30 +Postgres: # PostgreSQL数据库 + User: paopao + Password: paopao + DBName: paopao + Host: localhost + Port: 5432 + SSLMode: disable + TimeZone: Asia/Shanghai +Sqlite3: # Sqlite3数据库 + Path: data/sqlite3/paopao-ce.db +Redis: + Host: redis:6379 + Password: + DB: + \ No newline at end of file diff --git a/internal/conf/db.go b/internal/conf/db.go index 6ad7cd6e..62ad7fe3 100644 --- a/internal/conf/db.go +++ b/internal/conf/db.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package conf import ( diff --git a/internal/conf/db_cgo.go b/internal/conf/db_cgo.go index 3ec8a218..218512a5 100644 --- a/internal/conf/db_cgo.go +++ b/internal/conf/db_cgo.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build cgo // +build cgo diff --git a/internal/conf/db_nocgo.go b/internal/conf/db_nocgo.go index 37937484..977a6695 100644 --- a/internal/conf/db_nocgo.go +++ b/internal/conf/db_nocgo.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build !cgo // +build !cgo diff --git a/internal/conf/logger.go b/internal/conf/logger.go index 40b3500b..cbe3cc1b 100644 --- a/internal/conf/logger.go +++ b/internal/conf/logger.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package conf import ( diff --git a/internal/conf/logger_meili.go b/internal/conf/logger_meili.go index 756cc41f..2d3d439d 100644 --- a/internal/conf/logger_meili.go +++ b/internal/conf/logger_meili.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package conf import ( diff --git a/internal/conf/logger_zinc.go b/internal/conf/logger_zinc.go index 211270c0..4f804cf8 100644 --- a/internal/conf/logger_zinc.go +++ b/internal/conf/logger_zinc.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package conf import ( diff --git a/internal/conf/settting.go b/internal/conf/settting.go index 116fdf95..93443f64 100644 --- a/internal/conf/settting.go +++ b/internal/conf/settting.go @@ -1,6 +1,11 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package conf import ( + "embed" "fmt" "strings" "time" @@ -10,6 +15,9 @@ import ( "gorm.io/gorm/logger" ) +//go:embed config.yaml +var files embed.FS + type Setting struct { vp *viper.Viper } @@ -41,7 +49,7 @@ type LoggerMeiliSettingS struct { MinWorker int } -type ServerSettingS struct { +type HttpServerSettingS struct { RunMode string HttpIp string HttpPort string @@ -49,7 +57,13 @@ type ServerSettingS struct { WriteTimeout time.Duration } +type GRPCServerSettingS struct { + Host string + Port string +} + type AppSettingS struct { + RunMode string MaxCommentCount int64 AttachmentIncomeRate float64 DefaultContextTimeout time.Duration @@ -199,13 +213,21 @@ type JWTSettingS struct { } func NewSetting() (*Setting, error) { + cfgFile, err := files.Open("config.yaml") + if err != nil { + return nil, err + } + defer cfgFile.Close() + vp := viper.New() vp.SetConfigName("config") vp.AddConfigPath(".") vp.AddConfigPath("custom/") vp.SetConfigType("yaml") - err := vp.ReadInConfig() - if err != nil { + if err = vp.ReadConfig(cfgFile); err != nil { + return nil, err + } + if err = vp.MergeInConfig(); err != nil { return nil, err } @@ -217,7 +239,6 @@ func (s *Setting) ReadSection(k string, v any) error { if err != nil { return err } - return nil } @@ -249,6 +270,14 @@ func (s *Setting) featuresInfoFrom(k string) (map[string][]string, map[string]st return suites, kv } +func (s *HttpServerSettingS) GetReadTimeout() time.Duration { + return s.ReadTimeout * time.Second +} + +func (s *HttpServerSettingS) GetWriteTimeout() time.Duration { + return s.WriteTimeout * time.Second +} + func (s *MySQLSettingS) Dsn() string { return fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=%s&parseTime=%t&loc=Local", s.UserName, diff --git a/internal/core/authority.go b/internal/core/authority.go index c016c840..05e3742a 100644 --- a/internal/core/authority.go +++ b/internal/core/authority.go @@ -1,7 +1,10 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( - "github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/pkg/types" ) @@ -33,23 +36,17 @@ const ( ActCreateActivationCode ) -type act uint8 - -type FriendFilter map[int64]types.Empty -type FriendSet map[string]types.Empty +type ( + act uint8 -type Action struct { - Act act - UserId int64 -} + FriendFilter map[int64]types.Empty + FriendSet map[string]types.Empty -// AuthorizationManageService 授权管理服务 -type AuthorizationManageService interface { - IsAllow(user *model.User, action *Action) bool - BeFriendFilter(userId int64) FriendFilter - BeFriendIds(userId int64) ([]int64, error) - MyFriendSet(userId int64) FriendSet -} + Action struct { + Act act + UserId int64 + } +) func (f FriendFilter) IsFriend(userId int64) bool { _, yeah := f[userId] @@ -57,7 +54,7 @@ func (f FriendFilter) IsFriend(userId int64) bool { } // IsAllow default true if user is admin -func (a act) IsAllow(user *model.User, userId int64, isFriend bool, isActivation bool) bool { +func (a act) IsAllow(user *User, userId int64, isFriend bool, isActivation bool) bool { if user.IsAdmin { return true } @@ -116,3 +113,11 @@ func (a act) IsAllow(user *model.User, userId int64, isFriend bool, isActivation return false } + +// AuthorizationManageService 授权管理服务 +type AuthorizationManageService interface { + IsAllow(user *User, action *Action) bool + BeFriendFilter(userId int64) FriendFilter + BeFriendIds(userId int64) ([]int64, error) + MyFriendSet(userId int64) FriendSet +} diff --git a/internal/core/cache.go b/internal/core/cache.go index e4cf4cd9..d8b8cd10 100644 --- a/internal/core/cache.go +++ b/internal/core/cache.go @@ -1,6 +1,12 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core -import "github.com/rocboss/paopao-ce/internal/model" +import ( + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) const ( IdxActNop IdxAct = iota + 1 @@ -15,7 +21,7 @@ type IdxAct uint8 type IndexAction struct { Act IdxAct - Post *model.Post + Post *dbr.Post } func (a IdxAct) String() string { @@ -37,7 +43,7 @@ func (a IdxAct) String() string { } } -func NewIndexAction(act IdxAct, post *model.Post) *IndexAction { +func NewIndexAction(act IdxAct, post *dbr.Post) *IndexAction { return &IndexAction{ Act: act, Post: post, @@ -48,5 +54,5 @@ func NewIndexAction(act IdxAct, post *model.Post) *IndexAction { type CacheIndexService interface { IndexPostsService - SendAction(act IdxAct, post *model.Post) + SendAction(act IdxAct, post *dbr.Post) } diff --git a/internal/core/comments.go b/internal/core/comments.go index 9be29ed3..c5501b4b 100644 --- a/internal/core/comments.go +++ b/internal/core/comments.go @@ -1,24 +1,36 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +type ( + Comment = dbr.Comment + CommentFormated = dbr.CommentFormated + CommentReply = dbr.CommentReply + CommentContent = dbr.CommentContent + CommentReplyFormated = dbr.CommentReplyFormated ) // CommentService 评论检索服务 type CommentService interface { - GetComments(conditions *model.ConditionsT, offset, limit int) ([]*model.Comment, error) - GetCommentByID(id int64) (*model.Comment, error) - GetCommentCount(conditions *model.ConditionsT) (int64, error) - GetCommentReplyByID(id int64) (*model.CommentReply, error) - GetCommentContentsByIDs(ids []int64) ([]*model.CommentContent, error) - GetCommentRepliesByID(ids []int64) ([]*model.CommentReplyFormated, error) + GetComments(conditions *ConditionsT, offset, limit int) ([]*Comment, error) + GetCommentByID(id int64) (*Comment, error) + GetCommentCount(conditions *ConditionsT) (int64, error) + GetCommentReplyByID(id int64) (*CommentReply, error) + GetCommentContentsByIDs(ids []int64) ([]*CommentContent, error) + GetCommentRepliesByID(ids []int64) ([]*CommentReplyFormated, error) } // CommentManageService 评论管理服务 type CommentManageService interface { - DeleteComment(comment *model.Comment) error - CreateComment(comment *model.Comment) (*model.Comment, error) - CreateCommentReply(reply *model.CommentReply) (*model.CommentReply, error) - DeleteCommentReply(reply *model.CommentReply) error - CreateCommentContent(content *model.CommentContent) (*model.CommentContent, error) + DeleteComment(comment *Comment) error + CreateComment(comment *Comment) (*Comment, error) + CreateCommentReply(reply *CommentReply) (*CommentReply, error) + DeleteCommentReply(reply *CommentReply) error + CreateCommentContent(content *CommentContent) (*CommentContent, error) } diff --git a/internal/core/core.go b/internal/core/core.go index f0c158b1..9a8eb26f 100644 --- a/internal/core/core.go +++ b/internal/core/core.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core // DataService 数据服务集成 diff --git a/internal/core/messages.go b/internal/core/messages.go index aa08a1f8..57816480 100644 --- a/internal/core/messages.go +++ b/internal/core/messages.go @@ -1,15 +1,36 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +const ( + MsgTypePost = dbr.MsgTypePost + MsgtypeComment = dbr.MsgtypeComment + MsgTypeReply = dbr.MsgTypeReply + MsgTypeWhisper = dbr.MsgTypeWhisper + MsgTypeRequestingFriend = dbr.MsgTypeRequestingFriend + MsgTypeSystem = dbr.MsgTypeSystem + + MsgStatusUnread = dbr.MsgStatusUnread + MsgStatusReaded = dbr.MsgStatusReaded +) + +type ( + Message = dbr.Message + MessageFormated = dbr.MessageFormated ) // MessageService 消息服务 type MessageService interface { - CreateMessage(msg *model.Message) (*model.Message, error) + CreateMessage(msg *Message) (*Message, error) GetUnreadCount(userID int64) (int64, error) - GetMessageByID(id int64) (*model.Message, error) - ReadMessage(message *model.Message) error - GetMessages(conditions *model.ConditionsT, offset, limit int) ([]*model.MessageFormated, error) - GetMessageCount(conditions *model.ConditionsT) (int64, error) + GetMessageByID(id int64) (*Message, error) + ReadMessage(message *Message) error + GetMessages(conditions *ConditionsT, offset, limit int) ([]*MessageFormated, error) + GetMessageCount(conditions *ConditionsT) (int64, error) } diff --git a/internal/core/search.go b/internal/core/search.go index 3ac90288..74d6e029 100644 --- a/internal/core/search.go +++ b/internal/core/search.go @@ -1,7 +1,11 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" ) const ( @@ -9,28 +13,39 @@ const ( SearchTypeTag SearchType = "tag" ) -type SearchType string +const ( + PostVisitPublic = dbr.PostVisitPublic + PostVisitPrivate = dbr.PostVisitPrivate + PostVisitFriend = dbr.PostVisitFriend + PostVisitInvalid = dbr.PostVisitInvalid +) -type QueryReq struct { - Query string - Visibility []model.PostVisibleT - Type SearchType -} +type ( + PostVisibleT = dbr.PostVisibleT -type QueryResp struct { - Items []*model.PostFormated - Total int64 -} + SearchType string -type TsDocItem struct { - Post *model.Post - Content string -} + QueryReq struct { + Query string + Visibility []PostVisibleT + Type SearchType + } + + QueryResp struct { + Items []*PostFormated + Total int64 + } + + TsDocItem struct { + Post *Post + Content string + } +) // TweetSearchService tweet search service interface type TweetSearchService interface { IndexName() string AddDocuments(data []TsDocItem, primaryKey ...string) (bool, error) DeleteDocuments(identifiers []string) error - Search(user *model.User, q *QueryReq, offset, limit int) (*QueryResp, error) + Search(user *User, q *QueryReq, offset, limit int) (*QueryResp, error) } diff --git a/internal/core/security.go b/internal/core/security.go index 63a7ac21..ce313635 100644 --- a/internal/core/security.go +++ b/internal/core/security.go @@ -1,17 +1,32 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( - "github.com/rocboss/paopao-ce/internal/model" + "time" + + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +type ( + Captcha = dbr.Captcha ) // SecurityService 安全相关服务 type SecurityService interface { - GetLatestPhoneCaptcha(phone string) (*model.Captcha, error) - UsePhoneCaptcha(captcha *model.Captcha) error + GetLatestPhoneCaptcha(phone string) (*Captcha, error) + UsePhoneCaptcha(captcha *Captcha) error SendPhoneCaptcha(phone string) error } -// 附件检测服务 +// AttachmentCheckService 附件检测服务 type AttachmentCheckService interface { CheckAttachment(uri string) error } + +// PhoneVerifyService 手机验证服务 +type PhoneVerifyService interface { + SendPhoneCaptcha(phone string, captcha string, expire time.Duration) error +} diff --git a/internal/core/storage.go b/internal/core/storage.go index 2a241bca..310edf29 100644 --- a/internal/core/storage.go +++ b/internal/core/storage.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( diff --git a/internal/core/topics.go b/internal/core/topics.go index a894f9b2..138cc151 100644 --- a/internal/core/topics.go +++ b/internal/core/topics.go @@ -1,13 +1,22 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +type ( + Tag = dbr.Tag + TagFormated = dbr.TagFormated ) // TopicService 话题服务 type TopicService interface { - CreateTag(tag *model.Tag) (*model.Tag, error) - DeleteTag(tag *model.Tag) error - GetTags(conditions *model.ConditionsT, offset, limit int) ([]*model.Tag, error) - GetTagsByKeyword(keyword string) ([]*model.Tag, error) + CreateTag(tag *Tag) (*Tag, error) + DeleteTag(tag *Tag) error + GetTags(conditions *ConditionsT, offset, limit int) ([]*Tag, error) + GetTagsByKeyword(keyword string) ([]*Tag, error) } diff --git a/internal/core/tweets.go b/internal/core/tweets.go index 1b454c6d..682cbd65 100644 --- a/internal/core/tweets.go +++ b/internal/core/tweets.go @@ -1,49 +1,83 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +const ( + AttachmentTypeImage = dbr.AttachmentTypeImage + AttachmentTypeVideo = dbr.AttachmentTypeVideo + AttachmentTypeOther = dbr.AttachmentTypeOther + + // 类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源 + ContentTypeTitle = dbr.ContentTypeTitle + ContentTypeText = dbr.ContentTypeText + ContentTypeImage = dbr.ContentTypeImage + ContentTypeVideo = dbr.ContentTypeVideo + ContentTypeAudio = dbr.ContentTypeAudio + ContentTypeLink = dbr.ContentTypeLink + ContentTypeAttachment = dbr.ContentTypeAttachment + ContentTypeChargeAttachment = dbr.ContentTypeChargeAttachment +) + +type ( + PostStar = dbr.PostStar + PostCollection = dbr.PostCollection + PostAttachmentBill = dbr.PostAttachmentBill + PostContent = dbr.PostContent + Attachment = dbr.Attachment + AttachmentType = dbr.AttachmentType + PostContentT = dbr.PostContentT + + IndexTweetList struct { + Tweets []*PostFormated + Total int64 + } ) // TweetService 推文检索服务 type TweetService interface { - GetPostByID(id int64) (*model.Post, error) - GetPosts(conditions *model.ConditionsT, offset, limit int) ([]*model.Post, error) - GetPostCount(conditions *model.ConditionsT) (int64, error) - GetUserPostStar(postID, userID int64) (*model.PostStar, error) - GetUserPostStars(userID int64, offset, limit int) ([]*model.PostStar, error) + GetPostByID(id int64) (*Post, error) + GetPosts(conditions *ConditionsT, offset, limit int) ([]*Post, error) + GetPostCount(conditions *ConditionsT) (int64, error) + GetUserPostStar(postID, userID int64) (*PostStar, error) + GetUserPostStars(userID int64, offset, limit int) ([]*PostStar, error) GetUserPostStarCount(userID int64) (int64, error) - GetUserPostCollection(postID, userID int64) (*model.PostCollection, error) - GetUserPostCollections(userID int64, offset, limit int) ([]*model.PostCollection, error) + GetUserPostCollection(postID, userID int64) (*PostCollection, error) + GetUserPostCollections(userID int64, offset, limit int) ([]*PostCollection, error) GetUserPostCollectionCount(userID int64) (int64, error) - GetPostAttatchmentBill(postID, userID int64) (*model.PostAttachmentBill, error) - GetPostContentsByIDs(ids []int64) ([]*model.PostContent, error) - GetPostContentByID(id int64) (*model.PostContent, error) + GetPostAttatchmentBill(postID, userID int64) (*PostAttachmentBill, error) + GetPostContentsByIDs(ids []int64) ([]*PostContent, error) + GetPostContentByID(id int64) (*PostContent, error) } // TweetManageService 推文管理服务,包括创建/删除/更新推文 type TweetManageService interface { - CreateAttachment(attachment *model.Attachment) (*model.Attachment, error) - CreatePost(post *model.Post) (*model.Post, error) - DeletePost(post *model.Post) ([]string, error) - LockPost(post *model.Post) error - StickPost(post *model.Post) error - VisiblePost(post *model.Post, visibility model.PostVisibleT) error - UpdatePost(post *model.Post) error - CreatePostStar(postID, userID int64) (*model.PostStar, error) - DeletePostStar(p *model.PostStar) error - CreatePostCollection(postID, userID int64) (*model.PostCollection, error) - DeletePostCollection(p *model.PostCollection) error - CreatePostContent(content *model.PostContent) (*model.PostContent, error) + CreateAttachment(attachment *Attachment) (*Attachment, error) + CreatePost(post *Post) (*Post, error) + DeletePost(post *Post) ([]string, error) + LockPost(post *Post) error + StickPost(post *Post) error + VisiblePost(post *Post, visibility PostVisibleT) error + UpdatePost(post *Post) error + CreatePostStar(postID, userID int64) (*PostStar, error) + DeletePostStar(p *PostStar) error + CreatePostCollection(postID, userID int64) (*PostCollection, error) + DeletePostCollection(p *PostCollection) error + CreatePostContent(content *PostContent) (*PostContent, error) } // TweetHelpService 推文辅助服务 type TweetHelpService interface { - RevampPosts(posts []*model.PostFormated) ([]*model.PostFormated, error) - MergePosts(posts []*model.Post) ([]*model.PostFormated, error) + RevampPosts(posts []*PostFormated) ([]*PostFormated, error) + MergePosts(posts []*Post) ([]*PostFormated, error) } // IndexPostsService 广场首页推文列表服务 type IndexPostsService interface { - IndexPosts(user *model.User, offset int, limit int) (*rest.IndexTweetsResp, error) + IndexPosts(user *User, offset int, limit int) (*IndexTweetList, error) } diff --git a/internal/core/types.go b/internal/core/types.go new file mode 100644 index 00000000..6ca95893 --- /dev/null +++ b/internal/core/types.go @@ -0,0 +1,24 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package core + +import ( + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +const ( + UserStatusNormal = dbr.UserStatusNormal + UserStatusClosed = dbr.UserStatusClosed +) + +type ( + User = dbr.User + Post = dbr.Post + ConditionsT = dbr.ConditionsT + PostFormated = dbr.PostFormated + UserFormated = dbr.UserFormated + PostContentFormated = dbr.PostContentFormated + Model = dbr.Model +) diff --git a/internal/core/user.go b/internal/core/user.go index cf0ebaa8..ed132dd3 100644 --- a/internal/core/user.go +++ b/internal/core/user.go @@ -1,19 +1,33 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core -import ( - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" +type ( + ContactItem struct { + UserId int64 `json:"user_id"` + UserName string `json:"username"` + Nickname string `json:"nickname"` + Avatar string `json:"avatar"` + Phone string `json:"phone"` + } + + ContactList struct { + Contacts []ContactItem `json:"contacts"` + Total int64 `json:"total"` + } ) // UserManageService 用户管理服务 type UserManageService interface { - GetUserByID(id int64) (*model.User, error) - GetUserByUsername(username string) (*model.User, error) - GetUserByPhone(phone string) (*model.User, error) - GetUsersByIDs(ids []int64) ([]*model.User, error) - GetUsersByKeyword(keyword string) ([]*model.User, error) - CreateUser(user *model.User) (*model.User, error) - UpdateUser(user *model.User) error + GetUserByID(id int64) (*User, error) + GetUserByUsername(username string) (*User, error) + GetUserByPhone(phone string) (*User, error) + GetUsersByIDs(ids []int64) ([]*User, error) + GetUsersByKeyword(keyword string) ([]*User, error) + CreateUser(user *User) (*User, error) + UpdateUser(user *User) error } // ContactManageService 联系人管理服务 @@ -22,6 +36,6 @@ type ContactManageService interface { AddFriend(userId int64, friendId int64) error RejectFriend(userId int64, friendId int64) error DeleteFriend(userId int64, friendId int64) error - GetContacts(userId int64, offset int, limit int) (*rest.ContactsResp, error) + GetContacts(userId int64, offset int, limit int) (*ContactList, error) IsFriend(userID int64, friendID int64) bool } diff --git a/internal/core/version.go b/internal/core/version.go index e603c0a5..07376c39 100644 --- a/internal/core/version.go +++ b/internal/core/version.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( diff --git a/internal/core/wallet.go b/internal/core/wallet.go index 5b3a3391..c4792d3b 100644 --- a/internal/core/wallet.go +++ b/internal/core/wallet.go @@ -1,15 +1,24 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package core import ( - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" +) + +type ( + WalletStatement = dbr.WalletStatement + WalletRecharge = dbr.WalletRecharge ) // WalletService wallet service interface type WalletService interface { - GetUserWalletBills(userID int64, offset, limit int) ([]*model.WalletStatement, error) + GetUserWalletBills(userID int64, offset, limit int) ([]*WalletStatement, error) GetUserWalletBillCount(userID int64) (int64, error) - GetRechargeByID(id int64) (*model.WalletRecharge, error) - CreateRecharge(userId, amount int64) (*model.WalletRecharge, error) - HandleRechargeSuccess(recharge *model.WalletRecharge, tradeNo string) error - HandlePostAttachmentBought(post *model.Post, user *model.User) error + GetRechargeByID(id int64) (*WalletRecharge, error) + CreateRecharge(userId, amount int64) (*WalletRecharge, error) + HandleRechargeSuccess(recharge *WalletRecharge, tradeNo string) error + HandlePostAttachmentBought(post *Post, user *User) error } diff --git a/internal/dao/cache/bigcache.go b/internal/dao/cache/bigcache.go index 4fce26de..8ec83c38 100644 --- a/internal/dao/cache/bigcache.go +++ b/internal/dao/cache/bigcache.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package cache import ( @@ -11,8 +15,6 @@ import ( "github.com/Masterminds/semver/v3" "github.com/allegro/bigcache/v3" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" "github.com/rocboss/paopao-ce/pkg/types" "github.com/sirupsen/logrus" ) @@ -24,7 +26,7 @@ var ( type postsEntry struct { key string - tweets *rest.IndexTweetsResp + tweets *core.IndexTweetList } type bigCacheIndexServant struct { @@ -38,7 +40,7 @@ type bigCacheIndexServant struct { preventDuration time.Duration } -func (s *bigCacheIndexServant) IndexPosts(user *model.User, offset int, limit int) (*rest.IndexTweetsResp, error) { +func (s *bigCacheIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { key := s.keyFrom(user, offset, limit) posts, err := s.getPosts(key) if err == nil { @@ -54,7 +56,7 @@ func (s *bigCacheIndexServant) IndexPosts(user *model.User, offset int, limit in return posts, nil } -func (s *bigCacheIndexServant) getPosts(key string) (*rest.IndexTweetsResp, error) { +func (s *bigCacheIndexServant) getPosts(key string) (*core.IndexTweetList, error) { data, err := s.cache.Get(key) if err != nil { logrus.Debugf("bigCacheIndexServant.getPosts get posts by key: %s from cache err: %v", key, err) @@ -62,7 +64,7 @@ func (s *bigCacheIndexServant) getPosts(key string) (*rest.IndexTweetsResp, erro } buf := bytes.NewBuffer(data) dec := gob.NewDecoder(buf) - var resp rest.IndexTweetsResp + var resp core.IndexTweetList if err := dec.Decode(&resp); err != nil { logrus.Debugf("bigCacheIndexServant.getPosts get posts from cache in decode err: %v", err) return nil, err @@ -70,7 +72,7 @@ func (s *bigCacheIndexServant) getPosts(key string) (*rest.IndexTweetsResp, erro return &resp, nil } -func (s *bigCacheIndexServant) cachePosts(key string, tweets *rest.IndexTweetsResp) { +func (s *bigCacheIndexServant) cachePosts(key string, tweets *core.IndexTweetList) { entry := &postsEntry{key: key, tweets: tweets} select { case s.cachePostsCh <- entry: @@ -96,7 +98,7 @@ func (s *bigCacheIndexServant) setPosts(entry *postsEntry) { logrus.Debugf("bigCacheIndexServant.setPosts setPosts set cache by key: %s", entry.key) } -func (s *bigCacheIndexServant) keyFrom(user *model.User, offset int, limit int) string { +func (s *bigCacheIndexServant) keyFrom(user *core.User, offset int, limit int) string { var userId int64 = -1 if user != nil { userId = user.ID @@ -104,7 +106,7 @@ func (s *bigCacheIndexServant) keyFrom(user *model.User, offset int, limit int) return fmt.Sprintf("index:%d:%d:%d", userId, offset, limit) } -func (s *bigCacheIndexServant) SendAction(act core.IdxAct, post *model.Post) { +func (s *bigCacheIndexServant) SendAction(act core.IdxAct, post *core.Post) { action := core.NewIndexAction(act, post) select { case s.indexActionCh <- action: @@ -134,7 +136,7 @@ func (s *bigCacheIndexServant) handleIndexAction(action *core.IndexAction) { // 创建/删除 私密推文特殊处理 switch act { case core.IdxActCreatePost, core.IdxActDeletePost: - if post.Visibility == model.PostVisitPrivate { + if post.Visibility == core.PostVisitPrivate { s.deleteCacheByUserId(post.UserID, true) return } diff --git a/internal/dao/cache/cache.go b/internal/dao/cache/cache.go index 1b12ad88..773c9a2f 100644 --- a/internal/dao/cache/cache.go +++ b/internal/dao/cache/cache.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package cache import ( diff --git a/internal/dao/cache/none.go b/internal/dao/cache/none.go index 79705280..ce6e1caf 100644 --- a/internal/dao/cache/none.go +++ b/internal/dao/cache/none.go @@ -1,10 +1,12 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package cache import ( "github.com/Masterminds/semver/v3" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" ) var ( @@ -16,11 +18,11 @@ type noneCacheIndexServant struct { ips core.IndexPostsService } -func (s *noneCacheIndexServant) IndexPosts(user *model.User, offset int, limit int) (*rest.IndexTweetsResp, error) { +func (s *noneCacheIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { return s.ips.IndexPosts(user, offset, limit) } -func (s *noneCacheIndexServant) SendAction(_act core.IdxAct, _post *model.Post) { +func (s *noneCacheIndexServant) SendAction(_act core.IdxAct, _post *core.Post) { // empty } diff --git a/internal/dao/cache/simple.go b/internal/dao/cache/simple.go index afdea1be..ba674d1b 100644 --- a/internal/dao/cache/simple.go +++ b/internal/dao/cache/simple.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package cache import ( @@ -6,8 +10,6 @@ import ( "github.com/Masterminds/semver/v3" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" "github.com/sirupsen/logrus" ) @@ -20,21 +22,21 @@ type simpleCacheIndexServant struct { ips core.IndexPostsService indexActionCh chan core.IdxAct - indexPosts *rest.IndexTweetsResp + indexPosts *core.IndexTweetList atomicIndex atomic.Value maxIndexSize int checkTick *time.Ticker expireIndexTick *time.Ticker } -func (s *simpleCacheIndexServant) IndexPosts(user *model.User, offset int, limit int) (*rest.IndexTweetsResp, error) { - cacheResp := s.atomicIndex.Load().(*rest.IndexTweetsResp) +func (s *simpleCacheIndexServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { + cacheResp := s.atomicIndex.Load().(*core.IndexTweetList) end := offset + limit if cacheResp != nil { size := len(cacheResp.Tweets) logrus.Debugf("simpleCacheIndexServant.IndexPosts get index posts from cache posts: %d offset:%d limit:%d start:%d, end:%d", size, offset, limit, offset, end) if size >= end { - return &rest.IndexTweetsResp{ + return &core.IndexTweetList{ Tweets: cacheResp.Tweets[offset:end], Total: cacheResp.Total, }, nil @@ -45,7 +47,7 @@ func (s *simpleCacheIndexServant) IndexPosts(user *model.User, offset int, limit return s.ips.IndexPosts(user, offset, limit) } -func (s *simpleCacheIndexServant) SendAction(act core.IdxAct, _post *model.Post) { +func (s *simpleCacheIndexServant) SendAction(act core.IdxAct, _post *core.Post) { select { case s.indexActionCh <- act: logrus.Debugf("simpleCacheIndexServant.SendAction send indexAction by chan: %s", act) diff --git a/internal/dao/dao.go b/internal/dao/dao.go index f0244d3b..d0b05c9c 100644 --- a/internal/dao/dao.go +++ b/internal/dao/dao.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package dao import ( diff --git a/internal/dao/jinzhu/authority.go b/internal/dao/jinzhu/authority.go index c0f59556..5932fa24 100644 --- a/internal/dao/jinzhu/authority.go +++ b/internal/dao/jinzhu/authority.go @@ -1,8 +1,12 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/rocboss/paopao-ce/pkg/types" "gorm.io/gorm" ) @@ -21,7 +25,7 @@ func newAuthorizationManageService(db *gorm.DB) core.AuthorizationManageService } } -func (s *authorizationManageServant) IsAllow(user *model.User, action *core.Action) bool { +func (s *authorizationManageServant) IsAllow(user *core.User, action *core.Action) bool { // user is activation if had bind phone isActivation := (len(user.Phone) != 0) isFriend := s.isFriend(user.ID, action.UserId) @@ -30,7 +34,7 @@ func (s *authorizationManageServant) IsAllow(user *model.User, action *core.Acti } func (s *authorizationManageServant) MyFriendSet(userId int64) core.FriendSet { - ids, err := (&model.Contact{UserId: userId}).MyFriendIds(s.db) + ids, err := (&dbr.Contact{UserId: userId}).MyFriendIds(s.db) if err != nil { return core.FriendSet{} } @@ -43,7 +47,7 @@ func (s *authorizationManageServant) MyFriendSet(userId int64) core.FriendSet { } func (s *authorizationManageServant) BeFriendFilter(userId int64) core.FriendFilter { - ids, err := (&model.Contact{FriendId: userId}).BeFriendIds(s.db) + ids, err := (&dbr.Contact{FriendId: userId}).BeFriendIds(s.db) if err != nil { return core.FriendFilter{} } @@ -56,12 +60,12 @@ func (s *authorizationManageServant) BeFriendFilter(userId int64) core.FriendFil } func (s *authorizationManageServant) BeFriendIds(userId int64) ([]int64, error) { - return (&model.Contact{FriendId: userId}).BeFriendIds(s.db) + return (&dbr.Contact{FriendId: userId}).BeFriendIds(s.db) } func (s *authorizationManageServant) isFriend(userId int64, friendId int64) bool { - contact, err := (&model.Contact{UserId: friendId, FriendId: userId}).GetByUserFriend(s.db) - if err == nil || contact.Status == model.ContactStatusAgree { + contact, err := (&dbr.Contact{UserId: friendId, FriendId: userId}).GetByUserFriend(s.db) + if err == nil || contact.Status == dbr.ContactStatusAgree { return true } return false diff --git a/internal/dao/jinzhu/comments.go b/internal/dao/jinzhu/comments.go index c15e74f3..1af9e5ce 100644 --- a/internal/dao/jinzhu/comments.go +++ b/internal/dao/jinzhu/comments.go @@ -1,8 +1,12 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) @@ -31,42 +35,42 @@ func newCommentManageService(db *gorm.DB) core.CommentManageService { } } -func (s *commentServant) GetComments(conditions *model.ConditionsT, offset, limit int) ([]*model.Comment, error) { - return (&model.Comment{}).List(s.db, conditions, offset, limit) +func (s *commentServant) GetComments(conditions *core.ConditionsT, offset, limit int) ([]*core.Comment, error) { + return (&dbr.Comment{}).List(s.db, conditions, offset, limit) } -func (s *commentServant) GetCommentByID(id int64) (*model.Comment, error) { - comment := &model.Comment{ - Model: &model.Model{ +func (s *commentServant) GetCommentByID(id int64) (*core.Comment, error) { + comment := &dbr.Comment{ + Model: &dbr.Model{ ID: id, }, } return comment.Get(s.db) } -func (s *commentServant) GetCommentReplyByID(id int64) (*model.CommentReply, error) { - reply := &model.CommentReply{ - Model: &model.Model{ +func (s *commentServant) GetCommentReplyByID(id int64) (*core.CommentReply, error) { + reply := &dbr.CommentReply{ + Model: &dbr.Model{ ID: id, }, } return reply.Get(s.db) } -func (s *commentServant) GetCommentCount(conditions *model.ConditionsT) (int64, error) { - return (&model.Comment{}).Count(s.db, conditions) +func (s *commentServant) GetCommentCount(conditions *core.ConditionsT) (int64, error) { + return (&dbr.Comment{}).Count(s.db, conditions) } -func (s *commentServant) GetCommentContentsByIDs(ids []int64) ([]*model.CommentContent, error) { - commentContent := &model.CommentContent{} - return commentContent.List(s.db, &model.ConditionsT{ +func (s *commentServant) GetCommentContentsByIDs(ids []int64) ([]*core.CommentContent, error) { + commentContent := &dbr.CommentContent{} + return commentContent.List(s.db, &dbr.ConditionsT{ "comment_id IN ?": ids, }, 0, 0) } -func (s *commentServant) GetCommentRepliesByID(ids []int64) ([]*model.CommentReplyFormated, error) { - CommentReply := &model.CommentReply{} - replies, err := CommentReply.List(s.db, &model.ConditionsT{ +func (s *commentServant) GetCommentRepliesByID(ids []int64) ([]*core.CommentReplyFormated, error) { + CommentReply := &dbr.CommentReply{} + replies, err := CommentReply.List(s.db, &dbr.ConditionsT{ "comment_id IN ?": ids, }, 0, 0) @@ -83,7 +87,7 @@ func (s *commentServant) GetCommentRepliesByID(ids []int64) ([]*model.CommentRep if err != nil { return nil, err } - repliesFormated := []*model.CommentReplyFormated{} + repliesFormated := []*core.CommentReplyFormated{} for _, reply := range replies { replyFormated := reply.Format() for _, user := range users { @@ -101,22 +105,22 @@ func (s *commentServant) GetCommentRepliesByID(ids []int64) ([]*model.CommentRep return repliesFormated, nil } -func (s *commentManageServant) DeleteComment(comment *model.Comment) error { +func (s *commentManageServant) DeleteComment(comment *core.Comment) error { return comment.Delete(s.db) } -func (s *commentManageServant) CreateComment(comment *model.Comment) (*model.Comment, error) { +func (s *commentManageServant) CreateComment(comment *core.Comment) (*core.Comment, error) { return comment.Create(s.db) } -func (s *commentManageServant) CreateCommentReply(reply *model.CommentReply) (*model.CommentReply, error) { +func (s *commentManageServant) CreateCommentReply(reply *core.CommentReply) (*core.CommentReply, error) { return reply.Create(s.db) } -func (s *commentManageServant) DeleteCommentReply(reply *model.CommentReply) error { +func (s *commentManageServant) DeleteCommentReply(reply *core.CommentReply) error { return reply.Delete(s.db) } -func (s *commentManageServant) CreateCommentContent(content *model.CommentContent) (*model.CommentContent, error) { +func (s *commentManageServant) CreateCommentContent(content *core.CommentContent) (*core.CommentContent, error) { return content.Create(s.db) } diff --git a/internal/dao/jinzhu/contacts.go b/internal/dao/jinzhu/contacts.go index c55a94a0..c26ae4de 100644 --- a/internal/dao/jinzhu/contacts.go +++ b/internal/dao/jinzhu/contacts.go @@ -1,11 +1,14 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( "time" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/sirupsen/logrus" "gorm.io/gorm" ) @@ -24,14 +27,14 @@ func newContactManageService(db *gorm.DB) core.ContactManageService { } } -func (s *contactManageServant) fetchOrNewContact(db *gorm.DB, userId int64, friendId int64, status int8) (*model.Contact, error) { - contact := &model.Contact{ +func (s *contactManageServant) fetchOrNewContact(db *gorm.DB, userId int64, friendId int64, status int8) (*dbr.Contact, error) { + contact := &dbr.Contact{ UserId: userId, FriendId: friendId, } contact, err := contact.FetchUser(db) if err != nil { - contact = &model.Contact{ + contact = &dbr.Contact{ UserId: userId, FriendId: friendId, Status: status, @@ -54,17 +57,17 @@ func (s *contactManageServant) RequestingFriend(userId int64, friendId int64, gr } }() - contact, e := s.fetchOrNewContact(db, userId, friendId, model.ContactStatusRequesting) + contact, e := s.fetchOrNewContact(db, userId, friendId, dbr.ContactStatusRequesting) if e != nil { err = e return } // 如果已经好友,啥也不干 - if contact.Status == model.ContactStatusAgree { + if contact.Status == dbr.ContactStatusAgree { return nil - } else if contact.Status == model.ContactStatusReject || contact.Status == model.ContactStatusDeleted { - contact.Status = model.ContactStatusRequesting + } else if contact.Status == dbr.ContactStatusReject || contact.Status == dbr.ContactStatusDeleted { + contact.Status = dbr.ContactStatusRequesting contact.IsDel = 0 // remove deleted flag if needed if err = contact.UpdateInUnscoped(db); err != nil { logrus.Errorf("contactManageServant.RequestingFriend update exsit contact err:%s", err) @@ -72,13 +75,13 @@ func (s *contactManageServant) RequestingFriend(userId int64, friendId int64, gr } } - msg := &model.Message{ + msg := &dbr.Message{ SenderUserID: userId, ReceiverUserID: friendId, - Type: model.MsgTypeRequestingFriend, + Type: dbr.MsgTypeRequestingFriend, Brief: "请求添加好友,并附言:", Content: greetings, - ReplyID: int64(model.ContactStatusRequesting), + ReplyID: int64(dbr.ContactStatusRequesting), } if _, err = msg.Create(db); err != nil { logrus.Errorf("contactManageServant.RequestingFriend create message err:%s", err) @@ -97,7 +100,7 @@ func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err erro } }() - contact := &model.Contact{ + contact := &dbr.Contact{ UserId: friendId, FriendId: userId, } @@ -105,23 +108,23 @@ func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err erro return } // 如果还不是请求好友,啥也不干 - if contact.Status != model.ContactStatusRequesting { + if contact.Status != dbr.ContactStatusRequesting { logrus.Debugf("contactManageServant.AddFriend not reuesting status now so skip") return nil } - contact.Status = model.ContactStatusAgree + contact.Status = dbr.ContactStatusAgree if err = contact.Update(db); err != nil { return err } - contact, err = s.fetchOrNewContact(db, userId, friendId, model.ContactStatusAgree) + contact, err = s.fetchOrNewContact(db, userId, friendId, dbr.ContactStatusAgree) if err != nil { return } // 如果已经好友,啥也不干 - if contact.Status != model.ContactStatusAgree { - contact.Status = model.ContactStatusAgree + if contact.Status != dbr.ContactStatusAgree { + contact.Status = dbr.ContactStatusAgree contact.IsDel = 0 // remove deleted flag if err = contact.UpdateInUnscoped(db); err != nil { logrus.Errorf("contactManageServant.AddFriend update contact err:%s", err) @@ -129,8 +132,8 @@ func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err erro } } - args := []any{userId, friendId, friendId, userId, model.MsgTypeRequestingFriend, model.ContactStatusRequesting} - msgs, e := (&model.Message{}).FetchBy(db, model.Predicates{ + args := []any{userId, friendId, friendId, userId, dbr.MsgTypeRequestingFriend, dbr.ContactStatusRequesting} + msgs, e := (&dbr.Message{}).FetchBy(db, dbr.Predicates{ "((sender_user_id = ? AND receiver_user_id = ?) OR (sender_user_id = ? AND receiver_user_id = ?)) AND type = ? AND reply_id = ?": args, }) if e != nil { @@ -138,7 +141,7 @@ func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err erro return } for _, msg := range msgs { - msg.ReplyID = int64(model.ContactStatusAgree) + msg.ReplyID = int64(dbr.ContactStatusAgree) if err = msg.Update(db); err != nil { return } @@ -156,7 +159,7 @@ func (s *contactManageServant) RejectFriend(userId int64, friendId int64) (err e } }() - contact := &model.Contact{ + contact := &dbr.Contact{ UserId: friendId, FriendId: userId, } @@ -164,16 +167,16 @@ func (s *contactManageServant) RejectFriend(userId int64, friendId int64) (err e return } // 如果还不是请求好友,啥也不干 - if contact.Status != model.ContactStatusRequesting { + if contact.Status != dbr.ContactStatusRequesting { return nil } - contact.Status = model.ContactStatusReject + contact.Status = dbr.ContactStatusReject if err = contact.Update(db); err != nil { return err } - args := []any{friendId, userId, model.MsgTypeRequestingFriend, model.ContactStatusRequesting} - msgs, e := (&model.Message{}).FetchBy(db, model.Predicates{ + args := []any{friendId, userId, dbr.MsgTypeRequestingFriend, dbr.ContactStatusRequesting} + msgs, e := (&dbr.Message{}).FetchBy(db, dbr.Predicates{ "sender_user_id = ? AND receiver_user_id = ? AND type = ? AND reply_id = ?": args, }) if e != nil { @@ -181,7 +184,7 @@ func (s *contactManageServant) RejectFriend(userId int64, friendId int64) (err e return } for _, msg := range msgs { - msg.ReplyID = int64(model.ContactStatusReject) + msg.ReplyID = int64(dbr.ContactStatusReject) if err = msg.Update(db); err != nil { return } @@ -199,7 +202,7 @@ func (s *contactManageServant) DeleteFriend(userId int64, friendId int64) (err e } }() - contact := &model.Contact{ + contact := &dbr.Contact{ UserId: userId, FriendId: friendId, } @@ -210,10 +213,10 @@ func (s *contactManageServant) DeleteFriend(userId int64, friendId int64) (err e for _, contact := range contacts { // 如果还不是好友,啥也不干 - if contact.Status != model.ContactStatusAgree { + if contact.Status != dbr.ContactStatusAgree { continue } - contact.Status = model.ContactStatusDeleted + contact.Status = dbr.ContactStatusDeleted contact.DeletedOn = time.Now().Unix() contact.IsDel = 1 if err = contact.Update(db); err != nil { @@ -223,11 +226,11 @@ func (s *contactManageServant) DeleteFriend(userId int64, friendId int64) (err e return nil } -func (s *contactManageServant) GetContacts(userId int64, offset int, limit int) (*rest.ContactsResp, error) { - contact := &model.Contact{} - condition := model.ConditionsT{ +func (s *contactManageServant) GetContacts(userId int64, offset int, limit int) (*core.ContactList, error) { + contact := &dbr.Contact{} + condition := dbr.ConditionsT{ "user_id": userId, - "status": model.ContactStatusAgree, + "status": dbr.ContactStatusAgree, } contacts, err := contact.List(s.db, condition, offset, limit) if err != nil { @@ -237,13 +240,13 @@ func (s *contactManageServant) GetContacts(userId int64, offset int, limit int) if err != nil { return nil, err } - resp := &rest.ContactsResp{ - Contacts: make([]rest.ContactItem, 0, len(contacts)), + resp := &core.ContactList{ + Contacts: make([]core.ContactItem, 0, len(contacts)), Total: total, } for _, c := range contacts { if c.User != nil { - resp.Contacts = append(resp.Contacts, rest.ContactItem{ + resp.Contacts = append(resp.Contacts, core.ContactItem{ UserId: c.FriendId, UserName: c.User.Username, Nickname: c.User.Nickname, @@ -256,12 +259,12 @@ func (s *contactManageServant) GetContacts(userId int64, offset int, limit int) } func (s *contactManageServant) IsFriend(userId int64, friendId int64) bool { - contact := &model.Contact{ + contact := &dbr.Contact{ UserId: friendId, FriendId: userId, } contact, err := contact.GetByUserFriend(s.db) - if err == nil && contact.Status == model.ContactStatusAgree { + if err == nil && contact.Status == dbr.ContactStatusAgree { return true } return false diff --git a/internal/model/attachment.go b/internal/dao/jinzhu/dbr/attachment.go similarity index 65% rename from internal/model/attachment.go rename to internal/dao/jinzhu/dbr/attachment.go index 0c748b00..b62a5d8b 100644 --- a/internal/model/attachment.go +++ b/internal/dao/jinzhu/dbr/attachment.go @@ -1,13 +1,17 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import "gorm.io/gorm" type AttachmentType int const ( - ATTACHMENT_TYPE_IMAGE AttachmentType = iota + 1 - ATTACHMENT_TYPE_VIDEO - ATTACHMENT_TYPE_OTHER + AttachmentTypeImage AttachmentType = iota + 1 + AttachmentTypeVideo + AttachmentTypeOther ) type Attachment struct { diff --git a/internal/model/captcha.go b/internal/dao/jinzhu/dbr/captcha.go similarity index 82% rename from internal/model/captcha.go rename to internal/dao/jinzhu/dbr/captcha.go index 210cc691..4567d4b3 100644 --- a/internal/model/captcha.go +++ b/internal/dao/jinzhu/dbr/captcha.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import "gorm.io/gorm" diff --git a/internal/model/comment.go b/internal/dao/jinzhu/dbr/comment.go similarity index 94% rename from internal/model/comment.go rename to internal/dao/jinzhu/dbr/comment.go index 72494b53..80192df7 100644 --- a/internal/model/comment.go +++ b/internal/dao/jinzhu/dbr/comment.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "time" diff --git a/internal/model/comment_content.go b/internal/dao/jinzhu/dbr/comment_content.go similarity index 85% rename from internal/model/comment_content.go rename to internal/dao/jinzhu/dbr/comment_content.go index b7d42dfd..778f113a 100644 --- a/internal/model/comment_content.go +++ b/internal/dao/jinzhu/dbr/comment_content.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "time" @@ -47,7 +51,7 @@ func (c *CommentContent) Create(db *gorm.DB) (*CommentContent, error) { } func (c *CommentContent) MediaContentsByCommentId(db *gorm.DB, commentIds []int64) (contents []string, err error) { - err = db.Model(c).Where("comment_id IN ? AND type = ?", commentIds, CONTENT_TYPE_IMAGE).Select("content").Find(&contents).Error + err = db.Model(c).Where("comment_id IN ? AND type = ?", commentIds, ContentTypeImage).Select("content").Find(&contents).Error return } diff --git a/internal/model/comment_reply.go b/internal/dao/jinzhu/dbr/comment_reply.go similarity index 94% rename from internal/model/comment_reply.go rename to internal/dao/jinzhu/dbr/comment_reply.go index fd22702f..fe527be5 100644 --- a/internal/model/comment_reply.go +++ b/internal/dao/jinzhu/dbr/comment_reply.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "time" diff --git a/internal/model/contact.go b/internal/dao/jinzhu/dbr/contact.go similarity index 95% rename from internal/model/contact.go rename to internal/dao/jinzhu/dbr/contact.go index 14049f77..e8c12bd0 100644 --- a/internal/model/contact.go +++ b/internal/dao/jinzhu/dbr/contact.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "github.com/sirupsen/logrus" diff --git a/internal/model/message.go b/internal/dao/jinzhu/dbr/message.go similarity index 95% rename from internal/model/message.go rename to internal/dao/jinzhu/dbr/message.go index c1277cf7..6c952bae 100644 --- a/internal/model/message.go +++ b/internal/dao/jinzhu/dbr/message.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import "gorm.io/gorm" diff --git a/internal/dao/jinzhu/dbr/model.go b/internal/dao/jinzhu/dbr/model.go new file mode 100644 index 00000000..75e66561 --- /dev/null +++ b/internal/dao/jinzhu/dbr/model.go @@ -0,0 +1,40 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr + +import ( + "time" + + "gorm.io/gorm" + "gorm.io/plugin/soft_delete" +) + +// Model 公共Model +type Model struct { + ID int64 `gorm:"primary_key" json:"id"` + CreatedOn int64 `json:"created_on"` + ModifiedOn int64 `json:"modified_on"` + DeletedOn int64 `json:"deleted_on"` + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag" json:"is_del"` +} + +type ConditionsT map[string]any +type Predicates map[string][]any + +func (m *Model) BeforeCreate(tx *gorm.DB) (err error) { + nowTime := time.Now().Unix() + + tx.Statement.SetColumn("created_on", nowTime) + tx.Statement.SetColumn("modified_on", nowTime) + return +} + +func (m *Model) BeforeUpdate(tx *gorm.DB) (err error) { + if !tx.Statement.Changed("modified_on") { + tx.Statement.SetColumn("modified_on", time.Now().Unix()) + } + + return +} diff --git a/internal/model/post.go b/internal/dao/jinzhu/dbr/post.go similarity index 97% rename from internal/model/post.go rename to internal/dao/jinzhu/dbr/post.go index ae428a9a..a47dedfc 100644 --- a/internal/model/post.go +++ b/internal/dao/jinzhu/dbr/post.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "strings" diff --git a/internal/model/post_attachment_bill.go b/internal/dao/jinzhu/dbr/post_attachment_bill.go similarity index 81% rename from internal/model/post_attachment_bill.go rename to internal/dao/jinzhu/dbr/post_attachment_bill.go index 8ee7aae6..7bdd812f 100644 --- a/internal/model/post_attachment_bill.go +++ b/internal/dao/jinzhu/dbr/post_attachment_bill.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import "gorm.io/gorm" diff --git a/internal/model/post_collection.go b/internal/dao/jinzhu/dbr/post_collection.go similarity index 93% rename from internal/model/post_collection.go rename to internal/dao/jinzhu/dbr/post_collection.go index 0ea0cb29..04ca2647 100644 --- a/internal/model/post_collection.go +++ b/internal/dao/jinzhu/dbr/post_collection.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "time" diff --git a/internal/model/post_content.go b/internal/dao/jinzhu/dbr/post_content.go similarity index 83% rename from internal/model/post_content.go rename to internal/dao/jinzhu/dbr/post_content.go index b301de62..672cc57e 100644 --- a/internal/model/post_content.go +++ b/internal/dao/jinzhu/dbr/post_content.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "time" @@ -7,27 +11,26 @@ import ( ) // 类型,1标题,2文字段落,3图片地址,4视频地址,5语音地址,6链接地址,7附件资源 - type PostContentT int const ( - CONTENT_TYPE_TITLE PostContentT = iota + 1 - CONTENT_TYPE_TEXT - CONTENT_TYPE_IMAGE - CONTENT_TYPE_VIDEO - CONTENT_TYPE_AUDIO - CONTENT_TYPE_LINK - CONTENT_TYPE_ATTACHMENT - CONTENT_TYPE_CHARGE_ATTACHMENT + ContentTypeTitle PostContentT = iota + 1 + ContentTypeText + ContentTypeImage + ContentTypeVideo + ContentTypeAudio + ContentTypeLink + ContentTypeAttachment + ContentTypeChargeAttachment ) var ( mediaContentType = []PostContentT{ - CONTENT_TYPE_IMAGE, - CONTENT_TYPE_VIDEO, - CONTENT_TYPE_AUDIO, - CONTENT_TYPE_ATTACHMENT, - CONTENT_TYPE_CHARGE_ATTACHMENT, + ContentTypeImage, + ContentTypeVideo, + ContentTypeAudio, + ContentTypeAttachment, + ContentTypeChargeAttachment, } ) diff --git a/internal/model/post_star.go b/internal/dao/jinzhu/dbr/post_star.go similarity index 93% rename from internal/model/post_star.go rename to internal/dao/jinzhu/dbr/post_star.go index 3846a9c2..45c48f45 100644 --- a/internal/model/post_star.go +++ b/internal/dao/jinzhu/dbr/post_star.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "time" diff --git a/internal/model/tag.go b/internal/dao/jinzhu/dbr/tag.go similarity index 92% rename from internal/model/tag.go rename to internal/dao/jinzhu/dbr/tag.go index 34bb64f9..5193df26 100644 --- a/internal/model/tag.go +++ b/internal/dao/jinzhu/dbr/tag.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import ( "time" diff --git a/internal/model/user.go b/internal/dao/jinzhu/dbr/user.go similarity index 92% rename from internal/model/user.go rename to internal/dao/jinzhu/dbr/user.go index 39c52d79..a10d5432 100644 --- a/internal/model/user.go +++ b/internal/dao/jinzhu/dbr/user.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import "gorm.io/gorm" diff --git a/internal/model/wallet_recharge.go b/internal/dao/jinzhu/dbr/wallet_recharge.go similarity index 80% rename from internal/model/wallet_recharge.go rename to internal/dao/jinzhu/dbr/wallet_recharge.go index bfb3bc6f..14601cb0 100644 --- a/internal/model/wallet_recharge.go +++ b/internal/dao/jinzhu/dbr/wallet_recharge.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import "gorm.io/gorm" diff --git a/internal/model/wallet_statement.go b/internal/dao/jinzhu/dbr/wallet_statement.go similarity index 91% rename from internal/model/wallet_statement.go rename to internal/dao/jinzhu/dbr/wallet_statement.go index 163e2430..890e34ec 100644 --- a/internal/model/wallet_statement.go +++ b/internal/dao/jinzhu/dbr/wallet_statement.go @@ -1,4 +1,8 @@ -package model +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package dbr import "gorm.io/gorm" diff --git a/internal/dao/jinzhu/index.go b/internal/dao/jinzhu/index.go index 31712c61..7548de49 100644 --- a/internal/dao/jinzhu/index.go +++ b/internal/dao/jinzhu/index.go @@ -1,9 +1,12 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "github.com/sirupsen/logrus" "gorm.io/gorm" ) @@ -40,20 +43,20 @@ func newSimpleIndexPostsService(db *gorm.DB) core.IndexPostsService { } // IndexPosts 根据userId查询广场推文列表,简单做到不同用户的主页都是不同的; -func (s *indexPostsServant) IndexPosts(user *model.User, offset int, limit int) (*rest.IndexTweetsResp, error) { - predicates := model.Predicates{ +func (s *indexPostsServant) IndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { + predicates := dbr.Predicates{ "ORDER": []any{"is_top DESC, latest_replied_on DESC"}, } if user == nil { - predicates["visibility = ?"] = []any{model.PostVisitPublic} + predicates["visibility = ?"] = []any{dbr.PostVisitPublic} } else if !user.IsAdmin { friendIds, _ := s.ams.BeFriendIds(user.ID) friendIds = append(friendIds, user.ID) - args := []any{model.PostVisitPublic, model.PostVisitPrivate, user.ID, model.PostVisitFriend, friendIds} + args := []any{dbr.PostVisitPublic, dbr.PostVisitPrivate, user.ID, dbr.PostVisitFriend, friendIds} predicates["visibility = ? OR (visibility = ? AND user_id = ?) OR (visibility = ? AND user_id IN ?)"] = args } - posts, err := (&model.Post{}).Fetch(s.db, predicates, offset, limit) + posts, err := (&dbr.Post{}).Fetch(s.db, predicates, offset, limit) if err != nil { logrus.Debugf("gormIndexPostsServant.IndexPosts err: %v", err) return nil, err @@ -63,25 +66,25 @@ func (s *indexPostsServant) IndexPosts(user *model.User, offset int, limit int) return nil, err } - total, err := (&model.Post{}).CountBy(s.db, predicates) + total, err := (&dbr.Post{}).CountBy(s.db, predicates) if err != nil { return nil, err } - return &rest.IndexTweetsResp{ + return &core.IndexTweetList{ Tweets: formatPosts, Total: total, }, nil } // simpleCacheIndexGetPosts simpleCacheIndex 专属获取广场推文列表函数 -func (s *simpleIndexPostsServant) IndexPosts(_user *model.User, offset int, limit int) (*rest.IndexTweetsResp, error) { - predicates := model.Predicates{ - "visibility = ?": []any{model.PostVisitPublic}, +func (s *simpleIndexPostsServant) IndexPosts(_user *core.User, offset int, limit int) (*core.IndexTweetList, error) { + predicates := dbr.Predicates{ + "visibility = ?": []any{dbr.PostVisitPublic}, "ORDER": []any{"is_top DESC, latest_replied_on DESC"}, } - posts, err := (&model.Post{}).Fetch(s.db, predicates, offset, limit) + posts, err := (&dbr.Post{}).Fetch(s.db, predicates, offset, limit) if err != nil { logrus.Debugf("gormSimpleIndexPostsServant.IndexPosts err: %v", err) return nil, err @@ -92,12 +95,12 @@ func (s *simpleIndexPostsServant) IndexPosts(_user *model.User, offset int, limi return nil, err } - total, err := (&model.Post{}).CountBy(s.db, predicates) + total, err := (&dbr.Post{}).CountBy(s.db, predicates) if err != nil { return nil, err } - return &rest.IndexTweetsResp{ + return &core.IndexTweetList{ Tweets: formatPosts, Total: total, }, nil diff --git a/internal/dao/jinzhu/jinzhu.go b/internal/dao/jinzhu/jinzhu.go index b3eb550f..f708e064 100644 --- a/internal/dao/jinzhu/jinzhu.go +++ b/internal/dao/jinzhu/jinzhu.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + // Core service implement base gorm+mysql/postgresql/sqlite3. // Jinzhu is the primary developer of gorm so use his name as // package name as a saluter. @@ -42,6 +46,7 @@ func NewDataService() (core.DataService, core.VersionInfo) { v core.VersionInfo ) db := conf.MustGormDB() + pvs := security.NewPhoneVerifyService() i := newIndexPostsService(db) if cfg.If("SimpleCacheIndex") { @@ -67,7 +72,7 @@ func NewDataService() (core.DataService, core.VersionInfo) { CommentManageService: newCommentManageService(db), UserManageService: newUserManageService(db), ContactManageService: newContactManageService(db), - SecurityService: newSecurityService(db), + SecurityService: newSecurityService(db, pvs), AttachmentCheckService: security.NewAttachmentCheckService(), } return ds, ds diff --git a/internal/dao/jinzhu/messages.go b/internal/dao/jinzhu/messages.go index 3e282776..32edaac2 100644 --- a/internal/dao/jinzhu/messages.go +++ b/internal/dao/jinzhu/messages.go @@ -1,8 +1,12 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) @@ -20,37 +24,37 @@ func newMessageService(db *gorm.DB) core.MessageService { } } -func (d *messageServant) CreateMessage(msg *model.Message) (*model.Message, error) { +func (d *messageServant) CreateMessage(msg *core.Message) (*core.Message, error) { return msg.Create(d.db) } func (d *messageServant) GetUnreadCount(userID int64) (int64, error) { - return (&model.Message{}).Count(d.db, &model.ConditionsT{ + return (&dbr.Message{}).Count(d.db, &dbr.ConditionsT{ "receiver_user_id": userID, - "is_read": model.MsgStatusUnread, + "is_read": dbr.MsgStatusUnread, }) } -func (d *messageServant) GetMessageByID(id int64) (*model.Message, error) { - return (&model.Message{ - Model: &model.Model{ +func (d *messageServant) GetMessageByID(id int64) (*core.Message, error) { + return (&dbr.Message{ + Model: &dbr.Model{ ID: id, }, }).Get(d.db) } -func (d *messageServant) ReadMessage(message *model.Message) error { +func (d *messageServant) ReadMessage(message *core.Message) error { message.IsRead = 1 return message.Update(d.db) } -func (d *messageServant) GetMessages(conditions *model.ConditionsT, offset, limit int) ([]*model.MessageFormated, error) { - messages, err := (&model.Message{}).List(d.db, conditions, offset, limit) +func (d *messageServant) GetMessages(conditions *core.ConditionsT, offset, limit int) ([]*core.MessageFormated, error) { + messages, err := (&dbr.Message{}).List(d.db, conditions, offset, limit) if err != nil { return nil, err } - mfs := []*model.MessageFormated{} + mfs := []*dbr.MessageFormated{} for _, message := range messages { mf := message.Format() mfs = append(mfs, mf) @@ -59,6 +63,6 @@ func (d *messageServant) GetMessages(conditions *model.ConditionsT, offset, limi return mfs, nil } -func (d *messageServant) GetMessageCount(conditions *model.ConditionsT) (int64, error) { - return (&model.Message{}).Count(d.db, conditions) +func (d *messageServant) GetMessageCount(conditions *core.ConditionsT) (int64, error) { + return (&dbr.Message{}).Count(d.db, conditions) } diff --git a/internal/dao/jinzhu/security.go b/internal/dao/jinzhu/security.go index dfbe2c74..69fc57d4 100644 --- a/internal/dao/jinzhu/security.go +++ b/internal/dao/jinzhu/security.go @@ -1,18 +1,16 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( - "errors" - "fmt" "math/rand" - "net/http" "strconv" "time" - "github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/pkg/json" - "gopkg.in/resty.v1" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) @@ -21,71 +19,46 @@ var ( ) type securityServant struct { - db *gorm.DB + db *gorm.DB + phoneVerify core.PhoneVerifyService } -func newSecurityService(db *gorm.DB) core.SecurityService { +func newSecurityService(db *gorm.DB, phoneVerify core.PhoneVerifyService) core.SecurityService { return &securityServant{ - db: db, + db: db, + phoneVerify: phoneVerify, } } -type juhePhoneCaptchaRsp struct { - ErrorCode int `json:"error_code"` - Reason string `json:"reason"` -} - -// 获取最新短信验证码 -func (s *securityServant) GetLatestPhoneCaptcha(phone string) (*model.Captcha, error) { - return (&model.Captcha{ +// GetLatestPhoneCaptcha 获取最新短信验证码 +func (s *securityServant) GetLatestPhoneCaptcha(phone string) (*core.Captcha, error) { + return (&dbr.Captcha{ Phone: phone, }).Get(s.db) } -// 更新短信验证码 -func (s *securityServant) UsePhoneCaptcha(captcha *model.Captcha) error { +// UsePhoneCaptcha 更新短信验证码 +func (s *securityServant) UsePhoneCaptcha(captcha *core.Captcha) error { captcha.UseTimes++ return captcha.Update(s.db) } -// 发送短信验证码 +// SendPhoneCaptcha 发送短信验证码 func (s *securityServant) SendPhoneCaptcha(phone string) error { - rand.Seed(time.Now().UnixNano()) - captcha := rand.Intn(900000) + 100000 - m := 5 - - client := resty.New() - client.DisableWarn = true - resp, err := client.R(). - SetFormData(map[string]string{ - "mobile": phone, - "tpl_id": conf.SmsJuheSetting.TplID, - "tpl_value": fmt.Sprintf(conf.SmsJuheSetting.TplVal, captcha, m), - "key": conf.SmsJuheSetting.Key, - }).Post(conf.SmsJuheSetting.Gateway) - if err != nil { - return err - } - - if resp.StatusCode() != http.StatusOK { - return errors.New(resp.Status()) - } + expire := time.Duration(5) - result := &juhePhoneCaptchaRsp{} - err = json.Unmarshal(resp.Body(), result) - if err != nil { + // 发送验证码 + rand.Seed(time.Now().UnixNano()) + captcha := strconv.Itoa(rand.Intn(900000) + 100000) + if err := s.phoneVerify.SendPhoneCaptcha(phone, captcha, expire); err != nil { return err } - if result.ErrorCode != 0 { - return errors.New(result.Reason) - } - // 写入表 - captchaModel := &model.Captcha{ + captchaModel := &dbr.Captcha{ Phone: phone, - Captcha: strconv.Itoa(captcha), - ExpiredOn: time.Now().Add(time.Minute * time.Duration(m)).Unix(), + Captcha: captcha, + ExpiredOn: time.Now().Add(expire * time.Minute).Unix(), } captchaModel.Create(s.db) return nil diff --git a/internal/dao/jinzhu/topics.go b/internal/dao/jinzhu/topics.go index 0524b71b..d5ce70a9 100644 --- a/internal/dao/jinzhu/topics.go +++ b/internal/dao/jinzhu/topics.go @@ -1,10 +1,14 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( "strings" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) @@ -22,28 +26,28 @@ func newTopicService(db *gorm.DB) core.TopicService { } } -func (s *topicServant) CreateTag(tag *model.Tag) (*model.Tag, error) { +func (s *topicServant) CreateTag(tag *core.Tag) (*core.Tag, error) { return createTag(s.db, tag) } -func (s *topicServant) DeleteTag(tag *model.Tag) error { +func (s *topicServant) DeleteTag(tag *core.Tag) error { return deleteTag(s.db, tag) } -func (s *topicServant) GetTags(conditions *model.ConditionsT, offset, limit int) ([]*model.Tag, error) { - return (&model.Tag{}).List(s.db, conditions, offset, limit) +func (s *topicServant) GetTags(conditions *core.ConditionsT, offset, limit int) ([]*core.Tag, error) { + return (&dbr.Tag{}).List(s.db, conditions, offset, limit) } -func (s *topicServant) GetTagsByKeyword(keyword string) ([]*model.Tag, error) { - tag := &model.Tag{} +func (s *topicServant) GetTagsByKeyword(keyword string) ([]*core.Tag, error) { + tag := &dbr.Tag{} keyword = "%" + strings.Trim(keyword, " ") + "%" if keyword == "%%" { - return tag.List(s.db, &model.ConditionsT{ + return tag.List(s.db, &dbr.ConditionsT{ "ORDER": "quote_num DESC", }, 0, 6) } else { - return tag.List(s.db, &model.ConditionsT{ + return tag.List(s.db, &dbr.ConditionsT{ "tag LIKE ?": keyword, "ORDER": "quote_num DESC", }, 0, 6) diff --git a/internal/dao/jinzhu/tweets.go b/internal/dao/jinzhu/tweets.go index 12e6f21c..186b7280 100644 --- a/internal/dao/jinzhu/tweets.go +++ b/internal/dao/jinzhu/tweets.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( @@ -5,7 +9,7 @@ import ( "time" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) @@ -48,7 +52,7 @@ func newTweetHelpService(db *gorm.DB) core.TweetHelpService { } // MergePosts post数据整合 -func (s *tweetHelpServant) MergePosts(posts []*model.Post) ([]*model.PostFormated, error) { +func (s *tweetHelpServant) MergePosts(posts []*core.Post) ([]*core.PostFormated, error) { postIds := make([]int64, 0, len(posts)) userIds := make([]int64, 0, len(posts)) for _, post := range posts { @@ -66,18 +70,18 @@ func (s *tweetHelpServant) MergePosts(posts []*model.Post) ([]*model.PostFormate return nil, err } - userMap := make(map[int64]*model.UserFormated, len(users)) + userMap := make(map[int64]*dbr.UserFormated, len(users)) for _, user := range users { userMap[user.ID] = user.Format() } - contentMap := make(map[int64][]*model.PostContentFormated, len(postContents)) + contentMap := make(map[int64][]*dbr.PostContentFormated, len(postContents)) for _, content := range postContents { contentMap[content.PostID] = append(contentMap[content.PostID], content.Format()) } // 数据整合 - postsFormated := make([]*model.PostFormated, 0, len(posts)) + postsFormated := make([]*dbr.PostFormated, 0, len(posts)) for _, post := range posts { postFormated := post.Format() postFormated.User = userMap[post.UserID] @@ -88,7 +92,7 @@ func (s *tweetHelpServant) MergePosts(posts []*model.Post) ([]*model.PostFormate } // RevampPosts post数据整形修复 -func (s *tweetHelpServant) RevampPosts(posts []*model.PostFormated) ([]*model.PostFormated, error) { +func (s *tweetHelpServant) RevampPosts(posts []*core.PostFormated) ([]*core.PostFormated, error) { postIds := make([]int64, 0, len(posts)) userIds := make([]int64, 0, len(posts)) for _, post := range posts { @@ -106,12 +110,12 @@ func (s *tweetHelpServant) RevampPosts(posts []*model.PostFormated) ([]*model.Po return nil, err } - userMap := make(map[int64]*model.UserFormated, len(users)) + userMap := make(map[int64]*dbr.UserFormated, len(users)) for _, user := range users { userMap[user.ID] = user.Format() } - contentMap := make(map[int64][]*model.PostContentFormated, len(postContents)) + contentMap := make(map[int64][]*dbr.PostContentFormated, len(postContents)) for _, content := range postContents { contentMap[content.PostID] = append(contentMap[content.PostID], content.Format()) } @@ -124,23 +128,23 @@ func (s *tweetHelpServant) RevampPosts(posts []*model.PostFormated) ([]*model.Po return posts, nil } -func (s *tweetHelpServant) getPostContentsByIDs(ids []int64) ([]*model.PostContent, error) { - return (&model.PostContent{}).List(s.db, &model.ConditionsT{ +func (s *tweetHelpServant) getPostContentsByIDs(ids []int64) ([]*dbr.PostContent, error) { + return (&dbr.PostContent{}).List(s.db, &dbr.ConditionsT{ "post_id IN ?": ids, "ORDER": "sort ASC", }, 0, 0) } -func (s *tweetHelpServant) getUsersByIDs(ids []int64) ([]*model.User, error) { - user := &model.User{} +func (s *tweetHelpServant) getUsersByIDs(ids []int64) ([]*dbr.User, error) { + user := &dbr.User{} - return user.List(s.db, &model.ConditionsT{ + return user.List(s.db, &dbr.ConditionsT{ "id IN ?": ids, }, 0, 0) } -func (s *tweetManageServant) CreatePostCollection(postID, userID int64) (*model.PostCollection, error) { - collection := &model.PostCollection{ +func (s *tweetManageServant) CreatePostCollection(postID, userID int64) (*core.PostCollection, error) { + collection := &dbr.PostCollection{ PostID: postID, UserID: userID, } @@ -148,19 +152,19 @@ func (s *tweetManageServant) CreatePostCollection(postID, userID int64) (*model. return collection.Create(s.db) } -func (s *tweetManageServant) DeletePostCollection(p *model.PostCollection) error { +func (s *tweetManageServant) DeletePostCollection(p *core.PostCollection) error { return p.Delete(s.db) } -func (s *tweetManageServant) CreatePostContent(content *model.PostContent) (*model.PostContent, error) { +func (s *tweetManageServant) CreatePostContent(content *core.PostContent) (*core.PostContent, error) { return content.Create(s.db) } -func (s *tweetManageServant) CreateAttachment(attachment *model.Attachment) (*model.Attachment, error) { +func (s *tweetManageServant) CreateAttachment(attachment *core.Attachment) (*core.Attachment, error) { return attachment.Create(s.db) } -func (s *tweetManageServant) CreatePost(post *model.Post) (*model.Post, error) { +func (s *tweetManageServant) CreatePost(post *core.Post) (*core.Post, error) { post.LatestRepliedOn = time.Now().Unix() p, err := post.Create(s.db) if err != nil { @@ -170,11 +174,11 @@ func (s *tweetManageServant) CreatePost(post *model.Post) (*model.Post, error) { return p, nil } -func (s *tweetManageServant) DeletePost(post *model.Post) ([]string, error) { +func (s *tweetManageServant) DeletePost(post *core.Post) ([]string, error) { var mediaContents []string postId := post.ID - postContent := &model.PostContent{} + postContent := &dbr.PostContent{} err := s.db.Transaction( func(tx *gorm.DB) error { if contents, err := postContent.MediaContentsByPostId(tx, postId); err == nil { @@ -218,8 +222,8 @@ func (s *tweetManageServant) DeletePost(post *model.Post) ([]string, error) { } func (s *tweetManageServant) deleteCommentByPostId(db *gorm.DB, postId int64) ([]string, error) { - comment := &model.Comment{} - commentContent := &model.CommentContent{} + comment := &dbr.Comment{} + commentContent := &dbr.CommentContent{} // 获取推文的所有评论id commentIds, err := comment.CommentIdsByPostId(db, postId) @@ -244,19 +248,19 @@ func (s *tweetManageServant) deleteCommentByPostId(db *gorm.DB, postId int64) ([ } // 删评论的评论 - if err = (&model.CommentReply{}).DeleteByCommentIds(db, commentIds); err != nil { + if err = (&dbr.CommentReply{}).DeleteByCommentIds(db, commentIds); err != nil { return nil, err } return mediaContents, nil } -func (s *tweetManageServant) LockPost(post *model.Post) error { +func (s *tweetManageServant) LockPost(post *core.Post) error { post.IsLock = 1 - post.IsLock return post.Update(s.db) } -func (s *tweetManageServant) StickPost(post *model.Post) error { +func (s *tweetManageServant) StickPost(post *core.Post) error { post.IsTop = 1 - post.IsTop if err := post.Update(s.db); err != nil { return err @@ -265,7 +269,7 @@ func (s *tweetManageServant) StickPost(post *model.Post) error { return nil } -func (s *tweetManageServant) VisiblePost(post *model.Post, visibility model.PostVisibleT) error { +func (s *tweetManageServant) VisiblePost(post *core.Post, visibility core.PostVisibleT) error { oldVisibility := post.Visibility post.Visibility = visibility // TODO: 这个判断是否可以不要呢 @@ -273,7 +277,7 @@ func (s *tweetManageServant) VisiblePost(post *model.Post, visibility model.Post return nil } // 私密推文 特殊处理 - if visibility == model.PostVisitPrivate { + if visibility == dbr.PostVisitPrivate { // 强制取消置顶 // TODO: 置顶推文用户是否有权设置成私密? 后续完善 post.IsTop = 0 @@ -288,14 +292,14 @@ func (s *tweetManageServant) VisiblePost(post *model.Post, visibility model.Post // tag处理 tags := strings.Split(post.Tags, ",") for _, t := range tags { - tag := &model.Tag{ + tag := &dbr.Tag{ Tag: t, } // TODO: 暂时宽松不处理错误,这里或许可以有优化,后续完善 - if oldVisibility == model.PostVisitPrivate { + if oldVisibility == dbr.PostVisitPrivate { // 从私密转为非私密才需要重新创建tag createTag(db, tag) - } else if visibility == model.PostVisitPrivate { + } else if visibility == dbr.PostVisitPrivate { // 从非私密转为私密才需要删除tag deleteTag(db, tag) } @@ -305,7 +309,7 @@ func (s *tweetManageServant) VisiblePost(post *model.Post, visibility model.Post return nil } -func (s *tweetManageServant) UpdatePost(post *model.Post) error { +func (s *tweetManageServant) UpdatePost(post *core.Post) error { if err := post.Update(s.db); err != nil { return err } @@ -313,104 +317,104 @@ func (s *tweetManageServant) UpdatePost(post *model.Post) error { return nil } -func (s *tweetManageServant) CreatePostStar(postID, userID int64) (*model.PostStar, error) { - star := &model.PostStar{ +func (s *tweetManageServant) CreatePostStar(postID, userID int64) (*core.PostStar, error) { + star := &dbr.PostStar{ PostID: postID, UserID: userID, } return star.Create(s.db) } -func (s *tweetManageServant) DeletePostStar(p *model.PostStar) error { +func (s *tweetManageServant) DeletePostStar(p *core.PostStar) error { return p.Delete(s.db) } -func (s *tweetServant) GetPostByID(id int64) (*model.Post, error) { - post := &model.Post{ - Model: &model.Model{ +func (s *tweetServant) GetPostByID(id int64) (*core.Post, error) { + post := &dbr.Post{ + Model: &dbr.Model{ ID: id, }, } return post.Get(s.db) } -func (s *tweetServant) GetPosts(conditions *model.ConditionsT, offset, limit int) ([]*model.Post, error) { - return (&model.Post{}).List(s.db, conditions, offset, limit) +func (s *tweetServant) GetPosts(conditions *core.ConditionsT, offset, limit int) ([]*core.Post, error) { + return (&dbr.Post{}).List(s.db, conditions, offset, limit) } -func (s *tweetServant) GetPostCount(conditions *model.ConditionsT) (int64, error) { - return (&model.Post{}).Count(s.db, conditions) +func (s *tweetServant) GetPostCount(conditions *core.ConditionsT) (int64, error) { + return (&dbr.Post{}).Count(s.db, conditions) } -func (s *tweetServant) GetUserPostStar(postID, userID int64) (*model.PostStar, error) { - star := &model.PostStar{ +func (s *tweetServant) GetUserPostStar(postID, userID int64) (*core.PostStar, error) { + star := &dbr.PostStar{ PostID: postID, UserID: userID, } return star.Get(s.db) } -func (s *tweetServant) GetUserPostStars(userID int64, offset, limit int) ([]*model.PostStar, error) { - star := &model.PostStar{ +func (s *tweetServant) GetUserPostStars(userID int64, offset, limit int) ([]*core.PostStar, error) { + star := &dbr.PostStar{ UserID: userID, } - return star.List(s.db, &model.ConditionsT{ + return star.List(s.db, &dbr.ConditionsT{ "ORDER": s.db.NamingStrategy.TableName("PostStar") + ".id DESC", }, offset, limit) } func (s *tweetServant) GetUserPostStarCount(userID int64) (int64, error) { - star := &model.PostStar{ + star := &dbr.PostStar{ UserID: userID, } - return star.Count(s.db, &model.ConditionsT{}) + return star.Count(s.db, &dbr.ConditionsT{}) } -func (s *tweetServant) GetUserPostCollection(postID, userID int64) (*model.PostCollection, error) { - star := &model.PostCollection{ +func (s *tweetServant) GetUserPostCollection(postID, userID int64) (*core.PostCollection, error) { + star := &dbr.PostCollection{ PostID: postID, UserID: userID, } return star.Get(s.db) } -func (s *tweetServant) GetUserPostCollections(userID int64, offset, limit int) ([]*model.PostCollection, error) { - collection := &model.PostCollection{ +func (s *tweetServant) GetUserPostCollections(userID int64, offset, limit int) ([]*core.PostCollection, error) { + collection := &dbr.PostCollection{ UserID: userID, } - return collection.List(s.db, &model.ConditionsT{ + return collection.List(s.db, &dbr.ConditionsT{ "ORDER": s.db.NamingStrategy.TableName("PostCollection") + ".id DESC", }, offset, limit) } func (s *tweetServant) GetUserPostCollectionCount(userID int64) (int64, error) { - collection := &model.PostCollection{ + collection := &dbr.PostCollection{ UserID: userID, } - return collection.Count(s.db, &model.ConditionsT{}) + return collection.Count(s.db, &dbr.ConditionsT{}) } -func (s *tweetServant) GetUserWalletBills(userID int64, offset, limit int) ([]*model.WalletStatement, error) { - statement := &model.WalletStatement{ +func (s *tweetServant) GetUserWalletBills(userID int64, offset, limit int) ([]*core.WalletStatement, error) { + statement := &dbr.WalletStatement{ UserID: userID, } - return statement.List(s.db, &model.ConditionsT{ + return statement.List(s.db, &dbr.ConditionsT{ "ORDER": "id DESC", }, offset, limit) } func (s *tweetServant) GetUserWalletBillCount(userID int64) (int64, error) { - statement := &model.WalletStatement{ + statement := &dbr.WalletStatement{ UserID: userID, } - return statement.Count(s.db, &model.ConditionsT{}) + return statement.Count(s.db, &dbr.ConditionsT{}) } -func (s *tweetServant) GetPostAttatchmentBill(postID, userID int64) (*model.PostAttachmentBill, error) { - bill := &model.PostAttachmentBill{ +func (s *tweetServant) GetPostAttatchmentBill(postID, userID int64) (*core.PostAttachmentBill, error) { + bill := &dbr.PostAttachmentBill{ PostID: postID, UserID: userID, } @@ -418,16 +422,16 @@ func (s *tweetServant) GetPostAttatchmentBill(postID, userID int64) (*model.Post return bill.Get(s.db) } -func (s *tweetServant) GetPostContentsByIDs(ids []int64) ([]*model.PostContent, error) { - return (&model.PostContent{}).List(s.db, &model.ConditionsT{ +func (s *tweetServant) GetPostContentsByIDs(ids []int64) ([]*core.PostContent, error) { + return (&dbr.PostContent{}).List(s.db, &dbr.ConditionsT{ "post_id IN ?": ids, "ORDER": "sort ASC", }, 0, 0) } -func (s *tweetServant) GetPostContentByID(id int64) (*model.PostContent, error) { - return (&model.PostContent{ - Model: &model.Model{ +func (s *tweetServant) GetPostContentByID(id int64) (*core.PostContent, error) { + return (&dbr.PostContent{ + Model: &dbr.Model{ ID: id, }, }).Get(s.db) diff --git a/internal/dao/jinzhu/user.go b/internal/dao/jinzhu/user.go index e1380f00..96d09fc1 100644 --- a/internal/dao/jinzhu/user.go +++ b/internal/dao/jinzhu/user.go @@ -1,10 +1,14 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( "strings" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) @@ -22,69 +26,69 @@ func newUserManageService(db *gorm.DB) core.UserManageService { } } -func (s *userManageServant) GetUserByID(id int64) (*model.User, error) { - user := &model.User{ - Model: &model.Model{ +func (s *userManageServant) GetUserByID(id int64) (*core.User, error) { + user := &dbr.User{ + Model: &dbr.Model{ ID: id, }, } return user.Get(s.db) } -func (s *userManageServant) GetUserByUsername(username string) (*model.User, error) { - user := &model.User{ +func (s *userManageServant) GetUserByUsername(username string) (*core.User, error) { + user := &dbr.User{ Username: username, } return user.Get(s.db) } -func (s *userManageServant) GetUserByPhone(phone string) (*model.User, error) { - user := &model.User{ +func (s *userManageServant) GetUserByPhone(phone string) (*core.User, error) { + user := &dbr.User{ Phone: phone, } return user.Get(s.db) } -func (s *userManageServant) GetUsersByIDs(ids []int64) ([]*model.User, error) { - user := &model.User{} - return user.List(s.db, &model.ConditionsT{ +func (s *userManageServant) GetUsersByIDs(ids []int64) ([]*core.User, error) { + user := &dbr.User{} + return user.List(s.db, &dbr.ConditionsT{ "id IN ?": ids, }, 0, 0) } -func (s *userManageServant) GetUsersByKeyword(keyword string) ([]*model.User, error) { - user := &model.User{} +func (s *userManageServant) GetUsersByKeyword(keyword string) ([]*core.User, error) { + user := &dbr.User{} keyword = strings.Trim(keyword, " ") + "%" if keyword == "%" { - return user.List(s.db, &model.ConditionsT{ + return user.List(s.db, &dbr.ConditionsT{ "ORDER": "id ASC", }, 0, 6) } else { - return user.List(s.db, &model.ConditionsT{ + return user.List(s.db, &dbr.ConditionsT{ "username LIKE ?": keyword, }, 0, 6) } } -func (s *userManageServant) GetTagsByKeyword(keyword string) ([]*model.Tag, error) { - tag := &model.Tag{} +func (s *userManageServant) GetTagsByKeyword(keyword string) ([]*core.Tag, error) { + tag := &dbr.Tag{} keyword = "%" + strings.Trim(keyword, " ") + "%" if keyword == "%%" { - return tag.List(s.db, &model.ConditionsT{ + return tag.List(s.db, &dbr.ConditionsT{ "ORDER": "quote_num DESC", }, 0, 6) } else { - return tag.List(s.db, &model.ConditionsT{ + return tag.List(s.db, &dbr.ConditionsT{ "tag LIKE ?": keyword, "ORDER": "quote_num DESC", }, 0, 6) } } -func (s *userManageServant) CreateUser(user *model.User) (*model.User, error) { +func (s *userManageServant) CreateUser(user *dbr.User) (*core.User, error) { return user.Create(s.db) } -func (s *userManageServant) UpdateUser(user *model.User) error { +func (s *userManageServant) UpdateUser(user *core.User) error { return user.Update(s.db) } diff --git a/internal/dao/jinzhu/utils.go b/internal/dao/jinzhu/utils.go index 8c866027..27766397 100644 --- a/internal/dao/jinzhu/utils.go +++ b/internal/dao/jinzhu/utils.go @@ -1,11 +1,15 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) -func createTag(db *gorm.DB, tag *model.Tag) (*model.Tag, error) { +func createTag(db *gorm.DB, tag *dbr.Tag) (*dbr.Tag, error) { t, err := tag.Get(db) if err != nil { tag.QuoteNum = 1 @@ -23,7 +27,7 @@ func createTag(db *gorm.DB, tag *model.Tag) (*model.Tag, error) { return t, nil } -func deleteTag(db *gorm.DB, tag *model.Tag) error { +func deleteTag(db *gorm.DB, tag *dbr.Tag) error { tag, err := tag.Get(db) if err != nil { return err @@ -33,7 +37,7 @@ func deleteTag(db *gorm.DB, tag *model.Tag) error { } func deleteTags(db *gorm.DB, tags []string) error { - allTags, err := (&model.Tag{}).TagsFrom(db, tags) + allTags, err := (&dbr.Tag{}).TagsFrom(db, tags) if err != nil { return err } @@ -51,9 +55,9 @@ func deleteTags(db *gorm.DB, tags []string) error { } // 根据IDs获取用户列表 -func getUsersByIDs(db *gorm.DB, ids []int64) ([]*model.User, error) { - user := &model.User{} - return user.List(db, &model.ConditionsT{ +func getUsersByIDs(db *gorm.DB, ids []int64) ([]*dbr.User, error) { + user := &dbr.User{} + return user.List(db, &dbr.ConditionsT{ "id IN ?": ids, }, 0, 0) } diff --git a/internal/dao/jinzhu/wallet.go b/internal/dao/jinzhu/wallet.go index 3b4f9ea1..7b2023d7 100644 --- a/internal/dao/jinzhu/wallet.go +++ b/internal/dao/jinzhu/wallet.go @@ -1,9 +1,13 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package jinzhu import ( "github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr" "gorm.io/gorm" ) @@ -21,17 +25,17 @@ func newWalletService(db *gorm.DB) core.WalletService { } } -func (d *walletServant) GetRechargeByID(id int64) (*model.WalletRecharge, error) { - recharge := &model.WalletRecharge{ - Model: &model.Model{ +func (d *walletServant) GetRechargeByID(id int64) (*core.WalletRecharge, error) { + recharge := &dbr.WalletRecharge{ + Model: &dbr.Model{ ID: id, }, } return recharge.Get(d.db) } -func (d *walletServant) CreateRecharge(userId, amount int64) (*model.WalletRecharge, error) { - recharge := &model.WalletRecharge{ +func (d *walletServant) CreateRecharge(userId, amount int64) (*core.WalletRecharge, error) { + recharge := &dbr.WalletRecharge{ UserID: userId, Amount: amount, } @@ -39,26 +43,26 @@ func (d *walletServant) CreateRecharge(userId, amount int64) (*model.WalletRecha return recharge.Create(d.db) } -func (d *walletServant) GetUserWalletBills(userID int64, offset, limit int) ([]*model.WalletStatement, error) { - statement := &model.WalletStatement{ +func (d *walletServant) GetUserWalletBills(userID int64, offset, limit int) ([]*core.WalletStatement, error) { + statement := &dbr.WalletStatement{ UserID: userID, } - return statement.List(d.db, &model.ConditionsT{ + return statement.List(d.db, &dbr.ConditionsT{ "ORDER": "id DESC", }, offset, limit) } func (d *walletServant) GetUserWalletBillCount(userID int64) (int64, error) { - statement := &model.WalletStatement{ + statement := &dbr.WalletStatement{ UserID: userID, } - return statement.Count(d.db, &model.ConditionsT{}) + return statement.Count(d.db, &dbr.ConditionsT{}) } -func (d *walletServant) HandleRechargeSuccess(recharge *model.WalletRecharge, tradeNo string) error { - user, _ := (&model.User{ - Model: &model.Model{ +func (d *walletServant) HandleRechargeSuccess(recharge *core.WalletRecharge, tradeNo string) error { + user, _ := (&dbr.User{ + Model: &dbr.Model{ ID: recharge.UserID, }, }).Get(d.db) @@ -71,7 +75,7 @@ func (d *walletServant) HandleRechargeSuccess(recharge *model.WalletRecharge, tr } // 新增账单 - if err := tx.Create(&model.WalletStatement{ + if err := tx.Create(&dbr.WalletStatement{ UserID: user.ID, ChangeAmount: recharge.Amount, BalanceSnapshot: user.Balance + recharge.Amount, @@ -93,7 +97,7 @@ func (d *walletServant) HandleRechargeSuccess(recharge *model.WalletRecharge, tr }) } -func (d *walletServant) HandlePostAttachmentBought(post *model.Post, user *model.User) error { +func (d *walletServant) HandlePostAttachmentBought(post *core.Post, user *core.User) error { return d.db.Transaction(func(tx *gorm.DB) error { // 扣除金额 if err := tx.Model(user).Update("balance", gorm.Expr("balance - ?", post.AttachmentPrice)).Error; err != nil { @@ -102,7 +106,7 @@ func (d *walletServant) HandlePostAttachmentBought(post *model.Post, user *model } // 新增账单 - if err := tx.Create(&model.WalletStatement{ + if err := tx.Create(&dbr.WalletStatement{ PostID: post.ID, UserID: user.ID, ChangeAmount: -post.AttachmentPrice, @@ -113,7 +117,7 @@ func (d *walletServant) HandlePostAttachmentBought(post *model.Post, user *model } // 新增附件购买记录 - if err := tx.Create(&model.PostAttachmentBill{ + if err := tx.Create(&dbr.PostAttachmentBill{ PostID: post.ID, UserID: user.ID, PaidAmount: post.AttachmentPrice, @@ -124,8 +128,8 @@ func (d *walletServant) HandlePostAttachmentBought(post *model.Post, user *model // 对附件主新增账单 income := int64(float64(post.AttachmentPrice) * conf.AppSetting.AttachmentIncomeRate) if income > 0 { - master := &model.User{ - Model: &model.Model{ + master := &dbr.User{ + Model: &dbr.Model{ ID: post.UserID, }, } @@ -137,7 +141,7 @@ func (d *walletServant) HandlePostAttachmentBought(post *model.Post, user *model } // 新增账单 - if err := tx.Create(&model.WalletStatement{ + if err := tx.Create(&dbr.WalletStatement{ PostID: post.ID, UserID: master.ID, ChangeAmount: income, diff --git a/internal/dao/sakila/sakila.go b/internal/dao/sakila/sakila.go index 6efdffa6..d82a0d23 100644 --- a/internal/dao/sakila/sakila.go +++ b/internal/dao/sakila/sakila.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + // Core service implement base sqlx+mysql. All sub-service // will declare here and provide initial function. diff --git a/internal/dao/search/bridge.go b/internal/dao/search/bridge.go index 84f469a5..f23aaa25 100644 --- a/internal/dao/search/bridge.go +++ b/internal/dao/search/bridge.go @@ -1,10 +1,13 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package search import ( "time" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" "github.com/sirupsen/logrus" ) @@ -43,7 +46,7 @@ func (s *bridgeTweetSearchServant) DeleteDocuments(identifiers []string) error { return nil } -func (s *bridgeTweetSearchServant) Search(user *model.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *bridgeTweetSearchServant) Search(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { return s.ts.Search(user, q, offset, limit) } diff --git a/internal/dao/search/filter.go b/internal/dao/search/filter.go index 229f2482..5840e189 100644 --- a/internal/dao/search/filter.go +++ b/internal/dao/search/filter.go @@ -1,8 +1,11 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package search import ( "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/pkg/types" ) @@ -10,19 +13,19 @@ type tweetSearchFilter struct { ams core.AuthorizationManageService } -func (s *tweetSearchFilter) filterResp(user *model.User, resp *core.QueryResp) { +func (s *tweetSearchFilter) filterResp(user *core.User, resp *core.QueryResp) { // 管理员不过滤 if user != nil && user.IsAdmin { return } - var item *model.PostFormated + var item *core.PostFormated items := resp.Items latestIndex := len(items) - 1 if user == nil { for i := 0; i <= latestIndex; i++ { item = items[i] - if item.Visibility != model.PostVisitPublic { + if item.Visibility != core.PostVisitPublic { items[i] = items[latestIndex] items = items[:latestIndex] resp.Total-- @@ -36,8 +39,8 @@ func (s *tweetSearchFilter) filterResp(user *model.User, resp *core.QueryResp) { friendFilter[user.ID] = types.Empty{} for i := 0; i <= latestIndex; i++ { item = items[i] - cutFriend = (item.Visibility == model.PostVisitFriend && !friendFilter.IsFriend(item.UserID)) - cutPrivate = (item.Visibility == model.PostVisitPrivate && user.ID != item.UserID) + cutFriend = (item.Visibility == core.PostVisitFriend && !friendFilter.IsFriend(item.UserID)) + cutPrivate = (item.Visibility == core.PostVisitPrivate && user.ID != item.UserID) if cutFriend || cutPrivate { items[i] = items[latestIndex] items = items[:latestIndex] diff --git a/internal/dao/search/meili.go b/internal/dao/search/meili.go index 321953ee..b2ee4d16 100644 --- a/internal/dao/search/meili.go +++ b/internal/dao/search/meili.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package search import ( @@ -7,7 +11,6 @@ import ( "github.com/Masterminds/semver/v3" "github.com/meilisearch/meilisearch-go" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/pkg/json" "github.com/sirupsen/logrus" ) @@ -28,20 +31,20 @@ type meiliTweetSearchServant struct { } type postInfo struct { - ID int64 `json:"id"` - UserID int64 `json:"user_id"` - CommentCount int64 `json:"comment_count"` - CollectionCount int64 `json:"collection_count"` - UpvoteCount int64 `json:"upvote_count"` - Visibility model.PostVisibleT `json:"visibility"` - IsTop int `json:"is_top"` - IsEssence int `json:"is_essence"` - IsLock int `json:"is_lock"` - LatestRepliedOn int64 `json:"latest_replied_on"` - CreatedOn int64 `json:"created_on"` - ModifiedOn int64 `json:"modified_on"` - AttachmentPrice int64 `json:"attachment_price"` - IPLoc string `json:"ip_loc"` + ID int64 `json:"id"` + UserID int64 `json:"user_id"` + CommentCount int64 `json:"comment_count"` + CollectionCount int64 `json:"collection_count"` + UpvoteCount int64 `json:"upvote_count"` + Visibility core.PostVisibleT `json:"visibility"` + IsTop int `json:"is_top"` + IsEssence int `json:"is_essence"` + IsLock int `json:"is_lock"` + LatestRepliedOn int64 `json:"latest_replied_on"` + CreatedOn int64 `json:"created_on"` + ModifiedOn int64 `json:"modified_on"` + AttachmentPrice int64 `json:"attachment_price"` + IPLoc string `json:"ip_loc"` } func (s *meiliTweetSearchServant) Name() string { @@ -78,7 +81,7 @@ func (s *meiliTweetSearchServant) DeleteDocuments(identifiers []string) error { return nil } -func (s *meiliTweetSearchServant) Search(user *model.User, q *core.QueryReq, offset, limit int) (resp *core.QueryResp, err error) { +func (s *meiliTweetSearchServant) Search(user *core.User, q *core.QueryReq, offset, limit int) (resp *core.QueryResp, err error) { if q.Type == core.SearchTypeDefault && q.Query != "" { resp, err = s.queryByContent(user, q, offset, limit) } else if q.Type == core.SearchTypeTag && q.Query != "" { @@ -96,7 +99,7 @@ func (s *meiliTweetSearchServant) Search(user *model.User, q *core.QueryReq, off return } -func (s *meiliTweetSearchServant) queryByContent(user *model.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *meiliTweetSearchServant) queryByContent(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { request := &meilisearch.SearchRequest{ Offset: int64(offset), Limit: int64(limit), @@ -117,7 +120,7 @@ func (s *meiliTweetSearchServant) queryByContent(user *model.User, q *core.Query return s.postsFrom(resp) } -func (s *meiliTweetSearchServant) queryByTag(user *model.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *meiliTweetSearchServant) queryByTag(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { request := &meilisearch.SearchRequest{ Offset: int64(offset), Limit: int64(limit), @@ -141,7 +144,7 @@ func (s *meiliTweetSearchServant) queryByTag(user *model.User, q *core.QueryReq, return s.postsFrom(resp) } -func (s *meiliTweetSearchServant) queryAny(user *model.User, offset, limit int) (*core.QueryResp, error) { +func (s *meiliTweetSearchServant) queryAny(user *core.User, offset, limit int) (*core.QueryResp, error) { request := &meilisearch.SearchRequest{ Offset: int64(offset), Limit: int64(limit), @@ -161,7 +164,7 @@ func (s *meiliTweetSearchServant) queryAny(user *model.User, offset, limit int) return s.postsFrom(resp) } -func (s *meiliTweetSearchServant) filterList(user *model.User) string { +func (s *meiliTweetSearchServant) filterList(user *core.User) string { if user == nil { return s.publicFilter } @@ -174,7 +177,7 @@ func (s *meiliTweetSearchServant) filterList(user *model.User) string { } func (s *meiliTweetSearchServant) postsFrom(resp *meilisearch.SearchResponse) (*core.QueryResp, error) { - posts := make([]*model.PostFormated, 0, len(resp.Hits)) + posts := make([]*core.PostFormated, 0, len(resp.Hits)) for _, hit := range resp.Hits { raw, err := json.Marshal(hit) if err != nil { @@ -184,7 +187,7 @@ func (s *meiliTweetSearchServant) postsFrom(resp *meilisearch.SearchResponse) (* if err = json.Unmarshal(raw, p); err != nil { return nil, err } - posts = append(posts, &model.PostFormated{ + posts = append(posts, &core.PostFormated{ ID: p.ID, UserID: p.UserID, CommentCount: p.CommentCount, diff --git a/internal/dao/search/search.go b/internal/dao/search/search.go index 1dda80ef..baf0923b 100644 --- a/internal/dao/search/search.go +++ b/internal/dao/search/search.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package search import ( @@ -6,7 +10,6 @@ import ( "github.com/meilisearch/meilisearch-go" "github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/pkg/zinc" "github.com/sirupsen/logrus" ) @@ -40,9 +43,9 @@ func NewMeiliTweetSearchService(ams core.AuthorizationManageService) (core.Tweet }, client: client, index: client.Index(s.Index), - publicFilter: fmt.Sprintf("visibility=%d", model.PostVisitPublic), - privateFilter: fmt.Sprintf("visibility=%d AND user_id=", model.PostVisitPrivate), - friendFilter: fmt.Sprintf("visibility=%d", model.PostVisitFriend), + publicFilter: fmt.Sprintf("visibility=%d", core.PostVisitPublic), + privateFilter: fmt.Sprintf("visibility=%d AND user_id=", core.PostVisitPrivate), + friendFilter: fmt.Sprintf("visibility=%d", core.PostVisitFriend), } return mts, mts } @@ -55,9 +58,9 @@ func NewZincTweetSearchService(ams core.AuthorizationManageService) (core.TweetS }, indexName: s.Index, client: zinc.NewClient(s), - publicFilter: fmt.Sprintf("visibility:%d", model.PostVisitPublic), - privateFilter: fmt.Sprintf("visibility:%d AND user_id:%%d", model.PostVisitPrivate), - friendFilter: fmt.Sprintf("visibility:%d", model.PostVisitFriend), + publicFilter: fmt.Sprintf("visibility:%d", core.PostVisitPublic), + privateFilter: fmt.Sprintf("visibility:%d AND user_id:%%d", core.PostVisitPrivate), + friendFilter: fmt.Sprintf("visibility:%d", core.PostVisitFriend), } zts.createIndex() diff --git a/internal/dao/search/zinc.go b/internal/dao/search/zinc.go index c038cb90..ea9a7fa5 100644 --- a/internal/dao/search/zinc.go +++ b/internal/dao/search/zinc.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package search import ( @@ -5,7 +9,6 @@ import ( "github.com/Masterminds/semver/v3" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/pkg/json" "github.com/rocboss/paopao-ce/pkg/zinc" "github.com/sirupsen/logrus" @@ -73,7 +76,7 @@ func (s *zincTweetSearchServant) DeleteDocuments(identifiers []string) error { return nil } -func (s *zincTweetSearchServant) Search(user *model.User, q *core.QueryReq, offset, limit int) (resp *core.QueryResp, err error) { +func (s *zincTweetSearchServant) Search(user *core.User, q *core.QueryReq, offset, limit int) (resp *core.QueryResp, err error) { if q.Type == core.SearchTypeDefault && q.Query != "" { resp, err = s.queryByContent(user, q, offset, limit) } else if q.Type == core.SearchTypeTag && q.Query != "" { @@ -91,7 +94,7 @@ func (s *zincTweetSearchServant) Search(user *model.User, q *core.QueryReq, offs return } -func (s *zincTweetSearchServant) queryByContent(user *model.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *zincTweetSearchServant) queryByContent(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { resp, err := s.client.EsQuery(s.indexName, map[string]any{ "query": map[string]any{ "match_phrase": map[string]any{ @@ -108,7 +111,7 @@ func (s *zincTweetSearchServant) queryByContent(user *model.User, q *core.QueryR return s.postsFrom(resp) } -func (s *zincTweetSearchServant) queryByTag(user *model.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { +func (s *zincTweetSearchServant) queryByTag(user *core.User, q *core.QueryReq, offset, limit int) (*core.QueryResp, error) { resp, err := s.client.ApiQuery(s.indexName, map[string]any{ "search_type": "querystring", "query": map[string]any{ @@ -124,7 +127,7 @@ func (s *zincTweetSearchServant) queryByTag(user *model.User, q *core.QueryReq, return s.postsFrom(resp) } -func (s *zincTweetSearchServant) queryAny(user *model.User, offset, limit int) (*core.QueryResp, error) { +func (s *zincTweetSearchServant) queryAny(user *core.User, offset, limit int) (*core.QueryResp, error) { queryMap := map[string]any{ "query": map[string]any{ "match_all": map[string]string{}, @@ -141,9 +144,9 @@ func (s *zincTweetSearchServant) queryAny(user *model.User, offset, limit int) ( } func (s *zincTweetSearchServant) postsFrom(resp *zinc.QueryResultT) (*core.QueryResp, error) { - posts := make([]*model.PostFormated, 0, len(resp.Hits.Hits)) + posts := make([]*core.PostFormated, 0, len(resp.Hits.Hits)) for _, hit := range resp.Hits.Hits { - item := &model.PostFormated{} + item := &core.PostFormated{} raw, err := json.Marshal(hit.Source) if err != nil { return nil, err diff --git a/internal/dao/security/attachment.go b/internal/dao/security/attachment_check.go similarity index 69% rename from internal/dao/security/attachment.go rename to internal/dao/security/attachment_check.go index 3bd79461..aa077aca 100644 --- a/internal/dao/security/attachment.go +++ b/internal/dao/security/attachment_check.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package security import ( @@ -8,6 +12,10 @@ import ( "github.com/rocboss/paopao-ce/internal/core" ) +var ( + _ core.AttachmentCheckService = (*attachmentCheckServant)(nil) +) + type attachmentCheckServant struct { domain string } diff --git a/internal/dao/security/phone_verify_juhe.go b/internal/dao/security/phone_verify_juhe.go new file mode 100644 index 00000000..5981c6c3 --- /dev/null +++ b/internal/dao/security/phone_verify_juhe.go @@ -0,0 +1,66 @@ +package security + +import ( + "errors" + "fmt" + "net/http" + "time" + + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/pkg/json" + "gopkg.in/resty.v1" +) + +var ( + _ core.PhoneVerifyService = (*juheSmsServant)(nil) +) + +type juhePhoneCaptchaRsp struct { + ErrorCode int `json:"error_code"` + Reason string `json:"reason"` +} + +type juheSmsServant struct { + gateway string + key string + tplID string + tplVal string +} + +// SendPhoneCaptcha 发送短信验证码 +func (s *juheSmsServant) SendPhoneCaptcha(phone string, captcha string, expire time.Duration) error { + client := resty.New() + client.DisableWarn = true + resp, err := client.R(). + SetFormData(map[string]string{ + "mobile": phone, + "tpl_id": s.tplID, + "tpl_value": fmt.Sprintf(s.tplVal, captcha, expire), + "key": s.key, + }).Post(s.gateway) + if err != nil { + return err + } + if resp.StatusCode() != http.StatusOK { + return errors.New(resp.Status()) + } + + result := &juhePhoneCaptchaRsp{} + if err = json.Unmarshal(resp.Body(), result); err != nil { + return err + } + if result.ErrorCode != 0 { + return errors.New(result.Reason) + } + return nil +} + +func newJuheSmsServant() *juheSmsServant { + return &juheSmsServant{ + gateway: conf.SmsJuheSetting.Gateway, + key: conf.SmsJuheSetting.Key, + tplID: conf.SmsJuheSetting.TplID, + tplVal: conf.SmsJuheSetting.TplVal, + } +} diff --git a/internal/dao/security/security.go b/internal/dao/security/security.go new file mode 100644 index 00000000..75cd003b --- /dev/null +++ b/internal/dao/security/security.go @@ -0,0 +1,18 @@ +package security + +import ( + "strings" + + "github.com/alimy/cfg" + "github.com/rocboss/paopao-ce/internal/core" +) + +func NewPhoneVerifyService() core.PhoneVerifyService { + smsVendor, _ := cfg.Val("sms") + switch strings.ToLower(smsVendor) { + case "smsjuhe": + return newJuheSmsServant() + default: + return newJuheSmsServant() + } +} diff --git a/internal/dao/slonik/slonik.go b/internal/dao/slonik/slonik.go index 8cfb49c3..bb8f82ad 100644 --- a/internal/dao/slonik/slonik.go +++ b/internal/dao/slonik/slonik.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + // Core service implement base sqlx+postgresql. All sub-service // will declare here and provide initial function. diff --git a/internal/dao/storage/alioss.go b/internal/dao/storage/alioss.go index 3519cba5..e72fa44c 100644 --- a/internal/dao/storage/alioss.go +++ b/internal/dao/storage/alioss.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package storage import ( diff --git a/internal/dao/storage/cos.go b/internal/dao/storage/cos.go index f7a7ebad..3c2ea65f 100644 --- a/internal/dao/storage/cos.go +++ b/internal/dao/storage/cos.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package storage import ( diff --git a/internal/dao/storage/huaweiobs.go b/internal/dao/storage/huaweiobs.go index 31656e6c..7db9818b 100644 --- a/internal/dao/storage/huaweiobs.go +++ b/internal/dao/storage/huaweiobs.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package storage import ( diff --git a/internal/dao/storage/localoss.go b/internal/dao/storage/localoss.go index f2ba55ab..584fea91 100644 --- a/internal/dao/storage/localoss.go +++ b/internal/dao/storage/localoss.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package storage import ( diff --git a/internal/dao/storage/minio.go b/internal/dao/storage/minio.go index b4da9fed..3859a5b7 100644 --- a/internal/dao/storage/minio.go +++ b/internal/dao/storage/minio.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package storage import ( diff --git a/internal/dao/storage/storage.go b/internal/dao/storage/storage.go index c25d2907..0f03fa20 100644 --- a/internal/dao/storage/storage.go +++ b/internal/dao/storage/storage.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package storage import ( diff --git a/internal/ims/README.md b/internal/ims/README.md new file mode 100644 index 00000000..d095421b --- /dev/null +++ b/internal/ims/README.md @@ -0,0 +1,2 @@ +### IMS(Instant Message Push System) +消息推送模块,用于优化@、私信、系统通知等消息服务,目前还没实现,先占个位置~ diff --git a/internal/ims/ims.go b/internal/ims/ims.go new file mode 100644 index 00000000..1042e45d --- /dev/null +++ b/internal/ims/ims.go @@ -0,0 +1,5 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package ims diff --git a/internal/internal.go b/internal/internal.go index 8d51c97a..a8c0934f 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -1,9 +1,13 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package internal import ( "github.com/rocboss/paopao-ce/internal/migration" - "github.com/rocboss/paopao-ce/internal/routers/api" - "github.com/rocboss/paopao-ce/internal/service" + "github.com/rocboss/paopao-ce/internal/servants/web/broker" + "github.com/rocboss/paopao-ce/internal/servants/web/routers/api" ) func Initialize() { @@ -11,6 +15,6 @@ func Initialize() { migration.Run() // initialize service - service.Initialize() + broker.Initialize() api.Initialize() } diff --git a/internal/migration/migration.go b/internal/migration/migration.go index 9563f803..1cac6012 100644 --- a/internal/migration/migration.go +++ b/internal/migration/migration.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build !migration // +build !migration diff --git a/internal/migration/migration_embed.go b/internal/migration/migration_embed.go index c6a0ae34..02ede293 100644 --- a/internal/migration/migration_embed.go +++ b/internal/migration/migration_embed.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build migration // +build migration diff --git a/internal/model/model.go b/internal/model/model.go index 99bc8296..12cc4fbb 100644 --- a/internal/model/model.go +++ b/internal/model/model.go @@ -1,36 +1,5 @@ -package model - -import ( - "time" - - "gorm.io/gorm" - "gorm.io/plugin/soft_delete" -) - -// Model 公共Model -type Model struct { - ID int64 `gorm:"primary_key" json:"id"` - CreatedOn int64 `json:"created_on"` - ModifiedOn int64 `json:"modified_on"` - DeletedOn int64 `json:"deleted_on"` - IsDel soft_delete.DeletedAt `gorm:"softDelete:flag" json:"is_del"` -} - -type ConditionsT map[string]any -type Predicates map[string][]any +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. -func (m *Model) BeforeCreate(tx *gorm.DB) (err error) { - nowTime := time.Now().Unix() - - tx.Statement.SetColumn("created_on", nowTime) - tx.Statement.SetColumn("modified_on", nowTime) - return -} - -func (m *Model) BeforeUpdate(tx *gorm.DB) (err error) { - if !tx.Statement.Changed("modified_on") { - tx.Statement.SetColumn("modified_on", time.Now().Unix()) - } - - return -} +package model diff --git a/internal/model/rest/contacts.go b/internal/model/rest/contacts.go deleted file mode 100644 index bbf31e42..00000000 --- a/internal/model/rest/contacts.go +++ /dev/null @@ -1,31 +0,0 @@ -package rest - -type RequestingFriendReq struct { - UserId int64 `json:"user_id" binding:"required"` - Greetings string `json:"greetings" binding:"required"` -} - -type AddFriendReq struct { - UserId int64 `json:"user_id" binding:"required"` -} - -type RejectFriendReq struct { - UserId int64 `json:"user_id" binding:"required"` -} - -type DeleteFriendReq struct { - UserId int64 `json:"user_id"` -} - -type ContactItem struct { - UserId int64 `json:"user_id"` - UserName string `json:"username"` - Nickname string `json:"nickname"` - Avatar string `json:"avatar"` - Phone string `json:"phone"` -} - -type ContactsResp struct { - Contacts []ContactItem `json:"contacts"` - Total int64 `json:"total"` -} diff --git a/internal/model/rest/tweets.go b/internal/model/rest/tweets.go deleted file mode 100644 index de85e179..00000000 --- a/internal/model/rest/tweets.go +++ /dev/null @@ -1,8 +0,0 @@ -package rest - -import "github.com/rocboss/paopao-ce/internal/model" - -type IndexTweetsResp struct { - Tweets []*model.PostFormated - Total int64 -} diff --git a/internal/model/rest/user.go b/internal/model/rest/user.go deleted file mode 100644 index 60ff467d..00000000 --- a/internal/model/rest/user.go +++ /dev/null @@ -1,11 +0,0 @@ -package rest - -type UserProfileResp struct { - ID int64 `json:"id"` - Nickname string `json:"nickname"` - Username string `json:"username"` - Status int `json:"status"` - Avatar string `json:"avatar"` - IsAdmin bool `json:"is_admin"` - IsFriend bool `json:"is_friend"` -} diff --git a/internal/model/web/admin.go b/internal/model/web/admin.go new file mode 100644 index 00000000..6b1980ca --- /dev/null +++ b/internal/model/web/admin.go @@ -0,0 +1,11 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +type ChangeUserStatusReq struct { + BaseInfo `json:"-" binding:"-"` + ID int64 `json:"id" form:"id" binding:"required"` + Status int `json:"status" form:"status" binding:"required,oneof=1 2"` +} diff --git a/internal/model/web/alipay.go b/internal/model/web/alipay.go new file mode 100644 index 00000000..84746309 --- /dev/null +++ b/internal/model/web/alipay.go @@ -0,0 +1,48 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "context" + + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/smartwalle/alipay/v3" +) + +type UserWalletBillsReq struct { + UserId int64 + Page int + PageSize int +} + +type UserWalletBillsResp base.PageResp + +type UserRechargeLinkReq struct { + BaseInfo `json:"-" form:"-" binding:"-"` + Host string `json:"-" form:"-" binding:"-"` + Amount int64 `json:"amount" form:"amount" binding:"required"` +} + +type UserRechargeLinkResp struct { + Id int64 `json:"id"` + Pay string `json:"pay"` +} + +type UserRechargeResultReq struct { + UserId int64 + Id int64 +} + +type UserRechargeResultResp struct { + Id int64 `json:"id"` + Status string `json:"status"` +} + +type AlipayNotifyReq struct { + Ctx context.Context + ID int64 + TradeNo string + TradeStatus alipay.TradeStatus +} diff --git a/internal/model/web/core.go b/internal/model/web/core.go new file mode 100644 index 00000000..c43a0905 --- /dev/null +++ b/internal/model/web/core.go @@ -0,0 +1,113 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/rocboss/paopao-ce/internal/servants/base" +) + +type ChangeAvatarReq struct { + BaseInfo `json:"-" binding:"-"` + Avatar string `json:"avatar" form:"avatar" binding:"required"` +} + +type SyncSearchIndexReq struct { + BaseInfo `json:"-" binding:"-"` +} + +type UserInfoReq struct { + BaseInfo `json:"-" binding:"-"` + Username string `json:"username" form:"username" binding:"required"` +} + +type UserInfoResp struct { + Id int64 `json:"id"` + Nickname string `json:"nickname"` + Username string `json:"username"` + Status int `json:"status"` + Avatar string `json:"avatar"` + Balance int64 `json:"balance"` + Phone string `json:"phone"` + IsAdmin bool `json:"is_admin"` +} + +type GetUnreadMsgCountReq struct { + SimpleInfo `json:"-" binding:"-"` +} + +type GetUnreadMsgCountResp struct { + Count int64 `json:"count"` +} + +type GetMessagesReq BasePageReq + +type GetMessagesResp base.PageResp + +type ReadMessageReq struct { + SimpleInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} +type SendWhisperReq struct { + SimpleInfo `json:"-" binding:"-"` + UserID int64 `json:"user_id" binding:"required"` + Content string `json:"content" binding:"required"` +} + +type GetCollectionsReq BasePageReq +type GetCollectionsResp base.PageResp + +type GetStarsReq BasePageReq +type GetStarsResp base.PageResp + +type UserPhoneBindReq struct { + BaseInfo `json:"-" binding:"-"` + Phone string `json:"phone" form:"phone" binding:"required"` + Captcha string `json:"captcha" form:"captcha" binding:"required"` +} + +type ChangePasswordReq struct { + BaseInfo `json:"-" binding:"-"` + Password string `json:"password" form:"password" binding:"required"` + OldPassword string `json:"old_password" form:"old_password" binding:"required"` +} + +type ChangeNicknameReq struct { + BaseInfo `json:"-" binding:"-"` + Nickname string `json:"nickname" form:"nickname" binding:"required"` +} + +type SuggestUsersReq struct { + Keyword string +} + +type SuggestUsersResp struct { + Suggests []string `json:"suggests"` +} + +type SuggestTagsReq struct { + Keyword string +} + +type SuggestTagsResp struct { + Suggests []string `json:"suggests"` +} + +type TweetStarStatusReq struct { + SimpleInfo `json:"-" binding:"-"` + TweetId int64 `form:"id"` +} + +type TweetStarStatusResp struct { + Status bool `json:"status"` +} + +type TweetCollectionStatusReq struct { + SimpleInfo `json:"-" binding:"-"` + TweetId int64 `form:"id"` +} + +type TweetCollectionStatusResp struct { + Status bool `json:"status"` +} diff --git a/internal/model/web/followship.go b/internal/model/web/followship.go new file mode 100644 index 00000000..aba69f72 --- /dev/null +++ b/internal/model/web/followship.go @@ -0,0 +1,27 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import "github.com/rocboss/paopao-ce/internal/servants/base" + +type AddFollowingReq struct { + BaseInfo `json:"-" binding:"-"` +} + +type DeleteFollowingReq struct { + BaseInfo `json:"-" binding:"-"` +} + +type ListFollowingsReq struct { + BaseInfo `json:"-" binding:"-"` +} + +type ListFollowingsResp base.PageResp + +type ListFollowersReq struct { + BaseInfo `form:"-" binding:"-"` +} + +type ListFollowersResp base.PageResp diff --git a/internal/model/web/friendship.go b/internal/model/web/friendship.go new file mode 100644 index 00000000..08f5fd27 --- /dev/null +++ b/internal/model/web/friendship.go @@ -0,0 +1,40 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import "github.com/rocboss/paopao-ce/internal/servants/base" + +type RequestingFriendReq struct { + BaseInfo `json:"-" binding:"-"` + UserId int64 `json:"user_id" binding:"required"` + Greetings string `json:"greetings" binding:"required"` +} + +type AddFriendReq struct { + BaseInfo `json:"-" binding:"-"` + UserId int64 `json:"user_id" binding:"required"` +} + +type RejectFriendReq struct { + BaseInfo `json:"-" binding:"-"` + UserId int64 `json:"user_id" binding:"required"` +} + +type DeleteFriendReq struct { + BaseInfo `json:"-" binding:"-"` + UserId int64 `json:"user_id"` +} + +type GetContactsReq struct { + BaseInfo `form:"-" binding:"-"` + Page int `form:"-" binding:"-"` + PageSize int `form:"-" binding:"-"` +} + +type GetContactsResp base.PageResp + +func (r *GetContactsReq) SetPageInfo(page int, pageSize int) { + r.Page, r.PageSize = page, pageSize +} diff --git a/internal/model/web/loose.go b/internal/model/web/loose.go new file mode 100644 index 00000000..e505e35b --- /dev/null +++ b/internal/model/web/loose.go @@ -0,0 +1,49 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/servants/base" +) + +type TimelineReq struct { + BaseInfo `form:"-" binding:"-"` + Query string `form:"query"` + Visibility []core.PostVisibleT `form:"query"` + Type string `form:"type"` + Page int `form:"-" binding:"-"` + PageSize int `form:"-" binding:"-"` +} + +type TimelineResp base.PageResp + +type GetUserTweetsReq struct { + BaseInfo `form:"-" binding:"-"` + Username string `form:"username" binding:"required"` + Page int `form:"-" binding:"-"` + PageSize int `form:"-" binding:"-"` +} + +type GetUserTweetsResp base.PageResp + +type GetUserProfileReq struct { + BaseInfo `form:"-" binding:"-"` + Username string `form:"username" binding:"required"` +} + +type GetUserProfileResp struct { + ID int64 `json:"id"` + Nickname string `json:"nickname"` + Username string `json:"username"` + Status int `json:"status"` + Avatar string `json:"avatar"` + IsAdmin bool `json:"is_admin"` + IsFriend bool `json:"is_friend"` +} + +func (r *GetUserTweetsReq) SetPageInfo(page int, pageSize int) { + r.Page, r.PageSize = page, pageSize +} diff --git a/internal/model/web/priv.go b/internal/model/web/priv.go new file mode 100644 index 00000000..0657a485 --- /dev/null +++ b/internal/model/web/priv.go @@ -0,0 +1,164 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "fmt" + "mime/multipart" + "strings" + + "github.com/rocboss/paopao-ce/internal/core" +) + +type PostContentItem struct { + Content string `json:"content" binding:"required"` + Type core.PostContentT `json:"type" binding:"required"` + Sort int64 `json:"sort" binding:"required"` +} + +type CreateTweetReq struct { + BaseInfo `json:"-" binding:"-"` + Contents []*PostContentItem `json:"contents" binding:"required"` + Tags []string `json:"tags" binding:"required"` + Users []string `json:"users" binding:"required"` + AttachmentPrice int64 `json:"attachment_price"` + Visibility core.PostVisibleT `json:"visibility"` + ClientIP string `json:"-" binding:"-"` +} + +type CreateTweetResp core.PostFormated + +type DeleteTweetReq struct { + BaseInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} + +type StarTweetReq struct { + SimpleInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} + +type StarTweetResp struct { + Status bool `json:"status"` +} + +type CollectionTweetReq struct { + SimpleInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} + +type CollectionTweetResp struct { + Status bool `json:"status"` +} + +type LockTweetReq struct { + BaseInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} + +type LockTweetResp struct { + LockStatus int `json:"lock_status"` +} + +type StickTweetReq struct { + BaseInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} + +type StickTweetResp struct { + StickStatus int `json:"top_status"` +} + +type VisiblePostReq struct { + BaseInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` + Visibility core.PostVisibleT `json:"visibility" binding:"required"` +} + +type VisiblePostResp struct { + Visibility core.PostVisibleT `json:"visibility"` +} + +type CreateCommentReq struct { + SimpleInfo `json:"-" binding:"-"` + PostID int64 `json:"post_id" binding:"required"` + Contents []*PostContentItem `json:"contents" binding:"required"` + Users []string `json:"users" binding:"required"` + ClientIP string `json:"-" binding:"-"` +} + +type CreateCommentResp core.Comment + +type CreateCommentReplyReq struct { + SimpleInfo `json:"-" binding:"-"` + CommentID int64 `json:"comment_id" binding:"required"` + Content string `json:"content" binding:"required"` + AtUserID int64 `json:"at_user_id"` + ClientIP string `json:"-" binding:"-"` +} + +type CreateCommentReplyResp core.CommentReply + +type DeleteCommentReq struct { + BaseInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} +type DeleteCommentReplyReq struct { + BaseInfo `json:"-" binding:"-"` + ID int64 `json:"id" binding:"required"` +} + +type UploadAttachmentReq struct { + SimpleInfo `json:"-" binding:"-"` + UploadType string + ContentType string + File multipart.File + FileSize int64 + FileExt string +} + +type UploadAttachmentResp struct { + UserID int64 `json:"user_id"` + FileSize int64 `json:"file_size"` + ImgWidth int `json:"img_width"` + ImgHeight int `json:"img_height"` + Type core.AttachmentType `json:"type"` + Content string `json:"content"` +} + +type DownloadAttachmentPrecheckReq struct { + BaseInfo `form:"-" binding:"-"` + ContentID int64 `form:"id"` +} + +type DownloadAttachmentPrecheckResp struct { + Paid bool `json:"paid"` +} + +type DownloadAttachmentReq struct { + BaseInfo `form:"-" binding:"-"` + ContentID int64 `form:"id"` +} + +type DownloadAttachmentResp struct { + SignedURL string `json:"signed_url"` +} + +// Check 检查PostContentItem属性 +func (p *PostContentItem) Check(acs core.AttachmentCheckService) error { + // 检查附件是否是本站资源 + if p.Type == core.ContentTypeImage || p.Type == core.ContentTypeVideo || p.Type == core.ContentTypeAttachment { + if err := acs.CheckAttachment(p.Content); err != nil { + return err + } + } + // 检查链接是否合法 + if p.Type == core.ContentTypeLink { + if strings.Index(p.Content, "http://") != 0 && strings.Index(p.Content, "https://") != 0 { + return fmt.Errorf("链接不合法") + } + } + return nil +} diff --git a/internal/model/web/pub.go b/internal/model/web/pub.go new file mode 100644 index 00000000..a951b33a --- /dev/null +++ b/internal/model/web/pub.go @@ -0,0 +1,77 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/pkg/debug" +) + +const ( + TagTypeHot TagType = "hot" + TagTypeNew TagType = "new" +) + +type TagType string + +type TweetDetailReq struct { + TweetId int64 `form:"id"` +} + +type TweetDetailResp core.PostFormated + +type TweetCommentsReq struct { + TweetId int64 `form:"id"` + Page int `form:"-"` + PageSize int `form:"-"` +} + +type TweetCommentsResp base.PageResp + +type TopicListReq struct { + Type TagType `json:"type" form:"type" binding:"required"` + Num int `json:"num" form:"num" binding:"required"` +} + +// TopicListResp 主题返回值 +// TODO: 优化内容定义 +type TopicListResp struct { + Topics []*core.TagFormated `json:"topics"` +} + +type GetCaptchaResp struct { + Id string `json:"id"` + Content string `json:"b64s"` +} + +type SendCaptchaReq struct { + Phone string `json:"phone" form:"phone" binding:"required"` + ImgCaptcha string `json:"img_captcha" form:"img_captcha" binding:"required"` + ImgCaptchaID string `json:"img_captcha_id" form:"img_captcha_id" binding:"required"` +} + +type VersionResp struct { + BuildInfo *debug.BuildInfo `json:"build_info"` +} + +type LoginReq struct { + Username string `json:"username" form:"username" binding:"required"` + Password string `json:"password" form:"password" binding:"required"` +} + +type LoginResp struct { + Token string `json:"token"` +} + +type RegisterReq struct { + Username string `json:"username" form:"username" binding:"required"` + Password string `json:"password" form:"password" binding:"required"` +} + +type RegisterResp struct { + UserId int64 `json:"id"` + Username string `json:"username"` +} diff --git a/internal/model/web/web.go b/internal/model/web/web.go new file mode 100644 index 00000000..bec917fa --- /dev/null +++ b/internal/model/web/web.go @@ -0,0 +1,49 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/pkg/app" + "github.com/rocboss/paopao-ce/pkg/xerror" +) + +type BaseInfo struct { + User *core.User +} + +type SimpleInfo struct { + Uid int64 +} + +type BasePageReq struct { + UserId int64 + Page int + PageSize int +} + +func (b *BaseInfo) SetUser(user *core.User) { + b.User = user +} + +func (s *SimpleInfo) SetUserId(id int64) { + s.Uid = id +} + +func BasePageReqFrom(c *gin.Context) (*BasePageReq, mir.Error) { + uid, ok := base.UserIdFrom(c) + if !ok { + return nil, xerror.UnauthorizedTokenError + } + page, pageSize := app.GetPageInfo(c) + return &BasePageReq{ + UserId: uid, + Page: page, + PageSize: pageSize, + }, nil +} diff --git a/internal/obs/README.md b/internal/obs/README.md new file mode 100644 index 00000000..f56a1ef9 --- /dev/null +++ b/internal/obs/README.md @@ -0,0 +1,2 @@ +### OBS(Object Blob Storage System) +简单对象存储模块,目前还没实现,先占个位置~ diff --git a/internal/obs/obs.go b/internal/obs/obs.go new file mode 100644 index 00000000..13923b07 --- /dev/null +++ b/internal/obs/obs.go @@ -0,0 +1,5 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package obs diff --git a/internal/servants/admin/admin.go b/internal/servants/admin/admin.go new file mode 100644 index 00000000..409bdd78 --- /dev/null +++ b/internal/servants/admin/admin.go @@ -0,0 +1,15 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package admin + +import ( + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/m/v1" +) + +// RouteWeb register Manager route +func RouteManager(e *gin.Engine) { + api.RegisterUserServant(e, newUserSrv(), newUserBinding(), newUserRender()) +} diff --git a/internal/servants/admin/user.go b/internal/servants/admin/user.go new file mode 100644 index 00000000..fef348cf --- /dev/null +++ b/internal/servants/admin/user.go @@ -0,0 +1,51 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package admin + +import ( + api "github.com/rocboss/paopao-ce/auto/api/m/v1" + "github.com/rocboss/paopao-ce/internal/servants/base" +) + +var ( + _ api.User = (*userSrv)(nil) + _ api.UserBinding = (*userBinding)(nil) + _ api.UserRender = (*userRender)(nil) +) + +type userSrv struct { + base.BaseServant + api.UnimplementedUserServant +} + +type userBinding struct { + base.BaseBinding + *api.UnimplementedUserBinding +} + +type userRender struct { + base.BaseRender + *api.UnimplementedUserRender +} + +func newUserSrv() api.User { + return &userSrv{} +} + +func newUserBinding() api.UserBinding { + return &userBinding{ + UnimplementedUserBinding: &api.UnimplementedUserBinding{ + BindAny: base.BindAny, + }, + } +} + +func newUserRender() api.UserRender { + return &userRender{ + UnimplementedUserRender: &api.UnimplementedUserRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/base/base.go b/internal/servants/base/base.go new file mode 100644 index 00000000..7cf2ffeb --- /dev/null +++ b/internal/servants/base/base.go @@ -0,0 +1,211 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package base + +import ( + "context" + "fmt" + "math" + "net/http" + "time" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/go-redis/redis/v8" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/pkg/app" + "github.com/rocboss/paopao-ce/pkg/types" + "github.com/rocboss/paopao-ce/pkg/xerror" +) + +type BaseServant struct { + // TODO +} + +type DaoServant struct { + Redis *redis.Client + Ds core.DataService + Ts core.TweetSearchService +} + +type BaseBinding types.Empty + +type BaseRender types.Empty + +type JsonResp struct { + Code int `json:"code"` + Msg string `json:"msg,omitempty"` + Data any `json:"data,omitempty"` +} + +type UserSetter interface { + SetUser(*core.User) +} + +type UserIdSetter interface { + SetUserId(int64) +} + +type PageInfoSetter interface { + SetPageInfo(page, pageSize int) +} + +func UserFrom(c *gin.Context) (*core.User, bool) { + if u, exists := c.Get("USER"); exists { + user, ok := u.(*core.User) + return user, ok + } + return nil, false +} + +func UserIdFrom(c *gin.Context) (int64, bool) { + if uid, exists := c.Get("UID"); exists { + v, ok := uid.(int64) + return v, ok + } + return -1, false +} + +func UserNameFrom(c *gin.Context) (string, bool) { + if username, exists := c.Get("USERNAME"); exists { + v, ok := username.(string) + return v, ok + } + return "", false +} + +func BindAny(c *gin.Context, obj any) mir.Error { + var errs xerror.ValidErrors + err := c.ShouldBind(obj) + if err != nil { + return mir.NewError(xerror.InvalidParams.StatusCode(), xerror.InvalidParams.WithDetails(errs.Error())) + } + // setup *core.User if needed + if setter, ok := obj.(UserSetter); ok { + user, _ := UserFrom(c) + setter.SetUser(user) + } + // setup UserId if needed + if setter, ok := obj.(UserIdSetter); ok { + uid, _ := UserIdFrom(c) + setter.SetUserId(uid) + } + // setup PageInfo if needed + if setter, ok := obj.(PageInfoSetter); ok { + page, pageSize := app.GetPageInfo(c) + setter.SetPageInfo(page, pageSize) + } + return nil +} + +func RenderAny(c *gin.Context, data any, err mir.Error) { + if err == nil { + c.JSON(http.StatusOK, &JsonResp{ + Code: 0, + Msg: "success", + Data: data, + }) + } else { + c.JSON(xerror.HttpStatusCode(err), &JsonResp{ + Code: err.StatusCode(), + Msg: err.Error(), + }) + } +} + +func (s *DaoServant) GetTweetBy(id int64) (*core.PostFormated, error) { + post, err := s.Ds.GetPostByID(id) + if err != nil { + return nil, err + } + postContents, err := s.Ds.GetPostContentsByIDs([]int64{post.ID}) + if err != nil { + return nil, err + } + users, err := s.Ds.GetUsersByIDs([]int64{post.UserID}) + if err != nil { + return nil, err + } + // 数据整合 + postFormated := post.Format() + for _, user := range users { + postFormated.User = user.Format() + } + for _, content := range postContents { + if content.PostID == post.ID { + postFormated.Contents = append(postFormated.Contents, content.Format()) + } + } + return postFormated, nil +} + +func (s *DaoServant) PushPostsToSearch(c context.Context) { + if ok, _ := s.Redis.SetNX(c, "JOB_PUSH_TO_SEARCH", 1, time.Hour).Result(); ok { + defer s.Redis.Del(c, "JOB_PUSH_TO_SEARCH") + + splitNum := 1000 + totalRows, _ := s.Ds.GetPostCount(&core.ConditionsT{ + "visibility IN ?": []core.PostVisibleT{core.PostVisitPublic, core.PostVisitFriend}, + }) + pages := math.Ceil(float64(totalRows) / float64(splitNum)) + nums := int(pages) + for i := 0; i < nums; i++ { + posts, postsFormated, err := s.GetTweetList(&core.ConditionsT{}, i*splitNum, splitNum) + if err != nil || len(posts) != len(postsFormated) { + continue + } + for i, pf := range postsFormated { + contentFormated := "" + for _, content := range pf.Contents { + if content.Type == core.ContentTypeText || content.Type == core.ContentTypeTitle { + contentFormated = contentFormated + content.Content + "\n" + } + } + docs := []core.TsDocItem{{ + Post: posts[i], + Content: contentFormated, + }} + s.Ts.AddDocuments(docs, fmt.Sprintf("%d", posts[i].ID)) + } + } + } +} + +func (s *DaoServant) PushPostToSearch(post *core.Post) { + postFormated := post.Format() + postFormated.User = &core.UserFormated{ + ID: post.UserID, + } + contents, _ := s.Ds.GetPostContentsByIDs([]int64{post.ID}) + for _, content := range contents { + postFormated.Contents = append(postFormated.Contents, content.Format()) + } + + contentFormated := "" + for _, content := range postFormated.Contents { + if content.Type == core.ContentTypeText || content.Type == core.ContentTypeTitle { + contentFormated = contentFormated + content.Content + "\n" + } + } + + docs := []core.TsDocItem{{ + Post: post, + Content: contentFormated, + }} + s.Ts.AddDocuments(docs, fmt.Sprintf("%d", post.ID)) +} + +func (s *DaoServant) DeleteSearchPost(post *core.Post) error { + return s.Ts.DeleteDocuments([]string{fmt.Sprintf("%d", post.ID)}) +} + +func (s *DaoServant) GetTweetList(conditions *core.ConditionsT, offset, limit int) ([]*core.Post, []*core.PostFormated, error) { + posts, err := s.Ds.GetPosts(conditions, offset, limit) + if err != nil { + return nil, nil, err + } + postFormated, err := s.Ds.MergePosts(posts) + return posts, postFormated, err +} diff --git a/internal/servants/base/page.go b/internal/servants/base/page.go new file mode 100644 index 00000000..6e3b4d05 --- /dev/null +++ b/internal/servants/base/page.go @@ -0,0 +1,27 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package base + +type Pager struct { + Page int `json:"page"` + PageSize int `json:"page_size"` + TotalRows int64 `json:"total_rows"` +} + +type PageResp struct { + List any `json:"list"` + Pager Pager `json:"pager"` +} + +func PageRespFrom(list any, page int, pageSize int, totalRows int64) *PageResp { + return &PageResp{ + List: list, + Pager: Pager{ + Page: page, + PageSize: pageSize, + TotalRows: totalRows, + }, + } +} diff --git a/internal/servants/bot/bot.go b/internal/servants/bot/bot.go new file mode 100644 index 00000000..a2e0e699 --- /dev/null +++ b/internal/servants/bot/bot.go @@ -0,0 +1,15 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package bot + +import ( + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/r/v1" +) + +// RouteBot register Bot route +func RouteBot(e *gin.Engine) { + api.RegisterUserServant(e, newUserSrv(), newUserBinding(), newUserRender()) +} diff --git a/internal/servants/bot/user.go b/internal/servants/bot/user.go new file mode 100644 index 00000000..aae9048c --- /dev/null +++ b/internal/servants/bot/user.go @@ -0,0 +1,51 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package bot + +import ( + api "github.com/rocboss/paopao-ce/auto/api/r/v1" + "github.com/rocboss/paopao-ce/internal/servants/base" +) + +var ( + _ api.User = (*userSrv)(nil) + _ api.UserBinding = (*userBinding)(nil) + _ api.UserRender = (*userRender)(nil) +) + +type userSrv struct { + base.BaseServant + api.UnimplementedUserServant +} + +type userBinding struct { + base.BaseBinding + *api.UnimplementedUserBinding +} + +type userRender struct { + base.BaseRender + *api.UnimplementedUserRender +} + +func newUserSrv() api.User { + return &userSrv{} +} + +func newUserBinding() api.UserBinding { + return &userBinding{ + UnimplementedUserBinding: &api.UnimplementedUserBinding{ + BindAny: base.BindAny, + }, + } +} + +func newUserRender() api.UserRender { + return &userRender{ + UnimplementedUserRender: &api.UnimplementedUserRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/middleware/admin.go b/internal/servants/chain/admin.go similarity index 53% rename from internal/middleware/admin.go rename to internal/servants/chain/admin.go index f81b00ee..35a0fbc3 100644 --- a/internal/middleware/admin.go +++ b/internal/servants/chain/admin.go @@ -1,8 +1,12 @@ -package middleware +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package chain import ( "github.com/gin-gonic/gin" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/errcode" ) @@ -10,8 +14,8 @@ import ( func Admin() gin.HandlerFunc { return func(c *gin.Context) { if user, exist := c.Get("USER"); exist { - if userModel, ok := user.(*model.User); ok { - if userModel.Status == model.UserStatusNormal && userModel.IsAdmin { + if userModel, ok := user.(*core.User); ok { + if userModel.Status == core.UserStatusNormal && userModel.IsAdmin { c.Next() return } diff --git a/internal/middleware/jwt.go b/internal/servants/chain/jwt.go similarity index 89% rename from internal/middleware/jwt.go rename to internal/servants/chain/jwt.go index 3fab7679..a0396630 100644 --- a/internal/middleware/jwt.go +++ b/internal/servants/chain/jwt.go @@ -1,4 +1,8 @@ -package middleware +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package chain import ( "strings" @@ -6,7 +10,7 @@ import ( "github.com/gin-gonic/gin" "github.com/golang-jwt/jwt/v4" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/errcode" ) @@ -51,8 +55,8 @@ func JWT() gin.HandlerFunc { c.Set("USERNAME", claims.Username) // 加载用户信息 - user := &model.User{ - Model: &model.Model{ + user := &core.User{ + Model: &core.Model{ ID: claims.UID, }, } @@ -97,8 +101,8 @@ func JwtLoose() gin.HandlerFunc { c.Set("UID", claims.UID) c.Set("USERNAME", claims.Username) // 加载用户信息 - user := &model.User{ - Model: &model.Model{ + user := &core.User{ + Model: &core.Model{ ID: claims.UID, }, } diff --git a/internal/middleware/priv.go b/internal/servants/chain/priv.go similarity index 68% rename from internal/middleware/priv.go rename to internal/servants/chain/priv.go index e479c6b1..6c09d0a8 100644 --- a/internal/middleware/priv.go +++ b/internal/servants/chain/priv.go @@ -1,9 +1,13 @@ -package middleware +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package chain import ( "github.com/alimy/cfg" "github.com/gin-gonic/gin" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/errcode" ) @@ -12,8 +16,8 @@ func Priv() gin.HandlerFunc { if cfg.If("PhoneBind") { return func(c *gin.Context) { if u, exist := c.Get("USER"); exist { - if user, ok := u.(*model.User); ok { - if user.Status == model.UserStatusNormal { + if user, ok := u.(*core.User); ok { + if user.Status == core.UserStatusNormal { if user.Phone == "" { response := app.NewResponse(c) response.ToErrorResponse(errcode.AccountNoPhoneBind) @@ -32,7 +36,7 @@ func Priv() gin.HandlerFunc { } else { return func(c *gin.Context) { if u, exist := c.Get("USER"); exist { - if user, ok := u.(*model.User); ok && user.Status == model.UserStatusNormal { + if user, ok := u.(*core.User); ok && user.Status == core.UserStatusNormal { c.Next() return } diff --git a/internal/servants/docs/docs.go b/internal/servants/docs/docs.go new file mode 100644 index 00000000..7b6c9d36 --- /dev/null +++ b/internal/servants/docs/docs.go @@ -0,0 +1,17 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +//go:build !docs +// +build !docs + +package docs + +import ( + "github.com/gin-gonic/gin" +) + +// RegisterDocs stub function for register docs asset route +func RegisterDocs(e *gin.Engine) { + // empty +} diff --git a/internal/servants/docs/docs_embed.go b/internal/servants/docs/docs_embed.go new file mode 100644 index 00000000..8879896c --- /dev/null +++ b/internal/servants/docs/docs_embed.go @@ -0,0 +1,21 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +//go:build docs +// +build docs + +package docs + +import ( + "github.com/alimy/cfg" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/docs/openapi" +) + +// RegisterDocs register docs asset route +func RegisterDocs(e *gin.Engine) { + cfg.Be("Docs:OpenAPI", func() { + e.StaticFS("/docs/openapi", openapi.NewFileSystem()) + }) +} diff --git a/internal/servants/localoss/localoss.go b/internal/servants/localoss/localoss.go new file mode 100644 index 00000000..97fdafbe --- /dev/null +++ b/internal/servants/localoss/localoss.go @@ -0,0 +1,30 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package localoss + +import ( + "path/filepath" + + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/s/v1" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/sirupsen/logrus" +) + +// RouteLocalOSS register LocalOSS route if needed +func RouteLocalOSS(e *gin.Engine) { + savePath, err := filepath.Abs(conf.LocalOSSSetting.SavePath) + if err != nil { + logrus.Fatalf("get localOSS save path err: %v", err) + } + e.Static("/oss", savePath) + + logrus.Infof("register LocalOSS route in /oss on save path: %s", savePath) +} + +// RouteLocaloss register LocalOSS route if needed +func RouteLocaloss(e *gin.Engine) { + api.RegisterUserServant(e, newUserSrv(), newUserBinding(), newUserRender()) +} diff --git a/internal/servants/localoss/user.go b/internal/servants/localoss/user.go new file mode 100644 index 00000000..37fc715e --- /dev/null +++ b/internal/servants/localoss/user.go @@ -0,0 +1,51 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package localoss + +import ( + api "github.com/rocboss/paopao-ce/auto/api/s/v1" + "github.com/rocboss/paopao-ce/internal/servants/base" +) + +var ( + _ api.User = (*userSrv)(nil) + _ api.UserBinding = (*userBinding)(nil) + _ api.UserRender = (*userRender)(nil) +) + +type userSrv struct { + base.BaseServant + api.UnimplementedUserServant +} + +type userBinding struct { + base.BaseBinding + *api.UnimplementedUserBinding +} + +type userRender struct { + base.BaseRender + *api.UnimplementedUserRender +} + +func newUserSrv() api.User { + return &userSrv{} +} + +func newUserBinding() api.UserBinding { + return &userBinding{ + UnimplementedUserBinding: &api.UnimplementedUserBinding{ + BindAny: base.BindAny, + }, + } +} + +func newUserRender() api.UserRender { + return &userRender{ + UnimplementedUserRender: &api.UnimplementedUserRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/mobile/auth.go b/internal/servants/mobile/auth.go new file mode 100644 index 00000000..7b66794c --- /dev/null +++ b/internal/servants/mobile/auth.go @@ -0,0 +1,21 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package mobile + +import ( + api "github.com/rocboss/paopao-ce/auto/rpc/v1" +) + +var ( + _ api.AuthenticateServer = (*authenticateServant)(nil) +) + +type authenticateServant struct { + api.UnimplementedAuthenticateServer +} + +func newAuthenticateServer() *authenticateServant { + return &authenticateServant{} +} diff --git a/internal/servants/mobile/mobile.go b/internal/servants/mobile/mobile.go new file mode 100644 index 00000000..5f9ed52c --- /dev/null +++ b/internal/servants/mobile/mobile.go @@ -0,0 +1,14 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package mobile + +import ( + api "github.com/rocboss/paopao-ce/auto/rpc/v1" + "google.golang.org/grpc" +) + +func RegisterServants(s *grpc.Server) { + api.RegisterAuthenticateServer(s, newAuthenticateServer()) +} diff --git a/internal/servants/servants.go b/internal/servants/servants.go new file mode 100644 index 00000000..e206ad08 --- /dev/null +++ b/internal/servants/servants.go @@ -0,0 +1,65 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package servants + +import ( + "github.com/alimy/cfg" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/servants/admin" + "github.com/rocboss/paopao-ce/internal/servants/bot" + "github.com/rocboss/paopao-ce/internal/servants/docs" + "github.com/rocboss/paopao-ce/internal/servants/localoss" + "github.com/rocboss/paopao-ce/internal/servants/mobile" + "github.com/rocboss/paopao-ce/internal/servants/space" + "github.com/rocboss/paopao-ce/internal/servants/statick" + "github.com/rocboss/paopao-ce/internal/servants/web" + "google.golang.org/grpc" +) + +// RegisterWebServants register all the servants to gin.Engine +func RegisterWebServants(e *gin.Engine) { + cfg.Be("Frontend:EmbedWeb", func() { + statick.RegisterWebStatick(e) + }) + cfg.Be("LocalOSS", func() { + localoss.RouteLocalOSS(e) + }) + web.RouteWeb(e) +} + +// RegisterAdminServants register all the servants to gin.Engine +func RegisterAdminServants(e *gin.Engine) { + admin.RouteManager(e) +} + +// RegisterSpaceXServants register all the servants to gin.Engine +func RegisterSpaceXServants(e *gin.Engine) { + space.RouteSpaceX(e) +} + +// RegisterBotServants register all the servants to gin.Engine +func RegisterBotServants(e *gin.Engine) { + bot.RouteBot(e) +} + +// RegisterLocalossServants register all the servants to gin.Engine +func RegisterLocalossServants(e *gin.Engine) { + localoss.RouteLocaloss(e) +} + +// RegisterDocsServants register all the servants to gin.Engine +func RegisterDocsServants(e *gin.Engine) { + docs.RegisterDocs(e) +} + +// RegisterFrontendWebServants register all the servants to gin.Engine +func RegisterFrontendWebServants(e *gin.Engine) { + statick.RegisterWebStatick(e) +} + +// RegisterMobileServants register all the servants to grpc.Server +func RegisterMobileServants(s *grpc.Server) { + mobile.RegisterServants(s) +} diff --git a/internal/servants/space/space.go b/internal/servants/space/space.go new file mode 100644 index 00000000..c9952035 --- /dev/null +++ b/internal/servants/space/space.go @@ -0,0 +1,15 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package space + +import ( + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/x/v1" +) + +// RouteWeb register SpaceX route +func RouteSpaceX(e *gin.Engine) { + api.RegisterUserServant(e, newUserSrv(), newUserBinding(), newUserRender()) +} diff --git a/internal/servants/space/user.go b/internal/servants/space/user.go new file mode 100644 index 00000000..d0e5c632 --- /dev/null +++ b/internal/servants/space/user.go @@ -0,0 +1,51 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package space + +import ( + api "github.com/rocboss/paopao-ce/auto/api/x/v1" + "github.com/rocboss/paopao-ce/internal/servants/base" +) + +var ( + _ api.User = (*userSrv)(nil) + _ api.UserBinding = (*userBinding)(nil) + _ api.UserRender = (*userRender)(nil) +) + +type userSrv struct { + base.BaseServant + api.UnimplementedUserServant +} + +type userBinding struct { + base.BaseBinding + *api.UnimplementedUserBinding +} + +type userRender struct { + base.BaseRender + *api.UnimplementedUserRender +} + +func newUserSrv() api.User { + return &userSrv{} +} + +func newUserBinding() api.UserBinding { + return &userBinding{ + UnimplementedUserBinding: &api.UnimplementedUserBinding{ + BindAny: base.BindAny, + }, + } +} + +func newUserRender() api.UserRender { + return &userRender{ + UnimplementedUserRender: &api.UnimplementedUserRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/statick/statick.go b/internal/servants/statick/statick.go new file mode 100644 index 00000000..ef323b0b --- /dev/null +++ b/internal/servants/statick/statick.go @@ -0,0 +1,17 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +//go:build !embed +// +build !embed + +package statick + +import ( + "github.com/gin-gonic/gin" +) + +// RegisterWebStatick stub function for register static asset route +func RegisterWebStatick(e *gin.Engine) { + // empty +} diff --git a/internal/servants/statick/statick_embed.go b/internal/servants/statick/statick_embed.go new file mode 100644 index 00000000..33392531 --- /dev/null +++ b/internal/servants/statick/statick_embed.go @@ -0,0 +1,31 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +//go:build embed +// +build embed + +package statick + +import ( + "net/http" + + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/web" +) + +// RegisterWebStatick register web static assets route +func RegisterWebStatick(e *gin.Engine) { + routeWebStatic(e, "/", "/index.html", "/favicon.ico", "/assets/*filepath") +} + +func routeWebStatic(e *gin.Engine, paths ...string) { + staticHandler := http.FileServer(web.NewFileSystem()) + handler := func(c *gin.Context) { + staticHandler.ServeHTTP(c.Writer, c.Request) + } + for _, path := range paths { + e.GET(path, handler) + e.HEAD(path, handler) + } +} diff --git a/internal/servants/web/admin.go b/internal/servants/web/admin.go new file mode 100644 index 00000000..6a6dc2ec --- /dev/null +++ b/internal/servants/web/admin.go @@ -0,0 +1,73 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/model/web" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/internal/servants/chain" + "github.com/rocboss/paopao-ce/pkg/xerror" +) + +var ( + _ api.Admin = (*adminSrv)(nil) + _ api.AdminBinding = (*adminBinding)(nil) + _ api.AdminRender = (*adminRender)(nil) +) + +type adminSrv struct { + api.UnimplementedAdminServant + *base.DaoServant +} + +type adminBinding struct { + *api.UnimplementedAdminBinding +} + +type adminRender struct { + *api.UnimplementedAdminRender +} + +func (s *adminSrv) Chain() gin.HandlersChain { + return gin.HandlersChain{chain.JWT(), chain.Admin()} +} + +func (s *adminSrv) ChangeUserStatus(req *web.ChangeUserStatusReq) mir.Error { + user, err := s.Ds.GetUserByID(req.ID) + if err != nil || user.Model == nil || user.ID <= 0 { + return _errNoExistUsername + } + // 执行更新 + user.Status = req.Status + if err := s.Ds.UpdateUser(user); err != nil { + return xerror.ServerError + } + return nil +} + +func newAdminSrv(s *base.DaoServant) api.Admin { + return &adminSrv{ + DaoServant: s, + } +} + +func newAdminBinding() api.AdminBinding { + return &adminBinding{ + UnimplementedAdminBinding: &api.UnimplementedAdminBinding{ + BindAny: base.BindAny, + }, + } +} + +func newAdminRender() api.AdminRender { + return &adminRender{ + UnimplementedAdminRender: &api.UnimplementedAdminRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/web/alipay.go b/internal/servants/web/alipay.go new file mode 100644 index 00000000..c5ce3264 --- /dev/null +++ b/internal/servants/web/alipay.go @@ -0,0 +1,239 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "fmt" + "time" + + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/model/web" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/internal/servants/chain" + "github.com/rocboss/paopao-ce/pkg/app" + "github.com/rocboss/paopao-ce/pkg/convert" + "github.com/rocboss/paopao-ce/pkg/xerror" + "github.com/sirupsen/logrus" + "github.com/smartwalle/alipay/v3" +) + +var ( + _ api.AlipayPub = (*alipayPubSrv)(nil) + _ api.AlipayPubBinding = (*alipayPubBinding)(nil) + _ api.AlipayPubRender = (*alipayPubRender)(nil) + _ api.AlipayPriv = (*alipayPrivSrv)(nil) + _ api.AlipayPrivBinding = (*alipayPrivBinding)(nil) + _ api.AlipayPrivRender = (*alipayPrivRender)(nil) +) + +type alipayPubSrv struct { + api.UnimplementedAlipayPubServant + *base.DaoServant +} + +type alipayPubBinding struct { + *api.UnimplementedAlipayPubBinding + + alipayClient *alipay.Client +} + +type alipayPubRender struct { + *api.UnimplementedAlipayPubRender +} + +type alipayPrivSrv struct { + api.UnimplementedAlipayPrivServant + *base.DaoServant + + alipayClient *alipay.Client +} + +type alipayPrivBinding struct { + *api.UnimplementedAlipayPrivBinding +} + +type alipayPrivRender struct { + *api.UnimplementedAlipayPrivRender +} + +func (b *alipayPubBinding) BindAlipayNotify(c *gin.Context) (*web.AlipayNotifyReq, mir.Error) { + if err := c.Request.ParseForm(); err != nil { + logrus.Errorf("parse form err: %s", err) + return nil, _errRechargeNotifyError + } + noti, err := b.alipayClient.GetTradeNotification(c.Request) + if err != nil { + logrus.Errorf("alipayClient.GetTradeNotification err: %s form: %v", err, c.Request.Form) + return nil, _errRechargeNotifyError + } + return &web.AlipayNotifyReq{ + Ctx: c.Request.Context(), + ID: convert.StrTo(noti.OutTradeNo).MustInt64(), + TradeNo: noti.TradeNo, + TradeStatus: noti.TradeStatus, + }, nil +} + +func (s *alipayPubSrv) AlipayNotify(req *web.AlipayNotifyReq) mir.Error { + if req.TradeStatus == alipay.TradeStatusSuccess { + if ok, _ := s.Redis.SetNX(req.Ctx, "PaoPaoRecharge:"+req.TradeNo, 1, time.Second*5).Result(); ok { + recharge, err := s.Ds.GetRechargeByID(req.ID) + if err != nil { + logrus.Errorf("GetRechargeByID id:%d err: %s", req.ID, err) + return _errRechargeNotifyError + } + if recharge.TradeStatus != "TRADE_SUCCESS" { + // 标记为已付款 + err := s.Ds.HandleRechargeSuccess(recharge, req.TradeNo) + defer s.Redis.Del(req.Ctx, "PaoPaoRecharge:"+req.TradeNo) + if err != nil { + logrus.Errorf("HandleRechargeSuccess id:%d err: %s", req.ID, err) + return _errRechargeNotifyError + } + } + } + } + return nil +} + +func (b *alipayPrivBinding) BindUserWalletBills(c *gin.Context) (*web.UserWalletBillsReq, mir.Error) { + uid, ok := base.UserIdFrom(c) + if !ok { + return nil, xerror.UnauthorizedTokenError + } + page, pageSize := app.GetPageInfo(c) + return &web.UserWalletBillsReq{ + UserId: uid, + Page: page, + PageSize: pageSize, + }, nil +} + +func (b *alipayPrivBinding) BindUserRechargeLink(c *gin.Context) (*web.UserRechargeLinkReq, mir.Error) { + v := &web.UserRechargeLinkReq{ + Host: c.Request.Host, + } + err := b.BindAny(c, v) + return v, err +} + +func (b *alipayPrivBinding) BindUserRechargeResult(c *gin.Context) (*web.UserRechargeResultReq, mir.Error) { + uid, exist := base.UserIdFrom(c) + if !exist { + return nil, xerror.UnauthorizedTokenError + } + return &web.UserRechargeResultReq{ + UserId: uid, + Id: convert.StrTo(c.Query("id")).MustInt64(), + }, nil +} + +func (s *alipayPrivSrv) Chain() gin.HandlersChain { + return gin.HandlersChain{chain.JWT()} +} + +func (s *alipayPrivSrv) UserWalletBills(req *web.UserWalletBillsReq) (*web.UserWalletBillsResp, mir.Error) { + bills, err := s.Ds.GetUserWalletBills(req.UserId, (req.Page-1)*req.PageSize, req.PageSize) + if err != nil { + logrus.Errorf("GetUserWalletBills err: %s", err) + return nil, _errUserWalletBillsFailed + } + totalRows, err := s.Ds.GetUserWalletBillCount(req.UserId) + if err != nil { + logrus.Errorf("GetUserWalletBillCount err: %s", err) + return nil, _errUserWalletBillsFailed + } + resp := base.PageRespFrom(bills, req.Page, req.PageSize, totalRows) + return (*web.UserWalletBillsResp)(resp), nil +} + +func (s *alipayPrivSrv) UserRechargeLink(req *web.UserRechargeLinkReq) (*web.UserRechargeLinkResp, mir.Error) { + recharge, err := s.Ds.CreateRecharge(req.User.ID, req.Amount) + if err != nil { + logrus.Errorf("Ds.CreateRecharge err: %v", err) + return nil, _errRechargeReqFail + } + p := alipay.TradePreCreate{} + p.OutTradeNo = fmt.Sprintf("%d", recharge.ID) + p.Subject = "PaoPao用户钱包充值" + p.TotalAmount = fmt.Sprintf("%.2f", float64(recharge.Amount)/100.0) + p.NotifyURL = "https://" + req.Host + "/v1/alipay/notify" + rsp, err := s.alipayClient.TradePreCreate(p) + if err != nil { + logrus.Errorf("client.TradePreCreate err: %v\n", err) + return nil, _errRechargeReqFail + } + if rsp.Content.Code != alipay.CodeSuccess { + return nil, _errRechargeReqFail + } + return &web.UserRechargeLinkResp{ + Id: recharge.ID, + Pay: rsp.Content.QRCode, + }, nil +} + +func (s *alipayPrivSrv) UserRechargeResult(req *web.UserRechargeResultReq) (*web.UserRechargeResultResp, mir.Error) { + recharge, err := s.Ds.GetRechargeByID(req.Id) + if err != nil { + logrus.Errorf("Ds.GetRechargeByID err: %v", err) + return nil, _errGetRechargeFailed + } + if recharge.UserID != req.UserId { + logrus.Errorf("Ds.GetRechargeByID userId not equel recharge.UserID: %d req.UserId %d", recharge.UserID, req.UserId) + return nil, _errGetRechargeFailed + } + return &web.UserRechargeResultResp{ + Id: recharge.ID, + Status: recharge.TradeStatus, + }, nil +} + +func newAlipayPubSrv(s *base.DaoServant) api.AlipayPub { + return &alipayPubSrv{ + DaoServant: s, + } +} + +func newAlipayPubBinding(alipayClient *alipay.Client) api.AlipayPubBinding { + return &alipayPubBinding{ + UnimplementedAlipayPubBinding: &api.UnimplementedAlipayPubBinding{ + BindAny: base.BindAny, + }, + alipayClient: alipayClient, + } +} + +func newAlipayPubRender() api.AlipayPubRender { + return &alipayPubRender{ + UnimplementedAlipayPubRender: &api.UnimplementedAlipayPubRender{ + RenderAny: base.RenderAny, + }, + } +} + +func newAlipayPrivSrv(s *base.DaoServant, client *alipay.Client) api.AlipayPriv { + return &alipayPrivSrv{ + DaoServant: s, + alipayClient: client, + } +} + +func newAlipayPrivBinding() api.AlipayPrivBinding { + return &alipayPrivBinding{ + UnimplementedAlipayPrivBinding: &api.UnimplementedAlipayPrivBinding{ + BindAny: base.BindAny, + }, + } +} + +func newAlipayPrivRender() api.AlipayPrivRender { + return &alipayPrivRender{ + UnimplementedAlipayPrivRender: &api.UnimplementedAlipayPrivRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/web/assets/assets.go b/internal/servants/web/assets/assets.go new file mode 100644 index 00000000..e69dbd67 --- /dev/null +++ b/internal/servants/web/assets/assets.go @@ -0,0 +1,12 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package assets + +import ( + _ "embed" +) + +//go:embed comic.ttf +var ComicBytes []byte diff --git a/internal/routers/api/assets/comic.ttf b/internal/servants/web/assets/comic.ttf similarity index 100% rename from internal/routers/api/assets/comic.ttf rename to internal/servants/web/assets/comic.ttf diff --git a/internal/servants/web/broker/attachment.go b/internal/servants/web/broker/attachment.go new file mode 100644 index 00000000..e8c69447 --- /dev/null +++ b/internal/servants/web/broker/attachment.go @@ -0,0 +1,13 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker + +import ( + "github.com/rocboss/paopao-ce/internal/core" +) + +func CreateAttachment(attachment *core.Attachment) (*core.Attachment, error) { + return ds.CreateAttachment(attachment) +} diff --git a/internal/service/avatar.go b/internal/servants/web/broker/avatar.go similarity index 95% rename from internal/service/avatar.go rename to internal/servants/web/broker/avatar.go index 3ac302e0..04e183f4 100644 --- a/internal/service/avatar.go +++ b/internal/servants/web/broker/avatar.go @@ -1,4 +1,8 @@ -package service +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker import ( "math/rand" diff --git a/internal/servants/web/broker/broker.go b/internal/servants/web/broker/broker.go new file mode 100644 index 00000000..fcc5846d --- /dev/null +++ b/internal/servants/web/broker/broker.go @@ -0,0 +1,48 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker + +import ( + "github.com/alimy/cfg" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/dao" + "github.com/sirupsen/logrus" +) + +var ( + ds core.DataService + ts core.TweetSearchService + oss core.ObjectStorageService + DisablePhoneVerify bool +) + +func Initialize() { + ds = dao.DataService() + ts = dao.TweetSearchService() + oss = dao.ObjectStorageService() + DisablePhoneVerify = !cfg.If("Sms") +} + +// persistMediaContents 获取媒体内容并持久化 +func persistMediaContents(contents []*PostContentItem) (items []string, err error) { + items = make([]string, 0, len(contents)) + for _, item := range contents { + switch item.Type { + case core.ContentTypeImage, + core.ContentTypeVideo, + core.ContentTypeAudio, + core.ContentTypeAttachment, + core.ContentTypeChargeAttachment: + items = append(items, item.Content) + if err != nil { + continue + } + if err = oss.PersistObject(oss.ObjectKey(item.Content)); err != nil { + logrus.Errorf("service.persistMediaContents failed: %s", err) + } + } + } + return +} diff --git a/internal/service/comment.go b/internal/servants/web/broker/comment.go similarity index 83% rename from internal/service/comment.go rename to internal/servants/web/broker/comment.go index f5165d71..7f9389dc 100644 --- a/internal/service/comment.go +++ b/internal/servants/web/broker/comment.go @@ -1,11 +1,15 @@ -package service +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker import ( + "github.com/rocboss/paopao-ce/internal/core" "time" "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/pkg/errcode" "github.com/rocboss/paopao-ce/pkg/util" ) @@ -28,8 +32,8 @@ type ReplyDelReq struct { ID int64 `json:"id" binding:"required"` } -func GetPostComments(postID int64, sort string, offset, limit int) ([]*model.CommentFormated, int64, error) { - conditions := &model.ConditionsT{ +func GetPostComments(postID int64, sort string, offset, limit int) ([]*core.CommentFormated, int64, error) { + conditions := &core.ConditionsT{ "post_id": postID, "ORDER": sort, } @@ -61,7 +65,7 @@ func GetPostComments(postID int64, sort string, offset, limit int) ([]*model.Com return nil, 0, err } - commentsFormated := []*model.CommentFormated{} + commentsFormated := []*core.CommentFormated{} for _, comment := range comments { commentFormated := comment.Format() for _, content := range contents { @@ -89,7 +93,7 @@ func GetPostComments(postID int64, sort string, offset, limit int) ([]*model.Com return commentsFormated, totalRows, nil } -func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) (comment *model.Comment, err error) { +func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) (comment *core.Comment, err error) { var mediaContents []string defer func() { @@ -113,7 +117,7 @@ func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) return nil, errcode.MaxCommentCount } ip := ctx.ClientIP() - comment = &model.Comment{ + comment = &core.Comment{ PostID: post.ID, UserID: userID, IP: ip, @@ -126,13 +130,13 @@ func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) for _, item := range param.Contents { // 检查附件是否是本站资源 - if item.Type == model.CONTENT_TYPE_IMAGE || item.Type == model.CONTENT_TYPE_VIDEO || item.Type == model.CONTENT_TYPE_ATTACHMENT { + if item.Type == core.ContentTypeImage || item.Type == core.ContentTypeVideo || item.Type == core.ContentTypeAttachment { if err := ds.CheckAttachment(item.Content); err != nil { continue } } - postContent := &model.CommentContent{ + postContent := &core.CommentContent{ CommentID: comment.ID, UserID: userID, Content: item.Content, @@ -153,10 +157,10 @@ func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) // 创建用户消息提醒 postMaster, err := ds.GetUserByID(post.UserID) if err == nil && postMaster.ID != userID { - go ds.CreateMessage(&model.Message{ + go ds.CreateMessage(&core.Message{ SenderUserID: userID, ReceiverUserID: postMaster.ID, - Type: model.MsgtypeComment, + Type: core.MsgtypeComment, Brief: "在泡泡中评论了你", PostID: post.ID, CommentID: comment.ID, @@ -169,10 +173,10 @@ func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) } // 创建消息提醒 - go ds.CreateMessage(&model.Message{ + go ds.CreateMessage(&core.Message{ SenderUserID: userID, ReceiverUserID: user.ID, - Type: model.MsgtypeComment, + Type: core.MsgtypeComment, Brief: "在泡泡评论中@了你", PostID: post.ID, CommentID: comment.ID, @@ -182,11 +186,11 @@ func CreatePostComment(ctx *gin.Context, userID int64, param CommentCreationReq) return comment, nil } -func GetPostComment(id int64) (*model.Comment, error) { +func GetPostComment(id int64) (*core.Comment, error) { return ds.GetCommentByID(id) } -func DeletePostComment(comment *model.Comment) error { +func DeletePostComment(comment *core.Comment) error { // 加载post post, err := ds.GetPostByID(comment.PostID) if err == nil { @@ -198,7 +202,7 @@ func DeletePostComment(comment *model.Comment) error { return ds.DeleteComment(comment) } -func createPostPreHandler(commentID int64, userID, atUserID int64) (*model.Post, *model.Comment, int64, +func createPostPreHandler(commentID int64, userID, atUserID int64) (*core.Post, *core.Comment, int64, error) { // 加载Comment comment, err := ds.GetCommentByID(commentID) @@ -231,10 +235,10 @@ func createPostPreHandler(commentID int64, userID, atUserID int64) (*model.Post, return post, comment, atUserID, nil } -func CreatePostCommentReply(ctx *gin.Context, commentID int64, content string, userID, atUserID int64) (*model.CommentReply, error) { +func CreatePostCommentReply(ctx *gin.Context, commentID int64, content string, userID, atUserID int64) (*core.CommentReply, error) { var ( - post *model.Post - comment *model.Comment + post *core.Post + comment *core.Comment err error ) if post, comment, atUserID, err = createPostPreHandler(commentID, userID, atUserID); err != nil { @@ -243,7 +247,7 @@ func CreatePostCommentReply(ctx *gin.Context, commentID int64, content string, u // 创建评论 ip := ctx.ClientIP() - reply := &model.CommentReply{ + reply := &core.CommentReply{ CommentID: commentID, UserID: userID, Content: content, @@ -268,10 +272,10 @@ func CreatePostCommentReply(ctx *gin.Context, commentID int64, content string, u // 创建用户消息提醒 commentMaster, err := ds.GetUserByID(comment.UserID) if err == nil && commentMaster.ID != userID { - go ds.CreateMessage(&model.Message{ + go ds.CreateMessage(&core.Message{ SenderUserID: userID, ReceiverUserID: commentMaster.ID, - Type: model.MsgTypeReply, + Type: core.MsgTypeReply, Brief: "在泡泡评论下回复了你", PostID: post.ID, CommentID: comment.ID, @@ -280,10 +284,10 @@ func CreatePostCommentReply(ctx *gin.Context, commentID int64, content string, u } postMaster, err := ds.GetUserByID(post.UserID) if err == nil && postMaster.ID != userID && commentMaster.ID != postMaster.ID { - go ds.CreateMessage(&model.Message{ + go ds.CreateMessage(&core.Message{ SenderUserID: userID, ReceiverUserID: postMaster.ID, - Type: model.MsgTypeReply, + Type: core.MsgTypeReply, Brief: "在泡泡评论下发布了新回复", PostID: post.ID, CommentID: comment.ID, @@ -294,10 +298,10 @@ func CreatePostCommentReply(ctx *gin.Context, commentID int64, content string, u user, err := ds.GetUserByID(atUserID) if err == nil && user.ID != userID && commentMaster.ID != user.ID && postMaster.ID != user.ID { // 创建消息提醒 - go ds.CreateMessage(&model.Message{ + go ds.CreateMessage(&core.Message{ SenderUserID: userID, ReceiverUserID: user.ID, - Type: model.MsgTypeReply, + Type: core.MsgTypeReply, Brief: "在泡泡评论的回复中@了你", PostID: post.ID, CommentID: comment.ID, @@ -309,11 +313,11 @@ func CreatePostCommentReply(ctx *gin.Context, commentID int64, content string, u return reply, nil } -func GetPostCommentReply(id int64) (*model.CommentReply, error) { +func GetPostCommentReply(id int64) (*core.CommentReply, error) { return ds.GetCommentReplyByID(id) } -func DeletePostCommentReply(reply *model.CommentReply) error { +func DeletePostCommentReply(reply *core.CommentReply) error { err := ds.DeleteCommentReply(reply) if err != nil { return err diff --git a/internal/service/message.go b/internal/servants/web/broker/message.go similarity index 84% rename from internal/service/message.go rename to internal/servants/web/broker/message.go index a025a849..6e5dd1a1 100644 --- a/internal/service/message.go +++ b/internal/servants/web/broker/message.go @@ -1,4 +1,8 @@ -package service +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker import ( "fmt" @@ -6,7 +10,7 @@ import ( "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/pkg/convert" "github.com/rocboss/paopao-ce/pkg/errcode" ) @@ -23,7 +27,7 @@ type WhisperReq struct { } // CreateWhisper 创建私信 -func CreateWhisper(c *gin.Context, msg *model.Message) (*model.Message, error) { +func CreateWhisper(c *gin.Context, msg *core.Message) (*core.Message, error) { whisperKey := fmt.Sprintf("WhisperTimes:%d", msg.SenderUserID) // 今日频次限制 @@ -65,8 +69,8 @@ func ReadMessage(id, userID int64) error { return ds.ReadMessage(message) } -func GetMessages(userID int64, offset, limit int) ([]*model.MessageFormated, int64, error) { - conditions := &model.ConditionsT{ +func GetMessages(userID int64, offset, limit int) ([]*core.MessageFormated, int64, error) { + conditions := &core.ConditionsT{ "receiver_user_id": userID, "ORDER": "id DESC", } @@ -83,7 +87,7 @@ func GetMessages(userID int64, offset, limit int) ([]*model.MessageFormated, int } // 好友申请消息不需要获取其他信息 - if mf.Type == model.MsgTypeRequestingFriend { + if mf.Type == core.MsgTypeRequestingFriend { continue } diff --git a/internal/service/post.go b/internal/servants/web/broker/post.go similarity index 76% rename from internal/service/post.go rename to internal/servants/web/broker/post.go index c8bda6b8..9a73528b 100644 --- a/internal/service/post.go +++ b/internal/servants/web/broker/post.go @@ -1,4 +1,8 @@ -package service +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker import ( "errors" @@ -10,8 +14,6 @@ import ( "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" "github.com/rocboss/paopao-ce/pkg/errcode" "github.com/rocboss/paopao-ce/pkg/util" "github.com/sirupsen/logrus" @@ -23,7 +25,7 @@ const TagTypeHot TagType = "hot" const TagTypeNew TagType = "new" type PostListReq struct { - Conditions *model.ConditionsT + Conditions *core.ConditionsT Offset int Limit int } @@ -37,7 +39,7 @@ type PostCreationReq struct { Tags []string `json:"tags" binding:"required"` Users []string `json:"users" binding:"required"` AttachmentPrice int64 `json:"attachment_price"` - Visibility model.PostVisibleT `json:"visibility"` + Visibility core.PostVisibleT `json:"visibility"` } type PostDelReq struct { @@ -53,8 +55,8 @@ type PostStickReq struct { } type PostVisibilityReq struct { - ID int64 `json:"id" binding:"required"` - Visibility model.PostVisibleT `json:"visibility"` + ID int64 `json:"id" binding:"required"` + Visibility core.PostVisibleT `json:"visibility"` } type PostStarReq struct { @@ -66,27 +68,25 @@ type PostCollectionReq struct { } type PostContentItem struct { - Content string `json:"content" binding:"required"` - Type model.PostContentT `json:"type" binding:"required"` - Sort int64 `json:"sort" binding:"required"` + Content string `json:"content" binding:"required"` + Type core.PostContentT `json:"type" binding:"required"` + Sort int64 `json:"sort" binding:"required"` } // Check 检查PostContentItem属性 func (p *PostContentItem) Check() error { // 检查附件是否是本站资源 - if p.Type == model.CONTENT_TYPE_IMAGE || p.Type == model.CONTENT_TYPE_VIDEO || p.Type == model. - CONTENT_TYPE_ATTACHMENT { + if p.Type == core.ContentTypeImage || p.Type == core.ContentTypeVideo || p.Type == core.ContentTypeAttachment { if err := ds.CheckAttachment(p.Content); err != nil { return err } } // 检查链接是否合法 - if p.Type == model.CONTENT_TYPE_LINK { + if p.Type == core.ContentTypeLink { if strings.Index(p.Content, "http://") != 0 && strings.Index(p.Content, "https://") != 0 { return fmt.Errorf("链接不合法") } } - return nil } @@ -103,7 +103,7 @@ func tagsFrom(originTags []string) []string { // CreatePost 创建文章 // TODO: 推文+推文内容需要在一个事务中添加,后续优化 -func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *model.PostFormated, err error) { +func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *core.PostFormated, err error) { var mediaContents []string defer func() { @@ -118,7 +118,7 @@ func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *model.P ip := c.ClientIP() tags := tagsFrom(param.Tags) - post := &model.Post{ + post := &core.Post{ UserID: userID, Tags: strings.Join(tags, ","), IP: ip, @@ -138,11 +138,11 @@ func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *model.P continue } - if item.Type == model.CONTENT_TYPE_ATTACHMENT && param.AttachmentPrice > 0 { - item.Type = model.CONTENT_TYPE_CHARGE_ATTACHMENT + if item.Type == core.ContentTypeAttachment && param.AttachmentPrice > 0 { + item.Type = core.ContentTypeChargeAttachment } - postContent := &model.PostContent{ + postContent := &core.PostContent{ PostID: post.ID, UserID: userID, Content: item.Content, @@ -155,10 +155,10 @@ func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *model.P } // 私密推文不创建标签与用户提醒 - if post.Visibility != model.PostVisitPrivate { + if post.Visibility != core.PostVisitPrivate { // 创建标签 for _, t := range tags { - tag := &model.Tag{ + tag := &core.Tag{ UserID: userID, Tag: t, } @@ -174,10 +174,10 @@ func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *model.P // 创建消息提醒 // TODO: 优化消息提醒处理机制 - go ds.CreateMessage(&model.Message{ + go ds.CreateMessage(&core.Message{ SenderUserID: userID, ReceiverUserID: user.ID, - Type: model.MsgTypePost, + Type: core.MsgTypePost, Brief: "在新发布的泡泡动态中@了你", PostID: post.ID, }) @@ -187,14 +187,14 @@ func CreatePost(c *gin.Context, userID int64, param PostCreationReq) (_ *model.P // 推送Search PushPostToSearch(post) - formatedPosts, err := ds.RevampPosts([]*model.PostFormated{post.Format()}) + formatedPosts, err := ds.RevampPosts([]*core.PostFormated{post.Format()}) if err != nil { return nil, err } return formatedPosts[0], nil } -func DeletePost(user *model.User, id int64) *errcode.Error { +func DeletePost(user *core.User, id int64) *errcode.Error { if user == nil { return errcode.NoPermission } @@ -261,8 +261,8 @@ func StickPost(id int64) error { return nil } -func VisiblePost(user *model.User, postId int64, visibility model.PostVisibleT) *errcode.Error { - if visibility >= model.PostVisitInvalid { +func VisiblePost(user *core.User, postId int64, visibility core.PostVisibleT) *errcode.Error { + if visibility >= core.PostVisitInvalid { return errcode.InvalidParams } @@ -287,11 +287,11 @@ func VisiblePost(user *model.User, postId int64, visibility model.PostVisibleT) return nil } -func GetPostStar(postID, userID int64) (*model.PostStar, error) { +func GetPostStar(postID, userID int64) (*core.PostStar, error) { return ds.GetUserPostStar(postID, userID) } -func CreatePostStar(postID, userID int64) (*model.PostStar, error) { +func CreatePostStar(postID, userID int64) (*core.PostStar, error) { // 加载Post post, err := ds.GetPostByID(postID) if err != nil { @@ -299,7 +299,7 @@ func CreatePostStar(postID, userID int64) (*model.PostStar, error) { } // 私密post不可操作 - if post.Visibility == model.PostVisitPrivate { + if post.Visibility == core.PostVisitPrivate { return nil, errors.New("no permision") } @@ -318,7 +318,7 @@ func CreatePostStar(postID, userID int64) (*model.PostStar, error) { return star, nil } -func DeletePostStar(star *model.PostStar) error { +func DeletePostStar(star *core.PostStar) error { err := ds.DeletePostStar(star) if err != nil { return err @@ -330,7 +330,7 @@ func DeletePostStar(star *model.PostStar) error { } // 私密post不可操作 - if post.Visibility == model.PostVisitPrivate { + if post.Visibility == core.PostVisitPrivate { return errors.New("no permision") } @@ -344,11 +344,11 @@ func DeletePostStar(star *model.PostStar) error { return nil } -func GetPostCollection(postID, userID int64) (*model.PostCollection, error) { +func GetPostCollection(postID, userID int64) (*core.PostCollection, error) { return ds.GetUserPostCollection(postID, userID) } -func CreatePostCollection(postID, userID int64) (*model.PostCollection, error) { +func CreatePostCollection(postID, userID int64) (*core.PostCollection, error) { // 加载Post post, err := ds.GetPostByID(postID) if err != nil { @@ -356,7 +356,7 @@ func CreatePostCollection(postID, userID int64) (*model.PostCollection, error) { } // 私密post不可操作 - if post.Visibility == model.PostVisitPrivate { + if post.Visibility == core.PostVisitPrivate { return nil, errors.New("no permision") } @@ -375,7 +375,7 @@ func CreatePostCollection(postID, userID int64) (*model.PostCollection, error) { return collection, nil } -func DeletePostCollection(collection *model.PostCollection) error { +func DeletePostCollection(collection *core.PostCollection) error { err := ds.DeletePostCollection(collection) if err != nil { return err @@ -387,7 +387,7 @@ func DeletePostCollection(collection *model.PostCollection) error { } // 私密post不可操作 - if post.Visibility == model.PostVisitPrivate { + if post.Visibility == core.PostVisitPrivate { return errors.New("no permision") } @@ -401,7 +401,7 @@ func DeletePostCollection(collection *model.PostCollection) error { return nil } -func GetPost(id int64) (*model.PostFormated, error) { +func GetPost(id int64) (*core.PostFormated, error) { post, err := ds.GetPostByID(id) if err != nil { @@ -431,15 +431,15 @@ func GetPost(id int64) (*model.PostFormated, error) { return postFormated, nil } -func GetPostContentByID(id int64) (*model.PostContent, error) { +func GetPostContentByID(id int64) (*core.PostContent, error) { return ds.GetPostContentByID(id) } -func GetIndexPosts(user *model.User, offset int, limit int) (*rest.IndexTweetsResp, error) { +func GetIndexPosts(user *core.User, offset int, limit int) (*core.IndexTweetList, error) { return ds.IndexPosts(user, offset, limit) } -func GetPostList(req *PostListReq) ([]*model.Post, []*model.PostFormated, error) { +func GetPostList(req *PostListReq) ([]*core.Post, []*core.PostFormated, error) { posts, err := ds.GetPosts(req.Conditions, req.Offset, req.Limit) if err != nil { return nil, nil, err @@ -448,11 +448,11 @@ func GetPostList(req *PostListReq) ([]*model.Post, []*model.PostFormated, error) return posts, postFormated, err } -func GetPostCount(conditions *model.ConditionsT) (int64, error) { +func GetPostCount(conditions *core.ConditionsT) (int64, error) { return ds.GetPostCount(conditions) } -func GetPostListFromSearch(user *model.User, q *core.QueryReq, offset, limit int) ([]*model.PostFormated, int64, error) { +func GetPostListFromSearch(user *core.User, q *core.QueryReq, offset, limit int) ([]*core.PostFormated, int64, error) { resp, err := ts.Search(user, q, offset, limit) if err != nil { return nil, 0, err @@ -464,7 +464,7 @@ func GetPostListFromSearch(user *model.User, q *core.QueryReq, offset, limit int return posts, resp.Total, nil } -func GetPostListFromSearchByQuery(user *model.User, query string, offset, limit int) ([]*model.PostFormated, int64, error) { +func GetPostListFromSearchByQuery(user *core.User, query string, offset, limit int) ([]*core.PostFormated, int64, error) { q := &core.QueryReq{ Query: query, Type: "search", @@ -472,9 +472,9 @@ func GetPostListFromSearchByQuery(user *model.User, query string, offset, limit return GetPostListFromSearch(user, q, offset, limit) } -func PushPostToSearch(post *model.Post) { +func PushPostToSearch(post *core.Post) { postFormated := post.Format() - postFormated.User = &model.UserFormated{ + postFormated.User = &core.UserFormated{ ID: post.UserID, } contents, _ := ds.GetPostContentsByIDs([]int64{post.ID}) @@ -484,7 +484,7 @@ func PushPostToSearch(post *model.Post) { contentFormated := "" for _, content := range postFormated.Contents { - if content.Type == model.CONTENT_TYPE_TEXT || content.Type == model.CONTENT_TYPE_TITLE { + if content.Type == core.ContentTypeText || content.Type == core.ContentTypeTitle { contentFormated = contentFormated + content.Content + "\n" } } @@ -496,7 +496,7 @@ func PushPostToSearch(post *model.Post) { ts.AddDocuments(docs, fmt.Sprintf("%d", post.ID)) } -func DeleteSearchPost(post *model.Post) error { +func DeleteSearchPost(post *core.Post) error { return ts.DeleteDocuments([]string{fmt.Sprintf("%d", post.ID)}) } @@ -505,8 +505,8 @@ func PushPostsToSearch(c *gin.Context) { defer conf.Redis.Del(c, "JOB_PUSH_TO_SEARCH") splitNum := 1000 - totalRows, _ := GetPostCount(&model.ConditionsT{ - "visibility IN ?": []model.PostVisibleT{model.PostVisitPublic, model.PostVisitFriend}, + totalRows, _ := GetPostCount(&core.ConditionsT{ + "visibility IN ?": []core.PostVisibleT{core.PostVisitPublic, core.PostVisitFriend}, }) pages := math.Ceil(float64(totalRows) / float64(splitNum)) @@ -514,7 +514,7 @@ func PushPostsToSearch(c *gin.Context) { for i := 0; i < nums; i++ { posts, postsFormated, err := GetPostList(&PostListReq{ - Conditions: &model.ConditionsT{}, + Conditions: &core.ConditionsT{}, Offset: i * splitNum, Limit: splitNum, }) @@ -524,7 +524,7 @@ func PushPostsToSearch(c *gin.Context) { for i, pf := range postsFormated { contentFormated := "" for _, content := range pf.Contents { - if content.Type == model.CONTENT_TYPE_TEXT || content.Type == model.CONTENT_TYPE_TITLE { + if content.Type == core.ContentTypeText || content.Type == core.ContentTypeTitle { contentFormated = contentFormated + content.Content + "\n" } } @@ -538,22 +538,22 @@ func PushPostsToSearch(c *gin.Context) { } } -func GetPostTags(param *PostTagsReq) ([]*model.TagFormated, error) { +func GetPostTags(param *PostTagsReq) ([]*core.TagFormated, error) { num := param.Num if num > conf.AppSetting.MaxPageSize { num = conf.AppSetting.MaxPageSize } - conditions := &model.ConditionsT{} + conditions := &core.ConditionsT{} if param.Type == TagTypeHot { // 热门标签 - conditions = &model.ConditionsT{ + conditions = &core.ConditionsT{ "ORDER": "quote_num DESC", } } if param.Type == TagTypeNew { // 热门标签 - conditions = &model.ConditionsT{ + conditions = &core.ConditionsT{ "ORDER": "id DESC", } } @@ -571,7 +571,7 @@ func GetPostTags(param *PostTagsReq) ([]*model.TagFormated, error) { users, _ := ds.GetUsersByIDs(userIds) - tagsFormated := []*model.TagFormated{} + tagsFormated := []*core.TagFormated{} for _, tag := range tags { tagFormated := tag.Format() for _, user := range users { diff --git a/internal/service/sign.go b/internal/servants/web/broker/sign.go similarity index 79% rename from internal/service/sign.go rename to internal/servants/web/broker/sign.go index d3ec373a..c8883638 100644 --- a/internal/service/sign.go +++ b/internal/servants/web/broker/sign.go @@ -1,4 +1,8 @@ -package service +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker import ( "fmt" diff --git a/internal/service/user.go b/internal/servants/web/broker/user.go similarity index 76% rename from internal/service/user.go rename to internal/servants/web/broker/user.go index 7289c067..66919a99 100644 --- a/internal/service/user.go +++ b/internal/servants/web/broker/user.go @@ -1,4 +1,8 @@ -package service +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker import ( "fmt" @@ -10,15 +14,14 @@ import ( "github.com/gin-gonic/gin" "github.com/gofrs/uuid" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" + "github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/pkg/convert" "github.com/rocboss/paopao-ce/pkg/errcode" "github.com/rocboss/paopao-ce/pkg/util" "github.com/sirupsen/logrus" ) -const MAX_CAPTCHA_TIMES = 2 +const _MaxCaptchaTimes = 2 type PhoneCaptchaReq struct { Phone string `json:"phone" form:"phone" binding:"required"` @@ -59,19 +62,48 @@ type ChangeUserStatusReq struct { Status int `json:"status" form:"status" binding:"required"` } -const LOGIN_ERR_KEY = "PaoPaoUserLoginErr" -const MAX_LOGIN_ERR_TIMES = 10 +type RequestingFriendReq struct { + UserId int64 `json:"user_id" binding:"required"` + Greetings string `json:"greetings" binding:"required"` +} + +type AddFriendReq struct { + UserId int64 `json:"user_id" binding:"required"` +} + +type RejectFriendReq struct { + UserId int64 `json:"user_id" binding:"required"` +} + +type DeleteFriendReq struct { + UserId int64 `json:"user_id"` +} + +type UserProfileResp struct { + ID int64 `json:"id"` + Nickname string `json:"nickname"` + Username string `json:"username"` + Status int `json:"status"` + Avatar string `json:"avatar"` + IsAdmin bool `json:"is_admin"` + IsFriend bool `json:"is_friend"` +} + +const ( + _LoginErrKey = "PaoPaoUserLoginErr" + _MaxLoginErrTimes = 10 +) // DoLogin 用户认证 -func DoLogin(ctx *gin.Context, param *AuthRequest) (*model.User, error) { +func DoLogin(ctx *gin.Context, param *AuthRequest) (*core.User, error) { user, err := ds.GetUserByUsername(param.Username) if err != nil { return nil, errcode.UnauthorizedAuthNotExist } if user.Model != nil && user.ID > 0 { - if errTimes, err := conf.Redis.Get(ctx, fmt.Sprintf("%s:%d", LOGIN_ERR_KEY, user.ID)).Result(); err == nil { - if convert.StrTo(errTimes).MustInt() >= MAX_LOGIN_ERR_TIMES { + if errTimes, err := conf.Redis.Get(ctx, fmt.Sprintf("%s:%d", _LoginErrKey, user.ID)).Result(); err == nil { + if convert.StrTo(errTimes).MustInt() >= _MaxLoginErrTimes { return nil, errcode.TooManyLoginError } } @@ -79,19 +111,19 @@ func DoLogin(ctx *gin.Context, param *AuthRequest) (*model.User, error) { // 对比密码是否正确 if ValidPassword(user.Password, param.Password, user.Salt) { - if user.Status == model.UserStatusClosed { + if user.Status == core.UserStatusClosed { return nil, errcode.UserHasBeenBanned } // 清空登录计数 - conf.Redis.Del(ctx, fmt.Sprintf("%s:%d", LOGIN_ERR_KEY, user.ID)) + conf.Redis.Del(ctx, fmt.Sprintf("%s:%d", _LoginErrKey, user.ID)) return user, nil } // 登录错误计数 - _, err = conf.Redis.Incr(ctx, fmt.Sprintf("%s:%d", LOGIN_ERR_KEY, user.ID)).Result() + _, err = conf.Redis.Incr(ctx, fmt.Sprintf("%s:%d", _LoginErrKey, user.ID)).Result() if err == nil { - conf.Redis.Expire(ctx, fmt.Sprintf("%s:%d", LOGIN_ERR_KEY, user.ID), time.Hour).Result() + conf.Redis.Expire(ctx, fmt.Sprintf("%s:%d", _LoginErrKey, user.ID), time.Hour).Result() } return nil, errcode.UnauthorizedAuthFailed @@ -106,8 +138,8 @@ func ValidPassword(dbPassword, password, salt string) bool { } // CheckStatus 检测用户权限 -func CheckStatus(user *model.User) bool { - return user.Status == model.UserStatusNormal +func CheckStatus(user *core.User) bool { + return user.Status == core.UserStatusNormal } // ValidUsername 验证用户 @@ -161,7 +193,7 @@ func CheckPhoneCaptcha(phone, captcha string) *errcode.Error { return errcode.ErrorPhoneCaptcha } - if c.UseTimes >= MAX_CAPTCHA_TIMES { + if c.UseTimes >= _MaxCaptchaTimes { return errcode.MaxPhoneCaptchaUseTimes } @@ -198,16 +230,16 @@ func EncryptPasswordAndSalt(password string) (string, string) { } // Register 用户注册 -func Register(username, password string) (*model.User, error) { +func Register(username, password string) (*core.User, error) { password, salt := EncryptPasswordAndSalt(password) - user := &model.User{ + user := &core.User{ Nickname: username, Username: username, Password: password, Avatar: GetRandomAvatar(), Salt: salt, - Status: model.UserStatusNormal, + Status: core.UserStatusNormal, } user, err := ds.CreateUser(user) @@ -218,40 +250,40 @@ func Register(username, password string) (*model.User, error) { return user, nil } -func RequestingFriend(user *model.User, param *rest.RequestingFriendReq) error { +func RequestingFriend(user *core.User, param *RequestingFriendReq) error { if _, err := ds.GetUserByID(param.UserId); err != nil { return errcode.NotExistFriendId } return ds.RequestingFriend(user.ID, param.UserId, param.Greetings) } -func AddFriend(user *model.User, param *rest.AddFriendReq) error { +func AddFriend(user *core.User, param *AddFriendReq) error { if _, err := ds.GetUserByID(param.UserId); err != nil { return errcode.NotExistFriendId } return ds.AddFriend(user.ID, param.UserId) } -func RejectFriend(user *model.User, param *rest.RejectFriendReq) error { +func RejectFriend(user *core.User, param *RejectFriendReq) error { if _, err := ds.GetUserByID(param.UserId); err != nil { return errcode.NotExistFriendId } return ds.RejectFriend(user.ID, param.UserId) } -func DeleteFriend(user *model.User, param *rest.DeleteFriendReq) error { +func DeleteFriend(user *core.User, param *DeleteFriendReq) error { if _, err := ds.GetUserByID(param.UserId); err != nil { return errcode.NotExistFriendId } return ds.DeleteFriend(user.ID, param.UserId) } -func GetContacts(user *model.User, offset int, limit int) (*rest.ContactsResp, error) { +func GetContacts(user *core.User, offset int, limit int) (*core.ContactList, error) { return ds.GetContacts(user.ID, offset, limit) } // GetUserInfo 获取用户信息 -func GetUserInfo(param *AuthRequest) (*model.User, error) { +func GetUserInfo(param *AuthRequest) (*core.User, error) { user, err := ds.GetUserByUsername(param.Username) if err != nil { @@ -265,7 +297,7 @@ func GetUserInfo(param *AuthRequest) (*model.User, error) { return nil, errcode.UnauthorizedAuthNotExist } -func GetUserByID(id int64) (*model.User, error) { +func GetUserByID(id int64) (*core.User, error) { user, err := ds.GetUserByID(id) if err != nil { @@ -279,15 +311,15 @@ func GetUserByID(id int64) (*model.User, error) { return nil, errcode.NoExistUsername } -func GetUserByUsername(user *model.User, username string) (*rest.UserProfileResp, error) { +func GetUserByUsername(user *core.User, username string) (*UserProfileResp, error) { other, err := ds.GetUserByUsername(username) if err != nil { return nil, err } - var resp *rest.UserProfileResp + var resp *UserProfileResp if other.Model != nil && other.ID > 0 { - resp = &rest.UserProfileResp{ + resp = &UserProfileResp{ ID: other.ID, Nickname: other.Nickname, Username: other.Username, @@ -307,14 +339,14 @@ func GetUserByUsername(user *model.User, username string) (*rest.UserProfileResp } // UpdateUserInfo 更新用户信息 -func UpdateUserInfo(user *model.User) *errcode.Error { +func UpdateUserInfo(user *core.User) *errcode.Error { if err := ds.UpdateUser(user); err != nil { return errcode.ServerError } return nil } -func ChangeUserAvatar(user *model.User, avatar string) (err *errcode.Error) { +func ChangeUserAvatar(user *core.User, avatar string) (err *errcode.Error) { defer func() { if err != nil { deleteOssObjects([]string{avatar}) @@ -336,7 +368,7 @@ func ChangeUserAvatar(user *model.User, avatar string) (err *errcode.Error) { } // GetUserCollections 获取用户收藏列表 -func GetUserCollections(userID int64, offset, limit int) ([]*model.PostFormated, int64, error) { +func GetUserCollections(userID int64, offset, limit int) ([]*core.PostFormated, int64, error) { collections, err := ds.GetUserPostCollections(userID, offset, limit) if err != nil { return nil, 0, err @@ -345,7 +377,7 @@ func GetUserCollections(userID int64, offset, limit int) ([]*model.PostFormated, if err != nil { return nil, 0, err } - var posts []*model.Post + var posts []*core.Post for _, collection := range collections { posts = append(posts, collection.Post) } @@ -358,7 +390,7 @@ func GetUserCollections(userID int64, offset, limit int) ([]*model.PostFormated, } // GetUserStars 获取用户点赞列表 -func GetUserStars(userID int64, offset, limit int) ([]*model.PostFormated, int64, error) { +func GetUserStars(userID int64, offset, limit int) ([]*core.PostFormated, int64, error) { stars, err := ds.GetUserPostStars(userID, offset, limit) if err != nil { return nil, 0, err @@ -368,7 +400,7 @@ func GetUserStars(userID int64, offset, limit int) ([]*model.PostFormated, int64 return nil, 0, err } - var posts []*model.Post + var posts []*core.Post for _, star := range stars { posts = append(posts, star.Post) } @@ -381,7 +413,7 @@ func GetUserStars(userID int64, offset, limit int) ([]*model.PostFormated, int64 } // GetUserWalletBills 获取用户账单列表 -func GetUserWalletBills(userID int64, offset, limit int) ([]*model.WalletStatement, int64, error) { +func GetUserWalletBills(userID int64, offset, limit int) ([]*core.WalletStatement, int64, error) { bills, err := ds.GetUserWalletBills(userID, offset, limit) if err != nil { return nil, 0, err @@ -448,7 +480,7 @@ func IsFriend(userId, friendId int64) bool { } // checkPermision 检查是否拥有者或管理员 -func checkPermision(user *model.User, targetUserId int64) *errcode.Error { +func checkPermision(user *core.User, targetUserId int64) *errcode.Error { if user == nil || (user.ID != targetUserId && !user.IsAdmin) { return errcode.NoPermission } diff --git a/internal/service/wallet.go b/internal/servants/web/broker/wallet.go similarity index 69% rename from internal/service/wallet.go rename to internal/servants/web/broker/wallet.go index 0f22b23f..6f89edf8 100644 --- a/internal/service/wallet.go +++ b/internal/servants/web/broker/wallet.go @@ -1,11 +1,15 @@ -package service +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package broker import ( + "github.com/rocboss/paopao-ce/internal/core" "time" "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/pkg/errcode" ) @@ -13,11 +17,11 @@ type RechargeReq struct { Amount int64 `json:"amount" form:"amount" binding:"required"` } -func GetRechargeByID(id int64) (*model.WalletRecharge, error) { +func GetRechargeByID(id int64) (*core.WalletRecharge, error) { return ds.GetRechargeByID(id) } -func CreateRecharge(userID, amount int64) (*model.WalletRecharge, error) { +func CreateRecharge(userID, amount int64) (*core.WalletRecharge, error) { return ds.CreateRecharge(userID, amount) } @@ -44,7 +48,7 @@ func FinishRecharge(ctx *gin.Context, id int64, tradeNo string) error { return nil } -func BuyPostAttachment(post *model.Post, user *model.User) error { +func BuyPostAttachment(post *core.Post, user *core.User) error { if user.Balance < post.AttachmentPrice { return errcode.InsuffientDownloadMoney } diff --git a/internal/servants/web/core.go b/internal/servants/web/core.go new file mode 100644 index 00000000..92dcfbaa --- /dev/null +++ b/internal/servants/web/core.go @@ -0,0 +1,479 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "context" + "fmt" + + "time" + "unicode/utf8" + + "github.com/alimy/cfg" + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/model/web" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/internal/servants/chain" + "github.com/rocboss/paopao-ce/pkg/convert" + "github.com/rocboss/paopao-ce/pkg/xerror" + "github.com/sirupsen/logrus" +) + +const ( + // _MaxWhisperNumDaily 当日单用户私信总数限制(TODO 配置化、积分兑换等) + _MaxWhisperNumDaily = 20 + _MaxCaptchaTimes = 2 +) + +var ( + _ api.Core = (*coreSrv)(nil) + _ api.CoreBinding = (*coreBinding)(nil) + _ api.CoreRender = (*coreRender)(nil) + + _EnablePhoneVerify = cfg.If("Sms") +) + +type coreSrv struct { + api.UnimplementedCoreServant + *base.DaoServant + + oss core.ObjectStorageService +} + +type coreBinding struct { + *api.UnimplementedCoreBinding +} + +type coreRender struct { + *api.UnimplementedCoreRender +} + +func (b *coreBinding) BindGetUserInfo(c *gin.Context) (*web.UserInfoReq, mir.Error) { + username, exist := base.UserNameFrom(c) + if !exist { + return nil, xerror.UnauthorizedAuthNotExist + } + return &web.UserInfoReq{ + Username: username, + }, nil +} + +func (b *coreBinding) BindGetMessages(c *gin.Context) (*web.GetMessagesReq, mir.Error) { + v, err := web.BasePageReqFrom(c) + return (*web.GetMessagesReq)(v), err +} + +func (b *coreBinding) BindGetCollections(c *gin.Context) (*web.GetCollectionsReq, mir.Error) { + v, err := web.BasePageReqFrom(c) + return (*web.GetCollectionsReq)(v), err +} + +func (b *coreBinding) BindGetStars(c *gin.Context) (*web.GetStarsReq, mir.Error) { + v, err := web.BasePageReqFrom(c) + return (*web.GetStarsReq)(v), err +} + +func (b *coreBinding) BindSuggestTags(c *gin.Context) (*web.SuggestTagsReq, mir.Error) { + return &web.SuggestTagsReq{ + Keyword: c.Query("k"), + }, nil +} + +func (b *coreBinding) BindSuggestUsers(c *gin.Context) (*web.SuggestUsersReq, mir.Error) { + return &web.SuggestUsersReq{ + Keyword: c.Query("k"), + }, nil +} + +func (b *coreBinding) BindTweetCollectionStatus(c *gin.Context) (*web.TweetCollectionStatusReq, mir.Error) { + UserId, exist := base.UserIdFrom(c) + if !exist { + return nil, xerror.UnauthorizedAuthNotExist + } + return &web.TweetCollectionStatusReq{ + SimpleInfo: web.SimpleInfo{ + Uid: UserId, + }, + TweetId: convert.StrTo(c.Query("id")).MustInt64(), + }, nil +} + +func (b *coreBinding) BindTweetStarStatus(c *gin.Context) (*web.TweetStarStatusReq, mir.Error) { + UserId, exist := base.UserIdFrom(c) + if !exist { + return nil, xerror.UnauthorizedAuthNotExist + } + return &web.TweetStarStatusReq{ + SimpleInfo: web.SimpleInfo{ + Uid: UserId, + }, + TweetId: convert.StrTo(c.Query("id")).MustInt64(), + }, nil +} + +func (s *coreSrv) Chain() gin.HandlersChain { + return gin.HandlersChain{chain.JWT()} +} + +func (s *coreSrv) SyncSearchIndex(req *web.SyncSearchIndexReq) mir.Error { + if req.User != nil && req.User.IsAdmin { + go s.PushPostsToSearch(context.Background()) + } + return nil +} + +func (s *coreSrv) GetUserInfo(req *web.UserInfoReq) (*web.UserInfoResp, mir.Error) { + user, err := s.Ds.GetUserByUsername(req.Username) + if err != nil { + return nil, xerror.UnauthorizedAuthNotExist + } + if user.Model == nil || user.ID < 0 { + return nil, xerror.UnauthorizedAuthNotExist + } + resp := &web.UserInfoResp{ + Id: user.ID, + Nickname: user.Nickname, + Username: user.Username, + Status: user.Status, + Avatar: user.Avatar, + Balance: user.Balance, + IsAdmin: user.IsAdmin, + } + if user.Phone != "" && len(user.Phone) == 11 { + resp.Phone = user.Phone[0:3] + "****" + user.Phone[7:] + } + return resp, nil +} + +func (s *coreSrv) GetUnreadMsgCount(req *web.GetUnreadMsgCountReq) (*web.GetUnreadMsgCountResp, mir.Error) { + count, err := s.Ds.GetUnreadCount(req.Uid) + if err != nil { + return nil, xerror.ServerError + } + return &web.GetUnreadMsgCountResp{ + Count: count, + }, nil +} + +func (s *coreSrv) GetMessages(req *web.GetMessagesReq) (*web.GetMessagesResp, mir.Error) { + conditions := &core.ConditionsT{ + "receiver_user_id": req.UserId, + "ORDER": "id DESC", + } + messages, err := s.Ds.GetMessages(conditions, (req.Page-1)*req.PageSize, req.PageSize) + for _, mf := range messages { + if mf.SenderUserID > 0 { + user, err := s.Ds.GetUserByID(mf.SenderUserID) + if err == nil { + mf.SenderUser = user.Format() + } + } + // 好友申请消息不需要获取其他信息 + if mf.Type == core.MsgTypeRequestingFriend { + continue + } + if mf.PostID > 0 { + post, err := s.GetTweetBy(mf.PostID) + if err == nil { + mf.Post = post + if mf.CommentID > 0 { + comment, err := s.Ds.GetCommentByID(mf.CommentID) + if err == nil { + mf.Comment = comment + if mf.ReplyID > 0 { + reply, err := s.Ds.GetCommentReplyByID(mf.ReplyID) + if err == nil { + mf.Reply = reply + } + } + } + } + } + } + } + if err != nil { + logrus.Errorf("Ds.GetMessages err: %v\n", err) + return nil, _errGetMessagesFailed + } + totalRows, _ := s.Ds.GetMessageCount(conditions) + resp := base.PageRespFrom(messages, req.Page, req.PageSize, totalRows) + return (*web.GetMessagesResp)(resp), nil +} + +func (s *coreSrv) ReadMessage(req *web.ReadMessageReq) mir.Error { + message, err := s.Ds.GetMessageByID(req.ID) + if err != nil { + return _errReadMessageFailed + } + if message.ReceiverUserID != req.Uid { + return _errNoPermission + } + if err = s.Ds.ReadMessage(message); err != nil { + logrus.Errorf("Ds.ReadMessage err: %s", err) + return _errReadMessageFailed + } + return nil +} + +func (s *coreSrv) SendUserWhisper(req *web.SendWhisperReq) mir.Error { + // 不允许发送私信给自己 + if req.Uid == req.UserID { + return _errNoWhisperToSelf + } + + // 今日频次限制 + ctx := context.Background() + whisperKey := fmt.Sprintf("WhisperTimes:%d", req.Uid) + if res, _ := s.Redis.Get(ctx, whisperKey).Result(); convert.StrTo(res).MustInt() >= _MaxWhisperNumDaily { + return _errTooManyWhisperNum + } + + // 创建私信 + _, err := s.Ds.CreateMessage(&core.Message{ + SenderUserID: req.Uid, + ReceiverUserID: req.UserID, + Type: core.MsgTypeWhisper, + Brief: "给你发送新私信了", + Content: req.Content, + }) + if err != nil { + logrus.Errorf("Ds.CreateWhisper err: %s", err) + return _errSendWhisperFailed + } + + // 写入当日(自然日)计数缓存 + s.Redis.Incr(ctx, whisperKey).Result() + currentTime := time.Now() + endTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, currentTime.Location()) + s.Redis.Expire(ctx, whisperKey, endTime.Sub(currentTime)) + + return nil +} + +func (s *coreSrv) GetCollections(req *web.GetCollectionsReq) (*web.GetCollectionsResp, mir.Error) { + collections, err := s.Ds.GetUserPostCollections(req.UserId, (req.Page-1)*req.PageSize, req.PageSize) + if err != nil { + logrus.Errorf("Ds.GetUserPostCollections err: %s", err) + return nil, _errGetCollectionsFailed + } + totalRows, err := s.Ds.GetUserPostCollectionCount(req.UserId) + if err != nil { + logrus.Errorf("Ds.GetUserPostCollectionCount err: %s", err) + return nil, _errGetCollectionsFailed + } + + var posts []*core.Post + for _, collection := range collections { + posts = append(posts, collection.Post) + } + postsFormated, err := s.Ds.MergePosts(posts) + if err != nil { + logrus.Errorf("Ds.MergePosts err: %s", err) + return nil, _errGetCollectionsFailed + } + resp := base.PageRespFrom(postsFormated, req.Page, req.PageSize, totalRows) + + return (*web.GetCollectionsResp)(resp), nil +} + +func (s *coreSrv) UserPhoneBind(req *web.UserPhoneBindReq) mir.Error { + // 手机重复性检查 + u, err := s.Ds.GetUserByPhone(req.Phone) + if err != nil { + logrus.Errorf("Ds.GetUserByPhone err: %v", err) + return _errExistedUserPhone + } + if u.Model == nil || u.ID == 0 { + return _errExistedUserPhone + } + if u.ID == req.User.ID { + return _errExistedUserPhone + } + + // 如果禁止phone verify 则允许通过任意验证码 + if !_EnablePhoneVerify { + c, err := s.Ds.GetLatestPhoneCaptcha(req.Phone) + if err != nil { + return _errErrorPhoneCaptcha + } + if c.Captcha != req.Captcha { + return _errErrorPhoneCaptcha + } + if c.ExpiredOn < time.Now().Unix() { + return _errErrorPhoneCaptcha + } + if c.UseTimes >= _MaxCaptchaTimes { + return _errMaxPhoneCaptchaUseTimes + } + // 更新检测次数 + s.Ds.UsePhoneCaptcha(c) + } + + // 执行绑定 + user := req.User + user.Phone = req.Phone + if err := s.Ds.UpdateUser(user); err != nil { + // TODO: 优化错误处理逻辑,失败后上面的逻辑也应该回退 + logrus.Errorf("Ds.UpdateUser err: %s", err) + return xerror.ServerError + } + return nil +} + +func (s *coreSrv) GetStars(req *web.GetStarsReq) (*web.GetStarsResp, mir.Error) { + stars, err := s.Ds.GetUserPostStars(req.UserId, (req.Page-1)*req.PageSize, req.PageSize) + if err != nil { + logrus.Errorf("Ds.GetUserPostStars err: %s", err) + return nil, _errGetStarsFailed + } + totalRows, err := s.Ds.GetUserPostStarCount(req.UserId) + if err != nil { + logrus.Errorf("Ds.GetUserPostStars err: %s", err) + return nil, _errGetStarsFailed + } + + var posts []*core.Post + for _, star := range stars { + posts = append(posts, star.Post) + } + postsFormated, err := s.Ds.MergePosts(posts) + if err != nil { + logrus.Errorf("Ds.MergePosts err: %s", err) + return nil, _errGetStarsFailed + } + resp := base.PageRespFrom(postsFormated, req.Page, req.PageSize, totalRows) + + return (*web.GetStarsResp)(resp), nil +} + +func (s *coreSrv) ChangePassword(req *web.ChangePasswordReq) mir.Error { + // 密码检查 + if err := checkPassword(req.Password); err != nil { + return err + } + // 旧密码校验 + user := req.User + if !validPassword(user.Password, req.OldPassword, req.User.Salt) { + return _errErrorOldPassword + } + // 更新入库 + user.Password, user.Salt = encryptPasswordAndSalt(req.Password) + if err := s.Ds.UpdateUser(user); err != nil { + logrus.Errorf("Ds.UpdateUser err: %s", err) + return xerror.ServerError + } + return nil +} + +func (s *coreSrv) SuggestTags(req *web.SuggestTagsReq) (*web.SuggestTagsResp, mir.Error) { + tags, err := s.Ds.GetTagsByKeyword(req.Keyword) + if err != nil { + logrus.Errorf("Ds.GetTagsByKeyword err: %s", err) + return nil, xerror.ServerError + } + resp := &web.SuggestTagsResp{} + for _, t := range tags { + resp.Suggests = append(resp.Suggests, t.Tag) + } + return resp, nil +} + +func (s *coreSrv) SuggestUsers(req *web.SuggestUsersReq) (*web.SuggestUsersResp, mir.Error) { + users, err := s.Ds.GetUsersByKeyword(req.Keyword) + if err != nil { + logrus.Errorf("Ds.GetUsersByKeyword err: %s", err) + return nil, xerror.ServerError + } + resp := &web.SuggestUsersResp{} + for _, user := range users { + resp.Suggests = append(resp.Suggests, user.Username) + } + return resp, nil +} + +func (s *coreSrv) ChangeNickname(req *web.ChangeNicknameReq) mir.Error { + if utf8.RuneCountInString(req.Nickname) < 2 || utf8.RuneCountInString(req.Nickname) > 12 { + return _errNicknameLengthLimit + } + user := req.User + user.Nickname = req.Nickname + if err := s.Ds.UpdateUser(user); err != nil { + logrus.Errorf("Ds.UpdateUser err: %s", err) + return xerror.ServerError + } + return nil +} + +func (s *coreSrv) ChangeAvatar(req *web.ChangeAvatarReq) (xerr mir.Error) { + defer func() { + if xerr != nil { + deleteOssObjects(s.oss, []string{req.Avatar}) + } + }() + + if err := s.Ds.CheckAttachment(req.Avatar); err != nil { + logrus.Errorf("Ds.CheckAttachment failed: %s", err) + return xerror.InvalidParams + } + if err := s.oss.PersistObject(s.oss.ObjectKey(req.Avatar)); err != nil { + logrus.Errorf("Ds.ChangeUserAvatar persist object failed: %s", err) + return xerror.ServerError + } + user := req.User + user.Avatar = req.Avatar + if err := s.Ds.UpdateUser(user); err != nil { + logrus.Errorf("Ds.UpdateUser failed: %s", err) + return xerror.ServerError + } + return nil +} + +func (s *coreSrv) TweetCollectionStatus(req *web.TweetCollectionStatusReq) (*web.TweetCollectionStatusResp, mir.Error) { + resp := &web.TweetCollectionStatusResp{ + Status: true, + } + if _, err := s.Ds.GetUserPostCollection(req.TweetId, req.Uid); err != nil { + resp.Status = false + return resp, nil + } + return resp, nil +} + +func (s *coreSrv) TweetStarStatus(req *web.TweetStarStatusReq) (*web.TweetStarStatusResp, mir.Error) { + resp := &web.TweetStarStatusResp{ + Status: true, + } + if _, err := s.Ds.GetUserPostStar(req.TweetId, req.Uid); err != nil { + resp.Status = false + return resp, nil + } + return resp, nil +} + +func newCoreSrv(s *base.DaoServant, oss core.ObjectStorageService) api.Core { + return &coreSrv{ + DaoServant: s, + oss: oss, + } +} + +func newCoreBinding() api.CoreBinding { + return &coreBinding{ + UnimplementedCoreBinding: &api.UnimplementedCoreBinding{ + BindAny: base.BindAny, + }, + } +} + +func newCoreRender() api.CoreRender { + return &coreRender{ + UnimplementedCoreRender: &api.UnimplementedCoreRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/web/followship.go b/internal/servants/web/followship.go new file mode 100644 index 00000000..95d19ec3 --- /dev/null +++ b/internal/servants/web/followship.go @@ -0,0 +1,55 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/internal/servants/chain" +) + +var ( + _ api.Followship = (*followshipSrv)(nil) + _ api.FollowshipBinding = (*followshipBinding)(nil) + _ api.FollowshipRender = (*followshipRender)(nil) +) + +type followshipSrv struct { + api.UnimplementedFollowshipServant + *base.DaoServant +} + +type followshipBinding struct { + *api.UnimplementedFollowshipBinding +} + +type followshipRender struct { + *api.UnimplementedFollowshipRender +} + +func (s *followshipSrv) Chain() gin.HandlersChain { + return gin.HandlersChain{chain.JWT()} +} + +func newFollowshipSrv(s *base.DaoServant) api.Followship { + return &followshipSrv{} +} + +func newFollowshipBinding() api.FollowshipBinding { + return &followshipBinding{ + UnimplementedFollowshipBinding: &api.UnimplementedFollowshipBinding{ + BindAny: base.BindAny, + }, + } +} + +func newFollowshipRender() api.FollowshipRender { + return &followshipRender{ + UnimplementedFollowshipRender: &api.UnimplementedFollowshipRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/web/friendship.go b/internal/servants/web/friendship.go new file mode 100644 index 00000000..54c239ba --- /dev/null +++ b/internal/servants/web/friendship.go @@ -0,0 +1,142 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/model/web" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/internal/servants/chain" + "github.com/rocboss/paopao-ce/pkg/xerror" + "github.com/sirupsen/logrus" +) + +var ( + _ api.Friendship = (*friendshipSrv)(nil) + _ api.FriendshipBinding = (*friendshipBinding)(nil) + _ api.FriendshipRender = (*friendshipRender)(nil) +) + +type friendshipSrv struct { + api.UnimplementedFriendshipServant + *base.DaoServant +} + +type friendshipBinding struct { + *api.UnimplementedFriendshipBinding +} + +type friendshipRender struct { + *api.UnimplementedFriendshipRender +} + +func (s *friendshipSrv) Chain() gin.HandlersChain { + return gin.HandlersChain{chain.JWT()} +} + +func (s *friendshipSrv) GetContacts(req *web.GetContactsReq) (*web.GetContactsResp, mir.Error) { + if req.User == nil { + return nil, xerror.ServerError + } + res, err := s.Ds.GetContacts(req.User.ID, (req.Page-1)*req.PageSize, req.PageSize) + if err != nil { + logrus.Errorf("service.GetContacts err: %s", err) + return nil, _errGetContactsFailed + } + resp := base.PageRespFrom(res.Contacts, req.Page, req.PageSize, res.Total) + return (*web.GetContactsResp)(resp), nil +} + +func (s *friendshipSrv) DeleteFriend(req *web.DeleteFriendReq) mir.Error { + if req.User == nil { + return xerror.ServerError + } + if req.User != nil && req.User.ID == req.UserId { + return _errNoActionToSelf + } + if _, err := s.Ds.GetUserByID(req.UserId); err != nil { + return _errNotExistFriendId + } + if err := s.Ds.DeleteFriend(req.User.ID, req.UserId); err != nil { + logrus.Errorf("Ds.DeleteFriend err: %s", err) + return _errDeleteFriendFailed + } + return nil +} + +func (s *friendshipSrv) RejectFriend(req *web.RejectFriendReq) mir.Error { + if req.User == nil { + return xerror.ServerError + } + if req.User.ID == req.UserId { + return _errNoActionToSelf + } + if _, err := s.Ds.GetUserByID(req.UserId); err != nil { + return _errNotExistFriendId + } + if err := s.Ds.RejectFriend(req.User.ID, req.UserId); err != nil { + logrus.Errorf("Ds.RejectFriend err: %s", err) + return _errRejectFriendFailed + } + return nil +} + +func (s *friendshipSrv) AddFriend(req *web.AddFriendReq) mir.Error { + if req.User == nil { + return xerror.ServerError + } + if req.User.ID == req.UserId { + return _errNoActionToSelf + } + if _, err := s.Ds.GetUserByID(req.UserId); err != nil { + return _errNotExistFriendId + } + if err := s.Ds.AddFriend(req.User.ID, req.UserId); err != nil { + logrus.Errorf("Ds.AddFriend err: %s", err) + return _errAddFriendFailed + } + return nil +} + +func (s *friendshipSrv) RequestingFriend(req *web.RequestingFriendReq) mir.Error { + if req.User == nil { + return xerror.ServerError + } + if req.User.ID == req.UserId { + return _errNoRequestingFriendToSelf + } + if _, err := s.Ds.GetUserByID(req.UserId); err != nil { + return _errNotExistFriendId + } + if err := s.Ds.RequestingFriend(req.User.ID, req.UserId, req.Greetings); err != nil { + logrus.Errorf("Ds.RequestingFriend err: %s", err) + return _errSendRequestingFriendFailed + } + return nil +} + +func newFriendshipSrv(s *base.DaoServant) api.Friendship { + return &friendshipSrv{ + DaoServant: s, + } +} + +func newFriendshipBinding() api.FriendshipBinding { + return &friendshipBinding{ + UnimplementedFriendshipBinding: &api.UnimplementedFriendshipBinding{ + BindAny: base.BindAny, + }, + } +} + +func newFriendshipRender() api.FriendshipRender { + return &friendshipRender{ + UnimplementedFriendshipRender: &api.UnimplementedFriendshipRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/web/loose.go b/internal/servants/web/loose.go new file mode 100644 index 00000000..9e9b1bff --- /dev/null +++ b/internal/servants/web/loose.go @@ -0,0 +1,172 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/model/web" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/internal/servants/chain" + "github.com/rocboss/paopao-ce/pkg/app" + "github.com/sirupsen/logrus" +) + +var ( + _ api.Loose = (*looseSrv)(nil) + _ api.LooseBinding = (*looseBinding)(nil) + _ api.LooseRender = (*looseRender)(nil) +) + +type looseSrv struct { + api.UnimplementedLooseServant + *base.DaoServant +} + +type looseBinding struct { + *api.UnimplementedLooseBinding +} + +type looseRender struct { + *api.UnimplementedLooseRender +} + +func (s *looseBinding) BindTimeline(c *gin.Context) (*web.TimelineReq, mir.Error) { + user, _ := base.UserFrom(c) + page, pageSize := app.GetPageInfo(c) + v := &web.TimelineReq{ + BaseInfo: web.BaseInfo{ + User: user, + }, + Query: c.Query("query"), + Type: "search", + Page: page, + PageSize: pageSize, + } + if c.Query("type") == "tag" { + v.Type = "tag" + } + return v, nil +} + +func (s *looseSrv) Chain() gin.HandlersChain { + return gin.HandlersChain{chain.JwtLoose()} +} + +func (s *looseSrv) Timeline(req *web.TimelineReq) (*web.TimelineResp, mir.Error) { + var resp *base.PageResp + offset, limit := (req.Page-1)*req.PageSize, req.PageSize + if req.Query == "" && req.Type == "search" { + res, err := s.Ds.IndexPosts(req.User, offset, limit) + if err != nil { + logrus.Errorf("Ds.IndexPosts err: %s", err) + return nil, _errGetPostsFailed + } + resp = base.PageRespFrom(res.Tweets, req.Page, req.PageSize, res.Total) + } else { + q := &core.QueryReq{ + Query: req.Query, + Type: core.SearchType(req.Type), + } + res, err := s.Ts.Search(req.User, q, offset, limit) + if err != nil { + logrus.Errorf("Ts.Search err: %s", err) + return nil, _errGetPostsFailed + } + posts, err := s.Ds.RevampPosts(res.Items) + if err != nil { + logrus.Errorf("Ds.RevampPosts err: %s", err) + return nil, _errGetPostsFailed + } + resp = base.PageRespFrom(posts, req.Page, req.PageSize, res.Total) + } + return (*web.TimelineResp)(resp), nil +} + +func (s *looseSrv) GetUserTweets(req *web.GetUserTweetsReq) (*web.GetUserTweetsResp, mir.Error) { + other, xerr := s.GetUserProfile(&web.GetUserProfileReq{ + BaseInfo: req.BaseInfo, + Username: req.Username, + }) + if xerr != nil { + return nil, xerr + } + + visibilities := []core.PostVisibleT{core.PostVisitPublic} + if req.User != nil { + if req.User.ID == other.ID || req.User.IsAdmin { + visibilities = append(visibilities, core.PostVisitPrivate, core.PostVisitFriend) + } else if other.IsFriend { + visibilities = append(visibilities, core.PostVisitFriend) + } + } + conditions := &core.ConditionsT{ + "user_id": other.ID, + "visibility IN ?": visibilities, + "ORDER": "latest_replied_on DESC", + } + _, posts, err := s.GetTweetList(conditions, (req.Page-1)*req.PageSize, req.PageSize) + if err != nil { + logrus.Errorf("s.GetTweetList err: %s", err) + return nil, _errGetPostsFailed + } + totalRows, err := s.Ds.GetPostCount(conditions) + if err != nil { + logrus.Errorf("s.GetPostCount err: %s", err) + return nil, _errGetPostsFailed + } + + resp := base.PageRespFrom(posts, req.Page, req.PageSize, totalRows) + return (*web.GetUserTweetsResp)(resp), nil +} + +func (s *looseSrv) GetUserProfile(req *web.GetUserProfileReq) (*web.GetUserProfileResp, mir.Error) { + he, err := s.Ds.GetUserByUsername(req.Username) + if err != nil { + logrus.Errorf("Ds.GetUserByUsername err: %s", err) + return nil, _errNoExistUsername + } + if he.Model == nil && he.ID <= 0 { + return nil, _errNoExistUsername + } + // 设定自己不是自己的朋友 + isFriend := !(req.User == nil || req.User.ID == he.ID) + if req.User != nil && req.User.ID != he.ID { + isFriend = s.Ds.IsFriend(req.User.ID, he.ID) + } + return &web.GetUserProfileResp{ + ID: he.ID, + Nickname: he.Nickname, + Username: he.Username, + Status: he.Status, + Avatar: he.Avatar, + IsAdmin: he.IsAdmin, + IsFriend: isFriend, + }, nil +} + +func newLooseSrv(s *base.DaoServant) api.Loose { + return &looseSrv{ + DaoServant: s, + } +} + +func newLooseBinding() api.LooseBinding { + return &looseBinding{ + UnimplementedLooseBinding: &api.UnimplementedLooseBinding{ + BindAny: base.BindAny, + }, + } +} + +func newLooseRender() api.LooseRender { + return &looseRender{ + UnimplementedLooseRender: &api.UnimplementedLooseRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/web/priv.go b/internal/servants/web/priv.go new file mode 100644 index 00000000..514bbdd7 --- /dev/null +++ b/internal/servants/web/priv.go @@ -0,0 +1,892 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "image" + "strings" + "time" + + "github.com/alimy/mir/v3" + "github.com/disintegration/imaging" + "github.com/gin-gonic/gin" + "github.com/gofrs/uuid" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/model/web" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/internal/servants/chain" + "github.com/rocboss/paopao-ce/pkg/convert" + "github.com/rocboss/paopao-ce/pkg/util" + "github.com/rocboss/paopao-ce/pkg/xerror" + "github.com/sirupsen/logrus" +) + +var ( + _ api.Priv = (*privSrv)(nil) + _ api.PrivBinding = (*privBinding)(nil) + _ api.PrivRender = (*privRender)(nil) + + _uploadAttachmentTypeMap = map[string]core.AttachmentType{ + "public/image": core.AttachmentTypeImage, + "public/avatar": core.AttachmentTypeImage, + "public/video": core.AttachmentTypeVideo, + "attachment": core.AttachmentTypeOther, + } +) + +type privSrv struct { + api.UnimplementedPrivServant + *base.DaoServant + + oss core.ObjectStorageService +} + +type privBinding struct { + *api.UnimplementedPrivBinding +} + +type privRender struct { + *api.UnimplementedPrivRender +} + +func (b *privBinding) BindUploadAttachment(c *gin.Context) (_ *web.UploadAttachmentReq, xerr mir.Error) { + UserId, exist := base.UserIdFrom(c) + if !exist { + return nil, xerror.UnauthorizedAuthNotExist + } + + uploadType := c.Request.FormValue("type") + file, fileHeader, err := c.Request.FormFile("file") + if err != nil { + return nil, _errFileUploadFailed + } + defer func() { + if xerr != nil { + file.Close() + } + }() + + if err := fileCheck(uploadType, fileHeader.Size); err != nil { + return nil, err + } + + contentType := fileHeader.Header.Get("Content-Type") + fileExt, xerr := getFileExt(contentType) + if xerr != nil { + return nil, xerr + } + + return &web.UploadAttachmentReq{ + SimpleInfo: web.SimpleInfo{ + Uid: UserId, + }, + UploadType: uploadType, + ContentType: contentType, + File: file, + FileSize: fileHeader.Size, + FileExt: fileExt, + }, nil +} + +func (b *privBinding) BindDownloadAttachmentPrecheck(c *gin.Context) (*web.DownloadAttachmentPrecheckReq, mir.Error) { + user, exist := base.UserFrom(c) + if !exist { + return nil, xerror.UnauthorizedAuthNotExist + } + return &web.DownloadAttachmentPrecheckReq{ + BaseInfo: web.BaseInfo{ + User: user, + }, + ContentID: convert.StrTo(c.Query("id")).MustInt64(), + }, nil +} + +func (b *privBinding) BindDownloadAttachment(c *gin.Context) (*web.DownloadAttachmentReq, mir.Error) { + user, exist := base.UserFrom(c) + if !exist { + return nil, xerror.UnauthorizedAuthNotExist + } + return &web.DownloadAttachmentReq{ + BaseInfo: web.BaseInfo{ + User: user, + }, + ContentID: convert.StrTo(c.Query("id")).MustInt64(), + }, nil +} + +func (s *privBinding) BindCreateTweet(c *gin.Context) (*web.CreateTweetReq, mir.Error) { + v := &web.CreateTweetReq{} + err := s.BindAny(c, v) + v.ClientIP = c.ClientIP() + return v, err +} + +func (s *privBinding) BindCreateCommentReply(c *gin.Context) (*web.CreateCommentReplyReq, mir.Error) { + v := &web.CreateCommentReplyReq{} + err := s.BindAny(c, v) + v.ClientIP = c.ClientIP() + return v, err +} + +func (s *privBinding) BindCreateComment(c *gin.Context) (*web.CreateCommentReq, mir.Error) { + v := &web.CreateCommentReq{} + err := s.BindAny(c, v) + v.ClientIP = c.ClientIP() + return v, err +} + +func (s *privSrv) Chain() gin.HandlersChain { + return gin.HandlersChain{chain.JWT(), chain.Priv()} +} + +func (s *privSrv) UploadAttachment(req *web.UploadAttachmentReq) (*web.UploadAttachmentResp, mir.Error) { + defer req.File.Close() + + // 生成随机路径 + randomPath := uuid.Must(uuid.NewV4()).String() + ossSavePath := req.UploadType + "/" + generatePath(randomPath[:8]) + "/" + randomPath[9:] + req.FileExt + objectUrl, err := s.oss.PutObject(ossSavePath, req.File, req.FileSize, req.ContentType, false) + if err != nil { + logrus.Errorf("oss.putObject err: %s", err) + return nil, _errFileUploadFailed + } + + // 构造附件Model + attachment := &core.Attachment{ + UserID: req.Uid, + FileSize: req.FileSize, + Content: objectUrl, + Type: _uploadAttachmentTypeMap[req.UploadType], + } + if attachment.Type == core.AttachmentTypeImage { + var src image.Image + src, err = imaging.Decode(req.File) + if err == nil { + attachment.ImgWidth, attachment.ImgHeight = getImageSize(src.Bounds()) + } + } + attachment, err = s.Ds.CreateAttachment(attachment) + if err != nil { + logrus.Errorf("Ds.CreateAttachment err: %s", err) + return nil, _errFileUploadFailed + } + + return &web.UploadAttachmentResp{ + UserID: req.Uid, + FileSize: req.FileSize, + ImgWidth: attachment.ImgWidth, + ImgHeight: attachment.ImgHeight, + Type: attachment.Type, + Content: attachment.Content, + }, nil +} + +func (s *privSrv) DownloadAttachmentPrecheck(req *web.DownloadAttachmentPrecheckReq) (*web.DownloadAttachmentPrecheckResp, mir.Error) { + content, err := s.Ds.GetPostContentByID(req.ContentID) + if err != nil { + logrus.Errorf("Ds.GetPostContentByID err: %s", err) + return nil, _errInvalidDownloadReq + } + resp := &web.DownloadAttachmentPrecheckResp{Paid: true} + if content.Type == core.ContentTypeChargeAttachment { + tweet, err := s.GetTweetBy(content.PostID) + if err != nil { + logrus.Errorf("get tweet err: %v", err) + return nil, _errInvalidDownloadReq + } + // 发布者或管理员免费下载 + if tweet.UserID == req.User.ID || req.User.IsAdmin { + return resp, nil + } + // 检测是否有购买记录 + resp.Paid = s.checkPostAttachmentIsPaid(req.ContentID, req.User.ID) + } + return resp, nil +} + +func (s *privSrv) DownloadAttachment(req *web.DownloadAttachmentReq) (*web.DownloadAttachmentResp, mir.Error) { + content, err := s.Ds.GetPostContentByID(req.ContentID) + if err != nil { + logrus.Errorf("s.GetPostContentByID err: %v", err) + return nil, _errInvalidDownloadReq + } + // 收费附件 + if content.Type == core.ContentTypeChargeAttachment { + post, err := s.GetTweetBy(content.PostID) + if err != nil { + logrus.Errorf("s.GetTweetBy err: %v", err) + return nil, xerror.ServerError + } + paidFlag := false + // 发布者或管理员免费下载 或者 检测是否有购买记录 + if post.UserID == req.User.ID || req.User.IsAdmin || s.checkPostAttachmentIsPaid(post.ID, req.User.ID) { + paidFlag = true + } + // 未购买,则尝试购买 + if !paidFlag { + err := s.buyPostAttachment(&core.Post{ + Model: &core.Model{ + ID: post.ID, + }, + UserID: post.UserID, + AttachmentPrice: post.AttachmentPrice, + }, req.User) + if err != nil { + return nil, err + } + } + } + // 签发附件下载链接 + objectKey := s.oss.ObjectKey(content.Content) + signedURL, err := s.oss.SignURL(objectKey, 60) + if err != nil { + logrus.Errorf("client.SignURL err: %v", err) + return nil, _errDownloadReqError + } + return &web.DownloadAttachmentResp{ + SignedURL: signedURL, + }, nil +} + +func (s *privSrv) CreateTweet(req *web.CreateTweetReq) (_ *web.CreateTweetResp, xerr mir.Error) { + var mediaContents []string + defer func() { + if xerr != nil { + deleteOssObjects(s.oss, mediaContents) + } + }() + + contents, err := persistMediaContents(s.oss, req.Contents) + if err != nil { + return nil, _errCreatePostFailed + } + mediaContents = contents + tags := tagsFrom(req.Tags) + post := &core.Post{ + UserID: req.User.ID, + Tags: strings.Join(tags, ","), + IP: req.ClientIP, + IPLoc: util.GetIPLoc(req.ClientIP), + AttachmentPrice: req.AttachmentPrice, + Visibility: req.Visibility, + } + post, err = s.Ds.CreatePost(post) + if err != nil { + logrus.Errorf("Ds.CreatePost err: %s", err) + return nil, _errCreatePostFailed + } + + // 创建推文内容 + for _, item := range req.Contents { + if err := item.Check(s.Ds); err != nil { + // 属性非法 + logrus.Infof("contents check err: %s", err) + continue + } + if item.Type == core.ContentTypeAttachment && req.AttachmentPrice > 0 { + item.Type = core.ContentTypeChargeAttachment + } + postContent := &core.PostContent{ + PostID: post.ID, + UserID: req.User.ID, + Content: item.Content, + Type: item.Type, + Sort: item.Sort, + } + if _, err = s.Ds.CreatePostContent(postContent); err != nil { + logrus.Infof("Ds.CreatePostContent err: %s", err) + return nil, _errCreateCommentFailed + } + } + + // 私密推文不创建标签与用户提醒 + if post.Visibility != core.PostVisitPrivate { + // 创建标签 + for _, t := range tags { + tag := &core.Tag{ + UserID: req.User.ID, + Tag: t, + } + s.Ds.CreateTag(tag) + } + + // 创建用户消息提醒 + for _, u := range req.Users { + user, err := s.Ds.GetUserByUsername(u) + if err != nil || user.ID == req.User.ID { + continue + } + + // 创建消息提醒 + // TODO: 优化消息提醒处理机制 + go s.Ds.CreateMessage(&core.Message{ + SenderUserID: req.User.ID, + ReceiverUserID: user.ID, + Type: core.MsgTypePost, + Brief: "在新发布的泡泡动态中@了你", + PostID: post.ID, + }) + } + } + // 推送Search + s.PushPostToSearch(post) + formatedPosts, err := s.Ds.RevampPosts([]*core.PostFormated{post.Format()}) + if err != nil { + logrus.Infof("Ds.RevampPosts err: %s", err) + return nil, _errCreatePostFailed + } + return (*web.CreateTweetResp)(formatedPosts[0]), nil +} + +func (s *privSrv) DeleteTweet(req *web.DeleteTweetReq) mir.Error { + if req.User == nil { + return _errNoPermission + } + post, err := s.Ds.GetPostByID(req.ID) + if err != nil { + logrus.Errorf("Ds.GetPostByID err: %s", err) + return _errGetPostFailed + } + if post.UserID != req.User.ID && !req.User.IsAdmin { + return _errNoPermission + } + mediaContents, err := s.Ds.DeletePost(post) + if err != nil { + logrus.Errorf("Ds.DeletePost delete post failed: %s", err) + return _errDeletePostFailed + } + // 删除推文的媒体内容 + deleteOssObjects(s.oss, mediaContents) + // 删除索引 + s.DeleteSearchPost(post) + if err != nil { + logrus.Errorf("s.DeleteSearchPost failed: %s", err) + return _errDeletePostFailed + } + return nil +} + +func (s *privSrv) DeleteCommentReply(req *web.DeleteCommentReplyReq) mir.Error { + reply, err := s.Ds.GetCommentReplyByID(req.ID) + if err != nil { + logrus.Errorf("Ds.GetCommentReplyByID err: %s", err) + return _errGetReplyFailed + } + if req.User.ID != reply.UserID && !req.User.IsAdmin { + return _errNoPermission + } + // 执行删除 + err = s.deletePostCommentReply(reply) + if err != nil { + logrus.Errorf("s.deletePostCommentReply err: %s", err) + return _errDeleteCommentFailed + } + return nil +} + +func (s *privSrv) CreateCommentReply(req *web.CreateCommentReplyReq) (*web.CreateCommentReplyResp, mir.Error) { + var ( + post *core.Post + comment *core.Comment + atUserID int64 + err error + ) + + if post, comment, atUserID, err = s.createPostPreHandler(req.CommentID, req.Uid, req.AtUserID); err != nil { + return nil, _errCreateReplyFailed + } + + // 创建评论 + reply := &core.CommentReply{ + CommentID: req.CommentID, + UserID: req.Uid, + Content: req.Content, + AtUserID: atUserID, + IP: req.ClientIP, + IPLoc: util.GetIPLoc(req.ClientIP), + } + + reply, err = s.Ds.CreateCommentReply(reply) + if err != nil { + return nil, _errCreateReplyFailed + } + + // 更新Post回复数 + post.CommentCount++ + post.LatestRepliedOn = time.Now().Unix() + s.Ds.UpdatePost(post) + + // 更新索引 + s.PushPostToSearch(post) + + // 创建用户消息提醒 + commentMaster, err := s.Ds.GetUserByID(comment.UserID) + if err == nil && commentMaster.ID != req.Uid { + go s.Ds.CreateMessage(&core.Message{ + SenderUserID: req.Uid, + ReceiverUserID: commentMaster.ID, + Type: core.MsgTypeReply, + Brief: "在泡泡评论下回复了你", + PostID: post.ID, + CommentID: comment.ID, + ReplyID: reply.ID, + }) + } + postMaster, err := s.Ds.GetUserByID(post.UserID) + if err == nil && postMaster.ID != req.Uid && commentMaster.ID != postMaster.ID { + go s.Ds.CreateMessage(&core.Message{ + SenderUserID: req.Uid, + ReceiverUserID: postMaster.ID, + Type: core.MsgTypeReply, + Brief: "在泡泡评论下发布了新回复", + PostID: post.ID, + CommentID: comment.ID, + ReplyID: reply.ID, + }) + } + if atUserID > 0 { + user, err := s.Ds.GetUserByID(atUserID) + if err == nil && user.ID != req.Uid && commentMaster.ID != user.ID && postMaster.ID != user.ID { + // 创建消息提醒 + go s.Ds.CreateMessage(&core.Message{ + SenderUserID: req.Uid, + ReceiverUserID: user.ID, + Type: core.MsgTypeReply, + Brief: "在泡泡评论的回复中@了你", + PostID: post.ID, + CommentID: comment.ID, + ReplyID: reply.ID, + }) + } + } + return (*web.CreateCommentReplyResp)(reply), nil +} + +func (s *privSrv) DeleteComment(req *web.DeleteCommentReq) mir.Error { + comment, err := s.Ds.GetCommentByID(req.ID) + if err != nil { + logrus.Errorf("Ds.GetCommentByID err: %v\n", err) + return _errGetCommentFailed + } + if req.User.ID != comment.UserID && !req.User.IsAdmin { + return _errNoPermission + } + // 加载post + post, err := s.Ds.GetPostByID(comment.PostID) + if err != nil { + return _errDeleteCommentFailed + } + // 更新post回复数 + post.CommentCount-- + if err := s.Ds.UpdatePost(post); err != nil { + logrus.Errorf("Ds.UpdatePost err: %s", err) + return _errDeleteCommentFailed + } + // TODO: 优化删除逻辑,事务化删除comment + if err := s.Ds.DeleteComment(comment); err != nil { + logrus.Errorf("Ds.DeleteComment err: %s", err) + return _errDeleteCommentFailed + } + return nil +} + +func (s *privSrv) CreateComment(req *web.CreateCommentReq) (_ *web.CreateCommentResp, xerr mir.Error) { + var ( + mediaContents []string + err error + ) + defer func() { + if xerr != nil { + deleteOssObjects(s.oss, mediaContents) + } + }() + + if mediaContents, err = persistMediaContents(s.oss, req.Contents); err != nil { + return nil, xerror.ServerError + } + + // 加载Post + post, err := s.Ds.GetPostByID(req.PostID) + if err != nil { + logrus.Errorf("Ds.GetPostByID err:%s", err) + return nil, xerror.ServerError + } + if post.CommentCount >= conf.AppSetting.MaxCommentCount { + return nil, _errMaxCommentCount + } + comment := &core.Comment{ + PostID: post.ID, + UserID: req.Uid, + IP: req.ClientIP, + IPLoc: util.GetIPLoc(req.ClientIP), + } + comment, err = s.Ds.CreateComment(comment) + if err != nil { + logrus.Errorf("Ds.CreateComment err:%s", err) + return nil, _errCreateCommentFailed + } + + for _, item := range req.Contents { + // 检查附件是否是本站资源 + if item.Type == core.ContentTypeImage || item.Type == core.ContentTypeVideo || item.Type == core.ContentTypeAttachment { + if err := s.Ds.CheckAttachment(item.Content); err != nil { + continue + } + } + postContent := &core.CommentContent{ + CommentID: comment.ID, + UserID: req.Uid, + Content: item.Content, + Type: item.Type, + Sort: item.Sort, + } + s.Ds.CreateCommentContent(postContent) + } + + // 更新Post回复数 + post.CommentCount++ + post.LatestRepliedOn = time.Now().Unix() + s.Ds.UpdatePost(post) + + // 更新索引 + s.PushPostToSearch(post) + + // 创建用户消息提醒 + postMaster, err := s.Ds.GetUserByID(post.UserID) + if err == nil && postMaster.ID != req.Uid { + go s.Ds.CreateMessage(&core.Message{ + SenderUserID: req.Uid, + ReceiverUserID: postMaster.ID, + Type: core.MsgtypeComment, + Brief: "在泡泡中评论了你", + PostID: post.ID, + CommentID: comment.ID, + }) + } + for _, u := range req.Users { + user, err := s.Ds.GetUserByUsername(u) + if err != nil || user.ID == req.Uid || user.ID == postMaster.ID { + continue + } + + // 创建消息提醒 + go s.Ds.CreateMessage(&core.Message{ + SenderUserID: req.Uid, + ReceiverUserID: user.ID, + Type: core.MsgtypeComment, + Brief: "在泡泡评论中@了你", + PostID: post.ID, + CommentID: comment.ID, + }) + } + + return (*web.CreateCommentResp)(comment), nil +} + +func (s *privSrv) CollectionTweet(req *web.CollectionTweetReq) (*web.CollectionTweetResp, mir.Error) { + status := false + collection, err := s.Ds.GetUserPostCollection(req.ID, req.Uid) + if err != nil { + // 创建Star + if _, xerr := s.createPostCollection(req.ID, req.Uid); xerr != nil { + return nil, xerr + } + status = true + } else { + // 取消Star + if xerr := s.deletePostCollection(collection); xerr != nil { + return nil, xerr + } + } + return &web.CollectionTweetResp{ + Status: status, + }, nil +} + +func (s *privSrv) StarTweet(req *web.StarTweetReq) (*web.StarTweetResp, mir.Error) { + status := false + star, err := s.Ds.GetUserPostStar(req.ID, req.Uid) + if err != nil { + // 创建Star + if _, xerr := s.createPostStar(req.ID, req.Uid); xerr != nil { + return nil, xerr + } + status = true + } else { + // 取消Star + if xerr := s.deletePostStar(star); xerr != nil { + return nil, xerr + } + } + return &web.StarTweetResp{ + Status: status, + }, nil +} + +func (s *privSrv) VisiblePost(req *web.VisiblePostReq) (*web.VisiblePostResp, mir.Error) { + if req.Visibility >= core.PostVisitInvalid { + return nil, xerror.InvalidParams + } + post, err := s.Ds.GetPostByID(req.User.ID) + if err != nil { + return nil, _errVisblePostFailed + } + if xerr := checkPermision(req.User, post.UserID); xerr != nil { + return nil, xerr + } + if err = s.Ds.VisiblePost(post, req.Visibility); err != nil { + logrus.Warnf("update post failure: %v", err) + return nil, _errVisblePostFailed + } + + // 推送Search + post.Visibility = req.Visibility + s.PushPostToSearch(post) + + return &web.VisiblePostResp{ + Visibility: req.Visibility, + }, nil +} + +func (s *privSrv) StickTweet(req *web.StickTweetReq) (*web.StickTweetResp, mir.Error) { + post, err := s.Ds.GetPostByID(req.ID) + if err != nil { + logrus.Errorf("Ds.GetPostByID err: %v\n", err) + return nil, _errStickPostFailed + } + + if !req.User.IsAdmin { + return nil, _errNoPermission + } + if err = s.Ds.StickPost(post); err != nil { + return nil, _errStickPostFailed + } + return &web.StickTweetResp{ + StickStatus: 1 - post.IsTop, + }, nil +} + +func (s *privSrv) LockTweet(req *web.LockTweetReq) (*web.LockTweetResp, mir.Error) { + post, err := s.Ds.GetPostByID(req.ID) + if err != nil { + return nil, _errLockPostFailed + } + + if post.UserID != req.User.ID && !req.User.IsAdmin { + return nil, _errNoPermission + } + + if err := s.Ds.LockPost(post); err != nil { + return nil, _errLockPostFailed + } + return &web.LockTweetResp{ + LockStatus: 1 - post.IsLock, + }, nil +} + +func (s *privSrv) deletePostCommentReply(reply *core.CommentReply) error { + err := s.Ds.DeleteCommentReply(reply) + if err != nil { + return err + } + // 加载Comment + comment, err := s.Ds.GetCommentByID(reply.CommentID) + if err != nil { + return err + } + // 加载comment的post + post, err := s.Ds.GetPostByID(comment.PostID) + if err != nil { + return err + } + // 更新Post回复数 + post.CommentCount-- + post.LatestRepliedOn = time.Now().Unix() + s.Ds.UpdatePost(post) + // 更新索引 + s.PushPostToSearch(post) + return nil +} + +func (s *privSrv) createPostPreHandler(commentID int64, userID, atUserID int64) (*core.Post, *core.Comment, int64, + error) { + // 加载Comment + comment, err := s.Ds.GetCommentByID(commentID) + if err != nil { + return nil, nil, atUserID, err + } + + // 加载comment的post + post, err := s.Ds.GetPostByID(comment.PostID) + if err != nil { + return nil, nil, atUserID, err + } + + if post.CommentCount >= conf.AppSetting.MaxCommentCount { + return nil, nil, atUserID, _errMaxCommentCount + } + + if userID == atUserID { + atUserID = 0 + } + + if atUserID > 0 { + // 检测目前用户是否存在 + users, _ := s.Ds.GetUsersByIDs([]int64{atUserID}) + if len(users) == 0 { + atUserID = 0 + } + } + + return post, comment, atUserID, nil +} + +func (s *privSrv) createPostStar(postID, userID int64) (*core.PostStar, mir.Error) { + // 加载Post + post, err := s.Ds.GetPostByID(postID) + if err != nil { + return nil, xerror.ServerError + } + + // 私密post不可操作 + if post.Visibility == core.PostVisitPrivate { + return nil, _errNoPermission + } + + star, err := s.Ds.CreatePostStar(postID, userID) + if err != nil { + return nil, xerror.ServerError + } + + // 更新Post点赞数 + post.UpvoteCount++ + s.Ds.UpdatePost(post) + + // 更新索引 + s.PushPostToSearch(post) + + return star, nil +} + +func (s *privSrv) deletePostStar(star *core.PostStar) mir.Error { + err := s.Ds.DeletePostStar(star) + if err != nil { + return xerror.ServerError + } + // 加载Post + post, err := s.Ds.GetPostByID(star.PostID) + if err != nil { + return xerror.ServerError + } + + // 私密post不可操作 + if post.Visibility == core.PostVisitPrivate { + return _errNoPermission + } + + // 更新Post点赞数 + post.UpvoteCount-- + s.Ds.UpdatePost(post) + + // 更新索引 + s.PushPostToSearch(post) + + return nil +} + +func (s *privSrv) createPostCollection(postID, userID int64) (*core.PostCollection, mir.Error) { + // 加载Post + post, err := s.Ds.GetPostByID(postID) + if err != nil { + return nil, xerror.ServerError + } + + // 私密post不可操作 + if post.Visibility == core.PostVisitPrivate { + return nil, _errNoPermission + } + + collection, err := s.Ds.CreatePostCollection(postID, userID) + if err != nil { + return nil, xerror.ServerError + } + + // 更新Post点赞数 + post.CollectionCount++ + s.Ds.UpdatePost(post) + + // 更新索引 + s.PushPostToSearch(post) + + return collection, nil +} + +func (s *privSrv) deletePostCollection(collection *core.PostCollection) mir.Error { + err := s.Ds.DeletePostCollection(collection) + if err != nil { + return xerror.ServerError + } + // 加载Post + post, err := s.Ds.GetPostByID(collection.PostID) + if err != nil { + return xerror.ServerError + } + + // 私密post不可操作 + if post.Visibility == core.PostVisitPrivate { + return _errNoPermission + } + + // 更新Post点赞数 + post.CollectionCount-- + s.Ds.UpdatePost(post) + + // 更新索引 + s.PushPostToSearch(post) + + return nil +} + +func (s *privSrv) checkPostAttachmentIsPaid(postID, userID int64) bool { + bill, err := s.Ds.GetPostAttatchmentBill(postID, userID) + return err == nil && bill.Model != nil && bill.ID > 0 +} + +func (s *privSrv) buyPostAttachment(post *core.Post, user *core.User) mir.Error { + if user.Balance < post.AttachmentPrice { + return _errInsuffientDownloadMoney + } + // 执行购买 + if err := s.Ds.HandlePostAttachmentBought(post, user); err != nil { + logrus.Errorf("Ds.HandlePostAttachmentBought err: %s", err) + return xerror.ServerError + } + return nil +} + +func newPrivSrv(s *base.DaoServant, oss core.ObjectStorageService) api.Priv { + return &privSrv{ + DaoServant: s, + oss: oss, + } +} + +func newPrivBinding() api.PrivBinding { + return &privBinding{ + UnimplementedPrivBinding: &api.UnimplementedPrivBinding{ + BindAny: base.BindAny, + }, + } +} + +func newPrivRender() api.PrivRender { + return &privRender{ + UnimplementedPrivRender: &api.UnimplementedPrivRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/servants/web/pub.go b/internal/servants/web/pub.go new file mode 100644 index 00000000..f24913d1 --- /dev/null +++ b/internal/servants/web/pub.go @@ -0,0 +1,371 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "bytes" + "context" + "encoding/base64" + "fmt" + "image/color" + "image/png" + "regexp" + "time" + "unicode/utf8" + + "github.com/afocus/captcha" + "github.com/alimy/mir/v3" + "github.com/gin-gonic/gin" + "github.com/gofrs/uuid" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/model/web" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/rocboss/paopao-ce/internal/servants/web/assets" + "github.com/rocboss/paopao-ce/pkg/app" + "github.com/rocboss/paopao-ce/pkg/convert" + "github.com/rocboss/paopao-ce/pkg/debug" + "github.com/rocboss/paopao-ce/pkg/util" + "github.com/rocboss/paopao-ce/pkg/xerror" + "github.com/sirupsen/logrus" +) + +var ( + _ api.Pub = (*pubSrv)(nil) + _ api.PubBinding = (*pubBinding)(nil) + _ api.PubRender = (*pubRender)(nil) +) + +const ( + _LoginErrKey = "PaoPaoUserLoginErr" + _MaxLoginErrTimes = 10 + _MaxPhoneCaptcha = 10 +) + +type pubSrv struct { + api.UnimplementedPubServant + *base.DaoServant +} + +type pubBinding struct { + *api.UnimplementedPubBinding +} + +type pubRender struct { + *api.UnimplementedPubRender +} + +func (b *pubBinding) BindTweetComments(c *gin.Context) (*web.TweetCommentsReq, mir.Error) { + tweetId := convert.StrTo(c.Query("id")).MustInt64() + page, pageSize := app.GetPageInfo(c) + return &web.TweetCommentsReq{ + TweetId: tweetId, + Page: page, + PageSize: pageSize, + }, nil + +} + +func (s *pubSrv) TopicList(req *web.TopicListReq) (*web.TopicListResp, mir.Error) { + // tags, err := broker.GetPostTags(¶m) + num := req.Num + if num > conf.AppSetting.MaxPageSize { + num = conf.AppSetting.MaxPageSize + } + + conditions := &core.ConditionsT{} + if req.Type == web.TagTypeHot { + // 热门标签 + conditions = &core.ConditionsT{ + "ORDER": "quote_num DESC", + } + } else if req.Type == web.TagTypeNew { + // 热门标签 + conditions = &core.ConditionsT{ + "ORDER": "id DESC", + } + } + tags, err := s.Ds.GetTags(conditions, 0, num) + if err != nil { + return nil, _errGetPostTagsFailed + } + // 获取创建者User IDs + userIds := []int64{} + for _, tag := range tags { + userIds = append(userIds, tag.UserID) + } + users, _ := s.Ds.GetUsersByIDs(userIds) + tagsFormated := []*core.TagFormated{} + for _, tag := range tags { + tagFormated := tag.Format() + for _, user := range users { + if user.ID == tagFormated.UserID { + tagFormated.User = user.Format() + } + } + tagsFormated = append(tagsFormated, tagFormated) + } + return &web.TopicListResp{ + Topics: tagsFormated, + }, nil +} + +func (s *pubSrv) TweetComments(req *web.TweetCommentsReq) (*web.TweetCommentsResp, mir.Error) { + conditions := &core.ConditionsT{ + "post_id": req.TweetId, + "ORDER": "id ASC", + } + + comments, err := s.Ds.GetComments(conditions, (req.Page-1)*req.PageSize, req.PageSize) + if err != nil { + return nil, _errGetCommentsFailed + } + + userIDs := []int64{} + commentIDs := []int64{} + for _, comment := range comments { + userIDs = append(userIDs, comment.UserID) + commentIDs = append(commentIDs, comment.ID) + } + + users, err := s.Ds.GetUsersByIDs(userIDs) + if err != nil { + return nil, _errGetCommentsFailed + } + + contents, err := s.Ds.GetCommentContentsByIDs(commentIDs) + if err != nil { + return nil, _errGetCommentsFailed + } + + replies, err := s.Ds.GetCommentRepliesByID(commentIDs) + if err != nil { + return nil, _errGetCommentsFailed + } + + commentsFormated := []*core.CommentFormated{} + for _, comment := range comments { + commentFormated := comment.Format() + for _, content := range contents { + if content.CommentID == comment.ID { + commentFormated.Contents = append(commentFormated.Contents, content) + } + } + for _, reply := range replies { + if reply.CommentID == commentFormated.ID { + commentFormated.Replies = append(commentFormated.Replies, reply) + } + } + for _, user := range users { + if user.ID == comment.UserID { + commentFormated.User = user.Format() + } + } + commentsFormated = append(commentsFormated, commentFormated) + } + + // 获取总量 + totalRows, _ := s.Ds.GetCommentCount(conditions) + resp := base.PageRespFrom(contents, req.Page, req.PageSize, totalRows) + return (*web.TweetCommentsResp)(resp), nil +} + +func (s *pubSrv) TweetDetail(req *web.TweetDetailReq) (*web.TweetDetailResp, mir.Error) { + post, err := s.Ds.GetPostByID(req.TweetId) + if err != nil { + return nil, _errGetPostFailed + } + postContents, err := s.Ds.GetPostContentsByIDs([]int64{post.ID}) + if err != nil { + return nil, _errGetPostFailed + } + users, err := s.Ds.GetUsersByIDs([]int64{post.UserID}) + if err != nil { + return nil, _errGetPostFailed + } + // 数据整合 + postFormated := post.Format() + for _, user := range users { + postFormated.User = user.Format() + } + for _, content := range postContents { + if content.PostID == post.ID { + postFormated.Contents = append(postFormated.Contents, content.Format()) + } + } + return (*web.TweetDetailResp)(postFormated), nil +} + +func (s *pubSrv) SendCaptcha(req *web.SendCaptchaReq) mir.Error { + ctx := context.Background() + + // 验证图片验证码 + if res, err := s.Redis.Get(ctx, "PaoPaoCaptcha:"+req.ImgCaptchaID).Result(); err != nil || res != req.ImgCaptcha { + return _errErrorCaptchaPassword + } + s.Redis.Del(ctx, "PaoPaoCaptcha:"+req.ImgCaptchaID).Result() + + // 今日频次限制 + if res, _ := s.Redis.Get(ctx, "PaoPaoSmsCaptcha:"+req.Phone).Result(); convert.StrTo(res).MustInt() >= _MaxPhoneCaptcha { + return _errTooManyPhoneCaptchaSend + } + + if err := s.Ds.SendPhoneCaptcha(req.Phone); err != nil { + return xerror.ServerError + } + // 写入计数缓存 + s.Redis.Incr(ctx, "PaoPaoSmsCaptcha:"+req.Phone).Result() + currentTime := time.Now() + endTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, currentTime.Location()) + s.Redis.Expire(ctx, "PaoPaoSmsCaptcha:"+req.Phone, endTime.Sub(currentTime)) + + return nil +} + +func (s *pubSrv) GetCaptcha() (*web.GetCaptchaResp, mir.Error) { + cap := captcha.New() + if err := cap.AddFontFromBytes(assets.ComicBytes); err != nil { + logrus.Errorf("cap.AddFontFromBytes err:%s", err) + return nil, xerror.ServerError + } + cap.SetSize(160, 64) + cap.SetDisturbance(captcha.MEDIUM) + cap.SetFrontColor(color.RGBA{0, 0, 0, 255}) + cap.SetBkgColor(color.RGBA{218, 240, 228, 255}) + img, password := cap.Create(6, captcha.NUM) + emptyBuff := bytes.NewBuffer(nil) + if err := png.Encode(emptyBuff, img); err != nil { + logrus.Errorf("png.Encode err:%s", err) + return nil, xerror.ServerError + } + key := util.EncodeMD5(uuid.Must(uuid.NewV4()).String()) + // 五分钟有效期 + s.Redis.SetEX(context.Background(), "PaoPaoCaptcha:"+key, password, time.Minute*5) + return &web.GetCaptchaResp{ + Id: key, + Content: "data:image/png;base64," + base64.StdEncoding.EncodeToString(emptyBuff.Bytes()), + }, nil +} + +func (s *pubSrv) Register(req *web.RegisterReq) (*web.RegisterResp, mir.Error) { + // 用户名检查 + if err := s.validUsername(req.Username); err != nil { + return nil, err + } + // 密码检查 + if err := checkPassword(req.Password); err != nil { + logrus.Errorf("scheckPassword err: %v", err) + return nil, _errUserRegisterFailed + } + password, salt := encryptPasswordAndSalt(req.Password) + user := &core.User{ + Nickname: req.Username, + Username: req.Username, + Password: password, + Avatar: getRandomAvatar(), + Salt: salt, + Status: core.UserStatusNormal, + } + user, err := s.Ds.CreateUser(user) + if err != nil { + logrus.Errorf("Ds.CreateUser err: %s", err) + return nil, _errUserRegisterFailed + } + return &web.RegisterResp{ + UserId: user.ID, + Username: user.Username, + }, nil +} + +func (s *pubSrv) Login(req *web.LoginReq) (*web.LoginResp, mir.Error) { + ctx := context.Background() + user, err := s.Ds.GetUserByUsername(req.Username) + if err != nil { + logrus.Errorf("Ds.GetUserByUsername err:%s", err) + return nil, xerror.UnauthorizedAuthNotExist + } + + if user.Model != nil && user.ID > 0 { + if errTimes, err := s.Redis.Get(ctx, fmt.Sprintf("%s:%d", _LoginErrKey, user.ID)).Result(); err == nil { + if convert.StrTo(errTimes).MustInt() >= _MaxLoginErrTimes { + return nil, _errTooManyLoginError + } + } + // 对比密码是否正确 + if validPassword(user.Password, req.Password, user.Salt) { + if user.Status == core.UserStatusClosed { + return nil, _errUserHasBeenBanned + } + // 清空登录计数 + s.Redis.Del(ctx, fmt.Sprintf("%s:%d", _LoginErrKey, user.ID)) + } else { + // 登录错误计数 + _, err = s.Redis.Incr(ctx, fmt.Sprintf("%s:%d", _LoginErrKey, user.ID)).Result() + if err == nil { + s.Redis.Expire(ctx, fmt.Sprintf("%s:%d", _LoginErrKey, user.ID), time.Hour).Result() + } + return nil, xerror.UnauthorizedAuthFailed + } + } else { + return nil, xerror.UnauthorizedAuthNotExist + } + + token, err := app.GenerateToken(user) + if err != nil { + logrus.Errorf("app.GenerateToken err: %v", err) + return nil, xerror.UnauthorizedTokenGenerate + } + return &web.LoginResp{ + Token: token, + }, nil +} + +func (s *pubSrv) Version() (*web.VersionResp, mir.Error) { + return &web.VersionResp{ + BuildInfo: debug.ReadBuildInfo(), + }, nil +} + +// validUsername 验证用户 +func (s *pubSrv) validUsername(username string) mir.Error { + // 检测用户是否合规 + if utf8.RuneCountInString(username) < 3 || utf8.RuneCountInString(username) > 12 { + return _errUsernameLengthLimit + } + + if !regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString(username) { + return _errUsernameCharLimit + } + + // 重复检查 + user, _ := s.Ds.GetUserByUsername(username) + if user.Model != nil && user.ID > 0 { + return _errUsernameHasExisted + } + return nil +} + +func newPubSrv(s *base.DaoServant) api.Pub { + return &pubSrv{ + DaoServant: s, + } +} + +func newPubBinding() api.PubBinding { + return &pubBinding{ + UnimplementedPubBinding: &api.UnimplementedPubBinding{ + BindAny: base.BindAny, + }, + } +} + +func newPubRender() api.PubRender { + return &pubRender{ + UnimplementedPubRender: &api.UnimplementedPubRender{ + RenderAny: base.RenderAny, + }, + } +} diff --git a/internal/routers/api/api.go b/internal/servants/web/routers/api/api.go similarity index 88% rename from internal/routers/api/api.go rename to internal/servants/web/routers/api/api.go index 17d56d7c..b2e60cb6 100644 --- a/internal/routers/api/api.go +++ b/internal/servants/web/routers/api/api.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package api import ( diff --git a/internal/routers/api/attachment.go b/internal/servants/web/routers/api/attachment.go similarity index 78% rename from internal/routers/api/attachment.go rename to internal/servants/web/routers/api/attachment.go index 905b2c03..fb6a173c 100644 --- a/internal/routers/api/attachment.go +++ b/internal/servants/web/routers/api/attachment.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package api import ( @@ -6,19 +10,19 @@ import ( "github.com/disintegration/imaging" "github.com/gin-gonic/gin" "github.com/gofrs/uuid" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/service" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/servants/web/broker" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/convert" "github.com/rocboss/paopao-ce/pkg/errcode" "github.com/sirupsen/logrus" ) -var uploadAttachmentTypeMap = map[string]model.AttachmentType{ - "public/image": model.ATTACHMENT_TYPE_IMAGE, - "public/avatar": model.ATTACHMENT_TYPE_IMAGE, - "public/video": model.ATTACHMENT_TYPE_VIDEO, - "attachment": model.ATTACHMENT_TYPE_OTHER, +var uploadAttachmentTypeMap = map[string]core.AttachmentType{ + "public/image": core.AttachmentTypeImage, + "public/avatar": core.AttachmentTypeImage, + "public/video": core.AttachmentTypeVideo, + "attachment": core.AttachmentTypeOther, } func GeneratePath(s string) string { @@ -110,7 +114,7 @@ func UploadAttachment(c *gin.Context) { } // 构造附件Model - attachment := &model.Attachment{ + attachment := &core.Attachment{ FileSize: fileHeader.Size, Content: objectUrl, } @@ -120,7 +124,7 @@ func UploadAttachment(c *gin.Context) { } attachment.Type = uploadAttachmentTypeMap[uploadType] - if attachment.Type == model.ATTACHMENT_TYPE_IMAGE { + if attachment.Type == core.AttachmentTypeImage { var src image.Image src, err = imaging.Decode(file) if err == nil { @@ -128,7 +132,7 @@ func UploadAttachment(c *gin.Context) { } } - attachment, err = service.CreateAttachment(attachment) + attachment, err = broker.CreateAttachment(attachment) if err != nil { logrus.Errorf("service.CreateAttachment err: %v", err) response.ToErrorResponse(errcode.FileUploadFailed) @@ -142,15 +146,15 @@ func DownloadAttachmentPrecheck(c *gin.Context) { contentID := convert.StrTo(c.Query("id")).MustInt64() // 加载content - content, err := service.GetPostContentByID(contentID) + content, err := broker.GetPostContentByID(contentID) if err != nil { logrus.Errorf("service.GetPostContentByID err: %v", err) response.ToErrorResponse(errcode.InvalidDownloadReq) } user, _ := c.Get("USER") - if content.Type == model.CONTENT_TYPE_CHARGE_ATTACHMENT { + if content.Type == core.ContentTypeChargeAttachment { // 加载post - post, err := service.GetPost(content.PostID) + post, err := broker.GetPost(content.PostID) if err != nil { logrus.Errorf("service.GetPost err: %v", err) response.ToResponse(gin.H{ @@ -160,7 +164,7 @@ func DownloadAttachmentPrecheck(c *gin.Context) { } // 发布者或管理员免费下载 - if post.UserID == user.(*model.User).ID || user.(*model.User).IsAdmin { + if post.UserID == user.(*core.User).ID || user.(*core.User).IsAdmin { response.ToResponse(gin.H{ "paid": true, }) @@ -169,7 +173,7 @@ func DownloadAttachmentPrecheck(c *gin.Context) { // 检测是否有购买记录 response.ToResponse(gin.H{ - "paid": service.CheckPostAttachmentIsPaid(post.ID, user.(*model.User).ID), + "paid": broker.CheckPostAttachmentIsPaid(post.ID, user.(*core.User).ID), }) return } @@ -184,18 +188,18 @@ func DownloadAttachment(c *gin.Context) { contentID := convert.StrTo(c.Query("id")).MustInt64() // 加载content - content, err := service.GetPostContentByID(contentID) + content, err := broker.GetPostContentByID(contentID) if err != nil { logrus.Errorf("service.GetPostContentByID err: %v", err) response.ToErrorResponse(errcode.InvalidDownloadReq) } // 收费附件 - if content.Type == model.CONTENT_TYPE_CHARGE_ATTACHMENT { + if content.Type == core.ContentTypeChargeAttachment { user, _ := c.Get("USER") // 加载post - post, err := service.GetPost(content.PostID) + post, err := broker.GetPost(content.PostID) if err != nil { logrus.Errorf("service.GetPost err: %v", err) response.ToResponse(gin.H{ @@ -207,24 +211,24 @@ func DownloadAttachment(c *gin.Context) { paidFlag := false // 发布者或管理员免费下载 - if post.UserID == user.(*model.User).ID || user.(*model.User).IsAdmin { + if post.UserID == user.(*core.User).ID || user.(*core.User).IsAdmin { paidFlag = true } // 检测是否有购买记录 - if service.CheckPostAttachmentIsPaid(post.ID, user.(*model.User).ID) { + if broker.CheckPostAttachmentIsPaid(post.ID, user.(*core.User).ID) { paidFlag = true } if !paidFlag { // 未购买,则尝试购买 - err := service.BuyPostAttachment(&model.Post{ - Model: &model.Model{ + err := broker.BuyPostAttachment(&core.Post{ + Model: &core.Model{ ID: post.ID, }, UserID: post.UserID, AttachmentPrice: post.AttachmentPrice, - }, user.(*model.User)) + }, user.(*core.User)) if err != nil { logrus.Errorf("service.BuyPostAttachment err: %v", err) if err == errcode.InsuffientDownloadMoney { @@ -246,5 +250,7 @@ func DownloadAttachment(c *gin.Context) { response.ToErrorResponse(errcode.DownloadReqError) return } - response.ToResponse(signedURL) + response.ToResponse(gin.H{ + "signed_url": signedURL, + }) } diff --git a/internal/routers/api/comment.go b/internal/servants/web/routers/api/comment.go similarity index 75% rename from internal/routers/api/comment.go rename to internal/servants/web/routers/api/comment.go index 4b1fca36..0779eabb 100644 --- a/internal/routers/api/comment.go +++ b/internal/servants/web/routers/api/comment.go @@ -1,9 +1,13 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package api import ( "github.com/gin-gonic/gin" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/service" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/servants/web/broker" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/convert" "github.com/rocboss/paopao-ce/pkg/errcode" @@ -14,7 +18,7 @@ func GetPostComments(c *gin.Context) { postID := convert.StrTo(c.Query("id")).MustInt64() response := app.NewResponse(c) - contents, totalRows, err := service.GetPostComments(postID, "id ASC", 0, 0) + contents, totalRows, err := broker.GetPostComments(postID, "id ASC", 0, 0) if err != nil { logrus.Errorf("service.GetPostComments err: %v\n", err) @@ -26,7 +30,7 @@ func GetPostComments(c *gin.Context) { } func CreatePostComment(c *gin.Context) { - param := service.CommentCreationReq{} + param := broker.CommentCreationReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -36,7 +40,7 @@ func CreatePostComment(c *gin.Context) { } userID, _ := c.Get("UID") - comment, err := service.CreatePostComment(c, userID.(int64), param) + comment, err := broker.CreatePostComment(c, userID.(int64), param) if err != nil { if err == errcode.MaxCommentCount { @@ -52,7 +56,7 @@ func CreatePostComment(c *gin.Context) { } func DeletePostComment(c *gin.Context) { - param := service.CommentDelReq{} + param := broker.CommentDelReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -62,20 +66,20 @@ func DeletePostComment(c *gin.Context) { } user, _ := c.Get("USER") - comment, err := service.GetPostComment(param.ID) + comment, err := broker.GetPostComment(param.ID) if err != nil { logrus.Errorf("service.GetPostComment err: %v\n", err) response.ToErrorResponse(errcode.GetCommentFailed) return } - if user.(*model.User).ID != comment.UserID && !user.(*model.User).IsAdmin { + if user.(*core.User).ID != comment.UserID && !user.(*core.User).IsAdmin { response.ToErrorResponse(errcode.NoPermission) return } // 执行删除 - err = service.DeletePostComment(comment) + err = broker.DeletePostComment(comment) if err != nil { logrus.Errorf("service.DeletePostComment err: %v\n", err) response.ToErrorResponse(errcode.DeleteCommentFailed) @@ -86,7 +90,7 @@ func DeletePostComment(c *gin.Context) { } func CreatePostCommentReply(c *gin.Context) { - param := service.CommentReplyCreationReq{} + param := broker.CommentReplyCreationReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -96,7 +100,7 @@ func CreatePostCommentReply(c *gin.Context) { } user, _ := c.Get("USER") - comment, err := service.CreatePostCommentReply(c, param.CommentID, param.Content, user.(*model.User).ID, param.AtUserID) + comment, err := broker.CreatePostCommentReply(c, param.CommentID, param.Content, user.(*core.User).ID, param.AtUserID) if err != nil { logrus.Errorf("service.CreatePostCommentReply err: %v\n", err) response.ToErrorResponse(errcode.CreateReplyFailed) @@ -107,7 +111,7 @@ func CreatePostCommentReply(c *gin.Context) { } func DeletePostCommentReply(c *gin.Context) { - param := service.ReplyDelReq{} + param := broker.ReplyDelReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -118,20 +122,20 @@ func DeletePostCommentReply(c *gin.Context) { user, _ := c.Get("USER") - reply, err := service.GetPostCommentReply(param.ID) + reply, err := broker.GetPostCommentReply(param.ID) if err != nil { logrus.Errorf("service.GetPostCommentReply err: %v\n", err) response.ToErrorResponse(errcode.GetReplyFailed) return } - if user.(*model.User).ID != reply.UserID && !user.(*model.User).IsAdmin { + if user.(*core.User).ID != reply.UserID && !user.(*core.User).IsAdmin { response.ToErrorResponse(errcode.NoPermission) return } // 执行删除 - err = service.DeletePostCommentReply(reply) + err = broker.DeletePostCommentReply(reply) if err != nil { logrus.Errorf("service.DeletePostCommentReply err: %v\n", err) response.ToErrorResponse(errcode.DeleteCommentFailed) diff --git a/internal/routers/api/home.go b/internal/servants/web/routers/api/home.go similarity index 82% rename from internal/routers/api/home.go rename to internal/servants/web/routers/api/home.go index 80489978..30f115a9 100644 --- a/internal/routers/api/home.go +++ b/internal/servants/web/routers/api/home.go @@ -1,8 +1,11 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package api import ( "bytes" - _ "embed" "encoding/base64" "image/color" "image/png" @@ -12,8 +15,9 @@ import ( "github.com/gin-gonic/gin" "github.com/gofrs/uuid" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/service" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/servants/web/assets" + "github.com/rocboss/paopao-ce/internal/servants/web/broker" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/convert" "github.com/rocboss/paopao-ce/pkg/debug" @@ -22,9 +26,6 @@ import ( "github.com/sirupsen/logrus" ) -//go:embed assets/comic.ttf -var comic []byte - const MAX_PHONE_CAPTCHA = 10 func Version(c *gin.Context) { @@ -39,8 +40,8 @@ func SyncSearchIndex(c *gin.Context) { user, _ := c.Get("USER") - if user.(*model.User).IsAdmin { - go service.PushPostsToSearch(c) + if user.(*core.User).IsAdmin { + go broker.PushPostsToSearch(c) } response.ToResponse(nil) @@ -49,7 +50,7 @@ func SyncSearchIndex(c *gin.Context) { func GetCaptcha(c *gin.Context) { cap := captcha.New() - if err := cap.AddFontFromBytes(comic); err != nil { + if err := cap.AddFontFromBytes(assets.ComicBytes); err != nil { panic(err.Error()) } @@ -74,7 +75,7 @@ func GetCaptcha(c *gin.Context) { } func PostCaptcha(c *gin.Context) { - param := service.PhoneCaptchaReq{} + param := broker.PhoneCaptchaReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -96,7 +97,7 @@ func PostCaptcha(c *gin.Context) { return } - err := service.SendPhoneCaptcha(c, param.Phone) + err := broker.SendPhoneCaptcha(c, param.Phone) if err != nil { logrus.Errorf("app.SendPhoneCaptcha errs: %v", errs) response.ToErrorResponse(errcode.GetPhoneCaptchaError) diff --git a/internal/routers/api/message.go b/internal/servants/web/routers/api/message.go similarity index 74% rename from internal/routers/api/message.go rename to internal/servants/web/routers/api/message.go index 8c24cbd2..9cc72ffd 100644 --- a/internal/routers/api/message.go +++ b/internal/servants/web/routers/api/message.go @@ -1,9 +1,13 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package api import ( "github.com/gin-gonic/gin" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/service" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/servants/web/broker" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/errcode" "github.com/sirupsen/logrus" @@ -12,12 +16,12 @@ import ( func GetUnreadMsgCount(c *gin.Context) { response := app.NewResponse(c) - user := &model.User{} + user := &core.User{} if u, exists := c.Get("USER"); exists { - user = u.(*model.User) + user = u.(*core.User) } - count, _ := service.GetUnreadCount(user.ID) + count, _ := broker.GetUnreadCount(user.ID) response.ToResponse(gin.H{ "count": count, @@ -28,7 +32,7 @@ func GetMessages(c *gin.Context) { response := app.NewResponse(c) userID, _ := c.Get("UID") - messages, totalRows, err := service.GetMessages(userID.(int64), (app.GetPage(c)-1)*app.GetPageSize(c), app.GetPageSize(c)) + messages, totalRows, err := broker.GetMessages(userID.(int64), (app.GetPage(c)-1)*app.GetPageSize(c), app.GetPageSize(c)) if err != nil { logrus.Errorf("service.GetMessages err: %v\n", err) @@ -40,7 +44,7 @@ func GetMessages(c *gin.Context) { } func ReadMessage(c *gin.Context) { - param := service.ReadMessageReq{} + param := broker.ReadMessageReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -50,7 +54,7 @@ func ReadMessage(c *gin.Context) { } userID, _ := c.Get("UID") - err := service.ReadMessage(param.ID, userID.(int64)) + err := broker.ReadMessage(param.ID, userID.(int64)) if err != nil { logrus.Errorf("service.ReadMessage err: %v\n", err) response.ToErrorResponse(errcode.ReadMessageFailed) @@ -61,7 +65,7 @@ func ReadMessage(c *gin.Context) { } func SendUserWhisper(c *gin.Context) { - param := service.WhisperReq{} + param := broker.WhisperReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -78,10 +82,10 @@ func SendUserWhisper(c *gin.Context) { return } - _, err := service.CreateWhisper(c, &model.Message{ + _, err := broker.CreateWhisper(c, &core.Message{ SenderUserID: userID.(int64), ReceiverUserID: param.UserID, - Type: model.MsgTypeWhisper, + Type: core.MsgTypeWhisper, Brief: "给你发送新私信了", Content: param.Content, }) diff --git a/internal/routers/api/post.go b/internal/servants/web/routers/api/post.go similarity index 78% rename from internal/routers/api/post.go rename to internal/servants/web/routers/api/post.go index f580428f..0dc923b0 100644 --- a/internal/routers/api/post.go +++ b/internal/servants/web/routers/api/post.go @@ -1,10 +1,13 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package api import ( "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/service" + "github.com/rocboss/paopao-ce/internal/servants/web/broker" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/convert" "github.com/rocboss/paopao-ce/pkg/errcode" @@ -25,7 +28,7 @@ func GetPostList(c *gin.Context) { user, _ := userFrom(c) offset, limit := app.GetPageOffset(c) if q.Query == "" && q.Type == "search" { - resp, err := service.GetIndexPosts(user, offset, limit) + resp, err := broker.GetIndexPosts(user, offset, limit) if err != nil { logrus.Errorf("service.GetPostList err: %v\n", err) response.ToErrorResponse(errcode.GetPostsFailed) @@ -34,7 +37,7 @@ func GetPostList(c *gin.Context) { response.ToResponseList(resp.Tweets, resp.Total) } else { - posts, totalRows, err := service.GetPostListFromSearch(user, q, offset, limit) + posts, totalRows, err := broker.GetPostListFromSearch(user, q, offset, limit) if err != nil { logrus.Errorf("service.GetPostListFromSearch err: %v\n", err) @@ -49,7 +52,7 @@ func GetPost(c *gin.Context) { postID := convert.StrTo(c.Query("id")).MustInt64() response := app.NewResponse(c) - postFormated, err := service.GetPost(postID) + postFormated, err := broker.GetPost(postID) if err != nil { logrus.Errorf("service.GetPost err: %v\n", err) @@ -61,7 +64,7 @@ func GetPost(c *gin.Context) { } func CreatePost(c *gin.Context) { - param := service.PostCreationReq{} + param := broker.PostCreationReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -71,7 +74,7 @@ func CreatePost(c *gin.Context) { } userID, _ := c.Get("UID") - post, err := service.CreatePost(c, userID.(int64), param) + post, err := broker.CreatePost(c, userID.(int64), param) if err != nil { logrus.Errorf("service.CreatePost err: %v\n", err) @@ -83,7 +86,7 @@ func CreatePost(c *gin.Context) { } func DeletePost(c *gin.Context) { - param := service.PostDelReq{} + param := broker.PostDelReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -98,7 +101,7 @@ func DeletePost(c *gin.Context) { return } - err := service.DeletePost(user, param.ID) + err := broker.DeletePost(user, param.ID) if err != nil { logrus.Errorf("service.DeletePost err: %v\n", err) response.ToErrorResponse(err) @@ -114,7 +117,7 @@ func GetPostStar(c *gin.Context) { userID, _ := c.Get("UID") - _, err := service.GetPostStar(postID, userID.(int64)) + _, err := broker.GetPostStar(postID, userID.(int64)) if err != nil { response.ToResponse(gin.H{ "status": false, @@ -129,7 +132,7 @@ func GetPostStar(c *gin.Context) { } func PostStar(c *gin.Context) { - param := service.PostStarReq{} + param := broker.PostStarReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -141,14 +144,14 @@ func PostStar(c *gin.Context) { userID, _ := c.Get("UID") status := false - star, err := service.GetPostStar(param.ID, userID.(int64)) + star, err := broker.GetPostStar(param.ID, userID.(int64)) if err != nil { // 创建Star - _, err = service.CreatePostStar(param.ID, userID.(int64)) + _, err = broker.CreatePostStar(param.ID, userID.(int64)) status = true } else { // 取消Star - err = service.DeletePostStar(star) + err = broker.DeletePostStar(star) } if err != nil { @@ -167,7 +170,7 @@ func GetPostCollection(c *gin.Context) { userID, _ := c.Get("UID") - _, err := service.GetPostCollection(postID, userID.(int64)) + _, err := broker.GetPostCollection(postID, userID.(int64)) if err != nil { response.ToResponse(gin.H{ "status": false, @@ -182,7 +185,7 @@ func GetPostCollection(c *gin.Context) { } func PostCollection(c *gin.Context) { - param := service.PostCollectionReq{} + param := broker.PostCollectionReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -194,14 +197,14 @@ func PostCollection(c *gin.Context) { userID, _ := c.Get("UID") status := false - collection, err := service.GetPostCollection(param.ID, userID.(int64)) + collection, err := broker.GetPostCollection(param.ID, userID.(int64)) if err != nil { // 创建collection - _, err = service.CreatePostCollection(param.ID, userID.(int64)) + _, err = broker.CreatePostCollection(param.ID, userID.(int64)) status = true } else { // 取消Star - err = service.DeletePostCollection(collection) + err = broker.DeletePostCollection(collection) } if err != nil { @@ -215,7 +218,7 @@ func PostCollection(c *gin.Context) { } func LockPost(c *gin.Context) { - param := service.PostLockReq{} + param := broker.PostLockReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -227,18 +230,18 @@ func LockPost(c *gin.Context) { user, _ := c.Get("USER") // 获取Post - postFormated, err := service.GetPost(param.ID) + postFormated, err := broker.GetPost(param.ID) if err != nil { logrus.Errorf("service.GetPost err: %v\n", err) response.ToErrorResponse(errcode.GetPostFailed) return } - if postFormated.UserID != user.(*model.User).ID && !user.(*model.User).IsAdmin { + if postFormated.UserID != user.(*core.User).ID && !user.(*core.User).IsAdmin { response.ToErrorResponse(errcode.NoPermission) return } - err = service.LockPost(param.ID) + err = broker.LockPost(param.ID) if err != nil { logrus.Errorf("service.LockPost err: %v\n", err) response.ToErrorResponse(errcode.LockPostFailed) @@ -251,7 +254,7 @@ func LockPost(c *gin.Context) { } func StickPost(c *gin.Context) { - param := service.PostStickReq{} + param := broker.PostStickReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -263,18 +266,18 @@ func StickPost(c *gin.Context) { user, _ := c.Get("USER") // 获取Post - postFormated, err := service.GetPost(param.ID) + postFormated, err := broker.GetPost(param.ID) if err != nil { logrus.Errorf("service.GetPost err: %v\n", err) response.ToErrorResponse(errcode.GetPostFailed) return } - if !user.(*model.User).IsAdmin { + if !user.(*core.User).IsAdmin { response.ToErrorResponse(errcode.NoPermission) return } - err = service.StickPost(param.ID) + err = broker.StickPost(param.ID) if err != nil { logrus.Errorf("service.StickPost err: %v\n", err) response.ToErrorResponse(errcode.LockPostFailed) @@ -287,7 +290,7 @@ func StickPost(c *gin.Context) { } func VisiblePost(c *gin.Context) { - param := service.PostVisibilityReq{} + param := broker.PostVisibilityReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -297,7 +300,7 @@ func VisiblePost(c *gin.Context) { } user, _ := userFrom(c) - if err := service.VisiblePost(user, param.ID, param.Visibility); err != nil { + if err := broker.VisiblePost(user, param.ID, param.Visibility); err != nil { logrus.Errorf("service.VisiblePost err: %v\n", err) response.ToErrorResponse(err) return @@ -309,7 +312,7 @@ func VisiblePost(c *gin.Context) { } func GetPostTags(c *gin.Context) { - param := service.PostTagsReq{} + param := broker.PostTagsReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -318,7 +321,7 @@ func GetPostTags(c *gin.Context) { return } - tags, err := service.GetPostTags(¶m) + tags, err := broker.GetPostTags(¶m) if err != nil { logrus.Errorf("service.GetPostTags err: %v\n", err) response.ToErrorResponse(errcode.GetPostTagsFailed) @@ -326,5 +329,7 @@ func GetPostTags(c *gin.Context) { } - response.ToResponse(tags) + response.ToResponse(gin.H{ + "topics": tags, + }) } diff --git a/internal/routers/api/user.go b/internal/servants/web/routers/api/user.go similarity index 79% rename from internal/routers/api/user.go rename to internal/servants/web/routers/api/user.go index 7541c54b..89aa6615 100644 --- a/internal/routers/api/user.go +++ b/internal/servants/web/routers/api/user.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package api import ( @@ -6,9 +10,8 @@ import ( "unicode/utf8" "github.com/gin-gonic/gin" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/rocboss/paopao-ce/internal/model/rest" - "github.com/rocboss/paopao-ce/internal/service" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/servants/web/broker" "github.com/rocboss/paopao-ce/pkg/app" "github.com/rocboss/paopao-ce/pkg/convert" "github.com/rocboss/paopao-ce/pkg/errcode" @@ -18,7 +21,7 @@ import ( // Login 用户登录 func Login(c *gin.Context) { - param := service.AuthRequest{} + param := broker.AuthRequest{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -27,7 +30,7 @@ func Login(c *gin.Context) { return } - user, err := service.DoLogin(c, ¶m) + user, err := broker.DoLogin(c, ¶m) if err != nil { logrus.Errorf("service.DoLogin err: %v", err) response.ToErrorResponse(err.(*errcode.Error)) @@ -49,7 +52,7 @@ func Login(c *gin.Context) { // Register 用户注册 func Register(c *gin.Context) { - param := service.RegisterRequest{} + param := broker.RegisterRequest{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -59,7 +62,7 @@ func Register(c *gin.Context) { } // 用户名检查 - err := service.ValidUsername(param.Username) + err := broker.ValidUsername(param.Username) if err != nil { logrus.Errorf("service.Register err: %v", err) response.ToErrorResponse(err.(*errcode.Error)) @@ -67,14 +70,14 @@ func Register(c *gin.Context) { } // 密码检查 - err = service.CheckPassword(param.Password) + err = broker.CheckPassword(param.Password) if err != nil { logrus.Errorf("service.Register err: %v", err) response.ToErrorResponse(err.(*errcode.Error)) return } - user, err := service.Register( + user, err := broker.Register( param.Username, param.Password, ) @@ -92,7 +95,7 @@ func Register(c *gin.Context) { } func RequestingFriend(c *gin.Context) { - param := rest.RequestingFriendReq{} + param := broker.RequestingFriendReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -110,7 +113,7 @@ func RequestingFriend(c *gin.Context) { return } - if err := service.RequestingFriend(user, ¶m); err != nil { + if err := broker.RequestingFriend(user, ¶m); err != nil { logrus.Errorf("service.RequestingFriend err: %v", err) response.ToErrorResponse(errcode.SendRequestingFriendFailed) return @@ -120,7 +123,7 @@ func RequestingFriend(c *gin.Context) { } func AddFriend(c *gin.Context) { - param := rest.AddFriendReq{} + param := broker.AddFriendReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -137,7 +140,7 @@ func AddFriend(c *gin.Context) { return } - if err := service.AddFriend(user, ¶m); err != nil { + if err := broker.AddFriend(user, ¶m); err != nil { logrus.Errorf("service.AddFriend err: %v", err) response.ToErrorResponse(errcode.AddFriendFailed) return @@ -147,7 +150,7 @@ func AddFriend(c *gin.Context) { } func RejectFriend(c *gin.Context) { - param := rest.RejectFriendReq{} + param := broker.RejectFriendReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -164,7 +167,7 @@ func RejectFriend(c *gin.Context) { return } - if err := service.RejectFriend(user, ¶m); err != nil { + if err := broker.RejectFriend(user, ¶m); err != nil { logrus.Errorf("service.RejectFriend err: %v", err) response.ToErrorResponse(errcode.RejectFriendFailed) return @@ -174,7 +177,7 @@ func RejectFriend(c *gin.Context) { } func DeleteFriend(c *gin.Context) { - param := rest.DeleteFriendReq{} + param := broker.DeleteFriendReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -191,7 +194,7 @@ func DeleteFriend(c *gin.Context) { return } - if err := service.DeleteFriend(user, ¶m); err != nil { + if err := broker.DeleteFriend(user, ¶m); err != nil { logrus.Errorf("service.DeleteFriend err: %v", err) response.ToErrorResponse(errcode.DeleteFriendFailed) return @@ -208,7 +211,7 @@ func GetContacts(c *gin.Context) { } offset, limit := app.GetPageOffset(c) - resp, err := service.GetContacts(user, offset, limit) + resp, err := broker.GetContacts(user, offset, limit) if err != nil { logrus.Errorf("service.DeleteFriend err: %v", err) response.ToErrorResponse(errcode.GetContactsFailed) @@ -219,14 +222,14 @@ func GetContacts(c *gin.Context) { // 获取用户基本信息 func GetUserInfo(c *gin.Context) { - param := service.AuthRequest{} + param := broker.AuthRequest{} response := app.NewResponse(c) if username, exists := c.Get("USERNAME"); exists { param.Username = username.(string) } - user, err := service.GetUserInfo(¶m) + user, err := broker.GetUserInfo(¶m) if err != nil { response.ToErrorResponse(errcode.UnauthorizedAuthNotExist) @@ -251,7 +254,7 @@ func GetUserInfo(c *gin.Context) { // 修改密码 func ChangeUserPassword(c *gin.Context) { - param := service.ChangePasswordReq{} + param := broker.ChangePasswordReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -260,13 +263,13 @@ func ChangeUserPassword(c *gin.Context) { return } - user := &model.User{} + user := &core.User{} if u, exists := c.Get("USER"); exists { - user = u.(*model.User) + user = u.(*core.User) } // 密码检查 - err := service.CheckPassword(param.Password) + err := broker.CheckPassword(param.Password) if err != nil { logrus.Errorf("service.Register err: %v", err) response.ToErrorResponse(err.(*errcode.Error)) @@ -274,21 +277,21 @@ func ChangeUserPassword(c *gin.Context) { } // 旧密码校验 - if !service.ValidPassword(user.Password, param.OldPassword, user.Salt) { + if !broker.ValidPassword(user.Password, param.OldPassword, user.Salt) { response.ToErrorResponse(errcode.ErrorOldPassword) return } // 更新入库 - user.Password, user.Salt = service.EncryptPasswordAndSalt(param.Password) - service.UpdateUserInfo(user) + user.Password, user.Salt = broker.EncryptPasswordAndSalt(param.Password) + broker.UpdateUserInfo(user) response.ToResponse(nil) } // 修改昵称 func ChangeNickname(c *gin.Context) { - param := service.ChangeNicknameReq{} + param := broker.ChangeNicknameReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -297,9 +300,9 @@ func ChangeNickname(c *gin.Context) { return } - user := &model.User{} + user := &core.User{} if u, exists := c.Get("USER"); exists { - user = u.(*model.User) + user = u.(*core.User) } if utf8.RuneCountInString(param.Nickname) < 2 || utf8.RuneCountInString(param.Nickname) > 12 { @@ -309,14 +312,14 @@ func ChangeNickname(c *gin.Context) { // 执行绑定 user.Nickname = param.Nickname - service.UpdateUserInfo(user) + broker.UpdateUserInfo(user) response.ToResponse(nil) } // 修改头像 func ChangeAvatar(c *gin.Context) { - param := service.ChangeAvatarReq{} + param := broker.ChangeAvatarReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -331,7 +334,7 @@ func ChangeAvatar(c *gin.Context) { return } - if err := service.ChangeUserAvatar(user, param.Avatar); err != nil { + if err := broker.ChangeUserAvatar(user, param.Avatar); err != nil { response.ToErrorResponse(err) return } @@ -340,7 +343,7 @@ func ChangeAvatar(c *gin.Context) { // 用户绑定手机号 func BindUserPhone(c *gin.Context) { - param := service.UserPhoneBindReq{} + param := broker.UserPhoneBindReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -349,18 +352,18 @@ func BindUserPhone(c *gin.Context) { return } - user := &model.User{} + user := &core.User{} if u, exists := c.Get("USER"); exists { - user = u.(*model.User) + user = u.(*core.User) } // 手机重复性检查 - if service.CheckPhoneExist(user.ID, param.Phone) { + if broker.CheckPhoneExist(user.ID, param.Phone) { response.ToErrorResponse(errcode.ExistedUserPhone) return } - if err := service.CheckPhoneCaptcha(param.Phone, param.Captcha); err != nil { + if err := broker.CheckPhoneCaptcha(param.Phone, param.Captcha); err != nil { logrus.Errorf("service.CheckPhoneCaptcha err: %v\n", err) response.ToErrorResponse(err) return @@ -368,7 +371,7 @@ func BindUserPhone(c *gin.Context) { // 执行绑定 user.Phone = param.Phone - if err := service.UpdateUserInfo(user); err != nil { + if err := broker.UpdateUserInfo(user); err != nil { response.ToErrorResponse(err) return } @@ -378,7 +381,7 @@ func BindUserPhone(c *gin.Context) { // 修改用户状态 func ChangeUserStatus(c *gin.Context) { - param := service.ChangeUserStatusReq{} + param := broker.ChangeUserStatusReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -387,12 +390,12 @@ func ChangeUserStatus(c *gin.Context) { return } - if param.Status != model.UserStatusNormal && param.Status != model.UserStatusClosed { + if param.Status != core.UserStatusNormal && param.Status != core.UserStatusClosed { response.ToErrorResponse(errcode.InvalidParams) return } - user, err := service.GetUserByID(param.ID) + user, err := broker.GetUserByID(param.ID) if err != nil { logrus.Errorf("service.GetUserByID err: %v\n", err) response.ToErrorResponse(errcode.NoExistUsername) @@ -401,7 +404,7 @@ func ChangeUserStatus(c *gin.Context) { // 执行更新 user.Status = param.Status - service.UpdateUserInfo(user) + broker.UpdateUserInfo(user) response.ToResponse(nil) } @@ -411,7 +414,7 @@ func GetUserProfile(c *gin.Context) { username := c.Query("username") user, _ := userFrom(c) - resp, err := service.GetUserByUsername(user, username) + resp, err := broker.GetUserByUsername(user, username) if err != nil { logrus.Errorf("service.GetUserByUsername err: %v\n", err) response.ToErrorResponse(errcode.NoExistUsername) @@ -426,28 +429,28 @@ func GetUserPosts(c *gin.Context) { username := c.Query("username") user, exists := userFrom(c) - other, err := service.GetUserByUsername(user, username) + other, err := broker.GetUserByUsername(user, username) if err != nil { logrus.Errorf("service.GetUserByUsername err: %v\n", err) response.ToErrorResponse(errcode.NoExistUsername) return } - visibilities := []model.PostVisibleT{model.PostVisitPublic} + visibilities := []core.PostVisibleT{core.PostVisitPublic} if exists { if user.ID == other.ID || user.IsAdmin { - visibilities = append(visibilities, model.PostVisitPrivate, model.PostVisitFriend) + visibilities = append(visibilities, core.PostVisitPrivate, core.PostVisitFriend) } else if other.IsFriend { - visibilities = append(visibilities, model.PostVisitFriend) + visibilities = append(visibilities, core.PostVisitFriend) } } - conditions := model.ConditionsT{ + conditions := core.ConditionsT{ "user_id": other.ID, "visibility IN ?": visibilities, "ORDER": "latest_replied_on DESC", } - _, posts, err := service.GetPostList(&service.PostListReq{ + _, posts, err := broker.GetPostList(&broker.PostListReq{ Conditions: &conditions, Offset: (app.GetPage(c) - 1) * app.GetPageSize(c), Limit: app.GetPageSize(c), @@ -457,7 +460,7 @@ func GetUserPosts(c *gin.Context) { response.ToErrorResponse(errcode.GetPostsFailed) return } - totalRows, _ := service.GetPostCount(&conditions) + totalRows, _ := broker.GetPostCount(&conditions) response.ToResponseList(posts, totalRows) } @@ -466,7 +469,7 @@ func GetUserCollections(c *gin.Context) { response := app.NewResponse(c) userID, _ := c.Get("UID") - posts, totalRows, err := service.GetUserCollections(userID.(int64), (app.GetPage(c)-1)*app.GetPageSize(c), app.GetPageSize(c)) + posts, totalRows, err := broker.GetUserCollections(userID.(int64), (app.GetPage(c)-1)*app.GetPageSize(c), app.GetPageSize(c)) if err != nil { logrus.Errorf("service.GetUserCollections err: %v\n", err) @@ -481,7 +484,7 @@ func GetUserStars(c *gin.Context) { response := app.NewResponse(c) userID, _ := c.Get("UID") - posts, totalRows, err := service.GetUserStars(userID.(int64), (app.GetPage(c)-1)*app.GetPageSize(c), app.GetPageSize(c)) + posts, totalRows, err := broker.GetUserStars(userID.(int64), (app.GetPage(c)-1)*app.GetPageSize(c), app.GetPageSize(c)) if err != nil { logrus.Errorf("service.GetUserStars err: %v\n", err) response.ToErrorResponse(errcode.GetCollectionsFailed) @@ -495,32 +498,36 @@ func GetSuggestUsers(c *gin.Context) { keyword := c.Query("k") response := app.NewResponse(c) - usernames, err := service.GetSuggestUsers(keyword) + usernames, err := broker.GetSuggestUsers(keyword) if err != nil { logrus.Errorf("service.GetSuggestUsers err: %v\n", err) response.ToErrorResponse(errcode.GetCollectionsFailed) return } - response.ToResponse(usernames) + response.ToResponse(gin.H{ + "suggest": usernames, + }) } func GetSuggestTags(c *gin.Context) { keyword := c.Query("k") response := app.NewResponse(c) - tags, err := service.GetSuggestTags(keyword) + tags, err := broker.GetSuggestTags(keyword) if err != nil { logrus.Errorf("service.GetSuggestTags err: %v\n", err) response.ToErrorResponse(errcode.GetCollectionsFailed) return } - response.ToResponse(tags) + response.ToResponse(gin.H{ + "suggest": tags, + }) } func GetUserRechargeLink(c *gin.Context) { - param := service.RechargeReq{} + param := broker.RechargeReq{} response := app.NewResponse(c) valid, errs := app.BindAndValid(c, ¶m) if !valid { @@ -531,7 +538,7 @@ func GetUserRechargeLink(c *gin.Context) { // 下单 userID, _ := c.Get("UID") - recharge, err := service.CreateRecharge(userID.(int64), param.Amount) + recharge, err := broker.CreateRecharge(userID.(int64), param.Amount) if err != nil { logrus.Errorf("service.CreateRecharge err: %v\n", err) response.ToErrorResponse(errcode.RechargeReqFail) @@ -567,7 +574,7 @@ func GetUserRechargeResult(c *gin.Context) { id := c.Query("id") userID, _ := c.Get("UID") - recharge, err := service.GetRechargeByID(convert.StrTo(id).MustInt64()) + recharge, err := broker.GetRechargeByID(convert.StrTo(id).MustInt64()) if err != nil { response.ToErrorResponse(errcode.GetRechargeFailed) return @@ -601,7 +608,7 @@ func AlipayNotify(c *gin.Context) { tradeStatus := c.Request.Form.Get("trade_status") if tradeStatus == "TRADE_SUCCESS" { // 交易支付成功 - err = service.FinishRecharge(c, convert.StrTo(id).MustInt64(), tradeNo) + err = broker.FinishRecharge(c, convert.StrTo(id).MustInt64(), tradeNo) if err != nil { logrus.Errorf("service.FinishRecharge err: %v\n", err) response.ToErrorResponse(errcode.RechargeNotifyError) @@ -615,7 +622,7 @@ func GetUserWalletBills(c *gin.Context) { response := app.NewResponse(c) userID, _ := c.Get("UID") - bills, totalRows, err := service.GetUserWalletBills(userID.(int64), (app.GetPage(c)-1)*app.GetPageSize(c), app.GetPageSize(c)) + bills, totalRows, err := broker.GetUserWalletBills(userID.(int64), (app.GetPage(c)-1)*app.GetPageSize(c), app.GetPageSize(c)) if err != nil { logrus.Errorf("service.GetUserWalletBills err: %v\n", err) @@ -626,9 +633,9 @@ func GetUserWalletBills(c *gin.Context) { response.ToResponseList(bills, totalRows) } -func userFrom(c *gin.Context) (*model.User, bool) { +func userFrom(c *gin.Context) (*core.User, bool) { if u, exists := c.Get("USER"); exists { - user, ok := u.(*model.User) + user, ok := u.(*core.User) return user, ok } return nil, false diff --git a/internal/routers/docs.go b/internal/servants/web/routers/docs.go similarity index 57% rename from internal/routers/docs.go rename to internal/servants/web/routers/docs.go index fc054b08..bf5e0488 100644 --- a/internal/routers/docs.go +++ b/internal/servants/web/routers/docs.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build !docs // +build !docs diff --git a/internal/routers/docs_embed.go b/internal/servants/web/routers/docs_embed.go similarity index 68% rename from internal/routers/docs_embed.go rename to internal/servants/web/routers/docs_embed.go index 443f5c0a..20754e1a 100644 --- a/internal/routers/docs_embed.go +++ b/internal/servants/web/routers/docs_embed.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build docs // +build docs diff --git a/internal/routers/router.go b/internal/servants/web/routers/router.go similarity index 75% rename from internal/routers/router.go rename to internal/servants/web/routers/router.go index 354b4abe..70247c6a 100644 --- a/internal/routers/router.go +++ b/internal/servants/web/routers/router.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package routers import ( @@ -8,8 +12,8 @@ import ( "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/middleware" - "github.com/rocboss/paopao-ce/internal/routers/api" + "github.com/rocboss/paopao-ce/internal/servants/chain" + "github.com/rocboss/paopao-ce/internal/servants/web/routers/api" "github.com/sirupsen/logrus" ) @@ -67,7 +71,7 @@ func NewRouter() *gin.Engine { } // 宽松鉴权路由组 - looseApi := r.Group("/").Use(middleware.JwtLoose()) + looseApi := r.Group("/").Use(chain.JwtLoose()) { // 获取广场流 looseApi.GET("/posts", api.GetPostList) @@ -80,9 +84,9 @@ func NewRouter() *gin.Engine { } // 鉴权路由组 - authApi := r.Group("/").Use(middleware.JWT()) - privApi := r.Group("/").Use(middleware.JWT()).Use(middleware.Priv()) - adminApi := r.Group("/").Use(middleware.JWT()).Use(middleware.Admin()) + authApi := r.Group("/").Use(chain.JWT()) + privApi := r.Group("/").Use(chain.JWT()).Use(chain.Priv()) + adminApi := r.Group("/").Use(chain.JWT()).Use(chain.Admin()) // 核心路由注册 routeCore(authApi, privApi, adminApi) @@ -114,6 +118,78 @@ func NewRouter() *gin.Engine { return e } +func RegisterRoute(e *gin.Engine) { + // 按需注册 Web前端静态资源 + cfg.Be("Frontend:EmbedWeb", func() { + registerStatick(e) + }) + + // 按需注册 LocalOSS 路由 + cfg.Be("LocalOSS", func() { + routeLocalOSS(e) + }) + + // v1 group api + r := e.Group("/v1") + + // 获取version + r.GET("/", api.Version) + + // 用户登录 + r.POST("/auth/login", api.Login) + + // 用户注册 + r.POST("/auth/register", api.Register) + + // 获取验证码 + r.GET("/captcha", api.GetCaptcha) + + // 发送验证码 + r.POST("/captcha", api.PostCaptcha) + + // 无鉴权路由组 + noAuthApi := r.Group("/") + { + // 获取动态详情 + noAuthApi.GET("/post", api.GetPost) + + // 获取动态评论 + noAuthApi.GET("/post/comments", api.GetPostComments) + + // 获取话题列表 + noAuthApi.GET("/tags", api.GetPostTags) + } + + // 宽松鉴权路由组 + looseApi := r.Group("/").Use(chain.JwtLoose()) + { + // 获取广场流 + looseApi.GET("/posts", api.GetPostList) + + // 获取用户动态列表 + looseApi.GET("/user/posts", api.GetUserPosts) + + // 获取用户基本信息 + looseApi.GET("/user/profile", api.GetUserProfile) + } + + // 鉴权路由组 + authApi := r.Group("/").Use(chain.JWT()) + privApi := r.Group("/").Use(chain.JWT()).Use(chain.Priv()) + adminApi := r.Group("/").Use(chain.JWT()).Use(chain.Admin()) + + // 核心路由注册 + routeCore(authApi, privApi, adminApi) + + // 支付宝路由注册 + cfg.Be("Alipay", func() { + routeAlipay(r, authApi) + }) + + // Relationship相关路由注册 + routeRelationship(authApi) +} + func routeCore(authApi gin.IRoutes, privApi gin.IRoutes, adminApi gin.IRoutes) { // 同步索引 authApi.GET("/sync/index", api.SyncSearchIndex) diff --git a/internal/routers/statick.go b/internal/servants/web/routers/statick.go similarity index 58% rename from internal/routers/statick.go rename to internal/servants/web/routers/statick.go index c20d5059..c1f2d1cb 100644 --- a/internal/routers/statick.go +++ b/internal/servants/web/routers/statick.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build !embed // +build !embed diff --git a/internal/routers/statick_embed.go b/internal/servants/web/routers/statick_embed.go similarity index 79% rename from internal/routers/statick_embed.go rename to internal/servants/web/routers/statick_embed.go index 2ea56171..dfc729f5 100644 --- a/internal/routers/statick_embed.go +++ b/internal/servants/web/routers/statick_embed.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build embed // +build embed diff --git a/internal/servants/web/utils.go b/internal/servants/web/utils.go new file mode 100644 index 00000000..e42e03b5 --- /dev/null +++ b/internal/servants/web/utils.go @@ -0,0 +1,205 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "image" + "math/rand" + "strings" + "time" + "unicode/utf8" + + "github.com/alimy/mir/v3" + "github.com/gofrs/uuid" + "github.com/rocboss/paopao-ce/internal/core" + "github.com/rocboss/paopao-ce/internal/model/web" + "github.com/rocboss/paopao-ce/pkg/util" + "github.com/rocboss/paopao-ce/pkg/xerror" + "github.com/sirupsen/logrus" +) + +var defaultAvatars = []string{ + "https://assets.paopao.info/public/avatar/default/zoe.png", + "https://assets.paopao.info/public/avatar/default/william.png", + "https://assets.paopao.info/public/avatar/default/walter.png", + "https://assets.paopao.info/public/avatar/default/thomas.png", + "https://assets.paopao.info/public/avatar/default/taylor.png", + "https://assets.paopao.info/public/avatar/default/sophia.png", + "https://assets.paopao.info/public/avatar/default/sam.png", + "https://assets.paopao.info/public/avatar/default/ryan.png", + "https://assets.paopao.info/public/avatar/default/ruby.png", + "https://assets.paopao.info/public/avatar/default/quinn.png", + "https://assets.paopao.info/public/avatar/default/paul.png", + "https://assets.paopao.info/public/avatar/default/owen.png", + "https://assets.paopao.info/public/avatar/default/olivia.png", + "https://assets.paopao.info/public/avatar/default/norman.png", + "https://assets.paopao.info/public/avatar/default/nora.png", + "https://assets.paopao.info/public/avatar/default/natalie.png", + "https://assets.paopao.info/public/avatar/default/naomi.png", + "https://assets.paopao.info/public/avatar/default/miley.png", + "https://assets.paopao.info/public/avatar/default/mike.png", + "https://assets.paopao.info/public/avatar/default/lucas.png", + "https://assets.paopao.info/public/avatar/default/kylie.png", + "https://assets.paopao.info/public/avatar/default/julia.png", + "https://assets.paopao.info/public/avatar/default/joshua.png", + "https://assets.paopao.info/public/avatar/default/john.png", + "https://assets.paopao.info/public/avatar/default/jane.png", + "https://assets.paopao.info/public/avatar/default/jackson.png", + "https://assets.paopao.info/public/avatar/default/ivy.png", + "https://assets.paopao.info/public/avatar/default/isaac.png", + "https://assets.paopao.info/public/avatar/default/henry.png", + "https://assets.paopao.info/public/avatar/default/harry.png", + "https://assets.paopao.info/public/avatar/default/harold.png", + "https://assets.paopao.info/public/avatar/default/hanna.png", + "https://assets.paopao.info/public/avatar/default/grace.png", + "https://assets.paopao.info/public/avatar/default/george.png", + "https://assets.paopao.info/public/avatar/default/freddy.png", + "https://assets.paopao.info/public/avatar/default/frank.png", + "https://assets.paopao.info/public/avatar/default/finn.png", + "https://assets.paopao.info/public/avatar/default/emma.png", + "https://assets.paopao.info/public/avatar/default/emily.png", + "https://assets.paopao.info/public/avatar/default/edward.png", + "https://assets.paopao.info/public/avatar/default/clara.png", + "https://assets.paopao.info/public/avatar/default/claire.png", + "https://assets.paopao.info/public/avatar/default/chloe.png", + "https://assets.paopao.info/public/avatar/default/audrey.png", + "https://assets.paopao.info/public/avatar/default/arthur.png", + "https://assets.paopao.info/public/avatar/default/anna.png", + "https://assets.paopao.info/public/avatar/default/andy.png", + "https://assets.paopao.info/public/avatar/default/alfred.png", + "https://assets.paopao.info/public/avatar/default/alexa.png", + "https://assets.paopao.info/public/avatar/default/abigail.png", +} + +func getRandomAvatar() string { + rand.Seed(time.Now().UnixMicro()) + return defaultAvatars[rand.Intn(len(defaultAvatars))] +} + +// checkPassword 密码检查 +func checkPassword(password string) mir.Error { + // 检测用户是否合规 + if utf8.RuneCountInString(password) < 6 || utf8.RuneCountInString(password) > 16 { + return _errPasswordLengthLimit + } + return nil +} + +// ValidPassword 检查密码是否一致 +func validPassword(dbPassword, password, salt string) bool { + return strings.Compare(dbPassword, util.EncodeMD5(util.EncodeMD5(password)+salt)) == 0 +} + +// encryptPasswordAndSalt 密码加密&生成salt +func encryptPasswordAndSalt(password string) (string, string) { + salt := uuid.Must(uuid.NewV4()).String()[:8] + password = util.EncodeMD5(util.EncodeMD5(password) + salt) + return password, salt +} + +// deleteOssObjects 删除推文的媒体内容, 宽松处理错误(就是不处理), 后续完善 +func deleteOssObjects(oss core.ObjectStorageService, mediaContents []string) { + mediaContentsSize := len(mediaContents) + if mediaContentsSize > 1 { + objectKeys := make([]string, 0, mediaContentsSize) + for _, cUrl := range mediaContents { + objectKeys = append(objectKeys, oss.ObjectKey(cUrl)) + } + // TODO: 优化处理尽量使用channel传递objectKeys使用可控数量的Goroutine集中处理object删除动作,后续完善 + go oss.DeleteObjects(objectKeys) + } else if mediaContentsSize == 1 { + oss.DeleteObject(oss.ObjectKey(mediaContents[0])) + } +} + +// persistMediaContents 获取媒体内容并持久化 +func persistMediaContents(oss core.ObjectStorageService, contents []*web.PostContentItem) (items []string, err error) { + items = make([]string, 0, len(contents)) + for _, item := range contents { + switch item.Type { + case core.ContentTypeImage, + core.ContentTypeVideo, + core.ContentTypeAudio, + core.ContentTypeAttachment, + core.ContentTypeChargeAttachment: + items = append(items, item.Content) + if err != nil { + continue + } + if err = oss.PersistObject(oss.ObjectKey(item.Content)); err != nil { + logrus.Errorf("service.persistMediaContents failed: %s", err) + } + } + } + return +} + +func fileCheck(uploadType string, size int64) mir.Error { + if uploadType != "public/video" && + uploadType != "public/image" && + uploadType != "public/avatar" && + uploadType != "attachment" { + return xerror.InvalidParams + } + if size > 1024*1024*100 { + return _errFileInvalidSize.WithDetails("最大允许100MB") + } + return nil +} + +func getFileExt(s string) (string, mir.Error) { + switch s { + case "image/png": + return ".png", nil + case "image/jpg": + return ".jpg", nil + case "image/jpeg": + return ".jpeg", nil + case "image/gif": + return ".gif", nil + case "video/mp4": + return ".mp4", nil + case "video/quicktime": + return ".mov", nil + case "application/zip": + return ".zip", nil + default: + return "", _errFileInvalidExt.WithDetails("仅允许 png/jpg/gif/mp4/mov/zip 类型") + } +} + +func generatePath(s string) string { + n := len(s) + if n <= 2 { + return s + } + return generatePath(s[:n-2]) + "/" + s[n-2:] +} + +func getImageSize(img image.Rectangle) (int, int) { + b := img.Bounds() + width := b.Max.X + height := b.Max.Y + return width, height +} + +func tagsFrom(originTags []string) []string { + tags := make([]string, 0, len(originTags)) + for _, tag := range originTags { + // TODO: 优化tag有效性检测 + if tag = strings.TrimSpace(tag); len(tag) > 0 { + tags = append(tags, tag) + } + } + return tags +} + +// checkPermision 检查是否拥有者或管理员 +func checkPermision(user *core.User, targetUserId int64) mir.Error { + if user == nil || (user.ID != targetUserId && !user.IsAdmin) { + return _errNoPermission + } + return nil +} diff --git a/internal/servants/web/web.go b/internal/servants/web/web.go new file mode 100644 index 00000000..286109d3 --- /dev/null +++ b/internal/servants/web/web.go @@ -0,0 +1,68 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/alimy/cfg" + "github.com/gin-gonic/gin" + api "github.com/rocboss/paopao-ce/auto/api/v1" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/dao" + "github.com/rocboss/paopao-ce/internal/servants/base" + "github.com/sirupsen/logrus" + "github.com/smartwalle/alipay/v3" +) + +// RouteWeb register web route +func RouteWeb(e *gin.Engine) { + oss := dao.ObjectStorageService() + ds := &base.DaoServant{ + Redis: conf.Redis, + Ds: dao.DataService(), + Ts: dao.TweetSearchService(), + } + // aways register servants + api.RegisterAdminServant(e, newAdminSrv(ds), newAdminBinding(), newAdminRender()) + api.RegisterCoreServant(e, newCoreSrv(ds, oss), newCoreBinding(), newCoreRender()) + api.RegisterLooseServant(e, newLooseSrv(ds), newLooseBinding(), newLooseRender()) + api.RegisterPrivServant(e, newPrivSrv(ds, oss), newPrivBinding(), newPrivRender()) + api.RegisterPubServant(e, newPubSrv(ds), newPubBinding(), newPubRender()) + // regster servants if needed by configure + cfg.In(cfg.Actions{ + "Alipay": func() { + client := mustAlipayClient() + api.RegisterAlipayPubServant(e, newAlipayPubSrv(ds), newAlipayPubBinding(client), newAlipayPubRender()) + api.RegisterAlipayPrivServant(e, newAlipayPrivSrv(ds, client), newAlipayPrivBinding(), newAlipayPrivRender()) + }, + "Followship": func() { + api.RegisterFollowshipServant(e, newFollowshipSrv(ds), newFollowshipBinding(), newFollowshipRender()) + }, + "Friendship": func() { + api.RegisterFriendshipServant(e, newFriendshipSrv(ds), newFriendshipBinding(), newFriendshipRender()) + }, + }) +} + +func mustAlipayClient() *alipay.Client { + s := conf.AlipaySetting + // 将 key 的验证调整到初始化阶段 + client, err := alipay.New(s.AppID, s.PrivateKey, s.InProduction) + if err != nil { + logrus.Fatalf("alipay.New err: %s", err) + } + // 加载应用公钥证书 + if err = client.LoadAppPublicCertFromFile(s.AppPublicCertFile); err != nil { + logrus.Fatalf("client.LoadAppPublicCertFromFile err: %s\n", err) + } + // 加载支付宝根证书 + if err = client.LoadAliPayRootCertFromFile(s.RootCertFile); err != nil { + logrus.Fatalf("client.LoadAliPayRootCertFromFile err: %s\n", err) + } + // 加载支付宝公钥证书 + if err = client.LoadAliPayPublicCertFromFile(s.PublicCertFile); err != nil { + logrus.Fatalf("client.LoadAliPayPublicCertFromFile err: %s\n", err) + } + return client +} diff --git a/internal/servants/web/xerror.go b/internal/servants/web/xerror.go new file mode 100644 index 00000000..4de0f4b7 --- /dev/null +++ b/internal/servants/web/xerror.go @@ -0,0 +1,83 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package web + +import ( + "github.com/rocboss/paopao-ce/pkg/xerror" +) + +// nolint +var ( + _errUsernameHasExisted = xerror.NewError(20001, "用户名已存在") + _errUsernameLengthLimit = xerror.NewError(20002, "用户名长度3~12") + _errUsernameCharLimit = xerror.NewError(20003, "用户名只能包含字母、数字") + _errPasswordLengthLimit = xerror.NewError(20004, "密码长度6~16") + _errUserRegisterFailed = xerror.NewError(20005, "用户注册失败") + _errUserHasBeenBanned = xerror.NewError(20006, "该账户已被封停") + _errNoPermission = xerror.NewError(20007, "无权限执行该请求") + _errUserHasBindOTP = xerror.NewError(20008, "当前用户已绑定二次验证") + _errUserOTPInvalid = xerror.NewError(20009, "二次验证码验证失败") + _errUserNoBindOTP = xerror.NewError(20010, "当前用户未绑定二次验证") + _errErrorOldPassword = xerror.NewError(20011, "当前用户密码验证失败") + _errErrorCaptchaPassword = xerror.NewError(20012, "图形验证码验证失败") + _errAccountNoPhoneBind = xerror.NewError(20013, "拒绝操作: 账户未绑定手机号") + _errTooManyLoginError = xerror.NewError(20014, "登录失败次数过多,请稍后再试") + _errGetPhoneCaptchaError = xerror.NewError(20015, "短信验证码获取失败") + _errTooManyPhoneCaptchaSend = xerror.NewError(20016, "短信验证码获取次数已达今日上限") + _errExistedUserPhone = xerror.NewError(20017, "该手机号已被绑定") + _errErrorPhoneCaptcha = xerror.NewError(20018, "手机验证码不正确") + _errMaxPhoneCaptchaUseTimes = xerror.NewError(20019, "手机验证码已达最大使用次数") + _errNicknameLengthLimit = xerror.NewError(20020, "昵称长度2~12") + _errNoExistUsername = xerror.NewError(20021, "用户不存在") + _errNoAdminPermission = xerror.NewError(20022, "无管理权限") + + _errGetPostsFailed = xerror.NewError(30001, "获取动态列表失败") + _errCreatePostFailed = xerror.NewError(30002, "动态发布失败") + _errGetPostFailed = xerror.NewError(30003, "获取动态详情失败") + _errDeletePostFailed = xerror.NewError(30004, "动态删除失败") + _errLockPostFailed = xerror.NewError(30005, "动态锁定失败") + _errGetPostTagsFailed = xerror.NewError(30006, "获取话题列表失败") + _errInvalidDownloadReq = xerror.NewError(30007, "附件下载请求不合法") + _errDownloadReqError = xerror.NewError(30008, "附件下载请求失败") + _errInsuffientDownloadMoney = xerror.NewError(30009, "附件下载失败:账户资金不足") + _errDownloadExecFail = xerror.NewError(30010, "附件下载失败:扣费失败") + _errStickPostFailed = xerror.NewError(30011, "动态置顶失败") + _errVisblePostFailed = xerror.NewError(30012, "更新可见性失败") + + _errGetCommentsFailed = xerror.NewError(40001, "获取评论列表失败") + _errCreateCommentFailed = xerror.NewError(40002, "评论发布失败") + _errGetCommentFailed = xerror.NewError(40003, "获取评论详情失败") + _errDeleteCommentFailed = xerror.NewError(40004, "评论删除失败") + _errCreateReplyFailed = xerror.NewError(40005, "评论回复失败") + _errGetReplyFailed = xerror.NewError(40006, "获取评论详情失败") + _errMaxCommentCount = xerror.NewError(40007, "评论数已达最大限制") + + _errGetMessagesFailed = xerror.NewError(50001, "获取消息列表失败") + _errReadMessageFailed = xerror.NewError(50002, "标记消息已读失败") + _errSendWhisperFailed = xerror.NewError(50003, "私信发送失败") + _errNoWhisperToSelf = xerror.NewError(50004, "不允许给自己发送私信") + _errTooManyWhisperNum = xerror.NewError(50005, "今日私信次数已达上限") + + _errGetCollectionsFailed = xerror.NewError(60001, "获取收藏列表失败") + _errGetStarsFailed = xerror.NewError(60002, "获取点赞列表失败") + + _errRechargeReqFail = xerror.NewError(70001, "充值请求失败") + _errRechargeNotifyError = xerror.NewError(70002, "充值回调失败") + _errGetRechargeFailed = xerror.NewError(70003, "充值详情获取失败") + _errUserWalletBillsFailed = xerror.NewError(70004, "用户钱包账单获取失败") + + _errNoRequestingFriendToSelf = xerror.NewError(80001, "不允许添加自己为好友") + _errNotExistFriendId = xerror.NewError(80002, "好友id不存在") + _errSendRequestingFriendFailed = xerror.NewError(80003, "申请添加朋友请求发送失败") + _errAddFriendFailed = xerror.NewError(80004, "添加好友失败") + _errRejectFriendFailed = xerror.NewError(80005, "拒绝好友失败") + _errDeleteFriendFailed = xerror.NewError(80006, "删除好友失败") + _errGetContactsFailed = xerror.NewError(80007, "获取联系人列表失败") + _errNoActionToSelf = xerror.NewError(80008, "不允许对自己操作") + + _errFileUploadFailed = xerror.NewError(10200, "文件上传失败") + _errFileInvalidExt = xerror.NewError(10201, "文件类型不合法") + _errFileInvalidSize = xerror.NewError(10202, "文件大小超限") +) diff --git a/internal/service/admin.go b/internal/service/admin.go new file mode 100644 index 00000000..04ae090e --- /dev/null +++ b/internal/service/admin.go @@ -0,0 +1,96 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "net/http" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/gin-contrib/cors" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants" +) + +var ( + _ Service = (*adminService)(nil) +) + +type adminService struct { + *baseHttpService +} + +func (s *adminService) Name() string { + return "AdminService" +} + +func (s *adminService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *adminService) OnInit() error { + s.registerRoute(servants.RegisterAdminServants) + return nil +} + +func (s *adminService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.AdminServerSetting.HttpIp, conf.AdminServerSetting.HttpPort)) +} + +func newAdminEngine() *gin.Engine { + e := gin.New() + e.HandleMethodNotAllowed = true + e.Use(gin.Logger()) + e.Use(gin.Recovery()) + + // 跨域配置 + corsConfig := cors.DefaultConfig() + corsConfig.AllowAllOrigins = true + corsConfig.AddAllowHeaders("Authorization") + e.Use(cors.New(corsConfig)) + + // 默认404 + e.NoRoute(func(c *gin.Context) { + c.JSON(http.StatusNotFound, gin.H{ + "code": 404, + "msg": "Not Found", + }) + }) + + // 默认405 + e.NoMethod(func(c *gin.Context) { + c.JSON(http.StatusMethodNotAllowed, gin.H{ + "code": 405, + "msg": "Method Not Allowed", + }) + }) + + return e +} + +func newAdminService() Service { + addr := conf.AdminServerSetting.HttpIp + ":" + conf.AdminServerSetting.HttpPort + server := httpServers.from(addr, func() *httpServer { + engine := newAdminEngine() + return &httpServer{ + baseServer: newBaseServe(), + e: engine, + server: &http.Server{ + Addr: addr, + Handler: engine, + ReadTimeout: conf.AdminServerSetting.GetReadTimeout(), + WriteTimeout: conf.AdminServerSetting.GetWriteTimeout(), + MaxHeaderBytes: 1 << 20, + }, + } + }) + return &adminService{ + baseHttpService: &baseHttpService{ + server: server, + }, + } +} diff --git a/internal/service/attachment.go b/internal/service/attachment.go deleted file mode 100644 index 432a1a2f..00000000 --- a/internal/service/attachment.go +++ /dev/null @@ -1,7 +0,0 @@ -package service - -import "github.com/rocboss/paopao-ce/internal/model" - -func CreateAttachment(attachment *model.Attachment) (*model.Attachment, error) { - return ds.CreateAttachment(attachment) -} diff --git a/internal/service/bot.go b/internal/service/bot.go new file mode 100644 index 00000000..3c9b2f4d --- /dev/null +++ b/internal/service/bot.go @@ -0,0 +1,96 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "net/http" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/gin-contrib/cors" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants" +) + +var ( + _ Service = (*botService)(nil) +) + +type botService struct { + *baseHttpService +} + +func (s *botService) Name() string { + return "BotService" +} + +func (s *botService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *botService) OnInit() error { + s.registerRoute(servants.RegisterBotServants) + return nil +} + +func (s *botService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.BotServerSetting.HttpIp, conf.BotServerSetting.HttpPort)) +} + +func newBotEngine() *gin.Engine { + e := gin.New() + e.HandleMethodNotAllowed = true + e.Use(gin.Logger()) + e.Use(gin.Recovery()) + + // 跨域配置 + corsConfig := cors.DefaultConfig() + corsConfig.AllowAllOrigins = true + corsConfig.AddAllowHeaders("Authorization") + e.Use(cors.New(corsConfig)) + + // 默认404 + e.NoRoute(func(c *gin.Context) { + c.JSON(http.StatusNotFound, gin.H{ + "code": 404, + "msg": "Not Found", + }) + }) + + // 默认405 + e.NoMethod(func(c *gin.Context) { + c.JSON(http.StatusMethodNotAllowed, gin.H{ + "code": 405, + "msg": "Method Not Allowed", + }) + }) + + return e +} + +func newBotService() Service { + addr := conf.BotServerSetting.HttpIp + ":" + conf.BotServerSetting.HttpPort + server := httpServers.from(addr, func() *httpServer { + engine := newBotEngine() + return &httpServer{ + baseServer: newBaseServe(), + e: engine, + server: &http.Server{ + Addr: addr, + Handler: engine, + ReadTimeout: conf.BotServerSetting.GetReadTimeout(), + WriteTimeout: conf.BotServerSetting.GetWriteTimeout(), + MaxHeaderBytes: 1 << 20, + }, + } + }) + return &botService{ + baseHttpService: &baseHttpService{ + server: server, + }, + } +} diff --git a/internal/service/docs.go b/internal/service/docs.go new file mode 100644 index 00000000..4f8a48d3 --- /dev/null +++ b/internal/service/docs.go @@ -0,0 +1,63 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "net/http" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants" +) + +var ( + _ Service = (*docsService)(nil) +) + +type docsService struct { + *baseHttpService +} + +func (s *docsService) Name() string { + return "DocsService" +} + +func (s *docsService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *docsService) OnInit() error { + s.registerRoute(servants.RegisterDocsServants) + return nil +} + +func (s *docsService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.DocsServerSetting.HttpIp, conf.DocsServerSetting.HttpPort)) +} + +func newDocsService() Service { + addr := conf.DocsServerSetting.HttpIp + ":" + conf.DocsServerSetting.HttpPort + server := httpServers.from(addr, func() *httpServer { + engine := newWebEngine() + return &httpServer{ + baseServer: newBaseServe(), + e: engine, + server: &http.Server{ + Addr: addr, + Handler: engine, + ReadTimeout: conf.DocsServerSetting.GetReadTimeout(), + WriteTimeout: conf.DocsServerSetting.GetWriteTimeout(), + MaxHeaderBytes: 1 << 20, + }, + } + }) + return &docsService{ + baseHttpService: &baseHttpService{ + server: server, + }, + } +} diff --git a/internal/service/frontend_web.go b/internal/service/frontend_web.go new file mode 100644 index 00000000..f3903c21 --- /dev/null +++ b/internal/service/frontend_web.go @@ -0,0 +1,63 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "net/http" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants" +) + +var ( + _ Service = (*frontendWebService)(nil) +) + +type frontendWebService struct { + *baseHttpService +} + +func (s *frontendWebService) Name() string { + return "FrontendWebService" +} + +func (s *frontendWebService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *frontendWebService) OnInit() error { + s.registerRoute(servants.RegisterFrontendWebServants) + return nil +} + +func (s *frontendWebService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.FrontendWebSetting.HttpIp, conf.FrontendWebSetting.HttpPort)) +} + +func newFrontendWebServiceService() Service { + addr := conf.FrontendWebSetting.HttpIp + ":" + conf.FrontendWebSetting.HttpPort + server := httpServers.from(addr, func() *httpServer { + engine := newWebEngine() + return &httpServer{ + baseServer: newBaseServe(), + e: engine, + server: &http.Server{ + Addr: addr, + Handler: engine, + ReadTimeout: conf.FrontendWebSetting.GetReadTimeout(), + WriteTimeout: conf.FrontendWebSetting.GetWriteTimeout(), + MaxHeaderBytes: 1 << 20, + }, + } + }) + return &frontendWebService{ + baseHttpService: &baseHttpService{ + server: server, + }, + } +} diff --git a/internal/service/grpc_server.go b/internal/service/grpc_server.go new file mode 100644 index 00000000..47e870c9 --- /dev/null +++ b/internal/service/grpc_server.go @@ -0,0 +1,54 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "net" + + "google.golang.org/grpc" +) + +var ( + _ server = (*grpcServer)(nil) +) + +// grpcServer wraper for grpc.Server +type grpcServer struct { + *baseServer + + listener net.Listener + server *grpc.Server +} + +func (s *grpcServer) start() error { + s.Lock() + if s.serverStatus == _statusServerStarted || s.serverStatus == _statusServerStoped { + return nil + } + oldStatus := s.serverStatus + s.serverStatus = _statusServerStarted + s.Unlock() + + if err := s.server.Serve(s.listener); err != nil { + s.Lock() + s.serverStatus = oldStatus + s.Unlock() + + return err + } + return nil +} + +func (s *grpcServer) stop() error { + s.Lock() + defer s.Unlock() + + if s.serverStatus == _statusServerStoped || s.serverStatus == _statusServerInitilized { + return nil + } + s.server.Stop() + s.serverStatus = _statusServerStoped + return nil +} diff --git a/internal/service/grpc_service.go b/internal/service/grpc_service.go new file mode 100644 index 00000000..ded7b507 --- /dev/null +++ b/internal/service/grpc_service.go @@ -0,0 +1,32 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "google.golang.org/grpc" +) + +type baseGRPCService struct { + baseService + + server *grpcServer +} + +func (s *baseGRPCService) registerServer(h func(s *grpc.Server)) { + if s.server.status() != _statusServerStarted { + h(s.server.server) + } +} + +func (s *baseGRPCService) OnStart() error { + if err := s.server.start(); err != nil { + return err + } + return nil +} + +func (s *baseGRPCService) OnStop() error { + return s.server.stop() +} diff --git a/internal/service/http_server.go b/internal/service/http_server.go new file mode 100644 index 00000000..105df1a2 --- /dev/null +++ b/internal/service/http_server.go @@ -0,0 +1,57 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "context" + "net/http" + + "github.com/gin-gonic/gin" +) + +var ( + _ server = (*httpServer)(nil) +) + +// httpServer wraper for gin.engine and http.Server +type httpServer struct { + *baseServer + + e *gin.Engine + server *http.Server +} + +func (s *httpServer) start() error { + s.Lock() + if s.serverStatus == _statusServerStarted || s.serverStatus == _statusServerStoped { + return nil + } + oldStatus := s.serverStatus + s.serverStatus = _statusServerStarted + s.Unlock() + + if err := s.server.ListenAndServe(); err != nil { + s.Lock() + s.serverStatus = oldStatus + s.Unlock() + + return err + } + return nil +} + +func (s *httpServer) stop() error { + s.Lock() + defer s.Unlock() + + if s.serverStatus == _statusServerStoped || s.serverStatus == _statusServerInitilized { + return nil + } + if err := s.server.Shutdown(context.Background()); err != nil { + return err + } + s.serverStatus = _statusServerStoped + return nil +} diff --git a/internal/service/http_service.go b/internal/service/http_service.go new file mode 100644 index 00000000..42f3f90c --- /dev/null +++ b/internal/service/http_service.go @@ -0,0 +1,32 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "github.com/gin-gonic/gin" +) + +type baseHttpService struct { + baseService + + server *httpServer +} + +func (s *baseHttpService) registerRoute(h func(e *gin.Engine)) { + if s.server.status() != _statusServerStarted { + h(s.server.e) + } +} + +func (s *baseHttpService) OnStart() error { + if err := s.server.start(); err != nil { + return err + } + return nil +} + +func (s *baseHttpService) OnStop() error { + return s.server.stop() +} diff --git a/internal/service/localoss.go b/internal/service/localoss.go new file mode 100644 index 00000000..5bead183 --- /dev/null +++ b/internal/service/localoss.go @@ -0,0 +1,71 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "net/http" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants" +) + +var ( + _ Service = (*localossService)(nil) +) + +type localossService struct { + *baseHttpService +} + +func (s *localossService) Name() string { + return "LocalossService" +} + +func (s *localossService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *localossService) OnInit() error { + s.registerRoute(servants.RegisterLocalossServants) + return nil +} + +func (s *localossService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.LocalossServerSetting.HttpIp, conf.LocalossServerSetting.HttpPort)) +} + +func newLocalossEngine() *gin.Engine { + e := gin.New() + e.Use(gin.Logger()) + e.Use(gin.Recovery()) + return e +} + +func newLocalossService() Service { + addr := conf.LocalossServerSetting.HttpIp + ":" + conf.LocalossServerSetting.HttpPort + server := httpServers.from(addr, func() *httpServer { + engine := newLocalossEngine() + return &httpServer{ + baseServer: newBaseServe(), + e: engine, + server: &http.Server{ + Addr: addr, + Handler: engine, + ReadTimeout: conf.LocalossServerSetting.GetReadTimeout(), + WriteTimeout: conf.LocalossServerSetting.GetWriteTimeout(), + MaxHeaderBytes: 1 << 20, + }, + } + }) + return &localossService{ + baseHttpService: &baseHttpService{ + server: server, + }, + } +} diff --git a/internal/service/mobile.go b/internal/service/mobile.go new file mode 100644 index 00000000..9fa3cb64 --- /dev/null +++ b/internal/service/mobile.go @@ -0,0 +1,67 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "log" + "net" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants" + "google.golang.org/grpc" +) + +var ( + _ Service = (*mobileService)(nil) +) + +type mobileService struct { + *baseGRPCService +} + +func (s *mobileService) Name() string { + return "MobileService" +} + +func (s *mobileService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *mobileService) OnInit() error { + s.registerServer(servants.RegisterMobileServants) + return nil +} + +func (s *mobileService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.MobileServerSetting.Host, conf.MobileServerSetting.Port)) +} + +func newMobileService() Service { + addr := conf.MobileServerSetting.Host + ":" + conf.MobileServerSetting.Port + server := grpcServers.from(addr, func() *grpcServer { + l, err := net.Listen("tcp", addr) + if err != nil { + // TODO: optimize error process + log.Fatal(fmt.Errorf("failed to listen: %w", err)) + } + + // TODO: init grpc.Server + s := grpc.NewServer() + + return &grpcServer{ + baseServer: newBaseServe(), + listener: l, + server: s, + } + }) + return &mobileService{ + baseGRPCService: &baseGRPCService{ + server: server, + }, + } +} diff --git a/internal/service/server.go b/internal/service/server.go new file mode 100644 index 00000000..336e96af --- /dev/null +++ b/internal/service/server.go @@ -0,0 +1,73 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import "sync" + +var ( + httpServers = newServerPool[*httpServer]() + grpcServers = newServerPool[*grpcServer]() +) + +const ( + _statusServerUnknow uint8 = iota + _statusServerInitilized + _statusServerStarted + _statusServerStoped +) + +type server interface { + status() uint8 + setStatus(uint8) + start() error + stop() error +} + +type serverPool[T server] struct { + servers map[string]T +} + +type baseServer struct { + sync.RWMutex + serverStatus uint8 +} + +func (p *serverPool[T]) from(addr string, newServer func() T) T { + s, exist := p.servers[addr] + if exist { + return s + } + s = newServer() + s.setStatus(_statusServerInitilized) + p.servers[addr] = s + return s +} + +func (s *baseServer) setStatus(status uint8) { + s.RLock() + defer s.RUnlock() + + s.serverStatus = status +} + +func (s *baseServer) status() uint8 { + s.RLock() + defer s.RUnlock() + + return s.serverStatus +} + +func newServerPool[T server]() *serverPool[T] { + return &serverPool[T]{ + servers: make(map[string]T), + } +} + +func newBaseServe() *baseServer { + return &baseServer{ + RWMutex: sync.RWMutex{}, + serverStatus: _statusServerUnknow, + } +} diff --git a/internal/service/service.go b/internal/service/service.go index bb70e9f8..db648406 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -1,45 +1,92 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package service import ( + "log" + + "github.com/Masterminds/semver/v3" "github.com/alimy/cfg" - "github.com/rocboss/paopao-ce/internal/core" - "github.com/rocboss/paopao-ce/internal/dao" - "github.com/rocboss/paopao-ce/internal/model" - "github.com/sirupsen/logrus" + "github.com/rocboss/paopao-ce/pkg/types" ) -var ( - ds core.DataService - ts core.TweetSearchService - oss core.ObjectStorageService - DisablePhoneVerify bool -) +type Service interface { + Name() string + Version() *semver.Version + OnInit() error + OnStart() error + OnStop() error +} -func Initialize() { - ds = dao.DataService() - ts = dao.TweetSearchService() - oss = dao.ObjectStorageService() - DisablePhoneVerify = !cfg.If("Sms") +type baseService types.Empty + +func (baseService) Name() string { + return "" +} + +func (baseService) Version() *semver.Version { + return semver.MustParse("v0.0.1") } -// persistMediaContents 获取媒体内容并持久化 -func persistMediaContents(contents []*PostContentItem) (items []string, err error) { - items = make([]string, 0, len(contents)) - for _, item := range contents { - switch item.Type { - case model.CONTENT_TYPE_IMAGE, - model.CONTENT_TYPE_VIDEO, - model.CONTENT_TYPE_AUDIO, - model.CONTENT_TYPE_ATTACHMENT, - model.CONTENT_TYPE_CHARGE_ATTACHMENT: - items = append(items, item.Content) - if err != nil { - continue - } - if err = oss.PersistObject(oss.ObjectKey(item.Content)); err != nil { - logrus.Errorf("service.persistMediaContents failed: %s", err) - } +func (baseService) String() string { + return "" +} + +// InitService Initial service +func InitService() []Service { + ss := newService() + for _, s := range ss { + if err := s.OnInit(); err != nil { + log.Fatalf("initial %s service error: %s", s.Name(), err) } } + return ss +} + +// MaxSidSize max service id string length +func MaxSidSize(ss []Service) int { + length := 0 + for _, s := range ss { + size := len(s.Name() + "@" + s.Version().String()) + if size > length { + length = size + } + } + return length +} + +func newService() (ss []Service) { + // add all service if declared in features on config.yaml + cfg.In(cfg.Actions{ + "Web": func() { + ss = append(ss, newWebService()) + }, + "Admin": func() { + ss = append(ss, newAdminService()) + }, + "SpaceX": func() { + ss = append(ss, newSpaceXService()) + }, + "Bot": func() { + ss = append(ss, newBotService()) + }, + "NativeOBS": func() { + ss = append(ss, newLocalossService()) + }, + "Mobile": func() { + ss = append(ss, newMobileService()) + }, + "Frontend:Web": func() { + ss = append(ss, newFrontendWebServiceService()) + }, + "Docs": func() { + ss = append(ss, newDocsService()) + }, + "Deprecated:OldWeb": func() { + ss = append(ss, newOldWebService()) + }, + }) return } diff --git a/internal/service/space.go b/internal/service/space.go new file mode 100644 index 00000000..5cce8914 --- /dev/null +++ b/internal/service/space.go @@ -0,0 +1,96 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "net/http" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/gin-contrib/cors" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants" +) + +var ( + _ Service = (*spaceXService)(nil) +) + +type spaceXService struct { + *baseHttpService +} + +func (s *spaceXService) Name() string { + return "SpaceXService" +} + +func (s *spaceXService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *spaceXService) OnInit() error { + s.registerRoute(servants.RegisterSpaceXServants) + return nil +} + +func (s *spaceXService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.SpaceXServerSetting.HttpIp, conf.SpaceXServerSetting.HttpPort)) +} + +func newSpaceXEngine() *gin.Engine { + e := gin.New() + e.HandleMethodNotAllowed = true + e.Use(gin.Logger()) + e.Use(gin.Recovery()) + + // 跨域配置 + corsConfig := cors.DefaultConfig() + corsConfig.AllowAllOrigins = true + corsConfig.AddAllowHeaders("Authorization") + e.Use(cors.New(corsConfig)) + + // 默认404 + e.NoRoute(func(c *gin.Context) { + c.JSON(http.StatusNotFound, gin.H{ + "code": 404, + "msg": "Not Found", + }) + }) + + // 默认405 + e.NoMethod(func(c *gin.Context) { + c.JSON(http.StatusMethodNotAllowed, gin.H{ + "code": 405, + "msg": "Method Not Allowed", + }) + }) + + return e +} + +func newSpaceXService() Service { + addr := conf.SpaceXServerSetting.HttpIp + ":" + conf.SpaceXServerSetting.HttpPort + server := httpServers.from(addr, func() *httpServer { + engine := newSpaceXEngine() + return &httpServer{ + baseServer: newBaseServe(), + e: engine, + server: &http.Server{ + Addr: addr, + Handler: engine, + ReadTimeout: conf.SpaceXServerSetting.GetReadTimeout(), + WriteTimeout: conf.SpaceXServerSetting.GetWriteTimeout(), + MaxHeaderBytes: 1 << 20, + }, + } + }) + return &spaceXService{ + baseHttpService: &baseHttpService{ + server: server, + }, + } +} diff --git a/internal/service/web.go b/internal/service/web.go new file mode 100644 index 00000000..a0c821a0 --- /dev/null +++ b/internal/service/web.go @@ -0,0 +1,97 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "net/http" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/gin-contrib/cors" + "github.com/gin-gonic/gin" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants" +) + +var ( + _ Service = (*webService)(nil) +) + +type webService struct { + *baseHttpService +} + +func (s *webService) Name() string { + return "WebService" +} + +func (s *webService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *webService) OnInit() error { + s.registerRoute(servants.RegisterWebServants) + return nil +} + +func (s *webService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.WebServerSetting.HttpIp, conf.WebServerSetting.HttpPort)) +} + +func newWebEngine() *gin.Engine { + e := gin.New() + e.HandleMethodNotAllowed = true + e.Use(gin.Logger()) + e.Use(gin.Recovery()) + + // 跨域配置 + corsConfig := cors.DefaultConfig() + corsConfig.AllowAllOrigins = true + corsConfig.AddAllowHeaders("Authorization") + e.Use(cors.New(corsConfig)) + + // 默认404 + e.NoRoute(func(c *gin.Context) { + c.JSON(http.StatusNotFound, gin.H{ + "code": 404, + "msg": "Not Found", + }) + }) + + // 默认405 + e.NoMethod(func(c *gin.Context) { + c.JSON(http.StatusMethodNotAllowed, gin.H{ + "code": 405, + "msg": "Method Not Allowed", + }) + }) + + return e +} + +func newWebService() Service { + addr := conf.WebServerSetting.HttpIp + ":" + conf.WebServerSetting.HttpPort + server := httpServers.from(addr, func() *httpServer { + engine := newWebEngine() + return &httpServer{ + baseServer: newBaseServe(), + e: engine, + server: &http.Server{ + Addr: addr, + Handler: engine, + ReadTimeout: conf.WebServerSetting.GetReadTimeout(), + WriteTimeout: conf.WebServerSetting.GetWriteTimeout(), + MaxHeaderBytes: 1 << 20, + }, + } + }) + + return &webService{ + baseHttpService: &baseHttpService{ + server: server, + }, + } +} diff --git a/internal/service/web_old.go b/internal/service/web_old.go new file mode 100644 index 00000000..beb3902c --- /dev/null +++ b/internal/service/web_old.go @@ -0,0 +1,63 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package service + +import ( + "fmt" + "net/http" + + "github.com/Masterminds/semver/v3" + "github.com/fatih/color" + "github.com/rocboss/paopao-ce/internal/conf" + "github.com/rocboss/paopao-ce/internal/servants/web/routers" +) + +var ( + _ Service = (*oldWebService)(nil) +) + +type oldWebService struct { + *baseHttpService +} + +func (s *oldWebService) Name() string { + return "OldWebService" +} + +func (s *oldWebService) Version() *semver.Version { + return semver.MustParse("v0.1.0") +} + +func (s *oldWebService) OnInit() error { + s.registerRoute(routers.RegisterRoute) + return nil +} + +func (s *oldWebService) String() string { + return fmt.Sprintf("listen on %s\n", color.GreenString("http://%s:%s", conf.ServerSetting.HttpIp, conf.ServerSetting.HttpPort)) +} + +func newOldWebService() Service { + addr := conf.ServerSetting.HttpIp + ":" + conf.ServerSetting.HttpPort + server := httpServers.from(addr, func() *httpServer { + engine := newWebEngine() + return &httpServer{ + baseServer: newBaseServe(), + e: engine, + server: &http.Server{ + Addr: addr, + Handler: engine, + ReadTimeout: conf.ServerSetting.GetReadTimeout(), + WriteTimeout: conf.ServerSetting.GetWriteTimeout(), + MaxHeaderBytes: 1 << 20, + }, + } + }) + return &oldWebService{ + baseHttpService: &baseHttpService{ + server: server, + }, + } +} diff --git a/main.go b/main.go index 1046e97d..d1886084 100644 --- a/main.go +++ b/main.go @@ -1,17 +1,23 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package main import ( "flag" "fmt" - "log" - "net/http" + "os" + "os/signal" "strings" + "sync" + "syscall" "github.com/fatih/color" "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/routers" + "github.com/rocboss/paopao-ce/internal/service" "github.com/rocboss/paopao-ce/pkg/debug" "github.com/rocboss/paopao-ce/pkg/util" ) @@ -42,29 +48,57 @@ func init() { } func flagParse() { - flag.BoolVar(&noDefaultFeatures, "no-default-features", false, "whether use default features") + flag.BoolVar(&noDefaultFeatures, "no-default-features", false, "whether not use default features") flag.Var(&features, "features", "use special features") flag.Parse() } -func main() { - gin.SetMode(conf.ServerSetting.RunMode) - - router := routers.NewRouter() - s := &http.Server{ - Addr: conf.ServerSetting.HttpIp + ":" + conf.ServerSetting.HttpPort, - Handler: router, - ReadTimeout: conf.ServerSetting.ReadTimeout, - WriteTimeout: conf.ServerSetting.WriteTimeout, - MaxHeaderBytes: 1 << 20, +func runService(wg *sync.WaitGroup, ss []service.Service) { + gin.SetMode(conf.RunMode()) + + fmt.Fprintf(color.Output, "\nstarting run service...\n\n") + l := service.MaxSidSize(ss) + for _, s := range ss { + go func(s service.Service) { + fmt.Fprintf(color.Output, "%s [start] - %s", util.SidStr(s.Name(), s.Version(), l), s) + if err := s.OnStart(); err != nil { + fmt.Fprintf(color.Output, "%s [start] - occurs on error: %s\n", util.SidStr(s.Name(), s.Version(), l), err) + } + wg.Done() + }(s) + } +} + +func runManage(wg *sync.WaitGroup, ss []service.Service) { + quit := make(chan os.Signal, 1) + // kill (no param) default send syscall.SIGTERM + // kill -2 is syscall.SIGINT + // kill -9 is syscall.SIGKILL but can't be catch, so don't need add it + signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) + <-quit + fmt.Fprintf(color.Output, "\nshutting down server...\n\n") + l := service.MaxSidSize(ss) + for _, s := range ss { + if err := s.OnStop(); err != nil { + fmt.Fprintf(color.Output, "%s [stop] - occurs on error: %s\n", util.SidStr(s.Name(), s.Version(), l), err) + } + fmt.Fprintf(color.Output, "%s [stop] - finish...\n", util.SidStr(s.Name(), s.Version(), l)) } + wg.Done() +} +func main() { util.PrintHelloBanner(debug.VersionInfo()) - fmt.Fprintf(color.Output, "PaoPao service listen on %s\n", - color.GreenString(fmt.Sprintf("http://%s:%s", conf.ServerSetting.HttpIp, conf.ServerSetting.HttpPort)), - ) - if err := s.ListenAndServe(); err != nil { - log.Fatalf("run app failed: %s", err) + if ss := service.InitService(); len(ss) > 0 { + wg := &sync.WaitGroup{} + wg.Add(len(ss) + 1) + + runService(wg, ss) + go runManage(wg, ss) + + wg.Wait() + } else { + fmt.Fprintln(color.Output, "no service need start so just exit") } } diff --git a/mirc/README.md b/mirc/README.md new file mode 100644 index 00000000..81c88517 --- /dev/null +++ b/mirc/README.md @@ -0,0 +1,10 @@ +### RESTful API for paopao-ce +本目录包含所有RESTful API相关定义文件 + +|目录|系列API|备注| +| ----- | ----- | ----- | +|web|/|Web v1版本RESTful API相关定义文件| +|admin|m|Admin后台运维系列相关RESTful API相关定义文件| +|space|x|SpaceX系列相关RESTful API相关定义文件| +|localoss|s| LocalOSS OBS系列RESTful API相关定义文件| +|bot|r| Bot系列相关RESTful API相关定义文件| diff --git a/mirc/admin/README.md b/mirc/admin/README.md new file mode 100644 index 00000000..c9fa71b9 --- /dev/null +++ b/mirc/admin/README.md @@ -0,0 +1,4 @@ +### Admin系列RESTful API相关定义文件 +本目录包含 Admin后台运维相关API定义文件。 + +* v1 - v1版本API diff --git a/mirc/admin/v1/user.go b/mirc/admin/v1/user.go new file mode 100644 index 00000000..6f0dcb79 --- /dev/null +++ b/mirc/admin/v1/user.go @@ -0,0 +1,42 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" +) + +func init() { + AddEntry(new(User)) +} + +type AgentInfo struct { + Platform string `json:"platform"` + UserAgent string `json:"user_agent"` +} + +type ServerInfo struct { + ApiVer string `json:"api_ver"` +} + +type UserInfo struct { + Name string `json:"name"` +} + +type LoginReq struct { + AgentInfo AgentInfo `json:"agent_info"` + Name string `json:"name"` + Passwd string `json:"passwd"` +} + +type LoginResp struct { + UserInfo + ServerInfo ServerInfo `json:"server_info"` + JwtToken string `json:"jwt_token"` +} + +type User struct { + Chain Chain `mir:"-"` + Group Group `mir:"m/v1"` + Login func(Post, LoginReq) LoginResp `mir:"/user/login/"` + Logout func(Post) `mir:"/user/logout/"` +} diff --git a/mirc/bot/README.md b/mirc/bot/README.md new file mode 100644 index 00000000..a1aa83ac --- /dev/null +++ b/mirc/bot/README.md @@ -0,0 +1,4 @@ +### Bot系列RESTful API相关定义文件 +本目录包含 Bot相关API定义文件。 + +* v1 - v1版本API diff --git a/mirc/bot/v1/user.go b/mirc/bot/v1/user.go new file mode 100644 index 00000000..a4839673 --- /dev/null +++ b/mirc/bot/v1/user.go @@ -0,0 +1,42 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" +) + +func init() { + AddEntry(new(User)) +} + +type AgentInfo struct { + Platform string `json:"platform"` + UserAgent string `json:"user_agent"` +} + +type ServerInfo struct { + ApiVer string `json:"api_ver"` +} + +type UserInfo struct { + Name string `json:"name"` +} + +type LoginReq struct { + AgentInfo AgentInfo `json:"agent_info"` + Name string `json:"name"` + Passwd string `json:"passwd"` +} + +type LoginResp struct { + UserInfo + ServerInfo ServerInfo `json:"server_info"` + JwtToken string `json:"jwt_token"` +} + +type User struct { + Chain Chain `mir:"-"` + Group Group `mir:"r/v1"` + Login func(Post, LoginReq) LoginResp `mir:"/user/login/"` + Logout func(Post) `mir:"/user/logout/"` +} diff --git a/mirc/localoss/README.md b/mirc/localoss/README.md new file mode 100644 index 00000000..e1769bf5 --- /dev/null +++ b/mirc/localoss/README.md @@ -0,0 +1,4 @@ +### LocalOSS OBS系列RESTful API相关定义文件 +本目录包含 LocalOSS OBS 系列相关API定义文件。 + +* v1 - v1版本API diff --git a/mirc/localoss/v1/user.go b/mirc/localoss/v1/user.go new file mode 100644 index 00000000..555ff6d7 --- /dev/null +++ b/mirc/localoss/v1/user.go @@ -0,0 +1,42 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" +) + +func init() { + AddEntry(new(User)) +} + +type AgentInfo struct { + Platform string `json:"platform"` + UserAgent string `json:"user_agent"` +} + +type ServerInfo struct { + ApiVer string `json:"api_ver"` +} + +type UserInfo struct { + Name string `json:"name"` +} + +type LoginReq struct { + AgentInfo AgentInfo `json:"agent_info"` + Name string `json:"name"` + Passwd string `json:"passwd"` +} + +type LoginResp struct { + UserInfo + ServerInfo ServerInfo `json:"server_info"` + JwtToken string `json:"jwt_token"` +} + +type User struct { + Group Group `mir:"s/v1"` + Index func(Get) `mir:"/index/"` + Login func(Post, LoginReq) LoginResp `mir:"/user/login/"` + Logout func(Post) `mir:"/user/logout/"` +} diff --git a/mirc/main.go b/mirc/main.go new file mode 100644 index 00000000..1ec56e76 --- /dev/null +++ b/mirc/main.go @@ -0,0 +1,33 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package main + +import ( + "log" + + . "github.com/alimy/mir/v3/core" + . "github.com/alimy/mir/v3/engine" + + _ "github.com/rocboss/paopao-ce/mirc/admin/v1" + _ "github.com/rocboss/paopao-ce/mirc/bot/v1" + _ "github.com/rocboss/paopao-ce/mirc/localoss/v1" + _ "github.com/rocboss/paopao-ce/mirc/space/v1" + _ "github.com/rocboss/paopao-ce/mirc/web/v1" +) + +//go:generate go run main.go +func main() { + log.Println("generate code start") + opts := Options{ + RunMode(InSerialMode), + GeneratorName(GeneratorGin), + WatchCtxDone(true), + SinkPath("../auto"), + } + if err := Generate(opts); err != nil { + log.Fatal(err) + } + log.Println("generate code finish") +} diff --git a/mirc/space/README.md b/mirc/space/README.md new file mode 100644 index 00000000..a4ec3303 --- /dev/null +++ b/mirc/space/README.md @@ -0,0 +1,4 @@ +### SpaceX系列RESTful API +本目录包含SpaceX系列RESTful API相关定义文件 + +* v1 - v1版本API diff --git a/mirc/space/v1/user.go b/mirc/space/v1/user.go new file mode 100644 index 00000000..8dd49fa5 --- /dev/null +++ b/mirc/space/v1/user.go @@ -0,0 +1,42 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" +) + +func init() { + AddEntry(new(User)) +} + +type AgentInfo struct { + Platform string `json:"platform"` + UserAgent string `json:"user_agent"` +} + +type ServerInfo struct { + ApiVer string `json:"api_ver"` +} + +type UserInfo struct { + Name string `json:"name"` +} + +type LoginReq struct { + AgentInfo AgentInfo `json:"agent_info"` + Name string `json:"name"` + Passwd string `json:"passwd"` +} + +type LoginResp struct { + UserInfo + ServerInfo ServerInfo `json:"server_info"` + JwtToken string `json:"jwt_token"` +} + +type User struct { + Chain Chain `mir:"-"` + Group Group `mir:"x/v1"` + Login func(Post, LoginReq) LoginResp `mir:"/user/login/"` + Logout func(Post) `mir:"/user/logout/"` +} diff --git a/mirc/web/README.md b/mirc/web/README.md new file mode 100644 index 00000000..f8690712 --- /dev/null +++ b/mirc/web/README.md @@ -0,0 +1,4 @@ +### Web系列RESTful API +本目录包含Web系列RESTful API相关定义文件 + +* v1 - v1版本API diff --git a/mirc/web/v1/admin.go b/mirc/web/v1/admin.go new file mode 100644 index 00000000..4a1d8655 --- /dev/null +++ b/mirc/web/v1/admin.go @@ -0,0 +1,20 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +func init() { + AddEntry(new(Admin)) +} + +// Admin 运维相关服务 +type Admin struct { + Chain Chain `mir:"-"` + Group Group `mir:"v1"` + + // ChangeUserStatus 管理·禁言/解封用户 + ChangeUserStatus func(Post, web.ChangeUserStatusReq) `mir:"/admin/user/status"` +} diff --git a/mirc/web/v1/alipay.go b/mirc/web/v1/alipay.go new file mode 100644 index 00000000..86ab6936 --- /dev/null +++ b/mirc/web/v1/alipay.go @@ -0,0 +1,34 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +func init() { + AddEntries(new(AlipayPub), new(AlipayPriv)) +} + +// AlipayPub 支付宝相关不用授权的服务 +type AlipayPub struct { + Group Group `mir:"v1"` + + // AlipayNotify 支付宝回调 + AlipayNotify func(Post, web.AlipayNotifyReq) `mir:"/alipay/notify"` +} + +// AlipayPub 支付宝相关授权的服务 +type AlipayPriv struct { + Chain Chain `mir:"-"` + Group Group `mir:"v1"` + + // UserRechargeLink 用户充值 + UserRechargeLink func(Post, web.UserRechargeLinkReq) web.UserRechargeLinkResp `mir:"/user/recharge"` + + // UserRechargeResult 获取充值结果 + UserRechargeResult func(Get, web.UserRechargeResultReq) web.UserRechargeResultResp `mir:"/user/recharge"` + + // UserWalletBills 获取用户账单 + UserWalletBills func(Get, web.UserWalletBillsReq) web.UserWalletBillsResp `mir:"/user/wallet/bills"` +} diff --git a/mirc/web/v1/core.go b/mirc/web/v1/core.go new file mode 100644 index 00000000..af835074 --- /dev/null +++ b/mirc/web/v1/core.go @@ -0,0 +1,65 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +func init() { + AddEntry(new(Core)) +} + +// Core 核心服务,需要授权访问 +type Core struct { + Chain Chain `mir:"-"` + Group Group `mir:"v1"` + + // SyncSearchIndex 同步索引 + SyncSearchIndex func(Get, web.SyncSearchIndexReq) `mir:"/sync/index"` + + // GetUserInfo 获取当前用户信息 + GetUserInfo func(Get, web.UserInfoReq) web.UserInfoResp `mir:"/user/info"` + + // GetUnreadMsgCount 获取当前用户未读消息数量 + GetUnreadMsgCount func(Get, web.GetUnreadMsgCountReq) web.GetUnreadMsgCountResp `mir:"/user/msgcount/unread"` + + // GetMessages 获取消息列表 + GetMessages func(Get, web.GetMessagesReq) web.GetMessagesResp `mir:"/user/messages"` + + // ReadMessage 标记消息已读 + ReadMessage func(Post, web.ReadMessageReq) `mir:"/user/message/read"` + + // SendUserWhisper 发送用户私信 + SendUserWhisper func(Post, web.SendWhisperReq) `mir:"/user/whisper"` + + // GetCollections 获取用户收藏列表 + GetCollections func(Get, web.GetCollectionsReq) web.GetCollectionsResp `mir:"/user/collections"` + + // GetStars 获取用户点赞列表 + GetStars func(Get, web.GetStarsReq) web.GetStarsResp `mir:"/user/stars"` + + // UserPhoneBind 绑定用户手机号 + UserPhoneBind func(Post, web.UserPhoneBindReq) `mir:"/user/phone"` + + // ChangePassword 修改密码 + ChangePassword func(Post, web.ChangePasswordReq) `mir:"/user/password"` + + // ChangeNickname 修改昵称 + ChangeNickname func(Post, web.ChangeNicknameReq) `mir:"/user/nickname"` + + // ChangeAvatar 修改头像 + ChangeAvatar func(Post, web.ChangeAvatarReq) `mir:"/user/avatar"` + + // SuggestUsers 检索用户 + SuggestUsers func(Get, web.SuggestUsersReq) web.SuggestUsersResp `mir:"/suggest/users"` + + // SuggestTags 检索标签 + SuggestTags func(Get, web.SuggestTagsReq) web.SuggestTagsResp `mir:"/suggest/tags"` + + // TweetStarStatus 获取动态点赞状态 + TweetStarStatus func(Get, web.TweetStarStatusReq) web.TweetStarStatusResp `mir:"/post/star"` + + // TweetCollectionStatus 获取动态收藏状态 + TweetCollectionStatus func(Get, web.TweetCollectionStatusReq) web.TweetCollectionStatusResp `mir:"/post/collection"` +} diff --git a/mirc/web/v1/followship.go b/mirc/web/v1/followship.go new file mode 100644 index 00000000..99c0dba6 --- /dev/null +++ b/mirc/web/v1/followship.go @@ -0,0 +1,29 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +func init() { + AddEntry(new(Followship)) +} + +// Followship 关注者模式 服务 +type Followship struct { + Chain Chain `mir:"-"` + Group Group `mir:"v1"` + + // AddFollowing 添加关注 + AddFollowing func(Post, web.AddFollowingReq) `mir:"/following/add"` + + // DeleteFollowing 取消关注 + DeleteFollowing func(Post, web.DeleteFollowingReq) `mir:"/following/delete"` + + // ListFollowings 获取用户的关注列表 + ListFollowings func(Get, web.ListFollowingsReq) web.ListFollowingsResp `mir:"/following/list"` + + // ListFollowers 获取用户的追随者列表 + ListFollowers func(Get, web.ListFollowersReq) web.ListFollowersResp `mir:"/follower/list"` +} diff --git a/mirc/web/v1/friendship.go b/mirc/web/v1/friendship.go new file mode 100644 index 00000000..1013a894 --- /dev/null +++ b/mirc/web/v1/friendship.go @@ -0,0 +1,32 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +func init() { + AddEntry(new(Friendship)) +} + +// Friendship 好友模式 服务 +type Friendship struct { + Chain Chain `mir:"-"` + Group Group `mir:"v1"` + + // RequestingFriend 请求添加朋友 + RequestingFriend func(Post, web.RequestingFriendReq) `mir:"/friend/requesting"` + + // AddFriend 同意添加好友 + AddFriend func(Post, web.AddFriendReq) `mir:"/friend/add"` + + // RejectFriend 拒绝添加好友 + RejectFriend func(Post, web.RejectFriendReq) `mir:"/friend/reject"` + + // DeleteFriend 删除好友 + DeleteFriend func(Post, web.DeleteFriendReq) `mir:"/friend/delete"` + + // GetContacts 获取好友列表 + GetContacts func(Get, web.GetContactsReq) web.GetContactsResp `mir:"/user/contacts"` +} diff --git a/mirc/web/v1/loose.go b/mirc/web/v1/loose.go new file mode 100644 index 00000000..887e3c9b --- /dev/null +++ b/mirc/web/v1/loose.go @@ -0,0 +1,26 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +func init() { + AddEntry(new(Loose)) +} + +// Loose 宽松授权的服务 +type Loose struct { + Chain Chain `mir:"-"` + Group Group `mir:"v1"` + + // Timeline 获取广场流 + Timeline func(Get, web.TimelineReq) web.TimelineResp `mir:"/posts"` + + // GetUserTweets 获取用户动态列表 + GetUserTweets func(Get, web.GetUserTweetsReq) web.GetUserTweetsResp `mir:"/user/posts"` + + // GetUserProfile 获取用户基本信息 + GetUserProfile func(Get, web.GetUserProfileReq) web.GetUserProfileResp `mir:"/user/profile"` +} diff --git a/mirc/web/v1/priv.go b/mirc/web/v1/priv.go new file mode 100644 index 00000000..e9737e02 --- /dev/null +++ b/mirc/web/v1/priv.go @@ -0,0 +1,59 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +func init() { + AddEntry(new(Priv)) +} + +// Priv 私有授权的服务 +type Priv struct { + Chain Chain `mir:"-"` + Group Group `mir:"v1"` + + // UploadAttachment 上传资源 + UploadAttachment func(Post, web.UploadAttachmentReq) web.UploadAttachmentResp `mir:"/attachment"` + + // DownloadAttachmentPrecheck 下载资源预检 + DownloadAttachmentPrecheck func(Get, web.DownloadAttachmentPrecheckReq) web.DownloadAttachmentPrecheckResp `mir:"/attachment/precheck"` + + // DownloadAttachment 下载资源 + DownloadAttachment func(Get, web.DownloadAttachmentReq) web.DownloadAttachmentResp `mir:"/attachment"` + + // CreateTweet 发布动态 + CreateTweet func(Post, web.CreateTweetReq) web.CreateTweetResp `mir:"/post"` + + // DeleteTweet 删除动态 + DeleteTweet func(Delete, web.DeleteTweetReq) `mir:"/post"` + + // StarTweet 动态点赞操作 + StarTweet func(Post, web.StarTweetReq) web.StarTweetResp `mir:"/post/start"` + + // CollectionTweet 动态收藏操作 + CollectionTweet func(Post, web.CollectionTweetReq) web.CollectionTweetResp `mir:"/post/collection"` + + // LockTweet 锁定动态 + LockTweet func(Post, web.LockTweetReq) web.LockTweetResp `mir:"/post/lock"` + + // StickTweet 置顶动态 + StickTweet func(Post, web.StickTweetReq) web.StickTweetResp `mir:"/post/stick"` + + // VisiblePost 修改动态可见度 + VisiblePost func(Post, web.VisiblePostReq) web.VisiblePostResp `mir:"/post/visibility"` + + // CreateTweetComment 发布动态评论 + CreateComment func(Post, web.CreateCommentReq) web.CreateCommentResp `mir:"/post/comment"` + + // DeletePostComment 删除动态评论 + DeleteComment func(Delete, web.DeleteCommentReq) `mir:"/post/comment"` + + // CreateCommentReply 发布评论回复 + CreateCommentReply func(Post, web.CreateCommentReplyReq) web.CreateCommentReplyResp `mir:"/post/comment/reply"` + + // DeleteCommentReply 删除评论回复 + DeleteCommentReply func(Delete, web.DeleteCommentReplyReq) `mir:"/post/comment/reply"` +} diff --git a/mirc/web/v1/pub.go b/mirc/web/v1/pub.go new file mode 100644 index 00000000..2364f223 --- /dev/null +++ b/mirc/web/v1/pub.go @@ -0,0 +1,40 @@ +package v1 + +import ( + . "github.com/alimy/mir/v3" + . "github.com/alimy/mir/v3/engine" + "github.com/rocboss/paopao-ce/internal/model/web" +) + +func init() { + AddEntry(new(Pub)) +} + +// Pub 不用授权的公开服务 +type Pub struct { + Group Group `mir:"v1"` + + // Version 获取后台版本信息 + Version func(Get) web.VersionResp `mir:"/"` + + // Login 用户登录 + Login func(Post, web.LoginReq) web.LoginResp `mir:"/auth/login"` + + // Register 用户注册 + Register func(Post, web.RegisterReq) web.RegisterResp `mir:"/auth/register"` + + // GetCaptcha 获取验证码 + GetCaptcha func(Get) web.GetCaptchaResp `mir:"/captcha"` + + // SendCaptcha 发送验证码 + SendCaptcha func(Post, web.SendCaptchaReq) `mir:"/captcha"` + + // TweetDetail 获取动态详情 + TweetDetail func(Get, web.TweetDetailReq) web.TweetDetailResp `mir:"/post"` + + // TweetComments 获取动态评论 + TweetComments func(Get, web.TweetCommentsReq) web.TweetCommentsResp `mir:"/post/comments"` + + // TopicList 获取话题列表 + TopicList func(Get, web.TopicListReq) web.TopicListResp `mir:"/tags"` +} diff --git a/pkg/app/app.go b/pkg/app/app.go index fc860d27..a98a49a2 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package app import ( diff --git a/pkg/app/form.go b/pkg/app/form.go index 7e376104..91b116a2 100644 --- a/pkg/app/form.go +++ b/pkg/app/form.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package app import ( diff --git a/pkg/app/jwt.go b/pkg/app/jwt.go index 8033296f..b9759e07 100644 --- a/pkg/app/jwt.go +++ b/pkg/app/jwt.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package app import ( @@ -5,7 +9,7 @@ import ( "github.com/golang-jwt/jwt/v4" "github.com/rocboss/paopao-ce/internal/conf" - "github.com/rocboss/paopao-ce/internal/model" + "github.com/rocboss/paopao-ce/internal/core" ) type Claims struct { @@ -18,7 +22,7 @@ func GetJWTSecret() []byte { return []byte(conf.JWTSetting.Secret) } -func GenerateToken(User *model.User) (string, error) { +func GenerateToken(User *core.User) (string, error) { expireTime := time.Now().Add(conf.JWTSetting.Expire) claims := Claims{ UID: User.ID, diff --git a/pkg/app/pagination.go b/pkg/app/pagination.go index 1888efb9..09d7532b 100644 --- a/pkg/app/pagination.go +++ b/pkg/app/pagination.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package app import ( @@ -42,3 +46,17 @@ func GetPageOffset(c *gin.Context) (offset, limit int) { offset = (page - 1) * limit return } + +func GetPageInfo(c *gin.Context) (page, pageSize int) { + page = convert.StrTo(c.Query("page")).MustInt() + if page <= 0 { + page = 1 + } + pageSize = convert.StrTo(c.Query("page_size")).MustInt() + if pageSize <= 0 { + pageSize = conf.AppSetting.DefaultPageSize + } else if pageSize > conf.AppSetting.MaxPageSize { + pageSize = conf.AppSetting.MaxPageSize + } + return +} diff --git a/pkg/convert/convert.go b/pkg/convert/convert.go index 60dacf9b..ff3be5e5 100644 --- a/pkg/convert/convert.go +++ b/pkg/convert/convert.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package convert import "strconv" diff --git a/pkg/convert/convert_test.go b/pkg/convert/convert_test.go index a746e3e7..a31d13e6 100644 --- a/pkg/convert/convert_test.go +++ b/pkg/convert/convert_test.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package convert import ( diff --git a/pkg/crypto/signature.go b/pkg/crypto/signature.go index 7f18959a..20a6deaa 100644 --- a/pkg/crypto/signature.go +++ b/pkg/crypto/signature.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package crypto import ( diff --git a/pkg/debug/version.go b/pkg/debug/version.go index 485e8046..12623f96 100644 --- a/pkg/debug/version.go +++ b/pkg/debug/version.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package debug import ( @@ -7,9 +11,9 @@ import ( var version, commitID, buildDate string type BuildInfo struct { - Version string - Sum string - BuildDate string + Version string `json:"version"` + Sum string `json:"sum"` + BuildDate string `json:"build_date"` } func VersionInfo() string { diff --git a/pkg/errcode/common_code.go b/pkg/errcode/common_code.go index 75b220ee..1f15f8c5 100644 --- a/pkg/errcode/common_code.go +++ b/pkg/errcode/common_code.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package errcode var ( diff --git a/pkg/errcode/errcode.go b/pkg/errcode/errcode.go index 50f04868..5143aabb 100644 --- a/pkg/errcode/errcode.go +++ b/pkg/errcode/errcode.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package errcode import ( diff --git a/pkg/errcode/module_code.go b/pkg/errcode/module_code.go index 1c5b7215..9543624b 100644 --- a/pkg/errcode/module_code.go +++ b/pkg/errcode/module_code.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package errcode var ( diff --git a/pkg/sign/sign.go b/pkg/sign/sign.go index 717b8e54..fc7c10e9 100644 --- a/pkg/sign/sign.go +++ b/pkg/sign/sign.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package sign import ( diff --git a/pkg/types/types.go b/pkg/types/types.go index 2696f8b9..830c56c6 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package types // Empty empty alias type diff --git a/pkg/util/banner.go b/pkg/util/banner.go index d41b5ae1..b8f16971 100644 --- a/pkg/util/banner.go +++ b/pkg/util/banner.go @@ -1,6 +1,14 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package util -import "fmt" +import ( + "fmt" + + "github.com/Masterminds/semver/v3" +) func PrintHelloBanner(text string) { @@ -10,3 +18,7 @@ func PrintHelloBanner(text string) { fmt.Println("(__) \\_/\\_/ \\__/(__) \\_/\\_/ \\__/ ") fmt.Println(text) } + +func SidStr(name string, version *semver.Version, size int) string { + return fmt.Sprintf(fmt.Sprintf("%%s@%%-%ds", size-len(name+version.String())+4), name, version) +} diff --git a/pkg/util/ip.go b/pkg/util/ip.go index 3aaa13c1..4561d8a6 100644 --- a/pkg/util/ip.go +++ b/pkg/util/ip.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package util import "github.com/rocboss/paopao-ce/pkg/util/iploc" diff --git a/pkg/util/ip_test.go b/pkg/util/ip_test.go index 82976be8..0740ffd5 100644 --- a/pkg/util/ip_test.go +++ b/pkg/util/ip_test.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package util import "testing" diff --git a/pkg/util/iploc/iploc.go b/pkg/util/iploc/iploc.go index a05f8d7e..449e52a9 100644 --- a/pkg/util/iploc/iploc.go +++ b/pkg/util/iploc/iploc.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package iploc import ( diff --git a/pkg/util/iploc/iploc_test.go b/pkg/util/iploc/iploc_test.go index 4754e86d..a38bb106 100644 --- a/pkg/util/iploc/iploc_test.go +++ b/pkg/util/iploc/iploc_test.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package iploc import ( diff --git a/pkg/util/md5.go b/pkg/util/md5.go index 8a00f545..477cd5ff 100644 --- a/pkg/util/md5.go +++ b/pkg/util/md5.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package util import ( diff --git a/pkg/util/md5_test.go b/pkg/util/md5_test.go index 0bab593f..12c14c86 100644 --- a/pkg/util/md5_test.go +++ b/pkg/util/md5_test.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package util import "testing" diff --git a/pkg/util/str.go b/pkg/util/str.go index 35e034ab..8b62217d 100644 --- a/pkg/util/str.go +++ b/pkg/util/str.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package util import ( diff --git a/pkg/xerror/common.go b/pkg/xerror/common.go new file mode 100644 index 00000000..2852f6c2 --- /dev/null +++ b/pkg/xerror/common.go @@ -0,0 +1,26 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package xerror + +var ( + Success = NewError(0, "成功") + ServerError = NewError(10000, "服务内部错误") + InvalidParams = NewError(10001, "入参错误") + NotFound = NewError(10002, "找不到") + UnauthorizedAuthNotExist = NewError(10003, "账户不存在") + UnauthorizedAuthFailed = NewError(10004, "账户密码错误") + UnauthorizedTokenError = NewError(10005, "鉴权失败,Token 错误或丢失") + UnauthorizedTokenTimeout = NewError(10006, "鉴权失败,Token 超时") + UnauthorizedTokenGenerate = NewError(10007, "鉴权失败,Token 生成失败") + TooManyRequests = NewError(10008, "请求过多") + + GatewayMethodsLimit = NewError(10109, "网关仅接受GET或POST请求") + GatewayLostSign = NewError(10110, "网关请求缺少签名") + GatewayLostAppKey = NewError(10111, "网关请求缺少APP KEY") + GatewayAppKeyInvalid = NewError(10112, "网关请求无效APP KEY") + GatewayAppKeyClosed = NewError(10113, "网关请求APP KEY已停用") + GatewayParamSignError = NewError(10114, "网关请求参数签名错误") + GatewayTooManyRequests = NewError(10115, "网关请求频次超限") +) diff --git a/pkg/xerror/xerror.go b/pkg/xerror/xerror.go new file mode 100644 index 00000000..0fc7878c --- /dev/null +++ b/pkg/xerror/xerror.go @@ -0,0 +1,107 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + +package xerror + +import ( + "fmt" + "net/http" + "strings" + + "github.com/alimy/mir/v3" +) + +var ( + _ mir.Error = (*Error)(nil) + + codes = map[int]string{} +) + +type Error struct { + code int + msg string + details []string +} + +type ValidError struct { + Message string +} + +type ValidErrors []*ValidError + +func (v *ValidError) Error() string { + return v.Message +} + +func (v ValidErrors) Error() string { + return strings.Join(v.Errors(), ",") +} + +func (v ValidErrors) Errors() []string { + var errs []string + for _, err := range v { + errs = append(errs, err.Error()) + } + return errs +} + +func NewError(code int, msg string) *Error { + if _, ok := codes[code]; ok { + panic(fmt.Sprintf("错误码 %d 已经存在,请更换一个", code)) + } + codes[code] = msg + return &Error{code: code, msg: msg} +} + +func (e *Error) Error() string { + return fmt.Sprintf("错误码: %d, 错误信息: %s", e.StatusCode(), e.Msg()) +} + +func (e *Error) StatusCode() int { + return e.code +} + +func (e *Error) Msg() string { + return e.msg +} + +func (e *Error) Msgf(args []any) string { + return fmt.Sprintf(e.msg, args...) +} + +func (e *Error) Details() []string { + return e.details +} + +func (e *Error) WithDetails(details ...string) *Error { + newError := *e + newError.details = []string{} + newError.details = append(newError.details, details...) + + return &newError +} + +func HttpStatusCode(e mir.Error) int { + switch e.StatusCode() { + case Success.StatusCode(): + return http.StatusOK + case ServerError.StatusCode(): + return http.StatusInternalServerError + case InvalidParams.StatusCode(): + return http.StatusBadRequest + case UnauthorizedAuthNotExist.StatusCode(): + fallthrough + case UnauthorizedAuthFailed.StatusCode(): + fallthrough + case UnauthorizedTokenError.StatusCode(): + fallthrough + case UnauthorizedTokenGenerate.StatusCode(): + fallthrough + case UnauthorizedTokenTimeout.StatusCode(): + return http.StatusUnauthorized + case TooManyRequests.StatusCode(): + return http.StatusTooManyRequests + } + return http.StatusInternalServerError +} diff --git a/pkg/zinc/zinc.go b/pkg/zinc/zinc.go index ba1fb270..cc200a55 100644 --- a/pkg/zinc/zinc.go +++ b/pkg/zinc/zinc.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + package zinc import ( diff --git a/proto/RADME.md b/proto/RADME.md new file mode 100644 index 00000000..05d78ece --- /dev/null +++ b/proto/RADME.md @@ -0,0 +1,2 @@ +### gRPC API +This directory contain some gRPC API define files. diff --git a/proto/buf.lock b/proto/buf.lock new file mode 100644 index 00000000..19abf63f --- /dev/null +++ b/proto/buf.lock @@ -0,0 +1,7 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 75b4300737fb4efca0831636be94e517 diff --git a/proto/buf.yaml b/proto/buf.yaml new file mode 100644 index 00000000..eda8f330 --- /dev/null +++ b/proto/buf.yaml @@ -0,0 +1,10 @@ +version: v1 +lint: + use: + - DEFAULT +breaking: + use: + - FILE + +deps: + - buf.build/googleapis/googleapis diff --git a/proto/v1/auth.proto b/proto/v1/auth.proto new file mode 100644 index 00000000..16c340ce --- /dev/null +++ b/proto/v1/auth.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package auth; + +option go_package = "github.com/rocboss/paopao-ce/auto/rpc/v1"; + +message User { + string phoneNum = 1; +} + +message UserVerify { + string phoneNum = 1; + string VerificationCode = 2; +} + +message LoginReply { + int32 statuCode = 1; + string token = 2; +} + +message ActionReply { + int32 statusCode = 1; +} + +service Authenticate { + rpc preLogin(User) returns (ActionReply); + rpc login(User) returns (LoginReply); + rpc logout(User) returns (ActionReply); +} diff --git a/scripts/migration/embed.go b/scripts/migration/embed.go index 88e633c8..3f1eacda 100644 --- a/scripts/migration/embed.go +++ b/scripts/migration/embed.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build migration // +build migration diff --git a/web/.env b/web/.env index 2082466b..6d3d734c 100644 --- a/web/.env +++ b/web/.env @@ -5,9 +5,9 @@ VITE_ENABLE_ANOUNCEMENT=false VITE_ENABLE_WALLET=false # 功能开启 -VITE_ALLOW_TWEET_ATTACHMENT=false +VITE_ALLOW_TWEET_ATTACHMENT=true VITE_ALLOW_TWEET_ATTACHMENT_PRICE=false -VITE_ALLOW_TWEET_VIDEO=false +VITE_ALLOW_TWEET_VIDEO=true VITE_ALLOW_TWEET_VISIBILITY=true VITE_ALLOW_ACTIVATION=false VITE_ALLOW_PHONE_BIND=true diff --git a/web/dist/assets/404.15b4dcd0.js b/web/dist/assets/404.15b4dcd0.js deleted file mode 100644 index 757fd2b8..00000000 --- a/web/dist/assets/404.15b4dcd0.js +++ /dev/null @@ -1,32 +0,0 @@ -import{_ as E}from"./main-nav.9110259b.js";import{h as e,l as u,m as p,d as h,u as F,q as m,cH as V,s as _,v as d,y as S,N as D,bv as M,bs as R,bu as $,bt as I,ah as L,aj as T,V as H,W as P,a3 as f,a4 as v,a8 as j,J as N}from"./index.f480f018.js";import{_ as k}from"./List.49bcdf81.js";var O=e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 36 36"},e("circle",{fill:"#FFCB4C",cx:"18",cy:"17.018",r:"17"}),e("path",{fill:"#65471B",d:"M14.524 21.036c-.145-.116-.258-.274-.312-.464-.134-.46.13-.918.59-1.021 4.528-1.021 7.577 1.363 7.706 1.465.384.306.459.845.173 1.205-.286.358-.828.401-1.211.097-.11-.084-2.523-1.923-6.182-1.098-.274.061-.554-.016-.764-.184z"}),e("ellipse",{fill:"#65471B",cx:"13.119",cy:"11.174",rx:"2.125",ry:"2.656"}),e("ellipse",{fill:"#65471B",cx:"24.375",cy:"12.236",rx:"2.125",ry:"2.656"}),e("path",{fill:"#F19020",d:"M17.276 35.149s1.265-.411 1.429-1.352c.173-.972-.624-1.167-.624-1.167s1.041-.208 1.172-1.376c.123-1.101-.861-1.363-.861-1.363s.97-.4 1.016-1.539c.038-.959-.995-1.428-.995-1.428s5.038-1.221 5.556-1.341c.516-.12 1.32-.615 1.069-1.694-.249-1.08-1.204-1.118-1.697-1.003-.494.115-6.744 1.566-8.9 2.068l-1.439.334c-.54.127-.785-.11-.404-.512.508-.536.833-1.129.946-2.113.119-1.035-.232-2.313-.433-2.809-.374-.921-1.005-1.649-1.734-1.899-1.137-.39-1.945.321-1.542 1.561.604 1.854.208 3.375-.833 4.293-2.449 2.157-3.588 3.695-2.83 6.973.828 3.575 4.377 5.876 7.952 5.048l3.152-.681z"}),e("path",{fill:"#65471B",d:"M9.296 6.351c-.164-.088-.303-.224-.391-.399-.216-.428-.04-.927.393-1.112 4.266-1.831 7.699-.043 7.843.034.433.231.608.747.391 1.154-.216.405-.74.546-1.173.318-.123-.063-2.832-1.432-6.278.047-.257.109-.547.085-.785-.042zm12.135 3.75c-.156-.098-.286-.243-.362-.424-.187-.442.023-.927.468-1.084 4.381-1.536 7.685.48 7.823.567.415.26.555.787.312 1.178-.242.39-.776.495-1.191.238-.12-.072-2.727-1.621-6.267-.379-.266.091-.553.046-.783-.096z"})),W=e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 36 36"},e("path",{fill:"#FFCC4D",d:"M36 18c0 9.941-8.059 18-18 18-9.94 0-18-8.059-18-18C0 8.06 8.06 0 18 0c9.941 0 18 8.06 18 18"}),e("ellipse",{fill:"#664500",cx:"18",cy:"27",rx:"5",ry:"6"}),e("path",{fill:"#664500",d:"M5.999 11c-.208 0-.419-.065-.599-.2-.442-.331-.531-.958-.2-1.4C8.462 5.05 12.816 5 13 5c.552 0 1 .448 1 1 0 .551-.445.998-.996 1-.155.002-3.568.086-6.204 3.6-.196.262-.497.4-.801.4zm24.002 0c-.305 0-.604-.138-.801-.4-2.64-3.521-6.061-3.598-6.206-3.6-.55-.006-.994-.456-.991-1.005C22.006 5.444 22.45 5 23 5c.184 0 4.537.05 7.8 4.4.332.442.242 1.069-.2 1.4-.18.135-.39.2-.599.2zm-16.087 4.5l1.793-1.793c.391-.391.391-1.023 0-1.414s-1.023-.391-1.414 0L12.5 14.086l-1.793-1.793c-.391-.391-1.023-.391-1.414 0s-.391 1.023 0 1.414l1.793 1.793-1.793 1.793c-.391.391-.391 1.023 0 1.414.195.195.451.293.707.293s.512-.098.707-.293l1.793-1.793 1.793 1.793c.195.195.451.293.707.293s.512-.098.707-.293c.391-.391.391-1.023 0-1.414L13.914 15.5zm11 0l1.793-1.793c.391-.391.391-1.023 0-1.414s-1.023-.391-1.414 0L23.5 14.086l-1.793-1.793c-.391-.391-1.023-.391-1.414 0s-.391 1.023 0 1.414l1.793 1.793-1.793 1.793c-.391.391-.391 1.023 0 1.414.195.195.451.293.707.293s.512-.098.707-.293l1.793-1.793 1.793 1.793c.195.195.451.293.707.293s.512-.098.707-.293c.391-.391.391-1.023 0-1.414L24.914 15.5z"})),q=e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 36 36"},e("ellipse",{fill:"#292F33",cx:"18",cy:"26",rx:"18",ry:"10"}),e("ellipse",{fill:"#66757F",cx:"18",cy:"24",rx:"18",ry:"10"}),e("path",{fill:"#E1E8ED",d:"M18 31C3.042 31 1 16 1 12h34c0 2-1.958 19-17 19z"}),e("path",{fill:"#77B255",d:"M35 12.056c0 5.216-7.611 9.444-17 9.444S1 17.271 1 12.056C1 6.84 8.611 3.611 18 3.611s17 3.229 17 8.445z"}),e("ellipse",{fill:"#A6D388",cx:"18",cy:"13",rx:"15",ry:"7"}),e("path",{d:"M21 17c-.256 0-.512-.098-.707-.293-2.337-2.337-2.376-4.885-.125-8.262.739-1.109.9-2.246.478-3.377-.461-1.236-1.438-1.996-1.731-2.077-.553 0-.958-.443-.958-.996 0-.552.491-.995 1.043-.995.997 0 2.395 1.153 3.183 2.625 1.034 1.933.91 4.039-.351 5.929-1.961 2.942-1.531 4.332-.125 5.738.391.391.391 1.023 0 1.414-.195.196-.451.294-.707.294zm-6-2c-.256 0-.512-.098-.707-.293-2.337-2.337-2.376-4.885-.125-8.262.727-1.091.893-2.083.494-2.947-.444-.961-1.431-1.469-1.684-1.499-.552 0-.989-.447-.989-1 0-.552.458-1 1.011-1 .997 0 2.585.974 3.36 2.423.481.899 1.052 2.761-.528 5.131-1.961 2.942-1.531 4.332-.125 5.738.391.391.391 1.023 0 1.414-.195.197-.451.295-.707.295z",fill:"#5C913B"})),A=e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 36 36"},e("path",{fill:"#EF9645",d:"M15.5 2.965c1.381 0 2.5 1.119 2.5 2.5v.005L20.5.465c1.381 0 2.5 1.119 2.5 2.5V4.25l2.5-1.535c1.381 0 2.5 1.119 2.5 2.5V8.75L29 18H15.458L15.5 2.965z"}),e("path",{fill:"#FFDC5D",d:"M4.625 16.219c1.381-.611 3.354.208 4.75 2.188.917 1.3 1.187 3.151 2.391 3.344.46.073 1.234-.313 1.234-1.397V4.5s0-2 2-2 2 2 2 2v11.633c0-.029 1-.064 1-.082V2s0-2 2-2 2 2 2 2v14.053c0 .017 1 .041 1 .069V4.25s0-2 2-2 2 2 2 2v12.638c0 .118 1 .251 1 .398V8.75s0-2 2-2 2 2 2 2V24c0 6.627-5.373 12-12 12-4.775 0-8.06-2.598-9.896-5.292C8.547 28.423 8.096 26.051 8 25.334c0 0-.123-1.479-1.156-2.865-1.469-1.969-2.5-3.156-3.125-3.866-.317-.359-.625-1.707.906-2.384z"})),J=u("result",` - color: var(--n-text-color); - line-height: var(--n-line-height); - font-size: var(--n-font-size); - transition: - color .3s var(--n-bezier); -`,[u("result-icon",` - display: flex; - justify-content: center; - transition: color .3s var(--n-bezier); - `,[p("status-image",` - font-size: var(--n-icon-size); - width: 1em; - height: 1em; - `),u("base-icon",` - color: var(--n-icon-color); - font-size: var(--n-icon-size); - `)]),u("result-content",{marginTop:"24px"}),u("result-footer",` - margin-top: 24px; - text-align: center; - `),u("result-header",[p("title",` - margin-top: 16px; - font-weight: var(--n-title-font-weight); - transition: color .3s var(--n-bezier); - text-align: center; - color: var(--n-title-text-color); - font-size: var(--n-title-font-size); - `),p("description",` - margin-top: 4px; - text-align: center; - font-size: var(--n-font-size); - `)])]);const K={403:A,404:O,418:q,500:W,info:e(M,null),success:e(R,null),warning:e($,null),error:e(I,null)},G=Object.assign(Object.assign({},m.props),{size:{type:String,default:"medium"},status:{type:String,default:"info"},title:String,description:String});var Q=h({name:"Result",props:G,setup(n){const{mergedClsPrefixRef:r,inlineThemeDisabled:t}=F(n),s=m("Result","-result",J,V,n,r),o=_(()=>{const{size:l,status:a}=n,{common:{cubicBezierEaseInOut:c},self:{textColor:g,lineHeight:x,titleTextColor:z,titleFontWeight:w,[d("iconColor",a)]:C,[d("fontSize",l)]:y,[d("titleFontSize",l)]:B,[d("iconSize",l)]:b}}=s.value;return{"--n-bezier":c,"--n-font-size":y,"--n-icon-size":b,"--n-line-height":x,"--n-text-color":g,"--n-title-font-size":B,"--n-title-font-weight":w,"--n-title-text-color":z,"--n-icon-color":C||""}}),i=t?S("result",_(()=>{const{size:l,status:a}=n;let c="";return l&&(c+=l[0]),a&&(c+=a[0]),c}),o,n):void 0;return{mergedClsPrefix:r,cssVars:t?void 0:o,themeClass:i==null?void 0:i.themeClass,onRender:i==null?void 0:i.onRender}},render(){var n;const{status:r,$slots:t,mergedClsPrefix:s,onRender:o}=this;return o==null||o(),e("div",{class:[`${s}-result`,this.themeClass],style:this.cssVars},e("div",{class:`${s}-result-icon`},((n=t.icon)===null||n===void 0?void 0:n.call(t))||e(D,{clsPrefix:s},{default:()=>K[r]})),e("div",{class:`${s}-result-header`},this.title?e("div",{class:`${s}-result-header__title`},this.title):null,this.description?e("div",{class:`${s}-result-header__description`},this.description):null),t.default&&e("div",{class:`${s}-result-content`},t),t.footer&&e("div",{class:`${s}-result-footer`},t.footer()))}});const U=j("\u56DE\u4E3B\u9875"),X=h({setup(n){const r=T(),t=()=>{r.push({path:"/"})};return(s,o)=>{const i=E,l=N,a=Q,c=k;return H(),P("div",null,[f(i,{title:"404"}),f(c,{class:"main-content-wrap wrap404",bordered:""},{default:v(()=>[f(a,{status:"404",title:"404 \u8D44\u6E90\u4E0D\u5B58\u5728",description:"\u518D\u770B\u770B\u5176\u4ED6\u7684\u5427"},{footer:v(()=>[f(l,{onClick:t},{default:v(()=>[U]),_:1})]),_:1})]),_:1})])}}});var t1=L(X,[["__scopeId","data-v-4c5da4ba"]]);export{t1 as default}; diff --git a/web/dist/assets/Alert.a854329b.js b/web/dist/assets/Alert.a854329b.js deleted file mode 100644 index 85228da5..00000000 --- a/web/dist/assets/Alert.a854329b.js +++ /dev/null @@ -1,34 +0,0 @@ -import{c as j,ce as k,cf as u,b as f,l as y,m as c,bz as B,o as F,n as M,d as O,u as N,q as E,x as V,s as S,ba as K,v as g,y as q,r as D,h as s,b2 as G,cg as J,K as Q,N as U,bt as X,bu as Y,bv as Z,bs as ee,z as oe,bx as re}from"./index.f480f018.js";const ne=r=>{const{lineHeight:o,borderRadius:i,fontWeightStrong:m,baseColor:n,dividerColor:v,actionColor:z,textColor1:t,textColor2:a,closeColor:h,closeColorHover:C,closeColorPressed:b,infoColor:l,successColor:e,warningColor:p,errorColor:x,fontSize:T}=r;return Object.assign(Object.assign({},k),{fontSize:T,lineHeight:o,titleFontWeight:m,borderRadius:i,border:`1px solid ${v}`,color:z,titleTextColor:t,iconColor:a,contentTextColor:a,closeColor:h,closeColorHover:C,closeColorPressed:b,borderInfo:`1px solid ${u(n,f(l,{alpha:.25}))}`,colorInfo:u(n,f(l,{alpha:.08})),titleTextColorInfo:t,iconColorInfo:l,contentTextColorInfo:a,closeColorInfo:h,closeColorHoverInfo:C,closeColorPressedInfo:b,borderSuccess:`1px solid ${u(n,f(e,{alpha:.25}))}`,colorSuccess:u(n,f(e,{alpha:.08})),titleTextColorSuccess:t,iconColorSuccess:e,contentTextColorSuccess:a,closeColorSuccess:h,closeColorHoverSuccess:C,closeColorPressedSuccess:b,borderWarning:`1px solid ${u(n,f(p,{alpha:.33}))}`,colorWarning:u(n,f(p,{alpha:.08})),titleTextColorWarning:t,iconColorWarning:p,contentTextColorWarning:a,closeColorWarning:h,closeColorHoverWarning:C,closeColorPressedWarning:b,borderError:`1px solid ${u(n,f(x,{alpha:.25}))}`,colorError:u(n,f(x,{alpha:.08})),titleTextColorError:t,iconColorError:x,contentTextColorError:a,closeColorError:h,closeColorHoverError:C,closeColorPressedError:b})},te={name:"Alert",common:j,self:ne};var le=te,se=y("alert",` - line-height: var(--n-line-height); - border-radius: var(--n-border-radius); - position: relative; - transition: background-color .3s var(--n-bezier); - background-color: var(--n-color); - text-align: start; -`,[c("icon",{color:"var(--n-icon-color)"}),y("alert-body",{border:"var(--n-border)",padding:"var(--n-padding)"},[c("title",{color:"var(--n-title-text-color)"}),c("content",{color:"var(--n-content-text-color)"})]),B({originalTransition:"transform .3s var(--n-bezier)",enterToProps:{transform:"scale(1)"},leaveToProps:{transform:"scale(0.9)"}}),c("icon",` - position: absolute; - left: 0; - top: 0; - align-items: center; - justify-content: center; - display: flex; - width: var(--n-icon-size); - height: var(--n-icon-size); - font-size: var(--n-icon-size); - margin: var(--n-icon-margin); - `),c("close",` - transition: color .3s var(--n-bezier); - position: absolute; - right: 0; - top: 0; - margin: var(--n-close-margin); - font-size: var(--n-close-size); - `),F("show-icon",[y("alert-body",{paddingLeft:"calc(var(--n-icon-margin-left) + var(--n-icon-size) + var(--n-icon-margin-right))"})]),y("alert-body",` - border-radius: var(--n-border-radius); - transition: border-color .3s var(--n-bezier); - `,[c("title",` - transition: color .3s var(--n-bezier); - font-size: 16px; - line-height: 19px; - font-weight: var(--n-title-font-weight); - `,[M("& +",[c("content",{marginTop:"9px"})])]),c("content",{transition:"color .3s var(--n-bezier)",fontSize:"var(--n-font-size)"})]),c("icon",{transition:"color .3s var(--n-bezier)"})]);const ie=Object.assign(Object.assign({},E.props),{title:{type:String,default:void 0},showIcon:{type:Boolean,default:!0},type:{type:String,default:"default"},closable:{type:Boolean,default:!1},onClose:Function,onAfterLeave:{type:Function,default:void 0},onAfterHide:{type:Function,validator:()=>!0,default:void 0}});var ce=O({name:"Alert",inheritAttrs:!1,props:ie,setup(r){const{mergedClsPrefixRef:o,inlineThemeDisabled:i,mergedRtlRef:m}=N(r),n=E("Alert","-alert",se,le,r,o),v=V("Alert",m,o),z=S(()=>{const{common:{cubicBezierEaseInOut:l},self:e}=n.value,{fontSize:p,borderRadius:x,titleFontWeight:T,lineHeight:P,iconSize:$,iconMargin:I,iconMarginRtl:R,closeSize:_,closeMargin:A,closeMarginRtl:W,padding:w}=e,{type:d}=r,{left:H,right:L}=K(I);return{"--n-bezier":l,"--n-color":e[g("color",d)],"--n-close-color":e[g("closeColor",d)],"--n-close-color-hover":e[g("closeColorHover",d)],"--n-close-color-pressed":e[g("closeColorPressed",d)],"--n-icon-color":e[g("iconColor",d)],"--n-border":e[g("border",d)],"--n-title-text-color":e[g("titleTextColor",d)],"--n-content-text-color":e[g("contentTextColor",d)],"--n-line-height":P,"--n-border-radius":x,"--n-font-size":p,"--n-title-font-weight":T,"--n-icon-size":$,"--n-icon-margin":I,"--n-icon-margin-rtl":R,"--n-close-size":_,"--n-close-margin":A,"--n-close-margin-rtl":W,"--n-padding":w,"--n-icon-margin-left":H,"--n-icon-margin-right":L}}),t=i?q("alert",S(()=>r.type[0]),z,r):void 0,a=D(!0),h=()=>{const{onAfterLeave:l,onAfterHide:e}=r;l&&l(),e&&e()};return{rtlEnabled:v,mergedClsPrefix:o,visible:a,handleCloseClick:()=>{var l;Promise.resolve((l=r.onClose)===null||l===void 0?void 0:l.call(r)).then(e=>{e!==!1&&(a.value=!1)})},handleAfterLeave:()=>{h()},mergedTheme:n,cssVars:i?void 0:z,themeClass:t==null?void 0:t.themeClass,onRender:t==null?void 0:t.onRender}},render(){var r;return(r=this.onRender)===null||r===void 0||r.call(this),s(re,{onAfterLeave:this.handleAfterLeave},{default:()=>{const{mergedClsPrefix:o,$slots:i}=this,m={class:[`${o}-alert`,this.themeClass,this.showIcon&&`${o}-alert--show-icon`,this.rtlEnabled&&`${o}-alert--rtl`],style:this.cssVars,role:"alert"};return this.visible?s("div",Object.assign({},G(this.$attrs,m)),this.closable&&s(J,{clsPrefix:o,class:`${o}-alert__close`,onClick:this.handleCloseClick}),this.showIcon&&s("div",{class:`${o}-alert__icon`,"aria-hidden":"true"},Q(i.icon,()=>[s(U,{clsPrefix:o},{default:()=>{switch(this.type){case"success":return s(ee,null);case"info":return s(Z,null);case"warning":return s(Y,null);case"error":return s(X,null);default:return null}}})])),s("div",{class:`${o}-alert-body`},oe(i.header,n=>{const v=n||this.title;return v?s("div",{class:`${o}-alert-body__title`},v):null}),i.default&&s("div",{class:`${o}-alert-body__content`},i))):null}})}});export{ce as _}; diff --git a/web/dist/assets/Anouncement.98ee5b6f.js b/web/dist/assets/Anouncement.98ee5b6f.js deleted file mode 100644 index 1b7d2050..00000000 --- a/web/dist/assets/Anouncement.98ee5b6f.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as N}from"./post-skeleton.39a35f5b.js";import{_ as V}from"./main-nav.9110259b.js";import{ah as z,d as A,Z as E,ai as R,r as a,a1 as S,V as n,W as t,a3 as o,a4 as c,a2 as l,a6 as m,aa as F,ab as P,a5 as q,Y as s,a9 as _,c3 as D}from"./index.f480f018.js";import{f as I}from"./formatTime.02109bf5.js";import{_ as L}from"./List.49bcdf81.js";import{_ as M}from"./Pagination.1263479e.js";import{a as O,_ as T}from"./Skeleton.57e98fe3.js";const U={key:0,class:"pagination-wrap"},W={key:0,class:"skeleton-wrap"},Y={key:1},Z={key:0,class:"empty-wrap"},$={class:"bill-line"},j=A({setup(G){const d=E(),g=R(),v=a(!1),u=a([]),r=a(+g.query.p||1),f=a(20),p=a(0),h=i=>{r.value=i};return S(()=>{}),(i,H)=>{const y=V,k=M,x=N,w=O,C=T,B=L;return n(),t("div",null,[o(y,{title:"\u516C\u544A"}),o(B,{class:"main-content-wrap",bordered:""},{footer:c(()=>[p.value>1?(n(),t("div",U,[o(k,{page:r.value,"onUpdate:page":h,"page-slot":l(d).state.collapsedRight?5:8,"page-count":p.value},null,8,["page","page-slot","page-count"])])):m("",!0)]),default:c(()=>[v.value?(n(),t("div",W,[o(x,{num:f.value},null,8,["num"])])):(n(),t("div",Y,[u.value.length===0?(n(),t("div",Z,[o(w,{size:"large",description:"\u6682\u65E0\u6570\u636E"})])):m("",!0),(n(!0),t(F,null,P(u.value,e=>(n(),q(C,{key:e.id},{default:c(()=>[s("div",$,[s("div",null,"NO."+_(e.id),1),s("div",null,_(e.reason),1),s("div",{class:D({income:e.change_amount>=0,out:e.change_amount<0})},_((e.change_amount>0?"+":"")+(e.change_amount/100).toFixed(2)),3),s("div",null,_(l(I)(e.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});var te=z(j,[["__scopeId","data-v-543914f4"]]);export{te as default}; diff --git a/web/dist/assets/Collection.02f600ee.js b/web/dist/assets/Collection.02f600ee.js deleted file mode 100644 index 45ce9370..00000000 --- a/web/dist/assets/Collection.02f600ee.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as z}from"./post-item.03452002.js";import{_ as B}from"./post-skeleton.39a35f5b.js";import{_ as E}from"./main-nav.9110259b.js";import{ah as P,d as R,Z as V,ai as b,aj as F,r as n,a1 as M,V as e,W as o,a3 as a,a4 as p,cm as N,a2 as S,a6 as m,aa as $,ab as j,a5 as q}from"./index.f480f018.js";import{_ as I}from"./List.49bcdf81.js";import{_ as L}from"./Pagination.1263479e.js";import{a as T,_ as U}from"./Skeleton.57e98fe3.js";import"./content.ef1e095a.js";import"./formatTime.02109bf5.js";import"./Thing.eef6b133.js";const W={key:0,class:"pagination-wrap"},Z={key:0,class:"skeleton-wrap"},A={key:1},D={key:0,class:"empty-wrap"},G=R({setup(H){const d=V(),g=b();F();const s=n(!1),_=n([]),l=n(+g.query.p||1),c=n(20),u=n(0),r=()=>{s.value=!0,N({page:l.value,page_size:c.value}).then(t=>{s.value=!1,_.value=t.list,u.value=Math.ceil(t.pager.total_rows/c.value),window.scrollTo(0,0)}).catch(t=>{s.value=!1})},v=t=>{l.value=t,r()};return M(()=>{r()}),(t,J)=>{const f=E,h=L,k=B,y=T,w=z,C=U,x=I;return e(),o("div",null,[a(f,{title:"\u6536\u85CF"}),a(x,{class:"main-content-wrap",bordered:""},{footer:p(()=>[u.value>1?(e(),o("div",W,[a(h,{page:l.value,"onUpdate:page":v,"page-slot":S(d).state.collapsedRight?5:8,"page-count":u.value},null,8,["page","page-slot","page-count"])])):m("",!0)]),default:p(()=>[s.value?(e(),o("div",Z,[a(k,{num:c.value},null,8,["num"])])):(e(),o("div",A,[_.value.length===0?(e(),o("div",D,[a(y,{size:"large",description:"\u6682\u65E0\u6570\u636E"})])):m("",!0),(e(!0),o($,null,j(_.value,i=>(e(),q(C,{key:i.id},{default:p(()=>[a(w,{post:i},null,8,["post"])]),_:2},1024))),128))]))]),_:1})])}}});var se=P(G,[["__scopeId","data-v-2f4c0166"]]);export{se as default}; diff --git a/web/dist/assets/Contacts.a6b6de0d.js b/web/dist/assets/Contacts.a6b6de0d.js deleted file mode 100644 index 609e0044..00000000 --- a/web/dist/assets/Contacts.a6b6de0d.js +++ /dev/null @@ -1 +0,0 @@ -import{ah as k,d as C,aj as D,V as e,W as n,Y as c,a3 as o,a9 as v,ad as E,Z as N,ai as P,r as l,a1 as R,cn as S,a4 as g,a2 as U,a6 as y,aa as q,ab as M,a5 as T}from"./index.f480f018.js";import{_ as j}from"./post-skeleton.39a35f5b.js";import{_ as F}from"./main-nav.9110259b.js";import{_ as L}from"./List.49bcdf81.js";import{_ as W}from"./Pagination.1263479e.js";import{a as Y,_ as Z}from"./Skeleton.57e98fe3.js";const A={class:"avatar"},G={class:"base-info"},H={class:"username"},J={class:"uid"},K=C({props:{contact:null},setup(s){const p=D(),m=t=>{p.push({name:"user",query:{username:t}})};return(t,a)=>{const _=E;return e(),n("div",{class:"contact-item",onClick:a[0]||(a[0]=u=>m(s.contact.username))},[c("div",A,[o(_,{size:"large",src:s.contact.avatar},null,8,["src"])]),c("div",G,[c("div",H,[c("strong",null,v(s.contact.nickname),1),c("span",null," @"+v(s.contact.username),1)]),c("div",J,"UID. "+v(s.contact.user_id),1)])])}}});var O=k(K,[["__scopeId","data-v-23bc18c8"]]);const Q={key:0,class:"pagination-wrap"},X={key:0,class:"skeleton-wrap"},ee={key:1},te={key:0,class:"empty-wrap"},ae=C({setup(s){const p=N(),m=P(),t=l(!1),a=l([]),_=l(+m.query.p||1),u=l(20),d=l(0),w=r=>{_.value=r,f()};R(()=>{f()});const f=(r=!1)=>{a.value.length===0&&(t.value=!0),S({page:_.value,page_size:u.value}).then(i=>{t.value=!1,a.value=i.list,d.value=Math.ceil(i.pager.total_rows/u.value),r&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(i=>{t.value=!1})};return(r,i)=>{const x=F,$=W,B=j,b=Y,z=O,I=Z,V=L;return e(),n("div",null,[o(x,{title:"\u597D\u53CB"}),o(V,{class:"main-content-wrap",bordered:""},{footer:g(()=>[d.value>1?(e(),n("div",Q,[o($,{page:_.value,"onUpdate:page":w,"page-slot":U(p).state.collapsedRight?5:8,"page-count":d.value},null,8,["page","page-slot","page-count"])])):y("",!0)]),default:g(()=>[t.value?(e(),n("div",X,[o(B,{num:u.value},null,8,["num"])])):(e(),n("div",ee,[a.value.length===0?(e(),n("div",te,[o(b,{size:"large",description:"\u6682\u65E0\u6570\u636E"})])):y("",!0),(e(!0),n(q,null,M(a.value,h=>(e(),T(I,{key:h.user_id},{default:g(()=>[o(z,{contact:h},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})])}}});var ue=k(ae,[["__scopeId","data-v-e9de9e50"]]);export{ue as default}; diff --git a/web/dist/assets/Home.d188c936.js b/web/dist/assets/Home.d188c936.js deleted file mode 100644 index 5a5d3412..00000000 --- a/web/dist/assets/Home.d188c936.js +++ /dev/null @@ -1,177 +0,0 @@ -var Ct=Object.defineProperty,xt=Object.defineProperties;var kt=Object.getOwnPropertyDescriptors;var Xe=Object.getOwnPropertySymbols;var Rt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var Qe=(e,n,t)=>n in e?Ct(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Ye=(e,n)=>{for(var t in n||(n={}))Rt.call(n,t)&&Qe(e,t,n[t]);if(Xe)for(var t of Xe(n))St.call(n,t)&&Qe(e,t,n[t]);return e},Ze=(e,n)=>xt(e,kt(n));import{_ as Vt}from"./post-item.03452002.js";import{_ as Ft}from"./post-skeleton.39a35f5b.js";import{d as W,h as i,c as He,a as Bt,b as et,u as Ce,e as st,f as Ke,r as R,i as Ve,t as se,g as Fe,j as te,w as It,k as J,l as K,m as G,n as Q,o as Y,p as Le,q as ue,s as Z,v as Re,x as Ge,y as We,z as $t,A as ut,B as Dt,C as zt,D as dt,E as ct,F as pt,G as At,_ as Se,H as Et,I as ft,J as he,K as tt,N as me,L as je,M as Pt,O as Tt,P as Ne,Q as Oe,R as Nt,S as mt,T as Ot,X as nt,U as ot,V as M,W as j,Y as q,Z as vt,$ as Ut,a0 as Mt,a1 as ht,a2 as ne,a3 as y,a4 as P,a5 as we,a6 as oe,a7 as at,a8 as xe,a9 as Lt,aa as gt,ab as bt,ac as jt,ad as qt,ae as Ht,af as Kt,ag as Gt,ah as Wt,ai as Jt,aj as Xt,ak as Qt}from"./index.f480f018.js";import{V as ie,l as rt,I as Yt,P as ye,_ as Zt}from"./IEnum.bfd96c78.js";import{p as en}from"./content.ef1e095a.js";import{_ as tn,a as nn,b as on,c as an}from"./Upload.efe3adfd.js";import{_ as rn}from"./main-nav.9110259b.js";import{_ as ln}from"./List.49bcdf81.js";import{_ as sn}from"./Pagination.1263479e.js";import{_ as un,a as dn}from"./Skeleton.57e98fe3.js";import"./formatTime.02109bf5.js";import"./Thing.eef6b133.js";var cn=W({name:"ArrowDown",render(){return i("svg",{viewBox:"0 0 28 28",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},i("g",{stroke:"none","stroke-width":"1","fill-rule":"evenodd"},i("g",{"fill-rule":"nonzero"},i("path",{d:"M23.7916,15.2664 C24.0788,14.9679 24.0696,14.4931 23.7711,14.206 C23.4726,13.9188 22.9978,13.928 22.7106,14.2265 L14.7511,22.5007 L14.7511,3.74792 C14.7511,3.33371 14.4153,2.99792 14.0011,2.99792 C13.5869,2.99792 13.2511,3.33371 13.2511,3.74793 L13.2511,22.4998 L5.29259,14.2265 C5.00543,13.928 4.53064,13.9188 4.23213,14.206 C3.93361,14.4931 3.9244,14.9679 4.21157,15.2664 L13.2809,24.6944 C13.6743,25.1034 14.3289,25.1034 14.7223,24.6944 L23.7916,15.2664 Z"}))))}}),pn=W({name:"ArrowUp",render(){return i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},i("g",{fill:"none"},i("path",{d:"M3.13 9.163a.5.5 0 1 0 .74.674L9.5 3.67V17.5a.5.5 0 0 0 1 0V3.672l5.63 6.165a.5.5 0 0 0 .738-.674l-6.315-6.916a.746.746 0 0 0-.632-.24a.746.746 0 0 0-.476.24L3.131 9.163z",fill:"currentColor"})))}}),_t=W({name:"Remove",render(){return i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},i("line",{x1:"400",y1:"256",x2:"112",y2:"256",style:` - fill: none; - stroke: currentColor; - stroke-linecap: round; - stroke-linejoin: round; - stroke-width: 32px; - `}))}});const fn=e=>{const{borderColor:n,primaryColor:t,baseColor:c,textColorDisabled:l,inputColorDisabled:v,textColor2:r,opacityDisabled:k,borderRadius:p,fontSizeSmall:D,fontSizeMedium:f,fontSizeLarge:T,heightSmall:b,heightMedium:s,heightLarge:S,lineHeight:_}=e;return Object.assign(Object.assign({},Bt),{labelLineHeight:_,buttonHeightSmall:b,buttonHeightMedium:s,buttonHeightLarge:S,fontSizeSmall:D,fontSizeMedium:f,fontSizeLarge:T,boxShadow:`inset 0 0 0 1px ${n}`,boxShadowActive:`inset 0 0 0 1px ${t}`,boxShadowFocus:`inset 0 0 0 1px ${t}, 0 0 0 2px ${et(t,{alpha:.2})}`,boxShadowHover:`inset 0 0 0 1px ${t}`,boxShadowDisabled:`inset 0 0 0 1px ${n}`,color:c,colorDisabled:v,textColor:r,textColorDisabled:l,dotColorActive:t,dotColorDisabled:n,buttonBorderColor:n,buttonBorderColorActive:t,buttonBorderColorHover:n,buttonColor:c,buttonColorActive:c,buttonTextColor:r,buttonTextColorActive:t,buttonTextColorHover:t,opacityDisabled:k,buttonBoxShadowFocus:`inset 0 0 0 1px ${t}, 0 0 0 2px ${et(t,{alpha:.3})}`,buttonBoxShadowHover:"inset 0 0 0 1px #0000",buttonBoxShadow:"inset 0 0 0 1px #0000",buttonBorderRadius:p})},mn={name:"Radio",common:He,self:fn};var yt=mn;const vn={name:String,value:{type:[String,Number],default:"on"},checked:{type:Boolean,default:void 0},defaultChecked:Boolean,disabled:{type:Boolean,default:void 0},label:String,size:String,onUpdateChecked:[Function,Array],"onUpdate:checked":[Function,Array],checkedValue:{type:Boolean,validator:()=>(It("radio","`checked-value` is deprecated, please use `checked` instead."),!0),default:void 0}},wt=st("n-radio-group");function qe(e){const n=Ke(e,{mergedSize(u){const{size:I}=e;if(I!==void 0)return I;if(r){const{mergedSizeRef:{value:U}}=r;if(U!==void 0)return U}return u?u.mergedSize.value:"medium"},mergedDisabled(u){return!!(e.disabled||r!=null&&r.disabledRef.value||u!=null&&u.disabled.value)}}),{mergedSizeRef:t,mergedDisabledRef:c}=n,l=R(null),v=R(null),r=Ve(wt,null),k=R(e.defaultChecked),p=se(e,"checked"),D=Fe(p,k),f=te(()=>r?r.valueRef.value===e.value:D.value),T=te(()=>{const{name:u}=e;if(u!==void 0)return u;if(r)return r.nameRef.value}),b=R(!1);function s(){if(r){const{doUpdateValue:u}=r,{value:I}=e;J(u,I)}else{const{onUpdateChecked:u,"onUpdate:checked":I}=e,{nTriggerFormInput:U,nTriggerFormChange:N}=n;u&&J(u,!0),I&&J(I,!0),U(),N(),k.value=!0}}function S(){c.value||f.value||s()}function _(){S()}function w(){b.value=!1}function A(){b.value=!0}return{mergedClsPrefix:r?r.mergedClsPrefixRef:Ce(e).mergedClsPrefixRef,inputRef:l,labelRef:v,mergedName:T,mergedDisabled:c,uncontrolledChecked:k,renderSafeChecked:f,focus:b,mergedSize:t,handleRadioInputChange:_,handleRadioInputBlur:w,handleRadioInputFocus:A}}qe.props=vn;var hn=K("radio",` - line-height: var(--n-label-line-height); - outline: none; - position: relative; - user-select: none; - display: inline-flex; - align-items: flex-start; - flex-wrap: nowrap; - font-size: var(--n-font-size); - word-break: break-word; -`,[G("dot-wrapper",` - position: relative; - flex-shrink: 0; - flex-grow: 0; - width: var(--n-radio-size); - `),K("radio-input",` - position: absolute; - border: 0; - border-radius: inherit; - left: 0; - right: 0; - top: 0; - bottom: 0; - opacity: 0; - z-index: 1; - cursor: pointer; - `),G("dot",` - position: absolute; - top: 50%; - left: 0; - transform: translateY(-50%); - height: var(--n-radio-size); - width: var(--n-radio-size); - background: var(--n-color); - box-shadow: var(--n-box-shadow); - border-radius: 50%; - transition: - background-color .3s var(--n-bezier), - box-shadow .3s var(--n-bezier); - `,[Q("&::before",` - content: ""; - opacity: 0; - position: absolute; - left: 4px; - top: 4px; - height: calc(100% - 8px); - width: calc(100% - 8px); - border-radius: 50%; - transform: scale(.8); - background: var(--n-dot-color-active); - transition: - opacity .3s var(--n-bezier), - background-color .3s var(--n-bezier), - transform .3s var(--n-bezier); - `),Y("checked",{boxShadow:"var(--n-box-shadow-active)"},[Q("&::before",` - opacity: 1; - transform: scale(1); - `)])]),G("label",` - color: var(--n-text-color); - padding: var(--n-label-padding); - display: inline-block; - transition: color .3s var(--n-bezier); - `),Le("disabled",` - cursor: pointer; - `,[Q("&:hover",[G("dot",{boxShadow:"var(--n-box-shadow-hover)"})]),Y("focus",[Q("&:not(:active)",[G("dot",{boxShadow:"var(--n-box-shadow-focus)"})])])]),Y("disabled",` - cursor: not-allowed; - `,[G("dot",{boxShadow:"var(--n-box-shadow-disabled)",backgroundColor:"var(--n-color-disabled)"},[Q("&::before",{backgroundColor:"var(--n-dot-color-disabled)"}),Y("checked",` - opacity: 1; - `)]),G("label",{color:"var(--n-text-color-disabled)"}),K("radio-input",` - cursor: not-allowed; - `)])]),gn=W({name:"Radio",props:Object.assign(Object.assign({},ue.props),qe.props),setup(e){const n=qe(e),t=ue("Radio","-radio",hn,yt,e,n.mergedClsPrefix),c=Z(()=>{const{mergedSize:{value:D}}=n,{common:{cubicBezierEaseInOut:f},self:{boxShadow:T,boxShadowActive:b,boxShadowDisabled:s,boxShadowFocus:S,boxShadowHover:_,color:w,colorDisabled:A,textColor:u,textColorDisabled:I,dotColorActive:U,dotColorDisabled:N,labelPadding:z,labelLineHeight:a,[Re("fontSize",D)]:d,[Re("radioSize",D)]:V}}=t.value;return{"--n-bezier":f,"--n-label-line-height":a,"--n-box-shadow":T,"--n-box-shadow-active":b,"--n-box-shadow-disabled":s,"--n-box-shadow-focus":S,"--n-box-shadow-hover":_,"--n-color":w,"--n-color-disabled":A,"--n-dot-color-active":U,"--n-dot-color-disabled":N,"--n-font-size":d,"--n-radio-size":V,"--n-text-color":u,"--n-text-color-disabled":I,"--n-label-padding":z}}),{inlineThemeDisabled:l,mergedClsPrefixRef:v,mergedRtlRef:r}=Ce(e),k=Ge("Radio",r,v),p=l?We("radio",Z(()=>n.mergedSize.value[0]),c,e):void 0;return Object.assign(n,{rtlEnabled:k,cssVars:l?void 0:c,themeClass:p==null?void 0:p.themeClass,onRender:p==null?void 0:p.onRender})},render(){const{$slots:e,mergedClsPrefix:n,onRender:t,label:c}=this;return t==null||t(),i("label",{class:[`${n}-radio`,this.themeClass,{[`${n}-radio--rtl`]:this.rtlEnabled,[`${n}-radio--disabled`]:this.mergedDisabled,[`${n}-radio--checked`]:this.renderSafeChecked,[`${n}-radio--focus`]:this.focus}],style:this.cssVars},i("input",{ref:"inputRef",type:"radio",class:`${n}-radio-input`,value:this.value,name:this.mergedName,checked:this.renderSafeChecked,disabled:this.mergedDisabled,onChange:this.handleRadioInputChange,onFocus:this.handleRadioInputFocus,onBlur:this.handleRadioInputBlur}),i("div",{class:`${n}-radio__dot-wrapper`},"\xA0",i("div",{class:[`${n}-radio__dot`,this.renderSafeChecked&&`${n}-radio__dot--checked`]})),$t(e.default,l=>!l&&!c?null:i("div",{ref:"labelRef",class:`${n}-radio__label`},l||c)))}}),bn=K("radio-group",` - display: inline-block; - font-size: var(--n-font-size); -`,[G("splitor",` - display: inline-block; - vertical-align: bottom; - width: 1px; - transition: - background-color .3s var(--n-bezier), - opacity .3s var(--n-bezier); - background: var(--n-button-border-color); - `,[Y("checked",{backgroundColor:"var(--n-button-border-color-active)"}),Y("disabled",{opacity:"var(--n-opacity-disabled)"})]),Y("button-group",` - white-space: nowrap; - height: var(--n-height); - line-height: var(--n-height); - `,[K("radio-button",{height:"var(--n-height)",lineHeight:"var(--n-height)"}),G("splitor",{height:"var(--n-height)"})]),K("radio-button",` - vertical-align: bottom; - outline: none; - position: relative; - user-select: none; - display: inline-block; - box-sizing: border-box; - padding-left: 14px; - padding-right: 14px; - white-space: nowrap; - transition: - background-color .3s var(--n-bezier), - opacity .3s var(--n-bezier), - border-color .3s var(--n-bezier), - color .3s var(--n-bezier); - color: var(--n-button-text-color); - border-top: 1px solid var(--n-button-border-color); - border-bottom: 1px solid var(--n-button-border-color); - `,[K("radio-input",` - position: absolute; - border: 0; - border-radius: inherit; - left: 0; - right: 0; - top: 0; - bottom: 0; - opacity: 0; - z-index: 1; - `),G("state-border",` - z-index: 1; - pointer-events: none; - position: absolute; - box-shadow: var(--n-button-box-shadow); - transition: box-shadow .3s var(--n-bezier); - left: -1px; - bottom: -1px; - right: -1px; - top: -1px; - `),Q("&:first-child",` - border-top-left-radius: var(--n-button-border-radius); - border-bottom-left-radius: var(--n-button-border-radius); - border-left: 1px solid var(--n-button-border-color); - `,[G("state-border",` - border-top-left-radius: var(--n-button-border-radius); - border-bottom-left-radius: var(--n-button-border-radius); - `)]),Q("&:last-child",` - border-top-right-radius: var(--n-button-border-radius); - border-bottom-right-radius: var(--n-button-border-radius); - border-right: 1px solid var(--n-button-border-color); - `,[G("state-border",` - border-top-right-radius: var(--n-button-border-radius); - border-bottom-right-radius: var(--n-button-border-radius); - `)]),Le("disabled",` - cursor: pointer; - `,[Q("&:hover",[G("state-border",` - transition: box-shadow .3s var(--n-bezier); - box-shadow: var(--n-button-box-shadow-hover); - `),Le("checked",{color:"var(--n-button-text-color-hover)"})]),Y("focus",[Q("&:not(:active)",[G("state-border",{boxShadow:"var(--n-button-box-shadow-focus)"})])])]),Y("checked",` - background: var(--n-button-color-active); - color: var(--n-button-text-color-active); - border-color: var(--n-button-border-color-active); - `),Y("disabled",` - cursor: not-allowed; - opacity: var(--n-opacity-disabled); - `)])]);function _n(e,n,t){var c;const l=[];let v=!1;for(let r=0;r{const{value:N}=t,{common:{cubicBezierEaseInOut:z},self:{buttonBorderColor:a,buttonBorderColorActive:d,buttonBorderRadius:V,buttonBoxShadow:C,buttonBoxShadowFocus:H,buttonBoxShadowHover:de,buttonColorActive:ce,buttonTextColor:ae,buttonTextColorActive:pe,buttonTextColorHover:ee,opacityDisabled:ge,[Re("buttonHeight",N)]:be,[Re("fontSize",N)]:ve}}=T.value;return{"--n-font-size":ve,"--n-bezier":z,"--n-button-border-color":a,"--n-button-border-color-active":d,"--n-button-border-radius":V,"--n-button-box-shadow":C,"--n-button-box-shadow-focus":H,"--n-button-box-shadow-hover":de,"--n-button-color-active":ce,"--n-button-text-color":ae,"--n-button-text-color-hover":ee,"--n-button-text-color-active":pe,"--n-height":be,"--n-opacity-disabled":ge}}),U=D?We("radio-group",Z(()=>t.value[0]),I,e):void 0;return{selfElRef:n,rtlEnabled:u,mergedClsPrefix:p,mergedValue:S,handleFocusout:A,handleFocusin:w,cssVars:D?void 0:I,themeClass:U==null?void 0:U.themeClass,onRender:U==null?void 0:U.onRender}},render(){var e;const{mergedValue:n,mergedClsPrefix:t,handleFocusin:c,handleFocusout:l}=this,{children:v,isButtonGroup:r}=_n(Dt(zt(this)),n,t);return(e=this.onRender)===null||e===void 0||e.call(this),i("div",{onFocusin:c,onFocusout:l,ref:"selfElRef",class:[`${t}-radio-group`,this.rtlEnabled&&`${t}-radio-group--rtl`,this.themeClass,r&&`${t}-radio-group--button-group`],style:this.cssVars},v)}});const Cn=()=>At,xn=dt({name:"DynamicInput",common:He,peers:{Input:ct,Button:pt},self:Cn});var kn=xn;const Je=st("n-dynamic-input");var Rn=W({name:"DynamicInputInputPreset",props:{clsPrefix:{type:String,required:!0},value:{type:String,default:""},parentPath:String,path:String,onUpdateValue:{type:Function,required:!0}},setup(){const{mergedThemeRef:e,placeholderRef:n}=Ve(Je);return{mergedTheme:e,placeholder:n}},render(){const{mergedTheme:e,placeholder:n,value:t,clsPrefix:c,onUpdateValue:l}=this;return i("div",{class:`${c}-dynamic-input-preset-input`},i(Se,{theme:e.peers.Input,"theme-overrides":e.peerOverrides.Input,value:t,placeholder:n,onUpdateValue:l}))}}),Sn=W({name:"DynamicInputPairPreset",props:{clsPrefix:{type:String,required:!0},value:{type:Object,default:()=>({key:"",value:""})},parentPath:String,path:String,onUpdateValue:{type:Function,required:!0}},setup(e){const{mergedThemeRef:n,keyPlaceholderRef:t,valuePlaceholderRef:c}=Ve(Je);return{mergedTheme:n,keyPlaceholder:t,valuePlaceholder:c,handleKeyInput(l){e.onUpdateValue({key:l,value:e.value.value})},handleValueInput(l){e.onUpdateValue({key:e.value.key,value:l})}}},render(){const{mergedTheme:e,keyPlaceholder:n,valuePlaceholder:t,value:c,clsPrefix:l}=this;return i("div",{class:`${l}-dynamic-input-preset-pair`},i(Se,{theme:e.peers.Input,"theme-overrides":e.peerOverrides.Input,value:c.key,class:`${l}-dynamic-input-pair-input`,placeholder:n,onUpdateValue:this.handleKeyInput}),i(Se,{theme:e.peers.Input,"theme-overrides":e.peerOverrides.Input,value:c.value,class:`${l}-dynamic-input-pair-input`,placeholder:t,onUpdateValue:this.handleValueInput}))}}),Vn=K("dynamic-input",{width:"100%"},[K("dynamic-input-item",` - margin-bottom: 10px; - display: flex; - flex-wrap: nowrap; - `,[K("dynamic-input-preset-input",{flex:1,alignItems:"center"}),K("dynamic-input-preset-pair",` - flex: 1; - display: flex; - align-items: center; - `,[K("dynamic-input-pair-input",[Q("&:first-child",{"margin-right":"12px"})])]),G("action",` - align-self: flex-start; - display: flex; - justify-content: flex-end; - flex-shrink: 0; - flex-grow: 0; - margin: var(--action-margin); - `,[Y("icon",{cursor:"pointer"})]),Q("&:last-child",{marginBottom:0})]),K("form-item",` - padding-top: 0 !important; - margin-right: 0 !important; - `,[K("form-item-blank",{paddingTop:"0 !important"})])]);const ke=new WeakMap,Fn=Object.assign(Object.assign({},ue.props),{max:Number,min:{type:Number,default:0},value:Array,defaultValue:{type:Array,default:()=>[]},preset:{type:String,default:"input"},keyField:String,itemStyle:[String,Object],keyPlaceholder:{type:String,default:""},valuePlaceholder:{type:String,default:""},placeholder:{type:String,default:""},showSortButton:Boolean,createButtonProps:Object,onCreate:Function,onRemove:Function,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],onClear:Function,onInput:[Function,Array]});var Bn=W({name:"DynamicInput",props:Fn,setup(e,{slots:n}){const{mergedComponentPropsRef:t,mergedClsPrefixRef:c,inlineThemeDisabled:l}=Ce(),v=Ve(Et,null),r=R(e.defaultValue),k=se(e,"value"),p=Fe(k,r),D=ue("DynamicInput","-dynamic-input",Vn,kn,e,c),f=Z(()=>{const{value:a}=p;if(Array.isArray(a)){const{max:d}=e;return d!==void 0&&a.length>=d}return!1}),T=Z(()=>{const{value:a}=p;return Array.isArray(a)?a.length<=e.min:!0}),b=Z(()=>{var a,d;return(d=(a=t==null?void 0:t.value)===null||a===void 0?void 0:a.DynamicInput)===null||d===void 0?void 0:d.buttonSize});function s(a){const{onInput:d,"onUpdate:value":V,onUpdateValue:C}=e;d&&J(d,a),V&&J(V,a),C&&J(C,a),r.value=a}function S(a,d){if(a==null||typeof a!="object")return d;const V=Ne(a)?Oe(a):a;let C=ke.get(V);return C===void 0&&ke.set(V,C=Nt()),C}function _(a,d){const{value:V}=p,C=Array.from(V!=null?V:[]),H=C[a];if(C[a]=d,H&&d&&typeof H=="object"&&typeof d=="object"){const de=Ne(H)?Oe(H):H,ce=Ne(d)?Oe(d):d,ae=ke.get(de);ae!==void 0&&ke.set(ce,ae)}s(C)}function w(){A(0)}function A(a){const{value:d}=p,{onCreate:V}=e,C=Array.from(d!=null?d:[]);if(V)C.splice(a+1,0,V(a+1)),s(C);else if(n.default)C.splice(a+1,0,null),s(C);else switch(e.preset){case"input":C.splice(a+1,0,""),s(C);break;case"pair":C.splice(a+1,0,{key:"",value:""}),s(C);break}}function u(a){const{value:d}=p;if(!Array.isArray(d))return;const{min:V}=e;if(d.length<=V)return;const C=Array.from(d);C.splice(a,1),s(C);const{onRemove:H}=e;H&&H(a)}function I(a,d,V){if(d<0||V<0||d>=a.length||V>=a.length||d===V)return;const C=a[d];a[d]=a[V],a[V]=C}function U(a,d){const{value:V}=p;if(!Array.isArray(V))return;const C=Array.from(V);a==="up"&&I(C,d,d-1),a==="down"&&I(C,d,d+1),s(C)}ut(Je,{mergedThemeRef:D,keyPlaceholderRef:se(e,"keyPlaceholder"),valuePlaceholderRef:se(e,"valuePlaceholder"),placeholderRef:se(e,"placeholder")});const N=Z(()=>{const{self:{actionMargin:a}}=D.value;return{"--action-margin":a}}),z=l?We("dynamic-input",void 0,N,e):void 0;return{locale:ft("DynamicInput").localeRef,buttonSize:b,mergedClsPrefix:c,NFormItem:v,uncontrolledValue:r,mergedValue:p,insertionDisabled:f,removeDisabled:T,handleCreateClick:w,ensureKey:S,handleValueChange:_,remove:u,move:U,createItem:A,mergedTheme:D,cssVars:l?void 0:N,themeClass:z==null?void 0:z.themeClass,onRender:z==null?void 0:z.onRender}},render(){const{$slots:e,buttonSize:n,mergedClsPrefix:t,mergedValue:c,locale:l,mergedTheme:v,keyField:r,itemStyle:k,preset:p,showSortButton:D,NFormItem:f,ensureKey:T,handleValueChange:b,remove:s,createItem:S,move:_,onRender:w}=this;return w==null||w(),i("div",{class:[`${t}-dynamic-input`,this.themeClass],style:this.cssVars},!Array.isArray(c)||c.length===0?i(he,Object.assign({block:!0,ghost:!0,dashed:!0,size:n},this.createButtonProps,{disabled:this.insertionDisabled,theme:v.peers.Button,themeOverrides:v.peerOverrides.Button,onClick:this.handleCreateClick}),{default:()=>tt(e["create-button-default"],()=>[l.create]),icon:()=>tt(e["create-button-icon"],()=>[i(me,{clsPrefix:t},{default:()=>i(je,null)})])}):c.map((A,u)=>i("div",{key:r?A[r]:T(A,u),"data-key":r?A[r]:T(A,u),class:`${t}-dynamic-input-item`,style:k},Pt(e.default,{value:c[u],index:u},()=>[p==="input"?i(Rn,{clsPrefix:t,value:c[u],parentPath:f?f.path.value:void 0,path:f!=null&&f.path.value?`${f.path.value}[${u}]`:void 0,onUpdateValue:I=>b(u,I)}):p==="pair"?i(Sn,{clsPrefix:t,value:c[u],parentPath:f?f.path.value:void 0,path:f!=null&&f.path.value?`${f.path.value}[${u}]`:void 0,onUpdateValue:I=>b(u,I)}):null]),i("div",{class:`${t}-dynamic-input-item__action`},i(Tt,{size:n},{default:()=>[i(he,{disabled:this.removeDisabled,theme:v.peers.Button,themeOverrides:v.peerOverrides.Button,circle:!0,onClick:()=>s(u)},{icon:()=>i(me,{clsPrefix:t},{default:()=>i(_t,null)})}),i(he,{disabled:this.insertionDisabled,circle:!0,theme:v.peers.Button,themeOverrides:v.peerOverrides.Button,onClick:()=>S(u)},{icon:()=>i(me,{clsPrefix:t},{default:()=>i(je,null)})}),D?i(he,{disabled:u===0,circle:!0,theme:v.peers.Button,themeOverrides:v.peerOverrides.Button,onClick:()=>_("up",u)},{icon:()=>i(me,{clsPrefix:t},{default:()=>i(pn,null)})}):null,D?i(he,{disabled:u===c.length-1,circle:!0,theme:v.peers.Button,themeOverrides:v.peerOverrides.Button,onClick:()=>_("down",u)},{icon:()=>i(me,{clsPrefix:t},{default:()=>i(cn,null)})}):null]})))))}});const In=e=>{const{textColorDisabled:n}=e;return{iconColorDisabled:n}},$n=dt({name:"InputNumber",common:He,peers:{Button:pt,Input:ct},self:In});var Dn=$n;function zn(e){return e==null||typeof e=="string"&&e.trim()===""?null:Number(e)}function An(e){return e.includes(".")&&(/^(-)?\d+.*(\.|0)$/.test(e)||/^\.\d+$/.test(e))}function Ue(e){return e==null?!0:!Number.isNaN(e)}function En(e){return e==null?"":String(e)}function Me(e){if(e===null)return null;if(typeof e=="number")return e;{const n=Number(e);return Number.isNaN(n)?null:n}}var Pn=Q([K("input-number-suffix",` - display: inline-block; - margin-right: 10px; - `)]);const lt=800,it=100,Tn=Object.assign(Object.assign({},ue.props),{autofocus:Boolean,loading:{type:Boolean,default:void 0},placeholder:String,defaultValue:{type:Number,default:null},value:Number,step:{type:[Number,String],default:1},min:[Number,String],max:[Number,String],size:String,disabled:{type:Boolean,default:void 0},validator:Function,bordered:{type:Boolean,default:void 0},showButton:{type:Boolean,default:!0},readonly:Boolean,clearable:Boolean,keyboard:{type:Object,default:{}},updateValueOnInput:{type:Boolean,default:!0},status:String,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],onFocus:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onChange:[Function,Array]});var Nn=W({name:"InputNumber",props:Tn,setup(e){const{mergedBorderedRef:n,mergedClsPrefixRef:t,mergedRtlRef:c}=Ce(e),l=ue("InputNumber","-input-number",Pn,Dn,e,t),{localeRef:v}=ft("InputNumber"),r=Ke(e),{mergedSizeRef:k,mergedDisabledRef:p,mergedStatusRef:D}=r,f=R(null),T=R(null),b=R(null),s=R(e.defaultValue),S=se(e,"value"),_=Fe(S,s),w=R(""),A=o=>{const m=[e.min,e.max,e.step,o].map(B=>{const O=String(B).split(".")[1];return O?O.length:0});return Math.max(...m)},u=te(()=>{const{placeholder:o}=e;return o!==void 0?o:v.value.placeholder}),I=te(()=>{const o=Me(e.step);return o!==null?o===0?1:Math.abs(o):1}),U=te(()=>{const o=Me(e.min);return o!==null?o:null}),N=te(()=>{const o=Me(e.max);return o!==null?o:null}),z=o=>{const{value:m}=_;if(o===m){d();return}const{"onUpdate:value":B,onUpdateValue:O,onChange:$}=e,{nTriggerFormInput:_e,nTriggerFormChange:X}=r;$&&J($,o),O&&J(O,o),B&&J(B,o),s.value=o,_e(),X()},a=(o=0,m=!0,B=!1)=>{const{value:O}=w;if(B&&An(O))return!1;const $=zn(O);if($===null)return m&&z(null),null;if(Ue($)){const _e=A($);let X=parseFloat(($+o).toFixed(_e));if(Ue(X)){const{value:Pe}=N,{value:Te}=U;if(Pe!==null&&X>Pe){if(!m||B)return!1;X=Pe}if(Te!==null&&X{const{value:o}=_;Ue(o)?w.value=En(o):w.value=String(o)};d();const V=te(()=>a(0,!1)===!1),C=te(()=>{const{value:o}=_;if(e.validator&&o===null)return!1;const{value:m}=I;return a(-m,!1)!==!1}),H=te(()=>{const{value:o}=_;if(e.validator&&o===null)return!1;const{value:m}=I;return a(+m,!1)!==!1});function de(o){const{onFocus:m}=e,{nTriggerFormFocus:B}=r;m&&J(m,o),B()}function ce(o){var m,B;if(o.target===((m=f.value)===null||m===void 0?void 0:m.wrapperElRef))return;const O=a();if(O!==!1){const X=(B=f.value)===null||B===void 0?void 0:B.inputElRef;X&&(X.value=String(O||"")),_.value===O&&d()}else d();const{onBlur:$}=e,{nTriggerFormBlur:_e}=r;$&&J($,o),_e()}function ae(o){const{onClear:m}=e;m&&J(m,o)}function pe(){const{value:o}=H;if(!o){F();return}const{value:m}=_;if(m===null)e.validator||z(ve());else{const{value:B}=I;a(B)}}function ee(){const{value:o}=C;if(!o){g();return}const{value:m}=_;if(m===null)e.validator||z(ve());else{const{value:B}=I;a(-B)}}const ge=de,be=ce;function ve(){if(e.validator)return null;const{value:o}=U,{value:m}=N;return o!==null?Math.max(0,o):m!==null?Math.min(0,m):0}function Be(o){ae(o),z(null)}function Ie(o){var m,B,O;!((m=b.value)===null||m===void 0)&&m.$el.contains(o.target)&&o.preventDefault(),!((B=T.value)===null||B===void 0)&&B.$el.contains(o.target)&&o.preventDefault(),(O=f.value)===null||O===void 0||O.activate()}let fe=null,re=null,h=null;function g(){h&&(window.clearTimeout(h),h=null),fe&&(window.clearInterval(fe),fe=null)}function F(){E&&(window.clearTimeout(E),E=null),re&&(window.clearInterval(re),re=null)}function x(){h=window.setTimeout(()=>{fe=window.setInterval(()=>{ee()},it)},lt),ot("mouseup",document,()=>{window.setTimeout(g,0)})}let E=null;function L(){E=window.setTimeout(()=>{re=window.setInterval(()=>{pe()},it)},lt),ot("mouseup",document,()=>{window.setTimeout(F,0)})}const le=()=>{re||pe()},$e=()=>{fe||ee()};function De(o){var m,B;if(o.code==="Enter"||o.code==="NumpadEnter"){if(o.target===((m=f.value)===null||m===void 0?void 0:m.wrapperElRef))return;a()!==!1&&((B=f.value)===null||B===void 0||B.deactivate())}else if(o.code==="ArrowUp"){if(e.keyboard.ArrowUp===!1)return;o.preventDefault(),a()!==!1&&pe()}else if(o.code==="ArrowDown"){if(e.keyboard.ArrowDown===!1)return;o.preventDefault(),a()!==!1&&ee()}}function ze(o){w.value=o,e.updateValueOnInput&&a(0,!0,!0)}mt(_,()=>{d()});const Ae={focus:()=>{var o;return(o=f.value)===null||o===void 0?void 0:o.focus()},blur:()=>{var o;return(o=f.value)===null||o===void 0?void 0:o.blur()}},Ee=Ge("InputNumber",c,t);return Object.assign(Object.assign({},Ae),{rtlEnabled:Ee,inputInstRef:f,minusButtonInstRef:T,addButtonInstRef:b,mergedClsPrefix:t,mergedBordered:n,uncontrolledValue:s,mergedValue:_,mergedPlaceholder:u,displayedValueInvalid:V,mergedSize:k,mergedDisabled:p,displayedValue:w,addable:H,minusable:C,mergedStatus:D,handleFocus:ge,handleBlur:be,handleClear:Be,handleMouseDown:Ie,handleAddClick:le,handleMinusClick:$e,handleAddMousedown:L,handleMinusMousedown:x,handleKeyDown:De,handleUpdateDisplayedValue:ze,mergedTheme:l,inputThemeOverrides:{paddingSmall:"0 8px 0 10px",paddingMedium:"0 8px 0 12px",paddingLarge:"0 8px 0 14px"},buttonThemeOverrides:Z(()=>{const{self:{iconColorDisabled:o}}=l.value,[m,B,O,$]=Ot(o);return{textColorTextDisabled:`rgb(${m}, ${B}, ${O})`,opacityDisabled:`${$}`}})})},render(){const{mergedClsPrefix:e}=this;return i("div",{class:[`${e}-input-number`,this.rtlEnabled&&`${e}-input-number--rtl`]},i(Se,{ref:"inputInstRef",autofocus:this.autofocus,status:this.mergedStatus,bordered:this.mergedBordered,loading:this.loading,value:this.displayedValue,onUpdateValue:this.handleUpdateDisplayedValue,theme:this.mergedTheme.peers.Input,themeOverrides:this.mergedTheme.peerOverrides.Input,builtinThemeOverrides:this.inputThemeOverrides,size:this.mergedSize,placeholder:this.mergedPlaceholder,disabled:this.mergedDisabled,readonly:this.readonly,textDecoration:this.displayedValueInvalid?"line-through":void 0,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeydown:this.handleKeyDown,onMousedown:this.handleMouseDown,onClear:this.handleClear,clearable:this.clearable,internalLoadingBeforeSuffix:!0},{prefix:()=>{var n,t;return(t=(n=this.$slots).prefix)===null||t===void 0?void 0:t.call(n)},suffix:()=>{var n,t;return this.showButton?[this.$slots.suffix&&i("span",{class:`${e}-input-number-suffix`},{default:this.$slots.suffix}),i(nt,{text:!0,disabled:!this.minusable||this.mergedDisabled||this.readonly,focusable:!1,builtinThemeOverrides:this.buttonThemeOverrides,onClick:this.handleMinusClick,onMousedown:this.handleMinusMousedown,ref:"minusButtonInstRef"},{default:()=>i(me,{clsPrefix:e,"aria-disabled":!0},{default:()=>i(_t,null)})}),i(nt,{text:!0,disabled:!this.addable||this.mergedDisabled||this.readonly,focusable:!1,builtinThemeOverrides:this.buttonThemeOverrides,onClick:this.handleAddClick,onMousedown:this.handleAddMousedown,ref:"addButtonInstRef"},{default:()=>i(me,{clsPrefix:e},{default:()=>i(je,null)})})]:(t=(n=this.$slots).suffix)===null||t===void 0?void 0:t.call(n)}}))}});const On={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Un=q("path",{d:"M216.08 192v143.85a40.08 40.08 0 0 0 80.15 0l.13-188.55a67.94 67.94 0 1 0-135.87 0v189.82a95.51 95.51 0 1 0 191 0V159.74",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),Mn=[Un];var Ln=W({name:"AttachOutline",render:function(n,t){return M(),j("svg",On,Mn)}});const jn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},qn=q("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),Hn=q("path",{d:"M350.67 150.93l-117.2 46.88a64 64 0 0 0-35.66 35.66l-46.88 117.2a8 8 0 0 0 10.4 10.4l117.2-46.88a64 64 0 0 0 35.66-35.66l46.88-117.2a8 8 0 0 0-10.4-10.4zM256 280a24 24 0 1 1 24-24a24 24 0 0 1-24 24z",fill:"currentColor"},null,-1),Kn=[qn,Hn];var Gn=W({name:"CompassOutline",render:function(n,t){return M(),j("svg",jn,Kn)}});const Wn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Jn=q("path",{d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Xn=q("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),Qn=[Jn,Xn];var Yn=W({name:"EyeOutline",render:function(n,t){return M(),j("svg",Wn,Qn)}});const Zn={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},eo=q("path",{d:"M374.79 308.78L457.5 367a16 16 0 0 0 22.5-14.62V159.62A16 16 0 0 0 457.5 145l-82.71 58.22A16 16 0 0 0 368 216.3v79.4a16 16 0 0 0 6.79 13.08z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),to=q("path",{d:"M268 384H84a52.15 52.15 0 0 1-52-52V180a52.15 52.15 0 0 1 52-52h184.48A51.68 51.68 0 0 1 320 179.52V332a52.15 52.15 0 0 1-52 52z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),no=[eo,to];var oo=W({name:"VideocamOutline",render:function(n,t){return M(),j("svg",Zn,no)}});const ao={key:0,class:"compose-wrap"},ro={class:"compose-line"},lo={class:"compose-user"},io={class:"compose-line compose-options"},so={class:"attachment"},uo={class:"submit-wrap"},co=xe(" \u53D1\u5E03 "),po={class:"attachment-list-wrap"},fo={key:0,class:"attachment-price-wrap"},mo=q("span",null," \u9644\u4EF6\u4EF7\u683C\uFFE5",-1),vo={key:0,class:"eye-wrap"},ho={key:1,class:"link-wrap"},go=xe(" \u521B\u5EFA\u94FE\u63A5 "),bo={key:1,class:"compose-wrap"},_o=q("div",{class:"login-wrap"},[q("span",{class:"login-banner"}," \u767B\u5F55\u540E\uFF0C\u7CBE\u5F69\u66F4\u591A")],-1),yo={class:"login-wrap"},wo=xe(" \u767B\u5F55 "),Co=xe(" \u6CE8\u518C "),xo=W({emits:["post-success"],setup(e,{emit:n}){const t=vt(),c=R([]),l=R(!1),v=R(!1),r=R(!1),k=R(!1),p=R(""),D=R([]),f=R(),T=R(0),b=R("public/image"),s=R([]),S=R([]),_=R([]),w=R([]),A=R(ie.FRIEND),u=R(ie.FRIEND),I=[{value:ie.PUBLIC,label:"\u516C\u5F00"},{value:ie.PRIVATE,label:"\u79C1\u5BC6"},{value:ie.FRIEND,label:"\u597D\u53CB\u53EF\u89C1"}],U="false".toLocaleLowerCase()==="true",N="false".toLocaleLowerCase()==="true",z="true".toLocaleLowerCase()==="true",a="true".toLocaleLowerCase()==="true",d="/v1/attachment",V=R(),C=()=>{r.value=!r.value,r.value&&k.value&&(k.value=!1)},H=()=>{k.value=!k.value,k.value&&r.value&&(r.value=!1)},de=rt.exports.debounce(h=>{Ut({k:h}).then(g=>{let F=[];g.map(x=>{F.push({label:x,value:x})}),c.value=F,l.value=!1}).catch(g=>{l.value=!1})},200),ce=rt.exports.debounce(h=>{Mt({k:h}).then(g=>{let F=[];g.map(x=>{F.push({label:x,value:x})}),c.value=F,l.value=!1}).catch(g=>{l.value=!1})},200),ae=(h,g)=>{l.value||(l.value=!0,g==="@"?de(h):ce(h))},pe=h=>{h.length>200||(p.value=h)},ee=h=>{b.value=h},ge=h=>{s.value=h},be=async h=>{var g,F,x,E,L,le;return b.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((g=h.file.file)==null?void 0:g.type)?(window.$message.warning("\u56FE\u7247\u4EC5\u5141\u8BB8 png/jpg/gif \u683C\u5F0F"),!1):b.value==="image"&&((F=h.file.file)==null?void 0:F.size)>10485760?(window.$message.warning("\u56FE\u7247\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC710MB"),!1):b.value==="public/video"&&!["video/mp4","video/quicktime"].includes((x=h.file.file)==null?void 0:x.type)?(window.$message.warning("\u89C6\u9891\u4EC5\u5141\u8BB8 mp4/mov \u683C\u5F0F"),!1):b.value==="public/video"&&((E=h.file.file)==null?void 0:E.size)>104857600?(window.$message.warning("\u89C6\u9891\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7100MB"),!1):b.value==="attachment"&&!["application/zip"].includes((L=h.file.file)==null?void 0:L.type)?(window.$message.warning("\u9644\u4EF6\u4EC5\u5141\u8BB8 zip \u683C\u5F0F"),!1):b.value==="attachment"&&((le=h.file.file)==null?void 0:le.size)>104857600?(window.$message.warning("\u9644\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7100MB"),!1):!0},ve=({file:h,event:g})=>{var F;try{let x=JSON.parse((F=g.target)==null?void 0:F.response);x.code===0&&(b.value==="public/image"&&S.value.push({id:h.id,content:x.data.content}),b.value==="public/video"&&_.value.push({id:h.id,content:x.data.content}),b.value==="attachment"&&w.value.push({id:h.id,content:x.data.content}))}catch{window.$message.error("\u4E0A\u4F20\u5931\u8D25")}},Be=({file:h,event:g})=>{var F;try{let x=JSON.parse((F=g.target)==null?void 0:F.response);if(x.code!==0){let E=x.msg||"\u4E0A\u4F20\u5931\u8D25";x.details&&x.details.length>0&&x.details.map(L=>{E+=":"+L}),window.$message.error(E)}}catch{window.$message.error("\u4E0A\u4F20\u5931\u8D25")}},Ie=({file:h})=>{let g=S.value.findIndex(F=>F.id===h.id);g>-1&&S.value.splice(g,1),g=_.value.findIndex(F=>F.id===h.id),g>-1&&_.value.splice(g,1),g=w.value.findIndex(F=>F.id===h.id),g>-1&&w.value.splice(g,1)},fe=()=>{if(p.value.trim().length===0){window.$message.warning("\u8BF7\u8F93\u5165\u5185\u5BB9\u54E6");return}let{tags:h,users:g}=en(p.value);const F=[];let x=100;F.push({content:p.value,type:ye.TEXT,sort:x}),S.value.map(E=>{x++,F.push({content:E.content,type:ye.IMAGEURL,sort:x})}),_.value.map(E=>{x++,F.push({content:E.content,type:ye.VIDEOURL,sort:x})}),w.value.map(E=>{x++,F.push({content:E.content,type:ye.ATTACHMENT,sort:x})}),D.value.length>0&&D.value.map(E=>{x++,F.push({content:E,type:ye.LINKURL,sort:x})}),v.value=!0,jt({contents:F,tags:Array.from(new Set(h)),users:Array.from(new Set(g)),attachment_price:+T.value*100,visibility:A.value}).then(E=>{var L;window.$message.success("\u53D1\u5E03\u6210\u529F"),v.value=!1,n("post-success",E),r.value=!1,k.value=!1,(L=f.value)==null||L.clear(),s.value=[],p.value="",D.value=[],S.value=[],_.value=[],w.value=[],A.value=u.value}).catch(E=>{v.value=!1})},re=h=>{t.commit("triggerAuth",!0),t.commit("triggerAuthKey",h)};return ht(()=>{"friend".toLowerCase()==="friend"?u.value=ie.FRIEND:"friend".toLowerCase()==="public"?u.value=ie.PUBLIC:u.value=ie.PRIVATE,A.value=u.value,V.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(h,g)=>{const F=qt,x=Zt,E=Ht,L=he,le=tn,$e=nn,De=Kt,ze=on,Ae=Nn,Ee=an,o=gn,m=Gt,B=wn,O=Bn;return M(),j("div",null,[ne(t).state.userInfo.id>0?(M(),j("div",ao,[q("div",ro,[q("div",lo,[y(F,{round:"",size:30,src:ne(t).state.userInfo.avatar},null,8,["src"])]),y(x,{type:"textarea",size:"large",autosize:"",bordered:!1,loading:l.value,value:p.value,prefix:["@","#"],options:c.value,onSearch:ae,"onUpdate:value":pe,placeholder:"\u8BF4\u8BF4\u60A8\u7684\u65B0\u9C9C\u4E8B..."},null,8,["loading","value","options"])]),y(Ee,{ref_key:"uploadRef",ref:f,abstract:"","list-type":"image",multiple:!0,max:9,action:d,headers:{Authorization:V.value},data:{type:b.value},onBeforeUpload:be,onFinish:ve,onError:Be,onRemove:Ie,"onUpdate:fileList":ge},{default:P(()=>[q("div",io,[q("div",so,[y(le,{abstract:""},{default:P(({handleClick:$})=>[y(L,{disabled:s.value.length>0&&b.value==="public/video"||s.value.length===9,onClick:()=>{ee("public/image"),$()},quaternary:"",circle:"",type:"primary"},{icon:P(()=>[y(E,{size:"20",color:"var(--primary-color)"},{default:P(()=>[y(ne(Yt))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),U?(M(),we(le,{key:0,abstract:""},{default:P(({handleClick:$})=>[y(L,{disabled:s.value.length>0&&b.value!=="public/video"||s.value.length===9,onClick:()=>{ee("public/video"),$()},quaternary:"",circle:"",type:"primary"},{icon:P(()=>[y(E,{size:"20",color:"var(--primary-color)"},{default:P(()=>[y(ne(oo))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):oe("",!0),N?(M(),we(le,{key:1,abstract:""},{default:P(({handleClick:$})=>[y(L,{disabled:s.value.length>0&&b.value==="public/video"||s.value.length===9,onClick:()=>{ee("attachment"),$()},quaternary:"",circle:"",type:"primary"},{icon:P(()=>[y(E,{size:"20",color:"var(--primary-color)"},{default:P(()=>[y(ne(Ln))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1})):oe("",!0),y(L,{quaternary:"",circle:"",type:"primary",onClick:at(C,["stop"])},{icon:P(()=>[y(E,{size:"20",color:"var(--primary-color)"},{default:P(()=>[y(ne(Gn))]),_:1})]),_:1},8,["onClick"]),a?(M(),we(L,{key:2,quaternary:"",circle:"",type:"primary",onClick:at(H,["stop"])},{icon:P(()=>[y(E,{size:"20",color:"var(--primary-color)"},{default:P(()=>[y(ne(Yn))]),_:1})]),_:1},8,["onClick"])):oe("",!0)]),q("div",uo,[y(De,{trigger:"hover",placement:"bottom"},{trigger:P(()=>[y($e,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:p.value.length/200*100},null,8,["percentage"])]),default:P(()=>[xe(" "+Lt(p.value.length)+" / 200 ",1)]),_:1}),y(L,{loading:v.value,onClick:fe,type:"primary",secondary:"",round:""},{default:P(()=>[co]),_:1},8,["loading"])])]),q("div",po,[y(ze),w.value.length>0?(M(),j("div",fo,[z?(M(),we(Ae,{key:0,value:T.value,"onUpdate:value":g[0]||(g[0]=$=>T.value=$),min:0,max:1e5,placeholder:"\u8BF7\u8F93\u5165\u9644\u4EF6\u4EF7\u683C\uFF0C0\u4E3A\u514D\u8D39\u9644\u4EF6"},{prefix:P(()=>[mo]),_:1},8,["value"])):oe("",!0)])):oe("",!0)])]),_:1},8,["headers","data"]),k.value?(M(),j("div",vo,[y(B,{value:A.value,"onUpdate:value":g[1]||(g[1]=$=>A.value=$),name:"radiogroup"},{default:P(()=>[y(m,null,{default:P(()=>[(M(),j(gt,null,bt(I,$=>y(o,{key:$.value,value:$.value,label:$.label},null,8,["value","label"])),64))]),_:1})]),_:1},8,["value"])])):oe("",!0),r.value?(M(),j("div",ho,[y(O,{value:D.value,"onUpdate:value":g[2]||(g[2]=$=>D.value=$),placeholder:"\u8BF7\u8F93\u5165\u4EE5http(s)://\u5F00\u5934\u7684\u94FE\u63A5",min:0,max:3},{"create-button-default":P(()=>[go]),_:1},8,["value"])])):oe("",!0)])):(M(),j("div",bo,[_o,q("div",yo,[y(L,{strong:"",secondary:"",round:"",type:"primary",onClick:g[3]||(g[3]=$=>re("signin"))},{default:P(()=>[wo]),_:1}),y(L,{strong:"",secondary:"",round:"",type:"info",onClick:g[4]||(g[4]=$=>re("signup"))},{default:P(()=>[Co]),_:1})])]))])}}});const ko={key:0,class:"pagination-wrap"},Ro={key:0,class:"skeleton-wrap"},So={key:1},Vo={key:0,class:"empty-wrap"},Fo=W({setup(e){const n=vt(),t=Jt(),c=Xt(),l=R(!1),v=R([]),r=R(+t.query.p||1),k=R(20),p=R(0),D=Z(()=>{let s="\u6CE1\u6CE1\u5E7F\u573A";return t.query&&t.query.q&&(t.query.t&&t.query.t==="tag"?s="#"+decodeURIComponent(t.query.q):s="\u641C\u7D22: "+decodeURIComponent(t.query.q)),s}),f=()=>{l.value=!0,Qt({query:t.query.q?decodeURIComponent(t.query.q):null,type:t.query.t,page:r.value,page_size:k.value}).then(s=>{l.value=!1,v.value=s.list,p.value=Math.ceil(s.pager.total_rows/k.value),window.scrollTo(0,0)}).catch(s=>{l.value=!1})},T=s=>{if(r.value!=1){c.push({name:"post",query:{id:s.id}});return}let S=[],_=v.value.length;_==k.value&&_--;for(var w=0;w<_;w++){let A=v.value[w];if(!A.is_top)break;S.push(A)}for(S.push(s);w<_;w++)S.push(v.value[w]);v.value=S},b=s=>{c.push({name:"home",query:Ze(Ye({},t.query),{p:s})})};return ht(()=>{f()}),mt(()=>({path:t.path,query:t.query,refresh:n.state.refresh}),(s,S)=>{if(s.refresh!==S.refresh){r.value=+t.query.p||1,setTimeout(()=>{f()},0);return}S.path!=="/post"&&s.path==="/"&&(r.value=+t.query.p||1,setTimeout(()=>{f()},0))}),(s,S)=>{const _=rn,w=sn,A=xo,u=un,I=Ft,U=dn,N=Vt,z=ln;return M(),j("div",null,[y(_,{title:ne(D)},null,8,["title"]),y(z,{class:"main-content-wrap",bordered:""},{footer:P(()=>[p.value>1?(M(),j("div",ko,[y(w,{page:r.value,"onUpdate:page":b,"page-slot":ne(n).state.collapsedRight?5:8,"page-count":p.value},null,8,["page","page-slot","page-count"])])):oe("",!0)]),default:P(()=>[y(u,null,{default:P(()=>[y(A,{onPostSuccess:T})]),_:1}),l.value?(M(),j("div",Ro,[y(I,{num:k.value},null,8,["num"])])):(M(),j("div",So,[v.value.length===0?(M(),j("div",Vo,[y(U,{size:"large",description:"\u6682\u65E0\u6570\u636E"})])):oe("",!0),(M(!0),j(gt,null,bt(v.value,a=>(M(),we(u,{key:a.id},{default:P(()=>[y(N,{post:a},null,8,["post"])]),_:2},1024))),128))]))]),_:1})])}}});var Lo=Wt(Fo,[["__scopeId","data-v-7e0dfc66"]]);export{Lo as default}; diff --git a/web/dist/assets/IEnum.bfd96c78.js b/web/dist/assets/IEnum.bfd96c78.js deleted file mode 100644 index 6b750cee..00000000 --- a/web/dist/assets/IEnum.bfd96c78.js +++ /dev/null @@ -1,30 +0,0 @@ -import{D as gp,c as dp,b8 as pp,E as _p,n as vp,l as Io,aO as wp,d as Lo,u as xp,q as Eo,f as Ap,r as He,s as zi,aQ as Sp,t as mp,g as Rp,y as Ip,aT as Ki,aS as Tp,h as Le,aU as yp,aV as Cp,aW as Lp,aX as Ep,_ as Op,w as bp,aF as To,k as yo,V as Mp,W as Bp,Y as pr}from"./index.f480f018.js";import{N as Wp}from"./Skeleton.57e98fe3.js";const Fp=w=>{const{boxShadow2:nn}=w;return{menuBoxShadow:nn}},Up=gp({name:"Mention",common:dp,peers:{InternalSelectMenu:pp,Input:_p},self:Fp});var Pp=Up;function Dp(w,nn={debug:!1,useSelectionEnd:!1,checkWidthOverflow:!0}){const l=w.selectionStart!==null?w.selectionStart:0,te=w.selectionEnd!==null?w.selectionEnd:0,An=nn.useSelectionEnd?te:l,Ge=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],Z=navigator.userAgent.toLowerCase().includes("firefox");if(!(typeof window!="undefined"))throw new Error("textarea-caret-position#getCaretPosition should only be called in a browser");const Jn=nn==null?void 0:nn.debug;if(Jn){const fn=document.querySelector("#input-textarea-caret-position-mirror-div");fn!=null&&fn.parentNode&&fn.parentNode.removeChild(fn)}const gn=document.createElement("div");gn.id="input-textarea-caret-position-mirror-div",document.body.appendChild(gn);const V=gn.style,P=window.getComputedStyle?window.getComputedStyle(w):w.currentStyle,Sn=w.nodeName==="INPUT";V.whiteSpace=Sn?"nowrap":"pre-wrap",Sn||(V.wordWrap="break-word"),V.position="absolute",Jn||(V.visibility="hidden"),Ge.forEach(fn=>{if(Sn&&fn==="lineHeight")if(P.boxSizing==="border-box"){const Q=parseInt(P.height),sn=parseInt(P.paddingTop)+parseInt(P.paddingBottom)+parseInt(P.borderTopWidth)+parseInt(P.borderBottomWidth),de=sn+parseInt(P.lineHeight);Q>de?V.lineHeight=`${Q-sn}px`:Q===de?V.lineHeight=P.lineHeight:V.lineHeight="0"}else V.lineHeight=P.height;else V[fn]=P[fn]}),Z?w.scrollHeight>parseInt(P.height)&&(V.overflowY="scroll"):V.overflow="hidden",gn.textContent=w.value.substring(0,An),Sn&&gn.textContent&&(gn.textContent=gn.textContent.replace(/\s/g,"\xA0"));const X=document.createElement("span");X.textContent=w.value.substring(An)||".",X.style.position="relative",X.style.left=`${-w.scrollLeft}px`,X.style.top=`${-w.scrollTop}px`,gn.appendChild(X);const On={top:X.offsetTop+parseInt(P.borderTopWidth),left:X.offsetLeft+parseInt(P.borderLeftWidth),absolute:!1,height:parseInt(P.fontSize)*1.5};return Jn?X.style.backgroundColor="#aaa":document.body.removeChild(gn),On.left>=w.clientWidth&&nn.checkWidthOverflow&&(On.left=w.clientWidth),On}var Np=vp([Io("mention","width: 100%; z-index: auto; position: relative;"),Io("mention-menu",` - box-shadow: var(--n-menu-box-shadow); - `,[wp()])]);const Hp=Object.assign(Object.assign({},Eo.props),{to:Ki.propTo,autosize:[Boolean,Object],options:{type:Array,default:[]},type:{type:String,default:"text"},separator:{type:String,validator:w=>w.length!==1?(bp("mention","`separator`'s length must be 1."),!1):!0,default:" "},bordered:{type:Boolean,default:void 0},disabled:Boolean,value:String,defaultValue:{type:String,default:""},loading:Boolean,prefix:{type:[String,Array],default:"@"},placeholder:{type:String,default:""},placement:{type:String,default:"bottom-start"},size:String,renderLabel:Function,status:String,"onUpdate:value":[Array,Function],onUpdateValue:[Array,Function],onSearch:Function,onSelect:Function,onFocus:Function,onBlur:Function,internalDebug:Boolean});var Qp=Lo({name:"Mention",props:Hp,setup(w){const{namespaceRef:nn,mergedClsPrefixRef:l,mergedBorderedRef:te,inlineThemeDisabled:An}=xp(w),Ge=Eo("Mention","-mention",Np,Pp,w,l),Z=Ap(w),Xn=He(null),Jn=He(null),gn=He(null),V=He("");let P=null,Sn=null,X=null;const On=zi(()=>{const{value:S}=V;return w.options.filter(B=>S?typeof B.label=="string"?B.label.startsWith(S):B.value.startsWith(S):!0)}),fn=zi(()=>Sp(On.value,{getKey:S=>S.value})),Q=He(null),sn=He(!1),de=He(w.defaultValue),bn=mp(w,"value"),pe=Rp(bn,de),mn=zi(()=>{const{self:{menuBoxShadow:S}}=Ge.value;return{"--n-menu-box-shadow":S}}),Rn=An?Ip("mention",void 0,mn,w):void 0;function tn(S){w.disabled||(S||(P=null,Sn=null,X=null),sn.value=S)}function _e(S){const{onUpdateValue:B,"onUpdate:value":G}=w,{nTriggerFormChange:J,nTriggerFormInput:dn}=Z;G&&yo(G,S),B&&yo(B,S),dn(),J(),de.value=S}function Ee(){return w.type==="text"?Xn.value.inputElRef:Xn.value.textareaElRef}function It(){var S;const B=Ee();if(document.activeElement!==B){tn(!1);return}const{selectionEnd:G}=B;if(G===null){tn(!1);return}const J=B.value,{separator:dn}=w,{prefix:we}=w,Qn=typeof we=="string"?[we]:we;for(let pn=G-1;pn>=0;--pn){const Gn=J[pn];if(Gn===dn||Gn===` -`||Gn==="\r"){tn(!1);return}if(Qn.includes(Gn)){const kn=J.slice(pn+1,G);tn(!0),(S=w.onSearch)===null||S===void 0||S.call(w,kn,Gn),V.value=kn,P=Gn,Sn=pn+1,X=G;return}}tn(!1)}function _r(){const{value:S}=Jn;if(!S)return;const B=Ee(),G=Dp(B);G.left+=B.parentElement.offsetLeft,S.style.left=`${G.left}px`,S.style.top=`${G.top+G.height}px`}function vr(){var S;!sn.value||(S=gn.value)===null||S===void 0||S.syncPosition()}function wr(S){_e(S),ve()}function ve(){setTimeout(()=>{_r(),It(),To().then(vr)},0)}function xr(S){var B,G;if(S.code==="ArrowLeft"||S.code==="ArrowRight"){if(!((B=Xn.value)===null||B===void 0)&&B.isCompositing)return;ve()}else if(S.code==="ArrowUp"||S.code==="ArrowDown"||S.code==="Enter"||S.code==="NumpadEnter"){if(!((G=Xn.value)===null||G===void 0)&&G.isCompositing)return;const{value:J}=Q;if(sn.value){if(J)if(S.preventDefault(),S.code==="ArrowUp")J.prev();else if(S.code==="ArrowDown")J.next();else{const dn=J.getPendingTmNode();dn?Oe(dn):tn(!1)}}else ve()}}function Ar(S){const{onFocus:B}=w;B==null||B(S);const{nTriggerFormFocus:G}=Z;G(),ve()}function re(){var S;(S=Xn.value)===null||S===void 0||S.focus()}function Vn(){var S;(S=Xn.value)===null||S===void 0||S.blur()}function Sr(S){const{onBlur:B}=w;B==null||B(S);const{nTriggerFormBlur:G}=Z;G(),tn(!1)}function Oe(S){var B;if(P===null||Sn===null||X===null)return;const{rawNode:{value:G}}=S,J=Ee(),dn=J.value,{separator:we}=w,Qn=dn.slice(X),pn=Qn.startsWith(we),Gn=`${G}${pn?"":we}`;_e(dn.slice(0,Sn)+Gn+Qn),(B=w.onSelect)===null||B===void 0||B.call(w,S.rawNode,P);const kn=Sn+Gn.length+(pn?1:0);To().then(()=>{J.selectionStart=kn,J.selectionEnd=kn,It()})}function Mn(){w.disabled||ve()}return{namespace:nn,mergedClsPrefix:l,mergedBordered:te,mergedSize:Z.mergedSizeRef,mergedStatus:Z.mergedStatusRef,mergedTheme:Ge,treeMate:fn,selectMenuInstRef:Q,inputInstRef:Xn,cursorRef:Jn,followerRef:gn,showMenu:sn,adjustedTo:Ki(w),isMounted:Tp(),mergedValue:pe,handleInputFocus:Ar,handleInputBlur:Sr,handleInputUpdateValue:wr,handleInputKeyDown:xr,handleSelect:Oe,handleInputMouseDown:Mn,focus:re,blur:Vn,cssVars:An?void 0:mn,themeClass:Rn==null?void 0:Rn.themeClass,onRender:Rn==null?void 0:Rn.onRender}},render(){const{mergedTheme:w,mergedClsPrefix:nn,$slots:l}=this;return Le("div",{class:`${nn}-mention`},Le(Op,{status:this.mergedStatus,themeOverrides:w.peerOverrides.Input,theme:w.peers.Input,size:this.mergedSize,autosize:this.autosize,type:this.type,ref:"inputInstRef",placeholder:this.placeholder,onMousedown:this.handleInputMouseDown,onUpdateValue:this.handleInputUpdateValue,onKeydown:this.handleInputKeyDown,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,bordered:this.mergedBordered,disabled:this.disabled,value:this.mergedValue}),Le(yp,null,{default:()=>[Le(Cp,null,{default:()=>Le("div",{style:{position:"absolute",width:0,height:0},ref:"cursorRef"})}),Le(Lp,{ref:"followerRef",placement:this.placement,show:this.showMenu,containerClass:this.namespace,to:this.adjustedTo,teleportDisabled:this.adjustedTo===Ki.tdkey},{default:()=>Le(Ep,{name:"fade-in-scale-up-transition",appear:this.isMounted},{default:()=>{const{mergedTheme:te,onRender:An}=this;return An==null||An(),this.showMenu?Le(Wp,{clsPrefix:nn,theme:te.peers.InternalSelectMenu,themeOverrides:te.peerOverrides.InternalSelectMenu,autoPending:!0,ref:"selectMenuInstRef",class:[`${nn}-mention-menu`,this.themeClass],loading:this.loading,treeMate:this.treeMate,virtualScroll:!1,style:this.cssVars,onToggle:this.handleSelect,renderLabel:this.renderLabel},l):null}})})]}))}}),Rt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};const Gp={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},$p=pr("rect",{x:"48",y:"80",width:"416",height:"352",rx:"48",ry:"48",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),zp=pr("circle",{cx:"336",cy:"176",r:"32",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),Kp=pr("path",{d:"M304 335.79l-90.66-90.49a32 32 0 0 0-43.87-1.3L48 352",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),qp=pr("path",{d:"M224 432l123.34-123.34a32 32 0 0 1 43.11-2L464 368",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Yp=[$p,zp,Kp,qp];var kp=Lo({name:"ImageOutline",render:function(nn,l){return Mp(),Bp("svg",Gp,Yp)}}),Co={exports:{}};/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(w,nn){(function(){var l,te="4.17.21",An=200,Ge="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Z="Expected a function",Xn="Invalid `variable` option passed into `_.template`",Jn="__lodash_hash_undefined__",gn=500,V="__lodash_placeholder__",P=1,Sn=2,X=4,On=1,fn=2,Q=1,sn=2,de=4,bn=8,pe=16,mn=32,Rn=64,tn=128,_e=256,Ee=512,It=30,_r="...",vr=800,wr=16,ve=1,xr=2,Ar=3,re=1/0,Vn=9007199254740991,Sr=17976931348623157e292,Oe=0/0,Mn=4294967295,S=Mn-1,B=Mn>>>1,G=[["ary",tn],["bind",Q],["bindKey",sn],["curry",bn],["curryRight",pe],["flip",Ee],["partial",mn],["partialRight",Rn],["rearg",_e]],J="[object Arguments]",dn="[object Array]",we="[object AsyncFunction]",Qn="[object Boolean]",pn="[object Date]",Gn="[object DOMException]",kn="[object Error]",Tt="[object Function]",qi="[object GeneratorFunction]",$n="[object Map]",rt="[object Number]",Oo="[object Null]",ie="[object Object]",Yi="[object Promise]",bo="[object Proxy]",it="[object RegExp]",zn="[object Set]",ut="[object String]",yt="[object Symbol]",Mo="[object Undefined]",ft="[object WeakMap]",Bo="[object WeakSet]",ot="[object ArrayBuffer]",$e="[object DataView]",mr="[object Float32Array]",Rr="[object Float64Array]",Ir="[object Int8Array]",Tr="[object Int16Array]",yr="[object Int32Array]",Cr="[object Uint8Array]",Lr="[object Uint8ClampedArray]",Er="[object Uint16Array]",Or="[object Uint32Array]",Wo=/\b__p \+= '';/g,Fo=/\b(__p \+=) '' \+/g,Uo=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Zi=/&(?:amp|lt|gt|quot|#39);/g,Xi=/[&<>"']/g,Po=RegExp(Zi.source),Do=RegExp(Xi.source),No=/<%-([\s\S]+?)%>/g,Ho=/<%([\s\S]+?)%>/g,Ji=/<%=([\s\S]+?)%>/g,Go=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$o=/^\w*$/,zo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,br=/[\\^$.*+?()[\]{}|]/g,Ko=RegExp(br.source),Mr=/^\s+/,qo=/\s/,Yo=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Zo=/\{\n\/\* \[wrapped with (.+)\] \*/,Xo=/,? & /,Jo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Vo=/[()=,{}\[\]\/\s]/,Qo=/\\(\\)?/g,ko=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Vi=/\w*$/,jo=/^[-+]0x[0-9a-f]+$/i,nl=/^0b[01]+$/i,el=/^\[object .+?Constructor\]$/,tl=/^0o[0-7]+$/i,rl=/^(?:0|[1-9]\d*)$/,il=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ct=/($^)/,ul=/['\n\r\u2028\u2029\\]/g,Lt="\\ud800-\\udfff",fl="\\u0300-\\u036f",ol="\\ufe20-\\ufe2f",ll="\\u20d0-\\u20ff",Qi=fl+ol+ll,ki="\\u2700-\\u27bf",ji="a-z\\xdf-\\xf6\\xf8-\\xff",sl="\\xac\\xb1\\xd7\\xf7",al="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",cl="\\u2000-\\u206f",hl=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",nu="A-Z\\xc0-\\xd6\\xd8-\\xde",eu="\\ufe0e\\ufe0f",tu=sl+al+cl+hl,Br="['\u2019]",gl="["+Lt+"]",ru="["+tu+"]",Et="["+Qi+"]",iu="\\d+",dl="["+ki+"]",uu="["+ji+"]",fu="[^"+Lt+tu+iu+ki+ji+nu+"]",Wr="\\ud83c[\\udffb-\\udfff]",pl="(?:"+Et+"|"+Wr+")",ou="[^"+Lt+"]",Fr="(?:\\ud83c[\\udde6-\\uddff]){2}",Ur="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+nu+"]",lu="\\u200d",su="(?:"+uu+"|"+fu+")",_l="(?:"+ze+"|"+fu+")",au="(?:"+Br+"(?:d|ll|m|re|s|t|ve))?",cu="(?:"+Br+"(?:D|LL|M|RE|S|T|VE))?",hu=pl+"?",gu="["+eu+"]?",vl="(?:"+lu+"(?:"+[ou,Fr,Ur].join("|")+")"+gu+hu+")*",wl="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xl="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",du=gu+hu+vl,Al="(?:"+[dl,Fr,Ur].join("|")+")"+du,Sl="(?:"+[ou+Et+"?",Et,Fr,Ur,gl].join("|")+")",ml=RegExp(Br,"g"),Rl=RegExp(Et,"g"),Pr=RegExp(Wr+"(?="+Wr+")|"+Sl+du,"g"),Il=RegExp([ze+"?"+uu+"+"+au+"(?="+[ru,ze,"$"].join("|")+")",_l+"+"+cu+"(?="+[ru,ze+su,"$"].join("|")+")",ze+"?"+su+"+"+au,ze+"+"+cu,xl,wl,iu,Al].join("|"),"g"),Tl=RegExp("["+lu+Lt+Qi+eu+"]"),yl=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Cl=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ll=-1,H={};H[mr]=H[Rr]=H[Ir]=H[Tr]=H[yr]=H[Cr]=H[Lr]=H[Er]=H[Or]=!0,H[J]=H[dn]=H[ot]=H[Qn]=H[$e]=H[pn]=H[kn]=H[Tt]=H[$n]=H[rt]=H[ie]=H[it]=H[zn]=H[ut]=H[ft]=!1;var N={};N[J]=N[dn]=N[ot]=N[$e]=N[Qn]=N[pn]=N[mr]=N[Rr]=N[Ir]=N[Tr]=N[yr]=N[$n]=N[rt]=N[ie]=N[it]=N[zn]=N[ut]=N[yt]=N[Cr]=N[Lr]=N[Er]=N[Or]=!0,N[kn]=N[Tt]=N[ft]=!1;var El={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ol={"&":"&","<":"<",">":">",'"':""","'":"'"},bl={"&":"&","<":"<",">":">",""":'"',"'":"'"},Ml={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bl=parseFloat,Wl=parseInt,pu=typeof Rt=="object"&&Rt&&Rt.Object===Object&&Rt,Fl=typeof self=="object"&&self&&self.Object===Object&&self,rn=pu||Fl||Function("return this")(),Dr=nn&&!nn.nodeType&&nn,be=Dr&&!0&&w&&!w.nodeType&&w,_u=be&&be.exports===Dr,Nr=_u&&pu.process,Bn=function(){try{var a=be&&be.require&&be.require("util").types;return a||Nr&&Nr.binding&&Nr.binding("util")}catch{}}(),vu=Bn&&Bn.isArrayBuffer,wu=Bn&&Bn.isDate,xu=Bn&&Bn.isMap,Au=Bn&&Bn.isRegExp,Su=Bn&&Bn.isSet,mu=Bn&&Bn.isTypedArray;function In(a,g,h){switch(h.length){case 0:return a.call(g);case 1:return a.call(g,h[0]);case 2:return a.call(g,h[0],h[1]);case 3:return a.call(g,h[0],h[1],h[2])}return a.apply(g,h)}function Ul(a,g,h,x){for(var T=-1,W=a==null?0:a.length;++T-1}function Hr(a,g,h){for(var x=-1,T=a==null?0:a.length;++x-1;);return h}function Ou(a,g){for(var h=a.length;h--&&Ke(g,a[h],0)>-1;);return h}function ql(a,g){for(var h=a.length,x=0;h--;)a[h]===g&&++x;return x}var Yl=Kr(El),Zl=Kr(Ol);function Xl(a){return"\\"+Ml[a]}function Jl(a,g){return a==null?l:a[g]}function qe(a){return Tl.test(a)}function Vl(a){return yl.test(a)}function Ql(a){for(var g,h=[];!(g=a.next()).done;)h.push(g.value);return h}function Xr(a){var g=-1,h=Array(a.size);return a.forEach(function(x,T){h[++g]=[T,x]}),h}function bu(a,g){return function(h){return a(g(h))}}function Se(a,g){for(var h=-1,x=a.length,T=0,W=[];++h-1}function Ds(n,e){var t=this.__data__,r=Zt(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}ue.prototype.clear=Ws,ue.prototype.delete=Fs,ue.prototype.get=Us,ue.prototype.has=Ps,ue.prototype.set=Ds;function fe(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e=e?n:e)),n}function Pn(n,e,t,r,i,f){var o,s=e&P,c=e&Sn,d=e&X;if(t&&(o=i?t(n,r,i,f):t(n)),o!==l)return o;if(!z(n))return n;var p=y(n);if(p){if(o=$a(n),!s)return _n(n,o)}else{var _=ln(n),v=_==Tt||_==qi;if(Ce(n))return df(n,s);if(_==ie||_==J||v&&!i){if(o=c||v?{}:Bf(n),!s)return c?ba(n,na(o,n)):Oa(n,zu(o,n))}else{if(!N[_])return i?n:{};o=za(n,_,s)}}f||(f=new qn);var A=f.get(n);if(A)return A;f.set(n,o),lo(n)?n.forEach(function(I){o.add(Pn(I,e,t,I,n,f))}):fo(n)&&n.forEach(function(I,O){o.set(O,Pn(I,e,t,O,n,f))});var R=d?c?Ai:xi:c?wn:en,L=p?l:R(n);return Wn(L||n,function(I,O){L&&(O=I,I=n[O]),dt(o,O,Pn(I,e,t,O,n,f))}),o}function ea(n){var e=en(n);return function(t){return Ku(t,n,e)}}function Ku(n,e,t){var r=t.length;if(n==null)return!r;for(n=D(n);r--;){var i=t[r],f=e[i],o=n[i];if(o===l&&!(i in n)||!f(o))return!1}return!0}function qu(n,e,t){if(typeof n!="function")throw new Fn(Z);return St(function(){n.apply(l,t)},e)}function pt(n,e,t,r){var i=-1,f=Ot,o=!0,s=n.length,c=[],d=e.length;if(!s)return c;t&&(e=$(e,Tn(t))),r?(f=Hr,o=!1):e.length>=An&&(f=lt,o=!1,e=new We(e));n:for(;++ii?0:i+t),r=r===l||r>i?i:C(r),r<0&&(r+=i),r=t>r?0:ao(r);t0&&t(s)?e>1?un(s,e-1,t,r,i):Ae(i,s):r||(i[i.length]=s)}return i}var ei=Af(),Xu=Af(!0);function jn(n,e){return n&&ei(n,e,en)}function ti(n,e){return n&&Xu(n,e,en)}function Jt(n,e){return xe(e,function(t){return ce(n[t])})}function Ue(n,e){e=Te(e,n);for(var t=0,r=e.length;n!=null&&te}function ia(n,e){return n!=null&&U.call(n,e)}function ua(n,e){return n!=null&&e in D(n)}function fa(n,e,t){return n>=on(e,t)&&n=120&&p.length>=120)?new We(o&&p):l}p=n[0];var _=-1,v=s[0];n:for(;++_-1;)s!==n&&Ht.call(s,c,1),Ht.call(n,c,1);return n}function ff(n,e){for(var t=n?e.length:0,r=t-1;t--;){var i=e[t];if(t==r||i!==f){var f=i;ae(i)?Ht.call(n,i,1):hi(n,i)}}return n}function si(n,e){return n+zt(Nu()*(e-n+1))}function xa(n,e,t,r){for(var i=-1,f=j($t((e-n)/(t||1)),0),o=h(f);f--;)o[r?f:++i]=n,n+=t;return o}function ai(n,e){var t="";if(!n||e<1||e>Vn)return t;do e%2&&(t+=n),e=zt(e/2),e&&(n+=n);while(e);return t}function E(n,e){return Ci(Uf(n,e,xn),n+"")}function Aa(n){return $u(tt(n))}function Sa(n,e){var t=tt(n);return fr(t,Fe(e,0,t.length))}function wt(n,e,t,r){if(!z(n))return n;e=Te(e,n);for(var i=-1,f=e.length,o=f-1,s=n;s!=null&&++ii?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var f=h(i);++r>>1,o=n[f];o!==null&&!Cn(o)&&(t?o<=e:o=An){var d=e?null:Fa(n);if(d)return Mt(d);o=!1,i=lt,c=new We}else c=e?[]:s;n:for(;++r=r?n:Dn(n,e,t)}var gf=hs||function(n){return rn.clearTimeout(n)};function df(n,e){if(e)return n.slice();var t=n.length,r=Wu?Wu(t):new n.constructor(t);return n.copy(r),r}function _i(n){var e=new n.constructor(n.byteLength);return new Dt(e).set(new Dt(n)),e}function ya(n,e){var t=e?_i(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}function Ca(n){var e=new n.constructor(n.source,Vi.exec(n));return e.lastIndex=n.lastIndex,e}function La(n){return gt?D(gt.call(n)):{}}function pf(n,e){var t=e?_i(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}function _f(n,e){if(n!==e){var t=n!==l,r=n===null,i=n===n,f=Cn(n),o=e!==l,s=e===null,c=e===e,d=Cn(e);if(!s&&!d&&!f&&n>e||f&&o&&c&&!s&&!d||r&&o&&c||!t&&c||!i)return 1;if(!r&&!f&&!d&&n=s)return c;var d=t[r];return c*(d=="desc"?-1:1)}}return n.index-e.index}function vf(n,e,t,r){for(var i=-1,f=n.length,o=t.length,s=-1,c=e.length,d=j(f-o,0),p=h(c+d),_=!r;++s1?t[i-1]:l,o=i>2?t[2]:l;for(f=n.length>3&&typeof f=="function"?(i--,f):l,o&&cn(t[0],t[1],o)&&(f=i<3?l:f,i=1),e=D(e);++r-1?i[f?e[o]:o]:l}}function Rf(n){return se(function(e){var t=e.length,r=t,i=Un.prototype.thru;for(n&&e.reverse();r--;){var f=e[r];if(typeof f!="function")throw new Fn(Z);if(i&&!o&&ir(f)=="wrapper")var o=new Un([],!0)}for(r=o?r:t;++r1&&M.reverse(),p&&cs))return!1;var d=f.get(n),p=f.get(e);if(d&&p)return d==e&&p==n;var _=-1,v=!0,A=t&fn?new We:l;for(f.set(n,e),f.set(e,n);++_1?"& ":"")+e[r],e=e.join(t>2?", ":" "),n.replace(Yo,`{ -/* [wrapped with `+e+`] */ -`)}function qa(n){return y(n)||Ne(n)||!!(Pu&&n&&n[Pu])}function ae(n,e){var t=typeof n;return e=e==null?Vn:e,!!e&&(t=="number"||t!="symbol"&&rl.test(n))&&n>-1&&n%1==0&&n0){if(++e>=vr)return arguments[0]}else e=0;return n.apply(l,arguments)}}function fr(n,e){var t=-1,r=n.length,i=r-1;for(e=e===l?r:e;++t1?n[e-1]:l;return t=typeof t=="function"?(n.pop(),t):l,Xf(n,t)});function Jf(n){var e=u(n);return e.__chain__=!0,e}function th(n,e){return e(n),n}function or(n,e){return e(n)}var rh=se(function(n){var e=n.length,t=e?n[0]:0,r=this.__wrapped__,i=function(f){return ni(f,n)};return e>1||this.__actions__.length||!(r instanceof b)||!ae(t)?this.thru(i):(r=r.slice(t,+t+(e?1:0)),r.__actions__.push({func:or,args:[i],thisArg:l}),new Un(r,this.__chain__).thru(function(f){return e&&!f.length&&f.push(l),f}))});function ih(){return Jf(this)}function uh(){return new Un(this.value(),this.__chain__)}function fh(){this.__values__===l&&(this.__values__=so(this.value()));var n=this.__index__>=this.__values__.length,e=n?l:this.__values__[this.__index__++];return{done:n,value:e}}function oh(){return this}function lh(n){for(var e,t=this;t instanceof Yt;){var r=$f(t);r.__index__=0,r.__values__=l,e?i.__wrapped__=r:e=r;var i=r;t=t.__wrapped__}return i.__wrapped__=n,e}function sh(){var n=this.__wrapped__;if(n instanceof b){var e=n;return this.__actions__.length&&(e=new b(this)),e=e.reverse(),e.__actions__.push({func:or,args:[Li],thisArg:l}),new Un(e,this.__chain__)}return this.thru(Li)}function ah(){return cf(this.__wrapped__,this.__actions__)}var ch=jt(function(n,e,t){U.call(n,t)?++n[t]:oe(n,t,1)});function hh(n,e,t){var r=y(n)?Ru:ta;return t&&cn(n,e,t)&&(e=l),r(n,m(e,3))}function gh(n,e){var t=y(n)?xe:Zu;return t(n,m(e,3))}var dh=mf(zf),ph=mf(Kf);function _h(n,e){return un(lr(n,e),1)}function vh(n,e){return un(lr(n,e),re)}function wh(n,e,t){return t=t===l?1:C(t),un(lr(n,e),t)}function Vf(n,e){var t=y(n)?Wn:Re;return t(n,m(e,3))}function Qf(n,e){var t=y(n)?Pl:Yu;return t(n,m(e,3))}var xh=jt(function(n,e,t){U.call(n,t)?n[t].push(e):oe(n,t,[e])});function Ah(n,e,t,r){n=vn(n)?n:tt(n),t=t&&!r?C(t):0;var i=n.length;return t<0&&(t=j(i+t,0)),gr(n)?t<=i&&n.indexOf(e,t)>-1:!!i&&Ke(n,e,t)>-1}var Sh=E(function(n,e,t){var r=-1,i=typeof e=="function",f=vn(n)?h(n.length):[];return Re(n,function(o){f[++r]=i?In(e,o,t):_t(o,e,t)}),f}),mh=jt(function(n,e,t){oe(n,t,e)});function lr(n,e){var t=y(n)?$:ju;return t(n,m(e,3))}function Rh(n,e,t,r){return n==null?[]:(y(e)||(e=e==null?[]:[e]),t=r?l:t,y(t)||(t=t==null?[]:[t]),rf(n,e,t))}var Ih=jt(function(n,e,t){n[t?0:1].push(e)},function(){return[[],[]]});function Th(n,e,t){var r=y(n)?Gr:Cu,i=arguments.length<3;return r(n,m(e,4),t,i,Re)}function yh(n,e,t){var r=y(n)?Dl:Cu,i=arguments.length<3;return r(n,m(e,4),t,i,Yu)}function Ch(n,e){var t=y(n)?xe:Zu;return t(n,cr(m(e,3)))}function Lh(n){var e=y(n)?$u:Aa;return e(n)}function Eh(n,e,t){(t?cn(n,e,t):e===l)?e=1:e=C(e);var r=y(n)?Qs:Sa;return r(n,e)}function Oh(n){var e=y(n)?ks:Ra;return e(n)}function bh(n){if(n==null)return 0;if(vn(n))return gr(n)?Ye(n):n.length;var e=ln(n);return e==$n||e==zn?n.size:fi(n).length}function Mh(n,e,t){var r=y(n)?$r:Ia;return t&&cn(n,e,t)&&(e=l),r(n,m(e,3))}var Bh=E(function(n,e){if(n==null)return[];var t=e.length;return t>1&&cn(n,e[0],e[1])?e=[]:t>2&&cn(e[0],e[1],e[2])&&(e=[e[0]]),rf(n,un(e,1),[])}),sr=gs||function(){return rn.Date.now()};function Wh(n,e){if(typeof e!="function")throw new Fn(Z);return n=C(n),function(){if(--n<1)return e.apply(this,arguments)}}function kf(n,e,t){return e=t?l:e,e=n&&e==null?n.length:e,le(n,tn,l,l,l,l,e)}function jf(n,e){var t;if(typeof e!="function")throw new Fn(Z);return n=C(n),function(){return--n>0&&(t=e.apply(this,arguments)),n<=1&&(e=l),t}}var Oi=E(function(n,e,t){var r=Q;if(t.length){var i=Se(t,nt(Oi));r|=mn}return le(n,r,e,t,i)}),no=E(function(n,e,t){var r=Q|sn;if(t.length){var i=Se(t,nt(no));r|=mn}return le(e,r,n,t,i)});function eo(n,e,t){e=t?l:e;var r=le(n,bn,l,l,l,l,l,e);return r.placeholder=eo.placeholder,r}function to(n,e,t){e=t?l:e;var r=le(n,pe,l,l,l,l,l,e);return r.placeholder=to.placeholder,r}function ro(n,e,t){var r,i,f,o,s,c,d=0,p=!1,_=!1,v=!0;if(typeof n!="function")throw new Fn(Z);e=Hn(e)||0,z(t)&&(p=!!t.leading,_="maxWait"in t,f=_?j(Hn(t.maxWait)||0,e):f,v="trailing"in t?!!t.trailing:v);function A(Y){var Zn=r,ge=i;return r=i=l,d=Y,o=n.apply(ge,Zn),o}function R(Y){return d=Y,s=St(O,e),p?A(Y):o}function L(Y){var Zn=Y-c,ge=Y-d,Ro=e-Zn;return _?on(Ro,f-ge):Ro}function I(Y){var Zn=Y-c,ge=Y-d;return c===l||Zn>=e||Zn<0||_&&ge>=f}function O(){var Y=sr();if(I(Y))return M(Y);s=St(O,L(Y))}function M(Y){return s=l,v&&r?A(Y):(r=i=l,o)}function Ln(){s!==l&&gf(s),d=0,r=c=i=s=l}function hn(){return s===l?o:M(sr())}function En(){var Y=sr(),Zn=I(Y);if(r=arguments,i=this,c=Y,Zn){if(s===l)return R(c);if(_)return gf(s),s=St(O,e),A(c)}return s===l&&(s=St(O,e)),o}return En.cancel=Ln,En.flush=hn,En}var Fh=E(function(n,e){return qu(n,1,e)}),Uh=E(function(n,e,t){return qu(n,Hn(e)||0,t)});function Ph(n){return le(n,Ee)}function ar(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new Fn(Z);var t=function(){var r=arguments,i=e?e.apply(this,r):r[0],f=t.cache;if(f.has(i))return f.get(i);var o=n.apply(this,r);return t.cache=f.set(i,o)||f,o};return t.cache=new(ar.Cache||fe),t}ar.Cache=fe;function cr(n){if(typeof n!="function")throw new Fn(Z);return function(){var e=arguments;switch(e.length){case 0:return!n.call(this);case 1:return!n.call(this,e[0]);case 2:return!n.call(this,e[0],e[1]);case 3:return!n.call(this,e[0],e[1],e[2])}return!n.apply(this,e)}}function Dh(n){return jf(2,n)}var Nh=Ta(function(n,e){e=e.length==1&&y(e[0])?$(e[0],Tn(m())):$(un(e,1),Tn(m()));var t=e.length;return E(function(r){for(var i=-1,f=on(r.length,t);++i=e}),Ne=Vu(function(){return arguments}())?Vu:function(n){return K(n)&&U.call(n,"callee")&&!Uu.call(n,"callee")},y=h.isArray,ng=vu?Tn(vu):la;function vn(n){return n!=null&&hr(n.length)&&!ce(n)}function q(n){return K(n)&&vn(n)}function eg(n){return n===!0||n===!1||K(n)&&an(n)==Qn}var Ce=ps||$i,tg=wu?Tn(wu):sa;function rg(n){return K(n)&&n.nodeType===1&&!mt(n)}function ig(n){if(n==null)return!0;if(vn(n)&&(y(n)||typeof n=="string"||typeof n.splice=="function"||Ce(n)||et(n)||Ne(n)))return!n.length;var e=ln(n);if(e==$n||e==zn)return!n.size;if(At(n))return!fi(n).length;for(var t in n)if(U.call(n,t))return!1;return!0}function ug(n,e){return vt(n,e)}function fg(n,e,t){t=typeof t=="function"?t:l;var r=t?t(n,e):l;return r===l?vt(n,e,l,t):!!r}function Mi(n){if(!K(n))return!1;var e=an(n);return e==kn||e==Gn||typeof n.message=="string"&&typeof n.name=="string"&&!mt(n)}function og(n){return typeof n=="number"&&Du(n)}function ce(n){if(!z(n))return!1;var e=an(n);return e==Tt||e==qi||e==we||e==bo}function uo(n){return typeof n=="number"&&n==C(n)}function hr(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=Vn}function z(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}function K(n){return n!=null&&typeof n=="object"}var fo=xu?Tn(xu):ca;function lg(n,e){return n===e||ui(n,e,mi(e))}function sg(n,e,t){return t=typeof t=="function"?t:l,ui(n,e,mi(e),t)}function ag(n){return oo(n)&&n!=+n}function cg(n){if(Xa(n))throw new T(Ge);return Qu(n)}function hg(n){return n===null}function gg(n){return n==null}function oo(n){return typeof n=="number"||K(n)&&an(n)==rt}function mt(n){if(!K(n)||an(n)!=ie)return!1;var e=Nt(n);if(e===null)return!0;var t=U.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Ft.call(t)==ss}var Bi=Au?Tn(Au):ha;function dg(n){return uo(n)&&n>=-Vn&&n<=Vn}var lo=Su?Tn(Su):ga;function gr(n){return typeof n=="string"||!y(n)&&K(n)&&an(n)==ut}function Cn(n){return typeof n=="symbol"||K(n)&&an(n)==yt}var et=mu?Tn(mu):da;function pg(n){return n===l}function _g(n){return K(n)&&ln(n)==ft}function vg(n){return K(n)&&an(n)==Bo}var wg=rr(oi),xg=rr(function(n,e){return n<=e});function so(n){if(!n)return[];if(vn(n))return gr(n)?Kn(n):_n(n);if(st&&n[st])return Ql(n[st]());var e=ln(n),t=e==$n?Xr:e==zn?Mt:tt;return t(n)}function he(n){if(!n)return n===0?n:0;if(n=Hn(n),n===re||n===-re){var e=n<0?-1:1;return e*Sr}return n===n?n:0}function C(n){var e=he(n),t=e%1;return e===e?t?e-t:e:0}function ao(n){return n?Fe(C(n),0,Mn):0}function Hn(n){if(typeof n=="number")return n;if(Cn(n))return Oe;if(z(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=z(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Lu(n);var t=nl.test(n);return t||tl.test(n)?Wl(n.slice(2),t?2:8):jo.test(n)?Oe:+n}function co(n){return ne(n,wn(n))}function Ag(n){return n?Fe(C(n),-Vn,Vn):n===0?n:0}function F(n){return n==null?"":yn(n)}var Sg=ke(function(n,e){if(At(e)||vn(e)){ne(e,en(e),n);return}for(var t in e)U.call(e,t)&&dt(n,t,e[t])}),ho=ke(function(n,e){ne(e,wn(e),n)}),dr=ke(function(n,e,t,r){ne(e,wn(e),n,r)}),mg=ke(function(n,e,t,r){ne(e,en(e),n,r)}),Rg=se(ni);function Ig(n,e){var t=Qe(n);return e==null?t:zu(t,e)}var Tg=E(function(n,e){n=D(n);var t=-1,r=e.length,i=r>2?e[2]:l;for(i&&cn(e[0],e[1],i)&&(r=1);++t1),f}),ne(n,Ai(n),t),r&&(t=Pn(t,P|Sn|X,Ua));for(var i=e.length;i--;)hi(t,e[i]);return t});function zg(n,e){return po(n,cr(m(e)))}var Kg=se(function(n,e){return n==null?{}:va(n,e)});function po(n,e){if(n==null)return{};var t=$(Ai(n),function(r){return[r]});return e=m(e),uf(n,t,function(r,i){return e(r,i[0])})}function qg(n,e,t){e=Te(e,n);var r=-1,i=e.length;for(i||(i=1,n=l);++re){var r=n;n=e,e=r}if(t||n%1||e%1){var i=Nu();return on(n+i*(e-n+Bl("1e-"+((i+"").length-1))),e)}return si(n,e)}var td=je(function(n,e,t){return e=e.toLowerCase(),n+(t?wo(e):e)});function wo(n){return Ui(F(n).toLowerCase())}function xo(n){return n=F(n),n&&n.replace(il,Yl).replace(Rl,"")}function rd(n,e,t){n=F(n),e=yn(e);var r=n.length;t=t===l?r:Fe(C(t),0,r);var i=t;return t-=e.length,t>=0&&n.slice(t,i)==e}function id(n){return n=F(n),n&&Do.test(n)?n.replace(Xi,Zl):n}function ud(n){return n=F(n),n&&Ko.test(n)?n.replace(br,"\\$&"):n}var fd=je(function(n,e,t){return n+(t?"-":"")+e.toLowerCase()}),od=je(function(n,e,t){return n+(t?" ":"")+e.toLowerCase()}),ld=Sf("toLowerCase");function sd(n,e,t){n=F(n),e=C(e);var r=e?Ye(n):0;if(!e||r>=e)return n;var i=(e-r)/2;return tr(zt(i),t)+n+tr($t(i),t)}function ad(n,e,t){n=F(n),e=C(e);var r=e?Ye(n):0;return e&&r>>0,t?(n=F(n),n&&(typeof e=="string"||e!=null&&!Bi(e))&&(e=yn(e),!e&&qe(n))?ye(Kn(n),0,t):n.split(e,t)):[]}var vd=je(function(n,e,t){return n+(t?" ":"")+Ui(e)});function wd(n,e,t){return n=F(n),t=t==null?0:Fe(C(t),0,n.length),e=yn(e),n.slice(t,t+e.length)==e}function xd(n,e,t){var r=u.templateSettings;t&&cn(n,e,t)&&(e=l),n=F(n),e=dr({},e,r,Lf);var i=dr({},e.imports,r.imports,Lf),f=en(i),o=Zr(i,f),s,c,d=0,p=e.interpolate||Ct,_="__p += '",v=Jr((e.escape||Ct).source+"|"+p.source+"|"+(p===Ji?ko:Ct).source+"|"+(e.evaluate||Ct).source+"|$","g"),A="//# sourceURL="+(U.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ll+"]")+` -`;n.replace(v,function(I,O,M,Ln,hn,En){return M||(M=Ln),_+=n.slice(d,En).replace(ul,Xl),O&&(s=!0,_+=`' + -__e(`+O+`) + -'`),hn&&(c=!0,_+=`'; -`+hn+`; -__p += '`),M&&(_+=`' + -((__t = (`+M+`)) == null ? '' : __t) + -'`),d=En+I.length,I}),_+=`'; -`;var R=U.call(e,"variable")&&e.variable;if(!R)_=`with (obj) { -`+_+` -} -`;else if(Vo.test(R))throw new T(Xn);_=(c?_.replace(Wo,""):_).replace(Fo,"$1").replace(Uo,"$1;"),_="function("+(R||"obj")+`) { -`+(R?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(s?", __e = _.escape":"")+(c?`, __j = Array.prototype.join; -function print() { __p += __j.call(arguments, '') } -`:`; -`)+_+`return __p -}`;var L=So(function(){return W(f,A+"return "+_).apply(l,o)});if(L.source=_,Mi(L))throw L;return L}function Ad(n){return F(n).toLowerCase()}function Sd(n){return F(n).toUpperCase()}function md(n,e,t){if(n=F(n),n&&(t||e===l))return Lu(n);if(!n||!(e=yn(e)))return n;var r=Kn(n),i=Kn(e),f=Eu(r,i),o=Ou(r,i)+1;return ye(r,f,o).join("")}function Rd(n,e,t){if(n=F(n),n&&(t||e===l))return n.slice(0,Mu(n)+1);if(!n||!(e=yn(e)))return n;var r=Kn(n),i=Ou(r,Kn(e))+1;return ye(r,0,i).join("")}function Id(n,e,t){if(n=F(n),n&&(t||e===l))return n.replace(Mr,"");if(!n||!(e=yn(e)))return n;var r=Kn(n),i=Eu(r,Kn(e));return ye(r,i).join("")}function Td(n,e){var t=It,r=_r;if(z(e)){var i="separator"in e?e.separator:i;t="length"in e?C(e.length):t,r="omission"in e?yn(e.omission):r}n=F(n);var f=n.length;if(qe(n)){var o=Kn(n);f=o.length}if(t>=f)return n;var s=t-Ye(r);if(s<1)return r;var c=o?ye(o,0,s).join(""):n.slice(0,s);if(i===l)return c+r;if(o&&(s+=c.length-s),Bi(i)){if(n.slice(s).search(i)){var d,p=c;for(i.global||(i=Jr(i.source,F(Vi.exec(i))+"g")),i.lastIndex=0;d=i.exec(p);)var _=d.index;c=c.slice(0,_===l?s:_)}}else if(n.indexOf(yn(i),s)!=s){var v=c.lastIndexOf(i);v>-1&&(c=c.slice(0,v))}return c+r}function yd(n){return n=F(n),n&&Po.test(n)?n.replace(Zi,es):n}var Cd=je(function(n,e,t){return n+(t?" ":"")+e.toUpperCase()}),Ui=Sf("toUpperCase");function Ao(n,e,t){return n=F(n),e=t?l:e,e===l?Vl(n)?is(n):Gl(n):n.match(e)||[]}var So=E(function(n,e){try{return In(n,l,e)}catch(t){return Mi(t)?t:new T(t)}}),Ld=se(function(n,e){return Wn(e,function(t){t=ee(t),oe(n,t,Oi(n[t],n))}),n});function Ed(n){var e=n==null?0:n.length,t=m();return n=e?$(n,function(r){if(typeof r[1]!="function")throw new Fn(Z);return[t(r[0]),r[1]]}):[],E(function(r){for(var i=-1;++iVn)return[];var t=Mn,r=on(n,Mn);e=m(e),n-=Mn;for(var i=Yr(r,e);++t0||e<0)?new b(t):(n<0?t=t.takeRight(-n):n&&(t=t.drop(n)),e!==l&&(e=C(e),t=e<0?t.dropRight(-e):t.take(e-n)),t)},b.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},b.prototype.toArray=function(){return this.take(Mn)},jn(b.prototype,function(n,e){var t=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=u[r?"take"+(e=="last"?"Right":""):e],f=r||/^find/.test(e);!i||(u.prototype[e]=function(){var o=this.__wrapped__,s=r?[1]:arguments,c=o instanceof b,d=s[0],p=c||y(o),_=function(O){var M=i.apply(u,Ae([O],s));return r&&v?M[0]:M};p&&t&&typeof d=="function"&&d.length!=1&&(c=p=!1);var v=this.__chain__,A=!!this.__actions__.length,R=f&&!v,L=c&&!A;if(!f&&p){o=L?o:new b(this);var I=n.apply(o,s);return I.__actions__.push({func:or,args:[_],thisArg:l}),new Un(I,v)}return R&&L?n.apply(this,s):(I=this.thru(_),R?r?I.value()[0]:I.value():I)})}),Wn(["pop","push","shift","sort","splice","unshift"],function(n){var e=Bt[n],t=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",r=/^(?:pop|shift)$/.test(n);u.prototype[n]=function(){var i=arguments;if(r&&!this.__chain__){var f=this.value();return e.apply(y(f)?f:[],i)}return this[t](function(o){return e.apply(y(o)?o:[],i)})}}),jn(b.prototype,function(n,e){var t=u[e];if(t){var r=t.name+"";U.call(Ve,r)||(Ve[r]=[]),Ve[r].push({name:e,func:t})}}),Ve[nr(l,sn).name]=[{name:"wrapper",func:l}],b.prototype.clone=ys,b.prototype.reverse=Cs,b.prototype.value=Ls,u.prototype.at=rh,u.prototype.chain=ih,u.prototype.commit=uh,u.prototype.next=fh,u.prototype.plant=lh,u.prototype.reverse=sh,u.prototype.toJSON=u.prototype.valueOf=u.prototype.value=ah,u.prototype.first=u.prototype.head,st&&(u.prototype[st]=oh),u},Ze=us();be?((be.exports=Ze)._=Ze,Dr._=Ze):rn._=Ze}).call(Rt)})(Co,Co.exports);var Zp=(w=>(w[w.TITLE=1]="TITLE",w[w.TEXT=2]="TEXT",w[w.IMAGEURL=3]="IMAGEURL",w[w.VIDEOURL=4]="VIDEOURL",w[w.AUDIOURL=5]="AUDIOURL",w[w.LINKURL=6]="LINKURL",w[w.ATTACHMENT=7]="ATTACHMENT",w[w.CHARGEATTACHMENT=8]="CHARGEATTACHMENT",w))(Zp||{}),Xp=(w=>(w[w.PUBLIC=0]="PUBLIC",w[w.PRIVATE=1]="PRIVATE",w[w.FRIEND=2]="FRIEND",w))(Xp||{});export{kp as I,Zp as P,Xp as V,Qp as _,Co as l}; diff --git a/web/dist/assets/InputGroup.f69c4956.js b/web/dist/assets/InputGroup.f69c4956.js deleted file mode 100644 index 6289b2bf..00000000 --- a/web/dist/assets/InputGroup.f69c4956.js +++ /dev/null @@ -1,56 +0,0 @@ -import{l as t,n as r,m as o,d as a,u as d,b$ as s,h as n}from"./index.f480f018.js";var p=t("input-group",` - display: inline-flex; - width: 100%; - flex-wrap: nowrap; - vertical-align: bottom; -`,[r(">",[t("input",[r("&:not(:last-child)",` - border-top-right-radius: 0!important; - border-bottom-right-radius: 0!important; - `),r("&:not(:first-child)",` - border-top-left-radius: 0!important; - border-bottom-left-radius: 0!important; - margin-left: -1px!important; - `)]),t("button",[r("&:not(:last-child)",` - border-top-right-radius: 0!important; - border-bottom-right-radius: 0!important; - `,[o("state-border, border",` - border-top-right-radius: 0!important; - border-bottom-right-radius: 0!important; - `)]),r("&:not(:first-child)",` - border-top-left-radius: 0!important; - border-bottom-left-radius: 0!important; - `,[o("state-border, border",` - border-top-left-radius: 0!important; - border-bottom-left-radius: 0!important; - `)])]),r("*",[r("&:not(:last-child)",` - border-top-right-radius: 0!important; - border-bottom-right-radius: 0!important; - `,[r(">",[t("input",` - border-top-right-radius: 0!important; - border-bottom-right-radius: 0!important; - `),t("base-selection",[t("base-selection-label",` - border-top-right-radius: 0!important; - border-bottom-right-radius: 0!important; - `),t("base-selection-tags",` - border-top-right-radius: 0!important; - border-bottom-right-radius: 0!important; - `),o("box-shadow, border, state-border",` - border-top-right-radius: 0!important; - border-bottom-right-radius: 0!important; - `)])])]),r("&:not(:first-child)",` - margin-left: -1px!important; - border-top-left-radius: 0!important; - border-bottom-left-radius: 0!important; - `,[r(">",[t("input",` - border-top-left-radius: 0!important; - border-bottom-left-radius: 0!important; - `),t("base-selection",[t("base-selection-label",` - border-top-left-radius: 0!important; - border-bottom-left-radius: 0!important; - `),t("base-selection-tags",` - border-top-left-radius: 0!important; - border-bottom-left-radius: 0!important; - `),o("box-shadow, border, state-border",` - border-top-left-radius: 0!important; - border-bottom-left-radius: 0!important; - `)])])])])])]);const b={};var u=a({name:"InputGroup",props:b,setup(i){const{mergedClsPrefixRef:e}=d(i);return s("-input-group",p,e),{mergedClsPrefix:e}},render(){const{mergedClsPrefix:i}=this;return n("div",{class:`${i}-input-group`},this.$slots)}});export{u as _}; diff --git a/web/dist/assets/List.49bcdf81.js b/web/dist/assets/List.49bcdf81.js deleted file mode 100644 index d17b8a09..00000000 --- a/web/dist/assets/List.49bcdf81.js +++ /dev/null @@ -1,53 +0,0 @@ -import{n as d,l as n,o as z,m as i,aA as y,aB as _,d as P,u as R,q as c,A as $,s as j,y as B,h as a,e as M,aC as I}from"./index.f480f018.js";var L=d([n("list",` - --n-merged-border-color: var(--n-border-color); - --n-merged-color: var(--n-color) - font-size: var(--n-font-size); - transition: - background-color .3s var(--n-bezier), - color .3s var(--n-bezier), - border-color .3s var(--n-bezier); - padding: 0; - list-style-type: none; - color: var(--n-text-color); - background-color: var(--n-merged-color); - `,[z("bordered",` - border-radius: var(--n-border-radius); - border: 1px solid var(--n-merged-border-color); - `,[n("list-item",` - padding: 12px 20px; - `,[d("&:not(:last-child)",` - border-bottom: 1px solid var(--n-merged-border-color); - `)]),i("header, footer",` - padding: 12px 20px; - `,[d("&:not(:last-child)",` - border-bottom: 1px solid var(--n-merged-border-color); - `)])]),i("header, footer",` - padding: 12px 0; - box-sizing: border-box; - transition: border-color .3s var(--n-bezier); - `,[d("&:not(:last-child)",` - border-bottom: 1px solid var(--n-merged-border-color); - `)]),n("list-item",` - padding: 12px 0; - box-sizing: border-box; - display: flex; - flex-wrap: nowrap; - align-items: center; - transition: border-color .3s var(--n-bezier); - `,[i("prefix",` - margin-right: 20px; - flex: 0; - `),i("suffix",` - margin-left: 20px; - flex: 0; - `),i("main",` - flex: 1; - `),d("&:not(:last-child)",` - border-bottom: 1px solid var(--n-merged-border-color); - `)])]),y(n("list",` - --merged-color: var(--n-color-modal); - --merged-border-color: var(--n-border-color-modal); - `)),_(n("list",` - --merged-color: var(--n-color-popover); - --merged-border-color: var(--n-border-color-popover); - `))]);const O=Object.assign(Object.assign({},c.props),{size:{type:String,default:"medium"},bordered:{type:Boolean,default:!1}}),T=M("n-list");var k=P({name:"List",props:O,setup(r){const{mergedClsPrefixRef:o,inlineThemeDisabled:e}=R(r),s=c("List","-list",L,I,r,o);$(T,{mergedClsPrefixRef:o});const t=j(()=>{const{common:{cubicBezierEaseInOut:b},self:{fontSize:m,textColor:p,color:v,colorModal:f,colorPopover:u,borderColor:g,borderColorModal:x,borderColorPopover:h,borderRadius:C}}=s.value;return{"--n-font-size":m,"--n-bezier":b,"--n-text-color":p,"--n-color":v,"--n-border-radius":C,"--n-border-color":g,"--n-border-color-modal":x,"--n-border-color-popover":h,"--n-color-modal":f,"--n-color-popover":u}}),l=e?B("list",void 0,t,r):void 0;return{mergedClsPrefix:o,cssVars:e?void 0:t,themeClass:l==null?void 0:l.themeClass,onRender:l==null?void 0:l.onRender}},render(){var r;const{$slots:o,mergedClsPrefix:e,onRender:s}=this;return s==null||s(),a("ul",{class:[`${e}-list`,this.bordered&&`${e}-list--bordered`,this.themeClass],style:this.cssVars},o.header?a("div",{class:`${e}-list__header`},o.header()):null,(r=o.default)===null||r===void 0?void 0:r.call(o),o.footer?a("div",{class:`${e}-list__footer`},o.footer()):null)}});export{k as _,T as l}; diff --git a/web/dist/assets/Messages.c822d4d1.js b/web/dist/assets/Messages.c822d4d1.js deleted file mode 100644 index e372032b..00000000 --- a/web/dist/assets/Messages.c822d4d1.js +++ /dev/null @@ -1 +0,0 @@ -import{d as v,V as n,W as s,Y as i,ah as M,aj as z,al as I,a3 as a,a4 as r,a7 as $,a8 as p,a9 as w,a5 as b,a6 as l,a2 as k,c3 as N,ch as R,ci as q,cj as P,ad as T,ck as H,ae as U,ab as O,aa as A,ai as W,Z as Y,r as x,a1 as Z,cl as G}from"./index.f480f018.js";import{f as J}from"./formatTime.02109bf5.js";import{_ as K}from"./Alert.a854329b.js";import{_ as Q}from"./Thing.eef6b133.js";import{b as X,a as ee,_ as ne}from"./Skeleton.57e98fe3.js";import{_ as te}from"./main-nav.9110259b.js";import{_ as se}from"./List.49bcdf81.js";import{_ as oe}from"./Pagination.1263479e.js";const ae={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},re=i("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M464 128L240 384l-96-96"},null,-1),ie=i("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M144 384l-96-96"},null,-1),le=i("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128L232 284"},null,-1),ue=[re,ie,le];var ce=v({name:"CheckmarkDoneOutline",render:function(c,_){return n(),s("svg",ae,ue)}});const _e={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},de=i("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1),me=[de];var pe=v({name:"CheckmarkOutline",render:function(c,_){return n(),s("svg",_e,me)}});const he={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ge=i("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144"},null,-1),ke=i("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 144L144 368"},null,-1),ve=[ge,ke];var E=v({name:"CloseOutline",render:function(c,_){return n(),s("svg",he,ve)}});const we={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},fe=i("path",{d:"M336 192h40a40 40 0 0 1 40 40v192a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V232a40 40 0 0 1 40-40h40",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),ye=i("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 128l-80-80l-80 80"},null,-1),xe=i("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 321V48"},null,-1),$e=[fe,ye,xe];var Ce=v({name:"ShareOutline",render:function(c,_){return n(),s("svg",we,$e)}});const De={class:"sender-wrap"},Fe={key:0,class:"nickname"},Me={class:"username"},Be={key:1,class:"nickname"},je={class:"timestamp"},Ee={class:"timestamp-txt"},be={key:0,class:"brief-content"},Oe=p(" \u67E5\u770B\u8BE6\u60C5 "),Ae={key:1,class:"whisper-content-wrap"},Ve={key:2,class:"requesting-friend-wrap"},Le=p(" \u540C\u610F "),Se=p(" \u62D2\u7EDD "),ze={key:2,class:"status-info"},Ie=p(" \u5DF2\u540C\u610F "),Ne={key:3,class:"status-info"},Re=p(" \u5DF2\u62D2\u7EDD "),qe=v({props:{message:null},setup(e){const c="https://assets.paopao.info/public/avatar/default/admin.png",_=z(),u=t=>{d(t),(t.type===1||t.type===2||t.type===3)&&(t.post&&t.post.id>0?_.push({name:"post",query:{id:t.post_id}}):window.$message.error("\u8BE5\u52A8\u6001\u5DF2\u88AB\u5220\u9664"))},h=t=>{d(t),R({user_id:t.sender_user_id}).then(o=>{t.reply_id=2,window.$message.success("\u5DF2\u540C\u610F\u6DFB\u52A0\u597D\u53CB")}).catch(o=>{console.log(o)})},f=t=>{d(t),q({user_id:t.sender_user_id}).then(o=>{t.reply_id=3,window.$message.success("\u5DF2\u62D2\u7EDD\u6DFB\u52A0\u597D\u53CB")}).catch(o=>{console.log(o)})},d=t=>{t.is_read===0&&P({id:t.id}).then(o=>{t.is_read=1}).catch(o=>{console.log(o)})};return(t,o)=>{const C=T,m=I("router-link"),B=H,g=U,D=K,F=Q;return n(),s("div",{class:N(["message-item",{unread:e.message.is_read===0}]),onClick:o[4]||(o[4]=y=>d(e.message))},[a(F,{"content-indented":""},{avatar:r(()=>[a(C,{round:"",size:30,src:e.message.sender_user.id>0?e.message.sender_user.avatar:c},null,8,["src"])]),header:r(()=>[i("div",De,[e.message.sender_user.id>0?(n(),s("span",Fe,[a(m,{onClick:o[0]||(o[0]=$(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e.message.sender_user.username}}},{default:r(()=>[p(w(e.message.sender_user.nickname),1)]),_:1},8,["to"]),i("span",Me," @"+w(e.message.sender_user.username),1)])):(n(),s("span",Be," \u7CFB\u7EDF "))])]),"header-extra":r(()=>[i("span",je,[e.message.is_read===0?(n(),b(B,{key:0,dot:"",processing:""})):l("",!0),i("span",Ee,w(k(J)(e.message.created_on)),1)])]),description:r(()=>[a(D,{"show-icon":!1,class:"brief-wrap",type:e.message.is_read>0?"default":"success"},{default:r(()=>[e.message.type!=4?(n(),s("div",be,[p(w(e.message.brief)+" ",1),e.message.type===1||e.message.type===2||e.message.type===3?(n(),s("span",{key:0,onClick:o[1]||(o[1]=$(y=>u(e.message),["stop"])),class:"hash-link view-link"},[a(g,null,{default:r(()=>[a(k(Ce))]),_:1}),Oe])):l("",!0)])):l("",!0),e.message.type===4?(n(),s("div",Ae,w(e.message.content),1)):l("",!0),e.message.type===5?(n(),s("div",Ve,[p(w(e.message.content)+" ",1),e.message.reply_id===1?(n(),s("span",{key:0,onClick:o[2]||(o[2]=$(y=>h(e.message),["stop"])),class:"hash-link view-link"},[a(g,null,{default:r(()=>[a(k(pe))]),_:1}),Le])):l("",!0),e.message.reply_id===1?(n(),s("span",{key:1,onClick:o[3]||(o[3]=$(y=>f(e.message),["stop"])),class:"hash-link view-link"},[a(g,null,{default:r(()=>[a(k(E))]),_:1}),Se])):l("",!0),e.message.reply_id===2?(n(),s("span",ze,[a(g,null,{default:r(()=>[a(k(ce))]),_:1}),Ie])):l("",!0),e.message.reply_id===3?(n(),s("span",Ne,[a(g,null,{default:r(()=>[a(k(E))]),_:1}),Re])):l("",!0)])):l("",!0)]),_:1},8,["type"])]),_:1})],2)}}});var Pe=M(qe,[["__scopeId","data-v-44920a13"]]);const Te={class:"content"},He=v({props:{num:{default:1}},setup(e){return(c,_)=>{const u=X;return n(!0),s(A,null,O(new Array(e.num),h=>(n(),s("div",{class:"skeleton-item",key:h},[i("div",Te,[a(u,{text:"",repeat:2}),a(u,{text:"",style:{width:"60%"}})])]))),128)}}});var Ue=M(He,[["__scopeId","data-v-d0b0628c"]]);const We={key:0,class:"skeleton-wrap"},Ye={key:1},Ze={key:0,class:"empty-wrap"},Ge={key:0,class:"pagination-wrap"},Je=v({setup(e){const c=W(),_=Y(),u=x(!1),h=x(+c.query.p||1),f=x(10),d=x(0),t=x([]),o=()=>{u.value=!0,G({page:h.value,page_size:f.value}).then(m=>{u.value=!1,t.value=m.list,d.value=Math.ceil(m.pager.total_rows/f.value)}).catch(m=>{u.value=!1})},C=m=>{h.value=m,o()};return Z(()=>{o()}),(m,B)=>{const g=te,D=Ue,F=ee,y=Pe,V=ne,L=oe,S=se;return n(),s("div",null,[a(g,{title:"\u6D88\u606F"}),a(S,{class:"main-content-wrap messages-wrap",bordered:""},{footer:r(()=>[d.value>1?(n(),s("div",Ge,[a(L,{page:h.value,"onUpdate:page":C,"page-slot":k(_).state.collapsedRight?5:8,"page-count":d.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:r(()=>[u.value?(n(),s("div",We,[a(D,{num:f.value},null,8,["num"])])):(n(),s("div",Ye,[t.value.length===0?(n(),s("div",Ze,[a(F,{size:"large",description:"\u6682\u65E0\u6570\u636E"})])):l("",!0),(n(!0),s(A,null,O(t.value,j=>(n(),b(V,{key:j.id},{default:r(()=>[a(y,{message:j},null,8,["message"])]),_:2},1024))),128))]))]),_:1})])}}});var an=M(Je,[["__scopeId","data-v-532e9e3c"]]);export{an as default}; diff --git a/web/dist/assets/MoreHorizFilled.80db5156.js b/web/dist/assets/MoreHorizFilled.80db5156.js deleted file mode 100644 index 319b349b..00000000 --- a/web/dist/assets/MoreHorizFilled.80db5156.js +++ /dev/null @@ -1 +0,0 @@ -import{d as e,V as o,W as s,Y as r}from"./index.f480f018.js";const t={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},n=r("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2z",fill:"currentColor"},null,-1),l=[n];var m=e({name:"MoreHorizFilled",render:function(i,a){return o(),s("svg",t,l)}});export{m as M}; diff --git a/web/dist/assets/Pagination.1263479e.js b/web/dist/assets/Pagination.1263479e.js deleted file mode 100644 index 5af23bdf..00000000 --- a/web/dist/assets/Pagination.1263479e.js +++ /dev/null @@ -1,252 +0,0 @@ -import{d as se,h as n,r as m,aD as Bt,aE as _t,a1 as lt,aF as je,aG as $t,aH as At,n as re,l as x,m as D,p as Ze,o as Y,q as Me,t as ve,aI as Et,s as B,aJ as Ve,S as De,aK as st,v as Qe,y as qe,aL as Lt,an as He,aM as Ye,aa as Ge,aN as Dt,aO as jt,u as dt,aP as Vt,g as Ne,aQ as Nt,I as ut,aR as Wt,f as Ut,aS as Kt,aT as Je,aU as Ht,aV as Zt,aW as Jt,aX as qt,aY as Qt,aZ as Yt,a_ as Xe,a$ as Gt,k as U,b0 as Xt,x as en,K as tn,_ as nn,N as Oe}from"./index.f480f018.js";import{N as on}from"./Skeleton.57e98fe3.js";var et=se({name:"Backward",render(){return n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M12.2674 15.793C11.9675 16.0787 11.4927 16.0672 11.2071 15.7673L6.20572 10.5168C5.9298 10.2271 5.9298 9.7719 6.20572 9.48223L11.2071 4.23177C11.4927 3.93184 11.9675 3.92031 12.2674 4.206C12.5673 4.49169 12.5789 4.96642 12.2932 5.26634L7.78458 9.99952L12.2932 14.7327C12.5789 15.0326 12.5673 15.5074 12.2674 15.793Z",fill:"currentColor"}))}}),tt=se({name:"FastBackward",render(){return n("svg",{viewBox:"0 0 20 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},n("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},n("g",{fill:"currentColor","fill-rule":"nonzero"},n("path",{d:"M8.73171,16.7949 C9.03264,17.0795 9.50733,17.0663 9.79196,16.7654 C10.0766,16.4644 10.0634,15.9897 9.76243,15.7051 L4.52339,10.75 L17.2471,10.75 C17.6613,10.75 17.9971,10.4142 17.9971,10 C17.9971,9.58579 17.6613,9.25 17.2471,9.25 L4.52112,9.25 L9.76243,4.29275 C10.0634,4.00812 10.0766,3.53343 9.79196,3.2325 C9.50733,2.93156 9.03264,2.91834 8.73171,3.20297 L2.31449,9.27241 C2.14819,9.4297 2.04819,9.62981 2.01448,9.8386 C2.00308,9.89058 1.99707,9.94459 1.99707,10 C1.99707,10.0576 2.00356,10.1137 2.01585,10.1675 C2.05084,10.3733 2.15039,10.5702 2.31449,10.7254 L8.73171,16.7949 Z"}))))}}),nt=se({name:"FastForward",render(){return n("svg",{viewBox:"0 0 20 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},n("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},n("g",{fill:"currentColor","fill-rule":"nonzero"},n("path",{d:"M11.2654,3.20511 C10.9644,2.92049 10.4897,2.93371 10.2051,3.23464 C9.92049,3.53558 9.93371,4.01027 10.2346,4.29489 L15.4737,9.25 L2.75,9.25 C2.33579,9.25 2,9.58579 2,10.0000012 C2,10.4142 2.33579,10.75 2.75,10.75 L15.476,10.75 L10.2346,15.7073 C9.93371,15.9919 9.92049,16.4666 10.2051,16.7675 C10.4897,17.0684 10.9644,17.0817 11.2654,16.797 L17.6826,10.7276 C17.8489,10.5703 17.9489,10.3702 17.9826,10.1614 C17.994,10.1094 18,10.0554 18,10.0000012 C18,9.94241 17.9935,9.88633 17.9812,9.83246 C17.9462,9.62667 17.8467,9.42976 17.6826,9.27455 L11.2654,3.20511 Z"}))))}}),ot=se({name:"Forward",render(){return n("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{d:"M7.73271 4.20694C8.03263 3.92125 8.50737 3.93279 8.79306 4.23271L13.7944 9.48318C14.0703 9.77285 14.0703 10.2281 13.7944 10.5178L8.79306 15.7682C8.50737 16.0681 8.03263 16.0797 7.73271 15.794C7.43279 15.5083 7.42125 15.0336 7.70694 14.7336L12.2155 10.0005L7.70694 5.26729C7.42125 4.96737 7.43279 4.49264 7.73271 4.20694Z",fill:"currentColor"}))}}),rt=se({name:"More",render(){return n("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},n("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},n("g",{fill:"currentColor","fill-rule":"nonzero"},n("path",{d:"M4,7 C4.55228,7 5,7.44772 5,8 C5,8.55229 4.55228,9 4,9 C3.44772,9 3,8.55229 3,8 C3,7.44772 3.44772,7 4,7 Z M8,7 C8.55229,7 9,7.44772 9,8 C9,8.55229 8.55229,9 8,9 C7.44772,9 7,8.55229 7,8 C7,7.44772 7.44772,7 8,7 Z M12,7 C12.5523,7 13,7.44772 13,8 C13,8.55229 12.5523,9 12,9 C11.4477,9 11,8.55229 11,8 C11,7.44772 11.4477,7 12,7 Z"}))))}});const pe="v-hidden",rn=At("[v-hidden]",{display:"none!important"});var at=se({name:"Overflow",props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateOverflow:Function},setup(e,{slots:r}){const d=m(null),f=m(null);function u(){const{value:g}=d,{getCounter:s,getTail:R}=e;let p;if(s!==void 0?p=s():p=f.value,!g||!p)return;p.hasAttribute(pe)&&p.removeAttribute(pe);const{children:b}=g,M=g.offsetWidth,S=[],P=r.tail?R==null?void 0:R():null;let C=P?P.offsetWidth:0,y=!1;const $=g.children.length-(r.tail?1:0);for(let A=0;A<$-1;++A){if(A<0)continue;const j=b[A];if(y){j.hasAttribute(pe)||j.setAttribute(pe,"");continue}else j.hasAttribute(pe)&&j.removeAttribute(pe);const K=j.offsetWidth;if(C+=K,S[A]=K,C>M){const{updateCounter:E}=e;for(let k=A;k>=0;--k){const W=$-1-k;E!==void 0?E(W):p.textContent=`${W}`;const H=p.offsetWidth;if(C-=S[k],C+H<=M||k===0){y=!0,A=k-1,P&&(A===-1?(P.style.maxWidth=`${M-H}px`,P.style.boxSizing="border-box"):P.style.maxWidth="");break}}}}const{onUpdateOverflow:O}=e;y?O!==void 0&&O(!0):(O!==void 0&&O(!1),p.setAttribute(pe,""))}const w=Bt();return rn.mount({id:"vueuc/overflow",head:!0,anchorMetaName:_t,ssr:w}),lt(u),{selfRef:d,counterRef:f,sync:u}},render(){const{$slots:e}=this;return je(this.sync),n("div",{class:"v-overflow",ref:"selfRef"},[$t(e,"default"),e.counter?e.counter():n("span",{style:{display:"inline-block"},ref:"counterRef"}),e.tail?e.tail():null])}}),an=re([x("base-selection",` - position: relative; - z-index: auto; - box-shadow: none; - width: 100%; - max-width: 100%; - display: inline-block; - vertical-align: bottom; - border-radius: var(--n-border-radius); - min-height: var(--n-height); - line-height: 1.5; - font-size: var(--n-font-size); - `,[x("base-loading",` - color: var(--n-loading-color); - `),x("base-selection-tags","min-height: var(--n-height);"),D("border, state-border",` - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - pointer-events: none; - border: var(--n-border); - border-radius: inherit; - transition: - box-shadow .3s var(--n-bezier), - border-color .3s var(--n-bezier); - `),D("state-border",` - z-index: 1; - border-color: #0000; - `),x("base-suffix",` - cursor: pointer; - position: absolute; - top: 50%; - transform: translateY(-50%); - right: 10px; - `,[D("arrow",` - font-size: var(--n-arrow-size); - color: var(--n-arrow-color); - transition: color .3s var(--n-bezier); - `)]),x("base-selection-overlay",` - display: flex; - align-items: center; - white-space: nowrap; - pointer-events: none; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - padding: var(--n-padding-single); - transition: color .3s var(--n-bezier); - `,[D("wrapper",` - flex-basis: 0; - flex-grow: 1; - overflow: hidden; - text-overflow: ellipsis; - `)]),x("base-selection-placeholder",` - color: var(--n-placeholder-color); - `),x("base-selection-tags",` - cursor: pointer; - outline: none; - box-sizing: border-box; - position: relative; - z-index: auto; - display: flex; - padding: var(--n-padding-multiple); - flex-wrap: wrap; - align-items: center; - width: 100%; - vertical-align: bottom; - background-color: var(--n-color); - border-radius: inherit; - transition: - color .3s var(--n-bezier), - box-shadow .3s var(--n-bezier), - background-color .3s var(--n-bezier); - `),x("base-selection-label",` - height: var(--n-height); - display: inline-flex; - width: 100%; - vertical-align: bottom; - cursor: pointer; - outline: none; - z-index: auto; - box-sizing: border-box; - position: relative; - transition: - color .3s var(--n-bezier), - box-shadow .3s var(--n-bezier), - background-color .3s var(--n-bezier); - border-radius: inherit; - background-color: var(--n-color); - align-items: center; - `,[x("base-selection-input",` - line-height: inherit; - outline: none; - cursor: pointer; - box-sizing: border-box; - border:none; - width: 100%; - padding: var(--n-padding-single); - background-color: #0000; - color: var(--n-text-color); - transition: color .3s var(--n-bezier); - caret-color: var(--n-caret-color); - `,[D("content",` - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - `)]),D("render-label",` - color: var(--n-text-color); - `)]),Ze("disabled",[re("&:hover",[D("state-border",` - box-shadow: var(--n-box-shadow-hover); - border: var(--n-border-hover); - `)]),Y("focus",[D("state-border",` - box-shadow: var(--n-box-shadow-focus); - border: var(--n-border-focus); - `)]),Y("active",[D("state-border",` - box-shadow: var(--n-box-shadow-active); - border: var(--n-border-active); - `),x("base-selection-label","background-color: var(--n-color-active);"),x("base-selection-tags","background-color: var(--n-color-active);")])]),Y("disabled","cursor: not-allowed;",[D("arrow",` - color: var(--n-arrow-color-disabled); - `),x("base-selection-label",` - cursor: not-allowed; - background-color: var(--n-color-disabled); - `,[x("base-selection-input",` - cursor: not-allowed; - color: var(--n-text-color-disabled); - `),D("render-label",` - color: var(--n-text-color-disabled); - `)]),x("base-selection-tags",` - cursor: not-allowed; - background-color: var(--n-color-disabled); - `),x("base-selection-placeholder",` - cursor: not-allowed; - color: var(--n-placeholder-color-disabled); - `)]),x("base-selection-input-tag",` - height: calc(var(--n-height) - 6px); - line-height: calc(var(--n-height) - 6px); - outline: none; - display: none; - position: relative; - margin-bottom: 3px; - max-width: 100%; - vertical-align: bottom; - `,[D("input",` - min-width: 1px; - padding: 0; - background-color: #0000; - outline: none; - border: none; - max-width: 100%; - overflow: hidden; - width: 1em; - line-height: inherit; - cursor: pointer; - color: var(--n-text-color); - caret-color: var(--n-caret-color); - `),D("mirror",` - position: absolute; - left: 0; - top: 0; - white-space: pre; - visibility: hidden; - user-select: none; - opacity: 0; - `)]),["warning","error"].map(e=>Y(`${e}-status`,[D("state-border",`border: var(--n-border-${e});`),Ze("disabled",[re("&:hover",[D("state-border",` - box-shadow: var(--n-box-shadow-hover-${e}); - border: var(--n-border-hover-${e}); - `)]),Y("active",[D("state-border",` - box-shadow: var(--n-box-shadow-active-${e}); - border: var(--n-border-active-${e}); - `),x("base-selection-label",`background-color: var(--n-color-active-${e});`),x("base-selection-tags",`background-color: var(--n-color-active-${e});`)]),Y("focus",[D("state-border",` - box-shadow: var(--n-box-shadow-focus-${e}); - border: var(--n-border-focus-${e}); - `)])])]))]),x("base-selection-popover",` - margin-bottom: -3px; - display: flex; - flex-wrap: wrap; - `),x("base-selection-tag-wrapper",` - max-width: 100%; - display: inline-flex; - padding: 0 7px 3px 0; - `,[re("&:last-child","padding-right: 0;"),x("tag",` - font-size: 14px; - max-width: 100%; - `,[D("content",` - line-height: 1.25; - text-overflow: ellipsis; - overflow: hidden; - `)])])]),ln=se({name:"InternalSelection",props:Object.assign(Object.assign({},Me.props),{clsPrefix:{type:String,required:!0},bordered:{type:Boolean,default:void 0},active:Boolean,pattern:{type:String,default:""},placeholder:String,selectedOption:{type:Object,default:null},selectedOptions:{type:Array,default:null},multiple:Boolean,filterable:Boolean,clearable:Boolean,disabled:Boolean,size:{type:String,default:"medium"},loading:Boolean,autofocus:Boolean,showArrow:{type:Boolean,default:!0},inputProps:Object,focused:Boolean,renderTag:Function,onKeyup:Function,onKeydown:Function,onClick:Function,onBlur:Function,onFocus:Function,onDeleteOption:Function,maxTagCount:[String,Number],onClear:Function,onPatternInput:Function,onPatternFocus:Function,onPatternBlur:Function,renderLabel:Function,status:String,inlineThemeDisabled:Boolean}),setup(e){const r=m(null),d=m(null),f=m(null),u=m(null),w=m(null),g=m(null),s=m(null),R=m(null),p=m(null),b=m(null),M=m(!1),S=m(!1),P=m(!1),C=Me("InternalSelection","-internal-selection",an,Et,e,ve(e,"clsPrefix")),y=B(()=>e.clearable&&!e.disabled&&(P.value||e.active)),$=B(()=>e.selectedOption?e.renderTag?e.renderTag({option:e.selectedOption,handleClose:()=>{}}):e.renderLabel?e.renderLabel(e.selectedOption,!0):Ve(e.selectedOption.label,e.selectedOption,!0):e.placeholder),O=B(()=>{const o=e.selectedOption;if(!!o)return o.label}),A=B(()=>e.multiple?!!(Array.isArray(e.selectedOptions)&&e.selectedOptions.length):e.selectedOption!==null);function j(){var o;const{value:l}=r;if(l){const{value:_}=d;_&&(_.style.width=`${l.offsetWidth}px`,e.maxTagCount!=="responsive"&&((o=p.value)===null||o===void 0||o.sync()))}}function K(){const{value:o}=b;o&&(o.style.display="none")}function E(){const{value:o}=b;o&&(o.style.display="inline-block")}De(ve(e,"active"),o=>{o||K()}),De(ve(e,"pattern"),()=>{e.multiple&&je(j)});function k(o){const{onFocus:l}=e;l&&l(o)}function W(o){const{onBlur:l}=e;l&&l(o)}function H(o){const{onDeleteOption:l}=e;l&&l(o)}function V(o){const{onClear:l}=e;l&&l(o)}function I(o){const{onPatternInput:l}=e;l&&l(o)}function ae(o){var l;(!o.relatedTarget||!(!((l=f.value)===null||l===void 0)&&l.contains(o.relatedTarget)))&&k(o)}function de(o){var l;!((l=f.value)===null||l===void 0)&&l.contains(o.relatedTarget)||W(o)}function ue(o){V(o)}function ne(){P.value=!0}function ie(){P.value=!1}function ee(o){!e.active||!e.filterable||o.target!==d.value&&o.preventDefault()}function le(o){H(o)}function G(o){if(o.code==="Backspace"&&!Z.value&&!e.pattern.length){const{selectedOptions:l}=e;l!=null&&l.length&&le(l[l.length-1])}}const Z=m(!1);let J=null;function q(o){const{value:l}=r;if(l){const _=o.target.value;l.textContent=_,j()}Z.value?J=o:I(o)}function X(){Z.value=!0}function a(){Z.value=!1,I(J),J=null}function c(o){var l;S.value=!0,(l=e.onPatternFocus)===null||l===void 0||l.call(e,o)}function L(o){var l;S.value=!1,(l=e.onPatternBlur)===null||l===void 0||l.call(e,o)}function N(){var o,l;if(e.filterable)S.value=!1,(o=g.value)===null||o===void 0||o.blur(),(l=d.value)===null||l===void 0||l.blur();else if(e.multiple){const{value:_}=u;_==null||_.blur()}else{const{value:_}=w;_==null||_.blur()}}function Q(){var o,l,_;e.filterable?(S.value=!1,(o=g.value)===null||o===void 0||o.focus()):e.multiple?(l=u.value)===null||l===void 0||l.focus():(_=w.value)===null||_===void 0||_.focus()}function me(){const{value:o}=d;o&&(E(),o.focus())}function ce(){const{value:o}=d;o&&o.blur()}function Ie(o){const{value:l}=s;l&&l.setTextContent(`+${o}`)}function Re(){const{value:o}=R;return o}function Fe(){return d.value}let he=null;function be(){he!==null&&window.clearTimeout(he)}function ke(){e.disabled||e.active||(be(),he=window.setTimeout(()=>{M.value=!0},100))}function Te(){be()}function ze(o){o||(be(),M.value=!1)}lt(()=>{st(()=>{const o=g.value;!o||(o.tabIndex=e.disabled||S.value?-1:0)})});const{inlineThemeDisabled:we}=e,Ce=B(()=>{const{size:o}=e,{common:{cubicBezierEaseInOut:l},self:{borderRadius:_,color:Be,placeholderColor:_e,textColor:$e,paddingSingle:xe,paddingMultiple:ye,caretColor:Ae,colorDisabled:ge,textColorDisabled:Ee,placeholderColorDisabled:Se,colorActive:oe,boxShadowFocus:t,boxShadowActive:i,boxShadowHover:v,border:F,borderFocus:h,borderHover:T,borderActive:z,arrowColor:fe,arrowColorDisabled:Pe,loadingColor:Le,colorActiveWarning:Ue,boxShadowFocusWarning:Ke,boxShadowActiveWarning:ft,boxShadowHoverWarning:vt,borderWarning:ht,borderFocusWarning:bt,borderHoverWarning:gt,borderActiveWarning:pt,colorActiveError:mt,boxShadowFocusError:wt,boxShadowActiveError:Ct,boxShadowHoverError:xt,borderError:yt,borderFocusError:St,borderHoverError:Pt,borderActiveError:Ot,clearColor:Mt,clearColorHover:It,clearColorPressed:Rt,clearSize:Ft,arrowSize:kt,[Qe("height",o)]:Tt,[Qe("fontSize",o)]:zt}}=C.value;return{"--n-bezier":l,"--n-border":F,"--n-border-active":z,"--n-border-focus":h,"--n-border-hover":T,"--n-border-radius":_,"--n-box-shadow-active":i,"--n-box-shadow-focus":t,"--n-box-shadow-hover":v,"--n-caret-color":Ae,"--n-color":Be,"--n-color-active":oe,"--n-color-disabled":ge,"--n-font-size":zt,"--n-height":Tt,"--n-padding-single":xe,"--n-padding-multiple":ye,"--n-placeholder-color":_e,"--n-placeholder-color-disabled":Se,"--n-text-color":$e,"--n-text-color-disabled":Ee,"--n-arrow-color":fe,"--n-arrow-color-disabled":Pe,"--n-loading-color":Le,"--n-color-active-warning":Ue,"--n-box-shadow-focus-warning":Ke,"--n-box-shadow-active-warning":ft,"--n-box-shadow-hover-warning":vt,"--n-border-warning":ht,"--n-border-focus-warning":bt,"--n-border-hover-warning":gt,"--n-border-active-warning":pt,"--n-color-active-error":mt,"--n-box-shadow-focus-error":wt,"--n-box-shadow-active-error":Ct,"--n-box-shadow-hover-error":xt,"--n-border-error":yt,"--n-border-focus-error":St,"--n-border-hover-error":Pt,"--n-border-active-error":Ot,"--n-clear-size":Ft,"--n-clear-color":Mt,"--n-clear-color-hover":It,"--n-clear-color-pressed":Rt,"--n-arrow-size":kt}}),te=we?qe("internal-selection",B(()=>e.size[0]),Ce,e):void 0;return{mergedTheme:C,mergedClearable:y,patternInputFocused:S,filterablePlaceholder:$,label:O,selected:A,showTagsPanel:M,isCompositing:Z,counterRef:s,counterWrapperRef:R,patternInputMirrorRef:r,patternInputRef:d,selfRef:f,multipleElRef:u,singleElRef:w,patternInputWrapperRef:g,overflowRef:p,inputTagElRef:b,handleMouseDown:ee,handleFocusin:ae,handleClear:ue,handleMouseEnter:ne,handleMouseLeave:ie,handleDeleteOption:le,handlePatternKeyDown:G,handlePatternInputInput:q,handlePatternInputBlur:L,handlePatternInputFocus:c,handleMouseEnterCounter:ke,handleMouseLeaveCounter:Te,handleFocusout:de,handleCompositionEnd:a,handleCompositionStart:X,onPopoverUpdateShow:ze,focus:Q,focusInput:me,blur:N,blurInput:ce,updateCounter:Ie,getCounter:Re,getTail:Fe,renderLabel:e.renderLabel,cssVars:we?void 0:Ce,themeClass:te==null?void 0:te.themeClass,onRender:te==null?void 0:te.onRender}},render(){const{status:e,multiple:r,size:d,disabled:f,filterable:u,maxTagCount:w,bordered:g,clsPrefix:s,onRender:R,renderTag:p,renderLabel:b}=this;R==null||R();const M=w==="responsive",S=typeof w=="number",P=M||S,C=n(Lt,{clsPrefix:s,loading:this.loading,showArrow:this.showArrow,showClear:this.mergedClearable&&this.selected,onClear:this.handleClear},{default:()=>{var $,O;return(O=($=this.$slots).arrow)===null||O===void 0?void 0:O.call($)}});let y;if(r){const $=I=>n("div",{class:`${s}-base-selection-tag-wrapper`,key:I.value},p?p({option:I,handleClose:()=>this.handleDeleteOption(I)}):n(He,{size:d,closable:!I.disabled,disabled:f,internalStopClickPropagation:!0,onClose:()=>this.handleDeleteOption(I)},{default:()=>b?b(I,!0):Ve(I.label,I,!0)})),O=(S?this.selectedOptions.slice(0,w):this.selectedOptions).map($),A=u?n("div",{class:`${s}-base-selection-input-tag`,ref:"inputTagElRef",key:"__input-tag__"},n("input",Object.assign({},this.inputProps,{ref:"patternInputRef",tabindex:-1,disabled:f,value:this.pattern,autofocus:this.autofocus,class:`${s}-base-selection-input-tag__input`,onBlur:this.handlePatternInputBlur,onFocus:this.handlePatternInputFocus,onKeydown:this.handlePatternKeyDown,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),n("span",{ref:"patternInputMirrorRef",class:`${s}-base-selection-input-tag__mirror`},this.pattern)):null,j=M?()=>n("div",{class:`${s}-base-selection-tag-wrapper`,ref:"counterWrapperRef"},n(He,{size:d,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,onMouseleave:this.handleMouseLeaveCounter,disabled:f})):void 0;let K;if(S){const I=this.selectedOptions.length-w;I>0&&(K=n("div",{class:`${s}-base-selection-tag-wrapper`,key:"__counter__"},n(He,{size:d,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,disabled:f},{default:()=>`+${I}`})))}const E=M?u?n(at,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,getTail:this.getTail,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:()=>O,counter:j,tail:()=>A}):n(at,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:()=>O,counter:j}):S?O.concat(K):O,k=P?()=>n("div",{class:`${s}-base-selection-popover`},M?O:this.selectedOptions.map($)):void 0,W=P?{show:this.showTagsPanel,trigger:"hover",overlap:!0,placement:"top",width:"trigger",onUpdateShow:this.onPopoverUpdateShow,theme:this.mergedTheme.peers.Popover,themeOverrides:this.mergedTheme.peerOverrides.Popover}:null,V=(this.selected?!1:this.active?!this.pattern&&!this.isCompositing:!0)?n("div",{class:`${s}-base-selection-placeholder ${s}-base-selection-overlay`},this.placeholder):null;if(u){const I=n("div",{ref:"patternInputWrapperRef",class:`${s}-base-selection-tags`},E,M?null:A,C);y=n(Ge,null,P?n(Ye,Object.assign({},W),{trigger:()=>I,default:k}):I,V)}else{const I=n("div",{ref:"multipleElRef",class:`${s}-base-selection-tags`,tabindex:f?void 0:0},E,C);y=n(Ge,null,P?n(Ye,Object.assign({},W),{trigger:()=>I,default:k}):I,V)}}else if(u){const $=this.pattern||this.isCompositing,O=this.active?!$:!this.selected,A=this.active?!1:this.selected;y=n("div",{ref:"patternInputWrapperRef",class:`${s}-base-selection-label`},n("input",Object.assign({},this.inputProps,{ref:"patternInputRef",class:`${s}-base-selection-input`,value:this.active?this.pattern:"",placeholder:"",readonly:f,disabled:f,tabindex:-1,autofocus:this.autofocus,onFocus:this.handlePatternInputFocus,onBlur:this.handlePatternInputBlur,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),A?n("div",{class:`${s}-base-selection-label__render-label ${s}-base-selection-overlay`,key:"input"},n("div",{class:`${s}-base-selection-overlay__wrapper`},p?p({option:this.selectedOption,handleClose:()=>{}}):b?b(this.selectedOption,!0):Ve(this.label,this.selectedOption,!0))):null,O?n("div",{class:`${s}-base-selection-placeholder ${s}-base-selection-overlay`,key:"placeholder"},n("div",{class:`${s}-base-selection-overlay__wrapper`},this.filterablePlaceholder)):null,C)}else y=n("div",{ref:"singleElRef",class:`${s}-base-selection-label`,tabindex:this.disabled?void 0:0},this.label!==void 0?n("div",{class:`${s}-base-selection-input`,title:Dt(this.label),key:"input"},n("div",{class:`${s}-base-selection-input__content`},p?p({option:this.selectedOption,handleClose:()=>{}}):b?b(this.selectedOption,!0):Ve(this.label,this.selectedOption,!0))):n("div",{class:`${s}-base-selection-placeholder ${s}-base-selection-overlay`,key:"placeholder"},this.placeholder),C);return n("div",{ref:"selfRef",class:[`${s}-base-selection`,this.themeClass,e&&`${s}-base-selection--${e}-status`,{[`${s}-base-selection--active`]:this.active,[`${s}-base-selection--selected`]:this.selected||this.active&&this.pattern,[`${s}-base-selection--disabled`]:this.disabled,[`${s}-base-selection--multiple`]:this.multiple,[`${s}-base-selection--focus`]:this.focused}],style:this.cssVars,onClick:this.onClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onKeyup:this.onKeyup,onKeydown:this.onKeydown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onMousedown:this.handleMouseDown},y,g?n("div",{class:`${s}-base-selection__border`}):null,g?n("div",{class:`${s}-base-selection__state-border`}):null)}});function sn(e){return We(e)?e.name||e.key||"key-required":e.value}function We(e){return e.type==="group"}function ct(e){return e.type==="ignored"}const dn={getKey:sn,getIsGroup:We,getIgnored:ct};function it(e,r){try{return!!(1+r.toString().toLowerCase().indexOf(e.trim().toLowerCase()))}catch{return!1}}function un(e,r,d){if(!r)return e;function f(u){if(!Array.isArray(u))return[];const w=[];for(const g of u)if(We(g)){const s=f(g.children);s.length&&w.push(Object.assign({},g,{children:s}))}else{if(ct(g))continue;r(d,g)&&w.push(g)}return w}return f(e)}function cn(e){const r=new Map;return e.forEach(d=>{We(d)?d.children.forEach(f=>{r.set(f.value,f)}):r.set(d.value,d)}),r}function fn(e,r){return r?typeof r.label=="string"?it(e,r.label):r.value!==void 0?it(e,String(r.value)):!1:!1}var vn=re([x("select",` - z-index: auto; - outline: none; - width: 100%; - position: relative; - `),x("select-menu",` - margin: 4px 0; - box-shadow: var(--n-menu-box-shadow); - `,[jt()])]);const hn=Object.assign(Object.assign({},Me.props),{to:Je.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:{type:Function,default:fn},placement:{type:String,default:"bottom-start"},widthMode:{type:String,default:"trigger"},tag:Boolean,onCreate:{type:Function,default:e=>({label:e,value:e})},fallbackOption:{type:[Function,Boolean],default:()=>e=>({label:String(e),value:e})},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:"show"},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,onChange:[Function,Array],items:Array});var bn=se({name:"Select",props:hn,setup(e){const{mergedClsPrefixRef:r,mergedBorderedRef:d,namespaceRef:f,inlineThemeDisabled:u}=dt(e),w=Me("Select","-select",vn,Vt,e,r),g=m(e.defaultValue),s=ve(e,"value"),R=Ne(s,g),p=m(!1),b=m(""),M=B(()=>Nt(I.value,dn)),S=B(()=>cn(V.value)),P=m(!1),C=Ne(ve(e,"show"),P),y=m(null),$=m(null),O=m(null),{localeRef:A}=ut("Select"),j=B(()=>{var t;return(t=e.placeholder)!==null&&t!==void 0?t:A.value.placeholder}),K=Wt(e,["items","options"]),E=m([]),k=m([]),W=m(new Map),H=B(()=>{const{fallbackOption:t}=e;return t?i=>Object.assign(t(i),{value:i}):!1}),V=B(()=>k.value.concat(E.value).concat(K.value)),I=B(()=>{if(e.remote)return K.value;{const{value:t}=V,{value:i}=b;if(!i.length||!e.filterable)return t;{const{filter:v}=e;return un(t,v,i)}}});function ae(t){const i=e.remote,{value:v}=W,{value:F}=S,{value:h}=H,T=[];return t.forEach(z=>{if(F.has(z))T.push(F.get(z));else if(i&&v.has(z))T.push(v.get(z));else if(h){const fe=h(z);fe&&T.push(fe)}}),T}const de=B(()=>{if(e.multiple){const{value:t}=R;return Array.isArray(t)?ae(t):[]}return null}),ue=B(()=>{const{value:t}=R;return!e.multiple&&!Array.isArray(t)?t===null?null:ae([t])[0]||null:null}),ne=Ut(e),{mergedSizeRef:ie,mergedDisabledRef:ee,mergedStatusRef:le}=ne;function G(t,i){const{onChange:v,"onUpdate:value":F,onUpdateValue:h}=e,{nTriggerFormChange:T,nTriggerFormInput:z}=ne;v&&U(v,t,i),h&&U(h,t,i),F&&U(F,t,i),g.value=t,T(),z()}function Z(t){const{onBlur:i}=e,{nTriggerFormBlur:v}=ne;i&&U(i,t),v()}function J(){const{onClear:t}=e;t&&U(t)}function q(t){const{onFocus:i}=e,{nTriggerFormFocus:v}=ne;i&&U(i,t),v()}function X(t){const{onSearch:i}=e;i&&U(i,t)}function a(t){const{onScroll:i}=e;i&&U(i,t)}function c(){var t;const{remote:i,multiple:v}=e;if(i){const{value:F}=W;if(v)(t=de.value)===null||t===void 0||t.forEach(h=>{F.set(h.value,h)});else{const h=ue.value;h&&F.set(h.value,h)}}}function L(t){const{onUpdateShow:i,"onUpdate:show":v}=e;i&&U(i,t),v&&U(v,t),P.value=t}function N(){ee.value||(L(!0),P.value=!0,e.filterable&&Ae())}function Q(){L(!1)}function me(){b.value="",k.value=[]}const ce=m(!1);function Ie(){e.filterable&&(ce.value=!0)}function Re(){e.filterable&&(ce.value=!1,C.value||me())}function Fe(){ee.value||(C.value?e.filterable||Q():N())}function he(t){var i,v;!((v=(i=O.value)===null||i===void 0?void 0:i.selfRef)===null||v===void 0)&&v.contains(t.relatedTarget)||(p.value=!1,Z(t),Q())}function be(t){q(t),p.value=!0}function ke(t){p.value=!0}function Te(t){var i;!((i=y.value)===null||i===void 0)&&i.$el.contains(t.relatedTarget)||(p.value=!1,Z(t),Q())}function ze(){var t;(t=y.value)===null||t===void 0||t.focus(),Q()}function we(t){var i;C.value&&(!((i=y.value)===null||i===void 0)&&i.$el.contains(t.target)||Q())}function Ce(t){if(!Array.isArray(t))return[];if(H.value)return Array.from(t);{const{remote:i}=e,{value:v}=S;if(i){const{value:F}=W;return t.filter(h=>v.has(h)||F.has(h))}else return t.filter(F=>v.has(F))}}function te(t){o(t.rawNode)}function o(t){if(ee.value)return;const{tag:i,remote:v,clearFilterAfterSelect:F}=e;if(i&&!v){const{value:h}=k,T=h[0]||null;T&&(E.value.push(T),k.value=[])}if(v&&W.value.set(t.value,t),e.multiple){const h=Ce(R.value),T=h.findIndex(z=>z===t.value);if(~T){if(h.splice(T,1),i&&!v){const z=l(t.value);~z&&(E.value.splice(z,1),F&&(b.value=""))}}else h.push(t.value),F&&(b.value="");G(h,ae(h))}else{if(i&&!v){const h=l(t.value);~h?E.value=[E.value[h]]:E.value=[]}ye(),Q(),G(t.value,t)}}function l(t){return E.value.findIndex(v=>v.value===t)}function _(t){C.value||N();const{value:i}=t.target;b.value=i;const{tag:v,remote:F}=e;if(X(i),v&&!F){if(!i){k.value=[];return}const h=e.onCreate(i);K.value.some(T=>T.value===h.value)||E.value.some(T=>T.value===h.value)?k.value=[]:k.value=[h]}}function Be(t){t.stopPropagation();const{multiple:i}=e;!i&&e.filterable&&Q(),J(),i?G([],[]):G(null,null)}function _e(t){Gt(t,"action")||t.preventDefault()}function $e(t){a(t)}function xe(t){var i,v,F,h,T;switch(t.code){case"Space":if(e.filterable)break;t.preventDefault();case"Enter":case"NumpadEnter":if(!(!((i=y.value)===null||i===void 0)&&i.isCompositing)){if(C.value){const z=(v=O.value)===null||v===void 0?void 0:v.getPendingTmNode();z?te(z):e.filterable||(Q(),ye())}else if(N(),e.tag&&ce.value){const z=k.value[0];if(z){const fe=z.value,{value:Pe}=R;e.multiple&&Array.isArray(Pe)&&Pe.some(Le=>Le===fe)||o(z)}}}t.preventDefault();break;case"ArrowUp":if(t.preventDefault(),e.loading)return;C.value&&((F=O.value)===null||F===void 0||F.prev());break;case"ArrowDown":if(t.preventDefault(),e.loading)return;C.value?(h=O.value)===null||h===void 0||h.next():N();break;case"Escape":Q(),(T=y.value)===null||T===void 0||T.focus();break}}function ye(){var t;(t=y.value)===null||t===void 0||t.focus()}function Ae(){var t;(t=y.value)===null||t===void 0||t.focusInput()}function ge(){var t;(t=$.value)===null||t===void 0||t.syncPosition()}c(),De(ve(e,"options"),c),De(I,()=>{!C.value||je(ge)}),De(R,()=>{!C.value||je(ge)});const Ee={focus:()=>{var t;(t=y.value)===null||t===void 0||t.focus()},blur:()=>{var t;(t=y.value)===null||t===void 0||t.blur()}},Se=B(()=>{const{self:{menuBoxShadow:t}}=w.value;return{"--n-menu-box-shadow":t}}),oe=u?qe("select",void 0,Se,e):void 0;return Object.assign(Object.assign({},Ee),{mergedStatus:le,mergedClsPrefix:r,mergedBordered:d,namespace:f,treeMate:M,isMounted:Kt(),triggerRef:y,menuRef:O,pattern:b,uncontrolledShow:P,mergedShow:C,adjustedTo:Je(e),uncontrolledValue:g,mergedValue:R,followerRef:$,localizedPlaceholder:j,selectedOption:ue,selectedOptions:de,mergedSize:ie,mergedDisabled:ee,focused:p,activeWithoutMenuOpen:ce,inlineThemeDisabled:u,onTriggerInputFocus:Ie,onTriggerInputBlur:Re,handleMenuFocus:ke,handleMenuBlur:Te,handleMenuTabOut:ze,handleTriggerClick:Fe,handleToggle:te,handleDeleteOption:o,handlePatternInput:_,handleClear:Be,handleTriggerBlur:he,handleTriggerFocus:be,handleKeydown:xe,syncPosition:ge,handleMenuAfterLeave:me,handleMenuClickOutside:we,handleMenuScroll:$e,handleMenuKeydown:xe,handleMenuMousedown:_e,mergedTheme:w,cssVars:u?void 0:Se,themeClass:oe==null?void 0:oe.themeClass,onRender:oe==null?void 0:oe.onRender})},render(){return n("div",{class:`${this.mergedClsPrefix}-select`},n(Ht,null,{default:()=>[n(Zt,null,{default:()=>n(ln,{ref:"triggerRef",inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus},{arrow:()=>{var e,r;return[(r=(e=this.$slots).arrow)===null||r===void 0?void 0:r.call(e)]}})}),n(Jt,{ref:"followerRef",show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===Je.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?"target":void 0,minWidth:"target",placement:this.placement},{default:()=>n(qt,{name:"fade-in-scale-up-transition",appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var e,r,d;return this.mergedShow||this.displayDirective==="show"?((e=this.onRender)===null||e===void 0||e.call(this),Qt(n(on,Object.assign({},this.menuProps,{ref:"menuRef",inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,(r=this.menuProps)===null||r===void 0?void 0:r.class],clsPrefix:this.mergedClsPrefix,focusable:!0,autoPending:!0,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:"medium",renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[(d=this.menuProps)===null||d===void 0?void 0:d.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange}),{empty:()=>{var f,u;return[(u=(f=this.$slots).empty)===null||u===void 0?void 0:u.call(f)]},action:()=>{var f,u;return[(u=(f=this.$slots).action)===null||u===void 0?void 0:u.call(f)]}}),this.displayDirective==="show"?[[Yt,this.mergedShow],[Xe,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[Xe,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}});function gn(e,r,d=9){if(r===1)return[1];if(r===2)return[1,2];const f=1,u=r;let w=e,g=e;const s=(d-5)/2;g+=Math.ceil(s),g=Math.min(Math.max(g,f+d-3),u-2),w-=Math.floor(s),w=Math.max(Math.min(w,u-d+3),f+2);let R=!1,p=!1;w>f+2&&(R=!0),g=f+1&&b.push(f+1);for(let M=w;M<=g;++M)b.push(M);return p?b.push(-1):g===u-2&&b[b.length-1]!==u-1&&b.push(u-1),b[b.length-1]!==u&&b.push(u),b}function pn(e,r){return e.map(d=>{switch(d){case-2:return{type:"fast-backward",active:!1};case-1:return{type:"fast-forward",active:!1};default:return d===r?{type:"page",label:d,active:!0}:{type:"page",label:d,active:!1}}})}function mn(e,r,d){const f=gn(e,r,d);return pn(f,e)}var wn=x("pagination",` - display: flex; - vertical-align: middle; - font-size: var(--n-item-font-size); - flex-wrap: nowrap; -`,[x("pagination-prefix",` - display: flex; - align-items: center; - margin: var(--n-prefix-margin); - `),x("pagination-suffix",` - display: flex; - align-items: center; - margin: var(--n-suffix-margin); - `),re("> *:not(:first-child)",{margin:"var(--n-item-margin)"}),x("select",{width:"var(--n-select-width)"}),re("&.transition-disabled",[x("pagination-item",{transition:"none!important"})]),x("pagination-quick-jumper",` - white-space: nowrap; - display: flex; - color: var(--n-jumper-text-color); - transition: color .3s var(--n-bezier); - align-items: center; - font-size: var(--n-jumter-font-size); - `,[x("input",` - margin: var(--n-input-margin); - width: var(--n-input-width); - `)]),x("pagination-item",` - position: relative; - cursor: pointer; - user-select: none; - display: flex; - align-items: center; - justify-content: center; - box-sizing: border-box; - min-width: var(--n-item-size); - height: var(--n-item-size); - padding: var(--n-item-padding); - background-color: var(--n-item-color); - color: var(--n-item-text-color); - border-radius: var(--n-item-border-radius); - border: var(--n-item-border); - fill: var(--n-button-icon-color); - transition: - color .3s var(--n-bezier), - border-color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - fill .3s var(--n-bezier); - `,[Y("button",` - background: var(--n-button-color); - color: var(--n-button-icon-color); - border: var(--n-button-border); - `,[x("base-icon",` - font-size: var(--n-button-icon-size); - `)]),Ze("disabled",[re("&:hover",{background:"var(--n-item-color-hover)",color:"var(--n-item-text-color-hover)",border:"var(--n-item-border-hover)"},[Y("button",{background:"var(--n-button-color-hover)",border:"var(--n-button-border-hover)",color:"var(--n-button-icon-color-hover)"})]),re("&:active",{background:"var(--n-item-color-pressed)",color:"var(--n-item-text-color-pressed)",border:"var(--n-item-border-pressed)"},[Y("button",{background:"var(--n-button-color-pressed)",border:"var(--n-button-border-pressed)",color:"var(--n-button-icon-color-pressed)"})]),Y("active",{background:"var(--n-item-color-active)",color:"var(--n-item-text-color-active)",border:"var(--n-item-border-active)"},[re("&:hover",{background:"var(--n-item-color-active-hover)"})])]),Y("disabled",` - cursor: not-allowed; - color: var(--n-item-text-color-disabled); - `,[Y("active, button",{backgroundColor:"var(--n-item-color-disabled)",border:"var(--n-item-border-disabled)"})])]),Y("disabled",{cursor:"not-allowed"},[x("pagination-quick-jumper",{color:"var(--n-jumper-text-color-disabled)"})])]);const Cn=Object.assign(Object.assign({},Me.props),{page:Number,defaultPage:{type:Number,default:1},itemCount:Number,pageCount:Number,defaultPageCount:{type:Number,default:1},showSizePicker:Boolean,pageSize:Number,defaultPageSize:{type:Number,default:10},pageSizes:{type:Array,default(){return[10]}},showQuickJumper:Boolean,disabled:Boolean,pageSlot:{type:Number,default:9},prev:Function,next:Function,prefix:Function,suffix:Function,label:Function,"onUpdate:page":[Function,Array],onUpdatePage:[Function,Array],"onUpdate:pageSize":[Function,Array],onUpdatePageSize:[Function,Array],onPageSizeChange:[Function,Array],onChange:[Function,Array]});var Sn=se({name:"Pagination",props:Cn,setup(e){const{mergedComponentPropsRef:r,mergedClsPrefixRef:d,inlineThemeDisabled:f,mergedRtlRef:u}=dt(e),w=Me("Pagination","-pagination",wn,Xt,e,d),{localeRef:g}=ut("Pagination"),s=m(null),R=m(null),p=m(""),b=m(e.defaultPage),M=m(e.defaultPageSize),S=Ne(ve(e,"page"),b),P=Ne(ve(e,"pageSize"),M),C=B(()=>{const{itemCount:a}=e;if(a!==void 0)return Math.max(1,Math.ceil(a/P.value));const{pageCount:c}=e;return c!==void 0?c:1}),y=m(!1),$=m(!1),O=B(()=>{const a=g.value.selectionSuffix;return e.pageSizes.map(c=>typeof c=="number"?{label:`${c} / ${a}`,value:c}:c)}),A=B(()=>{var a,c;return((c=(a=r==null?void 0:r.value)===null||a===void 0?void 0:a.Pagination)===null||c===void 0?void 0:c.inputSize)||"small"}),j=B(()=>{var a,c;return((c=(a=r==null?void 0:r.value)===null||a===void 0?void 0:a.Pagination)===null||c===void 0?void 0:c.selectSize)||"small"}),K=B(()=>(S.value-1)*P.value),E=B(()=>{const a=S.value*P.value-1,{itemCount:c}=e;return c!==void 0&&a>c?c:a}),k=B(()=>{const{itemCount:a}=e;return a!==void 0?a:(e.pageCount||1)*P.value}),W=en("Pagination",u,d),H=()=>{je(()=>{var a;const{value:c}=s;!c||(c.classList.add("transition-disabled"),(a=s.value)===null||a===void 0||a.offsetWidth,c.classList.remove("transition-disabled"))})};function V(a){if(a===S.value)return;const{"onUpdate:page":c,onUpdatePage:L,onChange:N}=e;c&&U(c,a),L&&U(L,a),N&&U(N,a),b.value=a}function I(a){if(a===P.value)return;const{"onUpdate:pageSize":c,onUpdatePageSize:L,onPageSizeChange:N}=e;c&&U(c,a),L&&U(L,a),N&&U(N,a),M.value=a,C.value=1&&L<=C.value&&(V(L),p.value="",(c=R.value)===null||c===void 0||c.blur())}}function le(a){if(!e.disabled)switch(a.type){case"page":V(a.label);break;case"fast-backward":ne();break;case"fast-forward":ue();break}}function G(a){if(!e.disabled){switch(a.type){case"fast-backward":$.value=!0;break;case"fast-forward":y.value=!0;break;default:return}H()}}function Z(a){if(!e.disabled){switch(a.type){case"fast-backward":$.value=!1;break;case"fast-forward":y.value=!1;break;default:return}H()}}function J(a){p.value=a}st(()=>{S.value,P.value,H()});const q=B(()=>{const{self:{itemSize:a,itemPadding:c,itemMargin:L,itemMarginRtl:N,inputWidth:Q,selectWidth:me,inputMargin:ce,inputMarginRtl:Ie,selectMargin:Re,buttonBorder:Fe,buttonBorderHover:he,buttonBorderPressed:be,buttonIconColor:ke,buttonIconColorHover:Te,buttonIconColorPressed:ze,buttonIconSize:we,itemTextColor:Ce,itemTextColorHover:te,itemTextColorPressed:o,itemTextColorActive:l,itemTextColorDisabled:_,itemColor:Be,itemColorHover:_e,itemColorPressed:$e,itemColorActive:xe,itemColorActiveHover:ye,itemColorDisabled:Ae,itemBorder:ge,itemBorderHover:Ee,itemBorderPressed:Se,itemBorderActive:oe,itemBorderDisabled:t,itemBorderRadius:i,itemFontSize:v,jumperFontSize:F,jumperTextColor:h,jumperTextColorDisabled:T,prefixMargin:z,suffixMargin:fe,buttonColor:Pe,buttonColorHover:Le,buttonColorPressed:Ue},common:{cubicBezierEaseInOut:Ke}}=w.value;return{"--n-prefix-margin":z,"--n-suffix-margin":fe,"--n-item-font-size":v,"--n-select-width":me,"--n-select-margin":Re,"--n-input-width":Q,"--n-input-margin":ce,"--n-input-margin-rtl":Ie,"--n-item-size":a,"--n-item-text-color":Ce,"--n-item-text-color-disabled":_,"--n-item-text-color-hover":te,"--n-item-text-color-active":l,"--n-item-text-color-pressed":o,"--n-item-color":Be,"--n-item-color-hover":_e,"--n-item-color-disabled":Ae,"--n-item-color-active":xe,"--n-item-color-active-hover":ye,"--n-item-color-pressed":$e,"--n-item-border":ge,"--n-item-border-hover":Ee,"--n-item-border-disabled":t,"--n-item-border-active":oe,"--n-item-border-pressed":Se,"--n-item-padding":c,"--n-item-border-radius":i,"--n-bezier":Ke,"--n-jumper-font-size":F,"--n-jumper-text-color":h,"--n-jumper-text-color-disabled":T,"--n-item-margin":L,"--n-item-margin-rtl":N,"--n-button-icon-size":we,"--n-button-icon-color":ke,"--n-button-icon-color-hover":Te,"--n-button-icon-color-pressed":ze,"--n-button-color-hover":Le,"--n-button-color":Pe,"--n-button-color-pressed":Ue,"--n-button-border":Fe,"--n-button-border-hover":he,"--n-button-border-pressed":be}}),X=f?qe("pagination",void 0,q,e):void 0;return{rtlEnabled:W,mergedClsPrefix:d,locale:g,selfRef:s,jumperRef:R,mergedPage:S,showFastBackward:$,showFastForward:y,pageItems:B(()=>mn(S.value,C.value,e.pageSlot)),mergedItemCount:k,jumperValue:p,pageSizeOptions:O,mergedPageSize:P,inputSize:A,selectSize:j,mergedTheme:w,mergedPageCount:C,startIndex:K,endIndex:E,handleJumperInput:J,handleBackwardClick:de,handleForwardClick:ae,handlePageItemClick:le,handleSizePickerChange:ie,handleQuickJumperKeyUp:ee,handlePageItemMouseEnter:G,handlePageItemMouseLeave:Z,cssVars:f?void 0:q,themeClass:X==null?void 0:X.themeClass,onRender:X==null?void 0:X.onRender}},render(){const{$slots:e,mergedClsPrefix:r,disabled:d,cssVars:f,mergedPage:u,mergedPageCount:w,pageItems:g,showFastBackward:s,showFastForward:R,showSizePicker:p,showQuickJumper:b,mergedTheme:M,locale:S,inputSize:P,selectSize:C,mergedPageSize:y,pageSizeOptions:$,jumperValue:O,prev:A,next:j,prefix:K,suffix:E,label:k,handleJumperInput:W,handleSizePickerChange:H,handleBackwardClick:V,handlePageItemClick:I,handlePageItemMouseEnter:ae,handlePageItemMouseLeave:de,handleForwardClick:ue,handleQuickJumperKeyUp:ne,onRender:ie}=this;ie==null||ie();const ee=e.prefix||K,le=e.suffix||E,G=A||e.prev,Z=j||e.next,J=k||e.label;return n("div",{ref:"selfRef",class:[`${r}-pagination`,this.themeClass,this.rtlEnabled&&`${r}-pagination--rtl`,d&&`${r}-pagination--disabled`],style:f},ee?n("div",{class:`${r}-pagination-prefix`},ee({page:u,pageSize:y,pageCount:w,startIndex:this.startIndex,endIndex:this.endIndex,itemCount:this.mergedItemCount})):null,n("div",{class:[`${r}-pagination-item`,!G&&`${r}-pagination-item--button`,(u<=1||u>w||d)&&`${r}-pagination-item--disabled`],onClick:V},G?G({page:u,pageSize:y,pageCount:w,startIndex:this.startIndex,endIndex:this.endIndex,itemCount:this.mergedItemCount}):n(Oe,{clsPrefix:r},{default:()=>this.rtlEnabled?n(ot,null):n(et,null)})),g.map((q,X)=>{let a;switch(q.type){case"page":const c=q.label;J?a=J({type:"page",node:c,active:q.active}):a=c;break;case"fast-forward":const L=R?n(Oe,{clsPrefix:r},{default:()=>this.rtlEnabled?n(tt,null):n(nt,null)}):n(Oe,{clsPrefix:r},{default:()=>n(rt,null)});J?a=J({type:"fast-forward",node:L,active:R}):a=L;break;case"fast-backward":const N=s?n(Oe,{clsPrefix:r},{default:()=>this.rtlEnabled?n(nt,null):n(tt,null)}):n(Oe,{clsPrefix:r},{default:()=>n(rt,null)});J?a=J({type:"fast-backward",node:N,active:s}):a=N;break}return n("div",{key:X,class:[`${r}-pagination-item`,{[`${r}-pagination-item--active`]:q.active,[`${r}-pagination-item--disabled`]:d}],onClick:()=>I(q),onMouseenter:()=>ae(q),onMouseleave:()=>de(q)},a)}),n("div",{class:[`${r}-pagination-item`,!Z&&`${r}-pagination-item--button`,{[`${r}-pagination-item--disabled`]:u<1||u>=w||d}],onClick:ue},Z?Z({page:u,pageSize:y,pageCount:w,itemCount:this.mergedItemCount,startIndex:this.startIndex,endIndex:this.endIndex}):n(Oe,{clsPrefix:r},{default:()=>this.rtlEnabled?n(et,null):n(ot,null)})),p?n(bn,{size:C,placeholder:"",options:$,value:y,disabled:d,theme:M.peers.Select,themeOverrides:M.peerOverrides.Select,onUpdateValue:H}):null,b?n("div",{class:`${r}-pagination-quick-jumper`},tn(this.$slots.goto,()=>[S.goto]),n(nn,{ref:"jumperRef",value:O,onUpdateValue:W,size:P,placeholder:"",disabled:d,theme:M.peers.Input,themeOverrides:M.peerOverrides.Input,onKeyup:ne})):null,le?n("div",{class:`${r}-pagination-suffix`},le({page:u,pageSize:y,pageCount:w,startIndex:this.startIndex,endIndex:this.endIndex,itemCount:this.mergedItemCount})):null)}});export{Sn as _}; diff --git a/web/dist/assets/Post.db4b62c9.js b/web/dist/assets/Post.db4b62c9.js deleted file mode 100644 index f1fe2217..00000000 --- a/web/dist/assets/Post.db4b62c9.js +++ /dev/null @@ -1,57 +0,0 @@ -var Ne=Object.defineProperty,je=Object.defineProperties;var Me=Object.getOwnPropertyDescriptors;var be=Object.getOwnPropertySymbols;var Ve=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable;var we=(i,l,t)=>l in i?Ne(i,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[l]=t,X=(i,l)=>{for(var t in l||(l={}))Ve.call(l,t)&&we(i,t,l[t]);if(be)for(var t of be(l))qe.call(l,t)&&we(i,t,l[t]);return i},ee=(i,l)=>je(i,Me(l));import{l as he,p as ve,m as j,o as q,d as T,u as fe,q as ue,bC as Le,s as L,y as De,h as z,aa as se,e as He,I as xe,i as Ke,t as $e,K as Ee,J as W,z as We,N as Je,bu as Ge,bD as Qe,n as Be,bE as Ye,r as k,A as Ze,bF as Xe,bG as et,aM as tt,bH as st,k as Fe,V as c,W as g,Y as C,bI as ot,ah as oe,a6 as $,a3 as a,a4 as r,a8 as E,bJ as nt,_ as at,Z as re,al as ge,a9 as D,a5 as I,a2 as e,bK as it,ae as ce,aj as Ae,am as lt,ab as ie,a7 as J,bL as ut,ad as ye,$ as rt,a1 as ke,bM as ct,bN as pt,bO as dt,af as _t,bP as mt,bQ as vt,bR as ht,bS as ft,bT as gt,bU as yt,bV as kt,bW as Ct,an as bt,bX as wt,bp as xt,ag as $t,ai as Et,S as Bt,bY as Ft,bZ as Pt,b_ as Dt}from"./index.f480f018.js";import{_ as At}from"./InputGroup.f69c4956.js";import{f as le}from"./formatTime.02109bf5.js";import{p as Ce,a as Ie,H as It,C as zt,B as Rt,_ as Tt,b as St,c as Ot}from"./content.ef1e095a.js";import{_ as ze}from"./Thing.eef6b133.js";import{_ as Ut}from"./post-skeleton.39a35f5b.js";import{l as Nt,I as jt,_ as Mt,V as te}from"./IEnum.bfd96c78.js";import{_ as Vt,a as qt,b as Lt,c as Ht}from"./Upload.efe3adfd.js";import{M as Kt}from"./MoreHorizFilled.80db5156.js";import{_ as Wt}from"./main-nav.9110259b.js";import{_ as Jt}from"./List.49bcdf81.js";import{a as Gt,_ as Qt}from"./Skeleton.57e98fe3.js";var Yt=he("divider",` - position: relative; - display: flex; - width: 100%; - box-sizing: border-box; - font-size: 16px; - color: var(--n-text-color); - transition: - color .3s var(--n-bezier), - background-color .3s var(--n-bezier); -`,[ve("vertical",` - margin-top: 24px; - margin-bottom: 24px; - `,[ve("no-title",` - display: flex; - align-items: center; - `)]),j("title",` - display: flex; - align-items: center; - margin-left: 12px; - margin-right: 12px; - white-space: nowrap; - font-weight: var(--n-font-weight); - `),q("title-position-left",[j("line",[q("left",{width:"28px"})])]),q("title-position-right",[j("line",[q("right",{width:"28px"})])]),q("dashed",[j("line",` - background-color: #0000; - height: 0px; - width: 100%; - border-style: dashed; - border-width: 1px 0 0; - `)]),q("vertical",` - display: inline-block; - height: 1em; - margin: 0 8px; - vertical-align: middle; - width: 1px; - `),j("line",` - border: none; - transition: background-color .3s var(--n-bezier), border-color .3s var(--n-bezier); - height: 1px; - width: 100%; - margin: 0; - `),ve("dashed",[j("line",{backgroundColor:"var(--n-color)"})]),q("dashed",[j("line",{borderColor:"var(--n-color)"})]),q("vertical",{backgroundColor:"var(--n-color)"})]);const Zt=Object.assign(Object.assign({},ue.props),{titlePlacement:{type:String,default:"center"},dashed:Boolean,vertical:Boolean});var Xt=T({name:"Divider",props:Zt,setup(i){const{mergedClsPrefixRef:l,inlineThemeDisabled:t}=fe(i),u=ue("Divider","-divider",Yt,Le,i,l),f=L(()=>{const{common:{cubicBezierEaseInOut:p},self:{color:_,textColor:n,fontWeight:b}}=u.value;return{"--n-bezier":p,"--n-color":_,"--n-text-color":n,"--n-font-weight":b}}),d=t?De("divider",void 0,f,i):void 0;return{mergedClsPrefix:l,cssVars:t?void 0:f,themeClass:d==null?void 0:d.themeClass,onRender:d==null?void 0:d.onRender}},render(){var i;const{$slots:l,titlePlacement:t,vertical:u,dashed:f,cssVars:d,mergedClsPrefix:p}=this;return(i=this.onRender)===null||i===void 0||i.call(this),z("div",{role:"separator",class:[`${p}-divider`,this.themeClass,{[`${p}-divider--vertical`]:u,[`${p}-divider--no-title`]:!l.default,[`${p}-divider--dashed`]:f,[`${p}-divider--title-position-${t}`]:l.default&&t}],style:d},u?null:z("div",{class:`${p}-divider__line ${p}-divider__line--left`}),!u&&l.default?z(se,null,z("div",{class:`${p}-divider__title`},this.$slots),z("div",{class:`${p}-divider__line ${p}-divider__line--right`})):null)}});const Re=He("n-popconfirm"),Te={positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0}},Pe=Qe(Te);var es=T({name:"NPopconfirmPanel",props:Te,setup(i){const{localeRef:l}=xe("Popconfirm"),{inlineThemeDisabled:t}=fe(),{mergedClsPrefixRef:u,mergedThemeRef:f,props:d}=Ke(Re),p=L(()=>{const{common:{cubicBezierEaseInOut:n},self:{fontSize:b,iconSize:h,iconColor:v}}=f.value;return{"--n-bezier":n,"--n-font-size":b,"--n-icon-size":h,"--n-icon-color":v}}),_=t?De("popconfirm-panel",void 0,p,d):void 0;return Object.assign(Object.assign({},xe("Popconfirm")),{mergedClsPrefix:u,cssVars:t?void 0:p,localizedPositiveText:L(()=>i.positiveText||l.value.positiveText),localizedNegativeText:L(()=>i.negativeText||l.value.negativeText),positiveButtonProps:$e(d,"positiveButtonProps"),negativeButtonProps:$e(d,"negativeButtonProps"),handlePositiveClick(n){i.onPositiveClick(n)},handleNegativeClick(n){i.onNegativeClick(n)},themeClass:_==null?void 0:_.themeClass,onRender:_==null?void 0:_.onRender})},render(){var i;const{mergedClsPrefix:l,showIcon:t,$slots:u}=this,f=Ee(u.action,()=>this.negativeText===null&&this.positiveText===null?[]:[this.negativeText!==null&&z(W,Object.assign({size:"small",onClick:this.handleNegativeClick},this.negativeButtonProps),{default:()=>this.localizedNegativeText}),this.positiveText!==null&&z(W,Object.assign({size:"small",type:"primary",onClick:this.handlePositiveClick},this.positiveButtonProps),{default:()=>this.localizedPositiveText})]);return(i=this.onRender)===null||i===void 0||i.call(this),z("div",{class:[`${l}-popconfirm__panel`,this.themeClass],style:this.cssVars},We(u.default,d=>t||d?z("div",{class:`${l}-popconfirm__body`},t?z("div",{class:`${l}-popconfirm__icon`},Ee(u.icon,()=>[z(Je,{clsPrefix:l},{default:()=>z(Ge,null)})])):null,d):null),f?z("div",{class:[`${l}-popconfirm__action`]},f):null)}}),ts=he("popconfirm",[j("body",` - font-size: var(--n-font-size); - display: flex; - align-items: center; - flex-wrap: nowrap; - position: relative; - `,[j("icon",` - display: flex; - font-size: var(--n-icon-size); - color: var(--n-icon-color); - transition: color .3s var(--n-bezier); - margin: 0 8px 0 0; - `)]),j("action",` - display: flex; - justify-content: flex-end; - `,[Be("&:not(:first-child)","margin-top: 8px"),he("button",[Be("&:not(:last-child)","margin-right: 8px;")])])]);const ss=Object.assign(Object.assign(Object.assign({},ue.props),st),{positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},trigger:{type:String,default:"click"},positiveButtonProps:Object,negativeButtonProps:Object,onPositiveClick:Function,onNegativeClick:Function});var Se=T({name:"Popconfirm",props:ss,__popover__:!0,setup(i){const{mergedClsPrefixRef:l}=fe(),t=ue("Popconfirm","-popconfirm",ts,Ye,i,l),u=k(null);function f(_){const{onPositiveClick:n,"onUpdate:show":b}=i;Promise.resolve(n?n(_):!0).then(h=>{var v;h!==!1&&((v=u.value)===null||v===void 0||v.setShow(!1),b&&Fe(b,!1))})}function d(_){const{onNegativeClick:n,"onUpdate:show":b}=i;Promise.resolve(n?n(_):!0).then(h=>{var v;h!==!1&&((v=u.value)===null||v===void 0||v.setShow(!1),b&&Fe(b,!1))})}return Ze(Re,{mergedThemeRef:t,mergedClsPrefixRef:l,props:i}),Object.assign(Object.assign({},{setShow(_){var n;(n=u.value)===null||n===void 0||n.setShow(_)},syncPosition(){var _;(_=u.value)===null||_===void 0||_.syncPosition()}}),{mergedTheme:t,popoverInstRef:u,handlePositiveClick:f,handleNegativeClick:d})},render(){const{$slots:i,$props:l,mergedTheme:t}=this;return z(tt,et(l,Pe,{theme:t.peers.Popover,themeOverrides:t.peerOverrides.Popover,internalExtraClass:["popconfirm"],ref:"popoverInstRef"}),{trigger:i.activator||i.trigger,default:()=>{const u=Xe(l,Pe);return z(es,Object.assign(Object.assign({},u),{onPositiveClick:this.handlePositiveClick,onNegativeClick:this.handleNegativeClick}),i)}})}});const os={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ns=C("path",{d:"M400 480a16 16 0 0 1-10.63-4L256 357.41L122.63 476A16 16 0 0 1 96 464V96a64.07 64.07 0 0 1 64-64h192a64.07 64.07 0 0 1 64 64v368a16 16 0 0 1-16 16z",fill:"currentColor"},null,-1),as=[ns];var is=T({name:"Bookmark",render:function(l,t){return c(),g("svg",os,as)}});const ls={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},us=C("path",{d:"M256 448a32 32 0 0 1-18-5.57c-78.59-53.35-112.62-89.93-131.39-112.8c-40-48.75-59.15-98.8-58.61-153C48.63 114.52 98.46 64 159.08 64c44.08 0 74.61 24.83 92.39 45.51a6 6 0 0 0 9.06 0C278.31 88.81 308.84 64 352.92 64c60.62 0 110.45 50.52 111.08 112.64c.54 54.21-18.63 104.26-58.61 153c-18.77 22.87-52.8 59.45-131.39 112.8a32 32 0 0 1-18 5.56z",fill:"currentColor"},null,-1),rs=[us];var cs=T({name:"Heart",render:function(l,t){return c(),g("svg",ls,rs)}});const ps={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},ds=ot('',1),_s=[ds];var Oe=T({name:"Trash",render:function(l,t){return c(),g("svg",ps,_s)}});const ms={class:"reply-compose-wrap"},vs={class:"reply-switch"},hs={key:0,class:"reply-input-wrap"},fs=E(" \u56DE\u590D "),gs=T({props:{commentId:{default:0},atUserid:{default:0},atUsername:{default:""}},emits:["reload","reset"],setup(i,{expose:l,emit:t}){const u=i,f=k(),d=k(!1),p=k(""),_=k(!1),n=h=>{d.value=h,h?setTimeout(()=>{var v;(v=f.value)==null||v.focus()},10):(_.value=!1,p.value="",t("reset"))},b=()=>{_.value=!0,nt({comment_id:u.commentId,at_user_id:u.atUserid,content:p.value}).then(h=>{n(!1),window.$message.success("\u8BC4\u8BBA\u6210\u529F"),t("reload")}).catch(h=>{_.value=!1})};return l({switchReply:n}),(h,v)=>{const A=at,s=W,B=At;return c(),g("div",ms,[C("div",vs,[d.value?$("",!0):(c(),g("span",{key:0,class:"show",onClick:v[0]||(v[0]=x=>n(!0))}," \u56DE\u590D ")),d.value?(c(),g("span",{key:1,class:"hide",onClick:v[1]||(v[1]=x=>n(!1))}," \u53D6\u6D88 ")):$("",!0)]),d.value?(c(),g("div",hs,[a(B,null,{default:r(()=>[a(A,{ref_key:"inputInstRef",ref:f,size:"small",placeholder:u.atUsername?"@"+u.atUsername:"\u8BF7\u8F93\u5165\u56DE\u590D\u5185\u5BB9..",maxlength:"100",value:p.value,"onUpdate:value":v[2]||(v[2]=x=>p.value=x),"show-count":"",clearable:""},null,8,["placeholder","value"]),a(s,{type:"primary",size:"small",ghost:"",loading:_.value,onClick:b},{default:r(()=>[fs]),_:1},8,["loading"])]),_:1})])):$("",!0)])}}});var ys=oe(gs,[["__scopeId","data-v-3616e66c"]]);const ks={class:"reply-item"},Cs={class:"header-wrap"},bs={class:"username"},ws={class:"reply-name"},xs={class:"timestamp"},$s=E(" \u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F "),Es={class:"base-wrap"},Bs={class:"content"},Fs={key:0,class:"reply-switch"},Ps=T({props:{reply:null},emits:["focusReply","reload"],setup(i,{emit:l}){const t=i,u=re(),f=()=>{l("focusReply",t.reply)},d=()=>{it({id:t.reply.id}).then(p=>{window.$message.success("\u5220\u9664\u6210\u529F"),setTimeout(()=>{l("reload")},50)}).catch(p=>{console.log(p)})};return(p,_)=>{const n=ge("router-link"),b=ce,h=W,v=Se;return c(),g("div",ks,[C("div",Cs,[C("div",bs,[a(n,{class:"user-link",to:{name:"user",query:{username:t.reply.user.username}}},{default:r(()=>[E(D(t.reply.user.username),1)]),_:1},8,["to"]),C("span",ws,D(t.reply.at_user_id>0?"\u56DE\u590D":":"),1),t.reply.at_user_id>0?(c(),I(n,{key:0,class:"user-link",to:{name:"user",query:{username:t.reply.at_user.username}}},{default:r(()=>[E(D(t.reply.at_user.username),1)]),_:1},8,["to"])):$("",!0)]),C("div",xs,[E(D(t.reply.ip_loc?t.reply.ip_loc+" \xB7 ":t.reply.ip_loc)+" "+D(e(le)(t.reply.created_on))+" ",1),e(u).state.userInfo.is_admin||e(u).state.userInfo.id===t.reply.user.id?(c(),I(v,{key:0,"negative-text":"\u53D6\u6D88","positive-text":"\u786E\u8BA4",onPositiveClick:d},{trigger:r(()=>[a(h,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:r(()=>[a(b,null,{default:r(()=>[a(e(Oe))]),_:1})]),_:1})]),default:r(()=>[$s]),_:1})):$("",!0)])]),C("div",Es,[C("div",Bs,D(t.reply.content),1),e(u).state.userInfo.id>0?(c(),g("div",Fs,[C("span",{class:"show",onClick:f}," \u56DE\u590D ")])):$("",!0)])])}}});var Ds=oe(Ps,[["__scopeId","data-v-1e3df20d"]]);const As={class:"comment-item"},Is={class:"nickname-wrap"},zs={class:"username-wrap"},Rs={class:"opt-wrap"},Ts={class:"timestamp"},Ss=E(" \u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F "),Os=["innerHTML"],Us={class:"reply-wrap"},Ns=T({props:{comment:null},emits:["reload"],setup(i,{emit:l}){const t=i,u=re(),f=Ae(),d=k(0),p=k(""),_=k(),n=L(()=>{let B=Object.assign({texts:[],imgs:[]},t.comment);return B.contents.map(x=>{(+x.type==1||+x.type==2)&&B.texts.push(x),+x.type==3&&B.imgs.push(x)}),B}),b=(B,x)=>{let R=B.target;if(R.dataset.detail){const S=R.dataset.detail.split(":");S.length===2&&(u.commit("refresh"),S[0]==="tag"?window.$message.warning("\u8BC4\u8BBA\u5185\u7684\u65E0\u6548\u8BDD\u9898"):f.push({name:"user",query:{username:S[1]}}))}},h=B=>{var x,R;d.value=B.user_id,p.value=((x=B.user)==null?void 0:x.username)||"",(R=_.value)==null||R.switchReply(!0)},v=()=>{l("reload")},A=()=>{d.value=0,p.value=""},s=()=>{ut({id:n.value.id}).then(B=>{window.$message.success("\u5220\u9664\u6210\u529F"),setTimeout(()=>{v()},50)}).catch(B=>{})};return(B,x)=>{const R=ye,S=ge("router-link"),H=ce,K=W,M=Se,G=Ie,Q=Ds,Y=ys,o=ze;return c(),g("div",As,[a(o,{"content-indented":""},lt({avatar:r(()=>[a(R,{round:"",size:30,src:e(n).user.avatar},null,8,["src"])]),header:r(()=>[C("span",Is,[a(S,{onClick:x[0]||(x[0]=J(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e(n).user.username}}},{default:r(()=>[E(D(e(n).user.nickname),1)]),_:1},8,["to"])]),C("span",zs," @"+D(e(n).user.username),1)]),"header-extra":r(()=>[C("div",Rs,[C("span",Ts,D(e(n).ip_loc?e(n).ip_loc+" \xB7 ":e(n).ip_loc)+" "+D(e(le)(e(n).created_on)),1),e(u).state.userInfo.is_admin||e(u).state.userInfo.id===e(n).user.id?(c(),I(M,{key:0,"negative-text":"\u53D6\u6D88","positive-text":"\u786E\u8BA4",onPositiveClick:s},{trigger:r(()=>[a(K,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:r(()=>[a(H,null,{default:r(()=>[a(e(Oe))]),_:1})]),_:1})]),default:r(()=>[Ss]),_:1})):$("",!0)])]),footer:r(()=>[e(n).imgs.length>0?(c(),I(G,{key:0,imgs:e(n).imgs},null,8,["imgs"])):$("",!0),C("div",Us,[(c(!0),g(se,null,ie(e(n).replies,m=>(c(),I(Q,{key:m.id,reply:m,onFocusReply:h,onReload:v},null,8,["reply"]))),128))]),e(u).state.userInfo.id>0?(c(),I(Y,{key:1,ref_key:"replyComposeRef",ref:_,"comment-id":e(n).id,"at-userid":d.value,"at-username":p.value,onReload:v,onReset:A},null,8,["comment-id","at-userid","at-username"])):$("",!0)]),_:2},[e(n).texts.length>0?{name:"description",fn:r(()=>[(c(!0),g(se,null,ie(e(n).texts,m=>(c(),g("span",{key:m.id,class:"comment-text",onClick:x[1]||(x[1]=J(U=>b(U,e(n).id),["stop"])),innerHTML:e(Ce)(m.content).content},null,8,Os))),128))])}:void 0]),1024)])}}});var js=oe(Ns,[["__scopeId","data-v-6b2cb186"]]);const Ms=i=>(ct("data-v-0702a552"),i=i(),pt(),i),Vs={key:0,class:"compose-wrap"},qs={class:"compose-line"},Ls={class:"compose-user"},Hs={class:"compose-line compose-options"},Ks={class:"attachment"},Ws={class:"submit-wrap"},Js=E(" \u53D6\u6D88 "),Gs=E(" \u53D1\u5E03 "),Qs={class:"attachment-list-wrap"},Ys={key:1,class:"compose-wrap"},Zs=Ms(()=>C("div",{class:"login-wrap"},[C("span",{class:"login-banner"}," \u767B\u5F55\u540E\uFF0C\u7CBE\u5F69\u66F4\u591A")],-1)),Xs={class:"login-wrap"},eo=E(" \u767B\u5F55 "),to=E(" \u6CE8\u518C "),so=T({props:{lock:{default:0},postId:{default:0}},emits:["post-success"],setup(i,{emit:l}){const t=i,u=re(),f=k([]),d=k(!1),p=k(!1),_=k(!1),n=k(""),b=k(),h=k("public/image"),v=k([]),A=k([]),s="/v1/attachment",B=k(),x=Nt.exports.debounce(y=>{rt({k:y}).then(w=>{let F=[];w.map(P=>{F.push({label:P,value:P})}),f.value=F,p.value=!1}).catch(w=>{p.value=!1})},200),R=(y,w)=>{p.value||(p.value=!0,w==="@"&&x(y))},S=y=>{y.length>200||(n.value=y)},H=y=>{h.value=y},K=y=>{v.value=y},M=async y=>{var w,F;return h.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((w=y.file.file)==null?void 0:w.type)?(window.$message.warning("\u56FE\u7247\u4EC5\u5141\u8BB8 png/jpg/gif \u683C\u5F0F"),!1):h.value==="image"&&((F=y.file.file)==null?void 0:F.size)>10485760?(window.$message.warning("\u56FE\u7247\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC710MB"),!1):!0},G=({file:y,event:w})=>{var F;try{let P=JSON.parse((F=w.target)==null?void 0:F.response);P.code===0&&h.value==="public/image"&&A.value.push({id:y.id,content:P.data.content})}catch{window.$message.error("\u4E0A\u4F20\u5931\u8D25")}},Q=({file:y,event:w})=>{var F;try{let P=JSON.parse((F=w.target)==null?void 0:F.response);if(P.code!==0){let V=P.msg||"\u4E0A\u4F20\u5931\u8D25";P.details&&P.details.length>0&&P.details.map(N=>{V+=":"+N}),window.$message.error(V)}}catch{window.$message.error("\u4E0A\u4F20\u5931\u8D25")}},Y=({file:y})=>{let w=A.value.findIndex(F=>F.id===y.id);w>-1&&A.value.splice(w,1)},o=()=>{d.value=!0},m=()=>{var y;d.value=!1,(y=b.value)==null||y.clear(),v.value=[],n.value="",A.value=[]},U=()=>{if(n.value.trim().length===0){window.$message.warning("\u8BF7\u8F93\u5165\u5185\u5BB9\u54E6");return}let{users:y}=Ce(n.value);const w=[];let F=100;w.push({content:n.value,type:2,sort:F}),A.value.map(P=>{F++,w.push({content:P.content,type:3,sort:F})}),_.value=!0,dt({contents:w,post_id:t.postId,users:Array.from(new Set(y))}).then(P=>{window.$message.success("\u53D1\u5E03\u6210\u529F"),_.value=!1,l("post-success"),m()}).catch(P=>{_.value=!1})},ne=y=>{u.commit("triggerAuth",!0),u.commit("triggerAuthKey",y)};return ke(()=>{B.value="Bearer "+localStorage.getItem("PAOPAO_TOKEN")}),(y,w)=>{const F=ye,P=Mt,V=ce,N=W,pe=Vt,de=qt,_e=_t,ae=Lt,me=Ht;return c(),g("div",null,[e(u).state.userInfo.id>0?(c(),g("div",Vs,[C("div",qs,[C("div",Ls,[a(F,{round:"",size:30,src:e(u).state.userInfo.avatar},null,8,["src"])]),a(P,{type:"textarea",size:"large",autosize:"",bordered:!1,options:f.value,prefix:["@"],loading:p.value,value:n.value,disabled:t.lock===1,"onUpdate:value":S,onSearch:R,onFocus:o,placeholder:t.lock===1?"\u6CE1\u6CE1\u5DF2\u88AB\u9501\u5B9A\uFF0C\u56DE\u590D\u529F\u80FD\u5DF2\u5173\u95ED":"\u5FEB\u6765\u8BC4\u8BBA\u4E24\u53E5\u5427..."},null,8,["options","loading","value","disabled","placeholder"])]),d.value?(c(),I(me,{key:0,ref_key:"uploadRef",ref:b,abstract:"","list-type":"image",multiple:!0,max:9,action:s,headers:{Authorization:B.value},data:{type:h.value},onBeforeUpload:M,onFinish:G,onError:Q,onRemove:Y,"onUpdate:fileList":K},{default:r(()=>[C("div",Hs,[C("div",Ks,[a(pe,{abstract:""},{default:r(({handleClick:Z})=>[a(N,{disabled:v.value.length>0&&h.value==="public/video"||v.value.length===9,onClick:()=>{H("public/image"),Z()},quaternary:"",circle:"",type:"primary"},{icon:r(()=>[a(V,{size:"20",color:"var(--primary-color)"},{default:r(()=>[a(e(jt))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),a(_e,{trigger:"hover",placement:"bottom"},{trigger:r(()=>[a(de,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:n.value.length/200*100},null,8,["percentage"])]),default:r(()=>[E(" "+D(n.value.length)+" / 200 ",1)]),_:1})]),C("div",Ws,[a(N,{quaternary:"",round:"",type:"tertiary",class:"cancel-btn",size:"small",onClick:m},{default:r(()=>[Js]),_:1}),a(N,{loading:_.value,onClick:U,type:"primary",secondary:"",size:"small",round:""},{default:r(()=>[Gs]),_:1},8,["loading"])])]),C("div",Qs,[a(ae)])]),_:1},8,["headers","data"])):$("",!0)])):(c(),g("div",Ys,[Zs,C("div",Xs,[a(N,{strong:"",secondary:"",round:"",type:"primary",onClick:w[0]||(w[0]=Z=>ne("signin"))},{default:r(()=>[eo]),_:1}),a(N,{strong:"",secondary:"",round:"",type:"info",onClick:w[1]||(w[1]=Z=>ne("signup"))},{default:r(()=>[to]),_:1})])]))])}}});var oo=oe(so,[["__scopeId","data-v-0702a552"]]);const no={class:"username-wrap"},ao=E(" \u7F6E\u9876 "),io=E(" \u79C1\u5BC6 "),lo=E(" \u597D\u53CB\u53EF\u89C1 "),uo={key:0,class:"options"},ro={key:0},co=["innerHTML"],po={class:"timestamp"},_o={key:0},mo={key:1},vo={class:"opts-wrap"},ho=["onClick"],fo={class:"opt-item"},go=["onClick"],yo=T({props:{post:null},emits:["reload"],setup(i,{emit:l}){const t=i,u=re(),f=Ae(),d=k(!1),p=k(!1),_=k(!1),n=k(!1),b=k(!1),h=k(!1),v=k(!1),A=k(te.PUBLIC),s=L({get:()=>{let o=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},t.post);return o.contents.map(m=>{(+m.type==1||+m.type==2)&&o.texts.push(m),+m.type==3&&o.imgs.push(m),+m.type==4&&o.videos.push(m),+m.type==6&&o.links.push(m),+m.type==7&&o.attachments.push(m),+m.type==8&&o.charge_attachments.push(m)}),o},set:o=>{t.post.upvote_count=o.upvote_count,t.post.comment_count=o.comment_count,t.post.collection_count=o.collection_count}}),B=L(()=>{let o=[{label:"\u5220\u9664",key:"delete"}];return s.value.is_lock===0?o.push({label:"\u9501\u5B9A",key:"lock"}):o.push({label:"\u89E3\u9501",key:"unlock"}),u.state.userInfo.is_admin&&(s.value.is_top===0?o.push({label:"\u7F6E\u9876",key:"stick"}):o.push({label:"\u53D6\u6D88\u7F6E\u9876",key:"unstick"})),s.value.visibility===te.PUBLIC?o.push({label:"\u516C\u5F00",key:"vpublic",children:[{label:"\u79C1\u5BC6",key:"vprivate"},{label:"\u597D\u53CB\u53EF\u89C1",key:"vfriend"}]}):s.value.visibility===te.PRIVATE?o.push({label:"\u79C1\u5BC6",key:"vprivate",children:[{label:"\u516C\u5F00",key:"vpublic"},{label:"\u597D\u53CB\u53EF\u89C1",key:"vfriend"}]}):o.push({label:"\u597D\u53CB\u53EF\u89C1",key:"vfriend",children:[{label:"\u516C\u5F00",key:"vpublic"},{label:"\u79C1\u5BC6",key:"vprivate"}]}),o}),x=o=>{f.push({name:"post",query:{id:o}})},R=(o,m)=>{if(o.target.dataset.detail){const U=o.target.dataset.detail.split(":");if(U.length===2){u.commit("refresh"),U[0]==="tag"?f.push({name:"home",query:{q:U[1],t:"tag"}}):f.push({name:"user",query:{username:U[1]}});return}}x(m)},S=o=>{switch(o){case"delete":_.value=!0;break;case"lock":case"unlock":n.value=!0;break;case"stick":case"unstick":b.value=!0;break;case"vpublic":A.value=0,h.value=!0;break;case"vprivate":A.value=1,h.value=!0;break;case"vfriend":A.value=2,h.value=!0;break}},H=()=>{ht({id:s.value.id}).then(o=>{window.$message.success("\u5220\u9664\u6210\u529F"),f.replace("/"),setTimeout(()=>{u.commit("refresh")},50)}).catch(o=>{v.value=!1})},K=()=>{ft({id:s.value.id}).then(o=>{l("reload"),o.lock_status===1?window.$message.success("\u9501\u5B9A\u6210\u529F"):window.$message.success("\u89E3\u9501\u6210\u529F")}).catch(o=>{v.value=!1})},M=()=>{gt({id:s.value.id}).then(o=>{l("reload"),o.top_status===1?window.$message.success("\u7F6E\u9876\u6210\u529F"):window.$message.success("\u53D6\u6D88\u7F6E\u9876\u6210\u529F")}).catch(o=>{v.value=!1})},G=()=>{yt({id:s.value.id,visibility:A.value}).then(o=>{l("reload"),window.$message.success("\u4FEE\u6539\u53EF\u89C1\u6027\u6210\u529F")}).catch(o=>{v.value=!1})},Q=()=>{kt({id:s.value.id}).then(o=>{d.value=o.status,o.status?s.value=ee(X({},s.value),{upvote_count:s.value.upvote_count+1}):s.value=ee(X({},s.value),{upvote_count:s.value.upvote_count-1})}).catch(o=>{console.log(o)})},Y=()=>{Ct({id:s.value.id}).then(o=>{p.value=o.status,o.status?s.value=ee(X({},s.value),{collection_count:s.value.collection_count+1}):s.value=ee(X({},s.value),{collection_count:s.value.collection_count-1})}).catch(o=>{console.log(o)})};return ke(()=>{u.state.userInfo.id>0&&(mt({id:s.value.id}).then(o=>{d.value=o.status}).catch(o=>{console.log(o)}),vt({id:s.value.id}).then(o=>{p.value=o.status}).catch(o=>{console.log(o)}))}),(o,m)=>{const U=ye,ne=ge("router-link"),y=bt,w=ce,F=W,P=wt,V=xt,N=Tt,pe=Ie,de=St,_e=Ot,ae=Xt,me=$t,Z=ze;return c(),g("div",{class:"detail-item",onClick:m[6]||(m[6]=O=>x(e(s).id))},[a(Z,null,{avatar:r(()=>[a(U,{round:"",size:30,src:e(s).user.avatar},null,8,["src"])]),header:r(()=>[a(ne,{onClick:m[0]||(m[0]=J(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:e(s).user.username}}},{default:r(()=>[E(D(e(s).user.nickname),1)]),_:1},8,["to"]),C("span",no," @"+D(e(s).user.username),1),e(s).is_top?(c(),I(y,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:r(()=>[ao]),_:1})):$("",!0),e(s).visibility==e(te).PRIVATE?(c(),I(y,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:r(()=>[io]),_:1})):$("",!0),e(s).visibility==e(te).FRIEND?(c(),I(y,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:r(()=>[lo]),_:1})):$("",!0)]),"header-extra":r(()=>[e(u).state.userInfo.is_admin||e(u).state.userInfo.id===e(s).user.id?(c(),g("div",uo,[a(P,{placement:"bottom-end",trigger:"click",size:"small",options:e(B),onSelect:S},{default:r(()=>[a(F,{quaternary:"",circle:""},{icon:r(()=>[a(w,null,{default:r(()=>[a(e(Kt))]),_:1})]),_:1})]),_:1},8,["options"])])):$("",!0),a(V,{show:_.value,"onUpdate:show":m[1]||(m[1]=O=>_.value=O),"mask-closable":!1,preset:"dialog",title:"\u63D0\u793A",content:"\u786E\u5B9A\u5220\u9664\u8BE5\u6CE1\u6CE1\u52A8\u6001\u5417\uFF1F","positive-text":"\u786E\u8BA4","negative-text":"\u53D6\u6D88",onPositiveClick:H},null,8,["show"]),a(V,{show:n.value,"onUpdate:show":m[2]||(m[2]=O=>n.value=O),"mask-closable":!1,preset:"dialog",title:"\u63D0\u793A",content:"\u786E\u5B9A"+(e(s).is_lock?"\u89E3\u9501":"\u9501\u5B9A")+"\u8BE5\u6CE1\u6CE1\u52A8\u6001\u5417\uFF1F","positive-text":"\u786E\u8BA4","negative-text":"\u53D6\u6D88",onPositiveClick:K},null,8,["show","content"]),a(V,{show:b.value,"onUpdate:show":m[3]||(m[3]=O=>b.value=O),"mask-closable":!1,preset:"dialog",title:"\u63D0\u793A",content:"\u786E\u5B9A"+(e(s).is_top?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876")+"\u8BE5\u6CE1\u6CE1\u52A8\u6001\u5417\uFF1F","positive-text":"\u786E\u8BA4","negative-text":"\u53D6\u6D88",onPositiveClick:M},null,8,["show","content"]),a(V,{show:h.value,"onUpdate:show":m[4]||(m[4]=O=>h.value=O),"mask-closable":!1,preset:"dialog",title:"\u63D0\u793A",content:"\u786E\u5B9A\u5C06\u8BE5\u6CE1\u6CE1\u52A8\u6001\u53EF\u89C1\u5EA6\u4FEE\u6539\u4E3A"+(A.value==0?"\u516C\u5F00":A.value==1?"\u79C1\u5BC6":"\u597D\u53CB\u53EF\u89C1")+"\u5417\uFF1F","positive-text":"\u786E\u8BA4","negative-text":"\u53D6\u6D88",onPositiveClick:G},null,8,["show","content"])]),footer:r(()=>[a(N,{attachments:e(s).attachments},null,8,["attachments"]),a(N,{attachments:e(s).charge_attachments,price:e(s).attachment_price},null,8,["attachments","price"]),a(pe,{imgs:e(s).imgs},null,8,["imgs"]),a(de,{videos:e(s).videos,full:!0},null,8,["videos"]),a(_e,{links:e(s).links},null,8,["links"]),C("div",po,[E(" \u53D1\u5E03\u4E8E "+D(e(le)(e(s).created_on))+" ",1),e(s).ip_loc?(c(),g("span",_o,[a(ae,{vertical:""}),E(" "+D(e(s).ip_loc),1)])):$("",!0),e(s).created_on!=e(s).latest_replied_on?(c(),g("span",mo,[a(ae,{vertical:""}),E(" \u6700\u540E\u56DE\u590D "+D(e(le)(e(s).latest_replied_on)),1)])):$("",!0)])]),action:r(()=>[C("div",vo,[a(me,{justify:"space-between"},{default:r(()=>[C("div",{class:"opt-item hover",onClick:J(Q,["stop"])},[a(w,{size:"20",class:"opt-item-icon"},{default:r(()=>[d.value?$("",!0):(c(),I(e(It),{key:0})),d.value?(c(),I(e(cs),{key:1,color:"red"})):$("",!0)]),_:1}),E(" "+D(e(s).upvote_count),1)],8,ho),C("div",fo,[a(w,{size:"20",class:"opt-item-icon"},{default:r(()=>[a(e(zt))]),_:1}),E(" "+D(e(s).comment_count),1)]),C("div",{class:"opt-item hover",onClick:J(Y,["stop"])},[a(w,{size:"20",class:"opt-item-icon"},{default:r(()=>[p.value?$("",!0):(c(),I(e(Rt),{key:0})),p.value?(c(),I(e(is),{key:1,color:"#ff7600"})):$("",!0)]),_:1}),E(" "+D(e(s).collection_count),1)],8,go)]),_:1})])]),default:r(()=>[e(s).texts.length>0?(c(),g("div",ro,[(c(!0),g(se,null,ie(e(s).texts,O=>(c(),g("span",{key:O.id,class:"post-text",onClick:m[5]||(m[5]=J(Ue=>R(Ue,e(s).id),["stop"])),innerHTML:e(Ce)(O.content).content},null,8,co))),128))])):$("",!0)]),_:1})])}}});const ko={key:0,class:"detail-wrap"},Co={key:1,class:"empty-wrap"},bo={key:1},wo={key:0,class:"skeleton-wrap"},xo={key:1},$o={key:0,class:"empty-wrap"},Eo=T({setup(i){const l=Et(),t=k({}),u=k(!1),f=k(!1),d=k([]),p=L(()=>+l.query.id),_=()=>{t.value={id:0},u.value=!0,Ft({id:p.value}).then(b=>{u.value=!1,t.value=b,n()}).catch(b=>{u.value=!1})},n=(b=!1)=>{d.value.length===0&&(f.value=!0),Pt({id:t.value.id}).then(h=>{d.value=h.list,f.value=!1,b&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(h=>{f.value=!1})};return ke(()=>{_()}),Bt(p,()=>{p.value>0&&l.name==="post"&&_()}),(b,h)=>{const v=Wt,A=yo,s=Gt,B=Dt,x=Qt,R=oo,S=Ut,H=js,K=Jt;return c(),g("div",null,[a(v,{title:"\u6CE1\u6CE1\u8BE6\u60C5",back:!0}),a(K,{class:"main-content-wrap",bordered:""},{default:r(()=>[a(x,null,{default:r(()=>[a(B,{show:u.value},{default:r(()=>[t.value.id>1?(c(),g("div",ko,[a(A,{post:t.value,onReload:_},null,8,["post"])])):(c(),g("div",Co,[a(s,{size:"large",description:"\u6682\u65E0\u6570\u636E"})]))]),_:1},8,["show"])]),_:1}),t.value.id>0?(c(),I(x,{key:0},{default:r(()=>[a(R,{lock:t.value.is_lock,"post-id":t.value.id,onPostSuccess:h[0]||(h[0]=M=>n(!0))},null,8,["lock","post-id"])]),_:1})):$("",!0),t.value.id>0?(c(),g("div",bo,[f.value?(c(),g("div",wo,[a(S,{num:5})])):(c(),g("div",xo,[d.value.length===0?(c(),g("div",$o,[a(s,{size:"large",description:"\u6682\u65E0\u8BC4\u8BBA\uFF0C\u5FEB\u6765\u62A2\u6C99\u53D1"})])):$("",!0),(c(!0),g(se,null,ie(d.value,M=>(c(),I(x,{key:M.id},{default:r(()=>[a(H,{comment:M,onReload:n},null,8,["comment"])]),_:2},1024))),128))]))])):$("",!0)]),_:1})])}}});var jo=oe(Eo,[["__scopeId","data-v-41747510"]]);export{jo as default}; diff --git a/web/dist/assets/Profile.75de1930.js b/web/dist/assets/Profile.75de1930.js deleted file mode 100644 index bab88572..00000000 --- a/web/dist/assets/Profile.75de1930.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as N}from"./post-item.03452002.js";import{_ as S}from"./post-skeleton.39a35f5b.js";import{_ as U}from"./main-nav.9110259b.js";import{ah as D,d as M,Z as R,ai as $,r as c,a1 as q,V as e,W as o,a3 as t,a2 as _,a5 as h,a4 as r,a6 as d,c4 as F,Y as s,a9 as f,aa as L,ab as T,ad as W,c1 as Y,c2 as Z}from"./index.f480f018.js";import{_ as j}from"./List.49bcdf81.js";import{_ as A}from"./Pagination.1263479e.js";import{a as G,_ as H}from"./Skeleton.57e98fe3.js";import"./content.ef1e095a.js";import"./formatTime.02109bf5.js";import"./Thing.eef6b133.js";const J={class:"profile-baseinfo"},K={class:"avatar"},O={class:"base-info"},Q={class:"username"},X={class:"uid"},ee={key:0,class:"pagination-wrap"},te={key:0,class:"skeleton-wrap"},ae={key:1},se={key:0,class:"empty-wrap"},ne=M({setup(oe){const a=R(),k=$(),l=c(!1),u=c([]),i=c(+k.query.p||1),p=c(20),m=c(0),v=()=>{l.value=!0,F({username:a.state.userInfo.username,page:i.value,page_size:p.value}).then(n=>{l.value=!1,u.value=n.list,m.value=Math.ceil(n.pager.total_rows/p.value),window.scrollTo(0,0)}).catch(n=>{l.value=!1})},y=n=>{i.value=n,v()};return q(()=>{v()}),(n,_e)=>{const w=U,b=W,I=A,E=Y,P=Z,x=S,B=G,C=N,z=H,V=j;return e(),o("div",null,[t(w,{title:"\u4E3B\u9875"}),_(a).state.userInfo.id>0?(e(),h(V,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{footer:r(()=>[m.value>1?(e(),o("div",ee,[t(I,{page:i.value,"onUpdate:page":y,"page-slot":_(a).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):d("",!0)]),default:r(()=>[s("div",J,[s("div",K,[t(b,{size:"large",src:_(a).state.userInfo.avatar},null,8,["src"])]),s("div",O,[s("div",Q,[s("strong",null,f(_(a).state.userInfo.nickname),1),s("span",null," @"+f(_(a).state.userInfo.username),1)]),s("div",X,"UID. "+f(_(a).state.userInfo.id),1)])]),t(P,{class:"profile-tabs-wrap",animated:""},{default:r(()=>[t(E,{name:"post",tab:"\u6CE1\u6CE1"})]),_:1}),l.value?(e(),o("div",te,[t(x,{num:p.value},null,8,["num"])])):(e(),o("div",ae,[u.value.length===0?(e(),o("div",se,[t(B,{size:"large",description:"\u6682\u65E0\u6570\u636E"})])):d("",!0),(e(!0),o(L,null,T(u.value,g=>(e(),h(z,{key:g.id},{default:r(()=>[t(C,{post:g},null,8,["post"])]),_:2},1024))),128))]))]),_:1})):d("",!0)])}}});var ge=D(ne,[["__scopeId","data-v-2fe5c266"]]);export{ge as default}; diff --git a/web/dist/assets/Setting.837d491b.js b/web/dist/assets/Setting.837d491b.js deleted file mode 100644 index 6f5e8ac7..00000000 --- a/web/dist/assets/Setting.837d491b.js +++ /dev/null @@ -1 +0,0 @@ -var ye=Object.defineProperty,ke=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var te=Object.getOwnPropertySymbols;var Ee=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable;var ae=(_,v,g)=>v in _?ye(_,v,{enumerable:!0,configurable:!0,writable:!0,value:g}):_[v]=g,V=(_,v)=>{for(var g in v||(v={}))Ee.call(v,g)&&ae(_,g,v[g]);if(te)for(var g of te(v))Ae.call(v,g)&&ae(_,g,v[g]);return _},j=(_,v)=>ke(_,be(v));import{_ as Ie}from"./main-nav.9110259b.js";import{d as oe,V as r,W as h,Y as d,ah as $e,r as c,Z as Pe,ca as se,a1 as Ue,ae as xe,a3 as u,a4 as s,a5 as k,a6 as f,cw as ne,az as Re,a2 as t,a9 as U,aY as Se,aZ as qe,a8 as p,bj as x,a7 as R,bM as ze,bN as Ne,cx as Ke,cy as Me,cz as Ve,cA as je,cB as Te,cC as Le,ad as Oe,J as We,_ as Ge,cD as Je,cE as Ye,cF as Ze,cG as He}from"./index.f480f018.js";import{c as Qe}from"./Upload.efe3adfd.js";import{_ as Xe}from"./Alert.a854329b.js";import{_ as eu}from"./InputGroup.f69c4956.js";const uu={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},tu=d("g",{fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[d("path",{d:"M9 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-3"}),d("path",{d:"M9 15h3l8.5-8.5a1.5 1.5 0 0 0-3-3L9 12v3"}),d("path",{d:"M16 5l3 3"})],-1),au=[tu];var su=oe({name:"Edit",render:function(v,g){return r(),h("svg",uu,au)}});const T=_=>(ze("data-v-6eb93a4d"),_=_(),Ne(),_),nu={class:"base-line avatar"},ou=p("\u66F4\u6539\u5934\u50CF"),lu={class:"base-line"},ru=T(()=>d("span",{class:"base-label"},"\u6635\u79F0",-1)),iu={key:0},du={class:"base-line"},cu=T(()=>d("span",{class:"base-label"},"\u7528\u6237\u540D",-1)),pu={key:0},_u=p(" \u6362\u7ED1\u624B\u673A "),vu={key:1},mu=p(" \u6210\u529F\u7ED1\u5B9A\u624B\u673A\u540E\uFF0C\u624D\u80FD\u8FDB\u884C\u6362\u5934\u50CF\u3001\u53D1\u52A8\u6001\u3001\u56DE\u590D\u7B49\u4EA4\u4E92~"),fu=T(()=>d("br",null,null,-1)),hu={key:2,class:"phone-bind-wrap"},gu={class:"captcha-img-wrap"},Fu={class:"captcha-img"},Cu=["src"],wu={class:"form-submit-wrap"},Bu=p(" \u53D6\u6D88 "),Du=p(" \u7ED1\u5B9A "),yu={key:0},ku=p(" \u91CD\u65B0\u6FC0\u6D3B "),bu={key:1},Eu=p(" \u6210\u529F\u6FC0\u6D3B\u540E\u540E\uFF0C\u624D\u80FD\u53D1\uFF08\u516C\u5F00/\u597D\u53CB\u53EF\u89C1\uFF09\u52A8\u6001\u3001\u56DE\u590D~"),Au=T(()=>d("br",null,null,-1)),Iu={key:2,class:"phone-bind-wrap"},$u={class:"captcha-img-wrap"},Pu={class:"captcha-img"},Uu=["src"],xu={class:"form-submit-wrap"},Ru=p(" \u53D6\u6D88 "),Su=p(" \u6FC0\u6D3B "),qu=p(" \u60A8\u5DF2\u8BBE\u7F6E\u5BC6\u7801 "),zu=p(" \u91CD\u7F6E\u5BC6\u7801 "),Nu={key:1,class:"phone-bind-wrap"},Ku={class:"form-submit-wrap"},Mu=p(" \u53D6\u6D88 "),Vu=p(" \u66F4\u65B0 "),ju=oe({setup(_){const v="/v1/attachment",g="Bearer "+localStorage.getItem("PAOPAO_TOKEN"),S=c("public/avatar"),A="true".toLowerCase()==="true",le="false".toLowerCase()==="true",o=Pe(),I=c(!1),q=c(!1),z=c(!1),Y=c(),Z=c(),b=c(!1),N=c(!1),$=c(!1),P=c(!1),E=c(60),D=c(!1),y=c(!1),H=c(),Q=c(),X=c(),ee=c(),a=se({id:"",b64s:"",imgCaptcha:"",phone:"",phone_captcha:"",password:"",old_password:"",reenteredPassword:""}),i=se({id:"",b64s:"",imgCaptcha:"",activate_code:""}),re=async n=>{var e,F;return S.value==="public/avatar"&&!["image/png","image/jpg","image/jpeg"].includes((e=n.file.file)==null?void 0:e.type)?(window.$message.warning("\u5934\u50CF\u4EC5\u5141\u8BB8 png/jpg \u683C\u5F0F"),!1):S.value==="image"&&((F=n.file.file)==null?void 0:F.size)>1048576?(window.$message.warning("\u5934\u50CF\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC71MB"),!1):!0},ie=({file:n,event:e})=>{var F;try{let C=JSON.parse((F=e.target)==null?void 0:F.response);C.code===0&&S.value==="public/avatar"&&Ke({avatar:C.data.content}).then(m=>{var K;window.$message.success("\u5934\u50CF\u66F4\u65B0\u6210\u529F"),(K=Y.value)==null||K.clear(),o.commit("updateUserinfo",j(V({},o.state.userInfo),{avatar:C.data.content}))}).catch(m=>{console.log(m)})}catch{window.$message.error("\u4E0A\u4F20\u5931\u8D25")}},de=(n,e)=>!!a.password&&a.password.startsWith(e)&&a.password.length>=e.length,ce=(n,e)=>e===a.password,pe=()=>{var n;a.reenteredPassword&&((n=ee.value)==null||n.validate({trigger:"password-input"}))},_e=n=>{var e;n.preventDefault(),(e=X.value)==null||e.validate(F=>{F||(N.value=!0,Me({password:a.password,old_password:a.old_password}).then(C=>{N.value=!1,$.value=!1,window.$message.success("\u5BC6\u7801\u91CD\u7F6E\u6210\u529F"),o.commit("userLogout"),o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")}).catch(C=>{N.value=!1}))})},ve=n=>{var e;n.preventDefault(),(e=H.value)==null||e.validate(F=>{F||(q.value=!0,Ve({phone:a.phone,captcha:a.phone_captcha}).then(C=>{q.value=!1,D.value=!1,window.$message.success("\u7ED1\u5B9A\u6210\u529F"),o.commit("updateUserinfo",j(V({},o.state.userInfo),{phone:a.phone})),a.id="",a.b64s="",a.imgCaptcha="",a.phone="",a.phone_captcha=""}).catch(C=>{q.value=!1}))})},me=n=>{var e;n.preventDefault(),(e=Q.value)==null||e.validate(F=>{if(i.imgCaptcha===""){window.$message.warning("\u8BF7\u8F93\u5165\u56FE\u7247\u9A8C\u8BC1\u7801");return}I.value=!0,F||(z.value=!0,je({activate_code:i.activate_code,captcha_id:i.id,imgCaptcha:i.imgCaptcha}).then(C=>{z.value=!1,y.value=!1,window.$message.success("\u6FC0\u6D3B\u6210\u529F"),o.commit("updateUserinfo",j(V({},o.state.userInfo),{activation:i.activate_code})),i.id="",i.b64s="",i.imgCaptcha="",i.activate_code=""}).catch(C=>{z.value=!1,C.code===20012&&O()}))})},L=()=>{ne().then(n=>{a.id=n.id,a.b64s=n.b64s}).catch(n=>{console.log(n)})},O=()=>{ne().then(n=>{i.id=n.id,i.b64s=n.b64s}).catch(n=>{console.log(n)})},fe=()=>{Te({nickname:o.state.userInfo.nickname||""}).then(n=>{b.value=!1,window.$message.success("\u6635\u79F0\u4FEE\u6539\u6210\u529F")}).catch(n=>{b.value=!0})},he=()=>{if(!(E.value>0&&P.value)){if(a.imgCaptcha===""){window.$message.warning("\u8BF7\u8F93\u5165\u56FE\u7247\u9A8C\u8BC1\u7801");return}I.value=!0,Le({phone:a.phone,img_captcha:a.imgCaptcha,img_captcha_id:a.id}).then(n=>{P.value=!0,I.value=!1,window.$message.success("\u53D1\u9001\u6210\u529F");let e=setInterval(()=>{E.value--,E.value===0&&(clearInterval(e),E.value=60,P.value=!1)},1e3)}).catch(n=>{I.value=!1,n.code===20012&&L(),console.log(n)})}},ge={phone:[{required:!0,message:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",trigger:["input"],validator:(n,e)=>/^[1]+[3-9]{1}\d{9}$/.test(e)}],phone_captcha:[{required:!0,message:"\u8BF7\u8F93\u5165\u624B\u673A\u9A8C\u8BC1\u7801"}]},Fe={activate_code:[{required:!0,message:"\u8BF7\u8F93\u5165\u6FC0\u6D3B\u7801",trigger:["input"],validator:(n,e)=>/\d{6}$/.test(e)}]},Ce={password:[{required:!0,message:"\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801"}],old_password:[{required:!0,message:"\u8BF7\u8F93\u5165\u65E7\u5BC6\u7801"}],reenteredPassword:[{required:!0,message:"\u8BF7\u518D\u6B21\u8F93\u5165\u5BC6\u7801",trigger:["input","blur"]},{validator:de,message:"\u4E24\u6B21\u5BC6\u7801\u8F93\u5165\u4E0D\u4E00\u81F4",trigger:"input"},{validator:ce,message:"\u4E24\u6B21\u5BC6\u7801\u8F93\u5165\u4E0D\u4E00\u81F4",trigger:["blur","password-input"]}]},we=()=>{b.value=!0,setTimeout(()=>{var n;(n=Z.value)==null||n.focus()},30)};return Ue(()=>{o.state.userInfo.id===0&&(o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")),L(),O()}),(n,e)=>{const F=Ie,C=Oe,m=We,K=Qe,w=Ge,Be=xe,M=Re,ue=Xe,B=Je,De=eu,W=Ye,G=Ze,J=He;return r(),h("div",null,[u(F,{title:"\u8BBE\u7F6E",theme:""}),u(M,{title:"\u57FA\u672C\u4FE1\u606F",size:"small",class:"setting-card"},{default:s(()=>[d("div",nu,[u(C,{class:"avatar-img",size:80,src:t(o).state.userInfo.avatar},null,8,["src"]),!A||A&&t(o).state.userInfo.phone&&t(o).state.userInfo.phone.length>0?(r(),k(K,{key:0,ref_key:"avatarRef",ref:Y,action:v,headers:{Authorization:g},data:{type:S.value},onBeforeUpload:re,onFinish:ie},{default:s(()=>[u(m,{size:"small"},{default:s(()=>[ou]),_:1})]),_:1},8,["headers","data"])):f("",!0)]),d("div",lu,[ru,b.value?f("",!0):(r(),h("div",iu,U(t(o).state.userInfo.nickname),1)),Se(u(w,{ref_key:"inputInstRef",ref:Z,class:"nickname-input",value:t(o).state.userInfo.nickname,"onUpdate:value":e[0]||(e[0]=l=>t(o).state.userInfo.nickname=l),type:"text",size:"small",placeholder:"\u8BF7\u8F93\u5165\u6635\u79F0",onBlur:fe,maxlength:16},null,8,["value"]),[[qe,b.value]]),!b.value&&(!A||A&&t(o).state.userInfo.phone&&t(o).state.userInfo.phone.length>0&&t(o).state.userInfo.status==1)?(r(),k(m,{key:1,quaternary:"",round:"",type:"success",size:"small",onClick:we},{icon:s(()=>[u(Be,null,{default:s(()=>[u(t(su))]),_:1})]),_:1})):f("",!0)]),d("div",du,[cu,p(" @"+U(t(o).state.userInfo.username),1)])]),_:1}),A?(r(),k(M,{key:0,title:"\u624B\u673A\u53F7",size:"small",class:"setting-card"},{default:s(()=>[t(o).state.userInfo.phone&&t(o).state.userInfo.phone.length>0?(r(),h("div",pu,[p(U(t(o).state.userInfo.phone)+" ",1),!D.value&&t(o).state.userInfo.status==1?(r(),k(m,{key:0,quaternary:"",round:"",type:"success",onClick:e[1]||(e[1]=l=>D.value=!0)},{default:s(()=>[_u]),_:1})):f("",!0)])):(r(),h("div",vu,[u(ue,{title:"\u624B\u673A\u7ED1\u5B9A\u63D0\u793A",type:"warning"},{default:s(()=>[mu,fu,D.value?f("",!0):(r(),h("a",{key:0,class:"hash-link",onClick:e[2]||(e[2]=l=>D.value=!0)}," \u7ACB\u5373\u7ED1\u5B9A "))]),_:1})])),D.value?(r(),h("div",hu,[u(J,{ref_key:"phoneFormRef",ref:H,model:t(a),rules:ge},{default:s(()=>[u(B,{path:"phone",label:"\u624B\u673A\u53F7"},{default:s(()=>[u(w,{value:t(a).phone,"onUpdate:value":e[3]||(e[3]=l=>t(a).phone=l.trim()),placeholder:"\u8BF7\u8F93\u5165\u4E2D\u56FD\u5927\u9646\u624B\u673A\u53F7",onKeydown:e[4]||(e[4]=x(R(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),u(B,{path:"img_captcha",label:"\u56FE\u5F62\u9A8C\u8BC1\u7801"},{default:s(()=>[d("div",gu,[u(w,{value:t(a).imgCaptcha,"onUpdate:value":e[5]||(e[5]=l=>t(a).imgCaptcha=l),placeholder:"\u8BF7\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801\u540E\u83B7\u53D6\u9A8C\u8BC1\u7801"},null,8,["value"]),d("div",Fu,[t(a).b64s?(r(),h("img",{key:0,src:t(a).b64s,onClick:L},null,8,Cu)):f("",!0)])])]),_:1}),u(B,{path:"phone_captcha",label:"\u77ED\u4FE1\u9A8C\u8BC1\u7801"},{default:s(()=>[u(De,null,{default:s(()=>[u(w,{value:t(a).phone_captcha,"onUpdate:value":e[6]||(e[6]=l=>t(a).phone_captcha=l),placeholder:"\u8BF7\u8F93\u5165\u6536\u5230\u7684\u77ED\u4FE1\u9A8C\u8BC1\u7801"},null,8,["value"]),u(m,{type:"primary",ghost:"",disabled:P.value,loading:I.value,onClick:he},{default:s(()=>[p(U(E.value>0&&P.value?E.value+"s\u540E\u91CD\u65B0\u53D1\u9001":"\u53D1\u9001\u9A8C\u8BC1\u7801"),1)]),_:1},8,["disabled","loading"])]),_:1})]),_:1}),u(G,{gutter:[0,24]},{default:s(()=>[u(W,{span:24},{default:s(()=>[d("div",wu,[u(m,{quaternary:"",round:"",onClick:e[7]||(e[7]=l=>D.value=!1)},{default:s(()=>[Bu]),_:1}),u(m,{secondary:"",round:"",type:"primary",loading:q.value,onClick:ve},{default:s(()=>[Du]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):f("",!0)]),_:1})):f("",!0),le?(r(),k(M,{key:1,title:"\u6FC0\u6D3B\u7801",size:"small",class:"setting-card"},{default:s(()=>[t(o).state.userInfo.activation&&t(o).state.userInfo.activation.length>0?(r(),h("div",yu,[p(U(t(o).state.userInfo.activation)+" ",1),y.value?f("",!0):(r(),k(m,{key:0,quaternary:"",round:"",type:"success",onClick:e[8]||(e[8]=l=>y.value=!0)},{default:s(()=>[ku]),_:1}))])):(r(),h("div",bu,[u(ue,{title:"\u6FC0\u6D3B\u7801\u6FC0\u6D3B\u63D0\u793A",type:"warning"},{default:s(()=>[Eu,Au,y.value?f("",!0):(r(),h("a",{key:0,class:"hash-link",onClick:e[9]||(e[9]=l=>y.value=!0)}," \u7ACB\u5373\u6FC0\u6D3B "))]),_:1})])),y.value?(r(),h("div",Iu,[u(J,{ref_key:"activateFormRef",ref:Q,model:t(i),rules:Fe},{default:s(()=>[u(B,{path:"activate_code",label:"\u6FC0\u6D3B\u7801"},{default:s(()=>[u(w,{value:t(i).activate_code,"onUpdate:value":e[10]||(e[10]=l=>t(i).activate_code=l.trim()),placeholder:"\u8BF7\u8F93\u5165\u6FC0\u6D3B\u7801",onKeydown:e[11]||(e[11]=x(R(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),u(B,{path:"img_captcha",label:"\u56FE\u5F62\u9A8C\u8BC1\u7801"},{default:s(()=>[d("div",$u,[u(w,{value:t(i).imgCaptcha,"onUpdate:value":e[12]||(e[12]=l=>t(i).imgCaptcha=l),placeholder:"\u8BF7\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801\u540E\u83B7\u53D6\u9A8C\u8BC1\u7801"},null,8,["value"]),d("div",Pu,[t(i).b64s?(r(),h("img",{key:0,src:t(i).b64s,onClick:O},null,8,Uu)):f("",!0)])])]),_:1}),u(G,{gutter:[0,24]},{default:s(()=>[u(W,{span:24},{default:s(()=>[d("div",xu,[u(m,{quaternary:"",round:"",onClick:e[13]||(e[13]=l=>y.value=!1)},{default:s(()=>[Ru]),_:1}),u(m,{secondary:"",round:"",type:"primary",loading:z.value,onClick:me},{default:s(()=>[Su]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):f("",!0)]),_:1})):f("",!0),u(M,{title:"\u8D26\u6237\u5B89\u5168",size:"small",class:"setting-card"},{default:s(()=>[qu,$.value?f("",!0):(r(),k(m,{key:0,quaternary:"",round:"",type:"success",onClick:e[14]||(e[14]=l=>$.value=!0)},{default:s(()=>[zu]),_:1})),$.value?(r(),h("div",Nu,[u(J,{ref_key:"formRef",ref:X,model:t(a),rules:Ce},{default:s(()=>[u(B,{path:"old_password",label:"\u65E7\u5BC6\u7801"},{default:s(()=>[u(w,{value:t(a).old_password,"onUpdate:value":e[15]||(e[15]=l=>t(a).old_password=l),type:"password",placeholder:"\u8BF7\u8F93\u5165\u5F53\u524D\u5BC6\u7801",onKeydown:e[16]||(e[16]=x(R(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),u(B,{path:"password",label:"\u65B0\u5BC6\u7801"},{default:s(()=>[u(w,{value:t(a).password,"onUpdate:value":e[17]||(e[17]=l=>t(a).password=l),type:"password",placeholder:"\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801",onInput:pe,onKeydown:e[18]||(e[18]=x(R(()=>{},["prevent"]),["enter"]))},null,8,["value"])]),_:1}),u(B,{ref_key:"rPasswordFormItemRef",ref:ee,first:"",path:"reenteredPassword",label:"\u91CD\u590D\u5BC6\u7801"},{default:s(()=>[u(w,{value:t(a).reenteredPassword,"onUpdate:value":e[19]||(e[19]=l=>t(a).reenteredPassword=l),disabled:!t(a).password,type:"password",placeholder:"\u8BF7\u518D\u6B21\u8F93\u5165\u5BC6\u7801",onKeydown:e[20]||(e[20]=x(R(()=>{},["prevent"]),["enter"]))},null,8,["value","disabled"])]),_:1},512),u(G,{gutter:[0,24]},{default:s(()=>[u(W,{span:24},{default:s(()=>[d("div",Ku,[u(m,{quaternary:"",round:"",onClick:e[21]||(e[21]=l=>$.value=!1)},{default:s(()=>[Mu]),_:1}),u(m,{secondary:"",round:"",type:"primary",loading:N.value,onClick:_e},{default:s(()=>[Vu]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["model"])])):f("",!0)]),_:1})])}}});var Yu=$e(ju,[["__scopeId","data-v-6eb93a4d"]]);export{Yu as default}; diff --git a/web/dist/assets/Skeleton.57e98fe3.js b/web/dist/assets/Skeleton.57e98fe3.js deleted file mode 100644 index b1c2be91..00000000 --- a/web/dist/assets/Skeleton.57e98fe3.js +++ /dev/null @@ -1,135 +0,0 @@ -import{d as O,h as a,aD as Oe,aE as Be,a1 as ce,b1 as Fe,s as w,r as F,j as q,av as Y,au as D,b2 as ue,b3 as te,aH as J,b4 as Le,l as M,m as L,n as U,u as fe,q as K,b5 as $e,I as Ee,i as Z,b6 as He,v as H,y as ve,N as he,b7 as Q,aX as Ve,aJ as me,o as A,p as je,aO as Ae,t as B,b8 as De,b9 as Ke,S as ne,aF as Ge,ba as oe,A as ie,bb as We,z as qe,ay as Ue,bc as Ze,K as Xe,bd as Je,a$ as le,be as Ye,c as Qe,aa as et}from"./index.f480f018.js";import{l as tt}from"./List.49bcdf81.js";let re=!1;function nt(){if(typeof window!="undefined"&&!!window.CSS&&!re&&(re=!0,"registerProperty"in(window==null?void 0:window.CSS)))try{CSS.registerProperty({name:"--n-color-start",syntax:"",inherits:!1,initialValue:"#0000"}),CSS.registerProperty({name:"--n-color-end",syntax:"",inherits:!1,initialValue:"#0000"})}catch{}}var ot=O({name:"Checkmark",render(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},a("g",{fill:"none"},a("path",{d:"M14.046 3.486a.75.75 0 0 1-.032 1.06l-7.93 7.474a.85.85 0 0 1-1.188-.022l-2.68-2.72a.75.75 0 1 1 1.068-1.053l2.234 2.267l7.468-7.038a.75.75 0 0 1 1.06.032z",fill:"currentColor"})))}}),it=O({name:"Empty",render(){return a("svg",{viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("path",{d:"M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM16.8536 4.14645C16.6583 3.95118 16.3417 3.95118 16.1464 4.14645C15.9512 4.34171 15.9512 4.65829 16.1464 4.85355L18.7929 7.5L16.1464 10.1464C15.9512 10.3417 15.9512 10.6583 16.1464 10.8536C16.3417 11.0488 16.6583 11.0488 16.8536 10.8536L19.5 8.20711L22.1464 10.8536C22.3417 11.0488 22.6583 11.0488 22.8536 10.8536C23.0488 10.6583 23.0488 10.3417 22.8536 10.1464L20.2071 7.5L22.8536 4.85355C23.0488 4.65829 23.0488 4.34171 22.8536 4.14645C22.6583 3.95118 22.3417 3.95118 22.1464 4.14645L19.5 6.79289L16.8536 4.14645Z",fill:"currentColor"}),a("path",{d:"M25 22.75V12.5991C24.5572 13.0765 24.053 13.4961 23.5 13.8454V16H17.5L17.3982 16.0068C17.0322 16.0565 16.75 16.3703 16.75 16.75C16.75 18.2688 15.5188 19.5 14 19.5C12.4812 19.5 11.25 18.2688 11.25 16.75L11.2432 16.6482C11.1935 16.2822 10.8797 16 10.5 16H4.5V7.25C4.5 6.2835 5.2835 5.5 6.25 5.5H12.2696C12.4146 4.97463 12.6153 4.47237 12.865 4H6.25C4.45507 4 3 5.45507 3 7.25V22.75C3 24.5449 4.45507 26 6.25 26H21.75C23.5449 26 25 24.5449 25 22.75ZM4.5 22.75V17.5H9.81597L9.85751 17.7041C10.2905 19.5919 11.9808 21 14 21L14.215 20.9947C16.2095 20.8953 17.842 19.4209 18.184 17.5H23.5V22.75C23.5 23.7165 22.7165 24.5 21.75 24.5H6.25C5.2835 24.5 4.5 23.7165 4.5 22.75Z",fill:"currentColor"}))}}),lt=O({props:{onFocus:Function,onBlur:Function},setup(e){return()=>a("div",{style:"width: 0; height: 0",tabindex:0,onFocus:e.onFocus,onBlur:e.onBlur})}});function se(e){return e&-e}class rt{constructor(t,o){this.l=t,this.min=o;const i=new Array(t+1);for(let r=0;rr)throw new Error("[FinweckTree.sum]: `i` is larger than length.");let d=t*i;for(;t>0;)d+=o[t],t-=se(t);return d}getBound(t){let o=0,i=this.l;for(;i>o;){const r=Math.floor((o+i)/2),d=this.sum(r);if(d>t){i=r;continue}else if(d[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:"div"},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:"key"},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},setup(e){const t=Oe();st.mount({id:"vueuc/virtual-list",head:!0,anchorMetaName:Be,ssr:t}),ce(()=>{const{defaultScrollIndex:s,defaultScrollKey:c}=e;s!=null?m({index:s}):c!=null&&m({key:c})}),Fe(()=>{m({top:k.value})});const o=w(()=>{const s=new Map,{keyField:c}=e;return e.items.forEach((R,S)=>{s.set(R[c],S)}),s}),i=F(null),r=F(void 0),d=new Map,u=w(()=>{const{items:s,itemSize:c,keyField:R}=e,S=new rt(s.length,c);return s.forEach((C,z)=>{const b=C[R],_=d.get(b);_!==void 0&&S.add(z,_)}),S}),h=F(0),k=F(0),f=q(()=>Math.max(u.value.getBound(k.value-Y(e.paddingTop))-1,0)),v=w(()=>{const{value:s}=r;if(s===void 0)return[];const{items:c,itemSize:R}=e,S=f.value,C=Math.min(S+Math.ceil(s/R+1),c.length-1),z=[];for(let b=S;b<=C;++b)z.push(c[b]);return z}),m=s=>{const{left:c,top:R,index:S,key:C,position:z,behavior:b,debounce:_=!0}=s;if(c!==void 0||R!==void 0)g(c,R,b);else if(S!==void 0)y(S,b,_);else if(C!==void 0){const V=o.value.get(C);V!==void 0&&y(V,b,_)}else z==="bottom"?g(0,Number.MAX_SAFE_INTEGER,b):z==="top"&&g(0,0,b)};function y(s,c,R){const{value:S}=u,C=S.sum(s)+Y(e.paddingTop);if(!R)i.value.scrollTo({left:0,top:C,behavior:c});else{const{scrollTop:z,offsetHeight:b}=i.value;if(C>z){const _=S.get(s);C+_<=z+b||i.value.scrollTo({left:0,top:C+_-b,behavior:c})}else i.value.scrollTo({left:0,top:C,behavior:c})}I=s}function g(s,c,R){i.value.scrollTo({left:s,top:c,behavior:R})}function p(s,c){var R,S,C,z;if(e.ignoreItemResize||E(c.target))return;const{value:b}=u,_=o.value.get(s),V=b.get(_),j=(C=(S=(R=c.borderBoxSize)===null||R===void 0?void 0:R[0])===null||S===void 0?void 0:S.blockSize)!==null&&C!==void 0?C:c.contentRect.height;if(j===V)return;j-e.itemSize===0?d.delete(s):d.set(s,j-e.itemSize);const P=j-V;P!==0&&($!==void 0&&_<=$&&((z=i.value)===null||z===void 0||z.scrollBy(0,P)),b.add(_,P),h.value++)}function x(s){Le(G);const{onScroll:c}=e;c!==void 0&&c(s)}function N(s){if(E(s.target)||s.contentRect.height===r.value)return;r.value=s.contentRect.height;const{onResize:c}=e;c!==void 0&&c(s)}let I,$;function G(){const{value:s}=i;s!=null&&($=I!=null?I:f.value,I=void 0,k.value=i.value.scrollTop)}function E(s){let c=s;for(;c!==null;){if(c.style.display==="none")return!0;c=c.parentElement}return!1}return{listHeight:r,listStyle:{overflow:"auto"},keyToIndex:o,itemsStyle:w(()=>{const{itemResizable:s}=e,c=D(u.value.sum());return h.value,[e.itemsStyle,{boxSizing:"content-box",height:s?"":c,minHeight:s?c:"",paddingTop:D(e.paddingTop),paddingBottom:D(e.paddingBottom)}]}),visibleItemsStyle:w(()=>(h.value,{transform:`translateY(${D(u.value.sum(f.value))})`})),viewportItems:v,listElRef:i,itemsElRef:F(null),scrollTo:m,handleListResize:N,handleListScroll:x,handleItemResize:p}},render(){const{itemResizable:e,keyField:t,keyToIndex:o,visibleItemsTag:i}=this;return a(te,{onResize:this.handleListResize},{default:()=>{var r,d;return a("div",ue(this.$attrs,{class:["v-vl",this.showScrollbar&&"v-vl--show-scrollbar"],onScroll:this.handleListScroll,onWheel:this.onWheel,ref:"listElRef"}),[this.items.length!==0?a("div",{ref:"itemsElRef",class:"v-vl-items",style:this.itemsStyle},[a(i,Object.assign({class:"v-vl-visible-items",style:this.visibleItemsStyle},this.visibleItemsProps),{default:()=>this.viewportItems.map(u=>{const h=u[t],k=o.get(h),f=this.$slots.default({item:u,index:k})[0];return e?a(te,{key:h,onResize:v=>this.handleItemResize(h,v)},{default:()=>f}):(f.key=h,f)})})]):(d=(r=this.$slots).empty)===null||d===void 0?void 0:d.call(r)])}})}}),dt=M("empty",` - display: flex; - flex-direction: column; - align-items: center; - font-size: var(--n-font-size); -`,[L("icon",` - width: var(--n-icon-size); - height: var(--n-icon-size); - font-size: var(--n-icon-size); - line-height: var(--n-icon-size); - color: var(--n-icon-color); - transition: - color .3s var(--n-bezier); - `,[U("+",[L("description",` - margin-top: 8px; - `)])]),L("description",` - transition: color .3s var(--n-bezier); - color: var(--n-text-color); - `),L("extra",` - text-align: center; - transition: color .3s var(--n-bezier); - margin-top: 12px; - color: var(--n-extra-text-color); - `)]);const ct=Object.assign(Object.assign({},K.props),{description:String,showDescription:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},size:{type:String,default:"medium"},renderIcon:Function});var ut=O({name:"Empty",props:ct,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:o}=fe(e),i=K("Empty","-empty",dt,$e,e,t),{localeRef:r}=Ee("Empty"),d=Z(He,null),u=w(()=>{var v,m,y;return(v=e.description)!==null&&v!==void 0?v:(y=(m=d==null?void 0:d.mergedComponentPropsRef.value)===null||m===void 0?void 0:m.Empty)===null||y===void 0?void 0:y.description}),h=w(()=>{var v,m;return((m=(v=d==null?void 0:d.mergedComponentPropsRef.value)===null||v===void 0?void 0:v.Empty)===null||m===void 0?void 0:m.renderIcon)||(()=>a(it,null))}),k=w(()=>{const{size:v}=e,{common:{cubicBezierEaseInOut:m},self:{[H("iconSize",v)]:y,[H("fontSize",v)]:g,textColor:p,iconColor:x,extraTextColor:N}}=i.value;return{"--n-icon-size":y,"--n-font-size":g,"--n-bezier":m,"--n-text-color":p,"--n-icon-color":x,"--n-extra-text-color":N}}),f=o?ve("empty",w(()=>{let v="";const{size:m}=e;return v+=m[0],v}),k,e):void 0;return{mergedClsPrefix:t,mergedRenderIcon:h,localizedDescription:w(()=>u.value||r.value.description),cssVars:o?void 0:k,themeClass:f==null?void 0:f.themeClass,onRender:f==null?void 0:f.onRender}},render(){const{$slots:e,mergedClsPrefix:t,onRender:o}=this;return o==null||o(),a("div",{class:[`${t}-empty`,this.themeClass],style:this.cssVars},this.showIcon?a("div",{class:`${t}-empty__icon`},e.icon?e.icon():a(he,{clsPrefix:t},{default:this.mergedRenderIcon})):null,this.showDescription?a("div",{class:`${t}-empty__description`},e.default?e.default():this.localizedDescription):null,e.extra?a("div",{class:`${t}-empty__extra`},e.extra()):null)}});const ft=a(ot);function vt(e,t){return a(Ve,{name:"fade-in-scale-up-transition"},{default:()=>e?a(he,{clsPrefix:t,class:`${t}-base-select-option__check`},{default:()=>ft}):null})}var ae=O({name:"NBaseSelectOption",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(e){const{valueRef:t,pendingTmNodeRef:o,multipleRef:i,valueSetRef:r,renderLabelRef:d,renderOptionRef:u,handleOptionClick:h,handleOptionMouseEnter:k}=Z(Q),f=q(()=>{const{value:g}=o;return g?e.tmNode.key===g.key:!1});function v(g){const{tmNode:p}=e;p.disabled||h(g,p)}function m(g){const{tmNode:p}=e;p.disabled||k(g,p)}function y(g){const{tmNode:p}=e,{value:x}=f;p.disabled||x||k(g,p)}return{multiple:i,isGrouped:q(()=>{const{tmNode:g}=e,{parent:p}=g;return p&&p.rawNode.type==="group"}),isPending:f,isSelected:q(()=>{const{value:g}=t,{value:p}=i;if(g===null)return!1;const x=e.tmNode.rawNode.value;if(p){const{value:N}=r;return N.has(x)}else return g===x}),renderLabel:d,renderOption:u,handleMouseMove:y,handleMouseEnter:m,handleClick:v}},render(){const{clsPrefix:e,tmNode:{rawNode:t},isSelected:o,isPending:i,isGrouped:r,multiple:d,renderOption:u,renderLabel:h,handleClick:k,handleMouseEnter:f,handleMouseMove:v}=this,y=vt(d&&o,e),g=h?[h(t,o),y]:[me(t.label,t,o),y],p=a("div",{class:[`${e}-base-select-option`,t.class,{[`${e}-base-select-option--disabled`]:t.disabled,[`${e}-base-select-option--selected`]:o,[`${e}-base-select-option--grouped`]:r,[`${e}-base-select-option--pending`]:i}],style:t.style,onClick:k,onMouseenter:f,onMousemove:v},a("div",{class:`${e}-base-select-option__content`},g));return t.render?t.render({node:p,option:t,selected:o}):u?u({node:p,option:t,selected:o}):p}}),de=O({name:"NBaseSelectGroupHeader",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(){const{renderLabelRef:e,renderOptionRef:t}=Z(Q);return{renderLabel:e,renderOption:t}},render(){const{clsPrefix:e,renderLabel:t,renderOption:o,tmNode:{rawNode:i}}=this,r=t?t(i,!1):me(i.label,i,!1),d=a("div",{class:`${e}-base-select-group-header`},r);return i.render?i.render({node:d,option:i}):o?o({node:d,option:i,selected:!1}):d}}),ht=M("base-select-menu",` - line-height: 1.5; - outline: none; - z-index: 0; - position: relative; - border-radius: var(--n-border-radius); - transition: - background-color .3s var(--n-bezier), - box-shadow .3s var(--n-bezier); - background-color: var(--n-color); -`,[A("multiple",[M("base-select-option",` - padding-right: 28px; - `)]),M("scrollbar",` - max-height: var(--n-height); - `),M("virtual-list",` - max-height: var(--n-height); - `),M("base-select-option",` - min-height: var(--n-option-height); - font-size: var(--n-option-font-size); - display: flex; - align-items: center; - `,[L("content",` - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - `)]),M("base-select-group-header",` - min-height: var(--n-option-height); - font-size: .93em; - display: flex; - align-items: center; - `),M("base-select-menu-option-wrapper",` - position: relative; - width: 100%; - `),L("loading, empty",` - display: flex; - padding: 12px 32px; - flex: 1; - justify-content: center; - `),L("loading",` - color: var(--n-loading-color); - font-size: var(--n-loading-size); - `),L("action",` - padding: 8px var(--n-option-padding-left); - font-size: var(--n-option-font-size); - transition: - color .3s var(--n-bezier); - border-color .3s var(--n-bezier); - border-top: 1px solid var(--n-action-divider-color); - color: var(--n-action-text-color); - `),M("base-select-group-header",` - position: relative; - cursor: default; - padding: var(--n-option-padding); - color: var(--n-group-header-text-color); - `),M("base-select-option",` - cursor: pointer; - position: relative; - padding: var(--n-option-padding); - transition: - background-color .3s var(--n-bezier), - color .3s var(--n-bezier), - opacity .3s var(--n-bezier); - box-sizing: border-box; - color: var(--n-option-text-color); - opacity: 1; - `,[U("&:active",` - color: var(--n-option-text-color-pressed); - `),A("grouped",` - padding-left: calc(var(--n-option-padding-left) * 1.5); - `),A("pending",` - background-color: var(--n-option-color-pending); - `),A("selected",` - color: var(--n-option-text-color-active); - background-color: var(--n-option-color-active); - `),A("disabled",` - cursor: not-allowed; - `,[je("selected",` - color: var(--n-option-text-color-disabled); - `),A("selected",` - opacity: var(--n-option-opacity-disabled); - `)]),L("check",` - font-size: 16px; - position: absolute; - right: 8px; - top: calc(50% - 7px); - color: var(--n-option-check-color); - transition: color .3s var(--n-bezier); - `,[Ae({enterScale:"0.5"})])])]),St=O({name:"InternalSelectMenu",props:Object.assign(Object.assign({},K.props),{clsPrefix:{type:String,required:!0},scrollable:{type:Boolean,default:!0},treeMate:{type:Object,required:!0},multiple:Boolean,size:{type:String,default:"medium"},value:{type:[String,Number,Array],default:null},width:[Number,String],autoPending:Boolean,virtualScroll:{type:Boolean,default:!0},show:{type:Boolean,default:!0},loading:Boolean,focusable:Boolean,renderLabel:Function,renderOption:Function,onMousedown:Function,onScroll:Function,onFocus:Function,onBlur:Function,onKeyup:Function,onKeydown:Function,onTabOut:Function,onMouseenter:Function,onMouseleave:Function,resetMenuOnOptionsChange:{type:Boolean,default:!0},inlineThemeDisabled:Boolean,onToggle:Function}),setup(e){const t=K("InternalSelectMenu","-internal-select-menu",ht,De,e,B(e,"clsPrefix")),o=F(null),i=F(null),r=F(null),d=w(()=>e.treeMate.getFlattenedNodes()),u=w(()=>Ke(d.value)),h=F(null);function k(){const{treeMate:n}=e;let l=null;if(e.autoPending){const{value:T}=e;T===null?l=n.getFirstAvailableNode():(e.multiple?l=n.getNode((T||[])[(T||[]).length-1]):l=n.getNode(T),(!l||l.disabled)&&(l=n.getFirstAvailableNode())),l&&z(l)}}let f;ne(B(e,"show"),n=>{n?f=ne(e.resetMenuOnOptionsChange?[B(e,"treeMate"),B(e,"multiple")]:[B(e,"multiple")],()=>{k(),Ge(b)},{immediate:!0}):f==null||f()},{immediate:!0});const v=w(()=>Y(t.value.self[H("optionHeight",e.size)])),m=w(()=>oe(t.value.self[H("padding",e.size)])),y=w(()=>e.multiple&&Array.isArray(e.value)?new Set(e.value):new Set),g=w(()=>{const n=d.value;return n&&n.length===0});function p(n){const{onToggle:l}=e;l&&l(n)}function x(n){const{onScroll:l}=e;l&&l(n)}function N(n){var l;(l=r.value)===null||l===void 0||l.sync(),x(n)}function I(){var n;(n=r.value)===null||n===void 0||n.sync()}function $(){const{value:n}=h;return n||null}function G(n,l){l.disabled||z(l,!1)}function E(n,l){l.disabled||p(l)}function s(n){var l;le(n,"action")||(l=e.onKeyup)===null||l===void 0||l.call(e,n)}function c(n){var l;le(n,"action")||(l=e.onKeydown)===null||l===void 0||l.call(e,n)}function R(n){var l;(l=e.onMousedown)===null||l===void 0||l.call(e,n),!e.focusable&&n.preventDefault()}function S(){const{value:n}=h;n&&z(n.getNext({loop:!0}),!0)}function C(){const{value:n}=h;n&&z(n.getPrev({loop:!0}),!0)}function z(n,l=!1){h.value=n,l&&b()}function b(){var n,l;const T=h.value;if(!T)return;const W=u.value(T.key);W!==null&&(e.virtualScroll?(n=i.value)===null||n===void 0||n.scrollTo({index:W}):(l=r.value)===null||l===void 0||l.scrollTo({index:W,elSize:v.value}))}function _(n){var l,T;!((l=o.value)===null||l===void 0)&&l.contains(n.target)&&((T=e.onFocus)===null||T===void 0||T.call(e,n))}function V(n){var l,T;!((l=o.value)===null||l===void 0)&&l.contains(n.relatedTarget)||(T=e.onBlur)===null||T===void 0||T.call(e,n)}ie(Q,{handleOptionMouseEnter:G,handleOptionClick:E,valueSetRef:y,multipleRef:B(e,"multiple"),valueRef:B(e,"value"),renderLabelRef:B(e,"renderLabel"),renderOptionRef:B(e,"renderOption"),pendingTmNodeRef:h}),ie(We,o),ce(()=>{const{value:n}=r;n&&n.sync()});const j=w(()=>{const{size:n}=e,{common:{cubicBezierEaseInOut:l},self:{height:T,borderRadius:W,color:pe,groupHeaderTextColor:be,actionDividerColor:ye,optionTextColorPressed:xe,optionTextColor:Se,optionTextColorDisabled:ze,optionTextColorActive:we,optionOpacityDisabled:Re,optionCheckColor:Ce,actionTextColor:ke,optionColorPending:Te,optionColorActive:_e,loadingColor:Ne,loadingSize:Me,[H("optionFontSize",n)]:Ie,[H("optionHeight",n)]:Pe,[H("optionPadding",n)]:ee}}=t.value;return{"--n-height":T,"--n-action-divider-color":ye,"--n-action-text-color":ke,"--n-bezier":l,"--n-border-radius":W,"--n-color":pe,"--n-option-font-size":Ie,"--n-group-header-text-color":be,"--n-option-check-color":Ce,"--n-option-color-pending":Te,"--n-option-color-active":_e,"--n-option-height":Pe,"--n-option-opacity-disabled":Re,"--n-option-text-color":Se,"--n-option-text-color-active":we,"--n-option-text-color-disabled":ze,"--n-option-text-color-pressed":xe,"--n-option-padding":ee,"--n-option-padding-left":oe(ee,"left"),"--n-loading-color":Ne,"--n-loading-size":Me}}),{inlineThemeDisabled:X}=e,P=X?ve("internal-select-menu",w(()=>e.size[0]),j,e):void 0,ge={selfRef:o,next:S,prev:C,getPendingTmNode:$};return Object.assign({mergedTheme:t,virtualListRef:i,scrollbarRef:r,itemSize:v,padding:m,flattenedNodes:d,empty:g,virtualListContainer(){const{value:n}=i;return n==null?void 0:n.listElRef},virtualListContent(){const{value:n}=i;return n==null?void 0:n.itemsElRef},doScroll:x,handleFocusin:_,handleFocusout:V,handleKeyUp:s,handleKeyDown:c,handleMouseDown:R,handleVirtualListResize:I,handleVirtualListScroll:N,cssVars:X?void 0:j,themeClass:P==null?void 0:P.themeClass,onRender:P==null?void 0:P.onRender},ge)},render(){const{$slots:e,virtualScroll:t,clsPrefix:o,mergedTheme:i,themeClass:r,onRender:d}=this;return d==null||d(),a("div",{ref:"selfRef",tabindex:this.focusable?0:-1,class:[`${o}-base-select-menu`,r,this.multiple&&`${o}-base-select-menu--multiple`],style:[{width:Je(this.width)},this.cssVars],onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onKeyup:this.handleKeyUp,onKeydown:this.handleKeyDown,onMousedown:this.handleMouseDown,onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave},this.loading?a("div",{class:`${o}-base-select-menu__loading`},a(Ue,{clsPrefix:o,strokeWidth:20})):this.empty?a("div",{class:`${o}-base-select-menu__empty`},Xe(e.empty,()=>[a(ut,{theme:i.peers.Empty,themeOverrides:i.peerOverrides.Empty})])):a(Ze,{ref:"scrollbarRef",theme:i.peers.Scrollbar,themeOverrides:i.peerOverrides.Scrollbar,scrollable:this.scrollable,container:t?this.virtualListContainer:void 0,content:t?this.virtualListContent:void 0,onScroll:t?void 0:this.doScroll},{default:()=>t?a(at,{ref:"virtualListRef",class:`${o}-virtual-list`,items:this.flattenedNodes,itemSize:this.itemSize,showScrollbar:!1,paddingTop:this.padding.top,paddingBottom:this.padding.bottom,onResize:this.handleVirtualListResize,onScroll:this.handleVirtualListScroll,itemResizable:!0},{default:({item:u})=>u.isGroup?a(de,{key:u.key,clsPrefix:o,tmNode:u}):u.ignored?null:a(ae,{clsPrefix:o,key:u.key,tmNode:u})}):a("div",{class:`${o}-base-select-menu-option-wrapper`,style:{paddingTop:this.padding.top,paddingBottom:this.padding.bottom}},this.flattenedNodes.map(u=>u.isGroup?a(de,{key:u.key,clsPrefix:o,tmNode:u}):a(ae,{clsPrefix:o,key:u.key,tmNode:u})))}),qe(e.action,u=>u&&[a("div",{class:`${o}-base-select-menu__action`,"data-action":!0,key:"action"},u),a(lt,{onFocus:this.onTabOut,key:"focus-detector"})]))}}),zt=O({name:"ListItem",setup(){const e=Z(tt,null);return e||Ye("list-item","`n-list-item` must be placed in `n-list`."),{mergedClsPrefix:e.mergedClsPrefixRef}},render(){const{$slots:e,mergedClsPrefix:t}=this;return a("li",{class:`${t}-list-item`},e.prefix?a("div",{class:`${t}-list-item__prefix`},e.prefix()):null,e.default?a("div",{class:`${t}-list-item__main`},e):null,e.suffix?a("div",{class:`${t}-list-item__suffix`},e.suffix()):null)}});const mt=e=>{const{heightSmall:t,heightMedium:o,heightLarge:i,borderRadius:r}=e;return{color:"#eee",colorEnd:"#ddd",borderRadius:r,heightSmall:t,heightMedium:o,heightLarge:i}},gt={name:"Skeleton",common:Qe,self:mt};var pt=U([M("skeleton",` - height: 1em; - width: 100%; - transition: background-color .3s var(--n-bezier); - transition: - --n-color-start .3s var(--n-bezier), - --n-color-end .3s var(--n-bezier), - background-color .3s var(--n-bezier); - animation: 2s skeleton-loading infinite cubic-bezier(0.36, 0, 0.64, 1); - background-color: var(--n-color-start); - `),U("@keyframes skeleton-loading",` - 0% { - background: var(--n-color-start); - } - 40% { - background: var(--n-color-end); - } - 80% { - background: var(--n-color-start); - } - 100% { - background: var(--n-color-start); - } - `)]);const bt=Object.assign(Object.assign({},K.props),{text:Boolean,round:Boolean,circle:Boolean,height:[String,Number],width:[String,Number],size:String,repeat:{type:Number,default:1},animated:{type:Boolean,default:!0},sharp:{type:Boolean,default:!0}});var wt=O({name:"Skeleton",inheritAttrs:!1,props:bt,setup(e){nt();const{mergedClsPrefixRef:t}=fe(e),o=K("Skeleton","-skeleton",pt,gt,e,t);return{mergedClsPrefix:t,style:w(()=>{var i,r;const d=o.value,{common:{cubicBezierEaseInOut:u}}=d,h=d.self,{color:k,colorEnd:f,borderRadius:v}=h;let m;const{circle:y,sharp:g,round:p,width:x,height:N,size:I,text:$,animated:G}=e;I!==void 0&&(m=h[H("height",I)]);const E=y?(i=x!=null?x:N)!==null&&i!==void 0?i:m:x,s=(r=y&&x!=null?x:N)!==null&&r!==void 0?r:m;return{display:$?"inline-block":"",verticalAlign:$?"-0.125em":"",borderRadius:y?"50%":p?"4096px":g?"":v,width:typeof E=="number"?D(E):E,height:typeof s=="number"?D(s):s,animation:G?"":"none","--n-bezier":u,"--n-color-start":k,"--n-color-end":f}})}},render(){const{repeat:e,style:t,mergedClsPrefix:o,$attrs:i}=this,r=a("div",ue({class:`${o}-skeleton`,style:t},i));return e>1?a(et,null,Array.apply(null,{length:e}).map(d=>[r,` -`])):r}});export{St as N,zt as _,ut as a,wt as b,nt as u}; diff --git a/web/dist/assets/Thing.eef6b133.js b/web/dist/assets/Thing.eef6b133.js deleted file mode 100644 index 9a4ec7d5..00000000 --- a/web/dist/assets/Thing.eef6b133.js +++ /dev/null @@ -1,34 +0,0 @@ -import{l as r,m as l,n as c,d as _,u as s,q as v,bq as $,s as b,y as w,h as i,aa as E}from"./index.f480f018.js";var z=r("thing",` - display: flex; - transition: color .3s var(--n-bezier); - font-size: var(--n-font-size); - color: var(--n-text-color); -`,[r("thing-avatar",` - margin-right: 12px; - margin-top: 2px; - `),r("thing-avatar-header-wrapper",` - display: flex; - flex-wrap: nowrap; - `,[r("thing-header-wrapper",` - flex: 1; - `)]),r("thing-main",` - flex-grow: 1; - `,[r("thing-header",` - display: flex; - margin-bottom: 4px; - justify-content: space-between; - align-items: center; - `,[l("title",` - font-size: 16px; - font-weight: var(--n-title-font-weight); - transition: color .3s var(--n-bezier); - color: var(--n-title-text-color); - `)]),l("description",[c("&:not(:last-child)",` - margin-bottom: 4px; - `)]),l("content",[c("&:not(:first-child)",` - margin-top: 12px; - `)]),l("footer",[c("&:not(:first-child)",` - margin-top: 12px; - `)]),l("action",[c("&:not(:first-child)",` - margin-top: 12px; - `)])])]);const C=Object.assign(Object.assign({},v.props),{title:String,titleExtra:String,description:String,content:String,contentIndented:{type:Boolean,default:!1}});var T=_({name:"Thing",props:C,setup(t,{slots:e}){const{mergedClsPrefixRef:h,inlineThemeDisabled:g}=s(t),x=v("Thing","-thing",z,$,t,h),o=b(()=>{const{self:{titleTextColor:d,textColor:n,titleFontWeight:u,fontSize:f},common:{cubicBezierEaseInOut:m}}=x.value;return{"--n-bezier":m,"--n-font-size":f,"--n-text-color":n,"--n-title-font-weight":u,"--n-title-text-color":d}}),a=g?w("thing",void 0,o,t):void 0;return()=>{var d;const{value:n}=h;return(d=a==null?void 0:a.onRender)===null||d===void 0||d.call(a),i("div",{class:[`${n}-thing`,a==null?void 0:a.themeClass],style:g?void 0:o.value},e.avatar&&t.contentIndented?i("div",{class:`${n}-thing-avatar`},e.avatar()):null,i("div",{class:`${n}-thing-main`},!t.contentIndented&&(e.header||t.title||e["header-extra"]||t.titleExtra||e.avatar)?i("div",{class:`${n}-thing-avatar-header-wrapper`},e.avatar?i("div",{class:`${n}-thing-avatar`},e.avatar()):null,e.header||t.title||e["header-extra"]||t.titleExtra?i("div",{class:`${n}-thing-header-wrapper`},i("div",{class:`${n}-thing-header`},e.header||t.title?i("div",{class:`${n}-thing-header__title`},e.header?e.header():t.title):null,e["header-extra"]||t.titleExtra?i("div",{class:`${n}-thing-header__extra`},e["header-extra"]?e["header-extra"]():t.titleExtra):null),e.description||t.description?i("div",{class:`${n}-thing-main__description`},e.description?e.description():t.description):null):null):i(E,null,e.header||t.title||e["header-extra"]||t.titleExtra?i("div",{class:`${n}-thing-header`},e.header||t.title?i("div",{class:`${n}-thing-header__title`},e.header?e.header():t.title):null,e["header-extra"]||t.titleExtra?i("div",{class:`${n}-thing-header__extra`},e["header-extra"]?e["header-extra"]():t.titleExtra):null):null,e.description||t.description?i("div",{class:`${n}-thing-main__description`},e.description?e.description():t.description):null),e.default||t.content?i("div",{class:`${n}-thing-main__content`},e.default?e.default():t.content):null,e.footer?i("div",{class:`${n}-thing-main__footer`},e.footer()):null,e.action?i("div",{class:`${n}-thing-main__action`},e.action()):null))}}});export{T as _}; diff --git a/web/dist/assets/Topic.9a2ef7f9.css b/web/dist/assets/Topic.9a2ef7f9.css deleted file mode 100644 index 989189ad..00000000 --- a/web/dist/assets/Topic.9a2ef7f9.css +++ /dev/null @@ -1 +0,0 @@ -.tags-wrap[data-v-ec1d2778]{padding:20px}.tags-wrap .tag-item .tag-hot[data-v-ec1d2778]{margin-left:12px;font-size:12px;opacity:.75} diff --git a/web/dist/assets/Topic.c6bdf01d.js b/web/dist/assets/Topic.c6bdf01d.js deleted file mode 100644 index d4a28c39..00000000 --- a/web/dist/assets/Topic.c6bdf01d.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as T}from"./main-nav.9110259b.js";import{ah as w,d as x,r as s,a1 as B,al as D,V as _,W as r,a3 as a,a4 as n,c0 as V,aa as q,ab as C,c1 as E,c2 as N,ag as F,b_ as I,a5 as L,a8 as M,a9 as m,Y as S,ad as U,an as W}from"./index.f480f018.js";import{_ as Y}from"./List.49bcdf81.js";const $={class:"tag-hot"},j=x({setup(z){const c=s([]),u=s("hot"),o=s(!1),l=()=>{o.value=!0,V({type:u.value,num:50}).then(e=>{c.value=e,o.value=!1}).catch(e=>{o.value=!1})},i=e=>{u.value=e,l()};return B(()=>{l()}),(e,A)=>{const d=T,p=E,g=N,v=D("router-link"),f=U,h=W,y=F,b=I,k=Y;return _(),r("div",null,[a(d,{title:"\u8BDD\u9898"}),a(k,{class:"main-content-wrap tags-wrap",bordered:""},{default:n(()=>[a(g,{type:"line",animated:"","onUpdate:value":i},{default:n(()=>[a(p,{name:"hot",tab:"\u70ED\u95E8"}),a(p,{name:"new",tab:"\u6700\u65B0"})]),_:1}),a(b,{show:o.value},{default:n(()=>[a(y,null,{default:n(()=>[(_(!0),r(q,null,C(c.value,t=>(_(),L(h,{class:"tag-item",type:"success",round:"",key:t.id},{avatar:n(()=>[a(f,{src:t.user.avatar},null,8,["src"])]),default:n(()=>[a(v,{class:"hash-link",to:{name:"home",query:{q:t.tag,t:"tag"}}},{default:n(()=>[M(" #"+m(t.tag),1)]),_:2},1032,["to"]),S("span",$,"("+m(t.quote_num)+")",1)]),_:2},1024))),128))]),_:1})]),_:1},8,["show"])]),_:1})])}}});var K=w(j,[["__scopeId","data-v-ec1d2778"]]);export{K as default}; diff --git a/web/dist/assets/Upload.efe3adfd.js b/web/dist/assets/Upload.efe3adfd.js deleted file mode 100644 index 3ec3cd50..00000000 --- a/web/dist/assets/Upload.efe3adfd.js +++ /dev/null @@ -1,382 +0,0 @@ -import{br as q,h as t,n as $,l as f,o as C,d as A,s as R,bd as E,N as j,bs as re,bt as ie,bu as ne,bv as oe,u as ae,q as G,bw as be,v as J,y as le,e as ye,i as W,be as Y,L as we,bx as se,r as M,aK as xe,bl as Ce,J as V,by as Re,ax as ke,w as Be,bm as Pe,m as I,bz as Q,at as $e,bA as Le,f as Te,t as D,g as Se,A as ze,bB as De,aa as _e,R as Ie,aF as Oe,k as ee}from"./index.f480f018.js";var Fe=q("attach",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M3.25735931,8.70710678 L7.85355339,4.1109127 C8.82986412,3.13460197 10.4127766,3.13460197 11.3890873,4.1109127 C12.365398,5.08722343 12.365398,6.67013588 11.3890873,7.64644661 L6.08578644,12.9497475 C5.69526215,13.3402718 5.06209717,13.3402718 4.67157288,12.9497475 C4.28104858,12.5592232 4.28104858,11.9260582 4.67157288,11.5355339 L9.97487373,6.23223305 C10.1701359,6.0369709 10.1701359,5.72038841 9.97487373,5.52512627 C9.77961159,5.32986412 9.4630291,5.32986412 9.26776695,5.52512627 L3.96446609,10.8284271 C3.18341751,11.6094757 3.18341751,12.8758057 3.96446609,13.6568542 C4.74551468,14.4379028 6.01184464,14.4379028 6.79289322,13.6568542 L12.0961941,8.35355339 C13.4630291,6.98671837 13.4630291,4.77064094 12.0961941,3.40380592 C10.7293591,2.0369709 8.51328163,2.0369709 7.14644661,3.40380592 L2.55025253,8 C2.35499039,8.19526215 2.35499039,8.51184464 2.55025253,8.70710678 C2.74551468,8.90236893 3.06209717,8.90236893 3.25735931,8.70710678 Z"}))))),je=q("trash",t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t("path",{d:"M432,144,403.33,419.74A32,32,0,0,1,371.55,448H140.46a32,32,0,0,1-31.78-28.26L80,144",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("rect",{x:"32",y:"64",width:"448",height:"80",rx:"16",ry:"16",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("line",{x1:"312",y1:"240",x2:"200",y2:"352",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}),t("line",{x1:"312",y1:"352",x2:"200",y2:"240",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),Ue=q("download",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M3.5,13 L12.5,13 C12.7761424,13 13,13.2238576 13,13.5 C13,13.7454599 12.8231248,13.9496084 12.5898756,13.9919443 L12.5,14 L3.5,14 C3.22385763,14 3,13.7761424 3,13.5 C3,13.2545401 3.17687516,13.0503916 3.41012437,13.0080557 L3.5,13 L12.5,13 L3.5,13 Z M7.91012437,1.00805567 L8,1 C8.24545989,1 8.44960837,1.17687516 8.49194433,1.41012437 L8.5,1.5 L8.5,10.292 L11.1819805,7.6109127 C11.3555469,7.43734635 11.6249713,7.4180612 11.8198394,7.55305725 L11.8890873,7.6109127 C12.0626536,7.78447906 12.0819388,8.05390346 11.9469427,8.2487716 L11.8890873,8.31801948 L8.35355339,11.8535534 C8.17998704,12.0271197 7.91056264,12.0464049 7.7156945,11.9114088 L7.64644661,11.8535534 L4.1109127,8.31801948 C3.91565056,8.12275734 3.91565056,7.80617485 4.1109127,7.6109127 C4.28447906,7.43734635 4.55390346,7.4180612 4.7487716,7.55305725 L4.81801948,7.6109127 L7.5,10.292 L7.5,1.5 C7.5,1.25454011 7.67687516,1.05039163 7.91012437,1.00805567 L8,1 L7.91012437,1.00805567 Z"}))))),Ae=q("cancel",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M2.58859116,2.7156945 L2.64644661,2.64644661 C2.82001296,2.47288026 3.08943736,2.45359511 3.2843055,2.58859116 L3.35355339,2.64644661 L8,7.293 L12.6464466,2.64644661 C12.8417088,2.45118446 13.1582912,2.45118446 13.3535534,2.64644661 C13.5488155,2.84170876 13.5488155,3.15829124 13.3535534,3.35355339 L8.707,8 L13.3535534,12.6464466 C13.5271197,12.820013 13.5464049,13.0894374 13.4114088,13.2843055 L13.3535534,13.3535534 C13.179987,13.5271197 12.9105626,13.5464049 12.7156945,13.4114088 L12.6464466,13.3535534 L8,8.707 L3.35355339,13.3535534 C3.15829124,13.5488155 2.84170876,13.5488155 2.64644661,13.3535534 C2.45118446,13.1582912 2.45118446,12.8417088 2.64644661,12.6464466 L7.293,8 L2.64644661,3.35355339 C2.47288026,3.17998704 2.45359511,2.91056264 2.58859116,2.7156945 L2.64644661,2.64644661 L2.58859116,2.7156945 Z"}))))),Ne=q("retry",t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t("path",{d:"M320,146s24.36-12-64-12A160,160,0,1,0,416,294",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-miterlimit: 10; stroke-width: 32px;"}),t("polyline",{points:"256 58 336 138 256 218",style:"fill: none; stroke: currentcolor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 32px;"}))),Ee=$([f("progress",{display:"inline-block"},[f("progress-icon",` - color: var(--n-icon-color); - transition: color .3s var(--n-bezier); - `),C("line",` - width: 100%; - display: block; - `,[f("progress-content",` - display: flex; - align-items: center; - `,[f("progress-graph",{flex:1})]),f("progress-custom-content",{marginLeft:"14px"}),f("progress-icon",` - width: 30px; - padding-left: 14px; - height: var(--n-icon-size-line); - line-height: var(--n-icon-size-line); - font-size: var(--n-icon-size-line); - `,[C("as-text",` - color: var(--n-text-color-line-outer); - text-align: center; - width: 40px; - font-size: var(--n-font-size); - padding-left: 4px; - transition: color .3s var(--n-bezier); - `)])]),C("circle, dashboard",{width:"120px"},[f("progress-custom-content",` - position: absolute; - left: 50%; - top: 50%; - transform: translateX(-50%) translateY(-50%); - display: flex; - align-items: center; - justify-content: center; - `),f("progress-text",` - position: absolute; - left: 50%; - top: 50%; - transform: translateX(-50%) translateY(-50%); - display: flex; - align-items: center; - color: inherit; - font-size: var(--n-font-size-circle); - color: var(--n-text-color-circle); - font-weight: var(--n-font-weight-circle); - transition: color .3s var(--n-bezier); - white-space: nowrap; - `),f("progress-icon",` - position: absolute; - left: 50%; - top: 50%; - transform: translateX(-50%) translateY(-50%); - display: flex; - align-items: center; - color: var(--n-icon-color); - font-size: var(--n-icon-size-circle); - `)]),C("multiple-circle",` - width: 200px; - color: inherit; - `,[f("progress-text",` - font-weight: var(--n-font-weight-circle); - color: var(--n-text-color-circle); - position: absolute; - left: 50%; - top: 50%; - transform: translateX(-50%) translateY(-50%); - display: flex; - align-items: center; - justify-content: center; - transition: color .3s var(--n-bezier); - `)]),f("progress-content",{position:"relative"}),f("progress-graph",{position:"relative"},[f("progress-graph-circle",[$("svg",{verticalAlign:"bottom"}),f("progress-graph-circle-fill",` - stroke: var(--n-fill-color); - transition: - opacity .3s var(--n-bezier), - stroke .3s var(--n-bezier), - stroke-dasharray .3s var(--n-bezier); - `,[C("empty",{opacity:0})]),f("progress-graph-circle-rail",` - transition: stroke .3s var(--n-bezier); - overflow: hidden; - stroke: var(--n-rail-color); - `)]),f("progress-graph-line",[C("indicator-inside",[f("progress-graph-line-rail",` - height: 16px; - line-height: 16px; - border-radius: 10px; - `,[f("progress-graph-line-fill",` - height: inherit; - border-radius: 10px; - `),f("progress-graph-line-indicator",` - background: #0000; - white-space: nowrap; - text-align: right; - margin-left: 14px; - margin-right: 14px; - height: inherit; - font-size: 12px; - color: var(--n-text-color-line-inner); - transition: color .3s var(--n-bezier); - `)])]),C("indicator-inside-label",` - height: 16px; - display: flex; - align-items: center; - `,[f("progress-graph-line-rail",` - flex: 1; - transition: background-color .3s var(--n-bezier); - `),f("progress-graph-line-indicator",` - background: var(--n-fill-color); - font-size: 12px; - transform: translateZ(0); - display: flex; - vertical-align: middle; - height: 16px; - line-height: 16px; - padding: 0 10px; - border-radius: 10px; - position: absolute; - white-space: nowrap; - color: var(--n-text-color-line-inner); - transition: - right .2s var(--n-bezier), - color .3s var(--n-bezier), - background-color .3s var(--n-bezier); - `)]),f("progress-graph-line-rail",` - position: relative; - overflow: hidden; - height: var(--n-rail-height); - border-radius: 5px; - background-color: var(--n-rail-color); - transition: background-color .3s var(--n-bezier); - `,[f("progress-graph-line-fill",` - background: var(--n-fill-color); - position: relative; - border-radius: 5px; - height: inherit; - width: 100%; - max-width: 0%; - transition: - background-color .3s var(--n-bezier), - max-width .2s var(--n-bezier); - `,[C("processing",[$("&::after",` - content: ""; - background-image: var(--n-line-bg-processing); - animation: progress-processing-animation 2s var(--n-bezier) infinite; - `)])])])])])]),$("@keyframes progress-processing-animation",` - 0% { - position: absolute; - left: 0; - top: 0; - bottom: 0; - right: 100%; - opacity: 1; - } - 66% { - position: absolute; - left: 0; - top: 0; - bottom: 0; - right: 0; - opacity: 0; - } - 100% { - position: absolute; - left: 0; - top: 0; - bottom: 0; - right: 0; - opacity: 0; - } - `)]);const He={success:t(re,null),error:t(ie,null),warning:t(ne,null),info:t(oe,null)};var Me=A({name:"ProgressLine",props:{clsPrefix:{type:String,required:!0},percentage:{type:Number,default:0},railColor:String,railStyle:[String,Object],fillColor:String,status:{type:String,required:!0},indicatorPlacement:{type:String,required:!0},indicatorTextColor:String,unit:{type:String,default:"%"},processing:{type:Boolean,required:!0},showIndicator:{type:Boolean,required:!0},height:[String,Number],railBorderRadius:[String,Number],fillBorderRadius:[String,Number]},setup(e,{slots:n}){const i=R(()=>E(e.height)),r=R(()=>e.railBorderRadius!==void 0?E(e.railBorderRadius):e.height!==void 0?E(e.height,{c:.5}):""),l=R(()=>e.fillBorderRadius!==void 0?E(e.fillBorderRadius):e.railBorderRadius!==void 0?E(e.railBorderRadius):e.height!==void 0?E(e.height,{c:.5}):"");return()=>{const{indicatorPlacement:o,railColor:c,railStyle:g,percentage:s,unit:d,indicatorTextColor:a,status:u,showIndicator:b,fillColor:h,processing:k,clsPrefix:y}=e;return t("div",{class:`${y}-progress-content`,role:"none"},t("div",{class:`${y}-progress-graph`,"aria-hidden":!0},t("div",{class:[`${y}-progress-graph-line`,{[`${y}-progress-graph-line--indicator-${o}`]:!0}]},t("div",{class:`${y}-progress-graph-line-rail`,style:[{backgroundColor:c,height:i.value,borderRadius:r.value},g]},t("div",{class:[`${y}-progress-graph-line-fill`,k&&`${y}-progress-graph-line-fill--processing`],style:{maxWidth:`${e.percentage}%`,backgroundColor:h,height:i.value,lineHeight:i.value,borderRadius:l.value}},o==="inside"?t("div",{class:`${y}-progress-graph-line-indicator`},s,d):null)))),b&&o==="outside"?t("div",null,n.default?t("div",{class:`${y}-progress-custom-content`,style:{color:a},role:"none"},n.default()):u==="default"?t("div",{role:"none",class:`${y}-progress-icon ${y}-progress-icon--as-text`,style:{color:a}},s,d):t("div",{class:`${y}-progress-icon`,"aria-hidden":!0},t(j,{clsPrefix:y},{default:()=>He[u]}))):null)}}});const qe={success:t(re,null),error:t(ie,null),warning:t(ne,null),info:t(oe,null)};var We=A({name:"ProgressCircle",props:{clsPrefix:{type:String,required:!0},status:{type:String,required:!0},strokeWidth:{type:Number,required:!0},fillColor:String,railColor:String,railStyle:[String,Object],percentage:{type:Number,default:0},offsetDegree:{type:Number,default:0},showIndicator:{type:Boolean,required:!0},indicatorTextColor:String,unit:String,viewBoxWidth:{type:Number,required:!0},gapDegree:{type:Number,required:!0},gapOffsetDegree:{type:Number,default:0}},setup(e,{slots:n}){function i(r,l,o){const{gapDegree:c,viewBoxWidth:g}=e,s=50,d=0,a=s,u=0,b=2*s,h=`M 55,55 m ${d},${a} - a ${s},${s} 0 1 1 ${u},${-b} - a ${s},${s} 0 1 1 ${-u},${b}`,k=Math.PI*2*s,y={stroke:o,strokeDasharray:`${r/100*(k-c)}px ${g*8}px`,strokeDashoffset:`-${c/2+Math.PI/3.6*l}px`};return{pathString:h,pathStyle:y}}return()=>{const{fillColor:r,railColor:l,strokeWidth:o,offsetDegree:c,status:g,percentage:s,showIndicator:d,indicatorTextColor:a,unit:u,gapOffsetDegree:b,clsPrefix:h}=e,{pathString:k,pathStyle:y}=i(100,0,l),{pathString:B,pathStyle:w}=i(s,c,r);return t("div",{class:`${h}-progress-content`,role:"none"},t("div",{class:`${h}-progress-graph`,"aria-hidden":!0},t("div",{class:`${h}-progress-graph-circle`,style:{transform:b?`rotate(${b}deg)`:void 0}},t("svg",{viewBox:"0 0 110 110"},t("g",null,t("path",{class:`${h}-progress-graph-circle-rail`,d:k,"stroke-width":o,"stroke-linecap":"round",fill:"none",style:y})),t("g",null,t("path",{class:[`${h}-progress-graph-circle-fill`,s===0&&`${h}-progress-graph-circle-fill--empty`],d:B,"stroke-width":o,"stroke-linecap":"round",fill:"none",style:w}))))),d?t("div",null,n.default?t("div",{class:`${h}-progress-custom-content`,role:"none"},n.default()):g!=="default"?t("div",{class:`${h}-progress-icon`,"aria-hidden":!0},t(j,{clsPrefix:h},{default:()=>qe[g]})):t("div",{class:`${h}-progress-text`,style:{color:a},role:"none"},t("span",{class:`${h}-progress-text__percentage`},s),t("span",{class:`${h}-progress-text__unit`},u))):null)}}});function te(e,n,i=100){return`m ${i/2} ${i/2-e} a ${e} ${e} 0 1 1 0 ${2*e} a ${e} ${e} 0 1 1 0 -${2*e}`}var Xe=A({name:"ProgressMultipleCircle",props:{clsPrefix:{type:String,required:!0},viewBoxWidth:{type:Number,required:!0},percentage:{type:Array,default:[0]},strokeWidth:{type:Number,required:!0},circleGap:{type:Number,required:!0},showIndicator:{type:Boolean,required:!0},fillColor:{type:Array,default:()=>[]},railColor:{type:Array,default:()=>[]},railStyle:{type:Array,default:()=>[]}},setup(e,{slots:n}){const i=R(()=>e.percentage.map((l,o)=>`${Math.PI*l/100*(e.viewBoxWidth/2-e.strokeWidth/2*(1+2*o)-e.circleGap*o)*2}, ${e.viewBoxWidth*8}`));return()=>{const{viewBoxWidth:r,strokeWidth:l,circleGap:o,showIndicator:c,fillColor:g,railColor:s,railStyle:d,percentage:a,clsPrefix:u}=e;return t("div",{class:`${u}-progress-content`,role:"none"},t("div",{class:`${u}-progress-graph`,"aria-hidden":!0},t("div",{class:`${u}-progress-graph-circle`},t("svg",{viewBox:`0 0 ${r} ${r}`},a.map((b,h)=>t("g",{key:h},t("path",{class:`${u}-progress-graph-circle-rail`,d:te(r/2-l/2*(1+2*h)-o*h,l,r),"stroke-width":l,"stroke-linecap":"round",fill:"none",style:[{strokeDashoffset:0,stroke:s[h]},d[h]]}),t("path",{class:[`${u}-progress-graph-circle-fill`,b===0&&`${u}-progress-graph-circle-fill--empty`],d:te(r/2-l/2*(1+2*h)-o*h,l,r),"stroke-width":l,"stroke-linecap":"round",fill:"none",style:{strokeDasharray:i.value[h],strokeDashoffset:0,stroke:g[h]}})))))),c&&n.default?t("div",null,t("div",{class:`${u}-progress-text`},n.default())):null)}}});const Ve=Object.assign(Object.assign({},G.props),{processing:Boolean,type:{type:String,default:"line"},gapDegree:Number,gapOffsetDegree:Number,status:{type:String,default:"default"},railColor:[String,Array],railStyle:[String,Array],color:[String,Array],viewBoxWidth:{type:Number,default:100},strokeWidth:{type:Number,default:7},percentage:[Number,Array],unit:{type:String,default:"%"},showIndicator:{type:Boolean,default:!0},indicatorPosition:{type:String,default:"outside"},indicatorPlacement:{type:String,default:"outside"},indicatorTextColor:String,circleGap:{type:Number,default:1},height:Number,borderRadius:[String,Number],fillBorderRadius:[String,Number],offsetDegree:Number});var Ge=A({name:"Progress",props:Ve,setup(e){const n=R(()=>e.indicatorPlacement||e.indicatorPosition),i=R(()=>{if(e.gapDegree||e.gapDegree===0)return e.gapDegree;if(e.type==="dashboard")return 75}),{mergedClsPrefixRef:r,inlineThemeDisabled:l}=ae(e),o=G("Progress","-progress",Ee,be,e,r),c=R(()=>{const{status:s}=e,{common:{cubicBezierEaseInOut:d},self:{fontSize:a,fontSizeCircle:u,railColor:b,railHeight:h,iconSizeCircle:k,iconSizeLine:y,textColorCircle:B,textColorLineInner:w,textColorLineOuter:x,lineBgProcessing:O,fontWeightCircle:p,[J("iconColor",s)]:v,[J("fillColor",s)]:T}}=o.value;return{"--n-bezier":d,"--n-fill-color":T,"--n-font-size":a,"--n-font-size-circle":u,"--n-font-weight-circle":p,"--n-icon-color":v,"--n-icon-size-circle":k,"--n-icon-size-line":y,"--n-line-bg-processing":O,"--n-rail-color":b,"--n-rail-height":h,"--n-text-color-circle":B,"--n-text-color-line-inner":w,"--n-text-color-line-outer":x}}),g=l?le("progress",R(()=>e.status[0]),c,e):void 0;return{mergedClsPrefix:r,mergedIndicatorPlacement:n,gapDeg:i,cssVars:l?void 0:c,themeClass:g==null?void 0:g.themeClass,onRender:g==null?void 0:g.onRender}},render(){const{type:e,cssVars:n,indicatorTextColor:i,showIndicator:r,status:l,railColor:o,railStyle:c,color:g,percentage:s,viewBoxWidth:d,strokeWidth:a,mergedIndicatorPlacement:u,unit:b,borderRadius:h,fillBorderRadius:k,height:y,processing:B,circleGap:w,mergedClsPrefix:x,gapDeg:O,gapOffsetDegree:p,themeClass:v,$slots:T,onRender:m}=this;return m==null||m(),t("div",{class:[v,`${x}-progress`,`${x}-progress--${e}`,`${x}-progress--${l}`],style:n,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,role:e==="circle"||e==="line"||e==="dashboard"?"progressbar":"none"},e==="circle"||e==="dashboard"?t(We,{clsPrefix:x,status:l,showIndicator:r,indicatorTextColor:i,railColor:o,fillColor:g,railStyle:c,offsetDegree:this.offsetDegree,percentage:s,viewBoxWidth:d,strokeWidth:a,gapDegree:O===void 0?e==="dashboard"?75:0:O,gapOffsetDegree:p,unit:b},T):e==="line"?t(Me,{clsPrefix:x,status:l,showIndicator:r,indicatorTextColor:i,railColor:o,fillColor:g,railStyle:c,percentage:s,processing:B,indicatorPlacement:u,unit:b,fillBorderRadius:k,railBorderRadius:h,height:y},T):e==="multiple-circle"?t(Xe,{clsPrefix:x,strokeWidth:a,railColor:o,fillColor:g,railStyle:c,viewBoxWidth:d,percentage:s,showIndicator:r,circleGap:w},T):null)}});const H=ye("n-upload"),de="__UPLOAD_DRAGGER__";var Ye=A({name:"UploadDragger",[de]:!0,setup(e,{slots:n}){const i=W(H,null);return i||Y("upload-dragger","`n-upload-dragger` must be placed inside `n-upload`."),()=>{const{mergedClsPrefixRef:{value:r},mergedDisabledRef:{value:l}}=i;return t("div",{class:[`${r}-upload-dragger`,l&&`${r}-upload-dragger--disabled`]},n)}}}),Ke=globalThis&&globalThis.__awaiter||function(e,n,i,r){function l(o){return o instanceof i?o:new i(function(c){c(o)})}return new(i||(i=Promise))(function(o,c){function g(a){try{d(r.next(a))}catch(u){c(u)}}function s(a){try{d(r.throw(a))}catch(u){c(u)}}function d(a){a.done?o(a.value):l(a.value).then(g,s)}d((r=r.apply(e,n||[])).next())})};const ce=e=>e.includes("image/"),Ze=(e="")=>{const n=e.split("/"),r=n[n.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(r)||[""])[0]},Je=e=>{if(e.type)return ce(e.type);const n=e.thumbnailUrl||e.url||"",i=Ze(n);return/^data:image\//.test(n)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(i)?!0:!(/^data:/.test(n)||i)};function Qe(e){return Ke(this,void 0,void 0,function*(){return yield new Promise(n=>{if(!e.type||!ce(e.type)){n("");return}const i=new Image;i.src=window.URL.createObjectURL(e),i.onload=()=>{const{width:r,height:l}=i,o=document.createElement("canvas"),c=o.getContext("2d");o.width=r,o.height=l,o.style.cssText=`position: fixed; left: 0; top: 0; width: ${r}px; height: ${l}px; z-index: 9999; display: none;`,document.body.appendChild(o),c==null||c.drawImage(i,0,0,r,l);const g=o.toDataURL();document.body.removeChild(o),n(g)}})})}const et=typeof document!="undefined"&&typeof window!="undefined"&&window.FileReader&&window.File;var ue=A({name:"UploadTrigger",props:{abstract:Boolean},setup(e,{slots:n}){const i=W(H,null);i||Y("upload-trigger","`n-upload-trigger` must be placed inside `n-upload`.");const{mergedClsPrefixRef:r,mergedDisabledRef:l,maxReachedRef:o,listTypeRef:c,dragOverRef:g,openOpenFileDialog:s,draggerInsideRef:d,handleFileAddition:a}=i,u=R(()=>c.value==="image-card");function b(){l.value||o.value||s()}function h(w){w.preventDefault(),g.value=!0}function k(w){w.preventDefault(),g.value=!0}function y(w){w.preventDefault(),g.value=!1}function B(w){if(w.preventDefault(),!d.value||l.value||o.value)return;const x=w.dataTransfer,O=x==null?void 0:x.files;O&&a(O),g.value=!1}return()=>{var w;const{value:x}=r;return e.abstract?(w=n.default)===null||w===void 0?void 0:w.call(n,{handleClick:b,handleDrop:B,handleDragOver:h,handleDragEnter:k,handleDragLeave:y}):t("div",{class:[`${x}-upload-trigger`,(l.value||o.value)&&`${x}-upload-trigger--disabled`,u.value&&`${x}-upload-trigger--image-card`],onClick:b,onDrop:B,onDragover:h,onDragenter:k,onDragleave:y},u.value?t(Ye,null,{default:n.default||(()=>t(j,{clsPrefix:x},{default:()=>t(we,null)}))}):n)}}}),tt=A({name:"UploadProgress",props:{show:Boolean,percentage:{type:Number,required:!0},status:{type:String,required:!0}},setup(){return{mergedTheme:W(H).mergedThemeRef}},render(){return t(se,null,{default:()=>this.show?t(Ge,{type:"line",showIndicator:!1,percentage:this.percentage,status:this.status,height:2,theme:this.mergedTheme.peers.Progress,themeOverrides:this.mergedTheme.peerOverrides.Progress}):null})}});const rt=t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},t("g",{fill:"none"},t("path",{d:"M21.75 3A3.25 3.25 0 0 1 25 6.25v15.5A3.25 3.25 0 0 1 21.75 25H6.25A3.25 3.25 0 0 1 3 21.75V6.25A3.25 3.25 0 0 1 6.25 3h15.5zm.583 20.4l-7.807-7.68a.75.75 0 0 0-.968-.07l-.084.07l-7.808 7.68c.183.065.38.1.584.1h15.5c.204 0 .4-.035.583-.1l-7.807-7.68l7.807 7.68zM21.75 4.5H6.25A1.75 1.75 0 0 0 4.5 6.25v15.5c0 .208.036.408.103.593l7.82-7.692a2.25 2.25 0 0 1 3.026-.117l.129.117l7.82 7.692c.066-.185.102-.385.102-.593V6.25a1.75 1.75 0 0 0-1.75-1.75zm-3.25 3a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5zm0 1.5a1 1 0 1 0 0 2a1 1 0 0 0 0-2z",fill:"currentColor"}))),it=t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28"},t("g",{fill:"none"},t("path",{d:"M6.4 2A2.4 2.4 0 0 0 4 4.4v19.2A2.4 2.4 0 0 0 6.4 26h15.2a2.4 2.4 0 0 0 2.4-2.4V11.578c0-.729-.29-1.428-.805-1.944l-6.931-6.931A2.4 2.4 0 0 0 14.567 2H6.4zm-.9 2.4a.9.9 0 0 1 .9-.9H14V10a2 2 0 0 0 2 2h6.5v11.6a.9.9 0 0 1-.9.9H6.4a.9.9 0 0 1-.9-.9V4.4zm16.44 6.1H16a.5.5 0 0 1-.5-.5V4.06l6.44 6.44z",fill:"currentColor"})));var nt=globalThis&&globalThis.__awaiter||function(e,n,i,r){function l(o){return o instanceof i?o:new i(function(c){c(o)})}return new(i||(i=Promise))(function(o,c){function g(a){try{d(r.next(a))}catch(u){c(u)}}function s(a){try{d(r.throw(a))}catch(u){c(u)}}function d(a){a.done?o(a.value):l(a.value).then(g,s)}d((r=r.apply(e,n||[])).next())})},ot=A({name:"UploadFile",props:{clsPrefix:{type:String,required:!0},file:{type:Object,required:!0},listType:{type:String,required:!0}},setup(e){const n=W(H),i=M(null),r=M(""),l=R(()=>{const{file:p}=e;return p.status==="finished"?"success":p.status==="error"?"error":"info"}),o=R(()=>{const{file:p}=e;if(p.status==="error")return"error"}),c=R(()=>{const{file:p}=e;return p.status==="uploading"}),g=R(()=>{if(!n.showCancelButtonRef.value)return!1;const{file:p}=e;return["uploading","pending","error"].includes(p.status)}),s=R(()=>{if(!n.showRemoveButtonRef.value)return!1;const{file:p}=e;return["finished"].includes(p.status)}),d=R(()=>{if(!n.showDownloadButtonRef.value)return!1;const{file:p}=e;return["finished"].includes(p.status)}),a=R(()=>{if(!n.showRetryButtonRef.value)return!1;const{file:p}=e;return["error"].includes(p.status)}),u=R(()=>{if(!n.showPreviewButtonRef.value)return!1;const{file:{status:p,url:v},listType:T}=e;return["finished"].includes(p)&&(v||r.value)&&T==="image-card"});function b(){n.submit(e.file.id)}function h(p){p.preventDefault();const{file:v}=e;["finished","pending","error"].includes(v.status)?y(v):["uploading"].includes(v.status)?w(v):Be("upload","The button clicked type is unknown.")}function k(p){p.preventDefault(),B(e.file)}function y(p){const{XhrMap:v,doChange:T,onRemoveRef:{value:m},mergedFileListRef:{value:P}}=n;Promise.resolve(m?m({file:Object.assign({},p),fileList:P}):!0).then(S=>{if(S===!1)return;const _=Object.assign({},p,{status:"removed"});v.delete(p.id),T(_,void 0,{remove:!0})})}function B(p){const{onDownloadRef:{value:v}}=n;Promise.resolve(v?v(Object.assign({},p)):!0).then(T=>{})}function w(p){const{XhrMap:v}=n,T=v.get(p.id);T==null||T.abort(),y(Object.assign({},p))}function x(){const{onPreviewRef:{value:p}}=n;if(p)p(e.file);else if(e.listType==="image-card"){const{value:v}=i;if(!v)return;v.click()}}const O=()=>nt(this,void 0,void 0,function*(){const{listType:p}=e;p!=="image"&&p!=="image-card"||!et||!(e.file.file instanceof File)||(r.value=yield n.getFileThumbnailUrl(e.file))});return xe(()=>{O()}),{mergedTheme:n.mergedThemeRef,progressStatus:l,buttonType:o,showProgress:c,disabled:n.mergedDisabledRef,showCancelButton:g,showRemoveButton:s,showDownloadButton:d,showRetryButton:a,showPreviewButton:u,thumbnailUrl:r,imageRef:i,handleRemoveOrCancelClick:h,handleDownloadClick:k,handleRetryClick:b,handlePreviewClick:x}},render(){const{clsPrefix:e,mergedTheme:n,listType:i,file:r}=this;let l;const o=i==="image";o||i==="image-card"?l=Je(r)?(r.url||this.thumbnailUrl)&&r.status!=="error"?t("a",{rel:"noopener noreferer",target:"_blank",href:r.url||void 0,class:`${e}-upload-file-info__thumbnail`,onClick:this.handlePreviewClick},i==="image-card"?t(Ce,{src:this.thumbnailUrl||r.thumbnailUrl||r.url||void 0,previewSrc:r.url||void 0,alt:r.name,ref:"imageRef"}):t("img",{src:this.thumbnailUrl||r.thumbnailUrl||r.url||void 0,alt:r.name})):t("span",{class:`${e}-upload-file-info__thumbnail`},t(j,{clsPrefix:e},{default:()=>rt})):t("span",{class:`${e}-upload-file-info__thumbnail`},t(j,{clsPrefix:e},{default:()=>it})):l=t("span",{class:`${e}-upload-file-info__thumbnail`},t(j,{clsPrefix:e},{default:()=>t(Fe,null)}));const g=t(tt,{show:this.showProgress,percentage:r.percentage||0,status:this.progressStatus}),s=i==="text"||i==="image";return t("div",{class:[`${e}-upload-file`,`${e}-upload-file--${this.progressStatus}-status`,r.url&&r.status!=="error"&&i!=="image-card"&&`${e}-upload-file--with-url`,`${e}-upload-file--${i}-type`]},t("div",{class:`${e}-upload-file-info`},l,t("div",{class:`${e}-upload-file-info__name`},s&&(r.url&&r.status!=="error"?t("a",{rel:"noopener noreferer",target:"_blank",href:r.url||void 0,onClick:this.handlePreviewClick},r.name):t("span",{onClick:this.handlePreviewClick},r.name)),o&&g),t("div",{class:[`${e}-upload-file-info__action`,`${e}-upload-file-info__action--${i}-type`]},this.showPreviewButton?t(V,{key:"preview",text:!0,type:this.buttonType,onClick:this.handlePreviewClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Re,null)})}):null,(this.showRemoveButton||this.showCancelButton)&&!this.disabled&&t(V,{key:"cancelOrTrash",theme:n.peers.Button,themeOverrides:n.peerOverrides.Button,text:!0,type:this.buttonType,onClick:this.handleRemoveOrCancelClick},{icon:()=>t(ke,null,{default:()=>this.showRemoveButton?t(j,{clsPrefix:e,key:"trash"},{default:()=>t(je,null)}):t(j,{clsPrefix:e,key:"cancel"},{default:()=>t(Ae,null)})})}),this.showRetryButton&&!this.disabled&&t(V,{key:"retry",text:!0,type:this.buttonType,onClick:this.handleRetryClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Ne,null)})}),this.showDownloadButton?t(V,{key:"download",text:!0,type:this.buttonType,onClick:this.handleDownloadClick,theme:n.peers.Button,themeOverrides:n.peerOverrides.Button},{icon:()=>t(j,{clsPrefix:e},{default:()=>t(Ue,null)})}):null)),!o&&g)}}),at=A({name:"UploadFileList",setup(e,{slots:n}){const i=W(H,null);i||Y("upload-file-list","`n-upload-file-list` must be placed inside `n-upload`.");const{abstractRef:r,mergedClsPrefixRef:l,listTypeRef:o,mergedFileListRef:c,fileListStyleRef:g,cssVarsRef:s,themeClassRef:d,maxReachedRef:a,showTriggerRef:u,imageGroupPropsRef:b}=i,h=R(()=>o.value==="image-card"),k=()=>c.value.map(B=>t(ot,{clsPrefix:l.value,key:B.id,file:B,listType:o.value})),y=()=>h.value?t(Pe,Object.assign({},b.value),{default:k}):t(se,{group:!0},{default:k});return()=>{const{value:B}=l,{value:w}=r;return t("div",{class:[`${B}-upload-file-list`,h.value&&`${B}-upload-file-list--grid`,w?d==null?void 0:d.value:void 0],style:[w&&s?s.value:"",g.value]},y(),u.value&&!a.value&&h.value&&t(ue,null,n))}}}),lt=$([f("upload","width: 100%;",[C("dragger-inside",[I("trigger",` - display: block; - `)]),C("drag-over",[f("upload-dragger",` - border: var(--n-dragger-border-hover); - `)])]),f("upload-dragger",` - cursor: pointer; - box-sizing: border-box; - width: 100%; - text-align: center; - border-radius: var(--n-border-radius); - padding: 24px; - opacity: 1; - transition: - opacity .3s var(--n-bezier), - border-color .3s var(--n-bezier), - background-color .3s var(--n-bezier); - background-color: var(--n-dragger-color); - border: var(--n-dragger-border); - `,[$("&:hover",` - border: var(--n-dragger-border-hover); - `),C("disabled",` - opacity: var(--n-item-disabled-opacity); - cursor: not-allowed; - `)]),f("upload-trigger",` - display: inline-block; - box-sizing: border-box; - opacity: 1; - transition: opacity .3s var(--n-bezier); - `,[$("+",[f("upload-file-list","margin-top: 8px;")]),C("disabled",` - opacity: var(--n-item-disabled-opacity); - cursor: not-allowed; - `),C("image-card",` - width: 96px; - height: 96px; - `,[f("base-icon",` - font-size: 24px; - `),f("upload-dragger",` - padding: 0; - height: 100%; - width: 100%; - display: flex; - align-items: center; - justify-content: center; - `)])]),f("upload-file-list",` - line-height: var(--n-line-height); - opacity: 1; - transition: opacity .3s var(--n-bezier); - `,[C("disabled",` - opacity: var(--n-item-disabled-opacity); - cursor: not-allowed; - `,[f("upload-file","cursor: not-allowed;")]),C("grid",` - display: grid; - grid-template-columns: repeat(auto-fill, 96px); - grid-gap: 8px; - margin-top: 0; - `),f("upload-file",` - display: block; - box-sizing: border-box; - cursor: default; - padding: 0px 12px 0 6px; - transition: background-color .3s var(--n-bezier); - border-radius: var(--n-border-radius); - `,[Q(),f("progress",[Q({foldPadding:!0})]),$("&:hover",` - background-color: var(--n-item-color-hover); - `,[f("upload-file-info",[I("action",` - opacity: 1; - `)])]),C("image-type",` - border-radius: var(--n-border-radius); - text-decoration: underline; - text-decoration-color: #0000; - `,[f("upload-file-info",` - padding-top: 0px; - padding-bottom: 0px; - width: 100%; - height: 100%; - display: flex; - justify-content: space-between; - align-items: center; - padding: 6px 0; - `,[f("progress",` - padding: 2px 0; - margin-bottom: 0; - `),I("name",` - padding: 0 8px; - `),I("thumbnail",` - width: 32px; - height: 32px; - font-size: 28px; - display: flex; - justify-content: center; - align-items: center; - `,[$("img",` - width: 100%; - `)])])]),C("text-type",[f("progress",` - box-sizing: border-box; - padding-bottom: 6px; - margin-bottom: 6px; - `)]),C("image-card-type",` - position: relative; - width: 96px; - height: 96px; - border: var(--n-item-border-image-card); - border-radius: var(--n-border-radius); - padding: 0; - display: flex; - align-items: center; - justify-content: center; - transition: border-color .3s var(--n-bezier), background-color .3s var(--n-bezier); - border-radius: var(--n-border-radius); - `,[f("progress",` - position: absolute; - left: 8px; - bottom: 8px; - right: 8px; - width: unset; - `),f("upload-file-info",` - padding: 0; - width: 100%; - height: 100%; - `,[I("thumbnail",` - width: 100%; - height: 100%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: 36px; - `,[$("img",` - width: 100%; - `)])]),$("&::before",` - position: absolute; - z-index: 1; - left: 0; - right: 0; - top: 0; - bottom: 0; - border-radius: inherit; - opacity: 0; - transition: opacity .2s var(--n-bezier); - content: ""; - `),$("&:hover",[$("&::before","opacity: 1;"),f("upload-file-info",[I("thumbnail","opacity: .12;")])])]),C("error-status",[$("&:hover",` - background-color: var(--n-item-color-hover-error); - `),f("upload-file-info",[I("name","color: var(--n-item-text-color-error);"),I("thumbnail","color: var(--n-item-text-color-error);")]),C("image-card-type",` - border: var(--n-item-border-image-card-error); - `)]),C("with-url",` - cursor: pointer; - `,[f("upload-file-info",[I("name",` - color: var(--n-item-text-color-success); - text-decoration-color: var(--n-item-text-color-success); - `,[$("a",` - text-decoration: underline; - `)])])]),f("upload-file-info",` - position: relative; - padding-top: 6px; - padding-bottom: 6px; - display: flex; - flex-wrap: nowrap; - `,[I("thumbnail",` - font-size: 18px; - opacity: 1; - transition: opacity .2s var(--n-bezier); - color: var(--n-item-icon-color); - `,[f("base-icon",` - margin-right: 2px; - vertical-align: middle; - transition: color .3s var(--n-bezier); - `)]),I("action",` - padding-top: inherit; - padding-bottom: inherit; - position: absolute; - right: 0; - top: 0; - bottom: 0; - width: 80px; - display: flex; - align-items: center; - transition: opacity .2s var(--n-bezier); - justify-content: flex-end; - opacity: 0; - `,[f("button",[$("&:not(:last-child)",{marginRight:"4px"}),f("base-icon",[$("svg",[$e()])])]),C("image-type",` - position: relative; - max-width: 80px; - width: auto; - `),C("image-card-type",` - z-index: 2; - position: absolute; - width: 100%; - height: 100%; - left: 0; - right: 0; - bottom: 0; - top: 0; - display: flex; - justify-content: center; - align-items: center; - `)]),I("name",` - color: var(--n-item-text-color); - flex: 1; - display: flex; - justify-content: center; - text-overflow: ellipsis; - overflow: hidden; - flex-direction: column; - text-decoration-color: #0000; - font-size: var(--n-font-size); - transition: - color .3s var(--n-bezier), - text-decoration-color .3s var(--n-bezier); - `,[$("a",` - color: inherit; - text-decoration: underline; - `)])])])]),f("upload-file-input",` - display: block; - width: 0; - height: 0; - opacity: 0; - `)]),Z=globalThis&&globalThis.__awaiter||function(e,n,i,r){function l(o){return o instanceof i?o:new i(function(c){c(o)})}return new(i||(i=Promise))(function(o,c){function g(a){try{d(r.next(a))}catch(u){c(u)}}function s(a){try{d(r.throw(a))}catch(u){c(u)}}function d(a){a.done?o(a.value):l(a.value).then(g,s)}d((r=r.apply(e,n||[])).next())})};function st(e,n,i){const{doChange:r,XhrMap:l}=e;let o=0;function c(s){var d;let a=Object.assign({},n,{status:"error",percentage:o});l.delete(n.id),a=((d=e.onError)===null||d===void 0?void 0:d.call(e,{file:a,event:s}))||a,r(a,s)}function g(s){var d;if(i.status<200||i.status>=300){c(s);return}let a=Object.assign({},n,{status:"finished",percentage:o,file:null});l.delete(n.id),a=((d=e.onFinish)===null||d===void 0?void 0:d.call(e,{file:a,event:s}))||a,r(a,s)}return{handleXHRLoad:g,handleXHRError:c,handleXHRAbort(s){const d=Object.assign({},n,{status:"removed",file:null,percentage:o});l.delete(n.id),r(d,s)},handleXHRProgress(s){const d=Object.assign({},n,{status:"uploading"});if(s.lengthComputable){const a=Math.ceil(s.loaded/s.total*100);d.percentage=a,o=a}r(d,s)}}}function dt(e){const{inst:n,file:i,data:r,headers:l,withCredentials:o,action:c,customRequest:g}=e,{doChange:s}=e.inst;let d=0;g({file:i,data:r,headers:l,withCredentials:o,action:c,onProgress(a){const u=Object.assign({},i,{status:"uploading"}),b=a.percent;u.percentage=b,d=b,s(u)},onFinish(){var a;let u=Object.assign({},i,{status:"finished",percentage:d,file:null});u=((a=n.onFinish)===null||a===void 0?void 0:a.call(n,{file:u}))||u,s(u)},onError(){var a;let u=Object.assign({},i,{status:"error",percentage:d});u=((a=n.onError)===null||a===void 0?void 0:a.call(n,{file:u}))||u,s(u)}})}function ct(e,n,i){const r=st(e,n,i);i.onabort=r.handleXHRAbort,i.onerror=r.handleXHRError,i.onload=r.handleXHRLoad,i.upload&&(i.upload.onprogress=r.handleXHRProgress)}function ge(e,n){return typeof e=="function"?e({file:n}):e||{}}function ut(e,n,i){const r=ge(n,i);!r||Object.keys(r).forEach(l=>{e.setRequestHeader(l,r[l])})}function gt(e,n,i){const r=ge(n,i);!r||Object.keys(r).forEach(l=>{e.append(l,r[l])})}function ft(e,n,i,{method:r,action:l,withCredentials:o,headers:c,data:g}){const s=new XMLHttpRequest;e.XhrMap.set(i.id,s),s.withCredentials=o;const d=new FormData;if(gt(d,g,i),d.append(n,i.file),ct(e,i,s),l!==void 0){s.open(r.toUpperCase(),l),ut(s,c,i),s.send(d);const a=Object.assign({},i,{status:"uploading"});e.doChange(a)}}const pt=Object.assign(Object.assign({},G.props),{name:{type:String,default:"file"},accept:String,action:String,customRequest:Function,method:{type:String,default:"POST"},multiple:Boolean,showFileList:{type:Boolean,default:!0},data:[Object,Function],headers:[Object,Function],withCredentials:Boolean,disabled:{type:Boolean,default:void 0},onChange:Function,onRemove:Function,onFinish:Function,onError:Function,onBeforeUpload:Function,onDownload:Function,defaultUpload:{type:Boolean,default:!0},fileList:Array,"onUpdate:fileList":[Function,Array],onUpdateFileList:[Function,Array],fileListStyle:[String,Object],defaultFileList:{type:Array,default:()=>[]},showCancelButton:{type:Boolean,default:!0},showRemoveButton:{type:Boolean,default:!0},showDownloadButton:Boolean,showRetryButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},listType:{type:String,default:"text"},onPreview:Function,createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object});var mt=A({name:"Upload",props:pt,setup(e){e.abstract&&e.listType==="image-card"&&Y("upload","when the list-type is image-card, abstract is not supported.");const{mergedClsPrefixRef:n,inlineThemeDisabled:i}=ae(e),r=G("Upload","-upload",lt,Le,e,n),l=Te(e),o=R(()=>{const{max:m}=e;return m!==void 0?b.value.length>=m:!1}),c=M(e.defaultFileList),g=D(e,"fileList"),s=M(null),d={value:!1},a=M(!1),u=new Map,b=Se(g,c);function h(){var m;(m=s.value)===null||m===void 0||m.click()}function k(m){const P=m.target;B(P.files,m),P.value=""}function y(m){const{"onUpdate:fileList":P,onUpdateFileList:S}=e;P&&ee(P,m),S&&ee(S,m),c.value=m}function B(m,P){if(!m||m.length===0)return;const{onBeforeUpload:S}=e;let _=e.multiple?Array.from(m):[m[0]];const{max:U}=e;U&&(_=_.slice(0,U-b.value.length)),Promise.all(_.map(L=>Z(this,void 0,void 0,function*(){const z={id:Ie(),name:L.name,status:"pending",percentage:0,file:L,url:null,type:L.type,thumbnailUrl:null};return!S||(yield S({file:z,fileList:b.value}))!==!1?z:null}))).then(L=>Z(this,void 0,void 0,function*(){let z=Promise.resolve();return L.forEach(F=>{z=z.then(Oe).then(()=>{F&&x(F,P,{append:!0})})}),yield z})).then(()=>{e.defaultUpload&&w()})}function w(m){const{method:P,action:S,withCredentials:_,headers:U,data:L,name:z}=e,F=m!==void 0?b.value.filter(N=>N.id===m):b.value,K=m!==void 0;F.forEach(N=>{const{status:X}=N;(X==="pending"||X==="error"&&K)&&(e.customRequest?dt({inst:{doChange:x,XhrMap:u,onFinish:e.onFinish,onError:e.onError},file:N,action:S,withCredentials:_,headers:U,data:L,customRequest:e.customRequest}):ft({doChange:x,XhrMap:u,onFinish:e.onFinish,onError:e.onError},z,N,{method:P,action:S,withCredentials:_,headers:U,data:L}))})}const x=(m,P,S={append:!1,remove:!1})=>{const{append:_,remove:U}=S,L=Array.from(b.value),z=L.findIndex(F=>F.id===m.id);if(_||U||~z){_?L.push(m):U?L.splice(z,1):L.splice(z,1,m);const{onChange:F}=e;F&&F({file:m,fileList:L,event:P}),y(L)}};function O(m){return Z(this,void 0,void 0,function*(){const{createThumbnailUrl:P}=e;return P?yield P(m.file):yield Qe(m.file)})}const p=R(()=>{const{common:{cubicBezierEaseInOut:m},self:{draggerColor:P,draggerBorder:S,draggerBorderHover:_,itemColorHover:U,itemColorHoverError:L,itemTextColorError:z,itemTextColorSuccess:F,itemTextColor:K,itemIconColor:N,itemDisabledOpacity:X,lineHeight:fe,borderRadius:pe,fontSize:he,itemBorderImageCardError:me,itemBorderImageCard:ve}}=r.value;return{"--n-bezier":m,"--n-border-radius":pe,"--n-dragger-border":S,"--n-dragger-border-hover":_,"--n-dragger-color":P,"--n-font-size":he,"--n-item-color-hover":U,"--n-item-color-hover-error":L,"--n-item-disabled-opacity":X,"--n-item-icon-color":N,"--n-item-text-color":K,"--n-item-text-color-error":z,"--n-item-text-color-success":F,"--n-line-height":fe,"--n-item-border-image-card-error":me,"--n-item-border-image-card":ve}}),v=i?le("upload",void 0,p,e):void 0;ze(H,{mergedClsPrefixRef:n,mergedThemeRef:r,showCancelButtonRef:D(e,"showCancelButton"),showDownloadButtonRef:D(e,"showDownloadButton"),showRemoveButtonRef:D(e,"showRemoveButton"),showRetryButtonRef:D(e,"showRetryButton"),onRemoveRef:D(e,"onRemove"),onDownloadRef:D(e,"onDownload"),mergedFileListRef:b,XhrMap:u,submit:w,doChange:x,showPreviewButtonRef:D(e,"showPreviewButton"),onPreviewRef:D(e,"onPreview"),getFileThumbnailUrl:O,listTypeRef:D(e,"listType"),dragOverRef:a,openOpenFileDialog:h,draggerInsideRef:d,handleFileAddition:B,mergedDisabledRef:l.mergedDisabledRef,maxReachedRef:o,fileListStyleRef:D(e,"fileListStyle"),abstractRef:D(e,"abstract"),cssVarsRef:i?void 0:p,themeClassRef:v==null?void 0:v.themeClass,onRender:v==null?void 0:v.onRender,showTriggerRef:D(e,"showTrigger"),imageGroupPropsRef:D(e,"imageGroupProps")});const T={clear:()=>{c.value=[]},submit:w,openOpenFileDialog:h};return Object.assign({mergedClsPrefix:n,draggerInsideRef:d,inputElRef:s,mergedTheme:r,dragOver:a,handleFileInputChange:k,cssVars:i?void 0:p,themeClass:v==null?void 0:v.themeClass,onRender:v==null?void 0:v.onRender},T)},render(){var e,n;const{draggerInsideRef:i,mergedClsPrefix:r,$slots:l,onRender:o}=this;if(l.default&&!this.abstract){const g=l.default()[0];!((e=g==null?void 0:g.type)===null||e===void 0)&&e[de]&&(i.value=!0)}const c=t("input",Object.assign({},this.inputProps,{ref:"inputElRef",type:"file",class:`${r}-upload-file-input`,accept:this.accept,multiple:this.multiple,onChange:this.handleFileInputChange}));return this.abstract?t(_e,null,(n=l.default)===null||n===void 0?void 0:n.call(l),t(De,{to:"body"},c)):(o==null||o(),t("div",{class:[`${r}-upload`,i.value&&`${r}-upload--dragger-inside`,this.dragOver&&`${r}-upload--drag-over`,this.themeClass],style:this.cssVars},c,this.showTrigger&&this.listType!=="image-card"&&t(ue,null,l),this.showFileList&&t(at,null,l)))}});export{ue as _,Ge as a,at as b,mt as c}; diff --git a/web/dist/assets/User.695fa64f.js b/web/dist/assets/User.695fa64f.js deleted file mode 100644 index de15fe8c..00000000 --- a/web/dist/assets/User.695fa64f.js +++ /dev/null @@ -1,22 +0,0 @@ -import{_ as ye}from"./post-item.03452002.js";import{_ as be}from"./post-skeleton.39a35f5b.js";import{D as Ce,c as V,c5 as ke,l as H,p as xe,o as j,d as R,u as G,q as A,r as h,s as E,h as I,af as Be,b2 as Fe,i as Ee,c6 as Se,be as De,b as T,bd as $e,v as q,y as Te,ah as W,V as C,a5 as z,a4 as _,Y as k,a3 as l,a8 as S,a9 as D,c7 as ze,_ as K,J as P,bp as J,c8 as Re,c9 as Ae,Z as Ie,ai as We,ca as Pe,S as Oe,a1 as Ue,ae as Le,W as F,cb as je,a2 as m,a6 as $,aa as qe,ab as Me,c4 as Ne,cc as Ve,cd as He,ad as Ge,an as Ke,bX as Je,b_ as Xe,c1 as Ye,c2 as Ze}from"./index.f480f018.js";import{u as Qe,a as es,_ as ss}from"./Skeleton.57e98fe3.js";import{_ as X}from"./Alert.a854329b.js";import{_ as ts}from"./main-nav.9110259b.js";import{M as ns}from"./MoreHorizFilled.80db5156.js";import{_ as os}from"./List.49bcdf81.js";import{_ as as}from"./Pagination.1263479e.js";import"./content.ef1e095a.js";import"./formatTime.02109bf5.js";import"./Thing.eef6b133.js";const ls=Ce({name:"Ellipsis",common:V,peers:{Tooltip:ke}});var is=ls,us=H("ellipsis",{overflow:"hidden"},[xe("line-clamp",` - white-space: nowrap; - display: inline-block; - vertical-align: bottom; - max-width: 100%; - `),j("line-clamp",` - display: -webkit-inline-box; - -webkit-box-orient: vertical; - `),j("cursor-pointer",` - cursor: pointer; - `)]);function M(e){return`${e}-ellipsis--line-clamp`}function N(e,u){return`${e}-ellipsis--cursor-${u}`}const rs=Object.assign(Object.assign({},A.props),{expandTrigger:String,lineClamp:[Number,String],tooltip:{type:[Boolean,Object],default:!0}});var Y=R({name:"Ellipsis",inheritAttrs:!1,props:rs,setup(e,{slots:u,attrs:r}){const{mergedClsPrefixRef:n}=G(e),i=A("Ellipsis","-ellipsis",us,is,e,n),s=h(null),c=h(null),f=h(!1),p=E(()=>{const{lineClamp:t}=e,{value:d}=f;return t!==void 0?{textOverflow:"","-webkit-line-clamp":d?"":t}:{textOverflow:d?"":"ellipsis","-webkit-line-clamp":""}});function a(){let t=!1;const{value:d}=f;if(d)return!0;const{value:g}=s;if(g){const{lineClamp:B}=e;b(g),B!==void 0?t=g.scrollHeight<=g.offsetHeight:t=g.scrollWidth<=g.offsetWidth,x(g,t)}return t}const v=E(()=>e.expandTrigger==="click"?()=>{var t;const{value:d}=f;d&&((t=c.value)===null||t===void 0||t.setShow(!1)),f.value=!d}:void 0),y=()=>I("span",Object.assign({},Fe(r,{class:[`${n.value}-ellipsis`,e.lineClamp!==void 0?M(n.value):void 0,e.expandTrigger==="click"?N(n.value,"pointer"):void 0],style:p.value}),{ref:"triggerRef",onClick:v.value,onMouseenter:e.expandTrigger==="click"?a:void 0}),u);function b(t){if(!t)return;const d=p.value,g=M(n.value);e.lineClamp!==void 0?w(t,g,"add"):w(t,g,"remove");for(const B in d)t.style[B]!==d[B]&&(t.style[B]=d[B])}function x(t,d){const g=N(n.value,"pointer");e.expandTrigger==="click"&&!d?w(t,g,"add"):w(t,g,"remove")}function w(t,d,g){g==="add"?t.classList.contains(d)||t.classList.add(d):t.classList.contains(d)&&t.classList.remove(d)}return{mergedTheme:i,triggerRef:s,tooltipRef:c,handleClick:v,renderTrigger:y,getTooltipDisabled:a}},render(){var e;const{tooltip:u,renderTrigger:r,$slots:n}=this;if(u){const{mergedTheme:i}=this;return I(Be,Object.assign({ref:"tooltipRef",placement:"top"},u,{getDisabled:this.getTooltipDisabled,theme:i.peers.Tooltip,themeOverrides:i.peerOverrides.Tooltip}),{trigger:r,default:(e=n.tooltip)!==null&&e!==void 0?e:n.default})}else return r()}});function cs(){const e=Ee(Se,null);return e===null&&De("use-dialog","No outer founded."),e}const ds=e=>{const{primaryColor:u,successColor:r,warningColor:n,errorColor:i,infoColor:s,fontWeightStrong:c}=e;return{fontWeight:c,rotate:"252deg",colorStartPrimary:T(u,{alpha:.6}),colorEndPrimary:u,colorStartInfo:T(s,{alpha:.6}),colorEndInfo:s,colorStartWarning:T(n,{alpha:.6}),colorEndWarning:n,colorStartError:T(i,{alpha:.6}),colorEndError:i,colorStartSuccess:T(r,{alpha:.6}),colorEndSuccess:r}},_s={name:"GradientText",common:V,self:ds};var ps=_s,ms=H("gradient-text",` - display: inline-block; - font-weight: var(--n-font-weight); - -webkit-background-clip: text; - background-clip: text; - color: #0000; - white-space: nowrap; - background-image: linear-gradient(var(--n-rotate), var(--n-color-start) 0%, var(--n-color-end) 100%); - transition: - --n-color-start .3s var(--n-bezier), - --n-color-end .3s var(--n-bezier); -`);const fs=Object.assign(Object.assign({},A.props),{size:[String,Number],fontSize:[String,Number],type:{type:String,default:"primary"},color:[Object,String],gradient:[Object,String]});var Z=R({name:"GradientText",props:fs,setup(e){Qe();const{mergedClsPrefixRef:u,inlineThemeDisabled:r}=G(e),n=E(()=>{const{type:a}=e;return a==="danger"?"error":a}),i=E(()=>{let a=e.size||e.fontSize;return a&&(a=$e(a)),a||void 0}),s=E(()=>{const a=e.color||e.gradient;if(typeof a=="string")return a;if(a){const v=a.deg||0,y=a.from,b=a.to;return`linear-gradient(${v}deg, ${y} 0%, ${b} 100%)`}}),c=A("GradientText","-gradient-text",ms,ps,e,u),f=E(()=>{const{value:a}=n,{common:{cubicBezierEaseInOut:v},self:{rotate:y,[q("colorStart",a)]:b,[q("colorEnd",a)]:x,fontWeight:w}}=c.value;return{"--n-bezier":v,"--n-rotate":y,"--n-color-start":b,"--n-color-end":x,"--n-font-weight":w}}),p=r?Te("gradient-text",E(()=>n.value[0]),f,e):void 0;return{mergedClsPrefix:u,compatibleType:n,styleFontSize:i,styleBgImage:s,cssVars:r?void 0:f,themeClass:p==null?void 0:p.themeClass,onRender:p==null?void 0:p.onRender}},render(){const{mergedClsPrefix:e,onRender:u}=this;return u==null||u(),I("span",{class:[`${e}-gradient-text`,`${e}-gradient-text--${this.compatibleType}-type`,this.themeClass],style:[{fontSize:this.styleFontSize,backgroundImage:this.styleBgImage},this.cssVars]},this.$slots)}});const gs={class:"whisper-wrap"},hs=S(" \u5373\u5C06\u53D1\u9001\u79C1\u4FE1\u7ED9: "),vs={class:"whisper-line"},ws={class:"whisper-line send-wrap"},ys=S(" \u53D1\u9001 "),bs=R({props:{show:{type:Boolean,default:!1},user:null},emits:["success"],setup(e,{emit:u}){const r=e,n=h(""),i=h(!1),s=()=>{u("success")},c=()=>{i.value=!0,ze({user_id:r.user.id,content:n.value}).then(f=>{window.$message.success("\u53D1\u9001\u6210\u529F"),i.value=!1,n.value="",s()}).catch(f=>{i.value=!1})};return(f,p)=>{const a=Z,v=Y,y=X,b=K,x=P,w=J;return C(),z(w,{show:e.show,"onUpdate:show":s,class:"whisper-card",preset:"card",size:"small",title:"\u79C1\u4FE1","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:_(()=>[k("div",gs,[l(y,{"show-icon":!1},{default:_(()=>[hs,l(v,{style:{"max-width":"100%"}},{default:_(()=>[l(a,{type:"success"},{default:_(()=>[S(D(e.user.nickname)+"@"+D(e.user.username),1)]),_:1})]),_:1})]),_:1}),k("div",vs,[l(b,{type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u79C1\u4FE1\u5185\u5BB9\uFF08\u8BF7\u52FF\u53D1\u9001\u4E0D\u548C\u8C10\u5185\u5BB9\uFF0C\u5426\u5219\u5C06\u4F1A\u88AB\u5C01\u53F7\uFF09",autosize:{minRows:5,maxRows:10},value:n.value,"onUpdate:value":p[0]||(p[0]=t=>n.value=t),maxlength:"200","show-count":""},null,8,["value"])]),k("div",ws,[l(x,{strong:"",secondary:"",type:"primary",loading:i.value,onClick:c},{default:_(()=>[ys]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});var Cs=W(bs,[["__scopeId","data-v-3e021430"]]);const ks={class:"whisper-wrap"},xs=S(" \u53D1\u9001\u6DFB\u52A0\u670B\u53CB\u7533\u8BF7\u7ED9: "),Bs={class:"whisper-line"},Fs={class:"whisper-line send-wrap"},Es=S(" \u53D1\u9001 "),Ss=R({props:{show:{type:Boolean,default:!1},user:null},emits:["success"],setup(e,{emit:u}){const r=e,n=h(""),i=h(!1),s=()=>{u("success")},c=()=>{i.value=!0,Re({user_id:r.user.id,greetings:n.value}).then(f=>{window.$message.success("\u53D1\u9001\u6210\u529F"),i.value=!1,n.value="",s()}).catch(f=>{i.value=!1})};return(f,p)=>{const a=Z,v=Y,y=X,b=K,x=P,w=J;return C(),z(w,{show:e.show,"onUpdate:show":s,class:"whisper-card",preset:"card",size:"small",title:"\u7533\u8BF7\u6DFB\u52A0\u670B\u53CB","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:_(()=>[k("div",ks,[l(y,{"show-icon":!1},{default:_(()=>[xs,l(v,{style:{"max-width":"100%"}},{default:_(()=>[l(a,{type:"success"},{default:_(()=>[S(D(e.user.nickname)+"@"+D(e.user.username),1)]),_:1})]),_:1})]),_:1}),k("div",Bs,[l(b,{type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u771F\u631A\u7684\u95EE\u5019\u8BED",autosize:{minRows:5,maxRows:10},value:n.value,"onUpdate:value":p[0]||(p[0]=t=>n.value=t),maxlength:"120","show-count":""},null,8,["value"])]),k("div",Fs,[l(x,{strong:"",secondary:"",type:"primary",loading:i.value,onClick:c},{default:_(()=>[Es]),_:1},8,["loading"])])])]),_:1},8,["show"])}}});var Ds=W(Ss,[["__scopeId","data-v-bf9bc04e"]]);const $s={key:0,class:"profile-baseinfo"},Ts={class:"avatar"},zs={class:"base-info"},Rs={class:"username"},As=S(" \u597D\u53CB "),Is=S(" \u7BA1\u7406\u5458 "),Ws={class:"uid"},Ps={key:0,class:"user-opts"},Os={key:0,class:"pagination-wrap"},Us={key:0,class:"skeleton-wrap"},Ls={key:1},js={key:0,class:"empty-wrap"},qs=R({setup(e){Ae();const u=cs(),r=Ie(),n=We(),i=h(!1),s=Pe({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,status:1}),c=h(!1),f=h(!1),p=h(!1),a=h([]),v=h(n.query.username||""),y=h(+n.query.p||1),b=h(20),x=h(0),w=()=>{i.value=!0,Ne({username:v.value,page:y.value,page_size:b.value}).then(o=>{i.value=!1,a.value=o.list,x.value=Math.ceil(o.pager.total_rows/b.value),window.scrollTo(0,0)}).catch(o=>{i.value=!1})},t=()=>{c.value=!0,je({username:v.value}).then(o=>{c.value=!1,s.id=o.id,s.avatar=o.avatar,s.username=o.username,s.nickname=o.nickname,s.is_admin=o.is_admin,s.is_friend=o.is_friend,s.status=o.status,w()}).catch(o=>{c.value=!1,console.log(o)})},d=o=>{y.value=o,w()},g=()=>{f.value=!0},B=()=>{p.value=!0},Q=()=>{f.value=!1},ee=()=>{p.value=!1},se=E(()=>{let o=[{label:"\u79C1\u4FE1",key:"whisper"}];return r.state.userInfo.is_admin&&(s.status===1?o.push({label:"\u7981\u8A00",key:"banned"}):o.push({label:"\u89E3\u5C01",key:"deblocking"})),s.is_friend?o.push({label:"\u5220\u9664\u597D\u53CB",key:"delete"}):o.push({label:"\u6DFB\u52A0\u670B\u53CB",key:"requesting"}),o}),te=o=>{switch(o){case"whisper":g();break;case"delete":ne();break;case"requesting":B();break;case"banned":case"deblocking":oe();break}},ne=()=>{u.warning({title:"\u5220\u9664\u597D\u53CB",content:"\u5C06\u597D\u53CB \u201C"+s.nickname+"\u201D \u5220\u9664\uFF0C\u5C06\u540C\u65F6\u5220\u9664 \u70B9\u8D5E/\u6536\u85CF \u5217\u8868\u4E2D\u5173\u4E8E\u8BE5\u670B\u53CB\u7684 \u201C\u597D\u53CB\u53EF\u89C1\u201D \u63A8\u6587",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>{c.value=!0,Ve({user_id:s.id}).then(o=>{c.value=!1,s.is_friend=!1,w()}).catch(o=>{c.value=!1,console.log(o)})}})},oe=()=>{u.warning({title:"\u8B66\u544A",content:"\u786E\u5B9A\u5BF9\u8BE5\u7528\u6237\u8FDB\u884C"+(s.status===1?"\u7981\u8A00":"\u89E3\u5C01")+"\u5904\u7406\u5417\uFF1F",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>{c.value=!0,He({id:s.id,status:s.status===1?2:1}).then(o=>{c.value=!1,t()}).catch(o=>{c.value=!1,console.log(o)})}})};return Oe(()=>({path:n.path,query:n.query}),(o,O)=>{O.path==="/user"&&o.path==="/user"&&(v.value=n.query.username||"",t())}),Ue(()=>{t()}),(o,O)=>{const ae=ts,le=Ge,U=Ke,ie=Le,ue=P,re=Je,ce=Cs,de=Xe,_e=as,pe=Ye,me=Ze,fe=be,ge=es,he=ye,ve=ss,we=os;return C(),F("div",null,[l(ae,{title:"\u7528\u6237\u8BE6\u60C5"}),l(we,{class:"main-content-wrap profile-wrap",bordered:""},{footer:_(()=>[x.value>0?(C(),F("div",Os,[l(_e,{page:y.value,"onUpdate:page":d,"page-slot":m(r).state.collapsedRight?5:8,"page-count":x.value},null,8,["page","page-slot","page-count"])])):$("",!0)]),default:_(()=>[l(de,{show:c.value},{default:_(()=>[m(s).id>0?(C(),F("div",$s,[k("div",Ts,[l(le,{size:"large",src:m(s).avatar},null,8,["src"])]),k("div",zs,[k("div",Rs,[k("strong",null,D(m(s).nickname),1),k("span",null," @"+D(m(s).username),1),m(r).state.userInfo.id>0&&m(r).state.userInfo.username!=m(s).username&&m(s).is_friend?(C(),z(U,{key:0,class:"top-tag",type:"info",size:"small",round:""},{default:_(()=>[As]),_:1})):$("",!0),m(s).is_admin?(C(),z(U,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:_(()=>[Is]),_:1})):$("",!0)]),k("div",Ws,"UID. "+D(m(s).id),1)]),m(r).state.userInfo.id>0&&m(r).state.userInfo.username!=m(s).username?(C(),F("div",Ps,[l(re,{placement:"bottom-end",trigger:"click",size:"small",options:m(se),onSelect:te},{default:_(()=>[l(ue,{quaternary:"",circle:""},{icon:_(()=>[l(ie,null,{default:_(()=>[l(m(ns))]),_:1})]),_:1})]),_:1},8,["options"])])):$("",!0)])):$("",!0),l(ce,{show:f.value,user:m(s),onSuccess:Q},null,8,["show","user"]),l(Ds,{show:p.value,user:m(s),onSuccess:ee},null,8,["show","user"])]),_:1},8,["show"]),l(me,{class:"profile-tabs-wrap",animated:""},{default:_(()=>[l(pe,{name:"post",tab:"\u6CE1\u6CE1"})]),_:1}),i.value?(C(),F("div",Us,[l(fe,{num:b.value},null,8,["num"])])):(C(),F("div",Ls,[a.value.length===0?(C(),F("div",js,[l(ge,{size:"large",description:"\u6682\u65E0\u6570\u636E"})])):$("",!0),(C(!0),F(qe,null,Me(a.value,L=>(C(),z(ve,{key:L.id},{default:_(()=>[l(he,{post:L},null,8,["post"])]),_:2},1024))),128))]))]),_:1})])}}});var st=W(qs,[["__scopeId","data-v-7a6aaa02"]]);export{st as default}; diff --git a/web/dist/assets/Wallet.b8e2b626.js b/web/dist/assets/Wallet.b8e2b626.js deleted file mode 100644 index 81bbc1a3..00000000 --- a/web/dist/assets/Wallet.b8e2b626.js +++ /dev/null @@ -1,30 +0,0 @@ -import{_ as se}from"./post-skeleton.39a35f5b.js";import{_ as ae}from"./main-nav.9110259b.js";import{co as Lt,cp as It,cq as ue,d as st,I as ce,r as D,s as _t,a1 as kt,aK as le,l as W,m as Z,u as fe,q as Ut,cr as de,y as ge,h as x,z as X,V as P,W as L,Y as S,ah as he,Z as me,ai as pe,ae as _e,a3 as b,a4 as I,cs as we,bp as ye,a2 as tt,a6 as et,aa as St,ab as Tt,aY as Ce,aZ as ve,a9 as $,a8 as at,bM as Ee,bN as Be,ct as be,cu as Ae,cv as Ne,J as Ie,ag as Se,ck as Te,az as Me,a5 as Mt,c3 as Pe,a7 as Re}from"./index.f480f018.js";import{f as Fe}from"./formatTime.02109bf5.js";import{_ as De}from"./List.49bcdf81.js";import{_ as Le}from"./Pagination.1263479e.js";import{a as ke,_ as Ue}from"./Skeleton.57e98fe3.js";var Pt=1/0,ze=17976931348623157e292;function Ve(e){if(!e)return e===0?e:0;if(e=Lt(e),e===Pt||e===-Pt){var t=e<0?-1:1;return t*ze}return e===e?e:0}function xe(e){var t=Ve(e),i=t%1;return t===t?i?t-i:t:0}var $e=ue.isFinite,He=Math.min;function Ke(e){var t=Math[e];return function(i,r){if(i=Lt(i),r=r==null?0:He(xe(r),292),r&&$e(i)){var o=(It(i)+"e").split("e"),n=t(o[0]+"e"+(+o[1]+r));return o=(It(n)+"e").split("e"),+(o[0]+"e"+(+o[1]-r))}return t(i)}}var Oe=Ke("round"),Je=Oe;const Ye=e=>1-Math.pow(1-e,5);function qe(e){const{from:t,to:i,duration:r,onUpdate:o,onFinish:n}=e,s=()=>{const a=performance.now(),c=Math.min(a-u,r),l=t+(i-t)*Ye(c/r);if(c===r){n();return}o(l),requestAnimationFrame(s)},u=performance.now();s()}const je={to:{type:Number,default:0},precision:{type:Number,default:0},showSeparator:Boolean,locale:String,from:{type:Number,default:0},active:{type:Boolean,default:!0},duration:{type:Number,default:2e3}};var Ge=st({name:"NumberAnimation",props:je,setup(e){const{localeRef:t}=ce("name"),{duration:i}=e,r=D(e.from),o=_t(()=>{const{locale:f}=e;return f!==void 0?f:t.value});let n=!1;const s=f=>{r.value=f},u=()=>{r.value=e.to,n=!1},a=(f=e.from,g=e.to)=>{n=!0,r.value=e.from,f!==g&&qe({from:f,to:g,duration:i,onUpdate:s,onFinish:u})},c=_t(()=>{var f;const p=Je(r.value,e.precision).toFixed(e.precision).split("."),_=new Intl.NumberFormat(o.value),E=(f=_.formatToParts(.5).find(d=>d.type==="decimal"))===null||f===void 0?void 0:f.value,m=e.showSeparator?_.format(Number(p[0])):p[0],w=p[1];return{integer:m,decimal:w,decimalSeparator:E}});function l(){n||a()}return kt(()=>{le(()=>{e.active&&a()})}),Object.assign({formattedValue:c},{play:l})},render(){const{formattedValue:{integer:e,decimal:t,decimalSeparator:i}}=this;return[e,t?i:null,t]}}),Qe=W("statistic",[Z("label",` - font-weight: var(--n-label-font-weight); - transition: .3s color var(--n-bezier); - font-size: var(--n-label-font-size); - color: var(--n-label-text-color); - `),W("statistic-value",` - margin-top: 4px; - font-weight: var(--n-value-font-weight); - `,[Z("prefix",` - margin: 0 4px 0 0; - font-size: 24px; - transition: .3s color var(--n-bezier); - color: var(--n-value-prefix-text-color); - `,[W("icon",{verticalAlign:"-0.125em"})]),Z("content",` - font-size: 24px; - transition: .3s color var(--n-bezier); - color: var(--n-value-text-color); - `),Z("suffix",` - margin: 0 0 0 4px; - font-size: 24px; - transition: .3s color var(--n-bezier); - color: var(--n-value-suffix-text-color); - `,[W("icon",{verticalAlign:"-0.125em"})])])]);const We=Object.assign(Object.assign({},Ut.props),{tabularNums:Boolean,label:String,value:[String,Number]});var Ze=st({name:"Statistic",props:We,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:i}=fe(e),r=Ut("Statistic","-statistic",Qe,de,e,t),o=_t(()=>{const{self:{labelFontWeight:s,valueFontWeight:u,valuePrefixTextColor:a,labelTextColor:c,valueSuffixTextColor:l,valueTextColor:y,labelFontSize:f},common:{cubicBezierEaseInOut:g}}=r.value;return{"--n-bezier":g,"--n-label-font-size":f,"--n-label-font-weight":s,"--n-label-text-color":c,"--n-value-font-weight":u,"--n-value-prefix-text-color":a,"--n-value-suffix-text-color":l,"--n-value-text-color":y}}),n=i?ge("statistic",void 0,o,e):void 0;return{mergedClsPrefix:t,cssVars:i?void 0:o,themeClass:n==null?void 0:n.themeClass,onRender:n==null?void 0:n.onRender}},render(){var e;const{mergedClsPrefix:t,$slots:{default:i,label:r,prefix:o,suffix:n}}=this;return(e=this.onRender)===null||e===void 0||e.call(this),x("div",{class:[`${t}-statistic`,this.themeClass],style:this.cssVars},X(r,s=>x("div",{class:`${t}-statistic__label`},this.label||s)),x("div",{class:`${t}-statistic-value`,style:{fontVariantNumeric:this.tabularNums?"tabular-nums":""}},X(o,s=>s&&x("span",{class:`${t}-statistic-value__prefix`},s)),this.value!==void 0?x("span",{class:`${t}-statistic-value__content`},this.value):X(i,s=>s&&x("span",{class:`${t}-statistic-value__content`},s)),X(n,s=>s&&x("span",{class:`${t}-statistic-value__suffix`},s))))}});const Xe={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},tn=S("path",{d:"M102.41 32C62.38 32 32 64.12 32 103.78v304.45C32 447.86 64.38 480 104.41 480h303.2c40 0 72.39-32.14 72.39-71.77v-3.11c-1.35-.56-115.47-48.57-174.5-76.7c-39.82 48.57-91.18 78-144.5 78c-90.18 0-120.8-78.22-78.1-129.72c9.31-11.22 25.15-21.94 49.73-28c38.45-9.36 99.64 5.85 157 24.61a309.41 309.41 0 0 0 25.46-61.67H138.34V194h91.13v-31.83H119.09v-17.75h110.38V99s0-7.65 7.82-7.65h44.55v53H391v17.75H281.84V194h89.08a359.41 359.41 0 0 1-37.72 94.43c27 9.69 49.31 18.88 67.39 24.89c60.32 20 77.23 22.45 79.41 22.7V103.78C480 64.12 447.6 32 407.61 32h-305.2zM152 274.73q-5.81.06-11.67.63c-11.3 1.13-32.5 6.07-44.09 16.23c-34.74 30-13.94 84.93 56.37 84.93c40.87 0 81.71-25.9 113.79-67.37c-41.36-20-77-34.85-114.4-34.42z",fill:"currentColor"},null,-1),en=[tn];var nn=st({name:"LogoAlipay",render:function(t,i){return P(),L("svg",Xe,en)}}),G={},on=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},zt={},T={};let Et;const rn=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];T.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};T.getSymbolTotalCodewords=function(t){return rn[t]};T.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};T.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');Et=t};T.isKanjiModeEnabled=function(){return typeof Et!="undefined"};T.toSJIS=function(t){return Et(t)};var ut={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+i)}}e.isValid=function(r){return r&&typeof r.bit!="undefined"&&r.bit>=0&&r.bit<4},e.from=function(r,o){if(e.isValid(r))return r;try{return t(r)}catch{return o}}})(ut);function Vt(){this.buffer=[],this.length=0}Vt.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let i=0;i>>t-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var sn=Vt;function Q(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Q.prototype.set=function(e,t,i,r){const o=e*this.size+t;this.data[o]=i,r&&(this.reservedBit[o]=!0)};Q.prototype.get=function(e,t){return this.data[e*this.size+t]};Q.prototype.xor=function(e,t,i){this.data[e*this.size+t]^=i};Q.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var an=Q,xt={};(function(e){const t=T.getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const o=Math.floor(r/7)+2,n=t(r),s=n===145?26:Math.ceil((n-13)/(2*o-2))*2,u=[n-7];for(let a=1;a=0&&o<=7},e.from=function(o){return e.isValid(o)?parseInt(o,10):void 0},e.getPenaltyN1=function(o){const n=o.size;let s=0,u=0,a=0,c=null,l=null;for(let y=0;y=5&&(s+=t.N1+(u-5)),c=g,u=1),g=o.get(f,y),g===l?a++:(a>=5&&(s+=t.N1+(a-5)),l=g,a=1)}u>=5&&(s+=t.N1+(u-5)),a>=5&&(s+=t.N1+(a-5))}return s},e.getPenaltyN2=function(o){const n=o.size;let s=0;for(let u=0;u=10&&(u===1488||u===93)&&s++,a=a<<1&2047|o.get(l,c),l>=10&&(a===1488||a===93)&&s++}return s*t.N3},e.getPenaltyN4=function(o){let n=0;const s=o.data.length;for(let a=0;a=0;){const s=n[0];for(let a=0;a0){const n=new Uint8Array(this.degree);return n.set(r,o),n}return r};var cn=Bt,Jt={},z={},bt={};bt.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var k={};const Yt="[0-9]+",ln="[A-Z $%*+\\-./:]+";let j="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";j=j.replace(/u/g,"\\u");const fn="(?:(?![A-Z0-9 $%*+\\-./:]|"+j+`)(?:.|[\r -]))+`;k.KANJI=new RegExp(j,"g");k.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");k.BYTE=new RegExp(fn,"g");k.NUMERIC=new RegExp(Yt,"g");k.ALPHANUMERIC=new RegExp(ln,"g");const dn=new RegExp("^"+j+"$"),gn=new RegExp("^"+Yt+"$"),hn=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");k.testKanji=function(t){return dn.test(t)};k.testNumeric=function(t){return gn.test(t)};k.testAlphanumeric=function(t){return hn.test(t)};(function(e){const t=bt,i=k;e.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(n,s){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?n.ccBits[0]:s<27?n.ccBits[1]:n.ccBits[2]},e.getBestModeForData=function(n){return i.testNumeric(n)?e.NUMERIC:i.testAlphanumeric(n)?e.ALPHANUMERIC:i.testKanji(n)?e.KANJI:e.BYTE},e.toString=function(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")},e.isValid=function(n){return n&&n.bit&&n.ccBits};function r(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+o)}}e.from=function(n,s){if(e.isValid(n))return n;try{return r(n)}catch{return s}}})(z);(function(e){const t=T,i=ct,r=ut,o=z,n=bt,s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,u=t.getBCHDigit(s);function a(f,g,p){for(let _=1;_<=40;_++)if(g<=e.getCapacity(_,p,f))return _}function c(f,g){return o.getCharCountIndicator(f,g)+4}function l(f,g){let p=0;return f.forEach(function(_){p+=c(_.mode,g)+_.getBitsLength()}),p}function y(f,g){for(let p=1;p<=40;p++)if(l(f,p)<=e.getCapacity(p,g,o.MIXED))return p}e.from=function(g,p){return n.isValid(g)?parseInt(g,10):p},e.getCapacity=function(g,p,_){if(!n.isValid(g))throw new Error("Invalid QR Code version");typeof _=="undefined"&&(_=o.BYTE);const E=t.getSymbolTotalCodewords(g),m=i.getTotalCodewordsCount(g,p),w=(E-m)*8;if(_===o.MIXED)return w;const d=w-c(_,g);switch(_){case o.NUMERIC:return Math.floor(d/10*3);case o.ALPHANUMERIC:return Math.floor(d/11*2);case o.KANJI:return Math.floor(d/13);case o.BYTE:default:return Math.floor(d/8)}},e.getBestVersionForData=function(g,p){let _;const E=r.from(p,r.M);if(Array.isArray(g)){if(g.length>1)return y(g,E);if(g.length===0)return 1;_=g[0]}else _=g;return a(_.mode,_.getLength(),E)},e.getEncodedBits=function(g){if(!n.isValid(g)||g<7)throw new Error("Invalid QR Code version");let p=g<<12;for(;t.getBCHDigit(p)-u>=0;)p^=s<=0;)o^=jt<0&&(r=this.data.substr(i),o=parseInt(r,10),t.put(o,n*3+1))};var _n=H;const wn=z,dt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function K(e){this.mode=wn.ALPHANUMERIC,this.data=e}K.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};K.prototype.getLength=function(){return this.data.length};K.prototype.getBitsLength=function(){return K.getBitsLength(this.data.length)};K.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let r=dt.indexOf(this.data[i])*45;r+=dt.indexOf(this.data[i+1]),t.put(r,11)}this.data.length%2&&t.put(dt.indexOf(this.data[i]),6)};var yn=K,Cn=function(t){for(var i=[],r=t.length,o=0;o=55296&&n<=56319&&r>o+1){var s=t.charCodeAt(o+1);s>=56320&&s<=57343&&(n=(n-55296)*1024+s-56320+65536,o+=1)}if(n<128){i.push(n);continue}if(n<2048){i.push(n>>6|192),i.push(n&63|128);continue}if(n<55296||n>=57344&&n<65536){i.push(n>>12|224),i.push(n>>6&63|128),i.push(n&63|128);continue}if(n>=65536&&n<=1114111){i.push(n>>18|240),i.push(n>>12&63|128),i.push(n>>6&63|128),i.push(n&63|128);continue}i.push(239,191,189)}return new Uint8Array(i).buffer};const vn=Cn,En=z;function O(e){this.mode=En.BYTE,this.data=new Uint8Array(vn(e))}O.getBitsLength=function(t){return t*8};O.prototype.getLength=function(){return this.data.length};O.prototype.getBitsLength=function(){return O.getBitsLength(this.data.length)};O.prototype.write=function(e){for(let t=0,i=this.data.length;t=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+` -Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),e.put(i,13)}};var Nn=J,Qt={exports:{}};(function(e){var t={single_source_shortest_paths:function(i,r,o){var n={},s={};s[r]=0;var u=t.PriorityQueue.make();u.push(r,0);for(var a,c,l,y,f,g,p,_,E;!u.empty();){a=u.pop(),c=a.value,y=a.cost,f=i[c]||{};for(l in f)f.hasOwnProperty(l)&&(g=f[l],p=y+g,_=s[l],E=typeof s[l]=="undefined",(E||_>p)&&(s[l]=p,u.push(l,p),n[l]=c))}if(typeof o!="undefined"&&typeof s[o]=="undefined"){var m=["Could not find a path from ",r," to ",o,"."].join("");throw new Error(m)}return n},extract_shortest_path_from_predecessor_list:function(i,r){for(var o=[],n=r;n;)o.push(n),n=i[n];return o.reverse(),o},find_path:function(i,r,o){var n=t.single_source_shortest_paths(i,r,o);return t.extract_shortest_path_from_predecessor_list(n,o)},PriorityQueue:{make:function(i){var r=t.PriorityQueue,o={},n;i=i||{};for(n in r)r.hasOwnProperty(n)&&(o[n]=r[n]);return o.queue=[],o.sorter=i.sorter||r.default_sorter,o},default_sorter:function(i,r){return i.cost-r.cost},push:function(i,r){var o={value:i,cost:r};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Qt);(function(e){const t=z,i=_n,r=yn,o=Bn,n=Nn,s=k,u=T,a=Qt.exports;function c(m){return unescape(encodeURIComponent(m)).length}function l(m,w,d){const h=[];let C;for(;(C=m.exec(d))!==null;)h.push({data:C[0],index:C.index,mode:w,length:C[0].length});return h}function y(m){const w=l(s.NUMERIC,t.NUMERIC,m),d=l(s.ALPHANUMERIC,t.ALPHANUMERIC,m);let h,C;return u.isKanjiModeEnabled()?(h=l(s.BYTE,t.BYTE,m),C=l(s.KANJI,t.KANJI,m)):(h=l(s.BYTE_KANJI,t.BYTE,m),C=[]),w.concat(d,h,C).sort(function(B,A){return B.index-A.index}).map(function(B){return{data:B.data,mode:B.mode,length:B.length}})}function f(m,w){switch(w){case t.NUMERIC:return i.getBitsLength(m);case t.ALPHANUMERIC:return r.getBitsLength(m);case t.KANJI:return n.getBitsLength(m);case t.BYTE:return o.getBitsLength(m)}}function g(m){return m.reduce(function(w,d){const h=w.length-1>=0?w[w.length-1]:null;return h&&h.mode===d.mode?(w[w.length-1].data+=d.data,w):(w.push(d),w)},[])}function p(m){const w=[];for(let d=0;d=0&&u<=6&&(a===0||a===6)||a>=0&&a<=6&&(u===0||u===6)||u>=2&&u<=4&&a>=2&&a<=4?e.set(n+u,s+a,!0,!0):e.set(n+u,s+a,!1,!0))}}function Ln(e){const t=e.size;for(let i=8;i>u&1)===1,e.set(o,n,s,!0),e.set(n,o,s,!0)}function mt(e,t,i){const r=e.size,o=Rn.getEncodedBits(t,i);let n,s;for(n=0;n<15;n++)s=(o>>n&1)===1,n<6?e.set(n,8,s,!0):n<8?e.set(n+1,8,s,!0):e.set(r-15+n,8,s,!0),n<8?e.set(8,r-n-1,s,!0):n<9?e.set(8,15-n-1+1,s,!0):e.set(8,15-n-1,s,!0);e.set(r-8,8,1,!0)}function zn(e,t){const i=e.size;let r=-1,o=i-1,n=7,s=0;for(let u=i-1;u>0;u-=2)for(u===6&&u--;;){for(let a=0;a<2;a++)if(!e.isReserved(o,u-a)){let c=!1;s>>n&1)===1),e.set(o,u-a,c),n--,n===-1&&(s++,n=7)}if(o+=r,o<0||i<=o){o-=r,r=-r;break}}}function Vn(e,t,i){const r=new In;i.forEach(function(a){r.put(a.mode.bit,4),r.put(a.getLength(),Fn.getCharCountIndicator(a.mode,e)),a.write(r)});const o=ft.getSymbolTotalCodewords(e),n=Ct.getTotalCodewordsCount(e,t),s=(o-n)*8;for(r.getLengthInBits()+4<=s&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const u=(s-r.getLengthInBits())/8;for(let a=0;a=7&&Un(a,t),zn(a,s),isNaN(r)&&(r=yt.getBestMask(a,mt.bind(null,a,i))),yt.applyMask(r,a),mt(a,i,r),{modules:a,version:t,errorCorrectionLevel:i,maskPattern:r,segments:o}}zt.create=function(t,i){if(typeof t=="undefined"||t==="")throw new Error("No input text");let r=gt.M,o,n;return typeof i!="undefined"&&(r=gt.from(i.errorCorrectionLevel,gt.M),o=it.from(i.version),n=yt.from(i.maskPattern),i.toSJISFunc&&ft.setToSJISFunction(i.toSJISFunc)),$n(t,o,r,n)};var Wt={},At={};(function(e){function t(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let r=i.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+i);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(n){return[n,n]}))),r.length===6&&r.push("F","F");const o=parseInt(r.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const o=typeof r.margin=="undefined"||r.margin===null||r.margin<0?4:r.margin,n=r.width&&r.width>=21?r.width:void 0,s=r.scale||4;return{width:n,scale:n?4:s,margin:o,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,o){return o.width&&o.width>=r+o.margin*2?o.width/(r+o.margin*2):o.scale},e.getImageWidth=function(r,o){const n=e.getScale(r,o);return Math.floor((r+o.margin*2)*n)},e.qrToImageData=function(r,o,n){const s=o.modules.size,u=o.modules.data,a=e.getScale(s,n),c=Math.floor((s+n.margin*2)*a),l=n.margin*a,y=[n.color.light,n.color.dark];for(let f=0;f=l&&g>=l&&f0&&a>0&&e[u-1]||(r+=n?pt("M",a+i,.5+c+i):pt("m",o,0),o=0,n=!1),a+1':"",c="',l='viewBox="0 0 '+u+" "+u+'"',y=o.width?'width="'+o.width+'" height="'+o.width+'" ':"",f=''+a+c+` -`;return typeof r=="function"&&r(null,f),f};const On=on,vt=zt,Xt=Wt,Jn=Zt;function Nt(e,t,i,r,o){const n=[].slice.call(arguments,1),s=n.length,u=typeof n[s-1]=="function";if(!u&&!On())throw new Error("Callback required as last argument");if(u){if(s<2)throw new Error("Too few arguments provided");s===2?(o=i,i=t,t=r=void 0):s===3&&(t.getContext&&typeof o=="undefined"?(o=r,r=void 0):(o=r,r=i,i=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(i=t,t=r=void 0):s===2&&!t.getContext&&(r=i,i=t,t=void 0),new Promise(function(a,c){try{const l=vt.create(i,r);a(e(l,t,r))}catch(l){c(l)}})}try{const a=vt.create(i,r);o(null,e(a,t,r))}catch(a){o(a)}}G.create=vt.create;G.toCanvas=Nt.bind(null,Xt.render);G.toDataURL=Nt.bind(null,Xt.renderToDataURL);G.toString=Nt.bind(null,function(e,t,i){return Jn.render(e,i)});const te=e=>(Ee("data-v-4ef16ff5"),e=e(),Be(),e),Yn={class:"balance-wrap"},qn={class:"balance-line"},jn={class:"balance-opts"},Gn=at(" \u5145\u503C "),Qn=at(" \u63D0\u73B0 "),Wn={key:0,class:"pagination-wrap"},Zn={key:0,class:"skeleton-wrap"},Xn={key:1},to={key:0,class:"empty-wrap"},eo={class:"bill-line"},no={key:0,class:"amount-options"},oo={key:1,style:{"margin-top":"10px"}},ro=at(" \u524D\u5F80\u652F\u4ED8 "),io={class:"qrcode-wrap"},so=te(()=>S("canvas",{id:"qrcode-container"},null,-1)),ao={class:"pay-tips"},uo={class:"pay-sub-tips"},co=te(()=>S("span",{style:{"margin-left":"6px"}}," \u652F\u4ED8\u7ED3\u679C\u5B9E\u65F6\u540C\u6B65\u4E2D... ",-1)),lo=st({setup(e){const t=me(),i=pe(),r=D(!1),o=D(100),n=D(!1),s=D(""),u=D(!1),a=D([]),c=D(+i.query.p||1),l=D(20),y=D(0),f=D([100,200,300,500,1e3,3e3,5e3,1e4,5e4]),g=()=>{u.value=!0,be({page:c.value,page_size:l.value}).then(d=>{u.value=!1,a.value=d.list,y.value=Math.ceil(d.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(d=>{u.value=!1})},p=d=>{c.value=d,g()},_=()=>{const d=localStorage.getItem("PAOPAO_TOKEN")||"";d?we(d).then(h=>{t.commit("updateUserinfo",h),t.commit("triggerAuth",!1),g()}).catch(h=>{t.commit("triggerAuth",!0),t.commit("userLogout")}):(t.commit("triggerAuth",!0),t.commit("userLogout"))},E=()=>{r.value=!0},m=d=>{n.value=!0,Ae({amount:o.value}).then(h=>{n.value=!1,s.value=h.pay,G.toCanvas(document.querySelector("#qrcode-container"),h.pay,{width:150,margin:2});const C=setInterval(()=>{Ne({id:h.id}).then(v=>{v.status==="TRADE_SUCCESS"&&(clearInterval(C),window.$message.success("\u5145\u503C\u6210\u529F"),r.value=!1,s.value="",_())}).catch(v=>{console.log(v)})},2e3)}).catch(h=>{n.value=!1})},w=()=>{t.state.userInfo.balance==0?window.$message.warning("\u60A8\u6682\u65E0\u53EF\u63D0\u73B0\u8D44\u91D1"):window.$message.warning("\u8BE5\u529F\u80FD\u5373\u5C06\u5F00\u653E")};return kt(()=>{_()}),(d,h)=>{const C=ae,v=Ge,B=Ze,A=Ie,R=Se,M=Le,V=se,Y=ke,F=Ue,ee=De,ne=_e,oe=Te,re=Me,ie=ye;return P(),L("div",null,[b(C,{title:"\u94B1\u5305"}),b(ee,{class:"main-content-wrap",bordered:""},{footer:I(()=>[y.value>1?(P(),L("div",Wn,[b(M,{page:c.value,"onUpdate:page":p,"page-slot":tt(t).state.collapsedRight?5:8,"page-count":y.value},null,8,["page","page-slot","page-count"])])):et("",!0)]),default:I(()=>[S("div",Yn,[S("div",qn,[b(B,{label:"\u8D26\u6237\u4F59\u989D (\u5143)"},{default:I(()=>[b(v,{from:0,to:(tt(t).state.userInfo.balance||0)/100,duration:500,precision:2},null,8,["from","to"])]),_:1}),S("div",jn,[b(R,{vertical:""},{default:I(()=>[b(A,{size:"small",secondary:"",type:"primary",onClick:E},{default:I(()=>[Gn]),_:1}),b(A,{size:"small",secondary:"",type:"tertiary",onClick:w},{default:I(()=>[Qn]),_:1})]),_:1})])])]),u.value?(P(),L("div",Zn,[b(V,{num:l.value},null,8,["num"])])):(P(),L("div",Xn,[a.value.length===0?(P(),L("div",to,[b(Y,{size:"large",description:"\u6682\u65E0\u6570\u636E"})])):et("",!0),(P(!0),L(St,null,Tt(a.value,N=>(P(),Mt(F,{key:N.id},{default:I(()=>[S("div",eo,[S("div",null,"NO."+$(N.id),1),S("div",null,$(N.reason),1),S("div",{class:Pe({income:N.change_amount>=0,out:N.change_amount<0})},$((N.change_amount>0?"+":"")+(N.change_amount/100).toFixed(2)),3),S("div",null,$(tt(Fe)(N.created_on)),1)])]),_:2},1024))),128))]))]),_:1}),b(ie,{show:r.value,"onUpdate:show":h[0]||(h[0]=N=>r.value=N)},{default:I(()=>[b(re,{bordered:!1,title:"\u8BF7\u9009\u62E9\u5145\u503C\u91D1\u989D",role:"dialog","aria-modal":"true",style:{width:"100%","max-width":"330px"}},{default:I(()=>[s.value.length===0?(P(),L("div",no,[b(R,{align:"baseline"},{default:I(()=>[(P(!0),L(St,null,Tt(f.value,N=>(P(),Mt(A,{key:N,size:"small",secondary:"",type:o.value===N?"info":"default",onClick:Re(fo=>o.value=N,["stop"])},{default:I(()=>[at($(N/100)+"\u5143 ",1)]),_:2},1032,["type","onClick"]))),128))]),_:1})])):et("",!0),o.value>0&&s.value.length===0?(P(),L("div",oo,[b(A,{loading:n.value,strong:"",secondary:"",type:"info",style:{width:"100%"},onClick:m},{icon:I(()=>[b(ne,null,{default:I(()=>[b(tt(nn))]),_:1})]),default:I(()=>[ro]),_:1},8,["loading"])])):et("",!0),Ce(S("div",io,[so,S("div",ao," \u8BF7\u4F7F\u7528\u652F\u4ED8\u5B9D\u626B\u7801\u652F\u4ED8"+$((o.value/100).toFixed(2))+"\u5143 ",1),S("div",uo,[b(oe,{value:100,type:"info",dot:"",processing:""}),co])],512),[[ve,s.value.length>0]])]),_:1})]),_:1},8,["show"])])}}});var Co=he(lo,[["__scopeId","data-v-4ef16ff5"]]);export{Co as default}; diff --git a/web/dist/assets/content.ef1e095a.js b/web/dist/assets/content.ef1e095a.js deleted file mode 100644 index d32e5755..00000000 --- a/web/dist/assets/content.ef1e095a.js +++ /dev/null @@ -1,810 +0,0 @@ -import{bf as oe,s as F,r as I,ar as ie,e as se,d as $,i as ae,au as G,h as R,bg as le,u as ue,j as q,A as de,t as pe,b3 as ce,b4 as ve,B as fe,C as me,bh as ye,b2 as he,V as s,W as c,Y as S,ah as H,aa as h,ab as k,a3 as i,a4 as p,a2 as m,a9 as N,a7 as x,ae as Y,a5 as y,aY as M,aZ as O,bi as X,a6 as g,bj as Q,bk as ge,bl as we,bm as be,a8 as ke,bn as xe,bo as $e,J as Ce,bp as Se}from"./index.f480f018.js";function Ee(e){if(typeof e=="number")return{"":e.toString()};const n={};return e.split(/ +/).forEach(l=>{if(l==="")return;const[a,u]=l.split(":");u===void 0?n[""]=a:n[a]=u}),n}function D(e,n){var l;if(e==null)return;const a=Ee(e);if(n===void 0)return a[""];if(typeof n=="string")return(l=a[n])!==null&&l!==void 0?l:a[""];if(Array.isArray(n)){for(let u=n.length-1;u>=0;--u){const r=n[u];if(r in a)return a[r]}return a[""]}else{let u,r=-1;return Object.keys(a).forEach(t=>{const d=Number(t);!Number.isNaN(d)&&n>=d&&d>=r&&(r=d,u=a[t])}),u}}const _e={xs:0,s:640,m:1024,l:1280,xl:1536,"2xl":1920};function Be(e){return`(min-width: ${e}px)`}const T={};function ze(e=_e){if(!oe)return F(()=>[]);if(typeof window.matchMedia!="function")return F(()=>[]);const n=I({}),l=Object.keys(e),a=(u,r)=>{u.matches?n.value[r]=!0:n.value[r]=!1};return l.forEach(u=>{const r=e[u];let t,d;T[r]===void 0?(t=window.matchMedia(Be(r)),t.addEventListener?t.addEventListener("change",v=>{d.forEach(w=>{w(v,u)})}):t.addListener&&t.addListener(v=>{d.forEach(w=>{w(v,u)})}),d=new Set,T[r]={mql:t,cbs:d}):(t=T[r].mql,d=T[r].cbs),d.add(a),t.matches&&d.forEach(v=>{v(t,u)})}),ie(()=>{l.forEach(u=>{const{cbs:r}=T[e[u]];r.has(a)&&r.delete(a)})}),F(()=>{const{value:u}=n;return l.filter(r=>u[r])})}const L=1,W=se("n-grid"),Z=1,je={span:{type:[Number,String],default:Z},offset:{type:[Number,String],default:0},suffix:Boolean,privateOffset:Number,privateSpan:Number,privateColStart:Number,privateShow:{type:Boolean,default:!0}};var J=$({__GRID_ITEM__:!0,name:"GridItem",alias:["Gi"],props:je,setup(){const{xGapRef:e,itemStyleRef:n,overflowRef:l}=ae(W),a=le();return{overflow:l,itemStyle:n,deriveStyle:()=>{const{privateSpan:u=Z,privateShow:r=!0,privateColStart:t=void 0,privateOffset:d=0}=a.vnode.props,{value:v}=e,w=G(v||0);return{display:r?"":"none",gridColumn:`${t!=null?t:`span ${u}`} / span ${u}`,marginLeft:d?`calc((100% - (${u} - 1) * ${w}) / ${u} * ${d} + ${w} * ${d})`:""}}}},render(){var e,n;return R("div",{style:[this.itemStyle,this.deriveStyle()]},(n=(e=this.$slots).default)===null||n===void 0?void 0:n.call(e,{overflow:this.overflow}))}});const Re={xs:0,s:640,m:1024,l:1280,xl:1536,xxl:1920},K=24,Fe={responsive:{type:[String,Boolean],default:"self"},cols:{type:[Number,String],default:K},itemResponsive:Boolean,collapsed:Boolean,collapsedRows:{type:Number,default:1},itemStyle:[Object,String],xGap:{type:[Number,String],default:0},yGap:{type:[Number,String],default:0}};var ee=$({name:"Grid",inheritAttrs:!1,props:Fe,setup(e){const{mergedClsPrefixRef:n,mergedBreakpointsRef:l}=ue(e),a=/^\d+$/,u=I(void 0),r=ze((l==null?void 0:l.value)||Re),t=q(()=>!!(e.itemResponsive||!a.test(e.cols.toString())||!a.test(e.xGap.toString())||!a.test(e.yGap.toString()))),d=F(()=>{if(!!t.value)return e.responsive==="self"?u.value:r.value}),v=q(()=>{var C;return(C=Number(D(e.cols.toString(),d.value)))!==null&&C!==void 0?C:K}),w=q(()=>D(e.xGap.toString(),d.value)),o=q(()=>D(e.yGap.toString(),d.value)),f=C=>{u.value=C.contentRect.width},E=C=>{ve(f,C)},z=I(!1),_=F(()=>{if(e.responsive==="self")return E});return de(W,{itemStyleRef:pe(e,"itemStyle"),xGapRef:w,overflowRef:z}),{mergedClsPrefix:n,style:F(()=>({width:"100%",display:"grid",gridTemplateColumns:`repeat(${v.value}, minmax(0, 1fr))`,columnGap:G(w.value),rowGap:G(o.value)})),isResponsive:t,responsiveQuery:d,responsiveCols:v,handleResize:_,overflow:z}},render(){const e=()=>{var n,l,a,u,r,t;this.overflow=!1;const d=fe(me(this)),v=[],{collapsed:w,collapsedRows:o,responsiveCols:f,responsiveQuery:E}=this;d.forEach(b=>{var A,j,B;if(((A=b==null?void 0:b.type)===null||A===void 0?void 0:A.__GRID_ITEM__)!==!0)return;const P=ye(b),U=Number((B=D((j=P.props)===null||j===void 0?void 0:j.span,E))!==null&&B!==void 0?B:L);U!==0&&v.push({child:P,rawChildSpan:U})});let z=0;const _=(n=v[v.length-1])===null||n===void 0?void 0:n.child;if(_!=null&&_.props){const b=(l=_.props)===null||l===void 0?void 0:l.suffix;b!==void 0&&b!==!1&&(z=(u=(a=_.props)===null||a===void 0?void 0:a.span)!==null&&u!==void 0?u:L,_.props.privateSpan=z,_.props.privateColStart=f+1-z,_.props.privateShow=!0)}let C=0,V=!1;for(const{child:b,rawChildSpan:A}of v){if(V&&(this.overflow=!0),!V){const j=Number((t=D((r=b.props)===null||r===void 0?void 0:r.offset,E))!==null&&t!==void 0?t:0),B=Math.min(A+j,f)||1;if(b.props?(b.props.privateSpan=B,b.props.privateOffset=j):b.props={privateSpan:B,privateOffset:j},w){const P=C%f;B+P>f&&(C+=f-P),B+C+z>o*f?V=!0:C+=B}}V&&(b.props?b.props.privateShow!==!0&&(b.props.privateShow=!1):b.props={privateShow:!1})}return R("div",he({class:`${this.mergedClsPrefix}-grid`,style:this.style},this.$attrs),v.map(({child:b})=>b))};return this.isResponsive&&this.responsive==="self"?R(ce,{onResize:this.handleResize},{default:e}):e()}});const Ie={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Me=S("path",{d:"M352 48H160a48 48 0 0 0-48 48v368l144-128l144 128V96a48 48 0 0 0-48-48z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Ne=[Me];var jn=$({name:"BookmarkOutline",render:function(n,l){return s(),c("svg",Ie,Ne)}});const Ae={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Pe=S("path",{d:"M408 64H104a56.16 56.16 0 0 0-56 56v192a56.16 56.16 0 0 0 56 56h40v80l93.72-78.14a8 8 0 0 1 5.13-1.86H408a56.16 56.16 0 0 0 56-56V120a56.16 56.16 0 0 0-56-56z",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),De=[Pe];var Rn=$({name:"ChatboxOutline",render:function(n,l){return s(),c("svg",Ae,De)}});const Te={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Ve=S("path",{d:"M320 336h76c55 0 100-21.21 100-75.6s-53-73.47-96-75.6C391.11 99.74 329 48 256 48c-69 0-113.44 45.79-128 91.2c-60 5.7-112 35.88-112 98.4S70 336 136 336h56",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),qe=S("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 400.1l64 63.9l64-63.9"},null,-1),Oe=S("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 224v224.03"},null,-1),Ge=[Ve,qe,Oe];var Ue=$({name:"CloudDownloadOutline",render:function(n,l){return s(),c("svg",Te,Ge)}});const Le={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},He=S("path",{d:"M352.92 80C288 80 256 144 256 144s-32-64-96.92-64c-52.76 0-94.54 44.14-95.08 96.81c-1.1 109.33 86.73 187.08 183 252.42a16 16 0 0 0 18 0c96.26-65.34 184.09-143.09 183-252.42c-.54-52.67-42.32-96.81-95.08-96.81z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Ye=[He];var Fn=$({name:"HeartOutline",render:function(n,l){return s(),c("svg",Le,Ye)}});const Xe={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Qe=S("path",{d:"M208 352h-64a96 96 0 0 1 0-192h64",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36"},null,-1),We=S("path",{d:"M304 160h64a96 96 0 0 1 0 192h-64",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36"},null,-1),Ze=S("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"36",d:"M163.29 256h187.42"},null,-1),Je=[Qe,We,Ze];var Ke=$({name:"LinkOutline",render:function(n,l){return s(),c("svg",Xe,Je)}});const en={class:"link-wrap"},nn=["href"],tn={class:"link-txt"},rn=$({props:{links:{default:()=>[]}},setup(e){const n=e;return(l,a)=>{const u=Y;return s(),c("div",en,[(s(!0),c(h,null,k(n.links,r=>(s(),c("div",{class:"link-item",key:r.id},[i(u,{class:"hash-link"},{default:p(()=>[i(m(Ke))]),_:1}),S("a",{href:r.content,class:"hash-link",target:"_blank",onClick:a[0]||(a[0]=x(()=>{},["stop"]))},[S("span",tn,N(r.content),1)],8,nn)]))),128))])}}});var In=H(rn,[["__scopeId","data-v-4c9a59cc"]]),ne=$({name:"BasicTheme",props:{uuid:{type:String,required:!0},src:{type:String,required:!0},autoplay:{type:Boolean,required:!0},loop:{type:Boolean,required:!0},controls:{type:Boolean,required:!0},hoverable:{type:Boolean,required:!0},mask:{type:Boolean,required:!0},colors:{type:[String,Array],required:!0},time:{type:Object,required:!0},playing:{type:Boolean,default:!1},duration:{type:[String,Number],required:!0}},data(){return{hovered:!1,volume:!1,amount:1}},computed:{colorFrom(){var e;return typeof this.colors=="string"?this.colors?this.colors:"#fbbf24":(e=this.colors)!==null&&e!==void 0&&e[0]?this.colors[0]:"#fbbf24"},colorTo(){var e;return typeof this.colors=="string"?this.colors?this.colors:"#fbbf24":(e=this.colors)!==null&&e!==void 0&&e[1]?this.colors[1]:"#ec4899"}},mounted(){this.$emit("setPlayer",this.$refs[this.uuid])},methods:{setVolume(){this.$refs[this.uuid].volume=this.amount},stopVolume(){return this.amount>0?this.amount=0:this.amount=1}}});const on={class:"relative"},sn={class:"flex items-center justify-start w-full"},an={class:"font-sans text-white text-xs w-24"},ln={class:"mr-3 ml-2"},un={class:"relative"},dn={class:"px-3 py-2 rounded-lg flex items-center transform translate-x-2",style:{"background-color":"rgba(0, 0, 0, .8)"}},pn=i("img",{src:"https://en-zo.dev/vue-videoplayer/play.svg",alt:"Icon play video",class:"transform translate-x-0.5 w-12"},null,-1);function cn(e,n,l,a,u,r){return s(),y("div",{class:"shadow-xl rounded-xl overflow-hidden relative",onMouseenter:n[15]||(n[15]=t=>e.hovered=!0),onMouseleave:n[16]||(n[16]=t=>e.hovered=!1),onKeydown:n[17]||(n[17]=Q(t=>e.$emit("play"),["left"]))},[i("div",on,[i("video",{ref:e.uuid,class:"w-full",loop:e.loop,autoplay:e.autoplay,muted:e.autoplay,onTimeupdate:n[1]||(n[1]=t=>e.$emit("timeupdate",t.target)),onPause:n[2]||(n[2]=t=>e.$emit("isPlaying",!1)),onPlay:n[3]||(n[3]=t=>e.$emit("isPlaying",!0)),onClick:n[4]||(n[4]=t=>e.$emit("play"))},[i("source",{src:e.src,type:"video/mp4"},null,8,["src"])],40,["loop","autoplay","muted"]),e.controls?(s(),y("div",{key:0,class:[{"opacity-0 translate-y-full":!e.hoverable&&e.hovered,"opacity-0 translate-y-full":e.hoverable&&!e.hovered},"transition duration-300 transform absolute w-full bottom-0 left-0 flex items-center justify-between overlay px-5 pt-3 pb-5"]},[i("div",sn,[i("p",an,N(e.time.display)+"/"+N(e.duration),1),i("div",ln,[M(i("img",{src:"https://en-zo.dev/vue-videoplayer/pause.svg",alt:"Icon pause video",class:"w-5 cursor-pointer",onClick:n[5]||(n[5]=t=>e.$emit("play"))},null,512),[[O,e.playing]]),M(i("img",{src:"https://en-zo.dev/vue-videoplayer/play.svg",alt:"Icon play video",class:"w-5 cursor-pointer",onClick:n[6]||(n[6]=t=>e.$emit("play"))},null,512),[[O,!e.playing]])]),i("div",{class:"w-full h-1 bg-white bg-opacity-60 rounded-sm cursor-pointer",onClick:n[7]||(n[7]=t=>e.$emit("position",t))},[i("div",{class:"relative h-full pointer-events-none",style:`width: ${e.time.progress}%; transition: width .2s ease-in-out;`},[i("div",{class:"w-full rounded-sm h-full gradient-variable bg-gradient-to-r pointer-events-none absolute top-0 left-0",style:`--tw-gradient-from: ${e.colorFrom};--tw-gradient-to: ${e.colorTo};transition: width .2s ease-in-out`},null,4),i("div",{class:"w-full rounded-sm filter blur-sm h-full gradient-variable bg-gradient-to-r pointer-events-none absolute top-0 left-0",style:`--tw-gradient-from: ${e.colorFrom};--tw-gradient-to: ${e.colorTo};transition: width .2s ease-in-out`},null,4)],4)])]),i("div",{class:"ml-5 flex items-center justify-end",onMouseleave:n[13]||(n[13]=t=>e.volume=!1)},[i("div",un,[i("div",{class:`w-128 origin-left translate-x-2 -rotate-90 w-128 transition duration-200 absolute transform top-0 py-2 ${e.volume?"-translate-y-4":"opacity-0 -translate-y-1 pointer-events-none"}`},[i("div",dn,[M(i("input",{"onUpdate:modelValue":n[8]||(n[8]=t=>e.amount=t),type:"range",step:"0.05",min:"0",max:"1",class:"rounded-lg overflow-hidden appearance-none bg-white bg-opacity-30 h-1 w-128 vertical-range",onInput:n[9]||(n[9]=(...t)=>e.setVolume&&e.setVolume(...t))},null,544),[[X,e.amount]])])],2),i("img",{src:`https://en-zo.dev/vue-videoplayer/volume-${Math.ceil(e.amount*2)}.svg`,alt:"High volume video",class:"w-5 cursor-pointer relative",style:{"z-index":"2"},onClick:n[10]||(n[10]=(...t)=>e.stopVolume&&e.stopVolume(...t)),onMouseenter:n[11]||(n[11]=t=>e.volume=!0)},null,40,["src"])]),i("img",{src:"https://en-zo.dev/vue-videoplayer/maximize.svg",alt:"Fullscreen",class:"w-3 ml-4 cursor-pointer",onClick:n[12]||(n[12]=t=>e.$emit("fullScreen"))})],32)],2)):g("",!0),!e.autoplay&&e.mask&&e.time.current===0?(s(),y("div",{key:1,class:`transition transform duration-300 absolute top-0 left-0 w-full h-full bg-black bg-opacity-50 backdrop-filter z-10 flex items-center justify-center ${e.playing?"opacity-0 pointer-events-none":""}`},[i("div",{class:"w-20 h-20 rounded-full bg-white bg-opacity-20 transition duration-200 hover:bg-opacity-40 flex items-center justify-center cursor-pointer",onClick:n[14]||(n[14]=t=>e.$emit("play"))},[pn])],2)):g("",!0)])],32)}ne.render=cn;var te=$({name:"BasicTheme",props:{uuid:{type:String,required:!0},src:{type:String,required:!0},autoplay:{type:Boolean,required:!0},loop:{type:Boolean,required:!0},controls:{type:Boolean,required:!0},hoverable:{type:Boolean,required:!0},mask:{type:Boolean,required:!0},colors:{type:[String,Array],required:!0},time:{type:Object,required:!0},playing:{type:Boolean,default:!1},duration:{type:[String,Number],required:!0}},data(){return{hovered:!1,volume:!1,amount:1}},computed:{color(){var e;return typeof this.colors=="string"?this.colors?this.colors:"#8B5CF6":(e=this.colors)!==null&&e!==void 0&&e[0]?this.colors[0]:"#8B5CF6"}},mounted(){this.$emit("setPlayer",this.$refs[this.uuid])},methods:{setVolume(){this.$refs[this.uuid].volume=this.amount},stopVolume(){return this.amount>0?this.amount=0:this.amount=1}}});const vn={class:"relative"},fn={class:"mr-5"},mn={class:"relative mr-6"},yn={class:"px-3 py-3 rounded-xl flex items-center transform translate-x-9 bg-black bg-opacity-30"},hn=i("img",{src:"https://en-zo.dev/vue-videoplayer/play.svg",alt:"Icon play video",class:"transform translate-x-0.5 w-12"},null,-1);function gn(e,n,l,a,u,r){return s(),y("div",{class:"shadow-xl rounded-3xl overflow-hidden relative",onMouseenter:n[14]||(n[14]=t=>e.hovered=!0),onMouseleave:n[15]||(n[15]=t=>e.hovered=!1),onKeydown:n[16]||(n[16]=Q(t=>e.$emit("play"),["left"]))},[i("div",vn,[i("video",{ref:e.uuid,class:"w-full",loop:e.loop,autoplay:e.autoplay,muted:e.autoplay,onTimeupdate:n[1]||(n[1]=t=>e.$emit("timeupdate",t.target)),onPause:n[2]||(n[2]=t=>e.$emit("isPlaying",!1)),onPlay:n[3]||(n[3]=t=>e.$emit("isPlaying",!0)),onClick:n[4]||(n[4]=t=>e.$emit("play"))},[i("source",{src:e.src,type:"video/mp4"},null,8,["src"])],40,["loop","autoplay","muted"]),e.controls?(s(),y("div",{key:0,class:[{"opacity-0 translate-y-full":!e.hoverable&&e.hovered,"opacity-0 translate-y-full":e.hoverable&&!e.hovered},"absolute px-5 pb-5 bottom-0 left-0 w-full transition duration-300 transform"]},[i("div",{class:"w-full bg-black bg-opacity-30 px-5 py-4 rounded-xl flex items-center justify-between",onMouseleave:n[12]||(n[12]=t=>e.volume=!1)},[i("div",{class:"font-sans py-1 px-2 text-white rounded-md text-xs mr-5 whitespace-nowrap font-medium w-32 text-center",style:`font-size: 11px; background-color: ${e.color}`},N(e.time.display)+"\xA0/\xA0"+N(e.duration),5),i("div",fn,[M(i("img",{src:"https://en-zo.dev/vue-videoplayer/basic/pause.svg",alt:"Icon pause video",class:"w-4 cursor-pointer filter-white transition duration-300",onClick:n[5]||(n[5]=t=>e.$emit("play"))},null,512),[[O,e.playing]]),M(i("img",{src:"https://en-zo.dev/vue-videoplayer/basic/play.svg",alt:"Icon play video",class:"w-4 cursor-pointer filter-white transition duration-300",onClick:n[6]||(n[6]=t=>e.$emit("play"))},null,512),[[O,!e.playing]])]),i("div",{class:"w-full h-1 bg-white bg-opacity-40 rounded-sm cursor-pointer mr-6",onClick:n[7]||(n[7]=t=>e.$emit("position",t))},[i("div",{class:"w-full rounded-sm h-full bg-white pointer-events-none",style:`width: ${e.time.progress}%; transition: width .2s ease-in-out;`},null,4)]),i("div",mn,[i("div",{class:`w-128 origin-left translate-x-2 -rotate-90 w-128 transition duration-200 absolute transform top-0 py-2 ${e.volume?"-translate-y-4":"opacity-0 -translate-y-1 pointer-events-none"}`},[i("div",yn,[M(i("input",{"onUpdate:modelValue":n[8]||(n[8]=t=>e.amount=t),type:"range",step:"0.05",min:"0",max:"1",class:"rounded-lg overflow-hidden appearance-none bg-white bg-opacity-30 h-1.5 w-128 vertical-range"},null,512),[[X,e.amount]])])],2),i("img",{src:`https://en-zo.dev/vue-videoplayer/basic/volume_${Math.ceil(e.amount*2)}.svg`,alt:"High volume video",class:"w-5 cursor-pointer filter-white transition duration-300 relative",style:{"z-index":"2"},onClick:n[9]||(n[9]=(...t)=>e.stopVolume&&e.stopVolume(...t)),onMouseenter:n[10]||(n[10]=t=>e.volume=!0)},null,40,["src"])]),i("img",{src:"https://en-zo.dev/vue-videoplayer/basic/fullscreen.svg",alt:"Fullscreen",class:"w-4 cursor-pointer filter-white transition duration-300",onClick:n[11]||(n[11]=t=>e.$emit("fullScreen"))})],32)],2)):g("",!0),!e.autoplay&&e.mask&&e.time.current===0?(s(),y("div",{key:1,class:`transition transform duration-300 absolute top-0 left-0 w-full h-full bg-black bg-opacity-50 backdrop-filter z-10 flex items-center justify-center ${e.playing?"opacity-0 pointer-events-none":""}`},[i("div",{class:"w-20 h-20 rounded-full bg-white bg-opacity-20 transition duration-200 hover:bg-opacity-40 flex items-center justify-center cursor-pointer",onClick:n[13]||(n[13]=t=>e.$emit("play"))},[hn])],2)):g("",!0)])],32)}te.render=gn;var re=$({name:"Vue3PlayerVideo",components:{basic:te,gradient:ne},props:{src:{type:String,required:!0},autoplay:{type:Boolean,default:!1},loop:{type:Boolean,default:!1},controls:{type:Boolean,default:!0},mask:{type:Boolean,default:!0},colors:{type:[String,Array],default(){return["#8B5CF6","#ec4899"]}},hoverable:{type:Boolean,default:!1},theme:{type:String,default:"basic"}},data(){return{uuid:Math.random().toString(36).substr(2,18),player:null,duration:0,playing:!1,time:{progress:0,display:0,current:0}}},watch:{"time.current"(e){this.time.display=this.format(Number(e)),this.time.progress=e*100/this.player.duration}},methods:{isPlaying(e){this.playing=e},play(){return this.playing?this.player.pause():this.player.play()},setPlayer(e){this.player=e,this.player.addEventListener("loadeddata",()=>{this.player.readyState>=3&&(this.duration=this.format(Number(this.player.duration)),this.time.display=this.format(0))})},stop(){this.player.pause(),this.player.currentTime=0},fullScreen(){this.player.webkitEnterFullscreen()},position(e){this.player.pause();const n=e.target.getBoundingClientRect(),a=(e.clientX-n.left)*100/e.target.offsetWidth;this.player.currentTime=a*this.player.duration/100,this.player.play()},format(e){const n=Math.floor(e/3600),l=Math.floor(e%3600/60),a=Math.round(e%60);return[n,l>9?l:n?"0"+l:l||"00",a>9?a:"0"+a].filter(Boolean).join(":")}}});const wn={class:"vue3-player-video"};function bn(e,n,l,a,u,r){return s(),y("div",wn,[(s(),y(ge(e.theme),{uuid:e.uuid,src:e.src,autoplay:e.autoplay,loop:e.loop,controls:e.controls,mask:e.mask,colors:e.colors,time:e.time,playing:e.playing,duration:e.duration,hoverable:e.hoverable,onPlay:e.play,onStop:e.stop,onTimeupdate:n[1]||(n[1]=({currentTime:t})=>e.time.current=t),onPosition:e.position,onFullScreen:e.fullScreen,onSetPlayer:e.setPlayer,onIsPlaying:e.isPlaying},null,8,["uuid","src","autoplay","loop","controls","mask","colors","time","playing","duration","hoverable","onPlay","onStop","onPosition","onFullScreen","onSetPlayer","onIsPlaying"]))])}function kn(e,n){n===void 0&&(n={});var l=n.insertAt;if(!(!e||typeof document=="undefined")){var a=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css",l==="top"&&a.firstChild?a.insertBefore(u,a.firstChild):a.appendChild(u),u.styleSheet?u.styleSheet.cssText=e:u.appendChild(document.createTextNode(e))}}var xn=`/*! tailwindcss v2.1.2 | MIT License | https://tailwindcss.com */ - -/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ - -/* -Document -======== -*/ - -/** -Use a better box model (opinionated). -*/ - -*, -::before, -::after { - box-sizing: border-box; -} - -/** -Use a more readable tab size (opinionated). -*/ - -/** -1. Correct the line height in all browsers. -2. Prevent adjustments of font size after orientation changes in iOS. -*/ - -/* -Sections -======== -*/ - -/** -Remove the margin in all browsers. -*/ - -/** -Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) -*/ - -/* -Grouping content -================ -*/ - -/** -1. Add the correct height in Firefox. -2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) -*/ - -/* -Text-level semantics -==================== -*/ - -/** -Add the correct text decoration in Chrome, Edge, and Safari. -*/ - -/** -Add the correct font weight in Edge and Safari. -*/ - -/** -1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) -2. Correct the odd 'em' font sizing in all browsers. -*/ - -/** -Add the correct font size in all browsers. -*/ - -/** -Prevent 'sub' and 'sup' elements from affecting the line height in all browsers. -*/ - -/* -Tabular data -============ -*/ - -/** -1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) -2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) -*/ - -/* -Forms -===== -*/ - -/** -1. Change the font styles in all browsers. -2. Remove the margin in Firefox and Safari. -*/ - - -input { - font-family: inherit; /* 1 */ - font-size: 100%; /* 1 */ - line-height: 1.15; /* 1 */ - margin: 0; /* 2 */ -} - -/** -Remove the inheritance of text transform in Edge and Firefox. -1. Remove the inheritance of text transform in Firefox. -*/ - -/** -Correct the inability to style clickable types in iOS and Safari. -*/ - - -[type='button'], -[type='reset'], -[type='submit'] { - -webkit-appearance: button; -} - -/** -Remove the inner border and padding in Firefox. -*/ - -::-moz-focus-inner { - border-style: none; - padding: 0; -} - -/** -Restore the focus styles unset by the previous rule. -*/ - -:-moz-focusring { - outline: 1px dotted ButtonText; -} - -/** -Remove the additional ':invalid' styles in Firefox. -See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737 -*/ - -:-moz-ui-invalid { - box-shadow: none; -} - -/** -Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers. -*/ - -/** -Add the correct vertical alignment in Chrome and Firefox. -*/ - -progress { - vertical-align: baseline; -} - -/** -Correct the cursor style of increment and decrement buttons in Safari. -*/ - -::-webkit-inner-spin-button, -::-webkit-outer-spin-button { - height: auto; -} - -/** -1. Correct the odd appearance in Chrome and Safari. -2. Correct the outline style in Safari. -*/ - -[type='search'] { - -webkit-appearance: textfield; /* 1 */ - outline-offset: -2px; /* 2 */ -} - -/** -Remove the inner padding in Chrome and Safari on macOS. -*/ - -::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** -1. Correct the inability to style clickable types in iOS and Safari. -2. Change font properties to 'inherit' in Safari. -*/ - -::-webkit-file-upload-button { - -webkit-appearance: button; /* 1 */ - font: inherit; /* 2 */ -} - -/* -Interactive -=========== -*/ - -/* -Add the correct display in Chrome and Safari. -*/ - -/** - * Manually forked from SUIT CSS Base: https://github.com/suitcss/base - * A thin layer on top of normalize.css that provides a starting point more - * suitable for web applications. - */ - -/** - * Removes the default spacing and border for appropriate elements. - */ - - -p { - margin: 0; -} - -/** - * Work around a Firefox/IE bug where the transparent \`button\` background - * results in a loss of the default \`button\` focus styles. - */ - -/** - * Tailwind custom reset styles - */ - -/** - * 1. Use the user's configured \`sans\` font-family (with Tailwind's default - * sans-serif font stack as a fallback) as a sane default. - * 2. Use Tailwind's default "normal" line-height so the user isn't forced - * to override it to ensure consistency even when using the default theme. - */ - -/** - * Inherit font-family and line-height from \`html\` so users can set them as - * a class directly on the \`html\` element. - */ - -/** - * 1. Prevent padding and border from affecting element width. - * - * We used to set this in the html element and inherit from - * the parent element for everything else. This caused issues - * in shadow-dom-enhanced elements like
where the content - * is wrapped by a div with box-sizing set to \`content-box\`. - * - * https://github.com/mozdevs/cssremedy/issues/4 - * - * - * 2. Allow adding a border to an element by just adding a border-width. - * - * By default, the way the browser specifies that an element should have no - * border is by setting it's border-style to \`none\` in the user-agent - * stylesheet. - * - * In order to easily add borders to elements by just setting the \`border-width\` - * property, we change the default border-style for all elements to \`solid\`, and - * use border-width to hide them instead. This way our \`border\` utilities only - * need to set the \`border-width\` property instead of the entire \`border\` - * shorthand, making our border utilities much more straightforward to compose. - * - * https://github.com/tailwindcss/tailwindcss/pull/116 - */ - -*, -::before, -::after { - box-sizing: border-box; /* 1 */ - border-width: 0; /* 2 */ - border-style: solid; /* 2 */ - border-color: #e5e7eb; /* 2 */ -} - -/* - * Ensure horizontal rules are visible by default - */ - -/** - * Undo the \`border-style: none\` reset that Normalize applies to images so that - * our \`border-{width}\` utilities have the expected effect. - * - * The Normalize reset is unnecessary for us since we default the border-width - * to 0 on all elements. - * - * https://github.com/tailwindcss/tailwindcss/issues/362 - */ - -img { - border-style: solid; -} - -input:-ms-input-placeholder { - opacity: 1; - color: #9ca3af; -} - -input::placeholder { - opacity: 1; - color: #9ca3af; -} - - -[role="button"] { - cursor: pointer; -} - -/** - * Reset links to optimize for opt-in styling instead of - * opt-out. - */ - -/** - * Reset form element properties that are easy to forget to - * style explicitly so you don't inadvertently introduce - * styles that deviate from your design system. These styles - * supplement a partial reset that is already applied by - * normalize.css. - */ - - -input { - padding: 0; - line-height: inherit; - color: inherit; -} - -/** - * Use the configured 'mono' font family for elements that - * are expected to be rendered with a monospace font, falling - * back to the system monospace stack if there is no configured - * 'mono' font family. - */ - -/** - * Make replaced elements \`display: block\` by default as that's - * the behavior you want almost all of the time. Inspired by - * CSS Remedy, with \`svg\` added as well. - * - * https://github.com/mozdevs/cssremedy/issues/14 - */ - -img, -svg, -video { - display: block; - vertical-align: middle; -} - -/** - * Constrain images and videos to the parent width and preserve - * their intrinsic aspect ratio. - * - * https://github.com/mozdevs/cssremedy/issues/14 - */ - -img, -video { - max-width: 100%; - height: auto; -} - -.vue3-player-video .appearance-none{ - -webkit-appearance: none; - appearance: none; -} - -.vue3-player-video .bg-black{ - --tw-bg-opacity: 1; - background-color: rgba(0, 0, 0, var(--tw-bg-opacity)); -} - -.vue3-player-video .bg-white{ - --tw-bg-opacity: 1; - background-color: rgba(255, 255, 255, var(--tw-bg-opacity)); -} - -.vue3-player-video .bg-gradient-to-r{ - background-image: linear-gradient(to right, var(--tw-gradient-stops)); -} - -.vue3-player-video .bg-opacity-20{ - --tw-bg-opacity: 0.2; -} - -.vue3-player-video .bg-opacity-30{ - --tw-bg-opacity: 0.3; -} - -.vue3-player-video .bg-opacity-40{ - --tw-bg-opacity: 0.4; -} - -.vue3-player-video .bg-opacity-50{ - --tw-bg-opacity: 0.5; -} - -.vue3-player-video .bg-opacity-60{ - --tw-bg-opacity: 0.6; -} - -.vue3-player-video .hover\\:bg-opacity-40:hover{ - --tw-bg-opacity: 0.4; -} - -.vue3-player-video .rounded-sm{ - border-radius: 0.125rem; -} - -.vue3-player-video .rounded-md{ - border-radius: 0.375rem; -} - -.vue3-player-video .rounded-lg{ - border-radius: 0.5rem; -} - -.vue3-player-video .rounded-xl{ - border-radius: 0.75rem; -} - -.vue3-player-video .rounded-3xl{ - border-radius: 1.5rem; -} - -.vue3-player-video .rounded-full{ - border-radius: 9999px; -} - -.vue3-player-video .cursor-pointer{ - cursor: pointer; -} - -.vue3-player-video .flex{ - display: flex; -} - -.vue3-player-video .items-center{ - align-items: center; -} - -.vue3-player-video .justify-start{ - justify-content: flex-start; -} - -.vue3-player-video .justify-end{ - justify-content: flex-end; -} - -.vue3-player-video .justify-center{ - justify-content: center; -} - -.vue3-player-video .justify-between{ - justify-content: space-between; -} - -.vue3-player-video .font-sans{ - font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; -} - -.vue3-player-video .font-medium{ - font-weight: 500; -} - -.vue3-player-video .h-1{ - height: 0.25rem; -} - -.vue3-player-video .h-20{ - height: 5rem; -} - -.vue3-player-video .h-full{ - height: 100%; -} - -.vue3-player-video .text-xs{ - font-size: 0.75rem; - line-height: 1rem; -} - -.vue3-player-video .ml-2{ - margin-left: 0.5rem; -} - -.vue3-player-video .mr-3{ - margin-right: 0.75rem; -} - -.vue3-player-video .ml-4{ - margin-left: 1rem; -} - -.vue3-player-video .mr-5{ - margin-right: 1.25rem; -} - -.vue3-player-video .ml-5{ - margin-left: 1.25rem; -} - -.vue3-player-video .mr-6{ - margin-right: 1.5rem; -} - -.vue3-player-video .opacity-0{ - opacity: 0; -} - -.vue3-player-video .overflow-hidden{ - overflow: hidden; -} - -.vue3-player-video .py-1{ - padding-top: 0.25rem; - padding-bottom: 0.25rem; -} - -.vue3-player-video .py-2{ - padding-top: 0.5rem; - padding-bottom: 0.5rem; -} - -.vue3-player-video .px-2{ - padding-left: 0.5rem; - padding-right: 0.5rem; -} - -.vue3-player-video .py-3{ - padding-top: 0.75rem; - padding-bottom: 0.75rem; -} - -.vue3-player-video .px-3{ - padding-left: 0.75rem; - padding-right: 0.75rem; -} - -.vue3-player-video .py-4{ - padding-top: 1rem; - padding-bottom: 1rem; -} - -.vue3-player-video .px-5{ - padding-left: 1.25rem; - padding-right: 1.25rem; -} - -.vue3-player-video .pt-3{ - padding-top: 0.75rem; -} - -.vue3-player-video .pb-5{ - padding-bottom: 1.25rem; -} - -.vue3-player-video .pointer-events-none{ - pointer-events: none; -} - -.vue3-player-video .absolute{ - position: absolute; -} - -.vue3-player-video .relative{ - position: relative; -} - -.vue3-player-video .top-0{ - top: 0px; -} - -.vue3-player-video .bottom-0{ - bottom: 0px; -} - -.vue3-player-video .left-0{ - left: 0px; -} - -*{ - --tw-shadow: 0 0 #0000; -} - -.vue3-player-video .shadow-xl{ - --tw-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - -*{ - --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgba(59, 130, 246, 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; -} - -.vue3-player-video .text-center{ - text-align: center; -} - -.vue3-player-video .text-white{ - --tw-text-opacity: 1; - color: rgba(255, 255, 255, var(--tw-text-opacity)); -} - -.vue3-player-video .whitespace-nowrap{ - white-space: nowrap; -} - -.vue3-player-video .w-3{ - width: 0.75rem; -} - -.vue3-player-video .w-4{ - width: 1rem; -} - -.vue3-player-video .w-5{ - width: 1.25rem; -} - -.vue3-player-video .w-12{ - width: 3rem; -} - -.vue3-player-video .w-20{ - width: 5rem; -} - -.vue3-player-video .w-24{ - width: 6rem; -} - -.vue3-player-video .w-32{ - width: 8rem; -} - -.vue3-player-video .w-full{ - width: 100%; -} - -.vue3-player-video .z-10{ - z-index: 10; -} - -.vue3-player-video .transform{ - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.vue3-player-video .origin-left{ - transform-origin: left; -} - -.vue3-player-video .-rotate-90{ - --tw-rotate: -90deg; -} - -.vue3-player-video .translate-x-0{ - --tw-translate-x: 0px; -} - -.vue3-player-video .translate-x-2{ - --tw-translate-x: 0.5rem; -} - -.vue3-player-video .translate-x-9{ - --tw-translate-x: 2.25rem; -} - -.vue3-player-video .-translate-y-1{ - --tw-translate-y: -0.25rem; -} - -.vue3-player-video .-translate-y-4{ - --tw-translate-y: -1rem; -} - -.vue3-player-video .translate-y-full{ - --tw-translate-y: 100%; -} - -.vue3-player-video .transition{ - transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter; - transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; - transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter; - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - transition-duration: 150ms; -} - -.vue3-player-video .ease-in-out{ - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); -} - -.vue3-player-video .duration-200{ - transition-duration: 200ms; -} - -.vue3-player-video .duration-300{ - transition-duration: 300ms; -} - -@keyframes spin{ - to{ - transform: rotate(360deg); - } -} - -@keyframes ping{ - 75%, 100%{ - transform: scale(2); - opacity: 0; - } -} - -@keyframes pulse{ - 50%{ - opacity: .5; - } -} - -@keyframes bounce{ - 0%, 100%{ - transform: translateY(-25%); - animation-timing-function: cubic-bezier(0.8,0,1,1); - } - - 50%{ - transform: none; - animation-timing-function: cubic-bezier(0,0,0.2,1); - } -} - -.vue3-player-video .filter{ - --tw-blur: var(--tw-empty,/*!*/ /*!*/); - --tw-brightness: var(--tw-empty,/*!*/ /*!*/); - --tw-contrast: var(--tw-empty,/*!*/ /*!*/); - --tw-grayscale: var(--tw-empty,/*!*/ /*!*/); - --tw-hue-rotate: var(--tw-empty,/*!*/ /*!*/); - --tw-invert: var(--tw-empty,/*!*/ /*!*/); - --tw-saturate: var(--tw-empty,/*!*/ /*!*/); - --tw-sepia: var(--tw-empty,/*!*/ /*!*/); - --tw-drop-shadow: var(--tw-empty,/*!*/ /*!*/); - filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); -} - -.vue3-player-video .blur-sm{ - --tw-blur: blur(4px); -} - -.vue3-player-video .blur{ - --tw-blur: blur(8px); -} - -.vue3-player-video .backdrop-filter{ - --tw-backdrop-blur: var(--tw-empty,/*!*/ /*!*/); - --tw-backdrop-brightness: var(--tw-empty,/*!*/ /*!*/); - --tw-backdrop-contrast: var(--tw-empty,/*!*/ /*!*/); - --tw-backdrop-grayscale: var(--tw-empty,/*!*/ /*!*/); - --tw-backdrop-hue-rotate: var(--tw-empty,/*!*/ /*!*/); - --tw-backdrop-invert: var(--tw-empty,/*!*/ /*!*/); - --tw-backdrop-opacity: var(--tw-empty,/*!*/ /*!*/); - --tw-backdrop-saturate: var(--tw-empty,/*!*/ /*!*/); - --tw-backdrop-sepia: var(--tw-empty,/*!*/ /*!*/); - -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia); - backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia); -} - -.overlay { - background: linear-gradient(0deg, rgba(0,0,0,0.41961), transparent) -} - -.vertical-range::-webkit-slider-thumb { - width: 6px; - -webkit-appearance: none; - appearance: none; - height: 6px; - background-color: white; - cursor: ns-resize; - box-shadow: -405px 0 0 400px rgba(255, 255, 255, .6); - border-radius: 50%; -} - -.backdrop-filter { - -webkit-backdrop-filter: blur(15px) !important; - backdrop-filter: blur(15px) !important; -} - -.filter-white:hover { - filter: brightness(2); -} - -.gradient-variable { - --tw-gradient-from: #fbbf24; - --tw-gradient-to: #ec4899; - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(251, 191, 36, 0)) -} - -`;kn(xn);re.render=bn;var $n=(()=>{const e=re;return e.install=n=>{n.component("Vue3PlayerVideo",e)},e})(),Cn=$n;const Sn={key:0},Mn=$({props:{videos:{default:()=>[]},full:{type:Boolean,default:!1}},setup(e){const n=e;return(l,a)=>{const u=J,r=ee;return n.videos.length>0?(s(),c("div",Sn,[i(r,{"x-gap":4,"y-gap":4,cols:e.full?1:5},{default:p(()=>[i(u,{span:e.full?1:3},{default:p(()=>[(s(!0),c(h,null,k(n.videos,t=>(s(),y(m(Cn),{onClick:a[0]||(a[0]=x(()=>{},["stop"])),key:t.id,src:t.content,colors:["#18a058","#2aca75"],hoverable:!0,theme:"gradient"},null,8,["src"]))),128))]),_:1},8,["span"])]),_:1},8,["cols"])])):g("",!0)}}});const En={class:"images-wrap"},Nn=$({props:{imgs:{default:()=>[]}},setup(e){const n=e,l="https://paopao-assets.oss-cn-shanghai.aliyuncs.com/public/404.png",a="?x-oss-process=image/resize,m_fill,w_300,h_300,limit_0/auto-orient,1/format,png";return(u,r)=>{const t=we,d=J,v=ee,w=be;return s(),c("div",En,[[1].includes(n.imgs.length)?(s(),y(w,{key:0},{default:p(()=>[i(v,{"x-gap":4,"y-gap":4,cols:2},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,o=>(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[0]||(r[0]=x(()=>{},["stop"])),class:"post-img x1","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[2,3].includes(n.imgs.length)?(s(),y(w,{key:1},{default:p(()=>[i(v,{"x-gap":4,"y-gap":4,cols:3},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,o=>(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[1]||(r[1]=x(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[4].includes(n.imgs.length)?(s(),y(w,{key:2},{default:p(()=>[i(v,{"x-gap":4,"y-gap":4,cols:4},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,o=>(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[2]||(r[2]=x(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024))),128))]),_:1})]),_:1})):g("",!0),[5].includes(n.imgs.length)?(s(),y(w,{key:3},{default:p(()=>[i(v,{"x-gap":4,"y-gap":4,cols:3},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,{key:o.id},[f<3?(s(),y(d,{key:0},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[3]||(r[3]=x(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1}),i(v,{"x-gap":4,"y-gap":4,cols:2,style:{"margin-top":"4px"}},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,{key:o.id},[f>=3?(s(),y(d,{key:0},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[4]||(r[4]=x(()=>{},["stop"])),class:"post-img x1","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1})]),_:1})):g("",!0),[6].includes(n.imgs.length)?(s(),y(w,{key:4},{default:p(()=>[i(v,{"x-gap":4,"y-gap":4,cols:3},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,{key:o.id},[f<3?(s(),y(d,{key:0},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[5]||(r[5]=x(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1}),i(v,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,{key:o.id},[f>=3?(s(),y(d,{key:0},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[6]||(r[6]=x(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),128))]),_:1})]),_:1})):g("",!0),n.imgs.length===7?(s(),y(w,{key:5},{default:p(()=>[i(v,{"x-gap":4,"y-gap":4,cols:4},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,null,[f<4?(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[7]||(r[7]=x(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),i(v,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,null,[f>=4?(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[8]||(r[8]=x(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0),n.imgs.length===8?(s(),y(w,{key:6},{default:p(()=>[i(v,{"x-gap":4,"y-gap":4,cols:4},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,null,[f<4?(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[9]||(r[9]=x(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),i(v,{"x-gap":4,"y-gap":4,cols:4,style:{"margin-top":"4px"}},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,null,[f>=4?(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[10]||(r[10]=x(()=>{},["stop"])),class:"post-img x3","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0),n.imgs.length===9?(s(),y(w,{key:7},{default:p(()=>[i(v,{"x-gap":4,"y-gap":4,cols:3},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,null,[f<3?(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[11]||(r[11]=x(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),i(v,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,null,[f>=3&&f<6?(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[12]||(r[12]=x(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1}),i(v,{"x-gap":4,"y-gap":4,cols:3,style:{"margin-top":"4px"}},{default:p(()=>[(s(!0),c(h,null,k(n.imgs,(o,f)=>(s(),c(h,null,[f>=6?(s(),y(d,{key:o.id},{default:p(()=>[i(t,{onError:()=>o.content=m(l),onClick:r[13]||(r[13]=x(()=>{},["stop"])),class:"post-img x2","object-fit":"cover",src:o.content+m(a),"preview-src":o.content},null,8,["onError","src","preview-src"])]),_:2},1024)):g("",!0)],64))),256))]),_:1})]),_:1})):g("",!0)])}}});const _n={class:"attachment-wrap"},Bn=$({props:{attachments:{default:()=>[]},price:{default:0}},setup(e){const n=e,l=I(!1),a=I(""),u=I(0),r=d=>{l.value=!0,u.value=d.id,a.value="\u8FD9\u662F\u4E00\u4E2A\u514D\u8D39\u9644\u4EF6\uFF0C\u60A8\u53EF\u4EE5\u76F4\u63A5\u4E0B\u8F7D\uFF1F",d.type===8&&(a.value=()=>R("div",{},[R("p",{},"\u8FD9\u662F\u4E00\u4E2A\u6536\u8D39\u9644\u4EF6\uFF0C\u4E0B\u8F7D\u5C06\u6536\u53D6"+(n.price/100).toFixed(2)+"\u5143")]),xe({id:u.value}).then(v=>{v.paid&&(a.value=()=>R("div",{},[R("p",{},"\u6B64\u6B21\u4E0B\u8F7D\u60A8\u5DF2\u652F\u4ED8\u6216\u65E0\u9700\u4ED8\u8D39\uFF0C\u8BF7\u786E\u8BA4\u4E0B\u8F7D")]))}).catch(v=>{l.value=!1}))},t=()=>{$e({id:u.value}).then(d=>{window.open(d.replace("http://","https://"),"_blank")}).catch(d=>{console.log(d)})};return(d,v)=>{const w=Y,o=Ce,f=Se;return s(),c("div",_n,[(s(!0),c(h,null,k(e.attachments,E=>(s(),c("div",{class:"attach-item",key:E.id},[i(o,{onClick:x(z=>r(E),["stop"]),type:"primary",size:"tiny",dashed:""},{icon:p(()=>[i(w,null,{default:p(()=>[i(m(Ue))]),_:1})]),default:p(()=>[ke(" "+N(E.type===8?"\u6536\u8D39":"\u514D\u8D39")+"\u9644\u4EF6 ",1)]),_:2},1032,["onClick"])]))),128)),i(f,{show:l.value,"onUpdate:show":v[0]||(v[0]=E=>l.value=E),"mask-closable":!1,preset:"dialog",title:"\u4E0B\u8F7D\u63D0\u793A",content:a.value,"positive-text":"\u786E\u8BA4\u4E0B\u8F7D","negative-text":"\u53D6\u6D88","icon-placement":"top",onPositiveClick:t},null,8,["show","content"])])}}});var An=H(Bn,[["__scopeId","data-v-ca4bb796"]]);const Pn=e=>{const n=[],l=[];var a=/(#|#)([^#@])+?\s+?/g,u=/@([a-zA-Z0-9])+?\s+?/g;return e=e.replace(/<[^>]*?>/gi,"").replace(/(.*?)<\/[^>]*?>/gi,"").replace(a,r=>(n.push(r.substr(1).trim()),''+r.trim()+" ")).replace(u,r=>(l.push(r.substr(1).trim()),''+r.trim()+" ")),{content:e,tags:n,users:l}};export{jn as B,Rn as C,Fn as H,An as _,Nn as a,Mn as b,In as c,Pn as p}; diff --git a/web/dist/assets/content.ef781517.css b/web/dist/assets/content.ef781517.css deleted file mode 100644 index a2bccb17..00000000 --- a/web/dist/assets/content.ef781517.css +++ /dev/null @@ -1 +0,0 @@ -.link-wrap[data-v-4c9a59cc]{margin-bottom:10px}.link-wrap .link-item[data-v-4c9a59cc]{display:flex;align-items:center}.link-wrap .link-item .hash-link .link-txt[data-v-4c9a59cc]{margin-left:4px;word-break:break-all}.images-wrap{margin-top:10px}.post-img{display:flex;margin:0;border-radius:3px;overflow:hidden;background:rgba(0,0,0,.1);border:1px solid #eee}.post-img img{width:100%;height:100%}.x1{height:140px}.x2{height:90px}.x3{height:80px}.dark .post-img{border:1px solid #333}@media screen and (max-width: 821px){.x1{height:100px}.x2{height:70px}.x3{height:50px}}.attach-item[data-v-ca4bb796]{margin:10px 0} diff --git a/web/dist/assets/formatTime.02109bf5.js b/web/dist/assets/formatTime.02109bf5.js deleted file mode 100644 index ec43b2ec..00000000 --- a/web/dist/assets/formatTime.02109bf5.js +++ /dev/null @@ -1,11 +0,0 @@ -//! moment.js -//! version : 2.29.3 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -var Wt;function l(){return Wt.apply(null,arguments)}function Ds(e){Wt=e}function I(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function ae(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function nt(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(y(e,t))return!1;return!0}function b(e){return e===void 0}function q(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function De(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Nt(e,t){var s=[],r,a=e.length;for(r=0;r>>0,r;for(r=0;r0)for(s=0;s=0;return(n?s?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+r}var ut=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,pe=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qe={},ue={};function h(e,t,s,r){var a=r;typeof r=="string"&&(a=function(){return this[r]()}),e&&(ue[e]=a),t&&(ue[t[0]]=function(){return E(a.apply(this,arguments),t[1],t[2])}),s&&(ue[s]=function(){return this.localeData().ordinal(a.apply(this,arguments),e)})}function Os(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function Ts(e){var t=e.match(ut),s,r;for(s=0,r=t.length;s=0&&pe.test(e);)e=e.replace(pe,r),pe.lastIndex=0,s-=1;return e}var xs={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function bs(e){var t=this._longDateFormat[e],s=this._longDateFormat[e.toUpperCase()];return t||!s?t:(this._longDateFormat[e]=s.match(ut).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[e])}var Ws="Invalid date";function Ns(){return this._invalidDate}var Ps="%d",Rs=/\d{1,2}/;function Fs(e){return this._ordinal.replace("%d",e)}var Ls={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Is(e,t,s,r){var a=this._relativeTime[s];return V(a)?a(e,t,s,r):a.replace(/%d/i,e)}function Cs(e,t){var s=this._relativeTime[e>0?"future":"past"];return V(s)?s(t):s.replace(/%s/i,t)}var ye={};function O(e,t){var s=e.toLowerCase();ye[s]=ye[s+"s"]=ye[t]=e}function F(e){return typeof e=="string"?ye[e]||ye[e.toLowerCase()]:void 0}function dt(e){var t={},s,r;for(r in e)y(e,r)&&(s=F(r),s&&(t[s]=e[r]));return t}var Lt={};function T(e,t){Lt[e]=t}function Us(e){var t=[],s;for(s in e)y(e,s)&&t.push({unit:s,priority:Lt[s]});return t.sort(function(r,a){return r.priority-a.priority}),t}function Ce(e){return e%4===0&&e%100!==0||e%400===0}function P(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function _(e){var t=+e,s=0;return t!==0&&isFinite(t)&&(s=P(t)),s}function fe(e,t){return function(s){return s!=null?(It(this,e,s),l.updateOffset(this,t),this):We(this,e)}}function We(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function It(e,t,s){e.isValid()&&!isNaN(s)&&(t==="FullYear"&&Ce(e.year())&&e.month()===1&&e.date()===29?(s=_(s),e._d["set"+(e._isUTC?"UTC":"")+t](s,e.month(),Ge(s,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](s))}function Hs(e){return e=F(e),V(this[e])?this[e]():this}function Es(e,t){if(typeof e=="object"){e=dt(e);var s=Us(e),r,a=s.length;for(r=0;r68?1900:2e3)};var Zt=fe("FullYear",!0);function nr(){return Ce(this.year())}function ir(e,t,s,r,a,n,i){var d;return e<100&&e>=0?(d=new Date(e+400,t,s,r,a,n,i),isFinite(d.getFullYear())&&d.setFullYear(e)):d=new Date(e,t,s,r,a,n,i),d}function ke(e){var t,s;return e<100&&e>=0?(s=Array.prototype.slice.call(arguments),s[0]=e+400,t=new Date(Date.UTC.apply(null,s)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Pe(e,t,s){var r=7+t-s,a=(7+ke(e,0,r).getUTCDay()-t)%7;return-a+r-1}function $t(e,t,s,r,a){var n=(7+s-r)%7,i=Pe(e,r,a),d=1+7*(t-1)+n+i,c,k;return d<=0?(c=e-1,k=we(c)+d):d>we(e)?(c=e+1,k=d-we(e)):(c=e,k=d),{year:c,dayOfYear:k}}function Me(e,t,s){var r=Pe(e.year(),t,s),a=Math.floor((e.dayOfYear()-r-1)/7)+1,n,i;return a<1?(i=e.year()-1,n=a+B(i,t,s)):a>B(e.year(),t,s)?(n=a-B(e.year(),t,s),i=e.year()+1):(i=e.year(),n=a),{week:n,year:i}}function B(e,t,s){var r=Pe(e,t,s),a=Pe(e+1,t,s);return(we(e)-r+a)/7}h("w",["ww",2],"wo","week");h("W",["WW",2],"Wo","isoWeek");O("week","w");O("isoWeek","W");T("week",5);T("isoWeek",5);u("w",D);u("ww",D,N);u("W",D);u("WW",D,N);ve(["w","ww","W","WW"],function(e,t,s,r){t[r.substr(0,1)]=_(e)});function or(e){return Me(e,this._week.dow,this._week.doy).week}var lr={dow:0,doy:6};function ur(){return this._week.dow}function dr(){return this._week.doy}function hr(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function fr(e){var t=Me(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}h("d",0,"do","day");h("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});h("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});h("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});h("e",0,0,"weekday");h("E",0,0,"isoWeekday");O("day","d");O("weekday","e");O("isoWeekday","E");T("day",11);T("weekday",11);T("isoWeekday",11);u("d",D);u("e",D);u("E",D);u("dd",function(e,t){return t.weekdaysMinRegex(e)});u("ddd",function(e,t){return t.weekdaysShortRegex(e)});u("dddd",function(e,t){return t.weekdaysRegex(e)});ve(["dd","ddd","dddd"],function(e,t,s,r){var a=s._locale.weekdaysParse(e,r,s._strict);a!=null?t.d=a:f(s).invalidWeekday=e});ve(["d","e","E"],function(e,t,s,r){t[r]=_(e)});function cr(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function _r(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function ct(e,t){return e.slice(t,7).concat(e.slice(0,t))}var mr="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Bt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),yr="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),wr=ge,kr=ge,Mr=ge;function Sr(e,t){var s=I(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?ct(s,this._week.dow):e?s[e.day()]:s}function Dr(e){return e===!0?ct(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Yr(e){return e===!0?ct(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function gr(e,t,s){var r,a,n,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)n=A([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(n,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(n,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(n,"").toLocaleLowerCase();return s?t==="dddd"?(a=g.call(this._weekdaysParse,i),a!==-1?a:null):t==="ddd"?(a=g.call(this._shortWeekdaysParse,i),a!==-1?a:null):(a=g.call(this._minWeekdaysParse,i),a!==-1?a:null):t==="dddd"?(a=g.call(this._weekdaysParse,i),a!==-1||(a=g.call(this._shortWeekdaysParse,i),a!==-1)?a:(a=g.call(this._minWeekdaysParse,i),a!==-1?a:null)):t==="ddd"?(a=g.call(this._shortWeekdaysParse,i),a!==-1||(a=g.call(this._weekdaysParse,i),a!==-1)?a:(a=g.call(this._minWeekdaysParse,i),a!==-1?a:null)):(a=g.call(this._minWeekdaysParse,i),a!==-1||(a=g.call(this._weekdaysParse,i),a!==-1)?a:(a=g.call(this._shortWeekdaysParse,i),a!==-1?a:null))}function vr(e,t,s){var r,a,n;if(this._weekdaysParseExact)return gr.call(this,e,t,s);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(a=A([2e3,1]).day(r),s&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(a,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(a,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(a,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(n="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[r]=new RegExp(n.replace(".",""),"i")),s&&t==="dddd"&&this._fullWeekdaysParse[r].test(e))return r;if(s&&t==="ddd"&&this._shortWeekdaysParse[r].test(e))return r;if(s&&t==="dd"&&this._minWeekdaysParse[r].test(e))return r;if(!s&&this._weekdaysParse[r].test(e))return r}}function pr(e){if(!this.isValid())return e!=null?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e!=null?(e=cr(e,this.localeData()),this.add(e-t,"d")):t}function Or(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function Tr(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=_r(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function xr(e){return this._weekdaysParseExact?(y(this,"_weekdaysRegex")||_t.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(y(this,"_weekdaysRegex")||(this._weekdaysRegex=wr),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function br(e){return this._weekdaysParseExact?(y(this,"_weekdaysRegex")||_t.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(y(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=kr),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Wr(e){return this._weekdaysParseExact?(y(this,"_weekdaysRegex")||_t.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(y(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Mr),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function _t(){function e(x,G){return G.length-x.length}var t=[],s=[],r=[],a=[],n,i,d,c,k;for(n=0;n<7;n++)i=A([2e3,1]).day(n),d=W(this.weekdaysMin(i,"")),c=W(this.weekdaysShort(i,"")),k=W(this.weekdays(i,"")),t.push(d),s.push(c),r.push(k),a.push(d),a.push(c),a.push(k);t.sort(e),s.sort(e),r.sort(e),a.sort(e),this._weekdaysRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function mt(){return this.hours()%12||12}function Nr(){return this.hours()||24}h("H",["HH",2],0,"hour");h("h",["hh",2],0,mt);h("k",["kk",2],0,Nr);h("hmm",0,0,function(){return""+mt.apply(this)+E(this.minutes(),2)});h("hmmss",0,0,function(){return""+mt.apply(this)+E(this.minutes(),2)+E(this.seconds(),2)});h("Hmm",0,0,function(){return""+this.hours()+E(this.minutes(),2)});h("Hmmss",0,0,function(){return""+this.hours()+E(this.minutes(),2)+E(this.seconds(),2)});function qt(e,t){h(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}qt("a",!0);qt("A",!1);O("hour","h");T("hour",13);function Jt(e,t){return t._meridiemParse}u("a",Jt);u("A",Jt);u("H",D);u("h",D);u("k",D);u("HH",D,N);u("hh",D,N);u("kk",D,N);u("hmm",Ht);u("hmmss",Et);u("Hmm",Ht);u("Hmmss",Et);M(["H","HH"],v);M(["k","kk"],function(e,t,s){var r=_(e);t[v]=r===24?0:r});M(["a","A"],function(e,t,s){s._isPm=s._locale.isPM(e),s._meridiem=e});M(["h","hh"],function(e,t,s){t[v]=_(e),f(s).bigHour=!0});M("hmm",function(e,t,s){var r=e.length-2;t[v]=_(e.substr(0,r)),t[L]=_(e.substr(r)),f(s).bigHour=!0});M("hmmss",function(e,t,s){var r=e.length-4,a=e.length-2;t[v]=_(e.substr(0,r)),t[L]=_(e.substr(r,2)),t[$]=_(e.substr(a)),f(s).bigHour=!0});M("Hmm",function(e,t,s){var r=e.length-2;t[v]=_(e.substr(0,r)),t[L]=_(e.substr(r))});M("Hmmss",function(e,t,s){var r=e.length-4,a=e.length-2;t[v]=_(e.substr(0,r)),t[L]=_(e.substr(r,2)),t[$]=_(e.substr(a))});function Pr(e){return(e+"").toLowerCase().charAt(0)==="p"}var Rr=/[ap]\.?m?\.?/i,Fr=fe("Hours",!0);function Lr(e,t,s){return e>11?s?"pm":"PM":s?"am":"AM"}var Qt={calendar:vs,longDateFormat:xs,invalidDate:Ws,ordinal:Ps,dayOfMonthOrdinalParse:Rs,relativeTime:Ls,months:qs,monthsShort:At,week:lr,weekdays:mr,weekdaysMin:yr,weekdaysShort:Bt,meridiemParse:Rr},Y={},_e={},Se;function Ir(e,t){var s,r=Math.min(e.length,t.length);for(s=0;s0;){if(a=je(n.slice(0,s).join("-")),a)return a;if(r&&r.length>=s&&Ir(n,r)>=s-1)break;s--}t++}return Se}function Ur(e){return e.match("^[^/\\\\]*$")!=null}function je(e){var t=null,s;if(Y[e]===void 0&&typeof module!="undefined"&&module&&module.exports&&Ur(e))try{t=Se._abbr,s=require,s("./locale/"+e),te(t)}catch{Y[e]=null}return Y[e]}function te(e,t){var s;return e&&(b(t)?s=J(e):s=yt(e,t),s?Se=s:typeof console!="undefined"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),Se._abbr}function yt(e,t){if(t!==null){var s,r=Qt;if(t.abbr=e,Y[e]!=null)Rt("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=Y[e]._config;else if(t.parentLocale!=null)if(Y[t.parentLocale]!=null)r=Y[t.parentLocale]._config;else if(s=je(t.parentLocale),s!=null)r=s._config;else return _e[t.parentLocale]||(_e[t.parentLocale]=[]),_e[t.parentLocale].push({name:e,config:t}),null;return Y[e]=new lt(Ke(r,t)),_e[e]&&_e[e].forEach(function(a){yt(a.name,a.config)}),te(e),Y[e]}else return delete Y[e],null}function Hr(e,t){if(t!=null){var s,r,a=Qt;Y[e]!=null&&Y[e].parentLocale!=null?Y[e].set(Ke(Y[e]._config,t)):(r=je(e),r!=null&&(a=r._config),t=Ke(a,t),r==null&&(t.abbr=e),s=new lt(t),s.parentLocale=Y[e],Y[e]=s),te(e)}else Y[e]!=null&&(Y[e].parentLocale!=null?(Y[e]=Y[e].parentLocale,e===te()&&te(e)):Y[e]!=null&&delete Y[e]);return Y[e]}function J(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Se;if(!I(e)){if(t=je(e),t)return t;e=[e]}return Cr(e)}function Er(){return et(Y)}function wt(e){var t,s=e._a;return s&&f(e).overflow===-2&&(t=s[Z]<0||s[Z]>11?Z:s[H]<1||s[H]>Ge(s[p],s[Z])?H:s[v]<0||s[v]>24||s[v]===24&&(s[L]!==0||s[$]!==0||s[re]!==0)?v:s[L]<0||s[L]>59?L:s[$]<0||s[$]>59?$:s[re]<0||s[re]>999?re:-1,f(e)._overflowDayOfYear&&(tH)&&(t=H),f(e)._overflowWeeks&&t===-1&&(t=Zs),f(e)._overflowWeekday&&t===-1&&(t=$s),f(e).overflow=t),e}var Ar=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Vr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Gr=/Z|[+-]\d\d(?::?\d\d)?/,Oe=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Je=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],jr=/^\/?Date\((-?\d+)/i,zr=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Zr={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Xt(e){var t,s,r=e._i,a=Ar.exec(r)||Vr.exec(r),n,i,d,c,k=Oe.length,x=Je.length;if(a){for(f(e).iso=!0,t=0,s=k;twe(i)||e._dayOfYear===0)&&(f(e)._overflowDayOfYear=!0),s=ke(i,0,e._dayOfYear),e._a[Z]=s.getUTCMonth(),e._a[H]=s.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=r[t]=a[t];for(;t<7;t++)e._a[t]=r[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[v]===24&&e._a[L]===0&&e._a[$]===0&&e._a[re]===0&&(e._nextDay=!0,e._a[v]=0),e._d=(e._useUTC?ke:ir).apply(null,r),n=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[v]=24),e._w&&typeof e._w.d!="undefined"&&e._w.d!==n&&(f(e).weekdayMismatch=!0)}}function ea(e){var t,s,r,a,n,i,d,c,k;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(n=1,i=4,s=oe(t.GG,e._a[p],Me(S(),1,4).year),r=oe(t.W,1),a=oe(t.E,1),(a<1||a>7)&&(c=!0)):(n=e._locale._week.dow,i=e._locale._week.doy,k=Me(S(),n,i),s=oe(t.gg,e._a[p],k.year),r=oe(t.w,k.week),t.d!=null?(a=t.d,(a<0||a>6)&&(c=!0)):t.e!=null?(a=t.e+n,(t.e<0||t.e>6)&&(c=!0)):a=n),r<1||r>B(s,n,i)?f(e)._overflowWeeks=!0:c!=null?f(e)._overflowWeekday=!0:(d=$t(s,r,a,n,i),e._a[p]=d.year,e._dayOfYear=d.dayOfYear)}l.ISO_8601=function(){};l.RFC_2822=function(){};function Mt(e){if(e._f===l.ISO_8601){Xt(e);return}if(e._f===l.RFC_2822){Kt(e);return}e._a=[],f(e).empty=!0;var t=""+e._i,s,r,a,n,i,d=t.length,c=0,k,x;for(a=Ft(e._f,e._locale).match(ut)||[],x=a.length,s=0;s0&&f(e).unusedInput.push(i),t=t.slice(t.indexOf(r)+r.length),c+=r.length),ue[n]?(r?f(e).empty=!1:f(e).unusedTokens.push(n),zs(n,r,e)):e._strict&&!r&&f(e).unusedTokens.push(n);f(e).charsLeftOver=d-c,t.length>0&&f(e).unusedInput.push(t),e._a[v]<=12&&f(e).bigHour===!0&&e._a[v]>0&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[v]=ta(e._locale,e._a[v],e._meridiem),k=f(e).era,k!==null&&(e._a[p]=e._locale.erasConvertYear(k,e._a[p])),kt(e),wt(e)}function ta(e,t,s){var r;return s==null?t:e.meridiemHour!=null?e.meridiemHour(t,s):(e.isPM!=null&&(r=e.isPM(s),r&&t<12&&(t+=12),!r&&t===12&&(t=0)),t)}function sa(e){var t,s,r,a,n,i,d=!1,c=e._f.length;if(c===0){f(e).invalidFormat=!0,e._d=new Date(NaN);return}for(a=0;athis?this:e:Ie()});function ss(e,t){var s,r;if(t.length===1&&I(t[0])&&(t=t[0]),!t.length)return S();for(s=t[0],r=1;rthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function ga(){if(!b(this._isDSTShifted))return this._isDSTShifted;var e={},t;return ot(e,this),e=es(e),e._a?(t=e._isUTC?A(e._a):S(e._a),this._isDSTShifted=this.isValid()&&_a(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function va(){return this.isValid()?!this._isUTC:!1}function pa(){return this.isValid()?this._isUTC:!1}function as(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Oa=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Ta=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function U(e,t){var s=e,r=null,a,n,i;return xe(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:q(e)||!isNaN(+e)?(s={},t?s[t]=+e:s.milliseconds=+e):(r=Oa.exec(e))?(a=r[1]==="-"?-1:1,s={y:0,d:_(r[H])*a,h:_(r[v])*a,m:_(r[L])*a,s:_(r[$])*a,ms:_(st(r[re]*1e3))*a}):(r=Ta.exec(e))?(a=r[1]==="-"?-1:1,s={y:se(r[2],a),M:se(r[3],a),w:se(r[4],a),d:se(r[5],a),h:se(r[6],a),m:se(r[7],a),s:se(r[8],a)}):s==null?s={}:typeof s=="object"&&("from"in s||"to"in s)&&(i=xa(S(s.from),S(s.to)),s={},s.ms=i.milliseconds,s.M=i.months),n=new ze(s),xe(e)&&y(e,"_locale")&&(n._locale=e._locale),xe(e)&&y(e,"_isValid")&&(n._isValid=e._isValid),n}U.fn=ze.prototype;U.invalid=ca;function se(e,t){var s=e&&parseFloat(e.replace(",","."));return(isNaN(s)?0:s)*t}function xt(e,t){var s={};return s.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(s.months,"M").isAfter(t)&&--s.months,s.milliseconds=+t-+e.clone().add(s.months,"M"),s}function xa(e,t){var s;return e.isValid()&&t.isValid()?(t=Dt(t,e),e.isBefore(t)?s=xt(e,t):(s=xt(t,e),s.milliseconds=-s.milliseconds,s.months=-s.months),s):{milliseconds:0,months:0}}function ns(e,t){return function(s,r){var a,n;return r!==null&&!isNaN(+r)&&(Rt(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=s,s=r,r=n),a=U(s,r),is(this,a,e),this}}function is(e,t,s,r){var a=t._milliseconds,n=st(t._days),i=st(t._months);!e.isValid()||(r=r==null?!0:r,i&&Gt(e,We(e,"Month")+i*s),n&&It(e,"Date",We(e,"Date")+n*s),a&&e._d.setTime(e._d.valueOf()+a*s),r&&l.updateOffset(e,n||i))}var ba=ns(1,"add"),Wa=ns(-1,"subtract");function os(e){return typeof e=="string"||e instanceof String}function Na(e){return C(e)||De(e)||os(e)||q(e)||Ra(e)||Pa(e)||e===null||e===void 0}function Pa(e){var t=ae(e)&&!nt(e),s=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a,n,i=r.length;for(a=0;as.valueOf():s.valueOf()9999?Te(s,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):V(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Te(s,"Z")):Te(s,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function $a(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",s,r,a,n;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),s="["+e+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a="-MM-DD[T]HH:mm:ss.SSS",n=t+'[")]',this.format(s+r+a+n)}function Ba(e){e||(e=this.isUtc()?l.defaultFormatUtc:l.defaultFormat);var t=Te(this,e);return this.localeData().postformat(t)}function qa(e,t){return this.isValid()&&(C(e)&&e.isValid()||S(e).isValid())?U({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Ja(e){return this.from(S(),e)}function Qa(e,t){return this.isValid()&&(C(e)&&e.isValid()||S(e).isValid())?U({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Xa(e){return this.to(S(),e)}function ls(e){var t;return e===void 0?this._locale._abbr:(t=J(e),t!=null&&(this._locale=t),this)}var us=R("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function ds(){return this._locale}var Re=1e3,de=60*Re,Fe=60*de,hs=(365*400+97)*24*Fe;function he(e,t){return(e%t+t)%t}function fs(e,t,s){return e<100&&e>=0?new Date(e+400,t,s)-hs:new Date(e,t,s).valueOf()}function cs(e,t,s){return e<100&&e>=0?Date.UTC(e+400,t,s)-hs:Date.UTC(e,t,s)}function Ka(e){var t,s;if(e=F(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(s=this._isUTC?cs:fs,e){case"year":t=s(this.year(),0,1);break;case"quarter":t=s(this.year(),this.month()-this.month()%3,1);break;case"month":t=s(this.year(),this.month(),1);break;case"week":t=s(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=s(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=s(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=he(t+(this._isUTC?0:this.utcOffset()*de),Fe);break;case"minute":t=this._d.valueOf(),t-=he(t,de);break;case"second":t=this._d.valueOf(),t-=he(t,Re);break}return this._d.setTime(t),l.updateOffset(this,!0),this}function en(e){var t,s;if(e=F(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(s=this._isUTC?cs:fs,e){case"year":t=s(this.year()+1,0,1)-1;break;case"quarter":t=s(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=s(this.year(),this.month()+1,1)-1;break;case"week":t=s(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=s(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=s(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Fe-he(t+(this._isUTC?0:this.utcOffset()*de),Fe)-1;break;case"minute":t=this._d.valueOf(),t+=de-he(t,de)-1;break;case"second":t=this._d.valueOf(),t+=Re-he(t,Re)-1;break}return this._d.setTime(t),l.updateOffset(this,!0),this}function tn(){return this._d.valueOf()-(this._offset||0)*6e4}function sn(){return Math.floor(this.valueOf()/1e3)}function rn(){return new Date(this.valueOf())}function an(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function nn(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function on(){return this.isValid()?this.toISOString():null}function ln(){return it(this)}function un(){return K({},f(this))}function dn(){return f(this).overflow}function hn(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}h("N",0,0,"eraAbbr");h("NN",0,0,"eraAbbr");h("NNN",0,0,"eraAbbr");h("NNNN",0,0,"eraName");h("NNNNN",0,0,"eraNarrow");h("y",["y",1],"yo","eraYear");h("y",["yy",2],0,"eraYear");h("y",["yyy",3],0,"eraYear");h("y",["yyyy",4],0,"eraYear");u("N",Yt);u("NN",Yt);u("NNN",Yt);u("NNNN",Yn);u("NNNNN",gn);M(["N","NN","NNN","NNNN","NNNNN"],function(e,t,s,r){var a=s._locale.erasParse(e,r,s._strict);a?f(s).era=a:f(s).invalidEra=e});u("y",ce);u("yy",ce);u("yyy",ce);u("yyyy",ce);u("yo",vn);M(["y","yy","yyy","yyyy"],p);M(["yo"],function(e,t,s,r){var a;s._locale._eraYearOrdinalRegex&&(a=e.match(s._locale._eraYearOrdinalRegex)),s._locale.eraYearOrdinalParse?t[p]=s._locale.eraYearOrdinalParse(e,a):t[p]=parseInt(e,10)});function fn(e,t){var s,r,a,n=this._eras||J("en")._eras;for(s=0,r=n.length;s=0)return n[r]}function _n(e,t){var s=e.since<=e.until?1:-1;return t===void 0?l(e.since).year():l(e.since).year()+(t-e.offset)*s}function mn(){var e,t,s,r=this.localeData().eras();for(e=0,t=r.length;en&&(t=n),Nn.call(this,e,t,s,r,a))}function Nn(e,t,s,r,a){var n=$t(e,t,s,r,a),i=ke(n.year,0,n.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}h("Q",0,"Qo","quarter");O("quarter","Q");T("quarter",7);u("Q",Ct);M("Q",function(e,t){t[Z]=(_(e)-1)*3});function Pn(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}h("D",["DD",2],"Do","date");O("date","D");T("date",9);u("D",D);u("DD",D,N);u("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});M(["D","DD"],H);M("Do",function(e,t){t[H]=_(e.match(D)[0])});var ms=fe("Date",!0);h("DDD",["DDDD",3],"DDDo","dayOfYear");O("dayOfYear","DDD");T("dayOfYear",4);u("DDD",He);u("DDDD",Ut);M(["DDD","DDDD"],function(e,t,s){s._dayOfYear=_(e)});function Rn(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}h("m",["mm",2],0,"minute");O("minute","m");T("minute",14);u("m",D);u("mm",D,N);M(["m","mm"],L);var Fn=fe("Minutes",!1);h("s",["ss",2],0,"second");O("second","s");T("second",15);u("s",D);u("ss",D,N);M(["s","ss"],$);var Ln=fe("Seconds",!1);h("S",0,0,function(){return~~(this.millisecond()/100)});h(0,["SS",2],0,function(){return~~(this.millisecond()/10)});h(0,["SSS",3],0,"millisecond");h(0,["SSSS",4],0,function(){return this.millisecond()*10});h(0,["SSSSS",5],0,function(){return this.millisecond()*100});h(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});h(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});h(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});h(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});O("millisecond","ms");T("millisecond",16);u("S",He,Ct);u("SS",He,N);u("SSS",He,Ut);var ee,ys;for(ee="SSSS";ee.length<=9;ee+="S")u(ee,ce);function In(e,t){t[re]=_(("0."+e)*1e3)}for(ee="S";ee.length<=9;ee+="S")M(ee,In);ys=fe("Milliseconds",!1);h("z",0,0,"zoneAbbr");h("zz",0,0,"zoneName");function Cn(){return this._isUTC?"UTC":""}function Un(){return this._isUTC?"Coordinated Universal Time":""}var o=Ye.prototype;o.add=ba;o.calendar=Ia;o.clone=Ca;o.diff=ja;o.endOf=en;o.format=Ba;o.from=qa;o.fromNow=Ja;o.to=Qa;o.toNow=Xa;o.get=Hs;o.invalidAt=dn;o.isAfter=Ua;o.isBefore=Ha;o.isBetween=Ea;o.isSame=Aa;o.isSameOrAfter=Va;o.isSameOrBefore=Ga;o.isValid=ln;o.lang=us;o.locale=ls;o.localeData=ds;o.max=oa;o.min=ia;o.parsingFlags=un;o.set=Es;o.startOf=Ka;o.subtract=Wa;o.toArray=an;o.toObject=nn;o.toDate=rn;o.toISOString=Za;o.inspect=$a;typeof Symbol!="undefined"&&Symbol.for!=null&&(o[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});o.toJSON=on;o.toString=za;o.unix=sn;o.valueOf=tn;o.creationData=hn;o.eraName=mn;o.eraNarrow=yn;o.eraAbbr=wn;o.eraYear=kn;o.year=Zt;o.isLeapYear=nr;o.weekYear=pn;o.isoWeekYear=On;o.quarter=o.quarters=Pn;o.month=jt;o.daysInMonth=sr;o.week=o.weeks=hr;o.isoWeek=o.isoWeeks=fr;o.weeksInYear=bn;o.weeksInWeekYear=Wn;o.isoWeeksInYear=Tn;o.isoWeeksInISOWeekYear=xn;o.date=ms;o.day=o.days=pr;o.weekday=Or;o.isoWeekday=Tr;o.dayOfYear=Rn;o.hour=o.hours=Fr;o.minute=o.minutes=Fn;o.second=o.seconds=Ln;o.millisecond=o.milliseconds=ys;o.utcOffset=ya;o.utc=ka;o.local=Ma;o.parseZone=Sa;o.hasAlignedHourOffset=Da;o.isDST=Ya;o.isLocal=va;o.isUtcOffset=pa;o.isUtc=as;o.isUTC=as;o.zoneAbbr=Cn;o.zoneName=Un;o.dates=R("dates accessor is deprecated. Use date instead.",ms);o.months=R("months accessor is deprecated. Use month instead",jt);o.years=R("years accessor is deprecated. Use year instead",Zt);o.zone=R("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",wa);o.isDSTShifted=R("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",ga);function Hn(e){return S(e*1e3)}function En(){return S.apply(null,arguments).parseZone()}function ws(e){return e}var w=lt.prototype;w.calendar=ps;w.longDateFormat=bs;w.invalidDate=Ns;w.ordinal=Fs;w.preparse=ws;w.postformat=ws;w.relativeTime=Is;w.pastFuture=Cs;w.set=gs;w.eras=fn;w.erasParse=cn;w.erasConvertYear=_n;w.erasAbbrRegex=Sn;w.erasNameRegex=Mn;w.erasNarrowRegex=Dn;w.months=Xs;w.monthsShort=Ks;w.monthsParse=tr;w.monthsRegex=ar;w.monthsShortRegex=rr;w.week=or;w.firstDayOfYear=dr;w.firstDayOfWeek=ur;w.weekdays=Sr;w.weekdaysMin=Yr;w.weekdaysShort=Dr;w.weekdaysParse=vr;w.weekdaysRegex=xr;w.weekdaysShortRegex=br;w.weekdaysMinRegex=Wr;w.isPM=Pr;w.meridiem=Lr;function Le(e,t,s,r){var a=J(),n=A().set(r,t);return a[s](n,e)}function ks(e,t,s){if(q(e)&&(t=e,e=void 0),e=e||"",t!=null)return Le(e,t,s,"month");var r,a=[];for(r=0;r<12;r++)a[r]=Le(e,r,s,"month");return a}function vt(e,t,s,r){typeof e=="boolean"?(q(t)&&(s=t,t=void 0),t=t||""):(t=e,s=t,e=!1,q(t)&&(s=t,t=void 0),t=t||"");var a=J(),n=e?a._week.dow:0,i,d=[];if(s!=null)return Le(t,(s+n)%7,r,"day");for(i=0;i<7;i++)d[i]=Le(t,(i+n)%7,r,"day");return d}function An(e,t){return ks(e,t,"months")}function Vn(e,t){return ks(e,t,"monthsShort")}function Gn(e,t,s){return vt(e,t,s,"weekdays")}function jn(e,t,s){return vt(e,t,s,"weekdaysShort")}function zn(e,t,s){return vt(e,t,s,"weekdaysMin")}te("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,s=_(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+s}});l.lang=R("moment.lang is deprecated. Use moment.locale instead.",te);l.langData=R("moment.langData is deprecated. Use moment.localeData instead.",J);var j=Math.abs;function Zn(){var e=this._data;return this._milliseconds=j(this._milliseconds),this._days=j(this._days),this._months=j(this._months),e.milliseconds=j(e.milliseconds),e.seconds=j(e.seconds),e.minutes=j(e.minutes),e.hours=j(e.hours),e.months=j(e.months),e.years=j(e.years),this}function Ms(e,t,s,r){var a=U(t,s);return e._milliseconds+=r*a._milliseconds,e._days+=r*a._days,e._months+=r*a._months,e._bubble()}function $n(e,t){return Ms(this,e,t,1)}function Bn(e,t){return Ms(this,e,t,-1)}function bt(e){return e<0?Math.floor(e):Math.ceil(e)}function qn(){var e=this._milliseconds,t=this._days,s=this._months,r=this._data,a,n,i,d,c;return e>=0&&t>=0&&s>=0||e<=0&&t<=0&&s<=0||(e+=bt(at(s)+t)*864e5,t=0,s=0),r.milliseconds=e%1e3,a=P(e/1e3),r.seconds=a%60,n=P(a/60),r.minutes=n%60,i=P(n/60),r.hours=i%24,t+=P(i/24),c=P(Ss(t)),s+=c,t-=bt(at(c)),d=P(s/12),s%=12,r.days=t,r.months=s,r.years=d,this}function Ss(e){return e*4800/146097}function at(e){return e*146097/4800}function Jn(e){if(!this.isValid())return NaN;var t,s,r=this._milliseconds;if(e=F(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+r/864e5,s=this._months+Ss(t),e){case"month":return s;case"quarter":return s/3;case"year":return s/12}else switch(t=this._days+Math.round(at(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return t*24+r/36e5;case"minute":return t*1440+r/6e4;case"second":return t*86400+r/1e3;case"millisecond":return Math.floor(t*864e5)+r;default:throw new Error("Unknown unit "+e)}}function Qn(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+_(this._months/12)*31536e6:NaN}function Q(e){return function(){return this.as(e)}}var Xn=Q("ms"),Kn=Q("s"),ei=Q("m"),ti=Q("h"),si=Q("d"),ri=Q("w"),ai=Q("M"),ni=Q("Q"),ii=Q("y");function oi(){return U(this)}function li(e){return e=F(e),this.isValid()?this[e+"s"]():NaN}function ne(e){return function(){return this.isValid()?this._data[e]:NaN}}var ui=ne("milliseconds"),di=ne("seconds"),hi=ne("minutes"),fi=ne("hours"),ci=ne("days"),_i=ne("months"),mi=ne("years");function yi(){return P(this.days()/7)}var z=Math.round,le={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function wi(e,t,s,r,a){return a.relativeTime(t||1,!!s,e,r)}function ki(e,t,s,r){var a=U(e).abs(),n=z(a.as("s")),i=z(a.as("m")),d=z(a.as("h")),c=z(a.as("d")),k=z(a.as("M")),x=z(a.as("w")),G=z(a.as("y")),X=n<=s.ss&&["s",n]||n0,X[4]=r,wi.apply(null,X)}function Mi(e){return e===void 0?z:typeof e=="function"?(z=e,!0):!1}function Si(e,t){return le[e]===void 0?!1:t===void 0?le[e]:(le[e]=t,e==="s"&&(le.ss=t-1),!0)}function Di(e,t){if(!this.isValid())return this.localeData().invalidDate();var s=!1,r=le,a,n;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(s=e),typeof t=="object"&&(r=Object.assign({},le,t),t.s!=null&&t.ss==null&&(r.ss=t.s-1)),a=this.localeData(),n=ki(this,!s,r,a),s&&(n=a.pastFuture(+this,n)),a.postformat(n)}var Qe=Math.abs;function ie(e){return(e>0)-(e<0)||+e}function $e(){if(!this.isValid())return this.localeData().invalidDate();var e=Qe(this._milliseconds)/1e3,t=Qe(this._days),s=Qe(this._months),r,a,n,i,d=this.asSeconds(),c,k,x,G;return d?(r=P(e/60),a=P(r/60),e%=60,r%=60,n=P(s/12),s%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",c=d<0?"-":"",k=ie(this._months)!==ie(d)?"-":"",x=ie(this._days)!==ie(d)?"-":"",G=ie(this._milliseconds)!==ie(d)?"-":"",c+"P"+(n?k+n+"Y":"")+(s?k+s+"M":"")+(t?x+t+"D":"")+(a||r||e?"T":"")+(a?G+a+"H":"")+(r?G+r+"M":"")+(e?G+i+"S":"")):"P0D"}var m=ze.prototype;m.isValid=fa;m.abs=Zn;m.add=$n;m.subtract=Bn;m.as=Jn;m.asMilliseconds=Xn;m.asSeconds=Kn;m.asMinutes=ei;m.asHours=ti;m.asDays=si;m.asWeeks=ri;m.asMonths=ai;m.asQuarters=ni;m.asYears=ii;m.valueOf=Qn;m._bubble=qn;m.clone=oi;m.get=li;m.milliseconds=ui;m.seconds=di;m.minutes=hi;m.hours=fi;m.days=ci;m.weeks=yi;m.months=_i;m.years=mi;m.humanize=Di;m.toISOString=$e;m.toString=$e;m.toJSON=$e;m.locale=ls;m.localeData=ds;m.toIsoString=R("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$e);m.lang=us;h("X",0,0,"unix");h("x",0,0,"valueOf");u("x",Ae);u("X",Vs);M("X",function(e,t,s){s._d=new Date(parseFloat(e)*1e3)});M("x",function(e,t,s){s._d=new Date(_(e))});//! moment.js -l.version="2.29.3";Ds(S);l.fn=o;l.min=la;l.max=ua;l.now=da;l.utc=A;l.unix=Hn;l.months=An;l.isDate=De;l.locale=te;l.invalid=Ie;l.duration=U;l.isMoment=C;l.weekdays=Gn;l.parseZone=En;l.localeData=J;l.isDuration=xe;l.monthsShort=Vn;l.weekdaysMin=zn;l.defineLocale=yt;l.updateLocale=Hr;l.locales=Er;l.weekdaysShort=jn;l.normalizeUnits=F;l.relativeTimeRounding=Mi;l.relativeTimeThreshold=Si;l.calendarFormat=La;l.prototype=o;l.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};//! moment.js locale configuration -l.defineLocale("zh-cn",{months:"\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u56DB\u6708_\u4E94\u6708_\u516D\u6708_\u4E03\u6708_\u516B\u6708_\u4E5D\u6708_\u5341\u6708_\u5341\u4E00\u6708_\u5341\u4E8C\u6708".split("_"),monthsShort:"1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"),weekdays:"\u661F\u671F\u65E5_\u661F\u671F\u4E00_\u661F\u671F\u4E8C_\u661F\u671F\u4E09_\u661F\u671F\u56DB_\u661F\u671F\u4E94_\u661F\u671F\u516D".split("_"),weekdaysShort:"\u5468\u65E5_\u5468\u4E00_\u5468\u4E8C_\u5468\u4E09_\u5468\u56DB_\u5468\u4E94_\u5468\u516D".split("_"),weekdaysMin:"\u65E5_\u4E00_\u4E8C_\u4E09_\u56DB_\u4E94_\u516D".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY\u5E74M\u6708D\u65E5",LLL:"YYYY\u5E74M\u6708D\u65E5Ah\u70B9mm\u5206",LLLL:"YYYY\u5E74M\u6708D\u65E5ddddAh\u70B9mm\u5206",l:"YYYY/M/D",ll:"YYYY\u5E74M\u6708D\u65E5",lll:"YYYY\u5E74M\u6708D\u65E5 HH:mm",llll:"YYYY\u5E74M\u6708D\u65E5dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return e===12&&(e=0),t==="\u51CC\u6668"||t==="\u65E9\u4E0A"||t==="\u4E0A\u5348"?e:t==="\u4E0B\u5348"||t==="\u665A\u4E0A"?e+12:e>=11?e:e+12},meridiem:function(e,t,s){var r=e*100+t;return r<600?"\u51CC\u6668":r<900?"\u65E9\u4E0A":r<1130?"\u4E0A\u5348":r<1230?"\u4E2D\u5348":r<1800?"\u4E0B\u5348":"\u665A\u4E0A"},calendar:{sameDay:"[\u4ECA\u5929]LT",nextDay:"[\u660E\u5929]LT",nextWeek:function(e){return e.week()!==this.week()?"[\u4E0B]dddLT":"[\u672C]dddLT"},lastDay:"[\u6628\u5929]LT",lastWeek:function(e){return this.week()!==e.week()?"[\u4E0A]dddLT":"[\u672C]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"\u65E5";case"M":return e+"\u6708";case"w":case"W":return e+"\u5468";default:return e}},relativeTime:{future:"%s\u540E",past:"%s\u524D",s:"\u51E0\u79D2",ss:"%d \u79D2",m:"1 \u5206\u949F",mm:"%d \u5206\u949F",h:"1 \u5C0F\u65F6",hh:"%d \u5C0F\u65F6",d:"1 \u5929",dd:"%d \u5929",w:"1 \u5468",ww:"%d \u5468",M:"1 \u4E2A\u6708",MM:"%d \u4E2A\u6708",y:"1 \u5E74",yy:"%d \u5E74"},week:{dow:1,doy:4}});l.locale("zh-cn");const Yi=e=>l.unix(e).fromNow();export{Yi as f}; diff --git a/web/dist/assets/index.2a3b289f.css b/web/dist/assets/index.2a3b289f.css deleted file mode 100644 index f880c3ff..00000000 --- a/web/dist/assets/index.2a3b289f.css +++ /dev/null @@ -1 +0,0 @@ -.auth-wrap[data-v-66895776]{margin-top:-30px}.rightbar-wrap[data-v-0dc4cb5d]{width:240px;position:fixed;left:calc(50% + var(--content-main) / 2 + 10px)}.rightbar-wrap .search-wrap[data-v-0dc4cb5d]{margin:12px 0}.rightbar-wrap .hot-tag-item[data-v-0dc4cb5d]{line-height:2;position:relative}.rightbar-wrap .hot-tag-item .hash-link[data-v-0dc4cb5d]{width:calc(100% - 60px);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block}.rightbar-wrap .hot-tag-item .post-num[data-v-0dc4cb5d]{position:absolute;right:0;top:0;width:60px;text-align:right;line-height:2;opacity:.5}.rightbar-wrap .copyright-wrap[data-v-0dc4cb5d]{margin-top:10px}.rightbar-wrap .copyright-wrap .copyright[data-v-0dc4cb5d]{font-size:12px;opacity:.75}.rightbar-wrap .copyright-wrap .hash-link[data-v-0dc4cb5d]{font-size:12px}.sidebar-wrap{z-index:99;width:200px;height:100vh;position:fixed;right:calc(50% + var(--content-main) / 2 + 10px);padding:12px 0;box-sizing:border-box}.sidebar-wrap .n-menu .n-menu-item-content:before{border-radius:21px}.logo-wrap{display:flex;justify-content:flex-start;margin-bottom:12px}.logo-wrap .logo-img{margin-left:24px}.logo-wrap .logo-img:hover{cursor:pointer}.user-wrap{display:flex;align-items:center;position:absolute;bottom:12px;left:12px;right:12px}.user-wrap .user-mini-wrap{display:none}.user-wrap .user-avatar{margin-right:8px}.user-wrap .user-info{display:flex;flex-direction:column}.user-wrap .user-info .nickname{font-size:16px;font-weight:700;line-height:16px;height:16px;margin-bottom:2px;display:flex;align-items:center}.user-wrap .user-info .nickname .nickname-txt{max-width:90px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.user-wrap .user-info .nickname .logout{margin-left:6px}.user-wrap .user-info .username{font-size:14px;line-height:16px;height:16px;width:120px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;opacity:.75}.user-wrap .login-wrap{display:flex;justify-content:center;width:100%}.user-wrap .login-wrap button{margin:0 4px}.auth-card .n-card-header{z-index:999}@media screen and (max-width: 821px){.sidebar-wrap{width:65px;right:calc(100% - 60px)}.logo-wrap .logo-img{margin-left:12px!important}.user-wrap .user-avatar,.user-wrap .user-info,.user-wrap .login-wrap{display:none}.user-wrap .user-mini-wrap{display:block!important}}:root{--content-main: 500px}.app-container{margin:0}.app-container .app-wrap{width:100%;margin:0 auto}.main-wrap{min-height:100vh;display:flex;flex-direction:row;justify-content:center}.main-wrap .content-wrap{width:100%;max-width:var(--content-main);position:relative}.main-wrap .main-content-wrap{margin:0;border-top:none;border-radius:0}.main-wrap .main-content-wrap .n-list-item{padding:0}.empty-wrap{min-height:300px;display:flex;align-items:center;justify-content:center}.hash-link,.user-link{color:#18a058;text-decoration:none;cursor:pointer}.hash-link:hover,.user-link:hover{opacity:.8}.beian-link{color:#333;text-decoration:none}.beian-link:hover{opacity:.75}.username-link{color:#000;color:none;text-decoration:none;cursor:pointer}.username-link:hover{text-decoration:underline}.dark .hash-link,.dark .user-link{color:#63e2b7}.dark .username-link{color:#eee}.dark .beian-link{color:#ddd}@media screen and (max-width: 821px){.content-wrap{top:0;left:60px;position:absolute!important;width:calc(100% - 60px)!important}}@font-face{font-family:v-sans;font-weight:400;src:url(/assets/LatoLatin-Regular.ddd4ef7f.woff2)}@font-face{font-family:v-sans;font-weight:600;src:url(/assets/LatoLatin-Semibold.267eef30.woff2)}@font-face{font-family:v-mono;font-weight:400;src:url(/assets/FiraCode-Regular.f13d1ece.woff2)} diff --git a/web/dist/assets/index.f480f018.js b/web/dist/assets/index.f480f018.js deleted file mode 100644 index 58d64e21..00000000 --- a/web/dist/assets/index.f480f018.js +++ /dev/null @@ -1,1771 +0,0 @@ -const ib=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))o(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function r(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerpolicy&&(i.referrerPolicy=n.referrerpolicy),n.crossorigin==="use-credentials"?i.credentials="include":n.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(n){if(n.ep)return;n.ep=!0;const i=r(n);fetch(n.href,i)}};ib();function As(e,t){const r=Object.create(null),o=e.split(",");for(let n=0;n!!r[n.toLowerCase()]:n=>!!r[n]}const ab="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",lb=As(ab);function Ef(e){return!!e||e===""}function Os(e){if(Pe(e)){const t={};for(let r=0;r{if(r){const o=r.split(cb);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function ya(e){let t="";if(ft(e))t=e;else if(Pe(e))for(let r=0;rft(e)?e:e==null?"":Pe(e)||pt(e)&&(e.toString===Of||!Ie(e.toString))?JSON.stringify(e,Rf,2):String(e),Rf=(e,t)=>t&&t.__v_isRef?Rf(e,t.value):en(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((r,[o,n])=>(r[`${o} =>`]=n,r),{})}:zf(t)?{[`Set(${t.size})`]:[...t.values()]}:pt(t)&&!Pe(t)&&!If(t)?String(t):t,tt={},Qo=[],ir=()=>{},ub=()=>!1,fb=/^on[^a-z]/,wa=e=>fb.test(e),Is=e=>e.startsWith("onUpdate:"),St=Object.assign,Ms=(e,t)=>{const r=e.indexOf(t);r>-1&&e.splice(r,1)},hb=Object.prototype.hasOwnProperty,Ve=(e,t)=>hb.call(e,t),Pe=Array.isArray,en=e=>Sa(e)==="[object Map]",zf=e=>Sa(e)==="[object Set]",Ie=e=>typeof e=="function",ft=e=>typeof e=="string",Bs=e=>typeof e=="symbol",pt=e=>e!==null&&typeof e=="object",Af=e=>pt(e)&&Ie(e.then)&&Ie(e.catch),Of=Object.prototype.toString,Sa=e=>Of.call(e),pb=e=>Sa(e).slice(8,-1),If=e=>Sa(e)==="[object Object]",Ls=e=>ft(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Yi=As(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),_a=e=>{const t=Object.create(null);return r=>t[r]||(t[r]=e(r))},mb=/-(\w)/g,vr=_a(e=>e.replace(mb,(t,r)=>r?r.toUpperCase():"")),vb=/\B([A-Z])/g,Po=_a(e=>e.replace(vb,"-$1").toLowerCase()),$a=_a(e=>e.charAt(0).toUpperCase()+e.slice(1)),il=_a(e=>e?`on${$a(e)}`:""),ei=(e,t)=>!Object.is(e,t),tn=(e,t)=>{for(let r=0;r{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:r})},ra=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let rd;const gb=()=>rd||(rd=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});let hr;class bb{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&hr&&(this.parent=hr,this.index=(hr.scopes||(hr.scopes=[])).push(this)-1)}run(t){if(this.active){const r=hr;try{return hr=this,t()}finally{hr=r}}}on(){hr=this}off(){hr=this.parent}stop(t){if(this.active){let r,o;for(r=0,o=this.effects.length;r{const t=new Set(e);return t.w=0,t.n=0,t},Mf=e=>(e.w&Vr)>0,Bf=e=>(e.n&Vr)>0,Cb=({deps:e})=>{if(e.length)for(let t=0;t{const{deps:t}=e;if(t.length){let r=0;for(let o=0;o{(d==="length"||d>=o)&&l.push(s)});else switch(r!==void 0&&l.push(a.get(r)),t){case"add":Pe(e)?Ls(r)&&l.push(a.get("length")):(l.push(a.get(Co)),en(e)&&l.push(a.get(Hl)));break;case"delete":Pe(e)||(l.push(a.get(Co)),en(e)&&l.push(a.get(Hl)));break;case"set":en(e)&&l.push(a.get(Co));break}if(l.length===1)l[0]&&jl(l[0]);else{const s=[];for(const d of l)d&&s.push(...d);jl(Ds(s))}}function jl(e,t){for(const r of Pe(e)?e:[...e])(r!==nr||r.allowRecurse)&&(r.scheduler?r.scheduler():r.run())}const wb=As("__proto__,__v_isRef,__isVue"),Ff=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(Bs)),Sb=Hs(),_b=Hs(!1,!0),$b=Hs(!0),nd=Pb();function Pb(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...r){const o=Ge(this);for(let i=0,a=this.length;i{e[t]=function(...r){bn();const o=Ge(this)[t].apply(this,r);return xn(),o}}),e}function Hs(e=!1,t=!1){return function(o,n,i){if(n==="__v_isReactive")return!e;if(n==="__v_isReadonly")return e;if(n==="__v_isShallow")return t;if(n==="__v_raw"&&i===(e?t?Nb:Vf:t?Wf:Nf).get(o))return o;const a=Pe(o);if(!e&&a&&Ve(nd,n))return Reflect.get(nd,n,i);const l=Reflect.get(o,n,i);return(Bs(n)?Ff.has(n):wb(n))||(e||Kt(o,"get",n),t)?l:wt(l)?!a||!Ls(n)?l.value:l:pt(l)?e?gr(l):ar(l):l}}const kb=Hf(),Tb=Hf(!0);function Hf(e=!1){return function(r,o,n,i){let a=r[o];if(ti(a)&&wt(a)&&!wt(n))return!1;if(!e&&!ti(n)&&(Kf(n)||(n=Ge(n),a=Ge(a)),!Pe(r)&&wt(a)&&!wt(n)))return a.value=n,!0;const l=Pe(r)&&Ls(o)?Number(o)e,Pa=e=>Reflect.getPrototypeOf(e);function Ai(e,t,r=!1,o=!1){e=e.__v_raw;const n=Ge(e),i=Ge(t);t!==i&&!r&&Kt(n,"get",t),!r&&Kt(n,"get",i);const{has:a}=Pa(n),l=o?js:r?Vs:ri;if(a.call(n,t))return l(e.get(t));if(a.call(n,i))return l(e.get(i));e!==n&&e.get(t)}function Oi(e,t=!1){const r=this.__v_raw,o=Ge(r),n=Ge(e);return e!==n&&!t&&Kt(o,"has",e),!t&&Kt(o,"has",n),e===n?r.has(e):r.has(e)||r.has(n)}function Ii(e,t=!1){return e=e.__v_raw,!t&&Kt(Ge(e),"iterate",Co),Reflect.get(e,"size",e)}function id(e){e=Ge(e);const t=Ge(this);return Pa(t).has.call(t,e)||(t.add(e),kr(t,"add",e,e)),this}function ad(e,t){t=Ge(t);const r=Ge(this),{has:o,get:n}=Pa(r);let i=o.call(r,e);i||(e=Ge(e),i=o.call(r,e));const a=n.call(r,e);return r.set(e,t),i?ei(t,a)&&kr(r,"set",e,t):kr(r,"add",e,t),this}function ld(e){const t=Ge(this),{has:r,get:o}=Pa(t);let n=r.call(t,e);n||(e=Ge(e),n=r.call(t,e)),o&&o.call(t,e);const i=t.delete(e);return n&&kr(t,"delete",e,void 0),i}function sd(){const e=Ge(this),t=e.size!==0,r=e.clear();return t&&kr(e,"clear",void 0,void 0),r}function Mi(e,t){return function(o,n){const i=this,a=i.__v_raw,l=Ge(a),s=t?js:e?Vs:ri;return!e&&Kt(l,"iterate",Co),a.forEach((d,c)=>o.call(n,s(d),s(c),i))}}function Bi(e,t,r){return function(...o){const n=this.__v_raw,i=Ge(n),a=en(i),l=e==="entries"||e===Symbol.iterator&&a,s=e==="keys"&&a,d=n[e](...o),c=r?js:t?Vs:ri;return!t&&Kt(i,"iterate",s?Hl:Co),{next(){const{value:u,done:f}=d.next();return f?{value:u,done:f}:{value:l?[c(u[0]),c(u[1])]:c(u),done:f}},[Symbol.iterator](){return this}}}}function Or(e){return function(...t){return e==="delete"?!1:this}}function Ib(){const e={get(i){return Ai(this,i)},get size(){return Ii(this)},has:Oi,add:id,set:ad,delete:ld,clear:sd,forEach:Mi(!1,!1)},t={get(i){return Ai(this,i,!1,!0)},get size(){return Ii(this)},has:Oi,add:id,set:ad,delete:ld,clear:sd,forEach:Mi(!1,!0)},r={get(i){return Ai(this,i,!0)},get size(){return Ii(this,!0)},has(i){return Oi.call(this,i,!0)},add:Or("add"),set:Or("set"),delete:Or("delete"),clear:Or("clear"),forEach:Mi(!0,!1)},o={get(i){return Ai(this,i,!0,!0)},get size(){return Ii(this,!0)},has(i){return Oi.call(this,i,!0)},add:Or("add"),set:Or("set"),delete:Or("delete"),clear:Or("clear"),forEach:Mi(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(i=>{e[i]=Bi(i,!1,!1),r[i]=Bi(i,!0,!1),t[i]=Bi(i,!1,!0),o[i]=Bi(i,!0,!0)}),[e,r,t,o]}const[Mb,Bb,Lb,Db]=Ib();function Ns(e,t){const r=t?e?Db:Lb:e?Bb:Mb;return(o,n,i)=>n==="__v_isReactive"?!e:n==="__v_isReadonly"?e:n==="__v_raw"?o:Reflect.get(Ve(r,n)&&n in o?r:o,n,i)}const Fb={get:Ns(!1,!1)},Hb={get:Ns(!1,!0)},jb={get:Ns(!0,!1)},Nf=new WeakMap,Wf=new WeakMap,Vf=new WeakMap,Nb=new WeakMap;function Wb(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Vb(e){return e.__v_skip||!Object.isExtensible(e)?0:Wb(pb(e))}function ar(e){return ti(e)?e:Ws(e,!1,jf,Fb,Nf)}function Kb(e){return Ws(e,!1,Ob,Hb,Wf)}function gr(e){return Ws(e,!0,Ab,jb,Vf)}function Ws(e,t,r,o,n){if(!pt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=n.get(e);if(i)return i;const a=Vb(e);if(a===0)return e;const l=new Proxy(e,a===2?o:r);return n.set(e,l),l}function rn(e){return ti(e)?rn(e.__v_raw):!!(e&&e.__v_isReactive)}function ti(e){return!!(e&&e.__v_isReadonly)}function Kf(e){return!!(e&&e.__v_isShallow)}function Uf(e){return rn(e)||ti(e)}function Ge(e){const t=e&&e.__v_raw;return t?Ge(t):e}function oa(e){return ta(e,"__v_skip",!0),e}const ri=e=>pt(e)?ar(e):e,Vs=e=>pt(e)?gr(e):e;function qf(e){Nr&&nr&&(e=Ge(e),Df(e.dep||(e.dep=Ds())))}function Gf(e,t){e=Ge(e),e.dep&&jl(e.dep)}function wt(e){return!!(e&&e.__v_isRef===!0)}function W(e){return Yf(e,!1)}function Ub(e){return Yf(e,!0)}function Yf(e,t){return wt(e)?e:new qb(e,t)}class qb{constructor(t,r){this.__v_isShallow=r,this.dep=void 0,this.__v_isRef=!0,this._rawValue=r?t:Ge(t),this._value=r?t:ri(t)}get value(){return qf(this),this._value}set value(t){t=this.__v_isShallow?t:Ge(t),ei(t,this._rawValue)&&(this._rawValue=t,this._value=this.__v_isShallow?t:ri(t),Gf(this))}}function Me(e){return wt(e)?e.value:e}const Gb={get:(e,t,r)=>Me(Reflect.get(e,t,r)),set:(e,t,r,o)=>{const n=e[t];return wt(n)&&!wt(r)?(n.value=r,!0):Reflect.set(e,t,r,o)}};function Xf(e){return rn(e)?e:new Proxy(e,Gb)}class Yb{constructor(t,r,o){this._object=t,this._key=r,this._defaultValue=o,this.__v_isRef=!0}get value(){const t=this._object[this._key];return t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}}function Oe(e,t,r){const o=e[t];return wt(o)?o:new Yb(e,t,r)}class Xb{constructor(t,r,o,n){this._setter=r,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new Fs(t,()=>{this._dirty||(this._dirty=!0,Gf(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=o}get value(){const t=Ge(this);return qf(t),(t._dirty||!t._cacheable)&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function Zb(e,t,r=!1){let o,n;const i=Ie(e);return i?(o=e,n=ir):(o=e.get,n=e.set),new Xb(o,n,i||!n,r)}function Wr(e,t,r,o){let n;try{n=o?e(...o):e()}catch(i){ka(i,t,r)}return n}function Jt(e,t,r,o){if(Ie(e)){const i=Wr(e,t,r,o);return i&&Af(i)&&i.catch(a=>{ka(a,t,r)}),i}const n=[];for(let i=0;i>>1;oi(Nt[o])Pr&&Nt.splice(t,1)}function eh(e,t,r,o){Pe(e)?r.push(...e):(!t||!t.includes(e,e.allowRecurse?o+1:o))&&r.push(e),Qf()}function t0(e){eh(e,Dn,Vn,Ko)}function r0(e){eh(e,Fr,Kn,Uo)}function Us(e,t=null){if(Vn.length){for(Wl=t,Dn=[...new Set(Vn)],Vn.length=0,Ko=0;Kooi(r)-oi(o)),Uo=0;Uoe.id==null?1/0:e.id;function rh(e){Nl=!1,na=!0,Us(e),Nt.sort((r,o)=>oi(r)-oi(o));const t=ir;try{for(Pr=0;Prh.trim()):u&&(n=r.map(ra))}let l,s=o[l=il(t)]||o[l=il(vr(t))];!s&&i&&(s=o[l=il(Po(t))]),s&&Jt(s,e,6,n);const d=o[l+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,Jt(d,e,6,n)}}function oh(e,t,r=!1){const o=t.emitsCache,n=o.get(e);if(n!==void 0)return n;const i=e.emits;let a={},l=!1;if(!Ie(e)){const s=d=>{const c=oh(d,t,!0);c&&(l=!0,St(a,c))};!r&&t.mixins.length&&t.mixins.forEach(s),e.extends&&s(e.extends),e.mixins&&e.mixins.forEach(s)}return!i&&!l?(o.set(e,null),null):(Pe(i)?i.forEach(s=>a[s]=null):St(a,i),o.set(e,a),a)}function Ta(e,t){return!e||!wa(t)?!1:(t=t.slice(2).replace(/Once$/,""),Ve(e,t[0].toLowerCase()+t.slice(1))||Ve(e,Po(t))||Ve(e,t))}let zt=null,Ea=null;function ia(e){const t=zt;return zt=e,Ea=e&&e.type.__scopeId||null,t}function oO(e){Ea=e}function nO(){Ea=null}function Xe(e,t=zt,r){if(!t||e._n)return e;const o=(...n)=>{o._d&&yd(-1);const i=ia(t),a=e(...n);return ia(i),o._d&&yd(1),a};return o._n=!0,o._c=!0,o._d=!0,o}function al(e){const{type:t,vnode:r,proxy:o,withProxy:n,props:i,propsOptions:[a],slots:l,attrs:s,emit:d,render:c,renderCache:u,data:f,setupState:h,ctx:p,inheritAttrs:b}=e;let g,v;const w=ia(e);try{if(r.shapeFlag&4){const x=n||o;g=pr(c.call(x,x,u,i,h,f,p)),v=s}else{const x=t;g=pr(x.length>1?x(i,{attrs:s,slots:l,emit:d}):x(i,null)),v=t.props?s:n0(s)}}catch(x){qn.length=0,ka(x,e,1),g=ge(Lt)}let $=g;if(v&&b!==!1){const x=Object.keys(v),{shapeFlag:S}=$;x.length&&S&7&&(a&&x.some(Is)&&(v=i0(v,a)),$=lr($,v))}return r.dirs&&($.dirs=$.dirs?$.dirs.concat(r.dirs):r.dirs),r.transition&&($.transition=r.transition),g=$,ia(w),g}const n0=e=>{let t;for(const r in e)(r==="class"||r==="style"||wa(r))&&((t||(t={}))[r]=e[r]);return t},i0=(e,t)=>{const r={};for(const o in e)(!Is(o)||!(o.slice(9)in t))&&(r[o]=e[o]);return r};function a0(e,t,r){const{props:o,children:n,component:i}=e,{props:a,children:l,patchFlag:s}=t,d=i.emitsOptions;if(t.dirs||t.transition)return!0;if(r&&s>=0){if(s&1024)return!0;if(s&16)return o?cd(o,a,d):!!a;if(s&8){const c=t.dynamicProps;for(let u=0;ue.__isSuspense;function c0(e,t){t&&t.pendingBranch?Pe(e)?t.effects.push(...e):t.effects.push(e):r0(e)}function je(e,t){if(yt){let r=yt.provides;const o=yt.parent&&yt.parent.provides;o===r&&(r=yt.provides=Object.create(o)),r[e]=t}}function be(e,t,r=!1){const o=yt||zt;if(o){const n=o.parent==null?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides;if(n&&e in n)return n[e];if(arguments.length>1)return r&&Ie(t)?t.call(o.proxy):t}}function xr(e,t){return qs(e,null,t)}const dd={};function qe(e,t,r){return qs(e,t,r)}function qs(e,t,{immediate:r,deep:o,flush:n,onTrack:i,onTrigger:a}=tt){const l=yt;let s,d=!1,c=!1;if(wt(e)?(s=()=>e.value,d=Kf(e)):rn(e)?(s=()=>e,o=!0):Pe(e)?(c=!0,d=e.some(rn),s=()=>e.map(v=>{if(wt(v))return v.value;if(rn(v))return po(v);if(Ie(v))return Wr(v,l,2)})):Ie(e)?t?s=()=>Wr(e,l,2):s=()=>{if(!(l&&l.isUnmounted))return u&&u(),Jt(e,l,3,[f])}:s=ir,t&&o){const v=s;s=()=>po(v())}let u,f=v=>{u=g.onStop=()=>{Wr(v,l,4)}};if(ai)return f=ir,t?r&&Jt(t,l,3,[s(),c?[]:void 0,f]):s(),ir;let h=c?[]:dd;const p=()=>{if(!!g.active)if(t){const v=g.run();(o||d||(c?v.some((w,$)=>ei(w,h[$])):ei(v,h)))&&(u&&u(),Jt(t,l,3,[v,h===dd?void 0:h,f]),h=v)}else g.run()};p.allowRecurse=!!t;let b;n==="sync"?b=p:n==="post"?b=()=>kt(p,l&&l.suspense):b=()=>{!l||l.isMounted?t0(p):p()};const g=new Fs(s,b);return t?r?p():h=g.run():n==="post"?kt(g.run.bind(g),l&&l.suspense):g.run(),()=>{g.stop(),l&&l.scope&&Ms(l.scope.effects,g)}}function d0(e,t,r){const o=this.proxy,n=ft(e)?e.includes(".")?nh(o,e):()=>o[e]:e.bind(o,o);let i;Ie(t)?i=t:(i=t.handler,r=t);const a=yt;ln(this);const l=qs(n,i.bind(o),r);return a?ln(a):wo(),l}function nh(e,t){const r=t.split(".");return()=>{let o=e;for(let n=0;n{po(r,t)});else if(If(e))for(const r in e)po(e[r],t);return e}function ih(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ot(()=>{e.isMounted=!0}),It(()=>{e.isUnmounting=!0}),e}const Gt=[Function,Array],u0={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Gt,onEnter:Gt,onAfterEnter:Gt,onEnterCancelled:Gt,onBeforeLeave:Gt,onLeave:Gt,onAfterLeave:Gt,onLeaveCancelled:Gt,onBeforeAppear:Gt,onAppear:Gt,onAfterAppear:Gt,onAppearCancelled:Gt},setup(e,{slots:t}){const r=Zr(),o=ih();let n;return()=>{const i=t.default&&Gs(t.default(),!0);if(!i||!i.length)return;let a=i[0];if(i.length>1){for(const b of i)if(b.type!==Lt){a=b;break}}const l=Ge(e),{mode:s}=l;if(o.isLeaving)return ll(a);const d=ud(a);if(!d)return ll(a);const c=ni(d,l,o,r);nn(d,c);const u=r.subTree,f=u&&ud(u);let h=!1;const{getTransitionKey:p}=d.type;if(p){const b=p();n===void 0?n=b:b!==n&&(n=b,h=!0)}if(f&&f.type!==Lt&&(!fo(d,f)||h)){const b=ni(f,l,o,r);if(nn(f,b),s==="out-in")return o.isLeaving=!0,b.afterLeave=()=>{o.isLeaving=!1,r.update()},ll(a);s==="in-out"&&d.type!==Lt&&(b.delayLeave=(g,v,w)=>{const $=lh(o,f);$[String(f.key)]=f,g._leaveCb=()=>{v(),g._leaveCb=void 0,delete c.delayedLeave},c.delayedLeave=w})}return a}}},ah=u0;function lh(e,t){const{leavingVNodes:r}=e;let o=r.get(t.type);return o||(o=Object.create(null),r.set(t.type,o)),o}function ni(e,t,r,o){const{appear:n,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:s,onAfterEnter:d,onEnterCancelled:c,onBeforeLeave:u,onLeave:f,onAfterLeave:h,onLeaveCancelled:p,onBeforeAppear:b,onAppear:g,onAfterAppear:v,onAppearCancelled:w}=t,$=String(e.key),x=lh(r,e),S=(y,_)=>{y&&Jt(y,o,9,_)},E={mode:i,persisted:a,beforeEnter(y){let _=l;if(!r.isMounted)if(n)_=b||l;else return;y._leaveCb&&y._leaveCb(!0);const R=x[$];R&&fo(e,R)&&R.el._leaveCb&&R.el._leaveCb(),S(_,[y])},enter(y){let _=s,R=d,P=c;if(!r.isMounted)if(n)_=g||s,R=v||d,P=w||c;else return;let j=!1;const T=y._enterCb=N=>{j||(j=!0,N?S(P,[y]):S(R,[y]),E.delayedLeave&&E.delayedLeave(),y._enterCb=void 0)};_?(_(y,T),_.length<=1&&T()):T()},leave(y,_){const R=String(e.key);if(y._enterCb&&y._enterCb(!0),r.isUnmounting)return _();S(u,[y]);let P=!1;const j=y._leaveCb=T=>{P||(P=!0,_(),T?S(p,[y]):S(h,[y]),y._leaveCb=void 0,x[R]===e&&delete x[R])};x[R]=e,f?(f(y,j),f.length<=1&&j()):j()},clone(y){return ni(y,t,r,o)}};return E}function ll(e){if(Ra(e))return e=lr(e),e.children=null,e}function ud(e){return Ra(e)?e.children?e.children[0]:void 0:e}function nn(e,t){e.shapeFlag&6&&e.component?nn(e.component.subTree,t):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Gs(e,t=!1,r){let o=[],n=0;for(let i=0;i1)for(let i=0;i!!e.type.__asyncLoader,Ra=e=>e.type.__isKeepAlive,f0={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const r=Zr(),o=r.ctx;if(!o.renderer)return t.default;const n=new Map,i=new Set;let a=null;const l=r.suspense,{renderer:{p:s,m:d,um:c,o:{createElement:u}}}=o,f=u("div");o.activate=(w,$,x,S,E)=>{const y=w.component;d(w,$,x,0,l),s(y.vnode,w,$,x,y,l,S,w.slotScopeIds,E),kt(()=>{y.isDeactivated=!1,y.a&&tn(y.a);const _=w.props&&w.props.onVnodeMounted;_&&Zt(_,y.parent,w)},l)},o.deactivate=w=>{const $=w.component;d(w,f,null,1,l),kt(()=>{$.da&&tn($.da);const x=w.props&&w.props.onVnodeUnmounted;x&&Zt(x,$.parent,w),$.isDeactivated=!0},l)};function h(w){sl(w),c(w,r,l,!0)}function p(w){n.forEach(($,x)=>{const S=Zl($.type);S&&(!w||!w(S))&&b(x)})}function b(w){const $=n.get(w);!a||$.type!==a.type?h($):a&&sl(a),n.delete(w),i.delete(w)}qe(()=>[e.include,e.exclude],([w,$])=>{w&&p(x=>Fn(w,x)),$&&p(x=>!Fn($,x))},{flush:"post",deep:!0});let g=null;const v=()=>{g!=null&&n.set(g,cl(r.subTree))};return Ot(v),Ys(v),It(()=>{n.forEach(w=>{const{subTree:$,suspense:x}=r,S=cl($);if(w.type===S.type){sl(S);const E=S.component.da;E&&kt(E,x);return}h(w)})}),()=>{if(g=null,!t.default)return null;const w=t.default(),$=w[0];if(w.length>1)return a=null,w;if(!an($)||!($.shapeFlag&4)&&!($.shapeFlag&128))return a=null,$;let x=cl($);const S=x.type,E=Zl(ii(x)?x.type.__asyncResolved||{}:S),{include:y,exclude:_,max:R}=e;if(y&&(!E||!Fn(y,E))||_&&E&&Fn(_,E))return a=x,$;const P=x.key==null?S:x.key,j=n.get(P);return x.el&&(x=lr(x),$.shapeFlag&128&&($.ssContent=x)),g=P,j?(x.el=j.el,x.component=j.component,x.transition&&nn(x,x.transition),x.shapeFlag|=512,i.delete(P),i.add(P)):(i.add(P),R&&i.size>parseInt(R,10)&&b(i.values().next().value)),x.shapeFlag|=256,a=x,$}}},h0=f0;function Fn(e,t){return Pe(e)?e.some(r=>Fn(r,t)):ft(e)?e.split(",").includes(t):e.test?e.test(t):!1}function p0(e,t){sh(e,"a",t)}function m0(e,t){sh(e,"da",t)}function sh(e,t,r=yt){const o=e.__wdc||(e.__wdc=()=>{let n=r;for(;n;){if(n.isDeactivated)return;n=n.parent}return e()});if(za(t,o,r),r){let n=r.parent;for(;n&&n.parent;)Ra(n.parent.vnode)&&v0(o,t,r,n),n=n.parent}}function v0(e,t,r,o){const n=za(t,e,o,!0);Xs(()=>{Ms(o[t],n)},r)}function sl(e){let t=e.shapeFlag;t&256&&(t-=256),t&512&&(t-=512),e.shapeFlag=t}function cl(e){return e.shapeFlag&128?e.ssContent:e}function za(e,t,r=yt,o=!1){if(r){const n=r[e]||(r[e]=[]),i=t.__weh||(t.__weh=(...a)=>{if(r.isUnmounted)return;bn(),ln(r);const l=Jt(t,r,e,a);return wo(),xn(),l});return o?n.unshift(i):n.push(i),i}}const Er=e=>(t,r=yt)=>(!ai||e==="sp")&&za(e,t,r),Yr=Er("bm"),Ot=Er("m"),g0=Er("bu"),Ys=Er("u"),It=Er("bum"),Xs=Er("um"),b0=Er("sp"),x0=Er("rtg"),C0=Er("rtc");function y0(e,t=yt){za("ec",e,t)}let Vl=!0;function w0(e){const t=dh(e),r=e.proxy,o=e.ctx;Vl=!1,t.beforeCreate&&fd(t.beforeCreate,e,"bc");const{data:n,computed:i,methods:a,watch:l,provide:s,inject:d,created:c,beforeMount:u,mounted:f,beforeUpdate:h,updated:p,activated:b,deactivated:g,beforeDestroy:v,beforeUnmount:w,destroyed:$,unmounted:x,render:S,renderTracked:E,renderTriggered:y,errorCaptured:_,serverPrefetch:R,expose:P,inheritAttrs:j,components:T,directives:N,filters:B}=t;if(d&&S0(d,o,null,e.appContext.config.unwrapInjectedRef),a)for(const te in a){const se=a[te];Ie(se)&&(o[te]=se.bind(r))}if(n){const te=n.call(r,r);pt(te)&&(e.data=ar(te))}if(Vl=!0,i)for(const te in i){const se=i[te],_e=Ie(se)?se.bind(r,r):Ie(se.get)?se.get.bind(r,r):ir,Ae=!Ie(se)&&Ie(se.set)?se.set.bind(r):ir,Re=L({get:_e,set:Ae});Object.defineProperty(o,te,{enumerable:!0,configurable:!0,get:()=>Re.value,set:Ee=>Re.value=Ee})}if(l)for(const te in l)ch(l[te],o,r,te);if(s){const te=Ie(s)?s.call(r):s;Reflect.ownKeys(te).forEach(se=>{je(se,te[se])})}c&&fd(c,e,"c");function A(te,se){Pe(se)?se.forEach(_e=>te(_e.bind(r))):se&&te(se.bind(r))}if(A(Yr,u),A(Ot,f),A(g0,h),A(Ys,p),A(p0,b),A(m0,g),A(y0,_),A(C0,E),A(x0,y),A(It,w),A(Xs,x),A(b0,R),Pe(P))if(P.length){const te=e.exposed||(e.exposed={});P.forEach(se=>{Object.defineProperty(te,se,{get:()=>r[se],set:_e=>r[se]=_e})})}else e.exposed||(e.exposed={});S&&e.render===ir&&(e.render=S),j!=null&&(e.inheritAttrs=j),T&&(e.components=T),N&&(e.directives=N)}function S0(e,t,r=ir,o=!1){Pe(e)&&(e=Kl(e));for(const n in e){const i=e[n];let a;pt(i)?"default"in i?a=be(i.from||n,i.default,!0):a=be(i.from||n):a=be(i),wt(a)&&o?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>a.value,set:l=>a.value=l}):t[n]=a}}function fd(e,t,r){Jt(Pe(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,r)}function ch(e,t,r,o){const n=o.includes(".")?nh(r,o):()=>r[o];if(ft(e)){const i=t[e];Ie(i)&&qe(n,i)}else if(Ie(e))qe(n,e.bind(r));else if(pt(e))if(Pe(e))e.forEach(i=>ch(i,t,r,o));else{const i=Ie(e.handler)?e.handler.bind(r):t[e.handler];Ie(i)&&qe(n,i,e)}}function dh(e){const t=e.type,{mixins:r,extends:o}=t,{mixins:n,optionsCache:i,config:{optionMergeStrategies:a}}=e.appContext,l=i.get(t);let s;return l?s=l:!n.length&&!r&&!o?s=t:(s={},n.length&&n.forEach(d=>aa(s,d,a,!0)),aa(s,t,a)),i.set(t,s),s}function aa(e,t,r,o=!1){const{mixins:n,extends:i}=t;i&&aa(e,i,r,!0),n&&n.forEach(a=>aa(e,a,r,!0));for(const a in t)if(!(o&&a==="expose")){const l=_0[a]||r&&r[a];e[a]=l?l(e[a],t[a]):t[a]}return e}const _0={data:hd,props:lo,emits:lo,methods:lo,computed:lo,beforeCreate:Mt,created:Mt,beforeMount:Mt,mounted:Mt,beforeUpdate:Mt,updated:Mt,beforeDestroy:Mt,beforeUnmount:Mt,destroyed:Mt,unmounted:Mt,activated:Mt,deactivated:Mt,errorCaptured:Mt,serverPrefetch:Mt,components:lo,directives:lo,watch:P0,provide:hd,inject:$0};function hd(e,t){return t?e?function(){return St(Ie(e)?e.call(this,this):e,Ie(t)?t.call(this,this):t)}:t:e}function $0(e,t){return lo(Kl(e),Kl(t))}function Kl(e){if(Pe(e)){const t={};for(let r=0;r0)&&!(a&16)){if(a&8){const c=e.vnode.dynamicProps;for(let u=0;u{s=!0;const[f,h]=fh(u,t,!0);St(a,f),h&&l.push(...h)};!r&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!i&&!s)return o.set(e,Qo),Qo;if(Pe(i))for(let c=0;c-1,h[1]=b<0||p-1||Ve(h,"default"))&&l.push(u)}}}const d=[a,l];return o.set(e,d),d}function pd(e){return e[0]!=="$"}function md(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:e===null?"null":""}function vd(e,t){return md(e)===md(t)}function gd(e,t){return Pe(t)?t.findIndex(r=>vd(r,e)):Ie(t)&&vd(t,e)?0:-1}const hh=e=>e[0]==="_"||e==="$stable",Zs=e=>Pe(e)?e.map(pr):[pr(e)],E0=(e,t,r)=>{const o=Xe((...n)=>Zs(t(...n)),r);return o._c=!1,o},ph=(e,t,r)=>{const o=e._ctx;for(const n in e){if(hh(n))continue;const i=e[n];if(Ie(i))t[n]=E0(n,i,o);else if(i!=null){const a=Zs(i);t[n]=()=>a}}},mh=(e,t)=>{const r=Zs(t);e.slots.default=()=>r},R0=(e,t)=>{if(e.vnode.shapeFlag&32){const r=t._;r?(e.slots=Ge(t),ta(t,"_",r)):ph(t,e.slots={})}else e.slots={},t&&mh(e,t);ta(e.slots,Aa,1)},z0=(e,t,r)=>{const{vnode:o,slots:n}=e;let i=!0,a=tt;if(o.shapeFlag&32){const l=t._;l?r&&l===1?i=!1:(St(n,t),!r&&l===1&&delete n._):(i=!t.$stable,ph(t,n)),a=t}else t&&(mh(e,t),a={default:1});if(i)for(const l in n)!hh(l)&&!(l in a)&&delete n[l]};function Cr(e,t){const r=zt;if(r===null)return e;const o=Oa(r)||r.proxy,n=e.dirs||(e.dirs=[]);for(let i=0;iql(f,t&&(Pe(t)?t[h]:t),r,o,n));return}if(ii(o)&&!n)return;const i=o.shapeFlag&4?Oa(o.component)||o.component.proxy:o.el,a=n?null:i,{i:l,r:s}=e,d=t&&t.r,c=l.refs===tt?l.refs={}:l.refs,u=l.setupState;if(d!=null&&d!==s&&(ft(d)?(c[d]=null,Ve(u,d)&&(u[d]=null)):wt(d)&&(d.value=null)),Ie(s))Wr(s,l,12,[a,c]);else{const f=ft(s),h=wt(s);if(f||h){const p=()=>{if(e.f){const b=f?c[s]:s.value;n?Pe(b)&&Ms(b,i):Pe(b)?b.includes(i)||b.push(i):f?(c[s]=[i],Ve(u,s)&&(u[s]=c[s])):(s.value=[i],e.k&&(c[e.k]=s.value))}else f?(c[s]=a,Ve(u,s)&&(u[s]=a)):wt(s)&&(s.value=a,e.k&&(c[e.k]=a))};a?(p.id=-1,kt(p,r)):p()}}}const kt=c0;function I0(e){return M0(e)}function M0(e,t){const r=gb();r.__VUE__=!0;const{insert:o,remove:n,patchProp:i,createElement:a,createText:l,createComment:s,setText:d,setElementText:c,parentNode:u,nextSibling:f,setScopeId:h=ir,cloneNode:p,insertStaticContent:b}=e,g=(C,k,H,U=null,X=null,ne=null,le=!1,Y=null,J=!!k.dynamicChildren)=>{if(C===k)return;C&&!fo(C,k)&&(U=ce(C),$e(C,X,ne,!0),C=null),k.patchFlag===-2&&(J=!1,k.dynamicChildren=null);const{type:Q,ref:ve,shapeFlag:pe}=k;switch(Q){case ec:v(C,k,H,U);break;case Lt:w(C,k,H,U);break;case Xi:C==null&&$(k,H,U,le);break;case ot:N(C,k,H,U,X,ne,le,Y,J);break;default:pe&1?E(C,k,H,U,X,ne,le,Y,J):pe&6?B(C,k,H,U,X,ne,le,Y,J):(pe&64||pe&128)&&Q.process(C,k,H,U,X,ne,le,Y,J,xe)}ve!=null&&X&&ql(ve,C&&C.ref,ne,k||C,!k)},v=(C,k,H,U)=>{if(C==null)o(k.el=l(k.children),H,U);else{const X=k.el=C.el;k.children!==C.children&&d(X,k.children)}},w=(C,k,H,U)=>{C==null?o(k.el=s(k.children||""),H,U):k.el=C.el},$=(C,k,H,U)=>{[C.el,C.anchor]=b(C.children,k,H,U,C.el,C.anchor)},x=({el:C,anchor:k},H,U)=>{let X;for(;C&&C!==k;)X=f(C),o(C,H,U),C=X;o(k,H,U)},S=({el:C,anchor:k})=>{let H;for(;C&&C!==k;)H=f(C),n(C),C=H;n(k)},E=(C,k,H,U,X,ne,le,Y,J)=>{le=le||k.type==="svg",C==null?y(k,H,U,X,ne,le,Y,J):P(C,k,X,ne,le,Y,J)},y=(C,k,H,U,X,ne,le,Y)=>{let J,Q;const{type:ve,props:pe,shapeFlag:me,transition:we,patchFlag:De,dirs:Ye}=C;if(C.el&&p!==void 0&&De===-1)J=C.el=p(C.el);else{if(J=C.el=a(C.type,ne,pe&&pe.is,pe),me&8?c(J,C.children):me&16&&R(C.children,J,null,U,X,ne&&ve!=="foreignObject",le,Y),Ye&&oo(C,null,U,"created"),pe){for(const Je in pe)Je!=="value"&&!Yi(Je)&&i(J,Je,null,pe[Je],ne,C.children,U,X,D);"value"in pe&&i(J,"value",null,pe.value),(Q=pe.onVnodeBeforeMount)&&Zt(Q,U,C)}_(J,C,C.scopeId,le,U)}Ye&&oo(C,null,U,"beforeMount");const Fe=(!X||X&&!X.pendingBranch)&&we&&!we.persisted;Fe&&we.beforeEnter(J),o(J,k,H),((Q=pe&&pe.onVnodeMounted)||Fe||Ye)&&kt(()=>{Q&&Zt(Q,U,C),Fe&&we.enter(J),Ye&&oo(C,null,U,"mounted")},X)},_=(C,k,H,U,X)=>{if(H&&h(C,H),U)for(let ne=0;ne{for(let Q=J;Q{const Y=k.el=C.el;let{patchFlag:J,dynamicChildren:Q,dirs:ve}=k;J|=C.patchFlag&16;const pe=C.props||tt,me=k.props||tt;let we;H&&no(H,!1),(we=me.onVnodeBeforeUpdate)&&Zt(we,H,k,C),ve&&oo(k,C,H,"beforeUpdate"),H&&no(H,!0);const De=X&&k.type!=="foreignObject";if(Q?j(C.dynamicChildren,Q,Y,H,U,De,ne):le||_e(C,k,Y,null,H,U,De,ne,!1),J>0){if(J&16)T(Y,k,pe,me,H,U,X);else if(J&2&&pe.class!==me.class&&i(Y,"class",null,me.class,X),J&4&&i(Y,"style",pe.style,me.style,X),J&8){const Ye=k.dynamicProps;for(let Fe=0;Fe{we&&Zt(we,H,k,C),ve&&oo(k,C,H,"updated")},U)},j=(C,k,H,U,X,ne,le)=>{for(let Y=0;Y{if(H!==U){for(const Y in U){if(Yi(Y))continue;const J=U[Y],Q=H[Y];J!==Q&&Y!=="value"&&i(C,Y,Q,J,le,k.children,X,ne,D)}if(H!==tt)for(const Y in H)!Yi(Y)&&!(Y in U)&&i(C,Y,H[Y],null,le,k.children,X,ne,D);"value"in U&&i(C,"value",H.value,U.value)}},N=(C,k,H,U,X,ne,le,Y,J)=>{const Q=k.el=C?C.el:l(""),ve=k.anchor=C?C.anchor:l("");let{patchFlag:pe,dynamicChildren:me,slotScopeIds:we}=k;we&&(Y=Y?Y.concat(we):we),C==null?(o(Q,H,U),o(ve,H,U),R(k.children,H,ve,X,ne,le,Y,J)):pe>0&&pe&64&&me&&C.dynamicChildren?(j(C.dynamicChildren,me,H,X,ne,le,Y),(k.key!=null||X&&k===X.subTree)&&Js(C,k,!0)):_e(C,k,H,ve,X,ne,le,Y,J)},B=(C,k,H,U,X,ne,le,Y,J)=>{k.slotScopeIds=Y,C==null?k.shapeFlag&512?X.ctx.activate(k,H,U,le,J):q(k,H,U,X,ne,le,J):A(C,k,J)},q=(C,k,H,U,X,ne,le)=>{const Y=C.component=G0(C,U,X);if(Ra(C)&&(Y.ctx.renderer=xe),Y0(Y),Y.asyncDep){if(X&&X.registerDep(Y,te),!C.el){const J=Y.subTree=ge(Lt);w(null,J,k,H)}return}te(Y,C,k,H,X,ne,le)},A=(C,k,H)=>{const U=k.component=C.component;if(a0(C,k,H))if(U.asyncDep&&!U.asyncResolved){se(U,k,H);return}else U.next=k,e0(U.update),U.update();else k.component=C.component,k.el=C.el,U.vnode=k},te=(C,k,H,U,X,ne,le)=>{const Y=()=>{if(C.isMounted){let{next:ve,bu:pe,u:me,parent:we,vnode:De}=C,Ye=ve,Fe;no(C,!1),ve?(ve.el=De.el,se(C,ve,le)):ve=De,pe&&tn(pe),(Fe=ve.props&&ve.props.onVnodeBeforeUpdate)&&Zt(Fe,we,ve,De),no(C,!0);const Je=al(C),re=C.subTree;C.subTree=Je,g(re,Je,u(re.el),ce(re),C,X,ne),ve.el=Je.el,Ye===null&&l0(C,Je.el),me&&kt(me,X),(Fe=ve.props&&ve.props.onVnodeUpdated)&&kt(()=>Zt(Fe,we,ve,De),X)}else{let ve;const{el:pe,props:me}=k,{bm:we,m:De,parent:Ye}=C,Fe=ii(k);if(no(C,!1),we&&tn(we),!Fe&&(ve=me&&me.onVnodeBeforeMount)&&Zt(ve,Ye,k),no(C,!0),pe&&Z){const Je=()=>{C.subTree=al(C),Z(pe,C.subTree,C,X,null)};Fe?k.type.__asyncLoader().then(()=>!C.isUnmounted&&Je()):Je()}else{const Je=C.subTree=al(C);g(null,Je,H,U,C,X,ne),k.el=Je.el}if(De&&kt(De,X),!Fe&&(ve=me&&me.onVnodeMounted)){const Je=k;kt(()=>Zt(ve,Ye,Je),X)}k.shapeFlag&256&&C.a&&kt(C.a,X),C.isMounted=!0,k=H=U=null}},J=C.effect=new Fs(Y,()=>Jf(C.update),C.scope),Q=C.update=J.run.bind(J);Q.id=C.uid,no(C,!0),Q()},se=(C,k,H)=>{k.component=C;const U=C.vnode.props;C.vnode=k,C.next=null,T0(C,k.props,U,H),z0(C,k.children,H),bn(),Us(void 0,C.update),xn()},_e=(C,k,H,U,X,ne,le,Y,J=!1)=>{const Q=C&&C.children,ve=C?C.shapeFlag:0,pe=k.children,{patchFlag:me,shapeFlag:we}=k;if(me>0){if(me&128){Re(Q,pe,H,U,X,ne,le,Y,J);return}else if(me&256){Ae(Q,pe,H,U,X,ne,le,Y,J);return}}we&8?(ve&16&&D(Q,X,ne),pe!==Q&&c(H,pe)):ve&16?we&16?Re(Q,pe,H,U,X,ne,le,Y,J):D(Q,X,ne,!0):(ve&8&&c(H,""),we&16&&R(pe,H,U,X,ne,le,Y,J))},Ae=(C,k,H,U,X,ne,le,Y,J)=>{C=C||Qo,k=k||Qo;const Q=C.length,ve=k.length,pe=Math.min(Q,ve);let me;for(me=0;meve?D(C,X,ne,!0,!1,pe):R(k,H,U,X,ne,le,Y,J,pe)},Re=(C,k,H,U,X,ne,le,Y,J)=>{let Q=0;const ve=k.length;let pe=C.length-1,me=ve-1;for(;Q<=pe&&Q<=me;){const we=C[Q],De=k[Q]=J?Hr(k[Q]):pr(k[Q]);if(fo(we,De))g(we,De,H,null,X,ne,le,Y,J);else break;Q++}for(;Q<=pe&&Q<=me;){const we=C[pe],De=k[me]=J?Hr(k[me]):pr(k[me]);if(fo(we,De))g(we,De,H,null,X,ne,le,Y,J);else break;pe--,me--}if(Q>pe){if(Q<=me){const we=me+1,De=weme)for(;Q<=pe;)$e(C[Q],X,ne,!0),Q++;else{const we=Q,De=Q,Ye=new Map;for(Q=De;Q<=me;Q++){const Ue=k[Q]=J?Hr(k[Q]):pr(k[Q]);Ue.key!=null&&Ye.set(Ue.key,Q)}let Fe,Je=0;const re=me-De+1;let he=!1,Se=0;const Ne=new Array(re);for(Q=0;Q=re){$e(Ue,X,ne,!0);continue}let dt;if(Ue.key!=null)dt=Ye.get(Ue.key);else for(Fe=De;Fe<=me;Fe++)if(Ne[Fe-De]===0&&fo(Ue,k[Fe])){dt=Fe;break}dt===void 0?$e(Ue,X,ne,!0):(Ne[dt-De]=Q+1,dt>=Se?Se=dt:he=!0,g(Ue,k[dt],H,null,X,ne,le,Y,J),Je++)}const rt=he?B0(Ne):Qo;for(Fe=rt.length-1,Q=re-1;Q>=0;Q--){const Ue=De+Q,dt=k[Ue],Qe=Ue+1{const{el:ne,type:le,transition:Y,children:J,shapeFlag:Q}=C;if(Q&6){Ee(C.component.subTree,k,H,U);return}if(Q&128){C.suspense.move(k,H,U);return}if(Q&64){le.move(C,k,H,xe);return}if(le===ot){o(ne,k,H);for(let pe=0;peY.enter(ne),X);else{const{leave:pe,delayLeave:me,afterLeave:we}=Y,De=()=>o(ne,k,H),Ye=()=>{pe(ne,()=>{De(),we&&we()})};me?me(ne,De,Ye):Ye()}else o(ne,k,H)},$e=(C,k,H,U=!1,X=!1)=>{const{type:ne,props:le,ref:Y,children:J,dynamicChildren:Q,shapeFlag:ve,patchFlag:pe,dirs:me}=C;if(Y!=null&&ql(Y,null,H,C,!0),ve&256){k.ctx.deactivate(C);return}const we=ve&1&&me,De=!ii(C);let Ye;if(De&&(Ye=le&&le.onVnodeBeforeUnmount)&&Zt(Ye,k,C),ve&6)V(C.component,H,U);else{if(ve&128){C.suspense.unmount(H,U);return}we&&oo(C,null,k,"beforeUnmount"),ve&64?C.type.remove(C,k,H,X,xe,U):Q&&(ne!==ot||pe>0&&pe&64)?D(Q,k,H,!1,!0):(ne===ot&&pe&384||!X&&ve&16)&&D(J,k,H),U&&it(C)}(De&&(Ye=le&&le.onVnodeUnmounted)||we)&&kt(()=>{Ye&&Zt(Ye,k,C),we&&oo(C,null,k,"unmounted")},H)},it=C=>{const{type:k,el:H,anchor:U,transition:X}=C;if(k===ot){O(H,U);return}if(k===Xi){S(C);return}const ne=()=>{n(H),X&&!X.persisted&&X.afterLeave&&X.afterLeave()};if(C.shapeFlag&1&&X&&!X.persisted){const{leave:le,delayLeave:Y}=X,J=()=>le(H,ne);Y?Y(C.el,ne,J):J()}else ne()},O=(C,k)=>{let H;for(;C!==k;)H=f(C),n(C),C=H;n(k)},V=(C,k,H)=>{const{bum:U,scope:X,update:ne,subTree:le,um:Y}=C;U&&tn(U),X.stop(),ne&&(ne.active=!1,$e(le,C,k,H)),Y&&kt(Y,k),kt(()=>{C.isUnmounted=!0},k),k&&k.pendingBranch&&!k.isUnmounted&&C.asyncDep&&!C.asyncResolved&&C.suspenseId===k.pendingId&&(k.deps--,k.deps===0&&k.resolve())},D=(C,k,H,U=!1,X=!1,ne=0)=>{for(let le=ne;leC.shapeFlag&6?ce(C.component.subTree):C.shapeFlag&128?C.suspense.next():f(C.anchor||C.el),ue=(C,k,H)=>{C==null?k._vnode&&$e(k._vnode,null,null,!0):g(k._vnode||null,C,k,null,null,null,H),th(),k._vnode=C},xe={p:g,um:$e,m:Ee,r:it,mt:q,mc:R,pc:_e,pbc:j,n:ce,o:e};let G,Z;return t&&([G,Z]=t(xe)),{render:ue,hydrate:G,createApp:O0(ue,G)}}function no({effect:e,update:t},r){e.allowRecurse=t.allowRecurse=r}function Js(e,t,r=!1){const o=e.children,n=t.children;if(Pe(o)&&Pe(n))for(let i=0;i>1,e[r[l]]0&&(t[o]=r[i-1]),r[i]=o)}}for(i=r.length,a=r[i-1];i-- >0;)r[i]=a,a=t[a];return r}const L0=e=>e.__isTeleport,Un=e=>e&&(e.disabled||e.disabled===""),bd=e=>typeof SVGElement!="undefined"&&e instanceof SVGElement,Gl=(e,t)=>{const r=e&&e.to;return ft(r)?t?t(r):null:r},D0={__isTeleport:!0,process(e,t,r,o,n,i,a,l,s,d){const{mc:c,pc:u,pbc:f,o:{insert:h,querySelector:p,createText:b,createComment:g}}=d,v=Un(t.props);let{shapeFlag:w,children:$,dynamicChildren:x}=t;if(e==null){const S=t.el=b(""),E=t.anchor=b("");h(S,r,o),h(E,r,o);const y=t.target=Gl(t.props,p),_=t.targetAnchor=b("");y&&(h(_,y),a=a||bd(y));const R=(P,j)=>{w&16&&c($,P,j,n,i,a,l,s)};v?R(r,E):y&&R(y,_)}else{t.el=e.el;const S=t.anchor=e.anchor,E=t.target=e.target,y=t.targetAnchor=e.targetAnchor,_=Un(e.props),R=_?r:E,P=_?S:y;if(a=a||bd(E),x?(f(e.dynamicChildren,x,R,n,i,a,l),Js(e,t,!0)):s||u(e,t,R,P,n,i,a,l,!1),v)_||Li(t,r,S,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const j=t.target=Gl(t.props,p);j&&Li(t,j,null,d,0)}else _&&Li(t,E,y,d,1)}},remove(e,t,r,o,{um:n,o:{remove:i}},a){const{shapeFlag:l,children:s,anchor:d,targetAnchor:c,target:u,props:f}=e;if(u&&i(c),(a||!Un(f))&&(i(d),l&16))for(let h=0;h0?yo||Qo:null,H0(),la>0&&yo&&yo.push(e),e}function Et(e,t,r,o,n,i){return yh(Le(e,t,r,o,n,i,!0))}function mo(e,t,r,o,n){return yh(ge(e,t,r,o,n,!0))}function an(e){return e?e.__v_isVNode===!0:!1}function fo(e,t){return e.type===t.type&&e.key===t.key}const Aa="__vInternal",wh=({key:e})=>e!=null?e:null,Zi=({ref:e,ref_key:t,ref_for:r})=>e!=null?ft(e)||wt(e)||Ie(e)?{i:zt,r:e,k:t,f:!!r}:e:null;function Le(e,t=null,r=null,o=0,n=null,i=e===ot?0:1,a=!1,l=!1){const s={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&wh(t),ref:t&&Zi(t),scopeId:Ea,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:o,dynamicProps:n,dynamicChildren:null,appContext:null};return l?(tc(s,r),i&128&&e.normalize(s)):r&&(s.shapeFlag|=ft(r)?8:16),la>0&&!a&&yo&&(s.patchFlag>0||i&6)&&s.patchFlag!==32&&yo.push(s),s}const ge=j0;function j0(e,t=null,r=null,o=0,n=null,i=!1){if((!e||e===xh)&&(e=Lt),an(e)){const l=lr(e,t,!0);return r&&tc(l,r),l}if(Q0(e)&&(e=e.__vccOpts),t){t=N0(t);let{class:l,style:s}=t;l&&!ft(l)&&(t.class=ya(l)),pt(s)&&(Uf(s)&&!Pe(s)&&(s=St({},s)),t.style=Os(s))}const a=ft(e)?1:s0(e)?128:L0(e)?64:pt(e)?4:Ie(e)?2:0;return Le(e,t,r,o,n,a,i,!0)}function N0(e){return e?Uf(e)||Aa in e?St({},e):e:null}function lr(e,t,r=!1){const{props:o,ref:n,patchFlag:i,children:a}=e,l=t?Xr(o||{},t):o;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&wh(l),ref:t&&t.ref?r&&n?Pe(n)?n.concat(Zi(t)):[n,Zi(t)]:Zi(t):n,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ot?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&lr(e.ssContent),ssFallback:e.ssFallback&&lr(e.ssFallback),el:e.el,anchor:e.anchor}}function sr(e=" ",t=0){return ge(ec,null,e,t)}function Sh(e,t){const r=ge(Xi,null,e);return r.staticCount=t,r}function Yl(e="",t=!1){return t?(st(),mo(Lt,null,e)):ge(Lt,null,e)}function pr(e){return e==null||typeof e=="boolean"?ge(Lt):Pe(e)?ge(ot,null,e.slice()):typeof e=="object"?Hr(e):ge(ec,null,String(e))}function Hr(e){return e.el===null||e.memo?e:lr(e)}function tc(e,t){let r=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(Pe(t))r=16;else if(typeof t=="object")if(o&65){const n=t.default;n&&(n._c&&(n._d=!1),tc(e,n()),n._c&&(n._d=!0));return}else{r=32;const n=t._;!n&&!(Aa in t)?t._ctx=zt:n===3&&zt&&(zt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ie(t)?(t={default:t,_ctx:zt},r=32):(t=String(t),o&64?(r=16,t=[sr(t)]):r=8);e.children=t,e.shapeFlag|=r}function Xr(...e){const t={};for(let r=0;rt(a,l,void 0,i&&i[l]));else{const a=Object.keys(e);n=new Array(a.length);for(let l=0,s=a.length;lan(t)?!(t.type===Lt||t.type===ot&&!_h(t.children)):!0)?e:null}const Xl=e=>e?$h(e)?Oa(e)||e.proxy:Xl(e.parent):null,sa=St(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Xl(e.parent),$root:e=>Xl(e.root),$emit:e=>e.emit,$options:e=>dh(e),$forceUpdate:e=>()=>Jf(e.update),$nextTick:e=>br.bind(e.proxy),$watch:e=>d0.bind(e)}),K0={get({_:e},t){const{ctx:r,setupState:o,data:n,props:i,accessCache:a,type:l,appContext:s}=e;let d;if(t[0]!=="$"){const h=a[t];if(h!==void 0)switch(h){case 1:return o[t];case 2:return n[t];case 4:return r[t];case 3:return i[t]}else{if(o!==tt&&Ve(o,t))return a[t]=1,o[t];if(n!==tt&&Ve(n,t))return a[t]=2,n[t];if((d=e.propsOptions[0])&&Ve(d,t))return a[t]=3,i[t];if(r!==tt&&Ve(r,t))return a[t]=4,r[t];Vl&&(a[t]=0)}}const c=sa[t];let u,f;if(c)return t==="$attrs"&&Kt(e,"get",t),c(e);if((u=l.__cssModules)&&(u=u[t]))return u;if(r!==tt&&Ve(r,t))return a[t]=4,r[t];if(f=s.config.globalProperties,Ve(f,t))return f[t]},set({_:e},t,r){const{data:o,setupState:n,ctx:i}=e;return n!==tt&&Ve(n,t)?(n[t]=r,!0):o!==tt&&Ve(o,t)?(o[t]=r,!0):Ve(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=r,!0)},has({_:{data:e,setupState:t,accessCache:r,ctx:o,appContext:n,propsOptions:i}},a){let l;return!!r[a]||e!==tt&&Ve(e,a)||t!==tt&&Ve(t,a)||(l=i[0])&&Ve(l,a)||Ve(o,a)||Ve(sa,a)||Ve(n.config.globalProperties,a)},defineProperty(e,t,r){return r.get!=null?e._.accessCache[t]=0:Ve(r,"value")&&this.set(e,t,r.value,null),Reflect.defineProperty(e,t,r)}},U0=vh();let q0=0;function G0(e,t,r){const o=e.type,n=(t?t.appContext:e.appContext)||U0,i={uid:q0++,vnode:e,type:o,parent:t,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,scope:new bb(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(n.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:fh(o,n),emitsOptions:oh(o,n),emit:null,emitted:null,propsDefaults:tt,inheritAttrs:o.inheritAttrs,ctx:tt,data:tt,props:tt,attrs:tt,slots:tt,refs:tt,setupState:tt,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=o0.bind(null,i),e.ce&&e.ce(i),i}let yt=null;const Zr=()=>yt||zt,ln=e=>{yt=e,e.scope.on()},wo=()=>{yt&&yt.scope.off(),yt=null};function $h(e){return e.vnode.shapeFlag&4}let ai=!1;function Y0(e,t=!1){ai=t;const{props:r,children:o}=e.vnode,n=$h(e);k0(e,r,n,t),R0(e,o);const i=n?X0(e,t):void 0;return ai=!1,i}function X0(e,t){const r=e.type;e.accessCache=Object.create(null),e.proxy=oa(new Proxy(e.ctx,K0));const{setup:o}=r;if(o){const n=e.setupContext=o.length>1?J0(e):null;ln(e),bn();const i=Wr(o,e,0,[e.props,n]);if(xn(),wo(),Af(i)){if(i.then(wo,wo),t)return i.then(a=>{wd(e,a,t)}).catch(a=>{ka(a,e,0)});e.asyncDep=i}else wd(e,i,t)}else Ph(e,t)}function wd(e,t,r){Ie(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:pt(t)&&(e.setupState=Xf(t)),Ph(e,r)}let Sd;function Ph(e,t,r){const o=e.type;if(!e.render){if(!t&&Sd&&!o.render){const n=o.template;if(n){const{isCustomElement:i,compilerOptions:a}=e.appContext.config,{delimiters:l,compilerOptions:s}=o,d=St(St({isCustomElement:i,delimiters:l},a),s);o.render=Sd(n,d)}}e.render=o.render||ir}ln(e),bn(),w0(e),xn(),wo()}function Z0(e){return new Proxy(e.attrs,{get(t,r){return Kt(e,"get","$attrs"),t[r]}})}function J0(e){const t=o=>{e.exposed=o||{}};let r;return{get attrs(){return r||(r=Z0(e))},slots:e.slots,emit:e.emit,expose:t}}function Oa(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(Xf(oa(e.exposed)),{get(t,r){if(r in t)return t[r];if(r in sa)return sa[r](e)}}))}function Zl(e){return Ie(e)&&e.displayName||e.name}function Q0(e){return Ie(e)&&"__vccOpts"in e}const L=(e,t)=>Zb(e,t,ai);function m(e,t,r){const o=arguments.length;return o===2?pt(t)&&!Pe(t)?an(t)?ge(e,null,[t]):ge(e,t):ge(e,null,t):(o>3?r=Array.prototype.slice.call(arguments,2):o===3&&an(r)&&(r=[r]),ge(e,t,r))}const e1="3.2.33",t1="http://www.w3.org/2000/svg",ho=typeof document!="undefined"?document:null,_d=ho&&ho.createElement("template"),r1={insert:(e,t,r)=>{t.insertBefore(e,r||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,r,o)=>{const n=t?ho.createElementNS(t1,e):ho.createElement(e,r?{is:r}:void 0);return e==="select"&&o&&o.multiple!=null&&n.setAttribute("multiple",o.multiple),n},createText:e=>ho.createTextNode(e),createComment:e=>ho.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>ho.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},cloneNode(e){const t=e.cloneNode(!0);return"_value"in e&&(t._value=e._value),t},insertStaticContent(e,t,r,o,n,i){const a=r?r.previousSibling:t.lastChild;if(n&&(n===i||n.nextSibling))for(;t.insertBefore(n.cloneNode(!0),r),!(n===i||!(n=n.nextSibling)););else{_d.innerHTML=o?`${e}`:e;const l=_d.content;if(o){const s=l.firstChild;for(;s.firstChild;)l.appendChild(s.firstChild);l.removeChild(s)}t.insertBefore(l,r)}return[a?a.nextSibling:t.firstChild,r?r.previousSibling:t.lastChild]}};function o1(e,t,r){const o=e._vtc;o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):r?e.setAttribute("class",t):e.className=t}function n1(e,t,r){const o=e.style,n=ft(r);if(r&&!n){for(const i in r)Jl(o,i,r[i]);if(t&&!ft(t))for(const i in t)r[i]==null&&Jl(o,i,"")}else{const i=o.display;n?t!==r&&(o.cssText=r):t&&e.removeAttribute("style"),"_vod"in e&&(o.display=i)}}const $d=/\s*!important$/;function Jl(e,t,r){if(Pe(r))r.forEach(o=>Jl(e,t,o));else if(r==null&&(r=""),t.startsWith("--"))e.setProperty(t,r);else{const o=i1(e,t);$d.test(r)?e.setProperty(Po(o),r.replace($d,""),"important"):e[o]=r}}const Pd=["Webkit","Moz","ms"],dl={};function i1(e,t){const r=dl[t];if(r)return r;let o=vr(t);if(o!=="filter"&&o in e)return dl[t]=o;o=$a(o);for(let n=0;n{let e=Date.now,t=!1;if(typeof window!="undefined"){Date.now()>document.createEvent("Event").timeStamp&&(e=()=>performance.now());const r=navigator.userAgent.match(/firefox\/(\d+)/i);t=!!(r&&Number(r[1])<=53)}return[e,t]})();let Ql=0;const c1=Promise.resolve(),d1=()=>{Ql=0},u1=()=>Ql||(c1.then(d1),Ql=kh());function qo(e,t,r,o){e.addEventListener(t,r,o)}function f1(e,t,r,o){e.removeEventListener(t,r,o)}function h1(e,t,r,o,n=null){const i=e._vei||(e._vei={}),a=i[t];if(o&&a)a.value=o;else{const[l,s]=p1(t);if(o){const d=i[t]=m1(o,n);qo(e,l,d,s)}else a&&(f1(e,l,a,s),i[t]=void 0)}}const Td=/(?:Once|Passive|Capture)$/;function p1(e){let t;if(Td.test(e)){t={};let r;for(;r=e.match(Td);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[Po(e.slice(2)),t]}function m1(e,t){const r=o=>{const n=o.timeStamp||kh();(s1||n>=r.attached-1)&&Jt(v1(o,r.value),t,5,[o])};return r.value=e,r.attached=u1(),r}function v1(e,t){if(Pe(t)){const r=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{r.call(e),e._stopped=!0},t.map(o=>n=>!n._stopped&&o&&o(n))}else return t}const Ed=/^on[a-z]/,g1=(e,t,r,o,n=!1,i,a,l,s)=>{t==="class"?o1(e,o,n):t==="style"?n1(e,r,o):wa(t)?Is(t)||h1(e,t,r,o,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):b1(e,t,o,n))?l1(e,t,o,i,a,l,s):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),a1(e,t,o,n))};function b1(e,t,r,o){return o?!!(t==="innerHTML"||t==="textContent"||t in e&&Ed.test(t)&&Ie(r)):t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA"||Ed.test(t)&&ft(r)?!1:t in e}const Ir="transition",En="animation",At=(e,{slots:t})=>m(ah,Eh(e),t);At.displayName="Transition";const Th={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},x1=At.props=St({},ah.props,Th),io=(e,t=[])=>{Pe(e)?e.forEach(r=>r(...t)):e&&e(...t)},Rd=e=>e?Pe(e)?e.some(t=>t.length>1):e.length>1:!1;function Eh(e){const t={};for(const T in e)T in Th||(t[T]=e[T]);if(e.css===!1)return t;const{name:r="v",type:o,duration:n,enterFromClass:i=`${r}-enter-from`,enterActiveClass:a=`${r}-enter-active`,enterToClass:l=`${r}-enter-to`,appearFromClass:s=i,appearActiveClass:d=a,appearToClass:c=l,leaveFromClass:u=`${r}-leave-from`,leaveActiveClass:f=`${r}-leave-active`,leaveToClass:h=`${r}-leave-to`}=e,p=C1(n),b=p&&p[0],g=p&&p[1],{onBeforeEnter:v,onEnter:w,onEnterCancelled:$,onLeave:x,onLeaveCancelled:S,onBeforeAppear:E=v,onAppear:y=w,onAppearCancelled:_=$}=t,R=(T,N,B)=>{so(T,N?c:l),so(T,N?d:a),B&&B()},P=(T,N)=>{so(T,h),so(T,f),N&&N()},j=T=>(N,B)=>{const q=T?y:w,A=()=>R(N,T,B);io(q,[N,A]),zd(()=>{so(N,T?s:i),$r(N,T?c:l),Rd(q)||Ad(N,o,b,A)})};return St(t,{onBeforeEnter(T){io(v,[T]),$r(T,i),$r(T,a)},onBeforeAppear(T){io(E,[T]),$r(T,s),$r(T,d)},onEnter:j(!1),onAppear:j(!0),onLeave(T,N){const B=()=>P(T,N);$r(T,u),zh(),$r(T,f),zd(()=>{so(T,u),$r(T,h),Rd(x)||Ad(T,o,g,B)}),io(x,[T,B])},onEnterCancelled(T){R(T,!1),io($,[T])},onAppearCancelled(T){R(T,!0),io(_,[T])},onLeaveCancelled(T){P(T),io(S,[T])}})}function C1(e){if(e==null)return null;if(pt(e))return[ul(e.enter),ul(e.leave)];{const t=ul(e);return[t,t]}}function ul(e){return ra(e)}function $r(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.add(r)),(e._vtc||(e._vtc=new Set)).add(t)}function so(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const{_vtc:r}=e;r&&(r.delete(t),r.size||(e._vtc=void 0))}function zd(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let y1=0;function Ad(e,t,r,o){const n=e._endId=++y1,i=()=>{n===e._endId&&o()};if(r)return setTimeout(i,r);const{type:a,timeout:l,propCount:s}=Rh(e,t);if(!a)return o();const d=a+"end";let c=0;const u=()=>{e.removeEventListener(d,f),i()},f=h=>{h.target===e&&++c>=s&&u()};setTimeout(()=>{c(r[p]||"").split(", "),n=o(Ir+"Delay"),i=o(Ir+"Duration"),a=Od(n,i),l=o(En+"Delay"),s=o(En+"Duration"),d=Od(l,s);let c=null,u=0,f=0;t===Ir?a>0&&(c=Ir,u=a,f=i.length):t===En?d>0&&(c=En,u=d,f=s.length):(u=Math.max(a,d),c=u>0?a>d?Ir:En:null,f=c?c===Ir?i.length:s.length:0);const h=c===Ir&&/\b(transform|all)(,|$)/.test(r[Ir+"Property"]);return{type:c,timeout:u,propCount:f,hasTransform:h}}function Od(e,t){for(;e.lengthId(r)+Id(e[o])))}function Id(e){return Number(e.slice(0,-1).replace(",","."))*1e3}function zh(){return document.body.offsetHeight}const Ah=new WeakMap,Oh=new WeakMap,w1={name:"TransitionGroup",props:St({},x1,{tag:String,moveClass:String}),setup(e,{slots:t}){const r=Zr(),o=ih();let n,i;return Ys(()=>{if(!n.length)return;const a=e.moveClass||`${e.name||"v"}-move`;if(!P1(n[0].el,r.vnode.el,a))return;n.forEach(S1),n.forEach(_1);const l=n.filter($1);zh(),l.forEach(s=>{const d=s.el,c=d.style;$r(d,a),c.transform=c.webkitTransform=c.transitionDuration="";const u=d._moveCb=f=>{f&&f.target!==d||(!f||/transform$/.test(f.propertyName))&&(d.removeEventListener("transitionend",u),d._moveCb=null,so(d,a))};d.addEventListener("transitionend",u)})}),()=>{const a=Ge(e),l=Eh(a);let s=a.tag||ot;n=i,i=t.default?Gs(t.default()):[];for(let d=0;d{a.split(/\s+/).forEach(l=>l&&o.classList.remove(l))}),r.split(/\s+/).forEach(a=>a&&o.classList.add(a)),o.style.display="none";const n=t.nodeType===1?t:t.parentNode;n.appendChild(o);const{hasTransform:i}=Rh(o);return n.removeChild(o),i}const Md=e=>{const t=e.props["onUpdate:modelValue"];return Pe(t)?r=>tn(t,r):t};function k1(e){e.target.composing=!0}function Bd(e){const t=e.target;t.composing&&(t.composing=!1,T1(t,"input"))}function T1(e,t){const r=document.createEvent("HTMLEvents");r.initEvent(t,!0,!0),e.dispatchEvent(r)}const aO={created(e,{modifiers:{lazy:t,trim:r,number:o}},n){e._assign=Md(n);const i=o||n.props&&n.props.type==="number";qo(e,t?"change":"input",a=>{if(a.target.composing)return;let l=e.value;r?l=l.trim():i&&(l=ra(l)),e._assign(l)}),r&&qo(e,"change",()=>{e.value=e.value.trim()}),t||(qo(e,"compositionstart",k1),qo(e,"compositionend",Bd),qo(e,"change",Bd))},mounted(e,{value:t}){e.value=t==null?"":t},beforeUpdate(e,{value:t,modifiers:{lazy:r,trim:o,number:n}},i){if(e._assign=Md(i),e.composing||document.activeElement===e&&(r||o&&e.value.trim()===t||(n||e.type==="number")&&ra(e.value)===t))return;const a=t==null?"":t;e.value!==a&&(e.value=a)}},E1=["ctrl","shift","alt","meta"],R1={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>E1.some(r=>e[`${r}Key`]&&!t.includes(r))},Hn=(e,t)=>(r,...o)=>{for(let n=0;nr=>{if(!("key"in r))return;const o=Po(r.key);if(t.some(n=>n===o||z1[n]===o))return e(r)},li={beforeMount(e,{value:t},{transition:r}){e._vod=e.style.display==="none"?"":e.style.display,r&&t?r.beforeEnter(e):Rn(e,t)},mounted(e,{value:t},{transition:r}){r&&t&&r.enter(e)},updated(e,{value:t,oldValue:r},{transition:o}){!t!=!r&&(o?t?(o.beforeEnter(e),Rn(e,!0),o.enter(e)):o.leave(e,()=>{Rn(e,!1)}):Rn(e,t))},beforeUnmount(e,{value:t}){Rn(e,t)}};function Rn(e,t){e.style.display=t?e._vod:"none"}const A1=St({patchProp:g1},r1);let Ld;function O1(){return Ld||(Ld=I0(A1))}const I1=(...e)=>{const t=O1().createApp(...e),{mount:r}=t;return t.mount=o=>{const n=M1(o);if(!n)return;const i=t._component;!Ie(i)&&!i.render&&!i.template&&(i.template=n.innerHTML),n.innerHTML="";const a=r(n,!1,n instanceof SVGElement);return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),a},t};function M1(e){return ft(e)?document.querySelector(e):e}const B1="modulepreload",Dd={},L1="/",Yt=function(t,r){return!r||r.length===0?t():Promise.all(r.map(o=>{if(o=`${L1}${o}`,o in Dd)return;Dd[o]=!0;const n=o.endsWith(".css"),i=n?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${i}`))return;const a=document.createElement("link");if(a.rel=n?"stylesheet":B1,n||(a.as="script",a.crossOrigin=""),a.href=o,document.head.appendChild(a),n)return new Promise((l,s)=>{a.addEventListener("load",l),a.addEventListener("error",()=>s(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t())};function D1(){return Ih().__VUE_DEVTOOLS_GLOBAL_HOOK__}function Ih(){return typeof navigator!="undefined"&&typeof window!="undefined"?window:typeof global!="undefined"?global:{}}const F1=typeof Proxy=="function",H1="devtools-plugin:setup",j1="plugin:settings:set";let Oo,es;function N1(){var e;return Oo!==void 0||(typeof window!="undefined"&&window.performance?(Oo=!0,es=window.performance):typeof global!="undefined"&&((e=global.perf_hooks)===null||e===void 0?void 0:e.performance)?(Oo=!0,es=global.perf_hooks.performance):Oo=!1),Oo}function W1(){return N1()?es.now():Date.now()}class V1{constructor(t,r){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=t,this.hook=r;const o={};if(t.settings)for(const a in t.settings){const l=t.settings[a];o[a]=l.defaultValue}const n=`__vue-devtools-plugin-settings__${t.id}`;let i=Object.assign({},o);try{const a=localStorage.getItem(n),l=JSON.parse(a);Object.assign(i,l)}catch{}this.fallbacks={getSettings(){return i},setSettings(a){try{localStorage.setItem(n,JSON.stringify(a))}catch{}i=a},now(){return W1()}},r&&r.on(j1,(a,l)=>{a===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(a,l)=>this.target?this.target.on[l]:(...s)=>{this.onQueue.push({method:l,args:s})}}),this.proxiedTarget=new Proxy({},{get:(a,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...s)=>(this.targetQueue.push({method:l,args:s,resolve:()=>{}}),this.fallbacks[l](...s)):(...s)=>new Promise(d=>{this.targetQueue.push({method:l,args:s,resolve:d})})})}async setRealTarget(t){this.target=t;for(const r of this.onQueue)this.target.on[r.method](...r.args);for(const r of this.targetQueue)r.resolve(await this.target[r.method](...r.args))}}function K1(e,t){const r=e,o=Ih(),n=D1(),i=F1&&r.enableEarlyProxy;if(n&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!i))n.emit(H1,e,t);else{const a=i?new V1(r,n):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:r,setupFn:t,proxy:a}),a&&t(a.proxiedTarget)}}/*! - * vue-router v4.0.14 - * (c) 2022 Eduardo San Martin Morote - * @license MIT - */const Mh=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",Cn=e=>Mh?Symbol(e):"_vr_"+e,U1=Cn("rvlm"),Fd=Cn("rvd"),Ia=Cn("r"),oc=Cn("rl"),ts=Cn("rvl"),Go=typeof window!="undefined";function q1(e){return e.__esModule||Mh&&e[Symbol.toStringTag]==="Module"}const et=Object.assign;function fl(e,t){const r={};for(const o in t){const n=t[o];r[o]=Array.isArray(n)?n.map(e):e(n)}return r}const Gn=()=>{},G1=/\/$/,Y1=e=>e.replace(G1,"");function hl(e,t,r="/"){let o,n={},i="",a="";const l=t.indexOf("?"),s=t.indexOf("#",l>-1?l:0);return l>-1&&(o=t.slice(0,l),i=t.slice(l+1,s>-1?s:t.length),n=e(i)),s>-1&&(o=o||t.slice(0,s),a=t.slice(s,t.length)),o=Q1(o!=null?o:t,r),{fullPath:o+(i&&"?")+i+a,path:o,query:n,hash:a}}function X1(e,t){const r=t.query?e(t.query):"";return t.path+(r&&"?")+r+(t.hash||"")}function Hd(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Z1(e,t,r){const o=t.matched.length-1,n=r.matched.length-1;return o>-1&&o===n&&sn(t.matched[o],r.matched[n])&&Bh(t.params,r.params)&&e(t.query)===e(r.query)&&t.hash===r.hash}function sn(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Bh(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(!J1(e[r],t[r]))return!1;return!0}function J1(e,t){return Array.isArray(e)?jd(e,t):Array.isArray(t)?jd(t,e):e===t}function jd(e,t){return Array.isArray(t)?e.length===t.length&&e.every((r,o)=>r===t[o]):e.length===1&&e[0]===t}function Q1(e,t){if(e.startsWith("/"))return e;if(!e)return t;const r=t.split("/"),o=e.split("/");let n=r.length-1,i,a;for(i=0;i({left:window.pageXOffset,top:window.pageYOffset});function nx(e){let t;if("el"in e){const r=e.el,o=typeof r=="string"&&r.startsWith("#"),n=typeof r=="string"?o?document.getElementById(r.slice(1)):document.querySelector(r):r;if(!n)return;t=ox(n,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function Nd(e,t){return(history.state?history.state.position-t:-1)+e}const rs=new Map;function ix(e,t){rs.set(e,t)}function ax(e){const t=rs.get(e);return rs.delete(e),t}let lx=()=>location.protocol+"//"+location.host;function Lh(e,t){const{pathname:r,search:o,hash:n}=t,i=e.indexOf("#");if(i>-1){let l=n.includes(e.slice(i))?e.slice(i).length:1,s=n.slice(l);return s[0]!=="/"&&(s="/"+s),Hd(s,"")}return Hd(r,e)+o+n}function sx(e,t,r,o){let n=[],i=[],a=null;const l=({state:f})=>{const h=Lh(e,location),p=r.value,b=t.value;let g=0;if(f){if(r.value=h,t.value=f,a&&a===p){a=null;return}g=b?f.position-b.position:0}else o(h);n.forEach(v=>{v(r.value,p,{delta:g,type:si.pop,direction:g?g>0?Yn.forward:Yn.back:Yn.unknown})})};function s(){a=r.value}function d(f){n.push(f);const h=()=>{const p=n.indexOf(f);p>-1&&n.splice(p,1)};return i.push(h),h}function c(){const{history:f}=window;!f.state||f.replaceState(et({},f.state,{scroll:Ma()}),"")}function u(){for(const f of i)f();i=[],window.removeEventListener("popstate",l),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",l),window.addEventListener("beforeunload",c),{pauseListeners:s,listen:d,destroy:u}}function Wd(e,t,r,o=!1,n=!1){return{back:e,current:t,forward:r,replaced:o,position:window.history.length,scroll:n?Ma():null}}function cx(e){const{history:t,location:r}=window,o={value:Lh(e,r)},n={value:t.state};n.value||i(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(s,d,c){const u=e.indexOf("#"),f=u>-1?(r.host&&document.querySelector("base")?e:e.slice(u))+s:lx()+e+s;try{t[c?"replaceState":"pushState"](d,"",f),n.value=d}catch(h){console.error(h),r[c?"replace":"assign"](f)}}function a(s,d){const c=et({},t.state,Wd(n.value.back,s,n.value.forward,!0),d,{position:n.value.position});i(s,c,!0),o.value=s}function l(s,d){const c=et({},n.value,t.state,{forward:s,scroll:Ma()});i(c.current,c,!0);const u=et({},Wd(o.value,s,null),{position:c.position+1},d);i(s,u,!1),o.value=s}return{location:o,state:n,push:l,replace:a}}function dx(e){e=ex(e);const t=cx(e),r=sx(e,t.state,t.location,t.replace);function o(i,a=!0){a||r.pauseListeners(),history.go(i)}const n=et({location:"",base:e,go:o,createHref:rx.bind(null,e)},t,r);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>t.state.value}),n}function ux(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),dx(e)}function fx(e){return typeof e=="string"||e&&typeof e=="object"}function Dh(e){return typeof e=="string"||typeof e=="symbol"}const Mr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Fh=Cn("nf");var Vd;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(Vd||(Vd={}));function cn(e,t){return et(new Error,{type:e,[Fh]:!0},t)}function Br(e,t){return e instanceof Error&&Fh in e&&(t==null||!!(e.type&t))}const Kd="[^/]+?",hx={sensitive:!1,strict:!1,start:!0,end:!0},px=/[.+*?^${}()[\]/\\]/g;function mx(e,t){const r=et({},hx,t),o=[];let n=r.start?"^":"";const i=[];for(const d of e){const c=d.length?[]:[90];r.strict&&!d.length&&(n+="/");for(let u=0;ut.length?t.length===1&&t[0]===40+40?1:-1:0}function gx(e,t){let r=0;const o=e.score,n=t.score;for(;r1&&(s==="*"||s==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),i.push({type:1,value:d,regexp:c,repeatable:s==="*"||s==="+",optional:s==="*"||s==="?"})):t("Invalid state to consume buffer"),d="")}function f(){d+=s}for(;l{a(w)}:Gn}function a(c){if(Dh(c)){const u=o.get(c);u&&(o.delete(c),r.splice(r.indexOf(u),1),u.children.forEach(a),u.alias.forEach(a))}else{const u=r.indexOf(c);u>-1&&(r.splice(u,1),c.record.name&&o.delete(c.record.name),c.children.forEach(a),c.alias.forEach(a))}}function l(){return r}function s(c){let u=0;for(;u=0&&(c.record.path!==r[u].record.path||!Hh(c,r[u]));)u++;r.splice(u,0,c),c.record.name&&!Ud(c)&&o.set(c.record.name,c)}function d(c,u){let f,h={},p,b;if("name"in c&&c.name){if(f=o.get(c.name),!f)throw cn(1,{location:c});b=f.record.name,h=et(Sx(u.params,f.keys.filter(w=>!w.optional).map(w=>w.name)),c.params),p=f.stringify(h)}else if("path"in c)p=c.path,f=r.find(w=>w.re.test(p)),f&&(h=f.parse(p),b=f.record.name);else{if(f=u.name?o.get(u.name):r.find(w=>w.re.test(u.path)),!f)throw cn(1,{location:c,currentLocation:u});b=f.record.name,h=et({},u.params,c.params),p=f.stringify(h)}const g=[];let v=f;for(;v;)g.unshift(v.record),v=v.parent;return{name:b,path:p,params:h,matched:g,meta:Px(g)}}return e.forEach(c=>i(c)),{addRoute:i,resolve:d,removeRoute:a,getRoutes:l,getRecordMatcher:n}}function Sx(e,t){const r={};for(const o of t)o in e&&(r[o]=e[o]);return r}function _x(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:$x(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||{}:{default:e.component}}}function $x(e){const t={},r=e.props||!1;if("component"in e)t.default=r;else for(const o in e.components)t[o]=typeof r=="boolean"?r:r[o];return t}function Ud(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Px(e){return e.reduce((t,r)=>et(t,r.meta),{})}function qd(e,t){const r={};for(const o in e)r[o]=o in t?t[o]:e[o];return r}function Hh(e,t){return t.children.some(r=>r===e||Hh(e,r))}const jh=/#/g,kx=/&/g,Tx=/\//g,Ex=/=/g,Rx=/\?/g,Nh=/\+/g,zx=/%5B/g,Ax=/%5D/g,Wh=/%5E/g,Ox=/%60/g,Vh=/%7B/g,Ix=/%7C/g,Kh=/%7D/g,Mx=/%20/g;function nc(e){return encodeURI(""+e).replace(Ix,"|").replace(zx,"[").replace(Ax,"]")}function Bx(e){return nc(e).replace(Vh,"{").replace(Kh,"}").replace(Wh,"^")}function os(e){return nc(e).replace(Nh,"%2B").replace(Mx,"+").replace(jh,"%23").replace(kx,"%26").replace(Ox,"`").replace(Vh,"{").replace(Kh,"}").replace(Wh,"^")}function Lx(e){return os(e).replace(Ex,"%3D")}function Dx(e){return nc(e).replace(jh,"%23").replace(Rx,"%3F")}function Fx(e){return e==null?"":Dx(e).replace(Tx,"%2F")}function ca(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function Hx(e){const t={};if(e===""||e==="?")return t;const o=(e[0]==="?"?e.slice(1):e).split("&");for(let n=0;ni&&os(i)):[o&&os(o)]).forEach(i=>{i!==void 0&&(t+=(t.length?"&":"")+r,i!=null&&(t+="="+i))})}return t}function jx(e){const t={};for(const r in e){const o=e[r];o!==void 0&&(t[r]=Array.isArray(o)?o.map(n=>n==null?null:""+n):o==null?o:""+o)}return t}function zn(){let e=[];function t(o){return e.push(o),()=>{const n=e.indexOf(o);n>-1&&e.splice(n,1)}}function r(){e=[]}return{add:t,list:()=>e,reset:r}}function jr(e,t,r,o,n){const i=o&&(o.enterCallbacks[n]=o.enterCallbacks[n]||[]);return()=>new Promise((a,l)=>{const s=u=>{u===!1?l(cn(4,{from:r,to:t})):u instanceof Error?l(u):fx(u)?l(cn(2,{from:t,to:u})):(i&&o.enterCallbacks[n]===i&&typeof u=="function"&&i.push(u),a())},d=e.call(o&&o.instances[n],t,r,s);let c=Promise.resolve(d);e.length<3&&(c=c.then(s)),c.catch(u=>l(u))})}function pl(e,t,r,o){const n=[];for(const i of e)for(const a in i.components){let l=i.components[a];if(!(t!=="beforeRouteEnter"&&!i.instances[a]))if(Nx(l)){const d=(l.__vccOpts||l)[t];d&&n.push(jr(d,r,o,i,a))}else{let s=l();n.push(()=>s.then(d=>{if(!d)return Promise.reject(new Error(`Couldn't resolve component "${a}" at "${i.path}"`));const c=q1(d)?d.default:d;i.components[a]=c;const f=(c.__vccOpts||c)[t];return f&&jr(f,r,o,i,a)()}))}}return n}function Nx(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Yd(e){const t=be(Ia),r=be(oc),o=L(()=>t.resolve(Me(e.to))),n=L(()=>{const{matched:s}=o.value,{length:d}=s,c=s[d-1],u=r.matched;if(!c||!u.length)return-1;const f=u.findIndex(sn.bind(null,c));if(f>-1)return f;const h=Xd(s[d-2]);return d>1&&Xd(c)===h&&u[u.length-1].path!==h?u.findIndex(sn.bind(null,s[d-2])):f}),i=L(()=>n.value>-1&&Ux(r.params,o.value.params)),a=L(()=>n.value>-1&&n.value===r.matched.length-1&&Bh(r.params,o.value.params));function l(s={}){return Kx(s)?t[Me(e.replace)?"replace":"push"](Me(e.to)).catch(Gn):Promise.resolve()}return{route:o,href:L(()=>o.value.href),isActive:i,isExactActive:a,navigate:l}}const Wx=oe({name:"RouterLink",props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Yd,setup(e,{slots:t}){const r=ar(Yd(e)),{options:o}=be(Ia),n=L(()=>({[Zd(e.activeClass,o.linkActiveClass,"router-link-active")]:r.isActive,[Zd(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=t.default&&t.default(r);return e.custom?i:m("a",{"aria-current":r.isExactActive?e.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:n.value},i)}}}),Vx=Wx;function Kx(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){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}}function Ux(e,t){for(const r in t){const o=t[r],n=e[r];if(typeof o=="string"){if(o!==n)return!1}else if(!Array.isArray(n)||n.length!==o.length||o.some((i,a)=>i!==n[a]))return!1}return!0}function Xd(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Zd=(e,t,r)=>e!=null?e:t!=null?t:r,qx=oe({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},setup(e,{attrs:t,slots:r}){const o=be(ts),n=L(()=>e.route||o.value),i=be(Fd,0),a=L(()=>n.value.matched[i]);je(Fd,i+1),je(U1,a),je(ts,n);const l=W();return qe(()=>[l.value,a.value,e.name],([s,d,c],[u,f,h])=>{d&&(d.instances[c]=s,f&&f!==d&&s&&s===u&&(d.leaveGuards.size||(d.leaveGuards=f.leaveGuards),d.updateGuards.size||(d.updateGuards=f.updateGuards))),s&&d&&(!f||!sn(d,f)||!u)&&(d.enterCallbacks[c]||[]).forEach(p=>p(s))},{flush:"post"}),()=>{const s=n.value,d=a.value,c=d&&d.components[e.name],u=e.name;if(!c)return Jd(r.default,{Component:c,route:s});const f=d.props[e.name],h=f?f===!0?s.params:typeof f=="function"?f(s):f:null,b=m(c,et({},h,t,{onVnodeUnmounted:g=>{g.component.isUnmounted&&(d.instances[u]=null)},ref:l}));return Jd(r.default,{Component:b,route:s})||b}}});function Jd(e,t){if(!e)return null;const r=e(t);return r.length===1?r[0]:r}const Gx=qx;function Yx(e){const t=wx(e.routes,e),r=e.parseQuery||Hx,o=e.stringifyQuery||Gd,n=e.history,i=zn(),a=zn(),l=zn(),s=Ub(Mr);let d=Mr;Go&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=fl.bind(null,O=>""+O),u=fl.bind(null,Fx),f=fl.bind(null,ca);function h(O,V){let D,ce;return Dh(O)?(D=t.getRecordMatcher(O),ce=V):ce=O,t.addRoute(ce,D)}function p(O){const V=t.getRecordMatcher(O);V&&t.removeRoute(V)}function b(){return t.getRoutes().map(O=>O.record)}function g(O){return!!t.getRecordMatcher(O)}function v(O,V){if(V=et({},V||s.value),typeof O=="string"){const Z=hl(r,O,V.path),C=t.resolve({path:Z.path},V),k=n.createHref(Z.fullPath);return et(Z,C,{params:f(C.params),hash:ca(Z.hash),redirectedFrom:void 0,href:k})}let D;if("path"in O)D=et({},O,{path:hl(r,O.path,V.path).path});else{const Z=et({},O.params);for(const C in Z)Z[C]==null&&delete Z[C];D=et({},O,{params:u(O.params)}),V.params=u(V.params)}const ce=t.resolve(D,V),ue=O.hash||"";ce.params=c(f(ce.params));const xe=X1(o,et({},O,{hash:Bx(ue),path:ce.path})),G=n.createHref(xe);return et({fullPath:xe,hash:ue,query:o===Gd?jx(O.query):O.query||{}},ce,{redirectedFrom:void 0,href:G})}function w(O){return typeof O=="string"?hl(r,O,s.value.path):et({},O)}function $(O,V){if(d!==O)return cn(8,{from:V,to:O})}function x(O){return y(O)}function S(O){return x(et(w(O),{replace:!0}))}function E(O){const V=O.matched[O.matched.length-1];if(V&&V.redirect){const{redirect:D}=V;let ce=typeof D=="function"?D(O):D;return typeof ce=="string"&&(ce=ce.includes("?")||ce.includes("#")?ce=w(ce):{path:ce},ce.params={}),et({query:O.query,hash:O.hash,params:O.params},ce)}}function y(O,V){const D=d=v(O),ce=s.value,ue=O.state,xe=O.force,G=O.replace===!0,Z=E(D);if(Z)return y(et(w(Z),{state:ue,force:xe,replace:G}),V||D);const C=D;C.redirectedFrom=V;let k;return!xe&&Z1(o,ce,D)&&(k=cn(16,{to:C,from:ce}),Ae(ce,ce,!0,!1)),(k?Promise.resolve(k):R(C,ce)).catch(H=>Br(H)?Br(H,2)?H:_e(H):te(H,C,ce)).then(H=>{if(H){if(Br(H,2))return y(et(w(H.to),{state:ue,force:xe,replace:G}),V||C)}else H=j(C,ce,!0,G,ue);return P(C,ce,H),H})}function _(O,V){const D=$(O,V);return D?Promise.reject(D):Promise.resolve()}function R(O,V){let D;const[ce,ue,xe]=Xx(O,V);D=pl(ce.reverse(),"beforeRouteLeave",O,V);for(const Z of ce)Z.leaveGuards.forEach(C=>{D.push(jr(C,O,V))});const G=_.bind(null,O,V);return D.push(G),Io(D).then(()=>{D=[];for(const Z of i.list())D.push(jr(Z,O,V));return D.push(G),Io(D)}).then(()=>{D=pl(ue,"beforeRouteUpdate",O,V);for(const Z of ue)Z.updateGuards.forEach(C=>{D.push(jr(C,O,V))});return D.push(G),Io(D)}).then(()=>{D=[];for(const Z of O.matched)if(Z.beforeEnter&&!V.matched.includes(Z))if(Array.isArray(Z.beforeEnter))for(const C of Z.beforeEnter)D.push(jr(C,O,V));else D.push(jr(Z.beforeEnter,O,V));return D.push(G),Io(D)}).then(()=>(O.matched.forEach(Z=>Z.enterCallbacks={}),D=pl(xe,"beforeRouteEnter",O,V),D.push(G),Io(D))).then(()=>{D=[];for(const Z of a.list())D.push(jr(Z,O,V));return D.push(G),Io(D)}).catch(Z=>Br(Z,8)?Z:Promise.reject(Z))}function P(O,V,D){for(const ce of l.list())ce(O,V,D)}function j(O,V,D,ce,ue){const xe=$(O,V);if(xe)return xe;const G=V===Mr,Z=Go?history.state:{};D&&(ce||G?n.replace(O.fullPath,et({scroll:G&&Z&&Z.scroll},ue)):n.push(O.fullPath,ue)),s.value=O,Ae(O,V,D,G),_e()}let T;function N(){T=n.listen((O,V,D)=>{const ce=v(O),ue=E(ce);if(ue){y(et(ue,{replace:!0}),ce).catch(Gn);return}d=ce;const xe=s.value;Go&&ix(Nd(xe.fullPath,D.delta),Ma()),R(ce,xe).catch(G=>Br(G,12)?G:Br(G,2)?(y(G.to,ce).then(Z=>{Br(Z,20)&&!D.delta&&D.type===si.pop&&n.go(-1,!1)}).catch(Gn),Promise.reject()):(D.delta&&n.go(-D.delta,!1),te(G,ce,xe))).then(G=>{G=G||j(ce,xe,!1),G&&(D.delta?n.go(-D.delta,!1):D.type===si.pop&&Br(G,20)&&n.go(-1,!1)),P(ce,xe,G)}).catch(Gn)})}let B=zn(),q=zn(),A;function te(O,V,D){_e(O);const ce=q.list();return ce.length?ce.forEach(ue=>ue(O,V,D)):console.error(O),Promise.reject(O)}function se(){return A&&s.value!==Mr?Promise.resolve():new Promise((O,V)=>{B.add([O,V])})}function _e(O){return A||(A=!O,N(),B.list().forEach(([V,D])=>O?D(O):V()),B.reset()),O}function Ae(O,V,D,ce){const{scrollBehavior:ue}=e;if(!Go||!ue)return Promise.resolve();const xe=!D&&ax(Nd(O.fullPath,0))||(ce||!D)&&history.state&&history.state.scroll||null;return br().then(()=>ue(O,V,xe)).then(G=>G&&nx(G)).catch(G=>te(G,O,V))}const Re=O=>n.go(O);let Ee;const $e=new Set;return{currentRoute:s,addRoute:h,removeRoute:p,hasRoute:g,getRoutes:b,resolve:v,options:e,push:x,replace:S,go:Re,back:()=>Re(-1),forward:()=>Re(1),beforeEach:i.add,beforeResolve:a.add,afterEach:l.add,onError:q.add,isReady:se,install(O){const V=this;O.component("RouterLink",Vx),O.component("RouterView",Gx),O.config.globalProperties.$router=V,Object.defineProperty(O.config.globalProperties,"$route",{enumerable:!0,get:()=>Me(s)}),Go&&!Ee&&s.value===Mr&&(Ee=!0,x(n.location).catch(ue=>{}));const D={};for(const ue in Mr)D[ue]=L(()=>s.value[ue]);O.provide(Ia,V),O.provide(oc,ar(D)),O.provide(ts,s);const ce=O.unmount;$e.add(O),O.unmount=function(){$e.delete(O),$e.size<1&&(d=Mr,T&&T(),s.value=Mr,Ee=!1,A=!1),ce()}}}}function Io(e){return e.reduce((t,r)=>t.then(()=>r()),Promise.resolve())}function Xx(e,t){const r=[],o=[],n=[],i=Math.max(t.matched.length,e.matched.length);for(let a=0;asn(d,l))?o.push(l):r.push(l));const s=e.matched[a];s&&(t.matched.find(d=>sn(d,s))||n.push(s))}return[r,o,n]}function Uh(){return be(Ia)}function Zx(){return be(oc)}const Jx=[{path:"/",name:"home",meta:{title:"\u5E7F\u573A",keepAlive:!0},component:()=>Yt(()=>import("./Home.d188c936.js"),["assets/Home.d188c936.js","assets/Home.07e73aab.css","assets/post-item.03452002.js","assets/post-item.766f3250.css","assets/content.ef1e095a.js","assets/content.ef781517.css","assets/formatTime.02109bf5.js","assets/Thing.eef6b133.js","assets/post-skeleton.39a35f5b.js","assets/post-skeleton.328dfb67.css","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/IEnum.bfd96c78.js","assets/Upload.efe3adfd.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/Pagination.1263479e.js"])},{path:"/post",name:"post",meta:{title:"\u8BDD\u9898\u8BE6\u60C5"},component:()=>Yt(()=>import("./Post.db4b62c9.js"),["assets/Post.db4b62c9.js","assets/Post.de11af43.css","assets/InputGroup.f69c4956.js","assets/formatTime.02109bf5.js","assets/content.ef1e095a.js","assets/content.ef781517.css","assets/Thing.eef6b133.js","assets/post-skeleton.39a35f5b.js","assets/post-skeleton.328dfb67.css","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/IEnum.bfd96c78.js","assets/Upload.efe3adfd.js","assets/MoreHorizFilled.80db5156.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css"])},{path:"/topic",name:"topic",meta:{title:"\u8BDD\u9898"},component:()=>Yt(()=>import("./Topic.c6bdf01d.js"),["assets/Topic.c6bdf01d.js","assets/Topic.9a2ef7f9.css","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/List.49bcdf81.js"])},{path:"/anouncement",name:"anouncement",meta:{title:"\u516C\u544A"},component:()=>Yt(()=>import("./Anouncement.98ee5b6f.js"),["assets/Anouncement.98ee5b6f.js","assets/Anouncement.5f84f68f.css","assets/post-skeleton.39a35f5b.js","assets/post-skeleton.328dfb67.css","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/formatTime.02109bf5.js","assets/Pagination.1263479e.js"])},{path:"/profile",name:"profile",meta:{title:"\u4E3B\u9875"},component:()=>Yt(()=>import("./Profile.75de1930.js"),["assets/Profile.75de1930.js","assets/Profile.df0a7049.css","assets/post-item.03452002.js","assets/post-item.766f3250.css","assets/content.ef1e095a.js","assets/content.ef781517.css","assets/formatTime.02109bf5.js","assets/Thing.eef6b133.js","assets/post-skeleton.39a35f5b.js","assets/post-skeleton.328dfb67.css","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/Pagination.1263479e.js"])},{path:"/user",name:"user",meta:{title:"\u7528\u6237\u8BE6\u60C5"},component:()=>Yt(()=>import("./User.695fa64f.js"),["assets/User.695fa64f.js","assets/User.7b771241.css","assets/post-item.03452002.js","assets/post-item.766f3250.css","assets/content.ef1e095a.js","assets/content.ef781517.css","assets/formatTime.02109bf5.js","assets/Thing.eef6b133.js","assets/post-skeleton.39a35f5b.js","assets/post-skeleton.328dfb67.css","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/Alert.a854329b.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/MoreHorizFilled.80db5156.js","assets/Pagination.1263479e.js"])},{path:"/messages",name:"messages",meta:{title:"\u6D88\u606F"},component:()=>Yt(()=>import("./Messages.c822d4d1.js"),["assets/Messages.c822d4d1.js","assets/Messages.db382f03.css","assets/formatTime.02109bf5.js","assets/Alert.a854329b.js","assets/Thing.eef6b133.js","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/Pagination.1263479e.js"])},{path:"/collection",name:"collection",meta:{title:"\u6536\u85CF"},component:()=>Yt(()=>import("./Collection.02f600ee.js"),["assets/Collection.02f600ee.js","assets/Collection.d63a34f0.css","assets/post-item.03452002.js","assets/post-item.766f3250.css","assets/content.ef1e095a.js","assets/content.ef781517.css","assets/formatTime.02109bf5.js","assets/Thing.eef6b133.js","assets/post-skeleton.39a35f5b.js","assets/post-skeleton.328dfb67.css","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/Pagination.1263479e.js"])},{path:"/contacts",name:"contacts",meta:{title:"\u597D\u53CB"},component:()=>Yt(()=>import("./Contacts.a6b6de0d.js"),["assets/Contacts.a6b6de0d.js","assets/Contacts.e16015c7.css","assets/post-skeleton.39a35f5b.js","assets/post-skeleton.328dfb67.css","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/Pagination.1263479e.js"])},{path:"/wallet",name:"wallet",meta:{title:"\u94B1\u5305"},component:()=>Yt(()=>import("./Wallet.b8e2b626.js"),["assets/Wallet.b8e2b626.js","assets/Wallet.e5757b5e.css","assets/post-skeleton.39a35f5b.js","assets/post-skeleton.328dfb67.css","assets/Skeleton.57e98fe3.js","assets/List.49bcdf81.js","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/formatTime.02109bf5.js","assets/Pagination.1263479e.js"])},{path:"/setting",name:"setting",meta:{title:"\u8BBE\u7F6E"},component:()=>Yt(()=>import("./Setting.837d491b.js"),["assets/Setting.837d491b.js","assets/Setting.a66de7b5.css","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/Upload.efe3adfd.js","assets/Alert.a854329b.js","assets/InputGroup.f69c4956.js"])},{path:"/404",name:"404",meta:{title:"404"},component:()=>Yt(()=>import("./404.15b4dcd0.js"),["assets/404.15b4dcd0.js","assets/404.9c166a4c.css","assets/main-nav.9110259b.js","assets/main-nav.b4a45e8a.css","assets/List.49bcdf81.js"])},{path:"/:pathMatch(.*)",redirect:"/404"}],qh=Yx({history:ux(),routes:Jx});qh.beforeEach((e,t,r)=>{document.title=`${e.meta.title} | \u6CE1\u6CE1 - \u4E00\u4E2A\u6E05\u65B0\u6587\u827A\u7684\u5FAE\u793E\u533A`,r()});/*! - * vuex v4.0.2 - * (c) 2021 Evan You - * @license MIT - */var Gh="store";function Ba(e){return e===void 0&&(e=null),be(e!==null?e:Gh)}function yn(e,t){Object.keys(e).forEach(function(r){return t(e[r],r)})}function Qx(e){return e!==null&&typeof e=="object"}function eC(e){return e&&typeof e.then=="function"}function tC(e,t){return function(){return e(t)}}function Yh(e,t,r){return t.indexOf(e)<0&&(r&&r.prepend?t.unshift(e):t.push(e)),function(){var o=t.indexOf(e);o>-1&&t.splice(o,1)}}function Xh(e,t){e._actions=Object.create(null),e._mutations=Object.create(null),e._wrappedGetters=Object.create(null),e._modulesNamespaceMap=Object.create(null);var r=e.state;La(e,r,[],e._modules.root,!0),ic(e,r,t)}function ic(e,t,r){var o=e._state;e.getters={},e._makeLocalGettersCache=Object.create(null);var n=e._wrappedGetters,i={};yn(n,function(a,l){i[l]=tC(a,e),Object.defineProperty(e.getters,l,{get:function(){return i[l]()},enumerable:!0})}),e._state=ar({data:t}),e.strict&&aC(e),o&&r&&e._withCommit(function(){o.data=null})}function La(e,t,r,o,n){var i=!r.length,a=e._modules.getNamespace(r);if(o.namespaced&&(e._modulesNamespaceMap[a],e._modulesNamespaceMap[a]=o),!i&&!n){var l=ac(t,r.slice(0,-1)),s=r[r.length-1];e._withCommit(function(){l[s]=o.state})}var d=o.context=rC(e,a,r);o.forEachMutation(function(c,u){var f=a+u;oC(e,f,c,d)}),o.forEachAction(function(c,u){var f=c.root?u:a+u,h=c.handler||c;nC(e,f,h,d)}),o.forEachGetter(function(c,u){var f=a+u;iC(e,f,c,d)}),o.forEachChild(function(c,u){La(e,t,r.concat(u),c,n)})}function rC(e,t,r){var o=t==="",n={dispatch:o?e.dispatch:function(i,a,l){var s=da(i,a,l),d=s.payload,c=s.options,u=s.type;return(!c||!c.root)&&(u=t+u),e.dispatch(u,d)},commit:o?e.commit:function(i,a,l){var s=da(i,a,l),d=s.payload,c=s.options,u=s.type;(!c||!c.root)&&(u=t+u),e.commit(u,d,c)}};return Object.defineProperties(n,{getters:{get:o?function(){return e.getters}:function(){return Zh(e,t)}},state:{get:function(){return ac(e.state,r)}}}),n}function Zh(e,t){if(!e._makeLocalGettersCache[t]){var r={},o=t.length;Object.keys(e.getters).forEach(function(n){if(n.slice(0,o)===t){var i=n.slice(o);Object.defineProperty(r,i,{get:function(){return e.getters[n]},enumerable:!0})}}),e._makeLocalGettersCache[t]=r}return e._makeLocalGettersCache[t]}function oC(e,t,r,o){var n=e._mutations[t]||(e._mutations[t]=[]);n.push(function(a){r.call(e,o.state,a)})}function nC(e,t,r,o){var n=e._actions[t]||(e._actions[t]=[]);n.push(function(a){var l=r.call(e,{dispatch:o.dispatch,commit:o.commit,getters:o.getters,state:o.state,rootGetters:e.getters,rootState:e.state},a);return eC(l)||(l=Promise.resolve(l)),e._devtoolHook?l.catch(function(s){throw e._devtoolHook.emit("vuex:error",s),s}):l})}function iC(e,t,r,o){e._wrappedGetters[t]||(e._wrappedGetters[t]=function(i){return r(o.state,o.getters,i.state,i.getters)})}function aC(e){qe(function(){return e._state.data},function(){},{deep:!0,flush:"sync"})}function ac(e,t){return t.reduce(function(r,o){return r[o]},e)}function da(e,t,r){return Qx(e)&&e.type&&(r=t,t=e,e=e.type),{type:e,payload:t,options:r}}var lC="vuex bindings",Qd="vuex:mutations",ml="vuex:actions",Mo="vuex",sC=0;function cC(e,t){K1({id:"org.vuejs.vuex",app:e,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:[lC]},function(r){r.addTimelineLayer({id:Qd,label:"Vuex Mutations",color:eu}),r.addTimelineLayer({id:ml,label:"Vuex Actions",color:eu}),r.addInspector({id:Mo,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),r.on.getInspectorTree(function(o){if(o.app===e&&o.inspectorId===Mo)if(o.filter){var n=[];tp(n,t._modules.root,o.filter,""),o.rootNodes=n}else o.rootNodes=[ep(t._modules.root,"")]}),r.on.getInspectorState(function(o){if(o.app===e&&o.inspectorId===Mo){var n=o.nodeId;Zh(t,n),o.state=fC(pC(t._modules,n),n==="root"?t.getters:t._makeLocalGettersCache,n)}}),r.on.editInspectorState(function(o){if(o.app===e&&o.inspectorId===Mo){var n=o.nodeId,i=o.path;n!=="root"&&(i=n.split("/").filter(Boolean).concat(i)),t._withCommit(function(){o.set(t._state.data,i,o.state.value)})}}),t.subscribe(function(o,n){var i={};o.payload&&(i.payload=o.payload),i.state=n,r.notifyComponentUpdate(),r.sendInspectorTree(Mo),r.sendInspectorState(Mo),r.addTimelineEvent({layerId:Qd,event:{time:Date.now(),title:o.type,data:i}})}),t.subscribeAction({before:function(o,n){var i={};o.payload&&(i.payload=o.payload),o._id=sC++,o._time=Date.now(),i.state=n,r.addTimelineEvent({layerId:ml,event:{time:o._time,title:o.type,groupId:o._id,subtitle:"start",data:i}})},after:function(o,n){var i={},a=Date.now()-o._time;i.duration={_custom:{type:"duration",display:a+"ms",tooltip:"Action duration",value:a}},o.payload&&(i.payload=o.payload),i.state=n,r.addTimelineEvent({layerId:ml,event:{time:Date.now(),title:o.type,groupId:o._id,subtitle:"end",data:i}})}})})}var eu=8702998,dC=6710886,uC=16777215,Jh={label:"namespaced",textColor:uC,backgroundColor:dC};function Qh(e){return e&&e!=="root"?e.split("/").slice(-2,-1)[0]:"Root"}function ep(e,t){return{id:t||"root",label:Qh(t),tags:e.namespaced?[Jh]:[],children:Object.keys(e._children).map(function(r){return ep(e._children[r],t+r+"/")})}}function tp(e,t,r,o){o.includes(r)&&e.push({id:o||"root",label:o.endsWith("/")?o.slice(0,o.length-1):o||"Root",tags:t.namespaced?[Jh]:[]}),Object.keys(t._children).forEach(function(n){tp(e,t._children[n],r,o+n+"/")})}function fC(e,t,r){t=r==="root"?t:t[r];var o=Object.keys(t),n={state:Object.keys(e.state).map(function(a){return{key:a,editable:!0,value:e.state[a]}})};if(o.length){var i=hC(t);n.getters=Object.keys(i).map(function(a){return{key:a.endsWith("/")?Qh(a):a,editable:!1,value:ns(function(){return i[a]})}})}return n}function hC(e){var t={};return Object.keys(e).forEach(function(r){var o=r.split("/");if(o.length>1){var n=t,i=o.pop();o.forEach(function(a){n[a]||(n[a]={_custom:{value:{},display:a,tooltip:"Module",abstract:!0}}),n=n[a]._custom.value}),n[i]=ns(function(){return e[r]})}else t[r]=ns(function(){return e[r]})}),t}function pC(e,t){var r=t.split("/").filter(function(o){return o});return r.reduce(function(o,n,i){var a=o[n];if(!a)throw new Error('Missing module "'+n+'" for path "'+t+'".');return i===r.length-1?a:a._children},t==="root"?e:e.root._children)}function ns(e){try{return e()}catch(t){return t}}var cr=function(t,r){this.runtime=r,this._children=Object.create(null),this._rawModule=t;var o=t.state;this.state=(typeof o=="function"?o():o)||{}},rp={namespaced:{configurable:!0}};rp.namespaced.get=function(){return!!this._rawModule.namespaced};cr.prototype.addChild=function(t,r){this._children[t]=r};cr.prototype.removeChild=function(t){delete this._children[t]};cr.prototype.getChild=function(t){return this._children[t]};cr.prototype.hasChild=function(t){return t in this._children};cr.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)};cr.prototype.forEachChild=function(t){yn(this._children,t)};cr.prototype.forEachGetter=function(t){this._rawModule.getters&&yn(this._rawModule.getters,t)};cr.prototype.forEachAction=function(t){this._rawModule.actions&&yn(this._rawModule.actions,t)};cr.prototype.forEachMutation=function(t){this._rawModule.mutations&&yn(this._rawModule.mutations,t)};Object.defineProperties(cr.prototype,rp);var ko=function(t){this.register([],t,!1)};ko.prototype.get=function(t){return t.reduce(function(r,o){return r.getChild(o)},this.root)};ko.prototype.getNamespace=function(t){var r=this.root;return t.reduce(function(o,n){return r=r.getChild(n),o+(r.namespaced?n+"/":"")},"")};ko.prototype.update=function(t){op([],this.root,t)};ko.prototype.register=function(t,r,o){var n=this;o===void 0&&(o=!0);var i=new cr(r,o);if(t.length===0)this.root=i;else{var a=this.get(t.slice(0,-1));a.addChild(t[t.length-1],i)}r.modules&&yn(r.modules,function(l,s){n.register(t.concat(s),l,o)})};ko.prototype.unregister=function(t){var r=this.get(t.slice(0,-1)),o=t[t.length-1],n=r.getChild(o);!n||!n.runtime||r.removeChild(o)};ko.prototype.isRegistered=function(t){var r=this.get(t.slice(0,-1)),o=t[t.length-1];return r?r.hasChild(o):!1};function op(e,t,r){if(t.update(r),r.modules)for(var o in r.modules){if(!t.getChild(o))return;op(e.concat(o),t.getChild(o),r.modules[o])}}function mC(e){return new Ft(e)}var Ft=function(t){var r=this;t===void 0&&(t={});var o=t.plugins;o===void 0&&(o=[]);var n=t.strict;n===void 0&&(n=!1);var i=t.devtools;this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new ko(t),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._makeLocalGettersCache=Object.create(null),this._devtools=i;var a=this,l=this,s=l.dispatch,d=l.commit;this.dispatch=function(f,h){return s.call(a,f,h)},this.commit=function(f,h,p){return d.call(a,f,h,p)},this.strict=n;var c=this._modules.root.state;La(this,c,[],this._modules.root),ic(this,c),o.forEach(function(u){return u(r)})},lc={state:{configurable:!0}};Ft.prototype.install=function(t,r){t.provide(r||Gh,this),t.config.globalProperties.$store=this;var o=this._devtools!==void 0?this._devtools:!1;o&&cC(t,this)};lc.state.get=function(){return this._state.data};lc.state.set=function(e){};Ft.prototype.commit=function(t,r,o){var n=this,i=da(t,r,o),a=i.type,l=i.payload,s={type:a,payload:l},d=this._mutations[a];!d||(this._withCommit(function(){d.forEach(function(u){u(l)})}),this._subscribers.slice().forEach(function(c){return c(s,n.state)}))};Ft.prototype.dispatch=function(t,r){var o=this,n=da(t,r),i=n.type,a=n.payload,l={type:i,payload:a},s=this._actions[i];if(!!s){try{this._actionSubscribers.slice().filter(function(c){return c.before}).forEach(function(c){return c.before(l,o.state)})}catch{}var d=s.length>1?Promise.all(s.map(function(c){return c(a)})):s[0](a);return new Promise(function(c,u){d.then(function(f){try{o._actionSubscribers.filter(function(h){return h.after}).forEach(function(h){return h.after(l,o.state)})}catch{}c(f)},function(f){try{o._actionSubscribers.filter(function(h){return h.error}).forEach(function(h){return h.error(l,o.state,f)})}catch{}u(f)})})}};Ft.prototype.subscribe=function(t,r){return Yh(t,this._subscribers,r)};Ft.prototype.subscribeAction=function(t,r){var o=typeof t=="function"?{before:t}:t;return Yh(o,this._actionSubscribers,r)};Ft.prototype.watch=function(t,r,o){var n=this;return qe(function(){return t(n.state,n.getters)},r,Object.assign({},o))};Ft.prototype.replaceState=function(t){var r=this;this._withCommit(function(){r._state.data=t})};Ft.prototype.registerModule=function(t,r,o){o===void 0&&(o={}),typeof t=="string"&&(t=[t]),this._modules.register(t,r),La(this,this.state,t,this._modules.get(t),o.preserveState),ic(this,this.state)};Ft.prototype.unregisterModule=function(t){var r=this;typeof t=="string"&&(t=[t]),this._modules.unregister(t),this._withCommit(function(){var o=ac(r.state,t.slice(0,-1));delete o[t[t.length-1]]}),Xh(this)};Ft.prototype.hasModule=function(t){return typeof t=="string"&&(t=[t]),this._modules.isRegistered(t)};Ft.prototype.hotUpdate=function(t){this._modules.update(t),Xh(this,!0)};Ft.prototype._withCommit=function(t){var r=this._committing;this._committing=!0,t(),this._committing=r};Object.defineProperties(Ft.prototype,lc);var vC=mC({state:{refresh:Date.now(),theme:localStorage.getItem("PAOPAO_THEME"),collapsedLeft:document.body.clientWidth<=821,collapsedRight:document.body.clientWidth<=821,authModalShow:!1,authModelTab:"signin",userInfo:{id:0,username:"",nickname:""}},mutations:{refresh(e,t){e.refresh=t||Date.now()},triggerTheme(e,t){e.theme=t},triggerAuth(e,t){e.authModalShow=t},triggerAuthKey(e,t){e.authModelTab=t},triggerCollapsedLeft(e,t){e.collapsedLeft=t},triggerCollapsedRight(e,t){e.collapsedRight=t},updateUserinfo(e,t){e.userInfo=t},userLogout(e){localStorage.removeItem("PAOPAO_TOKEN"),e.userInfo={id:0,nickname:"",username:""}}},actions:{},modules:{}});let ua=[];const np=new WeakMap;function gC(){ua.forEach(e=>e(...np.get(e))),ua=[]}function ip(e,...t){np.set(e,t),!ua.includes(e)&&ua.push(e)===1&&requestAnimationFrame(gC)}function bC(e,t){let{target:r}=e;for(;r;){if(r.dataset&&r.dataset[t]!==void 0)return!0;r=r.parentElement}return!1}function tu(e){return typeof e=="string"?e.endsWith("px")?Number(e.slice(0,e.length-2)):Number(e):e}function xC(e){if(e!=null)return typeof e=="number"?`${e}px`:e.endsWith("px")?e:`${e}px`}function ap(e,t){const r=e.trim().split(/\s+/g),o={top:r[0]};switch(r.length){case 1:o.right=r[0],o.bottom=r[0],o.left=r[0];break;case 2:o.right=r[1],o.left=r[1],o.bottom=r[0];break;case 3:o.right=r[1],o.bottom=r[2],o.left=r[1];break;case 4:o.right=r[1],o.bottom=r[2],o.left=r[3];break;default:throw new Error("[seemly/getMargin]:"+e+" is not a valid value.")}return t===void 0?o:o[t]}function CC(e,t){const[r,o]=e.split(" ");return t?t==="row"?r:o:{row:r,col:o||r}}var ru={black:"#000",silver:"#C0C0C0",gray:"#808080",white:"#FFF",maroon:"#800000",red:"#F00",purple:"#800080",fuchsia:"#F0F",green:"#008000",lime:"#0F0",olive:"#808000",yellow:"#FF0",navy:"#000080",blue:"#00F",teal:"#008080",aqua:"#0FF",transparent:"#0000"};const wn="^\\s*",Sn="\\s*$",vo="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",go="([0-9A-Fa-f])",bo="([0-9A-Fa-f]{2})",yC=new RegExp(`${wn}rgb\\s*\\(${vo},${vo},${vo}\\)${Sn}`),wC=new RegExp(`${wn}rgba\\s*\\(${vo},${vo},${vo},${vo}\\)${Sn}`),SC=new RegExp(`${wn}#${go}${go}${go}${Sn}`),_C=new RegExp(`${wn}#${bo}${bo}${bo}${Sn}`),$C=new RegExp(`${wn}#${go}${go}${go}${go}${Sn}`),PC=new RegExp(`${wn}#${bo}${bo}${bo}${bo}${Sn}`);function Dt(e){return parseInt(e,16)}function Tr(e){try{let t;if(t=_C.exec(e))return[Dt(t[1]),Dt(t[2]),Dt(t[3]),1];if(t=yC.exec(e))return[Rt(t[1]),Rt(t[5]),Rt(t[9]),1];if(t=wC.exec(e))return[Rt(t[1]),Rt(t[5]),Rt(t[9]),Xn(t[13])];if(t=SC.exec(e))return[Dt(t[1]+t[1]),Dt(t[2]+t[2]),Dt(t[3]+t[3]),1];if(t=PC.exec(e))return[Dt(t[1]),Dt(t[2]),Dt(t[3]),Xn(Dt(t[4])/255)];if(t=$C.exec(e))return[Dt(t[1]+t[1]),Dt(t[2]+t[2]),Dt(t[3]+t[3]),Xn(Dt(t[4]+t[4])/255)];if(e in ru)return Tr(ru[e]);throw new Error(`[seemly/rgba]: Invalid color value ${e}.`)}catch(t){throw t}}function kC(e){return e>1?1:e<0?0:e}function is(e,t,r,o){return`rgba(${Rt(e)}, ${Rt(t)}, ${Rt(r)}, ${kC(o)})`}function vl(e,t,r,o,n){return Rt((e*t*(1-o)+r*o)/n)}function ye(e,t){Array.isArray(e)||(e=Tr(e)),Array.isArray(t)||(t=Tr(t));const r=e[3],o=t[3],n=Xn(r+o-r*o);return is(vl(e[0],r,t[0],o,n),vl(e[1],r,t[1],o,n),vl(e[2],r,t[2],o,n),n)}function ee(e,t){const[r,o,n,i=1]=Array.isArray(e)?e:Tr(e);return t.alpha?is(r,o,n,t.alpha):is(r,o,n,i)}function Yo(e,t){const[r,o,n,i=1]=Array.isArray(e)?e:Tr(e),{lightness:a=1,alpha:l=1}=t;return TC([r*a,o*a,n*a,i*l])}function Xn(e){const t=Math.round(Number(e)*100)/100;return t>1?1:t<0?0:t}function Rt(e){const t=Math.round(Number(e));return t>255?255:t<0?0:t}function TC(e){const[t,r,o]=e;return 3 in e?`rgba(${Rt(t)}, ${Rt(r)}, ${Rt(o)}, ${Xn(e[3])})`:`rgba(${Rt(t)}, ${Rt(r)}, ${Rt(o)}, 1)`}globalThis&&globalThis.__awaiter;function dn(e=8){return Math.random().toString(16).slice(2,2+e)}function EC(e,t="default",r=[]){const n=e.$slots[t];return n===void 0?r:n()}function Vt(e,t=[],r){const o={};return t.forEach(n=>{o[n]=e[n]}),Object.assign(o,r)}function sc(e,t=[],r){const o={};return Object.getOwnPropertyNames(e).forEach(i=>{t.includes(i)||(o[i]=e[i])}),Object.assign(o,r)}function So(e,t=!0,r=[]){return e.forEach(o=>{if(o!==null){if(typeof o!="object"){(typeof o=="string"||typeof o=="number")&&r.push(sr(String(o)));return}if(Array.isArray(o)){So(o,t,r);return}if(o.type===ot){if(o.children===null)return;Array.isArray(o.children)&&So(o.children,t,r)}else o.type!==Lt&&r.push(o)}}),r}function Be(e,...t){if(Array.isArray(e))e.forEach(r=>Be(r,...t));else return e(...t)}function er(e){return Object.keys(e)}const Ct=(e,...t)=>typeof e=="function"?e(...t):typeof e=="string"?sr(e):typeof e=="number"?sr(String(e)):null;function Kr(e,t){console.error(`[naive/${e}]: ${t}`)}function Da(e,t){throw new Error(`[naive/${e}]: ${t}`)}function RC(e){switch(typeof e){case"string":return e||void 0;case"number":return String(e);default:return}}function as(e,t="default",r=void 0){const o=e[t];if(!o)return Kr("getFirstSlotVNode",`slot[${t}] is empty`),null;const n=So(o(r));return n.length===1?n[0]:(Kr("getFirstSlotVNode",`slot[${t}] should have exactly one child`),null)}function zC(e){return t=>{t?e.value=t.$el:e.value=null}}function lO(e){return e}function bi(e){return e.some(t=>an(t)?!(t.type===Lt||t.type===ot&&!bi(t.children)):!0)?e:null}function _o(e,t){return e&&bi(e())||t()}function AC(e,t,r){return e&&bi(e(t))||r(t)}function bt(e,t){const r=e&&bi(e());return t(r||null)}function cc(e){return!(e&&bi(e()))}const OC=/^(\d|\.)+$/,ou=/(\d|\.)+/;function Qt(e,{c:t=1,offset:r=0,attachPx:o=!0}={}){if(typeof e=="number"){const n=(e+r)*t;return n===0?"0":`${n}px`}else if(typeof e=="string")if(OC.test(e)){const n=(Number(e)+r)*t;return o?n===0?"0":`${n}px`:`${n}`}else{const n=ou.exec(e);return n?e.replace(ou,String((Number(n[0])+r)*t)):e}return e}function un(e){return e.replace(/#|\(|\)|,|\s/g,"_")}function IC(e){let t=0;for(let r=0;r{let n=IC(o);if(n){if(n===1){e.forEach(a=>{r.push(o.replace("&",a))});return}}else{e.forEach(a=>{r.push((a&&a+" ")+o)});return}let i=[o];for(;n--;){const a=[];i.forEach(l=>{e.forEach(s=>{a.push(l.replace("&",s))})}),i=a}i.forEach(a=>r.push(a))}),r}function LC(e,t){const r=[];return t.split(lp).forEach(o=>{e.forEach(n=>{r.push((n&&n+" ")+o)})}),r}function DC(e){let t=[""];return e.forEach(r=>{r=r&&r.trim(),r&&(r.includes("&")?t=BC(t,r):t=LC(t,r))}),t.join(", ").replace(MC," ")}function nu(e){if(!e)return;const t=e.parentElement;t&&t.removeChild(e)}function Fa(e){return document.querySelector(`style[cssr-id="${e}"]`)}function FC(e){const t=document.createElement("style");return t.setAttribute("cssr-id",e),t}function Di(e){return e?/^\s*@(s|m)/.test(e):!1}const HC=/[A-Z]/g;function sp(e){return e.replace(HC,t=>"-"+t.toLowerCase())}function jC(e,t=" "){return typeof e=="object"&&e!==null?` { -`+Object.entries(e).map(r=>t+` ${sp(r[0])}: ${r[1]};`).join(` -`)+` -`+t+"}":`: ${e};`}function NC(e,t,r){return typeof e=="function"?e({context:t.context,props:r}):e}function iu(e,t,r,o){if(!t)return"";const n=NC(t,r,o);if(!n)return"";if(typeof n=="string")return`${e} { -${n} -}`;const i=Object.keys(n);if(i.length===0)return r.config.keepEmptyBlock?e+` { -}`:"";const a=e?[e+" {"]:[];return i.forEach(l=>{const s=n[l];if(l==="raw"){a.push(` -`+s+` -`);return}l=sp(l),s!=null&&a.push(` ${l}${jC(s)}`)}),e&&a.push("}"),a.join(` -`)}function ls(e,t,r){!e||e.forEach(o=>{if(Array.isArray(o))ls(o,t,r);else if(typeof o=="function"){const n=o(t);Array.isArray(n)?ls(n,t,r):n&&r(n)}else o&&r(o)})}function cp(e,t,r,o,n,i){const a=e.$;let l="";if(!a||typeof a=="string")Di(a)?l=a:t.push(a);else if(typeof a=="function"){const c=a({context:o.context,props:n});Di(c)?l=c:t.push(c)}else if(a.before&&a.before(o.context),!a.$||typeof a.$=="string")Di(a.$)?l=a.$:t.push(a.$);else if(a.$){const c=a.$({context:o.context,props:n});Di(c)?l=c:t.push(c)}const s=DC(t),d=iu(s,e.props,o,n);l?(r.push(`${l} {`),i&&d&&i.insertRule(`${l} { -${d} -} -`)):(i&&d&&i.insertRule(d),!i&&d.length&&r.push(d)),e.children&&ls(e.children,{context:o.context,props:n},c=>{if(typeof c=="string"){const u=iu(s,{raw:c},o,n);i?i.insertRule(u):r.push(u)}else cp(c,t,r,o,n,i)}),t.pop(),l&&r.push("}"),a&&a.after&&a.after(o.context)}function dp(e,t,r,o=!1){const n=[];return cp(e,[],n,t,r,o?e.instance.__styleSheet:void 0),o?"":n.join(` - -`)}function ci(e){for(var t=0,r,o=0,n=e.length;n>=4;++o,n-=4)r=e.charCodeAt(o)&255|(e.charCodeAt(++o)&255)<<8|(e.charCodeAt(++o)&255)<<16|(e.charCodeAt(++o)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(n){case 3:t^=(e.charCodeAt(o+2)&255)<<16;case 2:t^=(e.charCodeAt(o+1)&255)<<8;case 1:t^=e.charCodeAt(o)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}typeof window!="undefined"&&(window.__cssrContext={});function WC(e,t,r){const{els:o}=t;if(r===void 0)o.forEach(nu),t.els=[];else{const n=Fa(r);n&&o.includes(n)&&(nu(n),t.els=o.filter(i=>i!==n))}}function au(e,t){e.push(t)}function VC(e,t,r,o,n,i,a,l,s){if(i&&!s){if(r===void 0){console.error("[css-render/mount]: `id` is required in `silent` mode.");return}const f=window.__cssrContext;f[r]||(f[r]=!0,dp(t,e,o,i));return}let d;if(r===void 0&&(d=t.render(o),r=ci(d)),s){s.adapter(r,d!=null?d:t.render(o));return}const c=Fa(r);if(c!==null&&!a)return c;const u=c!=null?c:FC(r);if(d===void 0&&(d=t.render(o)),u.textContent=d,c!==null)return c;if(l){const f=document.head.querySelector(`meta[name="${l}"]`);if(f)return document.head.insertBefore(u,f),au(t.els,u),u}return n?document.head.insertBefore(u,document.head.querySelector("style, link")):document.head.appendChild(u),au(t.els,u),u}function KC(e){return dp(this,this.instance,e)}function UC(e={}){const{id:t,ssr:r,props:o,head:n=!1,silent:i=!1,force:a=!1,anchorMetaName:l}=e;return VC(this.instance,this,t,o,n,i,a,l,r)}function qC(e={}){const{id:t}=e;WC(this.instance,this,t)}const Fi=function(e,t,r,o){return{instance:e,$:t,props:r,children:o,els:[],render:KC,mount:UC,unmount:qC}},GC=function(e,t,r,o){return Array.isArray(t)?Fi(e,{$:null},null,t):Array.isArray(r)?Fi(e,t,null,r):Array.isArray(o)?Fi(e,t,r,o):Fi(e,t,r,null)};function up(e={}){let t=null;const r={c:(...o)=>GC(r,...o),use:(o,...n)=>o.install(r,...n),find:Fa,context:{},config:e,get __styleSheet(){if(!t){const o=document.createElement("style");return document.head.appendChild(o),t=document.styleSheets[document.styleSheets.length-1],t}return t}};return r}function YC(e,t){if(e===void 0)return!1;if(t){const{context:{ids:r}}=t;return r.has(e)}return Fa(e)!==null}function XC(e){let t=".",r="__",o="--",n;if(e){let p=e.blockPrefix;p&&(t=p),p=e.elementPrefix,p&&(r=p),p=e.modifierPrefix,p&&(o=p)}const i={install(p){n=p.c;const b=p.context;b.bem={},b.bem.b=null,b.bem.els=null}};function a(p){let b,g;return{before(v){b=v.bem.b,g=v.bem.els,v.bem.els=null},after(v){v.bem.b=b,v.bem.els=g},$({context:v,props:w}){return p=typeof p=="string"?p:p({context:v,props:w}),v.bem.b=p,`${(w==null?void 0:w.bPrefix)||t}${v.bem.b}`}}}function l(p){let b;return{before(g){b=g.bem.els},after(g){g.bem.els=b},$({context:g,props:v}){return p=typeof p=="string"?p:p({context:g,props:v}),g.bem.els=p.split(",").map(w=>w.trim()),g.bem.els.map(w=>`${(v==null?void 0:v.bPrefix)||t}${g.bem.b}${r}${w}`).join(", ")}}}function s(p){return{$({context:b,props:g}){p=typeof p=="string"?p:p({context:b,props:g});const v=p.split(",").map(x=>x.trim());function w(x){return v.map(S=>`&${(g==null?void 0:g.bPrefix)||t}${b.bem.b}${x!==void 0?`${r}${x}`:""}${o}${S}`).join(", ")}const $=b.bem.els;return $!==null?w($[0]):w()}}}function d(p){return{$({context:b,props:g}){p=typeof p=="string"?p:p({context:b,props:g});const v=b.bem.els;return`&:not(${(g==null?void 0:g.bPrefix)||t}${b.bem.b}${v!==null&&v.length>0?`${r}${v[0]}`:""}${o}${p})`}}}return Object.assign(i,{cB:(...p)=>n(a(p[0]),p[1],p[2]),cE:(...p)=>n(l(p[0]),p[1],p[2]),cM:(...p)=>n(s(p[0]),p[1],p[2]),cNotM:(...p)=>n(d(p[0]),p[1],p[2])}),i}function ae(e,t){return e+(t==="default"?"":t.replace(/^[a-z]/,r=>r.toUpperCase()))}ae("abc","def");const ZC="n",fn=`.${ZC}-`,JC="__",QC="--",fp=up(),hp=XC({blockPrefix:fn,elementPrefix:JC,modifierPrefix:QC});fp.use(hp);const{c:z,find:sO}=fp,{cB:M,cE:F,cM:K,cNotM:ut}=hp;function dc(e){return z(({props:{bPrefix:t}})=>`${t||fn}modal, ${t||fn}drawer`,[e])}function pp(e){return z(({props:{bPrefix:t}})=>`${t||fn}popover:not(${t||fn}tooltip)`,[e])}function mp(e){return z(({props:{bPrefix:t}})=>`&${t||fn}modal`,e)}const ey=(...e)=>z(">",[M(...e)]);function ty(e){const t=W(!!e.value);if(t.value)return gr(t);const r=qe(e,o=>{o&&(t.value=!0,r())});return gr(t)}function ht(e){const t=L(e),r=W(t.value);return qe(t,o=>{r.value=o}),typeof e=="function"?r:{__v_isRef:!0,get value(){return r.value},set value(o){e.set(o)}}}function uc(){return Zr()!==null}const fc=typeof window!="undefined";let on,Zn;const ry=()=>{var e,t;on=fc?(t=(e=document)===null||e===void 0?void 0:e.fonts)===null||t===void 0?void 0:t.ready:void 0,Zn=!1,on!==void 0?on.then(()=>{Zn=!0}):Zn=!0};ry();function vp(e){if(Zn)return;let t=!1;Ot(()=>{Zn||on==null||on.then(()=>{t||e()})}),It(()=>{t=!0})}const oy={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function ny(e,t,r){if(e==="mousemoveoutside"){const o=n=>{t.contains(n.target)||r(n)};return{mousemove:o,touchstart:o}}else if(e==="clickoutside"){let o=!1;const n=a=>{o=!t.contains(a.target)},i=a=>{!o||t.contains(a.target)||r(a)};return{mousedown:n,mouseup:i,touchstart:n,touchend:i}}return console.error(`[evtd/create-trap-handler]: name \`${e}\` is invalid. This could be a bug of evtd.`),{}}function gp(e,t,r){const o=oy[e];let n=o.get(t);n===void 0&&o.set(t,n=new WeakMap);let i=n.get(r);return i===void 0&&n.set(r,i=ny(e,t,r)),i}function iy(e,t,r,o){if(e==="mousemoveoutside"||e==="clickoutside"){const n=gp(e,t,r);return Object.keys(n).forEach(i=>{nt(i,document,n[i],o)}),!0}return!1}function ay(e,t,r,o){if(e==="mousemoveoutside"||e==="clickoutside"){const n=gp(e,t,r);return Object.keys(n).forEach(i=>{Ze(i,document,n[i],o)}),!0}return!1}function ly(){if(typeof window=="undefined")return{on:()=>{},off:()=>{}};const e=new WeakMap,t=new WeakMap;function r(){e.set(this,!0)}function o(){e.set(this,!0),t.set(this,!0)}function n(y,_,R){const P=y[_];return y[_]=function(){return R.apply(y,arguments),P.apply(y,arguments)},y}function i(y,_){y[_]=Event.prototype[_]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function s(){var y;return(y=a.get(this))!==null&&y!==void 0?y:null}function d(y,_){l!==void 0&&Object.defineProperty(y,"currentTarget",{configurable:!0,enumerable:!0,get:_!=null?_:l.get})}const c={bubble:{},capture:{}},u={};function f(){const y=function(_){const{type:R,eventPhase:P,target:j,bubbles:T}=_;if(P===2)return;const N=P===1?"capture":"bubble";let B=j;const q=[];for(;B===null&&(B=window),q.push(B),B!==window;)B=B.parentNode||null;const A=c.capture[R],te=c.bubble[R];if(n(_,"stopPropagation",r),n(_,"stopImmediatePropagation",o),d(_,s),N==="capture"){if(A===void 0)return;for(let se=q.length-1;se>=0&&!e.has(_);--se){const _e=q[se],Ae=A.get(_e);if(Ae!==void 0){a.set(_,_e);for(const Re of Ae){if(t.has(_))break;Re(_)}}if(se===0&&!T&&te!==void 0){const Re=te.get(_e);if(Re!==void 0)for(const Ee of Re){if(t.has(_))break;Ee(_)}}}}else if(N==="bubble"){if(te===void 0)return;for(let se=0;seT(_))};return y.displayName="evtdUnifiedWindowEventHandler",y}const p=f(),b=h();function g(y,_){const R=c[y];return R[_]===void 0&&(R[_]=new Map,window.addEventListener(_,p,y==="capture")),R[_]}function v(y){return u[y]===void 0&&(u[y]=new Set,window.addEventListener(y,b)),u[y]}function w(y,_){let R=y.get(_);return R===void 0&&y.set(_,R=new Set),R}function $(y,_,R,P){const j=c[_][R];if(j!==void 0){const T=j.get(y);if(T!==void 0&&T.has(P))return!0}return!1}function x(y,_){const R=u[y];return!!(R!==void 0&&R.has(_))}function S(y,_,R,P){let j;if(typeof P=="object"&&P.once===!0?j=A=>{E(y,_,j,P),R(A)}:j=R,iy(y,_,j,P))return;const N=P===!0||typeof P=="object"&&P.capture===!0?"capture":"bubble",B=g(N,y),q=w(B,_);if(q.has(j)||q.add(j),_===window){const A=v(y);A.has(j)||A.add(j)}}function E(y,_,R,P){if(ay(y,_,R,P))return;const T=P===!0||typeof P=="object"&&P.capture===!0,N=T?"capture":"bubble",B=g(N,y),q=w(B,_);if(_===window&&!$(_,T?"bubble":"capture",y,R)&&x(y,R)){const te=u[y];te.delete(R),te.size===0&&(window.removeEventListener(y,b),u[y]=void 0)}q.has(R)&&q.delete(R),q.size===0&&B.delete(_),B.size===0&&(window.removeEventListener(y,p,N==="capture"),c[N][y]=void 0)}return{on:S,off:E}}const{on:nt,off:Ze}=ly(),Nn=W(null);function lu(e){if(e.clientX>0||e.clientY>0)Nn.value={x:e.clientX,y:e.clientY};else{const{target:t}=e;if(t instanceof Element){const{left:r,top:o,width:n,height:i}=t.getBoundingClientRect();r>0||o>0?Nn.value={x:r+n/2,y:o+i/2}:Nn.value={x:0,y:0}}else Nn.value=null}}let Hi=0,su=!0;function bp(){if(!fc)return gr(W(null));Hi===0&&nt("click",document,lu,!0);const e=()=>{Hi+=1};return su&&(su=uc())?(Yr(e),It(()=>{Hi-=1,Hi===0&&Ze("click",document,lu,!0)})):e(),gr(Nn)}const sy=W(void 0);let ji=0;function cu(){sy.value=Date.now()}let du=!0;function xp(e){if(!fc)return gr(W(!1));const t=W(!1);let r=null;function o(){r!==null&&window.clearTimeout(r)}function n(){o(),t.value=!0,r=window.setTimeout(()=>{t.value=!1},e)}ji===0&&nt("click",window,cu,!0);const i=()=>{ji+=1,nt("click",window,n,!0)};return du&&(du=uc())?(Yr(i),It(()=>{ji-=1,ji===0&&Ze("click",window,cu,!0),Ze("click",window,n,!0),o()})):i(),gr(t)}function hn(e,t){return qe(e,r=>{r!==void 0&&(t.value=r)}),L(()=>e.value===void 0?t.value:e.value)}function xi(){const e=W(!1);return Ot(()=>{e.value=!0}),gr(e)}function di(e,t){return L(()=>{for(const r of t)if(e[r]!==void 0)return e[r];return e[t[t.length-1]]})}const cy=(typeof window=="undefined"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function dy(){return cy}function uy(e={},t){const r=ar({ctrl:!1,command:!1,win:!1,shift:!1,tab:!1}),{keydown:o,keyup:n}=e,i=s=>{switch(s.key){case"Control":r.ctrl=!0;break;case"Meta":r.command=!0,r.win=!0;break;case"Shift":r.shift=!0;break;case"Tab":r.tab=!0;break}o!==void 0&&Object.keys(o).forEach(d=>{if(d!==s.key)return;const c=o[d];if(typeof c=="function")c(s);else{const{stop:u=!1,prevent:f=!1}=c;u&&s.stopPropagation(),f&&s.preventDefault(),c.handler(s)}})},a=s=>{switch(s.key){case"Control":r.ctrl=!1;break;case"Meta":r.command=!1,r.win=!1;break;case"Shift":r.shift=!1;break;case"Tab":r.tab=!1;break}n!==void 0&&Object.keys(n).forEach(d=>{if(d!==s.key)return;const c=n[d];if(typeof c=="function")c(s);else{const{stop:u=!1,prevent:f=!1}=c;u&&s.stopPropagation(),f&&s.preventDefault(),c.handler(s)}})},l=()=>{(t===void 0||t.value)&&(nt("keydown",document,i),nt("keyup",document,a)),t!==void 0&&qe(t,s=>{s?(nt("keydown",document,i),nt("keyup",document,a)):(Ze("keydown",document,i),Ze("keyup",document,a))})};return uc()?(Yr(l),It(()=>{(t===void 0||t.value)&&(Ze("keydown",document,i),Ze("keyup",document,a))})):l(),gr(r)}const hc="n-modal-body",Cp="n-modal",pc="n-drawer-body",mc="n-popover-body",cO="n-internal-select-menu",fy="n-internal-select-menu-body",yp="__disabled__";function pn(e){const t=be(hc,null),r=be(pc,null),o=be(mc,null),n=be(fy,null);return ht(()=>{var i;const{to:a}=e;return a!==void 0?a===!1?yp:a===!0?"body":a:t!=null&&t.value?(i=t.value.$el)!==null&&i!==void 0?i:t.value:r!=null&&r.value?r.value:o!=null&&o.value?o.value:n!=null&&n.value?n.value:a!=null?a:"body"})}pn.tdkey=yp;pn.propTo={type:[String,Object,Boolean],default:void 0};function hy(e,t,r){var o;const n=be(e,null);if(n===null)return;const i=(o=Zr())===null||o===void 0?void 0:o.proxy;qe(r,a),a(r.value),It(()=>{a(void 0,r.value)});function a(d,c){const u=n[t];c!==void 0&&l(u,c),d!==void 0&&s(u,d)}function l(d,c){d[c]||(d[c]=[]),d[c].splice(d[c].findIndex(u=>u===i),1)}function s(d,c){d[c]||(d[c]=[]),~d[c].findIndex(u=>u===i)||d[c].push(i)}}function py(e,t,r){if(!t)return e;const o=W(e.value);let n=null;return qe(e,i=>{n!==null&&window.clearTimeout(n),i===!0?r&&!r.value?o.value=!0:n=window.setTimeout(()=>{o.value=!0},t):o.value=!1}),o}const ss="n-form-item";function wp(e,{defaultSize:t="medium",mergedSize:r,mergedDisabled:o}={}){const n=be(ss,null);je(ss,null);const i=L(r?()=>r(n):()=>{const{size:s}=e;if(s)return s;if(n){const{mergedSize:d}=n;if(d.value!==void 0)return d.value}return t}),a=L(o?()=>o(n):()=>{const{disabled:s}=e;return s!==void 0?s:n?n.disabled.value:!1}),l=L(()=>{const{status:s}=e;return s||(n==null?void 0:n.mergedValidationStatus.value)});return It(()=>{n&&n.restoreValidation()}),{mergedSizeRef:i,mergedDisabledRef:a,mergedStatusRef:l,nTriggerFormBlur(){n&&n.handleContentBlur()},nTriggerFormChange(){n&&n.handleContentChange()},nTriggerFormFocus(){n&&n.handleContentFocus()},nTriggerFormInput(){n&&n.handleContentInput()}}}var my=typeof global=="object"&&global&&global.Object===Object&&global,Sp=my,vy=typeof self=="object"&&self&&self.Object===Object&&self,gy=Sp||vy||Function("return this")(),dr=gy,by=dr.Symbol,Ur=by,_p=Object.prototype,xy=_p.hasOwnProperty,Cy=_p.toString,An=Ur?Ur.toStringTag:void 0;function yy(e){var t=xy.call(e,An),r=e[An];try{e[An]=void 0;var o=!0}catch{}var n=Cy.call(e);return o&&(t?e[An]=r:delete e[An]),n}var wy=Object.prototype,Sy=wy.toString;function _y(e){return Sy.call(e)}var $y="[object Null]",Py="[object Undefined]",uu=Ur?Ur.toStringTag:void 0;function To(e){return e==null?e===void 0?Py:$y:uu&&uu in Object(e)?yy(e):_y(e)}function qr(e){return e!=null&&typeof e=="object"}var ky="[object Symbol]";function Ha(e){return typeof e=="symbol"||qr(e)&&To(e)==ky}function $p(e,t){for(var r=-1,o=e==null?0:e.length,n=Array(o);++r0){if(++t>=aw)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function dw(e){return function(){return e}}var uw=function(){try{var e=Ro(Object,"defineProperty");return e({},"",{}),e}catch{}}(),fa=uw,fw=fa?function(e,t){return fa(e,"toString",{configurable:!0,enumerable:!1,value:dw(t),writable:!0})}:vc,hw=fw,pw=cw(hw),mw=pw,vw=9007199254740991,gw=/^(?:0|[1-9]\d*)$/;function bc(e,t){var r=typeof e;return t=t==null?vw:t,!!t&&(r=="number"||r!="symbol"&&gw.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=_w}function _n(e){return e!=null&&Cc(e.length)&&!gc(e)}function $w(e,t,r){if(!rr(r))return!1;var o=typeof t;return(o=="number"?_n(r)&&bc(t,r.length):o=="string"&&t in r)?Ci(r[t],e):!1}function Pw(e){return Sw(function(t,r){var o=-1,n=r.length,i=n>1?r[n-1]:void 0,a=n>2?r[2]:void 0;for(i=e.length>3&&typeof i=="function"?(n--,i):void 0,a&&$w(r[0],r[1],a)&&(i=n<3?void 0:i,n=1),t=Object(t);++o-1}function WS(e,t){var r=this.__data__,o=ja(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}function Rr(e){var t=-1,r=e==null?0:e.length;for(this.clear();++tn?0:n+t),r=r>n?n:r,r<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(n);++o=o?e:h2(e,t,r)}var m2="\\ud800-\\udfff",v2="\\u0300-\\u036f",g2="\\ufe20-\\ufe2f",b2="\\u20d0-\\u20ff",x2=v2+g2+b2,C2="\\ufe0e\\ufe0f",y2="\\u200d",w2=RegExp("["+y2+m2+x2+C2+"]");function Dp(e){return w2.test(e)}function S2(e){return e.split("")}var Fp="\\ud800-\\udfff",_2="\\u0300-\\u036f",$2="\\ufe20-\\ufe2f",P2="\\u20d0-\\u20ff",k2=_2+$2+P2,T2="\\ufe0e\\ufe0f",E2="["+Fp+"]",ds="["+k2+"]",us="\\ud83c[\\udffb-\\udfff]",R2="(?:"+ds+"|"+us+")",Hp="[^"+Fp+"]",jp="(?:\\ud83c[\\udde6-\\uddff]){2}",Np="[\\ud800-\\udbff][\\udc00-\\udfff]",z2="\\u200d",Wp=R2+"?",Vp="["+T2+"]?",A2="(?:"+z2+"(?:"+[Hp,jp,Np].join("|")+")"+Vp+Wp+")*",O2=Vp+Wp+A2,I2="(?:"+[Hp+ds+"?",ds,jp,Np,E2].join("|")+")",M2=RegExp(us+"(?="+us+")|"+I2+O2,"g");function B2(e){return e.match(M2)||[]}function L2(e){return Dp(e)?B2(e):S2(e)}function D2(e){return function(t){t=Op(t);var r=Dp(t)?L2(t):void 0,o=r?r[0]:t.charAt(0),n=r?p2(r,1).join(""):t.slice(1);return o[e]()+n}}var F2=D2("toUpperCase"),H2=F2;function j2(){this.__data__=new Rr,this.size=0}function N2(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function W2(e){return this.__data__.get(e)}function V2(e){return this.__data__.has(e)}var K2=200;function U2(e,t){var r=this.__data__;if(r instanceof Rr){var o=r.__data__;if(!fi||o.lengthl))return!1;var d=i.get(e),c=i.get(t);if(d&&c)return d==t&&c==e;var u=-1,f=!0,h=r&y_?new va:void 0;for(i.set(e,t),i.set(t,e);++u=t||y<0||u&&_>=i}function v(){var E=Cl();if(g(E))return w(E);l=setTimeout(v,b(E))}function w(E){return l=void 0,f&&o?h(E):(o=n=void 0,a)}function $(){l!==void 0&&clearTimeout(l),d=0,o=s=n=l=void 0}function x(){return l===void 0?a:w(Cl())}function S(){var E=Cl(),y=g(E);if(o=arguments,n=this,s=E,y){if(l===void 0)return p(s);if(u)return clearTimeout(l),l=setTimeout(v,t),h(s)}return l===void 0&&(l=setTimeout(v,t)),a}return S.cancel=$,S.flush=x,S}function ms(e,t,r){(r!==void 0&&!Ci(e[t],r)||r===void 0&&!(t in e))&&xc(e,t,r)}function g5(e){return qr(e)&&_n(e)}function vs(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function b5(e){return yw(e,Ap(e))}function x5(e,t,r,o,n,i,a){var l=vs(e,r),s=vs(t,r),d=a.get(s);if(d){ms(e,r,d);return}var c=i?i(l,s,r+"",e,t,a):void 0,u=c===void 0;if(u){var f=tr(s),h=!f&&pa(s),p=!f&&!h&&wc(s);c=s,f||h||p?tr(l)?c=l:g5(l)?c=iw(l):h?(u=!1,c=G2(s,!0)):p?(u=!1,c=h_(s,!0)):c=[]:f2(s)||ha(s)?(c=l,ha(l)?c=b5(l):(!rr(l)||gc(l))&&(c=p_(s))):u=!1}u&&(a.set(s,c),n(c,s,o,i,a),a.delete(s)),ms(e,r,c)}function Xp(e,t,r,o,n){e!==t&&Yp(t,function(i,a){if(n||(n=new mr),rr(i))x5(e,t,a,r,Xp,o,n);else{var l=o?o(vs(e,a),i,a+"",e,t,n):void 0;l===void 0&&(l=i),ms(e,a,l)}},Ap)}function C5(e,t){var r=-1,o=_n(e)?Array(e.length):[];return u5(e,function(n,i,a){o[++r]=t(n,i,a)}),o}function y5(e,t){var r=tr(e)?$p:C5;return r(e,i5(t))}var w5=Pw(function(e,t,r){Xp(e,t,r)}),Xo=w5,S5="Expected a function";function yl(e,t,r){var o=!0,n=!0;if(typeof e!="function")throw new TypeError(S5);return rr(r)&&(o="leading"in r?!!r.leading:o,n="trailing"in r?!!r.trailing:n),v5(e,t,{leading:o,maxWait:t,trailing:n})}const Zp=Symbol("@css-render/vue3-ssr");function _5(e,t){return``}function $5(e,t){const r=be(Zp,null);if(r===null){console.error("[css-render/vue3-ssr]: no ssr context found.");return}const{styles:o,ids:n}=r;n.has(e)||o!==null&&(n.add(e),o.push(_5(e,t)))}function $n(){const e=be(Zp,null);if(e!==null)return{adapter:$5,context:e}}var yr={fontFamily:'v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontFamilyMono:"v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace",fontWeight:"400",fontWeightStrong:"500",cubicBezierEaseInOut:"cubic-bezier(.4, 0, .2, 1)",cubicBezierEaseOut:"cubic-bezier(0, 0, .2, 1)",cubicBezierEaseIn:"cubic-bezier(.4, 0, 1, 1)",borderRadius:"3px",borderRadiusSmall:"2px",fontSize:"14px",fontSizeTiny:"12px",fontSizeSmall:"14px",fontSizeMedium:"14px",fontSizeLarge:"15px",fontSizeHuge:"16px",lineHeight:"1.6",heightTiny:"22px",heightSmall:"28px",heightMedium:"34px",heightLarge:"40px",heightHuge:"46px"};const{fontSize:P5,fontFamily:k5,lineHeight:T5}=yr;var Jp=z("body",` - margin: 0; - font-size: ${P5}; - font-family: ${k5}; - line-height: ${T5}; - -webkit-text-size-adjust: 100%; - -webkit-tap-highlight-color: transparent; -`,[z("input",` - font-family: inherit; - font-size: inherit; - `)]);const Gr="n-config-provider",hi="naive-ui-style";function dO(e){return e}function ze(e,t,r,o,n,i){const a=$n();if(r){const d=()=>{const c=i==null?void 0:i.value;r.mount({id:c===void 0?t:c+t,head:!0,props:{bPrefix:c?`.${c}-`:void 0},anchorMetaName:hi,ssr:a}),Jp.mount({id:"n-global",head:!0,anchorMetaName:hi,ssr:a})};a?d():Yr(d)}const l=be(Gr,null);return L(()=>{var d;const{theme:{common:c,self:u,peers:f={}}={},themeOverrides:h={},builtinThemeOverrides:p={}}=n,{common:b,peers:g}=h,{common:v=void 0,[e]:{common:w=void 0,self:$=void 0,peers:x={}}={}}=(l==null?void 0:l.mergedThemeRef.value)||{},{common:S=void 0,[e]:E={}}=(l==null?void 0:l.mergedThemeOverridesRef.value)||{},{common:y,peers:_={}}=E,R=Xo({},c||w||v||o.common,S,y,b),P=Xo((d=u||$||o.self)===null||d===void 0?void 0:d(R),p,E,h);return{common:R,self:P,peers:Xo({},o.peers,x,f),peerOverrides:Xo({},_,g)}})}ze.props={theme:Object,themeOverrides:Object,builtinThemeOverrides:Object};const Qp="n";function lt(e={},t={defaultBordered:!0}){const r=be(Gr,null);return{inlineThemeDisabled:r==null?void 0:r.inlineThemeDisabled,mergedRtlRef:r==null?void 0:r.mergedRtlRef,mergedComponentPropsRef:r==null?void 0:r.mergedComponentPropsRef,mergedBreakpointsRef:r==null?void 0:r.mergedBreakpointsRef,mergedBorderedRef:L(()=>{var o,n;const{bordered:i}=e;return i!==void 0?i:(n=(o=r==null?void 0:r.mergedBorderedRef.value)!==null&&o!==void 0?o:t.defaultBordered)!==null&&n!==void 0?n:!0}),mergedClsPrefixRef:L(()=>(r==null?void 0:r.mergedClsPrefixRef.value)||Qp),namespaceRef:L(()=>r==null?void 0:r.mergedNamespaceRef.value)}}const E5={name:"en-US",global:{undo:"Undo",redo:"Redo",confirm:"Confirm"},Popconfirm:{positiveText:"Confirm",negativeText:"Cancel"},Cascader:{placeholder:"Please Select",loading:"Loading",loadingRequiredMessage:e=>`Please load all ${e}'s descendants before checking it.`},Time:{dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},DatePicker:{yearFormat:"yyyy",monthFormat:"MMM",dayFormat:"eeeeee",yearTypeFormat:"yyyy",monthTypeFormat:"yyyy-MM",dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss",quarterFormat:"yyyy-qqq",clear:"Clear",now:"Now",confirm:"Confirm",selectTime:"Select Time",selectDate:"Select Date",datePlaceholder:"Select Date",datetimePlaceholder:"Select Date and Time",monthPlaceholder:"Select Month",yearPlaceholder:"Select Year",quarterPlaceholder:"Select Quarter",startDatePlaceholder:"Start Date",endDatePlaceholder:"End Date",startDatetimePlaceholder:"Start Date and Time",endDatetimePlaceholder:"End Date and Time",monthBeforeYear:!0,firstDayOfWeek:6,today:"Today"},DataTable:{checkTableAll:"Select all in the table",uncheckTableAll:"Unselect all in the table",confirm:"Confirm",clear:"Clear"},Transfer:{sourceTitle:"Source",targetTitle:"Target"},Empty:{description:"No Data"},Select:{placeholder:"Please Select"},TimePicker:{placeholder:"Select Time",positiveText:"OK",negativeText:"Cancel",now:"Now"},Pagination:{goto:"Goto",selectionSuffix:"page"},DynamicTags:{add:"Add"},Log:{loading:"Loading"},Input:{placeholder:"Please Input"},InputNumber:{placeholder:"Please Input"},DynamicInput:{create:"Create"},ThemeEditor:{title:"Theme Editor",clearAllVars:"Clear All Variables",clearSearch:"Clear Search",filterCompName:"Filter Component Name",filterVarName:"Filter Variable Name",import:"Import",export:"Export",restore:"Reset to Default"},Image:{tipPrevious:"Previous picture (\u2190)",tipNext:"Next picture (\u2192)",tipCounterclockwise:"Counterclockwise",tipClockwise:"Clockwise",tipZoomOut:"Zoom out",tipZoomIn:"Zoom in",tipClose:"Close (Esc)"}};var R5=E5;function wl(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth,o=e.formats[r]||e.formats[e.defaultWidth];return o}}function On(e){return function(t,r){var o=r||{},n=o.context?String(o.context):"standalone",i;if(n==="formatting"&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,l=o.width?String(o.width):a;i=e.formattingValues[l]||e.formattingValues[a]}else{var s=e.defaultWidth,d=o.width?String(o.width):e.defaultWidth;i=e.values[d]||e.values[s]}var c=e.argumentCallback?e.argumentCallback(t):t;return i[c]}}function z5(e){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=t.match(e.matchPattern);if(!o)return null;var n=o[0],i=t.match(e.parsePattern);if(!i)return null;var a=e.valueCallback?e.valueCallback(i[0]):i[0];a=r.valueCallback?r.valueCallback(a):a;var l=t.slice(n.length);return{value:a,rest:l}}}function In(e){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=r.width,n=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],i=t.match(n);if(!i)return null;var a=i[0],l=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(l)?O5(l,function(u){return u.test(a)}):A5(l,function(u){return u.test(a)}),d;d=e.valueCallback?e.valueCallback(s):s,d=r.valueCallback?r.valueCallback(d):d;var c=t.slice(a.length);return{value:d,rest:c}}}function A5(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function O5(e,t){for(var r=0;r0?"in "+o:o+" ago":o},B5=M5,L5={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},D5={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},F5={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},H5={date:wl({formats:L5,defaultWidth:"full"}),time:wl({formats:D5,defaultWidth:"full"}),dateTime:wl({formats:F5,defaultWidth:"full"})},j5=H5,N5={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},W5=function(e,t,r,o){return N5[e]},V5=W5,K5={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},U5={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},q5={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},G5={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Y5={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},X5={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Z5=function(e,t){var r=Number(e),o=r%100;if(o>20||o<10)switch(o%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},J5={ordinalNumber:Z5,era:On({values:K5,defaultWidth:"wide"}),quarter:On({values:U5,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:On({values:q5,defaultWidth:"wide"}),day:On({values:G5,defaultWidth:"wide"}),dayPeriod:On({values:Y5,defaultWidth:"wide",formattingValues:X5,defaultFormattingWidth:"wide"})},Q5=J5,e$=/^(\d+)(th|st|nd|rd)?/i,t$=/\d+/i,r$={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},o$={any:[/^b/i,/^(a|c)/i]},n$={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},i$={any:[/1/i,/2/i,/3/i,/4/i]},a$={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},l$={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},s$={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},c$={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},d$={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},u$={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},f$={ordinalNumber:z5({matchPattern:e$,parsePattern:t$,valueCallback:function(e){return parseInt(e,10)}}),era:In({matchPatterns:r$,defaultMatchWidth:"wide",parsePatterns:o$,defaultParseWidth:"any"}),quarter:In({matchPatterns:n$,defaultMatchWidth:"wide",parsePatterns:i$,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:In({matchPatterns:a$,defaultMatchWidth:"wide",parsePatterns:l$,defaultParseWidth:"any"}),day:In({matchPatterns:s$,defaultMatchWidth:"wide",parsePatterns:c$,defaultParseWidth:"any"}),dayPeriod:In({matchPatterns:d$,defaultMatchWidth:"any",parsePatterns:u$,defaultParseWidth:"any"})},h$=f$,p$={code:"en-US",formatDistance:B5,formatLong:j5,formatRelative:V5,localize:Q5,match:h$,options:{weekStartsOn:0,firstWeekContainsDate:1}},m$=p$;const v$={name:"en-US",locale:m$};var g$=v$;function em(e){const{mergedLocaleRef:t,mergedDateLocaleRef:r}=be(Gr,null)||{},o=L(()=>{var i,a;return(a=(i=t==null?void 0:t.value)===null||i===void 0?void 0:i[e])!==null&&a!==void 0?a:R5[e]});return{dateLocaleRef:L(()=>{var i;return(i=r==null?void 0:r.value)!==null&&i!==void 0?i:g$}),localeRef:o}}function Jr(e,t,r){if(!t)return;const o=$n(),n=()=>{const i=r==null?void 0:r.value;t.mount({id:i===void 0?e:i+e,head:!0,anchorMetaName:hi,props:{bPrefix:i?`.${i}-`:void 0},ssr:o}),Jp.mount({id:"n-global",head:!0,anchorMetaName:hi,ssr:o})};o?n():Yr(n)}function _t(e,t,r,o){var n;r||Da("useThemeClass","cssVarsRef is not passed");const i=(n=be(Gr,null))===null||n===void 0?void 0:n.mergedThemeHashRef,a=W(""),l=$n();let s;const d=`__${e}`,c=()=>{let u=d;const f=t?t.value:void 0,h=i==null?void 0:i.value;h&&(u+="-"+h),f&&(u+="-"+f);const{themeOverrides:p,builtinThemeOverrides:b}=o;p&&(u+="-"+ci(JSON.stringify(p))),b&&(u+="-"+ci(JSON.stringify(b))),a.value=u,s=()=>{const g=r.value;let v="";for(const w in g)v+=`${w}: ${g[w]};`;z(`.${u}`,v).mount({id:u,ssr:l}),s=void 0}};return xr(()=>{c()}),{themeClass:a,onRender:()=>{s==null||s()}}}var b$=oe({name:"Add",render(){return m("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M256 112V400M400 256H112",stroke:"currentColor","stroke-width":"32","stroke-linecap":"round","stroke-linejoin":"round"}))}});function wr(e,t){return oe({name:H2(e),setup(){var r;const o=(r=be(Gr,null))===null||r===void 0?void 0:r.mergedIconsRef;return()=>{var n;const i=(n=o==null?void 0:o.value)===null||n===void 0?void 0:n[e];return i?i():t}}})}var x$=oe({name:"ChevronRight",render(){return m("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M5.64645 3.14645C5.45118 3.34171 5.45118 3.65829 5.64645 3.85355L9.79289 8L5.64645 12.1464C5.45118 12.3417 5.45118 12.6583 5.64645 12.8536C5.84171 13.0488 6.15829 13.0488 6.35355 12.8536L10.8536 8.35355C11.0488 8.15829 11.0488 7.84171 10.8536 7.64645L6.35355 3.14645C6.15829 2.95118 5.84171 2.95118 5.64645 3.14645Z",fill:"currentColor"}))}}),C$=wr("close",m("svg",{viewBox:"0 0 12 12",version:"1.1",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},m("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},m("g",{fill:"currentColor","fill-rule":"nonzero"},m("path",{d:"M2.08859116,2.2156945 L2.14644661,2.14644661 C2.32001296,1.97288026 2.58943736,1.95359511 2.7843055,2.08859116 L2.85355339,2.14644661 L6,5.293 L9.14644661,2.14644661 C9.34170876,1.95118446 9.65829124,1.95118446 9.85355339,2.14644661 C10.0488155,2.34170876 10.0488155,2.65829124 9.85355339,2.85355339 L6.707,6 L9.85355339,9.14644661 C10.0271197,9.32001296 10.0464049,9.58943736 9.91140884,9.7843055 L9.85355339,9.85355339 C9.67998704,10.0271197 9.41056264,10.0464049 9.2156945,9.91140884 L9.14644661,9.85355339 L6,6.707 L2.85355339,9.85355339 C2.65829124,10.0488155 2.34170876,10.0488155 2.14644661,9.85355339 C1.95118446,9.65829124 1.95118446,9.34170876 2.14644661,9.14644661 L5.293,6 L2.14644661,2.85355339 C1.97288026,2.67998704 1.95359511,2.41056264 2.08859116,2.2156945 L2.14644661,2.14644661 L2.08859116,2.2156945 Z"}))))),y$=oe({name:"Eye",render(){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},m("path",{d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),m("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}))}}),w$=oe({name:"EyeOff",render(){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},m("path",{d:"M432 448a15.92 15.92 0 0 1-11.31-4.69l-352-352a16 16 0 0 1 22.62-22.62l352 352A16 16 0 0 1 432 448z",fill:"currentColor"}),m("path",{d:"M255.66 384c-41.49 0-81.5-12.28-118.92-36.5c-34.07-22-64.74-53.51-88.7-91v-.08c19.94-28.57 41.78-52.73 65.24-72.21a2 2 0 0 0 .14-2.94L93.5 161.38a2 2 0 0 0-2.71-.12c-24.92 21-48.05 46.76-69.08 76.92a31.92 31.92 0 0 0-.64 35.54c26.41 41.33 60.4 76.14 98.28 100.65C162 402 207.9 416 255.66 416a239.13 239.13 0 0 0 75.8-12.58a2 2 0 0 0 .77-3.31l-21.58-21.58a4 4 0 0 0-3.83-1a204.8 204.8 0 0 1-51.16 6.47z",fill:"currentColor"}),m("path",{d:"M490.84 238.6c-26.46-40.92-60.79-75.68-99.27-100.53C349 110.55 302 96 255.66 96a227.34 227.34 0 0 0-74.89 12.83a2 2 0 0 0-.75 3.31l21.55 21.55a4 4 0 0 0 3.88 1a192.82 192.82 0 0 1 50.21-6.69c40.69 0 80.58 12.43 118.55 37c34.71 22.4 65.74 53.88 89.76 91a.13.13 0 0 1 0 .16a310.72 310.72 0 0 1-64.12 72.73a2 2 0 0 0-.15 2.95l19.9 19.89a2 2 0 0 0 2.7.13a343.49 343.49 0 0 0 68.64-78.48a32.2 32.2 0 0 0-.1-34.78z",fill:"currentColor"}),m("path",{d:"M256 160a95.88 95.88 0 0 0-21.37 2.4a2 2 0 0 0-1 3.38l112.59 112.56a2 2 0 0 0 3.38-1A96 96 0 0 0 256 160z",fill:"currentColor"}),m("path",{d:"M165.78 233.66a2 2 0 0 0-3.38 1a96 96 0 0 0 115 115a2 2 0 0 0 1-3.38z",fill:"currentColor"}))}}),tm=wr("error",m("svg",{viewBox:"0 0 48 48",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},m("g",{stroke:"none","stroke-width":"1","fill-rule":"evenodd"},m("g",{"fill-rule":"nonzero"},m("path",{d:"M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M17.8838835,16.1161165 L17.7823881,16.0249942 C17.3266086,15.6583353 16.6733914,15.6583353 16.2176119,16.0249942 L16.1161165,16.1161165 L16.0249942,16.2176119 C15.6583353,16.6733914 15.6583353,17.3266086 16.0249942,17.7823881 L16.1161165,17.8838835 L22.233,24 L16.1161165,30.1161165 L16.0249942,30.2176119 C15.6583353,30.6733914 15.6583353,31.3266086 16.0249942,31.7823881 L16.1161165,31.8838835 L16.2176119,31.9750058 C16.6733914,32.3416647 17.3266086,32.3416647 17.7823881,31.9750058 L17.8838835,31.8838835 L24,25.767 L30.1161165,31.8838835 L30.2176119,31.9750058 C30.6733914,32.3416647 31.3266086,32.3416647 31.7823881,31.9750058 L31.8838835,31.8838835 L31.9750058,31.7823881 C32.3416647,31.3266086 32.3416647,30.6733914 31.9750058,30.2176119 L31.8838835,30.1161165 L25.767,24 L31.8838835,17.8838835 L31.9750058,17.7823881 C32.3416647,17.3266086 32.3416647,16.6733914 31.9750058,16.2176119 L31.8838835,16.1161165 L31.7823881,16.0249942 C31.3266086,15.6583353 30.6733914,15.6583353 30.2176119,16.0249942 L30.1161165,16.1161165 L24,22.233 L17.8838835,16.1161165 L17.7823881,16.0249942 L17.8838835,16.1161165 Z"}))))),rm=wr("info",m("svg",{viewBox:"0 0 28 28",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},m("g",{stroke:"none","stroke-width":"1","fill-rule":"evenodd"},m("g",{"fill-rule":"nonzero"},m("path",{d:"M14,2 C20.6274,2 26,7.37258 26,14 C26,20.6274 20.6274,26 14,26 C7.37258,26 2,20.6274 2,14 C2,7.37258 7.37258,2 14,2 Z M14,11 C13.4477,11 13,11.4477 13,12 L13,12 L13,20 C13,20.5523 13.4477,21 14,21 C14.5523,21 15,20.5523 15,20 L15,20 L15,12 C15,11.4477 14.5523,11 14,11 Z M14,6.75 C13.3096,6.75 12.75,7.30964 12.75,8 C12.75,8.69036 13.3096,9.25 14,9.25 C14.6904,9.25 15.25,8.69036 15.25,8 C15.25,7.30964 14.6904,6.75 14,6.75 Z"}))))),om=wr("success",m("svg",{viewBox:"0 0 48 48",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},m("g",{stroke:"none","stroke-width":"1","fill-rule":"evenodd"},m("g",{"fill-rule":"nonzero"},m("path",{d:"M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M32.6338835,17.6161165 C32.1782718,17.1605048 31.4584514,17.1301307 30.9676119,17.5249942 L30.8661165,17.6161165 L20.75,27.732233 L17.1338835,24.1161165 C16.6457281,23.6279612 15.8542719,23.6279612 15.3661165,24.1161165 C14.9105048,24.5717282 14.8801307,25.2915486 15.2749942,25.7823881 L15.3661165,25.8838835 L19.8661165,30.3838835 C20.3217282,30.8394952 21.0415486,30.8698693 21.5323881,30.4750058 L21.6338835,30.3838835 L32.6338835,19.3838835 C33.1220388,18.8957281 33.1220388,18.1042719 32.6338835,17.6161165 Z"}))))),nm=wr("warning",m("svg",{viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},m("g",{stroke:"none","stroke-width":"1","fill-rule":"evenodd"},m("g",{"fill-rule":"nonzero"},m("path",{d:"M12,2 C17.523,2 22,6.478 22,12 C22,17.522 17.523,22 12,22 C6.477,22 2,17.522 2,12 C2,6.478 6.477,2 12,2 Z M12.0018002,15.0037242 C11.450254,15.0037242 11.0031376,15.4508407 11.0031376,16.0023869 C11.0031376,16.553933 11.450254,17.0010495 12.0018002,17.0010495 C12.5533463,17.0010495 13.0004628,16.553933 13.0004628,16.0023869 C13.0004628,15.4508407 12.5533463,15.0037242 12.0018002,15.0037242 Z M11.99964,7 C11.4868042,7.00018474 11.0642719,7.38637706 11.0066858,7.8837365 L11,8.00036004 L11.0018003,13.0012393 L11.00857,13.117858 C11.0665141,13.6151758 11.4893244,14.0010638 12.0021602,14.0008793 C12.514996,14.0006946 12.9375283,13.6145023 12.9951144,13.1171428 L13.0018002,13.0005193 L13,7.99964009 L12.9932303,7.8830214 C12.9352861,7.38570354 12.5124758,6.99981552 11.99964,7 Z"}))))),S$=oe({name:"ChevronDown",render(){return m("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M3.14645 5.64645C3.34171 5.45118 3.65829 5.45118 3.85355 5.64645L8 9.79289L12.1464 5.64645C12.3417 5.45118 12.6583 5.45118 12.8536 5.64645C13.0488 5.84171 13.0488 6.15829 12.8536 6.35355L8.35355 10.8536C8.15829 11.0488 7.84171 11.0488 7.64645 10.8536L3.14645 6.35355C2.95118 6.15829 2.95118 5.84171 3.14645 5.64645Z",fill:"currentColor"}))}}),_$=wr("clear",m("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},m("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},m("g",{fill:"currentColor","fill-rule":"nonzero"},m("path",{d:"M8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 C2,4.6862915 4.6862915,2 8,2 Z M6.5343055,5.83859116 C6.33943736,5.70359511 6.07001296,5.72288026 5.89644661,5.89644661 L5.89644661,5.89644661 L5.83859116,5.9656945 C5.70359511,6.16056264 5.72288026,6.42998704 5.89644661,6.60355339 L5.89644661,6.60355339 L7.293,8 L5.89644661,9.39644661 L5.83859116,9.4656945 C5.70359511,9.66056264 5.72288026,9.92998704 5.89644661,10.1035534 L5.89644661,10.1035534 L5.9656945,10.1614088 C6.16056264,10.2964049 6.42998704,10.2771197 6.60355339,10.1035534 L6.60355339,10.1035534 L8,8.707 L9.39644661,10.1035534 L9.4656945,10.1614088 C9.66056264,10.2964049 9.92998704,10.2771197 10.1035534,10.1035534 L10.1035534,10.1035534 L10.1614088,10.0343055 C10.2964049,9.83943736 10.2771197,9.57001296 10.1035534,9.39644661 L10.1035534,9.39644661 L8.707,8 L10.1035534,6.60355339 L10.1614088,6.5343055 C10.2964049,6.33943736 10.2771197,6.07001296 10.1035534,5.89644661 L10.1035534,5.89644661 L10.0343055,5.83859116 C9.83943736,5.70359511 9.57001296,5.72288026 9.39644661,5.89644661 L9.39644661,5.89644661 L8,7.293 L6.60355339,5.89644661 Z"}))))),$$=oe({name:"ChevronDownFilled",render(){return m("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M3.20041 5.73966C3.48226 5.43613 3.95681 5.41856 4.26034 5.70041L8 9.22652L11.7397 5.70041C12.0432 5.41856 12.5177 5.43613 12.7996 5.73966C13.0815 6.0432 13.0639 6.51775 12.7603 6.7996L8.51034 10.7996C8.22258 11.0668 7.77743 11.0668 7.48967 10.7996L3.23966 6.7996C2.93613 6.51775 2.91856 6.0432 3.20041 5.73966Z",fill:"currentColor"}))}}),P$=wr("rotateClockwise",m("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 12.7916 15.3658 15.2026 13 16.3265V14.5C13 14.2239 12.7761 14 12.5 14C12.2239 14 12 14.2239 12 14.5V17.5C12 17.7761 12.2239 18 12.5 18H15.5C15.7761 18 16 17.7761 16 17.5C16 17.2239 15.7761 17 15.5 17H13.8758C16.3346 15.6357 18 13.0128 18 10C18 5.58172 14.4183 2 10 2C5.58172 2 2 5.58172 2 10C2 10.2761 2.22386 10.5 2.5 10.5C2.77614 10.5 3 10.2761 3 10Z",fill:"currentColor"}),m("path",{d:"M10 12C11.1046 12 12 11.1046 12 10C12 8.89543 11.1046 8 10 8C8.89543 8 8 8.89543 8 10C8 11.1046 8.89543 12 10 12ZM10 11C9.44772 11 9 10.5523 9 10C9 9.44772 9.44772 9 10 9C10.5523 9 11 9.44772 11 10C11 10.5523 10.5523 11 10 11Z",fill:"currentColor"}))),k$=wr("rotateClockwise",m("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M17 10C17 6.13401 13.866 3 10 3C6.13401 3 3 6.13401 3 10C3 12.7916 4.63419 15.2026 7 16.3265V14.5C7 14.2239 7.22386 14 7.5 14C7.77614 14 8 14.2239 8 14.5V17.5C8 17.7761 7.77614 18 7.5 18H4.5C4.22386 18 4 17.7761 4 17.5C4 17.2239 4.22386 17 4.5 17H6.12422C3.66539 15.6357 2 13.0128 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10C18 10.2761 17.7761 10.5 17.5 10.5C17.2239 10.5 17 10.2761 17 10Z",fill:"currentColor"}),m("path",{d:"M10 12C8.89543 12 8 11.1046 8 10C8 8.89543 8.89543 8 10 8C11.1046 8 12 8.89543 12 10C12 11.1046 11.1046 12 10 12ZM10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}))),T$=wr("zoomIn",m("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5Z",fill:"currentColor"}),m("path",{d:"M8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z",fill:"currentColor"}))),E$=wr("zoomOut",m("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11Z",fill:"currentColor"}),m("path",{d:"M14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z",fill:"currentColor"}))),Va=oe({name:"BaseIconSwitchTransition",setup(e,{slots:t}){const r=xi();return()=>m(At,{name:"icon-switch-transition",appear:r.value},t)}}),Ka=oe({name:"FadeInExpandTransition",props:{appear:Boolean,group:Boolean,mode:String,onLeave:Function,onAfterLeave:Function,onAfterEnter:Function,width:Boolean,reverse:Boolean},setup(e,{slots:t}){function r(l){e.width?l.style.maxWidth=`${l.offsetWidth}px`:l.style.maxHeight=`${l.offsetHeight}px`,l.offsetWidth}function o(l){e.width?l.style.maxWidth="0":l.style.maxHeight="0",l.offsetWidth;const{onLeave:s}=e;s&&s()}function n(l){e.width?l.style.maxWidth="":l.style.maxHeight="";const{onAfterLeave:s}=e;s&&s()}function i(l){if(l.style.transition="none",e.width){const s=l.offsetWidth;l.style.maxWidth="0",l.offsetWidth,l.style.transition="",l.style.maxWidth=`${s}px`}else if(e.reverse)l.style.maxHeight=`${l.offsetHeight}px`,l.offsetHeight,l.style.transition="",l.style.maxHeight="0";else{const s=l.offsetHeight;l.style.maxHeight="0",l.offsetWidth,l.style.transition="",l.style.maxHeight=`${s}px`}l.offsetWidth}function a(l){var s;e.width?l.style.maxWidth="":e.reverse||(l.style.maxHeight=""),(s=e.onAfterEnter)===null||s===void 0||s.call(e)}return()=>{const l=e.group?rc:At;return m(l,{name:e.width?"fade-in-width-expand-transition":"fade-in-height-expand-transition",mode:e.mode,appear:e.appear,onEnter:i,onAfterEnter:a,onBeforeLeave:r,onLeave:o,onAfterLeave:n},t)}}}),R$=M("base-icon",` - height: 1em; - width: 1em; - line-height: 1em; - text-align: center; - display: inline-block; - position: relative; - fill: currentColor; - transform: translateZ(0); -`,[z("svg",{height:"1em",width:"1em"})]),Bt=oe({name:"BaseIcon",props:{role:String,ariaLabel:String,ariaDisabled:{type:Boolean,default:void 0},ariaHidden:{type:Boolean,default:void 0},clsPrefix:{type:String,required:!0},onClick:Function,onMousedown:Function,onMouseup:Function},setup(e){Jr("-base-icon",R$,Oe(e,"clsPrefix"))},render(){return m("i",{class:`${this.clsPrefix}-base-icon`,onClick:this.onClick,onMousedown:this.onMousedown,onMouseup:this.onMouseup,role:this.role,"aria-label":this.ariaLabel,"aria-hidden":this.ariaHidden,"aria-disabled":this.ariaDisabled},this.$slots)}}),z$=M("base-close",` - cursor: pointer; - color: var(--n-close-color); -`,[z("&:hover",{color:"var(--n-close-color-hover)"}),z("&:active",{color:"var(--n-close-color-pressed)"}),K("disabled",{cursor:"not-allowed!important",color:"var(--n-close-color-disabled)"})]),yi=oe({name:"BaseClose",props:{clsPrefix:{type:String,required:!0},disabled:{type:Boolean,default:void 0},onClick:Function},setup(e){return Jr("-base-close",z$,Oe(e,"clsPrefix")),()=>{const{clsPrefix:t,disabled:r}=e;return m(Bt,{role:"button",ariaDisabled:r,ariaLabel:"close",clsPrefix:t,class:[`${t}-base-close`,r&&`${t}-base-close--disabled`],onClick:r?void 0:e.onClick},{default:()=>m(C$,null)})}}});const{cubicBezierEaseInOut:A$}=yr;function pi({originalTransform:e="",left:t=0,top:r=0,transition:o=`all .3s ${A$} !important`}={}){return[z("&.icon-switch-transition-enter-from, &.icon-switch-transition-leave-to",{transform:e+" scale(0.75)",left:t,top:r,opacity:0}),z("&.icon-switch-transition-enter-to, &.icon-switch-transition-leave-from",{transform:`scale(1) ${e}`,left:t,top:r,opacity:1}),z("&.icon-switch-transition-enter-active, &.icon-switch-transition-leave-active",{transformOrigin:"center",position:"absolute",left:t,top:r,transition:o})]}var O$=z([z("@keyframes loading-container-rotate",` - to { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } - `),z("@keyframes loading-layer-rotate",` - 12.5% { - -webkit-transform: rotate(135deg); - transform: rotate(135deg); - } - 25% { - -webkit-transform: rotate(270deg); - transform: rotate(270deg); - } - 37.5% { - -webkit-transform: rotate(405deg); - transform: rotate(405deg); - } - 50% { - -webkit-transform: rotate(540deg); - transform: rotate(540deg); - } - 62.5% { - -webkit-transform: rotate(675deg); - transform: rotate(675deg); - } - 75% { - -webkit-transform: rotate(810deg); - transform: rotate(810deg); - } - 87.5% { - -webkit-transform: rotate(945deg); - transform: rotate(945deg); - } - 100% { - -webkit-transform: rotate(1080deg); - transform: rotate(1080deg); - } - `),z("@keyframes loading-left-spin",` - from { - -webkit-transform: rotate(265deg); - transform: rotate(265deg); - } - 50% { - -webkit-transform: rotate(130deg); - transform: rotate(130deg); - } - to { - -webkit-transform: rotate(265deg); - transform: rotate(265deg); - } - `),z("@keyframes loading-right-spin",` - from { - -webkit-transform: rotate(-265deg); - transform: rotate(-265deg); - } - 50% { - -webkit-transform: rotate(-130deg); - transform: rotate(-130deg); - } - to { - -webkit-transform: rotate(-265deg); - transform: rotate(-265deg); - } - `),M("base-loading",` - position: relative; - line-height: 0; - width: 1em; - height: 1em; - `,[F("transition-wrapper",` - position: absolute; - width: 100%; - height: 100%; - `,[pi()]),F("container",` - display: inline-flex; - position: relative; - direction: ltr; - line-height: 0; - animation: loading-container-rotate 1568.2352941176ms linear infinite; - font-size: 0; - letter-spacing: 0; - white-space: nowrap; - opacity: 1; - width: 100%; - height: 100%; - `,[F("svg",` - stroke: var(--n-text-color); - fill: transparent; - position: absolute; - height: 100%; - overflow: hidden; - `),F("container-layer",` - position: absolute; - width: 100%; - height: 100%; - animation: loading-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both; - `,[F("container-layer-left",` - display: inline-flex; - position: relative; - width: 50%; - height: 100%; - overflow: hidden; - `,[F("svg",` - animation: loading-left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both; - width: 200%; - `)]),F("container-layer-patch",` - position: absolute; - top: 0; - left: 47.5%; - box-sizing: border-box; - width: 5%; - height: 100%; - overflow: hidden; - `,[F("svg",` - left: -900%; - width: 2000%; - transform: rotate(180deg); - `)]),F("container-layer-right",` - display: inline-flex; - position: relative; - width: 50%; - height: 100%; - overflow: hidden; - `,[F("svg",` - animation: loading-right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both; - left: -100%; - width: 200%; - `)])])]),F("placeholder",` - position: absolute; - left: 50%; - top: 50%; - transform: translateX(-50%) translateY(-50%); - `,[pi({left:"50%",top:"50%",originalTransform:"translateX(-50%) translateY(-50%)"})])])]),Ua=oe({name:"BaseLoading",props:{clsPrefix:{type:String,required:!0},scale:{type:Number,default:1},radius:{type:Number,default:100},strokeWidth:{type:Number,default:28},stroke:{type:String,default:void 0},show:{type:Boolean,default:!0}},setup(e){Jr("-base-loading",O$,Oe(e,"clsPrefix"))},render(){const{clsPrefix:e,radius:t,strokeWidth:r,stroke:o,scale:n}=this,i=t/n;return m("div",{class:`${e}-base-loading`,role:"img","aria-label":"loading"},m(Va,null,{default:()=>this.show?m("div",{key:"icon",class:`${e}-base-loading__transition-wrapper`},m("div",{class:`${e}-base-loading__container`},m("div",{class:`${e}-base-loading__container-layer`},m("div",{class:`${e}-base-loading__container-layer-left`},m("svg",{class:`${e}-base-loading__svg`,viewBox:`0 0 ${2*i} ${2*i}`,xmlns:"http://www.w3.org/2000/svg",style:{color:o}},m("circle",{fill:"none",stroke:"currentColor","stroke-width":r,"stroke-linecap":"round",cx:i,cy:i,r:t-r/2,"stroke-dasharray":4.91*t,"stroke-dashoffset":2.46*t}))),m("div",{class:`${e}-base-loading__container-layer-patch`},m("svg",{class:`${e}-base-loading__svg`,viewBox:`0 0 ${2*i} ${2*i}`,xmlns:"http://www.w3.org/2000/svg",style:{color:o}},m("circle",{fill:"none",stroke:"currentColor","stroke-width":r,"stroke-linecap":"round",cx:i,cy:i,r:t-r/2,"stroke-dasharray":4.91*t,"stroke-dashoffset":2.46*t}))),m("div",{class:`${e}-base-loading__container-layer-right`},m("svg",{class:`${e}-base-loading__svg`,viewBox:`0 0 ${2*i} ${2*i}`,xmlns:"http://www.w3.org/2000/svg",style:{color:o}},m("circle",{fill:"none",stroke:"currentColor","stroke-width":r,"stroke-linecap":"round",cx:i,cy:i,r:t-r/2,"stroke-dasharray":4.91*t,"stroke-dashoffset":2.46*t})))))):m("div",{key:"placeholder",class:`${e}-base-loading__placeholder`},this.$slots)}))}});function Fu(e){return Array.isArray(e)?e:[e]}const gs={STOP:"STOP"};function im(e,t){const r=t(e);e.children!==void 0&&r!==gs.STOP&&e.children.forEach(o=>im(o,t))}function I$(e,t={}){const{preserveGroup:r=!1}=t,o=[],n=r?a=>{a.isLeaf||(o.push(a.key),i(a.children))}:a=>{a.isLeaf||(a.isGroup||o.push(a.key),i(a.children))};function i(a){a.forEach(n)}return i(e),o}function M$(e,t){const{isLeaf:r}=e;return r!==void 0?r:!t(e)}function B$(e){return e.children}function L$(e){return e.key}function D$(){return!1}function F$(e,t){const{isLeaf:r}=e;return!(r===!1&&!Array.isArray(t(e)))}function H$(e){return e.disabled===!0}function j$(e,t){return e.isLeaf===!1&&!Array.isArray(t(e))}function Sl(e){var t;return e==null?[]:Array.isArray(e)?e:(t=e.checkedKeys)!==null&&t!==void 0?t:[]}function _l(e){var t;return e==null||Array.isArray(e)?[]:(t=e.indeterminateKeys)!==null&&t!==void 0?t:[]}function N$(e,t){const r=new Set(e);return t.forEach(o=>{r.has(o)||r.add(o)}),Array.from(r)}function W$(e,t){const r=new Set(e);return t.forEach(o=>{r.has(o)&&r.delete(o)}),Array.from(r)}function V$(e){return(e==null?void 0:e.type)==="group"}function uO(e){const t=new Map;return e.forEach((r,o)=>{t.set(r.key,o)}),r=>{var o;return(o=t.get(r))!==null&&o!==void 0?o:null}}class K$ extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function U$(e,t,r,o){return ga(t.concat(e),r,o,!1)}function q$(e,t){const r=new Set;return e.forEach(o=>{const n=t.treeNodeMap.get(o);if(n!==void 0){let i=n.parent;for(;i!==null&&!(i.disabled||r.has(i.key));)r.add(i.key),i=i.parent}}),r}function G$(e,t,r,o){const n=ga(t,r,o,!1),i=ga(e,r,o,!0),a=q$(e,r),l=[];return n.forEach(s=>{(i.has(s)||a.has(s))&&l.push(s)}),l.forEach(s=>n.delete(s)),n}function $l(e,t){const{checkedKeys:r,keysToCheck:o,keysToUncheck:n,indeterminateKeys:i,cascade:a,leafOnly:l,checkStrategy:s,allowNotLoaded:d}=e;if(!a)return o!==void 0?{checkedKeys:N$(r,o),indeterminateKeys:Array.from(i)}:n!==void 0?{checkedKeys:W$(r,n),indeterminateKeys:Array.from(i)}:{checkedKeys:Array.from(r),indeterminateKeys:Array.from(i)};const{levelTreeNodeMap:c}=t;let u;n!==void 0?u=G$(n,r,t,d):o!==void 0?u=U$(o,r,t,d):u=ga(r,t,d,!1);const f=s==="parent",h=s==="child"||l,p=u,b=new Set,g=Math.max.apply(null,Array.from(c.keys()));for(let v=g;v>=0;v-=1){const w=v===0,$=c.get(v);for(const x of $){if(x.isLeaf)continue;const{key:S,shallowLoaded:E}=x;if(h&&E&&x.children.forEach(P=>{!P.disabled&&!P.isLeaf&&P.shallowLoaded&&p.has(P.key)&&p.delete(P.key)}),x.disabled||!E)continue;let y=!0,_=!1,R=!0;for(const P of x.children){const j=P.key;if(!P.disabled){if(R&&(R=!1),p.has(j))_=!0;else if(b.has(j)){_=!0,y=!1;break}else if(y=!1,_)break}}y&&!R?(f&&x.children.forEach(P=>{!P.disabled&&p.has(P.key)&&p.delete(P.key)}),p.add(S)):_&&b.add(S),w&&h&&p.has(S)&&p.delete(S)}}return{checkedKeys:Array.from(p),indeterminateKeys:Array.from(b)}}function ga(e,t,r,o){const{treeNodeMap:n,getChildren:i}=t,a=new Set,l=new Set(e);return e.forEach(s=>{const d=n.get(s);d!==void 0&&im(d,c=>{if(c.disabled)return gs.STOP;const{key:u}=c;if(!a.has(u)&&(a.add(u),l.add(u),j$(c.rawNode,i))){if(o)return gs.STOP;if(!r)throw new K$}})}),l}function Y$(e,{includeGroup:t=!1,includeSelf:r=!0},o){var n;const i=o.treeNodeMap;let a=e==null?null:(n=i.get(e))!==null&&n!==void 0?n:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(t||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),r||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(s=>s.key),l}function X$(e){if(e.length===0)return null;const t=e[0];return t.isGroup||t.ignored||t.disabled?t.getNext():t}function Z$(e,t){const r=e.siblings,o=r.length,{index:n}=e;return t?r[(n+1)%o]:n===r.length-1?null:r[n+1]}function Hu(e,t,{loop:r=!1,includeDisabled:o=!1}={}){const n=t==="prev"?J$:Z$,i={reverse:t==="prev"};let a=!1,l=null;function s(d){if(d!==null){if(d===e){if(!a)a=!0;else if(!e.disabled&&!e.isGroup){l=e;return}}else if((!d.disabled||o)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const c=Tc(d,i);c!==null?l=c:s(n(d,r))}else{const c=n(d,!1);if(c!==null)s(c);else{const u=Q$(d);u!=null&&u.isGroup?s(n(u,r)):r&&s(n(d,!0))}}}}return s(e),l}function J$(e,t){const r=e.siblings,o=r.length,{index:n}=e;return t?r[(n-1+o)%o]:n===0?null:r[n-1]}function Q$(e){return e.parent}function Tc(e,t={}){const{reverse:r=!1}=t,{children:o}=e;if(o){const{length:n}=o,i=r?n-1:0,a=r?-1:n,l=r?-1:1;for(let s=i;s!==a;s+=l){const d=o[s];if(!d.disabled&&!d.ignored)if(d.isGroup){const c=Tc(d,t);if(c!==null)return c}else return d}}return null}const eP={getChild(){return this.ignored?null:Tc(this)},getParent(){const{parent:e}=this;return e!=null&&e.isGroup?e.getParent():e},getNext(e={}){return Hu(this,"next",e)},getPrev(e={}){return Hu(this,"prev",e)}};function tP(e,t){const r=t?new Set(t):void 0,o=[];function n(i){i.forEach(a=>{o.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||r===void 0||r.has(a.key))&&n(a.children)})}return n(e),o}function rP(e,t){const r=e.key;for(;t;){if(t.key===r)return!0;t=t.parent}return!1}function am(e,t,r,o,n,i=null,a=0){const l=[];return e.forEach((s,d)=>{var c;const u=Object.create(o);if(u.rawNode=s,u.siblings=l,u.level=a,u.index=d,u.isFirstChild=d===0,u.isLastChild=d+1===e.length,u.parent=i,!u.ignored){const f=n(s);Array.isArray(f)&&(u.children=am(f,t,r,o,n,u,a+1))}l.push(u),t.set(u.key,u),r.has(a)||r.set(a,[]),(c=r.get(a))===null||c===void 0||c.push(u)}),l}function lm(e,t={}){var r;const o=new Map,n=new Map,{getDisabled:i=H$,getIgnored:a=D$,getIsGroup:l=V$,getKey:s=L$}=t,d=(r=t.getChildren)!==null&&r!==void 0?r:B$,c=t.ignoreEmptyChildren?x=>{const S=d(x);return Array.isArray(S)?S.length?S:null:S}:d,u=Object.assign({get key(){return s(this.rawNode)},get disabled(){return i(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return M$(this.rawNode,c)},get shallowLoaded(){return F$(this.rawNode,c)},get ignored(){return a(this.rawNode)},contains(x){return rP(this,x)}},eP),f=am(e,o,n,u,c);function h(x){if(x==null)return null;const S=o.get(x);return S&&!S.isGroup&&!S.ignored?S:null}function p(x){if(x==null)return null;const S=o.get(x);return S&&!S.ignored?S:null}function b(x,S){const E=p(x);return E?E.getPrev(S):null}function g(x,S){const E=p(x);return E?E.getNext(S):null}function v(x){const S=p(x);return S?S.getParent():null}function w(x){const S=p(x);return S?S.getChild():null}const $={treeNodes:f,treeNodeMap:o,levelTreeNodeMap:n,maxLevel:Math.max(...n.keys()),getChildren:c,getFlattenedNodes(x){return tP(f,x)},getNode:h,getPrev:b,getNext:g,getParent:v,getChild:w,getFirstAvailableNode(){return X$(f)},getPath(x,S={}){return Y$(x,S,$)},getCheckedKeys(x,S={}){const{cascade:E=!0,leafOnly:y=!1,checkStrategy:_="all",allowNotLoaded:R=!1}=S;return $l({checkedKeys:Sl(x),indeterminateKeys:_l(x),cascade:E,leafOnly:y,checkStrategy:_,allowNotLoaded:R},$)},check(x,S,E={}){const{cascade:y=!0,leafOnly:_=!1,checkStrategy:R="all",allowNotLoaded:P=!1}=E;return $l({checkedKeys:Sl(S),indeterminateKeys:_l(S),keysToCheck:x==null?[]:Fu(x),cascade:y,leafOnly:_,checkStrategy:R,allowNotLoaded:P},$)},uncheck(x,S,E={}){const{cascade:y=!0,leafOnly:_=!1,checkStrategy:R="all",allowNotLoaded:P=!1}=E;return $l({checkedKeys:Sl(S),indeterminateKeys:_l(S),keysToUncheck:x==null?[]:Fu(x),cascade:y,leafOnly:_,checkStrategy:R,allowNotLoaded:P},$)},getNonLeafKeys(x={}){return I$(f,x)}};return $}function bs(e,t,r="default"){const o=t[r];if(o===void 0)throw new Error(`[vueuc/${e}]: slot[${r}] is empty.`);return o()}function xs(e,t=!0,r=[]){return e.forEach(o=>{if(o!==null){if(typeof o!="object"){(typeof o=="string"||typeof o=="number")&&r.push(sr(String(o)));return}if(Array.isArray(o)){xs(o,t,r);return}if(o.type===ot){if(o.children===null)return;Array.isArray(o.children)&&xs(o.children,t,r)}else o.type!==Lt&&r.push(o)}}),r}function ju(e,t,r="default"){const o=t[r];if(o===void 0)throw new Error(`[vueuc/${e}]: slot[${r}] is empty.`);const n=xs(o());if(n.length===1)return n[0];throw new Error(`[vueuc/${e}]: slot[${r}] should have exactly one child.`)}let Lr=null;function sm(){if(Lr===null&&(Lr=document.getElementById("v-binder-view-measurer"),Lr===null)){Lr=document.createElement("div"),Lr.id="v-binder-view-measurer";const{style:e}=Lr;e.position="fixed",e.left="0",e.right="0",e.top="0",e.bottom="0",e.pointerEvents="none",e.visibility="hidden",document.body.appendChild(Lr)}return Lr.getBoundingClientRect()}function oP(e,t){const r=sm();return{top:t,left:e,height:0,width:0,right:r.width-e,bottom:r.height-t}}function Pl(e){const t=e.getBoundingClientRect(),r=sm();return{left:t.left-r.left,top:t.top-r.top,bottom:r.height+r.top-t.bottom,right:r.width+r.left-t.right,width:t.width,height:t.height}}function nP(e){return e.nodeType===9?null:e.parentNode}function cm(e){if(e===null)return null;const t=nP(e);if(t===null)return null;if(t.nodeType===9)return document;if(t.nodeType===1){const{overflow:r,overflowX:o,overflowY:n}=getComputedStyle(t);if(/(auto|scroll|overlay)/.test(r+n+o))return t}return cm(t)}const iP=oe({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(e){var t;je("VBinder",(t=Zr())===null||t===void 0?void 0:t.proxy);const r=be("VBinder",null),o=W(null),n=v=>{o.value=v,r&&e.syncTargetWithParent&&r.setTargetRef(v)};let i=[];const a=()=>{let v=o.value;for(;v=cm(v),v!==null;)i.push(v);for(const w of i)nt("scroll",w,u,!0)},l=()=>{for(const v of i)Ze("scroll",v,u,!0);i=[]},s=new Set,d=v=>{s.size===0&&a(),s.has(v)||s.add(v)},c=v=>{s.has(v)&&s.delete(v),s.size===0&&l()},u=()=>{ip(f)},f=()=>{s.forEach(v=>v())},h=new Set,p=v=>{h.size===0&&nt("resize",window,g),h.has(v)||h.add(v)},b=v=>{h.has(v)&&h.delete(v),h.size===0&&Ze("resize",window,g)},g=()=>{h.forEach(v=>v())};return It(()=>{Ze("resize",window,g),l()}),{targetRef:o,setTargetRef:n,addScrollListener:d,removeScrollListener:c,addResizeListener:p,removeResizeListener:b}},render(){return bs("binder",this.$slots)}});var dm=iP,um=oe({name:"Target",setup(){const{setTargetRef:e,syncTarget:t}=be("VBinder");return{syncTarget:t,setTargetDirective:{mounted:e,updated:e}}},render(){const{syncTarget:e,setTargetDirective:t}=this;return e?Cr(ju("follower",this.$slots),[[t]]):ju("follower",this.$slots)}});const Bo="@@mmoContext",aP={mounted(e,{value:t}){e[Bo]={handler:void 0},typeof t=="function"&&(e[Bo].handler=t,nt("mousemoveoutside",e,t))},updated(e,{value:t}){const r=e[Bo];typeof t=="function"?r.handler?r.handler!==t&&(Ze("mousemoveoutside",e,r.handler),r.handler=t,nt("mousemoveoutside",e,t)):(e[Bo].handler=t,nt("mousemoveoutside",e,t)):r.handler&&(Ze("mousemoveoutside",e,r.handler),r.handler=void 0)},unmounted(e){const{handler:t}=e[Bo];t&&Ze("mousemoveoutside",e,t),e[Bo].handler=void 0}};var lP=aP;const Lo="@@coContext",sP={mounted(e,{value:t,modifiers:r}){e[Lo]={handler:void 0},typeof t=="function"&&(e[Lo].handler=t,nt("clickoutside",e,t,{capture:r.capture}))},updated(e,{value:t,modifiers:r}){const o=e[Lo];typeof t=="function"?o.handler?o.handler!==t&&(Ze("clickoutside",e,o.handler,{capture:r.capture}),o.handler=t,nt("clickoutside",e,t,{capture:r.capture})):(e[Lo].handler=t,nt("clickoutside",e,t,{capture:r.capture})):o.handler&&(Ze("clickoutside",e,o.handler,{capture:r.capture}),o.handler=void 0)},unmounted(e,{modifiers:t}){const{handler:r}=e[Lo];r&&Ze("clickoutside",e,r,{capture:t.capture}),e[Lo].handler=void 0}};var Cs=sP;function cP(e,t){console.error(`[vdirs/${e}]: ${t}`)}class dP{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(t,r){const{elementZIndex:o}=this;if(r!==void 0){t.style.zIndex=`${r}`,o.delete(t);return}const{nextZIndex:n}=this;o.has(t)&&o.get(t)+1===this.nextZIndex||(t.style.zIndex=`${n}`,o.set(t,n),this.nextZIndex=n+1,this.squashState())}unregister(t,r){const{elementZIndex:o}=this;o.has(t)?o.delete(t):r===void 0&&cP("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:t}=this;t||(this.nextZIndex=2e3),this.nextZIndex-t>2500&&this.rearrange()}rearrange(){const t=Array.from(this.elementZIndex.entries());t.sort((r,o)=>r[1]-o[1]),this.nextZIndex=2e3,t.forEach(r=>{const o=r[0],n=this.nextZIndex++;`${n}`!==o.style.zIndex&&(o.style.zIndex=`${n}`)})}}var kl=new dP;const Do="@@ziContext",uP={mounted(e,t){const{value:r={}}=t,{zIndex:o,enabled:n}=r;e[Do]={enabled:!!n,initialized:!1},n&&(kl.ensureZIndex(e,o),e[Do].initialized=!0)},updated(e,t){const{value:r={}}=t,{zIndex:o,enabled:n}=r,i=e[Do].enabled;n&&!i&&(kl.ensureZIndex(e,o),e[Do].initialized=!0),e[Do].enabled=!!n},unmounted(e,t){if(!e[Do].initialized)return;const{value:r={}}=t,{zIndex:o}=r;kl.unregister(e,o)}};var qa=uP;function Nu(e,t){console.error(`[vueuc/${e}]: ${t}`)}const{c:Zo}=up(),fm="vueuc-style";function Wu(e){return typeof e=="string"?document.querySelector(e):e()}var Ec=oe({name:"LazyTeleport",props:{to:{type:[String,Object],default:void 0},disabled:Boolean,show:{type:Boolean,required:!0}},setup(e){return{showTeleport:ty(Oe(e,"show")),mergedTo:L(()=>{const{to:t}=e;return t!=null?t:"body"})}},render(){return this.showTeleport?this.disabled?bs("lazy-teleport",this.$slots):m(gh,{disabled:this.disabled,to:this.mergedTo},bs("lazy-teleport",this.$slots)):null}});const Wi={top:"bottom",bottom:"top",left:"right",right:"left"},Vu={start:"end",center:"center",end:"start"},Tl={top:"height",bottom:"height",left:"width",right:"width"},fP={"bottom-start":"top left",bottom:"top center","bottom-end":"top right","top-start":"bottom left",top:"bottom center","top-end":"bottom right","right-start":"top left",right:"center left","right-end":"bottom left","left-start":"top right",left:"center right","left-end":"bottom right"},hP={"bottom-start":"bottom left",bottom:"bottom center","bottom-end":"bottom right","top-start":"top left",top:"top center","top-end":"top right","right-start":"top right",right:"center right","right-end":"bottom right","left-start":"top left",left:"center left","left-end":"bottom left"},pP={"bottom-start":"right","bottom-end":"left","top-start":"right","top-end":"left","right-start":"bottom","right-end":"top","left-start":"bottom","left-end":"top"},Ku={top:!0,bottom:!1,left:!0,right:!1},Uu={top:"end",bottom:"start",left:"end",right:"start"};function mP(e,t,r,o,n,i){if(!n||i)return{placement:e,top:0,left:0};const[a,l]=e.split("-");let s=l!=null?l:"center",d={top:0,left:0};const c=(h,p,b)=>{let g=0,v=0;const w=r[h]-t[p]-t[h];return w>0&&o&&(b?v=Ku[p]?w:-w:g=Ku[p]?w:-w),{left:g,top:v}},u=a==="left"||a==="right";if(s!=="center"){const h=pP[e],p=Wi[h],b=Tl[h];if(r[b]>t[b]){if(t[h]+t[b]t[p]&&(s=Vu[l])}else{const h=a==="bottom"||a==="top"?"left":"top",p=Wi[h],b=Tl[h],g=(r[b]-t[b])/2;(t[h]t[p]?(s=Uu[h],d=c(b,h,u)):(s=Uu[p],d=c(b,p,u)))}let f=a;return t[a] *",{pointerEvents:"all"})])]);var hm=oe({name:"Follower",inheritAttrs:!1,props:{show:Boolean,enabled:{type:Boolean,default:void 0},placement:{type:String,default:"bottom"},syncTrigger:{type:Array,default:["resize","scroll"]},to:[String,Object],flip:{type:Boolean,default:!0},internalShift:Boolean,x:Number,y:Number,width:String,minWidth:String,containerClass:String,teleportDisabled:Boolean,zindexable:{type:Boolean,default:!0},zIndex:Number,overlap:Boolean},setup(e){const t=be("VBinder"),r=ht(()=>e.enabled!==void 0?e.enabled:e.show),o=W(null),n=W(null),i=()=>{const{syncTrigger:f}=e;f.includes("scroll")&&t.addScrollListener(s),f.includes("resize")&&t.addResizeListener(s)},a=()=>{t.removeScrollListener(s),t.removeResizeListener(s)};Ot(()=>{r.value&&(s(),i())});const l=$n();bP.mount({id:"vueuc/binder",head:!0,anchorMetaName:fm,ssr:l}),It(()=>{a()}),vp(()=>{r.value&&s()});const s=()=>{if(!r.value)return;const f=o.value;if(f===null)return;const h=t.targetRef,{x:p,y:b,overlap:g}=e,v=p!==void 0&&b!==void 0?oP(p,b):Pl(h);f.style.setProperty("--v-target-width",`${Math.round(v.width)}px`),f.style.setProperty("--v-target-height",`${Math.round(v.height)}px`);const{width:w,minWidth:$,placement:x,internalShift:S,flip:E}=e;f.setAttribute("v-placement",x),g?f.setAttribute("v-overlap",""):f.removeAttribute("v-overlap");const{style:y}=f;w==="target"?y.width=`${v.width}px`:w!==void 0?y.width=w:y.width="",$==="target"?y.minWidth=`${v.width}px`:$!==void 0?y.minWidth=$:y.minWidth="";const _=Pl(f),R=Pl(n.value),{left:P,top:j,placement:T}=mP(x,v,_,S,E,g),N=vP(T,g),{left:B,top:q,transform:A}=gP(T,R,v,j,P,g);f.setAttribute("v-placement",T),f.style.setProperty("--v-offset-left",`${Math.round(P)}px`),f.style.setProperty("--v-offset-top",`${Math.round(j)}px`),f.style.transform=`translateX(${B}) translateY(${q}) ${A}`,f.style.transformOrigin=N};qe(r,f=>{f?(i(),d()):a()});const d=()=>{br().then(s).catch(f=>console.error(f))};["placement","x","y","internalShift","flip","width","overlap","minWidth"].forEach(f=>{qe(Oe(e,f),s)}),["teleportDisabled"].forEach(f=>{qe(Oe(e,f),d)}),qe(Oe(e,"syncTrigger"),f=>{f.includes("resize")?t.addResizeListener(s):t.removeResizeListener(s),f.includes("scroll")?t.addScrollListener(s):t.removeScrollListener(s)});const c=xi(),u=ht(()=>{const{to:f}=e;if(f!==void 0)return f;c.value});return{VBinder:t,mergedEnabled:r,offsetContainerRef:n,followerRef:o,mergedTo:u,syncPosition:s}},render(){return m(Ec,{show:this.show,to:this.mergedTo,disabled:this.teleportDisabled},{default:()=>{var e,t;const r=m("div",{class:["v-binder-follower-container",this.containerClass],ref:"offsetContainerRef"},[m("div",{class:"v-binder-follower-content",ref:"followerRef"},(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e))]);return this.zindexable?Cr(r,[[qa,{enabled:this.mergedEnabled,zIndex:this.zIndex}]]):r}})}}),pm=function(){if(typeof Map!="undefined")return Map;function e(t,r){var o=-1;return t.some(function(n,i){return n[0]===r?(o=i,!0):!1}),o}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var o=e(this.__entries__,r),n=this.__entries__[o];return n&&n[1]},t.prototype.set=function(r,o){var n=e(this.__entries__,r);~n?this.__entries__[n][1]=o:this.__entries__.push([r,o])},t.prototype.delete=function(r){var o=this.__entries__,n=e(o,r);~n&&o.splice(n,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,o){o===void 0&&(o=null);for(var n=0,i=this.__entries__;n0},e.prototype.connect_=function(){!ys||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),_P?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!ys||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,o=r===void 0?"":r,n=SP.some(function(i){return!!~o.indexOf(i)});n&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),mm=function(e,t){for(var r=0,o=Object.keys(t);r0},e}(),gm=typeof WeakMap!="undefined"?new WeakMap:new pm,bm=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=$P.getInstance(),o=new MP(t,r,this);gm.set(this,o)}return e}();["observe","unobserve","disconnect"].forEach(function(e){bm.prototype[e]=function(){var t;return(t=gm.get(this))[e].apply(t,arguments)}});var BP=function(){return typeof ba.ResizeObserver!="undefined"?ba.ResizeObserver:bm}();class LP{constructor(){this.handleResize=this.handleResize.bind(this),this.observer=new BP(this.handleResize),this.elHandlersMap=new Map}handleResize(t){for(const r of t){const o=this.elHandlersMap.get(r.target);o!==void 0&&o(r)}}registerHandler(t,r){this.elHandlersMap.set(t,r),this.observer.observe(t)}unregisterHandler(t){!this.elHandlersMap.has(t)||(this.elHandlersMap.delete(t),this.observer.unobserve(t))}}var Gu=new LP,vn=oe({name:"ResizeObserver",props:{onResize:Function},setup(e){return{registered:!1,handleResize(t){const{onResize:r}=e;r!==void 0&&r(t)}}},mounted(){const e=this.$el;if(e===void 0){Nu("resize-observer","$el does not exist.");return}if(e.nextElementSibling!==e.nextSibling&&e.nodeType===3&&e.nodeValue!==""){Nu("resize-observer","$el can not be observed (it may be a text node).");return}e.nextElementSibling!==null&&(Gu.registerHandler(e.nextElementSibling,this.handleResize),this.registered=!0)},beforeUnmount(){this.registered&&Gu.unregisterHandler(this.$el.nextElementSibling)},render(){return V0(this.$slots,"default")}});const DP=Zo(".v-x-scroll",{overflow:"auto",scrollbarWidth:"none"},[Zo("&::-webkit-scrollbar",{width:0,height:0})]);var FP=oe({name:"XScroll",props:{disabled:Boolean,onScroll:Function},setup(){const e=W(null);function t(n){!(n.currentTarget.offsetWidth=0;t--){const r=e.childNodes[t];if(xm(r)&&(wm(r)||ym(r)))return!0}return!1}function wm(e){if(!HP(e))return!1;try{e.focus()}catch{}return document.activeElement===e}function HP(e){if(e.tabIndex>0||e.tabIndex===0&&e.getAttribute("tabIndex")!==null)return!0;if(e.getAttribute("disabled"))return!1;switch(e.nodeName){case"A":return!!e.href&&e.rel!=="ignore";case"INPUT":return e.type!=="hidden"&&e.type!=="file";case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}}let Mn=[];const Sm=oe({name:"FocusTrap",props:{disabled:Boolean,active:Boolean,autoFocus:{type:Boolean,default:!0},onEsc:Function,initialFocusTo:String,finalFocusTo:String,returnFocusOnDeactivated:{type:Boolean,default:!0}},setup(e){const t=dn(),r=W(null),o=W(null);let n=!1,i=!1;const a=document.activeElement;function l(){return Mn[Mn.length-1]===t}function s(g){var v;g.code==="Escape"&&l()&&((v=e.onEsc)===null||v===void 0||v.call(e))}Ot(()=>{qe(()=>e.active,g=>{g?(u(),nt("keydown",document,s)):(Ze("keydown",document,s),n&&f())},{immediate:!0})}),It(()=>{Ze("keydown",document,s),n&&f()});function d(g){if(!i&&l()){const v=c();if(v===null||v.contains(g.target))return;h("first")}}function c(){const g=r.value;if(g===null)return null;let v=g;for(;v=v.nextSibling,!(v===null||v instanceof Element&&v.tagName==="DIV"););return v}function u(){var g;if(!e.disabled){if(Mn.push(t),e.autoFocus){const{initialFocusTo:v}=e;v===void 0?h("first"):(g=Wu(v))===null||g===void 0||g.focus()}n=!0,document.addEventListener("focus",d,!0)}}function f(){var g;if(e.disabled||(document.removeEventListener("focus",d,!0),Mn=Mn.filter(w=>w!==t),l()))return;const{finalFocusTo:v}=e;v!==void 0?(g=Wu(v))===null||g===void 0||g.focus():e.returnFocusOnDeactivated&&a instanceof HTMLElement&&(i=!0,a.focus({preventScroll:!0}),i=!1)}function h(g){if(!!l()&&e.active){const v=r.value,w=o.value;if(v!==null&&w!==null){const $=c();if($==null||$===w){i=!0,v.focus({preventScroll:!0}),i=!1;return}i=!0;const x=g==="first"?Cm($):ym($);i=!1,x||(i=!0,v.focus({preventScroll:!0}),i=!1)}}}function p(g){if(i)return;const v=c();v!==null&&(g.relatedTarget!==null&&v.contains(g.relatedTarget)?h("last"):h("first"))}function b(g){i||(g.relatedTarget!==null&&g.relatedTarget===r.value?h("last"):h("first"))}return{focusableStartRef:r,focusableEndRef:o,focusableStyle:"position: absolute; height: 0; width: 0;",handleStartFocus:p,handleEndFocus:b}},render(){const{default:e}=this.$slots;if(e===void 0)return null;if(this.disabled)return e();const{active:t,focusableStyle:r}=this;return m(ot,null,[m("div",{"aria-hidden":"true",tabindex:t?"0":"-1",ref:"focusableStartRef",style:r,onFocus:this.handleStartFocus}),e(),m("div",{"aria-hidden":"true",style:r,ref:"focusableEndRef",tabindex:t?"0":"-1",onFocus:this.handleEndFocus})])}}),fe={neutralBase:"#000",neutralInvertBase:"#fff",neutralTextBase:"#fff",neutralPopover:"rgb(72, 72, 78)",neutralCard:"rgb(24, 24, 28)",neutralModal:"rgb(44, 44, 50)",neutralBody:"rgb(16, 16, 20)",alpha1:"0.9",alpha2:"0.82",alpha3:"0.52",alpha4:"0.38",alpha5:"0.28",alphaClose:"0.52",alphaDisabled:"0.38",alphaDisabledInput:"0.06",alphaPending:"0.09",alphaTablePending:"0.06",alphaTableStriped:"0.05",alphaPressed:"0.05",alphaAvatar:"0.18",alphaRail:"0.2",alphaProgressRail:"0.12",alphaBorder:"0.24",alphaDivider:"0.09",alphaInput:"0.1",alphaAction:"0.06",alphaTab:"0.04",alphaScrollbar:"0.2",alphaScrollbarHover:"0.3",alphaCode:"0.12",alphaTag:"0",primaryHover:"#7fe7c4",primaryDefault:"#63e2b7",primaryActive:"#5acea7",primarySuppl:"rgb(42, 148, 125)",infoHover:"#8acbec",infoDefault:"#70c0e8",infoActive:"#66afd3",infoSuppl:"rgb(56, 137, 197)",errorHover:"#e98b8b",errorDefault:"#e88080",errorActive:"#e57272",errorSuppl:"rgb(208, 58, 82)",warningHover:"#f5d599",warningDefault:"#f2c97d",warningActive:"#e6c260",warningSuppl:"rgb(240, 138, 0)",successHover:"#7fe7c4",successDefault:"#63e2b7",successActive:"#5acea7",successSuppl:"rgb(42, 148, 125)"},jP=Tr(fe.neutralBase),_m=Tr(fe.neutralInvertBase),NP="rgba("+_m.slice(0,3).join(", ")+", ";function We(e){return NP+String(e)+")"}function WP(e){const t=Array.from(_m);return t[3]=Number(e),ye(jP,t)}const VP=Object.assign(Object.assign({name:"common"},yr),{baseColor:fe.neutralBase,primaryColor:fe.primaryDefault,primaryColorHover:fe.primaryHover,primaryColorPressed:fe.primaryActive,primaryColorSuppl:fe.primarySuppl,infoColor:fe.infoDefault,infoColorHover:fe.infoHover,infoColorPressed:fe.infoActive,infoColorSuppl:fe.infoSuppl,successColor:fe.successDefault,successColorHover:fe.successHover,successColorPressed:fe.successActive,successColorSuppl:fe.successSuppl,warningColor:fe.warningDefault,warningColorHover:fe.warningHover,warningColorPressed:fe.warningActive,warningColorSuppl:fe.warningSuppl,errorColor:fe.errorDefault,errorColorHover:fe.errorHover,errorColorPressed:fe.errorActive,errorColorSuppl:fe.errorSuppl,textColorBase:fe.neutralTextBase,textColor1:We(fe.alpha1),textColor2:We(fe.alpha2),textColor3:We(fe.alpha3),textColorDisabled:We(fe.alpha4),placeholderColor:We(fe.alpha4),placeholderColorDisabled:We(fe.alpha5),iconColor:We(fe.alpha4),iconColorDisabled:We(fe.alpha5),iconColorHover:We(Number(fe.alpha4)*1.25),iconColorPressed:We(Number(fe.alpha4)*.8),opacity1:fe.alpha1,opacity2:fe.alpha2,opacity3:fe.alpha3,opacity4:fe.alpha4,opacity5:fe.alpha5,dividerColor:We(fe.alphaDivider),borderColor:We(fe.alphaBorder),closeColorHover:We(Number(fe.alphaClose)*1.25),closeColor:We(Number(fe.alphaClose)),closeColorPressed:We(Number(fe.alphaClose)*.8),closeColorDisabled:We(fe.alpha4),clearColor:We(fe.alpha4),clearColorHover:Yo(We(fe.alpha4),{alpha:1.25}),clearColorPressed:Yo(We(fe.alpha4),{alpha:.8}),scrollbarColor:We(fe.alphaScrollbar),scrollbarColorHover:We(fe.alphaScrollbarHover),scrollbarWidth:"5px",scrollbarHeight:"5px",scrollbarBorderRadius:"5px",progressRailColor:We(fe.alphaProgressRail),railColor:We(fe.alphaRail),popoverColor:fe.neutralPopover,tableColor:fe.neutralCard,cardColor:fe.neutralCard,modalColor:fe.neutralModal,bodyColor:fe.neutralBody,tagColor:WP(fe.alphaTag),avatarColor:We(fe.alphaAvatar),invertedColor:fe.neutralBase,inputColor:We(fe.alphaInput),codeColor:We(fe.alphaCode),tabColor:We(fe.alphaTab),actionColor:We(fe.alphaAction),tableHeaderColor:We(fe.alphaAction),hoverColor:We(fe.alphaPending),tableColorHover:We(fe.alphaTablePending),tableColorStriped:We(fe.alphaTableStriped),pressedColor:We(fe.alphaPressed),opacityDisabled:fe.alphaDisabled,inputColorDisabled:We(fe.alphaDisabledInput),buttonColor2:"rgba(255, 255, 255, .06)",buttonColor2Hover:"rgba(255, 255, 255, .09)",buttonColor2Pressed:"rgba(255, 255, 255, .05)",boxShadow1:"0 1px 2px -2px rgba(0, 0, 0, .24), 0 3px 6px 0 rgba(0, 0, 0, .18), 0 5px 12px 4px rgba(0, 0, 0, .12)",boxShadow2:"0 3px 6px -4px rgba(0, 0, 0, .24), 0 6px 12px 0 rgba(0, 0, 0, .16), 0 9px 18px 8px rgba(0, 0, 0, .10)",boxShadow3:"0 6px 16px -9px rgba(0, 0, 0, .08), 0 9px 28px 0 rgba(0, 0, 0, .05), 0 12px 48px 16px rgba(0, 0, 0, .03)"});var de=VP;const Ce={neutralBase:"#FFF",neutralInvertBase:"#000",neutralTextBase:"#000",neutralPopover:"#fff",neutralCard:"#fff",neutralModal:"#fff",neutralBody:"#fff",alpha1:"0.82",alpha2:"0.72",alpha3:"0.38",alpha4:"0.24",alpha5:"0.18",alphaClose:"0.52",alphaDisabled:"0.5",alphaDisabledInput:"0.02",alphaPending:"0.05",alphaTablePending:"0.02",alphaPressed:"0.07",alphaAvatar:"0.2",alphaRail:"0.14",alphaProgressRail:".08",alphaBorder:"0.12",alphaDivider:"0.06",alphaInput:"0",alphaAction:"0.02",alphaTab:"0.04",alphaScrollbar:"0.25",alphaScrollbarHover:"0.4",alphaCode:"0.05",alphaTag:"0.02",primaryHover:"#36ad6a",primaryDefault:"#18a058",primaryActive:"#0c7a43",primarySuppl:"#36ad6a",infoHover:"#4098fc",infoDefault:"#2080f0",infoActive:"#1060c9",infoSuppl:"#4098fc",errorHover:"#de576d",errorDefault:"#d03050",errorActive:"#ab1f3f",errorSuppl:"#de576d",warningHover:"#fcb040",warningDefault:"#f0a020",warningActive:"#c97c10",warningSuppl:"#fcb040",successHover:"#36ad6a",successDefault:"#18a058",successActive:"#0c7a43",successSuppl:"#36ad6a"},KP=Tr(Ce.neutralBase),$m=Tr(Ce.neutralInvertBase),UP="rgba("+$m.slice(0,3).join(", ")+", ";function Yu(e){return UP+String(e)+")"}function Pt(e){const t=Array.from($m);return t[3]=Number(e),ye(KP,t)}const qP=Object.assign(Object.assign({name:"common"},yr),{baseColor:Ce.neutralBase,primaryColor:Ce.primaryDefault,primaryColorHover:Ce.primaryHover,primaryColorPressed:Ce.primaryActive,primaryColorSuppl:Ce.primarySuppl,infoColor:Ce.infoDefault,infoColorHover:Ce.infoHover,infoColorPressed:Ce.infoActive,infoColorSuppl:Ce.infoSuppl,successColor:Ce.successDefault,successColorHover:Ce.successHover,successColorPressed:Ce.successActive,successColorSuppl:Ce.successSuppl,warningColor:Ce.warningDefault,warningColorHover:Ce.warningHover,warningColorPressed:Ce.warningActive,warningColorSuppl:Ce.warningSuppl,errorColor:Ce.errorDefault,errorColorHover:Ce.errorHover,errorColorPressed:Ce.errorActive,errorColorSuppl:Ce.errorSuppl,textColorBase:Ce.neutralTextBase,textColor1:"rgb(31, 34, 37)",textColor2:"rgb(51, 54, 57)",textColor3:"rgb(118, 124, 130)",textColorDisabled:Pt(Ce.alpha4),placeholderColor:Pt(Ce.alpha4),placeholderColorDisabled:Pt(Ce.alpha5),iconColor:Pt(Ce.alpha4),iconColorHover:Yo(Pt(Ce.alpha4),{lightness:.75}),iconColorPressed:Yo(Pt(Ce.alpha4),{lightness:.9}),iconColorDisabled:Pt(Ce.alpha5),opacity1:Ce.alpha1,opacity2:Ce.alpha2,opacity3:Ce.alpha3,opacity4:Ce.alpha4,opacity5:Ce.alpha5,dividerColor:"rgb(239, 239, 245)",borderColor:"rgb(224, 224, 230)",closeColor:Pt(Number(Ce.alphaClose)),closeColorHover:Pt(Number(Ce.alphaClose)*1.25),closeColorPressed:Pt(Number(Ce.alphaClose)*.8),closeColorDisabled:Pt(Ce.alpha4),clearColor:Pt(Ce.alpha4),clearColorHover:Yo(Pt(Ce.alpha4),{lightness:.75}),clearColorPressed:Yo(Pt(Ce.alpha4),{lightness:.9}),scrollbarColor:Yu(Ce.alphaScrollbar),scrollbarColorHover:Yu(Ce.alphaScrollbarHover),scrollbarWidth:"5px",scrollbarHeight:"5px",scrollbarBorderRadius:"5px",progressRailColor:Pt(Ce.alphaProgressRail),railColor:"rgb(219, 219, 223)",popoverColor:Ce.neutralPopover,tableColor:Ce.neutralCard,cardColor:Ce.neutralCard,modalColor:Ce.neutralModal,bodyColor:Ce.neutralBody,tagColor:"rgb(250, 250, 252)",avatarColor:Pt(Ce.alphaAvatar),invertedColor:"rgb(0, 20, 40)",inputColor:Pt(Ce.alphaInput),codeColor:"rgb(244, 244, 248)",tabColor:"rgb(247, 247, 250)",actionColor:"rgb(250, 250, 252)",tableHeaderColor:"rgb(250, 250, 252)",hoverColor:"rgb(243, 243, 245)",tableColorHover:"rgba(0, 0, 100, 0.03)",tableColorStriped:"rgba(0, 0, 100, 0.02)",pressedColor:"rgb(237, 237, 239)",opacityDisabled:Ce.alphaDisabled,inputColorDisabled:"rgb(250, 250, 252)",buttonColor2:"rgba(46, 51, 56, .05)",buttonColor2Hover:"rgba(46, 51, 56, .09)",buttonColor2Pressed:"rgba(46, 51, 56, .13)",boxShadow1:"0 1px 2px -2px rgba(0, 0, 0, .08), 0 3px 6px 0 rgba(0, 0, 0, .06), 0 5px 12px 4px rgba(0, 0, 0, .04)",boxShadow2:"0 3px 6px -4px rgba(0, 0, 0, .12), 0 6px 16px 0 rgba(0, 0, 0, .08), 0 9px 28px 8px rgba(0, 0, 0, .05)",boxShadow3:"0 6px 16px -9px rgba(0, 0, 0, .08), 0 9px 28px 0 rgba(0, 0, 0, .05), 0 12px 48px 16px rgba(0, 0, 0, .03)"});var Ke=qP,GP={iconSizeSmall:"34px",iconSizeMedium:"40px",iconSizeLarge:"46px",iconSizeHuge:"52px"};const Pm=e=>{const{textColorDisabled:t,iconColor:r,textColor2:o,fontSizeSmall:n,fontSizeMedium:i,fontSizeLarge:a,fontSizeHuge:l}=e;return Object.assign(Object.assign({},GP),{fontSizeSmall:n,fontSizeMedium:i,fontSizeLarge:a,fontSizeHuge:l,textColor:t,iconColor:r,extraTextColor:o})},YP={name:"Empty",common:Ke,self:Pm};var km=YP;const XP={name:"Empty",common:de,self:Pm};var wi=XP;const Tm=e=>{const{scrollbarColor:t,scrollbarColorHover:r}=e;return{color:t,colorHover:r}},ZP={name:"Scrollbar",common:Ke,self:Tm};var Rc=ZP;const JP={name:"Scrollbar",common:de,self:Tm};var Ut=JP;const{cubicBezierEaseInOut:Xu}=yr;function mi({name:e="fade-in",enterDuration:t="0.2s",leaveDuration:r="0.2s",enterCubicBezier:o=Xu,leaveCubicBezier:n=Xu}={}){return[z(`&.${e}-transition-enter-active`,{transition:`all ${t} ${o}!important`}),z(`&.${e}-transition-leave-active`,{transition:`all ${r} ${n}!important`}),z(`&.${e}-transition-enter-from, &.${e}-transition-leave-to`,{opacity:0}),z(`&.${e}-transition-leave-from, &.${e}-transition-enter-to`,{opacity:1})]}var QP=M("scrollbar",` - overflow: hidden; - position: relative; - z-index: auto; - height: 100%; - width: 100%; -`,[z(">",[M("scrollbar-container",` - width: 100%; - overflow: scroll; - height: 100%; - max-height: inherit; - scrollbar-width: none; - `,[z("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",` - width: 0; - height: 0; - display: none; - `),z(">",[M("scrollbar-content",` - box-sizing: border-box; - min-width: 100%; - `)])]),M("scrollbar-rail",` - position: absolute; - pointer-events: none; - user-select: none; - `,[K("horizontal",` - left: 2px; - right: 2px; - bottom: 4px; - height: var(--n-scrollbar-height); - `,[z(">",[F("scrollbar",` - height: var(--n-scrollbar-height); - border-radius: var(--n-scrollbar-border-radius); - right: 0; - `)])]),K("vertical",` - right: 4px; - top: 2px; - bottom: 2px; - width: var(--n-scrollbar-width); - `,[z(">",[F("scrollbar",` - width: var(--n-scrollbar-width); - border-radius: var(--n-scrollbar-border-radius); - bottom: 0; - `)])]),K("disabled",[z(">",[F("scrollbar",{pointerEvents:"none"})])]),z(">",[F("scrollbar",` - position: absolute; - cursor: pointer; - pointer-events: all; - background-color: var(--n-scrollbar-color); - transition: background-color .2s var(--n-scrollbar-bezier); - `,[mi(),z("&:hover",{backgroundColor:"var(--n-scrollbar-color-hover)"})])])])])]);const e3=Object.assign(Object.assign({},ze.props),{size:{type:Number,default:5},duration:{type:Number,default:0},scrollable:{type:Boolean,default:!0},xScrollable:Boolean,useUnifiedContainer:Boolean,triggerDisplayManually:Boolean,container:Function,content:Function,containerClass:String,containerStyle:[String,Object],contentClass:String,contentStyle:[String,Object],horizontalRailStyle:[String,Object],verticalRailStyle:[String,Object],onScroll:Function,onWheel:Function,onResize:Function,internalOnUpdateScrollLeft:Function}),t3=oe({name:"Scrollbar",props:e3,inheritAttrs:!1,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:r}=lt(e),o=W(null),n=W(null),i=W(null),a=W(null),l=W(null),s=W(null),d=W(null),c=W(null),u=W(null),f=W(null),h=W(null),p=W(0),b=W(0),g=W(!1),v=W(!1);let w=!1,$=!1,x,S,E=0,y=0,_=0,R=0;const P=dy(),j=L(()=>{const{value:re}=c,{value:he}=s,{value:Se}=f;return re===null||he===null||Se===null?0:Math.min(re,Se*re/he+e.size*1.5)}),T=L(()=>`${j.value}px`),N=L(()=>{const{value:re}=u,{value:he}=d,{value:Se}=h;return re===null||he===null||Se===null?0:Se*re/he+e.size*1.5}),B=L(()=>`${N.value}px`),q=L(()=>{const{value:re}=c,{value:he}=p,{value:Se}=s,{value:Ne}=f;if(re===null||Se===null||Ne===null)return 0;{const rt=Se-re;return rt?he/rt*(Ne-j.value):0}}),A=L(()=>`${q.value}px`),te=L(()=>{const{value:re}=u,{value:he}=b,{value:Se}=d,{value:Ne}=h;if(re===null||Se===null||Ne===null)return 0;{const rt=Se-re;return rt?he/rt*(Ne-N.value):0}}),se=L(()=>`${te.value}px`),_e=L(()=>{const{value:re}=c,{value:he}=s;return re!==null&&he!==null&&he>re}),Ae=L(()=>{const{value:re}=u,{value:he}=d;return re!==null&&he!==null&&he>re}),Re=L(()=>{const{container:re}=e;return re?re():n.value}),Ee=L(()=>{const{content:re}=e;return re?re():i.value}),$e=le,it=re=>{const{onResize:he}=e;he&&he(re),le()},O=(re,he)=>{if(!e.scrollable)return;if(typeof re=="number"){D(re,he!=null?he:0,0,!1,"auto");return}const{left:Se,top:Ne,index:rt,elSize:Ue,position:dt,behavior:Qe,el:or,debounce:Ar=!0}=re;(Se!==void 0||Ne!==void 0)&&D(Se!=null?Se:0,Ne!=null?Ne:0,0,!1,Qe),or!==void 0?D(0,or.offsetTop,or.offsetHeight,Ar,Qe):rt!==void 0&&Ue!==void 0?D(0,rt*Ue,Ue,Ar,Qe):dt==="bottom"?D(0,Number.MAX_SAFE_INTEGER,0,!1,Qe):dt==="top"&&D(0,0,0,!1,Qe)},V=(re,he)=>{if(!e.scrollable)return;const{value:Se}=Re;!Se||(typeof re=="object"?Se.scrollBy(re):Se.scrollBy(re,he||0))};function D(re,he,Se,Ne,rt){const{value:Ue}=Re;if(!!Ue){if(Ne){const{scrollTop:dt,offsetHeight:Qe}=Ue;if(he>dt){he+Se<=dt+Qe||Ue.scrollTo({left:re,top:he+Se-Qe,behavior:rt});return}}Ue.scrollTo({left:re,top:he,behavior:rt})}}function ce(){C(),k(),le()}function ue(){xe()}function xe(){G(),Z()}function G(){S!==void 0&&window.clearTimeout(S),S=window.setTimeout(()=>{v.value=!1},e.duration)}function Z(){x!==void 0&&window.clearTimeout(x),x=window.setTimeout(()=>{g.value=!1},e.duration)}function C(){x!==void 0&&window.clearTimeout(x),g.value=!0}function k(){S!==void 0&&window.clearTimeout(S),v.value=!0}function H(re){const{onScroll:he}=e;he&&he(re),U()}function U(){const{value:re}=Re;re&&(p.value=re.scrollTop,b.value=re.scrollLeft)}function X(){const{value:re}=Ee;re&&(s.value=re.offsetHeight,d.value=re.offsetWidth);const{value:he}=Re;he&&(c.value=he.offsetHeight,u.value=he.offsetWidth);const{value:Se}=l,{value:Ne}=a;Se&&(h.value=Se.offsetWidth),Ne&&(f.value=Ne.offsetHeight)}function ne(){const{value:re}=Re;re&&(p.value=re.scrollTop,b.value=re.scrollLeft,c.value=re.offsetHeight,u.value=re.offsetWidth,s.value=re.scrollHeight,d.value=re.scrollWidth);const{value:he}=l,{value:Se}=a;he&&(h.value=he.offsetWidth),Se&&(f.value=Se.offsetHeight)}function le(){!e.scrollable||(e.useUnifiedContainer?ne():(X(),U()))}function Y(re){var he;return!(!((he=o.value)===null||he===void 0)&&he.contains(re.target))}function J(re){re.preventDefault(),re.stopPropagation(),$=!0,nt("mousemove",window,Q,!0),nt("mouseup",window,ve,!0),y=b.value,_=re.clientX}function Q(re){if(!$)return;x!==void 0&&window.clearTimeout(x),S!==void 0&&window.clearTimeout(S);const{value:he}=u,{value:Se}=d,{value:Ne}=N;if(he===null||Se===null)return;const Ue=(re.clientX-_)*(Se-he)/(he-Ne),dt=Se-he;let Qe=y+Ue;Qe=Math.min(dt,Qe),Qe=Math.max(Qe,0);const{value:or}=Re;if(or){or.scrollLeft=Qe;const{internalOnUpdateScrollLeft:Ar}=e;Ar&&Ar(Qe)}}function ve(re){re.preventDefault(),re.stopPropagation(),Ze("mousemove",window,Q,!0),Ze("mouseup",window,ve,!0),$=!1,le(),Y(re)&&xe()}function pe(re){re.preventDefault(),re.stopPropagation(),w=!0,nt("mousemove",window,me,!0),nt("mouseup",window,we,!0),E=p.value,R=re.clientY}function me(re){if(!w)return;x!==void 0&&window.clearTimeout(x),S!==void 0&&window.clearTimeout(S);const{value:he}=c,{value:Se}=s,{value:Ne}=j;if(he===null||Se===null)return;const Ue=(re.clientY-R)*(Se-he)/(he-Ne),dt=Se-he;let Qe=E+Ue;Qe=Math.min(dt,Qe),Qe=Math.max(Qe,0);const{value:or}=Re;or&&(or.scrollTop=Qe)}function we(re){re.preventDefault(),re.stopPropagation(),Ze("mousemove",window,me,!0),Ze("mouseup",window,we,!0),w=!1,le(),Y(re)&&xe()}xr(()=>{const{value:re}=Ae,{value:he}=_e,{value:Se}=t,{value:Ne}=l,{value:rt}=a;Ne&&(re?Ne.classList.remove(`${Se}-scrollbar-rail--disabled`):Ne.classList.add(`${Se}-scrollbar-rail--disabled`)),rt&&(he?rt.classList.remove(`${Se}-scrollbar-rail--disabled`):rt.classList.add(`${Se}-scrollbar-rail--disabled`))}),Ot(()=>{e.container||le()}),It(()=>{x!==void 0&&window.clearTimeout(x),S!==void 0&&window.clearTimeout(S),Ze("mousemove",window,me,!0),Ze("mouseup",window,we,!0)});const De=ze("Scrollbar","-scrollbar",QP,Rc,e,t),Ye=L(()=>{const{common:{cubicBezierEaseInOut:re,scrollbarBorderRadius:he,scrollbarHeight:Se,scrollbarWidth:Ne},self:{color:rt,colorHover:Ue}}=De.value;return{"--n-scrollbar-bezier":re,"--n-scrollbar-color":rt,"--n-scrollbar-color-hover":Ue,"--n-scrollbar-border-radius":he,"--n-scrollbar-width":Ne,"--n-scrollbar-height":Se}}),Fe=r?_t("scrollbar",void 0,Ye,e):void 0;return Object.assign(Object.assign({},{scrollTo:O,scrollBy:V,sync:le,syncUnifiedContainer:ne,handleMouseEnterWrapper:ce,handleMouseLeaveWrapper:ue}),{mergedClsPrefix:t,containerScrollTop:p,wrapperRef:o,containerRef:n,contentRef:i,yRailRef:a,xRailRef:l,needYBar:_e,needXBar:Ae,yBarSizePx:T,xBarSizePx:B,yBarTopPx:A,xBarLeftPx:se,isShowXBar:g,isShowYBar:v,isIos:P,handleScroll:H,handleContentResize:$e,handleContainerResize:it,handleYScrollMouseDown:pe,handleXScrollMouseDown:J,cssVars:r?void 0:Ye,themeClass:Fe==null?void 0:Fe.themeClass,onRender:Fe==null?void 0:Fe.onRender})},render(){var e;const{$slots:t,mergedClsPrefix:r,triggerDisplayManually:o}=this;if(!this.scrollable)return(e=t.default)===null||e===void 0?void 0:e.call(t);const n=()=>{var i,a;return(i=this.onRender)===null||i===void 0||i.call(this),m("div",Xr(this.$attrs,{role:"none",ref:"wrapperRef",class:[`${r}-scrollbar`,this.themeClass],style:this.cssVars,onMouseenter:o?void 0:this.handleMouseEnterWrapper,onMouseleave:o?void 0:this.handleMouseLeaveWrapper}),[this.container?(a=t.default)===null||a===void 0?void 0:a.call(t):m("div",{role:"none",ref:"containerRef",class:[`${r}-scrollbar-container`,this.containerClass],style:this.containerStyle,onScroll:this.handleScroll,onWheel:this.onWheel},m(vn,{onResize:this.handleContentResize},{default:()=>m("div",{ref:"contentRef",role:"none",style:[{width:this.xScrollable?"fit-content":null},this.contentStyle],class:[`${r}-scrollbar-content`,this.contentClass]},t)})),m("div",{ref:"yRailRef",class:`${r}-scrollbar-rail ${r}-scrollbar-rail--vertical`,style:this.horizontalRailStyle,"aria-hidden":!0},m(At,{name:"fade-in-transition"},{default:()=>this.needYBar&&this.isShowYBar&&!this.isIos?m("div",{class:`${r}-scrollbar-rail__scrollbar`,style:{height:this.yBarSizePx,top:this.yBarTopPx},onMousedown:this.handleYScrollMouseDown}):null})),m("div",{ref:"xRailRef",class:`${r}-scrollbar-rail ${r}-scrollbar-rail--horizontal`,style:this.verticalRailStyle,"aria-hidden":!0},m(At,{name:"fade-in-transition"},{default:()=>this.needXBar&&this.isShowXBar&&!this.isIos?m("div",{class:`${r}-scrollbar-rail__scrollbar`,style:{width:this.xBarSizePx,left:this.xBarLeftPx},onMousedown:this.handleXScrollMouseDown}):null}))])};return this.container?n():m(vn,{onResize:this.handleContainerResize},{default:n})}});var Em=t3,r3={height:"calc(var(--n-option-height) * 7.6)",paddingSmall:"4px 0",paddingMedium:"4px 0",paddingLarge:"4px 0",paddingHuge:"4px 0",optionPaddingSmall:"0 12px",optionPaddingMedium:"0 12px",optionPaddingLarge:"0 12px",optionPaddingHuge:"0 12px",loadingSize:"18px"};const Rm=e=>{const{borderRadius:t,popoverColor:r,textColor3:o,dividerColor:n,textColor2:i,primaryColorPressed:a,textColorDisabled:l,primaryColor:s,opacityDisabled:d,hoverColor:c,fontSizeSmall:u,fontSizeMedium:f,fontSizeLarge:h,fontSizeHuge:p,heightSmall:b,heightMedium:g,heightLarge:v,heightHuge:w}=e;return Object.assign(Object.assign({},r3),{optionFontSizeSmall:u,optionFontSizeMedium:f,optionFontSizeLarge:h,optionFontSizeHuge:p,optionHeightSmall:b,optionHeightMedium:g,optionHeightLarge:v,optionHeightHuge:w,borderRadius:t,color:r,groupHeaderTextColor:o,actionDividerColor:n,optionTextColor:i,optionTextColorPressed:a,optionTextColorDisabled:l,optionTextColorActive:s,optionOpacityDisabled:d,optionCheckColor:s,optionColorPending:c,optionColorActive:c,actionTextColor:i,loadingColor:s})},o3={name:"InternalSelectMenu",common:Ke,peers:{Scrollbar:Rc,Empty:km},self:Rm};var n3=o3;const i3={name:"InternalSelectMenu",common:de,peers:{Scrollbar:Ut,Empty:wi},self:Rm};var Si=i3;const{cubicBezierEaseIn:Zu,cubicBezierEaseOut:Ju}=yr;function vi({transformOrigin:e="inherit",duration:t=".2s",enterScale:r=".9",originalTransform:o="",originalTransition:n=""}={}){return[z("&.fade-in-scale-up-transition-leave-active",{transformOrigin:e,transition:`opacity ${t} ${Zu}, transform ${t} ${Zu} ${n&&","+n}`}),z("&.fade-in-scale-up-transition-enter-active",{transformOrigin:e,transition:`opacity ${t} ${Ju}, transform ${t} ${Ju} ${n&&","+n}`}),z("&.fade-in-scale-up-transition-enter-from, &.fade-in-scale-up-transition-leave-to",{opacity:0,transform:`${o} scale(${r})`}),z("&.fade-in-scale-up-transition-leave-from, &.fade-in-scale-up-transition-enter-to",{opacity:1,transform:`${o} scale(1)`})]}var a3=M("base-wave",` - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - border-radius: inherit; -`),zm=oe({name:"BaseWave",props:{clsPrefix:{type:String,required:!0}},setup(e){Jr("-base-wave",a3,Oe(e,"clsPrefix"));const t=W(null),r=W(!1);let o=null;return It(()=>{o!==null&&window.clearTimeout(o)}),{active:r,selfRef:t,play(){o!==null&&(window.clearTimeout(o),r.value=!1,o=null),br(()=>{var n;(n=t.value)===null||n===void 0||n.offsetHeight,r.value=!0,o=window.setTimeout(()=>{r.value=!1,o=null},1e3)})}}},render(){const{clsPrefix:e}=this;return m("div",{ref:"selfRef","aria-hidden":!0,class:[`${e}-base-wave`,this.active&&`${e}-base-wave--active`]})}}),l3={space:"6px",spaceArrow:"10px",arrowOffset:"10px",arrowOffsetVertical:"10px",arrowHeight:"6px",padding:"8px 14px"};const Am=e=>{const{boxShadow2:t,popoverColor:r,textColor2:o,borderRadius:n,fontSize:i,dividerColor:a}=e;return Object.assign(Object.assign({},l3),{fontSize:i,borderRadius:n,color:r,dividerColor:a,textColor:o,boxShadow:t})},s3={name:"Popover",common:Ke,self:Am};var _i=s3;const c3={name:"Popover",common:de,self:Am};var zo=c3;const El={top:"bottom",bottom:"top",left:"right",right:"left"},gt="var(--n-arrow-height) * 1.414";var d3=z([M("popover",` - transition: - box-shadow .3s var(--n-bezier), - background-color .3s var(--n-bezier), - color .3s var(--n-bezier); - transform-origin: inherit; - position: relative; - font-size: var(--n-font-size); - color: var(--n-text-color); - box-shadow: var(--n-box-shadow); - `,[z("&.popover-transition-enter-from, &.popover-transition-leave-to",` - opacity: 0; - transform: scale(.85); - `),z("&.popover-transition-enter-to, &.popover-transition-leave-from",` - transform: scale(1); - opacity: 1; - `),z("&.popover-transition-enter-active",` - transition: - opacity .15s var(--n-bezier-ease-out), - transform .15s var(--n-bezier-ease-out); - `),z("&.popover-transition-leave-active",` - transition: - opacity .15s var(--n-bezier-ease-in), - transform .15s var(--n-bezier-ease-in); - `),ut("raw",` - background-color: var(--n-color); - border-radius: var(--n-border-radius); - `,[ut("show-header","padding: var(--n-padding);")]),F("header",` - padding: var(--n-padding); - border-bottom: 1px solid var(--n-divider-color); - transition: border-color .3s var(--n-bezier); - `),F("content",` - padding: var(--n-padding); - `),M("popover-arrow-wrapper",` - position: absolute; - overflow: hidden; - pointer-events: none; - `,[M("popover-arrow",` - transition: background-color .3s var(--n-bezier); - position: absolute; - display: block; - width: calc(${gt}); - height: calc(${gt}); - box-shadow: 0 0 8px 0 rgba(0, 0, 0, .12); - transform: rotate(45deg); - background-color: var(--n-color); - pointer-events: all; - `)])]),Xt("top-start",` - top: calc(${gt} / -2 + 1px); - left: calc(${_r("top-start")} - var(--v-offset-left)); - `),Xt("top",` - top: calc(${gt} / -2 + 1px); - transform: translateX(calc(${gt} / -2)) rotate(45deg); - left: 50%; - `),Xt("top-end",` - top: calc(${gt} / -2 + 1px); - right: calc(${_r("top-end")} + var(--v-offset-left)); - `),Xt("bottom-start",` - bottom: calc(${gt} / -2 + 1px); - left: calc(${_r("bottom-start")} - var(--v-offset-left)); - `),Xt("bottom",` - bottom: calc(${gt} / -2 + 1px); - transform: translateX(calc(${gt} / -2)) rotate(45deg); - left: 50%; - `),Xt("bottom-end",` - bottom: calc(${gt} / -2 + 1px); - right: calc(${_r("bottom-end")} + var(--v-offset-left)); - `),Xt("left-start",` - left: calc(${gt} / -2 + 1px); - top: calc(${_r("left-start")} - var(--v-offset-top)); - `),Xt("left",` - left: calc(${gt} / -2 + 1px); - transform: translateY(calc(${gt} / -2)) rotate(45deg); - top: 50%; - `),Xt("left-end",` - left: calc(${gt} / -2 + 1px); - bottom: calc(${_r("left-end")} + var(--v-offset-top)); - `),Xt("right-start",` - right: calc(${gt} / -2 + 1px); - top: calc(${_r("right-start")} - var(--v-offset-top)); - `),Xt("right",` - right: calc(${gt} / -2 + 1px); - transform: translateY(calc(${gt} / -2)) rotate(45deg); - top: 50%; - `),Xt("right-end",` - right: calc(${gt} / -2 + 1px); - bottom: calc(${_r("right-end")} + var(--v-offset-top)); - `),...y5({top:["right-start","left-start"],right:["top-end","bottom-end"],bottom:["right-end","left-end"],left:["top-start","bottom-start"]},(e,t)=>{const r=["right","left"].includes(t),o=r?"width":"height";return e.map(n=>{const i=n.split("-")[1]==="end",l=`calc((${`var(--v-target-${o}, 0px)`} - ${gt}) / 2)`,s=_r(n);return z(`[v-placement="${n}"] >`,[M("popover",[K("center-arrow",[M("popover-arrow",`${t}: calc(max(${l}, ${s}) ${i?"+":"-"} var(--v-offset-${r?"left":"top"}));`)])])])})})]);function _r(e){return["top","bottom"].includes(e.split("-")[0])?"var(--n-arrow-offset)":"var(--n-arrow-offset-vertical)"}function Xt(e,t){const r=e.split("-")[0],o=["top","bottom"].includes(r)?"height: var(--n-space-arrow);":"width: var(--n-space-arrow);";return z(`[v-placement="${e}"] >`,[M("popover",[ut("manual-trigger",` - margin-${El[r]}: var(--n-space); - `),K("show-arrow",` - margin-${El[r]}: var(--n-space-arrow); - `),K("overlap",` - margin: 0; - `),ey("popover-arrow-wrapper",` - right: 0; - left: 0; - top: 0; - bottom: 0; - ${r}: calc(100% - 1px); - ${El[r]}: auto; - ${o} - `,[M("popover-arrow",t)])])])}const Om=Object.assign(Object.assign({},ze.props),{to:pn.propTo,show:Boolean,trigger:String,showArrow:Boolean,delay:Number,duration:Number,raw:Boolean,arrowPointToCenter:Boolean,arrowStyle:[String,Object],displayDirective:String,x:Number,y:Number,flip:Boolean,overlap:Boolean,placement:String,width:[Number,String],keepAliveOnHover:Boolean,internalTrapFocus:Boolean,animated:Boolean,onClickoutside:Function,minWidth:Number,maxWidth:Number}),Im=({arrowStyle:e,clsPrefix:t})=>m("div",{key:"__popover-arrow__",class:`${t}-popover-arrow-wrapper`},m("div",{class:`${t}-popover-arrow`,style:e}));var u3=oe({name:"PopoverBody",inheritAttrs:!1,props:Om,setup(e,{slots:t,attrs:r}){const{namespaceRef:o,mergedClsPrefixRef:n,inlineThemeDisabled:i}=lt(e),a=ze("Popover","-popover",d3,_i,e,n),l=W(null),s=be("NPopover"),d=W(null),c=W(e.show),u=L(()=>{const{trigger:E,onClickoutside:y}=e,_=[],{positionManuallyRef:{value:R}}=s;return R||(E==="click"&&!y&&_.push([Cs,$,void 0,{capture:!0}]),E==="hover"&&_.push([lP,w])),y&&_.push([Cs,$,void 0,{capture:!0}]),e.displayDirective==="show"&&_.push([li,e.show]),_}),f=L(()=>[{width:e.width==="trigger"?"":Qt(e.width)},e.maxWidth?{maxWidth:Qt(e.maxWidth)}:{},e.minWidth?{minWidth:Qt(e.minWidth)}:{},i?void 0:h.value]),h=L(()=>{const{common:{cubicBezierEaseInOut:E,cubicBezierEaseIn:y,cubicBezierEaseOut:_},self:{space:R,spaceArrow:P,padding:j,fontSize:T,textColor:N,dividerColor:B,color:q,boxShadow:A,borderRadius:te,arrowHeight:se,arrowOffset:_e,arrowOffsetVertical:Ae}}=a.value;return{"--n-box-shadow":A,"--n-bezier":E,"--n-bezier-ease-in":y,"--n-bezier-ease-out":_,"--n-font-size":T,"--n-text-color":N,"--n-color":q,"--n-divider-color":B,"--n-border-radius":te,"--n-arrow-height":se,"--n-arrow-offset":_e,"--n-arrow-offset-vertical":Ae,"--n-padding":j,"--n-space":R,"--n-space-arrow":P}}),p=i?_t("popover",void 0,h,e):void 0;s.setBodyInstance({syncPosition:b}),It(()=>{s.setBodyInstance(null)}),qe(Oe(e,"show"),E=>{e.animated||(E?c.value=!0:c.value=!1)});function b(){var E;(E=l.value)===null||E===void 0||E.syncPosition()}function g(E){e.trigger==="hover"&&e.keepAliveOnHover&&s.handleMouseEnter(E)}function v(E){e.trigger==="hover"&&e.keepAliveOnHover&&s.handleMouseLeave(E)}function w(E){e.trigger==="hover"&&!x().contains(E.target)&&s.handleMouseMoveOutside(E)}function $(E){(e.trigger==="click"&&!x().contains(E.target)||e.onClickoutside)&&s.handleClickOutside(E)}function x(){return s.getTriggerElement()}je(mc,d),je(pc,null),je(hc,null);function S(){p==null||p.onRender();let E;const{internalRenderBodyRef:{value:y}}=s,{value:_}=n;if(y)E=y([`${_}-popover`,p==null?void 0:p.themeClass.value,e.overlap&&`${_}-popover--overlap`],d,f.value,g,v);else{const{value:R}=s.extraClassRef,{internalTrapFocus:P}=e,j=()=>{var T;return[bt(t.header,N=>N&&[m("div",{class:`${_}-popover__header`},N),m("div",{class:`${_}-popover__content`},t)])||((T=t.default)===null||T===void 0?void 0:T.call(t)),e.showArrow?Im({arrowStyle:e.arrowStyle,clsPrefix:_}):null]};E=m("div",Xr({class:[`${_}-popover`,p==null?void 0:p.themeClass.value,R.map(T=>`${_}-${T}`),{[`${_}-popover--overlap`]:e.overlap,[`${_}-popover--show-arrow`]:e.showArrow,[`${_}-popover--show-header`]:!cc(t.header),[`${_}-popover--raw`]:e.raw,[`${_}-popover--manual-trigger`]:e.trigger==="manual",[`${_}-popover--center-arrow`]:e.arrowPointToCenter}],ref:d,style:f.value,onKeydown:s.handleKeydown,onMouseenter:g,onMouseleave:v},r),P?m(Sm,{active:e.show,autoFocus:!0},{default:j}):j())}return e.displayDirective==="show"||e.show?Cr(E,u.value):null}return{namespace:o,isMounted:s.isMountedRef,zIndex:s.zIndexRef,followerRef:l,adjustedTo:pn(e),followerEnabled:c,renderContentNode:S}},render(){return m(hm,{zIndex:this.zIndex,show:this.show,enabled:this.followerEnabled,to:this.adjustedTo,x:this.x,y:this.y,flip:this.flip,placement:this.placement,containerClass:this.namespace,ref:"followerRef",overlap:this.overlap,width:this.width==="trigger"?"target":void 0,teleportDisabled:this.adjustedTo===pn.tdkey},{default:()=>this.animated?m(At,{name:"popover-transition",appear:this.isMounted,onEnter:()=>{this.followerEnabled=!0},onAfterLeave:()=>{this.followerEnabled=!1}},{default:this.renderContentNode}):this.renderContentNode()})}});const f3=Object.keys(Om),h3={focus:["onFocus","onBlur"],click:["onClick"],hover:["onMouseenter","onMouseleave"],manual:[],nested:["onFocus","onBlur","onMouseenter","onMouseleave","onClick"]};function p3(e,t,r){h3[t].forEach(o=>{e.props?e.props=Object.assign({},e.props):e.props={};const n=e.props[o],i=r[o];n?e.props[o]=(...a)=>{n(...a),i(...a)}:e.props[o]=i})}const m3=sr("").type,Ya={show:{type:Boolean,default:void 0},defaultShow:Boolean,showArrow:{type:Boolean,default:!0},trigger:{type:String,default:"hover"},delay:{type:Number,default:100},duration:{type:Number,default:100},raw:Boolean,placement:{type:String,default:"top"},x:Number,y:Number,arrowPointToCenter:Boolean,disabled:Boolean,getDisabled:Function,displayDirective:{type:String,default:"if"},arrowStyle:[String,Object],flip:{type:Boolean,default:!0},animated:{type:Boolean,default:!0},width:{type:[Number,String],default:void 0},overlap:Boolean,keepAliveOnHover:{type:Boolean,default:!0},onClickoutside:Function,internalExtraClass:{type:Array,default:()=>[]},"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],zIndex:Number,to:pn.propTo,internalSyncTargetWithParent:Boolean,internalInheritedEventHandlers:{type:Array,default:()=>[]},internalTrapFocus:Boolean,onShow:[Function,Array],onHide:[Function,Array],arrow:{type:Boolean,default:void 0},minWidth:Number,maxWidth:Number},v3=Object.assign(Object.assign(Object.assign({},ze.props),Ya),{internalRenderBody:Function});var Mm=oe({name:"Popover",inheritAttrs:!1,props:v3,__popover__:!0,setup(e){const t=xi(),r=W(null),o=L(()=>e.show),n=W(e.defaultShow),i=hn(o,n),a=ht(()=>e.disabled?!1:i.value),l=()=>{if(e.disabled)return!0;const{getDisabled:B}=e;return!!(B!=null&&B())},s=()=>l()?!1:i.value,d=di(e,["arrow","showArrow"]),c=L(()=>e.overlap?!1:d.value);let u=null;const f=W(null),h=W(null),p=ht(()=>e.x!==void 0&&e.y!==void 0);function b(B){const{"onUpdate:show":q,onUpdateShow:A,onShow:te,onHide:se}=e;n.value=B,q&&Be(q,B),A&&Be(A,B),B&&te&&Be(te,!0),B&&se&&Be(se,!1)}function g(){u&&u.syncPosition()}function v(){const{value:B}=f;B&&(window.clearTimeout(B),f.value=null)}function w(){const{value:B}=h;B&&(window.clearTimeout(B),h.value=null)}function $(){const B=l();if(e.trigger==="focus"&&!B){if(s())return;b(!0)}}function x(){const B=l();if(e.trigger==="focus"&&!B){if(!s())return;b(!1)}}function S(){const B=l();if(e.trigger==="hover"&&!B){if(w(),f.value!==null||s())return;const q=()=>{b(!0),f.value=null},{delay:A}=e;A===0?q():f.value=window.setTimeout(q,A)}}function E(){const B=l();if(e.trigger==="hover"&&!B){if(v(),h.value!==null||!s())return;const q=()=>{b(!1),h.value=null},{duration:A}=e;A===0?q():h.value=window.setTimeout(q,A)}}function y(){E()}function _(B){var q;!s()||(e.trigger==="click"&&(v(),w(),b(!1)),(q=e.onClickoutside)===null||q===void 0||q.call(e,B))}function R(){if(e.trigger==="click"&&!l()){v(),w();const B=!s();b(B)}}function P(B){!e.internalTrapFocus||B.code==="Escape"&&(v(),w(),b(!1))}function j(B){n.value=B}function T(){var B;return(B=r.value)===null||B===void 0?void 0:B.targetRef}function N(B){u=B}return je("NPopover",{getTriggerElement:T,handleKeydown:P,handleMouseEnter:S,handleMouseLeave:E,handleClickOutside:_,handleMouseMoveOutside:y,setBodyInstance:N,positionManuallyRef:p,isMountedRef:t,zIndexRef:Oe(e,"zIndex"),extraClassRef:Oe(e,"internalExtraClass"),internalRenderBodyRef:Oe(e,"internalRenderBody")}),{binderInstRef:r,positionManually:p,mergedShowConsideringDisabledProp:a,uncontrolledShow:n,mergedShowArrow:c,getMergedShow:s,setShow:j,handleClick:R,handleMouseEnter:S,handleMouseLeave:E,handleFocus:$,handleBlur:x,syncPosition:g}},render(){var e;const{positionManually:t,$slots:r}=this;let o,n=!1;if(!t&&(r.activator?o=as(r,"activator"):o=as(r,"trigger"),o)){o=lr(o),o=o.type===m3?m("span",[o]):o;const i={onClick:this.handleClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onFocus:this.handleFocus,onBlur:this.handleBlur};if(!((e=o.type)===null||e===void 0)&&e.__popover__)n=!0,o.props||(o.props={internalSyncTargetWithParent:!0,internalInheritedEventHandlers:[]}),o.props.internalSyncTargetWithParent=!0,o.props.internalInheritedEventHandlers?o.props.internalInheritedEventHandlers=[i,...o.props.internalInheritedEventHandlers]:o.props.internalInheritedEventHandlers=[i];else{const{internalInheritedEventHandlers:a}=this,l=[i,...a],s={onBlur:d=>{l.forEach(c=>{c.onBlur(d)})},onFocus:d=>{l.forEach(c=>{c.onFocus(d)})},onClick:d=>{l.forEach(c=>{c.onClick(d)})},onMouseenter:d=>{l.forEach(c=>{c.onMouseenter(d)})},onMouseleave:d=>{l.forEach(c=>{c.onMouseleave(d)})}};p3(o,a?"nested":t?"manual":this.trigger,s)}}return m(dm,{ref:"binderInstRef",syncTarget:!n,syncTargetWithParent:this.internalSyncTargetWithParent},{default:()=>{this.mergedShowConsideringDisabledProp;const i=this.getMergedShow();return[this.internalTrapFocus&&i?Cr(m("div",{style:{position:"fixed",inset:0}}),[[qa,{enabled:i,zIndex:this.zIndex}]]):null,t?null:m(um,null,{default:()=>o}),m(u3,Vt(this.$props,f3,Object.assign(Object.assign({},this.$attrs),{showArrow:this.mergedShowArrow,show:i})),{default:()=>{var a,l;return(l=(a=this.$slots).default)===null||l===void 0?void 0:l.call(a)},header:()=>{var a,l;return(l=(a=this.$slots).header)===null||l===void 0?void 0:l.call(a)}})]}})}}),Bm={closeSizeSmall:"14px",closeSizeMedium:"14px",closeSizeLarge:"14px",padding:"0 7px",closeMargin:"0 0 0 3px",closeMarginRtl:"0 3px 0 0"};const g3={name:"Tag",common:de,self(e){const{textColor2:t,primaryColorHover:r,primaryColorPressed:o,primaryColor:n,infoColor:i,successColor:a,warningColor:l,errorColor:s,baseColor:d,borderColor:c,opacityDisabled:u,closeColor:f,closeColorHover:h,closeColorPressed:p,borderRadiusSmall:b,fontSizeTiny:g,fontSizeSmall:v,fontSizeMedium:w,heightTiny:$,heightSmall:x,heightMedium:S}=e;return Object.assign(Object.assign({},Bm),{heightSmall:$,heightMedium:x,heightLarge:S,borderRadius:b,opacityDisabled:u,fontSizeSmall:g,fontSizeMedium:v,fontSizeLarge:w,textColorCheckable:t,textColorHoverCheckable:r,textColorPressedCheckable:o,textColorChecked:d,colorCheckable:"#0000",colorHoverCheckable:"#0000",colorPressedCheckable:"#0000",colorChecked:n,colorCheckedHover:r,colorCheckedPressed:o,border:`1px solid ${c}`,textColor:t,color:"#0000",closeColor:f,closeColorHover:h,closeColorPressed:p,borderPrimary:`1px solid ${ee(n,{alpha:.3})}`,textColorPrimary:n,colorPrimary:"#0000",closeColorPrimary:ee(n,{alpha:.7}),closeColorHoverPrimary:ee(n,{alpha:.85}),closeColorPressedPrimary:ee(n,{alpha:.57}),borderInfo:`1px solid ${ee(i,{alpha:.3})}`,textColorInfo:i,colorInfo:"#0000",closeColorInfo:ee(i,{alpha:.7}),closeColorHoverInfo:ee(i,{alpha:.85}),closeColorPressedInfo:ee(i,{alpha:.57}),borderSuccess:`1px solid ${ee(a,{alpha:.3})}`,textColorSuccess:a,colorSuccess:"#0000",closeColorSuccess:ee(a,{alpha:.7}),closeColorHoverSuccess:ee(a,{alpha:.85}),closeColorPressedSuccess:ee(a,{alpha:.57}),borderWarning:`1px solid ${ee(l,{alpha:.3})}`,textColorWarning:l,colorWarning:"#0000",closeColorWarning:ee(l,{alpha:.7}),closeColorHoverWarning:ee(l,{alpha:.85}),closeColorPressedWarning:ee(l,{alpha:.57}),borderError:`1px solid ${ee(s,{alpha:.3})}`,textColorError:s,colorError:"#0000",closeColorError:ee(s,{alpha:.7}),closeColorHoverError:ee(s,{alpha:.85}),closeColorPressedError:ee(s,{alpha:.57})})}};var Lm=g3;const b3=e=>{const{textColor2:t,primaryColorHover:r,primaryColorPressed:o,primaryColor:n,infoColor:i,successColor:a,warningColor:l,errorColor:s,baseColor:d,borderColor:c,opacityDisabled:u,tagColor:f,closeColor:h,closeColorHover:p,closeColorPressed:b,borderRadiusSmall:g,fontSizeTiny:v,fontSizeSmall:w,fontSizeMedium:$,heightTiny:x,heightSmall:S,heightMedium:E}=e;return Object.assign(Object.assign({},Bm),{heightSmall:x,heightMedium:S,heightLarge:E,borderRadius:g,opacityDisabled:u,fontSizeSmall:v,fontSizeMedium:w,fontSizeLarge:$,textColorCheckable:t,textColorHoverCheckable:r,textColorPressedCheckable:o,textColorChecked:d,colorCheckable:"#0000",colorHoverCheckable:"#0000",colorPressedCheckable:"#0000",colorChecked:n,colorCheckedHover:r,colorCheckedPressed:o,border:`1px solid ${c}`,textColor:t,color:f,closeColor:h,closeColorHover:p,closeColorPressed:b,borderPrimary:`1px solid ${ee(n,{alpha:.3})}`,textColorPrimary:n,colorPrimary:ee(n,{alpha:.1}),closeColorPrimary:ee(n,{alpha:.75}),closeColorHoverPrimary:ee(n,{alpha:.6}),closeColorPressedPrimary:ee(n,{alpha:.9}),borderInfo:`1px solid ${ee(i,{alpha:.3})}`,textColorInfo:i,colorInfo:ee(i,{alpha:.1}),closeColorInfo:ee(i,{alpha:.75}),closeColorHoverInfo:ee(i,{alpha:.6}),closeColorPressedInfo:ee(i,{alpha:.9}),borderSuccess:`1px solid ${ee(a,{alpha:.3})}`,textColorSuccess:a,colorSuccess:ee(a,{alpha:.1}),closeColorSuccess:ee(a,{alpha:.75}),closeColorHoverSuccess:ee(a,{alpha:.6}),closeColorPressedSuccess:ee(a,{alpha:.9}),borderWarning:`1px solid ${ee(l,{alpha:.35})}`,textColorWarning:l,colorWarning:ee(l,{alpha:.12}),closeColorWarning:ee(l,{alpha:.75}),closeColorHoverWarning:ee(l,{alpha:.6}),closeColorPressedWarning:ee(l,{alpha:.9}),borderError:`1px solid ${ee(s,{alpha:.23})}`,textColorError:s,colorError:ee(s,{alpha:.08}),closeColorError:ee(s,{alpha:.65}),closeColorHoverError:ee(s,{alpha:.5}),closeColorPressedError:ee(s,{alpha:.8})})},x3={name:"Tag",common:Ke,self:b3};var C3=x3,y3={color:Object,type:{type:String,default:"default"},round:Boolean,size:{type:String,default:"medium"},closable:Boolean,disabled:{type:Boolean,default:void 0}},w3=M("tag",` - white-space: nowrap; - position: relative; - box-sizing: border-box; - cursor: default; - display: inline-flex; - align-items: center; - flex-wrap: nowrap; - padding: var(--n-padding); - border-radius: var(--n-border-radius); - color: var(--n-text-color); - background-color: var(--n-color); - transition: - border-color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - color .3s var(--n-bezier), - box-shadow .3s var(--n-bezier), - opacity .3s var(--n-bezier); - line-height: 1; - height: var(--n-height); - font-size: var(--n-font-size); -`,[F("border",` - pointer-events: none; - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - border-radius: inherit; - border: var(--n-border); - transition: border-color .3s var(--n-bezier); - `),F("avatar",` - display: flex; - margin-right: 6px; - `),F("close",` - font-size: var(--n-close-size); - margin: var(--n-close-margin); - transition: color .3s var(--n-bezier); - cursor: pointer; - `),K("round",` - padding: 0 calc(var(--n-height) / 2); - border-radius: calc(var(--n-height) / 2); - `,[F("avatar",` - margin-left: calc((var(--n-height) - 8px) / -2); - `)]),K("disabled",` - cursor: not-allowed !important; - opacity: var(--n-opacity-disabled); - `),K("checkable",` - cursor: pointer; - box-shadow: none; - color: var(--n-text-color-checkable); - background-color: var(--n-color-checkable); - `,[ut("disabled",[z("&:hover","background-color: var(--n-color-hover-checkable);",[ut("checked","color: var(--n-text-color-hover-checkable);")]),z("&:active","background-color: var(--n-color-pressed-checkable);",[ut("checked","color: var(--n-text-color-pressed-checkable);")])]),K("checked",` - color: var(--n-text-color-checked); - background-color: var(--n-color-checked); - `,[ut("disabled",[z("&:hover","background-color: var(--n-color-checked-hover);"),z("&:active","background-color: var(--n-color-checked-pressed);")])])])]);function Pn(e,t,r){if(!t)return;const o=$n(),n=L(()=>{const{value:a}=t;if(!a)return;const l=a[e];if(!!l)return l}),i=()=>{xr(()=>{const{value:a}=r,l=`${a}${e}Rtl`;if(YC(l,o))return;const{value:s}=n;!s||s.style.mount({id:l,head:!0,anchorMetaName:hi,props:{bPrefix:a?`.${a}-`:void 0},ssr:o})})};return o?i():Yr(i),n}const S3=Object.assign(Object.assign(Object.assign({},ze.props),y3),{bordered:{type:Boolean,default:void 0},checked:Boolean,checkable:Boolean,onClose:[Array,Function],onMouseenter:Function,onMouseleave:Function,"onUpdate:checked":Function,onUpdateChecked:Function,internalStopClickPropagation:Boolean,onCheckedChange:{type:Function,validator:()=>!0,default:void 0}}),Dm="n-tag";var fO=oe({name:"Tag",props:S3,setup(e){const t=W(null),{mergedBorderedRef:r,mergedClsPrefixRef:o,inlineThemeDisabled:n,mergedRtlRef:i}=lt(e),a=ze("Tag","-tag",w3,C3,e,o);je(Dm,{roundRef:Oe(e,"round")});function l(h){if(!e.disabled&&e.checkable){const{checked:p,onCheckedChange:b,onUpdateChecked:g,"onUpdate:checked":v}=e;g&&g(!p),v&&v(!p),b&&b(!p)}}function s(h){if(e.internalStopClickPropagation&&h.stopPropagation(),!e.disabled){const{onClose:p}=e;p&&Be(p,h)}}const d={setTextContent(h){const{value:p}=t;p&&(p.textContent=h)}},c=Pn("Tag",i,o),u=L(()=>{const{type:h,size:p,color:{color:b,textColor:g}={}}=e,{common:{cubicBezierEaseInOut:v},self:{padding:w,closeMargin:$,closeMarginRtl:x,borderRadius:S,opacityDisabled:E,textColorCheckable:y,textColorHoverCheckable:_,textColorPressedCheckable:R,textColorChecked:P,colorCheckable:j,colorHoverCheckable:T,colorPressedCheckable:N,colorChecked:B,colorCheckedHover:q,colorCheckedPressed:A,[ae("closeSize",p)]:te,[ae("fontSize",p)]:se,[ae("height",p)]:_e,[ae("color",h)]:Ae,[ae("textColor",h)]:Re,[ae("border",h)]:Ee,[ae("closeColor",h)]:$e,[ae("closeColorHover",h)]:it,[ae("closeColorPressed",h)]:O}}=a.value;return{"--n-avatar-size-override":`calc(${_e} - 8px)`,"--n-bezier":v,"--n-border-radius":S,"--n-border":Ee,"--n-close-color":$e,"--n-close-color-hover":it,"--n-close-color-pressed":O,"--n-close-color-disabled":$e,"--n-close-margin":$,"--n-close-margin-rtl":x,"--n-close-size":te,"--n-color":b||Ae,"--n-color-checkable":j,"--n-color-checked":B,"--n-color-checked-hover":q,"--n-color-checked-pressed":A,"--n-color-hover-checkable":T,"--n-color-pressed-checkable":N,"--n-font-size":se,"--n-height":_e,"--n-opacity-disabled":E,"--n-padding":w,"--n-text-color":g||Re,"--n-text-color-checkable":y,"--n-text-color-checked":P,"--n-text-color-hover-checkable":_,"--n-text-color-pressed-checkable":R}}),f=n?_t("tag",L(()=>{let h="";const{type:p,size:b,color:{color:g,textColor:v}={}}=e;return h+=p[0],h+=b[0],g&&(h+=`a${un(g)}`),v&&(h+=`b${un(v)}`),h}),u,e):void 0;return Object.assign(Object.assign({},d),{rtlEnabled:c,mergedClsPrefix:o,contentRef:t,mergedBordered:r,handleClick:l,handleCloseClick:s,cssVars:n?void 0:u,themeClass:f==null?void 0:f.themeClass,onRender:f==null?void 0:f.onRender})},render(){var e,t;const{mergedClsPrefix:r,rtlEnabled:o,color:{borderColor:n}={},onRender:i,$slots:a}=this;return i==null||i(),m("div",{class:[`${r}-tag`,this.themeClass,{[`${r}-tag--rtl`]:o,[`${r}-tag--disabled`]:this.disabled,[`${r}-tag--checkable`]:this.checkable,[`${r}-tag--checked`]:this.checkable&&this.checked,[`${r}-tag--round`]:this.round}],style:this.cssVars,onClick:this.handleClick,onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave},bt(a.avatar,l=>l&&m("div",{class:`${r}-tag__avatar`},l)),m("span",{class:`${r}-tag__content`,ref:"contentRef"},(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e)),!this.checkable&&this.closable?m(yi,{clsPrefix:r,class:`${r}-tag__close`,disabled:this.disabled,onClick:this.handleCloseClick}):null,!this.checkable&&this.mergedBordered?m("div",{class:`${r}-tag__border`,style:{borderColor:n}}):null)}}),_3=M("base-clear",` - flex-shrink: 0; - height: 1em; - width: 1em; - position: relative; -`,[z(">",[F("clear",` - font-size: var(--n-clear-size); - cursor: pointer; - color: var(--n-clear-color); - transition: color .3s var(--n-bezier); - `,[z("&:hover",` - color: var(--n-clear-color-hover)!important; - `),z("&:active",` - color: var(--n-clear-color-pressed)!important; - `)]),F("placeholder",` - display: flex; - `),F("clear, placeholder",` - position: absolute; - left: 50%; - top: 50%; - transform: translateX(-50%) translateY(-50%); - `,[pi({originalTransform:"translateX(-50%) translateY(-50%)",left:"50%",top:"50%"})])])]),ws=oe({name:"BaseClear",props:{clsPrefix:{type:String,required:!0},show:Boolean,onClear:Function},setup(e){return Jr("-base-clear",_3,Oe(e,"clsPrefix")),{handleMouseDown(t){t.preventDefault()}}},render(){const{clsPrefix:e}=this;return m("div",{class:`${e}-base-clear`},m(Va,null,{default:()=>{var t,r;return this.show?m(Bt,{clsPrefix:e,key:"dismiss",class:`${e}-base-clear__clear`,onClick:this.onClear,onMousedown:this.handleMouseDown,"data-clear":!0},{default:()=>m(_$,null)}):m("div",{key:"icon",class:`${e}-base-clear__placeholder`},(r=(t=this.$slots).default)===null||r===void 0?void 0:r.call(t))}}))}}),$3=oe({name:"InternalSelectionSuffix",props:{clsPrefix:{type:String,required:!0},showArrow:{type:Boolean,default:void 0},showClear:{type:Boolean,default:void 0},loading:{type:Boolean,default:!1},onClear:Function},setup(e,{slots:t}){return()=>{const{clsPrefix:r}=e;return m(Ua,{clsPrefix:r,class:`${r}-base-suffix`,strokeWidth:24,scale:.85,show:e.loading},{default:()=>e.showArrow?m(ws,{clsPrefix:r,show:e.showClear,onClear:e.onClear},{default:()=>m(Bt,{clsPrefix:r,class:`${r}-base-suffix__arrow`},{default:()=>_o(t.default,()=>[m(S$,null)])})}):null})}}}),Fm={paddingSingle:"0 26px 0 12px",paddingMultiple:"3px 26px 0 12px",clearSize:"16px",arrowSize:"16px"};const P3=e=>{const{borderRadius:t,textColor2:r,textColorDisabled:o,inputColor:n,inputColorDisabled:i,primaryColor:a,primaryColorHover:l,warningColor:s,warningColorHover:d,errorColor:c,errorColorHover:u,borderColor:f,iconColor:h,iconColorDisabled:p,clearColor:b,clearColorHover:g,clearColorPressed:v,placeholderColor:w,placeholderColorDisabled:$,fontSizeTiny:x,fontSizeSmall:S,fontSizeMedium:E,fontSizeLarge:y,heightTiny:_,heightSmall:R,heightMedium:P,heightLarge:j}=e;return Object.assign(Object.assign({},Fm),{fontSizeTiny:x,fontSizeSmall:S,fontSizeMedium:E,fontSizeLarge:y,heightTiny:_,heightSmall:R,heightMedium:P,heightLarge:j,borderRadius:t,textColor:r,textColorDisabled:o,placeholderColor:w,placeholderColorDisabled:$,color:n,colorDisabled:i,colorActive:n,border:`1px solid ${f}`,borderHover:`1px solid ${l}`,borderActive:`1px solid ${a}`,borderFocus:`1px solid ${l}`,boxShadowHover:"none",boxShadowActive:`0 0 0 2px ${ee(a,{alpha:.2})}`,boxShadowFocus:`0 0 0 2px ${ee(a,{alpha:.2})}`,caretColor:a,arrowColor:h,arrowColorDisabled:p,loadingColor:a,borderWarning:`1px solid ${s}`,borderHoverWarning:`1px solid ${d}`,borderActiveWarning:`1px solid ${s}`,borderFocusWarning:`1px solid ${d}`,boxShadowHoverWarning:"none",boxShadowActiveWarning:`0 0 0 2px ${ee(s,{alpha:.2})}`,boxShadowFocusWarning:`0 0 0 2px ${ee(s,{alpha:.2})}`,colorActiveWarning:n,caretColorWarning:s,borderError:`1px solid ${c}`,borderHoverError:`1px solid ${u}`,borderActiveError:`1px solid ${c}`,borderFocusError:`1px solid ${u}`,boxShadowHoverError:"none",boxShadowActiveError:`0 0 0 2px ${ee(c,{alpha:.2})}`,boxShadowFocusError:`0 0 0 2px ${ee(c,{alpha:.2})}`,colorActiveError:n,caretColorError:c,clearColor:b,clearColorHover:g,clearColorPressed:v})},k3={name:"InternalSelection",common:Ke,peers:{Popover:_i},self:P3};var T3=k3;const E3={name:"InternalSelection",common:de,peers:{Popover:zo},self(e){const{borderRadius:t,textColor2:r,textColorDisabled:o,inputColor:n,inputColorDisabled:i,primaryColor:a,primaryColorHover:l,warningColor:s,warningColorHover:d,errorColor:c,errorColorHover:u,iconColor:f,iconColorDisabled:h,clearColor:p,clearColorHover:b,clearColorPressed:g,placeholderColor:v,placeholderColorDisabled:w,fontSizeTiny:$,fontSizeSmall:x,fontSizeMedium:S,fontSizeLarge:E,heightTiny:y,heightSmall:_,heightMedium:R,heightLarge:P}=e;return Object.assign(Object.assign({},Fm),{fontSizeTiny:$,fontSizeSmall:x,fontSizeMedium:S,fontSizeLarge:E,heightTiny:y,heightSmall:_,heightMedium:R,heightLarge:P,borderRadius:t,textColor:r,textColorDisabled:o,placeholderColor:v,placeholderColorDisabled:w,color:n,colorDisabled:i,colorActive:ee(a,{alpha:.1}),border:"1px solid #0000",borderHover:`1px solid ${l}`,borderActive:`1px solid ${a}`,borderFocus:`1px solid ${l}`,boxShadowHover:"none",boxShadowActive:`0 0 8px 0 ${ee(a,{alpha:.4})}`,boxShadowFocus:`0 0 8px 0 ${ee(a,{alpha:.4})}`,caretColor:a,arrowColor:f,arrowColorDisabled:h,loadingColor:a,borderWarning:`1px solid ${s}`,borderHoverWarning:`1px solid ${d}`,borderActiveWarning:`1px solid ${s}`,borderFocusWarning:`1px solid ${d}`,boxShadowHoverWarning:"none",boxShadowActiveWarning:`0 0 8px 0 ${ee(s,{alpha:.4})}`,boxShadowFocusWarning:`0 0 8px 0 ${ee(s,{alpha:.4})}`,colorActiveWarning:ee(s,{alpha:.1}),caretColorWarning:s,borderError:`1px solid ${c}`,borderHoverError:`1px solid ${u}`,borderActiveError:`1px solid ${c}`,borderFocusError:`1px solid ${u}`,boxShadowHoverError:"none",boxShadowActiveError:`0 0 8px 0 ${ee(c,{alpha:.4})}`,boxShadowFocusError:`0 0 8px 0 ${ee(c,{alpha:.4})}`,colorActiveError:ee(c,{alpha:.1}),caretColorError:c,clearColor:p,clearColorHover:b,clearColorPressed:g})}};var zc=E3,Qu=oe({name:"SlotMachineNumber",props:{clsPrefix:{type:String,required:!0},value:{type:[Number,String],required:!0},oldOriginalNumber:{type:Number,default:void 0},newOriginalNumber:{type:Number,default:void 0}},setup(e){const t=W(null),r=W(e.value),o=W(e.value),n=W("up"),i=W(!1),a=L(()=>i.value?`${e.clsPrefix}-base-slot-machine-current-number--${n.value}-scroll`:null),l=L(()=>i.value?`${e.clsPrefix}-base-slot-machine-old-number--${n.value}-scroll`:null);qe(Oe(e,"value"),(c,u)=>{r.value=u,o.value=c,br(s)});function s(){const c=e.newOriginalNumber,u=e.oldOriginalNumber;u===void 0||c===void 0||(c>u?d("up"):u>c&&d("down"))}function d(c){n.value=c,i.value=!1,br(()=>{var u;(u=t.value)===null||u===void 0||u.offsetWidth,i.value=!0})}return()=>{const{clsPrefix:c}=e;return m("span",{ref:t,class:`${c}-base-slot-machine-number`},r.value!==null?m("span",{class:[`${c}-base-slot-machine-old-number ${c}-base-slot-machine-old-number--top`,l.value]},r.value):null,m("span",{class:[`${c}-base-slot-machine-current-number`,a.value]},m("span",{ref:"numberWrapper",class:[`${c}-base-slot-machine-current-number__inner`,typeof e.value!="number"&&`${c}-base-slot-machine-current-number__inner--not-number`]},o.value)),r.value!==null?m("span",{class:[`${c}-base-slot-machine-old-number ${c}-base-slot-machine-old-number--bottom`,l.value]},r.value):null)}}});const{cubicBezierEaseInOut:Dr}=yr;function Hm({duration:e=".2s",delay:t=".1s"}={}){return[z("&.fade-in-width-expand-transition-leave-from, &.fade-in-width-expand-transition-enter-to",{opacity:1}),z("&.fade-in-width-expand-transition-leave-to, &.fade-in-width-expand-transition-enter-from",` - opacity: 0!important; - margin-left: 0!important; - margin-right: 0!important; - `),z("&.fade-in-width-expand-transition-leave-active",` - overflow: hidden; - transition: - opacity ${e} ${Dr}, - max-width ${e} ${Dr} ${t}, - margin-left ${e} ${Dr} ${t}, - margin-right ${e} ${Dr} ${t}; - `),z("&.fade-in-width-expand-transition-enter-active",` - overflow: hidden; - transition: - opacity ${e} ${Dr} ${t}, - max-width ${e} ${Dr}, - margin-left ${e} ${Dr}, - margin-right ${e} ${Dr}; - `)]}const{cubicBezierEaseOut:Fo}=yr;function R3({duration:e=".2s"}={}){return[z("&.fade-up-width-expand-transition-leave-active",{transition:` - opacity ${e} ${Fo}, - max-width ${e} ${Fo}, - transform ${e} ${Fo} - `}),z("&.fade-up-width-expand-transition-enter-active",{transition:` - opacity ${e} ${Fo}, - max-width ${e} ${Fo}, - transform ${e} ${Fo} - `}),z("&.fade-up-width-expand-transition-enter-to",{opacity:1,transform:"translateX(0) translateY(0)"}),z("&.fade-up-width-expand-transition-enter-from",{maxWidth:"0 !important",opacity:0,transform:"translateY(60%)"}),z("&.fade-up-width-expand-transition-leave-from",{opacity:1,transform:"translateY(0)"}),z("&.fade-up-width-expand-transition-leave-to",{maxWidth:"0 !important",opacity:0,transform:"translateY(60%)"})]}var z3=z([z("@keyframes n-base-slot-machine-fade-up-in",` - from { - transform: translateY(60%); - opacity: 0; - } - to { - transform: translateY(0); - opacity: 1; - } - `),z("@keyframes n-base-slot-machine-fade-down-in",` - from { - transform: translateY(-60%); - opacity: 0; - } - to { - transform: translateY(0); - opacity: 1; - } - `),z("@keyframes n-base-slot-machine-fade-up-out",` - from { - transform: translateY(0%); - opacity: 1; - } - to { - transform: translateY(-60%); - opacity: 0; - } - `),z("@keyframes n-base-slot-machine-fade-down-out",` - from { - transform: translateY(0%); - opacity: 1; - } - to { - transform: translateY(60%); - opacity: 0; - } - `),M("base-slot-machine",` - overflow: hidden; - white-space: nowrap; - display: inline-block; - height: 18px; - line-height: 18px; - `,[M("base-slot-machine-number",` - display: inline-block; - position: relative; - height: 18px; - width: .6em; - max-width: .6em; - `,[R3({duration:".2s"}),Hm({duration:".2s",delay:"0s"}),M("base-slot-machine-old-number",` - display: inline-block; - opacity: 0; - position: absolute; - left: 0; - right: 0; - `,[K("top",{transform:"translateY(-100%)"}),K("bottom",{transform:"translateY(100%)"}),K("down-scroll",{animation:"n-base-slot-machine-fade-down-out .2s cubic-bezier(0, 0, .2, 1)",animationIterationCount:1}),K("up-scroll",{animation:"n-base-slot-machine-fade-up-out .2s cubic-bezier(0, 0, .2, 1)",animationIterationCount:1})]),M("base-slot-machine-current-number",` - display: inline-block; - position: absolute; - left: 0; - top: 0; - bottom: 0; - right: 0; - opacity: 1; - transform: translateY(0); - width: .6em; - `,[K("down-scroll",{animation:"n-base-slot-machine-fade-down-in .2s cubic-bezier(0, 0, .2, 1)",animationIterationCount:1}),K("up-scroll",{animation:"n-base-slot-machine-fade-up-in .2s cubic-bezier(0, 0, .2, 1)",animationIterationCount:1}),F("inner",` - display: inline-block; - position: absolute; - right: 0; - top: 0; - width: .6em; - `,[K("not-number",` - right: unset; - left: 0; - `)])])])])]),A3=oe({name:"BaseSlotMachine",props:{clsPrefix:{type:String,required:!0},value:{type:[Number,String],default:0},max:{type:Number,default:void 0},appeared:{type:Boolean,required:!0}},setup(e){Jr("-base-slot-machine",z3,Oe(e,"clsPrefix"));const t=W(),r=W(),o=L(()=>{if(typeof e.value=="string")return[];if(e.value<1)return[0];const n=[];let i=e.value;for(e.max!==void 0&&(i=Math.min(e.max,i));i>=1;)n.push(i%10),i/=10,i=Math.floor(i);return n.reverse(),n});return qe(Oe(e,"value"),(n,i)=>{typeof n=="string"?(r.value=void 0,t.value=void 0):typeof i=="string"?(r.value=n,t.value=void 0):(r.value=n,t.value=i)}),()=>{const{value:n,clsPrefix:i}=e;return typeof n=="number"?m("span",{class:`${i}-base-slot-machine`},m(rc,{name:"fade-up-width-expand-transition",tag:"span"},{default:()=>o.value.map((a,l)=>m(Qu,{clsPrefix:i,key:o.value.length-l-1,oldOriginalNumber:t.value,newOriginalNumber:r.value,value:a}))}),m(Ka,{key:"+",width:!0},{default:()=>e.max!==void 0&&e.max{const{borderRadius:t,railColor:r,primaryColor:o,primaryColorHover:n,primaryColorPressed:i,textColor2:a}=e;return Object.assign(Object.assign({},D3),{borderRadius:t,railColor:r,railColorActive:o,linkColor:ee(o,{alpha:.15}),linkTextColor:a,linkTextColorHover:n,linkTextColorPressed:i,linkTextColorActive:o})},H3={name:"Anchor",common:de,self:F3};var j3=H3,Nm={paddingTiny:"0 8px",paddingSmall:"0 10px",paddingMedium:"0 12px",paddingLarge:"0 14px",clearSize:"16px"};const N3={name:"Input",common:de,self(e){const{textColor2:t,textColor3:r,textColorDisabled:o,primaryColor:n,primaryColorHover:i,inputColor:a,inputColorDisabled:l,warningColor:s,warningColorHover:d,errorColor:c,errorColorHover:u,borderRadius:f,lineHeight:h,fontSizeTiny:p,fontSizeSmall:b,fontSizeMedium:g,fontSizeLarge:v,heightTiny:w,heightSmall:$,heightMedium:x,heightLarge:S,clearColor:E,clearColorHover:y,clearColorPressed:_,placeholderColor:R,placeholderColorDisabled:P,iconColor:j,iconColorDisabled:T,iconColorHover:N,iconColorPressed:B}=e;return Object.assign(Object.assign({},Nm),{countTextColor:r,heightTiny:w,heightSmall:$,heightMedium:x,heightLarge:S,fontSizeTiny:p,fontSizeSmall:b,fontSizeMedium:g,fontSizeLarge:v,lineHeight:h,lineHeightTextarea:h,borderRadius:f,iconSize:"16px",groupLabelColor:a,textColor:t,textColorDisabled:o,textDecorationColor:t,groupLabelTextColor:t,caretColor:n,placeholderColor:R,placeholderColorDisabled:P,color:a,colorDisabled:l,colorFocus:ee(n,{alpha:.1}),groupLabelBorder:"1px solid #0000",border:"1px solid #0000",borderHover:`1px solid ${i}`,borderDisabled:"1px solid #0000",borderFocus:`1px solid ${i}`,boxShadowFocus:`0 0 8px 0 ${ee(n,{alpha:.3})}`,loadingColor:n,loadingColorWarning:s,borderWarning:`1px solid ${s}`,borderHoverWarning:`1px solid ${d}`,colorFocusWarning:ee(s,{alpha:.1}),borderFocusWarning:`1px solid ${d}`,boxShadowFocusWarning:`0 0 8px 0 ${ee(s,{alpha:.3})}`,caretColorWarning:s,loadingColorError:c,borderError:`1px solid ${c}`,borderHoverError:`1px solid ${u}`,colorFocusError:ee(c,{alpha:.1}),borderFocusError:`1px solid ${u}`,boxShadowFocusError:`0 0 8px 0 ${ee(c,{alpha:.3})}`,caretColorError:c,clearColor:E,clearColorHover:y,clearColorPressed:_,iconColor:j,iconColorDisabled:T,iconColorHover:N,iconColorPressed:B,suffixTextColor:t})}};var ur=N3;const W3=e=>{const{textColor2:t,textColor3:r,textColorDisabled:o,primaryColor:n,primaryColorHover:i,inputColor:a,inputColorDisabled:l,borderColor:s,warningColor:d,warningColorHover:c,errorColor:u,errorColorHover:f,borderRadius:h,lineHeight:p,fontSizeTiny:b,fontSizeSmall:g,fontSizeMedium:v,fontSizeLarge:w,heightTiny:$,heightSmall:x,heightMedium:S,heightLarge:E,actionColor:y,clearColor:_,clearColorHover:R,clearColorPressed:P,placeholderColor:j,placeholderColorDisabled:T,iconColor:N,iconColorDisabled:B,iconColorHover:q,iconColorPressed:A}=e;return Object.assign(Object.assign({},Nm),{countTextColor:r,heightTiny:$,heightSmall:x,heightMedium:S,heightLarge:E,fontSizeTiny:b,fontSizeSmall:g,fontSizeMedium:v,fontSizeLarge:w,lineHeight:p,lineHeightTextarea:p,borderRadius:h,iconSize:"16px",groupLabelColor:y,groupLabelTextColor:t,textColor:t,textColorDisabled:o,textDecorationColor:t,caretColor:n,placeholderColor:j,placeholderColorDisabled:T,color:a,colorDisabled:l,colorFocus:a,groupLabelBorder:`1px solid ${s}`,border:`1px solid ${s}`,borderHover:`1px solid ${i}`,borderDisabled:`1px solid ${s}`,borderFocus:`1px solid ${i}`,boxShadowFocus:`0 0 0 2px ${ee(n,{alpha:.2})}`,loadingColor:n,loadingColorWarning:d,borderWarning:`1px solid ${d}`,borderHoverWarning:`1px solid ${c}`,colorFocusWarning:a,borderFocusWarning:`1px solid ${c}`,boxShadowFocusWarning:`0 0 0 2px ${ee(d,{alpha:.2})}`,caretColorWarning:d,loadingColorError:u,borderError:`1px solid ${u}`,borderHoverError:`1px solid ${f}`,colorFocusError:a,borderFocusError:`1px solid ${f}`,boxShadowFocusError:`0 0 0 2px ${ee(u,{alpha:.2})}`,caretColorError:u,clearColor:_,clearColorHover:R,clearColorPressed:P,iconColor:N,iconColorDisabled:B,iconColorHover:q,iconColorPressed:A,suffixTextColor:t})},V3={name:"Input",common:Ke,self:W3};var Wm=V3;const Vm="n-input";function K3(e){let t=0;for(const r of e)t++;return t}function Vi(e){return["",void 0,null].includes(e)}var ef=oe({name:"InputWordCount",setup(e,{slots:t}){const{mergedValueRef:r,maxlengthRef:o,mergedClsPrefixRef:n}=be(Vm),i=L(()=>{const{value:a}=r;return a===null||Array.isArray(a)?0:K3(a)});return()=>{const{value:a}=o,{value:l}=r;return m("span",{class:`${n.value}-input-word-count`},AC(t.default,{value:l===null||Array.isArray(l)?"":l},()=>[a===void 0?i.value:`${i.value} / ${a}`]))}}}),U3=M("input",` - max-width: 100%; - cursor: text; - line-height: 1.5; - z-index: auto; - outline: none; - box-sizing: border-box; - position: relative; - display: inline-flex; - border-radius: var(--n-border-radius); - background-color: var(--n-color); - transition: background-color .3s var(--n-bezier); - font-size: var(--n-font-size); - --n-padding-vertical: calc((var(--n-height) - 1.5 * var(--n-font-size)) / 2); -`,[F("input, textarea",` - overflow: hidden; - flex-grow: 1; - position: relative; - `),F("input-el, textarea-el, input-mirror, textarea-mirror, separator, placeholder",` - box-sizing: border-box; - font-size: inherit; - line-height: 1.5; - font-family: inherit; - border: none; - outline: none; - background-color: #0000; - text-align: inherit; - transition: - caret-color .3s var(--n-bezier), - color .3s var(--n-bezier), - text-decoration-color .3s var(--n-bezier); - `),F("input-el, textarea-el",` - -webkit-appearance: none; - scrollbar-width: none; - width: 100%; - min-width: 0; - text-decoration-color: var(--n-text-decoration-color); - color: var(--n-text-color); - caret-color: var(--n-caret-color); - background-color: transparent; - `,[z("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",` - width: 0; - height: 0; - display: none; - `),z("&::placeholder","color: #0000;"),z("&:-webkit-autofill ~",[F("placeholder","display: none;")])]),K("round",[ut("textarea","border-radius: calc(var(--n-height) / 2);")]),F("placeholder",` - pointer-events: none; - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - overflow: hidden; - color: var(--n-placeholder-color); - `,[z("span",` - width: 100%; - display: inline-block; - `)]),K("textarea",[F("placeholder","overflow: visible;")]),ut("autosize","width: 100%;"),K("autosize",[F("textarea-el, input-el",` - position: absolute; - top: 0; - left: 0; - height: 100%; - `)]),M("input-wrapper",` - overflow: hidden; - display: inline-flex; - flex-grow: 1; - position: relative; - padding-left: var(--n-padding-left); - padding-right: var(--n-padding-right); - `),F("input-mirror",` - padding: 0; - height: var(--n-height); - overflow: hidden; - visibility: hidden; - position: static; - white-space: nowrap; - pointer-events: none; - `),F("input-el",` - padding: 0; - height: var(--n-height); - line-height: var(--n-height); - `,[z("+",[F("placeholder",` - display: flex; - align-items: center; - `)])]),ut("textarea",[F("placeholder","white-space: nowrap;")]),F("eye",` - transition: color .3s var(--n-bezier); - `),K("textarea","width: 100%;",[M("input-word-count",` - position: absolute; - right: var(--n-padding-right); - bottom: var(--n-padding-vertical); - `),K("resizable",[M("input-wrapper",` - resize: vertical; - min-height: var(--n-height); - `)]),F("textarea",` - position: static; - `),F("textarea-el, textarea-mirror, placeholder",` - height: 100%; - left: var(--n-padding-left); - right: var(--n-padding-right); - padding-left: 0; - padding-right: 0; - padding-top: var(--n-padding-vertical); - padding-bottom: var(--n-padding-vertical); - word-break: break-word; - display: inline-block; - vertical-align: bottom; - box-sizing: border-box; - line-height: var(--n-line-height-textarea); - margin: 0; - resize: none; - white-space: pre-wrap; - `),F("textarea-mirror",` - width: 100%; - pointer-events: none; - overflow: hidden; - visibility: hidden; - position: static; - white-space: pre-wrap; - overflow-wrap: break-word; - `)]),K("pair",[F("input-el, placeholder","text-align: center;"),F("separator",` - display: flex; - align-items: center; - transition: color .3s var(--n-bezier); - color: var(--n-text-color); - `,[M("icon",` - color: var(--n-icon-color); - `),M("base-icon",` - color: var(--n-icon-color); - `)])]),K("disabled",` - cursor: not-allowed; - background-color: var(--n-color-disabled); - `,[F("border","border: var(--n-border-disabled);"),F("input-el, textarea-el",` - cursor: not-allowed; - color: var(--n-text-color-disabled); - text-decoration-color: var(--n-text-color-disabled); - `),F("placeholder","color: var(--n-placeholder-color-disabled);"),F("separator","color: var(--n-text-color-disabled);",[M("icon",` - color: var(--n-icon-color-disabled); - `),M("base-icon",` - color: var(--n-icon-color-disabled); - `)]),F("suffix, prefix","color: var(--n-text-color-disabled);",[M("icon",` - color: var(--n-icon-color-disabled); - `),M("internal-icon",` - color: var(--n-icon-color-disabled); - `)])]),ut("disabled",[F("eye",` - display: flex; - align-items: center; - justify-content: center; - color: var(--n-icon-color); - cursor: pointer; - `,[z("&:hover",` - color: var(--n-icon-color-hover); - `),z("&:active",` - color: var(--n-icon-color-pressed); - `),M("icon",[z("&:hover",` - color: var(--n-icon-color-hover); - `),z("&:active",` - color: var(--n-icon-color-pressed); - `)])]),z("&:hover",[F("state-border","border: var(--n-border-hover);")]),K("focus","background-color: var(--n-color-focus);",[F("state-border",` - border: var(--n-border-focus); - box-shadow: var(--n-box-shadow-focus); - `)])]),F("border, state-border",` - box-sizing: border-box; - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - pointer-events: none; - border-radius: inherit; - border: var(--n-border); - transition: - box-shadow .3s var(--n-bezier), - border-color .3s var(--n-bezier); - `),F("state-border",` - border-color: #0000; - z-index: 1; - `),F("prefix","margin-right: 4px;"),F("suffix",` - margin-left: 4px; - `),F("suffix, prefix",` - transition: color .3s var(--n-bezier); - flex-wrap: nowrap; - flex-shrink: 0; - line-height: var(--n-height); - white-space: nowrap; - display: inline-flex; - align-items: center; - justify-content: center; - color: var(--n-suffix-text-color); - `,[M("base-loading",` - font-size: var(--n-icon-size); - margin: 0 2px; - color: var(--n-loading-color); - `),M("base-clear",` - font-size: var(--n-icon-size); - `,[F("placeholder",[M("base-icon",` - transition: color .3s var(--n-bezier); - color: var(--n-icon-color); - font-size: var(--n-icon-size); - `)])]),M("icon",` - transition: color .3s var(--n-bezier); - color: var(--n-icon-color); - font-size: var(--n-icon-size); - `),M("base-icon",` - font-size: var(--n-icon-size); - `)]),M("input-word-count",` - pointer-events: none; - line-height: 1.5; - font-size: .85em; - color: var(--n-count-text-color); - transition: color .3s var(--n-bezier); - margin-left: 4px; - font-variant: tabular-nums; - `),["warning","error"].map(e=>K(`${e}-status`,[ut("disabled",[M("base-loading",` - color: var(--n-loading-color-${e}) - `),F("input-el, textarea-el",` - caret-color: var(--n-caret-color-${e}); - `),F("state-border",` - border: var(--n-border-${e}); - `),z("&:hover",[F("state-border",` - border: var(--n-border-hover-${e}); - `)]),z("&:focus",` - background-color: var(--n-color-focus-${e}); - `,[F("state-border",` - box-shadow: var(--n-box-shadow-focus-${e}); - border: var(--n-border-focus-${e}); - `)]),K("focus",` - background-color: var(--n-color-focus-${e}); - `,[F("state-border",` - box-shadow: var(--n-box-shadow-focus-${e}); - border: var(--n-border-focus-${e}); - `)])])]))]);const q3=Object.assign(Object.assign({},ze.props),{bordered:{type:Boolean,default:void 0},type:{type:String,default:"text"},placeholder:[Array,String],defaultValue:{type:[String,Array],default:null},value:[String,Array],disabled:{type:Boolean,default:void 0},size:String,rows:{type:[Number,String],default:3},round:Boolean,minlength:[String,Number],maxlength:[String,Number],clearable:Boolean,autosize:{type:[Boolean,Object],default:!1},pair:Boolean,separator:String,readonly:{type:[String,Boolean],default:!1},passivelyActivated:Boolean,showPasswordOn:String,stateful:{type:Boolean,default:!0},autofocus:Boolean,inputProps:Object,resizable:{type:Boolean,default:!0},showCount:Boolean,loading:{type:Boolean,default:void 0},onMousedown:Function,onKeydown:Function,onKeyup:Function,onInput:[Function,Array],onFocus:[Function,Array],onBlur:[Function,Array],onClick:[Function,Array],onChange:[Function,Array],onClear:[Function,Array],status:String,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],textDecoration:[String,Array],attrSize:{type:Number,default:20},onInputBlur:[Function,Array],onInputFocus:[Function,Array],onDeactivate:[Function,Array],onActivate:[Function,Array],onWrapperFocus:[Function,Array],onWrapperBlur:[Function,Array],internalDeactivateOnEnter:Boolean,internalForceFocus:Boolean,internalLoadingBeforeSuffix:Boolean,showPasswordToggle:Boolean});var Km=oe({name:"Input",props:q3,setup(e){const{mergedClsPrefixRef:t,mergedBorderedRef:r,inlineThemeDisabled:o,mergedRtlRef:n}=lt(e),i=ze("Input","-input",U3,Wm,e,t),a=W(null),l=W(null),s=W(null),d=W(null),c=W(null),u=W(null),f=W(null),{localeRef:h}=em("Input"),p=W(e.defaultValue),b=Oe(e,"value"),g=hn(b,p),v=wp(e),{mergedSizeRef:w,mergedDisabledRef:$,mergedStatusRef:x}=v,S=W(!1),E=W(!1),y=W(!1),_=W(!1);let R=null;const P=L(()=>{const{placeholder:I,pair:ie}=e;return ie?Array.isArray(I)?I:I===void 0?["",""]:[I,I]:I===void 0?[h.value.placeholder]:[I]}),j=L(()=>{const{value:I}=y,{value:ie}=g,{value:Te}=P;return!I&&(Vi(ie)||Array.isArray(ie)&&Vi(ie[0]))&&Te[0]}),T=L(()=>{const{value:I}=y,{value:ie}=g,{value:Te}=P;return!I&&Te[1]&&(Vi(ie)||Array.isArray(ie)&&Vi(ie[1]))}),N=ht(()=>e.internalForceFocus||S.value),B=ht(()=>{if($.value||e.readonly||!e.clearable||!N.value&&!E.value)return!1;const{value:I}=g,{value:ie}=N;return e.pair?!!(Array.isArray(I)&&(I[0]||I[1]))&&(E.value||ie):!!I&&(E.value||ie)}),q=L(()=>{const{showPasswordOn:I}=e;if(I)return I;if(e.showPasswordToggle)return"click"}),A=W(!1),te=L(()=>{const{textDecoration:I}=e;return I?Array.isArray(I)?I.map(ie=>({textDecoration:ie})):[{textDecoration:I}]:["",""]}),se=W(void 0),_e=()=>{var I,ie;if(e.type==="textarea"){const{autosize:Te}=e;if(Te&&(se.value=(ie=(I=f.value)===null||I===void 0?void 0:I.$el)===null||ie===void 0?void 0:ie.offsetWidth),!l.value||typeof Te=="boolean")return;const{paddingTop:mt,paddingBottom:vt,lineHeight:$t}=window.getComputedStyle(l.value),eo=Number(mt.slice(0,-2)),to=Number(vt.slice(0,-2)),ro=Number($t.slice(0,-2)),{value:kn}=s;if(!kn)return;if(Te.minRows){const Tn=Math.max(Te.minRows,1),nl=`${eo+to+ro*Tn}px`;kn.style.minHeight=nl}if(Te.maxRows){const Tn=`${eo+to+ro*Te.maxRows}px`;kn.style.maxHeight=Tn}}},Ae=L(()=>{const{maxlength:I}=e;return I===void 0?void 0:Number(I)});Ot(()=>{const{value:I}=g;Array.isArray(I)||Qe(I)});const Re=Zr().proxy;function Ee(I){const{onUpdateValue:ie,"onUpdate:value":Te,onInput:mt}=e,{nTriggerFormInput:vt}=v;ie&&Be(ie,I),Te&&Be(Te,I),mt&&Be(mt,I),p.value=I,vt()}function $e(I){const{onChange:ie}=e,{nTriggerFormChange:Te}=v;ie&&Be(ie,I),p.value=I,Te()}function it(I){const{onBlur:ie}=e,{nTriggerFormBlur:Te}=v;ie&&Be(ie,I),Te()}function O(I){const{onFocus:ie}=e,{nTriggerFormFocus:Te}=v;ie&&Be(ie,I),Te()}function V(I){const{onClear:ie}=e;ie&&Be(ie,I)}function D(I){const{onInputBlur:ie}=e;ie&&Be(ie,I)}function ce(I){const{onInputFocus:ie}=e;ie&&Be(ie,I)}function ue(){const{onDeactivate:I}=e;I&&Be(I)}function xe(){const{onActivate:I}=e;I&&Be(I)}function G(I){const{onClick:ie}=e;ie&&Be(ie,I)}function Z(I){const{onWrapperFocus:ie}=e;ie&&Be(ie,I)}function C(I){const{onWrapperBlur:ie}=e;ie&&Be(ie,I)}function k(){y.value=!0}function H(I){y.value=!1,I.target===u.value?U(I,1):U(I,0)}function U(I,ie=0,Te="input"){const mt=I.target.value;if(Qe(mt),e.type==="textarea"){const{value:$t}=f;$t&&$t.syncUnifiedContainer()}if(R=mt,y.value)return;const vt=mt;if(!e.pair)Te==="input"?Ee(vt):$e(vt);else{let{value:$t}=g;Array.isArray($t)?$t=[...$t]:$t=["",""],$t[ie]=vt,Te==="input"?Ee($t):$e($t)}Re.$forceUpdate()}function X(I){D(I),I.relatedTarget===a.value&&ue(),I.relatedTarget!==null&&(I.relatedTarget===c.value||I.relatedTarget===u.value||I.relatedTarget===l.value)||(_.value=!1),J(I,"blur")}function ne(I){ce(I),S.value=!0,_.value=!0,xe(),J(I,"focus")}function le(I){e.passivelyActivated&&(C(I),J(I,"blur"))}function Y(I){e.passivelyActivated&&(S.value=!0,Z(I),J(I,"focus"))}function J(I,ie){I.relatedTarget!==null&&(I.relatedTarget===c.value||I.relatedTarget===u.value||I.relatedTarget===l.value||I.relatedTarget===a.value)||(ie==="focus"?(O(I),S.value=!0):ie==="blur"&&(it(I),S.value=!1))}function Q(I,ie){U(I,ie,"change")}function ve(I){G(I)}function pe(I){V(I),e.pair?(Ee(["",""]),$e(["",""])):(Ee(""),$e(""))}function me(I){const{onMousedown:ie}=e;ie&&ie(I);const{tagName:Te}=I.target;if(Te!=="INPUT"&&Te!=="TEXTAREA"){if(e.resizable){const{value:mt}=a;if(mt){const{left:vt,top:$t,width:eo,height:to}=mt.getBoundingClientRect(),ro=14;if(vt+eo-ro{mt.preventDefault(),Ze("mouseup",document,ie)};if(nt("mouseup",document,ie),q.value!=="mousedown")return;A.value=!0;const Te=()=>{A.value=!1,Ze("mouseup",document,Te)};nt("mouseup",document,Te)}function Je(I){var ie;switch((ie=e.onKeydown)===null||ie===void 0||ie.call(e,I),I.code){case"Escape":he();break;case"Enter":case"NumpadEnter":re(I);break}}function re(I){var ie,Te;if(e.passivelyActivated){const{value:mt}=_;if(mt){e.internalDeactivateOnEnter&&he();return}I.preventDefault(),e.type==="textarea"?(ie=l.value)===null||ie===void 0||ie.focus():(Te=c.value)===null||Te===void 0||Te.focus()}}function he(){e.passivelyActivated&&(_.value=!1,br(()=>{var I;(I=a.value)===null||I===void 0||I.focus()}))}function Se(){var I,ie,Te;$.value||(e.passivelyActivated?(I=a.value)===null||I===void 0||I.focus():((ie=l.value)===null||ie===void 0||ie.focus(),(Te=c.value)===null||Te===void 0||Te.focus()))}function Ne(){var I;!((I=a.value)===null||I===void 0)&&I.contains(document.activeElement)&&document.activeElement.blur()}function rt(){var I,ie;(I=l.value)===null||I===void 0||I.select(),(ie=c.value)===null||ie===void 0||ie.select()}function Ue(){$.value||(l.value?l.value.focus():c.value&&c.value.focus())}function dt(){const{value:I}=a;(I==null?void 0:I.contains(document.activeElement))&&I!==document.activeElement&&he()}function Qe(I){const{type:ie,pair:Te,autosize:mt}=e;if(!Te&&mt)if(ie==="textarea"){const{value:vt}=s;vt&&(vt.textContent=(I!=null?I:"")+`\r -`)}else{const{value:vt}=d;vt&&(I?vt.textContent=I:vt.innerHTML=" ")}}function or(){_e()}const Ar=W({top:"0"});function xg(I){var ie;const{scrollTop:Te}=I.target;Ar.value.top=`${-Te}px`,(ie=f.value)===null||ie===void 0||ie.syncUnifiedContainer()}let Ri=null;xr(()=>{const{autosize:I,type:ie}=e;I&&ie==="textarea"?Ri=qe(g,Te=>{!Array.isArray(Te)&&Te!==R&&Qe(Te)}):Ri==null||Ri()});let zi=null;xr(()=>{e.type==="textarea"?zi=qe(g,I=>{var ie;!Array.isArray(I)&&I!==R&&((ie=f.value)===null||ie===void 0||ie.syncUnifiedContainer())}):zi==null||zi()}),je(Vm,{mergedValueRef:g,maxlengthRef:Ae,mergedClsPrefixRef:t});const Cg={wrapperElRef:a,inputElRef:c,textareaElRef:l,isCompositing:y,focus:Se,blur:Ne,select:rt,deactivate:dt,activate:Ue},yg=Pn("Input",n,t),td=L(()=>{const{value:I}=w,{common:{cubicBezierEaseInOut:ie},self:{color:Te,borderRadius:mt,textColor:vt,caretColor:$t,caretColorError:eo,caretColorWarning:to,textDecorationColor:ro,border:kn,borderDisabled:Tn,borderHover:nl,borderFocus:wg,placeholderColor:Sg,placeholderColorDisabled:_g,lineHeightTextarea:$g,colorDisabled:Pg,colorFocus:kg,textColorDisabled:Tg,boxShadowFocus:Eg,iconSize:Rg,colorFocusWarning:zg,boxShadowFocusWarning:Ag,borderWarning:Og,borderFocusWarning:Ig,borderHoverWarning:Mg,colorFocusError:Bg,boxShadowFocusError:Lg,borderError:Dg,borderFocusError:Fg,borderHoverError:Hg,clearSize:jg,clearColor:Ng,clearColorHover:Wg,clearColorPressed:Vg,iconColor:Kg,iconColorDisabled:Ug,suffixTextColor:qg,countTextColor:Gg,iconColorHover:Yg,iconColorPressed:Xg,loadingColor:Zg,loadingColorError:Jg,loadingColorWarning:Qg,[ae("padding",I)]:eb,[ae("fontSize",I)]:tb,[ae("height",I)]:rb}}=i.value,{left:ob,right:nb}=ap(eb);return{"--n-bezier":ie,"--n-count-text-color":Gg,"--n-color":Te,"--n-font-size":tb,"--n-border-radius":mt,"--n-height":rb,"--n-padding-left":ob,"--n-padding-right":nb,"--n-text-color":vt,"--n-caret-color":$t,"--n-text-decoration-color":ro,"--n-border":kn,"--n-border-disabled":Tn,"--n-border-hover":nl,"--n-border-focus":wg,"--n-placeholder-color":Sg,"--n-placeholder-color-disabled":_g,"--n-icon-size":Rg,"--n-line-height-textarea":$g,"--n-color-disabled":Pg,"--n-color-focus":kg,"--n-text-color-disabled":Tg,"--n-box-shadow-focus":Eg,"--n-loading-color":Zg,"--n-caret-color-warning":to,"--n-color-focus-warning":zg,"--n-box-shadow-focus-warning":Ag,"--n-border-warning":Og,"--n-border-focus-warning":Ig,"--n-border-hover-warning":Mg,"--n-loading-color-warning":Qg,"--n-caret-color-error":eo,"--n-color-focus-error":Bg,"--n-box-shadow-focus-error":Lg,"--n-border-error":Dg,"--n-border-focus-error":Fg,"--n-border-hover-error":Hg,"--n-loading-color-error":Jg,"--n-clear-color":Ng,"--n-clear-size":jg,"--n-clear-color-hover":Wg,"--n-clear-color-pressed":Vg,"--n-icon-color":Kg,"--n-icon-color-hover":Yg,"--n-icon-color-pressed":Xg,"--n-icon-color-disabled":Ug,"--n-suffix-text-color":qg}}),Ao=o?_t("input",L(()=>{const{value:I}=w;return I[0]}),td,e):void 0;return Object.assign(Object.assign({},Cg),{wrapperElRef:a,inputElRef:c,inputMirrorElRef:d,inputEl2Ref:u,textareaElRef:l,textareaMirrorElRef:s,textareaScrollbarInstRef:f,rtlEnabled:yg,uncontrolledValue:p,mergedValue:g,passwordVisible:A,mergedPlaceholder:P,showPlaceholder1:j,showPlaceholder2:T,mergedFocus:N,isComposing:y,activated:_,showClearButton:B,mergedSize:w,mergedDisabled:$,textDecorationStyle:te,mergedClsPrefix:t,mergedBordered:r,mergedShowPasswordOn:q,placeholderStyle:Ar,mergedStatus:x,textAreaScrollContainerWidth:se,handleTextAreaScroll:xg,handleCompositionStart:k,handleCompositionEnd:H,handleInput:U,handleInputBlur:X,handleInputFocus:ne,handleWrapperBlur:le,handleWrapperFocus:Y,handleMouseEnter:we,handleMouseLeave:De,handleMouseDown:me,handleChange:Q,handleClick:ve,handleClear:pe,handlePasswordToggleClick:Ye,handlePasswordToggleMousedown:Fe,handleWrapperKeyDown:Je,handleTextAreaMirrorResize:or,getTextareaScrollContainer:()=>l.value,mergedTheme:i,cssVars:o?void 0:td,themeClass:Ao==null?void 0:Ao.themeClass,onRender:Ao==null?void 0:Ao.onRender})},render(){const{mergedClsPrefix:e,mergedStatus:t,themeClass:r,onRender:o,$slots:n}=this;return o==null||o(),m("div",{ref:"wrapperElRef",class:[`${e}-input`,r,t&&`${e}-input--${t}-status`,{[`${e}-input--rtl`]:this.rtlEnabled,[`${e}-input--disabled`]:this.mergedDisabled,[`${e}-input--textarea`]:this.type==="textarea",[`${e}-input--resizable`]:this.resizable&&!this.autosize,[`${e}-input--autosize`]:this.autosize,[`${e}-input--round`]:this.round&&this.type!=="textarea",[`${e}-input--pair`]:this.pair,[`${e}-input--focus`]:this.mergedFocus,[`${e}-input--stateful`]:this.stateful}],style:this.cssVars,tabindex:!this.mergedDisabled&&this.passivelyActivated&&!this.activated?0:void 0,onFocus:this.handleWrapperFocus,onBlur:this.handleWrapperBlur,onClick:this.handleClick,onMousedown:this.handleMouseDown,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd,onKeyup:this.onKeyup,onKeydown:this.handleWrapperKeyDown},m("div",{class:`${e}-input-wrapper`},bt(n.prefix,i=>i&&m("div",{class:`${e}-input__prefix`},i)),this.type==="textarea"?m(Em,{ref:"textareaScrollbarInstRef",class:`${e}-input__textarea`,container:this.getTextareaScrollContainer,triggerDisplayManually:!0,useUnifiedContainer:!0},{default:()=>{const{textAreaScrollContainerWidth:i}=this,a={width:this.autosize&&i&&`${i}px`};return m(ot,null,m("textarea",Object.assign({},this.inputProps,{ref:"textareaElRef",class:`${e}-input__textarea-el`,autofocus:this.autofocus,rows:Number(this.rows),placeholder:this.placeholder,value:this.mergedValue,disabled:this.mergedDisabled,maxlength:this.maxlength,minlength:this.minlength,readonly:this.readonly,tabindex:this.passivelyActivated&&!this.activated?-1:void 0,style:[this.textDecorationStyle[0],a],onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,onInput:this.handleInput,onChange:this.handleChange,onScroll:this.handleTextAreaScroll})),this.showPlaceholder1?m("div",{class:`${e}-input__placeholder`,style:[this.placeholderStyle,a],key:"placeholder"},this.mergedPlaceholder[0]):null,this.autosize?m(vn,{onResize:this.handleTextAreaMirrorResize},{default:()=>m("div",{ref:"textareaMirrorElRef",class:`${e}-input__textarea-mirror`,key:"mirror"})}):null)}}):m("div",{class:`${e}-input__input`},m("input",Object.assign({type:this.type==="password"&&this.mergedShowPasswordOn&&this.passwordVisible?"text":this.type},this.inputProps,{ref:"inputElRef",class:`${e}-input__input-el`,style:this.textDecorationStyle[0],tabindex:this.passivelyActivated&&!this.activated?-1:void 0,placeholder:this.mergedPlaceholder[0],disabled:this.mergedDisabled,maxlength:this.maxlength,minlength:this.minlength,value:Array.isArray(this.mergedValue)?this.mergedValue[0]:this.mergedValue,readonly:this.readonly,autofocus:this.autofocus,size:this.attrSize,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,onInput:i=>this.handleInput(i,0),onChange:i=>this.handleChange(i,0)})),this.showPlaceholder1?m("div",{class:`${e}-input__placeholder`},m("span",null,this.mergedPlaceholder[0])):null,this.autosize?m("div",{class:`${e}-input__input-mirror`,key:"mirror",ref:"inputMirrorElRef"},"\xA0"):null),!this.pair&&bt(n.suffix,i=>i||this.clearable||this.showCount||this.mergedShowPasswordOn||this.loading!==void 0?m("div",{class:`${e}-input__suffix`},[bt(n.clear,a=>(this.clearable||a)&&m(ws,{clsPrefix:e,show:this.showClearButton,onClear:this.handleClear},{default:()=>a})),this.internalLoadingBeforeSuffix?null:i,this.loading!==void 0?m($3,{clsPrefix:e,loading:this.loading,showArrow:!1,showClear:!1,style:this.cssVars}):null,this.internalLoadingBeforeSuffix?i:null,this.showCount&&this.type!=="textarea"?m(ef,null,{default:a=>{var l;return(l=n.count)===null||l===void 0?void 0:l.call(n,a)}}):null,this.mergedShowPasswordOn&&this.type==="password"?m(Bt,{clsPrefix:e,class:`${e}-input__eye`,onMousedown:this.handlePasswordToggleMousedown,onClick:this.handlePasswordToggleClick},{default:()=>this.passwordVisible?_o(n["password-visible-icon"],()=>[m(y$,null)]):_o(n["password-invisible-icon"],()=>[m(w$,null)])}):null]):null)),this.pair?m("span",{class:`${e}-input__separator`},_o(n.separator,()=>[this.separator])):null,this.pair?m("div",{class:`${e}-input-wrapper`},m("div",{class:`${e}-input__input`},m("input",{ref:"inputEl2Ref",type:this.type,class:`${e}-input__input-el`,tabindex:this.passivelyActivated&&!this.activated?-1:void 0,placeholder:this.mergedPlaceholder[1],disabled:this.mergedDisabled,maxlength:this.maxlength,minlength:this.minlength,value:Array.isArray(this.mergedValue)?this.mergedValue[1]:void 0,readonly:this.readonly,style:this.textDecorationStyle[1],onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,onInput:i=>this.handleInput(i,1),onChange:i=>this.handleChange(i,1)}),this.showPlaceholder2?m("div",{class:`${e}-input__placeholder`},m("span",null,this.mergedPlaceholder[1])):null),bt(n.suffix,i=>(this.clearable||i)&&m("div",{class:`${e}-input__suffix`},[this.clearable&&m(ws,{clsPrefix:e,show:this.showClearButton,onClear:this.handleClear},{default:()=>{var a;return(a=n.clear)===null||a===void 0?void 0:a.call(n)}}),i]))):null,this.mergedBordered?m("div",{class:`${e}-input__border`}):null,this.mergedBordered?m("div",{class:`${e}-input__state-border`}):null,this.showCount&&this.type==="textarea"?m(ef,null,{default:i=>{var a;return(a=n.count)===null||a===void 0?void 0:a.call(n,i)}}):null)}});function G3(e){const{boxShadow2:t}=e;return{menuBoxShadow:t}}const Y3={name:"AutoComplete",common:de,peers:{InternalSelectMenu:Si,Input:ur},self:G3};var X3=Y3;const Z3="n-avatar-group",Um=e=>{const{borderRadius:t,avatarColor:r,cardColor:o,fontSize:n,heightTiny:i,heightSmall:a,heightMedium:l,heightLarge:s,heightHuge:d,modalColor:c,popoverColor:u}=e;return{borderRadius:t,fontSize:n,border:`2px solid ${o}`,heightTiny:i,heightSmall:a,heightMedium:l,heightLarge:s,heightHuge:d,color:ye(o,r),colorModal:ye(c,r),colorPopover:ye(u,r)}},J3={name:"Avatar",common:Ke,self:Um};var Q3=J3;const e6={name:"Avatar",common:de,self:Um};var qm=e6,t6=M("avatar",` - width: var(--n-merged-size); - height: var(--n-merged-size); - color: #FFF; - font-size: var(--n-font-size); - display: inline-flex; - position: relative; - overflow: hidden; - text-align: center; - border: var(--n-border); - border-radius: var(--n-border-radius); - --n-merged-color: var(--n-color); - background-color: var(--n-merged-color); - transition: - border-color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - color .3s var(--n-bezier); -`,[dc(z("&","--n-merged-color: var(--n-color-modal);")),pp(z("&","--n-merged-color: var(--n-color-popover);")),z("img",` - width: 100%; - height: 100%; - `),F("text",` - white-space: nowrap; - display: inline-block; - position: absolute; - left: 50%; - top: 50%; - `),M("icon",` - vertical-align: bottom; - font-size: calc(var(--n-merged-size) - 6px); - `),F("text","line-height: 1.25")]);const r6=Object.assign(Object.assign({},ze.props),{size:[String,Number],src:String,circle:{type:Boolean,default:void 0},objectFit:String,round:{type:Boolean,default:void 0},bordered:{type:Boolean,default:void 0},onError:Function,fallbackSrc:String,color:String});var o6=oe({name:"Avatar",props:r6,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:r}=lt(e),o=W(!1);let n=null;const i=W(null),a=W(null),l=()=>{const{value:v}=i;if(v&&(n===null||n!==v.innerHTML)){n=v.innerHTML;const{value:w}=a;if(w){const{offsetWidth:$,offsetHeight:x}=w,{offsetWidth:S,offsetHeight:E}=v,y=.9,_=Math.min($/S*y,x/E*y,1);v.style.transform=`translateX(-50%) translateY(-50%) scale(${_})`}}},s=be(Z3,null),d=L(()=>{const{size:v}=e;if(v)return v;const{size:w}=s||{};return w||"medium"}),c=ze("Avatar","-avatar",t6,Q3,e,t),u=be(Dm,null),f=L(()=>{if(s)return!0;const{round:v,circle:w}=e;return v!==void 0||w!==void 0?v||w:u?u.roundRef.value:!1}),h=L(()=>s?!0:e.bordered||!1),p=v=>{o.value=!0;const{onError:w}=e;w&&w(v)};qe(()=>e.src,()=>o.value=!1);const b=L(()=>{const v=d.value,w=f.value,$=h.value,{color:x}=e,{self:{borderRadius:S,fontSize:E,color:y,border:_,colorModal:R,colorPopover:P},common:{cubicBezierEaseInOut:j}}=c.value;let T;return typeof v=="number"?T=`${v}px`:T=c.value.self[ae("height",v)],{"--n-font-size":E,"--n-border":$?_:"none","--n-border-radius":w?"50%":S,"--n-color":x||y,"--n-color-modal":x||R,"--n-color-popover":x||P,"--n-bezier":j,"--n-merged-size":`var(--n-avatar-size-override, ${T})`}}),g=r?_t("avatar",L(()=>{const v=d.value,w=f.value,$=h.value,{color:x}=e;let S="";return v&&(typeof v=="number"?S+=`a${v}`:S+=v[0]),w&&(S+="b"),$&&(S+="c"),x&&(S+=un(x)),S}),b,e):void 0;return{textRef:i,selfRef:a,mergedRoundRef:f,mergedClsPrefix:t,fitTextTransform:l,cssVars:r?void 0:b,themeClass:g==null?void 0:g.themeClass,onRender:g==null?void 0:g.onRender,hasLoadError:o,handleError:p}},render(){const{$slots:e,src:t,mergedClsPrefix:r,onRender:o}=this;o==null||o();let n;return this.hasLoadError?n=m("img",{src:this.fallbackSrc,style:{objectFit:this.objectFit}}):n=bt(e.default,i=>{if(i)return m(vn,{onResize:this.fitTextTransform},{default:()=>m("span",{ref:"textRef",class:`${r}-avatar__text`},i)});if(t)return m("img",{src:t,onError:this.handleError,style:{objectFit:this.objectFit}})}),m("span",{ref:"selfRef",class:[`${r}-avatar`,this.themeClass],style:this.cssVars},n)}});const n6={name:"AvatarGroup",common:de,peers:{Avatar:qm}};var i6=n6,a6={width:"44px",height:"44px",borderRadius:"22px",iconSize:"26px"};const l6={name:"BackTop",common:de,self(e){const{popoverColor:t,textColor2:r,primaryColorHover:o,primaryColorPressed:n}=e;return Object.assign(Object.assign({},a6),{color:t,textColor:r,iconColor:r,iconColorHover:o,iconColorPressed:n,boxShadow:"0 2px 8px 0px rgba(0, 0, 0, .12)",boxShadowHover:"0 2px 12px 0px rgba(0, 0, 0, .18)",boxShadowPressed:"0 2px 12px 0px rgba(0, 0, 0, .18)"})}};var s6=l6;const c6={name:"Badge",common:de,self(e){const{errorColorSuppl:t,infoColorSuppl:r,successColorSuppl:o,warningColorSuppl:n,fontFamily:i}=e;return{color:t,colorInfo:r,colorSuccess:o,colorError:t,colorWarning:n,fontSize:"12px",fontFamily:i}}};var d6=c6;const u6=e=>{const{errorColor:t,infoColor:r,successColor:o,warningColor:n,fontFamily:i}=e;return{color:t,colorInfo:r,colorSuccess:o,colorError:t,colorWarning:n,fontSize:"12px",fontFamily:i}},f6={name:"Badge",common:Ke,self:u6};var h6=f6,p6=z([z("@keyframes badge-wave-spread",{from:{boxShadow:"0 0 0.5px 0px var(--n-ripple-color)",opacity:.6},to:{boxShadow:"0 0 0.5px 4.5px var(--n-ripple-color)",opacity:0}}),M("badge",` - display: inline-flex; - position: relative; - vertical-align: middle; - color: var(--n-color); - font-family: var(--n-font-family); - `,[K("as-is",[M("badge-sup",{position:"static",transform:"translateX(0)"},[vi({transformOrigin:"left bottom",originalTransform:"translateX(0)"})])]),K("dot",[M("badge-sup",` - height: 8px; - width: 8px; - padding: 0; - min-width: 8px; - left: 100%; - bottom: calc(100% - 4px); - `,[z("::before","border-radius: 4px;")])]),M("badge-sup",` - background: var(--n-color); - transition: - background-color .3s var(--n-bezier), - color .3s var(--n-bezier); - color: #FFF; - position: absolute; - height: 18px; - line-height: 18px; - border-radius: 9px; - padding: 0 6px; - text-align: center; - font-size: var(--n-font-size); - transform: translateX(-50%); - left: 100%; - bottom: calc(100% - 9px); - font-variant-numeric: tabular-nums; - z-index: 1; - display: flex; - align-items: center; - `,[vi({transformOrigin:"left bottom",originalTransform:"translateX(-50%)"}),M("base-wave",{zIndex:1,animationDuration:"2s",animationIterationCount:"infinite",animationDelay:"1s",animationTimingFunction:"var(--n-ripple-bezier)",animationName:"badge-wave-spread"}),z("&::before",` - opacity: 0; - transform: scale(1); - border-radius: 9px; - content: ""; - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - `)])])]);const m6=Object.assign(Object.assign({},ze.props),{value:[String,Number],max:Number,dot:Boolean,type:{type:String,default:"default"},show:{type:Boolean,default:!0},showZero:Boolean,processing:Boolean,color:String});var v6=oe({name:"Badge",props:m6,setup(e,{slots:t}){const{mergedClsPrefixRef:r,inlineThemeDisabled:o,mergedRtlRef:n}=lt(e),i=ze("Badge","-badge",p6,h6,e,r),a=W(!1),l=()=>{a.value=!0},s=()=>{a.value=!1},d=L(()=>e.show&&(e.dot||e.value!==void 0&&!(!e.showZero&&e.value<=0)||!cc(t.value)));Ot(()=>{d.value&&(a.value=!0)});const c=Pn("Badge",n,r),u=L(()=>{const{type:h,color:p}=e,{common:{cubicBezierEaseInOut:b,cubicBezierEaseOut:g},self:{[ae("color",h)]:v,fontFamily:w,fontSize:$}}=i.value;return{"--n-font-size":$,"--n-font-family":w,"--n-color":p||v,"--n-ripple-color":p||v,"--n-bezier":b,"--n-ripple-bezier":g}}),f=o?_t("badge",L(()=>{let h="";const{type:p,color:b}=e;return p&&(h+=p[0]),b&&(h+=un(b)),h}),u,e):void 0;return{rtlEnabled:c,mergedClsPrefix:r,appeared:a,showBadge:d,handleAfterEnter:l,handleAfterLeave:s,cssVars:o?void 0:u,themeClass:f==null?void 0:f.themeClass,onRender:f==null?void 0:f.onRender}},render(){var e;const{mergedClsPrefix:t,onRender:r,themeClass:o,$slots:n}=this;r==null||r();const i=(e=n.default)===null||e===void 0?void 0:e.call(n);return m("div",{class:[`${t}-badge`,this.rtlEnabled&&`${t}-badge--rtl`,o,{[`${t}-badge--dot`]:this.dot,[`${t}-badge--as-is`]:!i}],style:this.cssVars},i,m(At,{name:"fade-in-scale-up-transition",onAfterEnter:this.handleAfterEnter,onAfterLeave:this.handleAfterLeave},{default:()=>this.showBadge?m("sup",{class:`${t}-badge-sup`,title:RC(this.value)},_o(n.value,()=>[this.dot?null:m(A3,{clsPrefix:t,appeared:this.appeared,max:this.max,value:this.value})]),this.processing?m(zm,{clsPrefix:t}):null):null}))}}),g6={fontWeightActive:"400"};const b6=e=>{const{fontSize:t,textColor3:r,primaryColorHover:o,primaryColorPressed:n,textColor2:i}=e;return Object.assign(Object.assign({},g6),{fontSize:t,itemTextColor:r,itemTextColorHover:o,itemTextColorPressed:n,itemTextColorActive:i,separatorColor:r})},x6={name:"Breadcrumb",common:de,self:b6};var C6=x6;function ao(e){return ye(e,[255,255,255,.16])}function Ki(e){return ye(e,[0,0,0,.12])}var y6={paddingTiny:"0 6px",paddingSmall:"0 10px",paddingMedium:"0 14px",paddingLarge:"0 18px",paddingRoundTiny:"0 10px",paddingRoundSmall:"0 14px",paddingRoundMedium:"0 18px",paddingRoundLarge:"0 22px",iconMarginTiny:"6px",iconMarginSmall:"6px",iconMarginMedium:"6px",iconMarginLarge:"6px",iconSizeTiny:"14px",iconSizeSmall:"18px",iconSizeMedium:"18px",iconSizeLarge:"20px",rippleDuration:".6s"};const Gm=e=>{const{heightTiny:t,heightSmall:r,heightMedium:o,heightLarge:n,borderRadius:i,fontSizeTiny:a,fontSizeSmall:l,fontSizeMedium:s,fontSizeLarge:d,opacityDisabled:c,textColor2:u,textColor3:f,primaryColorHover:h,primaryColorPressed:p,borderColor:b,primaryColor:g,baseColor:v,infoColor:w,infoColorHover:$,infoColorPressed:x,successColor:S,successColorHover:E,successColorPressed:y,warningColor:_,warningColorHover:R,warningColorPressed:P,errorColor:j,errorColorHover:T,errorColorPressed:N,fontWeight:B,buttonColor2:q,buttonColor2Hover:A,buttonColor2Pressed:te,fontWeightStrong:se}=e;return Object.assign(Object.assign({},y6),{heightTiny:t,heightSmall:r,heightMedium:o,heightLarge:n,borderRadiusTiny:i,borderRadiusSmall:i,borderRadiusMedium:i,borderRadiusLarge:i,fontSizeTiny:a,fontSizeSmall:l,fontSizeMedium:s,fontSizeLarge:d,opacityDisabled:c,colorOpacitySecondary:"0.16",colorOpacitySecondaryHover:"0.22",colorOpacitySecondaryPressed:"0.28",colorSecondary:q,colorSecondaryHover:A,colorSecondaryPressed:te,colorTertiary:q,colorTertiaryHover:A,colorTertiaryPressed:te,colorQuaternary:"#0000",colorQuaternaryHover:A,colorQuaternaryPressed:te,color:"#0000",colorHover:"#0000",colorPressed:"#0000",colorFocus:"#0000",colorDisabled:"#0000",textColor:u,textColorTertiary:f,textColorHover:h,textColorPressed:p,textColorFocus:h,textColorDisabled:u,textColorText:u,textColorTextHover:h,textColorTextPressed:p,textColorTextFocus:h,textColorTextDisabled:u,textColorGhost:u,textColorGhostHover:h,textColorGhostPressed:p,textColorGhostFocus:h,textColorGhostDisabled:u,border:`1px solid ${b}`,borderHover:`1px solid ${h}`,borderPressed:`1px solid ${p}`,borderFocus:`1px solid ${h}`,borderDisabled:`1px solid ${b}`,rippleColor:g,colorPrimary:g,colorHoverPrimary:h,colorPressedPrimary:p,colorFocusPrimary:h,colorDisabledPrimary:g,textColorPrimary:v,textColorHoverPrimary:v,textColorPressedPrimary:v,textColorFocusPrimary:v,textColorDisabledPrimary:v,textColorTextPrimary:g,textColorTextHoverPrimary:h,textColorTextPressedPrimary:p,textColorTextFocusPrimary:h,textColorTextDisabledPrimary:u,textColorGhostPrimary:g,textColorGhostHoverPrimary:h,textColorGhostPressedPrimary:p,textColorGhostFocusPrimary:h,textColorGhostDisabledPrimary:g,borderPrimary:`1px solid ${g}`,borderHoverPrimary:`1px solid ${h}`,borderPressedPrimary:`1px solid ${p}`,borderFocusPrimary:`1px solid ${h}`,borderDisabledPrimary:`1px solid ${g}`,rippleColorPrimary:g,colorInfo:w,colorHoverInfo:$,colorPressedInfo:x,colorFocusInfo:$,colorDisabledInfo:w,textColorInfo:v,textColorHoverInfo:v,textColorPressedInfo:v,textColorFocusInfo:v,textColorDisabledInfo:v,textColorTextInfo:w,textColorTextHoverInfo:$,textColorTextPressedInfo:x,textColorTextFocusInfo:$,textColorTextDisabledInfo:u,textColorGhostInfo:w,textColorGhostHoverInfo:$,textColorGhostPressedInfo:x,textColorGhostFocusInfo:$,textColorGhostDisabledInfo:w,borderInfo:`1px solid ${w}`,borderHoverInfo:`1px solid ${$}`,borderPressedInfo:`1px solid ${x}`,borderFocusInfo:`1px solid ${$}`,borderDisabledInfo:`1px solid ${w}`,rippleColorInfo:w,colorSuccess:S,colorHoverSuccess:E,colorPressedSuccess:y,colorFocusSuccess:E,colorDisabledSuccess:S,textColorSuccess:v,textColorHoverSuccess:v,textColorPressedSuccess:v,textColorFocusSuccess:v,textColorDisabledSuccess:v,textColorTextSuccess:S,textColorTextHoverSuccess:E,textColorTextPressedSuccess:y,textColorTextFocusSuccess:E,textColorTextDisabledSuccess:u,textColorGhostSuccess:S,textColorGhostHoverSuccess:E,textColorGhostPressedSuccess:y,textColorGhostFocusSuccess:E,textColorGhostDisabledSuccess:S,borderSuccess:`1px solid ${S}`,borderHoverSuccess:`1px solid ${E}`,borderPressedSuccess:`1px solid ${y}`,borderFocusSuccess:`1px solid ${E}`,borderDisabledSuccess:`1px solid ${S}`,rippleColorSuccess:S,colorWarning:_,colorHoverWarning:R,colorPressedWarning:P,colorFocusWarning:R,colorDisabledWarning:_,textColorWarning:v,textColorHoverWarning:v,textColorPressedWarning:v,textColorFocusWarning:v,textColorDisabledWarning:v,textColorTextWarning:_,textColorTextHoverWarning:R,textColorTextPressedWarning:P,textColorTextFocusWarning:R,textColorTextDisabledWarning:u,textColorGhostWarning:_,textColorGhostHoverWarning:R,textColorGhostPressedWarning:P,textColorGhostFocusWarning:R,textColorGhostDisabledWarning:_,borderWarning:`1px solid ${_}`,borderHoverWarning:`1px solid ${R}`,borderPressedWarning:`1px solid ${P}`,borderFocusWarning:`1px solid ${R}`,borderDisabledWarning:`1px solid ${_}`,rippleColorWarning:_,colorError:j,colorHoverError:T,colorPressedError:N,colorFocusError:T,colorDisabledError:j,textColorError:v,textColorHoverError:v,textColorPressedError:v,textColorFocusError:v,textColorDisabledError:v,textColorTextError:j,textColorTextHoverError:T,textColorTextPressedError:N,textColorTextFocusError:T,textColorTextDisabledError:u,textColorGhostError:j,textColorGhostHoverError:T,textColorGhostPressedError:N,textColorGhostFocusError:T,textColorGhostDisabledError:j,borderError:`1px solid ${j}`,borderHoverError:`1px solid ${T}`,borderPressedError:`1px solid ${N}`,borderFocusError:`1px solid ${T}`,borderDisabledError:`1px solid ${j}`,rippleColorError:j,waveOpacity:"0.6",fontWeight:B,fontWeightStrong:se})},w6={name:"Button",common:Ke,self:Gm};var Xa=w6;const S6={name:"Button",common:de,self(e){const t=Gm(e);return t.waveOpacity="0.8",t.colorOpacitySecondary="0.16",t.colorOpacitySecondaryHover="0.2",t.colorOpacitySecondaryPressed="0.12",t}};var qt=S6;const ct="0!important",Ym="-1px!important";function Ho(e){return K(e+"-type",[z("& +",[M("button",{},[K(e+"-type",[F("border",{borderLeftWidth:ct}),F("state-border",{left:Ym})])])])])}function jo(e){return K(e+"-type",[z("& +",[M("button",[K(e+"-type",[F("border",{borderTopWidth:ct}),F("state-border",{top:Ym})])])])])}var _6=M("button-group",` - flex-wrap: nowrap; - display: inline-flex; - position: relative; -`,[ut("vertical",{flexDirection:"row"},[M("button",[z("&:first-child:not(:last-child)",` - margin-right: ${ct}; - border-top-right-radius: ${ct}; - border-bottom-right-radius: ${ct}; - `),z("&:last-child:not(:first-child)",` - margin-left: ${ct}; - border-top-left-radius: ${ct}; - border-bottom-left-radius: ${ct}; - `),z("&:not(:first-child):not(:last-child)",` - margin-left: ${ct}; - margin-right: ${ct}; - border-radius: ${ct}; - `),Ho("default"),K("ghost",[Ho("primary"),Ho("info"),Ho("success"),Ho("warning"),Ho("error")])])]),K("vertical",{flexDirection:"column"},[M("button",[z("&:first-child:not(:last-child)",` - margin-bottom: ${ct}; - margin-left: ${ct}; - margin-right: ${ct}; - border-bottom-left-radius: ${ct}; - border-bottom-right-radius: ${ct}; - `),z("&:last-child:not(:first-child)",` - margin-top: ${ct}; - margin-left: ${ct}; - margin-right: ${ct}; - border-top-left-radius: ${ct}; - border-top-right-radius: ${ct}; - `),z("&:not(:first-child):not(:last-child)",` - margin: ${ct}; - border-radius: ${ct}; - `),jo("default"),K("ghost",[jo("primary"),jo("info"),jo("success"),jo("warning"),jo("error")])])])]);const Xm="n-button-group",$6={size:{type:String,default:void 0},vertical:Boolean};var hO=oe({name:"ButtonGroup",props:$6,setup(e){const{mergedClsPrefixRef:t}=lt(e);return Jr("-button-group",_6,t),je(Xm,e),{mergedClsPrefix:t}},render(){const{mergedClsPrefix:e}=this;return m("div",{class:[`${e}-button-group`,this.vertical&&`${e}-button-group--vertical`],role:"group"},this.$slots)}}),P6=z([M("button",` - margin: 0; - font-weight: var(--n-font-weight); - line-height: 1; - font-family: inherit; - padding: var(--n-padding); - height: var(--n-height); - font-size: var(--n-font-size); - border-radius: var(--n-border-radius); - color: var(--n-text-color); - background-color: var(--n-color); - width: var(--n-width); - white-space: nowrap; - outline: none; - position: relative; - z-index: auto; - border: none; - display: inline-flex; - flex-wrap: nowrap; - flex-shrink: 0; - align-items: center; - justify-content: center; - user-select: none; - text-align: center; - cursor: pointer; - text-decoration: none; - transition: - color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - opacity .3s var(--n-bezier), - border-color .3s var(--n-bezier); - `,[K("color",[F("border",{borderColor:"var(--n-border-color)"}),K("disabled",[F("border",{borderColor:"var(--n-border-color-disabled)"})]),ut("disabled",[z("&:focus",[F("state-border",{borderColor:"var(--n-border-color-focus)"})]),z("&:hover",[F("state-border",{borderColor:"var(--n-border-color-hover)"})]),z("&:active",[F("state-border",{borderColor:"var(--n-border-color-pressed)"})]),K("pressed",[F("state-border",{borderColor:"var(--n-border-color-pressed)"})])])]),K("disabled",{backgroundColor:"var(--n-color-disabled)",color:"var(--n-text-color-disabled)"},[F("border",{border:"var(--n-border-disabled)"})]),ut("disabled",[z("&:focus",{backgroundColor:"var(--n-color-focus)",color:"var(--n-text-color-focus)"},[F("state-border",{border:"var(--n-border-focus)"})]),z("&:hover",{backgroundColor:"var(--n-color-hover)",color:"var(--n-text-color-hover)"},[F("state-border",{border:"var(--n-border-hover)"})]),z("&:active",{backgroundColor:"var(--n-color-pressed)",color:"var(--n-text-color-pressed)"},[F("state-border",{border:"var(--n-border-pressed)"})]),K("pressed",{backgroundColor:"var(--n-color-pressed)",color:"var(--n-text-color-pressed)"},[F("state-border",{border:"var(--n-border-pressed)"})])]),K("loading",{"pointer-events":"none"}),M("base-wave",` - pointer-events: none; - top: 0; - right: 0; - bottom: 0; - left: 0; - animation-iteration-count: 1; - animation-duration: var(--n-ripple-duration); - animation-timing-function: var(--n-bezier-ease-out), var(--n-bezier-ease-out); - `,[K("active",{zIndex:1,animationName:"button-wave-spread, button-wave-opacity"})]),typeof window!="undefined"&&"MozBoxSizing"in document.createElement("div").style?z("&::moz-focus-inner",{border:0}):null,F("border, state-border",` - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - border-radius: inherit; - transition: border-color .3s var(--n-bezier); - pointer-events: none; - `),F("border",{border:"var(--n-border)"}),F("state-border",{border:"var(--n-border)",borderColor:"#0000",zIndex:1}),F("icon",` - margin: var(--n-icon-margin); - margin-left: 0; - height: var(--n-icon-size); - width: var(--n-icon-size); - max-width: var(--n-icon-size); - font-size: var(--n-icon-size); - position: relative; - flex-shrink: 0; - `,[M("icon-slot",` - height: var(--n-icon-size); - width: var(--n-icon-size); - position: absolute; - left: 0; - top: 50%; - transform: translateY(-50%); - display: flex; - `,[pi({top:"50%",originalTransform:"translateY(-50%)"})]),Hm()]),F("content",` - display: flex; - align-items: center; - flex-wrap: nowrap; - `,[z("~",[F("icon",{margin:"var(--n-icon-margin)",marginRight:0})])]),K("block",` - display: flex; - width: 100%; - `),K("dashed",[F("border, state-border",{borderStyle:"dashed !important"})]),K("disabled",{cursor:"not-allowed",opacity:"var(--n-opacity-disabled)"})]),z("@keyframes button-wave-spread",{from:{boxShadow:"0 0 0.5px 0 var(--n-ripple-color)"},to:{boxShadow:"0 0 0.5px 4.5px var(--n-ripple-color)"}}),z("@keyframes button-wave-opacity",{from:{opacity:"var(--n-wave-opacity)"},to:{opacity:0}})]);const k6=Object.assign(Object.assign({},ze.props),{color:String,textColor:String,text:Boolean,block:Boolean,loading:Boolean,disabled:Boolean,circle:Boolean,size:String,ghost:Boolean,round:Boolean,secondary:Boolean,tertiary:Boolean,quaternary:Boolean,strong:Boolean,focusable:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},tag:{type:String,default:"button"},type:{type:String,default:"default"},dashed:Boolean,iconPlacement:{type:String,default:"left"},attrType:{type:String,default:"button"},bordered:{type:Boolean,default:!0},onClick:[Function,Array],internalAutoFocus:Boolean}),Zm=oe({name:"Button",props:k6,setup(e){const t=W(null),r=W(null),o=W(!1);Ot(()=>{const{value:x}=t;x&&!e.disabled&&e.focusable&&e.internalAutoFocus&&x.focus({preventScroll:!0})});const n=ht(()=>!e.quaternary&&!e.tertiary&&!e.secondary&&!e.text&&(!e.color||e.ghost||e.dashed)&&e.bordered),i=be(Xm,{}),{mergedSizeRef:a}=wp({},{defaultSize:"medium",mergedSize:x=>{const{size:S}=e;if(S)return S;const{size:E}=i;if(E)return E;const{mergedSize:y}=x||{};return y?y.value:"medium"}}),l=L(()=>e.focusable&&!e.disabled),s=x=>{var S;x.preventDefault(),!e.disabled&&l.value&&((S=t.value)===null||S===void 0||S.focus({preventScroll:!0}))},d=x=>{var S;if(!e.disabled&&!e.loading){const{onClick:E}=e;E&&Be(E,x),e.text||(S=r.value)===null||S===void 0||S.play()}},c=x=>{switch(x.code){case"Enter":case"NumpadEnter":if(!e.keyboard)return;o.value=!1}},u=x=>{switch(x.code){case"Enter":case"NumpadEnter":if(!e.keyboard||e.loading){x.preventDefault();return}o.value=!0}},f=()=>{o.value=!1},{inlineThemeDisabled:h,mergedClsPrefixRef:p,mergedRtlRef:b}=lt(e),g=ze("Button","-button",P6,Xa,e,p),v=Pn("Button",b,p),w=L(()=>{const x=g.value,{common:{cubicBezierEaseInOut:S,cubicBezierEaseOut:E},self:y}=x,{rippleDuration:_,opacityDisabled:R,fontWeight:P,fontWeightStrong:j}=y,T=a.value,{dashed:N,type:B,ghost:q,text:A,color:te,round:se,circle:_e,textColor:Ae,secondary:Re,tertiary:Ee,quaternary:$e,strong:it}=e,O={"font-weight":it?j:P};let V={"--n-color":"initial","--n-color-hover":"initial","--n-color-pressed":"initial","--n-color-focus":"initial","--n-color-disabled":"initial","--n-ripple-color":"initial","--n-text-color":"initial","--n-text-color-hover":"initial","--n-text-color-pressed":"initial","--n-text-color-focus":"initial","--n-text-color-disabled":"initial"};const D=B==="tertiary",ce=B==="default",ue=D?"default":B;if(A){const Y=Ae||te,J=Y||y[ae("textColorText",ue)];V={"--n-color":"#0000","--n-color-hover":"#0000","--n-color-pressed":"#0000","--n-color-focus":"#0000","--n-color-disabled":"#0000","--n-ripple-color":"#0000","--n-text-color":J,"--n-text-color-hover":Y?ao(Y):y[ae("textColorTextHover",ue)],"--n-text-color-pressed":Y?Ki(Y):y[ae("textColorTextPressed",ue)],"--n-text-color-focus":Y?ao(Y):y[ae("textColorTextHover",ue)],"--n-text-color-disabled":Y||y[ae("textColorTextDisabled",ue)]}}else if(q||N){const Y=Ae||te;V={"--n-color":"#0000","--n-color-hover":"#0000","--n-color-pressed":"#0000","--n-color-focus":"#0000","--n-color-disabled":"#0000","--n-ripple-color":te||y[ae("rippleColor",ue)],"--n-text-color":Y||y[ae("textColorGhost",ue)],"--n-text-color-hover":Y?ao(Y):y[ae("textColorGhostHover",ue)],"--n-text-color-pressed":Y?Ki(Y):y[ae("textColorGhostPressed",ue)],"--n-text-color-focus":Y?ao(Y):y[ae("textColorGhostHover",ue)],"--n-text-color-disabled":Y||y[ae("textColorGhostDisabled",ue)]}}else if(Re){const Y=ce?y.textColor:D?y.textColorTertiary:y[ae("color",ue)],J=te||Y,Q=B!=="default"&&B!=="tertiary";V={"--n-color":Q?ee(J,{alpha:Number(y.colorOpacitySecondary)}):y.colorSecondary,"--n-color-hover":Q?ee(J,{alpha:Number(y.colorOpacitySecondaryHover)}):y.colorSecondaryHover,"--n-color-pressed":Q?ee(J,{alpha:Number(y.colorOpacitySecondaryPressed)}):y.colorSecondaryPressed,"--n-color-focus":Q?ee(J,{alpha:Number(y.colorOpacitySecondaryHover)}):y.colorSecondaryHover,"--n-color-disabled":y.colorSecondary,"--n-ripple-color":"#0000","--n-text-color":J,"--n-text-color-hover":J,"--n-text-color-pressed":J,"--n-text-color-focus":J,"--n-text-color-disabled":J}}else if(Ee||$e){const Y=ce?y.textColor:D?y.textColorTertiary:y[ae("color",ue)],J=te||Y;Ee?(V["--n-color"]=y.colorTertiary,V["--n-color-hover"]=y.colorTertiaryHover,V["--n-color-pressed"]=y.colorTertiaryPressed,V["--n-color-focus"]=y.colorSecondaryHover,V["--n-color-disabled"]=y.colorTertiary):(V["--n-color"]=y.colorQuaternary,V["--n-color-hover"]=y.colorQuaternaryHover,V["--n-color-pressed"]=y.colorQuaternaryPressed,V["--n-color-focus"]=y.colorQuaternaryHover,V["--n-color-disabled"]=y.colorQuaternary),V["--n-ripple-color"]="#0000",V["--n-text-color"]=J,V["--n-text-color-hover"]=J,V["--n-text-color-pressed"]=J,V["--n-text-color-focus"]=J,V["--n-text-color-disabled"]=J}else V={"--n-color":te||y[ae("color",ue)],"--n-color-hover":te?ao(te):y[ae("colorHover",ue)],"--n-color-pressed":te?Ki(te):y[ae("colorPressed",ue)],"--n-color-focus":te?ao(te):y[ae("colorFocus",ue)],"--n-color-disabled":te||y[ae("colorDisabled",ue)],"--n-ripple-color":te||y[ae("rippleColor",ue)],"--n-text-color":Ae||(te?y.textColorPrimary:D?y.textColorTertiary:y[ae("textColor",ue)]),"--n-text-color-hover":Ae||(te?y.textColorHoverPrimary:y[ae("textColorHover",ue)]),"--n-text-color-pressed":Ae||(te?y.textColorPressedPrimary:y[ae("textColorPressed",ue)]),"--n-text-color-focus":Ae||(te?y.textColorFocusPrimary:y[ae("textColorFocus",ue)]),"--n-text-color-disabled":Ae||(te?y.textColorDisabledPrimary:y[ae("textColorDisabled",ue)])};let xe={"--n-border":"initial","--n-border-hover":"initial","--n-border-pressed":"initial","--n-border-focus":"initial","--n-border-disabled":"initial"};A?xe={"--n-border":"none","--n-border-hover":"none","--n-border-pressed":"none","--n-border-focus":"none","--n-border-disabled":"none"}:xe={"--n-border":y[ae("border",ue)],"--n-border-hover":y[ae("borderHover",ue)],"--n-border-pressed":y[ae("borderPressed",ue)],"--n-border-focus":y[ae("borderFocus",ue)],"--n-border-disabled":y[ae("borderDisabled",ue)]};const{[ae("height",T)]:G,[ae("fontSize",T)]:Z,[ae("padding",T)]:C,[ae("paddingRound",T)]:k,[ae("iconSize",T)]:H,[ae("borderRadius",T)]:U,[ae("iconMargin",T)]:X,waveOpacity:ne}=y,le={"--n-width":_e&&!A?G:"initial","--n-height":A?"initial":G,"--n-font-size":Z,"--n-padding":_e||A?"initial":se?k:C,"--n-icon-size":H,"--n-icon-margin":X,"--n-border-radius":A?"initial":_e||se?G:U};return Object.assign(Object.assign(Object.assign(Object.assign({"--n-bezier":S,"--n-bezier-ease-out":E,"--n-ripple-duration":_,"--n-opacity-disabled":R,"--n-wave-opacity":ne},O),V),xe),le)}),$=h?_t("button",L(()=>{let x="";const{dashed:S,type:E,ghost:y,text:_,color:R,round:P,circle:j,textColor:T,secondary:N,tertiary:B,quaternary:q,strong:A}=e;S&&(x+="a"),y&&(x+="b"),_&&(x+="c"),P&&(x+="d"),j&&(x+="e"),N&&(x+="f"),B&&(x+="g"),q&&(x+="h"),A&&(x+="i"),R&&(x+="j"+un(R)),T&&(x+="k"+un(T));const{value:te}=a;return x+="l"+te[0],x+="m"+E[0],x}),w,e):void 0;return{selfElRef:t,waveElRef:r,mergedClsPrefix:p,mergedFocusable:l,mergedSize:a,showBorder:n,enterPressed:o,rtlEnabled:v,handleMousedown:s,handleKeydown:u,handleBlur:f,handleKeyup:c,handleClick:d,customColorCssVars:L(()=>{const{color:x}=e;if(!x)return null;const S=ao(x);return{"--n-border-color":x,"--n-border-color-hover":S,"--n-border-color-pressed":Ki(x),"--n-border-color-focus":S,"--n-border-color-disabled":x}}),cssVars:h?void 0:w,themeClass:$==null?void 0:$.themeClass,onRender:$==null?void 0:$.onRender}},render(){const{mergedClsPrefix:e,tag:t,onRender:r}=this;r==null||r();const o=bt(this.$slots.default,n=>n&&m("span",{class:`${e}-button__content`},n));return m(t,{ref:"selfElRef",class:[this.themeClass,`${e}-button`,`${e}-button--${this.type}-type`,`${e}-button--${this.mergedSize}-type`,this.rtlEnabled&&`${e}-button--rtl`,this.disabled&&`${e}-button--disabled`,this.block&&`${e}-button--block`,this.enterPressed&&`${e}-button--pressed`,!this.text&&this.dashed&&`${e}-button--dashed`,this.color&&`${e}-button--color`,this.secondary&&`${e}-button--secondary`,this.loading&&`${e}-button--loading`,this.ghost&&`${e}-button--ghost`],tabindex:this.mergedFocusable?0:-1,type:this.attrType,style:this.cssVars,disabled:this.disabled,onClick:this.handleClick,onBlur:this.handleBlur,onMousedown:this.handleMousedown,onKeyup:this.handleKeyup,onKeydown:this.handleKeydown},this.iconPlacement==="right"&&o,m(Ka,{width:!0},{default:()=>bt(this.$slots.icon,n=>(this.loading||n)&&m("span",{class:`${e}-button__icon`,style:{margin:cc(this.$slots.default)?"0":""}},m(Va,null,{default:()=>this.loading?m(Ua,{clsPrefix:e,key:"loading",class:`${e}-icon-slot`,strokeWidth:20}):m("div",{key:"icon",class:`${e}-icon-slot`,role:"none"},n)})))}),this.iconPlacement==="left"&&o,this.text?null:m(zm,{ref:"waveElRef",clsPrefix:e}),this.showBorder?m("div",{"aria-hidden":!0,class:`${e}-button__border`,style:this.customColorCssVars}):null,this.showBorder?m("div",{"aria-hidden":!0,class:`${e}-button__state-border`,style:this.customColorCssVars}):null)}});var Ca=Zm;const pO=Zm;var T6={titleFontSize:"22px"};const E6=e=>{const{borderRadius:t,fontSize:r,lineHeight:o,textColor2:n,textColor1:i,textColorDisabled:a,dividerColor:l,fontWeightStrong:s,primaryColor:d,baseColor:c,hoverColor:u,cardColor:f,modalColor:h,popoverColor:p}=e;return Object.assign(Object.assign({},T6),{borderRadius:t,borderColor:ye(f,l),borderColorModal:ye(h,l),borderColorPopover:ye(p,l),textColor:n,titleFontWeight:s,titleTextColor:i,dayTextColor:a,fontSize:r,lineHeight:o,dateColorCurrent:d,dateTextColorCurrent:c,cellColorHover:ye(f,u),cellColorHoverModal:ye(h,u),cellColorHoverPopover:ye(p,u),cellColor:f,cellColorModal:h,cellColorPopover:p,barColor:d})},R6={name:"Calendar",common:de,peers:{Button:qt},self:E6};var z6=R6;const A6=e=>{const{fontSize:t,boxShadow2:r,popoverColor:o,textColor2:n,borderRadius:i,borderColor:a,heightSmall:l,heightMedium:s,heightLarge:d,fontSizeSmall:c,fontSizeMedium:u,fontSizeLarge:f,dividerColor:h}=e;return{panelFontSize:t,boxShadow:r,color:o,textColor:n,borderRadius:i,border:`1px solid ${a}`,heightSmall:l,heightMedium:s,heightLarge:d,fontSizeSmall:c,fontSizeMedium:u,fontSizeLarge:f,dividerColor:h}},O6={name:"ColorPicker",common:de,peers:{Input:ur,Button:qt},self:A6};var I6=O6,M6={paddingSmall:"12px 16px 12px",paddingMedium:"19px 24px 20px",paddingLarge:"23px 32px 24px",paddingHuge:"27px 40px 28px",titleFontSizeSmall:"16px",titleFontSizeMedium:"18px",titleFontSizeLarge:"18px",titleFontSizeHuge:"18px",closeSize:"18px"};const Jm=e=>{const{primaryColor:t,borderRadius:r,lineHeight:o,fontSize:n,cardColor:i,textColor2:a,textColor1:l,dividerColor:s,fontWeightStrong:d,closeColor:c,closeColorHover:u,closeColorPressed:f,modalColor:h,boxShadow1:p,popoverColor:b,actionColor:g}=e;return Object.assign(Object.assign({},M6),{lineHeight:o,color:i,colorModal:h,colorPopover:b,colorTarget:t,colorEmbedded:g,textColor:a,titleTextColor:l,borderColor:s,actionColor:g,titleFontWeight:d,closeColor:c,closeColorHover:u,closeColorPressed:f,fontSizeSmall:n,fontSizeMedium:n,fontSizeLarge:n,fontSizeHuge:n,boxShadow:p,borderRadius:r})},B6={name:"Card",common:Ke,self:Jm};var Qm=B6;const L6={name:"Card",common:de,self(e){const t=Jm(e),{cardColor:r}=e;return t.colorEmbedded=r,t}};var ev=L6,D6=z([M("card",` - font-size: var(--n-font-size); - line-height: var(--n-line-height); - display: flex; - flex-direction: column; - width: 100%; - box-sizing: border-box; - position: relative; - border-radius: var(--n-border-radius); - background-color: var(--n-color); - color: var(--n-text-color); - transition: - color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - box-shadow .3s var(--n-bezier), - border-color .3s var(--n-bezier); - `,[K("hoverable",[z("&:hover","box-shadow: var(--n-box-shadow);")]),K("content-segmented",[z(">",[F("content",{paddingTop:"var(--n-padding-bottom)"})])]),K("content-soft-segmented",[z(">",[F("content",` - margin: 0 var(--n-padding-left); - padding: var(--n-padding-bottom) 0; - `)])]),K("footer-segmented",[z(">",[F("footer",{paddingTop:"var(--n-padding-bottom)"})])]),K("footer-soft-segmented",[z(">",[F("footer",` - padding: var(--n-padding-bottom) 0; - margin: 0 var(--n-padding-left); - `)])]),z(">",[M("card-header",` - box-sizing: border-box; - display: flex; - align-items: center; - font-size: var(--n-title-font-size); - padding: - var(--n-padding-top) - var(--n-padding-left) - var(--n-padding-bottom) - var(--n-padding-left); - `,[F("main",` - font-weight: var(--n-title-font-weight); - transition: color .3s var(--n-bezier); - flex: 1; - color: var(--n-title-text-color); - `),F("extra",` - display: flex; - align-items: center; - font-size: var(--n-font-size); - font-weight: 400; - transition: color .3s var(--n-bezier); - color: var(--n-text-color); - `),F("close",` - font-size: var(--n-close-size); - transition: color .3s var(--n-bezier); - `)]),F("action",` - box-sizing: border-box; - transition: - background-color .3s var(--n-bezier), - border-color .3s var(--n-bezier); - background-clip: padding-box; - background-color: var(--n-action-color); - `),F("content","flex: 1;"),F("content, footer",` - box-sizing: border-box; - padding: 0 var(--n-padding-left) var(--n-padding-bottom) var(--n-padding-left); - font-size: var(--n-font-size); - `,[z("&:first-child",{paddingTop:"var(--n-padding-bottom)"})]),F("action",` - background-color: var(--n-action-color); - padding: var(--n-padding-bottom) var(--n-padding-left); - border-bottom-left-radius: var(--n-border-radius); - border-bottom-right-radius: var(--n-border-radius); - `)]),M("card-cover",` - overflow: hidden; - width: 100%; - border-radius: var(--n-border-radius) var(--n-border-radius) 0 0; - `,[z("img",` - display: block; - width: 100%; - `)]),K("bordered",` - border: 1px solid var(--n-border-color); - `,[z("&:target","border-color: var(--n-color-target);")]),K("action-segmented",[z(">",[F("action",[z("&:not(:first-child)",{borderTop:"1px solid var(--n-border-color)"})])])]),K("content-segmented, content-soft-segmented",[z(">",[F("content",{transition:"border-color 0.3s var(--n-bezier)"},[z("&:not(:first-child)",{borderTop:"1px solid var(--n-border-color)"})])])]),K("footer-segmented, footer-soft-segmented",[z(">",[F("footer",{transition:"border-color 0.3s var(--n-bezier)"},[z("&:not(:first-child)",{borderTop:"1px solid var(--n-border-color)"})])])])]),dc(M("card",{background:"var(--n-color-modal)"})),pp(M("card",{background:"var(--n-color-popover)"})),M("card",[mp({background:"var(--n-color-modal)"})])]);const Ac={title:String,contentStyle:[Object,String],headerStyle:[Object,String],headerExtraStyle:[Object,String],footerStyle:[Object,String],embedded:Boolean,segmented:{type:[Boolean,Object],default:!1},size:{type:String,default:"medium"},bordered:{type:Boolean,default:!0},closable:{type:Boolean,default:!1},hoverable:Boolean,role:String,onClose:[Function,Array]},F6=er(Ac),H6=Object.assign(Object.assign({},ze.props),Ac);var Oc=oe({name:"Card",props:H6,setup(e){const t=()=>{const{onClose:d}=e;d&&Be(d)},{inlineThemeDisabled:r,mergedClsPrefixRef:o,mergedRtlRef:n}=lt(e),i=ze("Card","-card",D6,Qm,e,o),a=Pn("Card",n,o),l=L(()=>{const{size:d}=e,{self:{color:c,colorModal:u,colorTarget:f,textColor:h,titleTextColor:p,titleFontWeight:b,borderColor:g,actionColor:v,borderRadius:w,closeColor:$,closeColorHover:x,closeColorPressed:S,lineHeight:E,closeSize:y,boxShadow:_,colorPopover:R,colorEmbedded:P,[ae("padding",d)]:j,[ae("fontSize",d)]:T,[ae("titleFontSize",d)]:N},common:{cubicBezierEaseInOut:B}}=i.value,{top:q,left:A,bottom:te}=ap(j);return{"--n-bezier":B,"--n-border-radius":w,"--n-color":e.embedded?P:c,"--n-color-modal":u,"--n-color-popover":R,"--n-color-target":f,"--n-text-color":h,"--n-line-height":E,"--n-action-color":v,"--n-title-text-color":p,"--n-title-font-weight":b,"--n-close-color":$,"--n-close-color-hover":x,"--n-close-color-pressed":S,"--n-border-color":g,"--n-box-shadow":_,"--n-padding-top":q,"--n-padding-bottom":te,"--n-padding-left":A,"--n-font-size":T,"--n-title-font-size":N,"--n-close-size":y}}),s=r?_t("card",L(()=>e.size[0]),l,e):void 0;return{rtlEnabled:a,mergedClsPrefix:o,mergedTheme:i,handleCloseClick:t,cssVars:r?void 0:l,themeClass:s==null?void 0:s.themeClass,onRender:s==null?void 0:s.onRender}},render(){const{segmented:e,bordered:t,hoverable:r,mergedClsPrefix:o,rtlEnabled:n,onRender:i,$slots:a}=this;return i==null||i(),m("div",{class:[`${o}-card`,this.themeClass,{[`${o}-card--rtl`]:n,[`${o}-card--content${typeof e!="boolean"&&e.content==="soft"?"-soft":""}-segmented`]:e===!0||e!==!1&&e.content,[`${o}-card--footer${typeof e!="boolean"&&e.footer==="soft"?"-soft":""}-segmented`]:e===!0||e!==!1&&e.footer,[`${o}-card--action-segmented`]:e===!0||e!==!1&&e.action,[`${o}-card--bordered`]:t,[`${o}-card--hoverable`]:r}],style:this.cssVars,role:this.role},bt(a.cover,l=>l&&m("div",{class:`${o}-card-cover`,role:"none"},l)),bt(a.header,l=>l||this.title||this.closable?m("div",{class:`${o}-card-header`,style:this.headerStyle},m("div",{class:`${o}-card-header__main`,role:"heading"},l||[this.title]),bt(a["header-extra"],s=>s&&m("div",{class:`${o}-card-header__extra`,style:this.headerExtraStyle},s)),this.closable?m(yi,{clsPrefix:o,class:`${o}-card-header__close`,onClick:this.handleCloseClick}):null):null),bt(a.default,l=>l&&m("div",{class:`${o}-card__content`,style:this.contentStyle,role:"none"},l)),bt(a.footer,l=>l&&[m("div",{class:`${o}-card__footer`,style:this.footerStyle,role:"none"},l)]),bt(a.action,l=>l&&m("div",{class:`${o}-card__action`,role:"none"},l)))}});const j6=e=>({dotSize:"8px",dotColor:"rgba(255, 255, 255, .3)",dotColorActive:"rgba(255, 255, 255, 1)",dotColorFocus:"rgba(255, 255, 255, .5)",dotLineWidth:"16px",dotLineWidthActive:"24px",arrowColor:"#eee"}),N6={name:"Carousel",common:de,self:j6};var W6=N6,V6={sizeSmall:"14px",sizeMedium:"16px",sizeLarge:"18px",labelPadding:"0 8px"};const K6=e=>{const{baseColor:t,inputColorDisabled:r,cardColor:o,modalColor:n,popoverColor:i,textColorDisabled:a,borderColor:l,primaryColor:s,textColor2:d,fontSizeSmall:c,fontSizeMedium:u,fontSizeLarge:f,borderRadiusSmall:h,lineHeight:p}=e;return Object.assign(Object.assign({},V6),{labelLineHeight:p,fontSizeSmall:c,fontSizeMedium:u,fontSizeLarge:f,borderRadius:h,color:t,colorChecked:s,colorDisabled:r,colorDisabledChecked:r,colorTableHeader:o,colorTableHeaderModal:n,colorTableHeaderPopover:i,checkMarkColor:t,checkMarkColorDisabled:a,checkMarkColorDisabledChecked:a,border:`1px solid ${l}`,borderDisabled:`1px solid ${l}`,borderDisabledChecked:`1px solid ${l}`,borderChecked:`1px solid ${s}`,borderFocus:`1px solid ${s}`,boxShadowFocus:`0 0 0 2px ${ee(s,{alpha:.3})}`,textColor:d,textColorDisabled:a})},U6={name:"Checkbox",common:de,self(e){const{cardColor:t}=e,r=K6(e);return r.color="#0000",r.checkMarkColor=t,r}};var $i=U6;const q6=e=>{const{borderRadius:t,boxShadow2:r,popoverColor:o,textColor2:n,textColor3:i,primaryColor:a,textColorDisabled:l,dividerColor:s,hoverColor:d,fontSizeMedium:c,heightMedium:u}=e;return{menuBorderRadius:t,menuColor:o,menuBoxShadow:r,menuDividerColor:s,menuHeight:"calc(var(--n-option-height) * 6.6)",optionArrowColor:i,optionHeight:u,optionFontSize:c,optionColorHover:d,optionTextColor:n,optionTextColorActive:a,optionTextColorDisabled:l,optionCheckMarkColor:a,loadingColor:a,columnWidth:"180px"}},G6={name:"Cascader",common:de,peers:{InternalSelectMenu:Si,InternalSelection:zc,Scrollbar:Ut,Checkbox:$i,Empty:km},self:q6};var Y6=G6;const X6={name:"Code",common:de,self(e){const{textColor2:t,fontSize:r,fontWeightStrong:o}=e;return{textColor:t,fontSize:r,fontWeightStrong:o,"mono-3":"#5c6370","hue-1":"#56b6c2","hue-2":"#61aeee","hue-3":"#c678dd","hue-4":"#98c379","hue-5":"#e06c75","hue-5-2":"#be5046","hue-6":"#d19a66","hue-6-2":"#e6c07b"}}};var tv=X6;const Z6=e=>{const{fontWeight:t,textColor1:r,textColor2:o,dividerColor:n,fontSize:i}=e;return{titleFontSize:i,titleFontWeight:t,dividerColor:n,titleTextColor:r,fontSize:i,textColor:o,arrowColor:o}},J6={name:"Collapse",common:de,self:Z6};var Q6=J6;const e4=e=>{const{cubicBezierEaseInOut:t}=e;return{bezier:t}},t4={name:"CollapseTransition",common:de,self:e4};var r4=t4;const o4={abstract:Boolean,bordered:{type:Boolean,default:void 0},clsPrefix:String,locale:Object,dateLocale:Object,namespace:String,rtl:Array,tag:{type:String,default:"div"},hljs:Object,theme:Object,themeOverrides:Object,componentOptions:Object,icons:Object,breakpoints:Object,inlineThemeDisabled:{type:Boolean,default:void 0},as:{type:String,validator:()=>(Kr("config-provider","`as` is deprecated, please use `tag` instead."),!0),default:void 0}};var n4=oe({name:"ConfigProvider",alias:["App"],props:o4,setup(e){const t=be(Gr,null),r=L(()=>{const{theme:h}=e;if(h===null)return;const p=t==null?void 0:t.mergedThemeRef.value;return h===void 0?p:p===void 0?h:Object.assign({},p,h)}),o=L(()=>{const{themeOverrides:h}=e;if(h!==null){if(h===void 0)return t==null?void 0:t.mergedThemeOverridesRef.value;{const p=t==null?void 0:t.mergedThemeOverridesRef.value;return p===void 0?h:Xo({},p,h)}}}),n=ht(()=>{const{namespace:h}=e;return h===void 0?t==null?void 0:t.mergedNamespaceRef.value:h}),i=ht(()=>{const{bordered:h}=e;return h===void 0?t==null?void 0:t.mergedBorderedRef.value:h}),a=L(()=>{const{icons:h}=e;return h===void 0?t==null?void 0:t.mergedIconsRef.value:h}),l=L(()=>{const{componentOptions:h}=e;return h!==void 0?h:t==null?void 0:t.mergedComponentPropsRef.value}),s=L(()=>{const{clsPrefix:h}=e;return h!==void 0?h:t==null?void 0:t.mergedClsPrefixRef.value}),d=L(()=>{var h;const{rtl:p}=e;if(p===void 0)return t==null?void 0:t.mergedRtlRef.value;const b={};for(const g of p)b[g.name]=oa(g),(h=g.peers)===null||h===void 0||h.forEach(v=>{v.name in b||(b[v.name]=oa(v))});return b}),c=L(()=>e.breakpoints||(t==null?void 0:t.mergedBreakpointsRef.value)),u=e.inlineThemeDisabled||(t==null?void 0:t.inlineThemeDisabled),f=L(()=>{const{value:h}=r,{value:p}=o,b=p&&Object.keys(p).length!==0,g=h==null?void 0:h.name;return g?b?`${g}-${ci(JSON.stringify(o.value))}`:g:b?ci(JSON.stringify(o.value)):""});return je(Gr,{mergedThemeHashRef:f,mergedBreakpointsRef:c,mergedRtlRef:d,mergedIconsRef:a,mergedComponentPropsRef:l,mergedBorderedRef:i,mergedNamespaceRef:n,mergedClsPrefixRef:s,mergedLocaleRef:L(()=>{const{locale:h}=e;if(h!==null)return h===void 0?t==null?void 0:t.mergedLocaleRef.value:h}),mergedDateLocaleRef:L(()=>{const{dateLocale:h}=e;if(h!==null)return h===void 0?t==null?void 0:t.mergedDateLocaleRef.value:h}),mergedHljsRef:L(()=>{const{hljs:h}=e;return h===void 0?t==null?void 0:t.mergedHljsRef.value:h}),mergedThemeRef:r,mergedThemeOverridesRef:o,inlineThemeDisabled:u||!1}),{mergedClsPrefix:s,mergedBordered:i,mergedNamespace:n,mergedTheme:r,mergedThemeOverrides:o}},render(){var e,t,r,o;return this.abstract?(o=(r=this.$slots).default)===null||o===void 0?void 0:o.call(r):m(this.as||this.tag,{class:`${this.mergedClsPrefix||Qp}-config-provider`},(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e))}});function rv(e){const{boxShadow2:t}=e;return{menuBoxShadow:t}}const i4={name:"Select",common:Ke,peers:{InternalSelection:T3,InternalSelectMenu:n3},self:rv};var a4=i4;const l4={name:"Select",common:de,peers:{InternalSelection:zc,InternalSelectMenu:Si},self:rv};var ov=l4,s4={itemSize:"28px",itemPadding:"0 4px",itemMargin:"0 0 0 8px",itemMarginRtl:"0 8px 0 0",buttonIconSize:"16px",inputWidth:"60px",selectWidth:"unset",inputMargin:"0 0 0 8px",inputMarginRtl:"0 8px 0 0",selectMargin:"0 0 0 8px",prefixMargin:"0 8px 0 0",suffixMargin:"0 0 0 8px",jumperFontSize:"14px"};const nv=e=>{const{textColor2:t,primaryColor:r,primaryColorHover:o,primaryColorPressed:n,inputColorDisabled:i,textColorDisabled:a,borderColor:l,borderRadius:s,fontSize:d}=e;return Object.assign(Object.assign({},s4),{buttonColor:"#0000",buttonColorHover:"#0000",buttonColorPressed:"#0000",buttonBorder:`1px solid ${l}`,buttonBorderHover:`1px solid ${l}`,buttonBorderPressed:`1px solid ${l}`,buttonIconColor:t,buttonIconColorHover:t,buttonIconColorPressed:t,itemTextColor:t,itemTextColorHover:o,itemTextColorPressed:n,itemTextColorActive:r,itemTextColorDisabled:a,itemColor:"#0000",itemColorHover:"#0000",itemColorPressed:"#0000",itemColorActive:"#0000",itemColorActiveHover:"#0000",itemColorDisabled:i,itemBorder:"1px solid #0000",itemBorderHover:"1px solid #0000",itemBorderPressed:"1px solid #0000",itemBorderActive:`1px solid ${r}`,itemBorderDisabled:`1px solid ${l}`,itemBorderRadius:s,itemFontSize:d,jumperTextColor:t,jumperTextColorDisabled:a})},c4={name:"Pagination",common:Ke,peers:{Select:a4,Input:Wm},self:nv};var mO=c4;const d4={name:"Pagination",common:de,peers:{Select:ov,Input:ur},self(e){const{primaryColor:t,opacity3:r}=e,o=ee(t,{alpha:Number(r)}),n=nv(e);return n.itemBorderActive=`1px solid ${o}`,n.itemBorderDisabled="1px solid #0000",n}};var iv=d4,av={padding:"8px 14px"};const u4={name:"Tooltip",common:de,peers:{Popover:zo},self(e){const{borderRadius:t,boxShadow2:r,popoverColor:o,textColor2:n}=e;return Object.assign(Object.assign({},av),{borderRadius:t,boxShadow:r,color:o,textColor:n})}};var Za=u4;const f4=e=>{const{borderRadius:t,boxShadow2:r,baseColor:o}=e;return Object.assign(Object.assign({},av),{borderRadius:t,boxShadow:r,color:ye(o,"rgba(0, 0, 0, .85)"),textColor:o})},h4={name:"Tooltip",common:Ke,peers:{Popover:_i},self:f4};var Ic=h4;const p4={name:"Ellipsis",common:de,peers:{Tooltip:Za}};var lv=p4,m4={radioSizeSmall:"14px",radioSizeMedium:"16px",radioSizeLarge:"18px",labelPadding:"0 8px"};const v4={name:"Radio",common:de,self(e){const{borderColor:t,primaryColor:r,baseColor:o,textColorDisabled:n,inputColorDisabled:i,textColor2:a,opacityDisabled:l,borderRadius:s,fontSizeSmall:d,fontSizeMedium:c,fontSizeLarge:u,heightSmall:f,heightMedium:h,heightLarge:p,lineHeight:b}=e;return Object.assign(Object.assign({},m4),{labelLineHeight:b,buttonHeightSmall:f,buttonHeightMedium:h,buttonHeightLarge:p,fontSizeSmall:d,fontSizeMedium:c,fontSizeLarge:u,boxShadow:`inset 0 0 0 1px ${t}`,boxShadowActive:`inset 0 0 0 1px ${r}`,boxShadowFocus:`inset 0 0 0 1px ${r}, 0 0 0 2px ${ee(r,{alpha:.3})}`,boxShadowHover:`inset 0 0 0 1px ${r}`,boxShadowDisabled:`inset 0 0 0 1px ${t}`,color:"#0000",colorDisabled:i,textColor:a,textColorDisabled:n,dotColorActive:r,dotColorDisabled:t,buttonBorderColor:t,buttonBorderColorActive:r,buttonBorderColorHover:r,buttonColor:"#0000",buttonColorActive:r,buttonTextColor:a,buttonTextColorActive:o,buttonTextColorHover:r,opacityDisabled:l,buttonBoxShadowFocus:`inset 0 0 0 1px ${r}, 0 0 0 2px ${ee(r,{alpha:.3})}`,buttonBoxShadowHover:`inset 0 0 0 1px ${r}`,buttonBoxShadow:"inset 0 0 0 1px #0000",buttonBorderRadius:s})}};var sv=v4,g4={thPaddingSmall:"8px",thPaddingMedium:"12px",thPaddingLarge:"12px",tdPaddingSmall:"8px",tdPaddingMedium:"12px",tdPaddingLarge:"12px",sorterSize:"15px",filterSize:"15px",paginationMargin:"12px 0 0 0",emptyPadding:"48px 0",actionPadding:"8px 12px",actionButtonMargin:"0 8px 0 0"};const b4=e=>{const{cardColor:t,modalColor:r,popoverColor:o,textColor2:n,textColor1:i,tableHeaderColor:a,tableColorHover:l,iconColor:s,primaryColor:d,fontWeightStrong:c,borderRadius:u,lineHeight:f,fontSizeSmall:h,fontSizeMedium:p,fontSizeLarge:b,dividerColor:g,heightSmall:v,opacityDisabled:w,tableColorStriped:$}=e;return Object.assign(Object.assign({},g4),{actionDividerColor:g,lineHeight:f,borderRadius:u,fontSizeSmall:h,fontSizeMedium:p,fontSizeLarge:b,borderColor:ye(t,g),tdColorHover:ye(t,l),tdColorStriped:ye(t,$),thColor:ye(t,a),thColorHover:ye(ye(t,a),l),tdColor:t,tdTextColor:n,thTextColor:i,thFontWeight:c,thButtonColorHover:l,thIconColor:s,thIconColorActive:d,borderColorModal:ye(r,g),tdColorHoverModal:ye(r,l),tdColorStripedModal:ye(r,$),thColorModal:ye(r,a),thColorHoverModal:ye(ye(r,a),l),tdColorModal:r,borderColorPopover:ye(o,g),tdColorHoverPopover:ye(o,l),tdColorStripedPopover:ye(o,$),thColorPopover:ye(o,a),thColorHoverPopover:ye(ye(o,a),l),tdColorPopover:o,boxShadowBefore:"inset -12px 0 8px -12px rgba(0, 0, 0, .18)",boxShadowAfter:"inset 12px 0 8px -12px rgba(0, 0, 0, .18)",loadingColor:d,loadingSize:v,opacityLoading:w})},x4={name:"DataTable",common:de,peers:{Button:qt,Checkbox:$i,Radio:sv,Pagination:iv,Scrollbar:Ut,Empty:wi,Popover:zo,Ellipsis:lv},self(e){const t=b4(e);return t.boxShadowAfter="inset 12px 0 8px -12px rgba(0, 0, 0, .36)",t.boxShadowBefore="inset -12px 0 8px -12px rgba(0, 0, 0, .36)",t}};var C4=x4;const y4=Object.assign(Object.assign({},Ya),ze.props);var cv=oe({name:"Tooltip",props:y4,__popover__:!0,setup(e){const t=ze("Tooltip","-tooltip",void 0,Ic,e),r=W(null);return Object.assign(Object.assign({},{syncPosition(){r.value.syncPosition()},setShow(n){r.value.setShow(n)}}),{popoverRef:r,mergedTheme:t,popoverThemeOverrides:L(()=>t.value.self)})},render(){const{mergedTheme:e,internalExtraClass:t}=this;return m(Mm,Object.assign(Object.assign({},this.$props),{theme:e.peers.Popover,themeOverrides:e.peerOverrides.Popover,builtinThemeOverrides:this.popoverThemeOverrides,internalExtraClass:t.concat("tooltip"),ref:"popoverRef"}),this.$slots)}}),w4={padding:"4px 0",optionIconSizeSmall:"14px",optionIconSizeMedium:"16px",optionIconSizeLarge:"16px",optionIconSizeHuge:"18px",optionSuffixWidthSmall:"14px",optionSuffixWidthMedium:"14px",optionSuffixWidthLarge:"16px",optionSuffixWidthHuge:"16px",optionIconSuffixWidthSmall:"32px",optionIconSuffixWidthMedium:"32px",optionIconSuffixWidthLarge:"36px",optionIconSuffixWidthHuge:"36px",optionPrefixWidthSmall:"14px",optionPrefixWidthMedium:"14px",optionPrefixWidthLarge:"16px",optionPrefixWidthHuge:"16px",optionIconPrefixWidthSmall:"36px",optionIconPrefixWidthMedium:"36px",optionIconPrefixWidthLarge:"40px",optionIconPrefixWidthHuge:"40px"};const dv=e=>{const{primaryColor:t,textColor2:r,dividerColor:o,hoverColor:n,popoverColor:i,invertedColor:a,borderRadius:l,fontSizeSmall:s,fontSizeMedium:d,fontSizeLarge:c,fontSizeHuge:u,heightSmall:f,heightMedium:h,heightLarge:p,heightHuge:b,textColor3:g,opacityDisabled:v}=e;return Object.assign(Object.assign({},w4),{optionHeightSmall:f,optionHeightMedium:h,optionHeightLarge:p,optionHeightHuge:b,borderRadius:l,fontSizeSmall:s,fontSizeMedium:d,fontSizeLarge:c,fontSizeHuge:u,optionTextColor:r,optionTextColorHover:r,optionTextColorActive:t,optionTextColorChildActive:t,color:i,dividerColor:o,suffixColor:r,prefixColor:r,optionColorHover:n,optionColorActive:ee(t,{alpha:.1}),groupHeaderTextColor:g,optionTextColorInverted:"#BBB",optionTextColorHoverInverted:"#FFF",optionTextColorActiveInverted:"#FFF",optionTextColorChildActiveInverted:"#FFF",colorInverted:a,dividerColorInverted:"#BBB",suffixColorInverted:"#BBB",prefixColorInverted:"#BBB",optionColorHoverInverted:t,optionColorActiveInverted:t,groupHeaderTextColorInverted:"#AAA",optionOpacityDisabled:v})},S4={name:"Dropdown",common:Ke,peers:{Popover:_i},self:dv};var uv=S4;const _4={name:"Dropdown",common:de,peers:{Popover:zo},self(e){const{primaryColorSuppl:t,primaryColor:r,popoverColor:o}=e,n=dv(e);return n.colorInverted=o,n.optionColorActive=ee(r,{alpha:.15}),n.optionColorActiveInverted=t,n.optionColorHoverInverted=t,n}};var fv=_4,hv=oe({name:"DropdownDivider",props:{clsPrefix:{type:String,required:!0}},render(){return m("div",{class:`${this.clsPrefix}-dropdown-divider`})}});const pv=e=>{const{textColorBase:t,opacity1:r,opacity2:o,opacity3:n,opacity4:i,opacity5:a}=e;return{color:t,opacity1Depth:r,opacity2Depth:o,opacity3Depth:n,opacity4Depth:i,opacity5Depth:a}},$4={name:"Icon",common:Ke,self:pv};var P4=$4;const k4={name:"Icon",common:de,self:pv};var T4=k4,E4=M("icon",` - height: 1em; - width: 1em; - line-height: 1em; - text-align: center; - display: inline-block; - position: relative; - fill: currentColor; - transform: translateZ(0); -`,[K("color-transition",{transition:"color .3s var(--n-bezier)"}),K("depth",{color:"var(--n-color)"},[z("svg",{opacity:"var(--n-opacity)",transition:"opacity .3s var(--n-bezier)"})]),z("svg",{height:"1em",width:"1em"})]);const Jo=oe({_n_icon__:!0,name:"Icon",inheritAttrs:!1,props:Object.assign(Object.assign({},ze.props),{depth:[String,Number],size:[Number,String],color:String,component:Object}),setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:r}=lt(e),o=ze("Icon","-icon",E4,P4,e,t),n=L(()=>{const{depth:a}=e,{common:{cubicBezierEaseInOut:l},self:s}=o.value;if(a!==void 0){const{color:d,[`opacity${a}Depth`]:c}=s;return{"--n-bezier":l,"--n-color":d,"--n-opacity":c}}return{"--n-bezier":l,"--n-color":"","--n-opacity":""}}),i=r?_t("icon",L(()=>`${e.depth||"d"}`),n,e):void 0;return{mergedClsPrefix:t,mergedStyle:L(()=>{const{size:a,color:l}=e;return{fontSize:Qt(a),color:l}}),cssVars:r?void 0:n,themeClass:i==null?void 0:i.themeClass,onRender:i==null?void 0:i.onRender}},render(){var e;const{$parent:t,depth:r,mergedClsPrefix:o,component:n,onRender:i,themeClass:a}=this;return!((e=t==null?void 0:t.$options)===null||e===void 0)&&e._n_icon__&&Kr("icon","don't wrap `n-icon` inside `n-icon`"),i==null||i(),m("i",Xr(this.$attrs,{role:"img",class:[`${o}-icon`,a,{[`${o}-icon--depth`]:r,[`${o}-icon--color-transition`]:r!==void 0}],style:[this.cssVars,this.mergedStyle]}),n?m(n):this.$slots)}}),Mc="n-dropdown-menu",Ja="n-dropdown",tf="n-dropdown-option";function Ss(e,t){return e.type==="submenu"||e.type===void 0&&e[t]!==void 0}function R4(e){return e.type==="group"}function mv(e){return e.type==="divider"}function z4(e){return e.type==="render"}var vv=oe({name:"DropdownOption",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0},parentKey:{type:[String,Number],default:null},placement:{type:String,default:"right-start"},props:Object},setup(e){const t=be(Ja),{hoverKeyRef:r,keyboardKeyRef:o,lastToggledSubmenuKeyRef:n,pendingKeyPathRef:i,activeKeyPathRef:a,animatedRef:l,mergedShowRef:s,renderLabelRef:d,renderIconRef:c,labelFieldRef:u,childrenFieldRef:f}=t,h=be(tf,null),p=be(Mc),b=L(()=>e.tmNode.rawNode),g=L(()=>{const{value:N}=f;return Ss(e.tmNode.rawNode,N)}),v=L(()=>{const{disabled:N}=e.tmNode;return N}),w=L(()=>{if(!g.value)return!1;const{key:N,disabled:B}=e.tmNode;if(B)return!1;const{value:q}=r,{value:A}=o,{value:te}=n,{value:se}=i;return q!==null?se.includes(N):A!==null?se.includes(N)&&se[se.length-1]!==N:te!==null?se.includes(N):!1}),$=L(()=>o.value===null&&!l.value),x=py(w,300,$),S=L(()=>!!(h!=null&&h.enteringSubmenuRef.value)),E=W(!1);je(tf,{enteringSubmenuRef:E});function y(){E.value=!0}function _(){E.value=!1}function R(){const{parentKey:N,tmNode:B}=e;!s.value||(n.value=N,o.value=null,r.value=B.key)}function P(){const{tmNode:N}=e;!s.value||r.value!==N.key&&R()}function j(N){if(!s.value)return;const{relatedTarget:B}=N;B&&!bC({target:B},"dropdownOption")&&(r.value=null)}function T(){const{value:N}=g,{tmNode:B}=e;!s.value||!N&&!B.disabled&&(t.doSelect(B.key,B.rawNode),t.doUpdateShow(!1))}return{labelField:u,renderLabel:d,renderIcon:c,siblingHasIcon:p.showIconRef,siblingHasSubmenu:p.hasSubmenuRef,animated:l,mergedShowSubmenu:L(()=>x.value&&!S.value),rawNode:b,hasSubmenu:g,pending:ht(()=>{const{value:N}=i,{key:B}=e.tmNode;return N.includes(B)}),childActive:ht(()=>{const{value:N}=a,{key:B}=e.tmNode,q=N.findIndex(A=>B===A);return q===-1?!1:q{const{value:N}=a,{key:B}=e.tmNode,q=N.findIndex(A=>B===A);return q===-1?!1:q===N.length-1}),mergedDisabled:v,handleClick:T,handleMouseMove:P,handleMouseEnter:R,handleMouseLeave:j,handleSubmenuBeforeEnter:y,handleSubmenuAfterEnter:_}},render(){var e;const{animated:t,rawNode:r,mergedShowSubmenu:o,clsPrefix:n,siblingHasIcon:i,siblingHasSubmenu:a,renderLabel:l,renderIcon:s,props:d}=this,c=o?m(gv,{clsPrefix:n,tmNodes:this.tmNode.children,parentKey:this.tmNode.key}):null,u={class:[`${n}-dropdown-option-body`,this.pending&&`${n}-dropdown-option-body--pending`,this.active&&`${n}-dropdown-option-body--active`,this.childActive&&`${n}-dropdown-option-body--child-active`,this.mergedDisabled&&`${n}-dropdown-option-body--disabled`],onMousemove:this.handleMouseMove,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onClick:this.handleClick};return m("div",{class:`${n}-dropdown-option`},m("div",Xr(u,d),[m("div",{"data-dropdown-option":!0,class:[`${n}-dropdown-option-body__prefix`,i&&`${n}-dropdown-option-body__prefix--show-icon`]},[s?s(r):Ct(r.icon)]),m("div",{"data-dropdown-option":!0,class:`${n}-dropdown-option-body__label`},l?l(r):Ct((e=r[this.labelField])!==null&&e!==void 0?e:r.title)),m("div",{"data-dropdown-option":!0,class:[`${n}-dropdown-option-body__suffix`,a&&`${n}-dropdown-option-body__suffix--has-submenu`]},this.hasSubmenu?m(Jo,null,{default:()=>m(x$,null)}):null)]),this.hasSubmenu?m(dm,null,{default:()=>[m(um,null,{default:()=>m("div",{class:`${n}-dropdown-offset-container`},m(hm,{show:this.mergedShowSubmenu,placement:this.placement,teleportDisabled:!0},{default:()=>m("div",{class:`${n}-dropdown-menu-wrapper`},t?m(At,{onBeforeEnter:this.handleSubmenuBeforeEnter,onAfterEnter:this.handleSubmenuAfterEnter,name:"fade-in-scale-up-transition",appear:!0},{default:()=>c}):c)}))})]}):null)}}),A4=oe({name:"DropdownGroupHeader",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(){const{showIconRef:e,hasSubmenuRef:t}=be(Mc),{renderLabelRef:r,labelFieldRef:o}=be(Ja);return{labelField:o,showIcon:e,hasSubmenu:t,renderLabel:r}},render(){var e;const{clsPrefix:t,hasSubmenu:r,showIcon:o,renderLabel:n}=this,{rawNode:i}=this.tmNode;return m("div",{class:`${t}-dropdown-option`},m("div",{class:`${t}-dropdown-option-body ${t}-dropdown-option-body--group`},m("div",{"data-dropdown-option":!0,class:[`${t}-dropdown-option-body__prefix`,o&&`${t}-dropdown-option-body__prefix--show-icon`]},Ct(i.icon)),m("div",{class:`${t}-dropdown-option-body__label`,"data-dropdown-option":!0},n?n(i):Ct((e=i.title)!==null&&e!==void 0?e:i[this.labelField])),m("div",{class:[`${t}-dropdown-option-body__suffix`,r&&`${t}-dropdown-option-body__suffix--has-submenu`],"data-dropdown-option":!0})))}}),O4=oe({name:"NDropdownGroup",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0},parentKey:{type:[String,Number],default:null}},render(){const{tmNode:e,parentKey:t,clsPrefix:r}=this,{children:o}=e;return m(ot,null,m(A4,{clsPrefix:r,tmNode:e,key:e.key}),o==null?void 0:o.map(n=>mv(n.rawNode)?m(hv,{clsPrefix:r,key:n.key}):n.isGroup?(Kr("dropdown","`group` node is not allowed to be put in `group` node."),null):m(vv,{clsPrefix:r,tmNode:n,parentKey:t,key:n.key})))}}),I4=oe({name:"DropdownRenderOption",props:{tmNode:{type:Object,required:!0}},render(){const{rawNode:{render:e,props:t}}=this.tmNode;return m("div",t,[e==null?void 0:e()])}}),gv=oe({name:"DropdownMenu",props:{showArrow:Boolean,arrowStyle:[String,Object],clsPrefix:{type:String,required:!0},tmNodes:{type:Array,default:()=>[]},parentKey:{type:[String,Number],default:null}},setup(e){const{renderIconRef:t,childrenFieldRef:r}=be(Ja);je(Mc,{showIconRef:L(()=>{const o=t.value;return e.tmNodes.some(n=>{var i;if(n.isGroup)return(i=n.children)===null||i===void 0?void 0:i.some(({rawNode:l})=>o?o(l):l.icon);const{rawNode:a}=n;return o?o(a):a.icon})}),hasSubmenuRef:L(()=>{const{value:o}=r;return e.tmNodes.some(n=>{var i;if(n.isGroup)return(i=n.children)===null||i===void 0?void 0:i.some(({rawNode:l})=>Ss(l,o));const{rawNode:a}=n;return Ss(a,o)})})})},render(){const{parentKey:e,clsPrefix:t}=this;return m("div",{class:`${t}-dropdown-menu`},this.tmNodes.map(r=>{const{rawNode:o}=r;return z4(o)?m(I4,{tmNode:r,key:r.key}):mv(o)?m(hv,{clsPrefix:t,key:r.key}):R4(o)?m(O4,{clsPrefix:t,tmNode:r,parentKey:e,key:r.key}):m(vv,{clsPrefix:t,tmNode:r,parentKey:e,key:r.key,props:o.props})}),this.showArrow?Im({clsPrefix:t,arrowStyle:this.arrowStyle}):null)}}),M4=M("dropdown-menu",` - transform-origin: inherit; - padding: var(--n-padding); - background-color: var(--n-color); - border-radius: var(--n-border-radius); - box-shadow: var(--n-box-shadow); - transition: - background-color .3s var(--n-bezier), - box-shadow .3s var(--n-bezier); -`,[vi(),M("dropdown-option",` - position: relative; - `,[z("a",` - text-decoration: none; - color: inherit; - `,[z("&::before",` - content: ""; - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - `)]),M("dropdown-option-body",` - display: flex; - cursor: pointer; - height: var(--n-option-height); - line-height: var(--n-option-height); - font-size: var(--n-font-size); - color: var(--n-option-text-color); - transition: - background-color .3s var(--n-bezier), - color .3s var(--n-bezier); - `,[K("pending",[ut("disabled",{color:"var(--n-option-text-color-hover)",backgroundColor:"var(--n-option-color-hover)"}),F("prefix, suffix",{color:"var(--n-option-text-color-hover)"})]),K("active",[ut("disabled",{color:"var(--n-option-text-color-active)",backgroundColor:"var(--n-option-color-active)"}),F("prefix, suffix",{color:"var(--n-option-text-color-active)"})]),K("disabled",{cursor:"not-allowed",opacity:"var(--n-option-opacity-disabled)"}),K("child-active",{color:"var(--n-option-text-color-child-active)"},[F("prefix, suffix",{color:"var(--n-option-text-color-child-active)"})]),K("group",{fontSize:"calc(var(--n-font-size) - 1px)",color:"var(--n-group-header-text-color)"},[F("prefix",{width:"calc(var(--n-option-prefix-width) / 2)"},[K("show-icon",{width:"calc(var(--n-option-icon-prefix-width) / 2)"})])]),F("prefix",` - width: var(--n-option-prefix-width); - display: flex; - justify-content: center; - align-items: center; - color: var(--n-prefix-color); - transition: color .3s var(--n-bezier); - `,[K("show-icon",{width:"var(--n-option-icon-prefix-width)"}),M("icon",{fontSize:"var(--n-option-icon-size)"})]),F("label",{whiteSpace:"nowrap",flex:1}),F("suffix",` - box-sizing: border-box; - flex-grow: 0; - flex-shrink: 0; - display: flex; - justify-content: flex-end; - align-items: center; - min-width: var(--n-option-suffix-width); - padding: 0 8px; - transition: color .3s var(--n-bezier); - color: var(--n-suffix-color); - `,[K("has-submenu",{width:"var(--n-option-icon-suffix-width)"}),M("icon",{fontSize:"var(--n-option-icon-size)"})]),M("dropdown-menu",{pointerEvents:"all"})]),M("dropdown-offset-container",` - pointer-events: none; - position: absolute; - left: 0; - right: 0; - top: -4px; - bottom: -4px; - `)]),M("dropdown-divider",` - transition: background-color .3s var(--n-bezier); - background-color: var(--n-divider-color); - height: 1px; - margin: 4px 0; - `),M("dropdown-menu-wrapper",` - transform-origin: inherit; - width: fit-content; - `)]);const B4={animated:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},size:{type:String,default:"medium"},inverted:Boolean,placement:{type:String,default:"bottom"},onSelect:[Function,Array],options:{type:Array,default:()=>[]},showArrow:Boolean,renderLabel:Function,renderIcon:Function,labelField:{type:String,default:"label"},keyField:{type:String,default:"key"},childrenField:{type:String,default:"children"},value:[String,Number]},L4=Object.keys(Ya),D4=Object.assign(Object.assign(Object.assign({},Ya),B4),ze.props);var F4=oe({name:"Dropdown",inheritAttrs:!1,props:D4,setup(e){const t=W(!1),r=hn(Oe(e,"show"),t),o=L(()=>{const{keyField:T,childrenField:N}=e;return lm(e.options,{getKey(B){return B[T]},getDisabled(B){return B.disabled===!0},getIgnored(B){return B.type==="divider"||B.type==="render"},getChildren(B){return B[N]}})}),n=L(()=>o.value.treeNodes),i=W(null),a=W(null),l=W(null),s=L(()=>{var T,N,B;return(B=(N=(T=i.value)!==null&&T!==void 0?T:a.value)!==null&&N!==void 0?N:l.value)!==null&&B!==void 0?B:null}),d=L(()=>o.value.getPath(s.value).keyPath),c=L(()=>o.value.getPath(e.value).keyPath),u=ht(()=>e.keyboard&&r.value);uy({keydown:{ArrowUp:{prevent:!0,handler:S},ArrowRight:{prevent:!0,handler:x},ArrowDown:{prevent:!0,handler:E},ArrowLeft:{prevent:!0,handler:$},Escape:w},keyup:{Enter:y}},u);const{mergedClsPrefixRef:f,inlineThemeDisabled:h}=lt(e),p=ze("Dropdown","-dropdown",M4,uv,e,f);je(Ja,{labelFieldRef:Oe(e,"labelField"),childrenFieldRef:Oe(e,"childrenField"),renderLabelRef:Oe(e,"renderLabel"),renderIconRef:Oe(e,"renderIcon"),hoverKeyRef:i,keyboardKeyRef:a,lastToggledSubmenuKeyRef:l,pendingKeyPathRef:d,activeKeyPathRef:c,animatedRef:Oe(e,"animated"),mergedShowRef:r,doSelect:b,doUpdateShow:g}),qe(r,T=>{T||v()});function b(T,N){const{onSelect:B}=e;B&&Be(B,T,N)}function g(T){const{"onUpdate:show":N,onUpdateShow:B}=e;N&&Be(N,T),B&&Be(B,T),t.value=T}function v(){i.value=null,a.value=null,l.value=null}function w(){g(!1)}function $(){R("left")}function x(){R("right")}function S(){R("up")}function E(){R("down")}function y(){const T=_();T!=null&&T.isLeaf&&(b(T.key,T.rawNode),g(!1))}function _(){var T;const{value:N}=o,{value:B}=s;return!N||B===null?null:(T=N.getNode(B))!==null&&T!==void 0?T:null}function R(T){const{value:N}=s,{value:{getFirstAvailableNode:B}}=o;let q=null;if(N===null){const A=B();A!==null&&(q=A.key)}else{const A=_();if(A){let te;switch(T){case"down":te=A.getNext();break;case"up":te=A.getPrev();break;case"right":te=A.getChild();break;case"left":te=A.getParent();break}te&&(q=te.key)}}q!==null&&(i.value=null,a.value=q)}const P=L(()=>{const{size:T,inverted:N}=e,{common:{cubicBezierEaseInOut:B},self:q}=p.value,{padding:A,dividerColor:te,borderRadius:se,optionOpacityDisabled:_e,[ae("optionIconSuffixWidth",T)]:Ae,[ae("optionSuffixWidth",T)]:Re,[ae("optionIconPrefixWidth",T)]:Ee,[ae("optionPrefixWidth",T)]:$e,[ae("fontSize",T)]:it,[ae("optionHeight",T)]:O,[ae("optionIconSize",T)]:V}=q,D={"--n-bezier":B,"--n-font-size":it,"--n-padding":A,"--n-border-radius":se,"--n-option-height":O,"--n-option-prefix-width":$e,"--n-option-icon-prefix-width":Ee,"--n-option-suffix-width":Re,"--n-option-icon-suffix-width":Ae,"--n-option-icon-size":V,"--n-divider-color":te,"--n-option-opacity-disabled":_e};return N?(D["--n-color"]=q.colorInverted,D["--n-option-color-hover"]=q.optionColorHoverInverted,D["--n-option-color-active"]=q.optionColorActiveInverted,D["--n-option-text-color"]=q.optionTextColorInverted,D["--n-option-text-color-hover"]=q.optionTextColorHoverInverted,D["--n-option-text-color-active"]=q.optionTextColorActiveInverted,D["--n-option-text-color-child-active"]=q.optionTextColorChildActiveInverted,D["--n-prefix-color"]=q.prefixColorInverted,D["--n-suffix-color"]=q.suffixColorInverted,D["--n-group-header-text-color"]=q.groupHeaderTextColorInverted):(D["--n-color"]=q.color,D["--n-option-color-hover"]=q.optionColorHover,D["--n-option-color-active"]=q.optionColorActive,D["--n-option-text-color"]=q.optionTextColor,D["--n-option-text-color-hover"]=q.optionTextColorHover,D["--n-option-text-color-active"]=q.optionTextColorActive,D["--n-option-text-color-child-active"]=q.optionTextColorChildActive,D["--n-prefix-color"]=q.prefixColor,D["--n-suffix-color"]=q.suffixColor,D["--n-group-header-text-color"]=q.groupHeaderTextColor),D}),j=h?_t("dropdown",L(()=>`${e.size[0]}${e.inverted?"i":""}`),P,e):void 0;return{mergedClsPrefix:f,mergedTheme:p,tmNodes:n,mergedShow:r,doUpdateShow:g,cssVars:h?void 0:P,themeClass:j==null?void 0:j.themeClass,onRender:j==null?void 0:j.onRender}},render(){const e=(o,n,i,a,l)=>{var s;const{mergedClsPrefix:d}=this;(s=this.onRender)===null||s===void 0||s.call(this);const c={ref:zC(n),class:[o,`${d}-dropdown`,this.themeClass,this.trigger==="manual"&&`${d}-popover--manual-trigger`,this.showArrow&&`${d}-popover--show-arrow`],clsPrefix:d,tmNodes:this.tmNodes,style:[i,this.cssVars],showArrow:this.showArrow,arrowStyle:this.arrowStyle,onMouseenter:a,onMouseleave:l};return m(gv,Xr(this.$attrs,c))},{mergedTheme:t}=this,r={show:this.mergedShow,theme:t.peers.Popover,themeOverrides:t.peerOverrides.Popover,internalRenderBody:e,onUpdateShow:this.doUpdateShow};return m(Mm,Object.assign({},Vt(this.$props,L4),r),{trigger:()=>{var o,n;return(n=(o=this.$slots).default)===null||n===void 0?void 0:n.call(o)}})}}),H4={itemFontSize:"12px",itemHeight:"36px",itemWidth:"52px",panelActionPadding:"8px 0"};const j4=e=>{const{popoverColor:t,textColor2:r,primaryColor:o,hoverColor:n,dividerColor:i,opacityDisabled:a,boxShadow2:l,borderRadius:s,iconColor:d,iconColorDisabled:c}=e;return Object.assign(Object.assign({},H4),{panelColor:t,panelBoxShadow:l,panelDividerColor:i,itemTextColor:r,itemTextColorActive:o,itemColorHover:n,itemOpacityDisabled:a,itemBorderRadius:s,borderRadius:s,iconColor:d,iconColorDisabled:c})},N4={name:"TimePicker",common:de,peers:{Scrollbar:Ut,Button:qt,Input:ur},self:j4};var bv=N4,W4={itemSize:"24px",itemCellWidth:"38px",itemCellHeight:"32px",scrollItemWidth:"80px",scrollItemHeight:"40px",panelExtraFooterPadding:"8px 12px",panelActionPadding:"8px 12px",calendarTitlePadding:"0",calendarTitleHeight:"28px",arrowSize:"14px",panelHeaderPadding:"8px 12px",calendarDaysHeight:"32px",calendarTitleGridTempateColumns:"28px 28px 1fr 28px 28px",calendarLeftPaddingDate:"6px 12px 4px 12px",calendarLeftPaddingDatetime:"4px 12px",calendarLeftPaddingDaterange:"6px 12px 4px 12px",calendarLeftPaddingDatetimerange:"4px 12px",calendarLeftPaddingMonth:"0",calendarLeftPaddingYear:"0",calendarLeftPaddingQuarter:"0",calendarRightPaddingDate:"6px 12px 4px 12px",calendarRightPaddingDatetime:"4px 12px",calendarRightPaddingDaterange:"6px 12px 4px 12px",calendarRightPaddingDatetimerange:"4px 12px",calendarRightPaddingMonth:"0",calendarRightPaddingYear:"0",calendarRightPaddingQuarter:"0"};const V4=e=>{const{hoverColor:t,fontSize:r,textColor2:o,textColorDisabled:n,popoverColor:i,primaryColor:a,borderRadiusSmall:l,iconColor:s,iconColorDisabled:d,textColor1:c,dividerColor:u,boxShadow2:f,borderRadius:h,fontWeightStrong:p}=e;return Object.assign(Object.assign({},W4),{itemFontSize:r,calendarDaysFontSize:r,calendarTitleFontSize:r,itemTextColor:o,itemTextColorDisabled:n,itemTextColorActive:i,itemTextColorCurrent:a,itemColorIncluded:ee(a,{alpha:.1}),itemColorHover:t,itemColorDisabled:t,itemColorActive:a,itemBorderRadius:l,panelColor:i,panelTextColor:o,arrowColor:s,calendarTitleTextColor:c,calendarTitleColorHover:t,calendarDaysTextColor:o,panelHeaderDividerColor:u,calendarDaysDividerColor:u,calendarDividerColor:u,panelActionDividerColor:u,panelBoxShadow:f,panelBorderRadius:h,calendarTitleFontWeight:p,scrollItemBorderRadius:h,iconColor:s,iconColorDisabled:d})},K4={name:"DatePicker",common:de,peers:{Input:ur,Button:qt,TimePicker:bv,Scrollbar:Ut},self(e){const{popoverColor:t,hoverColor:r,primaryColor:o}=e,n=V4(e);return n.itemColorDisabled=ye(t,r),n.itemColorIncluded=ee(o,{alpha:.15}),n.itemColorHover=ye(t,r),n}};var U4=K4,q4={thPaddingBorderedSmall:"8px 12px",thPaddingBorderedMedium:"12px 16px",thPaddingBorderedLarge:"16px 24px",thPaddingSmall:"0",thPaddingMedium:"0",thPaddingLarge:"0",tdPaddingBorderedSmall:"8px 12px",tdPaddingBorderedMedium:"12px 16px",tdPaddingBorderedLarge:"16px 24px",tdPaddingSmall:"0 0 8px 0",tdPaddingMedium:"0 0 12px 0",tdPaddingLarge:"0 0 16px 0"};const G4=e=>{const{tableHeaderColor:t,textColor2:r,textColor1:o,cardColor:n,modalColor:i,popoverColor:a,dividerColor:l,borderRadius:s,fontWeightStrong:d,lineHeight:c,fontSizeSmall:u,fontSizeMedium:f,fontSizeLarge:h}=e;return Object.assign(Object.assign({},q4),{lineHeight:c,fontSizeSmall:u,fontSizeMedium:f,fontSizeLarge:h,titleTextColor:o,thColor:ye(n,t),thColorModal:ye(i,t),thColorPopover:ye(a,t),thTextColor:o,thFontWeight:d,tdTextColor:r,tdColor:n,tdColorModal:i,tdColorPopover:a,borderColor:ye(n,l),borderColorModal:ye(i,l),borderColorPopover:ye(a,l),borderRadius:s})},Y4={name:"Descriptions",common:de,self:G4};var X4=Y4,Z4={titleFontSize:"18px",padding:"16px 28px 20px 28px",iconSize:"28px",actionSpace:"12px",contentMargin:"8px 0 16px 0",iconMargin:"0 4px 0 0",iconMarginIconTop:"4px 0 8px 0",closeSize:"18px",closeMargin:"22px 28px 0 0",closeMarginIconTop:"12px 18px 0 0"};const xv=e=>{const{textColor1:t,textColor2:r,modalColor:o,closeColor:n,closeColorHover:i,closeColorPressed:a,infoColor:l,successColor:s,warningColor:d,errorColor:c,primaryColor:u,dividerColor:f,borderRadius:h,fontWeightStrong:p,lineHeight:b,fontSize:g}=e;return Object.assign(Object.assign({},Z4),{fontSize:g,lineHeight:b,border:`1px solid ${f}`,titleTextColor:t,textColor:r,color:o,closeColor:n,closeColorHover:i,closeColorPressed:a,iconColor:u,iconColorInfo:l,iconColorSuccess:s,iconColorWarning:d,iconColorError:c,borderRadius:h,titleFontWeight:p})},J4={name:"Dialog",common:Ke,peers:{Button:Xa},self:xv};var Cv=J4;const Q4={name:"Dialog",common:de,peers:{Button:qt},self:xv};var yv=Q4;const Qa={icon:Function,type:{type:String,default:"default"},title:[String,Function],closable:{type:Boolean,default:!0},negativeText:String,positiveText:String,positiveButtonProps:Object,negativeButtonProps:Object,content:[String,Function],action:Function,showIcon:{type:Boolean,default:!0},loading:Boolean,bordered:Boolean,iconPlacement:String,onPositiveClick:Function,onNegativeClick:Function,onClose:Function},wv=er(Qa);var ek=z([M("dialog",` - line-height: var(--n-line-height); - position: relative; - background: var(--n-color); - color: var(--n-text-color); - box-sizing: border-box; - margin: auto; - border-radius: var(--n-border-radius); - padding: var(--n-padding); - transition: - border-color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - color .3s var(--n-bezier); - `,[F("icon",{color:"var(--n-icon-color)"}),K("bordered",{border:"var(--n-border)"}),K("icon-top",[F("close",{margin:"var(--n-close-margin)"}),F("icon",{margin:"var(--n-icon-margin)"}),F("content",{textAlign:"center"}),F("title",{justifyContent:"center"}),F("action",{justifyContent:"center"})]),K("icon-left",[F("icon",{margin:"var(--n-icon-margin)"})]),F("close",` - font-size: var(--n-close-size); - position: absolute; - right: 0; - top: 0; - margin: var(--n-close-margin); - transition: .3s color var(--n-bezier); - z-index: 1; - `),F("content",` - font-size: var(--n-font-size); - margin: var(--n-content-margin); - position: relative; - word-break: break-word; - `,[K("last","margin-bottom: 0;")]),F("action",` - display: flex; - justify-content: flex-end; - `,[z("> *:not(:last-child)",{marginRight:"var(--n-action-space)"})]),F("icon",{fontSize:"var(--n-icon-size)",transition:"color .3s var(--n-bezier)"}),F("title",` - transition: color .3s var(--n-bezier); - display: flex; - align-items: center; - font-size: var(--n-title-font-size); - font-weight: var(--n-title-font-weight); - color: var(--n-title-text-color); - `),M("dialog-icon-container",{display:"flex",justifyContent:"center"})]),dc(M("dialog",` - width: 446px; - max-width: calc(100vw - 32px); - `)),M("dialog",[mp(` - width: 446px; - max-width: calc(100vw - 32px); - `)])]);const rf=m(rm,null),tk={default:rf,info:rf,success:m(om,null),warning:m(nm,null),error:m(tm,null)},Sv=oe({name:"Dialog",alias:["NimbusConfirmCard","Confirm"],props:Object.assign(Object.assign({},ze.props),Qa),setup(e){const{mergedComponentPropsRef:t,mergedClsPrefixRef:r,inlineThemeDisabled:o}=lt(e),n=L(()=>{var u,f;const{iconPlacement:h}=e;return h||((f=(u=t==null?void 0:t.value)===null||u===void 0?void 0:u.Dialog)===null||f===void 0?void 0:f.iconPlacement)||"left"});function i(u){const{onPositiveClick:f}=e;f&&f(u)}function a(u){const{onNegativeClick:f}=e;f&&f(u)}function l(){const{onClose:u}=e;u&&u()}const s=ze("Dialog","-dialog",ek,Cv,e,r),d=L(()=>{const{type:u}=e,f=n.value,{common:{cubicBezierEaseInOut:h},self:{fontSize:p,lineHeight:b,border:g,titleTextColor:v,textColor:w,color:$,closeColor:x,closeColorHover:S,closeColorPressed:E,borderRadius:y,titleFontWeight:_,titleFontSize:R,padding:P,iconSize:j,actionSpace:T,contentMargin:N,closeSize:B,[f==="top"?"iconMarginIconTop":"iconMargin"]:q,[f==="top"?"closeMarginIconTop":"closeMargin"]:A,[ae("iconColor",u)]:te}}=s.value;return{"--n-font-size":p,"--n-icon-color":te,"--n-bezier":h,"--n-close-margin":A,"--n-icon-margin":q,"--n-icon-size":j,"--n-close-size":B,"--n-close-color":x,"--n-close-color-hover":S,"--n-close-color-pressed":E,"--n-color":$,"--n-text-color":w,"--n-border-radius":y,"--n-padding":P,"--n-line-height":b,"--n-border":g,"--n-content-margin":N,"--n-title-font-size":R,"--n-title-font-weight":_,"--n-title-text-color":v,"--n-action-space":T}}),c=o?_t("dialog",L(()=>`${e.type[0]}${n.value[0]}`),d,e):void 0;return{mergedClsPrefix:r,mergedIconPlacement:n,mergedTheme:s,handlePositiveClick:i,handleNegativeClick:a,handleCloseClick:l,cssVars:o?void 0:d,themeClass:c==null?void 0:c.themeClass,onRender:c==null?void 0:c.onRender}},render(){var e;const{bordered:t,mergedIconPlacement:r,cssVars:o,closable:n,showIcon:i,title:a,content:l,action:s,negativeText:d,positiveText:c,positiveButtonProps:u,negativeButtonProps:f,handlePositiveClick:h,handleNegativeClick:p,mergedTheme:b,loading:g,type:v,mergedClsPrefix:w}=this;(e=this.onRender)===null||e===void 0||e.call(this);const $=i?m(Bt,{clsPrefix:w,class:`${w}-dialog__icon`},{default:()=>bt(this.$slots.icon,S=>S||(this.icon?Ct(this.icon):tk[this.type]))}):null,x=bt(this.$slots.action,S=>S||c||d||s?m("div",{class:`${w}-dialog__action`},S||(s?[Ct(s)]:[this.negativeText&&m(Ca,Object.assign({theme:b.peers.Button,themeOverrides:b.peerOverrides.Button,ghost:!0,size:"small",onClick:p},f),{default:()=>Ct(this.negativeText)}),this.positiveText&&m(Ca,Object.assign({theme:b.peers.Button,themeOverrides:b.peerOverrides.Button,size:"small",type:v==="default"?"primary":v,disabled:g,loading:g,onClick:h},u),{default:()=>Ct(this.positiveText)})])):null);return m("div",{class:[`${w}-dialog`,this.themeClass,`${w}-dialog--icon-${r}`,t&&`${w}-dialog--bordered`],style:o,role:"dialog"},n?m(yi,{clsPrefix:w,class:`${w}-dialog__close`,onClick:this.handleCloseClick}):null,i&&r==="top"?m("div",{class:`${w}-dialog-icon-container`},$):null,m("div",{class:`${w}-dialog__title`},i&&r==="left"?$:null,_o(this.$slots.header,()=>[Ct(a)])),m("div",{class:[`${w}-dialog__content`,x?"":`${w}-dialog__content--last`]},_o(this.$slots.default,()=>[Ct(l)])),x)}}),_v="n-dialog-provider",rk="n-dialog-api",$v=e=>{const{modalColor:t,textColor2:r,boxShadow3:o}=e;return{color:t,textColor:r,boxShadow:o}},ok={name:"Modal",common:Ke,peers:{Scrollbar:Rc,Dialog:Cv,Card:Qm},self:$v};var nk=ok;const ik={name:"Modal",common:de,peers:{Scrollbar:Ut,Dialog:yv,Card:ev},self:$v};var ak=ik;const Bc=Object.assign(Object.assign({},Ac),Qa),lk=er(Bc);var sk=oe({name:"ModalBody",inheritAttrs:!1,props:Object.assign(Object.assign({show:{type:Boolean,required:!0},preset:String,displayDirective:{type:String,required:!0},trapFocus:{type:Boolean,default:!0},autoFocus:{type:Boolean,default:!0}},Bc),{onClickoutside:{type:Function,required:!0},onBeforeLeave:{type:Function,required:!0},onAfterLeave:{type:Function,required:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0},onClose:{type:Function,required:!0},onAfterEnter:Function,onEsc:Function}),setup(e){const t=W(null),r=W(null),o=W(e.show),n=W(null),i=W(null);qe(Oe(e,"show"),v=>{v&&(o.value=!0)});const a=be(Cp);function l(){if(a.transformOriginRef.value==="center")return"";const{value:v}=n,{value:w}=i;if(v===null||w===null)return"";if(r.value){const $=r.value.containerScrollTop;return`${v}px ${w+$}px`}return""}function s(v){if(a.transformOriginRef.value==="center")return;const w=a.getMousePosition();if(!w||!r.value)return;const $=r.value.containerScrollTop,{offsetLeft:x,offsetTop:S}=v;if(w){const E=w.y,y=w.x;n.value=-(x-y),i.value=-(S-E-$)}v.style.transformOrigin=l()}function d(v){br(()=>{s(v)})}function c(v){v.style.transformOrigin=l(),e.onBeforeLeave()}function u(){o.value=!1,n.value=null,i.value=null,e.onAfterLeave()}function f(){const{onClose:v}=e;v&&v()}function h(){e.onNegativeClick()}function p(){e.onPositiveClick()}function b(v){e.onClickoutside(v)}const g=W(null);return qe(g,v=>{v&&br(()=>{const w=v.el;w&&t.value!==w&&(t.value=w)})}),je(hc,t),je(pc,null),je(mc,null),{mergedTheme:a.mergedThemeRef,appear:a.appearRef,isMounted:a.isMountedRef,mergedClsPrefix:a.mergedClsPrefixRef,bodyRef:t,scrollbarRef:r,displayed:o,childNodeRef:g,handleClickOutside:b,handlePositiveClick:p,handleNegativeClick:h,handleCloseClick:f,handleAfterLeave:u,handleBeforeLeave:c,handleEnter:d}},render(){const{$slots:e,$attrs:t,handleEnter:r,handleAfterLeave:o,handleBeforeLeave:n,handleClickOutside:i,preset:a,mergedClsPrefix:l}=this;let s=null;if(!a){if(s=as(e),!s){Kr("modal","default slot is empty");return}s=lr(s),s.props=Xr({class:`${l}-modal`},t,s.props||{})}return this.displayDirective==="show"||this.displayed||this.show?Cr(m("div",{role:"none",class:`${l}-modal-body-wrapper`},m(Em,{ref:"scrollbarRef",theme:this.mergedTheme.peers.Scrollbar,themeOverrides:this.mergedTheme.peerOverrides.Scrollbar,contentClass:`${l}-modal-scroll-content`},{default:()=>m(Sm,{disabled:!this.trapFocus,active:this.show,onEsc:this.onEsc,autoFocus:this.autoFocus},{default:()=>{var d;return m(At,{name:"fade-in-scale-up-transition",appear:(d=this.appear)!==null&&d!==void 0?d:this.isMounted,onEnter:r,onAfterEnter:this.onAfterEnter,onAfterLeave:o,onBeforeLeave:n},{default:()=>Cr(this.preset==="confirm"||this.preset==="dialog"?m(Sv,Object.assign({},this.$attrs,{class:[`${l}-modal`,this.$attrs.class],ref:"bodyRef",theme:this.mergedTheme.peers.Dialog,themeOverrides:this.mergedTheme.peerOverrides.Dialog},Vt(this.$props,wv),{"aria-modal":"true"}),e):this.preset==="card"?m(Oc,Object.assign({},this.$attrs,{ref:"bodyRef",class:[`${l}-modal`,this.$attrs.class],theme:this.mergedTheme.peers.Card,themeOverrides:this.mergedTheme.peerOverrides.Card},Vt(this.$props,F6),{"aria-modal":"true",role:"dialog"}),e):this.childNodeRef=s,[[li,this.show],[Cs,i,void 0,{capture:!0}]])})}})})),[[li,this.displayDirective==="if"||this.displayed||this.show]]):null}}),ck=z([M("modal-container",` - position: fixed; - left: 0; - top: 0; - height: 0; - width: 0; - display: flex; - `),M("modal-mask",` - position: fixed; - left: 0; - right: 0; - top: 0; - bottom: 0; - background-color: rgba(0, 0, 0, .4); - `,[mi({enterDuration:".25s",leaveDuration:".25s",enterCubicBezier:"var(--n-bezier-ease-out)",leaveCubicBezier:"var(--n-bezier-ease-out)"})]),M("modal-body-wrapper",` - position: fixed; - left: 0; - right: 0; - top: 0; - bottom: 0; - overflow: visible; - `,[M("modal-scroll-content",` - min-height: 100%; - display: flex; - position: relative; - `)]),M("modal",` - align-self: center; - color: var(--n-text-color); - margin: auto; - box-shadow: var(--n-box-shadow); - `,[vi({duration:".25s",enterScale:".5"})])]);const dk=Object.assign(Object.assign(Object.assign(Object.assign({},ze.props),{show:Boolean,unstableShowMask:{type:Boolean,default:!0},maskClosable:{type:Boolean,default:!0},preset:String,to:[String,Object],displayDirective:{type:String,default:"if"},transformOrigin:{type:String,default:"mouse"},zIndex:Number,autoFocus:{type:Boolean,default:!0},trapFocus:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0}}),Bc),{onEsc:Function,"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],onAfterEnter:Function,onBeforeLeave:Function,onAfterLeave:Function,onClose:Function,onPositiveClick:Function,onNegativeClick:Function,onMaskClick:Function,internalDialog:Boolean,internalAppear:{type:Boolean,default:void 0},overlayStyle:[String,Object],onBeforeHide:Function,onAfterHide:Function,onHide:Function});var Pv=oe({name:"Modal",inheritAttrs:!1,props:dk,setup(e){const t=W(null),{mergedClsPrefixRef:r,namespaceRef:o,inlineThemeDisabled:n}=lt(e),i=ze("Modal","-modal",ck,nk,e,r),a=xp(64),l=bp(),s=xi(),d=e.internalDialog?be(_v,null):null;function c(x){const{onUpdateShow:S,"onUpdate:show":E,onHide:y}=e;S&&Be(S,x),E&&Be(E,x),y&&!x&&y(x)}function u(){const{onClose:x}=e;x?Promise.resolve(x()).then(S=>{S!==!1&&c(!1)}):c(!1)}function f(){const{onPositiveClick:x}=e;x?Promise.resolve(x()).then(S=>{S!==!1&&c(!1)}):c(!1)}function h(){const{onNegativeClick:x}=e;x?Promise.resolve(x()).then(S=>{S!==!1&&c(!1)}):c(!1)}function p(){const{onBeforeLeave:x,onBeforeHide:S}=e;x&&Be(x),S&&S()}function b(){const{onAfterLeave:x,onAfterHide:S}=e;x&&Be(x),S&&S()}function g(x){var S;const{onMaskClick:E}=e;E&&E(x),e.maskClosable&&!((S=t.value)===null||S===void 0)&&S.contains(x.target)&&c(!1)}function v(x){var S;(S=e.onEsc)===null||S===void 0||S.call(e),e.closeOnEsc&&c(!1)}je(Cp,{getMousePosition:()=>{if(d){const{clickedRef:x,clickPositionRef:S}=d;if(x.value&&S.value)return S.value}return a.value?l.value:null},mergedClsPrefixRef:r,mergedThemeRef:i,isMountedRef:s,appearRef:Oe(e,"internalAppear"),transformOriginRef:Oe(e,"transformOrigin")});const w=L(()=>{const{common:{cubicBezierEaseOut:x},self:{boxShadow:S,color:E,textColor:y}}=i.value;return{"--n-bezier-ease-out":x,"--n-box-shadow":S,"--n-color":E,"--n-text-color":y}}),$=n?_t("theme-class",void 0,w,e):void 0;return{mergedClsPrefix:r,namespace:o,isMounted:s,containerRef:t,presetProps:L(()=>Vt(e,lk)),handleEsc:v,handleAfterLeave:b,handleClickoutside:g,handleBeforeLeave:p,doUpdateShow:c,handleNegativeClick:h,handlePositiveClick:f,handleCloseClick:u,cssVars:n?void 0:w,themeClass:$==null?void 0:$.themeClass,onRender:$==null?void 0:$.onRender}},render(){const{mergedClsPrefix:e}=this;return m(Ec,{to:this.to,show:this.show},{default:()=>{var t,r;return(t=this.onRender)===null||t===void 0||t.call(this),Cr(m("div",{role:"none",ref:"containerRef",class:[`${e}-modal-container`,this.themeClass,this.namespace],style:this.cssVars},this.unstableShowMask?m(At,{name:"fade-in-transition",key:"mask",appear:(r=this.internalAppear)!==null&&r!==void 0?r:this.isMounted},{default:()=>this.show?m("div",{"aria-hidden":!0,ref:"containerRef",class:`${e}-modal-mask`}):null}):null,m(sk,Object.assign({style:this.overlayStyle},this.$attrs,{ref:"bodyWrapper",displayDirective:this.displayDirective,show:this.show,preset:this.preset,autoFocus:this.autoFocus,trapFocus:this.trapFocus},this.presetProps,{onEsc:this.handleEsc,onClose:this.handleCloseClick,onNegativeClick:this.handleNegativeClick,onPositiveClick:this.handlePositiveClick,onBeforeLeave:this.handleBeforeLeave,onAfterEnter:this.onAfterEnter,onAfterLeave:this.handleAfterLeave,onClickoutside:this.handleClickoutside}),this.$slots)),[[qa,{zIndex:this.zIndex,enabled:this.show}]])}})}});const uk=Object.assign(Object.assign({},Qa),{closeOnEsc:{type:Boolean,default:!0},internalStyle:[String,Object],maskClosable:{type:Boolean,default:!0},onPositiveClick:Function,onNegativeClick:Function,onClose:Function,onMaskClick:Function}),fk=oe({name:"DialogEnvironment",props:Object.assign(Object.assign({},uk),{internalKey:{type:String,required:!0},to:[String,Object],onInternalAfterLeave:{type:Function,required:!0}}),setup(e){const t=W(!0);function r(){e.onInternalAfterLeave(e.internalKey)}function o(d){const{onPositiveClick:c}=e;c?Promise.resolve(c(d)).then(u=>{u!==!1&&l()}):l()}function n(d){const{onNegativeClick:c}=e;c?Promise.resolve(c(d)).then(u=>{u!==!1&&l()}):l()}function i(){const{onClose:d}=e;d?Promise.resolve(d()).then(c=>{c!==!1&&l()}):l()}function a(d){const{onMaskClick:c,maskClosable:u}=e;c&&(c(d),u&&l())}function l(){t.value=!1}function s(d){t.value=d}return{show:t,hide:l,handleUpdateShow:s,handleAfterLeave:r,handleCloseClick:i,handleNegativeClick:n,handlePositiveClick:o,handleMaskClick:a}},render(){const{handlePositiveClick:e,handleUpdateShow:t,handleNegativeClick:r,handleCloseClick:o,handleAfterLeave:n,handleMaskClick:i,to:a,maskClosable:l,show:s}=this;return m(Pv,{show:s,onUpdateShow:t,onMaskClick:i,to:a,maskClosable:l,onAfterLeave:n,closeOnEsc:this.closeOnEsc,internalAppear:!0,internalDialog:!0},{default:()=>m(Sv,Object.assign({},Vt(this.$props,wv),{style:this.internalStyle,onClose:o,onNegativeClick:r,onPositiveClick:e}))})}}),hk={injectionKey:String,to:[String,Object]},pk=oe({name:"DialogProvider",props:hk,setup(){const e=W([]),t={};function r(l={}){const s=dn(),d=ar(Object.assign(Object.assign({},l),{key:s,destroy:()=>{t[`n-dialog-${s}`].hide()}}));return e.value.push(d),d}const o=["info","success","warning","error"].map(l=>s=>r(Object.assign(Object.assign({},s),{type:l})));function n(l){const{value:s}=e;s.splice(s.findIndex(d=>d.key===l),1)}function i(){Object.values(t).forEach(l=>l.hide())}const a={create:r,destroyAll:i,info:o[0],success:o[1],warning:o[2],error:o[3]};return je(rk,a),je(_v,{clickedRef:xp(64),clickPositionRef:bp()}),Object.assign(Object.assign({},a),{dialogList:e,dialogInstRefs:t,handleAfterLeave:n})},render(){var e,t;return m(ot,null,[this.dialogList.map(r=>m(fk,sc(r,["destroy","style"],{internalStyle:r.style,to:this.to,ref:o=>{o===null?delete this.dialogInstRefs[`n-dialog-${r.key}`]:this.dialogInstRefs[`n-dialog-${r.key}`]=o},internalKey:r.key,onInternalAfterLeave:this.handleAfterLeave}))),(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e)])}}),kv=e=>{const{textColor1:t,dividerColor:r,fontWeightStrong:o}=e;return{textColor:t,color:r,fontWeight:o}},mk={name:"Divider",common:Ke,self:kv};var vO=mk;const vk={name:"Divider",common:de,self:kv};var gk=vk;const bk=e=>{const{modalColor:t,textColor1:r,textColor2:o,boxShadow3:n,lineHeight:i,fontWeightStrong:a,dividerColor:l,closeColor:s,closeColorHover:d,closeColorPressed:c}=e;return{bodyPadding:"16px 24px",headerPadding:"16px 24px",footerPadding:"16px 24px",color:t,textColor:o,titleTextColor:r,titleFontSize:"18px",titleFontWeight:a,boxShadow:n,lineHeight:i,headerBorderBottom:`1px solid ${l}`,footerBorderTop:`1px solid ${l}`,closeColor:s,closeColorHover:d,closeColorPressed:c,closeSize:"18px"}},xk={name:"Drawer",common:de,peers:{Scrollbar:Ut},self:bk};var Ck=xk,yk={actionMargin:"0 0 0 20px"};const wk={name:"DynamicInput",common:de,peers:{Input:ur,Button:qt},self(){return yk}};var Sk=wk,Tv={gapSmall:"4px 8px",gapMedium:"8px 12px",gapLarge:"12px 16px"};const _k={name:"Space",self(){return Tv}};var Ev=_k;const $k=()=>Tv,Pk={name:"Space",self:$k};var kk=Pk;const Tk=Object.assign(Object.assign({},ze.props),{align:String,justify:{type:String,default:"start"},inline:Boolean,vertical:Boolean,size:{type:[String,Number,Array],default:"medium"},itemStyle:[String,Object],wrap:{type:Boolean,default:!0}});var Ek=oe({name:"Space",props:Tk,setup(e){const{mergedClsPrefixRef:t,mergedRtlRef:r}=lt(e),o=ze("Space","-space",void 0,kk,e,t);return{rtlEnabled:Pn("Space",r,t),mergedClsPrefix:t,margin:L(()=>{const{size:i}=e;if(Array.isArray(i))return{horizontal:i[0],vertical:i[1]};if(typeof i=="number")return{horizontal:i,vertical:i};const{self:{[ae("gap",i)]:a}}=o.value,{row:l,col:s}=CC(a);return{horizontal:tu(s),vertical:tu(l)}})}},render(){const{vertical:e,align:t,inline:r,justify:o,itemStyle:n,margin:i,wrap:a,mergedClsPrefix:l,rtlEnabled:s}=this,d=So(EC(this));if(!d.length)return null;const c=`${i.horizontal}px`,u=`${i.horizontal/2}px`,f=`${i.vertical}px`,h=`${i.vertical/2}px`,p=d.length-1,b=o.startsWith("space-");return m("div",{role:"none",class:[`${l}-space`,s&&`${l}-space--rtl`],style:{display:r?"inline-flex":"flex",flexDirection:e?"column":"row",justifyContent:["start","end"].includes(o)?"flex-"+o:o,flexWrap:!a||e?"nowrap":"wrap",marginTop:e?"":`-${h}`,marginBottom:e?"":`-${h}`,alignItems:t}},d.map((g,v)=>m("div",{role:"none",style:[n,{maxWidth:"100%"},e?{marginBottom:v!==p?f:""}:s?{marginLeft:b?o==="space-between"&&v===p?"":u:v!==p?c:"",marginRight:b?o==="space-between"&&v===0?"":u:"",paddingTop:h,paddingBottom:h}:{marginRight:b?o==="space-between"&&v===p?"":u:v!==p?c:"",marginLeft:b?o==="space-between"&&v===0?"":u:"",paddingTop:h,paddingBottom:h}]},g)))}});const Rk={name:"DynamicTags",common:de,peers:{Input:ur,Button:qt,Tag:Lm,Space:Ev},self(){return{inputWidth:"64px"}}};var zk=Rk;const Ak={name:"Element",common:de};var Ok=Ak,Ik={feedbackPadding:"4px 0 0 2px",feedbackHeightSmall:"24px",feedbackHeightMedium:"24px",feedbackHeightLarge:"26px",feedbackFontSizeSmall:"13px",feedbackFontSizeMedium:"14px",feedbackFontSizeLarge:"14px",labelFontSizeLeftSmall:"14px",labelFontSizeLeftMedium:"14px",labelFontSizeLeftLarge:"15px",labelFontSizeTopSmall:"13px",labelFontSizeTopMedium:"14px",labelFontSizeTopLarge:"14px",labelHeightSmall:"24px",labelHeightMedium:"26px",labelHeightLarge:"28px",labelPaddingVertical:"0 0 8px 2px",labelPaddingHorizontal:"0 12px 0 0",labelTextAlignVertical:"left",labelTextAlignHorizontal:"right"};const Rv=e=>{const{heightSmall:t,heightMedium:r,heightLarge:o,textColor1:n,errorColor:i,warningColor:a,lineHeight:l,textColor3:s}=e;return Object.assign(Object.assign({},Ik),{blankHeightSmall:t,blankHeightMedium:r,blankHeightLarge:o,lineHeight:l,labelTextColor:n,asteriskColor:i,feedbackTextColorError:i,feedbackTextColorWarning:a,feedbackTextColor:s})},Mk={name:"Form",common:Ke,self:Rv};var zv=Mk;const Bk={name:"Form",common:de,self:Rv};var Lk=Bk,Dk=M("form",[K("inline",` - width: 100%; - display: inline-flex; - align-items: flex-start; - align-content: space-around; - `,[M("form-item",{width:"auto",marginRight:"18px"},[z("&:last-child",{marginRight:0})])])]);const Pi="n-form",Av="n-form-item-insts";var Fk=globalThis&&globalThis.__awaiter||function(e,t,r,o){function n(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function l(c){try{d(o.next(c))}catch(u){a(u)}}function s(c){try{d(o.throw(c))}catch(u){a(u)}}function d(c){c.done?i(c.value):n(c.value).then(l,s)}d((o=o.apply(e,t||[])).next())})};const Hk=Object.assign(Object.assign({},ze.props),{inline:Boolean,labelWidth:[Number,String],labelAlign:String,labelPlacement:{type:String,default:"top"},model:{type:Object,default:()=>{}},rules:Object,disabled:Boolean,size:String,showRequireMark:{type:Boolean,default:void 0},requireMarkPlacement:String,showFeedback:{type:Boolean,default:!0},onSubmit:{type:Function,default:e=>e.preventDefault()},showLabel:{type:Boolean,default:void 0},validateMessages:Object});var jk=oe({name:"Form",props:Hk,setup(e){const{mergedClsPrefixRef:t}=lt(e);ze("Form","-form",Dk,zv,e,t);const r={},o=W(void 0),n=s=>{const d=o.value;(d===void 0||s>=d)&&(o.value=s)};function i(s,d=()=>!0){return Fk(this,void 0,void 0,function*(){return yield new Promise((c,u)=>{const f=[];for(const h of er(r)){const p=r[h];for(const b of p)b.path&&f.push(b.internalValidate(null,d))}Promise.all(f).then(h=>{if(h.some(p=>!p.valid)){const p=h.filter(b=>b.errors).map(b=>b.errors);s&&s(p),u(p)}else s&&s(),c()})})})}function a(){for(const s of er(r)){const d=r[s];for(const c of d)c.restoreValidation()}}return je(Pi,{props:e,maxChildLabelWidthRef:o,deriveMaxChildLabelWidth:n}),je(Av,{formItems:r}),Object.assign({validate:i,restoreValidation:a},{mergedClsPrefix:t})},render(){const{mergedClsPrefix:e}=this;return m("form",{class:[`${e}-form`,this.inline&&`${e}-form--inline`],onSubmit:this.onSubmit},this.$slots)}});function xo(){return xo=Object.assign||function(e){for(var t=1;t1?t-1:0),o=1;o=i)return l;switch(l){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}break;default:return l}});return a}return e}function qk(e){return e==="string"||e==="url"||e==="hex"||e==="email"||e==="date"||e==="pattern"}function xt(e,t){return!!(e==null||t==="array"&&Array.isArray(e)&&!e.length||qk(t)&&typeof e=="string"&&!e)}function Gk(e,t,r){var o=[],n=0,i=e.length;function a(l){o.push.apply(o,l||[]),n++,n===i&&r(o)}e.forEach(function(l){t(l,a)})}function of(e,t,r){var o=0,n=e.length;function i(a){if(a&&a.length){r(a);return}var l=o;o=o+1,l()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},Wn={integer:function(t){return Wn.number(t)&&parseInt(t,10)===t},float:function(t){return Wn.number(t)&&!Wn.integer(t)},array:function(t){return Array.isArray(t)},regexp:function(t){if(t instanceof RegExp)return!0;try{return!!new RegExp(t)}catch{return!1}},date:function(t){return typeof t.getTime=="function"&&typeof t.getMonth=="function"&&typeof t.getYear=="function"&&!isNaN(t.getTime())},number:function(t){return isNaN(t)?!1:typeof t=="number"},object:function(t){return typeof t=="object"&&!Wn.array(t)},method:function(t){return typeof t=="function"},email:function(t){return typeof t=="string"&&t.length<=320&&!!t.match(Rl.email)},url:function(t){return typeof t=="string"&&t.length<=2048&&!!t.match(Rl.url)},hex:function(t){return typeof t=="string"&&!!t.match(Rl.hex)}},e8=function(t,r,o,n,i){if(t.required&&r===void 0){Ov(t,r,o,n,i);return}var a=["integer","float","array","regexp","object","method","email","number","date","url","hex"],l=t.type;a.indexOf(l)>-1?Wn[l](r)||n.push(Wt(i.messages.types[l],t.fullField,t.type)):l&&typeof r!==t.type&&n.push(Wt(i.messages.types[l],t.fullField,t.type))},t8=function(t,r,o,n,i){var a=typeof t.len=="number",l=typeof t.min=="number",s=typeof t.max=="number",d=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,c=r,u=null,f=typeof r=="number",h=typeof r=="string",p=Array.isArray(r);if(f?u="number":h?u="string":p&&(u="array"),!u)return!1;p&&(c=r.length),h&&(c=r.replace(d,"_").length),a?c!==t.len&&n.push(Wt(i.messages[u].len,t.fullField,t.len)):l&&!s&&ct.max?n.push(Wt(i.messages[u].max,t.fullField,t.max)):l&&s&&(ct.max)&&n.push(Wt(i.messages[u].range,t.fullField,t.min,t.max))},No="enum",r8=function(t,r,o,n,i){t[No]=Array.isArray(t[No])?t[No]:[],t[No].indexOf(r)===-1&&n.push(Wt(i.messages[No],t.fullField,t[No].join(", ")))},o8=function(t,r,o,n,i){if(t.pattern){if(t.pattern instanceof RegExp)t.pattern.lastIndex=0,t.pattern.test(r)||n.push(Wt(i.messages.pattern.mismatch,t.fullField,r,t.pattern));else if(typeof t.pattern=="string"){var a=new RegExp(t.pattern);a.test(r)||n.push(Wt(i.messages.pattern.mismatch,t.fullField,r,t.pattern))}}},He={required:Ov,whitespace:Qk,type:e8,range:t8,enum:r8,pattern:o8},n8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r,"string")&&!t.required)return o();He.required(t,r,n,a,i,"string"),xt(r,"string")||(He.type(t,r,n,a,i),He.range(t,r,n,a,i),He.pattern(t,r,n,a,i),t.whitespace===!0&&He.whitespace(t,r,n,a,i))}o(a)},i8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r)&&!t.required)return o();He.required(t,r,n,a,i),r!==void 0&&He.type(t,r,n,a,i)}o(a)},a8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(r===""&&(r=void 0),xt(r)&&!t.required)return o();He.required(t,r,n,a,i),r!==void 0&&(He.type(t,r,n,a,i),He.range(t,r,n,a,i))}o(a)},l8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r)&&!t.required)return o();He.required(t,r,n,a,i),r!==void 0&&He.type(t,r,n,a,i)}o(a)},s8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r)&&!t.required)return o();He.required(t,r,n,a,i),xt(r)||He.type(t,r,n,a,i)}o(a)},c8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r)&&!t.required)return o();He.required(t,r,n,a,i),r!==void 0&&(He.type(t,r,n,a,i),He.range(t,r,n,a,i))}o(a)},d8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r)&&!t.required)return o();He.required(t,r,n,a,i),r!==void 0&&(He.type(t,r,n,a,i),He.range(t,r,n,a,i))}o(a)},u8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(r==null&&!t.required)return o();He.required(t,r,n,a,i,"array"),r!=null&&(He.type(t,r,n,a,i),He.range(t,r,n,a,i))}o(a)},f8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r)&&!t.required)return o();He.required(t,r,n,a,i),r!==void 0&&He.type(t,r,n,a,i)}o(a)},h8="enum",p8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r)&&!t.required)return o();He.required(t,r,n,a,i),r!==void 0&&He[h8](t,r,n,a,i)}o(a)},m8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r,"string")&&!t.required)return o();He.required(t,r,n,a,i),xt(r,"string")||He.pattern(t,r,n,a,i)}o(a)},v8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r,"date")&&!t.required)return o();if(He.required(t,r,n,a,i),!xt(r,"date")){var s;r instanceof Date?s=r:s=new Date(r),He.type(t,s,n,a,i),s&&He.range(t,s.getTime(),n,a,i)}}o(a)},g8=function(t,r,o,n,i){var a=[],l=Array.isArray(r)?"array":typeof r;He.required(t,r,n,a,i,l),o(a)},zl=function(t,r,o,n,i){var a=t.type,l=[],s=t.required||!t.required&&n.hasOwnProperty(t.field);if(s){if(xt(r,a)&&!t.required)return o();He.required(t,r,n,l,i,a),xt(r,a)||He.type(t,r,n,l,i)}o(l)},b8=function(t,r,o,n,i){var a=[],l=t.required||!t.required&&n.hasOwnProperty(t.field);if(l){if(xt(r)&&!t.required)return o();He.required(t,r,n,a,i)}o(a)},Qn={string:n8,method:i8,number:a8,boolean:l8,regexp:s8,integer:c8,float:d8,array:u8,object:f8,enum:p8,pattern:m8,date:v8,url:zl,hex:zl,email:zl,required:g8,any:b8};function ks(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var t=JSON.parse(JSON.stringify(this));return t.clone=this.clone,t}}}var Ts=ks(),ki=function(){function e(r){this.rules=null,this._messages=Ts,this.define(r)}var t=e.prototype;return t.define=function(o){var n=this;if(!o)throw new Error("Cannot configure a schema with no rules");if(typeof o!="object"||Array.isArray(o))throw new Error("Rules must be an object");this.rules={},Object.keys(o).forEach(function(i){var a=o[i];n.rules[i]=Array.isArray(a)?a:[a]})},t.messages=function(o){return o&&(this._messages=lf(ks(),o)),this._messages},t.validate=function(o,n,i){var a=this;n===void 0&&(n={}),i===void 0&&(i=function(){});var l=o,s=n,d=i;if(typeof s=="function"&&(d=s,s={}),!this.rules||Object.keys(this.rules).length===0)return d&&d(null,l),Promise.resolve(l);function c(b){var g=[],v={};function w(x){if(Array.isArray(x)){var S;g=(S=g).concat.apply(S,x)}else g.push(x)}for(var $=0;$e.size!==void 0?e.size:(t==null?void 0:t.props.size)!==void 0?t.props.size:"medium")}}function C8(e){const t=be(Pi,null),r=L(()=>{if(o.value==="top")return;const{labelWidth:f}=e;if(f!==void 0&&f!=="auto")return Qt(f);if(f==="auto"||(t==null?void 0:t.props.labelWidth)==="auto"){const h=t==null?void 0:t.maxChildLabelWidthRef.value;return h!==void 0?Qt(h):void 0}if((t==null?void 0:t.props.labelWidth)!==void 0)return Qt(t.props.labelWidth)}),o=L(()=>{const{labelPlacement:f}=e;return f!==void 0?f:t!=null&&t.props.labelPlacement?t.props.labelPlacement:"top"}),n=L(()=>{const{labelAlign:f}=e;if(f)return f;if(t!=null&&t.props.labelAlign)return t.props.labelAlign}),i=L(()=>{var f;return[(f=e.labelProps)===null||f===void 0?void 0:f.style,e.labelStyle,{width:r.value}]}),a=L(()=>{const{showRequireMark:f}=e;return f!==void 0?f:t==null?void 0:t.props.showRequireMark}),l=L(()=>{const{requireMarkPlacement:f}=e;return f!==void 0?f:(t==null?void 0:t.props.requireMarkPlacement)||"right"}),s=W(!1),d=L(()=>{const{validationStatus:f}=e;if(f!==void 0)return f;if(s.value)return"error"}),c=L(()=>{const{showFeedback:f}=e;return f!==void 0?f:(t==null?void 0:t.props.showFeedback)!==void 0?t.props.showFeedback:!0}),u=L(()=>{const{showLabel:f}=e;return f!==void 0?f:(t==null?void 0:t.props.showLabel)!==void 0?t.props.showLabel:!0});return{validationErrored:s,mergedLabelStyle:i,mergedLabelPlacement:o,mergedLabelAlign:n,mergedShowRequireMark:a,mergedRequireMarkPlacement:l,mergedValidationStatus:d,mergedShowFeedback:c,mergedShowLabel:u}}function y8(e){const t=be(Pi,null),r=L(()=>{const{rulePath:a}=e;if(a!==void 0)return a;const{path:l}=e;if(l!==void 0)return l}),o=L(()=>{const a=[],{rule:l}=e;if(l!==void 0&&(Array.isArray(l)?a.push(...l):a.push(l)),t){const{rules:s}=t.props,{value:d}=r;if(s!==void 0&&d!==void 0){const c=Pc(s,d);c!==void 0&&(Array.isArray(c)?a.push(...c):a.push(c))}}return a}),n=L(()=>o.value.some(a=>a.required)),i=L(()=>n.value||e.required);return{mergedRules:o,mergedRequired:i}}var w8=oe({name:"FormItemFeedback",props:{clsPrefix:{type:String,required:!0},explains:Array,feedback:String},render(){var e;const{$slots:t,feedback:r,clsPrefix:o}=this;return t.default?t.default():r?m("div",{key:r,class:`${o}-form-item-feedback__line`},r):(e=this.explains)===null||e===void 0?void 0:e.map(n=>m("div",{key:n,class:`${o}-form-item-feedback__line`},n))}});const{cubicBezierEaseInOut:sf}=yr;function S8({name:e="fade-down",fromOffset:t="-4px",enterDuration:r=".3s",leaveDuration:o=".3s",enterCubicBezier:n=sf,leaveCubicBezier:i=sf}={}){return[z(`&.${e}-transition-enter-from, &.${e}-transition-leave-to`,{opacity:0,transform:`translateY(${t})`}),z(`&.${e}-transition-enter-to, &.${e}-transition-leave-from`,{opacity:1,transform:"translateY(0)"}),z(`&.${e}-transition-leave-active`,{transition:`opacity ${o} ${i}, transform ${o} ${i}`}),z(`&.${e}-transition-enter-active`,{transition:`opacity ${r} ${n}, transform ${r} ${n}`})]}var _8=M("form-item",{display:"grid",lineHeight:"var(--n-line-height)"},[M("form-item-label",` - grid-area: label; - align-items: center; - line-height: 1.25; - text-align: var(--n-label-text-align); - font-size: var(--n-label-font-size); - height: var(--n-label-height); - padding: var(--n-label-padding); - color: var(--n-label-text-color); - transition: color .3s var(--n-bezier); - box-sizing: border-box; - `,[F("asterisk",` - color: var(--n-asterisk-color); - transition: color .3s var(--n-bezier); - `),F("asterisk-placeholder",` - visibility: hidden; - `)]),M("form-item-blank",{gridArea:"blank",minHeight:"var(--n-blank-height)"}),K("left-labelled",` - grid-template-areas: - "label blank" - "label feedback"; - grid-template-columns: auto minmax(0, 1fr); - `,[M("form-item-label",` - height: var(--n-blank-height); - line-height: var(--n-blank-height); - box-sizing: border-box; - white-space: nowrap; - flex-shrink: 0; - flex-grow: 0; - `)]),K("top-labelled",` - grid-template-areas: - "label" - "blank" - "feedback"; - grid-template-rows: var(--n-label-height) 1fr; - grid-template-columns: minmax(0, 100%); - `,[K("no-label",` - grid-template-areas: - "blank" - "feedback"; - grid-template-rows: 1fr; - `),M("form-item-label",{display:"flex",alignItems:"flex-end",justifyContent:"var(--n-label-text-align)"})]),M("form-item-blank",` - box-sizing: border-box; - display: flex; - align-items: center; - position: relative; - `),M("form-item-feedback-wrapper",` - grid-area: feedback; - box-sizing: border-box; - min-height: var(--n-feedback-height); - font-size: var(--n-feedback-font-size); - line-height: 1.25; - transform-origin: top left; - `,[z("&:not(:empty)",` - padding: var(--n-feedback-padding); - `),M("form-item-feedback",{transition:"color .3s var(--n-bezier)",color:"var(--n-feedback-text-color)"},[K("warning",{color:"var(--n-feedback-text-color-warning)"}),K("error",{color:"var(--n-feedback-text-color-error)"}),S8({fromOffset:"-3px",enterDuration:".3s",leaveDuration:".2s"})])])]),cf=globalThis&&globalThis.__awaiter||function(e,t,r,o){function n(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function l(c){try{d(o.next(c))}catch(u){a(u)}}function s(c){try{d(o.throw(c))}catch(u){a(u)}}function d(c){c.done?i(c.value):n(c.value).then(l,s)}d((o=o.apply(e,t||[])).next())})};const Lc=Object.assign(Object.assign({},ze.props),{label:String,labelWidth:[Number,String],labelStyle:[String,Object],labelAlign:String,labelPlacement:String,path:String,first:Boolean,rulePath:String,required:Boolean,showRequireMark:{type:Boolean,default:void 0},requireMarkPlacement:String,showFeedback:{type:Boolean,default:void 0},rule:[Object,Array],size:String,ignorePathChange:Boolean,validationStatus:String,feedback:String,showLabel:{type:Boolean,default:void 0},labelProps:Object}),$8=er(Lc);function df(e,t){return(...r)=>{try{const o=e(...r);return!t&&(typeof o=="boolean"||o instanceof Error||Array.isArray(o))||(o==null?void 0:o.then)?o:(o===void 0||Kr("form-item/validate",`You return a ${typeof o} typed value in the validator method, which is not recommended. Please use `+(t?"`Promise`":"`boolean`, `Error` or `Promise`")+" typed value instead."),!0)}catch(o){Kr("form-item/validate","An error is catched in the validation, so the validation won't be done. Your callback in `validate` method of `n-form` or `n-form-item` won't be called in this validation."),console.error(o);return}}}var P8=oe({name:"FormItem",props:Lc,setup(e){hy(Av,"formItems",Oe(e,"path"));const{mergedClsPrefixRef:t,inlineThemeDisabled:r}=lt(e),o=be(Pi,null),n=x8(e),i=C8(e),{validationErrored:a}=i,{mergedRequired:l,mergedRules:s}=y8(e),{mergedSize:d}=n,{mergedLabelPlacement:c,mergedLabelAlign:u}=i,f=W([]),h=W(dn()),p=L(()=>{const{feedback:T}=e;return T!=null?!0:f.value.length}),b=o?Oe(o.props,"disabled"):W(!1),g=ze("Form","-form-item",_8,zv,e,t);qe(Oe(e,"path"),()=>{e.ignorePathChange||v()});function v(){f.value=[],a.value=!1,e.feedback&&(h.value=dn())}function w(){y("blur")}function $(){y("change")}function x(){y("focus")}function S(){y("input")}function E(T,N){return cf(this,void 0,void 0,function*(){let B,q,A,te;return typeof T=="string"?(B=T,q=N):T!==null&&typeof T=="object"&&(B=T.trigger,q=T.callback,A=T.shouldRuleBeApplied,te=T.options),yield new Promise((se,_e)=>{y(B,A,te).then(({valid:Ae,errors:Re})=>{Ae?(q&&q(),se()):(q&&q(Re),_e(Re))})})})}const y=(T=null,N=()=>!0,B={suppressWarning:!0})=>cf(this,void 0,void 0,function*(){const{path:q}=e;B?B.first||(B.first=e.first):B={};const{value:A}=s,te=o?Pc(o.props.model,q||""):void 0,se=(T?A.filter(Ee=>Array.isArray(Ee.trigger)?Ee.trigger.includes(T):Ee.trigger===T):A).filter(N).map(Ee=>{const $e=Object.assign({},Ee);return $e.validator&&($e.validator=df($e.validator,!1)),$e.asyncValidator&&($e.asyncValidator=df($e.asyncValidator,!0)),$e});if(!se.length)return yield Promise.resolve({valid:!0});const _e=q!=null?q:"__n_no_path__",Ae=new ki({[_e]:se}),{validateMessages:Re}=(o==null?void 0:o.props)||{};return Re&&Ae.messages(Re),yield new Promise(Ee=>{Ae.validate({[_e]:te},B,($e,it)=>{$e!=null&&$e.length?(f.value=$e.map(O=>(O==null?void 0:O.message)||""),a.value=!0,Ee({valid:!1,errors:$e})):(v(),Ee({valid:!0}))})})});je(ss,{path:Oe(e,"path"),disabled:b,mergedSize:n.mergedSize,mergedValidationStatus:i.mergedValidationStatus,restoreValidation:v,handleContentBlur:w,handleContentChange:$,handleContentFocus:x,handleContentInput:S});const _={validate:E,restoreValidation:v,internalValidate:y},R=W(null);Ot(()=>{R.value!==null&&(o==null||o.deriveMaxChildLabelWidth(Number(getComputedStyle(R.value).width.slice(0,-2))))});const P=L(()=>{var T;const{value:N}=d,{value:B}=c,q=B==="top"?"vertical":"horizontal",{common:{cubicBezierEaseInOut:A},self:{labelTextColor:te,asteriskColor:se,lineHeight:_e,feedbackTextColor:Ae,feedbackTextColorWarning:Re,feedbackTextColorError:Ee,feedbackPadding:$e,[ae("labelHeight",N)]:it,[ae("blankHeight",N)]:O,[ae("feedbackFontSize",N)]:V,[ae("feedbackHeight",N)]:D,[ae("labelPadding",q)]:ce,[ae("labelTextAlign",q)]:ue,[ae(ae("labelFontSize",B),N)]:xe}}=g.value;let G=(T=u.value)!==null&&T!==void 0?T:ue;return B==="top"&&(G=G==="right"?"flex-end":"flex-start"),{"--n-bezier":A,"--n-line-height":_e,"--n-blank-height":O,"--n-label-font-size":xe,"--n-label-text-align":G,"--n-label-height":it,"--n-label-padding":ce,"--n-asterisk-color":se,"--n-label-text-color":te,"--n-feedback-padding":$e,"--n-feedback-font-size":V,"--n-feedback-height":D,"--n-feedback-text-color":Ae,"--n-feedback-text-color-warning":Re,"--n-feedback-text-color-error":Ee}}),j=_t("form-item",L(()=>{var T;return`${d.value[0]}${c.value[0]}${((T=u.value)===null||T===void 0?void 0:T[0])||""}`}),P,e);return Object.assign(Object.assign(Object.assign(Object.assign({labelElementRef:R,mergedClsPrefix:t,mergedRequired:l,hasFeedback:p,feedbackId:h,explains:f},i),n),_),{cssVars:r?void 0:P,themeClass:j==null?void 0:j.themeClass,onRender:j==null?void 0:j.onRender})},render(){var e;const{$slots:t,mergedClsPrefix:r,mergedShowLabel:o,mergedShowRequireMark:n,mergedRequireMarkPlacement:i,onRender:a}=this,l=n!==void 0?n:this.mergedRequired;return a==null||a(),m("div",{class:[`${r}-form-item`,this.themeClass,`${r}-form-item--${this.mergedSize}-size`,`${r}-form-item--${this.mergedLabelPlacement}-labelled`,!o&&`${r}-form-item--no-label`],style:this.cssVars},o&&(this.label||t.label)?m("label",Object.assign({},this.labelProps,{class:[(e=this.labelProps)===null||e===void 0?void 0:e.class,`${r}-form-item-label`],style:this.mergedLabelStyle,ref:"labelElementRef"}),i!=="left"?t.label?t.label():this.label:null,l?m("span",{class:`${r}-form-item-label__asterisk`},i!=="left"?"\xA0*":"*\xA0"):i==="right-hanging"&&m("span",{class:`${r}-form-item-label__asterisk-placeholder`},"\xA0*"),i==="left"?t.label?t.label():this.label:null):null,m("div",{class:[`${r}-form-item-blank`,this.mergedValidationStatus&&`${r}-form-item-blank--${this.mergedValidationStatus}`]},t),this.mergedShowFeedback?m("div",{key:this.feedbackId,class:`${r}-form-item-feedback-wrapper`},m(At,{name:"fade-down-transition",mode:"out-in"},{default:()=>{const s=m(w8,{clsPrefix:r,explains:this.explains,feedback:this.feedback},{default:t.feedback}),{hasFeedback:d,mergedValidationStatus:c}=this;return d||t.feedback?c==="warning"?m("div",{key:"controlled-warning",class:`${r}-form-item-feedback ${r}-form-item-feedback--warning`},s):c==="error"?m("div",{key:"controlled-error",class:`${r}-form-item-feedback ${r}-form-item-feedback--error`},s):c==="success"?m("div",{key:"controlled-success",class:`${r}-form-item-feedback ${r}-form-item-feedback--success`},s):m("div",{key:"controlled-default",class:`${r}-form-item-feedback`},s):null}})):null)}});const k8=Array.apply(null,{length:24}).map((e,t)=>{const r=t+1,o=`calc(100% / 24 * ${r})`;return[K(`${r}-span`,{width:o}),K(`${r}-offset`,{marginLeft:o}),K(`${r}-push`,{left:o}),K(`${r}-pull`,{right:o})]});var T8=z([M("row",{width:"100%",display:"flex",flexWrap:"wrap"}),M("col",{verticalAlign:"top",boxSizing:"border-box",display:"inline-block",position:"relative",zIndex:"auto"},[F("box",{position:"relative",zIndex:"auto",width:"100%",height:"100%"}),k8])]);const Iv="n-row",Dc={gutter:{type:[Array,Number,String],default:0},alignItems:String,justifyContent:String},E8=er(Dc);var R8=oe({name:"Row",props:Dc,setup(e){const{mergedClsPrefixRef:t}=lt(e);Jr("-legacy-grid",T8,t);const r=ht(()=>{const{gutter:n}=e;return Array.isArray(n)&&n[1]||0}),o=ht(()=>{const{gutter:n}=e;return Array.isArray(n)?n[0]:Number(n)});return je(Iv,{mergedClsPrefixRef:t,gutterRef:Oe(e,"gutter"),verticalGutterRef:r,horizontalGutterRef:o}),{mergedClsPrefix:t,styleMargin:ht(()=>`-${Qt(r.value,{c:.5})} -${Qt(o.value,{c:.5})}`),styleWidth:ht(()=>`calc(100% + ${Qt(o.value)})`)}},render(){return m("div",{class:`${this.mergedClsPrefix}-row`,style:{margin:this.styleMargin,width:this.styleWidth,alignItems:this.alignItems,justifyContent:this.justifyContent}},this.$slots)}});const Fc={span:{type:[String,Number],default:1},push:{type:[String,Number],default:0},pull:{type:[String,Number],default:0},offset:{type:[String,Number],default:0}},z8=er(Fc);var A8=oe({name:"Col",props:Fc,setup(e){const t=be(Iv,null);return t||Da("col","`n-col` must be placed inside `n-row`."),{mergedClsPrefix:t.mergedClsPrefixRef,gutter:t.gutterRef,stylePadding:L(()=>`${Qt(t.verticalGutterRef.value,{c:.5})} ${Qt(t.horizontalGutterRef.value,{c:.5})}`),mergedPush:L(()=>Number(e.push)-Number(e.pull))}},render(){const{$slots:e,span:t,mergedPush:r,offset:o,stylePadding:n,gutter:i,mergedClsPrefix:a}=this;return m("div",{class:[`${a}-col`,{[`${a}-col--${t}-span`]:!0,[`${a}-col--${r}-push`]:r>0,[`${a}-col--${-r}-pull`]:r<0,[`${a}-col--${o}-offset`]:o}],style:{padding:n}},i?m("div",null,e):e)}});const Hc=Object.assign(Object.assign({},Fc),Lc),O8=er(Hc);var I8=oe({name:"FormItemCol",props:Hc,setup(){const e=W(null);return{formItemInstRef:e,validate:(...o)=>{const{value:n}=e;if(n)return n.validate(...o)},restoreValidation:()=>{const{value:o}=e;if(o)return o.restoreValidation()}}},render(){return m(A8,Vt(this.$props,z8),{default:()=>{const e=Vt(this.$props,$8);return m(P8,Object.assign({ref:"formItemInstRef"},e),this.$slots)}})}});const M8=Object.assign(Object.assign({},Dc),Hc);var B8=oe({name:"FormItemRow",props:M8,setup(){const e=W(null);return{formItemColInstRef:e,validate:(...o)=>{const{value:n}=e;if(n)return n.validate(...o)},restoreValidation:()=>{const{value:o}=e;if(o)return o.restoreValidation()}}},render(){return m(R8,Vt(this.$props,E8),{default:()=>{const e=Vt(this.$props,O8);return m(I8,Object.assign(Object.assign({ref:"formItemColInstRef"},e),{span:24}),this.$slots)}})}}),L8=oe({name:"GlobalStyle",setup(){if(typeof document=="undefined")return;const e=be(Gr,null),{body:t}=document,{style:r}=t;let o=!1,n=!0;Yr(()=>{xr(()=>{var i,a;const{textColor2:l,fontSize:s,fontFamily:d,bodyColor:c,cubicBezierEaseInOut:u,lineHeight:f}=e?Xo({},((i=e.mergedThemeRef.value)===null||i===void 0?void 0:i.common)||Ke,(a=e.mergedThemeOverridesRef.value)===null||a===void 0?void 0:a.common):Ke;if(o||!t.hasAttribute("n-styled")){r.backgroundColor=c,r.color=l,r.fontSize=s,r.fontFamily=d,r.lineHeight=f;const h=`color .3s ${u}, background-color .3s ${u}`;n?setTimeout(()=>{r.transition=h},0):r.transition=h,t.setAttribute("n-styled",""),o=!0,n=!1}})}),Xs(()=>{o&&t.removeAttribute("n-styled")})},render(){return null}});const D8={name:"GradientText",common:de,self(e){const{primaryColor:t,successColor:r,warningColor:o,errorColor:n,infoColor:i,primaryColorSuppl:a,successColorSuppl:l,warningColorSuppl:s,errorColorSuppl:d,infoColorSuppl:c,fontWeightStrong:u}=e;return{fontWeight:u,rotate:"252deg",colorStartPrimary:t,colorEndPrimary:a,colorStartInfo:i,colorEndInfo:c,colorStartWarning:o,colorEndWarning:s,colorStartError:n,colorEndError:d,colorStartSuccess:r,colorEndSuccess:l}}};var F8=D8;const H8=e=>{const{primaryColor:t,baseColor:r}=e;return{color:t,iconColor:r}},j8={name:"IconWrapper",common:de,self:H8};var N8=j8;function W8(){return{toolbarIconColor:"rgba(255, 255, 255, .9)",toolbarColor:"rgba(0, 0, 0, .35)",toolbarBoxShadow:"none",toolbarBorderRadius:"24px"}}const V8={name:"Image",common:Ke,peers:{Tooltip:Ic},self:W8},K8={name:"InputNumber",common:de,peers:{Button:qt,Input:ur},self(e){const{textColorDisabled:t}=e;return{iconColorDisabled:t}}};var U8=K8;const q8={name:"Layout",common:de,peers:{Scrollbar:Ut},self(e){const{textColor2:t,bodyColor:r,popoverColor:o,cardColor:n,dividerColor:i,scrollbarColor:a,scrollbarColorHover:l}=e;return{textColor:t,textColorInverted:t,color:r,colorEmbedded:r,headerColor:n,headerColorInverted:n,footerColor:n,footerColorInverted:n,headerBorderColor:i,headerBorderColorInverted:i,footerBorderColor:i,footerBorderColorInverted:i,siderBorderColor:i,siderBorderColorInverted:i,siderColor:n,siderColorInverted:n,siderToggleButtonBorder:"1px solid transparent",siderToggleButtonColor:o,siderToggleButtonIconColor:t,siderToggleButtonIconColorInverted:t,siderToggleBarColor:ye(r,a),siderToggleBarColorHover:ye(r,l),__invertScrollbar:"false"}}};var G8=q8;const Mv=e=>{const{textColor2:t,cardColor:r,modalColor:o,popoverColor:n,dividerColor:i,borderRadius:a,fontSize:l}=e;return{textColor:t,color:r,colorModal:o,colorPopover:n,borderColor:i,borderColorModal:ye(o,i),borderColorPopover:ye(n,i),borderRadius:a,fontSize:l}},Y8={name:"List",common:Ke,self:Mv};var gO=Y8;const X8={name:"List",common:de,self:Mv};var Z8=X8;const J8={name:"LoadingBar",common:de,self(e){const{primaryColor:t}=e;return{colorError:"red",colorLoading:t,height:"2px"}}};var Q8=J8;const eT={name:"Log",common:de,peers:{Scrollbar:Ut,Code:tv},self(e){const{textColor2:t,inputColor:r,fontSize:o,primaryColor:n}=e;return{loaderFontSize:o,loaderTextColor:t,loaderColor:r,loaderBorder:"1px solid #0000",loadingColor:n}}};var tT=eT;const rT={name:"Mention",common:de,peers:{InternalSelectMenu:Si,Input:ur},self(e){const{boxShadow2:t}=e;return{menuBoxShadow:t}}};var oT=rT;function nT(e,t,r,o){return{itemColorHoverInverted:"#0000",itemColorActiveInverted:t,itemColorActiveHoverInverted:t,itemColorActiveCollapsedInverted:t,itemTextColorInverted:e,itemTextColorHoverInverted:r,itemTextColorChildActiveInverted:r,itemTextColorActiveInverted:r,itemTextColorActiveHoverInverted:r,itemTextColorHorizontalInverted:e,itemTextColorHoverHorizontalInverted:r,itemTextColorChildActiveHorizontalInverted:r,itemTextColorActiveHorizontalInverted:r,itemTextColorActiveHoverHorizontalInverted:r,itemIconColorInverted:e,itemIconColorHoverInverted:r,itemIconColorActiveInverted:r,itemIconColorActiveHoverInverted:r,itemIconColorChildActiveInverted:r,itemIconColorCollapsedInverted:e,itemIconColorHorizontalInverted:e,itemIconColorHoverHorizontalInverted:r,itemIconColorActiveHorizontalInverted:r,itemIconColorActiveHoverHorizontalInverted:r,itemIconColorChildActiveHorizontalInverted:r,arrowColorInverted:e,arrowColorHoverInverted:r,arrowColorActiveInverted:r,arrowColorActiveHoverInverted:r,arrowColorChildActiveInverted:r,groupTextColorInverted:o}}const Bv=e=>{const{borderRadius:t,textColor3:r,primaryColor:o,textColor2:n,textColor1:i,fontSize:a,dividerColor:l,hoverColor:s,primaryColorHover:d}=e;return Object.assign({borderRadius:t,color:"#0000",groupTextColor:r,itemColorHover:s,itemColorActive:ee(o,{alpha:.1}),itemColorActiveHover:ee(o,{alpha:.1}),itemColorActiveCollapsed:ee(o,{alpha:.1}),itemTextColor:n,itemTextColorHover:n,itemTextColorActive:o,itemTextColorActiveHover:o,itemTextColorChildActive:o,itemTextColorHorizontal:n,itemTextColorHoverHorizontal:d,itemTextColorActiveHorizontal:o,itemTextColorActiveHoverHorizontal:o,itemTextColorChildActiveHorizontal:o,itemIconColor:i,itemIconColorHover:i,itemIconColorActive:o,itemIconColorActiveHover:o,itemIconColorChildActive:o,itemIconColorCollapsed:i,itemIconColorHorizontal:i,itemIconColorHoverHorizontal:d,itemIconColorActiveHorizontal:o,itemIconColorActiveHoverHorizontal:o,itemIconColorChildActiveHorizontal:o,itemHeight:"42px",arrowColor:n,arrowColorHover:n,arrowColorActive:o,arrowColorActiveHover:o,arrowColorChildActive:o,colorInverted:"#0000",borderColorHorizontal:"#0000",fontSize:a,dividerColor:l},nT("#BBB",o,"#FFF","#AAA"))},iT={name:"Menu",common:Ke,peers:{Tooltip:Ic,Dropdown:uv},self:Bv};var aT=iT;const lT={name:"Menu",common:de,peers:{Tooltip:Za,Dropdown:fv},self(e){const{primaryColor:t,primaryColorSuppl:r}=e,o=Bv(e);return o.itemColorActive=ee(t,{alpha:.15}),o.itemColorActiveHover=ee(t,{alpha:.15}),o.itemColorActiveCollapsed=ee(t,{alpha:.15}),o.itemColorActiveInverted=r,o.itemColorActiveHoverInverted=r,o.itemColorActiveCollapsedInverted=r,o}};var sT=lT,cT={margin:"0 0 8px 0",padding:"10px 20px",maxWidth:"720px",minWidth:"420px",iconMargin:"0 10px 0 0",closeMargin:"0 0 0 12px",closeSize:"16px",iconSize:"20px",fontSize:"14px"};const Lv=e=>{const{textColor2:t,closeColor:r,closeColorHover:o,closeColorPressed:n,infoColor:i,successColor:a,errorColor:l,warningColor:s,popoverColor:d,boxShadow2:c,primaryColor:u,lineHeight:f,borderRadius:h}=e;return Object.assign(Object.assign({},cT),{textColor:t,textColorInfo:t,textColorSuccess:t,textColorError:t,textColorWarning:t,textColorLoading:t,color:d,colorInfo:d,colorSuccess:d,colorError:d,colorWarning:d,colorLoading:d,boxShadow:c,boxShadowInfo:c,boxShadowSuccess:c,boxShadowError:c,boxShadowWarning:c,boxShadowLoading:c,iconColor:t,iconColorInfo:i,iconColorSuccess:a,iconColorWarning:s,iconColorError:l,iconColorLoading:u,closeColor:r,closeColorHover:o,closeColorPressed:n,closeColorInfo:r,closeColorHoverInfo:o,closeColorPressedInfo:n,closeColorSuccess:r,closeColorHoverSuccess:o,closeColorPressedSuccess:n,closeColorError:r,closeColorHoverError:o,closeColorPressedError:n,closeColorWarning:r,closeColorHoverWarning:o,closeColorPressedWarning:n,closeColorLoading:r,closeColorHoverLoading:o,closeColorPressedLoading:n,loadingColor:u,lineHeight:f,borderRadius:h})},dT={name:"Message",common:Ke,self:Lv};var uT=dT;const fT={name:"Message",common:de,self:Lv};var hT=fT,pT={closeMargin:"18px 14px",closeSize:"16px",width:"365px",padding:"16px"};const mT=e=>{const{textColor2:t,successColor:r,infoColor:o,warningColor:n,errorColor:i,popoverColor:a,closeColor:l,closeColorHover:s,textColor1:d,textColor3:c,borderRadius:u,fontWeightStrong:f,boxShadow2:h,lineHeight:p,fontSize:b}=e;return Object.assign(Object.assign({},pT),{borderRadius:u,lineHeight:p,fontSize:b,headerFontWeight:f,iconColor:t,iconColorSuccess:r,iconColorInfo:o,iconColorWarning:n,iconColorError:i,color:a,textColor:t,closeColor:l,closeColorHover:s,closeColorPressed:l,headerTextColor:d,descriptionTextColor:c,actionTextColor:t,boxShadow:h})},vT={name:"Notification",common:de,peers:{Scrollbar:Ut},self:mT};var gT=vT,bT={titleFontSize:"18px",backSize:"22px"};function xT(e){const{textColor1:t,textColor2:r,textColor3:o,fontSize:n,fontWeightStrong:i,primaryColorHover:a,primaryColorPressed:l}=e;return Object.assign(Object.assign({},bT),{titleFontWeight:i,fontSize:n,titleTextColor:t,backColor:r,backColorHover:a,backColorPressed:l,subtitleTextColor:o})}const CT={name:"PageHeader",common:de,self:xT};var yT={iconSize:"22px"};const Dv=e=>{const{fontSize:t,warningColor:r}=e;return Object.assign(Object.assign({},yT),{fontSize:t,iconColor:r})},bO={name:"Popconfirm",common:Ke,peers:{Button:Xa,Popover:_i},self:Dv},wT={name:"Popconfirm",common:de,peers:{Button:qt,Popover:zo},self:Dv};var ST=wT;const _T={name:"Popselect",common:de,peers:{Popover:zo,InternalSelectMenu:Si}};var $T=_T;const Fv=e=>{const{infoColor:t,successColor:r,warningColor:o,errorColor:n,textColor2:i,progressRailColor:a,fontSize:l,fontWeight:s}=e;return{fontSize:l,fontSizeCircle:"28px",fontWeightCircle:s,railColor:a,railHeight:"8px",iconSizeCircle:"36px",iconSizeLine:"18px",iconColor:t,iconColorInfo:t,iconColorSuccess:r,iconColorWarning:o,iconColorError:n,textColorCircle:i,textColorLineInner:"rgb(255, 255, 255)",textColorLineOuter:i,fillColor:t,fillColorInfo:t,fillColorSuccess:r,fillColorWarning:o,fillColorError:n,lineBgProcessing:"linear-gradient(90deg, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, .5) 100%)"}},PT={name:"Progress",common:Ke,self:Fv};var kT=PT;const TT={name:"Progress",common:de,self(e){const t=Fv(e);return t.textColorLineInner="rgb(0, 0, 0)",t.lineBgProcessing="linear-gradient(90deg, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, .5) 100%)",t}};var Hv=TT;const ET={name:"Rate",common:de,self(e){const{railColor:t}=e;return{itemColor:t,itemColorActive:"#CCAA33",itemSize:"20px",sizeSmall:"16px",sizeMedium:"20px",sizeLarge:"24px"}}};var RT=ET,zT={titleFontSizeSmall:"26px",titleFontSizeMedium:"32px",titleFontSizeLarge:"40px",titleFontSizeHuge:"48px",fontSizeSmall:"14px",fontSizeMedium:"14px",fontSizeLarge:"15px",fontSizeHuge:"16px",iconSizeSmall:"64px",iconSizeMedium:"80px",iconSizeLarge:"100px",iconSizeHuge:"125px",iconColor418:void 0,iconColor404:void 0,iconColor403:void 0,iconColor500:void 0};const jv=e=>{const{textColor2:t,textColor1:r,errorColor:o,successColor:n,infoColor:i,warningColor:a,lineHeight:l,fontWeightStrong:s}=e;return Object.assign(Object.assign({},zT),{lineHeight:l,titleFontWeight:s,titleTextColor:r,textColor:t,iconColorError:o,iconColorSuccess:n,iconColorInfo:i,iconColorWarning:a})},AT={name:"Result",common:Ke,self:jv};var xO=AT;const OT={name:"Result",common:de,self:jv};var IT=OT,MT={railHeight:"4px",railWidthVertical:"4px",handleSize:"18px",dotHeight:"8px",dotWidth:"8px",dotBorderRadius:"4px"};const BT={name:"Slider",common:de,self(e){const t="0 2px 8px 0 rgba(0, 0, 0, 0.12)",{railColor:r,modalColor:o,primaryColorSuppl:n,popoverColor:i,textColor2:a,cardColor:l,borderRadius:s,fontSize:d,opacityDisabled:c}=e;return Object.assign(Object.assign({},MT),{fontSize:d,railColor:r,railColorHover:r,fillColor:n,fillColorHover:n,opacityDisabled:c,handleColor:"#FFF",dotColor:l,dotColorModal:o,dotColorPopover:i,handleBoxShadow:"0px 2px 4px 0 rgba(0, 0, 0, 0.4)",handleBoxShadowHover:"0px 2px 4px 0 rgba(0, 0, 0, 0.4)",handleBoxShadowActive:"0px 2px 4px 0 rgba(0, 0, 0, 0.4)",handleBoxShadowFocus:"0px 2px 4px 0 rgba(0, 0, 0, 0.4)",indicatorColor:i,indicatorBoxShadow:t,indicatorTextColor:a,indicatorBorderRadius:s,dotBorder:`2px solid ${r}`,dotBorderActive:`2px solid ${n}`,dotBoxShadow:""})}};var LT=BT;const Nv=e=>{const{opacityDisabled:t,heightTiny:r,heightSmall:o,heightMedium:n,heightLarge:i,heightHuge:a,primaryColor:l,fontSize:s}=e;return{fontSize:s,textColor:l,sizeTiny:r,sizeSmall:o,sizeMedium:n,sizeLarge:i,sizeHuge:a,color:l,opacitySpinning:t}},DT={name:"Spin",common:Ke,self:Nv};var FT=DT;const HT={name:"Spin",common:de,self:Nv};var jT=HT;const Wv=e=>{const{textColor2:t,textColor3:r,fontSize:o,fontWeight:n}=e;return{labelFontSize:o,labelFontWeight:n,valueFontWeight:n,labelTextColor:r,valuePrefixTextColor:t,valueSuffixTextColor:t,valueTextColor:t}},NT={name:"Statistic",common:Ke,self:Wv};var CO=NT;const WT={name:"Statistic",common:de,self:Wv};var VT=WT,KT={stepHeaderFontSizeSmall:"14px",stepHeaderFontSizeMedium:"16px",indicatorIndexFontSizeSmall:"14px",indicatorIndexFontSizeMedium:"16px",indicatorSizeSmall:"22px",indicatorSizeMedium:"28px",indicatorIconSizeSmall:"14px",indicatorIconSizeMedium:"18px"};const UT=e=>{const{fontWeightStrong:t,baseColor:r,textColorDisabled:o,primaryColor:n,errorColor:i,textColor1:a,textColor2:l}=e;return Object.assign(Object.assign({},KT),{stepHeaderFontWeight:t,indicatorTextColorProcess:r,indicatorTextColorWait:o,indicatorTextColorFinish:n,indicatorTextColorError:i,indicatorBorderColorProcess:n,indicatorBorderColorWait:o,indicatorBorderColorFinish:n,indicatorBorderColorError:i,indicatorColorProcess:n,indicatorColorWait:"#0000",indicatorColorFinish:"#0000",indicatorColorError:"#0000",splitorColorProcess:o,splitorColorWait:o,splitorColorFinish:n,splitorColorError:o,headerTextColorProcess:a,headerTextColorWait:o,headerTextColorFinish:o,headerTextColorError:i,descriptionTextColorProcess:l,descriptionTextColorWait:o,descriptionTextColorFinish:o,descriptionTextColorError:i})},qT={name:"Steps",common:de,self:UT};var GT=qT,YT={buttonHeightSmall:"14px",buttonHeightMedium:"18px",buttonHeightLarge:"22px",buttonWidthSmall:"14px",buttonWidthMedium:"18px",buttonWidthLarge:"22px",buttonWidthPressedSmall:"20px",buttonWidthPressedMedium:"24px",buttonWidthPressedLarge:"28px",railHeightSmall:"18px",railHeightMedium:"22px",railHeightLarge:"26px",railWidthSmall:"32px",railWidthMedium:"40px",railWidthLarge:"48px"};const XT={name:"Switch",common:de,self(e){const{primaryColorSuppl:t,opacityDisabled:r,borderRadius:o,primaryColor:n,textColor2:i,baseColor:a}=e,l="rgba(255, 255, 255, .20)";return Object.assign(Object.assign({},YT),{iconColor:a,textColor:i,loadingColor:t,opacityDisabled:r,railColor:l,railColorActive:t,buttonBoxShadow:"0px 2px 4px 0 rgba(0, 0, 0, 0.4)",buttonColor:"#FFF",railBorderRadiusSmall:o,railBorderRadiusMedium:o,railBorderRadiusLarge:o,buttonBorderRadiusSmall:o,buttonBorderRadiusMedium:o,buttonBorderRadiusLarge:o,boxShadowFocus:`0 0 8px 0 ${ee(n,{alpha:.3})}`})}};var ZT=XT,JT={thPaddingSmall:"6px",thPaddingMedium:"12px",thPaddingLarge:"12px",tdPaddingSmall:"6px",tdPaddingMedium:"12px",tdPaddingLarge:"12px"};const QT=e=>{const{dividerColor:t,cardColor:r,modalColor:o,popoverColor:n,tableHeaderColor:i,tableColorStriped:a,textColor1:l,textColor2:s,borderRadius:d,fontWeightStrong:c,lineHeight:u,fontSizeSmall:f,fontSizeMedium:h,fontSizeLarge:p}=e;return Object.assign(Object.assign({},JT),{fontSizeSmall:f,fontSizeMedium:h,fontSizeLarge:p,lineHeight:u,borderRadius:d,borderColor:ye(r,t),borderColorModal:ye(o,t),borderColorPopover:ye(n,t),tdColor:r,tdColorModal:o,tdColorPopover:n,tdColorStriped:ye(r,a),tdColorStripedModal:ye(o,a),tdColorStripedPopover:ye(n,a),thColor:ye(r,i),thColorModal:ye(o,i),thColorPopover:ye(n,i),thTextColor:l,tdTextColor:s,thFontWeight:c})},eE={name:"Table",common:de,self:QT};var tE=eE,rE={tabFontSizeSmall:"14px",tabFontSizeMedium:"14px",tabFontSizeLarge:"16px",tabGapSmallLine:"36px",tabGapMediumLine:"36px",tabGapLargeLine:"36px",tabPaddingSmallLine:"6px 0",tabPaddingMediumLine:"10px 0",tabPaddingLargeLine:"14px 0",tabGapSmallBar:"36px",tabGapMediumBar:"36px",tabGapLargeBar:"36px",tabPaddingSmallBar:"4px 0",tabPaddingMediumBar:"6px 0",tabPaddingLargeBar:"10px 0",tabGapSmallCard:"4px",tabGapMediumCard:"4px",tabGapLargeCard:"4px",tabPaddingSmallCard:"6px 10px",tabPaddingMediumCard:"8px 12px",tabPaddingLargeCard:"8px 16px",tabPaddingSmallSegment:"4px 0",tabPaddingMediumSegment:"6px 0",tabPaddingLargeSegment:"8px 0",tabGapSmallSegment:"0",tabGapMediumSegment:"0",tabGapLargeSegment:"0",panePaddingSmall:"8px 0 0 0",panePaddingMedium:"12px 0 0 0",panePaddingLarge:"16px 0 0 0"};const Vv=e=>{const{textColor2:t,primaryColor:r,textColorDisabled:o,closeColor:n,closeColorHover:i,closeColorPressed:a,tabColor:l,baseColor:s,dividerColor:d,fontWeight:c,textColor1:u,borderRadius:f,fontSize:h,fontWeightStrong:p}=e;return Object.assign(Object.assign({},rE),{colorSegment:l,tabFontSizeCard:h,tabTextColorLine:u,tabTextColorActiveLine:r,tabTextColorHoverLine:r,tabTextColorDisabledLine:o,tabTextColorSegment:u,tabTextColorActiveSegment:t,tabTextColorHoverSegment:t,tabTextColorDisabledSegment:o,tabTextColorBar:u,tabTextColorActiveBar:r,tabTextColorHoverBar:r,tabTextColorDisabledBar:o,tabTextColorCard:u,tabTextColorHoverCard:u,tabTextColorActiveCard:r,tabTextColorDisabledCard:o,barColor:r,closeColor:n,closeColorHover:i,closeColorPressed:a,tabColor:l,tabColorSegment:s,tabBorderColor:d,tabFontWeightActive:c,tabFontWeight:c,tabBorderRadius:f,paneTextColor:t,fontWeightStrong:p})},oE={name:"Tabs",common:Ke,self:Vv};var nE=oE;const iE={name:"Tabs",common:de,self(e){const t=Vv(e),{inputColor:r}=e;return t.colorSegment=r,t.tabColorSegment=r,t}};var aE=iE;const Kv=e=>{const{textColor1:t,textColor2:r,fontWeightStrong:o,fontSize:n}=e;return{fontSize:n,titleTextColor:t,textColor:r,titleFontWeight:o}},lE={name:"Thing",common:Ke,self:Kv};var yO=lE;const sE={name:"Thing",common:de,self:Kv};var cE=sE,dE={titleMarginMedium:"0",titleMarginLarge:"-2px 0 0 0",titleFontSizeMedium:"14px",titleFontSizeLarge:"16px",iconSizeMedium:"14px",iconSizeLarge:"14px"};const uE={name:"Timeline",common:de,self(e){const{textColor3:t,infoColorSuppl:r,errorColorSuppl:o,successColorSuppl:n,warningColorSuppl:i,textColor1:a,textColor2:l,railColor:s,fontWeightStrong:d,fontSize:c}=e;return Object.assign(Object.assign({},dE),{contentFontSize:c,titleFontWeight:d,circleBorder:`2px solid ${t}`,circleBorderInfo:`2px solid ${r}`,circleBorderError:`2px solid ${o}`,circleBorderSuccess:`2px solid ${n}`,circleBorderWarning:`2px solid ${i}`,iconColor:t,iconColorInfo:r,iconColorError:o,iconColorSuccess:n,iconColorWarning:i,titleTextColor:a,contentTextColor:l,metaTextColor:t,lineColor:s})}};var fE=uE,hE={extraFontSize:"12px",width:"440px"};const pE={name:"Transfer",common:de,peers:{Checkbox:$i,Scrollbar:Ut,Input:ur,Empty:wi,Button:qt},self(e){const{iconColorDisabled:t,iconColor:r,fontWeight:o,fontSizeLarge:n,fontSizeMedium:i,fontSizeSmall:a,heightLarge:l,heightMedium:s,heightSmall:d,borderRadius:c,inputColor:u,tableHeaderColor:f,textColor1:h,textColorDisabled:p,textColor2:b,hoverColor:g}=e;return Object.assign(Object.assign({},hE),{itemHeightSmall:d,itemHeightMedium:s,itemHeightLarge:l,fontSizeSmall:a,fontSizeMedium:i,fontSizeLarge:n,borderRadius:c,borderColor:"#0000",listColor:u,headerColor:f,titleTextColor:h,titleTextColorDisabled:p,extraTextColor:b,filterDividerColor:"#0000",itemTextColor:b,itemTextColorDisabled:p,itemColorPending:g,titleFontWeight:o,iconColor:r,iconColorDisabled:t})}};var mE=pE;const vE=e=>{const{borderRadiusSmall:t,hoverColor:r,pressedColor:o,primaryColor:n,textColor3:i,textColor2:a,textColorDisabled:l,fontSize:s}=e;return{fontSize:s,nodeBorderRadius:t,nodeColorHover:r,nodeColorPressed:o,nodeColorActive:ee(n,{alpha:.1}),arrowColor:i,nodeTextColor:a,nodeTextColorDisabled:l,loadingColor:n,dropMarkColor:n}},gE={name:"Tree",common:de,peers:{Checkbox:$i,Scrollbar:Ut},self(e){const{primaryColor:t}=e,r=vE(e);return r.nodeColorActive=ee(t,{alpha:.15}),r}};var Uv=gE;const bE={name:"TreeSelect",common:de,peers:{Tree:Uv,Empty:wi,InternalSelection:zc}};var xE=bE,CE={headerFontSize1:"30px",headerFontSize2:"22px",headerFontSize3:"18px",headerFontSize4:"16px",headerFontSize5:"16px",headerFontSize6:"16px",headerMargin1:"28px 0 20px 0",headerMargin2:"28px 0 20px 0",headerMargin3:"28px 0 20px 0",headerMargin4:"28px 0 18px 0",headerMargin5:"28px 0 18px 0",headerMargin6:"28px 0 18px 0",headerPrefixWidth1:"16px",headerPrefixWidth2:"16px",headerPrefixWidth3:"12px",headerPrefixWidth4:"12px",headerPrefixWidth5:"12px",headerPrefixWidth6:"12px",headerBarWidth1:"4px",headerBarWidth2:"4px",headerBarWidth3:"3px",headerBarWidth4:"3px",headerBarWidth5:"3px",headerBarWidth6:"3px",pMargin:"16px 0 16px 0",liMargin:".25em 0 0 0",olPadding:"0 0 0 2em",ulPadding:"0 0 0 2em"};const yE=e=>{const{primaryColor:t,textColor2:r,borderColor:o,lineHeight:n,fontSize:i,borderRadiusSmall:a,dividerColor:l,fontWeightStrong:s,textColor1:d,textColor3:c,infoColor:u,warningColor:f,errorColor:h,successColor:p,codeColor:b}=e;return Object.assign(Object.assign({},CE),{aTextColor:t,blockquoteTextColor:r,blockquotePrefixColor:o,blockquoteLineHeight:n,blockquoteFontSize:i,codeBorderRadius:a,liTextColor:r,liLineHeight:n,liFontSize:i,hrColor:l,headerFontWeight:s,headerTextColor:d,pTextColor:r,pTextColor1Depth:d,pTextColor2Depth:r,pTextColor3Depth:c,pLineHeight:n,pFontSize:i,headerBarColor:t,headerBarColorPrimary:t,headerBarColorInfo:u,headerBarColorError:h,headerBarColorWarning:f,headerBarColorSuccess:p,textColor:r,textColor1Depth:d,textColor2Depth:r,textColor3Depth:c,textColorPrimary:t,textColorInfo:u,textColorSuccess:p,textColorWarning:f,textColorError:h,codeTextColor:r,codeColor:b,codeBorder:"1px solid #0000"})},wE={name:"Typography",common:de,self:yE};var SE=wE;const qv=e=>{const{iconColor:t,primaryColor:r,errorColor:o,textColor2:n,successColor:i,opacityDisabled:a,actionColor:l,borderColor:s,hoverColor:d,lineHeight:c,borderRadius:u,fontSize:f}=e;return{fontSize:f,lineHeight:c,borderRadius:u,draggerColor:l,draggerBorder:`1px dashed ${s}`,draggerBorderHover:`1px dashed ${r}`,itemColorHover:d,itemColorHoverError:ee(o,{alpha:.06}),itemTextColor:n,itemTextColorError:o,itemTextColorSuccess:i,itemIconColor:t,itemDisabledOpacity:a,itemBorderImageCardError:`1px solid ${o}`,itemBorderImageCard:`1px solid ${s}`}},_E={name:"Upload",common:Ke,peers:{Button:Xa,Progress:kT},self:qv};var wO=_E;const $E={name:"Upload",common:de,peers:{Button:qt,Progress:Hv},self(e){const{errorColor:t}=e,r=qv(e);return r.itemColorHoverError=ee(t,{alpha:.09}),r}};var PE=$E;const kE={name:"Watermark",common:de,self(e){const{fontFamily:t}=e;return{fontFamily:t}}};var TE=kE;const EE={name:"Image",common:de,peers:{Tooltip:Za},self:e=>{const{textColor2:t}=e;return{toolbarIconColor:t,toolbarColor:"rgba(0, 0, 0, .35)",toolbarBoxShadow:"none",toolbarBorderRadius:"24px"}}},RE=m("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M6 5C5.75454 5 5.55039 5.17688 5.50806 5.41012L5.5 5.5V14.5C5.5 14.7761 5.72386 15 6 15C6.24546 15 6.44961 14.8231 6.49194 14.5899L6.5 14.5V5.5C6.5 5.22386 6.27614 5 6 5ZM13.8536 5.14645C13.68 4.97288 13.4106 4.9536 13.2157 5.08859L13.1464 5.14645L8.64645 9.64645C8.47288 9.82001 8.4536 10.0894 8.58859 10.2843L8.64645 10.3536L13.1464 14.8536C13.3417 15.0488 13.6583 15.0488 13.8536 14.8536C14.0271 14.68 14.0464 14.4106 13.9114 14.2157L13.8536 14.1464L9.70711 10L13.8536 5.85355C14.0488 5.65829 14.0488 5.34171 13.8536 5.14645Z",fill:"currentColor"})),zE=m("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M13.5 5C13.7455 5 13.9496 5.17688 13.9919 5.41012L14 5.5V14.5C14 14.7761 13.7761 15 13.5 15C13.2545 15 13.0504 14.8231 13.0081 14.5899L13 14.5V5.5C13 5.22386 13.2239 5 13.5 5ZM5.64645 5.14645C5.82001 4.97288 6.08944 4.9536 6.28431 5.08859L6.35355 5.14645L10.8536 9.64645C11.0271 9.82001 11.0464 10.0894 10.9114 10.2843L10.8536 10.3536L6.35355 14.8536C6.15829 15.0488 5.84171 15.0488 5.64645 14.8536C5.47288 14.68 5.4536 14.4106 5.58859 14.2157L5.64645 14.1464L9.79289 10L5.64645 5.85355C5.45118 5.65829 5.45118 5.34171 5.64645 5.14645Z",fill:"currentColor"})),AE=m("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m("path",{d:"M4.089 4.216l.057-.07a.5.5 0 0 1 .638-.057l.07.057L10 9.293l5.146-5.147a.5.5 0 0 1 .638-.057l.07.057a.5.5 0 0 1 .057.638l-.057.07L10.707 10l5.147 5.146a.5.5 0 0 1 .057.638l-.057.07a.5.5 0 0 1-.638.057l-.07-.057L10 10.707l-5.146 5.147a.5.5 0 0 1-.638.057l-.07-.057a.5.5 0 0 1-.057-.638l.057-.07L9.293 10L4.146 4.854a.5.5 0 0 1-.057-.638l.057-.07l-.057.07z",fill:"currentColor"})),jc=Object.assign(Object.assign({},ze.props),{showToolbar:{type:Boolean,default:!0},showToolbarTooltip:Boolean});var OE=z([z("body >",[M("image-container","position: fixed;")]),M("image-preview-container",` - position: fixed; - left: 0; - right: 0; - top: 0; - bottom: 0; - display: flex; - `),M("image-preview-overlay",` - z-index: -1; - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - background: rgba(0, 0, 0, .3); - `,[mi()]),M("image-preview-toolbar",` - z-index: 1; - position: absolute; - left: 50%; - transform: translateX(-50%); - border-radius: var(--n-toolbar-border-radius); - height: 48px; - bottom: 40px; - padding: 0 12px; - background: var(--n-toolbar-color); - box-shadow: var(--n-toolbar-box-shadow); - color: var(--n-toolbar-icon-color); - transition: color .3s var(--n-bezier); - display: flex; - align-items: center; - `,[M("base-icon",` - padding: 0 8px; - font-size: 28px; - cursor: pointer; - `),mi()]),M("image-preview-wrapper",` - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - display: flex; - pointer-events: none; - `,[vi()]),M("image-preview",` - user-select: none; - pointer-events: all; - margin: auto; - max-height: 100vh; - max-width: 100vw; - transition: transform .3s var(--n-bezier); - `),M("image",` - display: inline-flex; - max-height: 100%; - max-width: 100%; - `,[ut("preview-disabled",` - cursor: pointer; - `),z("img",` - border-radius: inherit; - `)])]),Gv=oe({name:"ImagePreview",props:Object.assign(Object.assign({},jc),{onNext:Function,onPrev:Function,clsPrefix:{type:String,required:!0}}),setup(e){const t=ze("Image","-image",OE,V8,e,Oe(e,"clsPrefix"));let r=null;const o=W(null),n=W(null),i=W(void 0),a=W(!1),l=W(!1),{localeRef:s}=em("Image");function d(){const{value:O}=n;if(!r||!O)return;const{style:V}=O,D=r.getBoundingClientRect(),ce=D.left+D.width/2,ue=D.top+D.height/2;V.transformOrigin=`${ce}px ${ue}px`}function c(O){var V,D;switch(O.code){case"ArrowLeft":(V=e.onPrev)===null||V===void 0||V.call(e);break;case"ArrowRight":(D=e.onNext)===null||D===void 0||D.call(e);break;case"Escape":_e();break}}qe(a,O=>{O?nt("keydown",document,c):Ze("keydown",document,c)}),It(()=>{Ze("keydown",document,c)});let u=0,f=0,h=0,p=0,b=0,g=0,v=0,w=0,$=!1;function x(O){const{clientX:V,clientY:D}=O;h=V-u,p=D-f,ip(se)}function S(O){const{mouseUpClientX:V,mouseUpClientY:D,mouseDownClientX:ce,mouseDownClientY:ue}=O,xe=ce-V,G=ue-D,Z=`vertical${G>0?"Top":"Bottom"}`,C=`horizontal${xe>0?"Left":"Right"}`;return{moveVerticalDirection:Z,moveHorizontalDirection:C,deltaHorizontal:xe,deltaVertical:G}}function E(O){const{value:V}=o;if(!V)return{offsetX:0,offsetY:0};const D=V.getBoundingClientRect(),{moveVerticalDirection:ce,moveHorizontalDirection:ue,deltaHorizontal:xe,deltaVertical:G}=O||{};let Z=0,C=0;return D.width<=window.innerWidth?Z=0:D.left>0?Z=(D.width-window.innerWidth)/2:D.right0?C=(D.height-window.innerHeight)/2:D.bottom.5){P-=.5,se(!1);const O=E();P+=.5,se(!1),P-=.5,h=O.offsetX,p=O.offsetY,se()}}function se(O=!0){const{value:V}=o;if(!V)return;const{style:D}=V,ce=`transform-origin: center; transform: translateX(${h}px) translateY(${p}px) rotate(${j}deg) scale(${P});`;$?D.cssText="cursor: grabbing; transition: none;"+ce:D.cssText="cursor: grab;"+ce+(O?"":"transition: none;"),O||V.offsetHeight}function _e(){a.value=!a.value,l.value=!0}const Ae={setPreviewSrc:O=>{i.value=O},setThumbnailEl:O=>{r=O},toggleShow:_e};function Re(O,V){if(e.showToolbarTooltip){const{value:D}=t;return m(cv,{to:!1,theme:D.peers.Tooltip,themeOverrides:D.peerOverrides.Tooltip},{default:()=>s.value[V],trigger:()=>O})}else return O}const Ee=L(()=>{const{common:{cubicBezierEaseInOut:O},self:{toolbarIconColor:V,toolbarBorderRadius:D,toolbarBoxShadow:ce,toolbarColor:ue}}=t.value;return{"--n-bezier":O,"--n-toolbar-icon-color":V,"--n-toolbar-color":ue,"--n-toolbar-border-radius":D,"--n-toolbar-box-shadow":ce}}),{inlineThemeDisabled:$e}=lt(),it=$e?_t("image-preview",void 0,Ee,e):void 0;return Object.assign({previewRef:o,previewWrapperRef:n,previewSrc:i,show:a,appear:xi(),displayed:l,handleWheel(O){O.preventDefault()},handlePreviewMousedown:_,handlePreviewDblclick:R,syncTransformOrigin:d,handleAfterLeave:()=>{j=0,P=1,l.value=!1},handleDragStart:O=>{O.preventDefault()},zoomIn:A,zoomOut:te,rotateCounterclockwise:B,rotateClockwise:q,handleSwitchPrev:T,handleSwitchNext:N,withTooltip:Re,cssVars:$e?void 0:Ee,themeClass:it==null?void 0:it.themeClass,onRender:it==null?void 0:it.onRender},Ae)},render(){var e,t;const{clsPrefix:r}=this;return m(ot,null,(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e),m(Ec,{show:this.show},{default:()=>{var o;return this.show||this.displayed?((o=this.onRender)===null||o===void 0||o.call(this),Cr(m("div",{class:[`${r}-image-preview-container`,this.themeClass],style:this.cssVars,onWheel:this.handleWheel},m(At,{name:"fade-in-transition",appear:this.appear},{default:()=>this.show?m("div",{class:`${r}-image-preview-overlay`,onClick:this.toggleShow}):null}),this.showToolbar?m(At,{name:"fade-in-transition",appear:this.appear},{default:()=>{if(!this.show)return null;const{withTooltip:n}=this;return m("div",{class:`${r}-image-preview-toolbar`},this.onPrev?m(ot,null,n(m(Bt,{clsPrefix:r,onClick:this.handleSwitchPrev},{default:()=>RE}),"tipPrevious"),n(m(Bt,{clsPrefix:r,onClick:this.handleSwitchNext},{default:()=>zE}),"tipNext")):null,n(m(Bt,{clsPrefix:r,onClick:this.rotateCounterclockwise},{default:()=>m(k$,null)}),"tipCounterclockwise"),n(m(Bt,{clsPrefix:r,onClick:this.rotateClockwise},{default:()=>m(P$,null)}),"tipClockwise"),n(m(Bt,{clsPrefix:r,onClick:this.zoomOut},{default:()=>m(E$,null)}),"tipZoomOut"),n(m(Bt,{clsPrefix:r,onClick:this.zoomIn},{default:()=>m(T$,null)}),"tipZoomIn"),n(m(Bt,{clsPrefix:r,onClick:this.toggleShow},{default:()=>AE}),"tipClose"))}}):null,m(At,{name:"fade-in-scale-up-transition",onAfterLeave:this.handleAfterLeave,appear:this.appear,onEnter:this.syncTransformOrigin,onBeforeLeave:this.syncTransformOrigin},{default:()=>Cr(m("div",{class:`${r}-image-preview-wrapper`,ref:"previewWrapperRef"},m("img",{draggable:!1,onMousedown:this.handlePreviewMousedown,onDblclick:this.handlePreviewDblclick,class:`${r}-image-preview`,key:this.previewSrc,src:this.previewSrc,ref:"previewRef",onDragstart:this.handleDragStart})),[[li,this.show]])})),[[qa,{enabled:this.show}]])):null}}))}});const Yv="n-image-group",IE=jc;var SO=oe({name:"ImageGroup",props:IE,setup(e){let t;const{mergedClsPrefixRef:r}=lt(e),o=`c${dn()}`,n=Zr(),i=s=>{var d;t=s,(d=l.value)===null||d===void 0||d.setPreviewSrc(s)};function a(s){if(!(n!=null&&n.proxy))return;const c=n.proxy.$el.parentElement.querySelectorAll(`.${o}:not([data-error=true])`);if(!c.length)return;const u=Array.from(c).findIndex(f=>f.dataset.previewSrc===t);~u?i(c[(u+s+c.length)%c.length].dataset.previewSrc):i(c[0].dataset.previewSrc)}je(Yv,{mergedClsPrefixRef:r,setPreviewSrc:i,setThumbnailEl:s=>{var d;(d=l.value)===null||d===void 0||d.setThumbnailEl(s)},toggleShow:()=>{var s;(s=l.value)===null||s===void 0||s.toggleShow()},groupId:o});const l=W(null);return{mergedClsPrefix:r,previewInstRef:l,next:()=>a(1),prev:()=>a(-1)}},render(){return m(Gv,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:this.mergedClsPrefix,ref:"previewInstRef",onPrev:this.prev,onNext:this.next,showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip},this.$slots)}});const ME=Object.assign({alt:String,height:[String,Number],imgProps:Object,objectFit:{type:String,default:"fill"},previewSrc:String,fallbackSrc:String,width:[String,Number],src:String,previewDisabled:Boolean,loadDescription:String,onError:Function,onLoad:Function},jc);var BE=oe({name:"Image",props:ME,inheritAttrs:!1,setup(e){const t=W(null),r=W(!1),o=Oe(e,"imgProps"),n=W(null),i=be(Yv,null),{mergedClsPrefixRef:a}=i||lt(e),l={click:()=>{if(e.previewDisabled||r.value)return;const s=e.previewSrc||e.src;if(i){i.setPreviewSrc(s),i.setThumbnailEl(t.value),i.toggleShow();return}const{value:d}=n;!d||(d.setPreviewSrc(s),d.setThumbnailEl(t.value),d.toggleShow())}};return xr(()=>{var s;e.src,(s=e.imgProps)===null||s===void 0||s.src,r.value=!1}),Object.assign({mergedClsPrefix:a,groupId:i==null?void 0:i.groupId,previewInstRef:n,imageRef:t,imgProps:o,showError:r,mergedOnError:s=>{r.value=!0;const{onError:d,imgProps:{onError:c}={}}=e;d==null||d(s),c==null||c(s)},mergedOnLoad:s=>{const{onLoad:d,imgProps:{onLoad:c}={}}=e;d==null||d(s),c==null||c(s)}},l)},render(){const{mergedClsPrefix:e,imgProps:t={},$attrs:r}=this,o=m("img",Object.assign({},t,{class:[this.groupId,t.class],ref:"imageRef",width:this.width||t.width,height:this.height||t.height,src:this.showError?this.fallbackSrc:this.src||t.src,alt:this.alt||t.alt,"aria-label":this.alt||t.alt,onClick:this.click,onError:this.mergedOnError,onLoad:this.mergedOnLoad,style:[t.style||"",{objectFit:this.objectFit}],"data-error":this.showError,"data-preview-src":this.previewSrc||this.src}));return m("div",Object.assign({},r,{role:"none",class:[r.class,`${e}-image`,(this.previewDisabled||this.showError)&&`${e}-image--preview-disabled`]}),this.groupId?o:m(Gv,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:e,ref:"previewInstRef",showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip},{default:()=>o}))}});const LE="n-layout-sider",Ti="n-menu",Nc="n-submenu",Wc="n-menu-item-group",Ui=8;function Vc(e){const t=be(Ti),{props:r,mergedCollapsedRef:o}=t,n=be(Nc,null),i=be(Wc,null),a=L(()=>r.mode==="horizontal"),l=L(()=>a.value?r.dropdownPlacement:"tmNodes"in e?"right-start":"right"),s=L(()=>{var f;return Math.max((f=r.collapsedIconSize)!==null&&f!==void 0?f:r.iconSize,r.iconSize)}),d=L(()=>{var f;return!a.value&&e.root&&o.value&&(f=r.collapsedIconSize)!==null&&f!==void 0?f:r.iconSize}),c=L(()=>{if(a.value)return;const{collapsedWidth:f,indent:h,rootIndent:p}=r,{root:b,isGroup:g}=e,v=p===void 0?h:p;if(b)return o.value?f/2-s.value/2:v;if(i)return h/2+i.paddingLeftRef.value;if(n)return(g?h/2:h)+n.paddingLeftRef.value}),u=L(()=>{const{collapsedWidth:f,indent:h,rootIndent:p}=r,{value:b}=s,{root:g}=e;return a.value||!g||!o.value?Ui:(p===void 0?h:p)+b+Ui-(f+b)/2});return{dropdownPlacement:l,activeIconSize:d,maxIconSize:s,paddingLeft:c,iconMarginRight:u,NMenu:t,NSubmenu:n}}const Kc={internalKey:{type:[String,Number],required:!0},root:Boolean,isGroup:Boolean,level:{type:Number,required:!0},title:[String,Function],extra:[String,Function]},Xv=Object.assign(Object.assign({},Kc),{tmNodes:{type:Array,required:!0}}),DE=oe({name:"MenuOptionGroup",props:Xv,setup(e){je(Nc,null);const t=Vc(e);je(Wc,{paddingLeftRef:t.paddingLeft});const{mergedClsPrefixRef:r,props:o}=be(Ti);return function(){const{value:n}=r,i=t.paddingLeft.value;return m("div",{class:`${n}-menu-item-group`,role:"group"},m("span",{class:`${n}-menu-item-group-title`,style:i!==void 0?`padding-left: ${i}px;`:void 0},Ct(e.title),e.extra?m(ot,null," ",Ct(e.extra)):null),m("div",null,e.tmNodes.map(a=>Uc(a,o))))}}});var Zv=oe({name:"MenuOptionContent",props:{collapsed:Boolean,disabled:Boolean,title:[String,Function],icon:Function,extra:[String,Function],showArrow:Boolean,childActive:Boolean,hover:Boolean,paddingLeft:Number,selected:Boolean,maxIconSize:{type:Number,required:!0},activeIconSize:{type:Number,required:!0},iconMarginRight:{type:Number,required:!0},clsPrefix:{type:String,required:!0},onClick:Function,tmNode:{type:Object,required:!0}},setup(e){const{props:t}=be(Ti);return{menuProps:t,style:L(()=>{const{paddingLeft:r}=e;return{paddingLeft:r&&`${r}px`}}),iconStyle:L(()=>{const{maxIconSize:r,activeIconSize:o,iconMarginRight:n}=e;return{width:`${r}px`,height:`${r}px`,fontSize:`${o}px`,marginRight:`${n}px`}})}},render(){const{clsPrefix:e,tmNode:t,menuProps:{renderIcon:r,renderLabel:o,renderExtra:n,expandIcon:i}}=this,a=r?r(t.rawNode):Ct(this.icon);return m("div",{onClick:this.onClick,role:"none",class:[`${e}-menu-item-content`,{[`${e}-menu-item-content--selected`]:this.selected,[`${e}-menu-item-content--collapsed`]:this.collapsed,[`${e}-menu-item-content--child-active`]:this.childActive,[`${e}-menu-item-content--disabled`]:this.disabled,[`${e}-menu-item-content--hover`]:this.hover}],style:this.style},a&&m("div",{class:`${e}-menu-item-content__icon`,style:this.iconStyle,role:"none"},[a]),m("div",{class:`${e}-menu-item-content-header`,role:"none"},o?o(t.rawNode):Ct(this.title),this.extra||n?m("span",{class:`${e}-menu-item-content-header__extra`}," ",n?n(t.rawNode):Ct(this.extra)):null),this.showArrow?m(Bt,{ariaHidden:!0,class:`${e}-menu-item-content__arrow`,clsPrefix:e},{default:()=>i?i(t.rawNode):m($$,null)}):null)}});const Jv=Object.assign(Object.assign({},Kc),{rawNodes:{type:Array,default:()=>[]},tmNodes:{type:Array,default:()=>[]},tmNode:{type:Object,required:!0},disabled:{type:Boolean,default:!1},icon:Function,onClick:Function}),FE=oe({name:"Submenu",props:Jv,setup(e){const t=Vc(e),{NMenu:r,NSubmenu:o}=t,{props:n,mergedCollapsedRef:i,mergedThemeRef:a}=r,l=L(()=>{const{disabled:f}=e;return o!=null&&o.mergedDisabledRef.value||n.disabled?!0:f}),s=W(!1);je(Nc,{paddingLeftRef:t.paddingLeft,mergedDisabledRef:l}),je(Wc,null);function d(){const{onClick:f}=e;f&&f()}function c(){l.value||(i.value||r.toggleExpand(e.internalKey),d())}function u(f){s.value=f}return{menuProps:n,mergedTheme:a,doSelect:r.doSelect,inverted:r.invertedRef,isHorizontal:r.isHorizontalRef,mergedClsPrefix:r.mergedClsPrefixRef,maxIconSize:t.maxIconSize,activeIconSize:t.activeIconSize,iconMarginRight:t.iconMarginRight,dropdownPlacement:t.dropdownPlacement,dropdownShow:s,paddingLeft:t.paddingLeft,mergedDisabled:l,mergedValue:r.mergedValueRef,childActive:ht(()=>r.activePathRef.value.includes(e.internalKey)),collapsed:L(()=>n.mode==="horizontal"?!1:i.value?!0:!r.mergedExpandedKeysRef.value.includes(e.internalKey)),dropdownEnabled:L(()=>!l.value&&(n.mode==="horizontal"||i.value)),handlePopoverShowChange:u,handleClick:c}},render(){var e;const{mergedClsPrefix:t,menuProps:{renderIcon:r,renderLabel:o}}=this,n=()=>{const{isHorizontal:a,paddingLeft:l,collapsed:s,mergedDisabled:d,maxIconSize:c,activeIconSize:u,title:f,childActive:h,icon:p,handleClick:b,dropdownShow:g,iconMarginRight:v,tmNode:w}=this;return m(Zv,{tmNode:w,paddingLeft:l,collapsed:s,disabled:d,iconMarginRight:v,maxIconSize:c,activeIconSize:u,title:f,showArrow:!a,childActive:h,clsPrefix:t,icon:p,hover:g,onClick:b})},i=()=>m(Ka,null,{default:()=>{const{tmNodes:a,collapsed:l}=this;return l?null:m("div",{class:`${t}-submenu-children`,role:"menu"},a.map(s=>Uc(s,this.menuProps)))}});return this.root?m(F4,Object.assign({},(e=this.menuProps)===null||e===void 0?void 0:e.dropdownProps,{themeOverrides:this.mergedTheme.peerOverrides.Dropdown,theme:this.mergedTheme.peers.Dropdown,builtinThemeOverrides:{fontSizeLarge:"14px",optionIconSizeLarge:"18px"},value:this.mergedValue,size:"large",trigger:"hover",disabled:!this.dropdownEnabled,placement:this.dropdownPlacement,keyField:this.menuProps.keyField,labelField:this.menuProps.labelField,childrenField:this.menuProps.childrenField,onUpdateShow:this.handlePopoverShowChange,options:this.rawNodes,onSelect:this.doSelect,inverted:this.inverted,renderIcon:r,renderLabel:o}),{default:()=>m("div",{class:`${t}-submenu`,role:"menuitem","aria-expanded":!this.collapsed},n(),this.isHorizontal?null:i())}):m("div",{class:`${t}-submenu`,role:"menuitem","aria-expanded":!this.collapsed},n(),i())}}),Qv=Object.assign(Object.assign({},Kc),{tmNode:{type:Object,required:!0},disabled:Boolean,icon:Function,onClick:Function}),HE=oe({name:"MenuOption",props:Qv,setup(e){const t=Vc(e),{NSubmenu:r,NMenu:o}=t,{props:n,mergedClsPrefixRef:i,mergedCollapsedRef:a}=o,l=r?r.mergedDisabledRef:{value:!1},s=L(()=>l.value||e.disabled);function d(u){const{onClick:f}=e;f&&f(u)}function c(u){s.value||(o.doSelect(e.internalKey,e.tmNode.rawNode),d(u))}return{mergedClsPrefix:i,dropdownPlacement:t.dropdownPlacement,paddingLeft:t.paddingLeft,iconMarginRight:t.iconMarginRight,maxIconSize:t.maxIconSize,activeIconSize:t.activeIconSize,mergedTheme:o.mergedThemeRef,menuProps:n,dropdownEnabled:ht(()=>e.root&&a.value&&n.mode!=="horizontal"&&!s.value),selected:L(()=>o.mergedValueRef.value===e.internalKey),mergedDisabled:s,handleClick:c}},render(){const{mergedClsPrefix:e,mergedTheme:t,tmNode:r,menuProps:{renderLabel:o}}=this;return m("div",{role:"menuitem",class:[`${e}-menu-item`]},m(cv,{theme:t.peers.Tooltip,themeOverrides:t.peerOverrides.Tooltip,trigger:"hover",placement:this.dropdownPlacement,disabled:!this.dropdownEnabled||this.title===void 0,internalExtraClass:["menu-tooltip"]},{default:()=>o?o(r.rawNode):Ct(this.title),trigger:()=>m(Zv,{tmNode:r,clsPrefix:e,paddingLeft:this.paddingLeft,iconMarginRight:this.iconMarginRight,maxIconSize:this.maxIconSize,activeIconSize:this.activeIconSize,selected:this.selected,title:this.title,extra:this.extra,disabled:this.mergedDisabled,icon:this.icon,onClick:this.handleClick})}))}});var jE=oe({name:"MenuDivider",setup(){const e=be(Ti),{mergedClsPrefixRef:t,isHorizontalRef:r}=e;return()=>r.value?null:m("div",{class:`${t.value}-menu-divider`})}});const NE=er(Xv),WE=er(Qv),VE=er(Jv);function KE(e){return e.type==="divider"||e.type==="render"}function UE(e){return e.type==="divider"}function Uc(e,t){const{rawNode:r}=e;if(KE(r))return UE(r)?m(jE,Object.assign({key:e.key},r.props)):void 0;const{labelField:o}=t,{key:n,level:i,isGroup:a}=e,l=Object.assign(Object.assign({},r),{title:r.title||r[o],extra:r.titleExtra||r.extra,key:n,internalKey:n,level:i,root:i===0,isGroup:a});return e.children?e.isGroup?m(DE,Vt(l,NE,{tmNodes:e.children,key:n})):m(FE,Vt(l,VE,{key:n,rawNodes:r[t.childrenField],tmNodes:e.children,tmNode:e})):m(HE,Vt(l,WE,{key:n,tmNode:e}))}var qE=z([M("menu",` - background-color: var(--n-color); - color: var(--n-item-text-color); - overflow: hidden; - transition: background-color .3s var(--n-bezier); - box-sizing: border-box; - font-size: var(--n-font-size); - padding-bottom: 6px; - `,[K("horizontal",` - display: inline-flex; - padding-bottom: 0; - `,[M("submenu","margin: 0;"),M("menu-item","margin: 0;"),M("menu-item-content",` - padding: 0 20px; - border-bottom: 2px solid #0000; - `,[z("&::before","display: none;"),K("selected","border-bottom: 2px solid var(--n-border-color-horizontal)")]),M("menu-item-content",[K("selected",[F("icon","color: var(--n-item-icon-color-active-horizontal);"),M("menu-item-content-header",` - color: var(--n-item-text-color-active-horizontal); - `,[z("a","color: var(--n-item-text-color-active-horizontal);"),F("extra","color: var(--n-item-text-color-active-horizontal);")])]),K("child-active",` - border-bottom: 2px solid var(--n-border-color-horizontal); - `,[M("menu-item-content-header",` - color: var(--n-item-text-color-child-active-horizontal); - `,[z("a",` - color: var(--n-item-text-color-child-active-horizontal); - `),F("extra",` - color: var(--n-item-text-color-child-active-horizontal); - `)]),F("icon",` - color: var(--n-item-icon-color-child-active-horizontal); - `)]),ut("disabled",[K("selected, child-active",[Bn(null,[F("icon","color: var(--n-item-icon-color-active-hover-horizontal);"),M("menu-item-content-header",` - color: var(--n-item-text-color-active-hover-horizontal); - `,[z("a","color: var(--n-item-text-color-active-hover-horizontal);"),F("extra","color: var(--n-item-text-color-active-hover-horizontal);")])])]),Bn("border-bottom: 2px solid var(--n-border-color-horizontal);",[F("icon",` - color: var(--n-item-icon-color-hover-horizontal); - `),M("menu-item-content-header",` - color: var(--n-item-text-color-hover-horizontal); - `,[z("a",` - color: var(--n-item-text-color-hover-horizontal); - `),F("extra",` - color: var(--n-item-text-color-hover-horizontal); - `)])])]),M("menu-item-content-header",[z("a","color: var(--n-item-text-color-horizontal);")])])]),K("collapsed",[M("menu-item",[K("selected",[z("&::before",` - background-color: var(--n-item-color-active-collapsed) !important; - `)])]),M("menu-item-content",[M("menu-item-content-header","opacity: 0;"),F("arrow","opacity: 0;"),F("icon","color: var(--n-item-icon-color-collapsed);")])]),M("menu-item",` - height: var(--n-item-height); - margin-top: 6px; - position: relative; - `),M("menu-item-content",` - box-sizing: border-box; - line-height: 1.75; - height: 100%; - display: grid; - grid-template-areas: "icon content arrow"; - grid-template-columns: auto 1fr auto; - align-items: center; - cursor: pointer; - position: relative; - padding-right: 18px; - transition: - background-color .3s var(--n-bezier), - padding-left .3s var(--n-bezier), - border-color .3s var(--n-bezier); - `,[z("> *","z-index: 1;"),z("&::before",` - z-index: auto; - content: ""; - background-color: #0000; - position: absolute; - left: 8px; - right: 8px; - top: 0; - bottom: 0; - pointer-events: none; - border-radius: var(--n-border-radius); - transition: background-color .3s var(--n-bezier); - `),K("disabled",` - opacity: .45; - cursor: not-allowed; - `),K("collapsed",[F("arrow","transform: rotate(0);")]),K("selected",[z("&::before","background-color: var(--n-item-color-active);"),F("arrow","color: var(--n-arrow-color-active);"),F("icon","color: var(--n-item-icon-color-active);"),M("menu-item-content-header",` - color: var(--n-item-text-color-active); - `,[z("a","color: var(--n-item-text-color-active);"),F("extra","color: var(--n-item-text-color-active);")])]),K("child-active",[M("menu-item-content-header",` - color: var(--n-item-text-color-child-active); - `,[z("a",` - color: var(--n-item-text-color-child-active); - `),F("extra",` - color: var(--n-item-text-color-child-active); - `)]),F("arrow",` - color: var(--n-arrow-color-child-active); - `),F("icon",` - color: var(--n-item-icon-color-child-active); - `)]),ut("disabled",[K("selected, child-active",[Bn(null,[F("arrow","color: var(--n-arrow-color-active-hover);"),F("icon","color: var(--n-item-icon-color-active-hover);"),M("menu-item-content-header",` - color: var(--n-item-text-color-active-hover); - `,[z("a","color: var(--n-item-text-color-active-hover);"),F("extra","color: var(--n-item-text-color-active-hover);")])])]),K("selected",[Bn(null,[z("&::before","background-color: var(--n-item-color-active-hover);")])]),Bn(null,[z("&::before","background-color: var(--n-item-color-hover);"),F("arrow",` - color: var(--n-arrow-color-hover); - `),F("icon",` - color: var(--n-item-icon-color-hover); - `),M("menu-item-content-header",` - color: var(--n-item-text-color-hover); - `,[z("a",` - color: var(--n-item-text-color-hover); - `),F("extra",` - color: var(--n-item-text-color-hover); - `)])])]),F("icon",` - grid-area: icon; - color: var(--n-item-icon-color); - transition: - color .3s var(--n-bezier), - font-size .3s var(--n-bezier), - margin-right .3s var(--n-bezier); - box-sizing: content-box; - display: inline-flex; - align-items: center; - justify-content: center; - `),F("arrow",` - grid-area: arrow; - font-size: 16px; - color: var(--n-arrow-color); - transform: rotate(180deg); - opacity: 1; - transition: - color .3s var(--n-bezier), - transform 0.2s var(--n-bezier), - opacity 0.2s var(--n-bezier); - `),M("menu-item-content-header",` - grid-area: content; - transition: - color .3s var(--n-bezier), - opacity .3s var(--n-bezier); - opacity: 1; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - color: var(--n-item-text-color); - `,[z("a",` - text-decoration: none; - transition: color .3s var(--n-bezier); - color: var(--n-item-text-color); - `,[z("&::before",` - content: ""; - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - `)]),F("extra",` - font-size: .93em; - color: var(--n-group-text-color); - transition: color .3s var(--n-bezier); - `)])]),M("submenu",` - cursor: pointer; - position: relative; - margin-top: 6px; - `,[M("menu-item-content",` - height: var(--n-item-height); - `),M("submenu-children",` - overflow: hidden; - padding: 0; - `,[jm({duration:".2s"})])]),M("menu-item-group",[M("menu-item-group-title",` - margin-top: 6px; - color: var(--n-group-text-color); - cursor: default; - font-size: .93em; - height: 36px; - display: flex; - align-items: center; - transition: - padding-left .3s var(--n-bezier), - color .3s var(--n-bezier); - `)])]),M("menu-tooltip",[z("a",` - color: inherit; - text-decoration: none; - `)]),M("menu-divider",` - transition: background-color .3s var(--n-bezier); - background-color: var(--n-divider-color); - height: 1px; - margin: 6px 18px; - `)]);function Bn(e,t){return[K("hover",e,t),z("&:hover",e,t)]}const GE=Object.assign(Object.assign({},ze.props),{options:{type:Array,default:()=>[]},collapsed:{type:Boolean,default:void 0},collapsedWidth:{type:Number,default:48},iconSize:{type:Number,default:20},collapsedIconSize:{type:Number,default:24},rootIndent:Number,indent:{type:Number,default:32},labelField:{type:String,default:"label"},keyField:{type:String,default:"key"},childrenField:{type:String,default:"children"},defaultExpandAll:Boolean,defaultExpandedKeys:Array,expandedKeys:Array,value:[String,Number],defaultValue:{type:[String,Number],default:null},mode:{type:String,default:"vertical"},watchProps:{type:Array,default:void 0},disabled:Boolean,inverted:Boolean,"onUpdate:expandedKeys":[Function,Array],onUpdateExpandedKeys:[Function,Array],onUpdateValue:[Function,Array],"onUpdate:value":[Function,Array],expandIcon:Function,renderIcon:Function,renderLabel:Function,renderExtra:Function,dropdownPlacement:{type:String,default:"bottom"},dropdownProps:Object,accordion:Boolean,items:Array,onOpenNamesChange:[Function,Array],onSelect:[Function,Array],onExpandedNamesChange:[Function,Array],expandedNames:Array,defaultExpandedNames:Array});var YE=oe({name:"Menu",props:GE,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:r}=lt(e),o=ze("Menu","-menu",qE,aT,e,t),n=be(LE,null),i=L(()=>{var _;const{collapsed:R}=e;if(R!==void 0)return R;if(n){const{collapseModeRef:P,collapsedRef:j}=n;if(P.value==="width")return(_=j.value)!==null&&_!==void 0?_:!1}return!1}),a=L(()=>{const{keyField:_,childrenField:R}=e;return lm(e.items||e.options,{getChildren(P){return P[R]},getKey(P){var j;return(j=P[_])!==null&&j!==void 0?j:P.name}})}),l=L(()=>new Set(a.value.treeNodes.map(_=>_.key))),{watchProps:s}=e,d=W(null);s!=null&&s.includes("defaultValue")?xr(()=>{d.value=e.defaultValue}):d.value=e.defaultValue;const c=Oe(e,"value"),u=hn(c,d),f=W([]),h=()=>{f.value=e.defaultExpandAll?a.value.getNonLeafKeys():e.defaultExpandedNames||e.defaultExpandedKeys||a.value.getPath(u.value,{includeSelf:!1}).keyPath};s!=null&&s.includes("defaultExpandedKeys")?xr(h):h();const p=di(e,["expandedNames","expandedKeys"]),b=hn(p,f),g=L(()=>a.value.treeNodes),v=L(()=>a.value.getPath(u.value).keyPath);je(Ti,{props:e,mergedCollapsedRef:i,mergedThemeRef:o,mergedValueRef:u,mergedExpandedKeysRef:b,activePathRef:v,mergedClsPrefixRef:t,isHorizontalRef:L(()=>e.mode==="horizontal"),invertedRef:Oe(e,"inverted"),doSelect:w,toggleExpand:x});function w(_,R){const{"onUpdate:value":P,onUpdateValue:j,onSelect:T}=e;j&&Be(j,_,R),P&&Be(P,_,R),T&&Be(T,_,R),d.value=_}function $(_){const{"onUpdate:expandedKeys":R,onUpdateExpandedKeys:P,onExpandedNamesChange:j,onOpenNamesChange:T}=e;R&&Be(R,_),P&&Be(P,_),j&&Be(j,_),T&&Be(T,_),f.value=_}function x(_){const R=Array.from(b.value),P=R.findIndex(j=>j===_);if(~P)R.splice(P,1);else{if(e.accordion&&l.value.has(_)){const j=R.findIndex(T=>l.value.has(T));j>-1&&R.splice(j,1)}R.push(_)}$(R)}const S=_=>{const R=a.value.getPath(_!=null?_:u.value,{includeSelf:!1}).keyPath;if(!R.length)return;const P=Array.from(b.value),j=new Set([...P,...R]);e.accordion&&l.value.forEach(T=>{j.has(T)&&!R.includes(T)&&j.delete(T)}),$(Array.from(j))},E=L(()=>{const{inverted:_}=e,{common:{cubicBezierEaseInOut:R},self:P}=o.value,{borderRadius:j,borderColorHorizontal:T,fontSize:N,itemHeight:B,dividerColor:q}=P,A={"--n-divider-color":q,"--n-bezier":R,"--n-font-size":N,"--n-border-color-horizontal":T,"--n-border-radius":j,"--n-item-height":B};return _?(A["--n-group-text-color"]=P.groupTextColorInverted,A["--n-color"]=P.colorInverted,A["--n-item-text-color"]=P.itemTextColorInverted,A["--n-item-text-color-hover"]=P.itemTextColorHoverInverted,A["--n-item-text-color-active"]=P.itemTextColorActiveInverted,A["--n-item-text-color-child-active"]=P.itemTextColorChildActiveInverted,A["--n-item-text-color-active-hover"]=P.itemTextColorActiveHoverInverted,A["--n-item-icon-color"]=P.itemIconColorInverted,A["--n-item-icon-color-hover"]=P.itemIconColorHoverInverted,A["--n-item-icon-color-active"]=P.itemIconColorActiveInverted,A["--n-item-icon-color-active-hover"]=P.itemIconColorActiveHoverInverted,A["--n-item-icon-color-child-active"]=P.itemIconColorChildActiveInverted,A["--n-item-icon-color-collapsed"]=P.itemIconColorCollapsedInverted,A["--n-item-text-color-horizontal"]=P.itemTextColorHorizontalInverted,A["--n-item-text-color-hover-horizontal"]=P.itemTextColorHoverHorizontalInverted,A["--n-item-text-color-active-horizontal"]=P.itemTextColorActiveHorizontalInverted,A["--n-item-text-color-child-active-horizontal"]=P.itemTextColorChildActiveHorizontalInverted,A["--n-item-text-color-active-hover-horizontal"]=P.itemTextColorActiveHoverHorizontalInverted,A["--n-item-icon-color-horizontal"]=P.itemIconColorHorizontalInverted,A["--n-item-icon-color-hover-horizontal"]=P.itemIconColorHoverHorizontalInverted,A["--n-item-icon-color-active-horizontal"]=P.itemIconColorActiveHorizontalInverted,A["--n-item-icon-color-active-hover-horizontal"]=P.itemIconColorActiveHoverHorizontalInverted,A["--n-item-icon-color-child-active-horizontal"]=P.itemIconColorChildActiveHorizontalInverted,A["--n-arrow-color"]=P.arrowColorInverted,A["--n-arrow-color-hover"]=P.arrowColorHoverInverted,A["--n-arrow-color-active"]=P.arrowColorActiveInverted,A["--n-arrow-color-active-hover"]=P.arrowColorActiveHoverInverted,A["--n-arrow-color-child-active"]=P.arrowColorChildActiveInverted,A["--n-item-color-hover"]=P.itemColorHoverInverted,A["--n-item-color-active"]=P.itemColorActiveInverted,A["--n-item-color-active-hover"]=P.itemColorActiveHoverInverted,A["--n-item-color-active-collapsed"]=P.itemColorActiveCollapsedInverted):(A["--n-group-text-color"]=P.groupTextColor,A["--n-color"]=P.color,A["--n-item-text-color"]=P.itemTextColor,A["--n-item-text-color-hover"]=P.itemTextColorHover,A["--n-item-text-color-active"]=P.itemTextColorActive,A["--n-item-text-color-child-active"]=P.itemTextColorChildActive,A["--n-item-text-color-active-hover"]=P.itemTextColorActiveHover,A["--n-item-icon-color"]=P.itemIconColor,A["--n-item-icon-color-hover"]=P.itemIconColorHover,A["--n-item-icon-color-active"]=P.itemIconColorActive,A["--n-item-icon-color-active-hover"]=P.itemIconColorActiveHover,A["--n-item-icon-color-child-active"]=P.itemIconColorChildActive,A["--n-item-icon-color-collapsed"]=P.itemIconColorCollapsed,A["--n-item-text-color-horizontal"]=P.itemTextColorHorizontal,A["--n-item-text-color-hover-horizontal"]=P.itemTextColorHoverHorizontal,A["--n-item-text-color-active-horizontal"]=P.itemTextColorActiveHorizontal,A["--n-item-text-color-child-active-horizontal"]=P.itemTextColorChildActiveHorizontal,A["--n-item-text-color-active-hover-horizontal"]=P.itemTextColorActiveHoverHorizontal,A["--n-item-icon-color-horizontal"]=P.itemIconColorHorizontal,A["--n-item-icon-color-hover-horizontal"]=P.itemIconColorHoverHorizontal,A["--n-item-icon-color-active-horizontal"]=P.itemIconColorActiveHorizontal,A["--n-item-icon-color-active-hover-horizontal"]=P.itemIconColorActiveHoverHorizontal,A["--n-item-icon-color-child-active-horizontal"]=P.itemIconColorChildActiveHorizontal,A["--n-arrow-color"]=P.arrowColor,A["--n-arrow-color-hover"]=P.arrowColorHover,A["--n-arrow-color-active"]=P.arrowColorActive,A["--n-arrow-color-active-hover"]=P.arrowColorActiveHover,A["--n-arrow-color-child-active"]=P.arrowColorChildActive,A["--n-item-color-hover"]=P.itemColorHover,A["--n-item-color-active"]=P.itemColorActive,A["--n-item-color-active-hover"]=P.itemColorActiveHover,A["--n-item-color-active-collapsed"]=P.itemColorActiveCollapsed),A}),y=r?_t("menu",L(()=>e.inverted?"a":"b"),E,e):void 0;return{mergedClsPrefix:t,controlledExpandedKeys:p,uncontrolledExpanededKeys:f,mergedExpandedKeys:b,uncontrolledValue:d,mergedValue:u,activePath:v,tmNodes:g,mergedTheme:o,mergedCollapsed:i,cssVars:r?void 0:E,themeClass:y==null?void 0:y.themeClass,onRender:y==null?void 0:y.onRender,showOption:S}},render(){const{mergedClsPrefix:e,mode:t,themeClass:r,onRender:o}=this;return o==null||o(),m("div",{role:t==="horizontal"?"menubar":"menu",class:[`${e}-menu`,r,`${e}-menu--${t}`,this.mergedCollapsed&&`${e}-menu--collapsed`],style:this.cssVars},this.tmNodes.map(n=>Uc(n,this.$props)))}});const eg={icon:Function,type:{type:String,default:"info"},content:[String,Number,Function],showIcon:{type:Boolean,default:!0},closable:Boolean,keepAliveOnHover:Boolean,onClose:Function,onMouseenter:Function,onMouseleave:Function},tg="n-message-api",rg="n-message-provider";var XE=z([M("message-wrapper",` - margin: var(--n-margin); - z-index: 0; - transform-origin: top center; - display: flex; - `,[jm({overflow:"visible",originalTransition:"transform .3s var(--n-bezier)",enterToProps:{transform:"scale(1)"},leaveToProps:{transform:"scale(0.85)"}})]),M("message",` - box-sizing: border-box; - display: flex; - align-items: center; - transition: - color .3s var(--n-bezier), - box-shadow .3s var(--n-bezier), - background-color .3s var(--n-bezier), - opacity .3s var(--n-bezier), - transform .3s var(--n-bezier), - margin-bottom .3s var(--n-bezier); - padding: var(--n-padding); - border-radius: var(--n-border-radius); - flex-wrap: nowrap; - overflow: hidden; - max-width: var(--n-max-width); - color: var(--n-text-color); - background-color: var(--n-color); - box-shadow: var(--n-box-shadow); - `,[F("content",` - display: inline-block; - line-height: var(--n-line-height); - font-size: var(--n-font-size); - `),F("icon",` - position: relative; - margin: var(--n-icon-margin); - height: var(--n-icon-size); - width: var(--n-icon-size); - font-size: var(--n-icon-size); - flex-shrink: 0; - `,[["default","info","success","warning","error","loading"].map(e=>K(`${e}-type`,[z("> *",` - color: var(--n-icon-color-${e}); - transition: color .3s var(--n-bezier); - `)])),z("> *",` - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - `,[pi()])]),F("close",` - font-size: var(--n-close-size); - margin: var(--n-close-margin); - transition: color .3s var(--n-bezier); - flex-shrink: 0; - `,[z("&:hover",` - color: var(--n-close-color-hover); - `),z("&:active",` - color: var(--n-close-color-pressed); - `)])]),M("message-container",` - z-index: 6000; - position: fixed; - height: 0; - overflow: visible; - display: flex; - flex-direction: column; - align-items: center; - `,[K("top",` - top: 12px; - left: 0; - right: 0; - `),K("top-left",` - top: 12px; - left: 12px; - right: 0; - align-items: flex-start; - `),K("top-right",` - top: 12px; - left: 0; - right: 12px; - align-items: flex-end; - `),K("bottom",` - bottom: 4px; - left: 0; - right: 0; - justify-content: flex-end; - `),K("bottom-left",` - bottom: 4px; - left: 12px; - right: 0; - justify-content: flex-end; - align-items: flex-start; - `),K("bottom-right",` - bottom: 4px; - left: 0; - right: 12px; - justify-content: flex-end; - align-items: flex-end; - `)])]);const ZE={info:()=>m(rm,null),success:()=>m(om,null),warning:()=>m(nm,null),error:()=>m(tm,null),default:()=>null};var JE=oe({name:"Message",props:Object.assign(Object.assign({},eg),{render:Function}),setup(e){const{inlineThemeDisabled:t}=lt(),{props:r,mergedClsPrefixRef:o}=be(rg),n=ze("Message","-message",XE,uT,r,o),i=L(()=>{const{type:l}=e,{common:{cubicBezierEaseInOut:s},self:{padding:d,margin:c,maxWidth:u,iconMargin:f,closeMargin:h,closeSize:p,iconSize:b,fontSize:g,lineHeight:v,borderRadius:w,iconColorInfo:$,iconColorSuccess:x,iconColorWarning:S,iconColorError:E,iconColorLoading:y,[ae("textColor",l)]:_,[ae("boxShadow",l)]:R,[ae("color",l)]:P,[ae("closeColor",l)]:j,[ae("closeColorPressed",l)]:T,[ae("closeColorHover",l)]:N}}=n.value;return{"--n-bezier":s,"--n-margin":c,"--n-padding":d,"--n-max-width":u,"--n-font-size":g,"--n-icon-margin":f,"--n-icon-size":b,"--n-close-size":p,"--n-close-margin":h,"--n-text-color":_,"--n-color":P,"--n-box-shadow":R,"--n-icon-color-info":$,"--n-icon-color-success":x,"--n-icon-color-warning":S,"--n-icon-color-error":E,"--n-icon-color-loading":y,"--n-close-color":j,"--n-close-color-pressed":T,"--n-close-color-hover":N,"--n-line-height":v,"--n-border-radius":w}}),a=t?_t("message",L(()=>e.type[0]),i,{}):void 0;return{mergedClsPrefix:o,messageProviderProps:r,handleClose(){var l;(l=e.onClose)===null||l===void 0||l.call(e)},cssVars:t?void 0:i,themeClass:a==null?void 0:a.themeClass,onRender:a==null?void 0:a.onRender,placement:r.placement}},render(){const{render:e,type:t,closable:r,content:o,mergedClsPrefix:n,cssVars:i,themeClass:a,onRender:l,icon:s,handleClose:d,showIcon:c}=this;l==null||l();let u;return m("div",{class:[`${n}-message-wrapper`,a],onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave,style:[{alignItems:this.placement.startsWith("top")?"flex-start":"flex-end"},i]},e?e(this.$props):m("div",{class:`${n}-message ${n}-message--${t}-type`},(u=QE(s,t,n))&&c?m("div",{class:`${n}-message__icon ${n}-message__icon--${t}-type`},m(Va,null,{default:()=>u})):null,m("div",{class:`${n}-message__content`},Ct(o)),r?m(yi,{clsPrefix:n,class:`${n}-message__close`,onClick:d}):null))}});function QE(e,t,r){if(typeof e=="function")return e();{const o=t==="loading"?m(Ua,{clsPrefix:r,strokeWidth:24,scale:.85}):ZE[t]();return o?m(Bt,{clsPrefix:r,key:t},{default:()=>o}):null}}var eR=oe({name:"MessageEnvironment",props:Object.assign(Object.assign({},eg),{duration:{type:Number,default:3e3},onAfterLeave:Function,onLeave:Function,internalKey:{type:String,required:!0},onInternalAfterLeave:Function,onHide:Function,onAfterHide:Function}),setup(e){let t=null;const r=W(!0);Ot(()=>{o()});function o(){const{duration:c}=e;c&&(t=window.setTimeout(a,c))}function n(c){c.currentTarget===c.target&&t!==null&&(window.clearTimeout(t),t=null)}function i(c){c.currentTarget===c.target&&o()}function a(){const{onHide:c}=e;r.value=!1,t&&(window.clearTimeout(t),t=null),c&&c()}function l(){const{onClose:c}=e;c&&c(),a()}function s(){const{onAfterLeave:c,onInternalAfterLeave:u,onAfterHide:f,internalKey:h}=e;c&&c(),u&&u(h),f&&f()}function d(){a()}return{show:r,hide:a,handleClose:l,handleAfterLeave:s,handleMouseleave:i,handleMouseenter:n,deactivate:d}},render(){return m(Ka,{appear:!0,onAfterLeave:this.handleAfterLeave,onLeave:this.onLeave},{default:()=>[this.show?m(JE,{content:this.content,type:this.type,icon:this.icon,showIcon:this.showIcon,closable:this.closable,onClose:this.handleClose,onMouseenter:this.keepAliveOnHover?this.handleMouseenter:void 0,onMouseleave:this.keepAliveOnHover?this.handleMouseleave:void 0}):null]})}});const tR=Object.assign(Object.assign({},ze.props),{to:[String,Object],duration:{type:Number,default:3e3},keepAliveOnHover:Boolean,max:Number,placement:{type:String,default:"top"},closable:Boolean,containerStyle:[String,Object]});var rR=oe({name:"MessageProvider",props:tR,setup(e){const{mergedClsPrefixRef:t}=lt(e),r=W([]),o=W({}),n={create(s,d){return i(s,Object.assign({type:"default"},d))},info(s,d){return i(s,Object.assign(Object.assign({},d),{type:"info"}))},success(s,d){return i(s,Object.assign(Object.assign({},d),{type:"success"}))},warning(s,d){return i(s,Object.assign(Object.assign({},d),{type:"warning"}))},error(s,d){return i(s,Object.assign(Object.assign({},d),{type:"error"}))},loading(s,d){return i(s,Object.assign(Object.assign({},d),{type:"loading"}))},destroyAll:l};je(rg,{props:e,mergedClsPrefixRef:t}),je(tg,n);function i(s,d){const c=dn(),u=ar(Object.assign(Object.assign({},d),{content:s,key:c,destroy:()=>{o.value[c].hide()}})),{max:f}=e;return f&&r.value.length>=f&&r.value.shift(),r.value.push(u),u}function a(s){r.value.splice(r.value.findIndex(d=>d.key===s),1),delete o.value[s]}function l(){Object.values(o.value).forEach(s=>{s.hide()})}return Object.assign({mergedClsPrefix:t,messageRefs:o,messageList:r,handleAfterLeave:a},n)},render(){var e,t,r;return m(ot,null,(t=(e=this.$slots).default)===null||t===void 0?void 0:t.call(e),this.messageList.length?m(gh,{to:(r=this.to)!==null&&r!==void 0?r:"body"},m("div",{class:[`${this.mergedClsPrefix}-message-container`,`${this.mergedClsPrefix}-message-container--${this.placement}`],key:"message-container",style:this.containerStyle},this.messageList.map(o=>m(eR,Object.assign({ref:n=>{n&&(this.messageRefs[o.key]=n)},internalKey:o.key,onInternalAfterLeave:this.handleAfterLeave},sc(o,["destroy"],void 0),{duration:o.duration===void 0?this.duration:o.duration,keepAliveOnHover:o.keepAliveOnHover===void 0?this.keepAliveOnHover:o.keepAliveOnHover,closable:o.closable===void 0?this.closable:o.closable}))))):null)}});function oR(){const e=be(tg,null);return e===null&&Da("use-message","No outer founded. See prerequisite in https://www.naiveui.com/en-US/os-theme/components/message for more details. If you want to use `useMessage` outside setup, please check https://www.naiveui.com/zh-CN/os-theme/components/message#Q-&-A."),e}const nR={name:"Skeleton",common:de,self(e){const{heightSmall:t,heightMedium:r,heightLarge:o,borderRadius:n}=e;return{color:"rgba(255, 255, 255, 0.12)",colorEnd:"rgba(255, 255, 255, 0.18)",borderRadius:n,heightSmall:t,heightMedium:r,heightLarge:o}}};var iR=z([z("@keyframes spin-rotate",` - from { - transform: rotate(0); - } - to { - transform: rotate(360deg); - } - `),M("spin-container",{position:"relative"},[M("spin-body",` - position: absolute; - top: 50%; - left: 50%; - transform: translateX(-50%) translateY(-50%); - `,[mi()])]),M("spin-body",` - display: inline-flex; - align-items: center; - justify-content: center; - flex-direction: column; - `),M("spin",` - display: inline-flex; - height: var(--n-size); - width: var(--n-size); - font-size: var(--n-size); - color: var(--n-color); - `,[K("rotate",` - animation: spin-rotate 2s linear infinite; - `)]),M("spin-description",` - display: inline-block; - font-size: var(--n-font-size); - color: var(--n-text-color); - transition: color .3s var(--n-bezier); - margin-top: 8px; - `),M("spin-content",` - opacity: 1; - transition: opacity .3s var(--n-bezier); - pointer-events: all; - `,[K("spinning",` - user-select: none; - pointer-events: none; - opacity: var(--n-opacity-spinning); - `)])]);const aR={small:20,medium:18,large:16},lR=Object.assign(Object.assign({},ze.props),{description:String,stroke:String,size:{type:[String,Number],default:"medium"},show:{type:Boolean,default:!0},strokeWidth:Number,rotate:{type:Boolean,default:!0},spinning:{type:Boolean,validator:()=>!0,default:void 0}});var sR=oe({name:"Spin",props:lR,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:r}=lt(e),o=ze("Spin","-spin",iR,FT,e,t),n=L(()=>{const{size:a}=e,{common:{cubicBezierEaseInOut:l},self:s}=o.value,{opacitySpinning:d,color:c,textColor:u}=s,f=typeof a=="number"?xC(a):s[ae("size",a)];return{"--n-bezier":l,"--n-opacity-spinning":d,"--n-size":f,"--n-color":c,"--n-text-color":u}}),i=r?_t("spin",L(()=>{const{size:a}=e;return typeof a=="number"?String(a):a[0]}),n,e):void 0;return{mergedClsPrefix:t,compitableShow:di(e,["spinning","show"]),mergedStrokeWidth:L(()=>{const{strokeWidth:a}=e;if(a!==void 0)return a;const{size:l}=e;return aR[typeof l=="number"?"medium":l]}),cssVars:r?void 0:n,themeClass:i==null?void 0:i.themeClass,onRender:i==null?void 0:i.onRender}},render(){var e,t;const{$slots:r,mergedClsPrefix:o,description:n}=this,i=r.icon&&this.rotate,a=(n||r.description)&&m("div",{class:`${o}-spin-description`},n||((e=r.description)===null||e===void 0?void 0:e.call(r))),l=r.icon?m("div",{class:[`${o}-spin-body`,this.themeClass]},m("div",{class:[`${o}-spin`,i&&`${o}-spin--rotate`],style:r.default?"":this.cssVars},r.icon()),a):m("div",{class:[`${o}-spin-body`,this.themeClass]},m(Ua,{clsPrefix:o,style:r.default?"":this.cssVars,stroke:this.stroke,"stroke-width":this.mergedStrokeWidth,class:`${o}-spin`}),a);return(t=this.onRender)===null||t===void 0||t.call(this),r.default?m("div",{class:[`${o}-spin-container`,this.themeClass],style:this.cssVars},m("div",{class:[`${o}-spin-content`,this.compitableShow&&`${o}-spin-content--spinning`]},r),m(At,{name:"fade-in-transition"},{default:()=>this.compitableShow?l:null})):l}});const qc="n-tabs",og={tab:[String,Number,Object,Function],name:{type:[String,Number],required:!0},disabled:Boolean,displayDirective:{type:String,default:"if"},closable:{type:Boolean,default:void 0},tabProps:Object,label:[String,Number,Object,Function]};var cR=oe({__TAB_PANE__:!0,name:"TabPane",alias:["TabPanel"],props:og,setup(e){const t=be(qc,null);return t||Da("tab-pane","`n-tab-pane` must be placed inside `n-tabs`."),{style:t.paneStyleRef,class:t.paneClassRef,mergedClsPrefix:t.mergedClsPrefixRef}},render(){return m("div",{class:[`${this.mergedClsPrefix}-tab-pane`,this.class],style:this.style},this.$slots)}});const dR=Object.assign({internalLeftPadded:Boolean,internalAddable:Boolean,internalCreatedByPane:Boolean},sc(og,["displayDirective"]));var Es=oe({__TAB__:!0,inheritAttrs:!1,name:"Tab",props:dR,setup(e){const{mergedClsPrefixRef:t,valueRef:r,typeRef:o,closableRef:n,tabStyleRef:i,tabChangeIdRef:a,onBeforeLeaveRef:l,triggerRef:s,handleAdd:d,activateTab:c,handleClose:u}=be(qc);return{trigger:s,mergedClosable:L(()=>{if(e.internalAddable)return!1;const{closable:f}=e;return f===void 0?n.value:f}),style:i,clsPrefix:t,value:r,type:o,handleClose(f){f.stopPropagation(),!e.disabled&&u(e.name)},activateTab(){if(e.disabled)return;if(e.internalAddable){d();return}const{name:f}=e,h=++a.id;if(f!==r.value){const{value:p}=l;p?Promise.resolve(p(e.name,r.value)).then(b=>{b&&a.id===h&&c(f)}):c(f)}}}},render(){const{internalAddable:e,clsPrefix:t,name:r,disabled:o,label:n,tab:i,value:a,mergedClosable:l,style:s,trigger:d,$slots:{default:c}}=this,u=n!=null?n:i;return m("div",{class:`${t}-tabs-tab-wrapper`},this.internalLeftPadded?m("div",{class:`${t}-tabs-tab-pad`}):null,m("div",Object.assign({key:r,"data-name":r,"data-disabled":o?!0:void 0},Xr({class:[`${t}-tabs-tab`,a===r&&`${t}-tabs-tab--active`,o&&`${t}-tabs-tab--disabled`,l&&`${t}-tabs-tab--closable`,e&&`${t}-tabs-tab--addable`],onClick:d==="click"?this.activateTab:void 0,onMouseenter:d==="hover"?this.activateTab:void 0,style:e?void 0:s},this.internalCreatedByPane?this.tabProps||{}:this.$attrs)),m("span",{class:`${t}-tabs-tab__label`},e?m(ot,null,m("div",{class:`${t}-tabs-tab__height-placeholder`},"\xA0"),m(Bt,{clsPrefix:t},{default:()=>m(b$,null)})):c?c():typeof u=="object"?u:Ct(u!=null?u:r)),l&&this.type==="card"?m(yi,{clsPrefix:t,class:`${t}-tabs-tab__close`,onClick:this.handleClose,disabled:o}):null))}}),uR=M("tabs",` - box-sizing: border-box; - width: 100%; - transition: - background-color .3s var(--n-bezier), - border-color .3s var(--n-bezier); -`,[M("tabs-rail",` - padding: 3px; - border-radius: var(--n-tab-border-radius); - width: 100%; - background-color: var(--n-color-segment); - transition: background-color .3s var(--n-bezier); - display: flex; - align-items: center; - `,[M("tabs-tab-wrapper",` - flex-basis: 0; - flex-grow: 1; - display: flex; - align-items: center; - justify-content: center; - `,[M("tabs-tab",` - overflow: hidden; - border-radius: var(--n-tab-border-radius); - width: 100%; - display: flex; - align-items: center; - justify-content: center; - `,[K("active",` - font-weight: var(--n-font-weight-strong); - color: var(--n-tab-text-color-active); - background-color: var(--n-tab-color-segment); - box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .08); - `),z("&:hover",` - color: var(--n-tab-text-color-hover); - `)])])]),K("flex",[M("tabs-nav",{width:"100%"},[M("tabs-wrapper",{width:"100%"},[M("tabs-tab",{marginRight:0})])])]),M("tabs-nav",` - box-sizing: border-box; - line-height: 1.5; - display: flex; - transition: border-color .3s var(--n-bezier); - `,[F("prefix, suffix",` - display: flex; - align-items: center; - `),F("prefix","padding-right: 16px;"),F("suffix","padding-left: 16px;")]),M("tabs-nav-scroll-wrapper",` - flex: 1; - position: relative; - overflow: hidden; - `,[K("shadow-before",[z("&::before",` - box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, .12); - `)]),K("shadow-after",[z("&::after",` - box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, .12); - `)]),z("&::before, &::after",` - transition: box-shadow .3s var(--n-bezier); - pointer-events: none; - content: ""; - position: absolute; - top: 0; - bottom: 0; - width: 20px; - z-index: 1; - `),z("&::before",` - left: 0; - `),z("&::after",` - right: 0; - `)]),M("tabs-nav-scroll-content",` - display: flex; - position: relative; - min-width: 100%; - width: fit-content; - `),M("tabs-wrapper",` - display: inline-flex; - flex-wrap: nowrap; - position: relative; - `),M("tabs-tab-wrapper",` - display: flex; - flex-wrap: nowrap; - flex-shrink: 0; - flex-grow: 0; - `),M("tabs-tab",` - cursor: pointer; - white-space: nowrap; - flex-wrap: nowrap; - display: inline-flex; - align-items: center; - color: var(--n-tab-text-color); - font-size: var(--n-tab-font-size); - background-clip: padding-box; - padding: var(--n-tab-padding); - transition: - box-shadow .3s var(--n-bezier), - color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - border-color .3s var(--n-bezier); - `,[K("disabled",{cursor:"not-allowed"}),F("close",` - margin-left: 8px; - font-size: 14px; - transition: color .3s var(--n-bezier); - `),F("label",` - display: flex; - align-items: center; - `)]),M("tabs-bar",` - position: absolute; - bottom: 0; - height: 2px; - border-radius: 1px; - background-color: var(--n-bar-color); - transition: - left .2s var(--n-bezier), - max-width .2s var(--n-bezier), - background-color .3s var(--n-bezier); - `,[K("transition-disabled",` - transition: none; - `),K("disabled",` - background-color: var(--n-tab-text-color-disabled) - `)]),M("tabs-pane-wrapper",` - position: relative; - overflow: hidden; - transition: max-height .2s var(--n-bezier); - `),M("tab-pane",` - color: var(--n-pane-text-color); - width: 100%; - padding: var(--n-pane-padding); - transition: - color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - opacity .2s var(--n-bezier); - left: 0; - right: 0; - top: 0; - `,[z("&.next-transition-leave-active, &.prev-transition-leave-active, &.next-transition-enter-active, &.prev-transition-enter-active",` - transition: - color .3s var(--n-bezier), - background-color .3s var(--n-bezier), - transform .2s var(--n-bezier), - opacity .2s var(--n-bezier); - `),z("&.next-transition-leave-active, &.prev-transition-leave-active",` - position: absolute; - `),z("&.next-transition-enter-from, &.prev-transition-leave-to",` - transform: translateX(32px); - opacity: 0; - `),z("&.next-transition-leave-to, &.prev-transition-enter-from",` - transform: translateX(-32px); - opacity: 0; - `),z("&.next-transition-leave-from, &.next-transition-enter-to, &.prev-transition-leave-from, &.prev-transition-enter-to",` - transform: translateX(0); - opacity: 1; - `)]),M("tabs-tab-pad",` - width: var(--n-tab-gap); - flex-grow: 0; - flex-shrink: 0; - `),K("line-type, bar-type",[M("tabs-tab",` - font-weight: var(--n-tab-font-weight-active); - box-sizing: border-box; - vertical-align: bottom; - `,[z("&:hover",{color:"var(--n-tab-text-color-hover)"}),K("active",{color:"var(--n-tab-text-color-active)"}),K("disabled",{color:"var(--n-tab-text-color-disabled)"})])]),M("tabs-nav",[K("line-type",[F("prefix, suffix",` - transition: border-color .3s var(--n-bezier); - border-bottom: 1px solid var(--n-tab-border-color); - `),M("tabs-nav-scroll-content",` - transition: border-color .3s var(--n-bezier); - border-bottom: 1px solid var(--n-tab-border-color); - `),M("tabs-bar",` - border-radius: 0; - bottom: -1px; - `)]),K("card-type",[F("prefix, suffix",` - transition: border-color .3s var(--n-bezier); - border-bottom: 1px solid var(--n-tab-border-color); - `),M("tabs-pad",` - flex-grow: 1; - transition: border-color .3s var(--n-bezier); - border-bottom: 1px solid var(--n-tab-border-color); - `),M("tabs-tab-pad",` - transition: border-color .3s var(--n-bezier); - border-bottom: 1px solid var(--n-tab-border-color); - `),M("tabs-tab",` - font-weight: var(--n-tab-font-weight); - border: 1px solid var(--n-tab-border-color); - border-top-left-radius: var(--n-tab-border-radius); - border-top-right-radius: var(--n-tab-border-radius); - background-color: var(--n-tab-color); - box-sizing: border-box; - position: relative; - vertical-align: bottom; - display: flex; - justify-content: space-between; - font-size: var(--n-tab-font-size); - color: var(--n-tab-text-color); - `,[K("addable",` - padding-left: 8px; - padding-right: 8px; - font-size: 16px; - `,[F("height-placeholder",` - width: 0; - font-size: var(--n-tab-font-size); - `),ut("disabled",[z("&:hover",` - color: var(--n-tab-text-color-hover); - `)])]),K("closable","padding-right: 6px;"),K("active",` - border-bottom: 1px solid #0000; - background-color: #0000; - font-weight: var(--n-tab-font-weight-active); - color: var(--n-tab-text-color-active); - `),K("disabled","color: var(--n-tab-text-color-disabled);")]),M("tabs-scroll-padding","border-bottom: 1px solid var(--n-tab-border-color);")])])]);const fR=Object.assign(Object.assign({},ze.props),{value:[String,Number],defaultValue:[String,Number],trigger:{type:String,default:"click"},type:{type:String,default:"bar"},closable:Boolean,justifyContent:String,size:{type:String,default:"medium"},tabStyle:[String,Object],barWidth:Number,paneClass:String,paneStyle:[String,Object],addable:[Boolean,Object],tabsPadding:{type:Number,default:0},animated:Boolean,onBeforeLeave:Function,onAdd:Function,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],onClose:[Function,Array],labelSize:String,activeName:[String,Number],onActiveNameChange:[Function,Array]});var hR=oe({name:"Tabs",props:fR,setup(e,{slots:t}){var r,o,n,i;const{mergedClsPrefixRef:a,inlineThemeDisabled:l}=lt(e),s=ze("Tabs","-tabs",uR,nE,e,a),d=W(null),c=W(null),u=W(null),f=W(null),h=W(null),p=W(!0),b=W(!0),g=di(e,["labelSize","size"]),v=di(e,["activeName","value"]),w=W((o=(r=v.value)!==null&&r!==void 0?r:e.defaultValue)!==null&&o!==void 0?o:t.default?(i=(n=So(t.default())[0])===null||n===void 0?void 0:n.props)===null||i===void 0?void 0:i.name:null),$=hn(v,w),x={id:0},S=L(()=>{if(!(!e.justifyContent||e.type==="card"))return{display:"flex",justifyContent:e.justifyContent}});qe($,()=>{x.id=0,_()});function E(){var G;const{value:Z}=$;return Z===null?null:(G=d.value)===null||G===void 0?void 0:G.querySelector(`[data-name="${Z}"]`)}function y(G){if(e.type==="card")return;const{value:Z}=c;if(!!Z&&G){const C=`${a.value}-tabs-bar--disabled`,{barWidth:k}=e;if(G.dataset.disabled==="true"?Z.classList.add(C):Z.classList.remove(C),k&&G.offsetWidth>=k){const H=Math.floor((G.offsetWidth-k)/2)+G.offsetLeft;Z.style.left=`${H}px`,Z.style.maxWidth=`${k}px`}else Z.style.left=`${G.offsetLeft}px`,Z.style.maxWidth=`${G.offsetWidth}px`;Z.style.width="8192px"}}function _(){if(e.type==="card")return;const G=E();G&&y(G)}const R=W(null);let P=0;function j(){const G=R.value;if(G){P=G.getBoundingClientRect().height;const Z=`${P}px`;G.style.height=Z,G.style.maxHeight=Z}}function T(G){const Z=R.value;if(Z){const C=G.getBoundingClientRect().height;Z.style.maxHeight=`${C}px`,Z.style.height=`${Math.max(P,C)}px`}}function N(){const G=R.value;G&&(G.style.maxHeight="",G.style.height="")}const B={value:[]},q=W("next");function A(G){const Z=$.value;let C="next";for(const k of B.value){if(k===Z)break;if(k===G){C="prev";break}}q.value=C,te(G)}function te(G){const{onActiveNameChange:Z,onUpdateValue:C,"onUpdate:value":k}=e;Z&&Be(Z,G),C&&Be(C,G),k&&Be(k,G),w.value=G}function se(G){const{onClose:Z}=e;Z&&Be(Z,G)}let _e=!0,Ae=0;const Re=yl(function(Z){var C;if(Z.contentRect.width===0&&Z.contentRect.height===0||Ae===Z.contentRect.width)return;Ae=Z.contentRect.width;const{type:k}=e;if((k==="line"||k==="bar")&&_e){const{value:H}=c;if(!H)return;const U=`${a.value}-tabs-bar--transition-disabled`;H.classList.add(U),_(),H.classList.remove(U)}k!=="segment"&&V((C=h.value)===null||C===void 0?void 0:C.$el)},64),Ee=W(!1);function $e(G){var Z;const{target:C,contentRect:{width:k}}=G,H=C.parentElement.offsetWidth;if(!Ee.value)HU.$el.offsetWidth&&(Ee.value=!1)}V((Z=h.value)===null||Z===void 0?void 0:Z.$el)}const it=yl($e,64);function O(){const{onAdd:G}=e;G&&G(),br(()=>{const Z=E(),{value:C}=h;!Z||!C||C.scrollTo({left:Z.offsetLeft,top:0,behavior:"smooth"})})}function V(G){if(!G)return;const{scrollLeft:Z,scrollWidth:C,offsetWidth:k}=G;p.value=Z<=0,b.value=Z+k>=C}const D=yl(G=>{V(G.target)},64);je(qc,{triggerRef:Oe(e,"trigger"),tabStyleRef:Oe(e,"tabStyle"),paneClassRef:Oe(e,"paneClass"),paneStyleRef:Oe(e,"paneStyle"),mergedClsPrefixRef:a,typeRef:Oe(e,"type"),closableRef:Oe(e,"closable"),valueRef:$,tabChangeIdRef:x,onBeforeLeaveRef:Oe(e,"onBeforeLeave"),activateTab:A,handleClose:se,handleAdd:O}),vp(()=>{_()}),xr(()=>{const{value:G}=u;if(!G)return;const{value:Z}=a,C=`${Z}-tabs-nav-scroll-wrapper--shadow-before`,k=`${Z}-tabs-nav-scroll-wrapper--shadow-after`;p.value?G.classList.remove(C):G.classList.add(C),b.value?G.classList.remove(k):G.classList.add(k)});const ce={syncBarPosition:()=>{_()}},ue=L(()=>{const{value:G}=g,{type:Z}=e,C={card:"Card",bar:"Bar",line:"Line",segment:"Segment"}[Z],k=`${G}${C}`,{self:{barColor:H,closeColor:U,closeColorHover:X,closeColorPressed:ne,tabColor:le,tabBorderColor:Y,paneTextColor:J,tabFontWeight:Q,tabBorderRadius:ve,tabFontWeightActive:pe,colorSegment:me,fontWeightStrong:we,tabColorSegment:De,[ae("panePadding",G)]:Ye,[ae("tabPadding",k)]:Fe,[ae("tabGap",k)]:Je,[ae("tabTextColor",Z)]:re,[ae("tabTextColorActive",Z)]:he,[ae("tabTextColorHover",Z)]:Se,[ae("tabTextColorDisabled",Z)]:Ne,[ae("tabFontSize",G)]:rt},common:{cubicBezierEaseInOut:Ue}}=s.value;return{"--n-bezier":Ue,"--n-color-segment":me,"--n-bar-color":H,"--n-tab-font-size":rt,"--n-tab-text-color":re,"--n-tab-text-color-active":he,"--n-tab-text-color-disabled":Ne,"--n-tab-text-color-hover":Se,"--n-pane-text-color":J,"--n-tab-border-color":Y,"--n-tab-border-radius":ve,"--n-close-color":U,"--n-close-color-hover":X,"--n-close-color-pressed":ne,"--n-tab-color":le,"--n-tab-font-weight":Q,"--n-tab-font-weight-active":pe,"--n-tab-padding":Fe,"--n-tab-gap":Je,"--n-pane-padding":Ye,"--n-font-weight-strong":we,"--n-tab-color-segment":De}}),xe=l?_t("tabs",L(()=>`${g.value[0]}${e.type[0]}`),ue,e):void 0;return Object.assign({mergedClsPrefix:a,mergedValue:$,renderedNames:new Set,tabsPaneWrapperRef:R,tabsElRef:d,barElRef:c,addTabInstRef:f,xScrollInstRef:h,scrollWrapperElRef:u,addTabFixed:Ee,tabWrapperStyle:S,handleNavResize:Re,mergedSize:g,handleScroll:D,handleTabsResize:it,cssVars:l?void 0:ue,themeClass:xe==null?void 0:xe.themeClass,animationDirection:q,renderNameListRef:B,onAnimationBeforeLeave:j,onAnimationEnter:T,onAnimationAfterEnter:N,onRender:xe==null?void 0:xe.onRender},ce)},render(){const{mergedClsPrefix:e,type:t,addTabFixed:r,addable:o,mergedSize:n,renderNameListRef:i,onRender:a,$slots:{default:l,prefix:s,suffix:d}}=this;a==null||a();const c=l?So(l()).filter(g=>g.type.__TAB_PANE__===!0):[],u=l?So(l()).filter(g=>g.type.__TAB__===!0):[],f=!u.length,h=t==="card",p=t==="segment",b=!h&&!p&&this.justifyContent;return i.value=[],m("div",{class:[`${e}-tabs`,this.themeClass,`${e}-tabs--${t}-type`,`${e}-tabs--${n}-size`,b&&`${e}-tabs--flex`],style:this.cssVars},m("div",{class:[`${e}-tabs-nav--${t}-type`,`${e}-tabs-nav`]},bt(s,g=>g&&m("div",{class:`${e}-tabs-nav__prefix`},g)),p?m("div",{class:`${e}-tabs-rail`},f?c.map((g,v)=>(i.value.push(g.props.name),m(Es,Object.assign({},g.props,{internalCreatedByPane:!0,internalLeftPadded:v!==0}),g.children?{default:g.children.tab}:void 0))):u.map((g,v)=>(i.value.push(g.props.name),v===0?g:hf(g)))):m(vn,{onResize:this.handleNavResize},{default:()=>m("div",{class:`${e}-tabs-nav-scroll-wrapper`,ref:"scrollWrapperElRef"},m(FP,{ref:"xScrollInstRef",onScroll:this.handleScroll},{default:()=>{const g=m("div",{style:this.tabWrapperStyle,class:`${e}-tabs-wrapper`},b?null:m("div",{class:`${e}-tabs-scroll-padding`,style:{width:`${this.tabsPadding}px`}}),f?c.map((w,$)=>(i.value.push(w.props.name),Al(m(Es,Object.assign({},w.props,{internalCreatedByPane:!0,internalLeftPadded:$!==0&&!b}),w.children?{default:w.children.tab}:void 0)))):u.map((w,$)=>(i.value.push(w.props.name),Al($!==0&&!b?hf(w):w))),!r&&o&&h?ff(o,(f?c.length:u.length)!==0):null,b?null:m("div",{class:`${e}-tabs-scroll-padding`,style:{width:`${this.tabsPadding}px`}}));let v=g;return h&&o&&(v=m(vn,{onResize:this.handleTabsResize},{default:()=>g})),m("div",{ref:"tabsElRef",class:`${e}-tabs-nav-scroll-content`},v,h?m("div",{class:`${e}-tabs-pad`}):null,h?null:m("div",{ref:"barElRef",class:`${e}-tabs-bar`}))}}))}),r&&o&&h?ff(o,!0):null,bt(d,g=>g&&m("div",{class:`${e}-tabs-nav__suffix`},g))),f&&(this.animated?m("div",{ref:"tabsPaneWrapperRef",class:`${e}-tabs-pane-wrapper`},uf(c,this.mergedValue,this.renderedNames,this.onAnimationBeforeLeave,this.onAnimationEnter,this.onAnimationAfterEnter,this.animationDirection)):uf(c,this.mergedValue,this.renderedNames)))}});function uf(e,t,r,o,n,i,a){const l=[];return e.forEach(s=>{const{name:d,displayDirective:c,"display-directive":u}=s.props,f=p=>c===p||u===p,h=t===d;if(s.key!==void 0&&(s.key=d),h||f("show")||f("show:lazy")&&r.has(d)){r.has(d)||r.add(d);const p=!f("if");l.push(p?Cr(s,[[li,h]]):s)}}),a?m(rc,{name:`${a}-transition`,onBeforeLeave:o,onEnter:n,onAfterEnter:i},{default:()=>l}):l}function ff(e,t){return m(Es,{ref:"addTabInstRef",key:"__addable",name:"__addable",internalCreatedByPane:!0,internalAddable:!0,internalLeftPadded:t,disabled:typeof e=="object"&&e.disabled})}function hf(e){const t=lr(e);return t.props?t.props.internalLeftPadded=!0:t.props={internalLeftPadded:!0},t}function Al(e){return Array.isArray(e.dynamicProps)?e.dynamicProps.includes("internalLeftPadded")||e.dynamicProps.push("internalLeftPadded"):e.dynamicProps=["internalLeftPadded"],e}const pR={name:"dark",common:de,Alert:M3,Anchor:j3,AutoComplete:X3,Avatar:qm,AvatarGroup:i6,BackTop:s6,Badge:d6,Breadcrumb:C6,Button:qt,Calendar:z6,Card:ev,Carousel:W6,Cascader:Y6,Checkbox:$i,Code:tv,Collapse:Q6,CollapseTransition:r4,ColorPicker:I6,DataTable:C4,DatePicker:U4,Descriptions:X4,Dialog:yv,Divider:gk,Drawer:Ck,Dropdown:fv,DynamicInput:Sk,DynamicTags:zk,Element:Ok,Empty:wi,Ellipsis:lv,Form:Lk,GradientText:F8,Icon:T4,IconWrapper:N8,Image:EE,Input:ur,InputNumber:U8,Layout:G8,List:Z8,LoadingBar:Q8,Log:tT,Menu:sT,Mention:oT,Message:hT,Modal:ak,Notification:gT,PageHeader:CT,Pagination:iv,Popconfirm:ST,Popover:zo,Popselect:$T,Progress:Hv,Radio:sv,Rate:RT,Result:IT,Scrollbar:Ut,Select:ov,Skeleton:nR,Slider:LT,Space:Ev,Spin:jT,Statistic:VT,Steps:GT,Switch:ZT,Table:tE,Tabs:aE,Tag:Lm,Thing:cE,TimePicker:bv,Timeline:fE,Tooltip:Za,Transfer:mE,Tree:Uv,TreeSelect:xE,Typography:SE,Upload:PE,Watermark:TE};var Gc={exports:{}},ng=function(t,r){return function(){for(var n=new Array(arguments.length),i=0;i=0)return;o==="set-cookie"?r[o]=(r[o]?r[o]:[]).concat([n]):r[o]=r[o]?r[o]+", "+n:n}}),r},mf=Ht,KR=mf.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),o;function n(i){var a=i;return t&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return o=n(window.location.href),function(a){var l=mf.isString(a)?n(a):a;return l.protocol===o.protocol&&l.host===o.host}}():function(){return function(){return!0}}();function Zc(e){this.message=e}Zc.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};Zc.prototype.__CANCEL__=!0;var tl=Zc,Gi=Ht,UR=BR,qR=LR,GR=sg,YR=NR,XR=VR,ZR=KR,Il=ug,JR=dg,QR=tl,vf=function(t){return new Promise(function(o,n){var i=t.data,a=t.headers,l=t.responseType,s;function d(){t.cancelToken&&t.cancelToken.unsubscribe(s),t.signal&&t.signal.removeEventListener("abort",s)}Gi.isFormData(i)&&delete a["Content-Type"];var c=new XMLHttpRequest;if(t.auth){var u=t.auth.username||"",f=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";a.Authorization="Basic "+btoa(u+":"+f)}var h=YR(t.baseURL,t.url);c.open(t.method.toUpperCase(),GR(h,t.params,t.paramsSerializer),!0),c.timeout=t.timeout;function p(){if(!!c){var g="getAllResponseHeaders"in c?XR(c.getAllResponseHeaders()):null,v=!l||l==="text"||l==="json"?c.responseText:c.response,w={data:v,status:c.status,statusText:c.statusText,headers:g,config:t,request:c};UR(function(x){o(x),d()},function(x){n(x),d()},w),c=null}}if("onloadend"in c?c.onloadend=p:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(p)},c.onabort=function(){!c||(n(Il("Request aborted",t,"ECONNABORTED",c)),c=null)},c.onerror=function(){n(Il("Network Error",t,null,c)),c=null},c.ontimeout=function(){var v=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",w=t.transitional||JR;t.timeoutErrorMessage&&(v=t.timeoutErrorMessage),n(Il(v,t,w.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},Gi.isStandardBrowserEnv()){var b=(t.withCredentials||ZR(h))&&t.xsrfCookieName?qR.read(t.xsrfCookieName):void 0;b&&(a[t.xsrfHeaderName]=b)}"setRequestHeader"in c&&Gi.forEach(a,function(v,w){typeof i=="undefined"&&w.toLowerCase()==="content-type"?delete a[w]:c.setRequestHeader(w,v)}),Gi.isUndefined(t.withCredentials)||(c.withCredentials=!!t.withCredentials),l&&l!=="json"&&(c.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&c.addEventListener("progress",t.onDownloadProgress),typeof t.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(s=function(g){!c||(n(!g||g&&g.type?new QR("canceled"):g),c.abort(),c=null)},t.cancelToken&&t.cancelToken.subscribe(s),t.signal&&(t.signal.aborted?s():t.signal.addEventListener("abort",s))),i||(i=null),c.send(i)})},Tt=Ht,gf=OR,ez=cg,tz=dg,rz={"Content-Type":"application/x-www-form-urlencoded"};function bf(e,t){!Tt.isUndefined(e)&&Tt.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function oz(){var e;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(e=vf),e}function nz(e,t,r){if(Tt.isString(e))try{return(t||JSON.parse)(e),Tt.trim(e)}catch(o){if(o.name!=="SyntaxError")throw o}return(r||JSON.stringify)(e)}var rl={transitional:tz,adapter:oz(),transformRequest:[function(t,r){return gf(r,"Accept"),gf(r,"Content-Type"),Tt.isFormData(t)||Tt.isArrayBuffer(t)||Tt.isBuffer(t)||Tt.isStream(t)||Tt.isFile(t)||Tt.isBlob(t)?t:Tt.isArrayBufferView(t)?t.buffer:Tt.isURLSearchParams(t)?(bf(r,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):Tt.isObject(t)||r&&r["Content-Type"]==="application/json"?(bf(r,"application/json"),nz(t)):t}],transformResponse:[function(t){var r=this.transitional||rl.transitional,o=r&&r.silentJSONParsing,n=r&&r.forcedJSONParsing,i=!o&&this.responseType==="json";if(i||n&&Tt.isString(t)&&t.length)try{return JSON.parse(t)}catch(a){if(i)throw a.name==="SyntaxError"?ez(a,this,"E_JSON_PARSE"):a}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Tt.forEach(["delete","get","head"],function(t){rl.headers[t]={}});Tt.forEach(["post","put","patch"],function(t){rl.headers[t]=Tt.merge(rz)});var Jc=rl,iz=Ht,az=Jc,lz=function(t,r,o){var n=this||az;return iz.forEach(o,function(a){t=a.call(n,t,r)}),t},fg=function(t){return!!(t&&t.__CANCEL__)},xf=Ht,Ml=lz,sz=fg,cz=Jc,dz=tl;function Bl(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new dz("canceled")}var uz=function(t){Bl(t),t.headers=t.headers||{},t.data=Ml.call(t,t.data,t.headers,t.transformRequest),t.headers=xf.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),xf.forEach(["delete","get","head","post","put","patch","common"],function(n){delete t.headers[n]});var r=t.adapter||cz.adapter;return r(t).then(function(n){return Bl(t),n.data=Ml.call(t,n.data,n.headers,t.transformResponse),n},function(n){return sz(n)||(Bl(t),n&&n.response&&(n.response.data=Ml.call(t,n.response.data,n.response.headers,t.transformResponse))),Promise.reject(n)})},jt=Ht,hg=function(t,r){r=r||{};var o={};function n(c,u){return jt.isPlainObject(c)&&jt.isPlainObject(u)?jt.merge(c,u):jt.isPlainObject(u)?jt.merge({},u):jt.isArray(u)?u.slice():u}function i(c){if(jt.isUndefined(r[c])){if(!jt.isUndefined(t[c]))return n(void 0,t[c])}else return n(t[c],r[c])}function a(c){if(!jt.isUndefined(r[c]))return n(void 0,r[c])}function l(c){if(jt.isUndefined(r[c])){if(!jt.isUndefined(t[c]))return n(void 0,t[c])}else return n(void 0,r[c])}function s(c){if(c in r)return n(t[c],r[c]);if(c in t)return n(void 0,t[c])}var d={url:a,method:a,data:a,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:s};return jt.forEach(Object.keys(t).concat(Object.keys(r)),function(u){var f=d[u]||i,h=f(u);jt.isUndefined(h)&&f!==s||(o[u]=h)}),o},pg={version:"0.26.1"},fz=pg.version,Qc={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){Qc[e]=function(o){return typeof o===e||"a"+(t<1?"n ":" ")+e}});var Cf={};Qc.transitional=function(t,r,o){function n(i,a){return"[Axios v"+fz+"] Transitional option '"+i+"'"+a+(o?". "+o:"")}return function(i,a,l){if(t===!1)throw new Error(n(a," has been removed"+(r?" in "+r:"")));return r&&!Cf[a]&&(Cf[a]=!0,console.warn(n(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,a,l):!0}};function hz(e,t,r){if(typeof e!="object")throw new TypeError("options must be an object");for(var o=Object.keys(e),n=o.length;n-- >0;){var i=o[n],a=t[i];if(a){var l=e[i],s=l===void 0||a(l,i,e);if(s!==!0)throw new TypeError("option "+i+" must be "+s);continue}if(r!==!0)throw Error("Unknown option "+i)}}var pz={assertOptions:hz,validators:Qc},mg=Ht,mz=sg,yf=zR,wf=uz,ol=hg,vg=pz,Vo=vg.validators;function Ei(e){this.defaults=e,this.interceptors={request:new yf,response:new yf}}Ei.prototype.request=function(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ol(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var o=r.transitional;o!==void 0&&vg.assertOptions(o,{silentJSONParsing:Vo.transitional(Vo.boolean),forcedJSONParsing:Vo.transitional(Vo.boolean),clarifyTimeoutError:Vo.transitional(Vo.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(r)===!1||(i=i&&h.synchronous,n.unshift(h.fulfilled,h.rejected))});var a=[];this.interceptors.response.forEach(function(h){a.push(h.fulfilled,h.rejected)});var l;if(!i){var s=[wf,void 0];for(Array.prototype.unshift.apply(s,n),s=s.concat(a),l=Promise.resolve(r);s.length;)l=l.then(s.shift(),s.shift());return l}for(var d=r;n.length;){var c=n.shift(),u=n.shift();try{d=c(d)}catch(f){u(f);break}}try{l=wf(d)}catch(f){return Promise.reject(f)}for(;a.length;)l=l.then(a.shift(),a.shift());return l};Ei.prototype.getUri=function(t){return t=ol(this.defaults,t),mz(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")};mg.forEach(["delete","get","head","options"],function(t){Ei.prototype[t]=function(r,o){return this.request(ol(o||{},{method:t,url:r,data:(o||{}).data}))}});mg.forEach(["post","put","patch"],function(t){Ei.prototype[t]=function(r,o,n){return this.request(ol(n||{},{method:t,url:r,data:o}))}});var vz=Ei,gz=tl;function gn(e){if(typeof e!="function")throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(n){t=n});var r=this;this.promise.then(function(o){if(!!r._listeners){var n,i=r._listeners.length;for(n=0;n(localStorage.getItem("PAOPAO_TOKEN")&&(e.headers.Authorization="Bearer "+localStorage.getItem("PAOPAO_TOKEN")),e),e=>Promise.reject(e));ed.interceptors.response.use(e=>{const{data:t={},code:r=0}=(e==null?void 0:e.data)||{};if(+r==0)return t||{};Promise.reject((e==null?void 0:e.data)||{})},(e={})=>{var r;const{response:t={}}=e||{};return+(t==null?void 0:t.status)==401?(localStorage.removeItem("PAOPAO_TOKEN"),(t==null?void 0:t.data.code)!==10005?window.$message.warning((t==null?void 0:t.data.msg)||"\u9274\u6743\u5931\u8D25"):window.$store.commit("triggerAuth",!0)):window.$message.error(((r=t==null?void 0:t.data)==null?void 0:r.msg)||"\u8BF7\u6C42\u5931\u8D25"),Promise.reject((t==null?void 0:t.data)||{})});function ke(e){return ed(e)}const _f=e=>ke({method:"post",url:"/v1/auth/login",data:e}),Pz=e=>ke({method:"post",url:"/v1/auth/register",data:e}),Ll=(e="")=>ke({method:"get",url:"/v1/user/info",headers:{Authorization:`Bearer ${e}`}});var bg=(e,t)=>{const r=e.__vccOpts||e;for(const[o,n]of t)r[o]=n;return r};const kz={class:"auth-wrap"},Tz=sr(" \u767B\u5F55 "),Ez=sr(" \u6CE8\u518C "),Rz=oe({setup(e){const t=Ba(),r=W(!1),o=W(),n=ar({username:"",password:""}),i=W(),a=ar({username:"",password:"",repassword:""}),l={username:{required:!0,message:"\u8BF7\u8F93\u5165\u8D26\u6237\u540D"},password:{required:!0,message:"\u8BF7\u8F93\u5165\u5BC6\u7801"},repassword:[{required:!0,message:"\u8BF7\u8F93\u5165\u5BC6\u7801"},{validator:(c,u)=>!!a.password&&a.password.startsWith(u)&&a.password.length>=u.length,message:"\u4E24\u6B21\u5BC6\u7801\u8F93\u5165\u4E0D\u4E00\u81F4",trigger:"input"}]},s=c=>{var u;c.preventDefault(),c.stopPropagation(),(u=o.value)==null||u.validate(f=>{f||(r.value=!0,_f({username:n.username,password:n.password}).then(h=>{const p=(h==null?void 0:h.token)||"";return localStorage.setItem("PAOPAO_TOKEN",p),Ll(p)}).then(h=>{window.$message.success("\u767B\u5F55\u6210\u529F"),r.value=!1,t.commit("updateUserinfo",h),t.commit("triggerAuth",!1),n.username="",n.password=""}).catch(h=>{r.value=!1}))})},d=c=>{var u;c.preventDefault(),c.stopPropagation(),(u=i.value)==null||u.validate(f=>{f||(r.value=!0,Pz({username:a.username,password:a.password}).then(h=>_f({username:a.username,password:a.password})).then(h=>{const p=(h==null?void 0:h.token)||"";return localStorage.setItem("PAOPAO_TOKEN",p),Ll(p)}).then(h=>{window.$message.success("\u6CE8\u518C\u6210\u529F"),r.value=!1,t.commit("updateUserinfo",h),t.commit("triggerAuth",!1),a.username="",a.password="",a.repassword=""}).catch(h=>{r.value=!1}))})};return Ot(()=>{const c=localStorage.getItem("PAOPAO_TOKEN")||"";c?Ll(c).then(u=>{t.commit("updateUserinfo",u),t.commit("triggerAuth",!1)}).catch(u=>{t.commit("userLogout")}):t.commit("userLogout")}),(c,u)=>{const f=Km,h=B8,p=jk,b=Ca,g=cR,v=hR,w=Oc,$=Pv;return st(),mo($,{show:Me(t).state.authModalShow,"onUpdate:show":u[5]||(u[5]=x=>Me(t).state.authModalShow=x),class:"auth-card",preset:"card",size:"small","mask-closable":!1,bordered:!1,style:{width:"360px"}},{default:Xe(()=>[Le("div",kz,[ge(w,{bordered:!1},{default:Xe(()=>[ge(v,{"default-value":Me(t).state.authModelTab,size:"large","justify-content":"space-evenly"},{default:Xe(()=>[ge(g,{name:"signin",tab:"\u767B\u5F55"},{default:Xe(()=>[ge(p,{ref_key:"loginRef",ref:o,model:Me(n),rules:{username:{required:!0,message:"\u8BF7\u8F93\u5165\u8D26\u6237\u540D"},password:{required:!0,message:"\u8BF7\u8F93\u5165\u5BC6\u7801"}}},{default:Xe(()=>[ge(h,{label:"\u8D26\u6237",path:"username"},{default:Xe(()=>[ge(f,{value:Me(n).username,"onUpdate:value":u[0]||(u[0]=x=>Me(n).username=x),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D",onKeyup:jn(Hn(s,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1}),ge(h,{label:"\u5BC6\u7801",path:"password"},{default:Xe(()=>[ge(f,{type:"password","show-password-on":"mousedown",value:Me(n).password,"onUpdate:value":u[1]||(u[1]=x=>Me(n).password=x),placeholder:"\u8BF7\u8F93\u5165\u8D26\u6237\u5BC6\u7801",onKeyup:jn(Hn(s,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1})]),_:1},8,["model"]),ge(b,{type:"primary",block:"",secondary:"",strong:"",loading:r.value,onClick:s},{default:Xe(()=>[Tz]),_:1},8,["loading"])]),_:1}),ge(g,{name:"signup",tab:"\u6CE8\u518C"},{default:Xe(()=>[ge(p,{ref_key:"registerRef",ref:i,model:Me(a),rules:l},{default:Xe(()=>[ge(h,{label:"\u7528\u6237\u540D",path:"username"},{default:Xe(()=>[ge(f,{value:Me(a).username,"onUpdate:value":u[2]||(u[2]=x=>Me(a).username=x),placeholder:"\u7528\u6237\u540D\u6CE8\u518C\u540E\u65E0\u6CD5\u4FEE\u6539"},null,8,["value"])]),_:1}),ge(h,{label:"\u5BC6\u7801",path:"password"},{default:Xe(()=>[ge(f,{type:"password","show-password-on":"mousedown",placeholder:"\u5BC6\u7801\u4E0D\u5C11\u4E8E6\u4F4D",value:Me(a).password,"onUpdate:value":u[3]||(u[3]=x=>Me(a).password=x),onKeyup:jn(Hn(d,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1}),ge(h,{label:"\u91CD\u590D\u5BC6\u7801",path:"repassword"},{default:Xe(()=>[ge(f,{type:"password","show-password-on":"mousedown",placeholder:"\u8BF7\u518D\u6B21\u8F93\u5165\u5BC6\u7801",value:Me(a).repassword,"onUpdate:value":u[4]||(u[4]=x=>Me(a).repassword=x),onKeyup:jn(Hn(d,["prevent"]),["enter"])},null,8,["value","onKeyup"])]),_:1})]),_:1},8,["model"]),ge(b,{type:"primary",block:"",secondary:"",strong:"",loading:r.value,onClick:d},{default:Xe(()=>[Ez]),_:1},8,["loading"])]),_:1})]),_:1},8,["default-value"])]),_:1})])]),_:1},8,["show"])}}});var zz=bg(Rz,[["__scopeId","data-v-66895776"]]);const _O=e=>ke({method:"get",url:"/v1/posts",params:e}),Az=e=>ke({method:"get",url:"/v1/tags",params:e}),$O=e=>ke({method:"get",url:"/v1/post",params:e}),PO=e=>ke({method:"get",url:"/v1/post/star",params:e}),kO=e=>ke({method:"post",url:"/v1/post/star",data:e}),TO=e=>ke({method:"get",url:"/v1/post/collection",params:e}),EO=e=>ke({method:"post",url:"/v1/post/collection",data:e}),RO=e=>ke({method:"get",url:"/v1/post/comments",params:e}),zO=e=>ke({method:"get",url:"/v1/user/contacts",params:e}),AO=e=>ke({method:"post",url:"/v1/post",data:e}),OO=e=>ke({method:"delete",url:"/v1/post",data:e}),IO=e=>ke({method:"post",url:"/v1/post/lock",data:e}),MO=e=>ke({method:"post",url:"/v1/post/stick",data:e}),BO=e=>ke({method:"post",url:"/v1/post/visibility",data:e}),LO=e=>ke({method:"post",url:"/v1/post/comment",data:e}),DO=e=>ke({method:"delete",url:"/v1/post/comment",data:e}),FO=e=>ke({method:"post",url:"/v1/post/comment/reply",data:e}),HO=e=>ke({method:"delete",url:"/v1/post/comment/reply",data:e}),Oz={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Iz=Le("path",{d:"M128 80V64a48.14 48.14 0 0 1 48-48h224a48.14 48.14 0 0 1 48 48v368l-80-64",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),Mz=Le("path",{d:"M320 96H112a48.14 48.14 0 0 0-48 48v352l152-128l152 128V144a48.14 48.14 0 0 0-48-48z",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),Bz=[Iz,Mz];var Lz=oe({name:"BookmarksOutline",render:function(t,r){return st(),Et("svg",Oz,Bz)}});const Dz={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Fz=Le("path",{d:"M431 320.6c-1-3.6 1.2-8.6 3.3-12.2a33.68 33.68 0 0 1 2.1-3.1A162 162 0 0 0 464 215c.3-92.2-77.5-167-173.7-167c-83.9 0-153.9 57.1-170.3 132.9a160.7 160.7 0 0 0-3.7 34.2c0 92.3 74.8 169.1 171 169.1c15.3 0 35.9-4.6 47.2-7.7s22.5-7.2 25.4-8.3a26.44 26.44 0 0 1 9.3-1.7a26 26 0 0 1 10.1 2l56.7 20.1a13.52 13.52 0 0 0 3.9 1a8 8 0 0 0 8-8a12.85 12.85 0 0 0-.5-2.7z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),Hz=Le("path",{d:"M66.46 232a146.23 146.23 0 0 0 6.39 152.67c2.31 3.49 3.61 6.19 3.21 8s-11.93 61.87-11.93 61.87a8 8 0 0 0 2.71 7.68A8.17 8.17 0 0 0 72 464a7.26 7.26 0 0 0 2.91-.6l56.21-22a15.7 15.7 0 0 1 12 .2c18.94 7.38 39.88 12 60.83 12A159.21 159.21 0 0 0 284 432.11",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),jz=[Fz,Hz];var Nz=oe({name:"ChatbubblesOutline",render:function(t,r){return st(),Et("svg",Dz,jz)}});const Wz={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Vz=Le("path",{d:"M80 212v236a16 16 0 0 0 16 16h96V328a24 24 0 0 1 24-24h80a24 24 0 0 1 24 24v136h96a16 16 0 0 0 16-16V212",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Kz=Le("path",{d:"M480 256L266.89 52c-5-5.28-16.69-5.34-21.78 0L32 256",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Uz=Le("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 179V64h-48v69"},null,-1),qz=[Vz,Kz,Uz];var $f=oe({name:"HomeOutline",render:function(t,r){return st(),Et("svg",Wz,qz)}});const Gz={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Yz=Le("path",{d:"M321.89 171.42C233 114 141 155.22 56 65.22c-19.8-21-8.3 235.5 98.1 332.7c77.79 71 197.9 63.08 238.4-5.92s18.28-163.17-70.61-220.58z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Xz=Le("path",{d:"M173 253c86 81 175 129 292 147",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),Zz=[Yz,Xz];var Jz=oe({name:"LeafOutline",render:function(t,r){return st(),Et("svg",Gz,Zz)}});const Qz={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},eA=Le("path",{d:"M304 336v40a40 40 0 0 1-40 40H104a40 40 0 0 1-40-40V136a40 40 0 0 1 40-40h152c22.09 0 48 17.91 48 40v40",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),tA=Le("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 336l80-80l-80-80"},null,-1),rA=Le("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M176 256h256"},null,-1),oA=[eA,tA,rA];var Pf=oe({name:"LogOutOutline",render:function(t,r){return st(),Et("svg",Qz,oA)}});const nA={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},iA=Sh('',6),aA=[iA];var lA=oe({name:"MegaphoneOutline",render:function(t,r){return st(),Et("svg",nA,aA)}});const sA={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},cA=Le("path",{d:"M402 168c-2.93 40.67-33.1 72-66 72s-63.12-31.32-66-72c-3-42.31 26.37-72 66-72s69 30.46 66 72z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),dA=Le("path",{d:"M336 304c-65.17 0-127.84 32.37-143.54 95.41c-2.08 8.34 3.15 16.59 11.72 16.59h263.65c8.57 0 13.77-8.25 11.72-16.59C463.85 335.36 401.18 304 336 304z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),uA=Le("path",{d:"M200 185.94c-2.34 32.48-26.72 58.06-53 58.06s-50.7-25.57-53-58.06C91.61 152.15 115.34 128 147 128s55.39 24.77 53 57.94z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),fA=Le("path",{d:"M206 306c-18.05-8.27-37.93-11.45-59-11.45c-52 0-102.1 25.85-114.65 76.2c-1.65 6.66 2.53 13.25 9.37 13.25H154",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32"},null,-1),hA=[cA,dA,uA,fA];var pA=oe({name:"PeopleOutline",render:function(t,r){return st(),Et("svg",sA,hA)}});const mA={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},vA=Le("path",{d:"M456.69 421.39L362.6 327.3a173.81 173.81 0 0 0 34.84-104.58C397.44 126.38 319.06 48 222.72 48S48 126.38 48 222.72s78.38 174.72 174.72 174.72A173.81 173.81 0 0 0 327.3 362.6l94.09 94.09a25 25 0 0 0 35.3-35.3zM97.92 222.72a124.8 124.8 0 1 1 124.8 124.8a124.95 124.95 0 0 1-124.8-124.8z",fill:"currentColor"},null,-1),gA=[vA];var bA=oe({name:"Search",render:function(t,r){return st(),Et("svg",mA,gA)}});const xA={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},CA=Le("path",{d:"M262.29 192.31a64 64 0 1 0 57.4 57.4a64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22a155.3 155.3 0 0 1-21.46-12.57a16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22a155.3 155.3 0 0 1 21.46 12.57a16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),yA=[CA];var wA=oe({name:"SettingsOutline",render:function(t,r){return st(),Et("svg",xA,yA)}});const SA={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},_A=Le("rect",{x:"48",y:"144",width:"416",height:"288",rx:"48",ry:"48",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),$A=Le("path",{d:"M411.36 144v-30A50 50 0 0 0 352 64.9L88.64 109.85A50 50 0 0 0 48 159v49",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32"},null,-1),PA=Le("path",{d:"M368 320a32 32 0 1 1 32-32a32 32 0 0 1-32 32z",fill:"currentColor"},null,-1),kA=[_A,$A,PA];var TA=oe({name:"WalletOutline",render:function(t,r){return st(),Et("svg",SA,kA)}});const EA={key:0,class:"rightbar-wrap"},RA={class:"search-wrap"},zA={class:"post-num"},AA={class:"copyright"},OA=["href"],IA=["href"],MA=oe({setup(e){const t=W([]),r=W(!1),o=W(""),n=Ba(),i=Uh(),a="2022 paopao.info",l="Roc's Me",s="",d="\u6CE1\u6CE1(PaoPao)\u5F00\u6E90\u793E\u533A",c="https://paopao.info",u=()=>{r.value=!0,Az({type:"hot",num:12}).then(p=>{t.value=p,r.value=!1}).catch(p=>{r.value=!1})},f=p=>p>=1e3?(p/1e3).toFixed(1)+"k":p,h=()=>{i.push({name:"home",query:{q:o.value}})};return Ot(()=>{u()}),(p,b)=>{const g=Jo,v=Km,w=bh("router-link"),$=sR,x=Oc,S=Ek;return Me(n).state.collapsedRight?Yl("",!0):(st(),Et("div",EA,[Le("div",RA,[ge(v,{round:"",clearable:"",placeholder:"\u641C\u4E00\u641C...",value:o.value,"onUpdate:value":b[0]||(b[0]=E=>o.value=E),onKeyup:jn(Hn(h,["prevent"]),["enter"])},{prefix:Xe(()=>[ge(g,{component:Me(bA)},null,8,["component"])]),_:1},8,["value","onKeyup"])]),ge(x,{title:"\u70ED\u95E8\u8BDD\u9898",embedded:"",bordered:!1,size:"small"},{default:Xe(()=>[ge($,{show:r.value},{default:Xe(()=>[(st(!0),Et(ot,null,W0(t.value,E=>(st(),Et("div",{class:"hot-tag-item",key:E.id},[ge(w,{class:"hash-link",to:{name:"home",query:{q:E.tag,t:"tag"}}},{default:Xe(()=>[sr(" #"+uo(E.tag),1)]),_:2},1032,["to"]),Le("div",zA,uo(f(E.quote_num)),1)]))),128))]),_:1},8,["show"])]),_:1}),ge(x,{class:"copyright-wrap",embedded:"",bordered:!1,size:"small"},{default:Xe(()=>[Le("div",AA,"\xA9 "+uo(Me(a)),1),Le("div",null,[ge(S,null,{default:Xe(()=>[Le("a",{href:Me(s),target:"_blank",class:"hash-link"},uo(Me(l)),9,OA),Le("a",{href:Me(c),target:"_blank",class:"hash-link"},uo(Me(d)),9,IA)]),_:1})])]),_:1})]))}}});var BA=bg(MA,[["__scopeId","data-v-0dc4cb5d"]]);const LA={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},DA=Sh('',1),FA=[DA];var kf=oe({name:"Hash",render:function(t,r){return st(),Et("svg",LA,FA)}});const jO=(e={})=>ke({method:"get",url:"/v1/captcha",params:e}),NO=e=>ke({method:"post",url:"/v1/captcha",data:e}),WO=e=>ke({method:"post",url:"/v1/user/whisper",data:e}),VO=e=>ke({method:"post",url:"/v1/friend/requesting",data:e}),KO=e=>ke({method:"post",url:"/v1/friend/add",data:e}),UO=e=>ke({method:"post",url:"/v1/friend/reject",data:e}),qO=e=>ke({method:"post",url:"/v1/friend/delete",data:e}),GO=e=>ke({method:"post",url:"/v1/user/phone",data:e}),YO=e=>ke({method:"post",url:"/v1/user/activate",data:e}),XO=e=>ke({method:"post",url:"/v1/user/password",data:e}),ZO=e=>ke({method:"post",url:"/v1/user/nickname",data:e}),JO=e=>ke({method:"post",url:"/v1/user/avatar",data:e}),Tf=(e={})=>ke({method:"get",url:"/v1/user/msgcount/unread",params:e}),QO=e=>ke({method:"get",url:"/v1/user/messages",params:e}),eI=e=>ke({method:"post",url:"/v1/user/message/read",data:e}),tI=e=>ke({method:"get",url:"/v1/user/collections",params:e}),rI=e=>ke({method:"get",url:"/v1/user/profile",params:e}),oI=e=>ke({method:"get",url:"/v1/user/posts",params:e}),nI=e=>ke({method:"get",url:"/v1/user/wallet/bills",params:e}),iI=e=>ke({method:"post",url:"/v1/user/recharge",data:e}),aI=e=>ke({method:"get",url:"/v1/user/recharge",params:e}),lI=e=>ke({method:"get",url:"/v1/suggest/users",params:e}),sI=e=>ke({method:"get",url:"/v1/suggest/tags",params:e}),cI=e=>ke({method:"get",url:"/v1/attachment/precheck",params:e}),dI=e=>ke({method:"get",url:"/v1/attachment",params:e}),uI=e=>ke({method:"post",url:"/v1/admin/user/status",data:e});var HA="/assets/logo.52afee68.png";const jA={class:"sidebar-wrap"},NA={class:"logo-wrap"},WA={key:0,class:"user-wrap"},VA={class:"user-info"},KA={class:"nickname"},UA={class:"nickname-txt"},qA={class:"username"},GA={class:"user-mini-wrap"},YA={key:1,class:"user-wrap"},XA={class:"login-wrap"},ZA=sr(" \u767B\u5F55 "),JA=sr(" \u6CE8\u518C "),QA=oe({setup(e){const t=Ba(),r=Zx(),o=Uh(),n=W(!1),i=W(r.name||""),a=W();qe(r,()=>{i.value=r.name}),qe(t.state,()=>{t.state.userInfo.id>0?a.value||(Tf().then(p=>{n.value=p.count>0}).catch(p=>{console.log(p)}),a.value=setInterval(()=>{Tf().then(p=>{n.value=p.count>0}).catch(p=>{console.log(p)})},5e3)):a.value&&clearInterval(a.value)}),Ot(()=>{window.onresize=()=>{t.commit("triggerCollapsedLeft",document.body.clientWidth<=821),t.commit("triggerCollapsedRight",document.body.clientWidth<=821)}});const l=L(()=>{const p=[{label:"\u5E7F\u573A",key:"home",icon:()=>m($f),href:"/"},{label:"\u8BDD\u9898",key:"topic",icon:()=>m(kf),href:"/topic"}];return"false".toLowerCase()==="true"&&p.push({label:"\u516C\u544A",key:"anouncement",icon:()=>m(lA),href:"/anouncement"}),p.push({label:"\u4E3B\u9875",key:"profile",icon:()=>m(Jz),href:"/profile"}),p.push({label:"\u6D88\u606F",key:"messages",icon:()=>m(Nz),href:"/messages"}),p.push({label:"\u6536\u85CF",key:"collection",icon:()=>m(Lz),href:"/collection"}),p.push({label:"\u597D\u53CB",key:"contacts",icon:()=>m(pA),href:"/contacts"}),"false".toLocaleLowerCase()==="true"&&p.push({label:"\u94B1\u5305",key:"wallet",icon:()=>m(TA),href:"/wallet"}),p.push({label:"\u8BBE\u7F6E",key:"setting",icon:()=>m(wA),href:"/setting"}),t.state.userInfo.id>0?p:[{label:"\u5E7F\u573A",key:"home",icon:()=>m($f),href:"/"},{label:"\u8BDD\u9898",key:"topic",icon:()=>m(kf),href:"/topic"}]}),s=p=>"href"in p?m("div",{},p.label):p.label,d=p=>p.key==="messages"?m(v6,{dot:!0,show:n.value,processing:!0},{default:()=>m(Jo,{color:p.key===i.value?"var(--n-item-icon-color-active)":"var(--n-item-icon-color)"},{default:p.icon})}):m(Jo,null,{default:p.icon}),c=(p,b={})=>{i.value=p,o.push({name:p})},u=()=>{r.path==="/"&&t.commit("refresh"),c("home")},f=p=>{t.commit("triggerAuth",!0),t.commit("triggerAuthKey",p)},h=()=>{t.commit("userLogout")};return window.$store=t,window.$message=oR(),(p,b)=>{const g=BE,v=YE,w=o6,$=Ca;return st(),Et("div",jA,[Le("div",NA,[ge(g,{class:"logo-img",width:"36",src:Me(HA),"preview-disabled":!0,onClick:u},null,8,["src"])]),ge(v,{accordion:!0,collapsed:Me(t).state.collapsedLeft,"collapsed-width":64,"icon-size":24,options:Me(l),"render-label":s,"render-icon":d,value:i.value,"onUpdate:value":c},null,8,["collapsed","options","value"]),Me(t).state.userInfo.id>0?(st(),Et("div",WA,[ge(w,{class:"user-avatar",round:"",size:34,src:Me(t).state.userInfo.avatar},null,8,["src"]),Le("div",VA,[Le("div",KA,[Le("span",UA,uo(Me(t).state.userInfo.nickname),1),ge($,{class:"logout",quaternary:"",circle:"",size:"tiny",onClick:h},{icon:Xe(()=>[ge(Me(Jo),null,{default:Xe(()=>[ge(Me(Pf))]),_:1})]),_:1})]),Le("div",qA,"@"+uo(Me(t).state.userInfo.username),1)]),Le("div",GA,[ge($,{class:"logout",quaternary:"",circle:"",onClick:h},{icon:Xe(()=>[ge(Me(Jo),{size:24},{default:Xe(()=>[ge(Me(Pf))]),_:1})]),_:1})])])):(st(),Et("div",YA,[Le("div",XA,[ge($,{strong:"",secondary:"",round:"",type:"primary",onClick:b[0]||(b[0]=x=>f("signin"))},{default:Xe(()=>[ZA]),_:1}),ge($,{strong:"",secondary:"",round:"",type:"info",onClick:b[1]||(b[1]=x=>f("signup"))},{default:Xe(()=>[JA]),_:1})])]))])}}});const eO={"has-sider":"",class:"main-wrap",position:"static"},tO={class:"content-wrap"},rO=oe({setup(e){const t=Ba(),r=L(()=>t.state.theme==="dark"?pR:null);return(o,n)=>{const i=QA,a=bh("router-view"),l=BA,s=zz,d=pk,c=rR,u=L8,f=n4;return st(),mo(f,{theme:Me(r)},{default:Xe(()=>[ge(c,null,{default:Xe(()=>[ge(d,null,{default:Xe(()=>{var h;return[Le("div",{class:ya(["app-container",{dark:((h=Me(r))==null?void 0:h.name)==="dark"}])},[Le("div",eO,[ge(i),Le("div",tO,[ge(a,{class:"app-wrap"},{default:Xe(({Component:p})=>[(st(),mo(h0,null,[o.$route.meta.keepAlive?(st(),mo(xd(p),{key:0})):Yl("",!0)],1024)),o.$route.meta.keepAlive?Yl("",!0):(st(),mo(xd(p),{key:0}))]),_:1})]),ge(l)]),ge(s)],2)]}),_:1})]),_:1}),ge(u)]),_:1},8,["theme"])}}});I1(rO).use(qh).use(vC).mount("#app");export{lI as $,je as A,So as B,EC as C,dO as D,Wm as E,Xa as F,yk as G,ss as H,em as I,Ca as J,_o as K,b$ as L,AC as M,Bt as N,hO as O,Uf as P,Ge as Q,dn as R,qe as S,Tr as T,nt as U,st as V,Et as W,pO as X,Le as Y,Ba as Z,Km as _,m4 as a,bC as a$,sI as a0,Ot as a1,Me as a2,ge as a3,Xe as a4,mo as a5,Yl as a6,Hn as a7,sr as a8,uo as a9,dc as aA,pp as aB,gO as aC,$n as aD,fm as aE,br as aF,V0 as aG,Zo as aH,T3 as aI,Ct as aJ,xr as aK,$3 as aL,Mm as aM,RC as aN,vi as aO,a4 as aP,lm as aQ,di as aR,xi as aS,pn as aT,dm as aU,um as aV,hm as aW,At as aX,Cr as aY,li as aZ,Cs as a_,ot as aa,W0 as ab,AO as ac,o6 as ad,Jo as ae,cv as af,Ek as ag,bg as ah,Zx as ai,Uh as aj,_O as ak,bh as al,iO as am,fO as an,gr as ao,uc as ap,Yr as aq,It as ar,YT as as,pi as at,xC as au,tu as av,cc as aw,Va as ax,Ua as ay,Oc as az,ee as b,Jr as b$,mO as b0,p0 as b1,Xr as b2,vn as b3,ip as b4,km as b5,Gr as b6,cO as b7,n3 as b8,uO as b9,wO as bA,gh as bB,vO as bC,er as bD,bO as bE,Vt as bF,sc as bG,Ya as bH,Sh as bI,FO as bJ,HO as bK,DO as bL,oO as bM,nO as bN,LO as bO,PO as bP,TO as bQ,OO as bR,IO as bS,MO as bT,BO as bU,kO as bV,EO as bW,F4 as bX,$O as bY,RO as bZ,sR as b_,ap as ba,fy as bb,Em as bc,Qt as bd,Da as be,fc as bf,Zr as bg,lr as bh,aO as bi,jn as bj,xd as bk,BE as bl,SO as bm,cI as bn,dI as bo,Pv as bp,yO as bq,wr as br,om as bs,tm as bt,nm as bu,rm as bv,kT as bw,Ka as bx,y$ as by,jm as bz,Ke as c,Az as c0,cR as c1,hR as c2,ya as c3,oI as c4,Ic as c5,rk as c6,WO as c7,VO as c8,oR as c9,YO as cA,ZO as cB,NO as cC,P8 as cD,A8 as cE,R8 as cF,jk as cG,xO as cH,ar as ca,rI as cb,qO as cc,uI as cd,O3 as ce,ye as cf,yi as cg,KO as ch,UO as ci,eI as cj,v6 as ck,QO as cl,tI as cm,zO as cn,mu as co,Op as cp,dr as cq,CO as cr,Ll as cs,nI as ct,iI as cu,aI as cv,jO as cw,JO as cx,XO as cy,GO as cz,oe as d,lO as e,wp as f,hn as g,m as h,be as i,ht as j,Be as k,M as l,F as m,z as n,K as o,ut as p,ze as q,W as r,L as s,Oe as t,lt as u,ae as v,Kr as w,Pn as x,_t as y,bt as z}; diff --git a/web/dist/assets/main-nav.9110259b.js b/web/dist/assets/main-nav.9110259b.js deleted file mode 100644 index 7e8d8466..00000000 --- a/web/dist/assets/main-nav.9110259b.js +++ /dev/null @@ -1,100 +0,0 @@ -import{ao as G,ap as Ce,aq as Be,ar as ze,r as N,c as Re,as as Se,b as Me,l as Q,m as t,at as ee,n as U,o as w,p as te,d as V,u as Ve,q as oe,f as $e,t as Le,g as Fe,s as T,v as _,au as q,av as h,y as Te,aw as K,h as r,z as k,ax as Oe,ay as Ee,k as Y,V as z,W as J,Y as W,Z as Ae,aj as Ne,a1 as Pe,a5 as X,a4 as M,a3 as O,a2 as E,a6 as ne,a8 as De,a9 as We,ae as Ie,J as He,az as je}from"./index.f480f018.js";let A=0;const Ue=typeof window!="undefined"&&window.matchMedia!==void 0,y=N(null);let c,x;function P(e){e.matches&&(y.value="dark")}function D(e){e.matches&&(y.value="light")}function qe(){c=window.matchMedia("(prefers-color-scheme: dark)"),x=window.matchMedia("(prefers-color-scheme: light)"),c.matches?y.value="dark":x.matches?y.value="light":y.value=null,c.addEventListener?(c.addEventListener("change",P),x.addEventListener("change",D)):c.addListener&&(c.addListener(P),x.addListener(D))}function Ke(){"removeEventListener"in c?(c.removeEventListener("change",P),x.removeEventListener("change",D)):"removeListener"in c&&(c.removeListener(P),x.removeListener(D)),c=void 0,x=void 0}let ae=!0;function Ye(){return Ue?(A===0&&qe(),ae&&(ae=Ce())&&(Be(()=>{A+=1}),ze(()=>{A-=1,A===0&&Ke()})),G(y)):G(y)}const Xe=e=>{const{primaryColor:o,opacityDisabled:i,borderRadius:s,textColor3:l}=e,f="rgba(0, 0, 0, .14)";return Object.assign(Object.assign({},Se),{iconColor:l,textColor:"white",loadingColor:o,opacityDisabled:i,railColor:f,railColorActive:o,buttonBoxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.3), inset 0 0 1px 0 rgba(0, 0, 0, 0.05)",buttonColor:"#FFF",railBorderRadiusSmall:s,railBorderRadiusMedium:s,railBorderRadiusLarge:s,buttonBorderRadiusSmall:s,buttonBorderRadiusMedium:s,buttonBorderRadiusLarge:s,boxShadowFocus:`0 0 0 2px ${Me(o,{alpha:.2})}`})},Je={name:"Switch",common:Re,self:Xe};var Ze=Je,Ge=Q("switch",` - height: var(--n-height); - min-width: var(--n-width); - vertical-align: middle; - user-select: none; - display: inline-flex; - outline: none; - justify-content: center; - align-items: center; -`,[t("children-placeholder",` - height: var(--n-rail-height); - display: flex; - flex-direction: column; - overflow: hidden; - pointer-events: none; - visibility: hidden; - `),t("rail-placeholder",` - display: flex; - flex-wrap: none; - `),t("button-placeholder",` - width: calc(1.75 * var(--n-rail-height)); - height: var(--n-rail-height); - `),Q("base-loading",` - position: absolute; - top: 50%; - left: 50%; - transform: translateX(-50%) translateY(-50%); - font-size: calc(var(--n-button-width) - 4px); - color: var(--n-loading-color); - transition: color .3s var(--n-bezier); - `,[ee({originalTransform:"translateX(-50%) translateY(-50%)"})]),t("checked, unchecked",` - transition: color .3s var(--n-bezier); - color: var(--n-text-color); - box-sizing: border-box; - position: absolute; - white-space: nowrap; - top: 0; - bottom: 0; - display: flex; - align-items: center; - line-height: 1; - `),t("checked",` - right: 0; - padding-right: calc(1.25 * var(--n-rail-height) - var(--n-offset)); - `),t("unchecked",` - left: 0; - justify-content: flex-end; - padding-left: calc(1.25 * var(--n-rail-height) - var(--n-offset)); - `),U("&:focus",[t("rail",` - box-shadow: var(--n-box-shadow-focus); - `)]),w("round",[t("rail",{borderRadius:"calc(var(--n-rail-height) / 2)"},[t("button",{borderRadius:"calc(var(--n-button-height) / 2)"})])]),te("disabled",[te("icon",[w("pressed",[t("rail",[t("button",{maxWidth:"var(--n-button-width-pressed)"})])]),t("rail",[U("&:active",[t("button",{maxWidth:"var(--n-button-width-pressed)"})])]),w("active",[w("pressed",[t("rail",[t("button",{left:"calc(100% - var(--n-offset) - var(--n-button-width-pressed))"})])]),t("rail",[U("&:active",[t("button",{left:"calc(100% - var(--n-offset) - var(--n-button-width-pressed))"})])])])])]),w("active",[t("rail",[t("button",{left:"calc(100% - (var(--n-rail-height) + var(--n-button-width)) / 2)"})])]),t("rail",` - overflow: hidden; - height: var(--n-rail-height); - min-width: var(--n-rail-width); - border-radius: var(--n-rail-border-radius); - cursor: pointer; - position: relative; - transition: - background .3s var(--n-bezier), - box-shadow .3s var(--n-bezier); - background-color: var(--n-rail-color); - `,[t("button-icon",` - color: var(--n-icon-color); - transition: color .3s var(--n-bezier); - font-size: calc(var(--n-button-height) - 4px); - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - display: flex; - justify-content: center; - align-items: center; - line-height: 1; - `,[ee()]),t("button",` - align-items: center; - top: var(--n-offset); - left: var(--n-offset); - height: var(--n-button-width); - width: var(--n-button-width-pressed); - max-width: var(--n-button-width); - border-radius: var(--n-button-border-radius); - background-color: var(--n-button-color); - box-shadow: var(--n-button-box-shadow); - box-sizing: border-box; - cursor: inherit; - content: ""; - position: absolute; - transition: - background-color .3s var(--n-bezier), - left .3s var(--n-bezier), - opacity .3s var(--n-bezier), - max-width .3s var(--n-bezier), - box-shadow .3s var(--n-bezier); - `)]),w("active",[t("rail","background-color: var(--n-rail-color-active);")]),w("disabled",[t("rail",` - cursor: not-allowed; - opacity: .5; - `)]),w("loading",[t("rail",` - pointer-events: none; - `)])]);const Qe=Object.assign(Object.assign({},oe.props),{size:{type:String,default:"medium"},value:{type:[String,Number,Boolean],default:void 0},loading:Boolean,defaultValue:{type:[String,Number,Boolean],default:!1},disabled:{type:Boolean,default:void 0},round:{type:Boolean,default:!0},"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],checkedValue:{type:[String,Number,Boolean],default:!0},uncheckedValue:{type:[String,Number,Boolean],default:!1},railStyle:Function,onChange:[Function,Array]});var et=V({name:"Switch",props:Qe,setup(e){const{mergedClsPrefixRef:o,inlineThemeDisabled:i}=Ve(e),s=oe("Switch","-switch",Ge,Ze,e,o),l=$e(e),{mergedSizeRef:f,mergedDisabledRef:d}=l,C=N(e.defaultValue),v=Le(e,"value"),u=Fe(v,C),p=T(()=>u.value===e.checkedValue),g=N(!1),a=N(!1),m=T(()=>{const{railStyle:n}=e;if(!!n)return n({focused:a.value,checked:p.value})});function b(n){const{"onUpdate:value":$,onChange:L,onUpdateValue:F}=e,{nTriggerFormInput:I,nTriggerFormChange:H}=l;$&&Y($,n),F&&Y(F,n),L&&Y(L,n),C.value=n,I(),H()}function ie(){const{nTriggerFormFocus:n}=l;n()}function re(){const{nTriggerFormBlur:n}=l;n()}function se(){e.loading||d.value||(u.value!==e.checkedValue?b(e.checkedValue):b(e.uncheckedValue))}function le(){a.value=!0,ie()}function ce(){a.value=!1,re(),g.value=!1}function de(n){e.loading||d.value||n.code==="Space"&&(u.value!==e.checkedValue?b(e.checkedValue):b(e.uncheckedValue),g.value=!1)}function ue(n){e.loading||d.value||n.code==="Space"&&(n.preventDefault(),g.value=!0)}const Z=T(()=>{const{value:n}=f,{self:{opacityDisabled:$,railColor:L,railColorActive:F,buttonBoxShadow:I,buttonColor:H,boxShadowFocus:he,loadingColor:fe,textColor:ve,iconColor:ge,[_("buttonHeight",n)]:R,[_("buttonWidth",n)]:me,[_("buttonWidthPressed",n)]:be,[_("railHeight",n)]:S,[_("railWidth",n)]:j,[_("railBorderRadius",n)]:we,[_("buttonBorderRadius",n)]:pe},common:{cubicBezierEaseInOut:_e}}=s.value,ke=q((h(S)-h(R))/2),xe=q(Math.max(h(S),h(R))),ye=h(S)>h(R)?j:q(h(j)+h(R)-h(S));return{"--n-bezier":_e,"--n-button-border-radius":pe,"--n-button-box-shadow":I,"--n-button-color":H,"--n-button-width":me,"--n-button-width-pressed":be,"--n-button-height":R,"--n-height":xe,"--n-offset":ke,"--n-opacity-disabled":$,"--n-rail-border-radius":we,"--n-rail-color":L,"--n-rail-color-active":F,"--n-rail-height":S,"--n-rail-width":j,"--n-width":ye,"--n-box-shadow-focus":he,"--n-loading-color":fe,"--n-text-color":ve,"--n-icon-color":ge}}),B=i?Te("switch",T(()=>f.value[0]),Z,e):void 0;return{handleClick:se,handleBlur:ce,handleFocus:le,handleKeyup:de,handleKeydown:ue,mergedRailStyle:m,pressed:g,mergedClsPrefix:o,mergedValue:u,checked:p,mergedDisabled:d,cssVars:i?void 0:Z,themeClass:B==null?void 0:B.themeClass,onRender:B==null?void 0:B.onRender}},render(){const{mergedClsPrefix:e,mergedDisabled:o,checked:i,mergedRailStyle:s,onRender:l,$slots:f}=this;l==null||l();const{checked:d,unchecked:C,icon:v,"checked-icon":u,"unchecked-icon":p}=f,g=!(K(v)&&K(u)&&K(p));return r("div",{role:"switch","aria-checked":i,class:[`${e}-switch`,this.themeClass,g&&`${e}-switch--icon`,i&&`${e}-switch--active`,o&&`${e}-switch--disabled`,this.round&&`${e}-switch--round`,this.loading&&`${e}-switch--loading`,this.pressed&&`${e}-switch--pressed`],tabindex:this.mergedDisabled?void 0:0,style:this.cssVars,onClick:this.handleClick,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyup:this.handleKeyup,onKeydown:this.handleKeydown},r("div",{class:`${e}-switch__rail`,"aria-hidden":"true",style:s},k(d,a=>k(C,m=>a||m?r("div",{"aria-hidden":!0,class:`${e}-switch__children-placeholder`},r("div",{class:`${e}-switch__rail-placeholder`},r("div",{class:`${e}-switch__button-placeholder`}),a),r("div",{class:`${e}-switch__rail-placeholder`},r("div",{class:`${e}-switch__button-placeholder`}),m)):null)),r("div",{class:`${e}-switch__button`},k(v,a=>k(u,m=>k(p,b=>r(Oe,null,{default:()=>this.loading?r(Ee,{key:"loading",clsPrefix:e,strokeWidth:20}):this.checked&&(m||a)?r("div",{class:`${e}-switch__button-icon`,key:m?"checked-icon":"icon"},m||a):!this.checked&&(b||a)?r("div",{class:`${e}-switch__button-icon`,key:b?"unchecked-icon":"icon"},b||a):null})))),k(d,a=>a&&r("div",{key:"checked",class:`${e}-switch__checked`},a)),k(C,a=>a&&r("div",{key:"unchecked",class:`${e}-switch__unchecked`},a)))))}});const tt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},nt=W("path",{d:"M14.71 6.71a.996.996 0 0 0-1.41 0L8.71 11.3a.996.996 0 0 0 0 1.41l4.59 4.59a.996.996 0 1 0 1.41-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41z",fill:"currentColor"},null,-1),at=[nt];var ot=V({name:"ChevronLeftRound",render:function(o,i){return z(),J("svg",tt,at)}});const it={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},rt=W("path",{d:"M9.37 5.51A7.35 7.35 0 0 0 9.1 7.5c0 4.08 3.32 7.4 7.4 7.4c.68 0 1.35-.09 1.99-.27A7.014 7.014 0 0 1 12 19c-3.86 0-7-3.14-7-7c0-2.93 1.81-5.45 4.37-6.49zM12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.389 5.389 0 0 1-4.4 2.26a5.403 5.403 0 0 1-3.14-9.8c-.44-.06-.9-.1-1.36-.1z",fill:"currentColor"},null,-1),st=[rt];var lt=V({name:"DarkModeOutlined",render:function(o,i){return z(),J("svg",it,st)}});const ct={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},dt=W("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3s-3-1.35-3-3s1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5s5-2.24 5-5s-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58a.996.996 0 0 0-1.41 0a.996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37a.996.996 0 0 0-1.41 0a.996.996 0 0 0 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0a.996.996 0 0 0 0-1.41l-1.06-1.06zm1.06-10.96a.996.996 0 0 0 0-1.41a.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36a.996.996 0 0 0 0-1.41a.996.996 0 0 0-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z",fill:"currentColor"},null,-1),ut=[dt];var ht=V({name:"LightModeOutlined",render:function(o,i){return z(),J("svg",ct,ut)}});const ft={class:"navbar"},gt=V({props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(e){const o=e,i=Ae(),s=Ne(),l=d=>{d?(localStorage.setItem("PAOPAO_THEME","dark"),i.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),i.commit("triggerTheme","light"))},f=()=>{window.history.length<=1?s.push({path:"/"}):s.go(-1)};return Pe(()=>{localStorage.getItem("PAOPAO_THEME")||l(Ye()==="dark")}),(d,C)=>{const v=Ie,u=He,p=et,g=je;return z(),X(g,{size:"small",bordered:!0,class:"nav-title-card"},{header:M(()=>[W("div",ft,[e.back?(z(),X(u,{key:0,class:"back-btn",onClick:f,quaternary:"",circle:"",size:"small"},{icon:M(()=>[O(v,null,{default:M(()=>[O(E(ot))]),_:1})]),_:1})):ne("",!0),De(" "+We(o.title)+" ",1),o.theme?(z(),X(p,{key:1,value:E(i).state.theme==="dark","onUpdate:value":l,size:"small",class:"theme-switch-wrap"},{"checked-icon":M(()=>[O(v,{component:E(ht)},null,8,["component"])]),"unchecked-icon":M(()=>[O(v,{component:E(lt)},null,8,["component"])]),_:1},8,["value"])):ne("",!0)])]),_:1})}}});export{gt as _}; diff --git a/web/dist/assets/post-item.03452002.js b/web/dist/assets/post-item.03452002.js deleted file mode 100644 index 4844606e..00000000 --- a/web/dist/assets/post-item.03452002.js +++ /dev/null @@ -1 +0,0 @@ -import{p as O,H as $,C as j,B as D,_ as E,a as F,b as L,c as M}from"./content.ef1e095a.js";import{d as R,ai as S,aj as I,Z as P,s as W,al as Y,V as o,W as f,a3 as i,am as Z,a2 as t,a4 as n,aa as A,ab as G,a7 as v,Y as u,a8 as p,a9 as c,a5 as r,a6 as _,ad as J,an as K,ae as Q,ag as U}from"./index.f480f018.js";import{f as X}from"./formatTime.02109bf5.js";import{_ as tt}from"./Thing.eef6b133.js";const et={class:"nickname-wrap"},st={class:"username-wrap"},at=p(" \u7F6E\u9876 "),nt=p(" \u79C1\u5BC6 "),ot=p(" \u597D\u53CB\u53EF\u89C1 "),it={class:"timestamp"},rt=["innerHTML"],_t={class:"opt-item"},ct={class:"opt-item"},pt={class:"opt-item"},ht=R({props:{post:null},setup(x){const C=x;S();const m=I(),B=P(),e=W(()=>{let a=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},C.post);return a.contents.map(s=>{(+s.type==1||+s.type==2)&&a.texts.push(s),+s.type==3&&a.imgs.push(s),+s.type==4&&a.videos.push(s),+s.type==6&&a.links.push(s),+s.type==7&&a.attachments.push(s),+s.type==8&&a.charge_attachments.push(s)}),a}),k=a=>{m.push({name:"post",query:{id:a}})},b=(a,s)=>{if(a.target.dataset.detail){const l=a.target.dataset.detail.split(":");if(l.length===2){B.commit("refresh"),l[0]==="tag"?m.push({name:"home",query:{q:l[1],t:"tag"}}):m.push({name:"user",query:{username:l[1]}});return}}k(s)};return(a,s)=>{const l=J,z=Y("router-link"),d=K,y=E,w=F,T=L,q=M,h=Q,N=U,V=tt;return o(),f("div",{class:"post-item",onClick:s[2]||(s[2]=g=>k(t(e).id))},[i(V,{"content-indented":""},Z({avatar:n(()=>[i(l,{round:"",size:30,src:t(e).user.avatar},null,8,["src"])]),header:n(()=>[u("span",et,[i(z,{onClick:s[0]||(s[0]=v(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:t(e).user.username}}},{default:n(()=>[p(c(t(e).user.nickname),1)]),_:1},8,["to"])]),u("span",st," @"+c(t(e).user.username),1),t(e).is_top?(o(),r(d,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:n(()=>[at]),_:1})):_("",!0),t(e).visibility==1?(o(),r(d,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:n(()=>[nt]),_:1})):_("",!0),t(e).visibility==2?(o(),r(d,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:n(()=>[ot]),_:1})):_("",!0)]),"header-extra":n(()=>[u("span",it,c(t(e).ip_loc?t(e).ip_loc+" \xB7 ":t(e).ip_loc)+" "+c(t(X)(t(e).created_on)),1)]),footer:n(()=>[t(e).attachments.length>0?(o(),r(y,{key:0,attachments:t(e).attachments},null,8,["attachments"])):_("",!0),t(e).charge_attachments.length>0?(o(),r(y,{key:1,attachments:t(e).charge_attachments,price:t(e).attachment_price},null,8,["attachments","price"])):_("",!0),t(e).imgs.length>0?(o(),r(w,{key:2,imgs:t(e).imgs},null,8,["imgs"])):_("",!0),t(e).videos.length>0?(o(),r(T,{key:3,videos:t(e).videos},null,8,["videos"])):_("",!0),t(e).links.length>0?(o(),r(q,{key:4,links:t(e).links},null,8,["links"])):_("",!0)]),action:n(()=>[i(N,{justify:"space-between"},{default:n(()=>[u("div",_t,[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t($))]),_:1}),p(" "+c(t(e).upvote_count),1)]),u("div",ct,[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t(j))]),_:1}),p(" "+c(t(e).comment_count),1)]),u("div",pt,[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t(D))]),_:1}),p(" "+c(t(e).collection_count),1)])]),_:1})]),_:2},[t(e).texts.length>0?{name:"description",fn:n(()=>[(o(!0),f(A,null,G(t(e).texts,g=>(o(),f("span",{key:g.id,class:"post-text",onClick:s[1]||(s[1]=v(H=>b(H,t(e).id),["stop"])),innerHTML:t(O)(g.content).content},null,8,rt))),128))])}:void 0]),1024)])}}});export{ht as _}; diff --git a/web/dist/assets/post-skeleton.39a35f5b.js b/web/dist/assets/post-skeleton.39a35f5b.js deleted file mode 100644 index 57595403..00000000 --- a/web/dist/assets/post-skeleton.39a35f5b.js +++ /dev/null @@ -1 +0,0 @@ -import{ah as r,d as c,V as s,W as n,ab as l,Y as a,a3 as t,aa as p}from"./index.f480f018.js";import{b as d}from"./Skeleton.57e98fe3.js";const i={class:"user"},u={class:"content"},m=c({props:{num:{default:1}},setup(o){return(v,f)=>{const e=d;return s(!0),n(p,null,l(new Array(o.num),_=>(s(),n("div",{class:"skeleton-item",key:_},[a("div",i,[t(e,{circle:"",size:"small"})]),a("div",u,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});var h=r(m,[["__scopeId","data-v-a6d56894"]]);export{h as _}; diff --git a/web/dist/index.html b/web/dist/index.html index a71980a3..729d3d7c 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -6,8 +6,8 @@ 泡泡 - - + + diff --git a/web/embed.go b/web/embed.go index 4866a53a..a16df24a 100644 --- a/web/embed.go +++ b/web/embed.go @@ -1,3 +1,7 @@ +// Copyright 2022 ROC. All rights reserved. +// Use of this source code is governed by a MIT style +// license that can be found in the LICENSE file. + //go:build embed // +build embed diff --git a/web/src/components/compose.vue b/web/src/components/compose.vue index 42b28006..b4faf3ec 100644 --- a/web/src/components/compose.vue +++ b/web/src/components/compose.vue @@ -340,7 +340,7 @@ const loadSuggestionUsers = debounce((k) => { }) .then((res) => { let options: MentionOption[] = []; - res.map((i) => { + res.suggest.map((i) => { options.push({ label: i, value: i, @@ -361,7 +361,7 @@ const loadSuggestionTags = debounce((k) => { }) .then((res) => { let options: MentionOption[] = []; - res.map((i) => { + res.suggest.map((i) => { options.push({ label: i, value: i, diff --git a/web/src/components/post-attachment.vue b/web/src/components/post-attachment.vue index a3d01bf8..689e8eae 100644 --- a/web/src/components/post-attachment.vue +++ b/web/src/components/post-attachment.vue @@ -96,7 +96,7 @@ const execDownloadAction = () => { id: attachmentID.value, }) .then((res) => { - window.open(res.replace('http://', 'https://'), '_blank'); + window.open(res.signed_url.replace('http://', 'https://'), '_blank'); }) .catch((err) => { console.log(err); diff --git a/web/src/components/rightbar.vue b/web/src/components/rightbar.vue index 1d680183..58da2402 100644 --- a/web/src/components/rightbar.vue +++ b/web/src/components/rightbar.vue @@ -84,7 +84,7 @@ const loadTags = () => { num: 12, }) .then((res) => { - tags.value = res; + tags.value = res.topics; loading.value = false; }) .catch((err) => { diff --git a/web/src/types/NetReq.d.ts b/web/src/types/NetReq.d.ts index 9fd63578..b317c587 100644 --- a/web/src/types/NetReq.d.ts +++ b/web/src/types/NetReq.d.ts @@ -24,14 +24,21 @@ declare module NetReq { pager: Item.PagerProps } - type UserGetSuggestUsers = string[] - type UserGetSuggestTags = string[] + interface UserGetSuggestUsers { + suggest: string[] + } + + interface UserGetSuggestTags { + suggest: string[] + } interface UserPrecheckAttachment { paid: number } - type UserGetAttachment = string + interface UserGetAttachment { + signed_url: string + } interface UserGetUnreadMsgCount { count: number @@ -151,7 +158,9 @@ declare module NetReq { status: boolean } - type PostGetTags = Item.TagProps[] + interface PostGetTags { + topics: Item.TagProps[] + } interface PostGetPostComments { /** 评论列表 */ diff --git a/web/src/views/Topic.vue b/web/src/views/Topic.vue index 303accb2..dd91b9b5 100644 --- a/web/src/views/Topic.vue +++ b/web/src/views/Topic.vue @@ -54,7 +54,7 @@ const loadTags = () => { num: 50, }) .then((res) => { - tags.value = res; + tags.value = res.topics; loading.value = false; }) .catch((err) => {