mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-09-30 03:22:04 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7b29c1961 | ||
|
|
147344546b | ||
|
|
ff935a39a1 | ||
|
|
2cce0b17b0 | ||
|
|
5f25572e95 | ||
|
|
dd5c9ccce8 | ||
|
|
da29141248 | ||
|
|
7f6049ebd6 | ||
|
|
119e1fb3f2 | ||
|
|
c5091898ae | ||
|
|
35bd395e55 | ||
|
|
d56b8fcb90 | ||
|
|
65b830198b | ||
|
|
ac0c23ff64 | ||
|
|
a355c8e8a9 | ||
|
|
c346dd69a4 | ||
|
|
f8f785d6e3 | ||
|
|
8288da8372 | ||
|
|
8b2b26c196 | ||
|
|
8009d37d24 | ||
|
|
6e9d000426 | ||
|
|
a426484916 | ||
|
|
b0ca9b2f1b | ||
|
|
956263d1fc | ||
|
|
51d635bc12 | ||
|
|
5fb45a1864 | ||
|
|
4e58e7ad6a | ||
|
|
93ab5fbea2 | ||
|
|
f459dd8812 | ||
|
|
95f9d685dc | ||
|
|
bb00f198bc | ||
|
|
0e1b9a3897 | ||
|
|
e32cf12908 | ||
|
|
c152f99793 | ||
|
|
f8b7a40837 | ||
|
|
a049a37624 | ||
|
|
8268c26d8b | ||
|
|
6292e6cc2e | ||
|
|
fbeaabf6aa | ||
|
|
30d1b9f358 | ||
|
|
16fa099685 | ||
|
|
bb4bebc724 |
No files matched your search
@@ -21,7 +21,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.19.0-beta.1'
|
||||
go-version: '>=1.19.0'
|
||||
|
||||
# This step usually is not needed because the /ui/dist is pregenerated locally
|
||||
# but its here to ensure that each release embeds the latest admin ui artifacts.
|
||||
|
||||
@@ -91,7 +91,7 @@ Running/building the application is the same as for any other Go program, aka. j
|
||||
|
||||
**PocketBase embeds SQLite, but doesn't require CGO.**
|
||||
|
||||
If CGO is enabled, it will use [mattn/go-sqlite3](https://pkg.go.dev/github.com/mattn/go-sqlite3) driver, otherwise - [modernc.org/sqlite](https://pkg.go.dev/modernc.org/sqlite). You can enable and disable CGO by setting the `CGO_ENABLED` enviroment variable to `1` or `0` respectively.
|
||||
If CGO is enabled, it will use [mattn/go-sqlite3](https://pkg.go.dev/github.com/mattn/go-sqlite3) driver, otherwise - [modernc.org/sqlite](https://pkg.go.dev/modernc.org/sqlite). You can enable and disable CGO by setting the `CGO_ENABLED` environment variable to `1` or `0` respectively.
|
||||
|
||||
Enable CGO only if you really need to squeeze the read/write query performance at the expense of complicating cross compilation.
|
||||
|
||||
|
||||
+25
-13
@@ -18,6 +18,8 @@ import (
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
const trailedAdminPath = "/_/"
|
||||
|
||||
// InitApi creates a configured echo instance with registered
|
||||
// system and app specific routes and middlewares.
|
||||
func InitApi(app core.App) (*echo.Echo, error) {
|
||||
@@ -25,7 +27,12 @@ func InitApi(app core.App) (*echo.Echo, error) {
|
||||
e.Debug = app.IsDebug()
|
||||
|
||||
// default middlewares
|
||||
e.Pre(middleware.RemoveTrailingSlash())
|
||||
e.Pre(middleware.RemoveTrailingSlashWithConfig(middleware.RemoveTrailingSlashConfig{
|
||||
Skipper: func(c echo.Context) bool {
|
||||
// ignore Admin UI route(s)
|
||||
return strings.HasPrefix(c.Request().URL.Path, trailedAdminPath)
|
||||
},
|
||||
}))
|
||||
e.Use(middleware.Recover())
|
||||
e.Use(middleware.Secure())
|
||||
e.Use(LoadAuthContext(app))
|
||||
@@ -128,21 +135,20 @@ func StaticDirectoryHandler(fileSystem fs.FS, disablePathUnescaping bool) echo.H
|
||||
|
||||
// bindStaticAdminUI registers the endpoints that serves the static admin UI.
|
||||
func bindStaticAdminUI(app core.App, e *echo.Echo) error {
|
||||
// serves /ui/dist/index.html file
|
||||
// (explicit route is used to avoid conflicts with `RemoveTrailingSlash` middleware)
|
||||
e.FileFS(
|
||||
"/_",
|
||||
"index.html",
|
||||
ui.DistIndexHTML,
|
||||
middleware.Gzip(),
|
||||
installerRedirect(app),
|
||||
// redirect to trailing slash to ensure that relative urls will still work properly
|
||||
e.GET(
|
||||
strings.TrimRight(trailedAdminPath, "/"),
|
||||
func(c echo.Context) error {
|
||||
return c.Redirect(http.StatusTemporaryRedirect, trailedAdminPath)
|
||||
},
|
||||
)
|
||||
|
||||
// serves static files from the /ui/dist directory
|
||||
// (similar to echo.StaticFS but with gzip middleware enabled)
|
||||
e.GET(
|
||||
"/_/*",
|
||||
StaticDirectoryHandler(ui.DistDirFS, false),
|
||||
trailedAdminPath+"*",
|
||||
echo.StaticDirectoryHandler(ui.DistDirFS, false),
|
||||
installerRedirect(app),
|
||||
middleware.Gzip(),
|
||||
)
|
||||
|
||||
@@ -175,6 +181,12 @@ func installerRedirect(app core.App) echo.MiddlewareFunc {
|
||||
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
// skip redirect checks for non-root level index.html requests
|
||||
path := c.Request().URL.Path
|
||||
if path != trailedAdminPath && path != trailedAdminPath+"index.html" {
|
||||
return next(c)
|
||||
}
|
||||
|
||||
// load into cache (if not already)
|
||||
if !app.Cache().Has(totalAdminsCacheKey) {
|
||||
if err := updateTotalAdminsCache(app); err != nil {
|
||||
@@ -188,12 +200,12 @@ func installerRedirect(app core.App) echo.MiddlewareFunc {
|
||||
|
||||
if totalAdmins == 0 && !hasInstallerParam {
|
||||
// redirect to the installer page
|
||||
return c.Redirect(http.StatusTemporaryRedirect, "/_/?installer#")
|
||||
return c.Redirect(http.StatusTemporaryRedirect, trailedAdminPath+"?installer#")
|
||||
}
|
||||
|
||||
if totalAdmins != 0 && hasInstallerParam {
|
||||
// redirect to the home page
|
||||
return c.Redirect(http.StatusTemporaryRedirect, "/_/#/")
|
||||
return c.Redirect(http.StatusTemporaryRedirect, trailedAdminPath+"#/")
|
||||
}
|
||||
|
||||
return next(c)
|
||||
|
||||
@@ -21,6 +21,7 @@ func BindCollectionApi(app core.App, rg *echo.Group) {
|
||||
subGroup.GET("/:collection", api.view)
|
||||
subGroup.PATCH("/:collection", api.update)
|
||||
subGroup.DELETE("/:collection", api.delete)
|
||||
subGroup.PUT("/import", api.bulkImport)
|
||||
}
|
||||
|
||||
type collectionApi struct {
|
||||
@@ -167,3 +168,38 @@ func (api *collectionApi) delete(c echo.Context) error {
|
||||
|
||||
return handlerErr
|
||||
}
|
||||
|
||||
func (api *collectionApi) bulkImport(c echo.Context) error {
|
||||
form := forms.NewCollectionsImport(api.app)
|
||||
|
||||
// load request data
|
||||
if err := c.Bind(form); err != nil {
|
||||
return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err)
|
||||
}
|
||||
|
||||
event := &core.CollectionsImportEvent{
|
||||
HttpContext: c,
|
||||
Collections: form.Collections,
|
||||
}
|
||||
|
||||
// import collections
|
||||
submitErr := form.Submit(func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc {
|
||||
return func() error {
|
||||
return api.app.OnCollectionsBeforeImportRequest().Trigger(event, func(e *core.CollectionsImportEvent) error {
|
||||
form.Collections = e.Collections // ensures that the form always has the latest changes
|
||||
|
||||
if err := next(); err != nil {
|
||||
return rest.NewBadRequestError("Failed to import the submitted collections.", err)
|
||||
}
|
||||
|
||||
return e.HttpContext.NoContent(http.StatusNoContent)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if submitErr == nil {
|
||||
api.app.OnCollectionsAfterImportRequest().Trigger(event)
|
||||
}
|
||||
|
||||
return submitErr
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
@@ -440,3 +442,266 @@ func TestCollectionUpdate(t *testing.T) {
|
||||
scenario.Test(t)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCollectionImport(t *testing.T) {
|
||||
scenarios := []tests.ApiScenario{
|
||||
{
|
||||
Name: "unauthorized",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
ExpectedStatus: 401,
|
||||
ExpectedContent: []string{`"data":{}`},
|
||||
},
|
||||
{
|
||||
Name: "authorized as user",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic",
|
||||
},
|
||||
ExpectedStatus: 401,
|
||||
ExpectedContent: []string{`"data":{}`},
|
||||
},
|
||||
{
|
||||
Name: "authorized as admin + empty collections",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
Body: strings.NewReader(`{"collections":[]}`),
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo",
|
||||
},
|
||||
ExpectedStatus: 400,
|
||||
ExpectedContent: []string{
|
||||
`"data":{`,
|
||||
`"collections":{"code":"validation_required"`,
|
||||
},
|
||||
AfterFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) {
|
||||
collections := []*models.Collection{}
|
||||
if err := app.Dao().CollectionQuery().All(&collections); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(collections) != 5 {
|
||||
t.Fatalf("Expected %d collections, got %d", 5, len(collections))
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "authorized as admin + trying to delete system collections",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
Body: strings.NewReader(`{"deleteMissing": true, "collections":[{"name": "test123"}]}`),
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo",
|
||||
},
|
||||
ExpectedStatus: 400,
|
||||
ExpectedContent: []string{
|
||||
`"data":{`,
|
||||
`"collections":{"code":"collections_import_failure"`,
|
||||
},
|
||||
ExpectedEvents: map[string]int{
|
||||
"OnCollectionsBeforeImportRequest": 1,
|
||||
},
|
||||
AfterFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) {
|
||||
collections := []*models.Collection{}
|
||||
if err := app.Dao().CollectionQuery().All(&collections); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(collections) != 5 {
|
||||
t.Fatalf("Expected %d collections, got %d", 5, len(collections))
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "authorized as admin + collections validator failure",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
Body: strings.NewReader(`{
|
||||
"collections":[
|
||||
{
|
||||
"name": "import1",
|
||||
"schema": [
|
||||
{
|
||||
"id": "koih1lqx",
|
||||
"name": "test",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{"name": "import2"}
|
||||
]
|
||||
}`),
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo",
|
||||
},
|
||||
ExpectedStatus: 400,
|
||||
ExpectedContent: []string{
|
||||
`"data":{`,
|
||||
`"collections":{"code":"collections_import_failure"`,
|
||||
},
|
||||
ExpectedEvents: map[string]int{
|
||||
"OnCollectionsBeforeImportRequest": 1,
|
||||
"OnModelBeforeCreate": 2,
|
||||
},
|
||||
AfterFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) {
|
||||
collections := []*models.Collection{}
|
||||
if err := app.Dao().CollectionQuery().All(&collections); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(collections) != 5 {
|
||||
t.Fatalf("Expected %d collections, got %d", 5, len(collections))
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "authorized as admin + successful collections save",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
Body: strings.NewReader(`{
|
||||
"collections":[
|
||||
{
|
||||
"name": "import1",
|
||||
"schema": [
|
||||
{
|
||||
"id": "koih1lqx",
|
||||
"name": "test",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "import2",
|
||||
"schema": [
|
||||
{
|
||||
"id": "koih1lqx",
|
||||
"name": "test",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`),
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo",
|
||||
},
|
||||
ExpectedStatus: 204,
|
||||
ExpectedEvents: map[string]int{
|
||||
"OnCollectionsBeforeImportRequest": 1,
|
||||
"OnCollectionsAfterImportRequest": 1,
|
||||
"OnModelBeforeCreate": 2,
|
||||
"OnModelAfterCreate": 2,
|
||||
},
|
||||
AfterFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) {
|
||||
collections := []*models.Collection{}
|
||||
if err := app.Dao().CollectionQuery().All(&collections); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(collections) != 7 {
|
||||
t.Fatalf("Expected %d collections, got %d", 7, len(collections))
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "authorized as admin + successful collections save and old non-system collections deletion",
|
||||
Method: http.MethodPut,
|
||||
Url: "/api/collections/import",
|
||||
Body: strings.NewReader(`{
|
||||
"deleteMissing": true,
|
||||
"collections":[
|
||||
{
|
||||
"id":"abe78266-fd4d-4aea-962d-8c0138ac522b",
|
||||
"name":"profiles",
|
||||
"system":true,
|
||||
"listRule":"userId = @request.user.id",
|
||||
"viewRule":"created > 'test_change'",
|
||||
"createRule":"userId = @request.user.id",
|
||||
"updateRule":"userId = @request.user.id",
|
||||
"deleteRule":"userId = @request.user.id",
|
||||
"schema":[
|
||||
{
|
||||
"id":"koih1lqx",
|
||||
"name":"userId",
|
||||
"type":"user",
|
||||
"system":true,
|
||||
"required":true,
|
||||
"unique":true,
|
||||
"options":{
|
||||
"maxSelect":1,
|
||||
"cascadeDelete":true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id":"69ycbg3q",
|
||||
"name":"rel",
|
||||
"type":"relation",
|
||||
"system":false,
|
||||
"required":false,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"maxSelect":2,
|
||||
"collectionId":"abe78266-fd4d-4aea-962d-8c0138ac522b",
|
||||
"cascadeDelete":false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc",
|
||||
"name":"demo",
|
||||
"schema":[
|
||||
{
|
||||
"id":"_2hlxbmp",
|
||||
"name":"title",
|
||||
"type":"text",
|
||||
"system":false,
|
||||
"required":true,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"min":3,
|
||||
"max":null,
|
||||
"pattern":""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "new_import",
|
||||
"schema": [
|
||||
{
|
||||
"id": "koih1lqx",
|
||||
"name": "test",
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`),
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo",
|
||||
},
|
||||
ExpectedStatus: 204,
|
||||
ExpectedEvents: map[string]int{
|
||||
"OnCollectionsAfterImportRequest": 1,
|
||||
"OnCollectionsBeforeImportRequest": 1,
|
||||
"OnModelBeforeDelete": 3,
|
||||
"OnModelAfterDelete": 3,
|
||||
"OnModelBeforeUpdate": 2,
|
||||
"OnModelAfterUpdate": 2,
|
||||
"OnModelBeforeCreate": 1,
|
||||
"OnModelAfterCreate": 1,
|
||||
},
|
||||
AfterFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) {
|
||||
collections := []*models.Collection{}
|
||||
if err := app.Dao().CollectionQuery().All(&collections); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(collections) != 3 {
|
||||
t.Fatalf("Expected %d collections, got %d", 3, len(collections))
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, scenario := range scenarios {
|
||||
scenario.Test(t)
|
||||
}
|
||||
}
|
||||
+8
-4
@@ -210,13 +210,17 @@ func (api *realtimeApi) bindEvents() {
|
||||
return nil
|
||||
})
|
||||
|
||||
api.app.OnRecordAfterCreateRequest().Add(func(e *core.RecordCreateEvent) error {
|
||||
api.broadcastRecord("create", e.Record)
|
||||
api.app.OnModelAfterCreate().Add(func(e *core.ModelEvent) error {
|
||||
if record, ok := e.Model.(*models.Record); ok {
|
||||
api.broadcastRecord("create", record)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
api.app.OnRecordAfterUpdateRequest().Add(func(e *core.RecordUpdateEvent) error {
|
||||
api.broadcastRecord("update", e.Record)
|
||||
api.app.OnModelAfterUpdate().Add(func(e *core.ModelEvent) error {
|
||||
if record, ok := e.Model.(*models.Record); ok {
|
||||
api.broadcastRecord("update", record)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -750,6 +750,62 @@ func TestRecordCreate(t *testing.T) {
|
||||
"OnModelAfterCreate": 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "invalid custom insertion id (less than 15 chars)",
|
||||
Method: http.MethodPost,
|
||||
Url: "/api/collections/demo3/records",
|
||||
Body: strings.NewReader(`{
|
||||
"id": "12345678901234",
|
||||
"title": "test"
|
||||
}`),
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo",
|
||||
},
|
||||
ExpectedStatus: 400,
|
||||
ExpectedContent: []string{
|
||||
`"id":{"code":"validation_length_invalid"`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "invalid custom insertion id (more than 15 chars)",
|
||||
Method: http.MethodPost,
|
||||
Url: "/api/collections/demo3/records",
|
||||
Body: strings.NewReader(`{
|
||||
"id": "1234567890123456",
|
||||
"title": "test"
|
||||
}`),
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo",
|
||||
},
|
||||
ExpectedStatus: 400,
|
||||
ExpectedContent: []string{
|
||||
`"id":{"code":"validation_length_invalid"`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "valid custom insertion id (exactly 15 chars)",
|
||||
Method: http.MethodPost,
|
||||
Url: "/api/collections/demo3/records",
|
||||
Body: strings.NewReader(`{
|
||||
"id": "123456789012345",
|
||||
"title": "test"
|
||||
}`),
|
||||
RequestHeaders: map[string]string{
|
||||
"Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo",
|
||||
},
|
||||
ExpectedStatus: 200,
|
||||
ExpectedContent: []string{
|
||||
`"id":"123456789012345"`,
|
||||
`"title":"test"`,
|
||||
},
|
||||
ExpectedEvents: map[string]int{
|
||||
"OnRecordBeforeCreateRequest": 1,
|
||||
"OnRecordAfterCreateRequest": 1,
|
||||
"OnModelBeforeCreate": 1,
|
||||
"OnModelAfterCreate": 1,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
Name: "submit via multipart form data",
|
||||
Method: http.MethodPost,
|
||||
|
||||
+168
-4
@@ -1,12 +1,21 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/migrations/logs"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/tools/inflector"
|
||||
"github.com/pocketbase/pocketbase/tools/migrate"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -15,18 +24,40 @@ import (
|
||||
func NewMigrateCommand(app core.App) *cobra.Command {
|
||||
desc := `
|
||||
Supported arguments are:
|
||||
- up - runs all available migrations.
|
||||
- down [number] - reverts the last [number] applied migrations.
|
||||
- create folder name - creates new migration template file.
|
||||
- up - runs all available migrations.
|
||||
- down [number] - reverts the last [number] applied migrations.
|
||||
- create name [folder] - creates new migration template file.
|
||||
- collections [folder] - (Experimental) creates new migration file with the most recent local collections configuration.
|
||||
`
|
||||
var databaseFlag string
|
||||
|
||||
command := &cobra.Command{
|
||||
Use: "migrate",
|
||||
Short: "Executes DB migration scripts",
|
||||
ValidArgs: []string{"up", "down", "create"},
|
||||
ValidArgs: []string{"up", "down", "create", "collections"},
|
||||
Long: desc,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd := ""
|
||||
if len(args) > 0 {
|
||||
cmd = args[0]
|
||||
}
|
||||
|
||||
// additional commands
|
||||
// ---
|
||||
if cmd == "create" {
|
||||
if err := migrateCreateHandler(defaultMigrateCreateTemplate, args[1:]); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if cmd == "collections" {
|
||||
if err := migrateCollectionsHandler(app, args[1:]); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
// ---
|
||||
|
||||
// normalize
|
||||
if databaseFlag != "logs" {
|
||||
databaseFlag = "db"
|
||||
@@ -75,3 +106,136 @@ func migrationsConnectionsMap(app core.App) map[string]migrationsConnection {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// migrate create
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
const defaultMigrateCreateTemplate = `package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
// add up queries...
|
||||
|
||||
return nil
|
||||
}, func(db dbx.Builder) error {
|
||||
// add down queries...
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
`
|
||||
|
||||
func migrateCreateHandler(template string, args []string) error {
|
||||
if len(args) < 1 {
|
||||
return fmt.Errorf("Missing migration file name")
|
||||
}
|
||||
|
||||
name := args[0]
|
||||
|
||||
var dir string
|
||||
if len(args) == 2 {
|
||||
dir = args[1]
|
||||
}
|
||||
if dir == "" {
|
||||
// If not specified, auto point to the default migrations folder.
|
||||
//
|
||||
// NB!
|
||||
// Since the create command makes sense only during development,
|
||||
// it is expected the user to be in the app working directory
|
||||
// and to be using `go run`
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dir = path.Join(wd, "migrations")
|
||||
}
|
||||
|
||||
resultFilePath := path.Join(
|
||||
dir,
|
||||
fmt.Sprintf("%d_%s.go", time.Now().Unix(), inflector.Snakecase(name)),
|
||||
)
|
||||
|
||||
confirm := false
|
||||
prompt := &survey.Confirm{
|
||||
Message: fmt.Sprintf("Do you really want to create migration %q?", resultFilePath),
|
||||
}
|
||||
survey.AskOne(prompt, &confirm)
|
||||
if !confirm {
|
||||
fmt.Println("The command has been cancelled")
|
||||
return nil
|
||||
}
|
||||
|
||||
// ensure that migrations dir exist
|
||||
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(resultFilePath, []byte(template), 0644); err != nil {
|
||||
return fmt.Errorf("Failed to save migration file %q\n", resultFilePath)
|
||||
}
|
||||
|
||||
fmt.Printf("Successfully created file %q\n", resultFilePath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// migrate collections
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
const collectionsMigrateCreateTemplate = `package migrations
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// Auto generated migration with the most recent collections configuration.
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
jsonData := ` + "`" + `%s` + "`" + `
|
||||
|
||||
collections := []*models.Collection{}
|
||||
if err := json.Unmarshal([]byte(jsonData), &collections); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return daos.New(db).ImportCollections(collections, true, nil)
|
||||
}, func(db dbx.Builder) error {
|
||||
// no revert since the configuration on the environment, on which
|
||||
// the migration was executed, could have changed via the UI/API
|
||||
return nil
|
||||
})
|
||||
}
|
||||
`
|
||||
|
||||
func migrateCollectionsHandler(app core.App, args []string) error {
|
||||
createArgs := []string{"collections_snapshot"}
|
||||
createArgs = append(createArgs, args...)
|
||||
|
||||
dao := daos.New(app.DB())
|
||||
|
||||
collections := []*models.Collection{}
|
||||
if err := dao.CollectionQuery().OrderBy("created ASC").All(&collections); err != nil {
|
||||
return fmt.Errorf("Failed to fetch migrations list: %v", err)
|
||||
}
|
||||
|
||||
serialized, err := json.MarshalIndent(collections, "\t\t", "\t")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to serialize collections list: %v", err)
|
||||
}
|
||||
|
||||
return migrateCreateHandler(
|
||||
fmt.Sprintf(collectionsMigrateCreateTemplate, string(serialized)),
|
||||
createArgs,
|
||||
)
|
||||
}
|
||||
+2
-2
@@ -28,7 +28,7 @@ func NewServeCommand(app core.App, showStartBanner bool) *cobra.Command {
|
||||
|
||||
command := &cobra.Command{
|
||||
Use: "serve",
|
||||
Short: "Starts the web server (default to localhost:8090)",
|
||||
Short: "Starts the web server (default to 127.0.0.1:8090)",
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
// ensure that the latest migrations are applied before starting the server
|
||||
if err := runMigrations(app); err != nil {
|
||||
@@ -123,7 +123,7 @@ func NewServeCommand(app core.App, showStartBanner bool) *cobra.Command {
|
||||
command.PersistentFlags().StringVar(
|
||||
&httpAddr,
|
||||
"http",
|
||||
"localhost:8090",
|
||||
"127.0.0.1:8090",
|
||||
"api HTTP server address",
|
||||
)
|
||||
|
||||
|
||||
+28
-17
@@ -119,7 +119,7 @@ type App interface {
|
||||
// sending a password reset email to an admin.
|
||||
//
|
||||
// Could be used to send your own custom email template if
|
||||
// hook.StopPropagation is returned in one of its listeners.
|
||||
// [hook.StopPropagation] is returned in one of its listeners.
|
||||
OnMailerBeforeAdminResetPasswordSend() *hook.Hook[*MailerAdminEvent]
|
||||
|
||||
// OnMailerAfterAdminResetPasswordSend hook is triggered after
|
||||
@@ -130,7 +130,7 @@ type App interface {
|
||||
// sending a password reset email to a user.
|
||||
//
|
||||
// Could be used to send your own custom email template if
|
||||
// hook.StopPropagation is returned in one of its listeners.
|
||||
// [hook.StopPropagation] is returned in one of its listeners.
|
||||
OnMailerBeforeUserResetPasswordSend() *hook.Hook[*MailerUserEvent]
|
||||
|
||||
// OnMailerAfterUserResetPasswordSend hook is triggered after
|
||||
@@ -141,7 +141,7 @@ type App interface {
|
||||
// sending a verification email to a user.
|
||||
//
|
||||
// Could be used to send your own custom email template if
|
||||
// hook.StopPropagation is returned in one of its listeners.
|
||||
// [hook.StopPropagation] is returned in one of its listeners.
|
||||
OnMailerBeforeUserVerificationSend() *hook.Hook[*MailerUserEvent]
|
||||
|
||||
// OnMailerAfterUserVerificationSend hook is triggered after a user
|
||||
@@ -152,7 +152,7 @@ type App interface {
|
||||
// sending a confirmation new address email to a a user.
|
||||
//
|
||||
// Could be used to send your own custom email template if
|
||||
// hook.StopPropagation is returned in one of its listeners.
|
||||
// [hook.StopPropagation] is returned in one of its listeners.
|
||||
OnMailerBeforeUserChangeEmailSend() *hook.Hook[*MailerUserEvent]
|
||||
|
||||
// OnMailerAfterUserChangeEmailSend hook is triggered after a user
|
||||
@@ -192,7 +192,7 @@ type App interface {
|
||||
//
|
||||
// Could be used to additionally validate the request data or
|
||||
// implement completely different persistence behavior
|
||||
// (returning hook.StopPropagation).
|
||||
// (returning [hook.StopPropagation]).
|
||||
OnSettingsBeforeUpdateRequest() *hook.Hook[*SettingsUpdateEvent]
|
||||
|
||||
// OnSettingsAfterUpdateRequest hook is triggered after each
|
||||
@@ -227,7 +227,7 @@ type App interface {
|
||||
// Admin create request (after request data load and before model persistence).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different persistence behavior (returning hook.StopPropagation).
|
||||
// completely different persistence behavior (returning [hook.StopPropagation]).
|
||||
OnAdminBeforeCreateRequest() *hook.Hook[*AdminCreateEvent]
|
||||
|
||||
// OnAdminAfterCreateRequest hook is triggered after each
|
||||
@@ -238,7 +238,7 @@ type App interface {
|
||||
// Admin update request (after request data load and before model persistence).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different persistence behavior (returning hook.StopPropagation).
|
||||
// completely different persistence behavior (returning [hook.StopPropagation]).
|
||||
OnAdminBeforeUpdateRequest() *hook.Hook[*AdminUpdateEvent]
|
||||
|
||||
// OnAdminAfterUpdateRequest hook is triggered after each
|
||||
@@ -249,7 +249,7 @@ type App interface {
|
||||
// Admin delete request (after model load and before actual deletion).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different delete behavior (returning hook.StopPropagation).
|
||||
// completely different delete behavior (returning [hook.StopPropagation]).
|
||||
OnAdminBeforeDeleteRequest() *hook.Hook[*AdminDeleteEvent]
|
||||
|
||||
// OnAdminAfterDeleteRequest hook is triggered after each
|
||||
@@ -281,7 +281,7 @@ type App interface {
|
||||
// create request (after request data load and before model persistence).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different persistence behavior (returning hook.StopPropagation).
|
||||
// completely different persistence behavior (returning [hook.StopPropagation]).
|
||||
OnUserBeforeCreateRequest() *hook.Hook[*UserCreateEvent]
|
||||
|
||||
// OnUserAfterCreateRequest hook is triggered after each
|
||||
@@ -292,7 +292,7 @@ type App interface {
|
||||
// update request (after request data load and before model persistence).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different persistence behavior (returning hook.StopPropagation).
|
||||
// completely different persistence behavior (returning [hook.StopPropagation]).
|
||||
OnUserBeforeUpdateRequest() *hook.Hook[*UserUpdateEvent]
|
||||
|
||||
// OnUserAfterUpdateRequest hook is triggered after each
|
||||
@@ -303,7 +303,7 @@ type App interface {
|
||||
// delete request (after model load and before actual deletion).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different delete behavior (returning hook.StopPropagation).
|
||||
// completely different delete behavior (returning [hook.StopPropagation]).
|
||||
OnUserBeforeDeleteRequest() *hook.Hook[*UserDeleteEvent]
|
||||
|
||||
// OnUserAfterDeleteRequest hook is triggered after each
|
||||
@@ -346,7 +346,7 @@ type App interface {
|
||||
// create request (after request data load and before model persistence).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different persistence behavior (returning hook.StopPropagation).
|
||||
// completely different persistence behavior (returning [hook.StopPropagation]).
|
||||
OnRecordBeforeCreateRequest() *hook.Hook[*RecordCreateEvent]
|
||||
|
||||
// OnRecordAfterCreateRequest hook is triggered after each
|
||||
@@ -357,7 +357,7 @@ type App interface {
|
||||
// update request (after request data load and before model persistence).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different persistence behavior (returning hook.StopPropagation).
|
||||
// completely different persistence behavior (returning [hook.StopPropagation]).
|
||||
OnRecordBeforeUpdateRequest() *hook.Hook[*RecordUpdateEvent]
|
||||
|
||||
// OnRecordAfterUpdateRequest hook is triggered after each
|
||||
@@ -368,7 +368,7 @@ type App interface {
|
||||
// delete request (after model load and before actual deletion).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different delete behavior (returning hook.StopPropagation).
|
||||
// completely different delete behavior (returning [hook.StopPropagation]).
|
||||
OnRecordBeforeDeleteRequest() *hook.Hook[*RecordDeleteEvent]
|
||||
|
||||
// OnRecordAfterDeleteRequest hook is triggered after each
|
||||
@@ -393,7 +393,7 @@ type App interface {
|
||||
// create request (after request data load and before model persistence).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different persistence behavior (returning hook.StopPropagation).
|
||||
// completely different persistence behavior (returning [hook.StopPropagation]).
|
||||
OnCollectionBeforeCreateRequest() *hook.Hook[*CollectionCreateEvent]
|
||||
|
||||
// OnCollectionAfterCreateRequest hook is triggered after each
|
||||
@@ -404,7 +404,7 @@ type App interface {
|
||||
// update request (after request data load and before model persistence).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different persistence behavior (returning hook.StopPropagation).
|
||||
// completely different persistence behavior (returning [hook.StopPropagation]).
|
||||
OnCollectionBeforeUpdateRequest() *hook.Hook[*CollectionUpdateEvent]
|
||||
|
||||
// OnCollectionAfterUpdateRequest hook is triggered after each
|
||||
@@ -415,10 +415,21 @@ type App interface {
|
||||
// Collection delete request (after model load and before actual deletion).
|
||||
//
|
||||
// Could be used to additionally validate the request data or implement
|
||||
// completely different delete behavior (returning hook.StopPropagation).
|
||||
// completely different delete behavior (returning [hook.StopPropagation]).
|
||||
OnCollectionBeforeDeleteRequest() *hook.Hook[*CollectionDeleteEvent]
|
||||
|
||||
// OnCollectionAfterDeleteRequest hook is triggered after each
|
||||
// successful API Collection delete request.
|
||||
OnCollectionAfterDeleteRequest() *hook.Hook[*CollectionDeleteEvent]
|
||||
|
||||
// OnCollectionsBeforeImportRequest hook is triggered before each API
|
||||
// collections import request (after request data load and before the actual import).
|
||||
//
|
||||
// Could be used to additionally validate the imported collections or
|
||||
// to implement completely different import behavior (returning [hook.StopPropagation]).
|
||||
OnCollectionsBeforeImportRequest() *hook.Hook[*CollectionsImportEvent]
|
||||
|
||||
// OnCollectionsAfterImportRequest hook is triggered after each
|
||||
// successful API collections import request.
|
||||
OnCollectionsAfterImportRequest() *hook.Hook[*CollectionsImportEvent]
|
||||
}
|
||||
+28
-16
@@ -109,14 +109,16 @@ type BaseApp struct {
|
||||
onRecordAfterDeleteRequest *hook.Hook[*RecordDeleteEvent]
|
||||
|
||||
// collection api event hooks
|
||||
onCollectionsListRequest *hook.Hook[*CollectionsListEvent]
|
||||
onCollectionViewRequest *hook.Hook[*CollectionViewEvent]
|
||||
onCollectionBeforeCreateRequest *hook.Hook[*CollectionCreateEvent]
|
||||
onCollectionAfterCreateRequest *hook.Hook[*CollectionCreateEvent]
|
||||
onCollectionBeforeUpdateRequest *hook.Hook[*CollectionUpdateEvent]
|
||||
onCollectionAfterUpdateRequest *hook.Hook[*CollectionUpdateEvent]
|
||||
onCollectionBeforeDeleteRequest *hook.Hook[*CollectionDeleteEvent]
|
||||
onCollectionAfterDeleteRequest *hook.Hook[*CollectionDeleteEvent]
|
||||
onCollectionsListRequest *hook.Hook[*CollectionsListEvent]
|
||||
onCollectionViewRequest *hook.Hook[*CollectionViewEvent]
|
||||
onCollectionBeforeCreateRequest *hook.Hook[*CollectionCreateEvent]
|
||||
onCollectionAfterCreateRequest *hook.Hook[*CollectionCreateEvent]
|
||||
onCollectionBeforeUpdateRequest *hook.Hook[*CollectionUpdateEvent]
|
||||
onCollectionAfterUpdateRequest *hook.Hook[*CollectionUpdateEvent]
|
||||
onCollectionBeforeDeleteRequest *hook.Hook[*CollectionDeleteEvent]
|
||||
onCollectionAfterDeleteRequest *hook.Hook[*CollectionDeleteEvent]
|
||||
onCollectionsBeforeImportRequest *hook.Hook[*CollectionsImportEvent]
|
||||
onCollectionsAfterImportRequest *hook.Hook[*CollectionsImportEvent]
|
||||
}
|
||||
|
||||
// NewBaseApp creates and returns a new BaseApp instance
|
||||
@@ -201,14 +203,16 @@ func NewBaseApp(dataDir string, encryptionEnv string, isDebug bool) *BaseApp {
|
||||
onRecordAfterDeleteRequest: &hook.Hook[*RecordDeleteEvent]{},
|
||||
|
||||
// collection API event hooks
|
||||
onCollectionsListRequest: &hook.Hook[*CollectionsListEvent]{},
|
||||
onCollectionViewRequest: &hook.Hook[*CollectionViewEvent]{},
|
||||
onCollectionBeforeCreateRequest: &hook.Hook[*CollectionCreateEvent]{},
|
||||
onCollectionAfterCreateRequest: &hook.Hook[*CollectionCreateEvent]{},
|
||||
onCollectionBeforeUpdateRequest: &hook.Hook[*CollectionUpdateEvent]{},
|
||||
onCollectionAfterUpdateRequest: &hook.Hook[*CollectionUpdateEvent]{},
|
||||
onCollectionBeforeDeleteRequest: &hook.Hook[*CollectionDeleteEvent]{},
|
||||
onCollectionAfterDeleteRequest: &hook.Hook[*CollectionDeleteEvent]{},
|
||||
onCollectionsListRequest: &hook.Hook[*CollectionsListEvent]{},
|
||||
onCollectionViewRequest: &hook.Hook[*CollectionViewEvent]{},
|
||||
onCollectionBeforeCreateRequest: &hook.Hook[*CollectionCreateEvent]{},
|
||||
onCollectionAfterCreateRequest: &hook.Hook[*CollectionCreateEvent]{},
|
||||
onCollectionBeforeUpdateRequest: &hook.Hook[*CollectionUpdateEvent]{},
|
||||
onCollectionAfterUpdateRequest: &hook.Hook[*CollectionUpdateEvent]{},
|
||||
onCollectionBeforeDeleteRequest: &hook.Hook[*CollectionDeleteEvent]{},
|
||||
onCollectionAfterDeleteRequest: &hook.Hook[*CollectionDeleteEvent]{},
|
||||
onCollectionsBeforeImportRequest: &hook.Hook[*CollectionsImportEvent]{},
|
||||
onCollectionsAfterImportRequest: &hook.Hook[*CollectionsImportEvent]{},
|
||||
}
|
||||
|
||||
app.registerDefaultHooks()
|
||||
@@ -687,6 +691,14 @@ func (app *BaseApp) OnCollectionAfterDeleteRequest() *hook.Hook[*CollectionDelet
|
||||
return app.onCollectionAfterDeleteRequest
|
||||
}
|
||||
|
||||
func (app *BaseApp) OnCollectionsBeforeImportRequest() *hook.Hook[*CollectionsImportEvent] {
|
||||
return app.onCollectionsBeforeImportRequest
|
||||
}
|
||||
|
||||
func (app *BaseApp) OnCollectionsAfterImportRequest() *hook.Hook[*CollectionsImportEvent] {
|
||||
return app.onCollectionsAfterImportRequest
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Helpers
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@@ -216,6 +216,11 @@ type CollectionDeleteEvent struct {
|
||||
Collection *models.Collection
|
||||
}
|
||||
|
||||
type CollectionsImportEvent struct {
|
||||
HttpContext echo.Context
|
||||
Collections []*models.Collection
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// File API events data
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
+61
-26
@@ -49,6 +49,12 @@ func (dao *Dao) FindById(m models.Model, id string) error {
|
||||
return dao.ModelQuery(m).Where(dbx.HashExp{"id": id}).Limit(1).One(m)
|
||||
}
|
||||
|
||||
type afterCallGroup struct {
|
||||
Action string
|
||||
EventDao *Dao
|
||||
Model models.Model
|
||||
}
|
||||
|
||||
// RunInTransaction wraps fn into a transaction.
|
||||
//
|
||||
// It is safe to nest RunInTransaction calls.
|
||||
@@ -59,45 +65,61 @@ func (dao *Dao) RunInTransaction(fn func(txDao *Dao) error) error {
|
||||
// so execute the function within the current transaction
|
||||
return fn(dao)
|
||||
case *dbx.DB:
|
||||
return txOrDB.Transactional(func(tx *dbx.Tx) error {
|
||||
afterCalls := []afterCallGroup{}
|
||||
|
||||
txError := txOrDB.Transactional(func(tx *dbx.Tx) error {
|
||||
txDao := New(tx)
|
||||
|
||||
txDao.BeforeCreateFunc = func(eventDao *Dao, m models.Model) error {
|
||||
if dao.BeforeCreateFunc != nil {
|
||||
if dao.BeforeCreateFunc != nil {
|
||||
txDao.BeforeCreateFunc = func(eventDao *Dao, m models.Model) error {
|
||||
return dao.BeforeCreateFunc(eventDao, m)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
txDao.AfterCreateFunc = func(eventDao *Dao, m models.Model) {
|
||||
if dao.AfterCreateFunc != nil {
|
||||
dao.AfterCreateFunc(eventDao, m)
|
||||
}
|
||||
}
|
||||
txDao.BeforeUpdateFunc = func(eventDao *Dao, m models.Model) error {
|
||||
if dao.BeforeUpdateFunc != nil {
|
||||
if dao.BeforeUpdateFunc != nil {
|
||||
txDao.BeforeUpdateFunc = func(eventDao *Dao, m models.Model) error {
|
||||
return dao.BeforeUpdateFunc(eventDao, m)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
txDao.AfterUpdateFunc = func(eventDao *Dao, m models.Model) {
|
||||
if dao.AfterUpdateFunc != nil {
|
||||
dao.AfterUpdateFunc(eventDao, m)
|
||||
}
|
||||
}
|
||||
txDao.BeforeDeleteFunc = func(eventDao *Dao, m models.Model) error {
|
||||
if dao.BeforeDeleteFunc != nil {
|
||||
if dao.BeforeDeleteFunc != nil {
|
||||
txDao.BeforeDeleteFunc = func(eventDao *Dao, m models.Model) error {
|
||||
return dao.BeforeDeleteFunc(eventDao, m)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
txDao.AfterDeleteFunc = func(eventDao *Dao, m models.Model) {
|
||||
if dao.AfterDeleteFunc != nil {
|
||||
dao.AfterDeleteFunc(eventDao, m)
|
||||
|
||||
if dao.AfterCreateFunc != nil {
|
||||
txDao.AfterCreateFunc = func(eventDao *Dao, m models.Model) {
|
||||
afterCalls = append(afterCalls, afterCallGroup{"create", eventDao, m})
|
||||
}
|
||||
}
|
||||
if dao.AfterUpdateFunc != nil {
|
||||
txDao.AfterUpdateFunc = func(eventDao *Dao, m models.Model) {
|
||||
afterCalls = append(afterCalls, afterCallGroup{"update", eventDao, m})
|
||||
}
|
||||
}
|
||||
if dao.AfterDeleteFunc != nil {
|
||||
txDao.AfterDeleteFunc = func(eventDao *Dao, m models.Model) {
|
||||
afterCalls = append(afterCalls, afterCallGroup{"delete", eventDao, m})
|
||||
}
|
||||
}
|
||||
|
||||
return fn(txDao)
|
||||
})
|
||||
|
||||
if txError == nil {
|
||||
// execute after event calls on successful transaction
|
||||
for _, call := range afterCalls {
|
||||
switch call.Action {
|
||||
case "create":
|
||||
dao.AfterCreateFunc(call.EventDao, call.Model)
|
||||
case "update":
|
||||
dao.AfterUpdateFunc(call.EventDao, call.Model)
|
||||
case "delete":
|
||||
dao.AfterDeleteFunc(call.EventDao, call.Model)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return txError
|
||||
}
|
||||
|
||||
return errors.New("Failed to start transaction (unknown dao.db)")
|
||||
@@ -128,11 +150,11 @@ func (dao *Dao) Delete(m models.Model) error {
|
||||
|
||||
// Save upserts (update or create if primary key is not set) the provided model.
|
||||
func (dao *Dao) Save(m models.Model) error {
|
||||
if m.HasId() {
|
||||
return dao.update(m)
|
||||
if m.IsNew() {
|
||||
return dao.create(m)
|
||||
}
|
||||
|
||||
return dao.create(m)
|
||||
return dao.update(m)
|
||||
}
|
||||
|
||||
func (dao *Dao) update(m models.Model) error {
|
||||
@@ -140,6 +162,10 @@ func (dao *Dao) update(m models.Model) error {
|
||||
return errors.New("ID is not set")
|
||||
}
|
||||
|
||||
if m.GetCreated().IsZero() {
|
||||
m.RefreshCreated()
|
||||
}
|
||||
|
||||
m.RefreshUpdated()
|
||||
|
||||
if dao.BeforeUpdateFunc != nil {
|
||||
@@ -179,6 +205,9 @@ func (dao *Dao) create(m models.Model) error {
|
||||
m.RefreshId()
|
||||
}
|
||||
|
||||
// mark the model as "new" since the model now always has an ID
|
||||
m.MarkAsNew()
|
||||
|
||||
if m.GetCreated().IsZero() {
|
||||
m.RefreshCreated()
|
||||
}
|
||||
@@ -195,6 +224,9 @@ func (dao *Dao) create(m models.Model) error {
|
||||
|
||||
if v, ok := any(m).(models.ColumnValueMapper); ok {
|
||||
dataMap := v.ColumnValueMap()
|
||||
if _, ok := dataMap["id"]; !ok {
|
||||
dataMap["id"] = m.GetId()
|
||||
}
|
||||
|
||||
_, err := dao.db.Insert(m.TableName(), dataMap).Execute()
|
||||
if err != nil {
|
||||
@@ -206,6 +238,9 @@ func (dao *Dao) create(m models.Model) error {
|
||||
}
|
||||
}
|
||||
|
||||
// clears the "new" model flag
|
||||
m.UnmarkAsNew()
|
||||
|
||||
if dao.AfterCreateFunc != nil {
|
||||
dao.AfterCreateFunc(dao, m)
|
||||
}
|
||||
|
||||
+269
-10
@@ -158,6 +158,33 @@ func TestDaoSaveCreate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDaoSaveWithInsertId(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
model := &models.Admin{}
|
||||
model.Id = "test"
|
||||
model.Email = "test_new@example.com"
|
||||
model.MarkAsNew()
|
||||
if err := testApp.Dao().Save(model); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// refresh
|
||||
model, _ = testApp.Dao().FindAdminById("test")
|
||||
|
||||
if model == nil {
|
||||
t.Fatal("Failed to find admin with id 'test'")
|
||||
}
|
||||
|
||||
expectedHooks := []string{"OnModelBeforeCreate", "OnModelAfterCreate"}
|
||||
for _, h := range expectedHooks {
|
||||
if v, ok := testApp.EventCalls[h]; !ok || v != 1 {
|
||||
t.Fatalf("Expected event %s to be called exactly one time, got %d", h, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDaoSaveUpdate(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
@@ -184,6 +211,61 @@ func TestDaoSaveUpdate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
type dummyColumnValueMapper struct {
|
||||
models.Admin
|
||||
}
|
||||
|
||||
func (a *dummyColumnValueMapper) ColumnValueMap() map[string]any {
|
||||
return map[string]any{
|
||||
"email": a.Email,
|
||||
"passwordHash": a.PasswordHash,
|
||||
"tokenKey": "custom_token_key",
|
||||
}
|
||||
}
|
||||
|
||||
func TestDaoSaveWithColumnValueMapper(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
model := &dummyColumnValueMapper{}
|
||||
model.Id = "test_mapped_id" // explicitly set an id
|
||||
model.Email = "test_mapped_create@example.com"
|
||||
model.TokenKey = "test_unmapped_token_key" // not used in the map
|
||||
model.SetPassword("123456")
|
||||
model.MarkAsNew()
|
||||
if err := testApp.Dao().Save(model); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
createdModel, _ := testApp.Dao().FindAdminById("test_mapped_id")
|
||||
if createdModel == nil {
|
||||
t.Fatal("[create] Failed to find model with id 'test_mapped_id'")
|
||||
}
|
||||
if createdModel.Email != model.Email {
|
||||
t.Fatalf("Expected model with email %q, got %q", model.Email, createdModel.Email)
|
||||
}
|
||||
if createdModel.TokenKey != "custom_token_key" {
|
||||
t.Fatalf("Expected model with tokenKey %q, got %q", "custom_token_key", createdModel.TokenKey)
|
||||
}
|
||||
|
||||
model.Email = "test_mapped_update@example.com"
|
||||
model.Avatar = 9 // not mapped and expect to be ignored
|
||||
if err := testApp.Dao().Save(model); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
updatedModel, _ := testApp.Dao().FindAdminById("test_mapped_id")
|
||||
if updatedModel == nil {
|
||||
t.Fatal("[update] Failed to find model with id 'test_mapped_id'")
|
||||
}
|
||||
if updatedModel.Email != model.Email {
|
||||
t.Fatalf("Expected model with email %q, got %q", model.Email, createdModel.Email)
|
||||
}
|
||||
if updatedModel.Avatar != 0 {
|
||||
t.Fatalf("Expected model avatar 0, got %v", updatedModel.Avatar)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDaoDelete(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
@@ -211,35 +293,212 @@ func TestDaoBeforeHooksError(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
testApp.Dao().BeforeCreateFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
baseDao := testApp.Dao()
|
||||
|
||||
baseDao.BeforeCreateFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
return errors.New("before_create")
|
||||
}
|
||||
testApp.Dao().BeforeUpdateFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
baseDao.BeforeUpdateFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
return errors.New("before_update")
|
||||
}
|
||||
testApp.Dao().BeforeDeleteFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
baseDao.BeforeDeleteFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
return errors.New("before_delete")
|
||||
}
|
||||
|
||||
existingModel, _ := testApp.Dao().FindAdminByEmail("test@example.com")
|
||||
|
||||
// try to create
|
||||
// test create error
|
||||
// ---
|
||||
newModel := &models.Admin{}
|
||||
newModel.Email = "test_new@example.com"
|
||||
if err := testApp.Dao().Save(newModel); err.Error() != "before_create" {
|
||||
if err := baseDao.Save(newModel); err.Error() != "before_create" {
|
||||
t.Fatalf("Expected before_create error, got %v", err)
|
||||
}
|
||||
|
||||
// try to update
|
||||
// test update error
|
||||
// ---
|
||||
if err := testApp.Dao().Save(existingModel); err.Error() != "before_update" {
|
||||
if err := baseDao.Save(existingModel); err.Error() != "before_update" {
|
||||
t.Fatalf("Expected before_update error, got %v", err)
|
||||
}
|
||||
|
||||
// try to delete
|
||||
// test delete error
|
||||
// ---
|
||||
if err := testApp.Dao().Delete(existingModel); err.Error() != "before_delete" {
|
||||
if err := baseDao.Delete(existingModel); err.Error() != "before_delete" {
|
||||
t.Fatalf("Expected before_delete error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDaoTransactionHooksCallsOnFailure(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
beforeCreateFuncCalls := 0
|
||||
beforeUpdateFuncCalls := 0
|
||||
beforeDeleteFuncCalls := 0
|
||||
afterCreateFuncCalls := 0
|
||||
afterUpdateFuncCalls := 0
|
||||
afterDeleteFuncCalls := 0
|
||||
|
||||
baseDao := testApp.Dao()
|
||||
|
||||
baseDao.BeforeCreateFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
beforeCreateFuncCalls++
|
||||
return nil
|
||||
}
|
||||
baseDao.BeforeUpdateFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
beforeUpdateFuncCalls++
|
||||
return nil
|
||||
}
|
||||
baseDao.BeforeDeleteFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
beforeDeleteFuncCalls++
|
||||
return nil
|
||||
}
|
||||
|
||||
baseDao.AfterCreateFunc = func(eventDao *daos.Dao, m models.Model) {
|
||||
afterCreateFuncCalls++
|
||||
}
|
||||
baseDao.AfterUpdateFunc = func(eventDao *daos.Dao, m models.Model) {
|
||||
afterUpdateFuncCalls++
|
||||
}
|
||||
baseDao.AfterDeleteFunc = func(eventDao *daos.Dao, m models.Model) {
|
||||
afterDeleteFuncCalls++
|
||||
}
|
||||
|
||||
existingModel, _ := testApp.Dao().FindAdminByEmail("test@example.com")
|
||||
|
||||
baseDao.RunInTransaction(func(txDao1 *daos.Dao) error {
|
||||
return txDao1.RunInTransaction(func(txDao2 *daos.Dao) error {
|
||||
// test create
|
||||
// ---
|
||||
newModel := &models.Admin{}
|
||||
newModel.Email = "test_new1@example.com"
|
||||
newModel.SetPassword("123456")
|
||||
if err := txDao2.Save(newModel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// test update (twice)
|
||||
// ---
|
||||
if err := txDao2.Save(existingModel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := txDao2.Save(existingModel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// test delete
|
||||
// ---
|
||||
if err := txDao2.Delete(existingModel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
return errors.New("test_tx_error")
|
||||
})
|
||||
})
|
||||
|
||||
if beforeCreateFuncCalls != 1 {
|
||||
t.Fatalf("Expected beforeCreateFuncCalls to be called 1 times, got %d", beforeCreateFuncCalls)
|
||||
}
|
||||
if beforeUpdateFuncCalls != 2 {
|
||||
t.Fatalf("Expected beforeUpdateFuncCalls to be called 2 times, got %d", beforeUpdateFuncCalls)
|
||||
}
|
||||
if beforeDeleteFuncCalls != 1 {
|
||||
t.Fatalf("Expected beforeDeleteFuncCalls to be called 1 times, got %d", beforeDeleteFuncCalls)
|
||||
}
|
||||
if afterCreateFuncCalls != 0 {
|
||||
t.Fatalf("Expected afterCreateFuncCalls to be called 0 times, got %d", afterCreateFuncCalls)
|
||||
}
|
||||
if afterUpdateFuncCalls != 0 {
|
||||
t.Fatalf("Expected afterUpdateFuncCalls to be called 0 times, got %d", afterUpdateFuncCalls)
|
||||
}
|
||||
if afterDeleteFuncCalls != 0 {
|
||||
t.Fatalf("Expected afterDeleteFuncCalls to be called 0 times, got %d", afterDeleteFuncCalls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDaoTransactionHooksCallsOnSuccess(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
beforeCreateFuncCalls := 0
|
||||
beforeUpdateFuncCalls := 0
|
||||
beforeDeleteFuncCalls := 0
|
||||
afterCreateFuncCalls := 0
|
||||
afterUpdateFuncCalls := 0
|
||||
afterDeleteFuncCalls := 0
|
||||
|
||||
baseDao := testApp.Dao()
|
||||
|
||||
baseDao.BeforeCreateFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
beforeCreateFuncCalls++
|
||||
return nil
|
||||
}
|
||||
baseDao.BeforeUpdateFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
beforeUpdateFuncCalls++
|
||||
return nil
|
||||
}
|
||||
baseDao.BeforeDeleteFunc = func(eventDao *daos.Dao, m models.Model) error {
|
||||
beforeDeleteFuncCalls++
|
||||
return nil
|
||||
}
|
||||
|
||||
baseDao.AfterCreateFunc = func(eventDao *daos.Dao, m models.Model) {
|
||||
afterCreateFuncCalls++
|
||||
}
|
||||
baseDao.AfterUpdateFunc = func(eventDao *daos.Dao, m models.Model) {
|
||||
afterUpdateFuncCalls++
|
||||
}
|
||||
baseDao.AfterDeleteFunc = func(eventDao *daos.Dao, m models.Model) {
|
||||
afterDeleteFuncCalls++
|
||||
}
|
||||
|
||||
existingModel, _ := testApp.Dao().FindAdminByEmail("test@example.com")
|
||||
|
||||
baseDao.RunInTransaction(func(txDao1 *daos.Dao) error {
|
||||
return txDao1.RunInTransaction(func(txDao2 *daos.Dao) error {
|
||||
// test create
|
||||
// ---
|
||||
newModel := &models.Admin{}
|
||||
newModel.Email = "test_new1@example.com"
|
||||
newModel.SetPassword("123456")
|
||||
if err := txDao2.Save(newModel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// test update (twice)
|
||||
// ---
|
||||
if err := txDao2.Save(existingModel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := txDao2.Save(existingModel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// test delete
|
||||
// ---
|
||||
if err := txDao2.Delete(existingModel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
})
|
||||
|
||||
if beforeCreateFuncCalls != 1 {
|
||||
t.Fatalf("Expected beforeCreateFuncCalls to be called 1 times, got %d", beforeCreateFuncCalls)
|
||||
}
|
||||
if beforeUpdateFuncCalls != 2 {
|
||||
t.Fatalf("Expected beforeUpdateFuncCalls to be called 2 times, got %d", beforeUpdateFuncCalls)
|
||||
}
|
||||
if beforeDeleteFuncCalls != 1 {
|
||||
t.Fatalf("Expected beforeDeleteFuncCalls to be called 1 times, got %d", beforeDeleteFuncCalls)
|
||||
}
|
||||
if afterCreateFuncCalls != 1 {
|
||||
t.Fatalf("Expected afterCreateFuncCalls to be called 1 times, got %d", afterCreateFuncCalls)
|
||||
}
|
||||
if afterUpdateFuncCalls != 2 {
|
||||
t.Fatalf("Expected afterUpdateFuncCalls to be called 2 times, got %d", afterUpdateFuncCalls)
|
||||
}
|
||||
if afterDeleteFuncCalls != 1 {
|
||||
t.Fatalf("Expected afterDeleteFuncCalls to be called 1 times, got %d", afterDeleteFuncCalls)
|
||||
}
|
||||
}
|
||||
+115
-3
@@ -113,7 +113,7 @@ func (dao *Dao) FindCollectionReferences(collection *models.Collection, excludeI
|
||||
// - is referenced as part of a relation field in another collection
|
||||
func (dao *Dao) DeleteCollection(collection *models.Collection) error {
|
||||
if collection.System {
|
||||
return errors.New("System collections cannot be deleted.")
|
||||
return fmt.Errorf("System collection %q cannot be deleted.", collection.Name)
|
||||
}
|
||||
|
||||
// ensure that there aren't any existing references.
|
||||
@@ -123,7 +123,7 @@ func (dao *Dao) DeleteCollection(collection *models.Collection) error {
|
||||
return err
|
||||
}
|
||||
if total := len(result); total > 0 {
|
||||
return fmt.Errorf("The collection has external relation field references (%d).", total)
|
||||
return fmt.Errorf("The collection %q has external relation field references (%d).", collection.Name, total)
|
||||
}
|
||||
|
||||
return dao.RunInTransaction(func(txDao *Dao) error {
|
||||
@@ -141,7 +141,7 @@ func (dao *Dao) DeleteCollection(collection *models.Collection) error {
|
||||
func (dao *Dao) SaveCollection(collection *models.Collection) error {
|
||||
var oldCollection *models.Collection
|
||||
|
||||
if collection.HasId() {
|
||||
if !collection.IsNew() {
|
||||
// get the existing collection state to compare with the new one
|
||||
// note: the select is outside of the transaction to prevent SQLITE_LOCKED error when mixing read&write in a single transaction
|
||||
var findErr error
|
||||
@@ -161,3 +161,115 @@ func (dao *Dao) SaveCollection(collection *models.Collection) error {
|
||||
return txDao.SyncRecordTableSchema(collection, oldCollection)
|
||||
})
|
||||
}
|
||||
|
||||
// ImportCollections imports the provided collections list within a single transaction.
|
||||
//
|
||||
// NB1! If deleteMissing is set, all local collections and schema fields, that are not present
|
||||
// in the imported configuration, WILL BE DELETED (including their related records data).
|
||||
//
|
||||
// NB2! This method doesn't perform validations on the imported collections data!
|
||||
// If you need validations, use [forms.CollectionsImport].
|
||||
func (dao *Dao) ImportCollections(
|
||||
importedCollections []*models.Collection,
|
||||
deleteMissing bool,
|
||||
beforeRecordsSync func(txDao *Dao, mappedImported, mappedExisting map[string]*models.Collection) error,
|
||||
) error {
|
||||
if len(importedCollections) == 0 {
|
||||
return errors.New("No collections to import")
|
||||
}
|
||||
|
||||
return dao.RunInTransaction(func(txDao *Dao) error {
|
||||
existingCollections := []*models.Collection{}
|
||||
if err := txDao.CollectionQuery().OrderBy("created ASC").All(&existingCollections); err != nil {
|
||||
return err
|
||||
}
|
||||
mappedExisting := make(map[string]*models.Collection, len(existingCollections))
|
||||
for _, existing := range existingCollections {
|
||||
mappedExisting[existing.GetId()] = existing
|
||||
}
|
||||
|
||||
mappedImported := make(map[string]*models.Collection, len(importedCollections))
|
||||
for _, imported := range importedCollections {
|
||||
// generate id if not set
|
||||
if !imported.HasId() {
|
||||
imported.MarkAsNew()
|
||||
imported.RefreshId()
|
||||
}
|
||||
|
||||
if existing, ok := mappedExisting[imported.GetId()]; ok {
|
||||
// preserve original created date
|
||||
if !existing.Created.IsZero() {
|
||||
imported.Created = existing.Created
|
||||
}
|
||||
|
||||
// extend existing schema
|
||||
if !deleteMissing {
|
||||
schema, _ := existing.Schema.Clone()
|
||||
for _, f := range imported.Schema.Fields() {
|
||||
schema.AddField(f) // add or replace
|
||||
}
|
||||
imported.Schema = *schema
|
||||
}
|
||||
} else {
|
||||
imported.MarkAsNew()
|
||||
}
|
||||
|
||||
mappedImported[imported.GetId()] = imported
|
||||
}
|
||||
|
||||
// delete old collections not available in the new configuration
|
||||
// (before saving the imports in case a deleted collection name is being reused)
|
||||
if deleteMissing {
|
||||
for _, existing := range existingCollections {
|
||||
if mappedImported[existing.GetId()] != nil {
|
||||
continue // exist
|
||||
}
|
||||
|
||||
if existing.System {
|
||||
return fmt.Errorf("System collection %q cannot be deleted.", existing.Name)
|
||||
}
|
||||
|
||||
// delete the collection
|
||||
if err := txDao.Delete(existing); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// upsert imported collections
|
||||
for _, imported := range importedCollections {
|
||||
if err := txDao.Save(imported); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if beforeRecordsSync != nil {
|
||||
if err := beforeRecordsSync(txDao, mappedImported, mappedExisting); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// delete the record tables of the deleted collections
|
||||
if deleteMissing {
|
||||
for _, existing := range existingCollections {
|
||||
if mappedImported[existing.GetId()] != nil {
|
||||
continue // exist
|
||||
}
|
||||
|
||||
if err := txDao.DeleteTable(existing.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sync the upserted collections with the related records table
|
||||
for _, imported := range importedCollections {
|
||||
existing := mappedExisting[imported.GetId()]
|
||||
if err := txDao.SyncRecordTableSchema(imported, existing); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package daos_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/models/schema"
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
@@ -250,3 +253,314 @@ func TestSaveCollectionUpdate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportCollections(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
jsonData string
|
||||
deleteMissing bool
|
||||
beforeRecordsSync func(txDao *daos.Dao, mappedImported, mappedExisting map[string]*models.Collection) error
|
||||
expectError bool
|
||||
expectCollectionsCount int
|
||||
afterTestFunc func(testApp *tests.TestApp, resultCollections []*models.Collection)
|
||||
}{
|
||||
{
|
||||
name: "empty collections",
|
||||
jsonData: `[]`,
|
||||
expectError: true,
|
||||
expectCollectionsCount: 5,
|
||||
},
|
||||
{
|
||||
name: "check db constraints",
|
||||
jsonData: `[
|
||||
{"name": "import_test", "schema": []}
|
||||
]`,
|
||||
deleteMissing: false,
|
||||
expectError: true,
|
||||
expectCollectionsCount: 5,
|
||||
},
|
||||
{
|
||||
name: "minimal collection import",
|
||||
jsonData: `[
|
||||
{"name": "import_test", "schema": [{"name":"test", "type": "text"}]}
|
||||
]`,
|
||||
deleteMissing: false,
|
||||
expectError: false,
|
||||
expectCollectionsCount: 6,
|
||||
},
|
||||
{
|
||||
name: "minimal collection import + failed beforeRecordsSync",
|
||||
jsonData: `[
|
||||
{"name": "import_test", "schema": [{"name":"test", "type": "text"}]}
|
||||
]`,
|
||||
beforeRecordsSync: func(txDao *daos.Dao, mappedImported, mappedExisting map[string]*models.Collection) error {
|
||||
return errors.New("test_error")
|
||||
},
|
||||
deleteMissing: false,
|
||||
expectError: true,
|
||||
expectCollectionsCount: 5,
|
||||
},
|
||||
{
|
||||
name: "minimal collection import + successful beforeRecordsSync",
|
||||
jsonData: `[
|
||||
{"name": "import_test", "schema": [{"name":"test", "type": "text"}]}
|
||||
]`,
|
||||
beforeRecordsSync: func(txDao *daos.Dao, mappedImported, mappedExisting map[string]*models.Collection) error {
|
||||
return nil
|
||||
},
|
||||
deleteMissing: false,
|
||||
expectError: false,
|
||||
expectCollectionsCount: 6,
|
||||
},
|
||||
{
|
||||
name: "new + update + delete system collection",
|
||||
jsonData: `[
|
||||
{
|
||||
"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc",
|
||||
"name":"demo",
|
||||
"schema":[
|
||||
{
|
||||
"id":"_2hlxbmp",
|
||||
"name":"title",
|
||||
"type":"text",
|
||||
"system":false,
|
||||
"required":true,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"min":3,
|
||||
"max":null,
|
||||
"pattern":""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "import1",
|
||||
"schema": [
|
||||
{
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]`,
|
||||
deleteMissing: true,
|
||||
expectError: true,
|
||||
expectCollectionsCount: 5,
|
||||
},
|
||||
{
|
||||
name: "new + update + delete non-system collection",
|
||||
jsonData: `[
|
||||
{
|
||||
"id":"abe78266-fd4d-4aea-962d-8c0138ac522b",
|
||||
"name":"profiles",
|
||||
"system":true,
|
||||
"listRule":"userId = @request.user.id",
|
||||
"viewRule":"created > 'test_change'",
|
||||
"createRule":"userId = @request.user.id",
|
||||
"updateRule":"userId = @request.user.id",
|
||||
"deleteRule":"userId = @request.user.id",
|
||||
"schema":[
|
||||
{
|
||||
"id":"koih1lqx",
|
||||
"name":"userId",
|
||||
"type":"user",
|
||||
"system":true,
|
||||
"required":true,
|
||||
"unique":true,
|
||||
"options":{
|
||||
"maxSelect":1,
|
||||
"cascadeDelete":true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id":"69ycbg3q",
|
||||
"name":"rel",
|
||||
"type":"relation",
|
||||
"system":false,
|
||||
"required":false,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"maxSelect":2,
|
||||
"collectionId":"abe78266-fd4d-4aea-962d-8c0138ac522b",
|
||||
"cascadeDelete":false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc",
|
||||
"name":"demo",
|
||||
"schema":[
|
||||
{
|
||||
"id":"_2hlxbmp",
|
||||
"name":"title",
|
||||
"type":"text",
|
||||
"system":false,
|
||||
"required":true,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"min":3,
|
||||
"max":null,
|
||||
"pattern":""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "test_deleted_collection_name_reuse",
|
||||
"name": "demo2",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]`,
|
||||
deleteMissing: true,
|
||||
expectError: false,
|
||||
expectCollectionsCount: 3,
|
||||
},
|
||||
{
|
||||
name: "test with deleteMissing: false",
|
||||
jsonData: `[
|
||||
{
|
||||
"id":"abe78266-fd4d-4aea-962d-8c0138ac522b",
|
||||
"name":"profiles",
|
||||
"system":true,
|
||||
"listRule":"userId = @request.user.id",
|
||||
"viewRule":"created > 'test_change'",
|
||||
"createRule":"userId = @request.user.id",
|
||||
"updateRule":"userId = @request.user.id",
|
||||
"deleteRule":"userId = @request.user.id",
|
||||
"schema":[
|
||||
{
|
||||
"id":"69ycbg3q",
|
||||
"name":"rel",
|
||||
"type":"relation",
|
||||
"system":false,
|
||||
"required":false,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"maxSelect":2,
|
||||
"collectionId":"abe78266-fd4d-4aea-962d-8c0138ac522b",
|
||||
"cascadeDelete":true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id":"abcd_import",
|
||||
"name":"new_field",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc",
|
||||
"name":"demo",
|
||||
"schema":[
|
||||
{
|
||||
"id":"_2hlxbmp",
|
||||
"name":"title",
|
||||
"type":"text",
|
||||
"system":false,
|
||||
"required":true,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"min":3,
|
||||
"max":null,
|
||||
"pattern":""
|
||||
}
|
||||
},
|
||||
{
|
||||
"id":"_2hlxbmp",
|
||||
"name":"field_with_duplicate_id",
|
||||
"type":"text",
|
||||
"system":false,
|
||||
"required":true,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"min":3,
|
||||
"max":null,
|
||||
"pattern":""
|
||||
}
|
||||
},
|
||||
{
|
||||
"id":"abcd_import",
|
||||
"name":"new_field",
|
||||
"type":"text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "new_import",
|
||||
"schema": [
|
||||
{
|
||||
"id":"abcd_import",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]`,
|
||||
deleteMissing: false,
|
||||
expectError: false,
|
||||
expectCollectionsCount: 6,
|
||||
afterTestFunc: func(testApp *tests.TestApp, resultCollections []*models.Collection) {
|
||||
expectedCollectionFields := map[string]int{
|
||||
"profiles": 6,
|
||||
"demo": 3,
|
||||
"demo2": 14,
|
||||
"demo3": 1,
|
||||
"demo4": 6,
|
||||
"new_import": 1,
|
||||
}
|
||||
for name, expectedCount := range expectedCollectionFields {
|
||||
collection, err := testApp.Dao().FindCollectionByNameOrId(name)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if totalFields := len(collection.Schema.Fields()); totalFields != expectedCount {
|
||||
t.Errorf("Expected %d %q fields, got %d", expectedCount, collection.Name, totalFields)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, scenario := range scenarios {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
importedCollections := []*models.Collection{}
|
||||
|
||||
// load data
|
||||
loadErr := json.Unmarshal([]byte(scenario.jsonData), &importedCollections)
|
||||
if loadErr != nil {
|
||||
t.Fatalf("[%s] Failed to load data: %v", scenario.name, loadErr)
|
||||
continue
|
||||
}
|
||||
|
||||
err := testApp.Dao().ImportCollections(importedCollections, scenario.deleteMissing, scenario.beforeRecordsSync)
|
||||
|
||||
hasErr := err != nil
|
||||
if hasErr != scenario.expectError {
|
||||
t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", scenario.name, scenario.expectError, hasErr, err)
|
||||
}
|
||||
|
||||
// check collections count
|
||||
collections := []*models.Collection{}
|
||||
if err := testApp.Dao().CollectionQuery().All(&collections); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(collections) != scenario.expectCollectionsCount {
|
||||
t.Errorf("[%s] Expected %d collections, got %d", scenario.name, scenario.expectCollectionsCount, len(collections))
|
||||
}
|
||||
|
||||
if scenario.afterTestFunc != nil {
|
||||
scenario.afterTestFunc(testApp, collections)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,6 @@ func TestFindUserRelatedRecords(t *testing.T) {
|
||||
}
|
||||
|
||||
if len(records) != len(scenario.expectedIds) {
|
||||
fmt.Println(records[0])
|
||||
t.Errorf("(%d) Expected %d records, got %d (%v)", i, len(scenario.expectedIds), len(records), records)
|
||||
continue
|
||||
}
|
||||
|
||||
+36
-5
@@ -6,20 +6,51 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// AdminLogin defines an admin email/pass login form.
|
||||
// AdminLogin specifies an admin email/pass login form.
|
||||
type AdminLogin struct {
|
||||
app core.App
|
||||
config AdminLoginConfig
|
||||
|
||||
Email string `form:"email" json:"email"`
|
||||
Password string `form:"password" json:"password"`
|
||||
}
|
||||
|
||||
// NewAdminLogin creates new admin login form for the provided app.
|
||||
// AdminLoginConfig is the [AdminLogin] factory initializer config.
|
||||
//
|
||||
// NB! App is a required struct member.
|
||||
type AdminLoginConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewAdminLogin creates a new [AdminLogin] form with initializer
|
||||
// config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewAdminLoginWithConfig] with explicitly set TxDao.
|
||||
func NewAdminLogin(app core.App) *AdminLogin {
|
||||
return &AdminLogin{app: app}
|
||||
return NewAdminLoginWithConfig(AdminLoginConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewAdminLoginWithConfig creates a new [AdminLogin] form
|
||||
// with the provided config or panics on invalid configuration.
|
||||
func NewAdminLoginWithConfig(config AdminLoginConfig) *AdminLogin {
|
||||
form := &AdminLogin{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -37,7 +68,7 @@ func (form *AdminLogin) Submit() (*models.Admin, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
admin, err := form.app.Dao().FindAdminByEmail(form.Email)
|
||||
admin, err := form.config.TxDao.FindAdminByEmail(form.Email)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -7,6 +7,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestAdminLoginPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewAdminLogin(nil)
|
||||
}
|
||||
|
||||
func TestAdminLoginValidate(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
@@ -3,24 +3,53 @@ package forms
|
||||
import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/forms/validators"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// AdminPasswordResetConfirm defines an admin password reset confirmation form.
|
||||
// AdminPasswordResetConfirm specifies an admin password reset confirmation form.
|
||||
type AdminPasswordResetConfirm struct {
|
||||
app core.App
|
||||
config AdminPasswordResetConfirmConfig
|
||||
|
||||
Token string `form:"token" json:"token"`
|
||||
Password string `form:"password" json:"password"`
|
||||
PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
|
||||
}
|
||||
|
||||
// NewAdminPasswordResetConfirm creates new admin password reset confirmation form.
|
||||
// AdminPasswordResetConfirmConfig is the [AdminPasswordResetConfirm] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type AdminPasswordResetConfirmConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewAdminPasswordResetConfirm creates a new [AdminPasswordResetConfirm]
|
||||
// form with initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewAdminPasswordResetConfirmWithConfig] with explicitly set TxDao.
|
||||
func NewAdminPasswordResetConfirm(app core.App) *AdminPasswordResetConfirm {
|
||||
return &AdminPasswordResetConfirm{
|
||||
app: app,
|
||||
return NewAdminPasswordResetConfirmWithConfig(AdminPasswordResetConfirmConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewAdminPasswordResetConfirmWithConfig creates a new [AdminPasswordResetConfirm]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewAdminPasswordResetConfirmWithConfig(config AdminPasswordResetConfirmConfig) *AdminPasswordResetConfirm {
|
||||
form := &AdminPasswordResetConfirm{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -38,9 +67,9 @@ func (form *AdminPasswordResetConfirm) checkToken(value any) error {
|
||||
return nil // nothing to check
|
||||
}
|
||||
|
||||
admin, err := form.app.Dao().FindAdminByToken(
|
||||
admin, err := form.config.TxDao.FindAdminByToken(
|
||||
v,
|
||||
form.app.Settings().AdminPasswordResetToken.Secret,
|
||||
form.config.App.Settings().AdminPasswordResetToken.Secret,
|
||||
)
|
||||
if err != nil || admin == nil {
|
||||
return validation.NewError("validation_invalid_token", "Invalid or expired token.")
|
||||
@@ -56,9 +85,9 @@ func (form *AdminPasswordResetConfirm) Submit() (*models.Admin, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
admin, err := form.app.Dao().FindAdminByToken(
|
||||
admin, err := form.config.TxDao.FindAdminByToken(
|
||||
form.Token,
|
||||
form.app.Settings().AdminPasswordResetToken.Secret,
|
||||
form.config.App.Settings().AdminPasswordResetToken.Secret,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -68,7 +97,7 @@ func (form *AdminPasswordResetConfirm) Submit() (*models.Admin, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := form.app.Dao().SaveAdmin(admin); err != nil {
|
||||
if err := form.config.TxDao.SaveAdmin(admin); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/security"
|
||||
)
|
||||
|
||||
func TestAdminPasswordResetPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewAdminPasswordResetConfirm(nil)
|
||||
}
|
||||
|
||||
func TestAdminPasswordResetConfirmValidate(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
@@ -7,24 +7,53 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/mails"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
// AdminPasswordResetRequest defines an admin password reset request form.
|
||||
// AdminPasswordResetRequest specifies an admin password reset request form.
|
||||
type AdminPasswordResetRequest struct {
|
||||
app core.App
|
||||
resendThreshold float64
|
||||
config AdminPasswordResetRequestConfig
|
||||
|
||||
Email string `form:"email" json:"email"`
|
||||
}
|
||||
|
||||
// NewAdminPasswordResetRequest creates new admin password reset request form.
|
||||
// AdminPasswordResetRequestConfig is the [AdminPasswordResetRequest] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type AdminPasswordResetRequestConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
ResendThreshold float64 // in seconds
|
||||
}
|
||||
|
||||
// NewAdminPasswordResetRequest creates a new [AdminPasswordResetRequest]
|
||||
// form with initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewAdminPasswordResetRequestWithConfig] with explicitly set TxDao.
|
||||
func NewAdminPasswordResetRequest(app core.App) *AdminPasswordResetRequest {
|
||||
return &AdminPasswordResetRequest{
|
||||
app: app,
|
||||
resendThreshold: 120, // 2 min
|
||||
return NewAdminPasswordResetRequestWithConfig(AdminPasswordResetRequestConfig{
|
||||
App: app,
|
||||
ResendThreshold: 120, // 2min
|
||||
})
|
||||
}
|
||||
|
||||
// NewAdminPasswordResetRequestWithConfig creates a new [AdminPasswordResetRequest]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewAdminPasswordResetRequestWithConfig(config AdminPasswordResetRequestConfig) *AdminPasswordResetRequest {
|
||||
form := &AdminPasswordResetRequest{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -48,23 +77,23 @@ func (form *AdminPasswordResetRequest) Submit() error {
|
||||
return err
|
||||
}
|
||||
|
||||
admin, err := form.app.Dao().FindAdminByEmail(form.Email)
|
||||
admin, err := form.config.TxDao.FindAdminByEmail(form.Email)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
now := time.Now().UTC()
|
||||
lastResetSentAt := admin.LastResetSentAt.Time()
|
||||
if now.Sub(lastResetSentAt).Seconds() < form.resendThreshold {
|
||||
if now.Sub(lastResetSentAt).Seconds() < form.config.ResendThreshold {
|
||||
return errors.New("You have already requested a password reset.")
|
||||
}
|
||||
|
||||
if err := mails.SendAdminPasswordReset(form.app, admin); err != nil {
|
||||
if err := mails.SendAdminPasswordReset(form.config.App, admin); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update last sent timestamp
|
||||
admin.LastResetSentAt = types.NowDateTime()
|
||||
|
||||
return form.app.Dao().SaveAdmin(admin)
|
||||
return form.config.TxDao.SaveAdmin(admin)
|
||||
}
|
||||
@@ -7,6 +7,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestAdminPasswordResetRequestPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewAdminPasswordResetRequest(nil)
|
||||
}
|
||||
|
||||
func TestAdminPasswordResetRequestValidate(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
+56
-12
@@ -4,32 +4,62 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/forms/validators"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// AdminUpsert defines an admin upsert (create/update) form.
|
||||
// AdminUpsert specifies a [models.Admin] upsert (create/update) form.
|
||||
type AdminUpsert struct {
|
||||
app core.App
|
||||
admin *models.Admin
|
||||
isCreate bool
|
||||
config AdminUpsertConfig
|
||||
admin *models.Admin
|
||||
|
||||
Id string `form:"id" json:"id"`
|
||||
Avatar int `form:"avatar" json:"avatar"`
|
||||
Email string `form:"email" json:"email"`
|
||||
Password string `form:"password" json:"password"`
|
||||
PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
|
||||
}
|
||||
|
||||
// NewAdminUpsert creates new upsert form for the provided admin model
|
||||
// (pass an empty admin model instance (`&models.Admin{}`) for create).
|
||||
// AdminUpsertConfig is the [AdminUpsert] factory initializer config.
|
||||
//
|
||||
// NB! App is a required struct member.
|
||||
type AdminUpsertConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewAdminUpsert creates a new [AdminUpsert] form with initializer
|
||||
// config created from the provided [core.App] and [models.Admin] instances
|
||||
// (for create you could pass a pointer to an empty Admin - `&models.Admin{}`).
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewAdminUpsertWithConfig] with explicitly set TxDao.
|
||||
func NewAdminUpsert(app core.App, admin *models.Admin) *AdminUpsert {
|
||||
return NewAdminUpsertWithConfig(AdminUpsertConfig{
|
||||
App: app,
|
||||
}, admin)
|
||||
}
|
||||
|
||||
// NewAdminUpsertWithConfig creates a new [AdminUpsert] form
|
||||
// with the provided config and [models.Admin] instance or panics on invalid configuration
|
||||
// (for create you could pass a pointer to an empty Admin - `&models.Admin{}`).
|
||||
func NewAdminUpsertWithConfig(config AdminUpsertConfig, admin *models.Admin) *AdminUpsert {
|
||||
form := &AdminUpsert{
|
||||
app: app,
|
||||
admin: admin,
|
||||
isCreate: !admin.HasId(),
|
||||
config: config,
|
||||
admin: admin,
|
||||
}
|
||||
|
||||
if form.config.App == nil || form.admin == nil {
|
||||
panic("Invalid initializer config or nil upsert model.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
// load defaults
|
||||
form.Id = admin.Id
|
||||
form.Avatar = admin.Avatar
|
||||
form.Email = admin.Email
|
||||
|
||||
@@ -39,6 +69,14 @@ func NewAdminUpsert(app core.App, admin *models.Admin) *AdminUpsert {
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
func (form *AdminUpsert) Validate() error {
|
||||
return validation.ValidateStruct(form,
|
||||
validation.Field(
|
||||
&form.Id,
|
||||
validation.When(
|
||||
form.admin.IsNew(),
|
||||
validation.Length(models.DefaultIdLength, models.DefaultIdLength),
|
||||
validation.Match(idRegex),
|
||||
).Else(validation.In(form.admin.Id)),
|
||||
),
|
||||
validation.Field(
|
||||
&form.Avatar,
|
||||
validation.Min(0),
|
||||
@@ -53,7 +91,7 @@ func (form *AdminUpsert) Validate() error {
|
||||
),
|
||||
validation.Field(
|
||||
&form.Password,
|
||||
validation.When(form.isCreate, validation.Required),
|
||||
validation.When(form.admin.IsNew(), validation.Required),
|
||||
validation.Length(10, 100),
|
||||
),
|
||||
validation.Field(
|
||||
@@ -67,7 +105,7 @@ func (form *AdminUpsert) Validate() error {
|
||||
func (form *AdminUpsert) checkUniqueEmail(value any) error {
|
||||
v, _ := value.(string)
|
||||
|
||||
if form.app.Dao().IsAdminEmailUnique(v, form.admin.Id) {
|
||||
if form.config.TxDao.IsAdminEmailUnique(v, form.admin.Id) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -83,6 +121,12 @@ func (form *AdminUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// custom insertion id can be set only on create
|
||||
if form.admin.IsNew() && form.Id != "" {
|
||||
form.admin.MarkAsNew()
|
||||
form.admin.SetId(form.Id)
|
||||
}
|
||||
|
||||
form.admin.Avatar = form.Avatar
|
||||
form.admin.Email = form.Email
|
||||
|
||||
@@ -91,6 +135,6 @@ func (form *AdminUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
}
|
||||
|
||||
return runInterceptors(func() error {
|
||||
return form.app.Dao().SaveAdmin(form.admin)
|
||||
return form.config.TxDao.SaveAdmin(form.admin)
|
||||
}, interceptors...)
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package forms_test
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
@@ -11,6 +12,29 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestAdminUpsertPanic1(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewAdminUpsert(nil, nil)
|
||||
}
|
||||
|
||||
func TestAdminUpsertPanic2(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewAdminUpsert(app, nil)
|
||||
}
|
||||
|
||||
func TestNewAdminUpsert(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
@@ -347,3 +371,105 @@ func TestAdminUpsertSubmitInterceptors(t *testing.T) {
|
||||
t.Fatalf("Expected the form model to be filled before calling the interceptors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminUpsertWithCustomId(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
existingAdmin, err := app.Dao().FindAdminByEmail("test@example.com")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
scenarios := []struct {
|
||||
name string
|
||||
jsonData string
|
||||
collection *models.Admin
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
"empty data",
|
||||
"{}",
|
||||
&models.Admin{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"empty id",
|
||||
`{"id":""}`,
|
||||
&models.Admin{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"id < 15 chars",
|
||||
`{"id":"a23"}`,
|
||||
&models.Admin{},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id > 15 chars",
|
||||
`{"id":"a234567890123456"}`,
|
||||
&models.Admin{},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id = 15 chars (invalid chars)",
|
||||
`{"id":"a@3456789012345"}`,
|
||||
&models.Admin{},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id = 15 chars (valid chars)",
|
||||
`{"id":"a23456789012345"}`,
|
||||
&models.Admin{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"changing the id of an existing item",
|
||||
`{"id":"b23456789012345"}`,
|
||||
existingAdmin,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"using the same existing item id",
|
||||
`{"id":"` + existingAdmin.Id + `"}`,
|
||||
existingAdmin,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"skipping the id for existing item",
|
||||
`{}`,
|
||||
existingAdmin,
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for i, scenario := range scenarios {
|
||||
form := forms.NewAdminUpsert(app, scenario.collection)
|
||||
if form.Email == "" {
|
||||
form.Email = fmt.Sprintf("test_id_%d@example.com", i)
|
||||
}
|
||||
form.Password = "1234567890"
|
||||
form.PasswordConfirm = form.Password
|
||||
|
||||
// load data
|
||||
loadErr := json.Unmarshal([]byte(scenario.jsonData), form)
|
||||
if loadErr != nil {
|
||||
t.Errorf("[%s] Failed to load form data: %v", scenario.name, loadErr)
|
||||
continue
|
||||
}
|
||||
|
||||
submitErr := form.Submit()
|
||||
hasErr := submitErr != nil
|
||||
|
||||
if hasErr != scenario.expectError {
|
||||
t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", scenario.name, scenario.expectError, hasErr, submitErr)
|
||||
}
|
||||
|
||||
if !hasErr && form.Id != "" {
|
||||
_, err := app.Dao().FindAdminById(form.Id)
|
||||
if err != nil {
|
||||
t.Errorf("[%s] Expected to find record with id %s, got %v", scenario.name, form.Id, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,11 @@
|
||||
// validation and applying changes to existing DB models through the app Dao.
|
||||
package forms
|
||||
|
||||
import "regexp"
|
||||
|
||||
// base ID value regex pattern
|
||||
var idRegex = regexp.MustCompile(`^[^\@\#\$\&\|\.\,\'\"\\\/\s]+$`)
|
||||
|
||||
// InterceptorNextFunc is a interceptor handler function.
|
||||
// Usually used in combination with InterceptorFunc.
|
||||
type InterceptorNextFunc = func() error
|
||||
|
||||
+99
-26
@@ -1,11 +1,13 @@
|
||||
package forms
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/models/schema"
|
||||
"github.com/pocketbase/pocketbase/resolvers"
|
||||
@@ -14,12 +16,12 @@ import (
|
||||
|
||||
var collectionNameRegex = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_]*$`)
|
||||
|
||||
// CollectionUpsert defines a collection upsert (create/update) form.
|
||||
// CollectionUpsert specifies a [models.Collection] upsert (create/update) form.
|
||||
type CollectionUpsert struct {
|
||||
app core.App
|
||||
config CollectionUpsertConfig
|
||||
collection *models.Collection
|
||||
isCreate bool
|
||||
|
||||
Id string `form:"id" json:"id"`
|
||||
Name string `form:"name" json:"name"`
|
||||
System bool `form:"system" json:"system"`
|
||||
Schema schema.Schema `form:"schema" json:"schema"`
|
||||
@@ -30,25 +32,54 @@ type CollectionUpsert struct {
|
||||
DeleteRule *string `form:"deleteRule" json:"deleteRule"`
|
||||
}
|
||||
|
||||
// NewCollectionUpsert creates new collection upsert form for the provided Collection model
|
||||
// (pass an empty Collection model instance (`&models.Collection{}`) for create).
|
||||
// CollectionUpsertConfig is the [CollectionUpsert] factory initializer config.
|
||||
//
|
||||
// NB! App is a required struct member.
|
||||
type CollectionUpsertConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewCollectionUpsert creates a new [CollectionUpsert] form with initializer
|
||||
// config created from the provided [core.App] and [models.Collection] instances
|
||||
// (for create you could pass a pointer to an empty Collection - `&models.Collection{}`).
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewCollectionUpsertWithConfig] with explicitly set TxDao.
|
||||
func NewCollectionUpsert(app core.App, collection *models.Collection) *CollectionUpsert {
|
||||
return NewCollectionUpsertWithConfig(CollectionUpsertConfig{
|
||||
App: app,
|
||||
}, collection)
|
||||
}
|
||||
|
||||
// NewCollectionUpsertWithConfig creates a new [CollectionUpsert] form
|
||||
// with the provided config and [models.Collection] instance or panics on invalid configuration
|
||||
// (for create you could pass a pointer to an empty Collection - `&models.Collection{}`).
|
||||
func NewCollectionUpsertWithConfig(config CollectionUpsertConfig, collection *models.Collection) *CollectionUpsert {
|
||||
form := &CollectionUpsert{
|
||||
app: app,
|
||||
config: config,
|
||||
collection: collection,
|
||||
isCreate: !collection.HasId(),
|
||||
}
|
||||
|
||||
if form.config.App == nil || form.collection == nil {
|
||||
panic("Invalid initializer config or nil upsert model.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
// load defaults
|
||||
form.Name = collection.Name
|
||||
form.System = collection.System
|
||||
form.ListRule = collection.ListRule
|
||||
form.ViewRule = collection.ViewRule
|
||||
form.CreateRule = collection.CreateRule
|
||||
form.UpdateRule = collection.UpdateRule
|
||||
form.DeleteRule = collection.DeleteRule
|
||||
form.Id = form.collection.Id
|
||||
form.Name = form.collection.Name
|
||||
form.System = form.collection.System
|
||||
form.ListRule = form.collection.ListRule
|
||||
form.ViewRule = form.collection.ViewRule
|
||||
form.CreateRule = form.collection.CreateRule
|
||||
form.UpdateRule = form.collection.UpdateRule
|
||||
form.DeleteRule = form.collection.DeleteRule
|
||||
|
||||
clone, _ := collection.Schema.Clone()
|
||||
clone, _ := form.collection.Schema.Clone()
|
||||
if clone != nil {
|
||||
form.Schema = *clone
|
||||
} else {
|
||||
@@ -61,6 +92,14 @@ func NewCollectionUpsert(app core.App, collection *models.Collection) *Collectio
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
func (form *CollectionUpsert) Validate() error {
|
||||
return validation.ValidateStruct(form,
|
||||
validation.Field(
|
||||
&form.Id,
|
||||
validation.When(
|
||||
form.collection.IsNew(),
|
||||
validation.Length(models.DefaultIdLength, models.DefaultIdLength),
|
||||
validation.Match(idRegex),
|
||||
).Else(validation.In(form.collection.Id)),
|
||||
),
|
||||
validation.Field(
|
||||
&form.System,
|
||||
validation.By(form.ensureNoSystemFlagChange),
|
||||
@@ -78,6 +117,7 @@ func (form *CollectionUpsert) Validate() error {
|
||||
&form.Schema,
|
||||
validation.By(form.ensureNoSystemFieldsChange),
|
||||
validation.By(form.ensureNoFieldsTypeChange),
|
||||
validation.By(form.ensureExistingRelationCollectionId),
|
||||
),
|
||||
validation.Field(&form.ListRule, validation.By(form.checkRule)),
|
||||
validation.Field(&form.ViewRule, validation.By(form.checkRule)),
|
||||
@@ -90,11 +130,11 @@ func (form *CollectionUpsert) Validate() error {
|
||||
func (form *CollectionUpsert) checkUniqueName(value any) error {
|
||||
v, _ := value.(string)
|
||||
|
||||
if !form.app.Dao().IsCollectionNameUnique(v, form.collection.Id) {
|
||||
if !form.config.TxDao.IsCollectionNameUnique(v, form.collection.Id) {
|
||||
return validation.NewError("validation_collection_name_exists", "Collection name must be unique (case insensitive).")
|
||||
}
|
||||
|
||||
if (form.isCreate || !strings.EqualFold(v, form.collection.Name)) && form.app.Dao().HasTable(v) {
|
||||
if (form.collection.IsNew() || !strings.EqualFold(v, form.collection.Name)) && form.config.TxDao.HasTable(v) {
|
||||
return validation.NewError("validation_collection_name_table_exists", "The collection name must be also unique table name.")
|
||||
}
|
||||
|
||||
@@ -104,7 +144,7 @@ func (form *CollectionUpsert) checkUniqueName(value any) error {
|
||||
func (form *CollectionUpsert) ensureNoSystemNameChange(value any) error {
|
||||
v, _ := value.(string)
|
||||
|
||||
if form.isCreate || !form.collection.System || v == form.collection.Name {
|
||||
if form.collection.IsNew() || !form.collection.System || v == form.collection.Name {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -114,7 +154,7 @@ func (form *CollectionUpsert) ensureNoSystemNameChange(value any) error {
|
||||
func (form *CollectionUpsert) ensureNoSystemFlagChange(value any) error {
|
||||
v, _ := value.(bool)
|
||||
|
||||
if form.isCreate || v == form.collection.System {
|
||||
if form.collection.IsNew() || v == form.collection.System {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -124,11 +164,38 @@ func (form *CollectionUpsert) ensureNoSystemFlagChange(value any) error {
|
||||
func (form *CollectionUpsert) ensureNoFieldsTypeChange(value any) error {
|
||||
v, _ := value.(schema.Schema)
|
||||
|
||||
for _, field := range v.Fields() {
|
||||
for i, field := range v.Fields() {
|
||||
oldField := form.collection.Schema.GetFieldById(field.Id)
|
||||
|
||||
if oldField != nil && oldField.Type != field.Type {
|
||||
return validation.NewError("validation_field_type_change", "Field type cannot be changed.")
|
||||
return validation.Errors{fmt.Sprint(i): validation.NewError(
|
||||
"validation_field_type_change",
|
||||
"Field type cannot be changed.",
|
||||
)}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (form *CollectionUpsert) ensureExistingRelationCollectionId(value any) error {
|
||||
v, _ := value.(schema.Schema)
|
||||
|
||||
for i, field := range v.Fields() {
|
||||
if field.Type != schema.FieldTypeRelation {
|
||||
continue
|
||||
}
|
||||
|
||||
options, _ := field.Options.(*schema.RelationOptions)
|
||||
if options == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if _, err := form.config.TxDao.FindCollectionByNameOrId(options.CollectionId); err != nil {
|
||||
return validation.Errors{fmt.Sprint(i): validation.NewError(
|
||||
"validation_field_invalid_relation",
|
||||
"The relation collection doesn't exist.",
|
||||
)}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +228,7 @@ func (form *CollectionUpsert) checkRule(value any) error {
|
||||
}
|
||||
|
||||
dummy := &models.Collection{Schema: form.Schema}
|
||||
r := resolvers.NewRecordFieldResolver(form.app.Dao(), dummy, nil)
|
||||
r := resolvers.NewRecordFieldResolver(form.config.TxDao, dummy, nil)
|
||||
|
||||
_, err := search.FilterData(*v).BuildExpr(r)
|
||||
if err != nil {
|
||||
@@ -182,13 +249,19 @@ func (form *CollectionUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// system flag can be set only for create
|
||||
if form.isCreate {
|
||||
if form.collection.IsNew() {
|
||||
// system flag can be set only on create
|
||||
form.collection.System = form.System
|
||||
|
||||
// custom insertion id can be set only on create
|
||||
if form.Id != "" {
|
||||
form.collection.MarkAsNew()
|
||||
form.collection.SetId(form.Id)
|
||||
}
|
||||
}
|
||||
|
||||
// system collections cannot be renamed
|
||||
if form.isCreate || !form.collection.System {
|
||||
if form.collection.IsNew() || !form.collection.System {
|
||||
form.collection.Name = form.Name
|
||||
}
|
||||
|
||||
@@ -200,6 +273,6 @@ func (form *CollectionUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
form.collection.DeleteRule = form.DeleteRule
|
||||
|
||||
return runInterceptors(func() error {
|
||||
return form.app.Dao().SaveCollection(form.collection)
|
||||
return form.config.TxDao.SaveCollection(form.collection)
|
||||
}, interceptors...)
|
||||
}
|
||||
@@ -10,9 +10,33 @@ import (
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/models/schema"
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
"github.com/pocketbase/pocketbase/tools/security"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
func TestCollectionUpsertPanic1(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewCollectionUpsert(nil, nil)
|
||||
}
|
||||
|
||||
func TestCollectionUpsertPanic2(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewCollectionUpsert(app, nil)
|
||||
}
|
||||
|
||||
func TestNewCollectionUpsert(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
@@ -518,3 +542,107 @@ func TestCollectionUpsertSubmitInterceptors(t *testing.T) {
|
||||
t.Fatalf("Expected the form model to be filled before calling the interceptors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCollectionUpsertWithCustomId(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
existingCollection, err := app.Dao().FindCollectionByNameOrId("demo3")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
newCollection := func() *models.Collection {
|
||||
return &models.Collection{
|
||||
Name: "c_" + security.RandomString(4),
|
||||
Schema: existingCollection.Schema,
|
||||
}
|
||||
}
|
||||
|
||||
scenarios := []struct {
|
||||
name string
|
||||
jsonData string
|
||||
collection *models.Collection
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
"empty data",
|
||||
"{}",
|
||||
newCollection(),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"empty id",
|
||||
`{"id":""}`,
|
||||
newCollection(),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"id < 15 chars",
|
||||
`{"id":"a23"}`,
|
||||
newCollection(),
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id > 15 chars",
|
||||
`{"id":"a234567890123456"}`,
|
||||
newCollection(),
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id = 15 chars (invalid chars)",
|
||||
`{"id":"a@3456789012345"}`,
|
||||
newCollection(),
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id = 15 chars (valid chars)",
|
||||
`{"id":"a23456789012345"}`,
|
||||
newCollection(),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"changing the id of an existing item",
|
||||
`{"id":"b23456789012345"}`,
|
||||
existingCollection,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"using the same existing item id",
|
||||
`{"id":"` + existingCollection.Id + `"}`,
|
||||
existingCollection,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"skipping the id for existing item",
|
||||
`{}`,
|
||||
existingCollection,
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, scenario := range scenarios {
|
||||
form := forms.NewCollectionUpsert(app, scenario.collection)
|
||||
|
||||
// load data
|
||||
loadErr := json.Unmarshal([]byte(scenario.jsonData), form)
|
||||
if loadErr != nil {
|
||||
t.Errorf("[%s] Failed to load form data: %v", scenario.name, loadErr)
|
||||
continue
|
||||
}
|
||||
|
||||
submitErr := form.Submit()
|
||||
hasErr := submitErr != nil
|
||||
|
||||
if hasErr != scenario.expectError {
|
||||
t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", scenario.name, scenario.expectError, hasErr, submitErr)
|
||||
}
|
||||
|
||||
if !hasErr && form.Id != "" {
|
||||
_, err := app.Dao().FindCollectionByNameOrId(form.Id)
|
||||
if err != nil {
|
||||
t.Errorf("[%s] Expected to find record with id %s, got %v", scenario.name, form.Id, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package forms
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// CollectionsImport specifies a form model to bulk import
|
||||
// (create, replace and delete) collections from a user provided list.
|
||||
type CollectionsImport struct {
|
||||
config CollectionsImportConfig
|
||||
|
||||
Collections []*models.Collection `form:"collections" json:"collections"`
|
||||
DeleteMissing bool `form:"deleteMissing" json:"deleteMissing"`
|
||||
}
|
||||
|
||||
// CollectionsImportConfig is the [CollectionsImport] factory initializer config.
|
||||
//
|
||||
// NB! App is a required struct member.
|
||||
type CollectionsImportConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewCollectionsImport creates a new [CollectionsImport] form with
|
||||
// initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewCollectionsImportWithConfig] with explicitly set TxDao.
|
||||
func NewCollectionsImport(app core.App) *CollectionsImport {
|
||||
return NewCollectionsImportWithConfig(CollectionsImportConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewCollectionsImportWithConfig creates a new [CollectionsImport]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewCollectionsImportWithConfig(config CollectionsImportConfig) *CollectionsImport {
|
||||
form := &CollectionsImport{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
func (form *CollectionsImport) Validate() error {
|
||||
return validation.ValidateStruct(form,
|
||||
validation.Field(&form.Collections, validation.Required),
|
||||
)
|
||||
}
|
||||
|
||||
// Submit applies the import, aka.:
|
||||
// - imports the form collections (create or replace)
|
||||
// - sync the collection changes with their related records table
|
||||
// - ensures the integrity of the imported structure (aka. run validations for each collection)
|
||||
// - if [form.DeleteMissing] is set, deletes all local collections that are not found in the imports list
|
||||
//
|
||||
// All operations are wrapped in a single transaction that are
|
||||
// rollbacked on the first encountered error.
|
||||
//
|
||||
// You can optionally provide a list of InterceptorFunc to further
|
||||
// modify the form behavior before persisting it.
|
||||
func (form *CollectionsImport) Submit(interceptors ...InterceptorFunc) error {
|
||||
if err := form.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return runInterceptors(func() error {
|
||||
return form.config.TxDao.RunInTransaction(func(txDao *daos.Dao) error {
|
||||
importErr := txDao.ImportCollections(
|
||||
form.Collections,
|
||||
form.DeleteMissing,
|
||||
form.beforeRecordsSync,
|
||||
)
|
||||
if importErr == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// validation failure
|
||||
if err, ok := importErr.(validation.Errors); ok {
|
||||
return err
|
||||
}
|
||||
|
||||
// generic/db failure
|
||||
if form.config.App.IsDebug() {
|
||||
log.Println("Internal import failure:", importErr)
|
||||
}
|
||||
return validation.Errors{"collections": validation.NewError(
|
||||
"collections_import_failure",
|
||||
"Failed to import the collections configuration.",
|
||||
)}
|
||||
})
|
||||
}, interceptors...)
|
||||
}
|
||||
|
||||
func (form *CollectionsImport) beforeRecordsSync(txDao *daos.Dao, mappedNew, mappedOld map[string]*models.Collection) error {
|
||||
// refresh the actual persisted collections list
|
||||
refreshedCollections := []*models.Collection{}
|
||||
if err := txDao.CollectionQuery().OrderBy("created ASC").All(&refreshedCollections); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// trigger the validator for each existing collection to
|
||||
// ensure that the app is not left in a broken state
|
||||
for _, collection := range refreshedCollections {
|
||||
upsertModel := mappedOld[collection.GetId()]
|
||||
if upsertModel == nil {
|
||||
upsertModel = collection
|
||||
}
|
||||
|
||||
upsertForm := NewCollectionUpsertWithConfig(CollectionUpsertConfig{
|
||||
App: form.config.App,
|
||||
TxDao: txDao,
|
||||
}, upsertModel)
|
||||
|
||||
// load form fields with the refreshed collection state
|
||||
upsertForm.Id = collection.Id
|
||||
upsertForm.Name = collection.Name
|
||||
upsertForm.System = collection.System
|
||||
upsertForm.ListRule = collection.ListRule
|
||||
upsertForm.ViewRule = collection.ViewRule
|
||||
upsertForm.CreateRule = collection.CreateRule
|
||||
upsertForm.UpdateRule = collection.UpdateRule
|
||||
upsertForm.DeleteRule = collection.DeleteRule
|
||||
upsertForm.Schema = collection.Schema
|
||||
|
||||
if err := upsertForm.Validate(); err != nil {
|
||||
// serialize the validation error(s)
|
||||
serializedErr, _ := json.MarshalIndent(err, "", " ")
|
||||
|
||||
return validation.Errors{"collections": validation.NewError(
|
||||
"collections_import_validate_failure",
|
||||
fmt.Sprintf("Data validations failed for collection %q (%s):\n%s", collection.Name, collection.Id, serializedErr),
|
||||
)}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,419 @@
|
||||
package forms_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/pocketbase/pocketbase/forms"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestCollectionsImportPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewCollectionsImport(nil)
|
||||
}
|
||||
|
||||
func TestCollectionsImportValidate(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
form := forms.NewCollectionsImport(app)
|
||||
|
||||
scenarios := []struct {
|
||||
collections []*models.Collection
|
||||
expectError bool
|
||||
}{
|
||||
{nil, true},
|
||||
{[]*models.Collection{}, true},
|
||||
{[]*models.Collection{{}}, false},
|
||||
}
|
||||
|
||||
for i, s := range scenarios {
|
||||
form.Collections = s.collections
|
||||
|
||||
err := form.Validate()
|
||||
|
||||
hasErr := err != nil
|
||||
if hasErr != s.expectError {
|
||||
t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCollectionsImportSubmit(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
jsonData string
|
||||
expectError bool
|
||||
expectCollectionsCount int
|
||||
expectEvents map[string]int
|
||||
}{
|
||||
{
|
||||
name: "empty collections",
|
||||
jsonData: `{
|
||||
"deleteMissing": true,
|
||||
"collections": []
|
||||
}`,
|
||||
expectError: true,
|
||||
expectCollectionsCount: 5,
|
||||
expectEvents: nil,
|
||||
},
|
||||
{
|
||||
name: "one of the collections has invalid data",
|
||||
jsonData: `{
|
||||
"collections": [
|
||||
{
|
||||
"name": "import1",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "import 2",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
expectError: true,
|
||||
expectCollectionsCount: 5,
|
||||
expectEvents: map[string]int{
|
||||
"OnModelBeforeCreate": 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "all imported collections has valid data",
|
||||
jsonData: `{
|
||||
"collections": [
|
||||
{
|
||||
"name": "import1",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "import2",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
expectError: false,
|
||||
expectCollectionsCount: 7,
|
||||
expectEvents: map[string]int{
|
||||
"OnModelBeforeCreate": 2,
|
||||
"OnModelAfterCreate": 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "new collection with existing name",
|
||||
jsonData: `{
|
||||
"collections": [
|
||||
{
|
||||
"name": "demo2",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
expectError: true,
|
||||
expectCollectionsCount: 5,
|
||||
expectEvents: map[string]int{
|
||||
"OnModelBeforeCreate": 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "delete system + modified + new collection",
|
||||
jsonData: `{
|
||||
"deleteMissing": true,
|
||||
"collections": [
|
||||
{
|
||||
"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc",
|
||||
"name":"demo",
|
||||
"schema":[
|
||||
{
|
||||
"id":"_2hlxbmp",
|
||||
"name":"title",
|
||||
"type":"text",
|
||||
"system":false,
|
||||
"required":true,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"min":3,
|
||||
"max":null,
|
||||
"pattern":""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "import1",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
expectError: true,
|
||||
expectCollectionsCount: 5,
|
||||
},
|
||||
{
|
||||
name: "modified + new collection",
|
||||
jsonData: `{
|
||||
"collections": [
|
||||
{
|
||||
"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc",
|
||||
"name":"demo",
|
||||
"schema":[
|
||||
{
|
||||
"id":"_2hlxbmp",
|
||||
"name":"title",
|
||||
"type":"text",
|
||||
"system":false,
|
||||
"required":true,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"min":3,
|
||||
"max":null,
|
||||
"pattern":""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "import1",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "import2",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
expectError: false,
|
||||
expectCollectionsCount: 7,
|
||||
expectEvents: map[string]int{
|
||||
"OnModelBeforeUpdate": 1,
|
||||
"OnModelAfterUpdate": 1,
|
||||
"OnModelBeforeCreate": 2,
|
||||
"OnModelAfterCreate": 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "delete non-system + modified + new collection",
|
||||
jsonData: `{
|
||||
"deleteMissing": true,
|
||||
"collections": [
|
||||
{
|
||||
"id":"abe78266-fd4d-4aea-962d-8c0138ac522b",
|
||||
"name":"profiles",
|
||||
"system":true,
|
||||
"listRule":"userId = @request.user.id",
|
||||
"viewRule":"created > 'test_change'",
|
||||
"createRule":"userId = @request.user.id",
|
||||
"updateRule":"userId = @request.user.id",
|
||||
"deleteRule":"userId = @request.user.id",
|
||||
"schema":[
|
||||
{
|
||||
"id":"koih1lqx",
|
||||
"name":"userId",
|
||||
"type":"user",
|
||||
"system":true,
|
||||
"required":true,
|
||||
"unique":true,
|
||||
"options":{
|
||||
"maxSelect":1,
|
||||
"cascadeDelete":true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id":"69ycbg3q",
|
||||
"name":"rel",
|
||||
"type":"relation",
|
||||
"system":false,
|
||||
"required":false,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"maxSelect":2,
|
||||
"collectionId":"abe78266-fd4d-4aea-962d-8c0138ac522b",
|
||||
"cascadeDelete":false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc",
|
||||
"name":"demo",
|
||||
"schema":[
|
||||
{
|
||||
"id":"_2hlxbmp",
|
||||
"name":"title",
|
||||
"type":"text",
|
||||
"system":false,
|
||||
"required":true,
|
||||
"unique":false,
|
||||
"options":{
|
||||
"min":3,
|
||||
"max":null,
|
||||
"pattern":""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "test_deleted_collection_name_reuse",
|
||||
"name": "demo2",
|
||||
"schema": [
|
||||
{
|
||||
"id":"fz6iql2m",
|
||||
"name":"active",
|
||||
"type":"bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
expectError: false,
|
||||
expectCollectionsCount: 3,
|
||||
expectEvents: map[string]int{
|
||||
"OnModelBeforeUpdate": 2,
|
||||
"OnModelAfterUpdate": 2,
|
||||
"OnModelBeforeCreate": 1,
|
||||
"OnModelAfterCreate": 1,
|
||||
"OnModelBeforeDelete": 3,
|
||||
"OnModelAfterDelete": 3,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
form := forms.NewCollectionsImport(testApp)
|
||||
|
||||
// load data
|
||||
loadErr := json.Unmarshal([]byte(s.jsonData), form)
|
||||
if loadErr != nil {
|
||||
t.Errorf("[%s] Failed to load form data: %v", s.name, loadErr)
|
||||
continue
|
||||
}
|
||||
|
||||
err := form.Submit()
|
||||
|
||||
hasErr := err != nil
|
||||
if hasErr != s.expectError {
|
||||
t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", s.name, s.expectError, hasErr, err)
|
||||
}
|
||||
|
||||
// check collections count
|
||||
collections := []*models.Collection{}
|
||||
if err := testApp.Dao().CollectionQuery().All(&collections); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(collections) != s.expectCollectionsCount {
|
||||
t.Errorf("[%s] Expected %d collections, got %d", s.name, s.expectCollectionsCount, len(collections))
|
||||
}
|
||||
|
||||
// check events
|
||||
if len(testApp.EventCalls) > len(s.expectEvents) {
|
||||
t.Errorf("[%s] Expected events %v, got %v", s.name, s.expectEvents, testApp.EventCalls)
|
||||
}
|
||||
for event, expectedCalls := range s.expectEvents {
|
||||
actualCalls := testApp.EventCalls[event]
|
||||
if actualCalls != expectedCalls {
|
||||
t.Errorf("[%s] Expected event %s to be called %d, got %d", s.name, event, expectedCalls, actualCalls)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCollectionsImportSubmitInterceptors(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
collections := []*models.Collection{}
|
||||
if err := app.Dao().CollectionQuery().All(&collections); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
form := forms.NewCollectionsImport(app)
|
||||
form.Collections = collections
|
||||
|
||||
testErr := errors.New("test_error")
|
||||
|
||||
interceptor1Called := false
|
||||
interceptor1 := func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc {
|
||||
return func() error {
|
||||
interceptor1Called = true
|
||||
return next()
|
||||
}
|
||||
}
|
||||
|
||||
interceptor2Called := false
|
||||
interceptor2 := func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc {
|
||||
return func() error {
|
||||
interceptor2Called = true
|
||||
return testErr
|
||||
}
|
||||
}
|
||||
|
||||
submitErr := form.Submit(interceptor1, interceptor2)
|
||||
if submitErr != testErr {
|
||||
t.Fatalf("Expected submitError %v, got %v", testErr, submitErr)
|
||||
}
|
||||
|
||||
if !interceptor1Called {
|
||||
t.Fatalf("Expected interceptor1 to be called")
|
||||
}
|
||||
|
||||
if !interceptor2Called {
|
||||
t.Fatalf("Expected interceptor2 to be called")
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
)
|
||||
|
||||
// RealtimeSubscribe defines a RealtimeSubscribe request form.
|
||||
// RealtimeSubscribe specifies a RealtimeSubscribe request form.
|
||||
type RealtimeSubscribe struct {
|
||||
ClientId string `form:"clientId" json:"clientId"`
|
||||
Subscriptions []string `form:"subscriptions" json:"subscriptions"`
|
||||
|
||||
+89
-14
@@ -9,6 +9,7 @@ import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
@@ -20,29 +21,59 @@ import (
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
// RecordUpsert defines a Record upsert form.
|
||||
// RecordUpsert specifies a [models.Record] upsert (create/update) form.
|
||||
type RecordUpsert struct {
|
||||
app core.App
|
||||
config RecordUpsertConfig
|
||||
record *models.Record
|
||||
|
||||
isCreate bool
|
||||
filesToDelete []string // names list
|
||||
filesToUpload []*rest.UploadedFile
|
||||
|
||||
Id string `form:"id" json:"id"`
|
||||
Data map[string]any `json:"data"`
|
||||
}
|
||||
|
||||
// NewRecordUpsert creates a new Record upsert form.
|
||||
// (pass a new Record model instance (`models.NewRecord(...)`) for create).
|
||||
// RecordUpsertConfig is the [RecordUpsert] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type RecordUpsertConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewRecordUpsert creates a new [RecordUpsert] form with initializer
|
||||
// config created from the provided [core.App] and [models.Record] instances
|
||||
// (for create you could pass a pointer to an empty Record - `models.NewRecord(collection)`).
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewRecordUpsertWithConfig] with explicitly set TxDao.
|
||||
func NewRecordUpsert(app core.App, record *models.Record) *RecordUpsert {
|
||||
return NewRecordUpsertWithConfig(RecordUpsertConfig{
|
||||
App: app,
|
||||
}, record)
|
||||
}
|
||||
|
||||
// NewRecordUpsertWithConfig creates a new [RecordUpsert] form
|
||||
// with the provided config and [models.Record] instance or panics on invalid configuration
|
||||
// (for create you could pass a pointer to an empty Record - `models.NewRecord(collection)`).
|
||||
func NewRecordUpsertWithConfig(config RecordUpsertConfig, record *models.Record) *RecordUpsert {
|
||||
form := &RecordUpsert{
|
||||
app: app,
|
||||
config: config,
|
||||
record: record,
|
||||
isCreate: !record.HasId(),
|
||||
filesToDelete: []string{},
|
||||
filesToUpload: []*rest.UploadedFile{},
|
||||
}
|
||||
|
||||
if form.config.App == nil || form.record == nil {
|
||||
panic("Invalid initializer config or nil upsert model.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
form.Id = record.Id
|
||||
|
||||
form.Data = map[string]any{}
|
||||
for _, field := range record.Collection().Schema.Fields() {
|
||||
form.Data[field.Name] = record.GetDataValue(field.Name)
|
||||
@@ -136,6 +167,10 @@ func (form *RecordUpsert) LoadData(r *http.Request) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if id, ok := requestData["id"]; ok {
|
||||
form.Id = cast.ToString(id)
|
||||
}
|
||||
|
||||
// extend base data with the extracted one
|
||||
extendedData := form.record.Data()
|
||||
rawData, err := json.Marshal(requestData)
|
||||
@@ -202,7 +237,7 @@ func (form *RecordUpsert) LoadData(r *http.Request) error {
|
||||
// check if there are any new uploaded form files
|
||||
files, err := rest.FindUploadedFiles(r, key)
|
||||
if err != nil {
|
||||
if form.app.IsDebug() {
|
||||
if form.config.App.IsDebug() {
|
||||
log.Printf("%q uploaded file error: %v\n", key, err)
|
||||
}
|
||||
|
||||
@@ -234,8 +269,24 @@ func (form *RecordUpsert) LoadData(r *http.Request) error {
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
func (form *RecordUpsert) Validate() error {
|
||||
// base form fields validator
|
||||
baseFieldsErrors := validation.ValidateStruct(form,
|
||||
validation.Field(
|
||||
&form.Id,
|
||||
validation.When(
|
||||
form.record.IsNew(),
|
||||
validation.Length(models.DefaultIdLength, models.DefaultIdLength),
|
||||
validation.Match(idRegex),
|
||||
).Else(validation.In(form.record.Id)),
|
||||
),
|
||||
)
|
||||
if baseFieldsErrors != nil {
|
||||
return baseFieldsErrors
|
||||
}
|
||||
|
||||
// record data validator
|
||||
dataValidator := validators.NewRecordDataValidator(
|
||||
form.app.Dao(),
|
||||
form.config.TxDao,
|
||||
form.record,
|
||||
form.filesToUpload,
|
||||
)
|
||||
@@ -252,17 +303,26 @@ func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error
|
||||
return err
|
||||
}
|
||||
|
||||
isNew := form.record.IsNew()
|
||||
|
||||
// custom insertion id can be set only on create
|
||||
if isNew && form.Id != "" {
|
||||
form.record.MarkAsNew()
|
||||
form.record.SetId(form.Id)
|
||||
}
|
||||
|
||||
// bulk load form data
|
||||
if err := form.record.Load(form.Data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return form.app.Dao().RunInTransaction(func(txDao *daos.Dao) error {
|
||||
return form.config.TxDao.RunInTransaction(func(txDao *daos.Dao) error {
|
||||
tx, ok := txDao.DB().(*dbx.Tx)
|
||||
if !ok {
|
||||
return errors.New("failed to get transaction db")
|
||||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
txDao.BeforeCreateFunc = nil
|
||||
txDao.AfterCreateFunc = nil
|
||||
txDao.BeforeUpdateFunc = nil
|
||||
@@ -272,7 +332,16 @@ func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error
|
||||
return err
|
||||
}
|
||||
|
||||
return callback(txDao)
|
||||
// restore record isNew state
|
||||
if isNew {
|
||||
form.record.MarkAsNew()
|
||||
}
|
||||
|
||||
if callback != nil {
|
||||
return callback(txDao)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -285,13 +354,19 @@ func (form *RecordUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// custom insertion id can be set only on create
|
||||
if form.record.IsNew() && form.Id != "" {
|
||||
form.record.MarkAsNew()
|
||||
form.record.SetId(form.Id)
|
||||
}
|
||||
|
||||
// bulk load form data
|
||||
if err := form.record.Load(form.Data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return runInterceptors(func() error {
|
||||
return form.app.Dao().RunInTransaction(func(txDao *daos.Dao) error {
|
||||
return form.config.TxDao.RunInTransaction(func(txDao *daos.Dao) error {
|
||||
// persist record model
|
||||
if err := txDao.SaveRecord(form.record); err != nil {
|
||||
return err
|
||||
@@ -322,7 +397,7 @@ func (form *RecordUpsert) processFilesToUpload() error {
|
||||
return errors.New("The record is not persisted yet.")
|
||||
}
|
||||
|
||||
fs, err := form.app.NewFilesystem()
|
||||
fs, err := form.config.App.NewFilesystem()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -358,7 +433,7 @@ func (form *RecordUpsert) processFilesToDelete() error {
|
||||
return errors.New("The record is not persisted yet.")
|
||||
}
|
||||
|
||||
fs, err := form.app.NewFilesystem()
|
||||
fs, err := form.config.App.NewFilesystem()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+142
-1
@@ -20,6 +20,29 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/list"
|
||||
)
|
||||
|
||||
func TestRecordUpsertPanic1(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewRecordUpsert(nil, nil)
|
||||
}
|
||||
|
||||
func TestRecordUpsertPanic2(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewRecordUpsert(app, nil)
|
||||
}
|
||||
|
||||
func TestNewRecordUpsert(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
@@ -32,7 +55,7 @@ func TestNewRecordUpsert(t *testing.T) {
|
||||
|
||||
val := form.Data["title"]
|
||||
if val != "test_value" {
|
||||
t.Errorf("Expected record data to be load, got %v", form.Data)
|
||||
t.Errorf("Expected record data to be loaded, got %v", form.Data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +91,7 @@ func TestRecordUpsertLoadDataJson(t *testing.T) {
|
||||
}
|
||||
|
||||
testData := map[string]any{
|
||||
"id": "test_id",
|
||||
"title": "test123",
|
||||
"unknown": "test456",
|
||||
// file fields unset/delete
|
||||
@@ -86,6 +110,10 @@ func TestRecordUpsertLoadDataJson(t *testing.T) {
|
||||
t.Fatal(loadErr)
|
||||
}
|
||||
|
||||
if form.Id != "test_id" {
|
||||
t.Fatalf("Expect id field to be %q, got %q", "test_id", form.Id)
|
||||
}
|
||||
|
||||
if v, ok := form.Data["title"]; !ok || v != "test123" {
|
||||
t.Fatalf("Expect title field to be %q, got %q", "test123", v)
|
||||
}
|
||||
@@ -134,6 +162,7 @@ func TestRecordUpsertLoadDataMultipart(t *testing.T) {
|
||||
}
|
||||
|
||||
formData, mp, err := tests.MockMultipartData(map[string]string{
|
||||
"id": "test_id",
|
||||
"title": "test123",
|
||||
"unknown": "test456",
|
||||
// file fields unset/delete
|
||||
@@ -154,6 +183,10 @@ func TestRecordUpsertLoadDataMultipart(t *testing.T) {
|
||||
t.Fatal(loadErr)
|
||||
}
|
||||
|
||||
if form.Id != "test_id" {
|
||||
t.Fatalf("Expect id field to be %q, got %q", "test_id", form.Id)
|
||||
}
|
||||
|
||||
if v, ok := form.Data["title"]; !ok || v != "test123" {
|
||||
t.Fatalf("Expect title field to be %q, got %q", "test123", v)
|
||||
}
|
||||
@@ -202,6 +235,7 @@ func TestRecordUpsertValidateFailure(t *testing.T) {
|
||||
|
||||
// try with invalid test data to check whether the RecordDataValidator is triggered
|
||||
formData, mp, err := tests.MockMultipartData(map[string]string{
|
||||
"id": "",
|
||||
"unknown": "test456", // should be ignored
|
||||
"title": "a",
|
||||
"onerel": "00000000-84ab-4057-a592-4604a731f78f",
|
||||
@@ -247,6 +281,7 @@ func TestRecordUpsertValidateSuccess(t *testing.T) {
|
||||
}
|
||||
|
||||
formData, mp, err := tests.MockMultipartData(map[string]string{
|
||||
"id": record.Id,
|
||||
"unknown": "test456", // should be ignored
|
||||
"title": "abc",
|
||||
"onerel": "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2",
|
||||
@@ -576,3 +611,109 @@ func hasRecordFile(app core.App, record *models.Record, filename string) bool {
|
||||
|
||||
return exists
|
||||
}
|
||||
|
||||
func TestRecordUpsertWithCustomId(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
collection, _ := app.Dao().FindCollectionByNameOrId("demo3")
|
||||
existingRecord, err := app.Dao().FindFirstRecordByData(collection, "id", "2c542824-9de1-42fe-8924-e57c86267760")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
scenarios := []struct {
|
||||
name string
|
||||
data map[string]string
|
||||
record *models.Record
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
"empty data",
|
||||
map[string]string{},
|
||||
models.NewRecord(collection),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"empty id",
|
||||
map[string]string{"id": ""},
|
||||
models.NewRecord(collection),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"id < 15 chars",
|
||||
map[string]string{"id": "a23"},
|
||||
models.NewRecord(collection),
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id > 15 chars",
|
||||
map[string]string{"id": "a234567890123456"},
|
||||
models.NewRecord(collection),
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id = 15 chars (invalid chars)",
|
||||
map[string]string{"id": "a@3456789012345"},
|
||||
models.NewRecord(collection),
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id = 15 chars (valid chars)",
|
||||
map[string]string{"id": "a23456789012345"},
|
||||
models.NewRecord(collection),
|
||||
false,
|
||||
},
|
||||
{
|
||||
"changing the id of an existing record",
|
||||
map[string]string{"id": "b23456789012345"},
|
||||
existingRecord,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"using the same existing record id",
|
||||
map[string]string{"id": existingRecord.Id},
|
||||
existingRecord,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"skipping the id for existing record",
|
||||
map[string]string{},
|
||||
existingRecord,
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, scenario := range scenarios {
|
||||
formData, mp, err := tests.MockMultipartData(scenario.data)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
form := forms.NewRecordUpsert(app, scenario.record)
|
||||
req := httptest.NewRequest(http.MethodGet, "/", formData)
|
||||
req.Header.Set(echo.HeaderContentType, mp.FormDataContentType())
|
||||
form.LoadData(req)
|
||||
|
||||
dryErr := form.DrySubmit(nil)
|
||||
hasDryErr := dryErr != nil
|
||||
|
||||
submitErr := form.Submit()
|
||||
hasSubmitErr := submitErr != nil
|
||||
|
||||
if hasDryErr != hasSubmitErr {
|
||||
t.Errorf("[%s] Expected hasDryErr and hasSubmitErr to have the same value, got %v vs %v", scenario.name, hasDryErr, hasSubmitErr)
|
||||
}
|
||||
|
||||
if hasSubmitErr != scenario.expectError {
|
||||
t.Errorf("[%s] Expected hasSubmitErr to be %v, got %v (%v)", scenario.name, scenario.expectError, hasSubmitErr, submitErr)
|
||||
}
|
||||
|
||||
if id, ok := scenario.data["id"]; ok && id != "" && !hasSubmitErr {
|
||||
_, err := app.Dao().FindRecordById(collection, id, nil)
|
||||
if err != nil {
|
||||
t.Errorf("[%s] Expected to find record with id %s, got %v", scenario.name, id, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,22 +5,56 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// SettingsUpsert defines app settings upsert form.
|
||||
// SettingsUpsert specifies a [core.Settings] upsert (create/update) form.
|
||||
type SettingsUpsert struct {
|
||||
*core.Settings
|
||||
|
||||
app core.App
|
||||
config SettingsUpsertConfig
|
||||
}
|
||||
|
||||
// NewSettingsUpsert creates new settings upsert form from the provided app.
|
||||
// SettingsUpsertConfig is the [SettingsUpsert] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type SettingsUpsertConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
TxLogsDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewSettingsUpsert creates a new [SettingsUpsert] form with initializer
|
||||
// config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewSettingsUpsertWithConfig] with explicitly set TxDao.
|
||||
func NewSettingsUpsert(app core.App) *SettingsUpsert {
|
||||
form := &SettingsUpsert{app: app}
|
||||
return NewSettingsUpsertWithConfig(SettingsUpsertConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewSettingsUpsertWithConfig creates a new [SettingsUpsert] form
|
||||
// with the provided config or panics on invalid configuration.
|
||||
func NewSettingsUpsertWithConfig(config SettingsUpsertConfig) *SettingsUpsert {
|
||||
form := &SettingsUpsert{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
if form.config.TxLogsDao == nil {
|
||||
form.config.TxLogsDao = form.config.App.LogsDao()
|
||||
}
|
||||
|
||||
// load the application settings into the form
|
||||
form.Settings, _ = app.Settings().Clone()
|
||||
form.Settings, _ = config.App.Settings().Clone()
|
||||
|
||||
return form
|
||||
}
|
||||
@@ -41,10 +75,10 @@ func (form *SettingsUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
return err
|
||||
}
|
||||
|
||||
encryptionKey := os.Getenv(form.app.EncryptionEnv())
|
||||
encryptionKey := os.Getenv(form.config.App.EncryptionEnv())
|
||||
|
||||
return runInterceptors(func() error {
|
||||
saveErr := form.app.Dao().SaveParam(
|
||||
saveErr := form.config.TxDao.SaveParam(
|
||||
models.ParamAppSettings,
|
||||
form.Settings,
|
||||
encryptionKey,
|
||||
@@ -54,11 +88,11 @@ func (form *SettingsUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
}
|
||||
|
||||
// explicitly trigger old logs deletion
|
||||
form.app.LogsDao().DeleteOldRequests(
|
||||
form.config.TxLogsDao.DeleteOldRequests(
|
||||
time.Now().AddDate(0, 0, -1*form.Settings.Logs.MaxDays),
|
||||
)
|
||||
|
||||
// merge the application settings with the form ones
|
||||
return form.app.Settings().Merge(form.Settings)
|
||||
return form.config.App.Settings().Merge(form.Settings)
|
||||
}, interceptors...)
|
||||
}
|
||||
@@ -12,6 +12,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/security"
|
||||
)
|
||||
|
||||
func TestSettingsUpsertPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewSettingsUpsert(nil)
|
||||
}
|
||||
|
||||
func TestNewSettingsUpsert(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
@@ -3,23 +3,53 @@ package forms
|
||||
import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/tools/security"
|
||||
)
|
||||
|
||||
// UserEmailChangeConfirm defines a user email change confirmation form.
|
||||
// UserEmailChangeConfirm specifies a user email change confirmation form.
|
||||
type UserEmailChangeConfirm struct {
|
||||
app core.App
|
||||
config UserEmailChangeConfirmConfig
|
||||
|
||||
Token string `form:"token" json:"token"`
|
||||
Password string `form:"password" json:"password"`
|
||||
}
|
||||
|
||||
// NewUserEmailChangeConfirm creates new user email change confirmation form.
|
||||
// UserEmailChangeConfirmConfig is the [UserEmailChangeConfirm] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserEmailChangeConfirmConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewUserEmailChangeConfirm creates a new [UserEmailChangeConfirm]
|
||||
// form with initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// This factory method is used primarily for convenience (and backward compatibility).
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserEmailChangeConfirmWithConfig] with explicitly set TxDao.
|
||||
func NewUserEmailChangeConfirm(app core.App) *UserEmailChangeConfirm {
|
||||
return &UserEmailChangeConfirm{
|
||||
app: app,
|
||||
return NewUserEmailChangeConfirmWithConfig(UserEmailChangeConfirmConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewUserEmailChangeConfirmWithConfig creates a new [UserEmailChangeConfirm]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewUserEmailChangeConfirmWithConfig(config UserEmailChangeConfirmConfig) *UserEmailChangeConfirm {
|
||||
form := &UserEmailChangeConfirm{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -73,14 +103,14 @@ func (form *UserEmailChangeConfirm) parseToken(token string) (*models.User, stri
|
||||
}
|
||||
|
||||
// ensure that there aren't other users with the new email
|
||||
if !form.app.Dao().IsUserEmailUnique(newEmail, "") {
|
||||
if !form.config.TxDao.IsUserEmailUnique(newEmail, "") {
|
||||
return nil, "", validation.NewError("validation_existing_token_email", "The new email address is already registered: "+newEmail)
|
||||
}
|
||||
|
||||
// verify that the token is not expired and its signiture is valid
|
||||
user, err := form.app.Dao().FindUserByToken(
|
||||
// verify that the token is not expired and its signature is valid
|
||||
user, err := form.config.TxDao.FindUserByToken(
|
||||
token,
|
||||
form.app.Settings().UserEmailChangeToken.Secret,
|
||||
form.config.App.Settings().UserEmailChangeToken.Secret,
|
||||
)
|
||||
if err != nil || user == nil {
|
||||
return nil, "", validation.NewError("validation_invalid_token", "Invalid or expired token.")
|
||||
@@ -105,7 +135,7 @@ func (form *UserEmailChangeConfirm) Submit() (*models.User, error) {
|
||||
user.Verified = true
|
||||
user.RefreshTokenKey() // invalidate old tokens
|
||||
|
||||
if err := form.app.Dao().SaveUser(user); err != nil {
|
||||
if err := form.config.TxDao.SaveUser(user); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/security"
|
||||
)
|
||||
|
||||
func TestUserEmailChangeConfirmPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserEmailChangeConfirm(nil)
|
||||
}
|
||||
|
||||
func TestUserEmailChangeConfirmValidateAndSubmit(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
@@ -4,24 +4,55 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/mails"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// UserEmailChangeRequest defines a user email change request form.
|
||||
type UserEmailChangeRequest struct {
|
||||
app core.App
|
||||
user *models.User
|
||||
config UserEmailChangeRequestConfig
|
||||
user *models.User
|
||||
|
||||
NewEmail string `form:"newEmail" json:"newEmail"`
|
||||
}
|
||||
|
||||
// NewUserEmailChangeRequest creates a new user email change request form.
|
||||
// UserEmailChangeRequestConfig is the [UserEmailChangeRequest] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserEmailChangeRequestConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewUserEmailChangeRequest creates a new [UserEmailChangeRequest]
|
||||
// form with initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserEmailChangeConfirmWithConfig] with explicitly set TxDao.
|
||||
func NewUserEmailChangeRequest(app core.App, user *models.User) *UserEmailChangeRequest {
|
||||
return &UserEmailChangeRequest{
|
||||
app: app,
|
||||
user: user,
|
||||
return NewUserEmailChangeRequestWithConfig(UserEmailChangeRequestConfig{
|
||||
App: app,
|
||||
}, user)
|
||||
}
|
||||
|
||||
// NewUserEmailChangeRequestWithConfig creates a new [UserEmailChangeRequest]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewUserEmailChangeRequestWithConfig(config UserEmailChangeRequestConfig, user *models.User) *UserEmailChangeRequest {
|
||||
form := &UserEmailChangeRequest{
|
||||
config: config,
|
||||
user: user,
|
||||
}
|
||||
|
||||
if form.config.App == nil || form.user == nil {
|
||||
panic("Invalid initializer config or nil user model.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -40,7 +71,7 @@ func (form *UserEmailChangeRequest) Validate() error {
|
||||
func (form *UserEmailChangeRequest) checkUniqueEmail(value any) error {
|
||||
v, _ := value.(string)
|
||||
|
||||
if !form.app.Dao().IsUserEmailUnique(v, "") {
|
||||
if !form.config.TxDao.IsUserEmailUnique(v, "") {
|
||||
return validation.NewError("validation_user_email_exists", "User email already exists.")
|
||||
}
|
||||
|
||||
@@ -53,5 +84,5 @@ func (form *UserEmailChangeRequest) Submit() error {
|
||||
return err
|
||||
}
|
||||
|
||||
return mails.SendUserChangeEmail(form.app, form.user, form.NewEmail)
|
||||
return mails.SendUserChangeEmail(form.config.App, form.user, form.NewEmail)
|
||||
}
|
||||
@@ -9,6 +9,29 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestUserEmailChangeRequestPanic1(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserEmailChangeRequest(nil, nil)
|
||||
}
|
||||
|
||||
func TestUserEmailChangeRequestPanic2(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserEmailChangeRequest(testApp, nil)
|
||||
}
|
||||
|
||||
func TestUserEmailChangeRequestValidateAndSubmit(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
@@ -4,21 +4,49 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// UserEmailLogin defines a user email/pass login form.
|
||||
// UserEmailLogin specifies a user email/pass login form.
|
||||
type UserEmailLogin struct {
|
||||
app core.App
|
||||
config UserEmailLoginConfig
|
||||
|
||||
Email string `form:"email" json:"email"`
|
||||
Password string `form:"password" json:"password"`
|
||||
}
|
||||
|
||||
// NewUserEmailLogin creates a new user email/pass login form.
|
||||
// UserEmailLoginConfig is the [UserEmailLogin] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserEmailLoginConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewUserEmailLogin creates a new [UserEmailLogin] form with
|
||||
// initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// This factory method is used primarily for convenience (and backward compatibility).
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserEmailLoginWithConfig] with explicitly set TxDao.
|
||||
func NewUserEmailLogin(app core.App) *UserEmailLogin {
|
||||
form := &UserEmailLogin{
|
||||
app: app,
|
||||
return NewUserEmailLoginWithConfig(UserEmailLoginConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewUserEmailLoginWithConfig creates a new [UserEmailLogin]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewUserEmailLoginWithConfig(config UserEmailLoginConfig) *UserEmailLogin {
|
||||
form := &UserEmailLogin{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
@@ -39,7 +67,7 @@ func (form *UserEmailLogin) Submit() (*models.User, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
user, err := form.app.Dao().FindUserByEmail(form.Email)
|
||||
user, err := form.config.TxDao.FindUserByEmail(form.Email)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -9,6 +9,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestUserEmailLoginPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserEmailLogin(nil)
|
||||
}
|
||||
|
||||
func TestUserEmailLoginValidate(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
+45
-11
@@ -7,15 +7,16 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/tools/auth"
|
||||
"github.com/pocketbase/pocketbase/tools/security"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
// UserOauth2Login defines a user Oauth2 login form.
|
||||
// UserOauth2Login specifies a user Oauth2 login form.
|
||||
type UserOauth2Login struct {
|
||||
app core.App
|
||||
config UserOauth2LoginConfig
|
||||
|
||||
// The name of the OAuth2 client provider (eg. "google")
|
||||
Provider string `form:"provider" json:"provider"`
|
||||
@@ -30,9 +31,39 @@ type UserOauth2Login struct {
|
||||
RedirectUrl string `form:"redirectUrl" json:"redirectUrl"`
|
||||
}
|
||||
|
||||
// NewUserOauth2Login creates a new user Oauth2 login form.
|
||||
// UserOauth2LoginConfig is the [UserOauth2Login] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserOauth2LoginConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewUserOauth2Login creates a new [UserOauth2Login] form with
|
||||
// initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserOauth2LoginWithConfig] with explicitly set TxDao.
|
||||
func NewUserOauth2Login(app core.App) *UserOauth2Login {
|
||||
return &UserOauth2Login{app: app}
|
||||
return NewUserOauth2LoginWithConfig(UserOauth2LoginConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewUserOauth2LoginWithConfig creates a new [UserOauth2Login]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewUserOauth2LoginWithConfig(config UserOauth2LoginConfig) *UserOauth2Login {
|
||||
form := &UserOauth2Login{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -48,7 +79,7 @@ func (form *UserOauth2Login) Validate() error {
|
||||
func (form *UserOauth2Login) checkProviderName(value any) error {
|
||||
name, _ := value.(string)
|
||||
|
||||
config, ok := form.app.Settings().NamedAuthProviderConfigs()[name]
|
||||
config, ok := form.config.App.Settings().NamedAuthProviderConfigs()[name]
|
||||
if !ok || !config.Enabled {
|
||||
return validation.NewError("validation_invalid_provider", fmt.Sprintf("%q is missing or is not enabled.", name))
|
||||
}
|
||||
@@ -68,7 +99,7 @@ func (form *UserOauth2Login) Submit() (*models.User, *auth.AuthUser, error) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
config := form.app.Settings().NamedAuthProviderConfigs()[form.Provider]
|
||||
config := form.config.App.Settings().NamedAuthProviderConfigs()[form.Provider]
|
||||
config.SetupProvider(provider)
|
||||
|
||||
provider.SetRedirectUrl(form.RedirectUrl)
|
||||
@@ -89,12 +120,12 @@ func (form *UserOauth2Login) Submit() (*models.User, *auth.AuthUser, error) {
|
||||
}
|
||||
|
||||
// login/register the auth user
|
||||
user, _ := form.app.Dao().FindUserByEmail(authData.Email)
|
||||
user, _ := form.config.TxDao.FindUserByEmail(authData.Email)
|
||||
if user != nil {
|
||||
// update the existing user's verified state
|
||||
if !user.Verified {
|
||||
user.Verified = true
|
||||
if err := form.app.Dao().SaveUser(user); err != nil {
|
||||
if err := form.config.TxDao.SaveUser(user); err != nil {
|
||||
return nil, authData, err
|
||||
}
|
||||
}
|
||||
@@ -108,7 +139,10 @@ func (form *UserOauth2Login) Submit() (*models.User, *auth.AuthUser, error) {
|
||||
|
||||
// create new user
|
||||
user = &models.User{Verified: true}
|
||||
upsertForm := NewUserUpsert(form.app, user)
|
||||
upsertForm := NewUserUpsertWithConfig(UserUpsertConfig{
|
||||
App: form.config.App,
|
||||
TxDao: form.config.TxDao,
|
||||
}, user)
|
||||
upsertForm.Email = authData.Email
|
||||
upsertForm.Password = security.RandomString(30)
|
||||
upsertForm.PasswordConfirm = upsertForm.Password
|
||||
@@ -118,7 +152,7 @@ func (form *UserOauth2Login) Submit() (*models.User, *auth.AuthUser, error) {
|
||||
AuthData: authData,
|
||||
}
|
||||
|
||||
if err := form.app.OnUserBeforeOauth2Register().Trigger(event); err != nil {
|
||||
if err := form.config.App.OnUserBeforeOauth2Register().Trigger(event); err != nil {
|
||||
return nil, authData, err
|
||||
}
|
||||
|
||||
@@ -126,7 +160,7 @@ func (form *UserOauth2Login) Submit() (*models.User, *auth.AuthUser, error) {
|
||||
return nil, authData, err
|
||||
}
|
||||
|
||||
if err := form.app.OnUserAfterOauth2Register().Trigger(event); err != nil {
|
||||
if err := form.config.App.OnUserAfterOauth2Register().Trigger(event); err != nil {
|
||||
return nil, authData, err
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestUserOauth2LoginPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserOauth2Login(nil)
|
||||
}
|
||||
|
||||
func TestUserOauth2LoginValidate(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
@@ -3,29 +3,59 @@ package forms
|
||||
import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/forms/validators"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// UserPasswordResetConfirm defines a user password reset confirmation form.
|
||||
// UserPasswordResetConfirm specifies a user password reset confirmation form.
|
||||
type UserPasswordResetConfirm struct {
|
||||
app core.App
|
||||
config UserPasswordResetConfirmConfig
|
||||
|
||||
Token string `form:"token" json:"token"`
|
||||
Password string `form:"password" json:"password"`
|
||||
PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
|
||||
}
|
||||
|
||||
// NewUserPasswordResetConfirm creates new user password reset confirmation form.
|
||||
// UserPasswordResetConfirmConfig is the [UserPasswordResetConfirm]
|
||||
// factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserPasswordResetConfirmConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewUserPasswordResetConfirm creates a new [UserPasswordResetConfirm]
|
||||
// form with initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserPasswordResetConfirmWithConfig] with explicitly set TxDao.
|
||||
func NewUserPasswordResetConfirm(app core.App) *UserPasswordResetConfirm {
|
||||
return &UserPasswordResetConfirm{
|
||||
app: app,
|
||||
return NewUserPasswordResetConfirmWithConfig(UserPasswordResetConfirmConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewUserPasswordResetConfirmWithConfig creates a new [UserPasswordResetConfirm]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewUserPasswordResetConfirmWithConfig(config UserPasswordResetConfirmConfig) *UserPasswordResetConfirm {
|
||||
form := &UserPasswordResetConfirm{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
func (form *UserPasswordResetConfirm) Validate() error {
|
||||
minPasswordLength := form.app.Settings().EmailAuth.MinPasswordLength
|
||||
minPasswordLength := form.config.App.Settings().EmailAuth.MinPasswordLength
|
||||
|
||||
return validation.ValidateStruct(form,
|
||||
validation.Field(&form.Token, validation.Required, validation.By(form.checkToken)),
|
||||
@@ -40,9 +70,9 @@ func (form *UserPasswordResetConfirm) checkToken(value any) error {
|
||||
return nil // nothing to check
|
||||
}
|
||||
|
||||
user, err := form.app.Dao().FindUserByToken(
|
||||
user, err := form.config.TxDao.FindUserByToken(
|
||||
v,
|
||||
form.app.Settings().UserPasswordResetToken.Secret,
|
||||
form.config.App.Settings().UserPasswordResetToken.Secret,
|
||||
)
|
||||
if err != nil || user == nil {
|
||||
return validation.NewError("validation_invalid_token", "Invalid or expired token.")
|
||||
@@ -58,9 +88,9 @@ func (form *UserPasswordResetConfirm) Submit() (*models.User, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
user, err := form.app.Dao().FindUserByToken(
|
||||
user, err := form.config.TxDao.FindUserByToken(
|
||||
form.Token,
|
||||
form.app.Settings().UserPasswordResetToken.Secret,
|
||||
form.config.App.Settings().UserPasswordResetToken.Secret,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -70,7 +100,7 @@ func (form *UserPasswordResetConfirm) Submit() (*models.User, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := form.app.Dao().SaveUser(user); err != nil {
|
||||
if err := form.config.TxDao.SaveUser(user); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/security"
|
||||
)
|
||||
|
||||
func TestUserPasswordResetConfirmPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserPasswordResetConfirm(nil)
|
||||
}
|
||||
|
||||
func TestUserPasswordResetConfirmValidate(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
@@ -7,24 +7,54 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/mails"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
// UserPasswordResetRequest defines a user password reset request form.
|
||||
// UserPasswordResetRequest specifies a user password reset request form.
|
||||
type UserPasswordResetRequest struct {
|
||||
app core.App
|
||||
resendThreshold float64
|
||||
config UserPasswordResetRequestConfig
|
||||
|
||||
Email string `form:"email" json:"email"`
|
||||
}
|
||||
|
||||
// NewUserPasswordResetRequest creates new user password reset request form.
|
||||
// UserPasswordResetRequestConfig is the [UserPasswordResetRequest]
|
||||
// factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserPasswordResetRequestConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
ResendThreshold float64 // in seconds
|
||||
}
|
||||
|
||||
// NewUserPasswordResetRequest creates a new [UserPasswordResetRequest]
|
||||
// form with initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserPasswordResetRequestWithConfig] with explicitly set TxDao.
|
||||
func NewUserPasswordResetRequest(app core.App) *UserPasswordResetRequest {
|
||||
return &UserPasswordResetRequest{
|
||||
app: app,
|
||||
resendThreshold: 120, // 2 min
|
||||
return NewUserPasswordResetRequestWithConfig(UserPasswordResetRequestConfig{
|
||||
App: app,
|
||||
ResendThreshold: 120, // 2 min
|
||||
})
|
||||
}
|
||||
|
||||
// NewUserPasswordResetRequestWithConfig creates a new [UserPasswordResetRequest]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewUserPasswordResetRequestWithConfig(config UserPasswordResetRequestConfig) *UserPasswordResetRequest {
|
||||
form := &UserPasswordResetRequest{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -48,23 +78,23 @@ func (form *UserPasswordResetRequest) Submit() error {
|
||||
return err
|
||||
}
|
||||
|
||||
user, err := form.app.Dao().FindUserByEmail(form.Email)
|
||||
user, err := form.config.TxDao.FindUserByEmail(form.Email)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
now := time.Now().UTC()
|
||||
lastResetSentAt := user.LastResetSentAt.Time()
|
||||
if now.Sub(lastResetSentAt).Seconds() < form.resendThreshold {
|
||||
if now.Sub(lastResetSentAt).Seconds() < form.config.ResendThreshold {
|
||||
return errors.New("You've already requested a password reset.")
|
||||
}
|
||||
|
||||
if err := mails.SendUserPasswordReset(form.app, user); err != nil {
|
||||
if err := mails.SendUserPasswordReset(form.config.App, user); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update last sent timestamp
|
||||
user.LastResetSentAt = types.NowDateTime()
|
||||
|
||||
return form.app.Dao().SaveUser(user)
|
||||
return form.config.TxDao.SaveUser(user)
|
||||
}
|
||||
@@ -11,6 +11,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
func TestUserPasswordResetRequestPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserPasswordResetRequest(nil)
|
||||
}
|
||||
|
||||
func TestUserPasswordResetRequestValidate(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
+61
-19
@@ -6,33 +6,63 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/forms/validators"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
"github.com/pocketbase/pocketbase/tools/list"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
// UserUpsert defines a user upsert (create/update) form.
|
||||
// UserUpsert specifies a [models.User] upsert (create/update) form.
|
||||
type UserUpsert struct {
|
||||
app core.App
|
||||
user *models.User
|
||||
isCreate bool
|
||||
config UserUpsertConfig
|
||||
user *models.User
|
||||
|
||||
Id string `form:"id" json:"id"`
|
||||
Email string `form:"email" json:"email"`
|
||||
Password string `form:"password" json:"password"`
|
||||
PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"`
|
||||
}
|
||||
|
||||
// NewUserUpsert creates new upsert form for the provided user model
|
||||
// (pass an empty user model instance (`&models.User{}`) for create).
|
||||
// UserUpsertConfig is the [UserUpsert] factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserUpsertConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewUserUpsert creates a new [UserUpsert] form with initializer
|
||||
// config created from the provided [core.App] instance
|
||||
// (for create you could pass a pointer to an empty User - `&models.User{}`).
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserEmailChangeConfirmWithConfig] with explicitly set TxDao.
|
||||
func NewUserUpsert(app core.App, user *models.User) *UserUpsert {
|
||||
return NewUserUpsertWithConfig(UserUpsertConfig{
|
||||
App: app,
|
||||
}, user)
|
||||
}
|
||||
|
||||
// NewUserUpsertWithConfig creates a new [UserUpsert] form with the provided
|
||||
// config and [models.User] instance or panics on invalid configuration
|
||||
// (for create you could pass a pointer to an empty User - `&models.User{}`).
|
||||
func NewUserUpsertWithConfig(config UserUpsertConfig, user *models.User) *UserUpsert {
|
||||
form := &UserUpsert{
|
||||
app: app,
|
||||
user: user,
|
||||
isCreate: !user.HasId(),
|
||||
config: config,
|
||||
user: user,
|
||||
}
|
||||
|
||||
if form.config.App == nil || form.user == nil {
|
||||
panic("Invalid initializer config or nil upsert model.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
// load defaults
|
||||
form.Id = user.Id
|
||||
form.Email = user.Email
|
||||
|
||||
return form
|
||||
@@ -40,9 +70,15 @@ func NewUserUpsert(app core.App, user *models.User) *UserUpsert {
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
func (form *UserUpsert) Validate() error {
|
||||
config := form.app.Settings()
|
||||
|
||||
return validation.ValidateStruct(form,
|
||||
validation.Field(
|
||||
&form.Id,
|
||||
validation.When(
|
||||
form.user.IsNew(),
|
||||
validation.Length(models.DefaultIdLength, models.DefaultIdLength),
|
||||
validation.Match(idRegex),
|
||||
).Else(validation.In(form.user.Id)),
|
||||
),
|
||||
validation.Field(
|
||||
&form.Email,
|
||||
validation.Required,
|
||||
@@ -53,12 +89,12 @@ func (form *UserUpsert) Validate() error {
|
||||
),
|
||||
validation.Field(
|
||||
&form.Password,
|
||||
validation.When(form.isCreate, validation.Required),
|
||||
validation.Length(config.EmailAuth.MinPasswordLength, 100),
|
||||
validation.When(form.user.IsNew(), validation.Required),
|
||||
validation.Length(form.config.App.Settings().EmailAuth.MinPasswordLength, 100),
|
||||
),
|
||||
validation.Field(
|
||||
&form.PasswordConfirm,
|
||||
validation.When(form.isCreate || form.Password != "", validation.Required),
|
||||
validation.When(form.user.IsNew() || form.Password != "", validation.Required),
|
||||
validation.By(validators.Compare(form.Password)),
|
||||
),
|
||||
)
|
||||
@@ -67,7 +103,7 @@ func (form *UserUpsert) Validate() error {
|
||||
func (form *UserUpsert) checkUniqueEmail(value any) error {
|
||||
v, _ := value.(string)
|
||||
|
||||
if v == "" || form.app.Dao().IsUserEmailUnique(v, form.user.Id) {
|
||||
if v == "" || form.config.TxDao.IsUserEmailUnique(v, form.user.Id) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -81,8 +117,8 @@ func (form *UserUpsert) checkEmailDomain(value any) error {
|
||||
}
|
||||
|
||||
domain := val[strings.LastIndex(val, "@")+1:]
|
||||
only := form.app.Settings().EmailAuth.OnlyDomains
|
||||
except := form.app.Settings().EmailAuth.ExceptDomains
|
||||
only := form.config.App.Settings().EmailAuth.OnlyDomains
|
||||
except := form.config.App.Settings().EmailAuth.ExceptDomains
|
||||
|
||||
// only domains check
|
||||
if len(only) > 0 && !list.ExistInSlice(domain, only) {
|
||||
@@ -110,7 +146,13 @@ func (form *UserUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
form.user.SetPassword(form.Password)
|
||||
}
|
||||
|
||||
if !form.isCreate && form.Email != form.user.Email {
|
||||
// custom insertion id can be set only on create
|
||||
if form.user.IsNew() && form.Id != "" {
|
||||
form.user.MarkAsNew()
|
||||
form.user.SetId(form.Id)
|
||||
}
|
||||
|
||||
if !form.user.IsNew() && form.Email != form.user.Email {
|
||||
form.user.Verified = false
|
||||
form.user.LastVerificationSentAt = types.DateTime{} // reset
|
||||
}
|
||||
@@ -118,6 +160,6 @@ func (form *UserUpsert) Submit(interceptors ...InterceptorFunc) error {
|
||||
form.user.Email = form.Email
|
||||
|
||||
return runInterceptors(func() error {
|
||||
return form.app.Dao().SaveUser(form.user)
|
||||
return form.config.TxDao.SaveUser(form.user)
|
||||
}, interceptors...)
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package forms_test
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
@@ -11,6 +12,29 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestUserUpsertPanic1(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserUpsert(nil, nil)
|
||||
}
|
||||
|
||||
func TestUserUpsertPanic2(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserUpsert(app, nil)
|
||||
}
|
||||
|
||||
func TestNewUserUpsert(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
@@ -304,3 +328,105 @@ func TestUserUpsertSubmitInterceptors(t *testing.T) {
|
||||
t.Fatalf("Expected the form model to be filled before calling the interceptors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUserUpsertWithCustomId(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
existingUser, err := app.Dao().FindUserByEmail("test@example.com")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
scenarios := []struct {
|
||||
name string
|
||||
jsonData string
|
||||
collection *models.User
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
"empty data",
|
||||
"{}",
|
||||
&models.User{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"empty id",
|
||||
`{"id":""}`,
|
||||
&models.User{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"id < 15 chars",
|
||||
`{"id":"a23"}`,
|
||||
&models.User{},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id > 15 chars",
|
||||
`{"id":"a234567890123456"}`,
|
||||
&models.User{},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id = 15 chars (invalid chars)",
|
||||
`{"id":"a@3456789012345"}`,
|
||||
&models.User{},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"id = 15 chars (valid chars)",
|
||||
`{"id":"a23456789012345"}`,
|
||||
&models.User{},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"changing the id of an existing item",
|
||||
`{"id":"b23456789012345"}`,
|
||||
existingUser,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"using the same existing item id",
|
||||
`{"id":"` + existingUser.Id + `"}`,
|
||||
existingUser,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"skipping the id for existing item",
|
||||
`{}`,
|
||||
existingUser,
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
||||
for i, scenario := range scenarios {
|
||||
form := forms.NewUserUpsert(app, scenario.collection)
|
||||
if form.Email == "" {
|
||||
form.Email = fmt.Sprintf("test_id_%d@example.com", i)
|
||||
}
|
||||
form.Password = "1234567890"
|
||||
form.PasswordConfirm = form.Password
|
||||
|
||||
// load data
|
||||
loadErr := json.Unmarshal([]byte(scenario.jsonData), form)
|
||||
if loadErr != nil {
|
||||
t.Errorf("[%s] Failed to load form data: %v", scenario.name, loadErr)
|
||||
continue
|
||||
}
|
||||
|
||||
submitErr := form.Submit()
|
||||
hasErr := submitErr != nil
|
||||
|
||||
if hasErr != scenario.expectError {
|
||||
t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", scenario.name, scenario.expectError, hasErr, submitErr)
|
||||
}
|
||||
|
||||
if !hasErr && form.Id != "" {
|
||||
_, err := app.Dao().FindUserById(form.Id)
|
||||
if err != nil {
|
||||
t.Errorf("[%s] Expected to find record with id %s, got %v", scenario.name, form.Id, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,21 +3,51 @@ package forms
|
||||
import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
// UserVerificationConfirm defines a user email confirmation form.
|
||||
// UserVerificationConfirm specifies a user email verification confirmation form.
|
||||
type UserVerificationConfirm struct {
|
||||
app core.App
|
||||
config UserVerificationConfirmConfig
|
||||
|
||||
Token string `form:"token" json:"token"`
|
||||
}
|
||||
|
||||
// NewUserVerificationConfirm creates a new user email confirmation form.
|
||||
// UserVerificationConfirmConfig is the [UserVerificationConfirm]
|
||||
// factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserVerificationConfirmConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
}
|
||||
|
||||
// NewUserVerificationConfirm creates a new [UserVerificationConfirm]
|
||||
// form with initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserVerificationConfirmWithConfig] with explicitly set TxDao.
|
||||
func NewUserVerificationConfirm(app core.App) *UserVerificationConfirm {
|
||||
return &UserVerificationConfirm{
|
||||
app: app,
|
||||
return NewUserVerificationConfirmWithConfig(UserVerificationConfirmConfig{
|
||||
App: app,
|
||||
})
|
||||
}
|
||||
|
||||
// NewUserVerificationConfirmWithConfig creates a new [UserVerificationConfirmConfig]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewUserVerificationConfirmWithConfig(config UserVerificationConfirmConfig) *UserVerificationConfirm {
|
||||
form := &UserVerificationConfirm{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -33,9 +63,9 @@ func (form *UserVerificationConfirm) checkToken(value any) error {
|
||||
return nil // nothing to check
|
||||
}
|
||||
|
||||
user, err := form.app.Dao().FindUserByToken(
|
||||
user, err := form.config.TxDao.FindUserByToken(
|
||||
v,
|
||||
form.app.Settings().UserVerificationToken.Secret,
|
||||
form.config.App.Settings().UserVerificationToken.Secret,
|
||||
)
|
||||
if err != nil || user == nil {
|
||||
return validation.NewError("validation_invalid_token", "Invalid or expired token.")
|
||||
@@ -51,9 +81,9 @@ func (form *UserVerificationConfirm) Submit() (*models.User, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
user, err := form.app.Dao().FindUserByToken(
|
||||
user, err := form.config.TxDao.FindUserByToken(
|
||||
form.Token,
|
||||
form.app.Settings().UserVerificationToken.Secret,
|
||||
form.config.App.Settings().UserVerificationToken.Secret,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -65,7 +95,7 @@ func (form *UserVerificationConfirm) Submit() (*models.User, error) {
|
||||
|
||||
user.Verified = true
|
||||
|
||||
if err := form.app.Dao().SaveUser(user); err != nil {
|
||||
if err := form.config.TxDao.SaveUser(user); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/security"
|
||||
)
|
||||
|
||||
func TestUserVerificationConfirmPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserVerificationConfirm(nil)
|
||||
}
|
||||
|
||||
func TestUserVerificationConfirmValidate(t *testing.T) {
|
||||
app, _ := tests.NewTestApp()
|
||||
defer app.Cleanup()
|
||||
|
||||
@@ -7,24 +7,54 @@ import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/mails"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
// UserVerificationRequest defines a user email verification request form.
|
||||
type UserVerificationRequest struct {
|
||||
app core.App
|
||||
resendThreshold float64
|
||||
config UserVerificationRequestConfig
|
||||
|
||||
Email string `form:"email" json:"email"`
|
||||
}
|
||||
|
||||
// NewUserVerificationRequest creates a new user email verification request form.
|
||||
// UserVerificationRequestConfig is the [UserVerificationRequest]
|
||||
// factory initializer config.
|
||||
//
|
||||
// NB! App is required struct member.
|
||||
type UserVerificationRequestConfig struct {
|
||||
App core.App
|
||||
TxDao *daos.Dao
|
||||
ResendThreshold float64 // in seconds
|
||||
}
|
||||
|
||||
// NewUserVerificationRequest creates a new [UserVerificationRequest]
|
||||
// form with initializer config created from the provided [core.App] instance.
|
||||
//
|
||||
// If you want to submit the form as part of another transaction, use
|
||||
// [NewUserVerificationRequestWithConfig] with explicitly set TxDao.
|
||||
func NewUserVerificationRequest(app core.App) *UserVerificationRequest {
|
||||
return &UserVerificationRequest{
|
||||
app: app,
|
||||
resendThreshold: 120, // 2 min
|
||||
return NewUserVerificationRequestWithConfig(UserVerificationRequestConfig{
|
||||
App: app,
|
||||
ResendThreshold: 120, // 2 min
|
||||
})
|
||||
}
|
||||
|
||||
// NewUserVerificationRequestWithConfig creates a new [UserVerificationRequest]
|
||||
// form with the provided config or panics on invalid configuration.
|
||||
func NewUserVerificationRequestWithConfig(config UserVerificationRequestConfig) *UserVerificationRequest {
|
||||
form := &UserVerificationRequest{config: config}
|
||||
|
||||
if form.config.App == nil {
|
||||
panic("Missing required config.App instance.")
|
||||
}
|
||||
|
||||
if form.config.TxDao == nil {
|
||||
form.config.TxDao = form.config.App.Dao()
|
||||
}
|
||||
|
||||
return form
|
||||
}
|
||||
|
||||
// Validate makes the form validatable by implementing [validation.Validatable] interface.
|
||||
@@ -48,7 +78,7 @@ func (form *UserVerificationRequest) Submit() error {
|
||||
return err
|
||||
}
|
||||
|
||||
user, err := form.app.Dao().FindUserByEmail(form.Email)
|
||||
user, err := form.config.TxDao.FindUserByEmail(form.Email)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -59,16 +89,16 @@ func (form *UserVerificationRequest) Submit() error {
|
||||
|
||||
now := time.Now().UTC()
|
||||
lastVerificationSentAt := user.LastVerificationSentAt.Time()
|
||||
if (now.Sub(lastVerificationSentAt)).Seconds() < form.resendThreshold {
|
||||
if (now.Sub(lastVerificationSentAt)).Seconds() < form.config.ResendThreshold {
|
||||
return errors.New("A verification email was already sent.")
|
||||
}
|
||||
|
||||
if err := mails.SendUserVerification(form.app, user); err != nil {
|
||||
if err := mails.SendUserVerification(form.config.App, user); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update last sent timestamp
|
||||
user.LastVerificationSentAt = types.NowDateTime()
|
||||
|
||||
return form.app.Dao().SaveUser(user)
|
||||
return form.config.TxDao.SaveUser(user)
|
||||
}
|
||||
@@ -11,6 +11,16 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
func TestUserVerificationRequestPanic(t *testing.T) {
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("The form did not panic")
|
||||
}
|
||||
}()
|
||||
|
||||
forms.NewUserVerificationRequest(nil)
|
||||
}
|
||||
|
||||
func TestUserVerificationRequestValidate(t *testing.T) {
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
@@ -96,6 +96,7 @@ func init() {
|
||||
UpdateRule: &profileOwnerRule,
|
||||
Schema: schema.NewSchema(
|
||||
&schema.SchemaField{
|
||||
Id: "pbfielduser",
|
||||
Name: models.ProfileCollectionUserFieldName,
|
||||
Type: schema.FieldTypeUser,
|
||||
Unique: true,
|
||||
@@ -107,11 +108,13 @@ func init() {
|
||||
},
|
||||
},
|
||||
&schema.SchemaField{
|
||||
Id: "pbfieldname",
|
||||
Name: "name",
|
||||
Type: schema.FieldTypeText,
|
||||
Options: &schema.TextOptions{},
|
||||
},
|
||||
&schema.SchemaField{
|
||||
Id: "pbfieldavatar",
|
||||
Name: "avatar",
|
||||
Type: schema.FieldTypeFile,
|
||||
Options: &schema.FileOptions{
|
||||
@@ -128,6 +131,8 @@ func init() {
|
||||
},
|
||||
),
|
||||
}
|
||||
collection.Id = "systemprofiles0"
|
||||
collection.MarkAsNew()
|
||||
|
||||
return daos.New(db).SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
|
||||
+38
-9
@@ -9,6 +9,9 @@ import (
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
// DefaultIdLength is the default length of the generated model id.
|
||||
const DefaultIdLength = 15
|
||||
|
||||
// ColumnValueMapper defines an interface for custom db model data serialization.
|
||||
type ColumnValueMapper interface {
|
||||
// ColumnValueMap returns the data to be used when persisting the model.
|
||||
@@ -24,8 +27,12 @@ type FilesManager interface {
|
||||
// Model defines an interface with common methods that all db models should have.
|
||||
type Model interface {
|
||||
TableName() string
|
||||
IsNew() bool
|
||||
MarkAsNew()
|
||||
UnmarkAsNew()
|
||||
HasId() bool
|
||||
GetId() string
|
||||
SetId(id string)
|
||||
GetCreated() types.DateTime
|
||||
GetUpdated() types.DateTime
|
||||
RefreshId()
|
||||
@@ -39,45 +46,67 @@ type Model interface {
|
||||
|
||||
// BaseModel defines common fields and methods used by all other models.
|
||||
type BaseModel struct {
|
||||
isNewFlag bool
|
||||
|
||||
Id string `db:"id" json:"id"`
|
||||
Created types.DateTime `db:"created" json:"created"`
|
||||
Updated types.DateTime `db:"updated" json:"updated"`
|
||||
}
|
||||
|
||||
// HasId returns whether the model has a nonzero primary key (aka. id).
|
||||
// HasId returns whether the model has a nonzero id.
|
||||
func (m *BaseModel) HasId() bool {
|
||||
return m.GetId() != ""
|
||||
}
|
||||
|
||||
// GetId returns the model's id.
|
||||
// GetId returns the model id.
|
||||
func (m *BaseModel) GetId() string {
|
||||
return m.Id
|
||||
}
|
||||
|
||||
// GetCreated returns the model's Created datetime.
|
||||
// SetId sets the model id to the provided string value.
|
||||
func (m *BaseModel) SetId(id string) {
|
||||
m.Id = id
|
||||
}
|
||||
|
||||
// MarkAsNew sets the model isNewFlag enforcing [m.IsNew()] to be true.
|
||||
func (m *BaseModel) MarkAsNew() {
|
||||
m.isNewFlag = true
|
||||
}
|
||||
|
||||
// UnmarkAsNew resets the model isNewFlag.
|
||||
func (m *BaseModel) UnmarkAsNew() {
|
||||
m.isNewFlag = false
|
||||
}
|
||||
|
||||
// IsNew indicates what type of db query (insert or update)
|
||||
// should be used with the model instance.
|
||||
func (m *BaseModel) IsNew() bool {
|
||||
return m.isNewFlag || !m.HasId()
|
||||
}
|
||||
|
||||
// GetCreated returns the model Created datetime.
|
||||
func (m *BaseModel) GetCreated() types.DateTime {
|
||||
return m.Created
|
||||
}
|
||||
|
||||
// GetUpdated returns the model's Updated datetime.
|
||||
// GetUpdated returns the model Updated datetime.
|
||||
func (m *BaseModel) GetUpdated() types.DateTime {
|
||||
return m.Updated
|
||||
}
|
||||
|
||||
// RefreshId generates and sets a new model id.
|
||||
//
|
||||
// The generated id is a cryptographically random 15 characters length string
|
||||
// (could change in the future).
|
||||
// The generated id is a cryptographically random 15 characters length string.
|
||||
func (m *BaseModel) RefreshId() {
|
||||
m.Id = security.RandomString(15)
|
||||
m.Id = security.RandomString(DefaultIdLength)
|
||||
}
|
||||
|
||||
// RefreshCreated updates the model's Created field with the current datetime.
|
||||
// RefreshCreated updates the model Created field with the current datetime.
|
||||
func (m *BaseModel) RefreshCreated() {
|
||||
m.Created = types.NowDateTime()
|
||||
}
|
||||
|
||||
// RefreshUpdated updates the model's Updated field with the current datetime.
|
||||
// RefreshUpdated updates the model Updated field with the current datetime.
|
||||
func (m *BaseModel) RefreshUpdated() {
|
||||
m.Updated = types.NowDateTime()
|
||||
}
|
||||
|
||||
+43
-13
@@ -34,25 +34,55 @@ func TestBaseModelHasId(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBaseModelGetId(t *testing.T) {
|
||||
m0 := models.BaseModel{}
|
||||
if m0.GetId() != "" {
|
||||
t.Fatalf("Expected zero id value, got %v", m0.GetId())
|
||||
func TestBaseModelId(t *testing.T) {
|
||||
m := models.BaseModel{}
|
||||
|
||||
if m.GetId() != "" {
|
||||
t.Fatalf("Expected empty id value, got %v", m.GetId())
|
||||
}
|
||||
|
||||
id := "abc"
|
||||
m1 := models.BaseModel{Id: id}
|
||||
if m1.GetId() != id {
|
||||
t.Fatalf("Expected id %v, got %v", id, m1.GetId())
|
||||
m.SetId("test")
|
||||
|
||||
if m.GetId() != "test" {
|
||||
t.Fatalf("Expected %q id, got %v", "test", m.GetId())
|
||||
}
|
||||
|
||||
m.RefreshId()
|
||||
|
||||
if len(m.GetId()) != 15 {
|
||||
t.Fatalf("Expected 15 chars id, got %v", m.GetId())
|
||||
}
|
||||
}
|
||||
|
||||
func TestBaseModelRefreshId(t *testing.T) {
|
||||
m := models.BaseModel{}
|
||||
m.RefreshId()
|
||||
func TestBaseModelIsNew(t *testing.T) {
|
||||
m0 := models.BaseModel{}
|
||||
m1 := models.BaseModel{Id: ""}
|
||||
m2 := models.BaseModel{Id: "test"}
|
||||
m3 := models.BaseModel{}
|
||||
m3.MarkAsNew()
|
||||
m4 := models.BaseModel{Id: "test"}
|
||||
m4.MarkAsNew()
|
||||
m5 := models.BaseModel{Id: "test"}
|
||||
m5.MarkAsNew()
|
||||
m5.UnmarkAsNew()
|
||||
|
||||
if m.GetId() == "" {
|
||||
t.Fatalf("Expected nonempty id value, got %v", m.GetId())
|
||||
scenarios := []struct {
|
||||
model models.BaseModel
|
||||
expected bool
|
||||
}{
|
||||
{m0, true},
|
||||
{m1, true},
|
||||
{m2, false},
|
||||
{m3, true},
|
||||
{m4, true},
|
||||
{m5, false},
|
||||
}
|
||||
|
||||
for i, s := range scenarios {
|
||||
result := s.model.IsNew()
|
||||
if result != s.expected {
|
||||
t.Errorf("(%d) Expected IsNew %v, got %v", i, s.expected, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -313,6 +313,16 @@ func NewTestApp() (*TestApp, error) {
|
||||
return nil
|
||||
})
|
||||
|
||||
t.OnCollectionsBeforeImportRequest().Add(func(e *core.CollectionsImportEvent) error {
|
||||
t.EventCalls["OnCollectionsBeforeImportRequest"]++
|
||||
return nil
|
||||
})
|
||||
|
||||
t.OnCollectionsAfterImportRequest().Add(func(e *core.CollectionsImportEvent) error {
|
||||
t.EventCalls["OnCollectionsAfterImportRequest"]++
|
||||
return nil
|
||||
})
|
||||
|
||||
t.OnAdminsListRequest().Add(func(e *core.AdminsListEvent) error {
|
||||
t.EventCalls["OnAdminsListRequest"]++
|
||||
return nil
|
||||
|
||||
Binary file not shown.
@@ -179,7 +179,7 @@ func (s *System) DeletePrefix(prefix string) []error {
|
||||
|
||||
var inlineServeContentTypes = []string{
|
||||
"image/png", "image/jpg", "image/jpeg", "image/gif",
|
||||
"video/mp4", "video/3gpp", "video/quicktime", " video/x-ms-wmv",
|
||||
"video/mp4", "video/3gpp", "video/quicktime", "video/x-ms-wmv",
|
||||
}
|
||||
|
||||
// Serve serves the file at fileKey location to an HTTP response.
|
||||
|
||||
+2
-57
@@ -2,14 +2,11 @@ package migrate
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/fatih/color"
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/tools/inflector"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
@@ -40,9 +37,8 @@ func NewRunner(db *dbx.DB, migrationsList MigrationsList) (*Runner, error) {
|
||||
// Run interactively executes the current runner with the provided args.
|
||||
//
|
||||
// The following commands are supported:
|
||||
// - up - applies all migrations
|
||||
// - down [n] - reverts the last n applied migrations
|
||||
// - create NEW_MIGRATION_NAME - create NEW_MIGRATION_NAME.go file from a migration template
|
||||
// - up - applies all migrations
|
||||
// - down [n] - reverts the last n applied migrations
|
||||
func (r *Runner) Run(args ...string) error {
|
||||
cmd := "up"
|
||||
if len(args) > 0 {
|
||||
@@ -100,57 +96,6 @@ func (r *Runner) Run(args ...string) error {
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
case "create":
|
||||
if len(args) < 2 {
|
||||
return fmt.Errorf("Missing migration file name")
|
||||
}
|
||||
|
||||
name := args[1]
|
||||
|
||||
var dir string
|
||||
if len(args) == 3 {
|
||||
dir = args[2]
|
||||
}
|
||||
if dir == "" {
|
||||
// If not specified, auto point to the default migrations folder.
|
||||
//
|
||||
// NB!
|
||||
// Since the create command makes sense only during development,
|
||||
// it is expected the user to be in the app working directory
|
||||
// and to be using `go run ...`
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dir = path.Join(wd, "migrations")
|
||||
}
|
||||
|
||||
resultFilePath := path.Join(
|
||||
dir,
|
||||
fmt.Sprintf("%d_%s.go", time.Now().Unix(), inflector.Snakecase(name)),
|
||||
)
|
||||
|
||||
confirm := false
|
||||
prompt := &survey.Confirm{
|
||||
Message: fmt.Sprintf("Do you really want to create migration %q?", resultFilePath),
|
||||
}
|
||||
survey.AskOne(prompt, &confirm)
|
||||
if !confirm {
|
||||
fmt.Println("The command has been cancelled")
|
||||
return nil
|
||||
}
|
||||
|
||||
// ensure that migrations dir exist
|
||||
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.WriteFile(resultFilePath, []byte(createTemplateContent), 0644); err != nil {
|
||||
return fmt.Errorf("Failed to save migration file %q\n", resultFilePath)
|
||||
}
|
||||
|
||||
fmt.Printf("Successfully created file %q\n", resultFilePath)
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("Unsupported command: %q\n", cmd)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package migrate
|
||||
|
||||
const createTemplateContent = `package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
// add up queries...
|
||||
|
||||
return nil
|
||||
}, func(db dbx.Builder) error {
|
||||
// add down queries...
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
`
|
||||
@@ -28,6 +28,7 @@ type Result struct {
|
||||
Page int `json:"page"`
|
||||
PerPage int `json:"perPage"`
|
||||
TotalItems int `json:"totalItems"`
|
||||
TotalPages int `json:"totalPages"`
|
||||
Items any `json:"items"`
|
||||
}
|
||||
|
||||
@@ -213,10 +214,12 @@ func (s *Provider) Exec(items any) (*Result, error) {
|
||||
s.perPage = MaxPerPage
|
||||
}
|
||||
|
||||
totalPages := int(math.Ceil(float64(totalCount) / float64(s.perPage)))
|
||||
|
||||
// normalize page according to the total count
|
||||
if s.page <= 0 || totalCount == 0 {
|
||||
s.page = 1
|
||||
} else if totalPages := int(math.Ceil(float64(totalCount) / float64(s.perPage))); s.page > totalPages {
|
||||
} else if s.page > totalPages {
|
||||
s.page = totalPages
|
||||
}
|
||||
|
||||
@@ -233,6 +236,7 @@ func (s *Provider) Exec(items any) (*Result, error) {
|
||||
Page: s.page,
|
||||
PerPage: s.perPage,
|
||||
TotalItems: int(totalCount),
|
||||
TotalPages: totalPages,
|
||||
Items: items,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ func TestProviderExecNonEmptyQuery(t *testing.T) {
|
||||
[]FilterData{},
|
||||
"",
|
||||
false,
|
||||
`{"page":1,"perPage":10,"totalItems":2,"items":[{"test1":1,"test2":"test2.1","test3":""},{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
`{"page":1,"perPage":10,"totalItems":2,"totalPages":1,"items":[{"test1":1,"test2":"test2.1","test3":""},{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
[]string{
|
||||
"SELECT COUNT(*) FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC",
|
||||
"SELECT * FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC LIMIT 10",
|
||||
@@ -250,7 +250,7 @@ func TestProviderExecNonEmptyQuery(t *testing.T) {
|
||||
[]FilterData{},
|
||||
"",
|
||||
false,
|
||||
`{"page":1,"perPage":30,"totalItems":2,"items":[{"test1":1,"test2":"test2.1","test3":""},{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
`{"page":1,"perPage":30,"totalItems":2,"totalPages":1,"items":[{"test1":1,"test2":"test2.1","test3":""},{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
[]string{
|
||||
"SELECT COUNT(*) FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC",
|
||||
"SELECT * FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC LIMIT 30",
|
||||
@@ -286,7 +286,7 @@ func TestProviderExecNonEmptyQuery(t *testing.T) {
|
||||
[]FilterData{"test2 != null", "test1 >= 2"},
|
||||
"",
|
||||
false,
|
||||
`{"page":1,"perPage":` + fmt.Sprint(MaxPerPage) + `,"totalItems":1,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
`{"page":1,"perPage":` + fmt.Sprint(MaxPerPage) + `,"totalItems":1,"totalPages":1,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
[]string{
|
||||
"SELECT COUNT(*) FROM `test` WHERE ((NOT (`test1` IS NULL)) AND (COALESCE(test2, '') != COALESCE(null, ''))) AND (test1 >= 2) ORDER BY `test1` ASC, `test2` DESC",
|
||||
"SELECT * FROM `test` WHERE ((NOT (`test1` IS NULL)) AND (COALESCE(test2, '') != COALESCE(null, ''))) AND (test1 >= 2) ORDER BY `test1` ASC, `test2` DESC LIMIT 200",
|
||||
@@ -300,7 +300,7 @@ func TestProviderExecNonEmptyQuery(t *testing.T) {
|
||||
[]FilterData{"test3 != ''"},
|
||||
"",
|
||||
false,
|
||||
`{"page":1,"perPage":10,"totalItems":0,"items":[]}`,
|
||||
`{"page":1,"perPage":10,"totalItems":0,"totalPages":0,"items":[]}`,
|
||||
[]string{
|
||||
"SELECT COUNT(*) FROM `test` WHERE (NOT (`test1` IS NULL)) AND (COALESCE(test3, '') != COALESCE('', '')) ORDER BY `test1` ASC, `test3` ASC",
|
||||
"SELECT * FROM `test` WHERE (NOT (`test1` IS NULL)) AND (COALESCE(test3, '') != COALESCE('', '')) ORDER BY `test1` ASC, `test3` ASC LIMIT 10",
|
||||
@@ -314,7 +314,7 @@ func TestProviderExecNonEmptyQuery(t *testing.T) {
|
||||
[]FilterData{},
|
||||
"",
|
||||
false,
|
||||
`{"page":2,"perPage":1,"totalItems":2,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
`{"page":2,"perPage":1,"totalItems":2,"totalPages":2,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
[]string{
|
||||
"SELECT COUNT(*) FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC",
|
||||
"SELECT * FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC LIMIT 1 OFFSET 1",
|
||||
@@ -328,7 +328,7 @@ func TestProviderExecNonEmptyQuery(t *testing.T) {
|
||||
[]FilterData{},
|
||||
"test.test1",
|
||||
false,
|
||||
`{"page":2,"perPage":1,"totalItems":2,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
`{"page":2,"perPage":1,"totalItems":2,"totalPages":2,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
[]string{
|
||||
"SELECT COUNT(DISTINCT(test.test1)) FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC",
|
||||
"SELECT * FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC LIMIT 1 OFFSET 1",
|
||||
@@ -403,7 +403,7 @@ func TestProviderParseAndExec(t *testing.T) {
|
||||
{
|
||||
"",
|
||||
false,
|
||||
`{"page":1,"perPage":123,"totalItems":2,"items":[{"test1":1,"test2":"test2.1","test3":""},{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
`{"page":1,"perPage":123,"totalItems":2,"totalPages":1,"items":[{"test1":1,"test2":"test2.1","test3":""},{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
},
|
||||
// invalid query
|
||||
{
|
||||
@@ -439,7 +439,7 @@ func TestProviderParseAndExec(t *testing.T) {
|
||||
{
|
||||
"page=3&perPage=555&filter=test1>1&sort=-test2,test3",
|
||||
false,
|
||||
`{"page":1,"perPage":200,"totalItems":1,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
`{"page":1,"perPage":200,"totalItems":1,"totalPages":1,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# all environments should start with 'PB_' prefix
|
||||
PB_BACKEND_URL = ../
|
||||
PB_PROFILE_COLLECTION = profiles
|
||||
PB_RULES_SYNTAX_DOCS = https://pocketbase.io/docs/manage-collections#rules-filters-syntax
|
||||
PB_INSTALLER_PARAM = installer
|
||||
PB_BACKEND_URL = "../"
|
||||
PB_PROFILE_COLLECTION = "profiles"
|
||||
PB_INSTALLER_PARAM = "installer"
|
||||
PB_RULES_SYNTAX_DOCS = "https://pocketbase.io/docs/manage-collections#rules-filters-syntax"
|
||||
PB_RELEASES = "https://github.com/pocketbase/pocketbase/releases"
|
||||
PB_VERSION = "v0.4.0"
|
||||
+1
-1
@@ -1 +1 @@
|
||||
PB_BACKEND_URL = http://localhost:8090
|
||||
PB_BACKEND_URL = "http://127.0.0.1:8090"
|
||||
@@ -0,0 +1,12 @@
|
||||
import{S as ka,i as Sa,s as va,e as Ca,f as Aa,g as Ma,y as Sn,o as Da,G as Oa,H as Ta,I as Ba,J as La,K as Ra,C as vn,L as Pa}from"./index.3b658553.js";class z{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ve.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),Ve.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Zt(this),r=new Zt(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Zt(this,e)}iterRange(e,t=this.length){return new zo(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qo(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?z.empty:e.length<=32?new Q(e):Ve.from(Q.split(e,[]))}}class Q extends z{constructor(e,t=Ea(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Ia(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new Q(ar(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Pi(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new Q(l,o.length+r.length));else{let h=l.length>>1;i.push(new Q(l.slice(0,h)),new Q(l.slice(h)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof Q))return super.replace(e,t,i);let s=Pi(this.text,Pi(i.text,ar(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new Q(s,r):Ve.from(Q.split(s,[]),r)}sliceString(e,t=this.length,i=`
|
||||
`){let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],h=r+l.length;r>e&&o&&(s+=i),e<h&&t>r&&(s+=l.slice(Math.max(0,e-r),t-r)),r=h+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new Q(i,s)),i=[],s=-1);return s>-1&&t.push(new Q(i,s)),t}}class Ve extends z{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,h=i+o.lines-1;if((t?h:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=h+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],h=o+l.length;if(e<=h&&t>=o){let a=s&((o<=e?1:0)|(h>=t?2:0));o>=e&&h<=t&&!a?i.push(l):l.decompose(e-o,t-o,i,a)}o=h+1}}replace(e,t,i){if(i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(e>=r&&t<=l){let h=o.replace(e-r,t-r,i),a=this.lines-o.lines+h.lines;if(h.lines<a>>5-1&&h.lines>a>>5+1){let c=this.children.slice();return c[s]=h,new Ve(c,this.length-(t-e)+i.length)}return super.replace(r,l,h)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
||||
`){let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],h=o+l.length;o>e&&r&&(s+=i),e<h&&t>o&&(s+=l.sliceString(e-o,t-o,i)),o=h+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ve))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let h=this.children[s],a=e.children[r];if(h!=a)return i+h.scanIdentical(a,t);i+=h.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new Q(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],h=0,a=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ve)for(let g of d.children)f(g);else d.lines>o&&(h>o||!h)?(u(),l.push(d)):d instanceof Q&&h&&(p=c[c.length-1])instanceof Q&&d.lines+p.lines<=32?(h+=d.lines,a+=d.length+1,c[c.length-1]=new Q(p.text.concat(d.text),p.length+1+d.length)):(h+d.lines>s&&u(),h+=d.lines,a+=d.length+1,c.push(d))}function u(){h!=0&&(l.push(c.length==1?c[0]:Ve.from(c,a)),a=-1,h=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ve(l,t)}}z.empty=new Q([""],0);function Ea(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Pi(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],h=s+l.length;h>=t&&(h>i&&(l=l.slice(0,i-s)),s<t&&(l=l.slice(t-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=h+1}return e}function ar(n,e,t){return Pi(n,[""],e,t)}class Zt{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Q?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof Q?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(s instanceof Q){let h=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,h.length>Math.max(0,e))return this.value=e==0?h:t>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=s.children[o+(t<0?-1:0)];e>h.length?(e-=h.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(h),this.offsets.push(t>0?1:(h instanceof Q?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class zo{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Zt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class qo{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},Zt.prototype[Symbol.iterator]=zo.prototype[Symbol.iterator]=qo.prototype[Symbol.iterator]=function(){return this});class Ia{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Dt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;n<Dt.length;n++)Dt[n]+=Dt[n-1];function Na(n){for(let e=1;e<Dt.length;e+=2)if(Dt[e]>n)return Dt[e-1]<=n;return!1}function cr(n){return n>=127462&&n<=127487}const fr=8205;function Ae(n,e,t=!0,i=!0){return(t?Ko:Va)(n,e,i)}function Ko(n,e,t){if(e==n.length)return e;e&&Uo(n.charCodeAt(e))&&jo(n.charCodeAt(e-1))&&e--;let i=re(n,e);for(e+=ve(i);e<n.length;){let s=re(n,e);if(i==fr||s==fr||t&&Na(s))e+=ve(s),i=s;else if(cr(s)){let r=0,o=e-2;for(;o>=0&&cr(re(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Va(n,e,t){for(;e>0;){let i=Ko(n,e-2,t);if(i<e)return i;e--}return 0}function Uo(n){return n>=56320&&n<57344}function jo(n){return n>=55296&&n<56320}function re(n,e){let t=n.charCodeAt(e);if(!jo(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Uo(i)?(t-55296<<10)+(i-56320)+65536:t}function Rs(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ve(n){return n<65536?1:2}const jn=/\r\n?|\n/;var me=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(me||(me={}));class He{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(e,t=!1){Gn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s
Line truncated
|
||||
`}get readOnly(){return this.facet(tl)}phrase(e,...t){for(let i of this.facet(V.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(_o))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return $a(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let h=Ae(t,o,!1);if(r(t.slice(h,o))!=ce.Word)break;o=h}for(;l<s;){let h=Ae(t,l);if(r(t.slice(l,h))!=ce.Word)break;l=h}return o==l?null:m.range(o+i,l+i)}}V.allowMultipleSelections=Xo;V.tabSize=T.define({combine:n=>n.length?n[0]:4});V.lineSeparator=Yo;V.readOnly=tl;V.phrases=T.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});V.languageData=_o;V.changeFilter=Qo;V.transactionFilter=Zo;V.transactionExtender=el;Qe.reconfigure=W.define();function zt(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class gt{eq(e){return this==e}range(e,t=e){return ri.create(e,t,this)}}gt.prototype.startSide=gt.prototype.endSide=0;gt.prototype.point=!1;gt.prototype.mapMode=me.TrackDel;class ri{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new ri(e,t,i)}}function Qn(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Is{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let h=o+l>>1,a=r[h]-e||(i?this.value[h].endSide:this.value[h].startSide)-t;if(h==o)return a>=0?o:l;a>=0?l=h:o=h+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(s(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t){let i=[],s=[],r=[],o=-1,l=-1;for(let h=0;h<this.value.length;h++){let a=this.value[h],c=this.from[h]+e,f=this.to[h]+e,u,d;if(c==f){let p=t.mapPos(c,a.startSide,a.mapMode);if(p==null||(u=d=p,a.startSide!=a.endSide&&(d=t.mapPos(c,a.endSide),d<u)))continue}else if(u=t.mapPos(c,a.startSide),d=t.mapPos(f,a.endSide),u>d||u==d&&a.startSide>0&&a.endSide<=0)continue;(d-u||a.endSide-a.startSide)<0||(o<0&&(o=u),a.point&&(l=Math.max(l,d-u)),i.push(a),s.push(u-o),r.push(d-o))}return{mapped:i.length?new Is(s,r,i,l):null,pos:o}}}class X{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new X(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Qn)),this.isEmpty)return t.length?X.of(t):this;let l=new sl(this,null,-1).goto(0),h=0,a=[],c=new mt;for(;l.value||h<t.length;)if(h<t.length&&(l.from-t[h].from||l.startSide-t[h].value.startSide)>=0){let f=t[h++];c.addInner(f.from,f.to,f.value)||a.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(h==t.length||this.chunkEnd(l.chunkIndex)<t[h].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||r<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||a.push(ri.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!a.length?X.empty:this.nextLayer.update({add:a,filter:o,filterFrom:s,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],h=this.chunk[o],a=e.touchesRange(l,l+h.length);if(a===!1)s=Math.max(s,h.maxPoint),t.push(h),i.push(e.mapPos(l));else if(a===!0){let{mapped:c,pos:f}=h.map(l,e);c&&(s=Math.max(s,c.maxPoint),t.push(c),i.push(f))}}let r=this.nextLayer.map(e);return t.length==0?r:new X(i,t,r||X.empty,s)}between(e,t,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],o=this.chunk[s];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return oi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return oi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),h=pr(o,l,i),a=new Ut(o,h,r),c=new Ut(l
Line truncated
|
||||
`)}static newName(){let e=br[yr]||1;return br[yr]=e+1,ts+e.toString(36)}static mount(e,t){(e[is]||new Xa(e)).mount(Array.isArray(t)?t:[t])}}let wi=null;class Xa{constructor(e){if(!e.head&&e.adoptedStyleSheets&&typeof CSSStyleSheet<"u"){if(wi)return e.adoptedStyleSheets=[wi.sheet].concat(e.adoptedStyleSheets),e[is]=wi;this.sheet=new CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat(e.adoptedStyleSheets),wi=this}else{this.styleTag=(e.ownerDocument||e).createElement("style");let t=e.head||e;t.insertBefore(this.styleTag,t.firstChild)}this.modules=[],e[is]=this}mount(e){let t=this.sheet,i=0,s=0;for(let r=0;r<e.length;r++){let o=e[r],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),t)for(let h=0;h<o.rules.length;h++)t.insertRule(o.rules[h],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=o.rules.length,s++}}if(!t){let r="";for(let o=0;o<this.modules.length;o++)r+=this.modules[o].getRules()+`
|
||||
`;this.styleTag.textContent=r}}}var ot={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Lt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wr=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent);typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent);var Ya=typeof navigator<"u"&&/Mac/.test(navigator.platform),Qa=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Za=Ya||wr&&+wr[1]<57;for(var oe=0;oe<10;oe++)ot[48+oe]=ot[96+oe]=String(oe);for(var oe=1;oe<=24;oe++)ot[oe+111]="F"+oe;for(var oe=65;oe<=90;oe++)ot[oe]=String.fromCharCode(oe+32),Lt[oe]=String.fromCharCode(oe);for(var An in ot)Lt.hasOwnProperty(An)||(Lt[An]=ot[An]);function ec(n){var e=Za&&(n.ctrlKey||n.altKey||n.metaKey)||Qa&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Lt:ot)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function zi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Rt(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function tc(){let n=document.activeElement;for(;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function Ii(n,e){if(!e.anchorNode)return!1;try{return Rt(n,e.anchorNode)}catch{return!1}}function li(n){return n.nodeType==3?Pt(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function qi(n,e,t,i){return t?xr(n,e,t,i,-1)||xr(n,e,t,i,1):!1}function Ki(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function xr(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:hi(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Ki(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?hi(n):0}else return!1}}function hi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}const rl={left:0,right:0,top:0,bottom:0};function hn(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function ic(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function nc(n,e,t,i,s,r,o,l){let h=n.ownerDocument,a=h.defaultView;for(let c=n;c;)if(c.nodeType==1){let f,u=c==h.body;if(u)f=ic(a);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.parentNode;continue}let g=c.getBoundingClientRect();f={left:g.left,right:g.left+c.clientWidth,top:g.top,bottom:g.top+c.clientHeight}}let d=0,p=0;if(s=="nearest")e.top<f.top?(p=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+p&&(p=e.bottom-f.bottom+p+o)):e.bottom>f.bottom&&(p=e.bottom-f.bottom+o,t<0&&e.top-p<f.top&&(p=-(f.top+p-e.top+o)));else{let g=e.bottom-e.top,y=f.bottom-f.top;p=(s=="center"&&g<=y?e.top+g/2-y/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-y+o)-f.top}if(i=="nearest"?e.left<f.left?(d=-(f.left-e.left+r),t>0&&e.right>f.right+d&&(d=e.right-f.right+d+r)):e.right>f.right&&(d=e.right-f.right+r,t<0&&e.left<f.left+d&&(d=-(f.left+d-e.left+r))):d=(i=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:i=="start"==l?e.left-r:e.right-(f.right-f.left)+r)-f.left,d||p)if(u)a.scrollBy(d,p);else{if(p){let g=c.scrollTop;c.scrollTop+=p,p=c.scrollTop-g}if(d){let g=c.scrollLeft;c.scrollLeft+=d,d=c.scrollLeft-g}e={left:e.left-d,top:e.top-p,right:e.right-d,bottom:e.bottom-p}}if(u)break;c=c.assignedSlot||c.parentNode,i=s="nearest"}else if(c.nodeType==11)c=c.host;else break}class sc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){this.set(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let Ct=null;function ol(n){if(n.setActive)return n.setActive();if(Ct)return n.focus(Ct);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Ct==null?{get preventScroll(){return Ct={preventScroll:!0},!0}}:void 0),!Ct){Ct=!1;for(let t=0;t<e.length;){let i=e[t++],s=e[t++],r=e[t++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=r&&(i.scrollLeft=r)}}}let kr;function Pt(n,e,tLine truncated
|
||||
`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),a=m.cursor(t?s.from:s.to)}if(h){if(!h(c))return l}else{if(!i)return a;h=i(c)}l=a}}function Lc(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==ce.Space&&(s=o),s==o}}function Rc(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return m.cursor(s,e.assoc);let o=e.goalColumn,l,h=n.contentDOM.getBoundingClientRect(),a=n.coordsAtPos(s),c=n.documentTop;if(a)o==null&&(o=a.left-h.left),l=r<0?a.top:a.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(h.right-h.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=h.left+o,u=i!=null?i:n.defaultLineHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,g=Il(n,{x:f,y:p},!1,r);if(p<h.top||p>h.bottom||(r<0?g<s:g>s))return m.cursor(g,e.assoc,void 0,o)}}function Tn(n,e,t){let i=n.state.facet(Dl).map(s=>s(n));for(;;){let s=!1;for(let r of i)r.between(t.from-1,t.from+1,(o,l,h)=>{t.from>o&&t.from<l&&(t=e.from>t.from?m.cursor(o,1):m.cursor(l,-1),s=!0)});if(!s)return t}}class Pc{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.rapidCompositionStart=!1,this.mouseSelection=null;for(let t in ie){let i=ie[t];e.contentDOM.addEventListener(t,s=>{!Vr(e,s)||this.ignoreDuringComposition(s)||t=="keydown"&&this.keydown(e,s)||(this.mustFlushObserver(s)&&e.observer.forceFlush(),this.runCustomHandlers(t,e,s)?s.preventDefault():i(e,s))},gs[t]),this.registeredEvents.push(t)}M.chrome&&M.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,M.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let s;this.customHandlers=[];for(let r of t)if(s=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:s});for(let o in s)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,l=>{!Vr(e,l)||this.runCustomHandlers(o,e,l)&&l.preventDefault()}))}}runCustomHandlers(e,t,i){for(let s of this.customHandlers){let r=s.handlers[e];if(r)try{if(r.call(s.plugin,i,t)||i.defaultPrevented)return!0}catch(o){Le(t.state,o)}}return!1}runScrollHandlers(e,t){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,t,e)}catch(r){Le(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(M.android&&M.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return e.observer.delayAndroidKey(t.key,t.keyCode),!0;let i;return M.ios&&(i=Nl.find(s=>s.keyCode==t.keyCode))&&!(t.ctrlKey||t.altKey||t.metaKey)&&!t.synthetic?(this.pendingIOSKey=i,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,ti(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:M.safari&&!M.ios&&Date.now()-this.compositionEndedAt<100?(this.compositionEndedAt=0,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229||e.type=="compositionend"&&!M.ios}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const Nl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Vl=[16,17,18,20,91,92,224,225];class Ec{constructor(e,t,i,s){this.view=e,this.style=i,this.mustSelect=s,this.lastEvent=t;let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(V.allowMultipleSelections)&&Ic(e,t),this.dragMove=Nc(e,t),this.dragging=Vc(e,t)&&Ws(t)==1?null:!1,this.dragging===!1&&(t.preventDefault(),this.select(t))}move(e){if(e.buttons==0)return this.destroy();this.dragging===!1&&this.select(this.lastEvent=e)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging|
Line truncated
|
||||
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,xs),Tf={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Rn=null;function Bf(){var n;if(Rn==null&&typeof document<"u"&&document.body){let e=document.body.style;Rn=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Rn||!1}const Vi=T.define({combine(n){let e=zt(n,{render:null,specialChars:Of,addSpecialChars:null});return(e.replaceTabs=!Bf())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,xs)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,xs)),e}});function Lf(n={}){return[Vi.of(n),Rf()]}let so=null;function Rf(){return so||(so=ue.fromClass(class{constructor(n){this.view=n,this.decorations=L.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Vi)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Df({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=re(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,h=di(o.text,l,i-o.from);return L.replace({widget:new Nf((l-h%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=L.replace({widget:new If(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Vi);n.startState.facet(Vi)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Pf="\u2022";function Ef(n){return n>=32?Pf:n==10?"\u2424":String.fromCharCode(9216+n)}class If extends kt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Ef(this.code),i=e.state.phrase("Control character")+" "+(Tf[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Nf extends kt{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}class Vf extends kt{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}ignoreEvent(){return!1}}function ro(n){return ue.fromClass(class{constructor(e){this.view=e,this.placeholder=L.set([L.widget({widget:new Vf(n),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?L.none:this.placeholder}},{decorations:e=>e.decorations})}const ks=2e3;function Ff(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>ks||t.off>ks||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let h=i;h<=s;h++){let a=n.doc.line(h);a.length<=l&&r.push(m.range(a.from+o,a.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let h=i;h<=s;h++){let a=n.doc.line(h),c=es(a.text,o,n.tabSize,!0);if(c>-1){let f=es(a.text,l,n.tabSize);r.push(m.range(a.from+c,a.from+f))}}}return r}function Wf(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function oo(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>ks?-1:s==i.length?Wf(n,e.clientX):di(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function Hf(n,e){let t=oo(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=oo(n,s);if(!l)return i;let h=Ff(n.state,t,l);return h.length?o?m.create(h.concat(i.ranges)):m.create(h):i}}:null}function zf(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return O.mouseSelectionStyle.of((t,i)=>e(i)?Hf(t,i):null)}const Pn="-10000px";class qf{constructor(e,t,i){this.facet=t,this.createTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(s=>s),this.tooltipViews=this.tooltips.map(i)}update(e){let t=e.state.facet(this.facet),i=t.filt
Line truncated
|
||||
`&&(t="");else{let i=t.indexOf(`
|
||||
`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;t+=this.ranges[++this.rangeIndex].from-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,i,s,r){if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let o=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-o}return this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new yh(t,e?e.state.tabSize:4,e?wt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=wh(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Y.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Wu,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Y(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Y(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function wh(n,e,t){e.start=e.pos;for(let i=0;i<10;i++){let s=n(e,t);if(e.pos>e.start)return s}throw new Error("Stream parser failed to advance stream.")}const Xs=Object.create(null),fi=[we.none],Wu=new qs(fi),yo=[],xh=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])xh[n]=Sh(Xs,e);class kh{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),xh)}resolve(e){return e?this.table[e]||(this.table[e]=Sh(this.extra,e)):0}}const Hu=new kh(Xs);function Hn(n,e){yo.indexOf(n)>-1||(yo.push(n),console.warn(e))}function Sh(n,e){let t=null;for(let r of e.split(".")){let o=n[r]||k[r];o?typeof o=="function"?t?t=o(t):Hn(r,`Modifier ${r} used at start of tag`):t?Hn(r,`Tag ${r} used as modifier`):t=o:Hn(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=we.define({id:fi.length,name:i,props:[ou({[i]:t})]});return fi.push(s),s.id}function zu(n){let e=we.define({id:fi.length,name:"Document",props:[ci.add(()=>n)]});return fi.push(e),e}const qu=n=>{let e=Qs(n.state);return e.line?Ku(n):e.block?ju(n):!1};function Ys(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const Ku=Ys($u,0),Uu=Ys(vh,0),ju=Ys((n,e)=>vh(n,e,Ju(e)),0);function Qs(n,e=n.selection.main.head){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const Jt=50;function Gu(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Jt,i),o=n.sliceDoc(s,s+Jt),l=/\s*$/.exec(r)[0].length,h=/^\s*/.exec(o)[0].length,a=r.length-l;if(r.slice(a-e.length,a)==e&&o.slice(h,h+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+h,margin:h&&1}};let c,f;s-i<=2*Jt?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+Jt),f=n.sliceDoc(s-Jt,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Ju(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from,to:s.to})}return e}function vh(n,e,t=e.selection.ranges){let i=t.map(r=>Qs(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>Gu(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;o<s.length;o++)if(l=s[o]){let h=i[o],{open:a,close:c}=l;r.push({from:a.pos-h.open.length,to:a.pos+a.margin},{from:c.pos-c.margin,to:c.pos+h.close.length})}return{changes:r}}return null}function $u(n,e,t=e.selection.ranges){let i=[],s=-1;for(let{from:r,to:o}of t){let l=i.length,h=1e9;for(let a=r;a<=o;){let c=e.doc.lineAt(a);if(c.from>s&&(r==o||o>c.from)){s=c.from;let f=Qs(e,a).line;if(!f)continue;let u=/^\s*/.exec(c.text)[0].length,d=u==c
Line truncated
|
||||
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp}create(){return this.regexp?new rp(this):new sp(this)}getCursor(e,t=0,i=e.length){return this.regexp?Mt(this,e,t,i):At(this,e,t,i)}}class oa{constructor(e){this.spec=e}}function At(n,e,t,i){return new Wt(e,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase())}class sp extends oa{constructor(e){super(e)}nextMatch(e,t,i){let s=At(this.spec,e,i,e.length).nextOverlapping();return s.done&&(s=At(this.spec,e,0,t).nextOverlapping()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=i;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=At(this.spec,e,r,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==t)return null;s-=1e4}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.length)}getReplacement(e){return this.spec.replace}matchAll(e,t){let i=At(this.spec,e,0,e.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=At(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Mt(n,e,t,i){return new ia(e,n.search,n.caseSensitive?void 0:{ignoreCase:!0},t,i)}class rp extends oa{nextMatch(e,t,i){let s=Mt(this.spec,e,i,e.length).next();return s.done&&(s=Mt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Mt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.length)}getReplacement(e){return this.spec.replace.replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i<e.match.length?e.match[i]:t)}matchAll(e,t){let i=Mt(this.spec,e,0,e.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Mt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const ui=W.define(),ir=W.define(),nt=ke.define({create(n){return new Kn(Bs(n).create(),null)},update(n,e){for(let t of e.effects)t.is(ui)?n=new Kn(t.value.create(),n.panel):t.is(ir)&&(n=new Kn(n.query,t.value?nr:null));return n},provide:n=>$i.from(n,e=>e.panel)});class Kn{constructor(e,t){this.query=e,this.panel=t}}const op=L.mark({class:"cm-searchMatch"}),lp=L.mark({class:"cm-searchMatch cm-searchMatch-selected"}),hp=ue.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(nt))}update(n){let e=n.state.field(nt);(e!=n.startState.field(nt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return L.none;let{view:t}=this,i=new mt;for(let s=0,r=t.visibleRanges,o=r.length;s<o;s++){let{from:l,to:h}=r[s];for(;s<o-1&&h>r[s+1].from-2*250;)h=r[++s].to;n.highlight(t.state.doc,l,h,(a,c)=>{let f=t.state.selection.ranges.some(u=>u.from==a&&u.to==c);i.add(a,c,f?lp:op)})}return i.finish()}},{decorations:n=>n.decorations});function gi(n){return e=>{let t=e.state.field(nt,!1);return t&&t.query.spec.valid?n(e,t):la(e)}}const nn=gi((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state.doc,t,t);return i?(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:sr(n,i),userEvent:"select.search"}),!0):!1}),sn=gi((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t.doc,i,i);return s?(n.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:sr(n,s),userEvent:"select.search"}),!0):!1}),ap=gi((n,{query:e})=>{let t=e.matchAll(n.state.doc,1e3);return!t||!t.length?!1:(n.dispatch({selection:m.create(t.map(i=>m.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),cp=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new Wt(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(m.range(l.value.from,l.value.to))}return e(n.update({selection:m.create(r,o),userEvent:"select.search.matches"})),!0},Ro=gi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t.doc,i,i);if(!r)return!1;let o=[],l,h,a=[];if(r.from==i&&r.to==s&&(h=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:h}),r=e.nextMatch(t.doc,r.from,r.to),a.push(O.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let c=o.length==0||o[0].from>=r.to?0:r.to-r.from-h.length;l={anchor:r.from-c,head:r.to-c},a.push(sr(n,r))}return n.dispatch({changes:o,selection:l,scrollIntoView:!!l,effects:a,userEvent:"input.replace"}),!0}),fp=gi((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state.doc,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getRep
Line truncated
|
||||
@@ -1,12 +0,0 @@
|
||||
import{S as Sa,i as va,s as Ca,e as Aa,f as Ma,g as Da,y as Sn,o as Oa,G as Ta,H as Ba,I as Ra,J as La,K as Pa,C as vn,L as Ea}from"./index.9681f446.js";class z{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ve.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),Ve.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Zt(this),r=new Zt(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Zt(this,e)}iterRange(e,t=this.length){return new qo(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ko(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?z.empty:e.length<=32?new Q(e):Ve.from(Q.split(e,[]))}}class Q extends z{constructor(e,t=Ia(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Na(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new Q(ar(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Pi(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new Q(l,o.length+r.length));else{let h=l.length>>1;i.push(new Q(l.slice(0,h)),new Q(l.slice(h)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof Q))return super.replace(e,t,i);let s=Pi(this.text,Pi(i.text,ar(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new Q(s,r):Ve.from(Q.split(s,[]),r)}sliceString(e,t=this.length,i=`
|
||||
`){let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],h=r+l.length;r>e&&o&&(s+=i),e<h&&t>r&&(s+=l.slice(Math.max(0,e-r),t-r)),r=h+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new Q(i,s)),i=[],s=-1);return s>-1&&t.push(new Q(i,s)),t}}class Ve extends z{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,h=i+o.lines-1;if((t?h:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=h+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],h=o+l.length;if(e<=h&&t>=o){let a=s&((o<=e?1:0)|(h>=t?2:0));o>=e&&h<=t&&!a?i.push(l):l.decompose(e-o,t-o,i,a)}o=h+1}}replace(e,t,i){if(i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(e>=r&&t<=l){let h=o.replace(e-r,t-r,i),a=this.lines-o.lines+h.lines;if(h.lines<a>>5-1&&h.lines>a>>5+1){let c=this.children.slice();return c[s]=h,new Ve(c,this.length-(t-e)+i.length)}return super.replace(r,l,h)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
||||
`){let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],h=o+l.length;o>e&&r&&(s+=i),e<h&&t>o&&(s+=l.sliceString(e-o,t-o,i)),o=h+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ve))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let h=this.children[s],a=e.children[r];if(h!=a)return i+h.scanIdentical(a,t);i+=h.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new Q(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],h=0,a=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ve)for(let g of d.children)f(g);else d.lines>o&&(h>o||!h)?(u(),l.push(d)):d instanceof Q&&h&&(p=c[c.length-1])instanceof Q&&d.lines+p.lines<=32?(h+=d.lines,a+=d.length+1,c[c.length-1]=new Q(p.text.concat(d.text),p.length+1+d.length)):(h+d.lines>s&&u(),h+=d.lines,a+=d.length+1,c.push(d))}function u(){h!=0&&(l.push(c.length==1?c[0]:Ve.from(c,a)),a=-1,h=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ve(l,t)}}z.empty=new Q([""],0);function Ia(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Pi(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],h=s+l.length;h>=t&&(h>i&&(l=l.slice(0,i-s)),s<t&&(l=l.slice(t-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=h+1}return e}function ar(n,e,t){return Pi(n,[""],e,t)}class Zt{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Q?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof Q?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(s instanceof Q){let h=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,h.length>Math.max(0,e))return this.value=e==0?h:t>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=s.children[o+(t<0?-1:0)];e>h.length?(e-=h.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(h),this.offsets.push(t>0?1:(h instanceof Q?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class qo{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Zt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ko{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},Zt.prototype[Symbol.iterator]=qo.prototype[Symbol.iterator]=Ko.prototype[Symbol.iterator]=function(){return this});class Na{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Dt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;n<Dt.length;n++)Dt[n]+=Dt[n-1];function Va(n){for(let e=1;e<Dt.length;e+=2)if(Dt[e]>n)return Dt[e-1]<=n;return!1}function cr(n){return n>=127462&&n<=127487}const fr=8205;function Ae(n,e,t=!0,i=!0){return(t?Uo:Fa)(n,e,i)}function Uo(n,e,t){if(e==n.length)return e;e&&jo(n.charCodeAt(e))&&Go(n.charCodeAt(e-1))&&e--;let i=re(n,e);for(e+=ve(i);e<n.length;){let s=re(n,e);if(i==fr||s==fr||t&&Va(s))e+=ve(s),i=s;else if(cr(s)){let r=0,o=e-2;for(;o>=0&&cr(re(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Fa(n,e,t){for(;e>0;){let i=Uo(n,e-2,t);if(i<e)return i;e--}return 0}function jo(n){return n>=56320&&n<57344}function Go(n){return n>=55296&&n<56320}function re(n,e){let t=n.charCodeAt(e);if(!Go(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return jo(i)?(t-55296<<10)+(i-56320)+65536:t}function Ls(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ve(n){return n<65536?1:2}const jn=/\r\n?|\n/;var me=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(me||(me={}));class We{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(e,t=!1){Gn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s
Line truncated
|
||||
`}get readOnly(){return this.facet(il)}phrase(e,...t){for(let i of this.facet(V.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Yo))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return Xa(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let h=Ae(t,o,!1);if(r(t.slice(h,o))!=ce.Word)break;o=h}for(;l<s;){let h=Ae(t,l);if(r(t.slice(l,h))!=ce.Word)break;l=h}return o==l?null:m.range(o+i,l+i)}}V.allowMultipleSelections=_o;V.tabSize=T.define({combine:n=>n.length?n[0]:4});V.lineSeparator=Qo;V.readOnly=il;V.phrases=T.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});V.languageData=Yo;V.changeFilter=Zo;V.transactionFilter=el;V.transactionExtender=tl;Qe.reconfigure=H.define();function zt(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class pt{eq(e){return this==e}range(e,t=e){return ri.create(e,t,this)}}pt.prototype.startSide=pt.prototype.endSide=0;pt.prototype.point=!1;pt.prototype.mapMode=me.TrackDel;class ri{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new ri(e,t,i)}}function Qn(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Is{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let h=o+l>>1,a=r[h]-e||(i?this.value[h].endSide:this.value[h].startSide)-t;if(h==o)return a>=0?o:l;a>=0?l=h:o=h+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(s(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t){let i=[],s=[],r=[],o=-1,l=-1;for(let h=0;h<this.value.length;h++){let a=this.value[h],c=this.from[h]+e,f=this.to[h]+e,u,d;if(c==f){let p=t.mapPos(c,a.startSide,a.mapMode);if(p==null||(u=d=p,a.startSide!=a.endSide&&(d=t.mapPos(c,a.endSide),d<u)))continue}else if(u=t.mapPos(c,a.startSide),d=t.mapPos(f,a.endSide),u>d||u==d&&a.startSide>0&&a.endSide<=0)continue;(d-u||a.endSide-a.startSide)<0||(o<0&&(o=u),a.point&&(l=Math.max(l,d-u)),i.push(a),s.push(u-o),r.push(d-o))}return{mapped:i.length?new Is(s,r,i,l):null,pos:o}}}class Y{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new Y(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Qn)),this.isEmpty)return t.length?Y.of(t):this;let l=new rl(this,null,-1).goto(0),h=0,a=[],c=new gt;for(;l.value||h<t.length;)if(h<t.length&&(l.from-t[h].from||l.startSide-t[h].value.startSide)>=0){let f=t[h++];c.addInner(f.from,f.to,f.value)||a.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(h==t.length||this.chunkEnd(l.chunkIndex)<t[h].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||r<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||a.push(ri.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!a.length?Y.empty:this.nextLayer.update({add:a,filter:o,filterFrom:s,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],h=this.chunk[o],a=e.touchesRange(l,l+h.length);if(a===!1)s=Math.max(s,h.maxPoint),t.push(h),i.push(e.mapPos(l));else if(a===!0){let{mapped:c,pos:f}=h.map(l,e);c&&(s=Math.max(s,c.maxPoint),t.push(c),i.push(f))}}let r=this.nextLayer.map(e);return t.length==0?r:new Y(i,t,r||Y.empty,s)}between(e,t,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],o=this.chunk[s];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return oi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return oi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),h=pr(o,l,i),a=new Ut(o,h,r),c=new Ut(l
Line truncated
|
||||
`)}static newName(){let e=br[yr]||1;return br[yr]=e+1,ts+e.toString(36)}static mount(e,t){(e[is]||new _a(e)).mount(Array.isArray(t)?t:[t])}}let wi=null;class _a{constructor(e){if(!e.head&&e.adoptedStyleSheets&&typeof CSSStyleSheet<"u"){if(wi)return e.adoptedStyleSheets=[wi.sheet].concat(e.adoptedStyleSheets),e[is]=wi;this.sheet=new CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat(e.adoptedStyleSheets),wi=this}else{this.styleTag=(e.ownerDocument||e).createElement("style");let t=e.head||e;t.insertBefore(this.styleTag,t.firstChild)}this.modules=[],e[is]=this}mount(e){let t=this.sheet,i=0,s=0;for(let r=0;r<e.length;r++){let o=e[r],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),t)for(let h=0;h<o.rules.length;h++)t.insertRule(o.rules[h],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=o.rules.length,s++}}if(!t){let r="";for(let o=0;o<this.modules.length;o++)r+=this.modules[o].getRules()+`
|
||||
`;this.styleTag.textContent=r}}}var ot={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Rt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wr=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent),Qa=typeof navigator<"u"&&/Apple Computer/.test(navigator.vendor),Za=typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent),xr=typeof navigator<"u"&&/Mac/.test(navigator.platform),ec=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tc=wr&&(xr||+wr[1]<57)||Za&&xr;for(var oe=0;oe<10;oe++)ot[48+oe]=ot[96+oe]=String(oe);for(var oe=1;oe<=24;oe++)ot[oe+111]="F"+oe;for(var oe=65;oe<=90;oe++)ot[oe]=String.fromCharCode(oe+32),Rt[oe]=String.fromCharCode(oe);for(var An in ot)Rt.hasOwnProperty(An)||(Rt[An]=ot[An]);function ic(n){var e=tc&&(n.ctrlKey||n.altKey||n.metaKey)||(Qa||ec)&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Rt:ot)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function zi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Lt(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function nc(){let n=document.activeElement;for(;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function Ii(n,e){if(!e.anchorNode)return!1;try{return Lt(n,e.anchorNode)}catch{return!1}}function li(n){return n.nodeType==3?Pt(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function qi(n,e,t,i){return t?kr(n,e,t,i,-1)||kr(n,e,t,i,1):!1}function Ki(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function kr(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:hi(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Ki(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?hi(n):0}else return!1}}function hi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}const ol={left:0,right:0,top:0,bottom:0};function hn(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function sc(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function rc(n,e,t,i,s,r,o,l){let h=n.ownerDocument,a=h.defaultView;for(let c=n;c;)if(c.nodeType==1){let f,u=c==h.body;if(u)f=sc(a);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.parentNode;continue}let g=c.getBoundingClientRect();f={left:g.left,right:g.left+c.clientWidth,top:g.top,bottom:g.top+c.clientHeight}}let d=0,p=0;if(s=="nearest")e.top<f.top?(p=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+p&&(p=e.bottom-f.bottom+p+o)):e.bottom>f.bottom&&(p=e.bottom-f.bottom+o,t<0&&e.top-p<f.top&&(p=-(f.top+p-e.top+o)));else{let g=e.bottom-e.top,y=f.bottom-f.top;p=(s=="center"&&g<=y?e.top+g/2-y/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-y+o)-f.top}if(i=="nearest"?e.left<f.left?(d=-(f.left-e.left+r),t>0&&e.right>f.right+d&&(d=e.right-f.right+d+r)):e.right>f.right&&(d=e.right-f.right+r,t<0&&e.left<f.left+d&&(d=-(f.left+d-e.left+r))):d=(i=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:i=="start"==l?e.left-r:e.right-(f.right-f.left)+r)-f.left,d||p)if(u)a.scrollBy(d,p);else{if(p){let g=c.scrollTop;c.scrollTop+=p,p=c.scrollTop-g}if(d){let g=c.scrollLeft;c.scrollLeft+=d,d=c.scrollLeft-g}e={left:e.left-d,top:e.top-p,right:e.right-d,bottom:e.bottom-p}}if(u)break;c=c.assignedSlot||c.parentNode,i=s="nearest"}else if(c.nodeType==11)c=c.host;else break}class oc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){this.set(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let vt=null;function ll(n){if(n.setActive)return n.setActive();if(vt)return n.focus(vt);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(vt==null?{get preventScroll(){return vt={preventScroll:!0},!0}}:void 0),!vt){vt=!1;for(let t=0;t<e.length;){let i=e[t++],s=e[t++],r=e[t++];i.scrollTop!Line truncated
|
||||
`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),a=m.cursor(t?s.from:s.to)}if(h){if(!h(c))return l}else{if(!i)return a;h=i(c)}l=a}}function Pc(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==ce.Space&&(s=o),s==o}}function Ec(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return m.cursor(s,e.assoc);let o=e.goalColumn,l,h=n.contentDOM.getBoundingClientRect(),a=n.coordsAtPos(s),c=n.documentTop;if(a)o==null&&(o=a.left-h.left),l=r<0?a.top:a.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(h.right-h.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=h.left+o,u=i!=null?i:n.defaultLineHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,g=Nl(n,{x:f,y:p},!1,r);if(p<h.top||p>h.bottom||(r<0?g<s:g>s))return m.cursor(g,e.assoc,void 0,o)}}function Tn(n,e,t){let i=n.state.facet(Ol).map(s=>s(n));for(;;){let s=!1;for(let r of i)r.between(t.from-1,t.from+1,(o,l,h)=>{t.from>o&&t.from<l&&(t=e.from>t.from?m.cursor(o,1):m.cursor(l,-1),s=!0)});if(!s)return t}}class Ic{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.rapidCompositionStart=!1,this.mouseSelection=null;for(let t in ie){let i=ie[t];e.contentDOM.addEventListener(t,s=>{!Fr(e,s)||this.ignoreDuringComposition(s)||t=="keydown"&&this.keydown(e,s)||(this.mustFlushObserver(s)&&e.observer.forceFlush(),this.runCustomHandlers(t,e,s)?s.preventDefault():i(e,s))},gs[t]),this.registeredEvents.push(t)}A.chrome&&A.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,A.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let s;this.customHandlers=[];for(let r of t)if(s=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:s});for(let o in s)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,l=>{!Fr(e,l)||this.runCustomHandlers(o,e,l)&&l.preventDefault()}))}}runCustomHandlers(e,t,i){for(let s of this.customHandlers){let r=s.handlers[e];if(r)try{if(r.call(s.plugin,i,t)||i.defaultPrevented)return!0}catch(o){Re(t.state,o)}}return!1}runScrollHandlers(e,t){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,t,e)}catch(r){Re(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(A.android&&A.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return e.observer.delayAndroidKey(t.key,t.keyCode),!0;let i;return A.ios&&(i=Vl.find(s=>s.keyCode==t.keyCode))&&!(t.ctrlKey||t.altKey||t.metaKey)&&!t.synthetic?(this.pendingIOSKey=i,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,ti(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:A.safari&&!A.ios&&Date.now()-this.compositionEndedAt<100?(this.compositionEndedAt=0,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229||e.type=="compositionend"&&!A.ios}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const Vl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Fl=[16,17,18,20,91,92,224,225];class Nc{constructor(e,t,i,s){this.view=e,this.style=i,this.mustSelect=s,this.lastEvent=t;let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(V.allowMultipleSelections)&&Vc(e,t),this.dragMove=Fc(e,t),this.dragging=Hc(e,t)&&Hs(t)==1?null:!1,this.dragging===!1&&(t.preventDefault(),this.select(t))}move(e){if(e.buttons==0)return this.destroy();this.dragging===!1&&this.select(this.lastEvent=e)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging|
Line truncated
|
||||
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,xs),Rf={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ln=null;function Lf(){var n;if(Ln==null&&typeof document<"u"&&document.body){let e=document.body.style;Ln=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Ln||!1}const Vi=T.define({combine(n){let e=zt(n,{render:null,specialChars:Bf,addSpecialChars:null});return(e.replaceTabs=!Lf())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,xs)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,xs)),e}});function Pf(n={}){return[Vi.of(n),Ef()]}let ro=null;function Ef(){return ro||(ro=ue.fromClass(class{constructor(n){this.view=n,this.decorations=R.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Vi)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Tf({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=re(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,h=di(o.text,l,i-o.from);return R.replace({widget:new Ff((l-h%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=R.replace({widget:new Vf(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Vi);n.startState.facet(Vi)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const If="\u2022";function Nf(n){return n>=32?If:n==10?"\u2424":String.fromCharCode(9216+n)}class Vf extends xt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Nf(this.code),i=e.state.phrase("Control character")+" "+(Rf[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Ff extends xt{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}class Hf extends xt{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}ignoreEvent(){return!1}}function oo(n){return ue.fromClass(class{constructor(e){this.view=e,this.placeholder=R.set([R.widget({widget:new Hf(n),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?R.none:this.placeholder}},{decorations:e=>e.decorations})}const ks=2e3;function Wf(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>ks||t.off>ks||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let h=i;h<=s;h++){let a=n.doc.line(h);a.length<=l&&r.push(m.range(a.from+o,a.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let h=i;h<=s;h++){let a=n.doc.line(h),c=es(a.text,o,n.tabSize,!0);if(c>-1){let f=es(a.text,l,n.tabSize);r.push(m.range(a.from+c,a.from+f))}}}return r}function zf(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function lo(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>ks?-1:s==i.length?zf(n,e.clientX):di(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function qf(n,e){let t=lo(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=lo(n,s);if(!l)return i;let h=Wf(n.state,t,l);return h.length?o?m.create(h.concat(i.ranges)):m.create(h):i}}:null}function Kf(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return O.mouseSelectionStyle.of((t,i)=>e(i)?qf(t,i):null)}const Pn="-10000px";class Uf{constructor(e,t,i){this.facet=t,this.createTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(s=>s),this.tooltipViews=this.tooltips.map(i)}update(e){let t=e.state.facet(this.facet),i=t.filt
Line truncated
|
||||
`&&(t="");else{let i=t.indexOf(`
|
||||
`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;t+=this.ranges[++this.rangeIndex].from-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,i,s,r){if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let o=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-o}return this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new bh(t,e?e.state.tabSize:4,e?bt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=xh(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=_.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:zu,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new _(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new _(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function xh(n,e,t){e.start=e.pos;for(let i=0;i<10;i++){let s=n(e,t);if(e.pos>e.start)return s}throw new Error("Stream parser failed to advance stream.")}const Ys=Object.create(null),fi=[we.none],zu=new qs(fi),bo=[],kh=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])kh[n]=vh(Ys,e);class Sh{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),kh)}resolve(e){return e?this.table[e]||(this.table[e]=vh(this.extra,e)):0}}const qu=new Sh(Ys);function Wn(n,e){bo.indexOf(n)>-1||(bo.push(n),console.warn(e))}function vh(n,e){let t=null;for(let r of e.split(".")){let o=n[r]||k[r];o?typeof o=="function"?t?t=o(t):Wn(r,`Modifier ${r} used at start of tag`):t?Wn(r,`Tag ${r} used as modifier`):t=o:Wn(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=we.define({id:fi.length,name:i,props:[hu({[i]:t})]});return fi.push(s),s.id}function Ku(n){let e=we.define({id:fi.length,name:"Document",props:[ci.add(()=>n)]});return fi.push(e),e}const Uu=n=>{let e=Qs(n.state);return e.line?ju(n):e.block?Ju(n):!1};function _s(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const ju=_s(Yu,0),Gu=_s(Ch,0),Ju=_s((n,e)=>Ch(n,e,Xu(e)),0);function Qs(n,e=n.selection.main.head){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const Jt=50;function $u(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Jt,i),o=n.sliceDoc(s,s+Jt),l=/\s*$/.exec(r)[0].length,h=/^\s*/.exec(o)[0].length,a=r.length-l;if(r.slice(a-e.length,a)==e&&o.slice(h,h+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+h,margin:h&&1}};let c,f;s-i<=2*Jt?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+Jt),f=n.sliceDoc(s-Jt,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Xu(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from,to:s.to})}return e}function Ch(n,e,t=e.selection.ranges){let i=t.map(r=>Qs(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>$u(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;o<s.length;o++)if(l=s[o]){let h=i[o],{open:a,close:c}=l;r.push({from:a.pos-h.open.length,to:a.pos+a.margin},{from:c.pos-c.margin,to:c.pos+h.close.length})}return{changes:r}}return null}function Yu(n,e,t=e.selection.ranges){let i=[],s=-1;for(let{from:r,to:o}of t){let l=i.length,h=1e9;for(let a=r;a<=o;){let c=e.doc.lineAt(a);if(c.from>s&&(r==o||o>c.from)){s=c.from;let f=Qs(e,a).line;if(!f)continue;let u=/^\s*/.exec(c.text)[0].length,d=u==c
Line truncated
|
||||
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp}create(){return this.regexp?new lp(this):new op(this)}getCursor(e,t=0,i=e.length){return this.regexp?Mt(this,e,t,i):At(this,e,t,i)}}class la{constructor(e){this.spec=e}}function At(n,e,t,i){return new Ht(e,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase())}class op extends la{constructor(e){super(e)}nextMatch(e,t,i){let s=At(this.spec,e,i,e.length).nextOverlapping();return s.done&&(s=At(this.spec,e,0,t).nextOverlapping()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=i;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=At(this.spec,e,r,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==t)return null;s-=1e4}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.length)}getReplacement(e){return this.spec.replace}matchAll(e,t){let i=At(this.spec,e,0,e.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=At(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Mt(n,e,t,i){return new na(e,n.search,n.caseSensitive?void 0:{ignoreCase:!0},t,i)}class lp extends la{nextMatch(e,t,i){let s=Mt(this.spec,e,i,e.length).next();return s.done&&(s=Mt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Mt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.length)}getReplacement(e){return this.spec.replace.replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i<e.match.length?e.match[i]:t)}matchAll(e,t){let i=Mt(this.spec,e,0,e.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Mt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const ui=H.define(),ir=H.define(),nt=ke.define({create(n){return new Kn(Bs(n).create(),null)},update(n,e){for(let t of e.effects)t.is(ui)?n=new Kn(t.value.create(),n.panel):t.is(ir)&&(n=new Kn(n.query,t.value?nr:null));return n},provide:n=>$i.from(n,e=>e.panel)});class Kn{constructor(e,t){this.query=e,this.panel=t}}const hp=R.mark({class:"cm-searchMatch"}),ap=R.mark({class:"cm-searchMatch cm-searchMatch-selected"}),cp=ue.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(nt))}update(n){let e=n.state.field(nt);(e!=n.startState.field(nt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return R.none;let{view:t}=this,i=new gt;for(let s=0,r=t.visibleRanges,o=r.length;s<o;s++){let{from:l,to:h}=r[s];for(;s<o-1&&h>r[s+1].from-2*250;)h=r[++s].to;n.highlight(t.state.doc,l,h,(a,c)=>{let f=t.state.selection.ranges.some(u=>u.from==a&&u.to==c);i.add(a,c,f?ap:hp)})}return i.finish()}},{decorations:n=>n.decorations});function gi(n){return e=>{let t=e.state.field(nt,!1);return t&&t.query.spec.valid?n(e,t):ha(e)}}const nn=gi((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state.doc,t,t);return i?(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:sr(n,i),userEvent:"select.search"}),!0):!1}),sn=gi((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t.doc,i,i);return s?(n.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:sr(n,s),userEvent:"select.search"}),!0):!1}),fp=gi((n,{query:e})=>{let t=e.matchAll(n.state.doc,1e3);return!t||!t.length?!1:(n.dispatch({selection:m.create(t.map(i=>m.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),up=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new Ht(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(m.range(l.value.from,l.value.to))}return e(n.update({selection:m.create(r,o),userEvent:"select.search.matches"})),!0},Po=gi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t.doc,i,i);if(!r)return!1;let o=[],l,h,a=[];if(r.from==i&&r.to==s&&(h=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:h}),r=e.nextMatch(t.doc,r.from,r.to),a.push(O.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let c=o.length==0||o[0].from>=r.to?0:r.to-r.from-h.length;l={anchor:r.from-c,head:r.to-c},a.push(sr(n,r))}return n.dispatch({changes:o,selection:l,scrollIntoView:!!l,effects:a,userEvent:"input.replace"}),!0}),dp=gi((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state.doc,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getRep
Line truncated
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
import{S as E,i as G,s as I,F as K,c as F,m as B,t as H,a as N,d as T,C as M,q as J,e as c,w as q,b as k,f as u,r as L,g as b,h as _,u as h,v as O,j as Q,l as U,o as w,A as V,p as W,B as X,D as Y,x as Z,z as S}from"./index.9681f446.js";function y(f){let e,o,s;return{c(){e=q("for "),o=c("strong"),s=q(f[3]),u(o,"class","txt-nowrap")},m(l,t){b(l,e,t),b(l,o,t),_(o,s)},p(l,t){t&8&&Z(s,l[3])},d(l){l&&w(e),l&&w(o)}}}function x(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password"),l=k(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0,t.autofocus=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[0]),t.focus(),p||(d=h(t,"input",f[6]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&1&&t.value!==n[0]&&S(t,n[0])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function ee(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password confirm"),l=k(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[1]),p||(d=h(t,"input",f[7]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&2&&t.value!==n[1]&&S(t,n[1])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function te(f){let e,o,s,l,t,r,p,d,n,i,g,R,C,v,P,A,j,m=f[3]&&y(f);return r=new J({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),d=new J({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),{c(){e=c("form"),o=c("div"),s=c("h4"),l=q(`Reset your admin password
|
||||
`),m&&m.c(),t=k(),F(r.$$.fragment),p=k(),F(d.$$.fragment),n=k(),i=c("button"),g=c("span"),g.textContent="Set new password",R=k(),C=c("div"),v=c("a"),v.textContent="Back to login",u(s,"class","m-b-xs"),u(o,"class","content txt-center m-b-sm"),u(g,"class","txt"),u(i,"type","submit"),u(i,"class","btn btn-lg btn-block"),i.disabled=f[2],L(i,"btn-loading",f[2]),u(e,"class","m-b-base"),u(v,"href","/login"),u(v,"class","link-hint"),u(C,"class","content txt-center")},m(a,$){b(a,e,$),_(e,o),_(o,s),_(s,l),m&&m.m(s,null),_(e,t),B(r,e,null),_(e,p),B(d,e,null),_(e,n),_(e,i),_(i,g),b(a,R,$),b(a,C,$),_(C,v),P=!0,A||(j=[h(e,"submit",O(f[4])),Q(U.call(null,v))],A=!0)},p(a,$){a[3]?m?m.p(a,$):(m=y(a),m.c(),m.m(s,null)):m&&(m.d(1),m=null);const z={};$&769&&(z.$$scope={dirty:$,ctx:a}),r.$set(z);const D={};$&770&&(D.$$scope={dirty:$,ctx:a}),d.$set(D),(!P||$&4)&&(i.disabled=a[2]),$&4&&L(i,"btn-loading",a[2])},i(a){P||(H(r.$$.fragment,a),H(d.$$.fragment,a),P=!0)},o(a){N(r.$$.fragment,a),N(d.$$.fragment,a),P=!1},d(a){a&&w(e),m&&m.d(),T(r),T(d),a&&w(R),a&&w(C),A=!1,V(j)}}}function se(f){let e,o;return e=new K({props:{$$slots:{default:[te]},$$scope:{ctx:f}}}),{c(){F(e.$$.fragment)},m(s,l){B(e,s,l),o=!0},p(s,[l]){const t={};l&527&&(t.$$scope={dirty:l,ctx:s}),e.$set(t)},i(s){o||(H(e.$$.fragment,s),o=!0)},o(s){N(e.$$.fragment,s),o=!1},d(s){T(e,s)}}}function le(f,e,o){let s,{params:l}=e,t="",r="",p=!1;async function d(){if(!p){o(2,p=!0);try{await W.Admins.confirmPasswordReset(l==null?void 0:l.token,t,r),X("Successfully set a new admin password."),Y("/")}catch(g){W.errorResponseHandler(g)}o(2,p=!1)}}function n(){t=this.value,o(0,t)}function i(){r=this.value,o(1,r)}return f.$$set=g=>{"params"in g&&o(5,l=g.params)},f.$$.update=()=>{f.$$.dirty&32&&o(3,s=M.getJWTPayload(l==null?void 0:l.token).email||"")},[t,r,p,s,d,l,n,i]}class ae extends E{constructor(e){super(),G(this,e,le,se,I,{params:5})}}export{ae as default};
|
||||
import{S as E,i as G,s as I,F as K,c as A,m as B,t as H,a as N,d as T,C as M,q as J,e as c,w as q,b as k,f as u,r as L,g as b,h as _,u as h,v as O,j as Q,l as U,o as w,A as V,p as W,B as X,D as Y,x as Z,z as S}from"./index.3b658553.js";function y(f){let e,o,s;return{c(){e=q("for "),o=c("strong"),s=q(f[3]),u(o,"class","txt-nowrap")},m(l,t){b(l,e,t),b(l,o,t),_(o,s)},p(l,t){t&8&&Z(s,l[3])},d(l){l&&w(e),l&&w(o)}}}function x(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password"),l=k(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0,t.autofocus=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[0]),t.focus(),p||(d=h(t,"input",f[6]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&1&&t.value!==n[0]&&S(t,n[0])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function ee(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password confirm"),l=k(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[1]),p||(d=h(t,"input",f[7]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&2&&t.value!==n[1]&&S(t,n[1])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function te(f){let e,o,s,l,t,r,p,d,n,i,g,R,C,v,P,F,j,m=f[3]&&y(f);return r=new J({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),d=new J({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),{c(){e=c("form"),o=c("div"),s=c("h4"),l=q(`Reset your admin password
|
||||
`),m&&m.c(),t=k(),A(r.$$.fragment),p=k(),A(d.$$.fragment),n=k(),i=c("button"),g=c("span"),g.textContent="Set new password",R=k(),C=c("div"),v=c("a"),v.textContent="Back to login",u(s,"class","m-b-xs"),u(o,"class","content txt-center m-b-sm"),u(g,"class","txt"),u(i,"type","submit"),u(i,"class","btn btn-lg btn-block"),i.disabled=f[2],L(i,"btn-loading",f[2]),u(e,"class","m-b-base"),u(v,"href","/login"),u(v,"class","link-hint"),u(C,"class","content txt-center")},m(a,$){b(a,e,$),_(e,o),_(o,s),_(s,l),m&&m.m(s,null),_(e,t),B(r,e,null),_(e,p),B(d,e,null),_(e,n),_(e,i),_(i,g),b(a,R,$),b(a,C,$),_(C,v),P=!0,F||(j=[h(e,"submit",O(f[4])),Q(U.call(null,v))],F=!0)},p(a,$){a[3]?m?m.p(a,$):(m=y(a),m.c(),m.m(s,null)):m&&(m.d(1),m=null);const z={};$&769&&(z.$$scope={dirty:$,ctx:a}),r.$set(z);const D={};$&770&&(D.$$scope={dirty:$,ctx:a}),d.$set(D),(!P||$&4)&&(i.disabled=a[2]),$&4&&L(i,"btn-loading",a[2])},i(a){P||(H(r.$$.fragment,a),H(d.$$.fragment,a),P=!0)},o(a){N(r.$$.fragment,a),N(d.$$.fragment,a),P=!1},d(a){a&&w(e),m&&m.d(),T(r),T(d),a&&w(R),a&&w(C),F=!1,V(j)}}}function se(f){let e,o;return e=new K({props:{$$slots:{default:[te]},$$scope:{ctx:f}}}),{c(){A(e.$$.fragment)},m(s,l){B(e,s,l),o=!0},p(s,[l]){const t={};l&527&&(t.$$scope={dirty:l,ctx:s}),e.$set(t)},i(s){o||(H(e.$$.fragment,s),o=!0)},o(s){N(e.$$.fragment,s),o=!1},d(s){T(e,s)}}}function le(f,e,o){let s,{params:l}=e,t="",r="",p=!1;async function d(){if(!p){o(2,p=!0);try{await W.admins.confirmPasswordReset(l==null?void 0:l.token,t,r),X("Successfully set a new admin password."),Y("/")}catch(g){W.errorResponseHandler(g)}o(2,p=!1)}}function n(){t=this.value,o(0,t)}function i(){r=this.value,o(1,r)}return f.$$set=g=>{"params"in g&&o(5,l=g.params)},f.$$.update=()=>{f.$$.dirty&32&&o(3,s=M.getJWTPayload(l==null?void 0:l.token).email||"")},[t,r,p,s,d,l,n,i]}class ae extends E{constructor(e){super(),G(this,e,le,se,I,{params:5})}}export{ae as default};
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
import{S as E,i as M,s as T,F as j,c as H,m as L,t as w,a as y,d as S,b as g,e as _,f as p,g as k,h as d,j as z,l as B,k as N,n as D,o as v,p as C,q as G,r as F,u as A,v as I,w as h,x as J,y as P,z as R}from"./index.9681f446.js";function K(c){let e,s,n,l,t,o,f,m,i,a,b,u;return l=new G({props:{class:"form-field required",name:"email",$$slots:{default:[Q,({uniqueId:r})=>({5:r}),({uniqueId:r})=>r?32:0]},$$scope:{ctx:c}}}),{c(){e=_("form"),s=_("div"),s.innerHTML=`<h4 class="m-b-xs">Forgotten admin password</h4>
|
||||
<p>Enter the email associated with your account and we\u2019ll send you a recovery link:</p>`,n=g(),H(l.$$.fragment),t=g(),o=_("button"),f=_("i"),m=g(),i=_("span"),i.textContent="Send recovery link",p(s,"class","content txt-center m-b-sm"),p(f,"class","ri-mail-send-line"),p(i,"class","txt"),p(o,"type","submit"),p(o,"class","btn btn-lg btn-block"),o.disabled=c[1],F(o,"btn-loading",c[1]),p(e,"class","m-b-base")},m(r,$){k(r,e,$),d(e,s),d(e,n),L(l,e,null),d(e,t),d(e,o),d(o,f),d(o,m),d(o,i),a=!0,b||(u=A(e,"submit",I(c[3])),b=!0)},p(r,$){const q={};$&97&&(q.$$scope={dirty:$,ctx:r}),l.$set(q),(!a||$&2)&&(o.disabled=r[1]),$&2&&F(o,"btn-loading",r[1])},i(r){a||(w(l.$$.fragment,r),a=!0)},o(r){y(l.$$.fragment,r),a=!1},d(r){r&&v(e),S(l),b=!1,u()}}}function O(c){let e,s,n,l,t,o,f,m,i;return{c(){e=_("div"),s=_("div"),s.innerHTML='<i class="ri-checkbox-circle-line"></i>',n=g(),l=_("div"),t=_("p"),o=h("Check "),f=_("strong"),m=h(c[0]),i=h(" for the recovery link."),p(s,"class","icon"),p(f,"class","txt-nowrap"),p(l,"class","content"),p(e,"class","alert alert-success")},m(a,b){k(a,e,b),d(e,s),d(e,n),d(e,l),d(l,t),d(t,o),d(t,f),d(f,m),d(t,i)},p(a,b){b&1&&J(m,a[0])},i:P,o:P,d(a){a&&v(e)}}}function Q(c){let e,s,n,l,t,o,f,m;return{c(){e=_("label"),s=h("Email"),l=g(),t=_("input"),p(e,"for",n=c[5]),p(t,"type","email"),p(t,"id",o=c[5]),t.required=!0,t.autofocus=!0},m(i,a){k(i,e,a),d(e,s),k(i,l,a),k(i,t,a),R(t,c[0]),t.focus(),f||(m=A(t,"input",c[4]),f=!0)},p(i,a){a&32&&n!==(n=i[5])&&p(e,"for",n),a&32&&o!==(o=i[5])&&p(t,"id",o),a&1&&t.value!==i[0]&&R(t,i[0])},d(i){i&&v(e),i&&v(l),i&&v(t),f=!1,m()}}}function U(c){let e,s,n,l,t,o,f,m;const i=[O,K],a=[];function b(u,r){return u[2]?0:1}return e=b(c),s=a[e]=i[e](c),{c(){s.c(),n=g(),l=_("div"),t=_("a"),t.textContent="Back to login",p(t,"href","/login"),p(t,"class","link-hint"),p(l,"class","content txt-center")},m(u,r){a[e].m(u,r),k(u,n,r),k(u,l,r),d(l,t),o=!0,f||(m=z(B.call(null,t)),f=!0)},p(u,r){let $=e;e=b(u),e===$?a[e].p(u,r):(N(),y(a[$],1,1,()=>{a[$]=null}),D(),s=a[e],s?s.p(u,r):(s=a[e]=i[e](u),s.c()),w(s,1),s.m(n.parentNode,n))},i(u){o||(w(s),o=!0)},o(u){y(s),o=!1},d(u){a[e].d(u),u&&v(n),u&&v(l),f=!1,m()}}}function V(c){let e,s;return e=new j({props:{$$slots:{default:[U]},$$scope:{ctx:c}}}),{c(){H(e.$$.fragment)},m(n,l){L(e,n,l),s=!0},p(n,[l]){const t={};l&71&&(t.$$scope={dirty:l,ctx:n}),e.$set(t)},i(n){s||(w(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){S(e,n)}}}function W(c,e,s){let n="",l=!1,t=!1;async function o(){if(!l){s(1,l=!0);try{await C.Admins.requestPasswordReset(n),s(2,t=!0)}catch(m){C.errorResponseHandler(m)}s(1,l=!1)}}function f(){n=this.value,s(0,n)}return[n,l,t,o,f]}class Y extends E{constructor(e){super(),M(this,e,W,V,T,{})}}export{Y as default};
|
||||
import{S as M,i as T,s as j,F as z,c as H,m as L,t as w,a as y,d as S,b as g,e as _,f as p,g as k,h as d,j as A,l as B,k as N,n as D,o as v,p as C,q as G,r as F,u as E,v as I,w as h,x as J,y as P,z as R}from"./index.3b658553.js";function K(c){let e,s,n,l,t,o,f,m,i,a,b,u;return l=new G({props:{class:"form-field required",name:"email",$$slots:{default:[Q,({uniqueId:r})=>({5:r}),({uniqueId:r})=>r?32:0]},$$scope:{ctx:c}}}),{c(){e=_("form"),s=_("div"),s.innerHTML=`<h4 class="m-b-xs">Forgotten admin password</h4>
|
||||
<p>Enter the email associated with your account and we\u2019ll send you a recovery link:</p>`,n=g(),H(l.$$.fragment),t=g(),o=_("button"),f=_("i"),m=g(),i=_("span"),i.textContent="Send recovery link",p(s,"class","content txt-center m-b-sm"),p(f,"class","ri-mail-send-line"),p(i,"class","txt"),p(o,"type","submit"),p(o,"class","btn btn-lg btn-block"),o.disabled=c[1],F(o,"btn-loading",c[1]),p(e,"class","m-b-base")},m(r,$){k(r,e,$),d(e,s),d(e,n),L(l,e,null),d(e,t),d(e,o),d(o,f),d(o,m),d(o,i),a=!0,b||(u=E(e,"submit",I(c[3])),b=!0)},p(r,$){const q={};$&97&&(q.$$scope={dirty:$,ctx:r}),l.$set(q),(!a||$&2)&&(o.disabled=r[1]),$&2&&F(o,"btn-loading",r[1])},i(r){a||(w(l.$$.fragment,r),a=!0)},o(r){y(l.$$.fragment,r),a=!1},d(r){r&&v(e),S(l),b=!1,u()}}}function O(c){let e,s,n,l,t,o,f,m,i;return{c(){e=_("div"),s=_("div"),s.innerHTML='<i class="ri-checkbox-circle-line"></i>',n=g(),l=_("div"),t=_("p"),o=h("Check "),f=_("strong"),m=h(c[0]),i=h(" for the recovery link."),p(s,"class","icon"),p(f,"class","txt-nowrap"),p(l,"class","content"),p(e,"class","alert alert-success")},m(a,b){k(a,e,b),d(e,s),d(e,n),d(e,l),d(l,t),d(t,o),d(t,f),d(f,m),d(t,i)},p(a,b){b&1&&J(m,a[0])},i:P,o:P,d(a){a&&v(e)}}}function Q(c){let e,s,n,l,t,o,f,m;return{c(){e=_("label"),s=h("Email"),l=g(),t=_("input"),p(e,"for",n=c[5]),p(t,"type","email"),p(t,"id",o=c[5]),t.required=!0,t.autofocus=!0},m(i,a){k(i,e,a),d(e,s),k(i,l,a),k(i,t,a),R(t,c[0]),t.focus(),f||(m=E(t,"input",c[4]),f=!0)},p(i,a){a&32&&n!==(n=i[5])&&p(e,"for",n),a&32&&o!==(o=i[5])&&p(t,"id",o),a&1&&t.value!==i[0]&&R(t,i[0])},d(i){i&&v(e),i&&v(l),i&&v(t),f=!1,m()}}}function U(c){let e,s,n,l,t,o,f,m;const i=[O,K],a=[];function b(u,r){return u[2]?0:1}return e=b(c),s=a[e]=i[e](c),{c(){s.c(),n=g(),l=_("div"),t=_("a"),t.textContent="Back to login",p(t,"href","/login"),p(t,"class","link-hint"),p(l,"class","content txt-center")},m(u,r){a[e].m(u,r),k(u,n,r),k(u,l,r),d(l,t),o=!0,f||(m=A(B.call(null,t)),f=!0)},p(u,r){let $=e;e=b(u),e===$?a[e].p(u,r):(N(),y(a[$],1,1,()=>{a[$]=null}),D(),s=a[e],s?s.p(u,r):(s=a[e]=i[e](u),s.c()),w(s,1),s.m(n.parentNode,n))},i(u){o||(w(s),o=!0)},o(u){y(s),o=!1},d(u){a[e].d(u),u&&v(n),u&&v(l),f=!1,m()}}}function V(c){let e,s;return e=new z({props:{$$slots:{default:[U]},$$scope:{ctx:c}}}),{c(){H(e.$$.fragment)},m(n,l){L(e,n,l),s=!0},p(n,[l]){const t={};l&71&&(t.$$scope={dirty:l,ctx:n}),e.$set(t)},i(n){s||(w(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){S(e,n)}}}function W(c,e,s){let n="",l=!1,t=!1;async function o(){if(!l){s(1,l=!0);try{await C.admins.requestPasswordReset(n),s(2,t=!0)}catch(m){C.errorResponseHandler(m)}s(1,l=!1)}}function f(){n=this.value,s(0,n)}return[n,l,t,o,f]}class Y extends M{constructor(e){super(),T(this,e,W,V,j,{})}}export{Y as default};
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import{S as J,i as M,s as N,F as R,c as S,m as U,t as $,a as v,d as z,C as W,E as Y,g as _,k as j,n as A,o as b,p as F,q as B,e as m,w as y,b as C,f as d,r as H,h as k,u as E,v as D,y as h,x as G,z as T}from"./index.9681f446.js";function I(r){let e,s,t,l,n,o,c,a,i,u,g,q,p=r[3]&&L(r);return o=new B({props:{class:"form-field required",name:"password",$$slots:{default:[O,({uniqueId:f})=>({8:f}),({uniqueId:f})=>f?256:0]},$$scope:{ctx:r}}}),{c(){e=m("form"),s=m("div"),t=m("h4"),l=y(`Type your password to confirm changing your email address
|
||||
`),p&&p.c(),n=C(),S(o.$$.fragment),c=C(),a=m("button"),i=m("span"),i.textContent="Confirm new email",d(t,"class","m-b-xs"),d(s,"class","content txt-center m-b-sm"),d(i,"class","txt"),d(a,"type","submit"),d(a,"class","btn btn-lg btn-block"),a.disabled=r[1],H(a,"btn-loading",r[1])},m(f,w){_(f,e,w),k(e,s),k(s,t),k(t,l),p&&p.m(t,null),k(e,n),U(o,e,null),k(e,c),k(e,a),k(a,i),u=!0,g||(q=E(e,"submit",D(r[4])),g=!0)},p(f,w){f[3]?p?p.p(f,w):(p=L(f),p.c(),p.m(t,null)):p&&(p.d(1),p=null);const P={};w&769&&(P.$$scope={dirty:w,ctx:f}),o.$set(P),(!u||w&2)&&(a.disabled=f[1]),w&2&&H(a,"btn-loading",f[1])},i(f){u||($(o.$$.fragment,f),u=!0)},o(f){v(o.$$.fragment,f),u=!1},d(f){f&&b(e),p&&p.d(),z(o),g=!1,q()}}}function K(r){let e,s,t,l,n;return{c(){e=m("div"),e.innerHTML=`<div class="icon"><i class="ri-checkbox-circle-line"></i></div>
|
||||
import{S as M,i as N,s as R,F as U,c as S,m as z,t as $,a as v,d as J,C as W,E as Y,g as _,k as j,n as A,o as b,p as F,q as B,e as m,w as y,b as C,f as d,r as H,h as k,u as E,v as D,y as h,x as G,z as T}from"./index.3b658553.js";function I(r){let e,s,t,l,n,o,c,a,i,u,g,q,p=r[3]&&L(r);return o=new B({props:{class:"form-field required",name:"password",$$slots:{default:[O,({uniqueId:f})=>({8:f}),({uniqueId:f})=>f?256:0]},$$scope:{ctx:r}}}),{c(){e=m("form"),s=m("div"),t=m("h4"),l=y(`Type your password to confirm changing your email address
|
||||
`),p&&p.c(),n=C(),S(o.$$.fragment),c=C(),a=m("button"),i=m("span"),i.textContent="Confirm new email",d(t,"class","m-b-xs"),d(s,"class","content txt-center m-b-sm"),d(i,"class","txt"),d(a,"type","submit"),d(a,"class","btn btn-lg btn-block"),a.disabled=r[1],H(a,"btn-loading",r[1])},m(f,w){_(f,e,w),k(e,s),k(s,t),k(t,l),p&&p.m(t,null),k(e,n),z(o,e,null),k(e,c),k(e,a),k(a,i),u=!0,g||(q=E(e,"submit",D(r[4])),g=!0)},p(f,w){f[3]?p?p.p(f,w):(p=L(f),p.c(),p.m(t,null)):p&&(p.d(1),p=null);const P={};w&769&&(P.$$scope={dirty:w,ctx:f}),o.$set(P),(!u||w&2)&&(a.disabled=f[1]),w&2&&H(a,"btn-loading",f[1])},i(f){u||($(o.$$.fragment,f),u=!0)},o(f){v(o.$$.fragment,f),u=!1},d(f){f&&b(e),p&&p.d(),J(o),g=!1,q()}}}function K(r){let e,s,t,l,n;return{c(){e=m("div"),e.innerHTML=`<div class="icon"><i class="ri-checkbox-circle-line"></i></div>
|
||||
<div class="content txt-bold"><p>Email address changed</p>
|
||||
<p>You can now sign in with your new email address.</p></div>`,s=C(),t=m("button"),t.textContent="Close",d(e,"class","alert alert-success"),d(t,"type","button"),d(t,"class","btn btn-secondary btn-block")},m(o,c){_(o,e,c),_(o,s,c),_(o,t,c),l||(n=E(t,"click",r[6]),l=!0)},p:h,i:h,o:h,d(o){o&&b(e),o&&b(s),o&&b(t),l=!1,n()}}}function L(r){let e,s,t;return{c(){e=y("to "),s=m("strong"),t=y(r[3]),d(s,"class","txt-nowrap")},m(l,n){_(l,e,n),_(l,s,n),k(s,t)},p(l,n){n&8&&G(t,l[3])},d(l){l&&b(e),l&&b(s)}}}function O(r){let e,s,t,l,n,o,c,a;return{c(){e=m("label"),s=y("Password"),l=C(),n=m("input"),d(e,"for",t=r[8]),d(n,"type","password"),d(n,"id",o=r[8]),n.required=!0,n.autofocus=!0},m(i,u){_(i,e,u),k(e,s),_(i,l,u),_(i,n,u),T(n,r[0]),n.focus(),c||(a=E(n,"input",r[7]),c=!0)},p(i,u){u&256&&t!==(t=i[8])&&d(e,"for",t),u&256&&o!==(o=i[8])&&d(n,"id",o),u&1&&n.value!==i[0]&&T(n,i[0])},d(i){i&&b(e),i&&b(l),i&&b(n),c=!1,a()}}}function Q(r){let e,s,t,l;const n=[K,I],o=[];function c(a,i){return a[2]?0:1}return e=c(r),s=o[e]=n[e](r),{c(){s.c(),t=Y()},m(a,i){o[e].m(a,i),_(a,t,i),l=!0},p(a,i){let u=e;e=c(a),e===u?o[e].p(a,i):(j(),v(o[u],1,1,()=>{o[u]=null}),A(),s=o[e],s?s.p(a,i):(s=o[e]=n[e](a),s.c()),$(s,1),s.m(t.parentNode,t))},i(a){l||($(s),l=!0)},o(a){v(s),l=!1},d(a){o[e].d(a),a&&b(t)}}}function V(r){let e,s;return e=new R({props:{nobranding:!0,$$slots:{default:[Q]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(t,l){U(e,t,l),s=!0},p(t,[l]){const n={};l&527&&(n.$$scope={dirty:l,ctx:t}),e.$set(n)},i(t){s||($(e.$$.fragment,t),s=!0)},o(t){v(e.$$.fragment,t),s=!1},d(t){z(e,t)}}}function X(r,e,s){let t,{params:l}=e,n="",o=!1,c=!1;async function a(){if(!o){s(1,o=!0);try{await F.Users.confirmEmailChange(l==null?void 0:l.token,n),s(2,c=!0)}catch(g){F.errorResponseHandler(g)}s(1,o=!1)}}const i=()=>window.close();function u(){n=this.value,s(0,n)}return r.$$set=g=>{"params"in g&&s(5,l=g.params)},r.$$.update=()=>{r.$$.dirty&32&&s(3,t=W.getJWTPayload(l==null?void 0:l.token).newEmail||"")},[n,o,c,t,a,l,i,u]}class x extends J{constructor(e){super(),M(this,e,X,V,N,{params:5})}}export{x as default};
|
||||
<p>You can now sign in with your new email address.</p></div>`,s=C(),t=m("button"),t.textContent="Close",d(e,"class","alert alert-success"),d(t,"type","button"),d(t,"class","btn btn-secondary btn-block")},m(o,c){_(o,e,c),_(o,s,c),_(o,t,c),l||(n=E(t,"click",r[6]),l=!0)},p:h,i:h,o:h,d(o){o&&b(e),o&&b(s),o&&b(t),l=!1,n()}}}function L(r){let e,s,t;return{c(){e=y("to "),s=m("strong"),t=y(r[3]),d(s,"class","txt-nowrap")},m(l,n){_(l,e,n),_(l,s,n),k(s,t)},p(l,n){n&8&&G(t,l[3])},d(l){l&&b(e),l&&b(s)}}}function O(r){let e,s,t,l,n,o,c,a;return{c(){e=m("label"),s=y("Password"),l=C(),n=m("input"),d(e,"for",t=r[8]),d(n,"type","password"),d(n,"id",o=r[8]),n.required=!0,n.autofocus=!0},m(i,u){_(i,e,u),k(e,s),_(i,l,u),_(i,n,u),T(n,r[0]),n.focus(),c||(a=E(n,"input",r[7]),c=!0)},p(i,u){u&256&&t!==(t=i[8])&&d(e,"for",t),u&256&&o!==(o=i[8])&&d(n,"id",o),u&1&&n.value!==i[0]&&T(n,i[0])},d(i){i&&b(e),i&&b(l),i&&b(n),c=!1,a()}}}function Q(r){let e,s,t,l;const n=[K,I],o=[];function c(a,i){return a[2]?0:1}return e=c(r),s=o[e]=n[e](r),{c(){s.c(),t=Y()},m(a,i){o[e].m(a,i),_(a,t,i),l=!0},p(a,i){let u=e;e=c(a),e===u?o[e].p(a,i):(j(),v(o[u],1,1,()=>{o[u]=null}),A(),s=o[e],s?s.p(a,i):(s=o[e]=n[e](a),s.c()),$(s,1),s.m(t.parentNode,t))},i(a){l||($(s),l=!0)},o(a){v(s),l=!1},d(a){o[e].d(a),a&&b(t)}}}function V(r){let e,s;return e=new U({props:{nobranding:!0,$$slots:{default:[Q]},$$scope:{ctx:r}}}),{c(){S(e.$$.fragment)},m(t,l){z(e,t,l),s=!0},p(t,[l]){const n={};l&527&&(n.$$scope={dirty:l,ctx:t}),e.$set(n)},i(t){s||($(e.$$.fragment,t),s=!0)},o(t){v(e.$$.fragment,t),s=!1},d(t){J(e,t)}}}function X(r,e,s){let t,{params:l}=e,n="",o=!1,c=!1;async function a(){if(!o){s(1,o=!0);try{await F.users.confirmEmailChange(l==null?void 0:l.token,n),s(2,c=!0)}catch(g){F.errorResponseHandler(g)}s(1,o=!1)}}const i=()=>window.close();function u(){n=this.value,s(0,n)}return r.$$set=g=>{"params"in g&&s(5,l=g.params)},r.$$.update=()=>{r.$$.dirty&32&&s(3,t=W.getJWTPayload(l==null?void 0:l.token).newEmail||"")},[n,o,c,t,a,l,i,u]}class x extends M{constructor(e){super(),N(this,e,X,V,R,{params:5})}}export{x as default};
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import{S as W,i as Y,s as j,F as A,c as H,m as N,t as P,a as q,d as S,C as B,E as D,g as _,k as G,n as I,o as m,p as z,q as E,e as b,w as y,b as C,f as c,r as J,h as w,u as h,v as K,y as F,x as O,z as R}from"./index.9681f446.js";function Q(i){let e,l,t,n,s,o,p,a,r,u,v,g,k,L,d=i[4]&&M(i);return o=new E({props:{class:"form-field required",name:"password",$$slots:{default:[X,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),a=new E({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[Z,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),{c(){e=b("form"),l=b("div"),t=b("h4"),n=y(`Reset your user password
|
||||
`),d&&d.c(),s=C(),H(o.$$.fragment),p=C(),H(a.$$.fragment),r=C(),u=b("button"),v=b("span"),v.textContent="Set new password",c(t,"class","m-b-xs"),c(l,"class","content txt-center m-b-sm"),c(v,"class","txt"),c(u,"type","submit"),c(u,"class","btn btn-lg btn-block"),u.disabled=i[2],J(u,"btn-loading",i[2])},m(f,$){_(f,e,$),w(e,l),w(l,t),w(t,n),d&&d.m(t,null),w(e,s),N(o,e,null),w(e,p),N(a,e,null),w(e,r),w(e,u),w(u,v),g=!0,k||(L=h(e,"submit",K(i[5])),k=!0)},p(f,$){f[4]?d?d.p(f,$):(d=M(f),d.c(),d.m(t,null)):d&&(d.d(1),d=null);const T={};$&3073&&(T.$$scope={dirty:$,ctx:f}),o.$set(T);const U={};$&3074&&(U.$$scope={dirty:$,ctx:f}),a.$set(U),(!g||$&4)&&(u.disabled=f[2]),$&4&&J(u,"btn-loading",f[2])},i(f){g||(P(o.$$.fragment,f),P(a.$$.fragment,f),g=!0)},o(f){q(o.$$.fragment,f),q(a.$$.fragment,f),g=!1},d(f){f&&m(e),d&&d.d(),S(o),S(a),k=!1,L()}}}function V(i){let e,l,t,n,s;return{c(){e=b("div"),e.innerHTML=`<div class="icon"><i class="ri-checkbox-circle-line"></i></div>
|
||||
import{S as W,i as Y,s as j,F as A,c as H,m as N,t as P,a as q,d as S,C as B,E as D,g as _,k as G,n as I,o as m,p as E,q as J,e as b,w as y,b as C,f as c,r as M,h as w,u as h,v as K,y as F,x as O,z as R}from"./index.3b658553.js";function Q(i){let e,l,t,n,s,o,p,a,r,u,v,g,k,L,d=i[4]&&U(i);return o=new J({props:{class:"form-field required",name:"password",$$slots:{default:[X,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),a=new J({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[Z,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),{c(){e=b("form"),l=b("div"),t=b("h4"),n=y(`Reset your user password
|
||||
`),d&&d.c(),s=C(),H(o.$$.fragment),p=C(),H(a.$$.fragment),r=C(),u=b("button"),v=b("span"),v.textContent="Set new password",c(t,"class","m-b-xs"),c(l,"class","content txt-center m-b-sm"),c(v,"class","txt"),c(u,"type","submit"),c(u,"class","btn btn-lg btn-block"),u.disabled=i[2],M(u,"btn-loading",i[2])},m(f,$){_(f,e,$),w(e,l),w(l,t),w(t,n),d&&d.m(t,null),w(e,s),N(o,e,null),w(e,p),N(a,e,null),w(e,r),w(e,u),w(u,v),g=!0,k||(L=h(e,"submit",K(i[5])),k=!0)},p(f,$){f[4]?d?d.p(f,$):(d=U(f),d.c(),d.m(t,null)):d&&(d.d(1),d=null);const T={};$&3073&&(T.$$scope={dirty:$,ctx:f}),o.$set(T);const z={};$&3074&&(z.$$scope={dirty:$,ctx:f}),a.$set(z),(!g||$&4)&&(u.disabled=f[2]),$&4&&M(u,"btn-loading",f[2])},i(f){g||(P(o.$$.fragment,f),P(a.$$.fragment,f),g=!0)},o(f){q(o.$$.fragment,f),q(a.$$.fragment,f),g=!1},d(f){f&&m(e),d&&d.d(),S(o),S(a),k=!1,L()}}}function V(i){let e,l,t,n,s;return{c(){e=b("div"),e.innerHTML=`<div class="icon"><i class="ri-checkbox-circle-line"></i></div>
|
||||
<div class="content txt-bold"><p>Password changed</p>
|
||||
<p>You can now sign in with your new password.</p></div>`,l=C(),t=b("button"),t.textContent="Close",c(e,"class","alert alert-success"),c(t,"type","button"),c(t,"class","btn btn-secondary btn-block")},m(o,p){_(o,e,p),_(o,l,p),_(o,t,p),n||(s=h(t,"click",i[7]),n=!0)},p:F,i:F,o:F,d(o){o&&m(e),o&&m(l),o&&m(t),n=!1,s()}}}function M(i){let e,l,t;return{c(){e=y("for "),l=b("strong"),t=y(i[4])},m(n,s){_(n,e,s),_(n,l,s),w(l,t)},p(n,s){s&16&&O(t,n[4])},d(n){n&&m(e),n&&m(l)}}}function X(i){let e,l,t,n,s,o,p,a;return{c(){e=b("label"),l=y("New password"),n=C(),s=b("input"),c(e,"for",t=i[10]),c(s,"type","password"),c(s,"id",o=i[10]),s.required=!0,s.autofocus=!0},m(r,u){_(r,e,u),w(e,l),_(r,n,u),_(r,s,u),R(s,i[0]),s.focus(),p||(a=h(s,"input",i[8]),p=!0)},p(r,u){u&1024&&t!==(t=r[10])&&c(e,"for",t),u&1024&&o!==(o=r[10])&&c(s,"id",o),u&1&&s.value!==r[0]&&R(s,r[0])},d(r){r&&m(e),r&&m(n),r&&m(s),p=!1,a()}}}function Z(i){let e,l,t,n,s,o,p,a;return{c(){e=b("label"),l=y("New password confirm"),n=C(),s=b("input"),c(e,"for",t=i[10]),c(s,"type","password"),c(s,"id",o=i[10]),s.required=!0},m(r,u){_(r,e,u),w(e,l),_(r,n,u),_(r,s,u),R(s,i[1]),p||(a=h(s,"input",i[9]),p=!0)},p(r,u){u&1024&&t!==(t=r[10])&&c(e,"for",t),u&1024&&o!==(o=r[10])&&c(s,"id",o),u&2&&s.value!==r[1]&&R(s,r[1])},d(r){r&&m(e),r&&m(n),r&&m(s),p=!1,a()}}}function x(i){let e,l,t,n;const s=[V,Q],o=[];function p(a,r){return a[3]?0:1}return e=p(i),l=o[e]=s[e](i),{c(){l.c(),t=D()},m(a,r){o[e].m(a,r),_(a,t,r),n=!0},p(a,r){let u=e;e=p(a),e===u?o[e].p(a,r):(G(),q(o[u],1,1,()=>{o[u]=null}),I(),l=o[e],l?l.p(a,r):(l=o[e]=s[e](a),l.c()),P(l,1),l.m(t.parentNode,t))},i(a){n||(P(l),n=!0)},o(a){q(l),n=!1},d(a){o[e].d(a),a&&m(t)}}}function ee(i){let e,l;return e=new A({props:{nobranding:!0,$$slots:{default:[x]},$$scope:{ctx:i}}}),{c(){H(e.$$.fragment)},m(t,n){N(e,t,n),l=!0},p(t,[n]){const s={};n&2079&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(P(e.$$.fragment,t),l=!0)},o(t){q(e.$$.fragment,t),l=!1},d(t){S(e,t)}}}function te(i,e,l){let t,{params:n}=e,s="",o="",p=!1,a=!1;async function r(){if(!p){l(2,p=!0);try{await z.Users.confirmPasswordReset(n==null?void 0:n.token,s,o),l(3,a=!0)}catch(k){z.errorResponseHandler(k)}l(2,p=!1)}}const u=()=>window.close();function v(){s=this.value,l(0,s)}function g(){o=this.value,l(1,o)}return i.$$set=k=>{"params"in k&&l(6,n=k.params)},i.$$.update=()=>{i.$$.dirty&64&&l(4,t=B.getJWTPayload(n==null?void 0:n.token).email||"")},[s,o,p,a,t,r,n,u,v,g]}class le extends W{constructor(e){super(),Y(this,e,te,ee,j,{params:6})}}export{le as default};
|
||||
<p>You can now sign in with your new password.</p></div>`,l=C(),t=b("button"),t.textContent="Close",c(e,"class","alert alert-success"),c(t,"type","button"),c(t,"class","btn btn-secondary btn-block")},m(o,p){_(o,e,p),_(o,l,p),_(o,t,p),n||(s=h(t,"click",i[7]),n=!0)},p:F,i:F,o:F,d(o){o&&m(e),o&&m(l),o&&m(t),n=!1,s()}}}function U(i){let e,l,t;return{c(){e=y("for "),l=b("strong"),t=y(i[4])},m(n,s){_(n,e,s),_(n,l,s),w(l,t)},p(n,s){s&16&&O(t,n[4])},d(n){n&&m(e),n&&m(l)}}}function X(i){let e,l,t,n,s,o,p,a;return{c(){e=b("label"),l=y("New password"),n=C(),s=b("input"),c(e,"for",t=i[10]),c(s,"type","password"),c(s,"id",o=i[10]),s.required=!0,s.autofocus=!0},m(r,u){_(r,e,u),w(e,l),_(r,n,u),_(r,s,u),R(s,i[0]),s.focus(),p||(a=h(s,"input",i[8]),p=!0)},p(r,u){u&1024&&t!==(t=r[10])&&c(e,"for",t),u&1024&&o!==(o=r[10])&&c(s,"id",o),u&1&&s.value!==r[0]&&R(s,r[0])},d(r){r&&m(e),r&&m(n),r&&m(s),p=!1,a()}}}function Z(i){let e,l,t,n,s,o,p,a;return{c(){e=b("label"),l=y("New password confirm"),n=C(),s=b("input"),c(e,"for",t=i[10]),c(s,"type","password"),c(s,"id",o=i[10]),s.required=!0},m(r,u){_(r,e,u),w(e,l),_(r,n,u),_(r,s,u),R(s,i[1]),p||(a=h(s,"input",i[9]),p=!0)},p(r,u){u&1024&&t!==(t=r[10])&&c(e,"for",t),u&1024&&o!==(o=r[10])&&c(s,"id",o),u&2&&s.value!==r[1]&&R(s,r[1])},d(r){r&&m(e),r&&m(n),r&&m(s),p=!1,a()}}}function x(i){let e,l,t,n;const s=[V,Q],o=[];function p(a,r){return a[3]?0:1}return e=p(i),l=o[e]=s[e](i),{c(){l.c(),t=D()},m(a,r){o[e].m(a,r),_(a,t,r),n=!0},p(a,r){let u=e;e=p(a),e===u?o[e].p(a,r):(G(),q(o[u],1,1,()=>{o[u]=null}),I(),l=o[e],l?l.p(a,r):(l=o[e]=s[e](a),l.c()),P(l,1),l.m(t.parentNode,t))},i(a){n||(P(l),n=!0)},o(a){q(l),n=!1},d(a){o[e].d(a),a&&m(t)}}}function ee(i){let e,l;return e=new A({props:{nobranding:!0,$$slots:{default:[x]},$$scope:{ctx:i}}}),{c(){H(e.$$.fragment)},m(t,n){N(e,t,n),l=!0},p(t,[n]){const s={};n&2079&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(P(e.$$.fragment,t),l=!0)},o(t){q(e.$$.fragment,t),l=!1},d(t){S(e,t)}}}function te(i,e,l){let t,{params:n}=e,s="",o="",p=!1,a=!1;async function r(){if(!p){l(2,p=!0);try{await E.users.confirmPasswordReset(n==null?void 0:n.token,s,o),l(3,a=!0)}catch(k){E.errorResponseHandler(k)}l(2,p=!1)}}const u=()=>window.close();function v(){s=this.value,l(0,s)}function g(){o=this.value,l(1,o)}return i.$$set=k=>{"params"in k&&l(6,n=k.params)},i.$$.update=()=>{i.$$.dirty&64&&l(4,t=B.getJWTPayload(n==null?void 0:n.token).email||"")},[s,o,p,a,t,r,n,u,v,g]}class le extends W{constructor(e){super(),Y(this,e,te,ee,j,{params:6})}}export{le as default};
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
import{S as k,i as v,s as y,F as w,c as x,m as C,t as g,a as $,d as L,p as H,E as M,g as r,o as a,e as u,b as m,f,u as _,y as p}from"./index.9681f446.js";function P(o){let t,s,e,n,i;return{c(){t=u("div"),t.innerHTML=`<div class="icon"><i class="ri-error-warning-line"></i></div>
|
||||
import{S as k,i as v,s as y,F as w,c as x,m as C,t as g,a as $,d as L,p as H,E as M,g as r,o as a,e as u,b as m,f,u as _,y as p}from"./index.3b658553.js";function P(o){let t,s,e,n,i;return{c(){t=u("div"),t.innerHTML=`<div class="icon"><i class="ri-error-warning-line"></i></div>
|
||||
<div class="content txt-bold"><p>Invalid or expired verification token.</p></div>`,s=m(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-danger"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(l,c){r(l,t,c),r(l,s,c),r(l,e,c),n||(i=_(e,"click",o[4]),n=!0)},p,d(l){l&&a(t),l&&a(s),l&&a(e),n=!1,i()}}}function S(o){let t,s,e,n,i;return{c(){t=u("div"),t.innerHTML=`<div class="icon"><i class="ri-checkbox-circle-line"></i></div>
|
||||
<div class="content txt-bold"><p>Successfully verified email address.</p></div>`,s=m(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-success"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(l,c){r(l,t,c),r(l,s,c),r(l,e,c),n||(i=_(e,"click",o[3]),n=!0)},p,d(l){l&&a(t),l&&a(s),l&&a(e),n=!1,i()}}}function T(o){let t;return{c(){t=u("div"),t.innerHTML='<div class="loader loader-lg"><em>Please wait...</em></div>',f(t,"class","txt-center")},m(s,e){r(s,t,e)},p,d(s){s&&a(t)}}}function F(o){let t;function s(i,l){return i[1]?T:i[0]?S:P}let e=s(o),n=e(o);return{c(){n.c(),t=M()},m(i,l){n.m(i,l),r(i,t,l)},p(i,l){e===(e=s(i))&&n?n.p(i,l):(n.d(1),n=e(i),n&&(n.c(),n.m(t.parentNode,t)))},d(i){n.d(i),i&&a(t)}}}function U(o){let t,s;return t=new w({props:{nobranding:!0,$$slots:{default:[F]},$$scope:{ctx:o}}}),{c(){x(t.$$.fragment)},m(e,n){C(t,e,n),s=!0},p(e,[n]){const i={};n&67&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){s||(g(t.$$.fragment,e),s=!0)},o(e){$(t.$$.fragment,e),s=!1},d(e){L(t,e)}}}function V(o,t,s){let{params:e}=t,n=!1,i=!1;l();async function l(){s(1,i=!0);try{await H.Users.confirmVerification(e==null?void 0:e.token),s(0,n=!0)}catch(d){console.warn(d),s(0,n=!1)}s(1,i=!1)}const c=()=>window.close(),b=()=>window.close();return o.$$set=d=>{"params"in d&&s(2,e=d.params)},[n,i,e,c,b]}class E extends k{constructor(t){super(),v(this,t,V,U,y,{params:2})}}export{E as default};
|
||||
<div class="content txt-bold"><p>Successfully verified email address.</p></div>`,s=m(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-success"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(l,c){r(l,t,c),r(l,s,c),r(l,e,c),n||(i=_(e,"click",o[3]),n=!0)},p,d(l){l&&a(t),l&&a(s),l&&a(e),n=!1,i()}}}function T(o){let t;return{c(){t=u("div"),t.innerHTML='<div class="loader loader-lg"><em>Please wait...</em></div>',f(t,"class","txt-center")},m(s,e){r(s,t,e)},p,d(s){s&&a(t)}}}function F(o){let t;function s(i,l){return i[1]?T:i[0]?S:P}let e=s(o),n=e(o);return{c(){n.c(),t=M()},m(i,l){n.m(i,l),r(i,t,l)},p(i,l){e===(e=s(i))&&n?n.p(i,l):(n.d(1),n=e(i),n&&(n.c(),n.m(t.parentNode,t)))},d(i){n.d(i),i&&a(t)}}}function V(o){let t,s;return t=new w({props:{nobranding:!0,$$slots:{default:[F]},$$scope:{ctx:o}}}),{c(){x(t.$$.fragment)},m(e,n){C(t,e,n),s=!0},p(e,[n]){const i={};n&67&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){s||(g(t.$$.fragment,e),s=!0)},o(e){$(t.$$.fragment,e),s=!1},d(e){L(t,e)}}}function q(o,t,s){let{params:e}=t,n=!1,i=!1;l();async function l(){s(1,i=!0);try{await H.users.confirmVerification(e==null?void 0:e.token),s(0,n=!0)}catch(d){console.warn(d),s(0,n=!1)}s(1,i=!1)}const c=()=>window.close(),b=()=>window.close();return o.$$set=d=>{"params"in d&&s(2,e=d.params)},[n,i,e,c,b]}class I extends k{constructor(t){super(),v(this,t,q,V,y,{params:2})}}export{I as default};
|
||||
@@ -1 +1 @@
|
||||
@font-face{font-family:remixicon;src:url(../fonts/remixicon/remixicon.woff2?v=1) format("woff2"),url(../fonts/remixicon/remixicon.woff?v=1) format("woff"),url(../fonts/remixicon/remixicon.ttf?v=1) format("truetype"),url(../fonts/remixicon/remixicon.svg?v=1#remixicon) format("svg");font-display:swap}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:400;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-regular.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-regular.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:400;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-italic.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:600;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:600;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600italic.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:700;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:700;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700italic.woff) format("woff")}@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:400;src:local(""),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-regular.woff2) format("woff2"),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-regular.woff) format("woff")}@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:600;src:local(""),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-600.woff2) format("woff2"),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-600.woff) format("woff")}:root{--baseFontFamily: "Source Sans Pro", sans-serif, emoji;--monospaceFontFamily: "Ubuntu Mono", monospace, emoji;--iconFontFamily: "remixicon";--txtPrimaryColor: #16161a;--txtHintColor: #666f75;--txtDisabledColor: #adb3b8;--primaryColor: #16161a;--bodyColor: #f8f9fa;--baseColor: #ffffff;--baseAlt1Color: #edf0f3;--baseAlt2Color: #dee3e8;--baseAlt3Color: #a9b4bc;--baseAlt4Color: #7c868d;--infoColor: #3da9fc;--infoAltColor: #d8eefe;--successColor: #2cb67d;--successAltColor: #d6f5e8;--dangerColor: #ef4565;--dangerAltColor: #fcdee4;--warningColor: #ff8e3c;--warningAltColor: #ffe7d6;--overlayColor: rgba(88, 95, 101, .3);--tooltipColor: rgba(0, 0, 0, .85);--shadowColor: rgba(0, 0, 0, .05);--baseFontSize: 14.5px;--xsFontSize: 12px;--smFontSize: 13px;--lgFontSize: 15px;--xlFontSize: 16px;--baseLineHeight: 22px;--smLineHeight: 16px;--lgLineHeight: 24px;--inputHeight: 34px;--btnHeight: 40px;--xsBtnHeight: 24px;--smBtnHeight: 30px;--lgBtnHeight: 54px;--baseSpacing: 30px;--xsSpacing: 15px;--smSpacing: 20px;--lgSpacing: 50px;--xlSpacing: 60px;--wrapperWidth: 850px;--smWrapperWidth: 420px;--lgWrapperWidth: 1200px;--appSidebarWidth: 75px;--pageSidebarWidth: 220px;--baseAnimationSpeed: .15s;--activeAnimationSpeed: 70ms;--baseRadius: 3px;--lgRadius: 12px;--btnRadius: 3px;accent-color:var(--primaryColor)}html,body,div,span,applet,object,iframe,h1,h2,.breadcrumbs .breadcrumb-item,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}i{font-family:remixicon!important;font-style:normal;font-weight:400;font-size:1.1238rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}i:before{vertical-align:top;margin-top:1px;display:inline-block}.ri-24-hours-fill:before{content:"\ea01"}.ri-24-hours-line:before{content:"\ea02"}.ri-4k-fill:before{content:"\ea03"}.ri-4k-line:before{content:"\ea04"}.ri-a-b:befoLine truncated
|
||||
@font-face{font-family:remixicon;src:url(../fonts/remixicon/remixicon.woff2?v=1) format("woff2"),url(../fonts/remixicon/remixicon.woff?v=1) format("woff"),url(../fonts/remixicon/remixicon.ttf?v=1) format("truetype"),url(../fonts/remixicon/remixicon.svg?v=1#remixicon) format("svg");font-display:swap}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:400;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-regular.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-regular.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:400;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-italic.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:600;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:600;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600italic.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:700;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:700;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700italic.woff) format("woff")}@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:400;src:local(""),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-regular.woff2) format("woff2"),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-regular.woff) format("woff")}@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:600;src:local(""),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-600.woff2) format("woff2"),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-600.woff) format("woff")}:root{--baseFontFamily: "Source Sans Pro", sans-serif, emoji;--monospaceFontFamily: "Ubuntu Mono", monospace, emoji;--iconFontFamily: "remixicon";--txtPrimaryColor: #16161a;--txtHintColor: #666f75;--txtDisabledColor: #adb3b8;--primaryColor: #16161a;--bodyColor: #f8f9fa;--baseColor: #ffffff;--baseAlt1Color: #edf0f3;--baseAlt2Color: #dee3e8;--baseAlt3Color: #a9b4bc;--baseAlt4Color: #7c868d;--infoColor: #3da9fc;--infoAltColor: #d8eefe;--successColor: #2cb67d;--successAltColor: #d6f5e8;--dangerColor: #ef4565;--dangerAltColor: #fcdee4;--warningColor: #ff8e3c;--warningAltColor: #ffe7d6;--overlayColor: rgba(70, 85, 100, .3);--tooltipColor: rgba(0, 0, 0, .85);--shadowColor: rgba(0, 0, 0, .05);--baseFontSize: 14.5px;--xsFontSize: 12px;--smFontSize: 13px;--lgFontSize: 15px;--xlFontSize: 16px;--baseLineHeight: 22px;--smLineHeight: 16px;--lgLineHeight: 24px;--inputHeight: 34px;--btnHeight: 40px;--xsBtnHeight: 24px;--smBtnHeight: 30px;--lgBtnHeight: 54px;--baseSpacing: 30px;--xsSpacing: 15px;--smSpacing: 20px;--lgSpacing: 50px;--xlSpacing: 60px;--wrapperWidth: 850px;--smWrapperWidth: 420px;--lgWrapperWidth: 1200px;--appSidebarWidth: 75px;--pageSidebarWidth: 220px;--baseAnimationSpeed: .15s;--activeAnimationSpeed: 70ms;--baseRadius: 3px;--lgRadius: 12px;--btnRadius: 3px;accent-color:var(--primaryColor)}html,body,div,span,applet,object,iframe,h1,h2,.breadcrumbs .breadcrumb-item,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}i{font-family:remixicon!important;font-style:normal;font-weight:400;font-size:1.1238rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}i:before{vertical-align:top;margin-top:1px;display:inline-block}.ri-24-hours-fill:before{content:"\ea01"}.ri-24-hours-line:before{content:"\ea02"}.ri-4k-fill:before{content:"\ea03"}.ri-4k-line:before{content:"\ea04"}.ri-a-b:befoLine truncated
|
||||
Vendored
+638
@@ -0,0 +1,638 @@
|
||||
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerpolicy&&(l.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?l.credentials="include":s.crossorigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=t(s);fetch(s.href,l)}})();function re(){}const gl=n=>n;function pt(n,e){for(const t in e)n[t]=e[t];return n}function lm(n){return n()}function Za(){return Object.create(null)}function Qe(n){n.forEach(lm)}function Kn(n){return typeof n=="function"}function De(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let Ll;function xn(n,e){return Ll||(Ll=document.createElement("a")),Ll.href=e,n===Ll.href}function R_(n){return Object.keys(n).length===0}function om(n,...e){if(n==null)return re;const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function kt(n,e,t){n.$$.on_destroy.push(om(e,t))}function wn(n,e,t,i){if(n){const s=rm(n,e,t,i);return n[0](s)}}function rm(n,e,t,i){return n[1]&&i?pt(t.ctx.slice(),n[1](i(e))):t.ctx}function $n(n,e,t,i){if(n[2]&&i){const s=n[2](i(t));if(e.dirty===void 0)return s;if(typeof s=="object"){const l=[],o=Math.max(e.dirty.length,s.length);for(let r=0;r<o;r+=1)l[r]=e.dirty[r]|s[r];return l}return e.dirty|s}return e.dirty}function Sn(n,e,t,i,s,l){if(s){const o=rm(e,t,i,l);n.p(o,s)}}function Cn(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let i=0;i<t;i++)e[i]=-1;return e}return-1}function di(n){const e={};for(const t in n)t[0]!=="$"&&(e[t]=n[t]);return e}function Jt(n,e){const t={};e=new Set(e);for(const i in n)!e.has(i)&&i[0]!=="$"&&(t[i]=n[i]);return t}function Ja(n){return n==null?"":n}function dn(n,e,t){return n.set(t),e}function Ye(n){return n&&Kn(n.destroy)?n.destroy:re}const am=typeof window<"u";let Lo=am?()=>window.performance.now():()=>Date.now(),la=am?n=>requestAnimationFrame(n):re;const bs=new Set;function um(n){bs.forEach(e=>{e.c(n)||(bs.delete(e),e.f())}),bs.size!==0&&la(um)}function Io(n){let e;return bs.size===0&&la(um),{promise:new Promise(t=>{bs.add(e={c:n,f:t})}),abort(){bs.delete(e)}}}function g(n,e){n.appendChild(e)}function fm(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function H_(n){const e=_("style");return j_(fm(n),e),e.sheet}function j_(n,e){g(n.head||n,e)}function w(n,e,t){n.insertBefore(e,t||null)}function k(n){n.parentNode.removeChild(n)}function xt(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function _(n){return document.createElement(n)}function F(n){return document.createTextNode(n)}function T(){return F(" ")}function Je(){return F("")}function G(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function Yt(n){return function(e){return e.preventDefault(),n.call(this,e)}}function ei(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function cm(n){return function(e){e.target===this&&n.call(this,e)}}function p(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function fi(n,e){const t=Object.getOwnPropertyDescriptors(n.__proto__);for(const i in e)e[i]==null?n.removeAttribute(i):i==="style"?n.style.cssText=e[i]:i==="__value"?n.value=n[i]=e[i]:t[i]&&t[i].set?n[i]=e[i]:p(n,i,e[i])}function At(n){return n===""?null:+n}function q_(n){return Array.from(n.childNodes)}function ue(n,e){e=""+e,n.wholeText!==e&&(n.data=e)}function Me(n,e){n.value=e==null?"":e}function Ga(n,e,t,i){t===null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function ie(n,e,t){n.classList[t?"add":"remove"](e)}function dm(n,e,{bubbles:t=!1,cancelable:i=!1}={}){const s=document.createEvent("CustomEvent");return s.initCustomEvent(n,t,i,e),s}const ao=new Map;let uo=0;function V_(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function z_(n,e){const t={stylesheet:H_(e),rules:{}};return ao.set(n,t),t}function ol(n,e,t,i,s,l,o,r=0){const a=16.666/i;let u=`{
|
||||
`;for(let b=0;b<=1;b+=a){const y=e+(t-e)*l(b);u+=b*100+`%{${o(y,1-y)}}
|
||||
`}const f=u+`100% {${o(t,1-t)}}
|
||||
}`,c=`__svelte_${V_(f)}_${r}`,d=fm(n),{stylesheet:h,rules:m}=ao.get(d)||z_(d,n);m[c]||(m[c]=!0,h.insertRule(`@keyframes ${c} ${f}`,h.cssRules.length));const v=n.style.animation||"";return n.style.animation=`${v?`${v}, `:""}${c} ${i}ms linear ${s}ms 1 both`,uo+=1,c}function rl(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?l=>l.indexOf(e)<0:l=>l.indexOf("__svelte")===-1),s=t.length-i.length;s&&(n.style.animation=i.join(", "),uo-=s,uo||B_())}function B_(){la(()=>{uo||(ao.forEach(n=>{const{stylesheet:e}=n;let t=e.cssRules.length;for(;t--;)e.deleteRule(t);n.rules={}}),ao.clear())})}function U_(n,e,t,i){if(!e)return re;const s=n.getBoundingClientRect();if(e.left===s.left&&e.right===s.right&&e.top===s.top&&e.bottom===s.bottom)return re;const{delay:l=0,duration:o=300,easing:r=gl,start:a=Lo()+l,end:u=a+o,tick:f=re,css:c}=t(n,{from:e,to:s},i);let d=!0,h=!1,m;function v(){c&&(m=ol(n,0,1,o,l,r,c)),l||(h=!0)}function b(){c&&rl(n,m),d=!1}return Io(y=>{if(!h&&y>=a&&(h=!0),h&&y>=u&&(f(1,0),b()),!d)return!1;if(h){const S=y-a,C=0+1*r(S/o);f(C,1-C)}return!0}),v(),f(0,1),b}function W_(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,s=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,pm(n,s)}}function pm(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),s=i.transform==="none"?"":i.transform;n.style.transform=`${s} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let al;function Xs(n){al=n}function Fo(){if(!al)throw new Error("Function called outside component initialization");return al}function Zn(n){Fo().$$.on_mount.push(n)}function Y_(n){Fo().$$.after_update.push(n)}function K_(n){Fo().$$.on_destroy.push(n)}function on(){const n=Fo();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=dm(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(n,l)}),!l.defaultPrevented}return!0}}function ut(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const Ys=[],he=[],no=[],Tr=[],hm=Promise.resolve();let Dr=!1;function mm(){Dr||(Dr=!0,hm.then(gm))}function ni(){return mm(),hm}function Dt(n){no.push(n)}function He(n){Tr.push(n)}const Qo=new Set;let Il=0;function gm(){const n=al;do{for(;Il<Ys.length;){const e=Ys[Il];Il++,Xs(e),Z_(e.$$)}for(Xs(null),Ys.length=0,Il=0;he.length;)he.pop()();for(let e=0;e<no.length;e+=1){const t=no[e];Qo.has(t)||(Qo.add(t),t())}no.length=0}while(Ys.length);for(;Tr.length;)Tr.pop()();Dr=!1,Qo.clear(),Xs(n)}function Z_(n){if(n.fragment!==null){n.update(),Qe(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Dt)}}let Is;function oa(){return Is||(Is=Promise.resolve(),Is.then(()=>{Is=null})),Is}function es(n,e,t){n.dispatchEvent(dm(`${e?"intro":"outro"}${t}`))}const io=new Set;let oi;function Pe(){oi={r:0,c:[],p:oi}}function Le(){oi.r||Qe(oi.c),oi=oi.p}function E(n,e){n&&n.i&&(io.delete(n),n.i(e))}function P(n,e,t,i){if(n&&n.o){if(io.has(n))return;io.add(n),oi.c.push(()=>{io.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const ra={duration:0};function _m(n,e,t){let i=e(n,t),s=!1,l,o,r=0;function a(){l&&rl(n,l)}function u(){const{delay:c=0,duration:d=300,easing:h=gl,tick:m=re,css:v}=i||ra;v&&(l=ol(n,0,1,d,c,h,v,r++)),m(0,1);const b=Lo()+c,y=b+d;o&&o.abort(),s=!0,Dt(()=>es(n,!0,"start")),o=Io(S=>{if(s){if(S>=y)return m(1,0),es(n,!0,"end"),a(),s=!1;if(S>=b){const C=h((S-b)/d);m(C,1-C)}}return s})}let f=!1;return{start(){f||(f=!0,rl(n),Kn(i)?(i=i(),oa().then(u)):u())},invalidate(){f=!1},end(){s&&(a(),s=!1)}}}function bm(n,e,t){let i=e(n,t),s=!0,l;const o=oi;o.r+=1;function r(){const{delay:a=0,duration:u=300,easing:f=gl,tick:c=re,css:d}=i||ra;d&&(l=ol(n,1,0,u,a,f,d));const h=Lo()+a,m=h+u;Dt(()=>es(n,!1,"start")),Io(v=>{if(s){if(v>=m)return c(0,1),es(n,!1,"end"),--o.r||Qe(o.c),!1;if(v>=h){const b=f((v-h)/u);c(1-b,b)}}return s})}return Kn(i)?oa().then(()=>{i=i(),r()}):r(),{end(a){a&&i.tick&&i.tick(1,0),s&&(l&&rl(n,l),s=!1)}}}function rt(n,e,t,i){let s=e(n,t),l=i?0:1,o=null,r=null,a=null;function u(){a&&rl(n,a)}function f(d,h){const m=d.b-l;return h*=Math.abs(m),{a:l,b:d.b,d:m,duration:h,start:d.start,end:d.start+h,group:d.group}}function c(d){const{delay:h=0,duration:m=300,easing:v=gl,tick:b=re,css:y}=s||ra,S={start:Lo()+h,b:d};d||(S.group=oi,oi.r+=1),o||r?r=S:(y&&(u(),a=ol(n,l,d,m,h,v,y)),d&&b(0,1),o=f(S,m),Dt(()=>es(n,d,"start")),Io(C=>{if(r&&C>r.start&&(o=f(r,m),r=null,es(n,o.b,"start"),y&&(u(),a=ol(n,l,o.b,o.duration,0,v,s.css))),o){if(C>=o.end)b(l=o.b,1-l),es(n,o.b,"end"),r||(o.b?u():--o.group.r||Qe(o.group.c)),o=null;else if(C>=o.start){const $=C-o.start;l=o.a+o.d*v($/o.duration),b(l,1-l)}}return!!(o||r)}))}return{run(d){Kn(s)?oa().then(()=>{s=s(),c(d)}):c(d)},end(){u(),o=r=null}}}function Mn(n,e){n.d(1),e.delete(n.key)}function Gt(n,e){P(n,1,1,()=>{e.delete(n.key)})}function J_(n,e){n.f(),Gt(n,e)}function bt(n,e,t,i,s,l,o,r,a,u,f,c){let d=n.length,h=
Line truncated
|
||||
<span class="txt">Pocket<strong>Base</strong></span></figure>`,t=T(),i=_("div"),p(e,"class","block txt-center m-b-lg"),p(i,"class","clearfix")},m(s,l){w(s,e,l),w(s,t,l),w(s,i,l)},d(s){s&&k(e),s&&k(t),s&&k(i)}}}function b1(n){let e,t,i,s=!n[0]&&Du();const l=n[1].default,o=wn(l,n,n[2],null);return{c(){e=_("div"),s&&s.c(),t=T(),o&&o.c(),p(e,"class","wrapper wrapper-sm m-b-xl panel-wrapper svelte-lxxzfu")},m(r,a){w(r,e,a),s&&s.m(e,null),g(e,t),o&&o.m(e,null),i=!0},p(r,a){r[0]?s&&(s.d(1),s=null):s||(s=Du(),s.c(),s.m(e,t)),o&&o.p&&(!i||a&4)&&Sn(o,l,r,r[2],i?$n(l,r[2],a,null):Cn(r[2]),null)},i(r){i||(E(o,r),i=!0)},o(r){P(o,r),i=!1},d(r){r&&k(e),s&&s.d(),o&&o.d(r)}}}function v1(n){let e,t;return e=new Dn({props:{class:"full-page",center:!0,$$slots:{default:[b1]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,[s]){const l={};s&5&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function y1(n,e,t){let{$$slots:i={},$$scope:s}=e,{nobranding:l=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,l=o.nobranding),"$$scope"in o&&t(2,s=o.$$scope)},[l,i,s]}class Dg extends Ee{constructor(e){super(),Oe(this,e,y1,v1,De,{nobranding:0})}}function Ou(n,e,t){const i=n.slice();return i[11]=e[t],i}const k1=n=>({}),Eu=n=>({uniqueId:n[3]});function w1(n){let e=(n[11]||_o)+"",t;return{c(){t=F(e)},m(i,s){w(i,t,s)},p(i,s){s&4&&e!==(e=(i[11]||_o)+"")&&ue(t,e)},d(i){i&&k(t)}}}function $1(n){var s,l;let e,t=(((s=n[11])==null?void 0:s.message)||((l=n[11])==null?void 0:l.code)||_o)+"",i;return{c(){e=_("pre"),i=F(t)},m(o,r){w(o,e,r),g(e,i)},p(o,r){var a,u;r&4&&t!==(t=(((a=o[11])==null?void 0:a.message)||((u=o[11])==null?void 0:u.code)||_o)+"")&&ue(i,t)},d(o){o&&k(e)}}}function Au(n){let e,t;function i(o,r){return typeof o[11]=="object"?$1:w1}let s=i(n),l=s(n);return{c(){e=_("div"),l.c(),t=T(),p(e,"class","help-block help-block-error")},m(o,r){w(o,e,r),l.m(e,null),g(e,t)},p(o,r){s===(s=i(o))&&l?l.p(o,r):(l.d(1),l=s(o),l&&(l.c(),l.m(e,t)))},d(o){o&&k(e),l.d()}}}function S1(n){let e,t,i,s,l;const o=n[7].default,r=wn(o,n,n[6],Eu);let a=n[2],u=[];for(let f=0;f<a.length;f+=1)u[f]=Au(Ou(n,a,f));return{c(){e=_("div"),r&&r.c(),t=T();for(let f=0;f<u.length;f+=1)u[f].c();p(e,"class",n[0]),ie(e,"error",n[2].length)},m(f,c){w(f,e,c),r&&r.m(e,null),g(e,t);for(let d=0;d<u.length;d+=1)u[d].m(e,null);n[9](e),i=!0,s||(l=G(e,"click",n[8]),s=!0)},p(f,[c]){if(r&&r.p&&(!i||c&64)&&Sn(r,o,f,f[6],i?$n(o,f[6],c,k1):Cn(f[6]),Eu),c&4){a=f[2];let d;for(d=0;d<a.length;d+=1){const h=Ou(f,a,d);u[d]?u[d].p(h,c):(u[d]=Au(h),u[d].c(),u[d].m(e,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}(!i||c&1)&&p(e,"class",f[0]),c&5&&ie(e,"error",f[2].length)},i(f){i||(E(r,f),i=!0)},o(f){P(r,f),i=!1},d(f){f&&k(e),r&&r.d(f),xt(u,f),n[9](null),s=!1,l()}}}const _o="Invalid value";function C1(n,e,t){let i;kt(n,as,m=>t(5,i=m));let{$$slots:s={},$$scope:l}=e;const o="field_"+U.randomString(7);let{name:r=""}=e,{class:a=void 0}=e,u,f=[];function c(){Tg(r)}Zn(()=>(u.addEventListener("input",c),u.addEventListener("change",c),()=>{u.removeEventListener("input",c),u.removeEventListener("change",c)}));function d(m){ut.call(this,n,m)}function h(m){he[m?"unshift":"push"](()=>{u=m,t(1,u)})}return n.$$set=m=>{"name"in m&&t(4,r=m.name),"class"in m&&t(0,a=m.class),"$$scope"in m&&t(6,l=m.$$scope)},n.$$.update=()=>{n.$$.dirty&48&&t(2,f=U.toArray(U.getNestedVal(i,r)))},[a,u,f,o,r,i,l,s,d,h]}class Ne extends Ee{constructor(e){super(),Oe(this,e,C1,S1,De,{name:4,class:0})}}function M1(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Email"),s=T(),l=_("input"),p(e,"for",i=n[9]),p(l,"type","email"),p(l,"autocomplete","off"),p(l,"id",o=n[9]),l.required=!0,l.autofocus=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0]),l.focus(),r||(a=G(l,"input",n[5]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&o!==(o=u[9])&&p(l,"id",o),f&1&&l.value!==u[0]&&Me(l,u[0])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function T1(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=F("Password"),s=T(),l=_("input"),r=T(),a=_("div"),a.textContent="Minimum 10 characters.",p(e,"for",i=n[9]),p(l,"type","password"),p(l,"autocomplete","new-password"),p(l,"minlength","10"),p(l,"id",o=n[9]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),g(e,t),w(c,s,d),w(c,l,d),Me(l,n[1]),w(c,r,d),w(c,a,d),u||(f=G(l,"input",n[6]),u=!0)},p(c,d){d&512&&i!==(i=c[9])&&p(e,"for",i),d&512&&o!==(o=c[9])&&p(l,"id",o),d&2&&l.value!==c[1]&&Me(l,c[1])},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function D1(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Password confirm"),s=T(),l=_("input"),p(e,"for",i=n[9]),p(l,"type","password"),p(l,"minlength","10"),p(l,"id",o=n[9]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[2]),r||(a=G(l,"input",n[7]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&o!==(o=u[9])&&p(l,"id",o),f&4&&l.value!==u[2]&&Me(l,u[2])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function O1(n){Line truncated
|
||||
<i class="ri-arrow-right-line"></i>`,p(t,"class","content txt-center m-b-base"),p(f,"type","submit"),p(f,"class","btn btn-lg btn-block btn-next"),ie(f,"btn-disabled",n[3]),ie(f,"btn-loading",n[3]),p(e,"class","block"),p(e,"autocomplete","off")},m(m,v){w(m,e,v),g(e,t),g(e,i),j(s,e,null),g(e,l),j(o,e,null),g(e,r),j(a,e,null),g(e,u),g(e,f),c=!0,d||(h=G(e,"submit",Yt(n[4])),d=!0)},p(m,[v]){const b={};v&1537&&(b.$$scope={dirty:v,ctx:m}),s.$set(b);const y={};v&1538&&(y.$$scope={dirty:v,ctx:m}),o.$set(y);const S={};v&1540&&(S.$$scope={dirty:v,ctx:m}),a.$set(S),v&8&&ie(f,"btn-disabled",m[3]),v&8&&ie(f,"btn-loading",m[3])},i(m){c||(E(s.$$.fragment,m),E(o.$$.fragment,m),E(a.$$.fragment,m),c=!0)},o(m){P(s.$$.fragment,m),P(o.$$.fragment,m),P(a.$$.fragment,m),c=!1},d(m){m&&k(e),q(s),q(o),q(a),d=!1,h()}}}function E1(n,e,t){const i=on();let s="",l="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await ve.admins.create({email:s,password:l,passwordConfirm:o}),await ve.admins.authViaEmail(s,l),i("submit")}catch(d){ve.errorResponseHandler(d)}t(3,r=!1)}}function u(){s=this.value,t(0,s)}function f(){l=this.value,t(1,l)}function c(){o=this.value,t(2,o)}return[s,l,o,r,a,u,f,c]}class A1 extends Ee{constructor(e){super(),Oe(this,e,E1,O1,De,{})}}function Pu(n){let e,t;return e=new Dg({props:{$$slots:{default:[P1]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,s){const l={};s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function P1(n){let e,t;return e=new A1({}),e.$on("submit",n[1]),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p:re,i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function L1(n){let e,t,i=n[0]&&Pu(n);return{c(){i&&i.c(),e=Je()},m(s,l){i&&i.m(s,l),w(s,e,l),t=!0},p(s,[l]){s[0]?i?(i.p(s,l),l&1&&E(i,1)):(i=Pu(s),i.c(),E(i,1),i.m(e.parentNode,e)):i&&(Pe(),P(i,1,1,()=>{i=null}),Le())},i(s){t||(E(i),t=!0)},o(s){P(i),t=!1},d(s){i&&i.d(s),s&&k(e)}}}function I1(n,e,t){let i=!1;s();function s(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){ve.logout(!1),t(0,i=!0);return}ve.authStore.isValid?$i("/collections"):ve.logout()}return[i,async()=>{t(0,i=!1),await ni(),window.location.search=""}]}class F1 extends Ee{constructor(e){super(),Oe(this,e,I1,L1,De,{})}}const Rt=ii(""),bo=ii("");function zo(n){const e=n-1;return e*e*e+1}function vo(n,{delay:e=0,duration:t=400,easing:i=gl}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function Bn(n,{delay:e=0,duration:t=400,easing:i=zo,x:s=0,y:l=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,u=r.transform==="none"?"":r.transform,f=a*(1-o);return{delay:e,duration:t,easing:i,css:(c,d)=>`
|
||||
transform: ${u} translate(${(1-c)*s}px, ${(1-c)*l}px);
|
||||
opacity: ${a-f*d}`}}function tn(n,{delay:e=0,duration:t=400,easing:i=zo}={}){const s=getComputedStyle(n),l=+s.opacity,o=parseFloat(s.height),r=parseFloat(s.paddingTop),a=parseFloat(s.paddingBottom),u=parseFloat(s.marginTop),f=parseFloat(s.marginBottom),c=parseFloat(s.borderTopWidth),d=parseFloat(s.borderBottomWidth);return{delay:e,duration:t,easing:i,css:h=>`overflow: hidden;opacity: ${Math.min(h*20,1)*l};height: ${h*o}px;padding-top: ${h*r}px;padding-bottom: ${h*a}px;margin-top: ${h*u}px;margin-bottom: ${h*f}px;border-top-width: ${h*c}px;border-bottom-width: ${h*d}px;`}}function Un(n,{delay:e=0,duration:t=400,easing:i=zo,start:s=0,opacity:l=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,u=1-s,f=r*(1-l);return{delay:e,duration:t,easing:i,css:(c,d)=>`
|
||||
transform: ${a} scale(${1-u*d});
|
||||
opacity: ${r-f*d}
|
||||
`}}function N1(n){let e,t,i,s;return{c(){e=_("input"),p(e,"type","text"),p(e,"id",n[8]),p(e,"placeholder",t=n[0]||n[1])},m(l,o){w(l,e,o),n[13](e),Me(e,n[7]),i||(s=G(e,"input",n[14]),i=!0)},p(l,o){o&3&&t!==(t=l[0]||l[1])&&p(e,"placeholder",t),o&128&&e.value!==l[7]&&Me(e,l[7])},i:re,o:re,d(l){l&&k(e),n[13](null),i=!1,s()}}}function R1(n){let e,t,i,s;function l(a){n[12](a)}var o=n[4];function r(a){let u={singleLine:!0,disableRequestKeys:!0,disableIndirectCollectionsKeys:!0,extraAutocompleteKeys:a[3],baseCollection:a[2],placeholder:a[0]||a[1]};return a[7]!==void 0&&(u.value=a[7]),{props:u}}return o&&(e=new o(r(n)),he.push(()=>Re(e,"value",l)),e.$on("submit",n[10])),{c(){e&&V(e.$$.fragment),i=Je()},m(a,u){e&&j(e,a,u),w(a,i,u),s=!0},p(a,u){const f={};if(u&8&&(f.extraAutocompleteKeys=a[3]),u&4&&(f.baseCollection=a[2]),u&3&&(f.placeholder=a[0]||a[1]),!t&&u&128&&(t=!0,f.value=a[7],He(()=>t=!1)),o!==(o=a[4])){if(e){Pe();const c=e;P(c.$$.fragment,1,0,()=>{q(c,1)}),Le()}o?(e=new o(r(a)),he.push(()=>Re(e,"value",l)),e.$on("submit",a[10]),V(e.$$.fragment),E(e.$$.fragment,1),j(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&E(e.$$.fragment,a),s=!0)},o(a){e&&P(e.$$.fragment,a),s=!1},d(a){a&&k(i),e&&q(e,a)}}}function Lu(n){let e,t,i,s,l,o,r=n[7]!==n[0]&&Iu();return{c(){r&&r.c(),e=T(),t=_("button"),t.innerHTML='<span class="txt">Clear</span>',p(t,"type","button"),p(t,"class","btn btn-secondary btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(a,u){r&&r.m(a,u),w(a,e,u),w(a,t,u),s=!0,l||(o=G(t,"click",n[15]),l=!0)},p(a,u){a[7]!==a[0]?r?u&129&&E(r,1):(r=Iu(),r.c(),E(r,1),r.m(e.parentNode,e)):r&&(Pe(),P(r,1,1,()=>{r=null}),Le())},i(a){s||(E(r),a&&Dt(()=>{i||(i=rt(t,Bn,{duration:150,x:5},!0)),i.run(1)}),s=!0)},o(a){P(r),a&&(i||(i=rt(t,Bn,{duration:150,x:5},!1)),i.run(0)),s=!1},d(a){r&&r.d(a),a&&k(e),a&&k(t),a&&i&&i.end(),l=!1,o()}}}function Iu(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Search</span>',p(e,"type","submit"),p(e,"class","btn btn-expanded btn-sm btn-warning")},m(s,l){w(s,e,l),i=!0},i(s){i||(s&&Dt(()=>{t||(t=rt(e,Bn,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){s&&(t||(t=rt(e,Bn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function H1(n){let e,t,i,s,l,o,r,a,u,f,c;const d=[R1,N1],h=[];function m(b,y){return b[4]&&!b[5]?0:1}o=m(n),r=h[o]=d[o](n);let v=(n[0].length||n[7].length)&&Lu(n);return{c(){e=_("div"),t=_("form"),i=_("label"),s=_("i"),l=T(),r.c(),a=T(),v&&v.c(),p(s,"class","ri-search-line"),p(i,"for",n[8]),p(i,"class","m-l-10 txt-xl"),p(t,"class","searchbar"),p(e,"class","searchbar-wrapper")},m(b,y){w(b,e,y),g(e,t),g(t,i),g(i,s),g(t,l),h[o].m(t,null),g(t,a),v&&v.m(t,null),u=!0,f||(c=[G(t,"submit",Yt(n[10])),G(e,"click",ei(n[11]))],f=!0)},p(b,[y]){let S=o;o=m(b),o===S?h[o].p(b,y):(Pe(),P(h[S],1,1,()=>{h[S]=null}),Le(),r=h[o],r?r.p(b,y):(r=h[o]=d[o](b),r.c()),E(r,1),r.m(t,a)),b[0].length||b[7].length?v?(v.p(b,y),y&129&&E(v,1)):(v=Lu(b),v.c(),E(v,1),v.m(t,null)):v&&(Pe(),P(v,1,1,()=>{v=null}),Le())},i(b){u||(E(r),E(v),u=!0)},o(b){P(r),P(v),u=!1},d(b){b&&k(e),h[o].d(),v&&v.d(),f=!1,Qe(c)}}}function j1(n,e,t){const i=on(),s="search_"+U.randomString(7);let{value:l=""}=e,{placeholder:o='Search filter, ex. created > "2022-01-01"...'}=e,{autocompleteCollection:r=new fn}=e,{extraAutocompleteKeys:a=[]}=e,u,f=!1,c,d="";function h(M=!0){t(7,d=""),M&&(c==null||c.focus()),i("clear")}function m(){t(0,l=d),i("submit",l)}async function v(){u||f||(t(5,f=!0),t(4,u=(await Xi(()=>import("./FilterAutocompleteInput.8dc61246.js"),[],import.meta.url)).default),t(5,f=!1))}Zn(()=>{v()});function b(M){ut.call(this,n,M)}function y(M){d=M,t(7,d),t(0,l)}function S(M){he[M?"unshift":"push"](()=>{c=M,t(6,c)})}function C(){d=this.value,t(7,d),t(0,l)}const $=()=>{h(!1),m()};return n.$$set=M=>{"value"in M&&t(0,l=M.value),"placeholder"in M&&t(1,o=M.placeholder),"autocompleteCollection"in M&&t(2,r=M.autocompleteCollection),"extraAutocompleteKeys"in M&&t(3,a=M.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof l=="string"&&t(7,d=l)},[l,o,r,a,u,f,c,d,s,h,m,b,y,S,C,$]}class Bo extends Ee{constructor(e){super(),Oe(this,e,j1,H1,De,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}let qr,Ui;const Vr="app-tooltip";function Fu(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function Ii(){return Ui=Ui||document.querySelector("."+Vr),Ui||(Ui=document.createElement("div"),Ui.classList.add(Vr),document.body.appendChild(Ui)),Ui}function Og(n,e){let t=Ii();if(!t.classList.contains("active")||!(e!=null&&e.text)){zr();return}t.textContent=e.text,t.className=Vr+" active",e.class&&t.classList.add(e.class),e.position&&t.classList.add(e.position),t.style.top="0px",t.style.left="0px";let i=t.offsetHeight,s=t.offsetWidth,l=n.getBoundingClientRect(),o=0,r=0,a=5;e.position=="left"?(o=l.top+l.height/2-i/2,r=l.left-s-a):e.position=="right"?(o=l.top+l.height/2-i/2,r=l.right+a):e.position=="top"?(o=l.top-i-a,r=l.left+l.width/2-s/2):e.position=="top-left"?(o=l.to
Line truncated
|
||||
<span class="txt">method</span>`,p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function G1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="url",p(t,"class",U.getFieldTypeIcon("url")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function X1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="referer",p(t,"class",U.getFieldTypeIcon("url")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function Q1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="status",p(t,"class",U.getFieldTypeIcon("number")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function x1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function Ru(n){let e;function t(l,o){return l[6]?tv:ev}let i=t(n),s=i(n);return{c(){s.c(),e=Je()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function ev(n){var r;let e,t,i,s,l,o=((r=n[0])==null?void 0:r.length)&&Hu(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No logs found.",s=T(),o&&o.c(),l=T(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),g(e,t),g(t,i),g(t,s),o&&o.m(t,null),g(e,l)},p(a,u){var f;(f=a[0])!=null&&f.length?o?o.p(a,u):(o=Hu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function tv(n){let e;return{c(){e=_("tr"),e.innerHTML=`<td colspan="99" class="p-xs"><span class="skeleton-loader"></span></td>
|
||||
`},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Hu(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear filters</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[18]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function ju(n){let e;return{c(){e=_("i"),p(e,"class","ri-error-warning-line txt-danger m-l-5 m-r-5"),p(e,"title","Error")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function qu(n,e){var le,me,we;let t,i,s,l=((le=e[21].method)==null?void 0:le.toUpperCase())+"",o,r,a,u,f,c=e[21].url+"",d,h,m,v,b,y,S=(e[21].referer||"N/A")+"",C,$,M,D,O,A=e[21].status+"",I,L,R,B,K,J,H,X,W,x,Q=(((me=e[21].meta)==null?void 0:me.errorMessage)||((we=e[21].meta)==null?void 0:we.errorData))&&ju();B=new wi({props:{date:e[21].created}});function se(){return e[16](e[21])}function ge(...Y){return e[17](e[21],...Y)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("span"),o=F(l),a=T(),u=_("td"),f=_("span"),d=F(c),m=T(),Q&&Q.c(),v=T(),b=_("td"),y=_("span"),C=F(S),M=T(),D=_("td"),O=_("span"),I=F(A),L=T(),R=_("td"),V(B.$$.fragment),K=T(),J=_("td"),J.innerHTML='<i class="ri-arrow-right-line"></i>',H=T(),p(s,"class",r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]),p(i,"class","col-type-text col-field-method min-width"),p(f,"class","txt txt-ellipsis"),p(f,"title",h=e[21].url),p(u,"class","col-type-text col-field-url"),p(y,"class","txt txt-ellipsis"),p(y,"title",$=e[21].referer),ie(y,"txt-hint",!e[21].referer),p(b,"class","col-type-text col-field-referer"),p(O,"class","label"),ie(O,"label-danger",e[21].status>=400),p(D,"class","col-type-number col-field-status"),p(R,"class","col-type-date col-field-created"),p(J,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(Y,be){w(Y,t,be),g(t,i),g(i,s),g(s,o),g(t,a),g(t,u),g(u,f),g(f,d),g(u,m),Q&&Q.m(u,null),g(t,v),g(t,b),g(b,y),g(y,C),g(t,M),g(t,D),g(D,O),g(O,I),g(t,L),g(t,R),j(B,R,null),g(t,K),g(t,J),g(t,H),X=!0,W||(x=[G(t,"click",se),G(t,"keydown",ge)],W=!0)},p(Y,be){var te,Se,je;e=Y,(!X||be&8)&&l!==(l=((te=e[21].method)==null?void 0:te.toUpperCase())+"")&&ue(o,l),(!X||be&8&&r!==(r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]))&&p(s,"class",r),(!X||be&8)&&c!==(c=e[21].url+"")&&ue(d,c),(!X||be&8&&h!==(h=e[21].url))&&p(f,"title",h),((Se=e[21].meta)==null?void 0:Se.errorMessage)||((je=e[21].meta)==null?void 0:je.errorData)?Q||(Q=ju(),Q.c(),Q.m(u,null)):Q&&(Q.d(1),Q=null),(!X||be&8)&&S!==(S=(e[21].referer||"N/A")+"")&&ue(C,S),(!X||be&8&&$!==($=e[21].referer))&&p(y,"title",$),be&8&&ie(y,"txt-hint",!e[21].referer),(!X||be&8)&&A!==(A=e[21].status+"")&&ue(I,A),be&8&&ie(O,"label-danger",e[21].status>=400);const ee={};be&8&&(ee.date=e[21].created),B.$set(ee)},i(Y){X||(E(B.$$.fragment,Y),X=!0)},o(Y){P(B.$$.fragment,Y),X=!1},d(Y){Y&&k(t),Q&&Q.d(),q(B),W=!1,Qe(x)}}}function Vu(n){let e,t,i=n[3].length+"",s,l,o;return{c(){e=_("small"),t=F("Showing "),s=F(i),l=F(" of "),o=F(n[4]),p(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),g(e,t),g(e,s),g(e,l),g(e,o)},p(r,a){a&8&&i!==(i=r[3].length+"")&&ue(s,i),a&16&&ue(o,r[4])},d(r){r&&k(e)}}}function zu(n){let e,t,i,s,l=n[4]-n[3].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=F("Load more ("),o=F(l),r=F(")"),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-lg btn-secondary btn-expanded"),ie(t,"btn-loading",n[6]),ie(t,"btn-disabled",n[6]),p(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),g(e,t),g(t,i),g(i,s),g(i,o),g(i,r),a||(u=G(t,"click",n[19]),a=!0)},p(f,c){c&24&&l!==(l=f[4]-f[3].length+"")&&ue(o,l),c&64&&ie(t,"btn-loading",f[6]),c&64&&ie(t,"btn-disabled",f[6])},d(f){f&&k(e),a=!1,u()}}}function nv(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C,$,M,D,O=[],A=new Map,I,L,R,B;function K(te){n[11](te)}let J={disable:!0,class:"col-field-method",name:"method",$$slots:{default:[J1]},$$scope:{ctx:n}};n[1]!==void 0&&(J.sort=n[1]),l=new sn({props:J}),he.push(()=>Re(l,"sort",K));function H(te){n[12](te)}let X={disable:!0,class:"col-type-text col-field-url",name:"url",$$slots:{default:[G1]},$$scope:{ctx:n}};n[1]!==void 0&&(X.sort=n[1]),a=new sn({props:X}),he.push(()=>Re(a,"sort",H));function W(te){n[13](te)}let x={disable:!0,class:"col-type-text col-field-referer",name:"referer",$$slots:{default:[X1]},$$scope:{ctx:n}};n[1]!==void 0&&(x.sort=n[1]),c=new sn({props:x}),he.push(()=>Re(c,"sort",W));function Q(te){n[14](te)}let se={disable:!0,class:"col-type-number col-field-status",name:"status",$$slots:{default:[Q1]},$$scope:{ctx:n}};n[1]!==void 0&&(se.sort=n[1]),m=new sn({props:se}),he.push(()=>Re(m,"sort",Q));function ge(te){n[15](te)}let le={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[x1]},$$scope:{ctx:n}};n[1]!==void 0&&(le.sort=n[1]),y=new sn({props:le}),he.push(()=>Re(y,"sort",ge));let me=n[3];const we=te=>te[21].id;for(let te=0;te<me.length;te+=1){let Se=Nu(n,me,te),je=we(Se);A.set(je,O[te]=qu(je,Se))}let Y=null;me.length||(Y=Ru(n
Line truncated
|
||||
* Chart.js v3.9.1
|
||||
* https://www.chartjs.org
|
||||
* (c) 2022 Chart.js Contributors
|
||||
* Released under the MIT License
|
||||
*/function gi(){}const lv=function(){let n=0;return function(){return n++}}();function Mt(n){return n===null||typeof n>"u"}function Ft(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function dt(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Wt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function Nn(n,e){return Wt(n)?n:e}function gt(n,e){return typeof n>"u"?e:n}const ov=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/e,Eg=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function zt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function Tt(n,e,t,i){let s,l,o;if(Ft(n))if(l=n.length,i)for(s=l-1;s>=0;s--)e.call(t,n[s],s);else for(s=0;s<l;s++)e.call(t,n[s],s);else if(dt(n))for(o=Object.keys(n),l=o.length,s=0;s<l;s++)e.call(t,n[o[s]],o[s])}function yo(n,e){let t,i,s,l;if(!n||!e||n.length!==e.length)return!1;for(t=0,i=n.length;t<i;++t)if(s=n[t],l=e[t],s.datasetIndex!==l.datasetIndex||s.index!==l.index)return!1;return!0}function ko(n){if(Ft(n))return n.map(ko);if(dt(n)){const e=Object.create(null),t=Object.keys(n),i=t.length;let s=0;for(;s<i;++s)e[t[s]]=ko(n[t[s]]);return e}return n}function Ag(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function rv(n,e,t,i){if(!Ag(n))return;const s=e[n],l=t[n];dt(s)&&dt(l)?ul(s,l,i):e[n]=ko(l)}function ul(n,e,t){const i=Ft(e)?e:[e],s=i.length;if(!dt(n))return n;t=t||{};const l=t.merger||rv;for(let o=0;o<s;++o){if(e=i[o],!dt(e))continue;const r=Object.keys(e);for(let a=0,u=r.length;a<u;++a)l(r[a],n,e,t)}return n}function el(n,e){return ul(n,e,{merger:av})}function av(n,e,t){if(!Ag(n))return;const i=e[n],s=t[n];dt(i)&&dt(s)?el(i,s):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=ko(s))}const Bu={"":n=>n,x:n=>n.x,y:n=>n.y};function Ni(n,e){return(Bu[e]||(Bu[e]=uv(e)))(n)}function uv(n){const e=fv(n);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function fv(n){const e=n.split("."),t=[];let i="";for(const s of e)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(t.push(i),i="");return t}function ka(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Wn=n=>typeof n<"u",Ri=n=>typeof n=="function",Uu=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function cv(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const Ut=Math.PI,Et=2*Ut,dv=Et+Ut,wo=Number.POSITIVE_INFINITY,pv=Ut/180,Bt=Ut/2,js=Ut/4,Wu=Ut*2/3,Vn=Math.log10,ai=Math.sign;function Yu(n){const e=Math.round(n);n=tl(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(Vn(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function hv(n){const e=[],t=Math.sqrt(n);let i;for(i=1;i<t;i++)n%i===0&&(e.push(i),e.push(n/i));return t===(t|0)&&e.push(t),e.sort((s,l)=>s-l).pop(),e}function Cs(n){return!isNaN(parseFloat(n))&&isFinite(n)}function tl(n,e,t){return Math.abs(n-e)<t}function mv(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function Pg(n,e,t){let i,s,l;for(i=0,s=n.length;i<s;i++)l=n[i][t],isNaN(l)||(e.min=Math.min(e.min,l),e.max=Math.max(e.max,l))}function Qn(n){return n*(Ut/180)}function wa(n){return n*(180/Ut)}function Ku(n){if(!Wt(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function Lg(n,e){const t=e.x-n.x,i=e.y-n.y,s=Math.sqrt(t*t+i*i);let l=Math.atan2(i,t);return l<-.5*Ut&&(l+=Et),{angle:l,distance:s}}function Br(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function gv(n,e){return(n-e+dv)%Et-Ut}function An(n){return(n%Et+Et)%Et}function fl(n,e,t,i){const s=An(n),l=An(e),o=An(t),r=An(l-s),a=An(o-s),u=An(s-l),f=An(s-o);return s===l||s===o||i&&l===o||r>a&&u<f}function un(n,e,t){return Math.max(e,Math.min(t,n))}function _v(n){return un(n,-32768,32767)}function cl(n,e,t,i=1e-6){return n>=Math.min(e,t)-i&&n<=Math.max(e,t)+i}function $a(n,e,t){t=t||(o=>n[o]<e);let i=n.length-1,s=0,l;for(;i-s>1;)l=s+i>>1,t(l)?s=l:i=l;return{lo:s,hi:i}}const xi=(n,e,t,i)=>$a(n,t,i?s=>n[s][e]<=t:s=>n[s][e]<t),bv=(n,e,t)=>$a(n,t,i=>n[i][e]>=t);function vv(n,e,t){let i=0,s=n.length;for(;i<s&&n[i]<e;)i++;for(;s>i&&n[s-1]>t;)s--;return i>0||s<n.length?n.slice(i,s):n}const Ig=["push","pop","shift","splice","unshift"];function yv(n,e){if(n._chartjs){n._chartjs.listeners.push(e);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),Ig.forEach(t=>{const i="_onData"+ka(t),s=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...l){const o=s.apply(this,l);return n._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...l)}),o}})})}function Zu(n,e){const t=n._chartjs;if(!t)return;const i=t.listeners,s=i.indexOf(e);s!==-1&&i.splice(s,1),!(i.length>0)&&(Ig.forEach(l=>{delete n[l]}),delete n._chartjs)}function Fg(n){const e=new Set;let t,i;for(t=0,i=n.length;t<i;++t)e.add(n[t]);return e.size===i?n:Array.from(e)}const Ng=function(){return typeof window>"u"?function(n){return n()}:window.requestLine truncated
|
||||
* @kurkle/color v0.2.1
|
||||
* https://github.com/kurkle/color#readme
|
||||
* (c) 2022 Jukka Kurkela
|
||||
* Released under the MIT License
|
||||
*/function wl(n){return n+.5|0}const Pi=(n,e,t)=>Math.max(Math.min(n,t),e);function Js(n){return Pi(wl(n*2.55),0,255)}function Fi(n){return Pi(wl(n*255),0,255)}function vi(n){return Pi(wl(n/2.55)/100,0,1)}function Qu(n){return Pi(wl(n*100),0,100)}const Fn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ur=[..."0123456789ABCDEF"],$v=n=>Ur[n&15],Sv=n=>Ur[(n&240)>>4]+Ur[n&15],Vl=n=>(n&240)>>4===(n&15),Cv=n=>Vl(n.r)&&Vl(n.g)&&Vl(n.b)&&Vl(n.a);function Mv(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&Fn[n[1]]*17,g:255&Fn[n[2]]*17,b:255&Fn[n[3]]*17,a:e===5?Fn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Fn[n[1]]<<4|Fn[n[2]],g:Fn[n[3]]<<4|Fn[n[4]],b:Fn[n[5]]<<4|Fn[n[6]],a:e===9?Fn[n[7]]<<4|Fn[n[8]]:255})),t}const Tv=(n,e)=>n<255?e(n):"";function Dv(n){var e=Cv(n)?$v:Sv;return n?"#"+e(n.r)+e(n.g)+e(n.b)+Tv(n.a,e):void 0}const Ov=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function qg(n,e,t){const i=e*Math.min(t,1-t),s=(l,o=(l+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function Ev(n,e,t){const i=(s,l=(s+n/60)%6)=>t-t*e*Math.max(Math.min(l,4-l,1),0);return[i(5),i(3),i(1)]}function Av(n,e,t){const i=qg(n,1,.5);let s;for(e+t>1&&(s=1/(e+t),e*=s,t*=s),s=0;s<3;s++)i[s]*=1-e-t,i[s]+=e;return i}function Pv(n,e,t,i,s){return n===s?(e-t)/i+(e<t?6:0):e===s?(t-n)/i+2:(n-e)/i+4}function Sa(n){const t=n.r/255,i=n.g/255,s=n.b/255,l=Math.max(t,i,s),o=Math.min(t,i,s),r=(l+o)/2;let a,u,f;return l!==o&&(f=l-o,u=r>.5?f/(2-l-o):f/(l+o),a=Pv(t,i,s,f,l),a=a*60+.5),[a|0,u||0,r]}function Ca(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Fi)}function Ma(n,e,t){return Ca(qg,n,e,t)}function Lv(n,e,t){return Ca(Av,n,e,t)}function Iv(n,e,t){return Ca(Ev,n,e,t)}function Vg(n){return(n%360+360)%360}function Fv(n){const e=Ov.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Js(+e[5]):Fi(+e[5]));const s=Vg(+e[2]),l=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=Lv(s,l,o):e[1]==="hsv"?i=Iv(s,l,o):i=Ma(s,l,o),{r:i[0],g:i[1],b:i[2],a:t}}function Nv(n,e){var t=Sa(n);t[0]=Vg(t[0]+e),t=Ma(t),n.r=t[0],n.g=t[1],n.b=t[2]}function Rv(n){if(!n)return;const e=Sa(n),t=e[0],i=Qu(e[1]),s=Qu(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${vi(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const xu={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},ef={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Hv(){const n={},e=Object.keys(ef),t=Object.keys(xu);let i,s,l,o,r;for(i=0;i<e.length;i++){for(o=r=e[i],s=0;s<t.length;s++)l=t[s]Line truncated
|
||||
* Chart.js v3.9.1
|
||||
* https://www.chartjs.org
|
||||
* (c) 2022 Chart.js Contributors
|
||||
* Released under the MIT License
|
||||
*/class qy{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,i,s){const l=t.listeners[s],o=t.duration;l.forEach(r=>r({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Ng.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const l=i.items;let o=l.length-1,r=!1,a;for(;o>=0;--o)a=l[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(l[o]=l[l.length-1],l.pop());r&&(s.draw(),this._notify(s,i,e,"progress")),l.length||(i.running=!1,this._notify(s,i,e,"complete"),i.initial=!1),t+=l.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);!t||(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var _i=new qy;const pf="transparent",Vy={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=nf(n||pf),s=i.valid&&nf(e||pf);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class zy{constructor(e,t,i,s){const l=t[i];s=Ul([e.to,s,l,e.from]);const o=Ul([e.from,l,s]);this._active=!0,this._fn=e.fn||Vy[e.type||typeof o],this._easing=nl[e.easing]||nl.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const s=this._target[this._prop],l=i-this._start,o=this._duration-l;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=l,this._loop=!!e.loop,this._to=Ul([e.to,t,s,e.from]),this._from=Ul([e.from,s,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,s=this._prop,l=this._from,o=this._loop,r=this._to;let a;if(this._active=l!==r&&(o||t<i),!this._active){this._target[s]=r,this._notify(!0);return}if(t<0){this._target[s]=l;return}a=t/i%2,a=o&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(l,r,a)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][t]()}}const By=["x","y","borderWidth","radius","tension"],Uy=["color","borderColor","backgroundColor"];_t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const Wy=Object.keys(_t.animation);_t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:n=>n!=="onProgress"&&n!=="onComplete"&&n!=="fn"});_t.set("animations",{colors:{type:"color",properties:Uy},numbers:{type:"number",properties:By}});_t.describe("animations",{_fallback:"animation"});_t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class n_{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!dt(e))return;const t=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!dt(s))return;const l={};for(const o of Wy)l[o]=s[o];(Ft(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!t.has(o))&&t.set(o,l)})})}_animateOptions(e,t){const i=t.options,s=Ky(e,i);if(!s)return[];const l=this._createAnimations(s,i);return i.$shared&&Yy(e.options.$animations,i).then(()=>{e.options=i},()=>{}),l}_createAnimations(e,t){const i=this._properties,s=[],l=e.$animations||(e.$animations={}),o=Object.keys(t),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const u=o[a];if(u.charAt(0)==="$")continue;if(u==="options"){s.push(...this._animateOptions(e,t));continue}const f=t[u];let c=l[u];const d=i.get(u);if(c)if(d&&c.active()){c.update(d,f,r);continue}else c.cancel();if(!d||!d.duration){e[u]=f;continue}l[u]=c=new zy(d,e,u,f),s.push(c)}return s}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return _i.add(this._chart,i),!0}}function Yy(n,e){const t=[]Line truncated
|
||||
`)>-1?n.split(`
|
||||
`):n}function rw(n,e){const{element:t,datasetIndex:i,index:s}=e,l=n.getDatasetMeta(i).controller,{label:o,value:r}=l.getLabelAndValue(s);return{chart:n,label:o,parsed:l.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:l.getDataset(),dataIndex:s,datasetIndex:i,element:t}}function Uf(n,e){const t=n.chart.ctx,{body:i,footer:s,title:l}=n,{boxWidth:o,boxHeight:r}=e,a=Pn(e.bodyFont),u=Pn(e.titleFont),f=Pn(e.footerFont),c=l.length,d=s.length,h=i.length,m=Yn(e.padding);let v=m.height,b=0,y=i.reduce(($,M)=>$+M.before.length+M.lines.length+M.after.length,0);if(y+=n.beforeBody.length+n.afterBody.length,c&&(v+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),y){const $=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;v+=h*$+(y-h)*a.lineHeight+(y-1)*e.bodySpacing}d&&(v+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let S=0;const C=function($){b=Math.max(b,t.measureText($).width+S)};return t.save(),t.font=u.string,Tt(n.title,C),t.font=a.string,Tt(n.beforeBody.concat(n.afterBody),C),S=e.displayColors?o+2+e.boxPadding:0,Tt(i,$=>{Tt($.before,C),Tt($.lines,C),Tt($.after,C)}),S=0,t.font=f.string,Tt(n.footer,C),t.restore(),b+=m.width,{width:b,height:v}}function aw(n,e){const{y:t,height:i}=e;return t<i/2?"top":t>n.height-i/2?"bottom":"center"}function uw(n,e,t,i){const{x:s,width:l}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&s+l+o>e.width||n==="right"&&s-l-o<0)return!0}function fw(n,e,t,i){const{x:s,width:l}=t,{width:o,chartArea:{left:r,right:a}}=n;let u="center";return i==="center"?u=s<=(r+a)/2?"left":"right":s<=l/2?u="left":s>=o-l/2&&(u="right"),uw(u,n,e,t)&&(u="center"),u}function Wf(n,e,t){const i=t.yAlign||e.yAlign||aw(n,t);return{xAlign:t.xAlign||e.xAlign||fw(n,e,t,i),yAlign:i}}function cw(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function dw(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function Yf(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=s+l,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:h}=ys(o);let m=cw(e,r);const v=dw(e,a,u);return a==="center"?r==="left"?m+=u:r==="right"&&(m-=u):r==="left"?m-=Math.max(f,d)+s:r==="right"&&(m+=Math.max(c,h)+s),{x:un(m,0,i.width-e.width),y:un(v,0,i.height-e.height)}}function Xl(n,e,t){const i=Yn(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function Kf(n){return li([],bi(n))}function pw(n,e,t){return Hi(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function Zf(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}class xr extends Ci{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart||e._chart,this._chart=this.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&t.options.animation&&i.animations,l=new n_(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(l)),l}getContext(){return this.$context||(this.$context=pw(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,s=i.beforeTitle.apply(this,[e]),l=i.title.apply(this,[e]),o=i.afterTitle.apply(this,[e]);let r=[];return r=li(r,bi(s)),r=li(r,bi(l)),r=li(r,bi(o)),r}getBeforeBody(e,t){return Kf(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const{callbacks:i}=t,s=[];return Tt(e,l=>{const o={before:[],lines:[],after:[]},r=Zf(i,l);li(o.before,bi(r.beforeLabel.call(this,l))),li(o.lines,r.label.call(this,l)),li(o.after,bi(r.afterLabel.call(this,l))),s.push(o)}),s}getAfterBody(e,t){return Kf(t.callbacks.afterBody.apply(this,[e]))}getFooter(e,t){const{callbacks:i}=t,s=i.beforeFooter.apply(this,[e]),l=i.footer.apply(this,[e]),o=i.afterFooter.apply(this,[e]);let r=[];return r=li(r,bi(s)),r=li(r,bi(l)),r=li(r,bi(o)),r}_createItems(e){const t=this._active,i=this.chart.data,s=[],l=[],o=[];let r=[],a,u;for(a=0,u=t.length;a<u;++a)r.push(rw(this.chart,t[a]));return e.filter&&(r=r.filter((f,c,d)=>e.filter(f,c,d,i))),e.itemSort&&(r=r.sort((f,c)=>e.itemSort(f,c,i))),Tt(r,f=>{const c=Zf(e.callbacks,f);s.push(c.labelColor.call(this,f)),l.push(c.labelPointStyle.call(this,f)),o.push(c.labelTextColor.call(this,f))}),this.labelColors=s,this.labelPointStyles=l,this.labelTextColors=o,this.dataPoints=r,r}update(e,t){const i=this.options.setContext(this.getContext()),s=this._active;l
Line truncated
|
||||
* chartjs-adapter-luxon v1.2.0
|
||||
* https://www.chartjs.org
|
||||
* (c) 2022 chartjs-adapter-luxon Contributors
|
||||
* Released under the MIT license
|
||||
*/const Iw={datetime:Xe.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:Xe.TIME_WITH_SECONDS,minute:Xe.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};r_._date.override({_id:"luxon",_create:function(n){return Xe.fromMillis(n,this.options)},init(n){this.options.locale||(this.options.locale=n.locale)},formats:function(){return Iw},parse:function(n,e){const t=this.options,i=typeof n;return n===null||i==="undefined"?null:(i==="number"?n=this._create(n):i==="string"?typeof e=="string"?n=Xe.fromFormat(n,e,t):n=Xe.fromISO(n,t):n instanceof Date?n=Xe.fromJSDate(n,t):i==="object"&&!(n instanceof Xe)&&(n=Xe.fromObject(n,t)),n.isValid?n.valueOf():null)},format:function(n,e){const t=this._create(n);return typeof e=="string"?t.toFormat(e):t.toLocaleString(e)},add:function(n,e,t){const i={};return i[t]=e,this._create(n).plus(i).valueOf()},diff:function(n,e,t){return this._create(n).diff(this._create(e)).as(t).valueOf()},startOf:function(n,e,t){if(e==="isoWeek"){t=Math.trunc(Math.min(Math.max(0,t),6));const i=this._create(n);return i.minus({days:(i.weekday-t+7)%7}).startOf("day").valueOf()}return e?this._create(n).startOf(e).valueOf():n},endOf:function(n,e){return this._create(n).endOf(e).valueOf()}});function nc(n){let e,t,i;return{c(){e=_("div"),p(e,"class","chart-loader loader svelte-vh4sl8")},m(s,l){w(s,e,l),i=!0},i(s){i||(s&&Dt(()=>{t||(t=rt(e,Un,{duration:150},!0)),t.run(1)}),i=!0)},o(s){s&&(t||(t=rt(e,Un,{duration:150},!1)),t.run(0)),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function Fw(n){let e,t,i=n[1]===1?"log":"logs",s;return{c(){e=F(n[1]),t=T(),s=F(i)},m(l,o){w(l,e,o),w(l,t,o),w(l,s,o)},p(l,o){o&2&&ue(e,l[1]),o&2&&i!==(i=l[1]===1?"log":"logs")&&ue(s,i)},d(l){l&&k(e),l&&k(t),l&&k(s)}}}function Nw(n){let e;return{c(){e=F("Loading...")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Rw(n){let e,t,i,s,l,o=n[2]&&nc();function r(f,c){return f[2]?Nw:Fw}let a=r(n),u=a(n);return{c(){e=_("div"),o&&o.c(),t=T(),i=_("canvas"),s=T(),l=_("div"),u.c(),p(i,"class","chart-canvas svelte-vh4sl8"),Ga(i,"height","250px"),Ga(i,"width","100%"),p(e,"class","chart-wrapper svelte-vh4sl8"),ie(e,"loading",n[2]),p(l,"class","txt-hint m-t-xs txt-right")},m(f,c){w(f,e,c),o&&o.m(e,null),g(e,t),g(e,i),n[8](i),w(f,s,c),w(f,l,c),u.m(l,null)},p(f,[c]){f[2]?o?c&4&&E(o,1):(o=nc(),o.c(),E(o,1),o.m(e,t)):o&&(Pe(),P(o,1,1,()=>{o=null}),Le()),c&4&&ie(e,"loading",f[2]),a===(a=r(f))&&u?u.p(f,c):(u.d(1),u=a(f),u&&(u.c(),u.m(l,null)))},i(f){E(o)},o(f){P(o)},d(f){f&&k(e),o&&o.d(),n[8](null),f&&k(s),f&&k(l),u.d()}}}function Hw(n,e,t){let{filter:i=""}=e,{presets:s=""}=e,l,o,r=[],a=0,u=!1;async function f(){return t(2,u=!0),ve.logs.getRequestsStats({filter:[s,i].filter(Boolean).join("&&")}).then(h=>{c();for(let m of h)r.push({x:U.getDateTime(m.date).toLocal().toJSDate(),y:m.total}),t(1,a+=m.total);r.push({x:new Date,y:void 0})}).catch(h=>{h!=null&&h.isAbort||(c(),console.warn(h),ve.errorResponseHandler(h,!1))}).finally(()=>{t(2,u=!1)})}function c(){t(1,a=0),t(7,r=[])}Zn(()=>(Eo.register(ji,Zo,Yo,za,Ml,ow,hw),t(6,o=new Eo(l,{type:"line",data:{datasets:[{label:"Total requests",data:r,borderColor:"#ef4565",pointBackgroundColor:"#ef4565",backgroundColor:"rgb(239,69,101,0.05)",borderWidth:2,pointRadius:1,pointBorderWidth:0,fill:!0}]},options:{animation:!1,interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,grid:{color:"#edf0f3",borderColor:"#dee3e8"},ticks:{precision:0,maxTicksLimit:6,autoSkip:!0,color:"#666f75"}},x:{type:"time",time:{unit:"hour",tooltipFormat:"DD h a"},grid:{borderColor:"#dee3e8",color:h=>h.tick.major?"#edf0f3":""},ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:h=>h.tick.major?"#16161a":"#666f75"}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function d(h){he[h?"unshift":"push"](()=>{l=h,t(0,l)})}return n.$$set=h=>{"filter"in h&&t(3,i=h.filter),"presets"in h&&t(4,s=h.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof s<"u")&&f(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update())},[l,a,u,i,s,f,o,r,d]}class jw extends Ee{constructor(e){super(),Oe(this,e,Hw,Rw,De,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}var ic=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},T_={exports:{}};(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
||||
* Prism: Lightweight, robust, elegant syntax highlighting
|
||||
*
|
||||
* @license MIT <https://opensource.org/licenses/MIT>
|
||||
* @author Lea Verou <https://lea.verou.me>
|
||||
* @namespace
|
||||
* @public
|
||||
*/var t=function(i){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,o={},r={manual:i.Prism&&i.Prism.manual,disableWorkerMessageHandler:i.Prism&&i.Prism.disableWorkerMessageHandler,util:{encode:function S(C){return C instanceof a?new a(C.type,S(C.content),C.alias):Array.isArray(C)?C.map(S):C.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(S){return Object.prototype.toString.call(S).slice(8,-1)},objId:function(S){return S.__id||Object.defineProperty(S,"__id",{value:++l}),S.__id},clone:function S(C,$){$=$||{};var M,D;switch(r.util.type(C)){case"Object":if(D=r.util.objId(C),$[D])return $[D];M={},$[D]=M;for(var O in C)C.hasOwnProperty(O)&&(M[O]=S(C[O],$));return M;case"Array":return D=r.util.objId(C),$[D]?$[D]:(M=[],$[D]=M,C.forEach(function(A,I){M[I]=S(A,$)}),M);default:return C}},getLanguage:function(S){for(;S;){var C=s.exec(S.className);if(C)return C[1].toLowerCase();S=S.parentElement}return"none"},setLanguage:function(S,C){S.className=S.className.replace(RegExp(s,"gi"),""),S.classList.add("language-"+C)},currentScript:function(){if(typeof document>"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(M){var S=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(M.stack)||[])[1];if(S){var C=document.getElementsByTagName("script");for(var $ in C)if(C[$].src==S)return C[$]}return null}},isActive:function(S,C,$){for(var M="no-"+C;S;){var D=S.classList;if(D.contains(C))return!0;if(D.contains(M))return!1;S=S.parentElement}return!!$}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(S,C){var $=r.util.clone(r.languages[S]);for(var M in C)$[M]=C[M];return $},insertBefore:function(S,C,$,M){M=M||r.languages;var D=M[S],O={};for(var A in D)if(D.hasOwnProperty(A)){if(A==C)for(var I in $)$.hasOwnProperty(I)&&(O[I]=$[I]);$.hasOwnProperty(A)||(O[A]=D[A])}var L=M[S];return M[S]=O,r.languages.DFS(r.languages,function(R,B){B===L&&R!=S&&(this[R]=O)}),O},DFS:function S(C,$,M,D){D=D||{};var O=r.util.objId;for(var A in C)if(C.hasOwnProperty(A)){$.call(C,A,C[A],M||A);var I=C[A],L=r.util.type(I);L==="Object"&&!D[O(I)]?(D[O(I)]=!0,S(I,$,null,D)):L==="Array"&&!D[O(I)]&&(D[O(I)]=!0,S(I,$,A,D))}}},plugins:{},highlightAll:function(S,C){r.highlightAllUnder(document,S,C)},highlightAllUnder:function(S,C,$){var M={callback:$,container:S,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",M),M.elements=Array.prototype.slice.apply(M.container.querySelectorAll(M.selector)),r.hooks.run("before-all-elements-highlight",M);for(var D=0,O;O=M.elements[D++];)r.highlightElement(O,C===!0,M.callback)},highlightElement:function(S,C,$){var M=r.util.getLanguage(S),D=r.languages[M];r.util.setLanguage(S,M);var O=S.parentElement;O&&O.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(O,M);var A=S.textContent,I={element:S,language:M,grammar:D,code:A};function L(B){I.highlightedCode=B,r.hooks.run("before-insert",I),I.element.innerHTML=I.highlightedCode,r.hooks.run("after-highlight",I),r.hooks.run("complete",I),$&&$.call(I.element)}if(r.hooks.run("before-sanity-check",I),O=I.element.parentElement,O&&O.nodeName.toLowerCase()==="pre"&&!O.hasAttribute("tabindex")&&O.setAttribute("tabindex","0"),!I.code){r.hooks.run("complete",I),$&&$.call(I.element);return}if(r.hooks.run("before-highlight",I),!I.grammar){L(r.util.encode(I.code));return}if(C&&i.Worker){var R=new Worker(r.filename);R.onmessage=function(B){L(B.data)},R.postMessage(JSON.stringify({language:I.language,code:I.code,immediateClose:!0}))}else L(r.highlight(I.code,I.grammar,I.language))},highlight:function(S,C,$){var M={code:S,grammar:C,language:$};if(r.hooks.run("before-tokenize",M),!M.grammar)throw new Error('The language "'+M.language+'" has no grammar.');return M.tokens=r.tokenize(M.code,M.grammar),r.hooks.run("after-tokenize",M),a.stringify(r.util.encode(M.tokens),M.language)},tokenize:function(S,C){var $=C.rest;if($){for(var M in $)C[M]=$[M];delete C.rest}var D=new c;return d(D,D.head,S),f(S,D,C,D.head,0),m(D)},hooks:{all:{},add:function(S,C){var $=r.hooks.all;$[S]=$[S]||[],$[S].push(C)},run:function(S,C){var $=r.hooks.all[S];if(!(!$||!$.length))for(var M=0,D;D=$[M++];)D(C)}},Token:a};i.Prism=r;function a(S,C,$,M){this.type=S,this.content=C,this.alias=$,this.length=(M||"").length|0}a.stringify=function S(C,$){if(typeof C=="string")return C;if(Array.isArray(C)){var M="";return C.forEach(function(L){M+=S(L,$)}),M}var D={type:C.type,content:S(C.content,$),tag:"span",classes:["token",C.type],attributes:{},language:$},O=C.alias;O&&(Array.isArray(O)?Array.prototype.push.apply(D.classes,O):D.classes.push(O)),r.hooks.run("wrap",D);var A="";for(var I in D.attributes)A+=" "+I+'="'+(D.attributes[I]||"").replace(/"/g,""")+'"';return"<"+D.tag+' class="'+D.classes.join(" ")+'"'+A+">"+D.content+"</"+D.tag+">"};function u(S,C,$,M){S.lastIndex=C;var D=S.exec($);if(D&&M&&D[1]){var O=D[1].length;D.index+=O,D[0]=D[0].slice(O)}return D}funLine truncated
|
||||
`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(I+1))}y.textContent=D,t.highlightElement(y)},function(D){b.setAttribute(r,f),y.textContent=D})}}),t.plugins.fileHighlight={highlight:function(b){for(var y=(b||document).querySelectorAll(c),S=0,C;C=y[S++];)t.highlightElement(C)}};var m=!1;t.fileHighlight=function(){m||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),m=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(T_);const Ws=T_.exports;var qw={exports:{}};(function(n){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(l,o){for(var r in o)o.hasOwnProperty(r)&&(l[r]=o[r]);return l};function t(l){this.defaults=e({},l)}function i(l){return l.replace(/-(\w)/g,function(o,r){return r.toUpperCase()})}function s(l){for(var o=0,r=0;r<l.length;++r)l.charCodeAt(r)==" ".charCodeAt(0)&&(o+=3);return l.length+o}t.prototype={setDefaults:function(l){this.defaults=e(this.defaults,l)},normalize:function(l,o){o=e(this.defaults,o);for(var r in o){var a=i(r);r!=="normalize"&&a!=="setDefaults"&&o[r]&&this[a]&&(l=this[a].call(this,l,o[r]))}return l},leftTrim:function(l){return l.replace(/^\s+/,"")},rightTrim:function(l){return l.replace(/\s+$/,"")},tabsToSpaces:function(l,o){return o=o|0||4,l.replace(/\t/g,new Array(++o).join(" "))},spacesToTabs:function(l,o){return o=o|0||4,l.replace(RegExp(" {"+o+"}","g")," ")},removeTrailing:function(l){return l.replace(/\s*?$/gm,"")},removeInitialLineFeed:function(l){return l.replace(/^(?:\r?\n|\r)/,"")},removeIndent:function(l){var o=l.match(/^[^\S\n\r]*(?=\S)/gm);return!o||!o[0].length||(o.sort(function(r,a){return r.length-a.length}),!o[0].length)?l:l.replace(RegExp("^"+o[0],"gm"),"")},indent:function(l,o){return l.replace(/^[^\S\n\r]*(?=\S)/gm,new Array(++o).join(" ")+"$&")},breakLines:function(l,o){o=o===!0?80:o|0||80;for(var r=l.split(`
|
||||
`),a=0;a<r.length;++a)if(!(s(r[a])<=o)){for(var u=r[a].split(/(\s+)/g),f=0,c=0;c<u.length;++c){var d=s(u[c]);f+=d,f>o&&(u[c]=`
|
||||
`+u[c],f=d)}r[a]=u.join("")}return r.join(`
|
||||
`)}},n.exports&&(n.exports=t),Prism.plugins.NormalizeWhitespace=new t({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(l){var o=Prism.plugins.NormalizeWhitespace;if(!(l.settings&&l.settings["whitespace-normalization"]===!1)&&!!Prism.util.isActive(l.element,"whitespace-normalization",!0)){if((!l.element||!l.element.parentNode)&&l.code){l.code=o.normalize(l.code,l.settings);return}var r=l.element.parentNode;if(!(!l.code||!r||r.nodeName.toLowerCase()!=="pre")){for(var a=r.childNodes,u="",f="",c=!1,d=0;d<a.length;++d){var h=a[d];h==l.element?c=!0:h.nodeName==="#text"&&(c?f+=h.nodeValue:u+=h.nodeValue,r.removeChild(h),--d)}if(!l.element.children.length||!Prism.plugins.KeepMarkup)l.code=u+l.code+f,l.code=o.normalize(l.code,l.settings);else{var m=u+l.element.innerHTML+f;l.element.innerHTML=o.normalize(m,l.settings),l.code=l.element.textContent}}}})})()})(qw);(function(n){var e=[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|final|finally|for|get|hide|if|implements|import|in|interface|library|mixin|new|null|on|operator|part|rethrow|return|set|show|static|super|switch|sync|this|throw|try|typedef|var|void|while|with|yield)\b/],t=/(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,i={pattern:RegExp(t+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}}}};n.languages.dart=n.languages.extend("clike",{"class-name":[i,{pattern:RegExp(t+/[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source),lookbehind:!0,inside:i.inside}],keyword:e,operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),n.languages.insertBefore("dart","string",{"string-literal":{pattern:/r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,lookbehind:!0,inside:{punctuation:/^\$\{?|\}$/,expression:{pattern:/[\s\S]+/,inside:n.languages.dart}}},string:/[\s\S]+/}},string:void 0}),n.languages.insertBefore("dart","class-name",{metadata:{pattern:/@\w+/,alias:"function"}}),n.languages.insertBefore("dart","class-name",{generics:{pattern:/<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,inside:{"class-name":i,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}}})})(Prism);function Vw(n){let e,t,i;return{c(){e=_("div"),t=_("code"),p(t,"class","svelte-1ua9m3i"),p(e,"class",i="code-wrapper prism-light "+n[0]+" svelte-1ua9m3i")},m(s,l){w(s,e,l),g(e,t),t.innerHTML=n[1]},p(s,[l]){l&2&&(t.innerHTML=s[1]),l&1&&i!==(i="code-wrapper prism-light "+s[0]+" svelte-1ua9m3i")&&p(e,"class",i)},i:re,o:re,d(s){s&&k(e)}}}function zw(n,e,t){let{class:i=""}=e,{content:s=""}=e,{language:l="javascript"}=e,o="";function r(a){return a=typeof a=="string"?a:"",a=Ws.plugins.NormalizeWhitespace.normalize(a,{"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Ws.highlight(a,Ws.languages[l]||Ws.languages.javascript,l)}return n.$$set=a=>{"class"in a&&t(0,i=a.class),"content"in a&&t(2,s=a.content),"language"in a&&t(3,l=a.language)},n.$$.update=()=>{n.$$.dirty&4&&typeof Ws<"u"&&s&&t(1,o=r(s))},[i,o,s,l]}class gn extends Ee{constructor(e){super(),Oe(this,e,zw,Vw,De,{class:0,content:2,language:3})}}const Bw=n=>({}),sc=n=>({}),Uw=n=>({}),lc=n=>({});function oc(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C=n[4]&&!n[2]&&rc(n);const $=n[18].header,M=wn($,n,n[17],lc);let D=n[4]&&n[2]&&ac(n);const O=n[18].default,A=wn(O,n,n[17],null),I=n[18].footer,L=wn(I,n,n[17],sc);return{c(){e=_("div"),t=_("div"),s=T(),l=_("div"),o=_("div"),C&&C.c(),r=T(),M&&M.c(),a=T(),D&&D.c(),u=T(),f=_("div"),A&&A.c(),c=T(),d=_("div"),L&&L.c(),p(t,"class","overlay"),p(o,"class","overlay-panel-section panel-header"),p(f,"class","overlay-panel-section panel-content"),p(d,"class","overlay-panel-section panel-footer"),p(l,"class",h="overlay-panel "+n[1]+" "+n[8]),ie(l,"popup",n[2]),p(e,"class","overlay-panel-container"),ie(e,"padded",n[2]),ie(e,"active",n[0])},m(R,B){w(R,e,B),g(e,t),g(e,s),g(e,l),g(l,o),C&&C.m(o,null),g(o,r),M&&M.m(o,null),g(o,a),D&&D.m(o,null),g(l,u),g(l,f),A&&A.m(f,null),n[20](f),g(l,c),g(l,d),L&&L.m(d,null),b=!0,y||(S=[G(t,"click",Yt(n[19])),G(f,"scroll",n[21])],y=!0)},p(R,B){n=R,n[4]&&!n[2]?C?C.p(n,B):(C=rc(n),C.c(),C.m(o,r)):C&&(C.d(1),C=null),M&&M.p&&(!b||B&131072)&&Sn(M,$,n,n[17],b?$n($,n[17],B,Uw):Cn(n[17]),lc),n[4]&&n[2]?D?D.p(n,B):(D=ac(n),D.c(),D.m(o,null)):D&&(D.d(1),D=null),A&&A.p&&(!b||B&131072)&&Sn(A,O,n,n[17],b?$n(O,n[17],B,null):Cn(n[17]),null),L&&L.p&&(!b||B&131072)&&Sn(L,I,n,n[17],b?$n(I,n[17],B,Bw):Cn(n[17]),sc),(!b||B&258&&h!==(h="overlay-panel "+n[1]+" "+n[8]))&&p(l,"class",h),B&262&&ie(l,"popup",n[2]),B&4&&ie(e,"padded",n[2]),B&1&&ie(e,"active",n[0])},i(R){b||(Dt(()=>{i||(i=rt(t,vo,{duration:_s,opacity:0},!0)),i
Line truncated
|
||||
This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]))&&p(e,"for",l);const S={};y&16&&(S.id=b[4]),y&1&&(S.disabled=!U.isEmpty(b[0].onlyDomains)),!a&&y&1&&(a=!0,S.value=b[0].exceptDomains,He(()=>a=!1)),r.$set(S)},i(b){c||(E(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),q(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function X$(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(b){n[3](b)}let v={id:n[4]+".options.onlyDomains",disabled:!U.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(v.value=n[0].onlyDomains),r=new cs({props:v}),he.push(()=>Re(r,"value",m)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=T(),s=_("i"),o=T(),V(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[4]+".options.onlyDomains"),p(f,"class","help-block")},m(b,y){w(b,e,y),g(e,t),g(e,i),g(e,s),w(b,o,y),j(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(h=Ye(Ct.call(null,s,{text:`List of domains that are ONLY allowed.
|
||||
This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]+".options.onlyDomains"))&&p(e,"for",l);const S={};y&16&&(S.id=b[4]+".options.onlyDomains"),y&1&&(S.disabled=!U.isEmpty(b[0].exceptDomains)),!a&&y&1&&(a=!0,S.value=b[0].onlyDomains,He(()=>a=!1)),r.$set(S)},i(b){c||(E(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),q(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function Q$(n){let e,t,i,s,l,o,r;return i=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[G$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[X$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){w(a,e,u),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.exceptDomains"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.onlyDomains"),u&49&&(c.$$scope={dirty:u,ctx:a}),o.$set(c)},i(a){r||(E(i.$$.fragment,a),E(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),q(i),q(o)}}}function x$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.exceptDomains,r)&&(s.exceptDomains=r,t(0,s))}function o(r){n.$$.not_equal(s.onlyDomains,r)&&(s.onlyDomains=r,t(0,s))}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class A_ extends Ee{constructor(e){super(),Oe(this,e,x$,Q$,De,{key:1,options:0})}}function eS(n){let e,t,i,s;function l(a){n[2](a)}function o(a){n[3](a)}let r={};return n[0]!==void 0&&(r.key=n[0]),n[1]!==void 0&&(r.options=n[1]),e=new A_({props:r}),he.push(()=>Re(e,"key",l)),he.push(()=>Re(e,"options",o)),{c(){V(e.$$.fragment)},m(a,u){j(e,a,u),s=!0},p(a,[u]){const f={};!t&&u&1&&(t=!0,f.key=a[0],He(()=>t=!1)),!i&&u&2&&(i=!0,f.options=a[1],He(()=>i=!1)),e.$set(f)},i(a){s||(E(e.$$.fragment,a),s=!0)},o(a){P(e.$$.fragment,a),s=!1},d(a){q(e,a)}}}function tS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){i=r,t(0,i)}function o(r){s=r,t(1,s)}return n.$$set=r=>{"key"in r&&t(0,i=r.key),"options"in r&&t(1,s=r.options)},[i,s,l,o]}class nS extends Ee{constructor(e){super(),Oe(this,e,tS,eS,De,{key:0,options:1})}}var kr=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],ks={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(n){return typeof console<"u"&&console.warn(n)},getWeek:function(n){var e=new Date(n.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var t=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},hl={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(n){var e=n%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to togg
Line truncated
|
||||
<span class='flatpickr-weekday'>
|
||||
`+z.join("</span><span class='flatpickr-weekday'>")+`
|
||||
</span>
|
||||
`}}function se(){t.calendarContainer.classList.add("hasWeeks");var N=St("div","flatpickr-weekwrapper");N.appendChild(St("span","flatpickr-weekday",t.l10n.weekAbbreviation));var z=St("div","flatpickr-weeks");return N.appendChild(z),{weekWrapper:N,weekNumbers:z}}function ge(N,z){z===void 0&&(z=!0);var ne=z?N:N-t.currentMonth;ne<0&&t._hidePrevMonthArrow===!0||ne>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=ne,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,Ke("onYearChange"),K()),B(),Ke("onMonthChange"),at())}function le(N,z){if(N===void 0&&(N=!0),z===void 0&&(z=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,z===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var ne=Cr(t.config),ae=ne.hours,Ae=ne.minutes,oe=ne.seconds;h(ae,Ae,oe)}t.redraw(),N&&Ke("onChange")}function me(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),Ke("onClose")}function we(){t.config!==void 0&&Ke("onDestroy");for(var N=t._handlers.length;N--;)t._handlers[N].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var z=t.calendarContainer.parentNode;if(z.lastChild&&z.removeChild(z.lastChild),z.parentNode){for(;z.firstChild;)z.parentNode.insertBefore(z.firstChild,z);z.parentNode.removeChild(z)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(ne){try{delete t[ne]}catch{}})}function Y(N){return t.calendarContainer.contains(N)}function be(N){if(t.isOpen&&!t.config.inline){var z=On(N),ne=Y(z),ae=z===t.input||z===t.altInput||t.element.contains(z)||N.path&&N.path.indexOf&&(~N.path.indexOf(t.input)||~N.path.indexOf(t.altInput)),Ae=!ae&&!ne&&!Y(N.relatedTarget),oe=!t.config.ignoredFocusElements.some(function(ye){return ye.contains(z)});Ae&&oe&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function ee(N){if(!(!N||t.config.minDate&&N<t.config.minDate.getFullYear()||t.config.maxDate&&N>t.config.maxDate.getFullYear())){var z=N,ne=t.currentYear!==z;t.currentYear=z||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),ne&&(t.redraw(),Ke("onYearChange"),K())}}function te(N,z){var ne;z===void 0&&(z=!0);var ae=t.parseDate(N,void 0,z);if(t.config.minDate&&ae&&En(ae,t.config.minDate,z!==void 0?z:!t.minDateHasTime)<0||t.config.maxDate&&ae&&En(ae,t.config.maxDate,z!==void 0?z:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(ae===void 0)return!1;for(var Ae=!!t.config.enable,oe=(ne=t.config.enable)!==null&&ne!==void 0?ne:t.config.disable,ye=0,Te=void 0;ye<oe.length;ye++){if(Te=oe[ye],typeof Te=="function"&&Te(ae))return Ae;if(Te instanceof Date&&ae!==void 0&&Te.getTime()===ae.getTime())return Ae;if(typeof Te=="string"){var fe=t.parseDate(Te,void 0,!0);return fe&&fe.getTime()===ae.getTime()?Ae:!Ae}else if(typeof Te=="object"&&ae!==void 0&&Te.from&&Te.to&&ae.getTime()>=Te.from.getTime()&&ae.getTime()<=Te.to.getTime())return Ae}return!Ae}function Se(N){return t.daysContainer!==void 0?N.className.indexOf("hidden")===-1&&N.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(N):!1}function je(N){var z=N.target===t._input,ne=t._input.value.trimEnd()!==Pt();z&&ne&&!(N.relatedTarget&&Y(N.relatedTarget))&&t.setDate(t._input.value,!0,N.target===t.altInput?t.config.altFormat:t.config.dateFormat)}func
Line truncated
|
||||
`),d=_("span"),h=_("span"),h.textContent="Choose presets",m=T(),V(v.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[10]),p(h,"class","txt link-primary"),p(d,"class","inline-flex"),p(f,"class","help-block")},m(M,D){w(M,e,D),g(e,t),g(e,i),g(e,s),w(M,o,D),j(r,M,D),w(M,u,D),w(M,f,D),g(f,c),g(f,d),g(d,h),g(d,m),j(v,d,null),b=!0,y||(S=Ye(Ct.call(null,s,{text:`Allow files ONLY with the listed mime types.
|
||||
Leave empty for no restriction.`,position:"top"})),y=!0)},p(M,D){(!b||D&1024&&l!==(l=M[10]))&&p(e,"for",l);const O={};D&1024&&(O.id=M[10]),!a&&D&1&&(a=!0,O.value=M[0].mimeTypes,He(()=>a=!1)),r.$set(O);const A={};D&2049&&(A.$$scope={dirty:D,ctx:M}),v.$set(A)},i(M){b||(E(r.$$.fragment,M),E(v.$$.fragment,M),b=!0)},o(M){P(r.$$.fragment,M),P(v.$$.fragment,M),b=!1},d(M){M&&k(e),M&&k(o),q(r,M),M&&k(u),M&&k(f),q(v),y=!1,S()}}}function OS(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(b){n[9](b)}let v={id:n[10],placeholder:"eg. 50x50, 480x720"};return n[0].thumbs!==void 0&&(v.value=n[0].thumbs),r=new cs({props:v}),he.push(()=>Re(r,"value",m)),{c(){e=_("label"),t=_("span"),t.textContent="Thumb sizes",i=T(),s=_("i"),o=T(),V(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[10]),p(f,"class","help-block")},m(b,y){w(b,e,y),g(e,t),g(e,i),g(e,s),w(b,o,y),j(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(h=Ye(Ct.call(null,s,{text:"List of additional thumb sizes for image files, along with the default thumb size of 100x100. The thumbs will be generated lazily on first access.",position:"top"})),d=!0)},p(b,y){(!c||y&1024&&l!==(l=b[10]))&&p(e,"for",l);const S={};y&1024&&(S.id=b[10]),!a&&y&1&&(a=!0,S.value=b[0].thumbs,He(()=>a=!1)),r.$set(S)},i(b){c||(E(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),q(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function ES(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;return i=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[CS,({uniqueId:m})=>({10:m}),({uniqueId:m})=>m?1024:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[MS,({uniqueId:m})=>({10:m}),({uniqueId:m})=>m?1024:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[DS,({uniqueId:m})=>({10:m}),({uniqueId:m})=>m?1024:0]},$$scope:{ctx:n}}}),d=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[OS,({uniqueId:m})=>({10:m}),({uniqueId:m})=>m?1024:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),a=_("div"),V(u.$$.fragment),f=T(),c=_("div"),V(d.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(a,"class","col-sm-12"),p(c,"class","col-sm-12"),p(e,"class","grid")},m(m,v){w(m,e,v),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),g(e,a),j(u,a,null),g(e,f),g(e,c),j(d,c,null),h=!0},p(m,[v]){const b={};v&2&&(b.name="schema."+m[1]+".options.maxSize"),v&3073&&(b.$$scope={dirty:v,ctx:m}),i.$set(b);const y={};v&2&&(y.name="schema."+m[1]+".options.maxSelect"),v&3073&&(y.$$scope={dirty:v,ctx:m}),o.$set(y);const S={};v&2&&(S.name="schema."+m[1]+".options.mimeTypes"),v&3073&&(S.$$scope={dirty:v,ctx:m}),u.$set(S);const C={};v&2&&(C.name="schema."+m[1]+".options.thumbs"),v&3073&&(C.$$scope={dirty:v,ctx:m}),d.$set(C)},i(m){h||(E(i.$$.fragment,m),E(o.$$.fragment,m),E(u.$$.fragment,m),E(d.$$.fragment,m),h=!0)},o(m){P(i.$$.fragment,m),P(o.$$.fragment,m),P(u.$$.fragment,m),P(d.$$.fragment,m),h=!1},d(m){m&&k(e),q(i),q(o),q(u),q(d)}}}function AS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.maxSize=At(this.value),t(0,s)}function o(){s.maxSelect=At(this.value),t(0,s)}function r(h){n.$$.not_equal(s.mimeTypes,h)&&(s.mimeTypes=h,t(0,s))}const a=()=>{t(0,s.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],s)},u=()=>{t(0,s.mimeTypes=["image/jpg","image/jpeg","image/png","image/svg+xml","image/gif"],s)},f=()=>{t(0,s.mimeTypes=["video/mp4","video/x-ms-wmv","video/quicktime","video/3gpp"],s)},c=()=>{t(0,s.mimeTypes=["application/zip","application/x-7z-compressed","application/x-rar-compressed"],s)};function d(h){n.$$.not_equal(s.thumbs,h)&&(s.thumbs=h,t(0,s))}return n.$$set=h=>{"key"in h&&t(1,i=h.key),"options"in h&&t(0,s=h.options)},n.$$.update=()=>{n.$$.dirty&1&&U.isEmpty(s)&&t(0,s={maxSelect:1,maxSize:5242880,thumbs:[],mimeTypes:[]})},[s,i,l,o,r,a,u,f,c,d]}class PS extends Ee{constructor(e){super(),Oe(this,e,AS,ES,De,{key:1,options:0})}}function LS(n){let e,t,i,s,l,o,r;function a(f){n[5](f)}let u={searchable:n[3].length>5,selectPlaceholder:n[2]?"Loading...":"Select collection",noOptionsText:"No collections found",selectionKey:"id",items:n[3]};return n[0].collectionId!==void 0&&(u.keyOfSelected=n[0].collectionId),l=new fs({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=F("Collection"),s=T(),V(l.$$.fragment),p(e,"for",i=n[9])},m(f,c){w(f,e,c),g(e,t),w(f,s,c),j(l,f,c),r=!0},p(f,c){(!r||c&512&&i!==(i=f[9]))&&p(e,"for",i);const d={};c&8&&(d.searchable=f[3].length>5),c&4&&(d.selectPlaceholder=f[2]?"Loading...":"Select collection"),c&8&&(d.items=f[3]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].collectionI
Line truncated
|
||||
form-field
|
||||
required
|
||||
`+(n[5]?"":"invalid")+`
|
||||
`+(n[0].id&&n[0].system?"disabled":"")+`
|
||||
`,name:"schema."+n[1]+".name",$$slots:{default:[WS,({uniqueId:B})=>({38:B}),({uniqueId:B})=>[0,B?128:0]]},$$scope:{ctx:n}}});const O=[n3,t3,e3,xS,QS,XS,GS,JS,ZS,KS,YS],A=[];function I(B,K){return B[0].type==="text"?0:B[0].type==="number"?1:B[0].type==="bool"?2:B[0].type==="email"?3:B[0].type==="url"?4:B[0].type==="date"?5:B[0].type==="select"?6:B[0].type==="json"?7:B[0].type==="file"?8:B[0].type==="relation"?9:B[0].type==="user"?10:-1}~(f=I(n))&&(c=A[f]=O[f](n)),m=new Ne({props:{class:"form-field form-field-toggle m-0",name:"requried",$$slots:{default:[i3,({uniqueId:B})=>({38:B}),({uniqueId:B})=>[0,B?128:0]]},$$scope:{ctx:n}}});let L=n[0].type!=="file"&&Fc(n),R=!n[0].toDelete&&Nc(n);return{c(){e=_("form"),t=_("div"),i=_("div"),V(s.$$.fragment),l=T(),o=_("div"),V(r.$$.fragment),a=T(),u=_("div"),c&&c.c(),d=T(),h=_("div"),V(m.$$.fragment),v=T(),b=_("div"),L&&L.c(),y=T(),R&&R.c(),S=T(),C=_("input"),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(u,"class","col-sm-12 hidden-empty"),p(h,"class","col-sm-4 flex"),p(b,"class","col-sm-4 flex"),p(t,"class","grid"),p(C,"type","submit"),p(C,"class","hidden"),p(C,"tabindex","-1"),p(e,"class","field-form")},m(B,K){w(B,e,K),g(e,t),g(t,i),j(s,i,null),g(t,l),g(t,o),j(r,o,null),g(t,a),g(t,u),~f&&A[f].m(u,null),g(t,d),g(t,h),j(m,h,null),g(t,v),g(t,b),L&&L.m(b,null),g(t,y),R&&R.m(t,null),g(e,S),g(e,C),$=!0,M||(D=G(e,"submit",Yt(n[31])),M=!0)},p(B,K){const J={};K[0]&1&&(J.class="form-field required "+(B[0].id?"disabled":"")),K[0]&2&&(J.name="schema."+B[1]+".type"),K[0]&1|K[1]&384&&(J.$$scope={dirty:K,ctx:B}),s.$set(J);const H={};K[0]&33&&(H.class=`
|
||||
form-field
|
||||
required
|
||||
`+(B[5]?"":"invalid")+`
|
||||
`+(B[0].id&&B[0].system?"disabled":"")+`
|
||||
`),K[0]&2&&(H.name="schema."+B[1]+".name"),K[0]&33|K[1]&384&&(H.$$scope={dirty:K,ctx:B}),r.$set(H);let X=f;f=I(B),f===X?~f&&A[f].p(B,K):(c&&(Pe(),P(A[X],1,1,()=>{A[X]=null}),Le()),~f?(c=A[f],c?c.p(B,K):(c=A[f]=O[f](B),c.c()),E(c,1),c.m(u,null)):c=null);const W={};K[0]&1|K[1]&384&&(W.$$scope={dirty:K,ctx:B}),m.$set(W),B[0].type!=="file"?L?(L.p(B,K),K[0]&1&&E(L,1)):(L=Fc(B),L.c(),E(L,1),L.m(b,null)):L&&(Pe(),P(L,1,1,()=>{L=null}),Le()),B[0].toDelete?R&&(Pe(),P(R,1,1,()=>{R=null}),Le()):R?(R.p(B,K),K[0]&1&&E(R,1)):(R=Nc(B),R.c(),E(R,1),R.m(t,null))},i(B){$||(E(s.$$.fragment,B),E(r.$$.fragment,B),E(c),E(m.$$.fragment,B),E(L),E(R),$=!0)},o(B){P(s.$$.fragment,B),P(r.$$.fragment,B),P(c),P(m.$$.fragment,B),P(L),P(R),$=!1},d(B){B&&k(e),q(s),q(r),~f&&A[f].d(),q(m),L&&L.d(),R&&R.d(),M=!1,D()}}}function Hc(n){let e,t,i,s,l=n[0].system&&jc(),o=!n[0].id&&qc(n),r=n[0].required&&Vc(),a=n[0].unique&&zc();return{c(){e=_("div"),l&&l.c(),t=T(),o&&o.c(),i=T(),r&&r.c(),s=T(),a&&a.c(),p(e,"class","inline-flex")},m(u,f){w(u,e,f),l&&l.m(e,null),g(e,t),o&&o.m(e,null),g(e,i),r&&r.m(e,null),g(e,s),a&&a.m(e,null)},p(u,f){u[0].system?l||(l=jc(),l.c(),l.m(e,t)):l&&(l.d(1),l=null),u[0].id?o&&(o.d(1),o=null):o?o.p(u,f):(o=qc(u),o.c(),o.m(e,i)),u[0].required?r||(r=Vc(),r.c(),r.m(e,s)):r&&(r.d(1),r=null),u[0].unique?a||(a=zc(),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(u){u&&k(e),l&&l.d(),o&&o.d(),r&&r.d(),a&&a.d()}}}function jc(n){let e;return{c(){e=_("span"),e.textContent="System",p(e,"class","label label-danger")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function qc(n){let e;return{c(){e=_("span"),e.textContent="New",p(e,"class","label"),ie(e,"label-warning",n[8]&&!n[0].toDelete)},m(t,i){w(t,e,i)},p(t,i){i[0]&257&&ie(e,"label-warning",t[8]&&!t[0].toDelete)},d(t){t&&k(e)}}}function Vc(n){let e;return{c(){e=_("span"),e.textContent="Required",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function zc(n){let e;return{c(){e=_("span"),e.textContent="Unique",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Bc(n){let e,t,i,s,l;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Ye(Ct.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Dt(()=>{t||(t=rt(e,Un,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=rt(e,Un,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function Uc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Restore</span>',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-secondary")},m(s,l){w(s,e,l),t||(i=G(e,"click",ei(n[15])),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function r3(n){let e,t,i,s,l,o,r=(n[0].name||"-")+"",a,u,f,c,d,h,m,v,b,y=!n[0].toDelete&&Hc(n),S=n[7]&&!n[0].system&&Bc(),C=n[0].toDelete&&Uc(n);return{c(){e=_("div"),t=_("span"),i=_("i"),l=T(),o=_("strong"),a=F(r),f=T(),y&&y.c(),c=T(),d=_("div"),h=T(),S&&S.c(),m=T(),C&&C.c(),v=Je(),p(i,"class",s=Ja(U.getFieldTypeIcon(n[0].type))+" svelte-1tpxlm5"),p(t,"class","icon field-type"),p(o,"class","title field-name svelte-1tpxlm5"),p(o,"title",u=n[0].name),ie(o,"txt-strikethrough",n[0].toDelete),p(e,"class","inline-flex"),p(d,"class","flex-fill")},m($,M){w($,e,M),g(e,t),g(t,i),g(e,l),g(e,o),g(o,a),w($,f,M),y&&y.m($,M),w($,c,M),w($,d,M),w($,h,M),S&&S.m($,M),w($,m,M),C&&C.m($,M),w($,v,M),b=!0},p($,M){(!b||M[0]&1&&s!==(s=Ja(U.getFieldTypeIcon($[0].type))+" svelte-1tpxlm5"))&&p(i,"class",s),(!b||M[0]&1)&&r!==(r=($[0].name||"-")+"")&&ue(a,r),(!b||M[0]&1&&u!==(u=$[0].name))&&p(o,"title",u),M[0]&1&&ie(o,"txt-strikethrough",$[0].toDelete),$[0].toDelete?y&&(y.d(1),y=null):y?y.p($,M):(y=Hc($),y.c(),y.m(c.parentNode,c)),$[7]&&!$[0].system?S?M[0]&129&&E(S,1):(S=Bc(),S.c(),E(S,1),S.m(m.parentNode,m)):S&&(Pe(),P(S,1,1,()=>{S=null}),Le()),$[0].toDelete?C?C.p($,M):(C=Uc($),C.c(),C.m(v.parentNode,v)):C&&(C.d(1),C=null)},i($){b||(E(S),b=!0)},o($){P(S),b=!1},d($){$&&k(e),$&&k(f),y&&y.d($),$&&k(c),$&&k(d),$&&k(h),S&&S.d($),$&&k(m),C&&C.d($),$&&k(v)}}}function a3(n){let e,t,i={single:!0,interactive:n[8],class:n[2]||n[0].toDelete||n[0].system?"field-accordion disabled":"field-accordion",$$slots:{header:[r3],default:[o3]},$$scope:{ctx:n}};return e=new Ua({props:i}),n[32](e),e.$on("expand",n[33]),e.$on("collapse",n[34]),e.$on("toggle",n[35]),{c(){V(e.$$.fragment)},m(s,l){j(e,s,l),t=!0},p(s,l){const o={};l[0]&256&&(o.interactive=s[8]),l[0]&5&&(o.class=s[2]||s[0].toDelete||s[0].system?"field-accordion disabled":"field-accordion"),l[0]&483|l[1]&256&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[32](null),q(e,s)}}}function u3(n,e,t){let i,s,l,o,r;kt(n,as,Y=>t(14,r=Y));const a=on();let{key:u="0"}=e,{field:f=new Tn}=e,{disabled:c=!1}=e,{excludeNames:d=[]}=e,h,m=f.type;function v(){h==null||h.expand()}function b(){h==null||h.collapse()}function y(){f.id?t(0,f.toDelete=!0,f):(b(),a("remove"))}function S(Y){if(Y=(""+Y).toLowerCase(),!Y)return!1;for(const be of d)i
Line truncated
|
||||
<code>@request.query.*</code>
|
||||
<code>@request.data.*</code>
|
||||
<code>@request.user.*</code>`,C=T(),$=_("hr"),M=T(),D=_("p"),D.innerHTML="You could also add constraints and query other collections using the <em>@collection</em> filter:",O=T(),A=_("div"),A.innerHTML="<code>@collection.ANY_COLLECTION_NAME.*</code>",I=T(),L=_("hr"),R=T(),B=_("p"),B.innerHTML=`Example rule:
|
||||
<br/>
|
||||
<code>@request.user.id!="" && created>"2022-01-01 00:00:00"</code>`,p(s,"class","m-b-0"),p(o,"class","inline-flex flex-gap-5"),p(m,"class","m-t-10 m-b-5"),p(b,"class","m-b-0"),p(S,"class","inline-flex flex-gap-5"),p($,"class","m-t-10 m-b-5"),p(D,"class","m-b-0"),p(A,"class","inline-flex flex-gap-5"),p(L,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(W,x){w(W,e,x),g(e,t),g(t,i),g(i,s),g(i,l),g(i,o),g(o,r),g(o,a),g(o,u),g(o,f),g(o,c),g(o,d);for(let Q=0;Q<X.length;Q+=1)X[Q].m(o,null);g(i,h),g(i,m),g(i,v),g(i,b),g(i,y),g(i,S),g(i,C),g(i,$),g(i,M),g(i,D),g(i,O),g(i,A),g(i,I),g(i,L),g(i,R),g(i,B),J=!0},p(W,x){if(x&1){H=W[0].schema;let Q;for(Q=0;Q<H.length;Q+=1){const se=Zc(W,H,Q);X[Q]?X[Q].p(se,x):(X[Q]=Gc(se),X[Q].c(),X[Q].m(o,null))}for(;Q<X.length;Q+=1)X[Q].d(1);X.length=H.length}},i(W){J||(W&&Dt(()=>{K||(K=rt(e,tn,{duration:150},!0)),K.run(1)}),J=!0)},o(W){W&&(K||(K=rt(e,tn,{duration:150},!1)),K.run(0)),J=!1},d(W){W&&k(e),xt(X,W),W&&K&&K.end()}}}function h3(n){let e,t=n[19].name+"",i;return{c(){e=_("code"),i=F(t)},m(s,l){w(s,e,l),g(e,i)},p(s,l){l&1&&t!==(t=s[19].name+"")&&ue(i,t)},d(s){s&&k(e)}}}function m3(n){let e,t=n[19].name+"",i,s;return{c(){e=_("code"),i=F(t),s=F(".*")},m(l,o){w(l,e,o),g(e,i),g(e,s)},p(l,o){o&1&&t!==(t=l[19].name+"")&&ue(i,t)},d(l){l&&k(e)}}}function Gc(n){let e;function t(l,o){return l[19].type==="relation"||l[19].type==="user"?m3:h3}let i=t(n),s=i(n);return{c(){s.c(),e=Je()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function g3(n){let e=[],t=new Map,i,s,l=Object.entries(n[6]);const o=r=>r[14];for(let r=0;r<l.length;r+=1){let a=Kc(n,l,r),u=o(a);t.set(u,e[r]=Xc(u,a))}return{c(){for(let r=0;r<e.length;r+=1)e[r].c();i=Je()},m(r,a){for(let u=0;u<e.length;u+=1)e[u].m(r,a);w(r,i,a),s=!0},p(r,a){a&262235&&(l=Object.entries(r[6]),Pe(),e=bt(e,a,o,1,r,l,t,i.parentNode,Gt,Xc,i,Kc),Le())},i(r){if(!s){for(let a=0;a<l.length;a+=1)E(e[a]);s=!0}},o(r){for(let a=0;a<e.length;a+=1)P(e[a]);s=!1},d(r){for(let a=0;a<e.length;a+=1)e[a].d(r);r&&k(i)}}}function _3(n){let e;return{c(){e=_("div"),e.innerHTML='<span class="loader"></span>',p(e,"class","txt-center")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function b3(n){let e,t,i;function s(){return n[9](n[14])}return{c(){e=_("button"),e.innerHTML='<i class="ri-lock-line"></i>',p(e,"type","button"),p(e,"class","rule-toggle-btn btn btn-circle btn-outline svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[Ye(Ct.call(null,e,"Lock and set to Admins only")),G(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,Qe(i)}}}function v3(n){let e,t,i;function s(){return n[8](n[14])}return{c(){e=_("button"),e.innerHTML='<i class="ri-lock-unlock-line"></i>',p(e,"type","button"),p(e,"class","rule-toggle-btn btn btn-circle btn-outline btn-success svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[Ye(Ct.call(null,e,"Unlock and set custom rule")),G(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,Qe(i)}}}function y3(n){let e;return{c(){e=F("Leave empty to grant everyone access")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function k3(n){let e;return{c(){e=F("Only admins will be able to access (unlock to change)")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function w3(n){let e,t=n[15]+"",i,s,l=Ai(n[0][n[14]])?"Admins only":"Custom rule",o,r,a,u,f=n[14],c,d,h,m,v,b,y;function S(){return n[10](n[14])}const C=()=>n[11](u,f),$=()=>n[11](null,f);function M(R){n[12](R,n[14])}var D=n[4];function O(R){let B={baseCollection:R[0],disabled:Ai(R[0][R[14]])};return R[0][R[14]]!==void 0&&(B.value=R[0][R[14]]),{props:B}}D&&(u=new D(O(n)),C(),he.push(()=>Re(u,"value",M)));function A(R,B){return B&1&&(m=null),m==null&&(m=!!Ai(R[0][R[14]])),m?k3:y3}let I=A(n,-1),L=I(n);return{c(){e=_("label"),i=F(t),s=F(" - "),o=F(l),a=T(),u&&V(u.$$.fragment),d=T(),h=_("div"),L.c(),p(e,"for",r=n[18]),p(h,"class","help-block")},m(R,B){w(R,e,B),g(e,i),g(e,s),g(e,o),w(R,a,B),u&&j(u,R,B),w(R,d,B),w(R,h,B),L.m(h,null),v=!0,b||(y=G(e,"click",S),b=!0)},p(R,B){n=R,(!v||B&1)&&l!==(l=Ai(n[0][n[14]])?"Admins only":"Custom rule")&&ue(o,l),(!v||B&262144&&r!==(r=n[18]))&&p(e,"for",r),f!==n[14]&&($(),f=n[14],C());const K={};if(B&1&&(K.baseCollection=n[0]),B&1&&(K.disabled=Ai(n[0][n[14]])),!c&&B&65&&(c=!0,K.value=n[0][n[14]],He(()=>c=!1)),D!==(D=n[4])){if(u){Pe();const J=u;P(J.$$.fragment,1,0,()=>{q(J,1)}),Le()}D?(u=new D(O(n)),C(),he.push(()=>Re(u,"value",M)),V(u.$$.fragment),E(u.$$.fragment,1),j(u,d.parentNode,d)):u=null}else D&&u.$set(K);I!==(I=A(n,B))&&(L.d(1),L=I(n),L&&(L.c(),L.m(h,null)))},i(R){v||(u&&E(u.$$.fragment,R),v=!0)},o(R){u&&P(u.$$.fragment,R),v=!1},d(R){R&&k(e),R&&k(a),$(),u&&q(u,R),R&&k(d),R&&k(h),L.d(),b=!1,y()}}}function Xc(n,e){let t,i,s,l,o,r,a,u;function f(h,m){return m&1&&(l=null),l==null&&(l=!!Ai(h[0][h[14]])),l?v3:b3}let c=f(e,-1),d=c(e);return r=new Ne({props:{class:"form-field rule-field m-0 "+(Ai(e[0][e[14]])?"disabled":""),name:e[14],$$slots:{default:[w3,(Line truncated
|
||||
<a href="https://pocketbase.io/docs/manage-collections#rules-filters-syntax" target="_blank" rel="noopener">PocketBase filter syntax and operators
|
||||
</a>.`,s=T(),l=_("span"),r=F(o),a=T(),b&&b.c(),u=T(),c.c(),d=Je(),p(l,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),p(t,"class","flex"),p(e,"class","block m-b-base")},m($,M){w($,e,M),g(e,t),g(t,i),g(t,s),g(t,l),g(l,r),g(e,a),b&&b.m(e,null),w($,u,M),S[f].m($,M),w($,d,M),h=!0,m||(v=G(l,"click",n[7]),m=!0)},p($,[M]){(!h||M&4)&&o!==(o=$[2]?"Hide available fields":"Show available fields")&&ue(r,o),$[2]?b?(b.p($,M),M&4&&E(b,1)):(b=Jc($),b.c(),E(b,1),b.m(e,null)):b&&(Pe(),P(b,1,1,()=>{b=null}),Le());let D=f;f=C($),f===D?S[f].p($,M):(Pe(),P(S[D],1,1,()=>{S[D]=null}),Le(),c=S[f],c?c.p($,M):(c=S[f]=y[f]($),c.c()),E(c,1),c.m(d.parentNode,d))},i($){h||(E(b),E(c),h=!0)},o($){P(b),P(c),h=!1},d($){$&&k(e),b&&b.d(),$&&k(u),S[f].d($),$&&k(d),m=!1,v()}}}function Ai(n){return n===null}function S3(n,e,t){let{collection:i=new fn}=e,s={},l=!1,o={},r,a=!1;const u={listRule:"List Action",viewRule:"View Action",createRule:"Create Action",updateRule:"Update Action",deleteRule:"Delete Action"};async function f(){t(5,a=!0);try{t(4,r=(await Xi(()=>import("./FilterAutocompleteInput.8dc61246.js"),[],import.meta.url)).default)}catch(y){console.warn(y),t(4,r=null)}t(5,a=!1)}Zn(()=>{f()});const c=()=>t(2,l=!l),d=async y=>{var S;t(0,i[y]=s[y]||"",i),await ni(),(S=o[y])==null||S.focus()},h=y=>{t(1,s[y]=i[y],s),t(0,i[y]=null,i)},m=y=>{var S;return(S=o[y])==null?void 0:S.focus()};function v(y,S){he[y?"unshift":"push"](()=>{o[S]=y,t(3,o)})}function b(y,S){n.$$.not_equal(i[S],y)&&(i[S]=y,t(0,i))}return n.$$set=y=>{"collection"in y&&t(0,i=y.collection)},[i,s,l,o,r,a,u,c,d,h,m,v,b]}class C3 extends Ee{constructor(e){super(),Oe(this,e,S3,$3,De,{collection:0})}}function Qc(n,e,t){const i=n.slice();return i[14]=e[t],i}function xc(n,e,t){const i=n.slice();return i[14]=e[t],i}function ed(n){let e;return{c(){e=_("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function td(n){let e,t,i,s,l=n[1].originalName+"",o,r,a,u,f,c=n[1].name+"",d;return{c(){e=_("li"),t=_("div"),i=F(`Renamed collection
|
||||
`),s=_("strong"),o=F(l),r=T(),a=_("i"),u=T(),f=_("strong"),d=F(c),p(s,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex")},m(h,m){w(h,e,m),g(e,t),g(t,i),g(t,s),g(s,o),g(t,r),g(t,a),g(t,u),g(t,f),g(f,d)},p(h,m){m&2&&l!==(l=h[1].originalName+"")&&ue(o,l),m&2&&c!==(c=h[1].name+"")&&ue(d,c)},d(h){h&&k(e)}}}function nd(n){let e,t,i,s,l=n[14].originalName+"",o,r,a,u,f,c=n[14].name+"",d;return{c(){e=_("li"),t=_("div"),i=F(`Renamed field
|
||||
`),s=_("strong"),o=F(l),r=T(),a=_("i"),u=T(),f=_("strong"),d=F(c),p(s,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex")},m(h,m){w(h,e,m),g(e,t),g(t,i),g(t,s),g(s,o),g(t,r),g(t,a),g(t,u),g(t,f),g(f,d)},p(h,m){m&16&&l!==(l=h[14].originalName+"")&&ue(o,l),m&16&&c!==(c=h[14].name+"")&&ue(d,c)},d(h){h&&k(e)}}}function id(n){let e,t,i,s=n[14].name+"",l,o;return{c(){e=_("li"),t=F("Removed field "),i=_("span"),l=F(s),o=T(),p(i,"class","txt-bold"),p(e,"class","txt-danger")},m(r,a){w(r,e,a),g(e,t),g(e,i),g(i,l),g(e,o)},p(r,a){a&8&&s!==(s=r[14].name+"")&&ue(l,s)},d(r){r&&k(e)}}}function M3(n){let e,t,i,s,l,o,r,a,u,f,c,d,h=n[3].length&&ed(),m=n[5]&&td(n),v=n[4],b=[];for(let C=0;C<v.length;C+=1)b[C]=nd(xc(n,v,C));let y=n[3],S=[];for(let C=0;C<y.length;C+=1)S[C]=id(Qc(n,y,C));return{c(){e=_("div"),t=_("div"),t.innerHTML='<i class="ri-error-warning-line"></i>',i=T(),s=_("div"),l=_("p"),l.textContent=`If any of the following changes is part of another collection rule or filter, you'll have to
|
||||
update it manually!`,o=T(),h&&h.c(),r=T(),a=_("h6"),a.textContent="Changes:",u=T(),f=_("ul"),m&&m.c(),c=T();for(let C=0;C<b.length;C+=1)b[C].c();d=T();for(let C=0;C<S.length;C+=1)S[C].c();p(t,"class","icon"),p(s,"class","content txt-bold"),p(e,"class","alert alert-warning"),p(f,"class","changes-list svelte-1ghly2p")},m(C,$){w(C,e,$),g(e,t),g(e,i),g(e,s),g(s,l),g(s,o),h&&h.m(s,null),w(C,r,$),w(C,a,$),w(C,u,$),w(C,f,$),m&&m.m(f,null),g(f,c);for(let M=0;M<b.length;M+=1)b[M].m(f,null);g(f,d);for(let M=0;M<S.length;M+=1)S[M].m(f,null)},p(C,$){if(C[3].length?h||(h=ed(),h.c(),h.m(s,null)):h&&(h.d(1),h=null),C[5]?m?m.p(C,$):(m=td(C),m.c(),m.m(f,c)):m&&(m.d(1),m=null),$&16){v=C[4];let M;for(M=0;M<v.length;M+=1){const D=xc(C,v,M);b[M]?b[M].p(D,$):(b[M]=nd(D),b[M].c(),b[M].m(f,d))}for(;M<b.length;M+=1)b[M].d(1);b.length=v.length}if($&8){y=C[3];let M;for(M=0;M<y.length;M+=1){const D=Qc(C,y,M);S[M]?S[M].p(D,$):(S[M]=id(D),S[M].c(),S[M].m(f,null))}for(;M<S.length;M+=1)S[M].d(1);S.length=y.length}},d(C){C&&k(e),h&&h.d(),C&&k(r),C&&k(a),C&&k(u),C&&k(f),m&&m.d(),xt(b,C),xt(S,C)}}}function T3(n){let e;return{c(){e=_("h4"),e.textContent="Confirm collection changes"},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function D3(n){let e,t,i,s,l;return{c(){e=_("button"),e.innerHTML='<span class="txt">Cancel</span>',t=T(),i=_("button"),i.innerHTML='<span class="txt">Confirm</span>',e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-secondary"),p(i,"type","button"),p(i,"class","btn btn-expanded")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),e.focus(),s||(l=[G(e,"click",n[8]),G(i,"click",n[9])],s=!0)},p:re,d(o){o&&k(e),o&&k(t),o&&k(i),s=!1,Qe(l)}}}function O3(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[D3],header:[T3],default:[M3]},$$scope:{ctx:n}};return e=new hi({props:i}),n[10](e),e.$on("hide",n[11]),e.$on("show",n[12]),{c(){V(e.$$.fragment)},m(s,l){j(e,s,l),t=!0},p(s,[l]){const o={};l&524346&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[10](null),q(e,s)}}}function E3(n,e,t){let i,s,l;const o=on();let r,a;async function u(y){t(1,a=y),await ni(),!i&&!s.length&&!l.length?c():r==null||r.show()}function f(){r==null||r.hide()}function c(){f(),o("confirm")}const d=()=>f(),h=()=>c();function m(y){he[y?"unshift":"push"](()=>{r=y,t(2,r)})}function v(y){ut.call(this,n,y)}function b(y){ut.call(this,n,y)}return n.$$.update=()=>{n.$$.dirty&2&&t(5,i=(a==null?void 0:a.originalName)!=(a==null?void 0:a.name)),n.$$.dirty&2&&t(4,s=(a==null?void 0:a.schema.filter(y=>y.id&&!y.toDelete&&y.originalName!=y.name))||[]),n.$$.dirty&2&&t(3,l=(a==null?void 0:a.schema.filter(y=>y.id&&y.toDelete))||[])},[f,a,r,l,s,i,c,u,d,h,m,v,b]}class A3 extends Ee{constructor(e){super(),Oe(this,e,E3,O3,De,{show:7,hide:0})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}}function sd(n){let e,t,i,s;function l(r){n[26](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new C3({props:o}),he.push(()=>Re(t,"collection",l)),{c(){e=_("div"),V(t.$$.fragment),p(e,"class","tab-item active")},m(r,a){w(r,e,a),j(t,e,null),s=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],He(()=>i=!1)),t.$set(u)},i(r){s||(E(t.$$.fragment,r),s=!0)},o(r){P(t.$$.fragment,r),s=!1},d(r){r&&k(e),q(t)}}}function P3(n){let e,t,i,s,l,o;function r(f){n[25](f)}let a={};n[2]!==void 0&&(a.collection=n[2]),i=new p3({props:a}),he.push(()=>Re(i,"collection",r));let u=n[9]===ml&&sd(n);return{c(){e=_("div"),t=_("div"),V(i.$$.fragment),l=T(),u&&u.c(),p(t,"class","tab-item"),ie(t,"active",n[9]===ls),p(e,"class","tabs-content svelte-b10vi")},m(f,c){w(f,e,c),g(e,t),j(i,t,null),g(e,l),u&&u.m(e,null),o=!0},p(f,c){const d={};!s&&c[0]&4&&(s=!0,d.collection=f[2],He(()=>s=!1)),i.$set(d),c[0]&512&&ie(t,"active",f[9]===ls),f[9]===ml?u?(u.p(f,c),c[0]&512&&E(u,1)):(u=sd(f),u.c(),E(u,1),u.m(e,null)):u&&(Pe(),P(u,1,1,()=>{u=null}),Le())},i(f){o||(E(i.$$.fragment,f),E(u),o=!0)},o(f){P(i.$$.fragment,f),P(u),o=!1},d(f){f&&k(e),q(i),u&&u.d()}}}function ld(n){let e,t,i,s,l,o,r;return o=new qi({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[L3]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=T(),i=_("button"),s=_("i"),l=T(),V(o.$$.fragment),p(e,"class","flex-fill"),p(s,"class","ri-more-line"),p(i,"type","button"),p(i,"class","btn btn-sm btn-circle btn-secondary flex-gap-0")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),g(i,s),g(i,l),j(o,i,null),r=!0},p(a,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:a}),o.$set(f)},i(a){r||(E(o.$$.fragment,a),r=!0)},o(a){P(o.$$.fragment,a),r=!1},d(a){a&&k(e),a&&k(t),a&&k(i),q(o)}}}function L3(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=`<i class="ri-delete-bin-7-line"></i>
|
||||
<span class="txt">Delete</span>`,p(e,"type","button"),p(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[20]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function od(n){let e;return{c(){e=_("div"),e.textContent="System collection",p(e,"class","help-block")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function I3(n){let e,t,i,s,l,o,r,a,u,f,c,d,h=n[2].system&&od();return{c(){e=_("label"),t=F("Name"),s=T(),l=_("input"),u=T(),h&&h.c(),f=Je(),p(e,"for",i=n[38]),p(l,"type","text"),p(l,"id",o=n[38]),l.required=!0,l.disabled=n[11],p(l,"spellcheck","false"),l.autofocus=r=n[2].isNew,p(l,"placeholder",'eg. "posts"'),l.value=a=n[2].name},m(m,v){w(m,e,v),g(e,t),w(m,s,v),w(m,l,v),w(m,u,v),h&&h.m(m,v),w(m,f,v),n[2].isNew&&l.focus(),c||(d=G(l,"input",n[21]),c=!0)},p(m,v){v[1]&128&&i!==(i=m[38])&&p(e,"for",i),v[1]&128&&o!==(o=m[38])&&p(l,"id",o),v[0]&2048&&(l.disabled=m[11]),v[0]&4&&r!==(r=m[2].isNew)&&(l.autofocus=r),v[0]&4&&a!==(a=m[2].name)&&l.value!==a&&(l.value=a),m[2].system?h||(h=od(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},d(m){m&&k(e),m&&k(s),m&&k(l),m&&k(u),h&&h.d(m),m&&k(f),c=!1,d()}}}function rd(n){let e,t,i,s,l,o;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(r,a){w(r,e,a),s=!0,l||(o=Ye(t=Ct.call(null,e,n[12])),l=!0)},p(r,a){t&&Kn(t.update)&&a[0]&4096&&t.update.call(null,r[12])},i(r){s||(r&&Dt(()=>{i||(i=rt(e,Un,{duration:150,start:.7},!0)),i.run(1)}),s=!0)},o(r){r&&(i||(i=rt(e,Un,{duration:150,start:.7},!1)),i.run(0)),s=!1},d(r){r&&k(e),r&&i&&i.end(),l=!1,o()}}}function ad(n){let e,t,i,s,l;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Ye(Ct.call(null,e,"Has errors")),s=!0)},i(o){i||(o&&Dt(()=>{t||(t=rt(e,Un,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){o&&(t||(t=rt(e,Un,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function F3(n){var R,B,K,J,H,X;let e,t=n[2].isNew?"New collection":"Edit collection",i,s,l,o,r,a,u,f,c,d,h,m,v=!U.isEmpty((R=n[4])==null?void 0:R.schema),b,y,S,C,$=!U.isEmpty((B=n[4])==null?void 0:B.listRule)||!U.isEmpty((K=n[4])==null?void 0:K.viewRule)||!U.isEmpty((J=n[4])==null?void 0:J.createRule)||!U.isEmpty((H=n[4])==null?void 0:H.updateRule)||!U.isEmpty((X=n[4])==null?void 0:X.deleteRule),M,D,O,A=!n[2].isNew&&!n[2].system&&ld(n);r=new Ne({props:{class:"form-field required m-b-0 "+(n[11]?"disabled":""),name:"name",$$slots:{default:[I3,({uniqueId:W})=>({38:W}),({uniqueId:W})=>[0,W?128:0]]},$$scope:{ctx:n}}});let I=v&&rd(n),L=$&&ad();return{c(){e=_("h4"),i=F(t),s=T(),A&&A.c(),l=T(),o=_("form"),V(r.$$.fragment),a=T(),u=_("input"),f=T(),c=_("div"),d=_("button"),h=_("span"),h.textContent="Fields",m=T(),I&&I.c(),b=T(),y=_("button"),S=_("span"),S.textContent="API Rules",C=T(),L&&L.c(),p(u,"type","submit"),p(u,"class","hidden"),p(u,"tabindex","-1"),p(o,"class","block"),p(h,"class","txt"),p(d,"type","button"),p(d,"class","tab-item"),ie(d,"active",n[9]===ls),p(S,"class","txt"),p(y,"type","button"),p(y,"class","tab-item"),ie(y,"active",n[9]===ml),p(c,"class","tabs-header stretched")},m(W,x){w(W,e,x),g(e,i),w(W,s,x),A&&A.m(W,x),w(W,l,x),w(W,o,x),j(r,o,null),g(o,a),g(o,u),w(W,f,x),w(W,c,x),g(c,d),g(d,h),g(d,m),I&&I.m(d,null),g(c,b),g(c,y),g(y,S),g(y,C),L&&L.m(y,null),M=!0,D||(O=[G(o,"submit",Yt(n[22])),G(d,"click",n[23]),G(y,"click",n[24])],D=!0)},p(W,x){var se,ge,le,me,we,Y;(!M||x[0]&4)&&t!==(t=W[2].isNew?"New collection":"Edit collection")&&ue(i,t),!W[2].isNew&&!W[2].system?A?(A.p(W,x),x[0]&4&&E(A,1)):(A=ld(W),A.c(),E(A,1),A.m(l.parentNode,l)):A&&(Pe(),P(A,1,1,()=>{A=null}),Le());const Q={};x[0]&2048&&(Q.class="form-field required m-b-0 "+(W[11]?"disabled":"")),x[0]&2052|x[1]&384&&(Q.$$scope={dirty:x,ctx:W}),r.$set(Q),x[0]&16&&(v=!U.isEmpty((se=W[4])==null?void 0:se.schema)),v?I?(I.p(W,x),x[0]&16&&E(I,1)):(I=rd(W),I.c(),E(I,1),I.m(d,null)):I&&(Pe(),P(I,1,1,()=>{I=null}),Le()),x[0]&512&&ie(d,"active",W[9]===ls),x[0]&16&&($=!U.isEmpty((ge=W[4])==null?void 0:ge.listRule)||!U.isEmpty((le=W[4])==null?void 0:le.viewRule)||!U.isEmpty((me=W[4])==null?void 0:me.createRule)||!U.isEmpty((we=W[4])==null?void 0:we.updateRule)||!U.isEmpty((Y=W[4])==null?void 0:Y.deleteRule)),$?L?x[0]&16&&E(L,1):(L=ad(),L.c(),E(L,1),L.m(y,null)):L&&(Pe(),P(L,1,1,()=>{L=null}),Le()),x[0]&512&&ie(y,"active",W[9]===ml)},i(W){M||(E(A),E(r.$$.fragment,W),E(I),E(L),M=!0)},o(W){P(A),P(r.$$.fragment,W),P(I),P(L),M=!1},d(W){W&&k(e),W&&k(s),A&&A.d(W),W&&k(l),W&&k(o),q(r),W&&k(f),W&&k(c),I&&I.d(),L&&L.d(),D=!1,Qe(O)}}}function N3(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=T(),s=_("button"),l=_("span"),r=F(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[7],p(l,"class","txt"),p(s,"type","button"),p(s,"class","btn btn-expanded"),s.disabled=a=!n[10]||n[7],ie(s,"btn-loading",n[7])},m(c,d){w(c,e,d),g(e,t),w(c,i,d),w(c,s,d),g(s,l),g(l,r),u||(f=[G(e,"click",n[18]),G(s,"click",n[19])],Line truncated
|
||||
<span class="txt">New collection</span>`,y=T(),V(S.$$.fragment),p(l,"type","button"),p(l,"class","btn btn-xs btn-secondary btn-circle btn-clear"),ie(l,"hidden",!n[4]),p(s,"class","form-field-addon"),p(r,"type","text"),p(r,"placeholder","Search collections..."),p(i,"class","form-field search"),ie(i,"active",n[4]),p(t,"class","sidebar-header"),p(u,"class","m-t-5 m-b-xs"),p(c,"class","sidebar-content"),p(b,"type","button"),p(b,"class","btn btn-block btn-outline"),p(v,"class","sidebar-footer"),p(e,"class","page-sidebar collection-sidebar")},m(L,R){w(L,e,R),g(e,t),g(t,i),g(i,s),g(s,l),g(i,o),g(i,r),Me(r,n[0]),g(e,a),g(e,u),g(e,f),g(e,c);for(let B=0;B<d.length;B+=1)d[B].m(c,null);A&&A.m(c,null),g(e,m),g(e,v),g(v,b),w(L,y,R),j(S,L,R),C=!0,$||(M=[G(l,"click",n[8]),G(r,"input",n[9]),G(b,"click",n[11])],$=!0)},p(L,[R]){R&16&&ie(l,"hidden",!L[4]),R&1&&r.value!==L[0]&&Me(r,L[0]),R&16&&ie(i,"active",L[4]),R&106&&(D=L[3],d=bt(d,R,O,1,L,D,h,c,Mn,dd,null,ud),!D.length&&A?A.p(L,R):D.length?A&&(A.d(1),A=null):(A=fd(L),A.c(),A.m(c,null)));const B={};S.$set(B)},i(L){C||(E(S.$$.fragment,L),C=!0)},o(L){P(S.$$.fragment,L),C=!1},d(L){L&&k(e);for(let R=0;R<d.length;R+=1)d[R].d();A&&A.d(),L&&k(y),n[12](null),q(S,L),$=!1,Qe(M)}}}function z3(n,e,t){let i,s,l,o,r;kt(n,ui,b=>t(5,o=b)),kt(n,Ds,b=>t(7,r=b));let a,u="";function f(b){dn(ui,o=b,o)}const c=()=>t(0,u="");function d(){u=this.value,t(0,u)}const h=b=>f(b),m=()=>a==null?void 0:a.show();function v(b){he[b?"unshift":"push"](()=>{a=b,t(2,a)})}return n.$$.update=()=>{n.$$.dirty&1&&t(1,i=u.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(4,s=u!==""),n.$$.dirty&131&&t(3,l=r.filter(b=>b.name!="profiles"&&(b.id==u||b.name.replace(/\s+/g,"").toLowerCase().includes(i))))},[u,i,a,l,s,o,f,r,c,d,h,m,v]}class B3 extends Ee{constructor(e){super(),Oe(this,e,z3,V3,De,{})}}function U3(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,x,Q,se,ge,le,me,we,Y,be,ee,te,Se,je,Ue,Z,pe,ce,ke,Ze;return{c(){e=_("p"),e.innerHTML=`The syntax basically follows the format
|
||||
<code><span class="txt-success">OPERAND</span>
|
||||
<span class="txt-danger">OPERATOR</span>
|
||||
<span class="txt-success">OPERAND</span></code>, where:`,t=T(),i=_("ul"),s=_("li"),s.innerHTML=`<code class="txt-success">OPERAND</code> - could be any of the above field literal, string (single or double
|
||||
quoted), number, null, true, false`,l=T(),o=_("li"),r=_("code"),r.textContent="OPERATOR",a=F(` - is one of:
|
||||
`),u=_("br"),f=T(),c=_("ul"),d=_("li"),h=_("code"),h.textContent="=",m=T(),v=_("span"),v.textContent="Equal",b=T(),y=_("li"),S=_("code"),S.textContent="!=",C=T(),$=_("span"),$.textContent="NOT equal",M=T(),D=_("li"),O=_("code"),O.textContent=">",A=T(),I=_("span"),I.textContent="Greater than",L=T(),R=_("li"),B=_("code"),B.textContent=">=",K=T(),J=_("span"),J.textContent="Greater than or equal",H=T(),X=_("li"),W=_("code"),W.textContent="<",x=T(),Q=_("span"),Q.textContent="Less than or equal",se=T(),ge=_("li"),le=_("code"),le.textContent="<=",me=T(),we=_("span"),we.textContent="Less than or equal",Y=T(),be=_("li"),ee=_("code"),ee.textContent="~",te=T(),Se=_("span"),Se.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard
|
||||
match)`,je=T(),Ue=_("li"),Z=_("code"),Z.textContent="!~",pe=T(),ce=_("span"),ce.textContent=`NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for
|
||||
wildcard match)`,ke=T(),Ze=_("p"),Ze.innerHTML=`To group and combine several expressions you could use brackets
|
||||
<code>(...)</code>, <code>&&</code> (AND) and <code>||</code> (OR) tokens.`,p(r,"class","txt-danger"),p(h,"class","filter-op svelte-1w7s5nw"),p(v,"class","txt-hint"),p(S,"class","filter-op svelte-1w7s5nw"),p($,"class","txt-hint"),p(O,"class","filter-op svelte-1w7s5nw"),p(I,"class","txt-hint"),p(B,"class","filter-op svelte-1w7s5nw"),p(J,"class","txt-hint"),p(W,"class","filter-op svelte-1w7s5nw"),p(Q,"class","txt-hint"),p(le,"class","filter-op svelte-1w7s5nw"),p(we,"class","txt-hint"),p(ee,"class","filter-op svelte-1w7s5nw"),p(Se,"class","txt-hint"),p(Z,"class","filter-op svelte-1w7s5nw"),p(ce,"class","txt-hint")},m(tt,We){w(tt,e,We),w(tt,t,We),w(tt,i,We),g(i,s),g(i,l),g(i,o),g(o,r),g(o,a),g(o,u),g(o,f),g(o,c),g(c,d),g(d,h),g(d,m),g(d,v),g(c,b),g(c,y),g(y,S),g(y,C),g(y,$),g(c,M),g(c,D),g(D,O),g(D,A),g(D,I),g(c,L),g(c,R),g(R,B),g(R,K),g(R,J),g(c,H),g(c,X),g(X,W),g(X,x),g(X,Q),g(c,se),g(c,ge),g(ge,le),g(ge,me),g(ge,we),g(c,Y),g(c,be),g(be,ee),g(be,te),g(be,Se),g(c,je),g(c,Ue),g(Ue,Z),g(Ue,pe),g(Ue,ce),w(tt,ke,We),w(tt,Ze,We)},p:re,i:re,o:re,d(tt){tt&&k(e),tt&&k(t),tt&&k(i),tt&&k(ke),tt&&k(Ze)}}}class W3 extends Ee{constructor(e){super(),Oe(this,e,null,U3,De,{})}}function pd(n,e,t){const i=n.slice();return i[5]=e[t],i}function hd(n,e,t){const i=n.slice();return i[5]=e[t],i}function md(n,e){let t,i,s=e[5].title+"",l,o,r,a;function u(){return e[4](e[5])}return{key:n,first:null,c(){t=_("button"),i=_("div"),l=F(s),o=T(),p(i,"class","txt"),p(t,"class","tab-item svelte-1maocj6"),ie(t,"active",e[0]===e[5].language),this.first=t},m(f,c){w(f,t,c),g(t,i),g(i,l),g(t,o),r||(a=G(t,"click",u),r=!0)},p(f,c){e=f,c&2&&s!==(s=e[5].title+"")&&ue(l,s),c&3&&ie(t,"active",e[0]===e[5].language)},d(f){f&&k(t),r=!1,a()}}}function gd(n,e){let t,i,s,l;return i=new gn({props:{language:e[5].language,content:e[5].content}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item svelte-1maocj6"),ie(t,"active",e[0]===e[5].language),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o;const a={};r&2&&(a.language=e[5].language),r&2&&(a.content=e[5].content),i.$set(a),r&3&&ie(t,"active",e[0]===e[5].language)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function Y3(n){let e,t,i=[],s=new Map,l,o,r=[],a=new Map,u,f=n[1];const c=m=>m[5].language;for(let m=0;m<f.length;m+=1){let v=hd(n,f,m),b=c(v);s.set(b,i[m]=md(b,v))}let d=n[1];const h=m=>m[5].language;for(let m=0;m<d.length;m+=1){let v=pd(n,d,m),b=h(v);a.set(b,r[m]=gd(b,v))}return{c(){e=_("div"),t=_("div");for(let m=0;m<i.length;m+=1)i[m].c();l=T(),o=_("div");for(let m=0;m<r.length;m+=1)r[m].c();p(t,"class","tabs-header compact left"),p(o,"class","tabs-content"),p(e,"class","tabs sdk-tabs m-b-lg svelte-1maocj6")},m(m,v){w(m,e,v),g(e,t);for(let b=0;b<i.length;b+=1)i[b].m(t,null);g(e,l),g(e,o);for(let b=0;b<r.length;b+=1)r[b].m(o,null);u=!0},p(m,[v]){v&3&&(f=m[1],i=bt(i,v,c,1,m,f,s,t,Mn,md,null,hd)),v&3&&(d=m[1],Pe(),r=bt(r,v,h,1,m,d,a,o,Gt,gd,null,pd),Le())},i(m){if(!u){for(let v=0;v<d.length;v+=1)E(r[v]);u=!0}},o(m){for(let v=0;v<r.length;v+=1)P(r[v]);u=!1},d(m){m&&k(e);for(let v=0;v<i.length;v+=1)i[v].d();for(let v=0;v<r.length;v+=1)r[v].d()}}}const _d="pb_sdk_preference";function K3(n,e,t){let i,{js:s=""}=e,{dart:l=""}=e,o=localStorage.getItem(_d)||"javascript";const r=a=>t(0,o=a.language);return n.$$set=a=>{"js"in a&&t(2,s=a.js),"dart"in a&&t(3,l=a.dart)},n.$$.update=()=>{n.$$.dirty&1&&o&&localStorage.setItem(_d,o),n.$$.dirty&12&&t(1,i=[{title:"JavaScript",language:"javascript",content:s},{title:"Dart",language:"dart",content:l}])},[o,i,s,l,r]}class Ls extends Ee{constructor(e){super(),Oe(this,e,K3,Y3,De,{js:2,dart:3})}}function bd(n,e,t){const i=n.slice();return i[6]=e[t],i}function vd(n,e,t){const i=n.slice();return i[6]=e[t],i}function yd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function kd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("div"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ie(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function wd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o,r&20&&ie(t,"active",e[2]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function Z3(n){var mi,Tl,ds,Dl;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y=n[0].name+"",S,C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,x,Q,se,ge,le,me,we,Y,be,ee,te,Se,je,Ue,Z,pe,ce,ke,Ze,tt,We,it,Ce,ze,Ge,st,ct,_e,Ie,nt,ft,vt,ot,Ot,wt,jt,Nt,Ke,$e,Be,et,at,Pt,It,Lt,lt,N,z,ne,ae=[],Ae=new Map,oe,ye,Te=[],fe=new Map,Line truncated
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
const resultList = await client.records.getList('${(mi=n[0])==null?void 0:mi.name}', 1, 50, {
|
||||
filter: 'created >= "2022-01-01 00:00:00"',
|
||||
});
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
const records = await client.records.getFullList('${(Tl=n[0])==null?void 0:Tl.name}', 200 /* batch size */, {
|
||||
sort: '-created',
|
||||
});
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
final result = await client.records.getList(
|
||||
'${(ds=n[0])==null?void 0:ds.name}',
|
||||
page: 1,
|
||||
perPage: 50,
|
||||
filter: 'created >= "2022-01-01 00:00:00"',
|
||||
);
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
final records = await client.records.getFullList('${(Dl=n[0])==null?void 0:Dl.name}', batch: 200, sort: '-created');
|
||||
`}}),Z=new gn({props:{content:`
|
||||
// DESC by created and ASC by id
|
||||
?sort=-created,id
|
||||
`}}),ze=new gn({props:{content:`
|
||||
?filter=(id='abc' && created>'2022-01-01')
|
||||
`}}),st=new W3({}),wt=new gn({props:{content:`
|
||||
?expand=rel1,rel2.subrel21.subrel22
|
||||
`}});let ht=n[4];const rn=qe=>qe[6].code;for(let qe=0;qe<ht.length;qe+=1){let xe=vd(n,ht,qe),Xt=rn(xe);Ae.set(Xt,ae[qe]=kd(Xt,xe))}let qt=n[4];const Mi=qe=>qe[6].code;for(let qe=0;qe<qt.length;qe+=1){let xe=bd(n,qt,qe),Xt=Mi(xe);fe.set(Xt,Te[qe]=wd(Xt,xe))}return{c(){e=_("div"),t=_("strong"),t.textContent="GET",i=T(),s=_("div"),l=_("p"),o=F("/api/collections/"),r=_("strong"),u=F(a),f=F("/records"),c=T(),Fe&&Fe.c(),d=T(),h=_("div"),m=_("p"),v=F("Fetch a paginated "),b=_("strong"),S=F(y),C=F(" records list."),$=T(),M=_("div"),M.textContent="Client SDKs example",D=T(),V(O.$$.fragment),A=T(),I=_("div"),I.textContent="Query parameters",L=T(),R=_("table"),B=_("thead"),B.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr>`,K=T(),J=_("tbody"),H=_("tr"),H.innerHTML=`<td>page</td>
|
||||
<td><span class="label">Number</span></td>
|
||||
<td>The page (aka. offset) of the paginated list (default to 1).</td>`,X=T(),W=_("tr"),W.innerHTML=`<td>perPage</td>
|
||||
<td><span class="label">Number</span></td>
|
||||
<td>Specify the max returned records per page (default to 30).</td>`,x=T(),Q=_("tr"),se=_("td"),se.textContent="sort",ge=T(),le=_("td"),le.innerHTML='<span class="label">String</span>',me=T(),we=_("td"),Y=F("Specify the records order attribute(s). "),be=_("br"),ee=F(`
|
||||
Add `),te=_("code"),te.textContent="-",Se=F(" / "),je=_("code"),je.textContent="+",Ue=F(` (default) in front of the attribute for DESC / ASC order.
|
||||
Ex.:
|
||||
`),V(Z.$$.fragment),pe=T(),ce=_("tr"),ke=_("td"),ke.textContent="filter",Ze=T(),tt=_("td"),tt.innerHTML='<span class="label">String</span>',We=T(),it=_("td"),Ce=F(`Filter the returned records. Ex.:
|
||||
`),V(ze.$$.fragment),Ge=T(),V(st.$$.fragment),ct=T(),_e=_("tr"),Ie=_("td"),Ie.textContent="expand",nt=T(),ft=_("td"),ft.innerHTML='<span class="label">String</span>',vt=T(),ot=_("td"),Ot=F(`Auto expand record relations. Ex.:
|
||||
`),V(wt.$$.fragment),jt=F(`
|
||||
Supports up to 6-levels depth nested relations expansion. `),Nt=_("br"),Ke=F(`
|
||||
The expanded relations will be appended to each individual record under the
|
||||
`),$e=_("code"),$e.textContent="@expand",Be=F(" property (eg. "),et=_("code"),et.textContent='"@expand": {"rel1": {...}, ...}',at=F(`). Only the
|
||||
relations that the user has permissions to `),Pt=_("strong"),Pt.textContent="view",It=F(" will be expanded."),Lt=T(),lt=_("div"),lt.textContent="Responses",N=T(),z=_("div"),ne=_("div");for(let qe=0;qe<ae.length;qe+=1)ae[qe].c();oe=T(),ye=_("div");for(let qe=0;qe<Te.length;qe+=1)Te[qe].c();p(t,"class","label label-primary"),p(s,"class","content"),p(e,"class","alert alert-info"),p(h,"class","content m-b-base"),p(M,"class","section-title"),p(I,"class","section-title"),p(R,"class","table-compact table-border m-b-lg"),p(lt,"class","section-title"),p(ne,"class","tabs-header compact left"),p(ye,"class","tabs-content"),p(z,"class","tabs")},m(qe,xe){w(qe,e,xe),g(e,t),g(e,i),g(e,s),g(s,l),g(l,o),g(l,r),g(r,u),g(l,f),g(e,c),Fe&&Fe.m(e,null),w(qe,d,xe),w(qe,h,xe),g(h,m),g(m,v),g(m,b),g(b,S),g(m,C),w(qe,$,xe),w(qe,M,xe),w(qe,D,xe),j(O,qe,xe),w(qe,A,xe),w(qe,I,xe),w(qe,L,xe),w(qe,R,xe),g(R,B),g(R,K),g(R,J),g(J,H),g(J,X),g(J,W),g(J,x),g(J,Q),g(Q,se),g(Q,ge),g(Q,le),g(Q,me),g(Q,we),g(we,Y),g(we,be),g(we,ee),g(we,te),g(we,Se),g(we,je),g(we,Ue),j(Z,we,null),g(J,pe),g(J,ce),g(ce,ke),g(ce,Ze),g(ce,tt),g(ce,We),g(ce,it),g(it,Ce),j(ze,it,null),g(it,Ge),j(st,it,null),g(J,ct),g(J,_e),g(_e,Ie),g(_e,nt),g(_e,ft),g(_e,vt),g(_e,ot),g(ot,Ot),j(wt,ot,null),g(ot,jt),g(ot,Nt),g(ot,Ke),g(ot,$e),g(ot,Be),g(ot,et),g(ot,at),g(ot,Pt),g(ot,It),w(qe,Lt,xe),w(qe,lt,xe),w(qe,N,xe),w(qe,z,xe),g(z,ne);for(let Xt=0;Xt<ae.length;Xt+=1)ae[Xt].m(ne,null);g(z,oe),g(z,ye);for(let Xt=0;Xt<Te.length;Xt+=1)Te[Xt].m(ye,null);de=!0},p(qe,[xe]){var Ol,El,Al,Pl;(!de||xe&1)&&a!==(a=qe[0].name+"")&&ue(u,a),qe[1]?Fe||(Fe=yd(),Fe.c(),Fe.m(e,null)):Fe&&(Fe.d(1),Fe=null),(!de||xe&1)&&y!==(y=qe[0].name+"")&&ue(S,y);const Xt={};xe&9&&(Xt.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${qe[3]}');
|
||||
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
const resultList = await client.records.getList('${(Ol=qe[0])==null?void 0:Ol.name}', 1, 50, {
|
||||
filter: 'created >= "2022-01-01 00:00:00"',
|
||||
});
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
const records = await client.records.getFullList('${(El=qe[0])==null?void 0:El.name}', 200 /* batch size */, {
|
||||
sort: '-created',
|
||||
});
|
||||
`),xe&9&&(Xt.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${qe[3]}');
|
||||
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
final result = await client.records.getList(
|
||||
'${(Al=qe[0])==null?void 0:Al.name}',
|
||||
page: 1,
|
||||
perPage: 50,
|
||||
filter: 'created >= "2022-01-01 00:00:00"',
|
||||
);
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
final records = await client.records.getFullList('${(Pl=qe[0])==null?void 0:Pl.name}', batch: 200, sort: '-created');
|
||||
`),O.$set(Xt),xe&20&&(ht=qe[4],ae=bt(ae,xe,rn,1,qe,ht,Ae,ne,Mn,kd,null,vd)),xe&20&&(qt=qe[4],Pe(),Te=bt(Te,xe,Mi,1,qe,qt,fe,ye,Gt,wd,null,bd),Le())},i(qe){if(!de){E(O.$$.fragment,qe),E(Z.$$.fragment,qe),E(ze.$$.fragment,qe),E(st.$$.fragment,qe),E(wt.$$.fragment,qe);for(let xe=0;xe<qt.length;xe+=1)E(Te[xe]);de=!0}},o(qe){P(O.$$.fragment,qe),P(Z.$$.fragment,qe),P(ze.$$.fragment,qe),P(st.$$.fragment,qe),P(wt.$$.fragment,qe);for(let xe=0;xe<Te.length;xe+=1)P(Te[xe]);de=!1},d(qe){qe&&k(e),Fe&&Fe.d(),qe&&k(d),qe&&k(h),qe&&k($),qe&&k(M),qe&&k(D),q(O,qe),qe&&k(A),qe&&k(I),qe&&k(L),qe&&k(R),q(Z),q(ze),q(st),q(wt),qe&&k(Lt),qe&&k(lt),qe&&k(N),qe&&k(z);for(let xe=0;xe<ae.length;xe+=1)ae[xe].d();for(let xe=0;xe<Te.length;xe+=1)Te[xe].d()}}}function J3(n,e,t){let i,s,{collection:l=new fn}=e,o=200,r=[];const a=u=>t(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.listRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:200,body:JSON.stringify({page:1,perPage:30,totalItems:2,items:[U.dummyCollectionRecord(l),U.dummyCollectionRecord(l)]},null,2)}),r.push({code:400,body:`
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Something went wrong while processing your request. Invalid filter.",
|
||||
"data": {}
|
||||
}
|
||||
`}),i&&r.push({code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "Only admins can access this action.",
|
||||
"data": {}
|
||||
}
|
||||
`}),r.push({code:404,body:`
|
||||
{
|
||||
"code": 404,
|
||||
"message": "The requested resource wasn't found.",
|
||||
"data": {}
|
||||
}
|
||||
`}))},t(3,s=U.getApiExampleUrl(ve.baseUrl)),[l,i,o,s,r,a]}class G3 extends Ee{constructor(e){super(),Oe(this,e,J3,Z3,De,{collection:0})}}function $d(n,e,t){const i=n.slice();return i[6]=e[t],i}function Sd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Cd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Md(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ie(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Td(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o,r&20&&ie(t,"active",e[2]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function X3(n){var Nt,Ke;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y,S=n[0].name+"",C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,x,Q,se,ge,le,me,we,Y,be,ee,te,Se,je,Ue,Z,pe,ce,ke,Ze,tt,We,it,Ce,ze,Ge=[],st=new Map,ct,_e,Ie=[],nt=new Map,ft,vt=n[1]&&Cd();A=new Ls({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
const record = await client.records.getOne('${(Nt=n[0])==null?void 0:Nt.name}', 'RECORD_ID', {
|
||||
expand: 'some_relation'
|
||||
});
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
final record = await client.records.getOne('${(Ke=n[0])==null?void 0:Ke.name}', 'RECORD_ID', query: {
|
||||
'expand': 'some_relation',
|
||||
});
|
||||
`}}),ee=new gn({props:{content:`
|
||||
?expand=rel1,rel2.subrel21.subrel22
|
||||
`}});let ot=n[4];const Ot=$e=>$e[6].code;for(let $e=0;$e<ot.length;$e+=1){let Be=Sd(n,ot,$e),et=Ot(Be);st.set(et,Ge[$e]=Md(et,Be))}let wt=n[4];const jt=$e=>$e[6].code;for(let $e=0;$e<wt.length;$e+=1){let Be=$d(n,wt,$e),et=jt(Be);nt.set(et,Ie[$e]=Td(et,Be))}return{c(){e=_("div"),t=_("strong"),t.textContent="GET",i=T(),s=_("div"),l=_("p"),o=F("/api/collections/"),r=_("strong"),u=F(a),f=F("/records/"),c=_("strong"),c.textContent=":id",d=T(),vt&&vt.c(),h=T(),m=_("div"),v=_("p"),b=F("Fetch a single "),y=_("strong"),C=F(S),$=F(" record."),M=T(),D=_("div"),D.textContent="Client SDKs example",O=T(),V(A.$$.fragment),I=T(),L=_("div"),L.textContent="Path Parameters",R=T(),B=_("table"),B.innerHTML=`<thead><tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr></thead>
|
||||
<tbody><tr><td>id</td>
|
||||
<td><span class="label">String</span></td>
|
||||
<td>ID of the record to view.</td></tr></tbody>`,K=T(),J=_("div"),J.textContent="Query parameters",H=T(),X=_("table"),W=_("thead"),W.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr>`,x=T(),Q=_("tbody"),se=_("tr"),ge=_("td"),ge.textContent="expand",le=T(),me=_("td"),me.innerHTML='<span class="label">String</span>',we=T(),Y=_("td"),be=F(`Auto expand record relations. Ex.:
|
||||
`),V(ee.$$.fragment),te=F(`
|
||||
Supports up to 6-levels depth nested relations expansion. `),Se=_("br"),je=F(`
|
||||
The expanded relations will be appended to the record under the
|
||||
`),Ue=_("code"),Ue.textContent="@expand",Z=F(" property (eg. "),pe=_("code"),pe.textContent='"@expand": {"rel1": {...}, ...}',ce=F(`). Only the
|
||||
relations that the user has permissions to `),ke=_("strong"),ke.textContent="view",Ze=F(" will be expanded."),tt=T(),We=_("div"),We.textContent="Responses",it=T(),Ce=_("div"),ze=_("div");for(let $e=0;$e<Ge.length;$e+=1)Ge[$e].c();ct=T(),_e=_("div");for(let $e=0;$e<Ie.length;$e+=1)Ie[$e].c();p(t,"class","label label-primary"),p(s,"class","content"),p(e,"class","alert alert-info"),p(m,"class","content m-b-base"),p(D,"class","section-title"),p(L,"class","section-title"),p(B,"class","table-compact table-border m-b-lg"),p(J,"class","section-title"),p(X,"class","table-compact table-border m-b-lg"),p(We,"class","section-title"),p(ze,"class","tabs-header compact left"),p(_e,"class","tabs-content"),p(Ce,"class","tabs")},m($e,Be){w($e,e,Be),g(e,t),g(e,i),g(e,s),g(s,l),g(l,o),g(l,r),g(r,u),g(l,f),g(l,c),g(e,d),vt&&vt.m(e,null),w($e,h,Be),w($e,m,Be),g(m,v),g(v,b),g(v,y),g(y,C),g(v,$),w($e,M,Be),w($e,D,Be),w($e,O,Be),j(A,$e,Be),w($e,I,Be),w($e,L,Be),w($e,R,Be),w($e,B,Be),w($e,K,Be),w($e,J,Be),w($e,H,Be),w($e,X,Be),g(X,W),g(X,x),g(X,Q),g(Q,se),g(se,ge),g(se,le),g(se,me),g(se,we),g(se,Y),g(Y,be),j(ee,Y,null),g(Y,te),g(Y,Se),g(Y,je),g(Y,Ue),g(Y,Z),g(Y,pe),g(Y,ce),g(Y,ke),g(Y,Ze),w($e,tt,Be),w($e,We,Be),w($e,it,Be),w($e,Ce,Be),g(Ce,ze);for(let et=0;et<Ge.length;et+=1)Ge[et].m(ze,null);g(Ce,ct),g(Ce,_e);for(let et=0;et<Ie.length;et+=1)Ie[et].m(_e,null);ft=!0},p($e,[Be]){var at,Pt;(!ft||Be&1)&&a!==(a=$e[0].name+"")&&ue(u,a),$e[1]?vt||(vt=Cd(),vt.c(),vt.m(e,null)):vt&&(vt.d(1),vt=null),(!ft||Be&1)&&S!==(S=$e[0].name+"")&&ue(C,S);const et={};Be&9&&(et.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${$e[3]}');
|
||||
|
||||
...
|
||||
|
||||
const record = await client.records.getOne('${(at=$e[0])==null?void 0:at.name}', 'RECORD_ID', {
|
||||
expand: 'some_relation'
|
||||
});
|
||||
`),Be&9&&(et.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${$e[3]}');
|
||||
|
||||
...
|
||||
|
||||
final record = await client.records.getOne('${(Pt=$e[0])==null?void 0:Pt.name}', 'RECORD_ID', query: {
|
||||
'expand': 'some_relation',
|
||||
});
|
||||
`),A.$set(et),Be&20&&(ot=$e[4],Ge=bt(Ge,Be,Ot,1,$e,ot,st,ze,Mn,Md,null,Sd)),Be&20&&(wt=$e[4],Pe(),Ie=bt(Ie,Be,jt,1,$e,wt,nt,_e,Gt,Td,null,$d),Le())},i($e){if(!ft){E(A.$$.fragment,$e),E(ee.$$.fragment,$e);for(let Be=0;Be<wt.length;Be+=1)E(Ie[Be]);ft=!0}},o($e){P(A.$$.fragment,$e),P(ee.$$.fragment,$e);for(let Be=0;Be<Ie.length;Be+=1)P(Ie[Be]);ft=!1},d($e){$e&&k(e),vt&&vt.d(),$e&&k(h),$e&&k(m),$e&&k(M),$e&&k(D),$e&&k(O),q(A,$e),$e&&k(I),$e&&k(L),$e&&k(R),$e&&k(B),$e&&k(K),$e&&k(J),$e&&k(H),$e&&k(X),q(ee),$e&&k(tt),$e&&k(We),$e&&k(it),$e&&k(Ce);for(let Be=0;Be<Ge.length;Be+=1)Ge[Be].d();for(let Be=0;Be<Ie.length;Be+=1)Ie[Be].d()}}}function Q3(n,e,t){let i,s,{collection:l=new fn}=e,o=200,r=[];const a=u=>t(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.viewRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:200,body:JSON.stringify(U.dummyCollectionRecord(l),null,2)}),i&&r.push({code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "Only admins can access this action.",
|
||||
"data": {}
|
||||
}
|
||||
`}),r.push({code:404,body:`
|
||||
{
|
||||
"code": 404,
|
||||
"message": "The requested resource wasn't found.",
|
||||
"data": {}
|
||||
}
|
||||
`}))},t(3,s=U.getApiExampleUrl(ve.baseUrl)),[l,i,o,s,r,a]}class x3 extends Ee{constructor(e){super(),Oe(this,e,Q3,X3,De,{collection:0})}}function Dd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Od(n,e,t){const i=n.slice();return i[6]=e[t],i}function Ed(n,e,t){const i=n.slice();return i[11]=e[t],i}function Ad(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function eC(n){let e;return{c(){e=_("span"),e.textContent="Optional",p(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function tC(n){let e;return{c(){e=_("span"),e.textContent="Required",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function nC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=F("User "),i=F(t),s=F(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ue(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function iC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=F("Relation record "),i=F(t),s=F(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ue(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function sC(n){let e,t,i,s,l;return{c(){e=F("FormData object."),t=_("br"),i=F(`
|
||||
Set to `),s=_("code"),s.textContent="null",l=F(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:re,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function lC(n){let e;return{c(){e=F("URL address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function oC(n){let e;return{c(){e=F("Email address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function rC(n){let e;return{c(){e=F("JSON array or object.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function aC(n){let e;return{c(){e=F("Number value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function uC(n){let e;return{c(){e=F("Plain text value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Pd(n,e){let t,i,s,l,o,r=e[11].name+"",a,u,f,c,d=U.getFieldValueType(e[11])+"",h,m,v,b;function y(O,A){return O[11].required?tC:eC}let S=y(e),C=S(e);function $(O,A){if(O[11].type==="text")return uC;if(O[11].type==="number")return aC;if(O[11].type==="json")return rC;if(O[11].type==="email")return oC;if(O[11].type==="url")return lC;if(O[11].type==="file")return sC;if(O[11].type==="relation")return iC;if(O[11].type==="user")return nC}let M=$(e),D=M&&M(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=T(),o=_("span"),a=F(r),u=T(),f=_("td"),c=_("span"),h=F(d),m=T(),v=_("td"),D&&D.c(),b=T(),p(s,"class","inline-flex"),p(c,"class","label"),this.first=t},m(O,A){w(O,t,A),g(t,i),g(i,s),C.m(s,null),g(s,l),g(s,o),g(o,a),g(t,u),g(t,f),g(f,c),g(c,h),g(t,m),g(t,v),D&&D.m(v,null),g(t,b)},p(O,A){e=O,S!==(S=y(e))&&(C.d(1),C=S(e),C&&(C.c(),C.m(s,l))),A&1&&r!==(r=e[11].name+"")&&ue(a,r),A&1&&d!==(d=U.getFieldValueType(e[11])+"")&&ue(h,d),M===(M=$(e))&&D?D.p(e,A):(D&&D.d(1),D=M&&M(e),D&&(D.c(),D.m(v,null)))},d(O){O&&k(t),C.d(),D&&D.d()}}}function Ld(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[1]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[6].code+"")&&ue(s,i),f&6&&ie(t,"active",e[1]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Id(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[1]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[6].body),i.$set(a),r&6&&ie(t,"active",e[1]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function fC(n){var ne,ae,Ae;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y=n[0].name+"",S,C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,x,Q,se,ge=[],le=new Map,me,we,Y,be,ee,te,Se,je,Ue,Z,pe,ce,ke,Ze,tt,We,it,Ce,ze,Ge,st,ct,_e,Ie,nt,ft,vt,ot,Ot,wt=[],jt=new Map,Nt,Ke,$e=[],Be=new Map,et,at=n[4]&&Ad();R=new Ls({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.records.create('${(ne=n[0])==null?void 0:ne.name}', data);
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
final body = <String, dynamic>{ ... };
|
||||
|
||||
final record = await client.records.create('${(ae=n[0])==null?void 0:ae.name}', body: body);
|
||||
`}});let Pt=(Ae=n[0])==null?void 0:Ae.schema;const It=oe=>oe[11].name;for(let oe=0;oe<Pt.length;oe+=1){let ye=Ed(n,Pt,oe),Te=It(ye);le.set(Te,ge[oe]=Pd(Te,ye))}tt=new gn({props:{content:`
|
||||
?expand=rel1,rel2.subrel21.subrel22
|
||||
`}});let Lt=n[2];const lt=oe=>oe[6].code;for(let oe=0;oe<Lt.length;oe+=1){let ye=Od(n,Lt,oe),Te=lt(ye);jt.set(Te,wt[oe]=Ld(Te,ye))}let N=n[2];const z=oe=>oe[6].code;for(let oe=0;oe<N.length;oe+=1){let ye=Dd(n,N,oe),Te=z(ye);Be.set(Te,$e[oe]=Id(Te,ye))}return{c(){e=_("div"),t=_("strong"),t.textContent="POST",i=T(),s=_("div"),l=_("p"),o=F("/api/collections/"),r=_("strong"),u=F(a),f=F("/records"),c=T(),at&&at.c(),d=T(),h=_("div"),m=_("p"),v=F("Create a new "),b=_("strong"),S=F(y),C=F(" record."),$=T(),M=_("p"),M.innerHTML=`Body parameters could be sent as <code>application/json</code> or
|
||||
<code>multipart/form-data</code>.`,D=T(),O=_("p"),O.innerHTML="File upload is supported only via <code>multipart/form-data</code>.",A=T(),I=_("div"),I.textContent="Client SDKs example",L=T(),V(R.$$.fragment),B=T(),K=_("div"),K.textContent="Body Parameters",J=T(),H=_("table"),X=_("thead"),X.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="50%">Description</th></tr>`,W=T(),x=_("tbody"),Q=_("tr"),Q.innerHTML=`<td><div class="inline-flex"><span class="label label-warning">Optional</span>
|
||||
<span>id</span></div></td>
|
||||
<td><span class="label">String</span></td>
|
||||
<td><strong>15 characters string</strong> to store as record ID.
|
||||
<br/>
|
||||
If not set, it will be auto generated.</td>`,se=T();for(let oe=0;oe<ge.length;oe+=1)ge[oe].c();me=T(),we=_("div"),we.textContent="Query parameters",Y=T(),be=_("table"),ee=_("thead"),ee.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr>`,te=T(),Se=_("tbody"),je=_("tr"),Ue=_("td"),Ue.textContent="expand",Z=T(),pe=_("td"),pe.innerHTML='<span class="label">String</span>',ce=T(),ke=_("td"),Ze=F(`Auto expand relations when returning the created record. Ex.:
|
||||
`),V(tt.$$.fragment),We=F(`
|
||||
Supports up to 6-levels depth nested relations expansion. `),it=_("br"),Ce=F(`
|
||||
The expanded relations will be appended to the record under the
|
||||
`),ze=_("code"),ze.textContent="@expand",Ge=F(" property (eg. "),st=_("code"),st.textContent='"@expand": {"rel1": {...}, ...}',ct=F(`). Only the
|
||||
relations that the user has permissions to `),_e=_("strong"),_e.textContent="view",Ie=F(" will be expanded."),nt=T(),ft=_("div"),ft.textContent="Responses",vt=T(),ot=_("div"),Ot=_("div");for(let oe=0;oe<wt.length;oe+=1)wt[oe].c();Nt=T(),Ke=_("div");for(let oe=0;oe<$e.length;oe+=1)$e[oe].c();p(t,"class","label label-primary"),p(s,"class","content"),p(e,"class","alert alert-success"),p(h,"class","content m-b-base"),p(I,"class","section-title"),p(K,"class","section-title"),p(H,"class","table-compact table-border m-b-lg"),p(we,"class","section-title"),p(be,"class","table-compact table-border m-b-lg"),p(ft,"class","section-title"),p(Ot,"class","tabs-header compact left"),p(Ke,"class","tabs-content"),p(ot,"class","tabs")},m(oe,ye){w(oe,e,ye),g(e,t),g(e,i),g(e,s),g(s,l),g(l,o),g(l,r),g(r,u),g(l,f),g(e,c),at&&at.m(e,null),w(oe,d,ye),w(oe,h,ye),g(h,m),g(m,v),g(m,b),g(b,S),g(m,C),g(h,$),g(h,M),g(h,D),g(h,O),w(oe,A,ye),w(oe,I,ye),w(oe,L,ye),j(R,oe,ye),w(oe,B,ye),w(oe,K,ye),w(oe,J,ye),w(oe,H,ye),g(H,X),g(H,W),g(H,x),g(x,Q),g(x,se);for(let Te=0;Te<ge.length;Te+=1)ge[Te].m(x,null);w(oe,me,ye),w(oe,we,ye),w(oe,Y,ye),w(oe,be,ye),g(be,ee),g(be,te),g(be,Se),g(Se,je),g(je,Ue),g(je,Z),g(je,pe),g(je,ce),g(je,ke),g(ke,Ze),j(tt,ke,null),g(ke,We),g(ke,it),g(ke,Ce),g(ke,ze),g(ke,Ge),g(ke,st),g(ke,ct),g(ke,_e),g(ke,Ie),w(oe,nt,ye),w(oe,ft,ye),w(oe,vt,ye),w(oe,ot,ye),g(ot,Ot);for(let Te=0;Te<wt.length;Te+=1)wt[Te].m(Ot,null);g(ot,Nt),g(ot,Ke);for(let Te=0;Te<$e.length;Te+=1)$e[Te].m(Ke,null);et=!0},p(oe,[ye]){var fe,de,Fe;(!et||ye&1)&&a!==(a=oe[0].name+"")&&ue(u,a),oe[4]?at||(at=Ad(),at.c(),at.m(e,null)):at&&(at.d(1),at=null),(!et||ye&1)&&y!==(y=oe[0].name+"")&&ue(S,y);const Te={};ye&9&&(Te.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${oe[3]}');
|
||||
|
||||
...
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.records.create('${(fe=oe[0])==null?void 0:fe.name}', data);
|
||||
`),ye&9&&(Te.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${oe[3]}');
|
||||
|
||||
...
|
||||
|
||||
final body = <String, dynamic>{ ... };
|
||||
|
||||
final record = await client.records.create('${(de=oe[0])==null?void 0:de.name}', body: body);
|
||||
`),R.$set(Te),ye&1&&(Pt=(Fe=oe[0])==null?void 0:Fe.schema,ge=bt(ge,ye,It,1,oe,Pt,le,x,Mn,Pd,null,Ed)),ye&6&&(Lt=oe[2],wt=bt(wt,ye,lt,1,oe,Lt,jt,Ot,Mn,Ld,null,Od)),ye&6&&(N=oe[2],Pe(),$e=bt($e,ye,z,1,oe,N,Be,Ke,Gt,Id,null,Dd),Le())},i(oe){if(!et){E(R.$$.fragment,oe),E(tt.$$.fragment,oe);for(let ye=0;ye<N.length;ye+=1)E($e[ye]);et=!0}},o(oe){P(R.$$.fragment,oe),P(tt.$$.fragment,oe);for(let ye=0;ye<$e.length;ye+=1)P($e[ye]);et=!1},d(oe){oe&&k(e),at&&at.d(),oe&&k(d),oe&&k(h),oe&&k(A),oe&&k(I),oe&&k(L),q(R,oe),oe&&k(B),oe&&k(K),oe&&k(J),oe&&k(H);for(let ye=0;ye<ge.length;ye+=1)ge[ye].d();oe&&k(me),oe&&k(we),oe&&k(Y),oe&&k(be),q(tt),oe&&k(nt),oe&&k(ft),oe&&k(vt),oe&&k(ot);for(let ye=0;ye<wt.length;ye+=1)wt[ye].d();for(let ye=0;ye<$e.length;ye+=1)$e[ye].d()}}}function cC(n,e,t){let i,s,{collection:l=new fn}=e,o=200,r=[];const a=u=>t(1,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{var u,f;n.$$.dirty&1&&t(4,i=(l==null?void 0:l.createRule)===null),n.$$.dirty&1&&t(2,r=[{code:200,body:JSON.stringify(U.dummyCollectionRecord(l),null,2)},{code:400,body:`
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Failed to create record.",
|
||||
"data": {
|
||||
"${(f=(u=l==null?void 0:l.schema)==null?void 0:u[0])==null?void 0:f.name}": {
|
||||
"code": "validation_required",
|
||||
"message": "Missing required value."
|
||||
}
|
||||
}
|
||||
}
|
||||
`},{code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "You are not allowed to perform this request.",
|
||||
"data": {}
|
||||
}
|
||||
`}])},t(3,s=U.getApiExampleUrl(ve.baseUrl)),[l,o,r,s,i,a]}class dC extends Ee{constructor(e){super(),Oe(this,e,cC,fC,De,{collection:0})}}function Fd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Nd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Rd(n,e,t){const i=n.slice();return i[11]=e[t],i}function Hd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function pC(n){let e;return{c(){e=_("span"),e.textContent="Optional",p(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function hC(n){let e;return{c(){e=_("span"),e.textContent="Required",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function mC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=F("User "),i=F(t),s=F(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ue(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function gC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=F("Relation record "),i=F(t),s=F(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ue(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function _C(n){let e,t,i,s,l;return{c(){e=F("FormData object."),t=_("br"),i=F(`
|
||||
Set to `),s=_("code"),s.textContent="null",l=F(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:re,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function bC(n){let e;return{c(){e=F("URL address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function vC(n){let e;return{c(){e=F("Email address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function yC(n){let e;return{c(){e=F("JSON array or object.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function kC(n){let e;return{c(){e=F("Number value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function wC(n){let e;return{c(){e=F("Plain text value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function jd(n,e){let t,i,s,l,o,r=e[11].name+"",a,u,f,c,d=U.getFieldValueType(e[11])+"",h,m,v,b;function y(O,A){return O[11].required?hC:pC}let S=y(e),C=S(e);function $(O,A){if(O[11].type==="text")return wC;if(O[11].type==="number")return kC;if(O[11].type==="json")return yC;if(O[11].type==="email")return vC;if(O[11].type==="url")return bC;if(O[11].type==="file")return _C;if(O[11].type==="relation")return gC;if(O[11].type==="user")return mC}let M=$(e),D=M&&M(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=T(),o=_("span"),a=F(r),u=T(),f=_("td"),c=_("span"),h=F(d),m=T(),v=_("td"),D&&D.c(),b=T(),p(s,"class","inline-flex"),p(c,"class","label"),this.first=t},m(O,A){w(O,t,A),g(t,i),g(i,s),C.m(s,null),g(s,l),g(s,o),g(o,a),g(t,u),g(t,f),g(f,c),g(c,h),g(t,m),g(t,v),D&&D.m(v,null),g(t,b)},p(O,A){e=O,S!==(S=y(e))&&(C.d(1),C=S(e),C&&(C.c(),C.m(s,l))),A&1&&r!==(r=e[11].name+"")&&ue(a,r),A&1&&d!==(d=U.getFieldValueType(e[11])+"")&&ue(h,d),M===(M=$(e))&&D?D.p(e,A):(D&&D.d(1),D=M&&M(e),D&&(D.c(),D.m(v,null)))},d(O){O&&k(t),C.d(),D&&D.d()}}}function qd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[1]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[6].code+"")&&ue(s,i),f&6&&ie(t,"active",e[1]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Vd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[1]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[6].body),i.$set(a),r&6&&ie(t,"active",e[1]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function $C(n){var oe,ye,Te;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y,S=n[0].name+"",C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,x,Q,se,ge,le,me,we=[],Y=new Map,be,ee,te,Se,je,Ue,Z,pe,ce,ke,Ze,tt,We,it,Ce,ze,Ge,st,ct,_e,Ie,nt,ft,vt,ot,Ot,wt,jt,Nt,Ke=[],$e=new Map,Be,et,at=[],Pt=new Map,It,Lt=n[4]&&Hd();B=new Ls({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.records.update('${(oe=n[0])==null?void 0:oe.name}', 'RECORD_ID', data);
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
final body = <String, dynamic>{ ... };
|
||||
|
||||
final record = await client.records.update('${(ye=n[0])==null?void 0:ye.name}', 'RECORD_ID', body: body);
|
||||
`}});let lt=(Te=n[0])==null?void 0:Te.schema;const N=fe=>fe[11].name;for(let fe=0;fe<lt.length;fe+=1){let de=Rd(n,lt,fe),Fe=N(de);Y.set(Fe,we[fe]=jd(Fe,de))}Ce=new gn({props:{content:`
|
||||
?expand=rel1,rel2.subrel21.subrel22
|
||||
`}});let z=n[2];const ne=fe=>fe[6].code;for(let fe=0;fe<z.length;fe+=1){let de=Nd(n,z,fe),Fe=ne(de);$e.set(Fe,Ke[fe]=qd(Fe,de))}let ae=n[2];const Ae=fe=>fe[6].code;for(let fe=0;fe<ae.length;fe+=1){let de=Fd(n,ae,fe),Fe=Ae(de);Pt.set(Fe,at[fe]=Vd(Fe,de))}return{c(){e=_("div"),t=_("strong"),t.textContent="PATCH",i=T(),s=_("div"),l=_("p"),o=F("/api/collections/"),r=_("strong"),u=F(a),f=F("/records/"),c=_("strong"),c.textContent=":id",d=T(),Lt&&Lt.c(),h=T(),m=_("div"),v=_("p"),b=F("Update a single "),y=_("strong"),C=F(S),$=F(" record."),M=T(),D=_("p"),D.innerHTML=`Body parameters could be sent as <code>application/json</code> or
|
||||
<code>multipart/form-data</code>.`,O=T(),A=_("p"),A.innerHTML="File upload is supported only via <code>multipart/form-data</code>.",I=T(),L=_("div"),L.textContent="Client SDKs example",R=T(),V(B.$$.fragment),K=T(),J=_("div"),J.textContent="Path parameters",H=T(),X=_("table"),X.innerHTML=`<thead><tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr></thead>
|
||||
<tbody><tr><td>id</td>
|
||||
<td><span class="label">String</span></td>
|
||||
<td>ID of the record to update.</td></tr></tbody>`,W=T(),x=_("div"),x.textContent="Body Parameters",Q=T(),se=_("table"),ge=_("thead"),ge.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="50%">Description</th></tr>`,le=T(),me=_("tbody");for(let fe=0;fe<we.length;fe+=1)we[fe].c();be=T(),ee=_("div"),ee.textContent="Query parameters",te=T(),Se=_("table"),je=_("thead"),je.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr>`,Ue=T(),Z=_("tbody"),pe=_("tr"),ce=_("td"),ce.textContent="expand",ke=T(),Ze=_("td"),Ze.innerHTML='<span class="label">String</span>',tt=T(),We=_("td"),it=F(`Auto expand relations when returning the updated record. Ex.:
|
||||
`),V(Ce.$$.fragment),ze=F(`
|
||||
Supports up to 6-levels depth nested relations expansion. `),Ge=_("br"),st=F(`
|
||||
The expanded relations will be appended to the record under the
|
||||
`),ct=_("code"),ct.textContent="@expand",_e=F(" property (eg. "),Ie=_("code"),Ie.textContent='"@expand": {"rel1": {...}, ...}',nt=F(`). Only the
|
||||
relations that the user has permissions to `),ft=_("strong"),ft.textContent="view",vt=F(" will be expanded."),ot=T(),Ot=_("div"),Ot.textContent="Responses",wt=T(),jt=_("div"),Nt=_("div");for(let fe=0;fe<Ke.length;fe+=1)Ke[fe].c();Be=T(),et=_("div");for(let fe=0;fe<at.length;fe+=1)at[fe].c();p(t,"class","label label-primary"),p(s,"class","content"),p(e,"class","alert alert-warning"),p(m,"class","content m-b-base"),p(L,"class","section-title"),p(J,"class","section-title"),p(X,"class","table-compact table-border m-b-lg"),p(x,"class","section-title"),p(se,"class","table-compact table-border m-b-lg"),p(ee,"class","section-title"),p(Se,"class","table-compact table-border m-b-lg"),p(Ot,"class","section-title"),p(Nt,"class","tabs-header compact left"),p(et,"class","tabs-content"),p(jt,"class","tabs")},m(fe,de){w(fe,e,de),g(e,t),g(e,i),g(e,s),g(s,l),g(l,o),g(l,r),g(r,u),g(l,f),g(l,c),g(e,d),Lt&&Lt.m(e,null),w(fe,h,de),w(fe,m,de),g(m,v),g(v,b),g(v,y),g(y,C),g(v,$),g(m,M),g(m,D),g(m,O),g(m,A),w(fe,I,de),w(fe,L,de),w(fe,R,de),j(B,fe,de),w(fe,K,de),w(fe,J,de),w(fe,H,de),w(fe,X,de),w(fe,W,de),w(fe,x,de),w(fe,Q,de),w(fe,se,de),g(se,ge),g(se,le),g(se,me);for(let Fe=0;Fe<we.length;Fe+=1)we[Fe].m(me,null);w(fe,be,de),w(fe,ee,de),w(fe,te,de),w(fe,Se,de),g(Se,je),g(Se,Ue),g(Se,Z),g(Z,pe),g(pe,ce),g(pe,ke),g(pe,Ze),g(pe,tt),g(pe,We),g(We,it),j(Ce,We,null),g(We,ze),g(We,Ge),g(We,st),g(We,ct),g(We,_e),g(We,Ie),g(We,nt),g(We,ft),g(We,vt),w(fe,ot,de),w(fe,Ot,de),w(fe,wt,de),w(fe,jt,de),g(jt,Nt);for(let Fe=0;Fe<Ke.length;Fe+=1)Ke[Fe].m(Nt,null);g(jt,Be),g(jt,et);for(let Fe=0;Fe<at.length;Fe+=1)at[Fe].m(et,null);It=!0},p(fe,[de]){var ht,rn,qt;(!It||de&1)&&a!==(a=fe[0].name+"")&&ue(u,a),fe[4]?Lt||(Lt=Hd(),Lt.c(),Lt.m(e,null)):Lt&&(Lt.d(1),Lt=null),(!It||de&1)&&S!==(S=fe[0].name+"")&&ue(C,S);const Fe={};de&9&&(Fe.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${fe[3]}');
|
||||
|
||||
...
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.records.update('${(ht=fe[0])==null?void 0:ht.name}', 'RECORD_ID', data);
|
||||
`),de&9&&(Fe.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${fe[3]}');
|
||||
|
||||
...
|
||||
|
||||
final body = <String, dynamic>{ ... };
|
||||
|
||||
final record = await client.records.update('${(rn=fe[0])==null?void 0:rn.name}', 'RECORD_ID', body: body);
|
||||
`),B.$set(Fe),de&1&&(lt=(qt=fe[0])==null?void 0:qt.schema,we=bt(we,de,N,1,fe,lt,Y,me,Mn,jd,null,Rd)),de&6&&(z=fe[2],Ke=bt(Ke,de,ne,1,fe,z,$e,Nt,Mn,qd,null,Nd)),de&6&&(ae=fe[2],Pe(),at=bt(at,de,Ae,1,fe,ae,Pt,et,Gt,Vd,null,Fd),Le())},i(fe){if(!It){E(B.$$.fragment,fe),E(Ce.$$.fragment,fe);for(let de=0;de<ae.length;de+=1)E(at[de]);It=!0}},o(fe){P(B.$$.fragment,fe),P(Ce.$$.fragment,fe);for(let de=0;de<at.length;de+=1)P(at[de]);It=!1},d(fe){fe&&k(e),Lt&&Lt.d(),fe&&k(h),fe&&k(m),fe&&k(I),fe&&k(L),fe&&k(R),q(B,fe),fe&&k(K),fe&&k(J),fe&&k(H),fe&&k(X),fe&&k(W),fe&&k(x),fe&&k(Q),fe&&k(se);for(let de=0;de<we.length;de+=1)we[de].d();fe&&k(be),fe&&k(ee),fe&&k(te),fe&&k(Se),q(Ce),fe&&k(ot),fe&&k(Ot),fe&&k(wt),fe&&k(jt);for(let de=0;de<Ke.length;de+=1)Ke[de].d();for(let de=0;de<at.length;de+=1)at[de].d()}}}function SC(n,e,t){let i,s,{collection:l=new fn}=e,o=200,r=[];const a=u=>t(1,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{var u,f;n.$$.dirty&1&&t(4,i=(l==null?void 0:l.updateRule)===null),n.$$.dirty&1&&t(2,r=[{code:200,body:JSON.stringify(U.dummyCollectionRecord(l),null,2)},{code:400,body:`
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Failed to update record.",
|
||||
"data": {
|
||||
"${(f=(u=l==null?void 0:l.schema)==null?void 0:u[0])==null?void 0:f.name}": {
|
||||
"code": "validation_required",
|
||||
"message": "Missing required value."
|
||||
}
|
||||
}
|
||||
}
|
||||
`},{code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "You are not allowed to perform this request.",
|
||||
"data": {}
|
||||
}
|
||||
`},{code:404,body:`
|
||||
{
|
||||
"code": 404,
|
||||
"message": "The requested resource wasn't found.",
|
||||
"data": {}
|
||||
}
|
||||
`}])},t(3,s=U.getApiExampleUrl(ve.baseUrl)),[l,o,r,s,i,a]}class CC extends Ee{constructor(e){super(),Oe(this,e,SC,$C,De,{collection:0})}}function zd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Bd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Ud(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Wd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ie(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Yd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o,r&20&&ie(t,"active",e[2]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function MC(n){var je,Ue;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y,S=n[0].name+"",C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,x=[],Q=new Map,se,ge,le=[],me=new Map,we,Y=n[1]&&Ud();A=new Ls({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
await client.records.delete('${(je=n[0])==null?void 0:je.name}', 'RECORD_ID');
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
await client.records.delete('${(Ue=n[0])==null?void 0:Ue.name}', 'RECORD_ID');
|
||||
`}});let be=n[4];const ee=Z=>Z[6].code;for(let Z=0;Z<be.length;Z+=1){let pe=Bd(n,be,Z),ce=ee(pe);Q.set(ce,x[Z]=Wd(ce,pe))}let te=n[4];const Se=Z=>Z[6].code;for(let Z=0;Z<te.length;Z+=1){let pe=zd(n,te,Z),ce=Se(pe);me.set(ce,le[Z]=Yd(ce,pe))}return{c(){e=_("div"),t=_("strong"),t.textContent="DELETE",i=T(),s=_("div"),l=_("p"),o=F("/api/collections/"),r=_("strong"),u=F(a),f=F("/records/"),c=_("strong"),c.textContent=":id",d=T(),Y&&Y.c(),h=T(),m=_("div"),v=_("p"),b=F("Delete a single "),y=_("strong"),C=F(S),$=F(" record."),M=T(),D=_("div"),D.textContent="Client SDKs example",O=T(),V(A.$$.fragment),I=T(),L=_("div"),L.textContent="Path parameters",R=T(),B=_("table"),B.innerHTML=`<thead><tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr></thead>
|
||||
<tbody><tr><td>id</td>
|
||||
<td><span class="label">String</span></td>
|
||||
<td>ID of the record to delete.</td></tr></tbody>`,K=T(),J=_("div"),J.textContent="Responses",H=T(),X=_("div"),W=_("div");for(let Z=0;Z<x.length;Z+=1)x[Z].c();se=T(),ge=_("div");for(let Z=0;Z<le.length;Z+=1)le[Z].c();p(t,"class","label label-primary"),p(s,"class","content"),p(e,"class","alert alert-danger"),p(m,"class","content m-b-base"),p(D,"class","section-title"),p(L,"class","section-title"),p(B,"class","table-compact table-border m-b-lg"),p(J,"class","section-title"),p(W,"class","tabs-header compact left"),p(ge,"class","tabs-content"),p(X,"class","tabs")},m(Z,pe){w(Z,e,pe),g(e,t),g(e,i),g(e,s),g(s,l),g(l,o),g(l,r),g(r,u),g(l,f),g(l,c),g(e,d),Y&&Y.m(e,null),w(Z,h,pe),w(Z,m,pe),g(m,v),g(v,b),g(v,y),g(y,C),g(v,$),w(Z,M,pe),w(Z,D,pe),w(Z,O,pe),j(A,Z,pe),w(Z,I,pe),w(Z,L,pe),w(Z,R,pe),w(Z,B,pe),w(Z,K,pe),w(Z,J,pe),w(Z,H,pe),w(Z,X,pe),g(X,W);for(let ce=0;ce<x.length;ce+=1)x[ce].m(W,null);g(X,se),g(X,ge);for(let ce=0;ce<le.length;ce+=1)le[ce].m(ge,null);we=!0},p(Z,[pe]){var ke,Ze;(!we||pe&1)&&a!==(a=Z[0].name+"")&&ue(u,a),Z[1]?Y||(Y=Ud(),Y.c(),Y.m(e,null)):Y&&(Y.d(1),Y=null),(!we||pe&1)&&S!==(S=Z[0].name+"")&&ue(C,S);const ce={};pe&9&&(ce.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${Z[3]}');
|
||||
|
||||
...
|
||||
|
||||
await client.records.delete('${(ke=Z[0])==null?void 0:ke.name}', 'RECORD_ID');
|
||||
`),pe&9&&(ce.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${Z[3]}');
|
||||
|
||||
...
|
||||
|
||||
await client.records.delete('${(Ze=Z[0])==null?void 0:Ze.name}', 'RECORD_ID');
|
||||
`),A.$set(ce),pe&20&&(be=Z[4],x=bt(x,pe,ee,1,Z,be,Q,W,Mn,Wd,null,Bd)),pe&20&&(te=Z[4],Pe(),le=bt(le,pe,Se,1,Z,te,me,ge,Gt,Yd,null,zd),Le())},i(Z){if(!we){E(A.$$.fragment,Z);for(let pe=0;pe<te.length;pe+=1)E(le[pe]);we=!0}},o(Z){P(A.$$.fragment,Z);for(let pe=0;pe<le.length;pe+=1)P(le[pe]);we=!1},d(Z){Z&&k(e),Y&&Y.d(),Z&&k(h),Z&&k(m),Z&&k(M),Z&&k(D),Z&&k(O),q(A,Z),Z&&k(I),Z&&k(L),Z&&k(R),Z&&k(B),Z&&k(K),Z&&k(J),Z&&k(H),Z&&k(X);for(let pe=0;pe<x.length;pe+=1)x[pe].d();for(let pe=0;pe<le.length;pe+=1)le[pe].d()}}}function TC(n,e,t){let i,s,{collection:l=new fn}=e,o=204,r=[];const a=u=>t(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.deleteRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:204,body:`
|
||||
null
|
||||
`}),r.push({code:400,body:`
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Failed to delete record. Make sure that the record is not part of a required relation reference.",
|
||||
"data": {}
|
||||
}
|
||||
`}),i&&r.push({code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "Only admins can access this action.",
|
||||
"data": {}
|
||||
}
|
||||
`}),r.push({code:404,body:`
|
||||
{
|
||||
"code": 404,
|
||||
"message": "The requested resource wasn't found.",
|
||||
"data": {}
|
||||
}
|
||||
`}))},t(3,s=CommonHelper.getApiExampleUrl(ve.baseUrl)),[l,i,o,s,r,a]}class DC extends Ee{constructor(e){super(),Oe(this,e,TC,MC,De,{collection:0})}}function OC(n){var h,m,v,b,y,S,C,$;let e,t,i,s,l,o,r,a,u,f,c,d;return r=new Ls({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[1]}');
|
||||
|
||||
...
|
||||
|
||||
// (Optionally) authenticate
|
||||
client.users.authViaEmail('test@example.com', '123456');
|
||||
|
||||
// Subscribe to changes in any record from the collection
|
||||
client.realtime.subscribe('${(h=n[0])==null?void 0:h.name}', function (e) {
|
||||
console.log(e.record);
|
||||
});
|
||||
|
||||
// Subscribe to changes in a single record
|
||||
client.realtime.subscribe('${(m=n[0])==null?void 0:m.name}/RECORD_ID', function (e) {
|
||||
console.log(e.record);
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
client.realtime.unsubscribe() // remove all subscriptions
|
||||
client.realtime.unsubscribe('${(v=n[0])==null?void 0:v.name}') // remove only the collection subscription
|
||||
client.realtime.unsubscribe('${(b=n[0])==null?void 0:b.name}/RECORD_ID') // remove only the record subscription
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[1]}');
|
||||
|
||||
...
|
||||
|
||||
// (Optionally) authenticate
|
||||
client.users.authViaEmail('test@example.com', '123456');
|
||||
|
||||
// Subscribe to changes in any record from the collection
|
||||
client.realtime.subscribe('${(y=n[0])==null?void 0:y.name}', (e) {
|
||||
print(e.record);
|
||||
});
|
||||
|
||||
// Subscribe to changes in a single record
|
||||
client.realtime.subscribe('${(S=n[0])==null?void 0:S.name}/RECORD_ID', (e) {
|
||||
print(e.record);
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
client.realtime.unsubscribe() // remove all subscriptions
|
||||
client.realtime.unsubscribe('${(C=n[0])==null?void 0:C.name}') // remove only the collection subscription
|
||||
client.realtime.unsubscribe('${($=n[0])==null?void 0:$.name}/RECORD_ID') // remove only the record subscription
|
||||
`}}),c=new gn({props:{content:JSON.stringify({action:"create",record:U.dummyCollectionRecord(n[0])},null,2).replace('"action": "create"','"action": "create" // create, update or delete')}}),{c(){e=_("div"),e.innerHTML=`<strong class="label label-primary">SSE</strong>
|
||||
<div class="content"><p>/api/realtime</p></div>`,t=T(),i=_("div"),i.innerHTML=`<p>Subscribe to realtime changes via Server-Sent Events (SSE).</p>
|
||||
<p>Events are send for <strong>create</strong>, <strong>update</strong>
|
||||
and <strong>delete</strong> record operations (see "Event data format" section below).</p>
|
||||
<div class="alert alert-info m-t-10"><div class="icon"><i class="ri-information-line"></i></div>
|
||||
<div class="contet"><p><strong>You could subscribe to a single record or to an entire collection.</strong></p>
|
||||
<p>When you subscribe to a <strong>single record</strong>, the collection's
|
||||
<strong>ViewRule</strong> will be used to determine whether the subscriber has access to receive
|
||||
the event message.</p>
|
||||
<p>When you subscribe to an <strong>entire collection</strong>, the collection's
|
||||
<strong>ListRule</strong> will be used to determine whether the subscriber has access to receive
|
||||
the event message.</p></div></div>`,s=T(),l=_("div"),l.textContent="Client SDKs example",o=T(),V(r.$$.fragment),a=T(),u=_("div"),u.textContent="Event data format",f=T(),V(c.$$.fragment),p(e,"class","alert"),p(i,"class","content m-b-base"),p(l,"class","section-title"),p(u,"class","section-title")},m(M,D){w(M,e,D),w(M,t,D),w(M,i,D),w(M,s,D),w(M,l,D),w(M,o,D),j(r,M,D),w(M,a,D),w(M,u,D),w(M,f,D),j(c,M,D),d=!0},p(M,[D]){var I,L,R,B,K,J,H,X;const O={};D&3&&(O.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${M[1]}');
|
||||
|
||||
...
|
||||
|
||||
// (Optionally) authenticate
|
||||
client.users.authViaEmail('test@example.com', '123456');
|
||||
|
||||
// Subscribe to changes in any record from the collection
|
||||
client.realtime.subscribe('${(I=M[0])==null?void 0:I.name}', function (e) {
|
||||
console.log(e.record);
|
||||
});
|
||||
|
||||
// Subscribe to changes in a single record
|
||||
client.realtime.subscribe('${(L=M[0])==null?void 0:L.name}/RECORD_ID', function (e) {
|
||||
console.log(e.record);
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
client.realtime.unsubscribe() // remove all subscriptions
|
||||
client.realtime.unsubscribe('${(R=M[0])==null?void 0:R.name}') // remove only the collection subscription
|
||||
client.realtime.unsubscribe('${(B=M[0])==null?void 0:B.name}/RECORD_ID') // remove only the record subscription
|
||||
`),D&3&&(O.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${M[1]}');
|
||||
|
||||
...
|
||||
|
||||
// (Optionally) authenticate
|
||||
client.users.authViaEmail('test@example.com', '123456');
|
||||
|
||||
// Subscribe to changes in any record from the collection
|
||||
client.realtime.subscribe('${(K=M[0])==null?void 0:K.name}', (e) {
|
||||
print(e.record);
|
||||
});
|
||||
|
||||
// Subscribe to changes in a single record
|
||||
client.realtime.subscribe('${(J=M[0])==null?void 0:J.name}/RECORD_ID', (e) {
|
||||
print(e.record);
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
client.realtime.unsubscribe() // remove all subscriptions
|
||||
client.realtime.unsubscribe('${(H=M[0])==null?void 0:H.name}') // remove only the collection subscription
|
||||
client.realtime.unsubscribe('${(X=M[0])==null?void 0:X.name}/RECORD_ID') // remove only the record subscription
|
||||
`),r.$set(O);const A={};D&1&&(A.content=JSON.stringify({action:"create",record:U.dummyCollectionRecord(M[0])},null,2).replace('"action": "create"','"action": "create" // create, update or delete')),c.$set(A)},i(M){d||(E(r.$$.fragment,M),E(c.$$.fragment,M),d=!0)},o(M){P(r.$$.fragment,M),P(c.$$.fragment,M),d=!1},d(M){M&&k(e),M&&k(t),M&&k(i),M&&k(s),M&&k(l),M&&k(o),q(r,M),M&&k(a),M&&k(u),M&&k(f),q(c,M)}}}function EC(n,e,t){let i,{collection:s=new fn}=e;return n.$$set=l=>{"collection"in l&&t(0,s=l.collection)},t(1,i=U.getApiExampleUrl(ve.baseUrl)),[s,i]}class AC extends Ee{constructor(e){super(),Oe(this,e,EC,OC,De,{collection:0})}}function Kd(n,e,t){const i=n.slice();return i[14]=e[t],i}function Zd(n,e,t){const i=n.slice();return i[14]=e[t],i}function Jd(n){let e,t,i,s;var l=n[14].component;function o(r){return{props:{collection:r[3]}}}return l&&(t=new l(o(n))),{c(){e=_("div"),t&&V(t.$$.fragment),i=T(),p(e,"class","tab-item active")},m(r,a){w(r,e,a),t&&j(t,e,null),g(e,i),s=!0},p(r,a){const u={};if(a&8&&(u.collection=r[3]),l!==(l=r[14].component)){if(t){Pe();const f=t;P(f.$$.fragment,1,0,()=>{q(f,1)}),Le()}l?(t=new l(o(r)),V(t.$$.fragment),E(t.$$.fragment,1),j(t,e,i)):t=null}else l&&t.$set(u)},i(r){s||(t&&E(t.$$.fragment,r),s=!0)},o(r){t&&P(t.$$.fragment,r),s=!1},d(r){r&&k(e),t&&q(t)}}}function Gd(n,e){let t,i,s,l=e[4]===e[14].id&&Jd(e);return{key:n,first:null,c(){t=Je(),l&&l.c(),i=Je(),this.first=t},m(o,r){w(o,t,r),l&&l.m(o,r),w(o,i,r),s=!0},p(o,r){e=o,e[4]===e[14].id?l?(l.p(e,r),r&16&&E(l,1)):(l=Jd(e),l.c(),E(l,1),l.m(i.parentNode,i)):l&&(Pe(),P(l,1,1,()=>{l=null}),Le())},i(o){s||(E(l),s=!0)},o(o){P(l),s=!1},d(o){o&&k(t),l&&l.d(o),o&&k(i)}}}function PC(n){let e,t=[],i=new Map,s,l=n[5];const o=r=>r[14].id;for(let r=0;r<l.length;r+=1){let a=Kd(n,l,r),u=o(a);i.set(u,t[r]=Gd(u,a))}return{c(){e=_("div");for(let r=0;r<t.length;r+=1)t[r].c();p(e,"class","tabs-content")},m(r,a){w(r,e,a);for(let u=0;u<t.length;u+=1)t[u].m(e,null);s=!0},p(r,a){a&56&&(l=r[5],Pe(),t=bt(t,a,o,1,r,l,i,e,Gt,Gd,null,Kd),Le())},i(r){if(!s){for(let a=0;a<l.length;a+=1)E(t[a]);s=!0}},o(r){for(let a=0;a<t.length;a+=1)P(t[a]);s=!1},d(r){r&&k(e);for(let a=0;a<t.length;a+=1)t[a].d()}}}function Xd(n,e){let t,i,s=e[14].label+"",l,o,r,a;function u(){return e[9](e[14])}function f(...c){return e[10](e[14],...c)}return{key:n,first:null,c(){t=_("button"),i=_("span"),l=F(s),o=T(),p(i,"class","txt"),p(t,"tabindex","0"),p(t,"class","tab-item"),ie(t,"active",e[4]===e[14].id),this.first=t},m(c,d){w(c,t,d),g(t,i),g(i,l),g(t,o),r||(a=[G(t,"click",u),G(t,"keydown",cm(f))],r=!0)},p(c,d){e=c,d&48&&ie(t,"active",e[4]===e[14].id)},d(c){c&&k(t),r=!1,Qe(a)}}}function LC(n){let e,t,i=n[3].name+"",s,l,o,r,a=[],u=new Map,f=n[5];const c=d=>d[14].id;for(let d=0;d<f.length;d+=1){let h=Zd(n,f,d),m=c(h);u.set(m,a[d]=Xd(m,h))}return{c(){e=_("h4"),t=_("strong"),s=F(i),l=F(" records API"),o=T(),r=_("div");for(let d=0;d<a.length;d+=1)a[d].c();p(r,"class","tabs-header stretched")},m(d,h){w(d,e,h),g(e,t),g(t,s),g(e,l),w(d,o,h),w(d,r,h);for(let m=0;m<a.length;m+=1)a[m].m(r,null)},p(d,h){h&8&&i!==(i=d[3].name+"")&&ue(s,i),h&114&&(f=d[5],a=bt(a,h,c,1,d,f,u,r,Mn,Xd,null,Zd))},d(d){d&&k(e),d&&k(o),d&&k(r);for(let h=0;h<a.length;h+=1)a[h].d()}}}function IC(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Close</span>',p(e,"type","button"),p(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[8]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function FC(n){let e,t,i={class:"overlay-panel-xl colored-header collection-panel",$$slots:{footer:[IC],header:[LC],default:[PC]},$$scope:{ctx:n}};return e=new hi({props:i}),n[11](e),e.$on("hide",n[12]),e.$on("show",n[13]),{c(){V(e.$$.fragment)},m(s,l){j(e,s,l),t=!0},p(s,[l]){const o={};l&524312&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[11](null),q(e,s)}}}function NC(n,e,t){const i=[{id:"list",label:"List",component:G3},{id:"view",label:"View",component:x3},{id:"create",label:"Create",component:dC},{id:"update",label:"Update",component:CC},{id:"delete",label:"Delete",component:DC},{id:"realtime",label:"Realtime",component:AC}];let s,l=new fn,o=i[0].id;function r(y){return t(3,l=y),u(i[0].id),s==null?void 0:s.show()}function a(){return s==null?void 0:s.hide()}function u(y){t(4,o=y)}function f(y,S){(y.code==="Enter"||y.code==="Space")&&(y.preventDefault(),u(S))}const c=()=>a(),d=y=>u(y.id),h=(y,S)=>f(S,y.id);function m(y){he[y?"unshift":"push"](()=>{s=y,t(2,s)})}function v(y){ut.call(this,n,y)}function b(y){ut.call(this,n,y)}return[a,u,s,l,o,i,f,r,c,d,h,m,v,b]}class RC extends Ee{constructor(e){super(),Oe(this,e,NC,FC,De,{show:7,hide:0,changeTab:1})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}get changeTab(){return this.$$.ctx[1]}}function HC(n){let e,t,i,s=[n[3]],l={};for(let o=0;o<s.length;o+=1)l=pt(l,s[o]);return{c(){e=_("textarea"),fi(e,l),ie(e,"svelte-1x1pbts",!0)},m(o,r){w(o,e,r),e.autofocus&&e.focus(),n[5](e),Me(e,n[0]),t||(i=[
Line truncated
|
||||
<span class="txt">Upload new file</span>`,p(t,"type","file"),p(t,"class","hidden"),t.multiple=n[5],p(s,"type","button"),p(s,"class","btn btn-secondary btn-sm btn-block"),p(e,"class","list-item btn-list-item")},m(r,a){w(r,e,a),g(e,t),n[16](t),g(e,i),g(e,s),l||(o=[G(t,"change",n[17]),G(s,"click",n[18])],l=!0)},p(r,a){a&32&&(t.multiple=r[5])},d(r){r&&k(e),n[16](null),l=!1,Qe(o)}}}function N4(n){let e,t,i,s,l,o=n[3].name+"",r,a,u,f,c=[],d=new Map,h,m,v,b=n[4];const y=D=>D[25];for(let D=0;D<b.length;D+=1){let O=ep(n,b,D),A=y(O);d.set(A,c[D]=tp(A,O))}let S=n[0],C=[];for(let D=0;D<S.length;D+=1)C[D]=np(xd(n,S,D));const $=D=>P(C[D],1,1,()=>{C[D]=null});let M=!n[8]&&ip(n);return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=F(o),u=T(),f=_("div");for(let D=0;D<c.length;D+=1)c[D].c();h=T();for(let D=0;D<C.length;D+=1)C[D].c();m=T(),M&&M.c(),p(t,"class",i=U.getFieldTypeIcon(n[3].type)),p(l,"class","txt"),p(e,"for",a=n[21]),p(f,"class","files-list")},m(D,O){w(D,e,O),g(e,t),g(e,s),g(e,l),g(l,r),w(D,u,O),w(D,f,O);for(let A=0;A<c.length;A+=1)c[A].m(f,null);g(f,h);for(let A=0;A<C.length;A+=1)C[A].m(f,null);g(f,m),M&&M.m(f,null),n[19](f),v=!0},p(D,O){if((!v||O&8&&i!==(i=U.getFieldTypeIcon(D[3].type)))&&p(t,"class",i),(!v||O&8)&&o!==(o=D[3].name+"")&&ue(r,o),(!v||O&2097152&&a!==(a=D[21]))&&p(e,"for",a),O&1558&&(b=D[4],Pe(),c=bt(c,O,y,1,D,b,d,f,Gt,tp,h,ep),Le()),O&2049){S=D[0];let A;for(A=0;A<S.length;A+=1){const I=xd(D,S,A);C[A]?(C[A].p(I,O),E(C[A],1)):(C[A]=np(I),C[A].c(),E(C[A],1),C[A].m(f,m))}for(Pe(),A=S.length;A<C.length;A+=1)$(A);Le()}D[8]?M&&(M.d(1),M=null):M?M.p(D,O):(M=ip(D),M.c(),M.m(f,null))},i(D){if(!v){for(let O=0;O<b.length;O+=1)E(c[O]);for(let O=0;O<S.length;O+=1)E(C[O]);v=!0}},o(D){for(let O=0;O<c.length;O+=1)P(c[O]);C=C.filter(Boolean);for(let O=0;O<C.length;O+=1)P(C[O]);v=!1},d(D){D&&k(e),D&&k(u),D&&k(f);for(let O=0;O<c.length;O+=1)c[O].d();xt(C,D),M&&M.d(),n[19](null)}}}function R4(n){let e,t;return e=new Ne({props:{class:"form-field form-field-file "+(n[3].required?"required":""),name:n[3].name,$$slots:{default:[N4,({uniqueId:i})=>({21:i}),({uniqueId:i})=>i?2097152:0]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,[s]){const l={};s&8&&(l.class="form-field form-field-file "+(i[3].required?"required":"")),s&8&&(l.name=i[3].name),s&136315391&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function H4(n,e,t){let i,s,l,{record:o}=e,{value:r=""}=e,{uploadedFiles:a=[]}=e,{deletedFileIndexes:u=[]}=e,{field:f=new Tn}=e,c,d;function h(A){U.removeByValue(u,A),t(1,u)}function m(A){U.pushUnique(u,A),t(1,u)}function v(A){U.isEmpty(a[A])||a.splice(A,1),t(0,a)}function b(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:r,uploadedFiles:a,deletedFileIndexes:u},bubbles:!0}))}const y=A=>h(A),S=A=>m(A),C=A=>v(A);function $(A){he[A?"unshift":"push"](()=>{c=A,t(6,c)})}const M=()=>{for(let A of c.files)a.push(A);t(0,a),t(6,c.value=null,c)},D=()=>c==null?void 0:c.click();function O(A){he[A?"unshift":"push"](()=>{d=A,t(7,d)})}return n.$$set=A=>{"record"in A&&t(2,o=A.record),"value"in A&&t(12,r=A.value),"uploadedFiles"in A&&t(0,a=A.uploadedFiles),"deletedFileIndexes"in A&&t(1,u=A.deletedFileIndexes),"field"in A&&t(3,f=A.field)},n.$$.update=()=>{var A,I;n.$$.dirty&1&&(Array.isArray(a)||t(0,a=U.toArray(a))),n.$$.dirty&2&&(Array.isArray(u)||t(1,u=U.toArray(u))),n.$$.dirty&8&&t(5,i=((A=f.options)==null?void 0:A.maxSelect)>1),n.$$.dirty&4128&&U.isEmpty(r)&&t(12,r=i?[]:""),n.$$.dirty&4096&&t(4,s=U.toArray(r)),n.$$.dirty&27&&t(8,l=(s.length||a.length)&&((I=f.options)==null?void 0:I.maxSelect)<=s.length+a.length-u.length),n.$$.dirty&3&&(a!==-1||u!==-1)&&b()},[a,u,o,f,s,i,c,d,l,h,m,v,r,y,S,C,$,M,D,O]}class j4 extends Ee{constructor(e){super(),Oe(this,e,H4,R4,De,{record:2,value:12,uploadedFiles:0,deletedFileIndexes:1,field:3})}}function sp(n){let e,t;return{c(){e=_("small"),t=F(n[1]),p(e,"class","block txt-hint txt-ellipsis")},m(i,s){w(i,e,s),g(e,t)},p(i,s){s&2&&ue(t,i[1])},d(i){i&&k(e)}}}function q4(n){let e,t,i,s,l,o=n[0].id+"",r,a,u,f,c=n[1]!==""&&n[1]!==n[0].id&&sp(n);return{c(){e=_("i"),i=T(),s=_("div"),l=_("div"),r=F(o),a=T(),c&&c.c(),p(e,"class","ri-information-line link-hint"),p(l,"class","block txt-ellipsis"),p(s,"class","content svelte-1gjwqyd")},m(d,h){w(d,e,h),w(d,i,h),w(d,s,h),g(s,l),g(l,r),g(s,a),c&&c.m(s,null),u||(f=Ye(t=Ct.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),u=!0)},p(d,[h]){t&&Kn(t.update)&&h&1&&t.update.call(null,{text:JSON.stringify(d[0],null,2),position:"left",class:"code"}),h&1&&o!==(o=d[0].id+"")&&ue(r,o),d[1]!==""&&d[1]!==d[0].id?c?c.p(d,h):(c=sp(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i:re,o:re,d(d){d&&k(e),d&&k(i),d&&k(s),c&&c.d(),u=!1,f()}}}function V4(n,e,t){let i;const s=["id","created","updated","@collectionId","@collectionName"];let{item:l={}}=e;function o(r){r=r||{};const a=["name","title","label","key","email","heading","content",...ObjectLine truncated
|
||||
`,p(e,"class","block txt-center txt-disabled")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function aM(n){let e,t,i;function s(o){n[31](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new oM({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function uM(n){let e,t,i;function s(o){n[30](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new G4({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function fM(n){let e,t,i,s,l;function o(f){n[27](f,n[40])}function r(f){n[28](f,n[40])}function a(f){n[29](f,n[40])}let u={field:n[40],record:n[2]};return n[2][n[40].name]!==void 0&&(u.value=n[2][n[40].name]),n[3][n[40].name]!==void 0&&(u.uploadedFiles=n[3][n[40].name]),n[4][n[40].name]!==void 0&&(u.deletedFileIndexes=n[4][n[40].name]),e=new j4({props:u}),he.push(()=>Re(e,"value",o)),he.push(()=>Re(e,"uploadedFiles",r)),he.push(()=>Re(e,"deletedFileIndexes",a)),{c(){V(e.$$.fragment)},m(f,c){j(e,f,c),l=!0},p(f,c){n=f;const d={};c[0]&1&&(d.field=n[40]),c[0]&4&&(d.record=n[2]),!t&&c[0]&5&&(t=!0,d.value=n[2][n[40].name],He(()=>t=!1)),!i&&c[0]&9&&(i=!0,d.uploadedFiles=n[3][n[40].name],He(()=>i=!1)),!s&&c[0]&17&&(s=!0,d.deletedFileIndexes=n[4][n[40].name],He(()=>s=!1)),e.$set(d)},i(f){l||(E(e.$$.fragment,f),l=!0)},o(f){P(e.$$.fragment,f),l=!1},d(f){q(e,f)}}}function cM(n){let e,t,i;function s(o){n[26](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new b4({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function dM(n){let e,t,i;function s(o){n[25](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new h4({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function pM(n){let e,t,i;function s(o){n[24](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new f4({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function hM(n){let e,t,i;function s(o){n[23](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new o4({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function mM(n){let e,t,i;function s(o){n[22](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new n4({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function gM(n){let e,t,i;function s(o){n[21](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new QC({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function _M(n){let e,t,i;function s(o){n[20](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new ZC({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){q(e,o)}}}function bM(n){let e,t,i;function s(o){n[19](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new UC({props:l}),he.push(()=>Re(e,"value",s)),{c(){V(e.$$.fragment)},m(o,r){j(e,o,r),i=!0},p(o,r){n=o;
Line truncated
|
||||
<span class="txt">Delete</span>`,p(e,"tabindex","0"),p(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[18]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function kM(n){let e,t=n[2].isNew?"New":"Edit",i,s,l=n[0].name+"",o,r,a,u,f,c=!n[2].isNew&&n[10]&&pp(n);return{c(){e=_("h4"),i=F(t),s=T(),o=F(l),r=F(" record"),a=T(),c&&c.c(),u=Je()},m(d,h){w(d,e,h),g(e,i),g(e,s),g(e,o),g(e,r),w(d,a,h),c&&c.m(d,h),w(d,u,h),f=!0},p(d,h){(!f||h[0]&4)&&t!==(t=d[2].isNew?"New":"Edit")&&ue(i,t),(!f||h[0]&1)&&l!==(l=d[0].name+"")&&ue(o,l),!d[2].isNew&&d[10]?c?(c.p(d,h),h[0]&1028&&E(c,1)):(c=pp(d),c.c(),E(c,1),c.m(u.parentNode,u)):c&&(Pe(),P(c,1,1,()=>{c=null}),Le())},i(d){f||(E(c),f=!0)},o(d){P(c),f=!1},d(d){d&&k(e),d&&k(a),c&&c.d(d),d&&k(u)}}}function wM(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=T(),s=_("button"),l=_("span"),r=F(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[7],p(l,"class","txt"),p(s,"type","submit"),p(s,"form",n[11]),p(s,"class","btn btn-expanded"),s.disabled=a=!n[9]||n[7],ie(s,"btn-loading",n[7])},m(c,d){w(c,e,d),g(e,t),w(c,i,d),w(c,s,d),g(s,l),g(l,r),u||(f=G(e,"click",n[17]),u=!0)},p(c,d){d[0]&128&&(e.disabled=c[7]),d[0]&4&&o!==(o=c[2].isNew?"Create":"Save changes")&&ue(r,o),d[0]&640&&a!==(a=!c[9]||c[7])&&(s.disabled=a),d[0]&128&&ie(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,f()}}}function $M(n){let e,t,i={class:"overlay-panel-lg record-panel",beforeHide:n[32],$$slots:{footer:[wM],header:[kM],default:[vM]},$$scope:{ctx:n}};return e=new hi({props:i}),n[33](e),e.$on("hide",n[34]),e.$on("show",n[35]),{c(){V(e.$$.fragment)},m(s,l){j(e,s,l),t=!0},p(s,l){const o={};l[0]&288&&(o.beforeHide=s[32]),l[0]&1693|l[1]&8192&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[33](null),q(e,s)}}}function hp(n){return JSON.stringify(n)}function SM(n,e,t){let i,s,l,o;const r=on(),a="record_"+U.randomString(5);let{collection:u}=e,f,c=null,d=new fo,h=!1,m=!1,v={},b={},y="";function S(ee){return $(ee),t(8,m=!0),f==null?void 0:f.show()}function C(){return f==null?void 0:f.hide()}async function $(ee){Si({}),c=ee||{},t(2,d=ee!=null&&ee.clone?ee.clone():new fo),t(3,v={}),t(4,b={}),await ni(),t(15,y=hp(d))}function M(){if(h||!l)return;t(7,h=!0);const ee=O();let te;d.isNew?te=ve.records.create(u==null?void 0:u.id,ee):te=ve.records.update(u==null?void 0:u.id,d.id,ee),te.then(async Se=>{cn(d.isNew?"Successfully created record.":"Successfully updated record."),t(8,m=!1),C(),r("save",Se)}).catch(Se=>{ve.errorResponseHandler(Se)}).finally(()=>{t(7,h=!1)})}function D(){!(c!=null&&c.id)||ci("Do you really want to delete the selected record?",()=>ve.records.delete(c["@collectionId"],c.id).then(()=>{C(),cn("Successfully deleted record."),r("delete",c)}).catch(ee=>{ve.errorResponseHandler(ee)}))}function O(){const ee=(d==null?void 0:d.export())||{},te=new FormData,Se={};for(const je of(u==null?void 0:u.schema)||[])Se[je.name]=je;for(const je in ee)!Se[je]||(typeof ee[je]>"u"&&(ee[je]=null),U.addValueToFormData(te,je,ee[je]));for(const je in v){const Ue=U.toArray(v[je]);for(const Z of Ue)te.append(je,Z)}for(const je in b){const Ue=U.toArray(b[je]);for(const Z of Ue)te.append(je+"."+Z,"")}return te}const A=()=>C(),I=()=>D();function L(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function R(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function B(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function K(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function J(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function H(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function X(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function W(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function x(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function Q(ee,te){n.$$.not_equal(v[te.name],ee)&&(v[te.name]=ee,t(3,v))}function se(ee,te){n.$$.not_equal(b[te.name],ee)&&(b[te.name]=ee,t(4,b))}function ge(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}function le(ee,te){n.$$.not_equal(d[te.name],ee)&&(d[te.name]=ee,t(2,d))}const me=()=>s&&m?(ci("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,m=!1),C()}),!1):!0;function we(ee){he[ee?"unshift":"push"](()=>{f=ee,t(6,f)})}function Y(ee){ut.call(this,n,ee)}function be(ee){ut.call(this,n,ee)}return n.$$set=ee=>{"collection"in ee&&t(0,u=ee.collection)},n.$$.update=()=>{n.$$.dirty[0]&24&&t(16,i=U.hasNonEmptyProps(v)||U.hasNonEmptyProps(b)),n.$$.dirty[0]&98308&&t(5,s=i||y!=hp(d)),n.$$.dirty[0]&36&&t(9,l=d.isNew||s),n.$$.dirty[0]&1&&t(10,o=(u==null?void 0:u.name)!=="profiles")},[u,C,d,v,b,s,f,h,m,l,o,a,M,D,S,y,i,A,I,L,R,B,K,J,H,X,W,x,Q,se,ge,le,me,we,Y,be]}class F_ extends Ee{constructor(e){super(),Oe(this,e,SM,$M,De,{coLine truncated
|
||||
`},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Mp(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear filters</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[28]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function Tp(n,e){let t,i,s;return i=new N_({props:{record:e[35],field:e[38]}}),{key:n,first:null,c(){t=Je(),V(i.$$.fragment),this.first=t},m(l,o){w(l,t,o),j(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&8&&(r.record=e[35]),o[0]&2048&&(r.field=e[38]),i.$set(r)},i(l){s||(E(i.$$.fragment,l),s=!0)},o(l){P(i.$$.fragment,l),s=!1},d(l){l&&k(t),q(i,l)}}}function Dp(n,e){let t,i,s,l,o,r,a,u,f,c,d,h,m,v=[],b=new Map,y,S,C,$,M,D,O,A,I,L,R,B;function K(){return e[25](e[35])}h=new Xo({props:{id:e[35].id}});let J=e[11];const H=x=>x[38].name;for(let x=0;x<J.length;x+=1){let Q=wp(e,J,x),se=H(Q);b.set(se,v[x]=Tp(se,Q))}C=new wi({props:{date:e[35].created}}),D=new wi({props:{date:e[35].updated}});function X(){return e[26](e[35])}function W(...x){return e[27](e[35],...x)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),l=_("input"),a=T(),u=_("label"),c=T(),d=_("td"),V(h.$$.fragment),m=T();for(let x=0;x<v.length;x+=1)v[x].c();y=T(),S=_("td"),V(C.$$.fragment),$=T(),M=_("td"),V(D.$$.fragment),O=T(),A=_("td"),A.innerHTML='<i class="ri-arrow-right-line"></i>',I=T(),p(l,"type","checkbox"),p(l,"id",o="checkbox_"+e[35].id),l.checked=r=e[5][e[35].id],p(u,"for",f="checkbox_"+e[35].id),p(s,"class","form-field"),p(i,"class","bulk-select-col min-width"),p(d,"class","col-type-text col-field-id"),p(S,"class","col-type-date col-field-created"),p(M,"class","col-type-date col-field-updated"),p(A,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(x,Q){w(x,t,Q),g(t,i),g(i,s),g(s,l),g(s,a),g(s,u),g(t,c),g(t,d),j(h,d,null),g(t,m);for(let se=0;se<v.length;se+=1)v[se].m(t,null);g(t,y),g(t,S),j(C,S,null),g(t,$),g(t,M),j(D,M,null),g(t,O),g(t,A),g(t,I),L=!0,R||(B=[G(l,"change",K),G(s,"click",ei(e[19])),G(t,"click",X),G(t,"keydown",W)],R=!0)},p(x,Q){e=x,(!L||Q[0]&8&&o!==(o="checkbox_"+e[35].id))&&p(l,"id",o),(!L||Q[0]&40&&r!==(r=e[5][e[35].id]))&&(l.checked=r),(!L||Q[0]&8&&f!==(f="checkbox_"+e[35].id))&&p(u,"for",f);const se={};Q[0]&8&&(se.id=e[35].id),h.$set(se),Q[0]&2056&&(J=e[11],Pe(),v=bt(v,Q,H,1,e,J,b,t,Gt,Tp,y,wp),Le());const ge={};Q[0]&8&&(ge.date=e[35].created),C.$set(ge);const le={};Q[0]&8&&(le.date=e[35].updated),D.$set(le)},i(x){if(!L){E(h.$$.fragment,x);for(let Q=0;Q<J.length;Q+=1)E(v[Q]);E(C.$$.fragment,x),E(D.$$.fragment,x),L=!0}},o(x){P(h.$$.fragment,x);for(let Q=0;Q<v.length;Q+=1)P(v[Q]);P(C.$$.fragment,x),P(D.$$.fragment,x),L=!1},d(x){x&&k(t),q(h);for(let Q=0;Q<v.length;Q+=1)v[Q].d();q(C),q(D),R=!1,Qe(B)}}}function Op(n){let e,t,i=n[3].length+"",s,l,o;return{c(){e=_("small"),t=F("Showing "),s=F(i),l=F(" of "),o=F(n[4]),p(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),g(e,t),g(e,s),g(e,l),g(e,o)},p(r,a){a[0]&8&&i!==(i=r[3].length+"")&&ue(s,i),a[0]&16&&ue(o,r[4])},d(r){r&&k(e)}}}function Ep(n){let e,t,i,s,l=n[4]-n[3].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=F("Load more ("),o=F(l),r=F(")"),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-lg btn-secondary btn-expanded"),ie(t,"btn-loading",n[8]),ie(t,"btn-disabled",n[8]),p(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),g(e,t),g(t,i),g(i,s),g(i,o),g(i,r),a||(u=G(t,"click",n[29]),a=!0)},p(f,c){c[0]&24&&l!==(l=f[4]-f[3].length+"")&&ue(o,l),c[0]&256&&ie(t,"btn-loading",f[8]),c[0]&256&&ie(t,"btn-disabled",f[8])},d(f){f&&k(e),a=!1,u()}}}function Ap(n){let e,t,i,s,l,o,r=n[6]===1?"record":"records",a,u,f,c,d,h,m,v,b,y,S;return{c(){e=_("div"),t=_("div"),i=F("Selected "),s=_("strong"),l=F(n[6]),o=T(),a=F(r),u=T(),f=_("button"),f.innerHTML='<span class="txt">Reset</span>',c=T(),d=_("div"),h=T(),m=_("button"),m.innerHTML='<span class="txt">Delete selected</span>',p(t,"class","txt"),p(f,"type","button"),p(f,"class","btn btn-xs btn-secondary btn-outline p-l-5 p-r-5"),ie(f,"btn-disabled",n[9]),p(d,"class","flex-fill"),p(m,"type","button"),p(m,"class","btn btn-sm btn-secondary btn-danger"),ie(m,"btn-loading",n[9]),ie(m,"btn-disabled",n[9]),p(e,"class","bulkbar")},m(C,$){w(C,e,$),g(e,t),g(t,i),g(t,s),g(s,l),g(t,o),g(t,a),g(e,u),g(e,f),g(e,c),g(e,d),g(e,h),g(e,m),b=!0,y||(S=[G(f,"click",n[30]),G(m,"click",n[31])],y=!0)},p(C,$){(!b||$[0]&64)&&ue(l,C[6]),(!b||$[0]&64)&&r!==(r=C[6]===1?"record":"records")&&ue(a,r),$[0]&512&&ie(f,"btn-disabled",C[9]),$[0]&512&&ie(m,"btn-loading",C[9]),$[0]&512&&ie(m,"btn-disabled",C[9])},i(C){b||(C&&Dt(()=>{v||(v=rt(e,Bn,{duration:150,y:5},!0)),v.run(1)}),b=!0)},o(C){C&&(v||(v=rt(e,Bn,{duration:150,y:5},!1)),v.run(0)),b=!1},d(C){C&&k(e),C&&v&&v.end(),y=!1,Qe(S)}}}function YM(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v=[],b=new Map,y,S,C,$,M,D,O,A,I,L,R=[],B=new Map,K,J,H,X,W,x,Q;function se(ce){n[21](ce)}let ge={class:"col-type-text col-field-id",name:"id",$$slots:{defa
Line truncated
|
||||
<span class="txt">API Preview</span>`,b=T(),y=_("button"),y.innerHTML=`<i class="ri-add-line"></i>
|
||||
<span class="txt">New record</span>`,S=T(),V(C.$$.fragment),$=T(),V(M.$$.fragment),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(f,"type","button"),p(f,"class","btn btn-secondary btn-circle"),p(u,"class","inline-flex gap-5"),p(v,"type","button"),p(v,"class","btn btn-outline"),p(y,"type","button"),p(y,"class","btn btn-expanded"),p(m,"class","btns-group"),p(e,"class","page-header")},m(J,H){w(J,e,H),g(e,t),g(t,i),g(t,s),g(t,l),g(l,r),g(e,a),g(e,u),g(u,f),g(u,c),j(d,u,null),g(e,h),g(e,m),g(m,v),g(m,b),g(m,y),w(J,S,H),j(C,J,H),w(J,$,H),j(M,J,H),A=!0,I||(L=[Ye(Ct.call(null,f,{text:"Edit collection",position:"right"})),G(f,"click",n[12]),G(v,"click",n[14]),G(y,"click",n[15])],I=!0)},p(J,H){(!A||H&4)&&o!==(o=J[2].name+"")&&ue(r,o);const X={};H&1&&(X.value=J[0]),H&4&&(X.autocompleteCollection=J[2]),C.$set(X);const W={};H&4&&(W.collection=J[2]),!D&&H&1&&(D=!0,W.filter=J[0],He(()=>D=!1)),!O&&H&2&&(O=!0,W.sort=J[1],He(()=>O=!1)),M.$set(W)},i(J){A||(E(d.$$.fragment,J),E(C.$$.fragment,J),E(M.$$.fragment,J),A=!0)},o(J){P(d.$$.fragment,J),P(C.$$.fragment,J),P(M.$$.fragment,J),A=!1},d(J){J&&k(e),q(d),J&&k(S),q(C,J),J&&k($),n[17](null),q(M,J),I=!1,Qe(L)}}}function xM(n){let e,t,i,s,l,o,r,a;return{c(){e=_("div"),t=_("div"),t.innerHTML='<i class="ri-database-2-line"></i>',i=T(),s=_("h1"),s.textContent="Create your first collection to add records!",l=T(),o=_("button"),o.innerHTML=`<i class="ri-add-line"></i>
|
||||
<span class="txt">Create new collection</span>`,p(t,"class","icon"),p(s,"class","m-b-10"),p(o,"type","button"),p(o,"class","btn btn-expanded-lg btn-lg"),p(e,"class","placeholder-section m-b-base")},m(u,f){w(u,e,f),g(e,t),g(e,i),g(e,s),g(e,l),g(e,o),r||(a=G(o,"click",n[11]),r=!0)},p:re,d(u){u&&k(e),r=!1,a()}}}function eT(n){let e;return{c(){e=_("div"),e.innerHTML=`<span class="loader loader-lg"></span>
|
||||
<h1>Loading collections...</h1>`,p(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function tT(n){let e,t,i,s,l,o,r,a,u;const f=[XM,GM,JM],c=[];function d(b,y){return b[8]?0:b[7].length?2:1}e=d(n),t=c[e]=f[e](n);let h={};s=new Ya({props:h}),n[21](s);let m={};o=new RC({props:m}),n[22](o);let v={collection:n[2]};return a=new F_({props:v}),n[23](a),a.$on("save",n[24]),a.$on("delete",n[25]),{c(){t.c(),i=T(),V(s.$$.fragment),l=T(),V(o.$$.fragment),r=T(),V(a.$$.fragment)},m(b,y){c[e].m(b,y),w(b,i,y),j(s,b,y),w(b,l,y),j(o,b,y),w(b,r,y),j(a,b,y),u=!0},p(b,[y]){let S=e;e=d(b),e===S?c[e].p(b,y):(Pe(),P(c[S],1,1,()=>{c[S]=null}),Le(),t=c[e],t?t.p(b,y):(t=c[e]=f[e](b),t.c()),E(t,1),t.m(i.parentNode,i));const C={};s.$set(C);const $={};o.$set($);const M={};y&4&&(M.collection=b[2]),a.$set(M)},i(b){u||(E(t),E(s.$$.fragment,b),E(o.$$.fragment,b),E(a.$$.fragment,b),u=!0)},o(b){P(t),P(s.$$.fragment,b),P(o.$$.fragment,b),P(a.$$.fragment,b),u=!1},d(b){c[e].d(b),b&&k(i),n[21](null),q(s,b),b&&k(l),n[22](null),q(o,b),b&&k(r),n[23](null),q(a,b)}}}function nT(n,e,t){let i,s,l,o,r,a;kt(n,ui,W=>t(2,s=W)),kt(n,Ds,W=>t(10,l=W)),kt(n,Ro,W=>t(26,o=W)),kt(n,Rt,W=>t(27,r=W)),kt(n,na,W=>t(8,a=W)),dn(Rt,r="Collections",r);const u=new URLSearchParams(o);let f,c,d,h,m=u.get("filter")||"",v=u.get("sort")||"-created",b=u.get("collectionId")||"";function y(){t(9,b=s.id),t(1,v="-created"),t(0,m="")}f$(b);const S=()=>f==null?void 0:f.show(),C=()=>f==null?void 0:f.show(s),$=()=>h==null?void 0:h.load(),M=()=>c==null?void 0:c.show(s),D=()=>d==null?void 0:d.show(),O=W=>t(0,m=W.detail);function A(W){he[W?"unshift":"push"](()=>{h=W,t(6,h)})}function I(W){m=W,t(0,m)}function L(W){v=W,t(1,v)}const R=W=>d==null?void 0:d.show(W==null?void 0:W.detail);function B(W){he[W?"unshift":"push"](()=>{f=W,t(3,f)})}function K(W){he[W?"unshift":"push"](()=>{c=W,t(4,c)})}function J(W){he[W?"unshift":"push"](()=>{d=W,t(5,d)})}const H=()=>h==null?void 0:h.load(),X=()=>h==null?void 0:h.load();return n.$$.update=()=>{if(n.$$.dirty&1024&&t(7,i=l.filter(W=>W.name!="profiles")),n.$$.dirty&516&&(s==null?void 0:s.id)&&b!=s.id&&y(),n.$$.dirty&7&&(v||m||(s==null?void 0:s.id))){const W=new URLSearchParams({collectionId:(s==null?void 0:s.id)||"",filter:m,sort:v}).toString();$i("/collections?"+W)}},[m,v,s,f,c,d,h,i,a,b,l,S,C,$,M,D,O,A,I,L,R,B,K,J,H,X]}class iT extends Ee{constructor(e){super(),Oe(this,e,nT,tT,De,{})}}function Pp(n){let e,t;return e=new Ne({props:{class:"form-field disabled",name:"id",$$slots:{default:[sT,({uniqueId:i})=>({31:i}),({uniqueId:i})=>[0,i?1:0]]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,s){const l={};s[0]&2|s[1]&3&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function sT(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="ID",o=T(),r=_("input"),p(t,"class",U.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"for",l=n[31]),p(r,"type","text"),p(r,"id",a=n[31]),r.value=u=n[1].id,r.disabled=!0},m(f,c){w(f,e,c),g(e,t),g(e,i),g(e,s),w(f,o,c),w(f,r,c)},p(f,c){c[1]&1&&l!==(l=f[31])&&p(e,"for",l),c[1]&1&&a!==(a=f[31])&&p(r,"id",a),c[0]&2&&u!==(u=f[1].id)&&r.value!==u&&(r.value=u)},d(f){f&&k(e),f&&k(o),f&&k(r)}}}function Lp(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='<i class="ri-shield-check-line"></i>',p(e,"class","form-field-addon txt-success")},m(s,l){w(s,e,l),t||(i=Ye(Ct.call(null,e,"Verified")),t=!0)},d(s){s&&k(e),t=!1,i()}}}function lT(n){let e,t,i,s,l,o,r,a,u,f,c,d=n[1].verified&&Lp();return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="Email",o=T(),d&&d.c(),r=T(),a=_("input"),p(t,"class",U.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"for",l=n[31]),p(a,"type","email"),p(a,"autocomplete","off"),p(a,"id",u=n[31]),a.required=!0},m(h,m){w(h,e,m),g(e,t),g(e,i),g(e,s),w(h,o,m),d&&d.m(h,m),w(h,r,m),w(h,a,m),Me(a,n[2]),f||(c=G(a,"input",n[19]),f=!0)},p(h,m){m[1]&1&&l!==(l=h[31])&&p(e,"for",l),h[1].verified?d||(d=Lp(),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null),m[1]&1&&u!==(u=h[31])&&p(a,"id",u),m[0]&4&&a.value!==h[2]&&Me(a,h[2])},d(h){h&&k(e),h&&k(o),d&&d.d(h),h&&k(r),h&&k(a),f=!1,c()}}}function Ip(n){let e,t;return e=new Ne({props:{class:"form-field form-field-toggle",$$slots:{default:[oT,({uniqueId:i})=>({31:i}),({uniqueId:i})=>[0,i?1:0]]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,s){const l={};s[0]&8|s[1]&3&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function oT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=F("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[31]),p(s,"for",o=n[31])},m(u,f){w(u,e,f),e.checked=n[3],w(u,i,f),w(u,s,f),g(s,l),r||(a=G(e,"change",n[20]),r=!0)},p(u,f){f[1]&1&&t!==(t=u[31])&&p(e,"id",t),f[0]&8&&(e.checked=u[3]),f[1]&1&&o!==(o=u[31])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Fp(n){let e,tLine truncated
|
||||
<span class="txt">Send verification email</span>`,p(e,"type","button"),p(e,"class","dropdown-item")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[16]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function dT(n){let e,t,i,s,l=!n[1].verified&&Hp(n);return{c(){l&&l.c(),e=T(),t=_("button"),t.innerHTML=`<i class="ri-delete-bin-7-line"></i>
|
||||
<span class="txt">Delete</span>`,p(t,"type","button"),p(t,"class","dropdown-item")},m(o,r){l&&l.m(o,r),w(o,e,r),w(o,t,r),i||(s=G(t,"click",n[17]),i=!0)},p(o,r){o[1].verified?l&&(l.d(1),l=null):l?l.p(o,r):(l=Hp(o),l.c(),l.m(e.parentNode,e))},d(o){l&&l.d(o),o&&k(e),o&&k(t),i=!1,s()}}}function pT(n){let e,t,i,s,l,o,r=n[1].isNew?"Create":"Save changes",a,u,f,c,d,h=!n[1].isNew&&Rp(n);return{c(){h&&h.c(),e=T(),t=_("button"),i=_("span"),i.textContent="Cancel",s=T(),l=_("button"),o=_("span"),a=F(r),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-secondary"),t.disabled=n[5],p(o,"class","txt"),p(l,"type","submit"),p(l,"form",n[11]),p(l,"class","btn btn-expanded"),l.disabled=u=!n[10]||n[5],ie(l,"btn-loading",n[5])},m(m,v){h&&h.m(m,v),w(m,e,v),w(m,t,v),g(t,i),w(m,s,v),w(m,l,v),g(l,o),g(o,a),f=!0,c||(d=G(t,"click",n[18]),c=!0)},p(m,v){m[1].isNew?h&&(Pe(),P(h,1,1,()=>{h=null}),Le()):h?(h.p(m,v),v[0]&2&&E(h,1)):(h=Rp(m),h.c(),E(h,1),h.m(e.parentNode,e)),(!f||v[0]&32)&&(t.disabled=m[5]),(!f||v[0]&2)&&r!==(r=m[1].isNew?"Create":"Save changes")&&ue(a,r),(!f||v[0]&1056&&u!==(u=!m[10]||m[5]))&&(l.disabled=u),v[0]&32&&ie(l,"btn-loading",m[5])},i(m){f||(E(h),f=!0)},o(m){P(h),f=!1},d(m){h&&h.d(m),m&&k(e),m&&k(t),m&&k(s),m&&k(l),c=!1,d()}}}function hT(n){let e,t,i={popup:!0,class:"user-panel",beforeHide:n[24],$$slots:{footer:[pT],header:[cT],default:[fT]},$$scope:{ctx:n}};return e=new hi({props:i}),n[25](e),e.$on("hide",n[26]),e.$on("show",n[27]),{c(){V(e.$$.fragment)},m(s,l){j(e,s,l),t=!0},p(s,l){const o={};l[0]&1088&&(o.beforeHide=s[24]),l[0]&1966|l[1]&2&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[25](null),q(e,s)}}}function mT(n,e,t){let i;const s=on(),l="user_"+U.randomString(5);let o,r=new co,a=!1,u=!1,f="",c="",d="",h=!1,m=!0;function v(x){return y(x),t(6,u=!0),o==null?void 0:o.show()}function b(){return o==null?void 0:o.hide()}function y(x){Si({}),t(1,r=x!=null&&x.clone?x.clone():new co),S()}function S(){t(3,h=!1),t(9,m=!0),t(2,f=(r==null?void 0:r.email)||""),t(7,c=""),t(8,d="")}function C(){if(a||!i)return;t(5,a=!0);const x={email:f};(r.isNew||h)&&(x.password=c,x.passwordConfirm=d);let Q;r.isNew?Q=ve.users.create(x):Q=ve.users.update(r.id,x),Q.then(async se=>{m&&M(!1),t(6,u=!1),b(),cn(r.isNew?"Successfully created user.":"Successfully updated user."),s("save",se)}).catch(se=>{ve.errorResponseHandler(se)}).finally(()=>{t(5,a=!1)})}function $(){!(r!=null&&r.id)||ci("Do you really want to delete the selected user?",()=>ve.users.delete(r.id).then(()=>{t(6,u=!1),b(),cn("Successfully deleted user."),s("delete",r)}).catch(x=>{ve.errorResponseHandler(x)}))}function M(x=!0){return ve.users.requestVerification(r.isNew?f:r.email).then(()=>{t(6,u=!1),b(),x&&cn(`Successfully sent verification email to ${r.email}.`)}).catch(Q=>{ve.errorResponseHandler(Q)})}const D=()=>M(),O=()=>$(),A=()=>b();function I(){f=this.value,t(2,f)}function L(){h=this.checked,t(3,h)}function R(){c=this.value,t(7,c)}function B(){d=this.value,t(8,d)}function K(){m=this.checked,t(9,m)}const J=()=>i&&u?(ci("You have unsaved changes. Do you really want to close the panel?",()=>{t(6,u=!1),b()}),!1):!0;function H(x){he[x?"unshift":"push"](()=>{o=x,t(4,o)})}function X(x){ut.call(this,n,x)}function W(x){ut.call(this,n,x)}return n.$$.update=()=>{n.$$.dirty[0]&14&&t(10,i=r.isNew&&f!=""||h||f!==r.email)},[b,r,f,h,o,a,u,c,d,m,i,l,C,$,M,v,D,O,A,I,L,R,B,K,J,H,X,W]}class gT extends Ee{constructor(e){super(),Oe(this,e,mT,hT,De,{show:15,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[0]}}function jp(n,e,t){const i=n.slice();return i[40]=e[t],i}function qp(n,e,t){const i=n.slice();return i[43]=e[t],i}function Vp(n,e,t){const i=n.slice();return i[43]=e[t],i}function _T(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C,$,M,D,O,A,I,L=[],R=new Map,B,K,J,H,X,W,x,Q,se,ge,le=[],me=new Map,we,Y,be,ee,te,Se;a=new Uo({}),a.$on("refresh",n[17]),m=new Bo({props:{value:n[3],placeholder:"Search filter, eg. verified=1",extraAutocompleteKeys:["verified","email"]}}),m.$on("submit",n[19]);function je(_e){n[20](_e)}let Ue={class:"col-type-text col-field-id",name:"id",$$slots:{default:[vT]},$$scope:{ctx:n}};n[4]!==void 0&&(Ue.sort=n[4]),$=new sn({props:Ue}),he.push(()=>Re($,"sort",je));function Z(_e){n[21](_e)}let pe={class:"col-type-email col-field-email",name:"email",$$slots:{default:[yT]},$$scope:{ctx:n}};n[4]!==void 0&&(pe.sort=n[4]),O=new sn({props:pe}),he.push(()=>Re(O,"sort",Z));let ce=n[12];const ke=_e=>_e[43].name;for(let _e=0;_e<ce.length;_e+=1){let Ie=Vp(n,ce,_e),nt=ke(Ie);R.set(nt,L[_e]=zp(nt,Ie))}function Ze(_e){n[22](_e)}let tt={class:"col-type-date col-field-created",name:"created",$$slots:{default:[kT]},$$scope:{ctx:n}};n[4]!==void 0&&(tt.sort=n[4]),K=new sn({props:tt}),he.push(()=>Re(K,"sort",Ze));function We(_e){n[23](_e)}let it={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[wT]},$$scope:{ctx:n}};n[4]!==void 0&&(it.sorLine truncated
|
||||
<span class="txt">New user</span>`,h=T(),V(m.$$.fragment),v=T(),b=_("div"),y=_("table"),S=_("thead"),C=_("tr"),V($.$$.fragment),D=T(),V(O.$$.fragment),I=T();for(let _e=0;_e<L.length;_e+=1)L[_e].c();B=T(),V(K.$$.fragment),H=T(),V(X.$$.fragment),x=T(),Q=_("th"),se=T(),ge=_("tbody");for(let _e=0;_e<le.length;_e+=1)le[_e].c();Ge&&Ge.c(),we=T(),st&&st.c(),Y=T(),ct&&ct.c(),be=Je(),p(i,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(o,"type","button"),p(o,"class","btn btn-secondary btn-circle"),p(f,"class","flex-fill"),p(d,"type","button"),p(d,"class","btn btn-expanded"),p(e,"class","page-header"),p(Q,"class","col-type-action min-width"),p(y,"class","table"),ie(y,"table-loading",n[10]),p(b,"class","table-wrapper")},m(_e,Ie){w(_e,e,Ie),g(e,t),g(t,i),g(i,s),g(e,l),g(e,o),g(e,r),j(a,e,null),g(e,u),g(e,f),g(e,c),g(e,d),w(_e,h,Ie),j(m,_e,Ie),w(_e,v,Ie),w(_e,b,Ie),g(b,y),g(y,S),g(S,C),j($,C,null),g(C,D),j(O,C,null),g(C,I);for(let nt=0;nt<L.length;nt+=1)L[nt].m(C,null);g(C,B),j(K,C,null),g(C,H),j(X,C,null),g(C,x),g(C,Q),g(y,se),g(y,ge);for(let nt=0;nt<le.length;nt+=1)le[nt].m(ge,null);Ge&&Ge.m(ge,null),w(_e,we,Ie),st&&st.m(_e,Ie),w(_e,Y,Ie),ct&&ct.m(_e,Ie),w(_e,be,Ie),ee=!0,te||(Se=[Ye(Ct.call(null,o,{text:"Edit profile collection",position:"right"})),G(o,"click",n[16]),G(d,"click",n[18])],te=!0)},p(_e,Ie){(!ee||Ie[0]&16384)&&ue(s,_e[14]);const nt={};Ie[0]&8&&(nt.value=_e[3]),m.$set(nt);const ft={};Ie[1]&131072&&(ft.$$scope={dirty:Ie,ctx:_e}),!M&&Ie[0]&16&&(M=!0,ft.sort=_e[4],He(()=>M=!1)),$.$set(ft);const vt={};Ie[1]&131072&&(vt.$$scope={dirty:Ie,ctx:_e}),!A&&Ie[0]&16&&(A=!0,vt.sort=_e[4],He(()=>A=!1)),O.$set(vt),Ie[0]&4096&&(ce=_e[12],L=bt(L,Ie,ke,1,_e,ce,R,C,Mn,zp,B,Vp));const ot={};Ie[1]&131072&&(ot.$$scope={dirty:Ie,ctx:_e}),!J&&Ie[0]&16&&(J=!0,ot.sort=_e[4],He(()=>J=!1)),K.$set(ot);const Ot={};Ie[1]&131072&&(Ot.$$scope={dirty:Ie,ctx:_e}),!W&&Ie[0]&16&&(W=!0,Ot.sort=_e[4],He(()=>W=!1)),X.$set(Ot),Ie[0]&5450&&(Ce=_e[1],Pe(),le=bt(le,Ie,ze,1,_e,Ce,me,ge,Gt,Yp,null,jp),Le(),!Ce.length&&Ge?Ge.p(_e,Ie):Ce.length?Ge&&(Ge.d(1),Ge=null):(Ge=Bp(_e),Ge.c(),Ge.m(ge,null))),Ie[0]&1024&&ie(y,"table-loading",_e[10]),_e[1].length?st?st.p(_e,Ie):(st=Kp(_e),st.c(),st.m(Y.parentNode,Y)):st&&(st.d(1),st=null),_e[1].length&&_e[13]?ct?ct.p(_e,Ie):(ct=Zp(_e),ct.c(),ct.m(be.parentNode,be)):ct&&(ct.d(1),ct=null)},i(_e){if(!ee){E(a.$$.fragment,_e),E(m.$$.fragment,_e),E($.$$.fragment,_e),E(O.$$.fragment,_e),E(K.$$.fragment,_e),E(X.$$.fragment,_e);for(let Ie=0;Ie<Ce.length;Ie+=1)E(le[Ie]);ee=!0}},o(_e){P(a.$$.fragment,_e),P(m.$$.fragment,_e),P($.$$.fragment,_e),P(O.$$.fragment,_e),P(K.$$.fragment,_e),P(X.$$.fragment,_e);for(let Ie=0;Ie<le.length;Ie+=1)P(le[Ie]);ee=!1},d(_e){_e&&k(e),q(a),_e&&k(h),q(m,_e),_e&&k(v),_e&&k(b),q($),q(O);for(let Ie=0;Ie<L.length;Ie+=1)L[Ie].d();q(K),q(X);for(let Ie=0;Ie<le.length;Ie+=1)le[Ie].d();Ge&&Ge.d(),_e&&k(we),st&&st.d(_e),_e&&k(Y),ct&&ct.d(_e),_e&&k(be),te=!1,Qe(Se)}}}function bT(n){let e;return{c(){e=_("div"),e.innerHTML=`<span class="loader loader-lg"></span>
|
||||
<h1>Loading users...</h1>`,p(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function vT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="id",p(t,"class",U.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function yT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="email",p(t,"class",U.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function zp(n,e){let t,i,s,l,o,r,a,u=e[43].name+"",f,c,d;return{key:n,first:null,c(){t=_("th"),i=_("div"),s=_("i"),o=T(),r=_("span"),a=F("profile."),f=F(u),p(s,"class",l=U.getFieldTypeIcon(e[43].type)),p(r,"class","txt"),p(i,"class","col-header-content"),p(t,"class",c="col-type-"+e[43].type+" col-field-"+e[43].name),p(t,"name",d=e[43].name),this.first=t},m(h,m){w(h,t,m),g(t,i),g(i,s),g(i,o),g(i,r),g(r,a),g(r,f)},p(h,m){e=h,m[0]&4096&&l!==(l=U.getFieldTypeIcon(e[43].type))&&p(s,"class",l),m[0]&4096&&u!==(u=e[43].name+"")&&ue(f,u),m[0]&4096&&c!==(c="col-type-"+e[43].type+" col-field-"+e[43].name)&&p(t,"class",c),m[0]&4096&&d!==(d=e[43].name)&&p(t,"name",d)},d(h){h&&k(t)}}}function kT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function wT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="updated",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function Bp(n){let e;function t(l,o){return l[10]?ST:$T}let i=t(n),s=i(n);return{c(){s.c(),e=Je()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function $T(n){var r;let e,t,i,s,l,o=((r=n[3])==null?void 0:r.length)&&Up(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No users found.",s=T(),o&&o.c(),l=T(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),g(e,t),g(t,i),g(t,s),o&&o.m(t,null),g(e,l)},p(a,u){var f;(f=a[3])!=null&&f.length?o?o.p(a,u):(o=Up(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function ST(n){let e;return{c(){e=_("tr"),e.innerHTML=`<td colspan="99" class="p-xs"><span class="skeleton-loader"></span></td>
|
||||
`},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Up(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear filters</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[26]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function Wp(n,e){let t,i,s;return i=new N_({props:{field:e[43],record:e[40].profile||{}}}),{key:n,first:null,c(){t=Je(),V(i.$$.fragment),this.first=t},m(l,o){w(l,t,o),j(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&4096&&(r.field=e[43]),o[0]&2&&(r.record=e[40].profile||{}),i.$set(r)},i(l){s||(E(i.$$.fragment,l),s=!0)},o(l){P(i.$$.fragment,l),s=!1},d(l){l&&k(t),q(i,l)}}}function Yp(n,e){let t,i,s,l,o,r,a,u=e[40].email+"",f,c,d,h,m=e[40].verified?"Verified":"Unverified",v,b,y=[],S=new Map,C,$,M,D,O,A,I,L,R,B,K,J,H,X,W;s=new Xo({props:{id:e[40].id}});let x=e[12];const Q=le=>le[43].name;for(let le=0;le<x.length;le+=1){let me=qp(e,x,le),we=Q(me);S.set(we,y[le]=Wp(we,me))}M=new wi({props:{date:e[40].created}}),A=new wi({props:{date:e[40].updated}});function se(){return e[24](e[40])}function ge(){return e[25](e[40])}return{key:n,first:null,c(){t=_("tr"),i=_("td"),V(s.$$.fragment),l=T(),o=_("td"),r=_("div"),a=_("span"),f=F(u),d=T(),h=_("span"),v=F(m),b=T();for(let le=0;le<y.length;le+=1)y[le].c();C=T(),$=_("td"),V(M.$$.fragment),D=T(),O=_("td"),V(A.$$.fragment),I=T(),L=_("td"),R=_("button"),R.innerHTML=`<i class="ri-user-settings-line"></i>
|
||||
<span class="txt">Edit user</span>`,B=T(),K=_("button"),K.innerHTML=`<i class="ri-profile-line"></i>
|
||||
<span class="txt">Edit profile</span>`,J=T(),p(i,"class","col-type-text col-field-id"),p(a,"class","txt"),p(a,"title",c=e[40].email),p(h,"class","label"),ie(h,"label-success",e[40].verified),ie(h,"label-warning",!e[40].verified),p(r,"class","inline-flex"),p(o,"class","col-type-email col-field-email"),p($,"class","col-type-date col-field-created"),p(O,"class","col-type-date col-field-updated"),p(R,"type","button"),p(R,"class","btn btn-sm btn-outline"),p(K,"type","button"),p(K,"class","btn btn-sm m-l-10"),p(L,"class","col-type-action min-width"),this.first=t},m(le,me){w(le,t,me),g(t,i),j(s,i,null),g(t,l),g(t,o),g(o,r),g(r,a),g(a,f),g(r,d),g(r,h),g(h,v),g(t,b);for(let we=0;we<y.length;we+=1)y[we].m(t,null);g(t,C),g(t,$),j(M,$,null),g(t,D),g(t,O),j(A,O,null),g(t,I),g(t,L),g(L,R),g(L,B),g(L,K),g(t,J),H=!0,X||(W=[G(R,"click",ei(se)),G(K,"click",ei(ge))],X=!0)},p(le,me){e=le;const we={};me[0]&2&&(we.id=e[40].id),s.$set(we),(!H||me[0]&2)&&u!==(u=e[40].email+"")&&ue(f,u),(!H||me[0]&2&&c!==(c=e[40].email))&&p(a,"title",c),(!H||me[0]&2)&&m!==(m=e[40].verified?"Verified":"Unverified")&&ue(v,m),me[0]&2&&ie(h,"label-success",e[40].verified),me[0]&2&&ie(h,"label-warning",!e[40].verified),me[0]&4098&&(x=e[12],Pe(),y=bt(y,me,Q,1,e,x,S,t,Gt,Wp,C,qp),Le());const Y={};me[0]&2&&(Y.date=e[40].created),M.$set(Y);const be={};me[0]&2&&(be.date=e[40].updated),A.$set(be)},i(le){if(!H){E(s.$$.fragment,le);for(let me=0;me<x.length;me+=1)E(y[me]);E(M.$$.fragment,le),E(A.$$.fragment,le),H=!0}},o(le){P(s.$$.fragment,le);for(let me=0;me<y.length;me+=1)P(y[me]);P(M.$$.fragment,le),P(A.$$.fragment,le),H=!1},d(le){le&&k(t),q(s);for(let me=0;me<y.length;me+=1)y[me].d();q(M),q(A),X=!1,Qe(W)}}}function Kp(n){let e,t,i=n[1].length+"",s,l,o;return{c(){e=_("small"),t=F("Showing "),s=F(i),l=F(" of "),o=F(n[2]),p(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),g(e,t),g(e,s),g(e,l),g(e,o)},p(r,a){a[0]&2&&i!==(i=r[1].length+"")&&ue(s,i),a[0]&4&&ue(o,r[2])},d(r){r&&k(e)}}}function Zp(n){let e,t,i,s,l=n[2]-n[1].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=F("Load more ("),o=F(l),r=F(")"),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-lg btn-secondary btn-expanded"),ie(t,"btn-loading",n[10]),ie(t,"btn-disabled",n[10]),p(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),g(e,t),g(t,i),g(i,s),g(i,o),g(i,r),a||(u=G(t,"click",n[27]),a=!0)},p(f,c){c[0]&6&&l!==(l=f[2]-f[1].length+"")&&ue(o,l),c[0]&1024&&ie(t,"btn-loading",f[10]),c[0]&1024&&ie(t,"btn-disabled",f[10])},d(f){f&&k(e),a=!1,u()}}}function CT(n){let e,t,i,s;const l=[bT,_T],o=[];function r(a,u){return a[11]?0:1}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=Je()},m(a,u){o[e].m(a,u),w(a,i,u),s=!0},p(a,u){let f=e;e=r(a),e===f?o[e].p(a,u):(Pe(),P(o[f],1,1,()=>{o[f]=null}),Le(),t=o[e],t?t.p(a,u):(t=o[e]=l[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){s||(E(t),s=!0)},o(a){P(t),s=!1},d(a){o[e].d(a),a&&k(i)}}}function MT(n){let e,t,i,s,l,o,r,a;e=new Dn({props:{$$slots:{default:[CT]},$$scope:{ctx:n}}});let u={};i=new gT({props:u}),n[28](i),i.$on("save",n[29]),i.$on("delete",n[30]);let f={};l=new Ya({props:f}),n[31](l),l.$on("save",n[32]);let c={collection:n[5]};return r=new F_({props:c}),n[33](r),r.$on("save",n[34]),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment),s=T(),V(l.$$.fragment),o=T(),V(r.$$.fragment)},m(d,h){j(e,d,h),w(d,t,h),j(i,d,h),w(d,s,h),j(l,d,h),w(d,o,h),j(r,d,h),a=!0},p(d,h){const m={};h[0]&32766|h[1]&131072&&(m.$$scope={dirty:h,ctx:d}),e.$set(m);const v={};i.$set(v);const b={};l.$set(b);const y={};h[0]&32&&(y.collection=d[5]),r.$set(y)},i(d){a||(E(e.$$.fragment,d),E(i.$$.fragment,d),E(l.$$.fragment,d),E(r.$$.fragment,d),a=!0)},o(d){P(e.$$.fragment,d),P(i.$$.fragment,d),P(l.$$.fragment,d),P(r.$$.fragment,d),a=!1},d(d){q(e,d),d&&k(t),n[28](null),q(i,d),d&&k(s),n[31](null),q(l,d),d&&k(o),n[33](null),q(r,d)}}}function TT(n,e,t){let i,s,l,o;kt(n,Ro,ee=>t(35,l=ee)),kt(n,Rt,ee=>t(14,o=ee)),dn(Rt,o="Users",o);const r=new URLSearchParams(l),a=["id","userId","created","updated"];let u,f,c,d=[],h=1,m=0,v=!1,b=r.get("filter")||"",y=r.get("sort")||"-created",S=new fn,C=!1;O();async function $(ee=1){return t(10,v=!0),ee<=1&&M(),ve.users.getList(ee,50,{sort:y||"-created",filter:b}).then(te=>{t(10,v=!1),t(1,d=d.concat(te.items)),t(9,h=te.page),t(2,m=te.totalItems)}).catch(te=>{te!=null&&te.isAbort||(t(10,v=!1),console.warn(te),M(),ve.errorResponseHandler(te,!1))})}function M(){t(1,d=[]),t(9,h=1),t(2,m=0)}function D(ee){const te=d.find(Se=>Se.id===(ee==null?void 0:ee.userId));te&&(te.profile=ee),t(1,d)}async function O(){t(11,C=!0);try{t(5,S=await ve.collections.getOne("profiles"))}catch(ee){ve.errorResponseHandler(ee)}t(11,C=!1)}const A=()=>f==null?void 0:f.show(S),I=()=>$(),L=()=>u==null?void 0:u.show(),R=ee=>t(3,b=ee.detail);function B(ee){y=ee,t(4,y)}function K(ee){y=ee,t(4,y)}function J(ee){y=ee,t(4,y)}function H(ee){y=ee,t(4,y)}const X=ee=>u==null?void 0:u.show(ee),W=ee=>c==null?void 0:c.show(ee.profile),x=()=>t(3,b=""),QLine truncated
|
||||
<span class="txt">Application</span>`,o=T(),r=_("a"),r.innerHTML=`<i class="ri-send-plane-2-line"></i>
|
||||
<span class="txt">Mail settings</span>`,a=T(),u=_("a"),u.innerHTML=`<i class="ri-archive-drawer-line"></i>
|
||||
<span class="txt">Files storage</span>`,f=T(),c=_("div"),c.innerHTML=`<span class="txt">Sync</span>
|
||||
<small class="label label-danger label-compact">Experimental</small>`,d=T(),h=_("a"),h.innerHTML=`<i class="ri-uninstall-line"></i>
|
||||
<span class="txt">Export collections</span>`,m=T(),v=_("a"),v.innerHTML=`<i class="ri-install-line"></i>
|
||||
<span class="txt">Import collections</span>`,b=T(),y=_("div"),y.textContent="Authentication",S=T(),C=_("a"),C.innerHTML=`<i class="ri-lock-password-line"></i>
|
||||
<span class="txt">Auth providers</span>`,$=T(),M=_("a"),M.innerHTML=`<i class="ri-key-line"></i>
|
||||
<span class="txt">Token options</span>`,D=T(),O=_("a"),O.innerHTML=`<i class="ri-shield-user-line"></i>
|
||||
<span class="txt">Admins</span>`,p(i,"class","sidebar-title"),p(l,"href","/settings"),p(l,"class","sidebar-list-item"),p(r,"href","/settings/mail"),p(r,"class","sidebar-list-item"),p(u,"href","/settings/storage"),p(u,"class","sidebar-list-item"),p(c,"class","sidebar-title"),p(h,"href","/settings/export-collections"),p(h,"class","sidebar-list-item"),p(v,"href","/settings/import-collections"),p(v,"class","sidebar-list-item"),p(y,"class","sidebar-title"),p(C,"href","/settings/auth-providers"),p(C,"class","sidebar-list-item"),p(M,"href","/settings/tokens"),p(M,"class","sidebar-list-item"),p(O,"href","/settings/admins"),p(O,"class","sidebar-list-item"),p(t,"class","sidebar-content"),p(e,"class","page-sidebar settings-sidebar")},m(L,R){w(L,e,R),g(e,t),g(t,i),g(t,s),g(t,l),g(t,o),g(t,r),g(t,a),g(t,u),g(t,f),g(t,c),g(t,d),g(t,h),g(t,m),g(t,v),g(t,b),g(t,y),g(t,S),g(t,C),g(t,$),g(t,M),g(t,D),g(t,O),A||(I=[Ye(Hn.call(null,l,{path:"/settings"})),Ye(hn.call(null,l)),Ye(Hn.call(null,r,{path:"/settings/mail/?.*"})),Ye(hn.call(null,r)),Ye(Hn.call(null,u,{path:"/settings/storage/?.*"})),Ye(hn.call(null,u)),Ye(Hn.call(null,h,{path:"/settings/export-collections/?.*"})),Ye(hn.call(null,h)),Ye(Hn.call(null,v,{path:"/settings/import-collections/?.*"})),Ye(hn.call(null,v)),Ye(Hn.call(null,C,{path:"/settings/auth-providers/?.*"})),Ye(hn.call(null,C)),Ye(Hn.call(null,M,{path:"/settings/tokens/?.*"})),Ye(hn.call(null,M)),Ye(Hn.call(null,O,{path:"/settings/admins/?.*"})),Ye(hn.call(null,O))],A=!0)},p:re,i:re,o:re,d(L){L&&k(e),A=!1,Qe(I)}}}class Vi extends Ee{constructor(e){super(),Oe(this,e,null,OT,De,{})}}function Jp(n,e,t){const i=n.slice();return i[31]=e[t],i}function Gp(n){let e,t;return e=new Ne({props:{class:"form-field disabled",name:"id",$$slots:{default:[ET,({uniqueId:i})=>({30:i}),({uniqueId:i})=>[i?1073741824:0]]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,s){const l={};s[0]&1073741826|s[1]&8&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function ET(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="ID",o=T(),r=_("input"),p(t,"class",U.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"for",l=n[30]),p(r,"type","text"),p(r,"id",a=n[30]),r.value=u=n[1].id,r.disabled=!0},m(f,c){w(f,e,c),g(e,t),g(e,i),g(e,s),w(f,o,c),w(f,r,c)},p(f,c){c[0]&1073741824&&l!==(l=f[30])&&p(e,"for",l),c[0]&1073741824&&a!==(a=f[30])&&p(r,"id",a),c[0]&2&&u!==(u=f[1].id)&&r.value!==u&&(r.value=u)},d(f){f&&k(e),f&&k(o),f&&k(r)}}}function Xp(n){let e,t,i,s,l,o,r;function a(){return n[17](n[31])}function u(...f){return n[18](n[31],...f)}return{c(){e=_("figure"),t=_("img"),s=T(),xn(t.src,i="./images/avatars/avatar"+n[31]+".svg")||p(t,"src",i),p(t,"alt","Avatar "+n[31]),p(e,"tabindex","0"),p(e,"class",l="link-fade thumb thumb-circle "+(n[31]==n[2]?"thumb-active":"thumb-sm"))},m(f,c){w(f,e,c),g(e,t),g(e,s),o||(r=[G(e,"click",a),G(e,"keydown",u)],o=!0)},p(f,c){n=f,c[0]&4&&l!==(l="link-fade thumb thumb-circle "+(n[31]==n[2]?"thumb-active":"thumb-sm"))&&p(e,"class",l)},d(f){f&&k(e),o=!1,Qe(r)}}}function AT(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="Email",o=T(),r=_("input"),p(t,"class",U.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"for",l=n[30]),p(r,"type","email"),p(r,"autocomplete","off"),p(r,"id",a=n[30]),r.required=!0},m(c,d){w(c,e,d),g(e,t),g(e,i),g(e,s),w(c,o,d),w(c,r,d),Me(r,n[3]),u||(f=G(r,"input",n[19]),u=!0)},p(c,d){d[0]&1073741824&&l!==(l=c[30])&&p(e,"for",l),d[0]&1073741824&&a!==(a=c[30])&&p(r,"id",a),d[0]&8&&r.value!==c[3]&&Me(r,c[3])},d(c){c&&k(e),c&&k(o),c&&k(r),u=!1,f()}}}function Qp(n){let e,t;return e=new Ne({props:{class:"form-field form-field-toggle",$$slots:{default:[PT,({uniqueId:i})=>({30:i}),({uniqueId:i})=>[i?1073741824:0]]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,s){const l={};s[0]&1073741840|s[1]&8&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function PT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=F("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[30]),p(s,"for",o=n[30])},m(u,f){w(u,e,f),e.checked=n[4],w(u,i,f),w(u,s,f),g(s,l),r||(a=G(e,"change",n[20]),r=!0)},p(u,f){f[0]&1073741824&&t!==(t=u[30])&&p(e,"id",t),f[0]&16&&(e.checked=u[4]),f[0]&1073741824&&o!==(o=u[30])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function xp(n){let e,t,i,s,l,o,r,a,u;return s=new Ne({props:{class:"form-field required",name:"password",$$slots:{default:[LT,({uniqueId:f})=>({30:f}),({uniqueId:f})=>[f?1073741824:0]]},$$scope:{ctx:n}}}),r=new Ne({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[IT,({uniqueId:f})=>({30:f}),({uniqueId:f})=>[f?1073741824:0]]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),i=_("div"),V(s.$$.fragment),l=T(),o=_("div"),V(r.$$.fragment),p(i,"class","col-sm-6"),p(o,Line truncated
|
||||
<span class="txt">Delete</span>`,p(e,"type","button"),p(e,"class","dropdown-item")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[15]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function HT(n){let e,t,i,s,l,o,r=n[1].isNew?"Create":"Save changes",a,u,f,c,d,h=!n[1].isNew&&eh(n);return{c(){h&&h.c(),e=T(),t=_("button"),i=_("span"),i.textContent="Cancel",s=T(),l=_("button"),o=_("span"),a=F(r),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-secondary"),t.disabled=n[6],p(o,"class","txt"),p(l,"type","submit"),p(l,"form",n[11]),p(l,"class","btn btn-expanded"),l.disabled=u=!n[10]||n[6],ie(l,"btn-loading",n[6])},m(m,v){h&&h.m(m,v),w(m,e,v),w(m,t,v),g(t,i),w(m,s,v),w(m,l,v),g(l,o),g(o,a),f=!0,c||(d=G(t,"click",n[16]),c=!0)},p(m,v){m[1].isNew?h&&(Pe(),P(h,1,1,()=>{h=null}),Le()):h?(h.p(m,v),v[0]&2&&E(h,1)):(h=eh(m),h.c(),E(h,1),h.m(e.parentNode,e)),(!f||v[0]&64)&&(t.disabled=m[6]),(!f||v[0]&2)&&r!==(r=m[1].isNew?"Create":"Save changes")&&ue(a,r),(!f||v[0]&1088&&u!==(u=!m[10]||m[6]))&&(l.disabled=u),v[0]&64&&ie(l,"btn-loading",m[6])},i(m){f||(E(h),f=!0)},o(m){P(h),f=!1},d(m){h&&h.d(m),m&&k(e),m&&k(t),m&&k(s),m&&k(l),c=!1,d()}}}function jT(n){let e,t,i={popup:!0,class:"admin-panel",beforeHide:n[23],$$slots:{footer:[HT],header:[NT],default:[FT]},$$scope:{ctx:n}};return e=new hi({props:i}),n[24](e),e.$on("hide",n[25]),e.$on("show",n[26]),{c(){V(e.$$.fragment)},m(s,l){j(e,s,l),t=!0},p(s,l){const o={};l[0]&1152&&(o.beforeHide=s[23]),l[0]&1886|l[1]&8&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[24](null),q(e,s)}}}function qT(n,e,t){let i;const s=on(),l="admin_"+U.randomString(5);let o,r=new $s,a=!1,u=!1,f=0,c="",d="",h="",m=!1;function v(W){return y(W),t(7,u=!0),o==null?void 0:o.show()}function b(){return o==null?void 0:o.hide()}function y(W){Si({}),t(1,r=W!=null&&W.clone?W.clone():new $s),S()}function S(){t(4,m=!1),t(3,c=(r==null?void 0:r.email)||""),t(2,f=(r==null?void 0:r.avatar)||0),t(8,d=""),t(9,h="")}function C(){if(a||!i)return;t(6,a=!0);const W={email:c,avatar:f};(r.isNew||m)&&(W.password=d,W.passwordConfirm=h);let x;r.isNew?x=ve.admins.create(W):x=ve.admins.update(r.id,W),x.then(async Q=>{var se;t(7,u=!1),b(),cn(r.isNew?"Successfully created admin.":"Successfully updated admin."),s("save",Q),((se=ve.authStore.model)==null?void 0:se.id)===Q.id&&ve.authStore.save(ve.authStore.token,Q)}).catch(Q=>{ve.errorResponseHandler(Q)}).finally(()=>{t(6,a=!1)})}function $(){!(r!=null&&r.id)||ci("Do you really want to delete the selected admin?",()=>ve.admins.delete(r.id).then(()=>{t(7,u=!1),b(),cn("Successfully deleted admin."),s("delete",r)}).catch(W=>{ve.errorResponseHandler(W)}))}const M=()=>$(),D=()=>b(),O=W=>t(2,f=W),A=(W,x)=>{(x.code==="Enter"||x.code==="Space")&&(x.preventDefault(),t(2,f=W))};function I(){c=this.value,t(3,c)}function L(){m=this.checked,t(4,m)}function R(){d=this.value,t(8,d)}function B(){h=this.value,t(9,h)}const K=()=>i&&u?(ci("You have unsaved changes. Do you really want to close the panel?",()=>{t(7,u=!1),b()}),!1):!0;function J(W){he[W?"unshift":"push"](()=>{o=W,t(5,o)})}function H(W){ut.call(this,n,W)}function X(W){ut.call(this,n,W)}return n.$$.update=()=>{n.$$.dirty[0]&30&&t(10,i=r.isNew&&c!=""||m||c!==r.email||f!==r.avatar)},[b,r,f,c,m,o,a,u,d,h,i,l,C,$,v,M,D,O,A,I,L,R,B,K,J,H,X]}class VT extends Ee{constructor(e){super(),Oe(this,e,qT,jT,De,{show:14,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[14]}get hide(){return this.$$.ctx[0]}}function th(n,e,t){const i=n.slice();return i[24]=e[t],i}function zT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="id",p(t,"class",U.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function BT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="email",p(t,"class",U.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function UT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function WT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="updated",p(t,"class",U.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),g(e,t),g(e,i),g(e,s)},p:re,d(l){l&&k(e)}}}function nh(n){let e;function t(l,o){return l[5]?KT:YT}let i=t(n),s=i(n);return{c(){s.c(),e=Je()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function YT(n){var r;let e,t,i,s,l,o=((r=n[1])==null?void 0:r.length)&&ih(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No admins found.",s=T(),o&&o.c(),l=T(),p(t,"colspan","99"),p(t,"class","txt-center txLine truncated
|
||||
`},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function ih(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear filters</span>',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[17]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function sh(n){let e;return{c(){e=_("span"),e.textContent="You",p(e,"class","label label-warning m-l-5")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function lh(n,e){let t,i,s,l,o,r,a,u,f,c,d,h,m=e[24].email+"",v,b,y,S,C,$,M,D,O,A,I,L,R,B;u=new Xo({props:{id:e[24].id}});let K=e[24].id===e[7].id&&sh();C=new wi({props:{date:e[24].created}}),D=new wi({props:{date:e[24].updated}});function J(){return e[15](e[24])}function H(...X){return e[16](e[24],...X)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("figure"),l=_("img"),r=T(),a=_("td"),V(u.$$.fragment),f=T(),K&&K.c(),c=T(),d=_("td"),h=_("span"),v=F(m),y=T(),S=_("td"),V(C.$$.fragment),$=T(),M=_("td"),V(D.$$.fragment),O=T(),A=_("td"),A.innerHTML='<i class="ri-arrow-right-line"></i>',I=T(),xn(l.src,o="./images/avatars/avatar"+(e[24].avatar||0)+".svg")||p(l,"src",o),p(l,"alt","Admin avatar"),p(s,"class","thumb thumb-sm thumb-circle"),p(i,"class","min-width"),p(a,"class","col-type-text col-field-id"),p(h,"class","txt txt-ellipsis"),p(h,"title",b=e[24].email),p(d,"class","col-type-email col-field-email"),p(S,"class","col-type-date col-field-created"),p(M,"class","col-type-date col-field-updated"),p(A,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(X,W){w(X,t,W),g(t,i),g(i,s),g(s,l),g(t,r),g(t,a),j(u,a,null),g(a,f),K&&K.m(a,null),g(t,c),g(t,d),g(d,h),g(h,v),g(t,y),g(t,S),j(C,S,null),g(t,$),g(t,M),j(D,M,null),g(t,O),g(t,A),g(t,I),L=!0,R||(B=[G(t,"click",J),G(t,"keydown",H)],R=!0)},p(X,W){e=X,(!L||W&16&&!xn(l.src,o="./images/avatars/avatar"+(e[24].avatar||0)+".svg"))&&p(l,"src",o);const x={};W&16&&(x.id=e[24].id),u.$set(x),e[24].id===e[7].id?K||(K=sh(),K.c(),K.m(a,null)):K&&(K.d(1),K=null),(!L||W&16)&&m!==(m=e[24].email+"")&&ue(v,m),(!L||W&16&&b!==(b=e[24].email))&&p(h,"title",b);const Q={};W&16&&(Q.date=e[24].created),C.$set(Q);const se={};W&16&&(se.date=e[24].updated),D.$set(se)},i(X){L||(E(u.$$.fragment,X),E(C.$$.fragment,X),E(D.$$.fragment,X),L=!0)},o(X){P(u.$$.fragment,X),P(C.$$.fragment,X),P(D.$$.fragment,X),L=!1},d(X){X&&k(t),q(u),K&&K.d(),q(C),q(D),R=!1,Qe(B)}}}function oh(n){let e,t,i=n[4].length+"",s,l,o=n[4].length+"",r;return{c(){e=_("small"),t=F("Showing "),s=F(i),l=F(" of "),r=F(o),p(e,"class","block txt-hint txt-right m-t-sm")},m(a,u){w(a,e,u),g(e,t),g(e,s),g(e,l),g(e,r)},p(a,u){u&16&&i!==(i=a[4].length+"")&&ue(s,i),u&16&&o!==(o=a[4].length+"")&&ue(r,o)},d(a){a&&k(e)}}}function ZT(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,x,Q,se,ge=[],le=new Map,me,we,Y,be,ee;a=new Uo({}),a.$on("refresh",n[8]),m=new Bo({props:{value:n[1],placeholder:"Search filter, eg. email='test@example.com'",extraAutocompleteKeys:["email"]}}),m.$on("submit",n[10]);function te(Ce){n[11](Ce)}let Se={class:"col-type-text",name:"id",$$slots:{default:[zT]},$$scope:{ctx:n}};n[2]!==void 0&&(Se.sort=n[2]),D=new sn({props:Se}),he.push(()=>Re(D,"sort",te));function je(Ce){n[12](Ce)}let Ue={class:"col-type-email col-field-email",name:"email",$$slots:{default:[BT]},$$scope:{ctx:n}};n[2]!==void 0&&(Ue.sort=n[2]),I=new sn({props:Ue}),he.push(()=>Re(I,"sort",je));function Z(Ce){n[13](Ce)}let pe={class:"col-type-date col-field-created",name:"created",$$slots:{default:[UT]},$$scope:{ctx:n}};n[2]!==void 0&&(pe.sort=n[2]),B=new sn({props:pe}),he.push(()=>Re(B,"sort",Z));function ce(Ce){n[14](Ce)}let ke={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[WT]},$$scope:{ctx:n}};n[2]!==void 0&&(ke.sort=n[2]),H=new sn({props:ke}),he.push(()=>Re(H,"sort",ce));let Ze=n[4];const tt=Ce=>Ce[24].id;for(let Ce=0;Ce<Ze.length;Ce+=1){let ze=th(n,Ze,Ce),Ge=tt(ze);le.set(Ge,ge[Ce]=lh(Ge,ze))}let We=null;Ze.length||(We=nh(n));let it=n[4].length&&oh(n);return{c(){e=_("header"),t=_("nav"),i=_("div"),i.textContent="Settings",s=T(),l=_("div"),o=F(n[6]),r=T(),V(a.$$.fragment),u=T(),f=_("div"),c=T(),d=_("button"),d.innerHTML=`<i class="ri-add-line"></i>
|
||||
<span class="txt">New admin</span>`,h=T(),V(m.$$.fragment),v=T(),b=_("div"),y=_("table"),S=_("thead"),C=_("tr"),$=_("th"),M=T(),V(D.$$.fragment),A=T(),V(I.$$.fragment),R=T(),V(B.$$.fragment),J=T(),V(H.$$.fragment),W=T(),x=_("th"),Q=T(),se=_("tbody");for(let Ce=0;Ce<ge.length;Ce+=1)ge[Ce].c();We&&We.c(),me=T(),it&&it.c(),we=Je(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(f,"class","flex-fill"),p(d,"type","button"),p(d,"class","btn btn-expanded"),p(e,"class","page-header"),p($,"class","min-width"),p(x,"class","col-type-action min-width"),p(y,"class","table"),ie(y,"table-loading",n[5]),p(b,"class","table-wrapper")},m(Ce,ze){w(Ce,e,ze),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),g(e,r),j(a,e,null),g(e,u),g(e,f),g(e,c),g(e,d),w(Ce,h,ze),j(m,Ce,ze),w(Ce,v,ze),w(Ce,b,ze),g(b,y),g(y,S),g(S,C),g(C,$),g(C,M),j(D,C,null),g(C,A),j(I,C,null),g(C,R),j(B,C,null),g(C,J),j(H,C,null),g(C,W),g(C,x),g(y,Q),g(y,se);for(let Ge=0;Ge<ge.length;Ge+=1)ge[Ge].m(se,null);We&&We.m(se,null),w(Ce,me,ze),it&&it.m(Ce,ze),w(Ce,we,ze),Y=!0,be||(ee=G(d,"click",n[9]),be=!0)},p(Ce,ze){(!Y||ze&64)&&ue(o,Ce[6]);const Ge={};ze&2&&(Ge.value=Ce[1]),m.$set(Ge);const st={};ze&134217728&&(st.$$scope={dirty:ze,ctx:Ce}),!O&&ze&4&&(O=!0,st.sort=Ce[2],He(()=>O=!1)),D.$set(st);const ct={};ze&134217728&&(ct.$$scope={dirty:ze,ctx:Ce}),!L&&ze&4&&(L=!0,ct.sort=Ce[2],He(()=>L=!1)),I.$set(ct);const _e={};ze&134217728&&(_e.$$scope={dirty:ze,ctx:Ce}),!K&&ze&4&&(K=!0,_e.sort=Ce[2],He(()=>K=!1)),B.$set(_e);const Ie={};ze&134217728&&(Ie.$$scope={dirty:ze,ctx:Ce}),!X&&ze&4&&(X=!0,Ie.sort=Ce[2],He(()=>X=!1)),H.$set(Ie),ze&186&&(Ze=Ce[4],Pe(),ge=bt(ge,ze,tt,1,Ce,Ze,le,se,Gt,lh,null,th),Le(),!Ze.length&&We?We.p(Ce,ze):Ze.length?We&&(We.d(1),We=null):(We=nh(Ce),We.c(),We.m(se,null))),ze&32&&ie(y,"table-loading",Ce[5]),Ce[4].length?it?it.p(Ce,ze):(it=oh(Ce),it.c(),it.m(we.parentNode,we)):it&&(it.d(1),it=null)},i(Ce){if(!Y){E(a.$$.fragment,Ce),E(m.$$.fragment,Ce),E(D.$$.fragment,Ce),E(I.$$.fragment,Ce),E(B.$$.fragment,Ce),E(H.$$.fragment,Ce);for(let ze=0;ze<Ze.length;ze+=1)E(ge[ze]);Y=!0}},o(Ce){P(a.$$.fragment,Ce),P(m.$$.fragment,Ce),P(D.$$.fragment,Ce),P(I.$$.fragment,Ce),P(B.$$.fragment,Ce),P(H.$$.fragment,Ce);for(let ze=0;ze<ge.length;ze+=1)P(ge[ze]);Y=!1},d(Ce){Ce&&k(e),q(a),Ce&&k(h),q(m,Ce),Ce&&k(v),Ce&&k(b),q(D),q(I),q(B),q(H);for(let ze=0;ze<ge.length;ze+=1)ge[ze].d();We&&We.d(),Ce&&k(me),it&&it.d(Ce),Ce&&k(we),be=!1,ee()}}}function JT(n){let e,t,i,s,l,o;e=new Vi({}),i=new Dn({props:{$$slots:{default:[ZT]},$$scope:{ctx:n}}});let r={};return l=new VT({props:r}),n[18](l),l.$on("save",n[19]),l.$on("delete",n[20]),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment),s=T(),V(l.$$.fragment)},m(a,u){j(e,a,u),w(a,t,u),j(i,a,u),w(a,s,u),j(l,a,u),o=!0},p(a,[u]){const f={};u&134217982&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};l.$set(c)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),E(l.$$.fragment,a),o=!0)},o(a){P(e.$$.fragment,a),P(i.$$.fragment,a),P(l.$$.fragment,a),o=!1},d(a){q(e,a),a&&k(t),q(i,a),a&&k(s),n[18](null),q(l,a)}}}function GT(n,e,t){let i,s,l;kt(n,Ro,R=>t(21,i=R)),kt(n,Rt,R=>t(6,s=R)),kt(n,ya,R=>t(7,l=R)),dn(Rt,s="Admins",s);const o=new URLSearchParams(i);let r,a=[],u=!1,f=o.get("filter")||"",c=o.get("sort")||"-created";function d(){return t(5,u=!0),t(4,a=[]),ve.admins.getFullList(100,{sort:c||"-created",filter:f}).then(R=>{t(4,a=R),t(5,u=!1)}).catch(R=>{R!=null&&R.isAbort||(t(5,u=!1),console.warn(R),h(),ve.errorResponseHandler(R,!1))})}function h(){t(4,a=[])}const m=()=>d(),v=()=>r==null?void 0:r.show(),b=R=>t(1,f=R.detail);function y(R){c=R,t(2,c)}function S(R){c=R,t(2,c)}function C(R){c=R,t(2,c)}function $(R){c=R,t(2,c)}const M=R=>r==null?void 0:r.show(R),D=(R,B)=>{(B.code==="Enter"||B.code==="Space")&&(B.preventDefault(),r==null||r.show(R))},O=()=>t(1,f="");function A(R){he[R?"unshift":"push"](()=>{r=R,t(3,r)})}const I=()=>d(),L=()=>d();return n.$$.update=()=>{if(n.$$.dirty&6&&c!==-1&&f!==-1){const R=new URLSearchParams({filter:f,sort:c}).toString();$i("/settings/admins?"+R),d()}},[d,f,c,r,a,u,s,l,m,v,b,y,S,C,$,M,D,O,A,I,L]}class XT extends Ee{constructor(e){super(),Oe(this,e,GT,JT,De,{loadAdmins:0})}get loadAdmins(){return this.$$.ctx[0]}}function QT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Email"),s=T(),l=_("input"),p(e,"for",i=n[8]),p(l,"type","email"),p(l,"id",o=n[8]),l.required=!0,l.autofocus=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0]),l.focus(),r||(a=G(l,"input",n[4]),r=!0)},p(u,f){f&256&&i!==(i=u[8])&&p(e,"for",i),f&256&&o!==(o=u[8])&&p(l,"id",o),f&1&&l.value!==u[0]&&Me(l,u[0])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function xT(n){let e,t,i,s,l,o,r,a,u,f,c;return{c(){e=_("label"),t=F("Password"),s=T(),l=_("input"),r=T(),a=_("div"),u=_("a"),u.textContent="Forgotten password?",p(e,"for",i=n[8]),p(l,"type","password"),p(l,"id",o=n[8]),l.required=!0,p(u,"href","/request-password-reset"),p(u,"class","link-hint"),p(a,"class","help-block")},m(d,h){w(d,e,h),g(e,t),w(d,s,h),w(d,l,h),MLine truncated
|
||||
<i class="ri-arrow-right-line"></i>`,p(t,"class","content txt-center m-b-base"),p(a,"type","submit"),p(a,"class","btn btn-lg btn-block btn-next"),ie(a,"btn-disabled",n[2]),ie(a,"btn-loading",n[2]),p(e,"class","block")},m(d,h){w(d,e,h),g(e,t),g(e,i),j(s,e,null),g(e,l),j(o,e,null),g(e,r),g(e,a),u=!0,f||(c=G(e,"submit",Yt(n[3])),f=!0)},p(d,h){const m={};h&769&&(m.$$scope={dirty:h,ctx:d}),s.$set(m);const v={};h&770&&(v.$$scope={dirty:h,ctx:d}),o.$set(v),h&4&&ie(a,"btn-disabled",d[2]),h&4&&ie(a,"btn-loading",d[2])},i(d){u||(E(s.$$.fragment,d),E(o.$$.fragment,d),u=!0)},o(d){P(s.$$.fragment,d),P(o.$$.fragment,d),u=!1},d(d){d&&k(e),q(s),q(o),f=!1,c()}}}function tD(n){let e,t;return e=new Dg({props:{$$slots:{default:[eD]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,[s]){const l={};s&519&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function nD(n,e,t){let i;kt(n,Ro,c=>t(6,i=c));const s=new URLSearchParams(i);let l=s.get("demoEmail")||"",o=s.get("demoPassword")||"",r=!1;function a(){if(!r)return t(2,r=!0),ve.admins.authViaEmail(l,o).then(()=>{$i("/")}).catch(()=>{go("Invalid login credentials.")}).finally(()=>{t(2,r=!1)})}function u(){l=this.value,t(0,l)}function f(){o=this.value,t(1,o)}return[l,o,r,a,u,f]}class iD extends Ee{constructor(e){super(),Oe(this,e,nD,tD,De,{})}}function sD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S;return i=new Ne({props:{class:"form-field required",name:"meta.appName",$$slots:{default:[oD,({uniqueId:C})=>({14:C}),({uniqueId:C})=>C?16384:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"meta.appUrl",$$slots:{default:[rD,({uniqueId:C})=>({14:C}),({uniqueId:C})=>C?16384:0]},$$scope:{ctx:n}}}),a=new Ne({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[aD,({uniqueId:C})=>({14:C}),({uniqueId:C})=>C?16384:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),V(a.$$.fragment),u=T(),f=_("div"),c=_("div"),d=T(),h=_("button"),m=_("span"),m.textContent="Save changes",p(t,"class","col-lg-6"),p(l,"class","col-lg-6"),p(c,"class","flex-fill"),p(m,"class","txt"),p(h,"type","submit"),p(h,"class","btn btn-expanded"),h.disabled=v=!n[3]||n[2],ie(h,"btn-loading",n[2]),p(f,"class","col-lg-12 flex"),p(e,"class","grid")},m(C,$){w(C,e,$),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),j(a,e,null),g(e,u),g(e,f),g(f,c),g(f,d),g(f,h),g(h,m),b=!0,y||(S=G(h,"click",n[9]),y=!0)},p(C,$){const M={};$&49153&&(M.$$scope={dirty:$,ctx:C}),i.$set(M);const D={};$&49153&&(D.$$scope={dirty:$,ctx:C}),o.$set(D);const O={};$&49153&&(O.$$scope={dirty:$,ctx:C}),a.$set(O),(!b||$&12&&v!==(v=!C[3]||C[2]))&&(h.disabled=v),$&4&&ie(h,"btn-loading",C[2])},i(C){b||(E(i.$$.fragment,C),E(o.$$.fragment,C),E(a.$$.fragment,C),b=!0)},o(C){P(i.$$.fragment,C),P(o.$$.fragment,C),P(a.$$.fragment,C),b=!1},d(C){C&&k(e),q(i),q(o),q(a),y=!1,S()}}}function lD(n){let e;return{c(){e=_("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function oD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Application name"),s=T(),l=_("input"),p(e,"for",i=n[14]),p(l,"type","text"),p(l,"id",o=n[14]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].meta.appName),r||(a=G(l,"input",n[6]),r=!0)},p(u,f){f&16384&&i!==(i=u[14])&&p(e,"for",i),f&16384&&o!==(o=u[14])&&p(l,"id",o),f&1&&l.value!==u[0].meta.appName&&Me(l,u[0].meta.appName)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function rD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Application url"),s=T(),l=_("input"),p(e,"for",i=n[14]),p(l,"type","text"),p(l,"id",o=n[14]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].meta.appUrl),r||(a=G(l,"input",n[7]),r=!0)},p(u,f){f&16384&&i!==(i=u[14])&&p(e,"for",i),f&16384&&o!==(o=u[14])&&p(l,"id",o),f&1&&l.value!==u[0].meta.appUrl&&Me(l,u[0].meta.appUrl)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function aD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Logs max days retention"),s=T(),l=_("input"),p(e,"for",i=n[14]),p(l,"type","number"),p(l,"id",o=n[14]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].logs.maxDays),r||(a=G(l,"input",n[8]),r=!0)},p(u,f){f&16384&&i!==(i=u[14])&&p(e,"for",i),f&16384&&o!==(o=u[14])&&p(l,"id",o),f&1&&At(l.value)!==u[0].logs.maxDays&&Me(l,u[0].logs.maxDays)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function uD(n){let e,t,i,s,l,o,r,a,u;const f=[lD,sD],c=[];function d(h,m){return h[1]?0:1}return l=d(n),o=c[l]=f[l](n),{c(){e=_("header"),e.innerHTML=`<nav class="breadcrumbs"><div class="breadcrumb-item">Settings</div>
|
||||
<div class="breadcrumb-item">Application</div></nav>`,t=T(),i=_("div"),s=_("form"),o.c(),p(e,"class","page-header"),p(s,"class","panel"),p(s,"autocomplete","off"),p(i,"class","wrapper")},m(h,m){w(h,e,m),w(h,t,m),w(h,i,m),g(i,s),c[l].m(s,null),r=!0,a||(u=G(s,"submit",Yt(n[4])),a=!0)},p(h,m){let v=l;l=d(h),l===v?c[l].p(h,m):(Pe(),P(c[v],1,1,()=>{c[v]=null}),Le(),o=c[l],o?o.p(h,m):(o=c[l]=f[l](h),o.c()),E(o,1),o.m(s,null))},i(h){r||(E(o),r=!0)},o(h){P(o),r=!1},d(h){h&&k(e),h&&k(t),h&&k(i),c[l].d(),a=!1,u()}}}function fD(n){let e,t,i,s;return e=new Vi({}),i=new Dn({props:{$$slots:{default:[uD]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment)},m(l,o){j(e,l,o),w(l,t,o),j(i,l,o),s=!0},p(l,[o]){const r={};o&32783&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){q(e,l),l&&k(t),q(i,l)}}}function cD(n,e,t){let i,s,l;kt(n,bo,y=>t(10,s=y)),kt(n,Rt,y=>t(11,l=y)),dn(Rt,l="Application settings",l);let o={},r=!1,a=!1,u="";f();async function f(){t(1,r=!0);try{const y=await ve.settings.getAll()||{};d(y)}catch(y){ve.errorResponseHandler(y)}t(1,r=!1)}async function c(){if(!(a||!i)){t(2,a=!0);try{const y=await ve.settings.update(U.filterRedactedProps(o));d(y),cn("Successfully saved application settings.")}catch(y){ve.errorResponseHandler(y)}t(2,a=!1)}}function d(y={}){var S;dn(bo,s=(S=y==null?void 0:y.meta)==null?void 0:S.appName,s),t(0,o={meta:(y==null?void 0:y.meta)||{},logs:(y==null?void 0:y.logs)||{}}),t(5,u=JSON.stringify(o))}function h(){o.meta.appName=this.value,t(0,o)}function m(){o.meta.appUrl=this.value,t(0,o)}function v(){o.logs.maxDays=At(this.value),t(0,o)}const b=()=>c();return n.$$.update=()=>{n.$$.dirty&33&&t(3,i=u!=JSON.stringify(o))},[o,r,a,i,c,u,h,m,v,b]}class dD extends Ee{constructor(e){super(),Oe(this,e,cD,fD,De,{})}}function pD(n){let e,t,i,s=[{type:"password"},{autocomplete:"new-password"},n[5]],l={};for(let o=0;o<s.length;o+=1)l=pt(l,s[o]);return{c(){e=_("input"),fi(e,l)},m(o,r){w(o,e,r),e.autofocus&&e.focus(),n[7](e),Me(e,n[0]),t||(i=G(e,"input",n[8]),t=!0)},p(o,r){fi(e,l=_n(s,[{type:"password"},{autocomplete:"new-password"},r&32&&o[5]])),r&1&&e.value!==o[0]&&Me(e,o[0])},d(o){o&&k(e),n[7](null),t=!1,i()}}}function hD(n){let e,t,i,s,l,o,r=[{readOnly:!0},{type:"text"},{placeholder:n[1]},n[5]],a={};for(let u=0;u<r.length;u+=1)a=pt(a,r[u]);return{c(){e=_("div"),t=_("button"),t.innerHTML='<i class="ri-key-line"></i>',i=T(),s=_("input"),p(t,"type","button"),p(t,"class","btn btn-secondary btn-circle"),p(e,"class","form-field-addon"),fi(s,a)},m(u,f){w(u,e,f),g(e,t),w(u,i,f),w(u,s,f),s.autofocus&&s.focus(),l||(o=[Ye(Ct.call(null,t,{position:"left",text:"Set new value"})),G(t,"click",n[6])],l=!0)},p(u,f){fi(s,a=_n(r,[{readOnly:!0},{type:"text"},f&2&&{placeholder:u[1]},f&32&&u[5]]))},d(u){u&&k(e),u&&k(i),u&&k(s),l=!1,Qe(o)}}}function mD(n){let e;function t(l,o){return l[3]?hD:pD}let i=t(n),s=i(n);return{c(){s.c(),e=Je()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:re,o:re,d(l){s.d(l),l&&k(e)}}}function gD(n,e,t){const i=["value","mask"];let s=Jt(e,i),{value:l=""}=e,{mask:o="******"}=e,r,a=!1;async function u(){t(0,l=""),t(3,a=!1),await ni(),r==null||r.focus()}const f=()=>u();function c(h){he[h?"unshift":"push"](()=>{r=h,t(2,r)})}function d(){l=this.value,t(0,l)}return n.$$set=h=>{e=pt(pt({},e),di(h)),t(5,s=Jt(e,i)),"value"in h&&t(0,l=h.value),"mask"in h&&t(1,o=h.mask)},n.$$.update=()=>{n.$$.dirty&3&&l===o&&t(3,a=!0)},[l,o,r,a,u,s,f,c,d]}class Ka extends Ee{constructor(e){super(),Oe(this,e,gD,mD,De,{value:0,mask:1})}}function _D(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C,$,M,D,O,A,I,L,R,B,K;i=new Ne({props:{class:"form-field required",name:"meta.senderName",$$slots:{default:[vD,({uniqueId:H})=>({23:H}),({uniqueId:H})=>H?8388608:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"meta.senderAddress",$$slots:{default:[yD,({uniqueId:H})=>({23:H}),({uniqueId:H})=>H?8388608:0]},$$scope:{ctx:n}}}),a=new Ne({props:{class:"form-field required",name:"meta.userVerificationUrl",$$slots:{default:[kD,({uniqueId:H})=>({23:H}),({uniqueId:H})=>H?8388608:0]},$$scope:{ctx:n}}}),f=new Ne({props:{class:"form-field required",name:"meta.userResetPasswordUrl",$$slots:{default:[wD,({uniqueId:H})=>({23:H}),({uniqueId:H})=>H?8388608:0]},$$scope:{ctx:n}}}),d=new Ne({props:{class:"form-field required",name:"meta.userConfirmEmailChangeUrl",$$slots:{default:[$D,({uniqueId:H})=>({23:H}),({uniqueId:H})=>H?8388608:0]},$$scope:{ctx:n}}}),S=new Ne({props:{class:"form-field form-field-toggle",$$slots:{default:[SD,({uniqueId:H})=>({23:H}),({uniqueId:H})=>H?8388608:0]},$$scope:{ctx:n}}});let J=n[0].smtp.enabled&&rh(n);return{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),V(a.$$.fragment),u=T(),V(f.$$.fragment),c=T(),V(d.$$.fragment),h=T(),m=_("hr"),v=T(),b=_("div"),b.innerHTML=`<p>By default PocketBase Line truncated
|
||||
<br/>
|
||||
<strong class="txt-bold">For better emails deliverability it is recommended to enable the SMTP settings
|
||||
below.</strong></p>`,y=T(),V(S.$$.fragment),C=T(),J&&J.c(),$=T(),M=_("div"),D=_("div"),O=T(),A=_("button"),I=_("span"),I.textContent="Save changes",p(t,"class","col-lg-6"),p(l,"class","col-lg-6"),p(e,"class","grid"),p(b,"class","content m-b-sm"),p(D,"class","flex-fill"),p(I,"class","txt"),p(A,"type","submit"),p(A,"class","btn btn-expanded"),A.disabled=L=!n[3]||n[2],ie(A,"btn-loading",n[2]),p(M,"class","flex")},m(H,X){w(H,e,X),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),j(a,e,null),g(e,u),j(f,e,null),g(e,c),j(d,e,null),w(H,h,X),w(H,m,X),w(H,v,X),w(H,b,X),w(H,y,X),j(S,H,X),w(H,C,X),J&&J.m(H,X),w(H,$,X),w(H,M,X),g(M,D),g(M,O),g(M,A),g(A,I),R=!0,B||(K=G(A,"click",n[19]),B=!0)},p(H,X){const W={};X&25165825&&(W.$$scope={dirty:X,ctx:H}),i.$set(W);const x={};X&25165825&&(x.$$scope={dirty:X,ctx:H}),o.$set(x);const Q={};X&25165825&&(Q.$$scope={dirty:X,ctx:H}),a.$set(Q);const se={};X&25165825&&(se.$$scope={dirty:X,ctx:H}),f.$set(se);const ge={};X&25165825&&(ge.$$scope={dirty:X,ctx:H}),d.$set(ge);const le={};X&25165825&&(le.$$scope={dirty:X,ctx:H}),S.$set(le),H[0].smtp.enabled?J?(J.p(H,X),X&1&&E(J,1)):(J=rh(H),J.c(),E(J,1),J.m($.parentNode,$)):J&&(Pe(),P(J,1,1,()=>{J=null}),Le()),(!R||X&12&&L!==(L=!H[3]||H[2]))&&(A.disabled=L),X&4&&ie(A,"btn-loading",H[2])},i(H){R||(E(i.$$.fragment,H),E(o.$$.fragment,H),E(a.$$.fragment,H),E(f.$$.fragment,H),E(d.$$.fragment,H),E(S.$$.fragment,H),E(J),R=!0)},o(H){P(i.$$.fragment,H),P(o.$$.fragment,H),P(a.$$.fragment,H),P(f.$$.fragment,H),P(d.$$.fragment,H),P(S.$$.fragment,H),P(J),R=!1},d(H){H&&k(e),q(i),q(o),q(a),q(f),q(d),H&&k(h),H&&k(m),H&&k(v),H&&k(b),H&&k(y),q(S,H),H&&k(C),J&&J.d(H),H&&k($),H&&k(M),B=!1,K()}}}function bD(n){let e;return{c(){e=_("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function vD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Sender name"),s=T(),l=_("input"),p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].meta.senderName),r||(a=G(l,"input",n[8]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(l,"id",o),f&1&&l.value!==u[0].meta.senderName&&Me(l,u[0].meta.senderName)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function yD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Sender address"),s=T(),l=_("input"),p(e,"for",i=n[23]),p(l,"type","email"),p(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].meta.senderAddress),r||(a=G(l,"input",n[9]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(l,"id",o),f&1&&l.value!==u[0].meta.senderAddress&&Me(l,u[0].meta.senderAddress)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function kD(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=F("User verification page url"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML=`Used in the user verification email. Available placeholder parameters:
|
||||
<code>%APP_URL%</code>, <code>%TOKEN%</code>.`,p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),g(e,t),w(c,s,d),w(c,l,d),Me(l,n[0].meta.userVerificationUrl),w(c,r,d),w(c,a,d),u||(f=G(l,"input",n[10]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(l,"id",o),d&1&&l.value!==c[0].meta.userVerificationUrl&&Me(l,c[0].meta.userVerificationUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function wD(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=F("User reset password page url"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML=`Used in the user password reset email. Available placeholder parameters:
|
||||
<code>%APP_URL%</code>, <code>%TOKEN%</code>.`,p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),g(e,t),w(c,s,d),w(c,l,d),Me(l,n[0].meta.userResetPasswordUrl),w(c,r,d),w(c,a,d),u||(f=G(l,"input",n[11]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(l,"id",o),d&1&&l.value!==c[0].meta.userResetPasswordUrl&&Me(l,c[0].meta.userResetPasswordUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function $D(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=F("User confirm email change page url"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML=`Used in the user email change confirmation email. Available placeholder
|
||||
parameters:
|
||||
<code>%APP_URL%</code>, <code>%TOKEN%</code>.`,p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),g(e,t),w(c,s,d),w(c,l,d),Me(l,n[0].meta.userConfirmEmailChangeUrl),w(c,r,d),w(c,a,d),u||(f=G(l,"input",n[12]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(l,"id",o),d&1&&l.value!==c[0].meta.userConfirmEmailChangeUrl&&Me(l,c[0].meta.userConfirmEmailChangeUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function SD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=F("Use SMTP mail server"),p(e,"type","checkbox"),p(e,"id",t=n[23]),e.required=!0,p(s,"for",o=n[23])},m(u,f){w(u,e,f),e.checked=n[0].smtp.enabled,w(u,i,f),w(u,s,f),g(s,l),r||(a=G(e,"change",n[13]),r=!0)},p(u,f){f&8388608&&t!==(t=u[23])&&p(e,"id",t),f&1&&(e.checked=u[0].smtp.enabled),f&8388608&&o!==(o=u[23])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function rh(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C;return i=new Ne({props:{class:"form-field required",name:"smtp.host",$$slots:{default:[CD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"smtp.port",$$slots:{default:[MD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field required",name:"smtp.tls",$$slots:{default:[TD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),d=new Ne({props:{class:"form-field",name:"smtp.username",$$slots:{default:[DD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),v=new Ne({props:{class:"form-field",name:"smtp.password",$$slots:{default:[OD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),a=_("div"),V(u.$$.fragment),f=T(),c=_("div"),V(d.$$.fragment),h=T(),m=_("div"),V(v.$$.fragment),b=T(),y=_("div"),p(t,"class","col-lg-6"),p(l,"class","col-lg-3"),p(a,"class","col-lg-3"),p(c,"class","col-lg-6"),p(m,"class","col-lg-6"),p(y,"class","col-lg-12"),p(e,"class","grid")},m($,M){w($,e,M),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),g(e,a),j(u,a,null),g(e,f),g(e,c),j(d,c,null),g(e,h),g(e,m),j(v,m,null),g(e,b),g(e,y),C=!0},p($,M){const D={};M&25165825&&(D.$$scope={dirty:M,ctx:$}),i.$set(D);const O={};M&25165825&&(O.$$scope={dirty:M,ctx:$}),o.$set(O);const A={};M&25165825&&(A.$$scope={dirty:M,ctx:$}),u.$set(A);const I={};M&25165825&&(I.$$scope={dirty:M,ctx:$}),d.$set(I);const L={};M&25165825&&(L.$$scope={dirty:M,ctx:$}),v.$set(L)},i($){C||(E(i.$$.fragment,$),E(o.$$.fragment,$),E(u.$$.fragment,$),E(d.$$.fragment,$),E(v.$$.fragment,$),$&&Dt(()=>{S||(S=rt(e,tn,{duration:150},!0)),S.run(1)}),C=!0)},o($){P(i.$$.fragment,$),P(o.$$.fragment,$),P(u.$$.fragment,$),P(d.$$.fragment,$),P(v.$$.fragment,$),$&&(S||(S=rt(e,tn,{duration:150},!1)),S.run(0)),C=!1},d($){$&&k(e),q(i),q(o),q(u),q(d),q(v),$&&S&&S.end()}}}function CD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("SMTP server host"),s=T(),l=_("input"),p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].smtp.host),r||(a=G(l,"input",n[14]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(l,"id",o),f&1&&l.value!==u[0].smtp.host&&Me(l,u[0].smtp.host)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function MD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Port"),s=T(),l=_("input"),p(e,"for",i=n[23]),p(l,"type","number"),p(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].smtp.port),r||(a=G(l,"input",n[15]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(l,"id",o),f&1&&At(l.value)!==u[0].smtp.port&&Me(l,u[0].smtp.port)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function TD(n){let e,t,i,s,l,o,r;function a(f){n[16](f)}let u={id:n[23],items:n[5]};return n[0].smtp.tls!==void 0&&(u.keyOfSelected=n[0].smtp.tls),l=new fs({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=F("TLS Encryption"),s=T(),V(l.$$.fragment),p(e,"for",i=n[23])},m(f,c){w(f,e,c),g(e,t),w(f,s,c),j(l,f,c),r=!0},p(f,c){(!r||c&8388608&&i!==(i=f[23]))&&p(e,"for",i);const d={};c&8388608&&(d.id=f[23]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].smtp.tls,He(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),q(l,f)}}}function DD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Username"),s=T(),l=_("input"),p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23])},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].smtp.username),r||(a=G(l,"input",n[17]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(l,"id",o),f&1&&l.value!==u[0].smtp.username&&Me(l,u[0].smtp.username)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function OD(n){let e,t,i,s,l,o,r;function a(f){n[18](f)}let u={id:Line truncated
|
||||
the
|
||||
`),r=_("strong"),u=F(a),f=F(`
|
||||
to the
|
||||
`),c=_("strong"),h=F(d),m=F(`.
|
||||
`),v=_("br"),b=F(`
|
||||
There are numerous command line tools that can help you, such as:
|
||||
`),y=_("a"),y.textContent=`rclone
|
||||
`,S=F(`,
|
||||
`),C=_("a"),C.textContent=`s5cmd
|
||||
`,$=F(", etc."),M=T(),D=_("div"),p(i,"class","icon"),p(y,"href","https://github.com/rclone/rclone"),p(y,"target","_blank"),p(y,"rel","noopener"),p(y,"class","txt-bold"),p(C,"href","https://github.com/peak/s5cmd"),p(C,"target","_blank"),p(C,"rel","noopener"),p(C,"class","txt-bold"),p(l,"class","content"),p(t,"class","alert alert-warning m-0"),p(D,"class","clearfix m-t-base")},m(I,L){w(I,e,L),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),g(l,r),g(r,u),g(l,f),g(l,c),g(c,h),g(l,m),g(l,v),g(l,b),g(l,y),g(l,S),g(l,C),g(l,$),g(e,M),g(e,D),A=!0},p(I,L){(!A||L&8)&&a!==(a=I[3]?"S3 storage":"local file system")&&ue(u,a),(!A||L&1)&&d!==(d=I[0].enabled?"S3 storage":"local file system")&&ue(h,d)},i(I){A||(I&&Dt(()=>{O||(O=rt(e,tn,{duration:150},!0)),O.run(1)}),A=!0)},o(I){I&&(O||(O=rt(e,tn,{duration:150},!1)),O.run(0)),A=!1},d(I){I&&k(e),I&&O&&O.end()}}}function uh(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C,$,M,D;return i=new Ne({props:{class:"form-field required",name:"s3.endpoint",$$slots:{default:[RD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"s3.bucket",$$slots:{default:[HD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field required",name:"s3.region",$$slots:{default:[jD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),d=new Ne({props:{class:"form-field required",name:"s3.accessKey",$$slots:{default:[qD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),v=new Ne({props:{class:"form-field required",name:"s3.secret",$$slots:{default:[VD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),S=new Ne({props:{class:"form-field",name:"s3.forcePathStyle",$$slots:{default:[zD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),a=_("div"),V(u.$$.fragment),f=T(),c=_("div"),V(d.$$.fragment),h=T(),m=_("div"),V(v.$$.fragment),b=T(),y=_("div"),V(S.$$.fragment),C=T(),$=_("div"),p(t,"class","col-lg-12"),p(l,"class","col-lg-6"),p(a,"class","col-lg-6"),p(c,"class","col-lg-6"),p(m,"class","col-lg-6"),p(y,"class","col-lg-12"),p($,"class","col-lg-12"),p(e,"class","grid")},m(O,A){w(O,e,A),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),g(e,a),j(u,a,null),g(e,f),g(e,c),j(d,c,null),g(e,h),g(e,m),j(v,m,null),g(e,b),g(e,y),j(S,y,null),g(e,C),g(e,$),D=!0},p(O,A){const I={};A&1572865&&(I.$$scope={dirty:A,ctx:O}),i.$set(I);const L={};A&1572865&&(L.$$scope={dirty:A,ctx:O}),o.$set(L);const R={};A&1572865&&(R.$$scope={dirty:A,ctx:O}),u.$set(R);const B={};A&1572865&&(B.$$scope={dirty:A,ctx:O}),d.$set(B);const K={};A&1572865&&(K.$$scope={dirty:A,ctx:O}),v.$set(K);const J={};A&1572865&&(J.$$scope={dirty:A,ctx:O}),S.$set(J)},i(O){D||(E(i.$$.fragment,O),E(o.$$.fragment,O),E(u.$$.fragment,O),E(d.$$.fragment,O),E(v.$$.fragment,O),E(S.$$.fragment,O),O&&Dt(()=>{M||(M=rt(e,tn,{duration:150},!0)),M.run(1)}),D=!0)},o(O){P(i.$$.fragment,O),P(o.$$.fragment,O),P(u.$$.fragment,O),P(d.$$.fragment,O),P(v.$$.fragment,O),P(S.$$.fragment,O),O&&(M||(M=rt(e,tn,{duration:150},!1)),M.run(0)),D=!1},d(O){O&&k(e),q(i),q(o),q(u),q(d),q(v),q(S),O&&M&&M.end()}}}function RD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Endpoint"),s=T(),l=_("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].endpoint),r||(a=G(l,"input",n[9]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&p(e,"for",i),f&524288&&o!==(o=u[19])&&p(l,"id",o),f&1&&l.value!==u[0].endpoint&&Me(l,u[0].endpoint)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function HD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Bucket"),s=T(),l=_("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].bucket),r||(a=G(l,"input",n[10]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&p(e,"for",i),f&524288&&o!==(o=u[19])&&p(l,"id",o),f&1&&l.value!==u[0].bucket&&Me(l,u[0].bucket)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function jD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Region"),s=T(),l=_("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].region),r||(a=G(l,"input",n[11]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&p(e,"for",i),f&524288&&o!==(o=u[19])&&p(l,"id",o),f&1&&l.value!==u[0].region&&Me(l,u[0].region)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function qD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Access key"),s=T(),l=_("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].accessKey),r||(a=G(l,"input",n[12]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&p(e,"for",i),f&524288&&o!==(o=u[19])&&p(l,"id",o),f&1&&l.value!==u[0].accessKey&&Me(l,u[0].accessKey)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function V
Line truncated
|
||||
<p>If you have limited disk space, you could optionally connect to a S3 compatible storage.</p>`,c=T(),h.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(f,"class","content txt-xl m-b-base"),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m($,M){w($,e,M),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),w($,r,M),w($,a,M),g(a,u),g(u,f),g(u,c),S[d].m(u,null),m=!0,v||(b=G(u,"submit",Yt(n[16])),v=!0)},p($,M){(!m||M&32)&&ue(o,$[5]);let D=d;d=C($),d===D?S[d].p($,M):(Pe(),P(S[D],1,1,()=>{S[D]=null}),Le(),h=S[d],h?h.p($,M):(h=S[d]=y[d]($),h.c()),E(h,1),h.m(u,null))},i($){m||(E(h),m=!0)},o($){P(h),m=!1},d($){$&&k(e),$&&k(r),$&&k(a),S[d].d(),v=!1,b()}}}function UD(n){let e,t,i,s;return e=new Vi({}),i=new Dn({props:{$$slots:{default:[BD]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment)},m(l,o){j(e,l,o),w(l,t,o),j(i,l,o),s=!0},p(l,[o]){const r={};o&1048639&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){q(e,l),l&&k(t),q(i,l)}}}function WD(n,e,t){let i,s;kt(n,Rt,D=>t(5,s=D)),dn(Rt,s="Files storage",s);let l={},o=!1,r=!1,a="",u=!1;f();async function f(){t(1,o=!0);try{const D=await ve.settings.getAll()||{};d(D)}catch(D){ve.errorResponseHandler(D)}t(1,o=!1)}async function c(){if(!(r||!i)){t(2,r=!0);try{const D=await ve.settings.update(U.filterRedactedProps({s3:l}));d(D),Si({}),cn("Successfully saved Files storage settings.")}catch(D){ve.errorResponseHandler(D)}t(2,r=!1)}}function d(D={}){t(0,l=(D==null?void 0:D.s3)||{}),t(3,u=l.enabled),t(7,a=JSON.stringify(l))}function h(){l.enabled=this.checked,t(0,l)}function m(){l.endpoint=this.value,t(0,l)}function v(){l.bucket=this.value,t(0,l)}function b(){l.region=this.value,t(0,l)}function y(){l.accessKey=this.value,t(0,l)}function S(D){n.$$.not_equal(l.secret,D)&&(l.secret=D,t(0,l))}function C(){l.forcePathStyle=this.checked,t(0,l)}const $=()=>c(),M=()=>c();return n.$$.update=()=>{n.$$.dirty&129&&t(4,i=a!=JSON.stringify(l))},[l,o,r,u,i,s,c,a,h,m,v,b,y,S,C,$,M]}class YD extends Ee{constructor(e){super(),Oe(this,e,WD,UD,De,{})}}function KD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=F("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[16]),p(s,"for",o=n[16])},m(u,f){w(u,e,f),e.checked=n[0].enabled,w(u,i,f),w(u,s,f),g(s,l),r||(a=G(e,"change",n[8]),r=!0)},p(u,f){f&65536&&t!==(t=u[16])&&p(e,"id",t),f&1&&(e.checked=u[0].enabled),f&65536&&o!==(o=u[16])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function fh(n){let e,t,i,s,l,o,r,a,u,f,c;return i=new Ne({props:{class:"form-field required",name:"emailPassword.minPasswordLength",$$slots:{default:[ZD,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field "+(U.isEmpty(n[0].onlyDomains)?"":"disabled"),name:"emailPassword.exceptDomains",$$slots:{default:[JD,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field "+(U.isEmpty(n[0].exceptDomains)?"":"disabled"),name:"emailPassword.onlyDomains",$$slots:{default:[GD,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),a=_("div"),V(u.$$.fragment),p(t,"class","col-sm-12 m-t-sm"),p(l,"class","col-lg-6"),p(a,"class","col-lg-6"),p(e,"class","grid")},m(d,h){w(d,e,h),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),g(e,a),j(u,a,null),c=!0},p(d,h){const m={};h&196609&&(m.$$scope={dirty:h,ctx:d}),i.$set(m);const v={};h&1&&(v.class="form-field "+(U.isEmpty(d[0].onlyDomains)?"":"disabled")),h&196609&&(v.$$scope={dirty:h,ctx:d}),o.$set(v);const b={};h&1&&(b.class="form-field "+(U.isEmpty(d[0].exceptDomains)?"":"disabled")),h&196609&&(b.$$scope={dirty:h,ctx:d}),u.$set(b)},i(d){c||(E(i.$$.fragment,d),E(o.$$.fragment,d),E(u.$$.fragment,d),d&&Dt(()=>{f||(f=rt(e,tn,{duration:150},!0)),f.run(1)}),c=!0)},o(d){P(i.$$.fragment,d),P(o.$$.fragment,d),P(u.$$.fragment,d),d&&(f||(f=rt(e,tn,{duration:150},!1)),f.run(0)),c=!1},d(d){d&&k(e),q(i),q(o),q(u),d&&f&&f.end()}}}function ZD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Minimum password length"),s=T(),l=_("input"),p(e,"for",i=n[16]),p(l,"type","number"),p(l,"id",o=n[16]),l.required=!0,p(l,"min","5"),p(l,"max","200")},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].minPasswordLength),r||(a=G(l,"input",n[9]),r=!0)},p(u,f){f&65536&&i!==(i=u[16])&&p(e,"for",i),f&65536&&o!==(o=u[16])&&p(l,"id",o),f&1&&At(l.value)!==u[0].minPasswordLength&&Me(l,u[0].minPasswordLength)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function JD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(b){n[10](b)}let v={id:n[16],disabled:!U.isEmpty(n[0].onlyDomains)};return n[0].exceptDomains!==void 0&&(v.value=n[0].exceptDomains),r=new cs({props:v}),he.push(()=>Re(r,"value",m)),{c(){e=_("label"),t=_("span"),t.textContent="Except domains",i=T(),s=_("i"),o=T(),Line truncated
|
||||
This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&65536&&l!==(l=b[16]))&&p(e,"for",l);const S={};y&65536&&(S.id=b[16]),y&1&&(S.disabled=!U.isEmpty(b[0].onlyDomains)),!a&&y&1&&(a=!0,S.value=b[0].exceptDomains,He(()=>a=!1)),r.$set(S)},i(b){c||(E(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),q(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function GD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(b){n[11](b)}let v={id:n[16]+".config.onlyDomains",disabled:!U.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(v.value=n[0].onlyDomains),r=new cs({props:v}),he.push(()=>Re(r,"value",m)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=T(),s=_("i"),o=T(),V(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[16]+".config.onlyDomains"),p(f,"class","help-block")},m(b,y){w(b,e,y),g(e,t),g(e,i),g(e,s),w(b,o,y),j(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(h=Ye(Ct.call(null,s,{text:`Email domains that are ONLY allowed to sign up.
|
||||
This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&65536&&l!==(l=b[16]+".config.onlyDomains"))&&p(e,"for",l);const S={};y&65536&&(S.id=b[16]+".config.onlyDomains"),y&1&&(S.disabled=!U.isEmpty(b[0].exceptDomains)),!a&&y&1&&(a=!0,S.value=b[0].onlyDomains,He(()=>a=!1)),r.$set(S)},i(b){c||(E(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),q(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function XD(n){let e,t,i,s;e=new Ne({props:{class:"form-field form-field-toggle m-b-0",name:"emailPassword.enabled",$$slots:{default:[KD,({uniqueId:o})=>({16:o}),({uniqueId:o})=>o?65536:0]},$$scope:{ctx:n}}});let l=n[0].enabled&&fh(n);return{c(){V(e.$$.fragment),t=T(),l&&l.c(),i=Je()},m(o,r){j(e,o,r),w(o,t,r),l&&l.m(o,r),w(o,i,r),s=!0},p(o,r){const a={};r&196609&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].enabled?l?(l.p(o,r),r&1&&E(l,1)):(l=fh(o),l.c(),E(l,1),l.m(i.parentNode,i)):l&&(Pe(),P(l,1,1,()=>{l=null}),Le())},i(o){s||(E(e.$$.fragment,o),E(l),s=!0)},o(o){P(e.$$.fragment,o),P(l),s=!1},d(o){q(e,o),o&&k(t),l&&l.d(o),o&&k(i)}}}function QD(n){let e;return{c(){e=_("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function xD(n){let e;return{c(){e=_("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function ch(n){let e,t,i,s,l;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Ye(Ct.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Dt(()=>{t||(t=rt(e,Un,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=rt(e,Un,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function eO(n){let e,t,i,s,l,o,r;function a(d,h){return d[0].enabled?xD:QD}let u=a(n),f=u(n),c=n[2]&&ch();return{c(){e=_("div"),e.innerHTML=`<i class="ri-mail-lock-line"></i>
|
||||
<span class="txt">Email/Password</span>`,t=T(),f.c(),i=T(),s=_("div"),l=T(),c&&c.c(),o=Je(),p(e,"class","inline-flex"),p(s,"class","flex-fill")},m(d,h){w(d,e,h),w(d,t,h),f.m(d,h),w(d,i,h),w(d,s,h),w(d,l,h),c&&c.m(d,h),w(d,o,h),r=!0},p(d,h){u!==(u=a(d))&&(f.d(1),f=u(d),f&&(f.c(),f.m(i.parentNode,i))),d[2]?c?h&4&&E(c,1):(c=ch(),c.c(),E(c,1),c.m(o.parentNode,o)):c&&(Pe(),P(c,1,1,()=>{c=null}),Le())},i(d){r||(E(c),r=!0)},o(d){P(c),r=!1},d(d){d&&k(e),d&&k(t),f.d(d),d&&k(i),d&&k(s),d&&k(l),c&&c.d(d),d&&k(o)}}}function tO(n){let e,t;const i=[n[3]];let s={$$slots:{header:[eO],default:[XD]},$$scope:{ctx:n}};for(let l=0;l<i.length;l+=1)s=pt(s,i[l]);return e=new Ua({props:s}),n[12](e),e.$on("expand",n[13]),e.$on("collapse",n[14]),e.$on("toggle",n[15]),{c(){V(e.$$.fragment)},m(l,o){j(e,l,o),t=!0},p(l,[o]){const r=o&8?_n(i,[pi(l[3])]):{};o&131077&&(r.$$scope={dirty:o,ctx:l}),e.$set(r)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){P(e.$$.fragment,l),t=!1},d(l){n[12](null),q(e,l)}}}function nO(n,e,t){let i;const s=["config","expand","collapse","collapseSiblings"];let l=Jt(e,s),o;kt(n,as,$=>t(7,o=$));let{config:r={}}=e,a;function u(){a==null||a.expand()}function f(){a==null||a.collapse()}function c(){a==null||a.collapseSiblings()}function d(){r.enabled=this.checked,t(0,r)}function h(){r.minPasswordLength=At(this.value),t(0,r)}function m($){n.$$.not_equal(r.exceptDomains,$)&&(r.exceptDomains=$,t(0,r))}function v($){n.$$.not_equal(r.onlyDomains,$)&&(r.onlyDomains=$,t(0,r))}function b($){he[$?"unshift":"push"](()=>{a=$,t(1,a)})}function y($){ut.call(this,n,$)}function S($){ut.call(this,n,$)}function C($){ut.call(this,n,$)}return n.$$set=$=>{e=pt(pt({},e),di($)),t(3,l=Jt(e,s)),"config"in $&&t(0,r=$.config)},n.$$.update=()=>{n.$$.dirty&128&&t(2,i=!U.isEmpty(o==null?void 0:o.emailPassword))},[r,a,i,l,u,f,c,o,d,h,m,v,b,y,S,C]}class iO extends Ee{constructor(e){super(),Oe(this,e,nO,tO,De,{config:0,expand:4,collapse:5,collapseSiblings:6})}get expand(){return this.$$.ctx[4]}get collapse(){return this.$$.ctx[5]}get collapseSiblings(){return this.$$.ctx[6]}}function sO(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=F("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[22]),p(s,"for",o=n[22])},m(u,f){w(u,e,f),e.checked=n[0].enabled,w(u,i,f),w(u,s,f),g(s,l),r||(a=G(e,"change",n[11]),r=!0)},p(u,f){f&4194304&&t!==(t=u[22])&&p(e,"id",t),f&1&&(e.checked=u[0].enabled),f&4194304&&o!==(o=u[22])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function dh(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m;l=new Ne({props:{class:"form-field required",name:n[1]+".clientId",$$slots:{default:[lO,({uniqueId:b})=>({22:b}),({uniqueId:b})=>b?4194304:0]},$$scope:{ctx:n}}}),a=new Ne({props:{class:"form-field required",name:n[1]+".clientSecret",$$slots:{default:[oO,({uniqueId:b})=>({22:b}),({uniqueId:b})=>b?4194304:0]},$$scope:{ctx:n}}}),c=new Ne({props:{class:"form-field",name:n[1]+".allowRegistrations",$$slots:{default:[rO,({uniqueId:b})=>({22:b}),({uniqueId:b})=>b?4194304:0]},$$scope:{ctx:n}}});let v=n[4]&&ph(n);return{c(){e=_("div"),t=_("div"),i=T(),s=_("div"),V(l.$$.fragment),o=T(),r=_("div"),V(a.$$.fragment),u=T(),f=_("div"),V(c.$$.fragment),d=T(),v&&v.c(),p(t,"class","col-12 spacing"),p(s,"class","col-lg-6"),p(r,"class","col-lg-6"),p(f,"class","col-lg-12"),p(e,"class","grid")},m(b,y){w(b,e,y),g(e,t),g(e,i),g(e,s),j(l,s,null),g(e,o),g(e,r),j(a,r,null),g(e,u),g(e,f),j(c,f,null),g(e,d),v&&v.m(e,null),m=!0},p(b,y){const S={};y&2&&(S.name=b[1]+".clientId"),y&12582913&&(S.$$scope={dirty:y,ctx:b}),l.$set(S);const C={};y&2&&(C.name=b[1]+".clientSecret"),y&12582913&&(C.$$scope={dirty:y,ctx:b}),a.$set(C);const $={};y&2&&($.name=b[1]+".allowRegistrations"),y&12582913&&($.$$scope={dirty:y,ctx:b}),c.$set($),b[4]?v?(v.p(b,y),y&16&&E(v,1)):(v=ph(b),v.c(),E(v,1),v.m(e,null)):v&&(Pe(),P(v,1,1,()=>{v=null}),Le())},i(b){m||(E(l.$$.fragment,b),E(a.$$.fragment,b),E(c.$$.fragment,b),E(v),b&&Dt(()=>{h||(h=rt(e,tn,{duration:200},!0)),h.run(1)}),m=!0)},o(b){P(l.$$.fragment,b),P(a.$$.fragment,b),P(c.$$.fragment,b),P(v),b&&(h||(h=rt(e,tn,{duration:200},!1)),h.run(0)),m=!1},d(b){b&&k(e),q(l),q(a),q(c),v&&v.d(),b&&h&&h.end()}}}function lO(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Client ID"),s=T(),l=_("input"),p(e,"for",i=n[22]),p(l,"type","text"),p(l,"id",o=n[22]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].clientId),r||(a=G(l,"input",n[12]),r=!0)},p(u,f){f&4194304&&i!==(i=u[22])&&p(e,"for",i),f&4194304&&o!==(o=u[22])&&p(l,"id",o),f&1&&l.value!==u[0].clientId&&Me(l,u[0].clientId)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function oO(n){let e,t,i,s,l,o,r;function a(f){n[13](f)}let u={id:n[22],required:!0};return n[0].clientSecret!==void 0&&(u.value=n[0].clientSecret),l=new Ka({props:u}),he.push(()=>Re(l,"value",a)),{c(){e=_("label"),t=F("Client Secret"),s=T(),V(l.$$.fragment),p(e,"for",i=n[22])},m(f,c){w(f,e,c),g(e,t),w(f,s,c),j(l,f,c),r=!0},p(f,c){(!r||c&4194304&&i!==(i=f[22]))&&p(e,"for",i);const d={};c&4194304&&(d.id=f[22]),!o&&c&Line truncated
|
||||
another PocketBase environment.</p>`,t=T(),i=_("div"),s=_("button"),s.innerHTML='<span class="txt">Copy</span>',l=T(),V(o.$$.fragment),r=T(),a=_("div"),u=_("div"),f=T(),c=_("button"),c.innerHTML=`<i class="ri-download-line"></i>
|
||||
<span class="txt">Download as JSON</span>`,p(e,"class","content txt-xl m-b-base"),p(s,"type","button"),p(s,"class","btn btn-sm btn-secondary fade copy-schema svelte-jm5c4z"),p(i,"tabindex","0"),p(i,"class","export-preview svelte-jm5c4z"),p(u,"class","flex-fill"),p(c,"type","button"),p(c,"class","btn btn-expanded"),p(a,"class","flex m-t-base")},m(v,b){w(v,e,b),w(v,t,b),w(v,i,b),g(i,s),g(i,l),j(o,i,null),n[8](i),w(v,r,b),w(v,a,b),g(a,u),g(a,f),g(a,c),d=!0,h||(m=[G(s,"click",n[7]),G(i,"keydown",n[9]),G(c,"click",n[10])],h=!0)},p(v,b){const y={};b&4&&(y.content=v[2]),o.$set(y)},i(v){d||(E(o.$$.fragment,v),d=!0)},o(v){P(o.$$.fragment,v),d=!1},d(v){v&&k(e),v&&k(t),v&&k(i),q(o),n[8](null),v&&k(r),v&&k(a),h=!1,Qe(m)}}}function AO(n){let e;return{c(){e=_("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function PO(n){let e,t,i,s,l,o,r,a,u,f,c,d;const h=[AO,EO],m=[];function v(b,y){return b[1]?0:1}return f=v(n),c=m[f]=h[f](n),{c(){e=_("header"),t=_("nav"),i=_("div"),i.textContent="Settings",s=T(),l=_("div"),o=F(n[3]),r=T(),a=_("div"),u=_("div"),c.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","panel"),p(a,"class","wrapper")},m(b,y){w(b,e,y),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),w(b,r,y),w(b,a,y),g(a,u),m[f].m(u,null),d=!0},p(b,y){(!d||y&8)&&ue(o,b[3]);let S=f;f=v(b),f===S?m[f].p(b,y):(Pe(),P(m[S],1,1,()=>{m[S]=null}),Le(),c=m[f],c?c.p(b,y):(c=m[f]=h[f](b),c.c()),E(c,1),c.m(u,null))},i(b){d||(E(c),d=!0)},o(b){P(c),d=!1},d(b){b&&k(e),b&&k(r),b&&k(a),m[f].d()}}}function LO(n){let e,t,i,s;return e=new Vi({}),i=new Dn({props:{$$slots:{default:[PO]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment)},m(l,o){j(e,l,o),w(l,t,o),j(i,l,o),s=!0},p(l,[o]){const r={};o&8207&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){q(e,l),l&&k(t),q(i,l)}}}function IO(n,e,t){let i,s;kt(n,Rt,b=>t(3,s=b)),dn(Rt,s="Export collections",s);const l="export_"+U.randomString(5);let o,r=[],a=!1;u();async function u(){t(1,a=!0);try{t(6,r=await ve.collections.getFullList(100,{$cancelKey:l}));for(let b of r)delete b.created,delete b.updated}catch(b){ve.errorResponseHandler(b)}t(1,a=!1)}function f(){U.downloadJson(r,"pb_schema")}function c(){U.copyToClipboard(i),h1("The configuration was copied to your clipboard!",3e3)}const d=()=>c();function h(b){he[b?"unshift":"push"](()=>{o=b,t(0,o)})}const m=b=>{if(b.ctrlKey&&b.code==="KeyA"){b.preventDefault();const y=window.getSelection(),S=document.createRange();S.selectNodeContents(o),y.removeAllRanges(),y.addRange(S)}},v=()=>f();return n.$$.update=()=>{n.$$.dirty&64&&t(2,i=JSON.stringify(r,null,4))},[o,a,i,s,f,c,r,d,h,m,v]}class FO extends Ee{constructor(e){super(),Oe(this,e,IO,LO,De,{})}}function bh(n,e,t){const i=n.slice();return i[14]=e[t],i}function vh(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function yh(n,e,t){const i=n.slice();return i[14]=e[t],i}function kh(n,e,t){const i=n.slice();return i[17]=e[t][0],i[23]=e[t][1],i}function wh(n,e,t){const i=n.slice();return i[14]=e[t],i}function $h(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function Sh(n,e,t){const i=n.slice();return i[30]=e[t],i}function NO(n){let e,t,i,s,l=n[1].name+"",o,r=n[9]&&Ch(),a=n[0].name!==n[1].name&&Mh(n);return{c(){e=_("div"),r&&r.c(),t=T(),a&&a.c(),i=T(),s=_("strong"),o=F(l),p(s,"class","txt"),p(e,"class","inline-flex fleg-gap-5")},m(u,f){w(u,e,f),r&&r.m(e,null),g(e,t),a&&a.m(e,null),g(e,i),g(e,s),g(s,o)},p(u,f){u[9]?r||(r=Ch(),r.c(),r.m(e,t)):r&&(r.d(1),r=null),u[0].name!==u[1].name?a?a.p(u,f):(a=Mh(u),a.c(),a.m(e,i)):a&&(a.d(1),a=null),f[0]&2&&l!==(l=u[1].name+"")&&ue(o,l)},d(u){u&&k(e),r&&r.d(),a&&a.d()}}}function RO(n){var o;let e,t,i,s=((o=n[0])==null?void 0:o.name)+"",l;return{c(){e=_("span"),e.textContent="Deleted",t=T(),i=_("strong"),l=F(s),p(e,"class","label label-danger")},m(r,a){w(r,e,a),w(r,t,a),w(r,i,a),g(i,l)},p(r,a){var u;a[0]&1&&s!==(s=((u=r[0])==null?void 0:u.name)+"")&&ue(l,s)},d(r){r&&k(e),r&&k(t),r&&k(i)}}}function HO(n){var o;let e,t,i,s=((o=n[1])==null?void 0:o.name)+"",l;return{c(){e=_("span"),e.textContent="Added",t=T(),i=_("strong"),l=F(s),p(e,"class","label label-success")},m(r,a){w(r,e,a),w(r,t,a),w(r,i,a),g(i,l)},p(r,a){var u;a[0]&2&&s!==(s=((u=r[1])==null?void 0:u.name)+"")&&ue(l,s)},d(r){r&&k(e),r&&k(t),r&&k(i)}}}function Ch(n){let e;return{c(){e=_("span"),e.textContent="Changed",p(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Mh(n){let e,t=n[0].name+"",i,s,l;return{c(){e=_("strong"),i=F(t),s=T(),l=_("i"),p(e,"class","txt-strikethrough txt-hint"),p(l,"class","ri-arrow-right-line txt-sm")},m(o,r){w(o,e,r),g(e,i),w(o,s,r),w(o,l,r)},p(o,r){r[0]&1&&t!==(t=o[0].name+"")&&ue(i,t)},d(o){o&&k(e),o&&k(s),o&&k(l)}}}function Th(n){var b,y;let e,t,i,s=n[30]+"",l,o,r,a,u=n[12]((b=n[0])==null?void 0:b[n[30]])+""Line truncated
|
||||
<th width="10%" class="svelte-lmkr38">Old</th>
|
||||
<th width="10%" class="svelte-lmkr38">New</th></tr>`,l=T(),o=_("tbody");for(let $=0;$<m.length;$+=1)m[$].c();r=T(),v&&v.c(),a=T();for(let $=0;$<y.length;$+=1)y[$].c();u=T();for(let $=0;$<C.length;$+=1)C[$].c();p(e,"class","section-title"),p(i,"class","table collections-diff-table m-b-base svelte-lmkr38")},m($,M){w($,e,M),d.m(e,null),w($,t,M),w($,i,M),g(i,s),g(i,l),g(i,o);for(let D=0;D<m.length;D+=1)m[D].m(o,null);g(o,r),v&&v.m(o,null),g(o,a);for(let D=0;D<y.length;D+=1)y[D].m(o,null);g(o,u);for(let D=0;D<C.length;D+=1)C[D].m(o,null)},p($,M){if(c===(c=f($))&&d?d.p($,M):(d.d(1),d=c($),d&&(d.c(),d.m(e,null))),M[0]&7203){h=$[11];let D;for(D=0;D<h.length;D+=1){const O=Sh($,h,D);m[D]?m[D].p(O,M):(m[D]=Th(O),m[D].c(),m[D].m(o,r))}for(;D<m.length;D+=1)m[D].d(1);m.length=h.length}if($[2]||$[5]?v?v.p($,M):(v=Dh($),v.c(),v.m(o,a)):v&&(v.d(1),v=null),M[0]&4248){b=$[7];let D;for(D=0;D<b.length;D+=1){const O=yh($,b,D);y[D]?y[D].p(O,M):(y[D]=Lh(O),y[D].c(),y[D].m(o,u))}for(;D<y.length;D+=1)y[D].d(1);y.length=b.length}if(M[0]&4352){S=$[8];let D;for(D=0;D<S.length;D+=1){const O=bh($,S,D);C[D]?C[D].p(O,M):(C[D]=Fh(O),C[D].c(),C[D].m(o,null))}for(;D<C.length;D+=1)C[D].d(1);C.length=S.length}},i:re,o:re,d($){$&&k(e),d.d(),$&&k(t),$&&k(i),xt(m,$),v&&v.d(),xt(y,$),xt(C,$)}}}function jn(n,e){n=n||[];for(let t of n)if(t.id==e)return t;return null}function vn(n,e){return n===e?!1:JSON.stringify(n)!==JSON.stringify(e)}function qO(n,e,t){let i,s,l,{collectionA:o=new fn}=e,{collectionB:r=new fn}=e,{deleteMissing:a=!1}=e,u=[],f=[],c=[],d=[],h=[];const m=Object.keys(new fn().export()).filter(y=>!["schema","created","updated"].includes(y));function v(){t(4,f=Array.isArray(r==null?void 0:r.schema)?r==null?void 0:r.schema.concat():[]),a||t(4,f=f.concat(u.filter(y=>!f.find(S=>y.id==S.id))))}function b(y){return typeof y>"u"?"":U.isObject(y)?JSON.stringify(y,null,4):y}return n.$$set=y=>{"collectionA"in y&&t(0,o=y.collectionA),"collectionB"in y&&t(1,r=y.collectionB),"deleteMissing"in y&&t(2,a=y.deleteMissing)},n.$$.update=()=>{n.$$.dirty[0]&2&&t(5,i=!(r!=null&&r.id)&&!(r!=null&&r.name)),n.$$.dirty[0]&33&&t(10,s=!i&&!(o!=null&&o.id)),n.$$.dirty[0]&1&&t(3,u=Array.isArray(o==null?void 0:o.schema)?o==null?void 0:o.schema.concat():[]),n.$$.dirty[0]&7&&(typeof(o==null?void 0:o.schema)<"u"||typeof(r==null?void 0:r.schema)<"u"||typeof a<"u")&&v(),n.$$.dirty[0]&24&&t(6,c=u.filter(y=>!f.find(S=>y.id==S.id))),n.$$.dirty[0]&24&&t(7,d=f.filter(y=>u.find(S=>S.id==y.id))),n.$$.dirty[0]&24&&t(8,h=f.filter(y=>!u.find(S=>S.id==y.id))),n.$$.dirty[0]&7&&t(9,l=U.hasCollectionChanges(o,r,a))},[o,r,a,u,f,i,c,d,h,l,s,m,b]}class VO extends Ee{constructor(e){super(),Oe(this,e,qO,jO,De,{collectionA:0,collectionB:1,deleteMissing:2},null,[-1,-1])}}function Nh(n,e,t){const i=n.slice();return i[17]=e[t],i}function Rh(n){let e,t;return e=new VO({props:{collectionA:n[17].old,collectionB:n[17].new,deleteMissing:n[3]}}),{c(){V(e.$$.fragment)},m(i,s){j(e,i,s),t=!0},p(i,s){const l={};s&4&&(l.collectionA=i[17].old),s&4&&(l.collectionB=i[17].new),s&8&&(l.deleteMissing=i[3]),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function zO(n){let e,t,i=n[2],s=[];for(let o=0;o<i.length;o+=1)s[o]=Rh(Nh(n,i,o));const l=o=>P(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o<s.length;o+=1)s[o].c();e=Je()},m(o,r){for(let a=0;a<s.length;a+=1)s[a].m(o,r);w(o,e,r),t=!0},p(o,r){if(r&12){i=o[2];let a;for(a=0;a<i.length;a+=1){const u=Nh(o,i,a);s[a]?(s[a].p(u,r),E(s[a],1)):(s[a]=Rh(u),s[a].c(),E(s[a],1),s[a].m(e.parentNode,e))}for(Pe(),a=i.length;a<s.length;a+=1)l(a);Le()}},i(o){if(!t){for(let r=0;r<i.length;r+=1)E(s[r]);t=!0}},o(o){s=s.filter(Boolean);for(let r=0;r<s.length;r+=1)P(s[r]);t=!1},d(o){xt(s,o),o&&k(e)}}}function BO(n){let e;return{c(){e=_("h4"),e.textContent="Side-by-side diff",p(e,"class","center txt-break")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function UO(n){let e,t,i,s,l,o,r;return{c(){e=_("button"),t=F("Close"),i=T(),s=_("button"),l=_("span"),l.textContent="Confirm and import",p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[4],p(l,"class","txt"),p(s,"type","button"),p(s,"class","btn btn-expanded"),s.disabled=n[4],ie(s,"btn-loading",n[4])},m(a,u){w(a,e,u),g(e,t),w(a,i,u),w(a,s,u),g(s,l),o||(r=[G(e,"click",n[0]),G(s,"click",n[9])],o=!0)},p(a,u){u&16&&(e.disabled=a[4]),u&16&&(s.disabled=a[4]),u&16&&ie(s,"btn-loading",a[4])},d(a){a&&k(e),a&&k(i),a&&k(s),o=!1,Qe(r)}}}function WO(n){let e,t,i={class:"full-width-popup import-popup",overlayClose:!1,escClose:!n[4],beforeHide:n[10],popup:!0,$$slots:{footer:[UO],header:[BO],default:[zO]},$$scope:{ctx:n}};return e=new hi({props:i}),n[11](e),e.$on("show",n[12]),e.$on("hide",n[13]),{c(){V(e.$$.fragment)},m(s,l){j(e,s,l),t=!0},p(s,[l]){const o={};l&16&&(o.escClose=!s[4]),l&16&&(o.beforeHide=s[10]),l&1048604&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[11](null),q(e,s)}}}function YO(n,e,t){const i=on();let sLine truncated
|
||||
- ${$.join(`
|
||||
- `)}`,()=>{m()}):m()}async function m(){if(!u){t(4,u=!0);try{await ve.collections.import(o,a),cn("Successfully imported collections configuration."),i("submit")}catch($){ve.errorResponseHandler($)}t(4,u=!1),c()}}const v=()=>h(),b=()=>!u;function y($){he[$?"unshift":"push"](()=>{s=$,t(1,s)})}function S($){ut.call(this,n,$)}function C($){ut.call(this,n,$)}return n.$$.update=()=>{n.$$.dirty&384&&Array.isArray(l)&&Array.isArray(o)&&d()},[c,s,r,a,u,h,f,l,o,v,b,y,S,C]}class KO extends Ee{constructor(e){super(),Oe(this,e,YO,WO,De,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function Hh(n,e,t){const i=n.slice();return i[32]=e[t],i}function jh(n,e,t){const i=n.slice();return i[35]=e[t],i}function qh(n,e,t){const i=n.slice();return i[32]=e[t],i}function ZO(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C,$,M,D,O;a=new Ne({props:{class:"form-field "+(n[6]?"":"field-error"),name:"collections",$$slots:{default:[GO,({uniqueId:K})=>({40:K}),({uniqueId:K})=>[0,K?512:0]]},$$scope:{ctx:n}}});let A=!1,I=n[6]&&n[1].length&&!n[7]&&zh(),L=n[6]&&n[1].length&&n[7]&&Bh(n),R=n[13].length&&em(n),B=!!n[0]&&tm(n);return{c(){e=_("input"),t=T(),i=_("div"),s=_("p"),l=F(`Paste below the collections configuration you want to import or
|
||||
`),o=_("button"),o.innerHTML='<span class="txt">Load from JSON file</span>',r=T(),V(a.$$.fragment),u=T(),f=T(),I&&I.c(),c=T(),L&&L.c(),d=T(),R&&R.c(),h=T(),m=_("div"),B&&B.c(),v=T(),b=_("div"),y=T(),S=_("button"),C=_("span"),C.textContent="Review",p(e,"type","file"),p(e,"class","hidden"),p(e,"accept",".json"),p(o,"class","btn btn-outline btn-sm m-l-5"),ie(o,"btn-loading",n[12]),p(i,"class","content txt-xl m-b-base"),p(b,"class","flex-fill"),p(C,"class","txt"),p(S,"type","button"),p(S,"class","btn btn-expanded btn-warning m-l-auto"),S.disabled=$=!n[14],p(m,"class","flex m-t-base")},m(K,J){w(K,e,J),n[19](e),w(K,t,J),w(K,i,J),g(i,s),g(s,l),g(s,o),w(K,r,J),j(a,K,J),w(K,u,J),w(K,f,J),I&&I.m(K,J),w(K,c,J),L&&L.m(K,J),w(K,d,J),R&&R.m(K,J),w(K,h,J),w(K,m,J),B&&B.m(m,null),g(m,v),g(m,b),g(m,y),g(m,S),g(S,C),M=!0,D||(O=[G(e,"change",n[20]),G(o,"click",n[21]),G(S,"click",n[26])],D=!0)},p(K,J){J[0]&4096&&ie(o,"btn-loading",K[12]);const H={};J[0]&64&&(H.class="form-field "+(K[6]?"":"field-error")),J[0]&65|J[1]&1536&&(H.$$scope={dirty:J,ctx:K}),a.$set(H),K[6]&&K[1].length&&!K[7]?I||(I=zh(),I.c(),I.m(c.parentNode,c)):I&&(I.d(1),I=null),K[6]&&K[1].length&&K[7]?L?L.p(K,J):(L=Bh(K),L.c(),L.m(d.parentNode,d)):L&&(L.d(1),L=null),K[13].length?R?R.p(K,J):(R=em(K),R.c(),R.m(h.parentNode,h)):R&&(R.d(1),R=null),K[0]?B?B.p(K,J):(B=tm(K),B.c(),B.m(m,v)):B&&(B.d(1),B=null),(!M||J[0]&16384&&$!==($=!K[14]))&&(S.disabled=$)},i(K){M||(E(a.$$.fragment,K),E(A),M=!0)},o(K){P(a.$$.fragment,K),P(A),M=!1},d(K){K&&k(e),n[19](null),K&&k(t),K&&k(i),K&&k(r),q(a,K),K&&k(u),K&&k(f),I&&I.d(K),K&&k(c),L&&L.d(K),K&&k(d),R&&R.d(K),K&&k(h),K&&k(m),B&&B.d(),D=!1,Qe(O)}}}function JO(n){let e;return{c(){e=_("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function Vh(n){let e;return{c(){e=_("div"),e.textContent="Invalid collections configuration.",p(e,"class","help-block help-block-error")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function GO(n){let e,t,i,s,l,o,r,a,u,f,c=!!n[0]&&!n[6]&&Vh();return{c(){e=_("label"),t=F("Collections"),s=T(),l=_("textarea"),r=T(),c&&c.c(),a=Je(),p(e,"for",i=n[40]),p(e,"class","p-b-10"),p(l,"id",o=n[40]),p(l,"class","code"),p(l,"spellcheck","false"),p(l,"rows","15"),l.required=!0},m(d,h){w(d,e,h),g(e,t),w(d,s,h),w(d,l,h),Me(l,n[0]),w(d,r,h),c&&c.m(d,h),w(d,a,h),u||(f=G(l,"input",n[22]),u=!0)},p(d,h){h[1]&512&&i!==(i=d[40])&&p(e,"for",i),h[1]&512&&o!==(o=d[40])&&p(l,"id",o),h[0]&1&&Me(l,d[0]),!!d[0]&&!d[6]?c||(c=Vh(),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(d){d&&k(e),d&&k(s),d&&k(l),d&&k(r),c&&c.d(d),d&&k(a),u=!1,f()}}}function zh(n){let e;return{c(){e=_("div"),e.innerHTML=`<div class="icon"><i class="ri-information-line"></i></div>
|
||||
<div class="content"><string>Your collections configuration is already up-to-date!</string></div>`,p(e,"class","alert alert-info")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Bh(n){let e,t,i,s,l,o=n[9].length&&Uh(n),r=n[4].length&&Kh(n),a=n[8].length&&Xh(n);return{c(){e=_("h5"),e.textContent="Detected changes",t=T(),i=_("div"),o&&o.c(),s=T(),r&&r.c(),l=T(),a&&a.c(),p(e,"class","section-title"),p(i,"class","list")},m(u,f){w(u,e,f),w(u,t,f),w(u,i,f),o&&o.m(i,null),g(i,s),r&&r.m(i,null),g(i,l),a&&a.m(i,null)},p(u,f){u[9].length?o?o.p(u,f):(o=Uh(u),o.c(),o.m(i,s)):o&&(o.d(1),o=null),u[4].length?r?r.p(u,f):(r=Kh(u),r.c(),r.m(i,l)):r&&(r.d(1),r=null),u[8].length?a?a.p(u,f):(a=Xh(u),a.c(),a.m(i,null)):a&&(a.d(1),a=null)},d(u){u&&k(e),u&&k(t),u&&k(i),o&&o.d(),r&&r.d(),a&&a.d()}}}function Uh(n){let e=[],t=new Map,i,s=n[9];const l=o=>o[32].id;for(let o=0;o<s.length;o+=1){let r=qh(n,s,o),a=l(r);t.set(a,e[o]=Yh(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=Je()},m(o,r){for(let a=0;a<e.length;a+=1)e[a].m(o,r);w(o,i,r)},p(o,r){r[0]&512&&(s=o[9],e=bt(e,r,l,1,o,s,t,i.parentNode,Mn,Yh,i,qh))},d(o){for(let r=0;r<e.length;r+=1)e[r].d(o);o&&k(i)}}}function Wh(n){let e,t,i=n[32].id+"",s,l;return{c(){e=_("small"),t=F("("),s=F(i),l=F(")"),p(e,"class","txt-hint")},m(o,r){w(o,e,r),g(e,t),g(e,s),g(e,l)},p(o,r){r[0]&512&&i!==(i=o[32].id+"")&&ue(s,i)},d(o){o&&k(e)}}}function Yh(n,e){let t,i,s,l,o=e[32].name+"",r,a,u,f=e[32].id&&Wh(e);return{key:n,first:null,c(){t=_("div"),i=_("span"),i.textContent="Deleted",s=T(),l=_("strong"),r=F(o),a=T(),f&&f.c(),u=T(),p(i,"class","label label-danger list-label svelte-1jx20fl"),p(t,"class","list-item"),this.first=t},m(c,d){w(c,t,d),g(t,i),g(t,s),g(t,l),g(l,r),g(t,a),f&&f.m(t,null),g(t,u)},p(c,d){e=c,d[0]&512&&o!==(o=e[32].name+"")&&ue(r,o),e[32].id?f?f.p(e,d):(f=Wh(e),f.c(),f.m(t,u)):f&&(f.d(1),f=null)},d(c){c&&k(t),f&&f.d()}}}function Kh(n){let e=[],t=new Map,i,s=n[4];const l=o=>o[35].old.id+o[35].new.id;for(let o=0;o<s.length;o+=1){let r=jh(n,s,o),a=l(r);t.set(a,e[o]=Gh(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=Je()},m(o,r){for(let a=0;a<e.length;a+=1)e[a].m(o,r);w(o,i,r)},p(o,r){r[0]&16&&(s=o[4],e=bt(e,r,l,1,o,s,t,i.parentNode,Mn,Gh,i,jh))},d(o){for(let r=0;r<e.length;r+=1)e[r].d(o);o&&k(i)}}}function Zh(n){let e,t=n[35].old.name+"",i,s,l;return{c(){e=_("strong"),i=F(t),s=T(),l=_("i"),p(e,"class","txt-strikethrough txt-hint"),p(l,"class","ri-arrow-right-line txt-sm")},m(o,r){w(o,e,r),g(e,i),w(o,s,r),w(o,l,r)},p(o,r){r[0]&16&&t!==(t=o[35].old.name+"")&&ue(i,t)},d(o){o&&k(e),o&&k(s),o&&k(l)}}}function Jh(n){let e,t,i=n[35].new.id+"",s,l;return{c(){e=_("small"),t=F("("),s=F(i),l=F(")"),p(e,"class","txt-hint")},m(o,r){w(o,e,r),g(e,t),g(e,s),g(e,l)},p(o,r){r[0]&16&&i!==(i=o[35].new.id+"")&&ue(s,i)},d(o){o&&k(e)}}}function Gh(n,e){let t,i,s,l,o,r,a=e[35].new.name+"",u,f,c,d=e[35].old.name!==e[35].new.name&&Zh(e),h=e[35].new.id&&Jh(e);return{key:n,first:null,c(){t=_("div"),i=_("span"),i.textContent="Changed",s=T(),l=_("div"),d&&d.c(),o=T(),r=_("strong"),u=F(a),f=T(),h&&h.c(),c=T(),p(i,"class","label label-warning list-label svelte-1jx20fl"),p(l,"class","inline-flex flex-gap-5"),p(t,"class","list-item"),this.first=t},m(m,v){w(m,t,v),g(t,i),g(t,s),g(t,l),d&&d.m(l,null),g(l,o),g(l,r),g(r,u),g(l,f),h&&h.m(l,null),g(t,c)},p(m,v){e=m,e[35].old.name!==e[35].new.name?d?d.p(e,v):(d=Zh(e),d.c(),d.m(l,o)):d&&(d.d(1),d=null),v[0]&16&&a!==(a=e[35].new.name+"")&&ue(u,a),e[35].new.id?h?h.p(e,v):(h=Jh(e),h.c(),h.m(l,null)):h&&(h.d(1),h=null)},d(m){m&&k(t),d&&d.d(),h&&h.d()}}}function Xh(n){let e=[],t=new Map,i,s=n[8];const l=o=>o[32].id;for(let o=0;o<s.length;o+=1){let r=Hh(n,s,o),a=l(r);t.set(a,e[o]=xh(a,r))}return{c(){for(let o=0;o<e.length;o+=1)e[o].c();i=Je()},m(o,r){for(let a=0;a<e.length;a+=1)e[a].m(o,r);w(o,i,r)},p(o,r){r[0]&256&&(s=o[8],e=bt(e,r,l,1,o,s,t,i.parentNode,Mn,xh,i,Hh))},d(o){for(let r=0;r<e.length;r+=1)e[r].d(o);o&&k(i)}}}function Qh(n){let e,t,i=n[32].id+"",s,l;return{c(){e=_("small"),t=F("("),s=F(i),l=F(")"),p(e,"class","txt-hint")},m(o,r){w(o,e,r),g(e,t),g(e,s),g(e,l)},p(o,r){r[0]&256&&i!==(i=o[32].id+"")&&ue(s,i)},d(o){o&&k(e)}}}function xh(n,e){let t,i,s,l,o=e[32].name+"",r,a,u,f=e[32].id&&Qh(e);return{key:n,first:null,c(){t=_("div"),i=_("span"),i.textContent="Added",s=T(),l=_("strong"),r=F(o),a=T(),f&&f.c(),u=T(),p(i,"class","label label-success list-label svelte-1jx20fl"),p(t,"class","list-item"),this.first=t},m(c,d){w(c,t,d),g(t,i),g(t,s),g(t,l),g(l,r),g(t,a),f&&f.m(t,null),g(t,u)},p(c,d){e=c,d[0]&256&&o!==(o=e[32].name+"")&&ue(r,o),e[32].id?f?f.p(e,d):(f=Qh(e),f.c(),f.m(t,u)):f&&(f.d(1),f=null)},d(c){c&&k(t),f&&f.d()}}}function em(n){let e,t,i,s,l,o,r,a;return{c(){e=_("div"),t=_("div"),t.innerHTML='<i class="ri-error-warning-line"></i>',i=T(),s=_("div"),s.innerHTML=`<string>Some of the imported collections shares the same name and/or fields but are
|
||||
imported with different IDs. You can replace them in the import if you want
|
||||
to.</string>`,l=T(),o=_("button"),o.innerHTML='<span class="txt">Replace with original ids</span>',p(t,"class","icon"),p(s,"class","content"),p(o,"type","button"),p(o,"class","btn btn-warning btn-sm btn-outline"),p(e,"class","alert alert-warning m-t-base")},m(u,f){w(u,e,f),g(e,t),g(e,i),g(e,s),g(e,l),g(e,o),r||(a=G(o,"click",n[24]),r=!0)},p:re,d(u){u&&k(e),r=!1,a()}}}function tm(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear</span>',p(e,"type","button"),p(e,"class","btn btn-secondary link-hint")},m(s,l){w(s,e,l),t||(i=G(e,"click",n[25]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function XO(n){let e,t,i,s,l,o,r,a,u,f,c,d;const h=[JO,ZO],m=[];function v(b,y){return b[5]?0:1}return f=v(n),c=m[f]=h[f](n),{c(){e=_("header"),t=_("nav"),i=_("div"),i.textContent="Settings",s=T(),l=_("div"),o=F(n[15]),r=T(),a=_("div"),u=_("div"),c.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","panel"),p(a,"class","wrapper")},m(b,y){w(b,e,y),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),w(b,r,y),w(b,a,y),g(a,u),m[f].m(u,null),d=!0},p(b,y){(!d||y[0]&32768)&&ue(o,b[15]);let S=f;f=v(b),f===S?m[f].p(b,y):(Pe(),P(m[S],1,1,()=>{m[S]=null}),Le(),c=m[f],c?c.p(b,y):(c=m[f]=h[f](b),c.c()),E(c,1),c.m(u,null))},i(b){d||(E(c),d=!0)},o(b){P(c),d=!1},d(b){b&&k(e),b&&k(r),b&&k(a),m[f].d()}}}function QO(n){let e,t,i,s,l,o;e=new Vi({}),i=new Dn({props:{$$slots:{default:[XO]},$$scope:{ctx:n}}});let r={};return l=new KO({props:r}),n[27](l),l.$on("submit",n[28]),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment),s=T(),V(l.$$.fragment)},m(a,u){j(e,a,u),w(a,t,u),j(i,a,u),w(a,s,u),j(l,a,u),o=!0},p(a,u){const f={};u[0]&65535|u[1]&1024&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};l.$set(c)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),E(l.$$.fragment,a),o=!0)},o(a){P(e.$$.fragment,a),P(i.$$.fragment,a),P(l.$$.fragment,a),o=!1},d(a){q(e,a),a&&k(t),q(i,a),a&&k(s),n[27](null),q(l,a)}}}function xO(n,e,t){let i,s,l,o,r,a,u;kt(n,Rt,Q=>t(15,u=Q)),dn(Rt,u="Import collections",u);let f,c,d="",h=!1,m=[],v=[],b=!0,y=[],S=!1;C();async function C(){t(5,S=!0);try{t(2,v=await ve.collections.getFullList(200));for(let Q of v)delete Q.created,delete Q.updated}catch(Q){ve.errorResponseHandler(Q)}t(5,S=!1)}function $(){if(t(4,y=[]),!!i)for(let Q of m){const se=U.findByKey(v,"id",Q.id);!(se!=null&&se.id)||!U.hasCollectionChanges(se,Q,b)||y.push({new:Q,old:se})}}function M(){t(1,m=[]);try{t(1,m=JSON.parse(d))}catch{}Array.isArray(m)?t(1,m=U.filterDuplicatesByKey(m)):t(1,m=[]);for(let Q of m)delete Q.created,delete Q.updated,Q.schema=U.filterDuplicatesByKey(Q.schema)}function D(){var Q;for(let se of m){const ge=U.findByKey(v,"name",se.name)||U.findByKey(v,"id",se.id);if(!ge)continue;const le=se.id,me=ge.id;se.id=me;const we=Array.isArray(ge.schema)?ge.schema:[],Y=Array.isArray(se.schema)?se.schema:[];for(const be of Y){const ee=U.findByKey(we,"name",be.name);be.id=ee.id}for(let be of m)if(!!Array.isArray(be.schema))for(let ee of be.schema)((Q=ee.options)==null?void 0:Q.collectionId)===le&&(ee.options.collectionId=me)}t(0,d=JSON.stringify(m,null,4))}function O(Q){t(12,h=!0);const se=new FileReader;se.onload=async ge=>{t(12,h=!1),t(10,f.value="",f),t(0,d=ge.target.result),await ni(),m.length||(go("Invalid collections configuration."),A())},se.onerror=ge=>{console.warn(ge),go("Failed to load the imported JSON."),t(12,h=!1),t(10,f.value="",f)},se.readAsText(Q)}function A(){t(0,d=""),t(10,f.value="",f),Si({})}function I(Q){he[Q?"unshift":"push"](()=>{f=Q,t(10,f)})}const L=()=>{f.files.length&&O(f.files[0])},R=()=>{f.click()};function B(){d=this.value,t(0,d)}function K(){b=this.checked,t(3,b)}const J=()=>D(),H=()=>A(),X=()=>c==null?void 0:c.show(v,m,b);function W(Q){he[Q?"unshift":"push"](()=>{c=Q,t(11,c)})}const x=()=>A();return n.$$.update=()=>{n.$$.dirty[0]&1&&typeof d<"u"&&M(),n.$$.dirty[0]&3&&t(6,i=!!d&&m.length&&m.length===m.filter(Q=>!!Q.id&&!!Q.name).length),n.$$.dirty[0]&78&&t(9,s=v.filter(Q=>i&&b&&!U.findByKey(m,"id",Q.id))),n.$$.dirty[0]&70&&t(8,l=m.filter(Q=>i&&!U.findByKey(v,"id",Q.id))),n.$$.dirty[0]&10&&(typeof m<"u"||typeof b<"u")&&$(),n.$$.dirty[0]&785&&t(7,o=!!d&&(s.length||l.length||y.length)),n.$$.dirty[0]&224&&t(14,r=!S&&i&&o),n.$$.dirty[0]&6&&t(13,a=m.filter(Q=>{let se=U.findByKey(v,"name",Q.name)||U.findByKey(v,"id",Q.id);if(!se)return!1;if(se.id!=Q.id)return!0;const ge=Array.isArray(se.schema)?se.schema:[],le=Array.isArray(Q.schema)?Q.schema:[];for(const me of le){if(U.findByKey(ge,"id",me.id))continue;const Y=U.findByKey(ge,"name",me.name);if(Y&&me.id!=Y.id)return!0}return!1}))},[d,m,v,b,y,S,i,o,l,s,f,c,h,a,r,u,D,O,A,I,L,R,B,K,J,H,X,W,x]}class eE extends Ee{constructor(e){super(),Oe(this,e,xO,QO,De,{},null,[-1,-1])}}const nn=[async n=>{const e=new URLSearchParams(window.location.search);return n.location!=="/"&&e.has("installer")?$i("/"):!0}],tE={"/login":en({component:iD,conditions:nn.concat([n=>!ve.authStore.isValid]),userData:{showLine truncated
|
||||
<span class="txt">Manage admins</span>`,t=T(),i=_("hr"),s=T(),l=_("div"),l.innerHTML=`<i class="ri-logout-circle-line"></i>
|
||||
<span class="txt">Logout</span>`,p(e,"href","/settings/admins"),p(e,"class","dropdown-item closable"),p(l,"tabindex","0"),p(l,"class","dropdown-item closable")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),w(a,s,u),w(a,l,u),o||(r=[Ye(hn.call(null,e)),G(l,"click",n[6])],o=!0)},p:re,d(a){a&&k(e),a&&k(t),a&&k(i),a&&k(s),a&&k(l),o=!1,Qe(r)}}}function gE(n){var h;let e,t,i,s,l,o,r,a,u,f,c;document.title=e=U.joinNonEmpty([n[3],n[2],"PocketBase"]," - ");let d=((h=n[0])==null?void 0:h.id)&&n[1]&&sm(n);return o=new i0({props:{routes:tE}}),o.$on("routeLoading",n[4]),o.$on("conditionsFailed",n[5]),a=new uE({}),f=new hE({}),{c(){t=T(),i=_("div"),d&&d.c(),s=T(),l=_("div"),V(o.$$.fragment),r=T(),V(a.$$.fragment),u=T(),V(f.$$.fragment),p(l,"class","app-body"),p(i,"class","app-layout")},m(m,v){w(m,t,v),w(m,i,v),d&&d.m(i,null),g(i,s),g(i,l),j(o,l,null),g(l,r),j(a,l,null),w(m,u,v),j(f,m,v),c=!0},p(m,[v]){var b;(!c||v&12)&&e!==(e=U.joinNonEmpty([m[3],m[2],"PocketBase"]," - "))&&(document.title=e),((b=m[0])==null?void 0:b.id)&&m[1]?d?(d.p(m,v),v&3&&E(d,1)):(d=sm(m),d.c(),E(d,1),d.m(i,s)):d&&(Pe(),P(d,1,1,()=>{d=null}),Le())},i(m){c||(E(d),E(o.$$.fragment,m),E(a.$$.fragment,m),E(f.$$.fragment,m),c=!0)},o(m){P(d),P(o.$$.fragment,m),P(a.$$.fragment,m),P(f.$$.fragment,m),c=!1},d(m){m&&k(t),m&&k(i),d&&d.d(),q(o),q(a),m&&k(u),q(f,m)}}}function _E(n,e,t){let i,s,l;kt(n,bo,d=>t(2,i=d)),kt(n,ya,d=>t(0,s=d)),kt(n,Rt,d=>t(3,l=d));let o,r=!1;function a(d){var h,m,v,b;((h=d==null?void 0:d.detail)==null?void 0:h.location)!==o&&(t(1,r=!!((v=(m=d==null?void 0:d.detail)==null?void 0:m.userData)!=null&&v.showAppSidebar)),o=(b=d==null?void 0:d.detail)==null?void 0:b.location,dn(Rt,l="",l),Si({}),O_())}function u(){$i("/")}async function f(){var d;if(!!(s!=null&&s.id))try{const h=await ve.settings.getAll({$cancelKey:"loadAppName"});dn(bo,i=((d=h==null?void 0:h.meta)==null?void 0:d.appName)||"",i)}catch(h){console.warn("Failed to load app name.",h)}}function c(){ve.logout()}return n.$$.update=()=>{n.$$.dirty&1&&s!=null&&s.id&&f()},[s,r,i,l,a,u,c]}class bE extends Ee{constructor(e){super(),Oe(this,e,_E,gE,De,{})}}new bE({target:document.getElementById("app")});export{Qe as A,cn as B,U as C,$i as D,Je as E,Dg as F,kt as G,Ds as H,on as I,fn as J,Zn as K,he as L,Ee as S,P as a,T as b,V as c,q as d,_ as e,p as f,w as g,g as h,Oe as i,Ye as j,Pe as k,hn as l,j as m,Le as n,k as o,ve as p,Ne as q,ie as r,De as s,E as t,G as u,Yt as v,F as w,ue as x,re as y,Me as z};
|
||||
Vendored
-620
@@ -1,620 +0,0 @@
|
||||
const Zg=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerpolicy&&(l.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?l.credentials="include":s.crossorigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=t(s);fetch(s.href,l)}};Zg();function re(){}const hl=n=>n;function ft(n,e){for(const t in e)n[t]=e[t];return n}function gp(n){return n()}function Ua(){return Object.create(null)}function Qe(n){n.forEach(gp)}function Vn(n){return typeof n=="function"}function Te(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let Al;function Kn(n,e){return Al||(Al=document.createElement("a")),Al.href=e,n===Al.href}function Gg(n){return Object.keys(n).length===0}function _p(n,...e){if(n==null)return re;const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function kt(n,e,t){n.$$.on_destroy.push(_p(e,t))}function $n(n,e,t,i){if(n){const s=bp(n,e,t,i);return n[0](s)}}function bp(n,e,t,i){return n[1]&&i?ft(t.ctx.slice(),n[1](i(e))):t.ctx}function Cn(n,e,t,i){if(n[2]&&i){const s=n[2](i(t));if(e.dirty===void 0)return s;if(typeof s=="object"){const l=[],o=Math.max(e.dirty.length,s.length);for(let r=0;r<o;r+=1)l[r]=e.dirty[r]|s[r];return l}return e.dirty|s}return e.dirty}function Mn(n,e,t,i,s,l){if(s){const o=bp(e,t,i,l);n.p(o,s)}}function Tn(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let i=0;i<t;i++)e[i]=-1;return e}return-1}function li(n){const e={};for(const t in n)t[0]!=="$"&&(e[t]=n[t]);return e}function Zt(n,e){const t={};e=new Set(e);for(const i in n)!e.has(i)&&i[0]!=="$"&&(t[i]=n[i]);return t}function Wa(n){return n==null?"":n}function _n(n,e,t){return n.set(t),e}function Ye(n){return n&&Vn(n.destroy)?n.destroy:re}const vp=typeof window<"u";let Eo=vp?()=>window.performance.now():()=>Date.now(),na=vp?n=>requestAnimationFrame(n):re;const ds=new Set;function yp(n){ds.forEach(e=>{e.c(n)||(ds.delete(e),e.f())}),ds.size!==0&&na(yp)}function Ao(n){let e;return ds.size===0&&na(yp),{promise:new Promise(t=>{ds.add(e={c:n,f:t})}),abort(){ds.delete(e)}}}function m(n,e){n.appendChild(e)}function kp(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function Jg(n){const e=_("style");return Xg(kp(n),e),e.sheet}function Xg(n,e){m(n.head||n,e)}function w(n,e,t){n.insertBefore(e,t||null)}function k(n){n.parentNode.removeChild(n)}function Zn(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function _(n){return document.createElement(n)}function N(n){return document.createTextNode(n)}function T(){return N(" ")}function st(){return N("")}function Q(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function Wt(n){return function(e){return e.preventDefault(),n.call(this,e)}}function Gn(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function wp(n){return function(e){e.target===this&&n.call(this,e)}}function h(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function si(n,e){const t=Object.getOwnPropertyDescriptors(n.__proto__);for(const i in e)e[i]==null?n.removeAttribute(i):i==="style"?n.style.cssText=e[i]:i==="__value"?n.value=n[i]=e[i]:t[i]&&t[i].set?n[i]=e[i]:h(n,i,e[i])}function Pt(n){return n===""?null:+n}function Qg(n){return Array.from(n.childNodes)}function ge(n,e){e=""+e,n.wholeText!==e&&(n.data=e)}function we(n,e){n.value=e==null?"":e}function Ya(n,e,t,i){t===null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function se(n,e,t){n.classList[t?"add":"remove"](e)}function Sp(n,e,{bubbles:t=!1,cancelable:i=!1}={}){const s=document.createEvent("CustomEvent");return s.initCustomEvent(n,t,i,e),s}const oo=new Map;let ro=0;function xg(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function e_(n,e){const t={stylesheet:Jg(e),rules:{}};return oo.set(n,t),t}function nl(n,e,t,i,s,l,o,r=0){const a=16.666/i;let u=`{
|
||||
`;for(let b=0;b<=1;b+=a){const y=e+(t-e)*l(b);u+=b*100+`%{${o(y,1-y)}}
|
||||
`}const f=u+`100% {${o(t,1-t)}}
|
||||
}`,c=`__svelte_${xg(f)}_${r}`,d=kp(n),{stylesheet:p,rules:g}=oo.get(d)||e_(d,n);g[c]||(g[c]=!0,p.insertRule(`@keyframes ${c} ${f}`,p.cssRules.length));const v=n.style.animation||"";return n.style.animation=`${v?`${v}, `:""}${c} ${i}ms linear ${s}ms 1 both`,ro+=1,c}function il(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?l=>l.indexOf(e)<0:l=>l.indexOf("__svelte")===-1),s=t.length-i.length;s&&(n.style.animation=i.join(", "),ro-=s,ro||t_())}function t_(){na(()=>{ro||(oo.forEach(n=>{const{stylesheet:e}=n;let t=e.cssRules.length;for(;t--;)e.deleteRule(t);n.rules={}}),oo.clear())})}function n_(n,e,t,i){if(!e)return re;const s=n.getBoundingClientRect();if(e.left===s.left&&e.right===s.right&&e.top===s.top&&e.bottom===s.bottom)return re;const{delay:l=0,duration:o=300,easing:r=hl,start:a=Eo()+l,end:u=a+o,tick:f=re,css:c}=t(n,{from:e,to:s},i);let d=!0,p=!1,g;function v(){c&&(g=nl(n,0,1,o,l,r,c)),l||(p=!0)}function b(){c&&il(n,g),d=!1}return Ao(y=>{if(!p&&y>=a&&(p=!0),p&&y>=u&&(f(1,0),b()),!d)return!1;if(p){const $=y-a,S=0+1*r($/o);f(S,1-S)}return!0}),v(),f(0,1),b}function i_(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,s=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,$p(n,s)}}function $p(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),s=i.transform==="none"?"":i.transform;n.style.transform=`${s} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let sl;function Ws(n){sl=n}function Po(){if(!sl)throw new Error("Function called outside component initialization");return sl}function zn(n){Po().$$.on_mount.push(n)}function s_(n){Po().$$.after_update.push(n)}function l_(n){Po().$$.on_destroy.push(n)}function rn(){const n=Po();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=Sp(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(n,l)}),!l.defaultPrevented}return!0}}function at(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const qs=[],me=[],eo=[],$r=[],Cp=Promise.resolve();let Cr=!1;function Mp(){Cr||(Cr=!0,Cp.then(Tp))}function oi(){return Mp(),Cp}function Ot(n){eo.push(n)}function Ie(n){$r.push(n)}const Zo=new Set;let Pl=0;function Tp(){const n=sl;do{for(;Pl<qs.length;){const e=qs[Pl];Pl++,Ws(e),o_(e.$$)}for(Ws(null),qs.length=0,Pl=0;me.length;)me.pop()();for(let e=0;e<eo.length;e+=1){const t=eo[e];Zo.has(t)||(Zo.add(t),t())}eo.length=0}while(qs.length);for(;$r.length;)$r.pop()();Cr=!1,Zo.clear(),Ws(n)}function o_(n){if(n.fragment!==null){n.update(),Qe(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(Ot)}}let Ds;function ia(){return Ds||(Ds=Promise.resolve(),Ds.then(()=>{Ds=null})),Ds}function Ji(n,e,t){n.dispatchEvent(Sp(`${e?"intro":"outro"}${t}`))}const to=new Set;let ti;function Ee(){ti={r:0,c:[],p:ti}}function Ae(){ti.r||Qe(ti.c),ti=ti.p}function A(n,e){n&&n.i&&(to.delete(n),n.i(e))}function P(n,e,t,i){if(n&&n.o){if(to.has(n))return;to.add(n),ti.c.push(()=>{to.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const sa={duration:0};function Dp(n,e,t){let i=e(n,t),s=!1,l,o,r=0;function a(){l&&il(n,l)}function u(){const{delay:c=0,duration:d=300,easing:p=hl,tick:g=re,css:v}=i||sa;v&&(l=nl(n,0,1,d,c,p,v,r++)),g(0,1);const b=Eo()+c,y=b+d;o&&o.abort(),s=!0,Ot(()=>Ji(n,!0,"start")),o=Ao($=>{if(s){if($>=y)return g(1,0),Ji(n,!0,"end"),a(),s=!1;if($>=b){const S=p(($-b)/d);g(S,1-S)}}return s})}let f=!1;return{start(){f||(f=!0,il(n),Vn(i)?(i=i(),ia().then(u)):u())},invalidate(){f=!1},end(){s&&(a(),s=!1)}}}function Op(n,e,t){let i=e(n,t),s=!0,l;const o=ti;o.r+=1;function r(){const{delay:a=0,duration:u=300,easing:f=hl,tick:c=re,css:d}=i||sa;d&&(l=nl(n,1,0,u,a,f,d));const p=Eo()+a,g=p+u;Ot(()=>Ji(n,!1,"start")),Ao(v=>{if(s){if(v>=g)return c(0,1),Ji(n,!1,"end"),--o.r||Qe(o.c),!1;if(v>=p){const b=f((v-p)/u);c(1-b,b)}}return s})}return Vn(i)?ia().then(()=>{i=i(),r()}):r(),{end(a){a&&i.tick&&i.tick(1,0),s&&(l&&il(n,l),s=!1)}}}function lt(n,e,t,i){let s=e(n,t),l=i?0:1,o=null,r=null,a=null;function u(){a&&il(n,a)}function f(d,p){const g=d.b-l;return p*=Math.abs(g),{a:l,b:d.b,d:g,duration:p,start:d.start,end:d.start+p,group:d.group}}function c(d){const{delay:p=0,duration:g=300,easing:v=hl,tick:b=re,css:y}=s||sa,$={start:Eo()+p,b:d};d||($.group=ti,ti.r+=1),o||r?r=$:(y&&(u(),a=nl(n,l,d,g,p,v,y)),d&&b(0,1),o=f($,g),Ot(()=>Ji(n,d,"start")),Ao(S=>{if(r&&S>r.start&&(o=f(r,g),r=null,Ji(n,o.b,"start"),y&&(u(),a=nl(n,l,o.b,o.duration,0,v,s.css))),o){if(S>=o.end)b(l=o.b,1-l),Ji(n,o.b,"end"),r||(o.b?u():--o.group.r||Qe(o.group.c)),o=null;else if(S>=o.start){const M=S-o.start;l=o.a+o.d*v(M/o.duration),b(l,1-l)}}return!!(o||r)}))}return{run(d){Vn(s)?ia().then(()=>{s=s(),c(d)}):c(d)},end(){u(),o=r=null}}}function Jn(n,e){n.d(1),e.delete(n.key)}function Gt(n,e){P(n,1,1,()=>{e.delete(n.key)})}function r_(n,e){n.f(),Gt(n,e)}function St(n,e,t,i,s,l,o,r,a,u,f,c){let d=n.length,p=
Line truncated
|
||||
<span class="txt">Pocket<strong>Base</strong></span></figure>`,t=T(),i=_("div"),h(e,"class","block txt-center m-b-lg"),h(i,"class","clearfix")},m(s,l){w(s,e,l),w(s,t,l),w(s,i,l)},d(s){s&&k(e),s&&k(t),s&&k(i)}}}function C0(n){let e,t,i,s,l,o,r,a,u=!n[0]&&Su();const f=n[2].default,c=$n(f,n,n[1],null);return{c(){e=_("div"),t=_("div"),i=T(),s=_("div"),u&&u.c(),l=T(),c&&c.c(),o=T(),r=_("div"),h(t,"class","flex-fill"),h(s,"class","wrapper wrapper-sm m-b-xl svelte-1wbawr2"),h(r,"class","flex-fill"),h(e,"class","page-wrapper full-page-panel svelte-1wbawr2")},m(d,p){w(d,e,p),m(e,t),m(e,i),m(e,s),u&&u.m(s,null),m(s,l),c&&c.m(s,null),m(e,o),m(e,r),a=!0},p(d,[p]){d[0]?u&&(u.d(1),u=null):u||(u=Su(),u.c(),u.m(s,l)),c&&c.p&&(!a||p&2)&&Mn(c,f,d,d[1],a?Cn(f,d[1],p,null):Tn(d[1]),null)},i(d){a||(A(c,d),a=!0)},o(d){P(c,d),a=!1},d(d){d&&k(e),u&&u.d(),c&&c.d(d)}}}function M0(n,e,t){let{$$slots:i={},$$scope:s}=e,{nobranding:l=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,l=o.nobranding),"$$scope"in o&&t(1,s=o.$$scope)},[l,s,i]}class Vm extends Oe{constructor(e){super(),De(this,e,M0,C0,Te,{nobranding:0})}}function $u(n,e,t){const i=n.slice();return i[11]=e[t],i}const T0=n=>({}),Cu=n=>({uniqueId:n[3]});function D0(n){let e=(n[11]||po)+"",t;return{c(){t=N(e)},m(i,s){w(i,t,s)},p(i,s){s&4&&e!==(e=(i[11]||po)+"")&&ge(t,e)},d(i){i&&k(t)}}}function O0(n){var i,s;let e=(((i=n[11])==null?void 0:i.message)||((s=n[11])==null?void 0:s.code)||po)+"",t;return{c(){t=N(e)},m(l,o){w(l,t,o)},p(l,o){var r,a;o&4&&e!==(e=(((r=l[11])==null?void 0:r.message)||((a=l[11])==null?void 0:a.code)||po)+"")&&ge(t,e)},d(l){l&&k(t)}}}function Mu(n){let e,t;function i(o,r){return typeof o[11]=="object"?O0:D0}let s=i(n),l=s(n);return{c(){e=_("div"),l.c(),t=T(),h(e,"class","help-block help-block-error")},m(o,r){w(o,e,r),l.m(e,null),m(e,t)},p(o,r){s===(s=i(o))&&l?l.p(o,r):(l.d(1),l=s(o),l&&(l.c(),l.m(e,t)))},d(o){o&&k(e),l.d()}}}function E0(n){let e,t,i,s,l;const o=n[7].default,r=$n(o,n,n[6],Cu);let a=n[2],u=[];for(let f=0;f<a.length;f+=1)u[f]=Mu($u(n,a,f));return{c(){e=_("div"),r&&r.c(),t=T();for(let f=0;f<u.length;f+=1)u[f].c();h(e,"class",n[0]),se(e,"error",n[2].length)},m(f,c){w(f,e,c),r&&r.m(e,null),m(e,t);for(let d=0;d<u.length;d+=1)u[d].m(e,null);n[9](e),i=!0,s||(l=Q(e,"click",n[8]),s=!0)},p(f,[c]){if(r&&r.p&&(!i||c&64)&&Mn(r,o,f,f[6],i?Cn(o,f[6],c,T0):Tn(f[6]),Cu),c&4){a=f[2];let d;for(d=0;d<a.length;d+=1){const p=$u(f,a,d);u[d]?u[d].p(p,c):(u[d]=Mu(p),u[d].c(),u[d].m(e,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}(!i||c&1)&&h(e,"class",f[0]),c&5&&se(e,"error",f[2].length)},i(f){i||(A(r,f),i=!0)},o(f){P(r,f),i=!1},d(f){f&&k(e),r&&r.d(f),Zn(u,f),n[9](null),s=!1,l()}}}const po="Invalid value";function A0(n,e,t){let i;kt(n,ns,g=>t(5,i=g));let{$$slots:s={},$$scope:l}=e;const o="field_"+G.randomString(7);let{name:r=""}=e,{class:a=void 0}=e,u,f=[];function c(){qm(r)}zn(()=>(u.addEventListener("input",c),u.addEventListener("change",c),()=>{u.removeEventListener("input",c),u.removeEventListener("change",c)}));function d(g){at.call(this,n,g)}function p(g){me[g?"unshift":"push"](()=>{u=g,t(1,u)})}return n.$$set=g=>{"name"in g&&t(4,r=g.name),"class"in g&&t(0,a=g.class),"$$scope"in g&&t(6,l=g.$$scope)},n.$$.update=()=>{n.$$.dirty&48&&t(2,f=G.toArray(G.getNestedVal(i,r)))},[a,u,f,o,r,i,l,s,d,p]}class Pe extends Oe{constructor(e){super(),De(this,e,A0,E0,Te,{name:4,class:0})}}function P0(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Email"),s=T(),l=_("input"),h(e,"for",i=n[9]),h(l,"type","email"),h(l,"autocomplete","off"),h(l,"id",o=n[9]),l.required=!0,l.autofocus=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0]),l.focus(),r||(a=Q(l,"input",n[5]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&h(e,"for",i),f&512&&o!==(o=u[9])&&h(l,"id",o),f&1&&l.value!==u[0]&&we(l,u[0])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function L0(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=N("Password"),s=T(),l=_("input"),r=T(),a=_("div"),a.textContent="Minimum 10 characters.",h(e,"for",i=n[9]),h(l,"type","password"),h(l,"autocomplete","new-password"),h(l,"minlength","10"),h(l,"id",o=n[9]),l.required=!0,h(a,"class","help-block")},m(c,d){w(c,e,d),m(e,t),w(c,s,d),w(c,l,d),we(l,n[1]),w(c,r,d),w(c,a,d),u||(f=Q(l,"input",n[6]),u=!0)},p(c,d){d&512&&i!==(i=c[9])&&h(e,"for",i),d&512&&o!==(o=c[9])&&h(l,"id",o),d&2&&l.value!==c[1]&&we(l,c[1])},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function F0(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Password confirm"),s=T(),l=_("input"),h(e,"for",i=n[9]),h(l,"type","password"),h(l,"minlength","10"),h(l,"id",o=n[9]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[2]),r||(a=Q(l,"input",n[7]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&h(e,"for",i),f&512&&o!==(o=u[9])&&h(l,"id",o),f&4&&l.value!==u[2]&&we(l,u[2])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function I0(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;return s=new Pe({props:{class:"form-field required",name:"email",$$slots:{default:[P0,({uniqueId:g})=>({9:gLine truncated
|
||||
<i class="ri-arrow-right-line"></i>`,h(t,"class","content txt-center m-b-base"),h(f,"type","submit"),h(f,"class","btn btn-lg btn-block btn-next"),se(f,"btn-disabled",n[3]),se(f,"btn-loading",n[3]),h(e,"class","block"),h(e,"autocomplete","off")},m(g,v){w(g,e,v),m(e,t),m(e,i),V(s,e,null),m(e,l),V(o,e,null),m(e,r),V(a,e,null),m(e,u),m(e,f),c=!0,d||(p=Q(e,"submit",Wt(n[4])),d=!0)},p(g,[v]){const b={};v&1537&&(b.$$scope={dirty:v,ctx:g}),s.$set(b);const y={};v&1538&&(y.$$scope={dirty:v,ctx:g}),o.$set(y);const $={};v&1540&&($.$$scope={dirty:v,ctx:g}),a.$set($),v&8&&se(f,"btn-disabled",g[3]),v&8&&se(f,"btn-loading",g[3])},i(g){c||(A(s.$$.fragment,g),A(o.$$.fragment,g),A(a.$$.fragment,g),c=!0)},o(g){P(s.$$.fragment,g),P(o.$$.fragment,g),P(a.$$.fragment,g),c=!1},d(g){g&&k(e),z(s),z(o),z(a),d=!1,p()}}}function R0(n,e,t){const i=rn();let s="",l="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await ye.Admins.create({email:s,password:l,passwordConfirm:o}),await ye.Admins.authViaEmail(s,l),i("submit")}catch(d){ye.errorResponseHandler(d)}t(3,r=!1)}}function u(){s=this.value,t(0,s)}function f(){l=this.value,t(1,l)}function c(){o=this.value,t(2,o)}return[s,l,o,r,a,u,f,c]}class N0 extends Oe{constructor(e){super(),De(this,e,R0,I0,Te,{})}}function Tu(n){let e,t;return e=new Vm({props:{$$slots:{default:[H0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function H0(n){let e,t;return e=new N0({}),e.$on("submit",n[1]),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p:re,i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function j0(n){let e,t,i=n[0]&&Tu(n);return{c(){i&&i.c(),e=st()},m(s,l){i&&i.m(s,l),w(s,e,l),t=!0},p(s,[l]){s[0]?i?(i.p(s,l),l&1&&A(i,1)):(i=Tu(s),i.c(),A(i,1),i.m(e.parentNode,e)):i&&(Ee(),P(i,1,1,()=>{i=null}),Ae())},i(s){t||(A(i),t=!0)},o(s){P(i),t=!1},d(s){i&&i.d(s),s&&k(e)}}}function q0(n,e,t){let i=!1;s();function s(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){ye.logout(!1),t(0,i=!0);return}ye.AuthStore.isValid?vi("/collections"):ye.logout()}return[i,async()=>{t(0,i=!1),await oi(),window.location.search=""}]}class V0 extends Oe{constructor(e){super(),De(this,e,q0,j0,Te,{})}}const Jt=Qn(""),mo=Qn("");function jo(n){const e=n-1;return e*e*e+1}function go(n,{delay:e=0,duration:t=400,easing:i=hl}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function Nn(n,{delay:e=0,duration:t=400,easing:i=jo,x:s=0,y:l=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,u=r.transform==="none"?"":r.transform,f=a*(1-o);return{delay:e,duration:t,easing:i,css:(c,d)=>`
|
||||
transform: ${u} translate(${(1-c)*s}px, ${(1-c)*l}px);
|
||||
opacity: ${a-f*d}`}}function xt(n,{delay:e=0,duration:t=400,easing:i=jo}={}){const s=getComputedStyle(n),l=+s.opacity,o=parseFloat(s.height),r=parseFloat(s.paddingTop),a=parseFloat(s.paddingBottom),u=parseFloat(s.marginTop),f=parseFloat(s.marginBottom),c=parseFloat(s.borderTopWidth),d=parseFloat(s.borderBottomWidth);return{delay:e,duration:t,easing:i,css:p=>`overflow: hidden;opacity: ${Math.min(p*20,1)*l};height: ${p*o}px;padding-top: ${p*r}px;padding-bottom: ${p*a}px;margin-top: ${p*u}px;margin-bottom: ${p*f}px;border-top-width: ${p*c}px;border-bottom-width: ${p*d}px;`}}function Hn(n,{delay:e=0,duration:t=400,easing:i=jo,start:s=0,opacity:l=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,u=1-s,f=r*(1-l);return{delay:e,duration:t,easing:i,css:(c,d)=>`
|
||||
transform: ${a} scale(${1-u*d});
|
||||
opacity: ${r-f*d}
|
||||
`}}function z0(n){let e,t,i,s;return{c(){e=_("input"),h(e,"type","text"),h(e,"id",n[8]),h(e,"placeholder",t=n[0]||n[1])},m(l,o){w(l,e,o),n[13](e),we(e,n[7]),i||(s=Q(e,"input",n[14]),i=!0)},p(l,o){o&3&&t!==(t=l[0]||l[1])&&h(e,"placeholder",t),o&128&&e.value!==l[7]&&we(e,l[7])},i:re,o:re,d(l){l&&k(e),n[13](null),i=!1,s()}}}function B0(n){let e,t,i,s;function l(a){n[12](a)}var o=n[4];function r(a){let u={singleLine:!0,disableRequestKeys:!0,disableIndirectCollectionsKeys:!0,extraAutocompleteKeys:a[3],baseCollection:a[2],placeholder:a[0]||a[1]};return a[7]!==void 0&&(u.value=a[7]),{props:u}}return o&&(e=new o(r(n)),me.push(()=>Le(e,"value",l)),e.$on("submit",n[10])),{c(){e&&B(e.$$.fragment),i=st()},m(a,u){e&&V(e,a,u),w(a,i,u),s=!0},p(a,u){const f={};if(u&8&&(f.extraAutocompleteKeys=a[3]),u&4&&(f.baseCollection=a[2]),u&3&&(f.placeholder=a[0]||a[1]),!t&&u&128&&(t=!0,f.value=a[7],Ie(()=>t=!1)),o!==(o=a[4])){if(e){Ee();const c=e;P(c.$$.fragment,1,0,()=>{z(c,1)}),Ae()}o?(e=new o(r(a)),me.push(()=>Le(e,"value",l)),e.$on("submit",a[10]),B(e.$$.fragment),A(e.$$.fragment,1),V(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&A(e.$$.fragment,a),s=!0)},o(a){e&&P(e.$$.fragment,a),s=!1},d(a){a&&k(i),e&&z(e,a)}}}function Du(n){let e,t,i,s,l,o,r=n[7]!==n[0]&&Ou();return{c(){r&&r.c(),e=T(),t=_("button"),t.innerHTML='<span class="txt">Clear</span>',h(t,"type","button"),h(t,"class","btn btn-secondary btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(a,u){r&&r.m(a,u),w(a,e,u),w(a,t,u),s=!0,l||(o=Q(t,"click",n[15]),l=!0)},p(a,u){a[7]!==a[0]?r?u&129&&A(r,1):(r=Ou(),r.c(),A(r,1),r.m(e.parentNode,e)):r&&(Ee(),P(r,1,1,()=>{r=null}),Ae())},i(a){s||(A(r),Ot(()=>{i||(i=lt(t,Nn,{duration:150,x:5},!0)),i.run(1)}),s=!0)},o(a){P(r),i||(i=lt(t,Nn,{duration:150,x:5},!1)),i.run(0),s=!1},d(a){r&&r.d(a),a&&k(e),a&&k(t),a&&i&&i.end(),l=!1,o()}}}function Ou(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Search</span>',h(e,"type","submit"),h(e,"class","btn btn-expanded btn-sm btn-warning")},m(s,l){w(s,e,l),i=!0},i(s){i||(Ot(()=>{t||(t=lt(e,Nn,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){t||(t=lt(e,Nn,{duration:150,x:5},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function U0(n){let e,t,i,s,l,o,r,a,u,f,c;const d=[B0,z0],p=[];function g(b,y){return b[4]&&!b[5]?0:1}o=g(n),r=p[o]=d[o](n);let v=(n[0].length||n[7].length)&&Du(n);return{c(){e=_("div"),t=_("form"),i=_("label"),s=_("i"),l=T(),r.c(),a=T(),v&&v.c(),h(s,"class","ri-search-line"),h(i,"for",n[8]),h(i,"class","m-l-10 txt-xl"),h(t,"class","searchbar"),h(e,"class","searchbar-wrapper")},m(b,y){w(b,e,y),m(e,t),m(t,i),m(i,s),m(t,l),p[o].m(t,null),m(t,a),v&&v.m(t,null),u=!0,f||(c=[Q(t,"submit",Wt(n[10])),Q(e,"click",Gn(n[11]))],f=!0)},p(b,[y]){let $=o;o=g(b),o===$?p[o].p(b,y):(Ee(),P(p[$],1,1,()=>{p[$]=null}),Ae(),r=p[o],r?r.p(b,y):(r=p[o]=d[o](b),r.c()),A(r,1),r.m(t,a)),b[0].length||b[7].length?v?(v.p(b,y),y&129&&A(v,1)):(v=Du(b),v.c(),A(v,1),v.m(t,null)):v&&(Ee(),P(v,1,1,()=>{v=null}),Ae())},i(b){u||(A(r),A(v),u=!0)},o(b){P(r),P(v),u=!1},d(b){b&&k(e),p[o].d(),v&&v.d(),f=!1,Qe(c)}}}function W0(n,e,t){const i=rn(),s="search_"+G.randomString(7);let{value:l=""}=e,{placeholder:o='Search filter, ex. created > "2022-01-01"...'}=e,{autocompleteCollection:r=new On}=e,{extraAutocompleteKeys:a=[]}=e,u,f=!1,c,d="";function p(C=!0){t(7,d=""),C&&(c==null||c.focus()),i("clear")}function g(){t(0,l=d),i("submit",l)}async function v(){u||f||(t(5,f=!0),t(4,u=(await Ki(()=>import("./FilterAutocompleteInput.9d9a35b4.js"),[])).default),t(5,f=!1))}zn(()=>{v()});function b(C){at.call(this,n,C)}function y(C){d=C,t(7,d),t(0,l)}function $(C){me[C?"unshift":"push"](()=>{c=C,t(6,c)})}function S(){d=this.value,t(7,d),t(0,l)}const M=()=>{p(!1),g()};return n.$$set=C=>{"value"in C&&t(0,l=C.value),"placeholder"in C&&t(1,o=C.placeholder),"autocompleteCollection"in C&&t(2,r=C.autocompleteCollection),"extraAutocompleteKeys"in C&&t(3,a=C.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof l=="string"&&t(7,d=l)},[l,o,r,a,u,f,c,d,s,p,g,b,y,$,S,M]}class qo extends Oe{constructor(e){super(),De(this,e,W0,U0,Te,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}let Nr,qi;const Hr="app-tooltip";function Eu(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function Ei(){return qi=qi||document.querySelector("."+Hr),qi||(qi=document.createElement("div"),qi.classList.add(Hr),document.body.appendChild(qi)),qi}function zm(n,e){let t=Ei();if(!t.classList.contains("active")||!(e!=null&&e.text)){jr();return}t.textContent=e.text,t.className=Hr+" active",e.class&&t.classList.add(e.class),t.style.top="0px",t.style.left="0px";let i=t.offsetHeight,s=t.offsetWidth,l=n.getBoundingClientRect(),o=0,r=0,a=5;e.position=="left"?(o=l.top+l.height/2-i/2,r=l.left-s-a):e.position=="right"?(o=l.top+l.height/2-i/2,r=l.right+a):e.position=="top"?(o=l.top-i-a,r=l.left+l.width/2-s/2):e.position=="top-left"?(o=l.top-i-a,r=l.left):e.position=="top-right"?(o=l.top-i-a,r=l.right-s):e.posi
Line truncated
|
||||
<span class="txt">method</span>`,h(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function n1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="url",h(t,"class",G.getFieldTypeIcon("url")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function i1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="referer",h(t,"class",G.getFieldTypeIcon("url")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function s1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="status",h(t,"class",G.getFieldTypeIcon("number")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function l1(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",h(t,"class",G.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function Pu(n){let e;function t(l,o){return l[6]?r1:o1}let i=t(n),s=i(n);return{c(){s.c(),e=st()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function o1(n){var r;let e,t,i,s,l,o=((r=n[0])==null?void 0:r.length)&&Lu(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No logs found.",s=T(),o&&o.c(),l=T(),h(t,"colspan","99"),h(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),o&&o.m(t,null),m(e,l)},p(a,u){var f;(f=a[0])!=null&&f.length?o?o.p(a,u):(o=Lu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function r1(n){let e;return{c(){e=_("tr"),e.innerHTML=`<td colspan="99" class="p-xs"><span class="skeleton-loader"></span></td>
|
||||
`},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Lu(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear filters</span>',h(e,"type","button"),h(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[18]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function Fu(n){let e;return{c(){e=_("i"),h(e,"class","ri-error-warning-line txt-danger m-l-5 m-r-5"),h(e,"title","Error")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Iu(n,e){var oe,he,be;let t,i,s,l=((oe=e[21].method)==null?void 0:oe.toUpperCase())+"",o,r,a,u,f,c=e[21].url+"",d,p,g,v,b,y,$=(e[21].referer||"N/A")+"",S,M,C,D,O,E=e[21].status+"",F,L,R,H,te,le,q,Y,W,X,ne=(((he=e[21].meta)==null?void 0:he.errorMessage)||((be=e[21].meta)==null?void 0:be.errorData))&&Fu();H=new _i({props:{date:e[21].created}});function ue(){return e[16](e[21])}function Me(...K){return e[17](e[21],...K)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("span"),o=N(l),a=T(),u=_("td"),f=_("span"),d=N(c),g=T(),ne&&ne.c(),v=T(),b=_("td"),y=_("span"),S=N($),C=T(),D=_("td"),O=_("span"),F=N(E),L=T(),R=_("td"),B(H.$$.fragment),te=T(),le=_("td"),le.innerHTML='<i class="ri-arrow-right-line"></i>',q=T(),h(s,"class",r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]),h(i,"class","col-type-text col-field-method min-width"),h(f,"class","txt txt-ellipsis"),h(f,"title",p=e[21].url),h(u,"class","col-type-text col-field-url"),h(y,"class","txt txt-ellipsis"),h(y,"title",M=e[21].referer),se(y,"txt-hint",!e[21].referer),h(b,"class","col-type-text col-field-referer"),h(O,"class","label"),se(O,"label-danger",e[21].status>=400),h(D,"class","col-type-number col-field-status"),h(R,"class","col-type-date col-field-created"),h(le,"class","col-type-action min-width"),h(t,"tabindex","0"),h(t,"class","row-handle"),this.first=t},m(K,Se){w(K,t,Se),m(t,i),m(i,s),m(s,o),m(t,a),m(t,u),m(u,f),m(f,d),m(u,g),ne&&ne.m(u,null),m(t,v),m(t,b),m(b,y),m(y,S),m(t,C),m(t,D),m(D,O),m(O,F),m(t,L),m(t,R),V(H,R,null),m(t,te),m(t,le),m(t,q),Y=!0,W||(X=[Q(t,"click",ue),Q(t,"keydown",Me)],W=!0)},p(K,Se){var J,ve,Re;e=K,(!Y||Se&8)&&l!==(l=((J=e[21].method)==null?void 0:J.toUpperCase())+"")&&ge(o,l),(!Y||Se&8&&r!==(r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]))&&h(s,"class",r),(!Y||Se&8)&&c!==(c=e[21].url+"")&&ge(d,c),(!Y||Se&8&&p!==(p=e[21].url))&&h(f,"title",p),((ve=e[21].meta)==null?void 0:ve.errorMessage)||((Re=e[21].meta)==null?void 0:Re.errorData)?ne||(ne=Fu(),ne.c(),ne.m(u,null)):ne&&(ne.d(1),ne=null),(!Y||Se&8)&&$!==($=(e[21].referer||"N/A")+"")&&ge(S,$),(!Y||Se&8&&M!==(M=e[21].referer))&&h(y,"title",M),Se&8&&se(y,"txt-hint",!e[21].referer),(!Y||Se&8)&&E!==(E=e[21].status+"")&&ge(F,E),Se&8&&se(O,"label-danger",e[21].status>=400);const x={};Se&8&&(x.date=e[21].created),H.$set(x)},i(K){Y||(A(H.$$.fragment,K),Y=!0)},o(K){P(H.$$.fragment,K),Y=!1},d(K){K&&k(t),ne&&ne.d(),z(H),W=!1,Qe(X)}}}function Ru(n){let e,t,i=n[3].length+"",s,l,o;return{c(){e=_("small"),t=N("Showing "),s=N(i),l=N(" of "),o=N(n[4]),h(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),m(e,t),m(e,s),m(e,l),m(e,o)},p(r,a){a&8&&i!==(i=r[3].length+"")&&ge(s,i),a&16&&ge(o,r[4])},d(r){r&&k(e)}}}function Nu(n){let e,t,i,s,l=n[4]-n[3].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=N("Load more ("),o=N(l),r=N(")"),h(i,"class","txt"),h(t,"type","button"),h(t,"class","btn btn-lg btn-secondary btn-expanded"),se(t,"btn-loading",n[6]),se(t,"btn-disabled",n[6]),h(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),m(e,t),m(t,i),m(i,s),m(i,o),m(i,r),a||(u=Q(t,"click",n[19]),a=!0)},p(f,c){c&24&&l!==(l=f[4]-f[3].length+"")&&ge(o,l),c&64&&se(t,"btn-loading",f[6]),c&64&&se(t,"btn-disabled",f[6])},d(f){f&&k(e),a=!1,u()}}}function a1(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,S,M,C,D,O=[],E=new Map,F,L,R,H;function te(J){n[11](J)}let le={disable:!0,class:"col-field-method",name:"method",$$slots:{default:[t1]},$$scope:{ctx:n}};n[1]!==void 0&&(le.sort=n[1]),l=new en({props:le}),me.push(()=>Le(l,"sort",te));function q(J){n[12](J)}let Y={disable:!0,class:"col-type-text col-field-url",name:"url",$$slots:{default:[n1]},$$scope:{ctx:n}};n[1]!==void 0&&(Y.sort=n[1]),a=new en({props:Y}),me.push(()=>Le(a,"sort",q));function W(J){n[13](J)}let X={disable:!0,class:"col-type-text col-field-referer",name:"referer",$$slots:{default:[i1]},$$scope:{ctx:n}};n[1]!==void 0&&(X.sort=n[1]),c=new en({props:X}),me.push(()=>Le(c,"sort",W));function ne(J){n[14](J)}let ue={disable:!0,class:"col-type-number col-field-status",name:"status",$$slots:{default:[s1]},$$scope:{ctx:n}};n[1]!==void 0&&(ue.sort=n[1]),g=new en({props:ue}),me.push(()=>Le(g,"sort",ne));function Me(J){n[15](J)}let oe={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[l1]},$$scope:{ctx:n}};n[1]!==void 0&&(oe.sort=n[1]),y=new en({props:oe}),me.push(()=>Le(y,"sort",Me));let he=n[3];const be=J=>J[21].id;for(let J=0;J<he.length;J+=1){let ve=Au(n,he,J),Re=be(ve);E.set(Re,O[J]=Iu(Re,ve))}let K=null;he.length||(
Line truncated
|
||||
* Chart.js v3.8.2
|
||||
* https://www.chartjs.org
|
||||
* (c) 2022 Chart.js Contributors
|
||||
* Released under the MIT License
|
||||
*/const Bm=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function Um(n,e,t){const i=t||(o=>Array.prototype.slice.call(o));let s=!1,l=[];return function(...o){l=i(o),s||(s=!0,Bm.call(window,()=>{s=!1,n.apply(e,l)}))}}function c1(n,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(n,e,i)):n.apply(this,i),e}}const d1=n=>n==="start"?"left":n==="end"?"right":"center",Hu=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2;function fi(){}const h1=function(){let n=0;return function(){return n++}}();function Dt(n){return n===null||typeof n>"u"}function Nt(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function ut(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Ut=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function Pn(n,e){return Ut(n)?n:e}function mt(n,e){return typeof n>"u"?e:n}const p1=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/e,Wm=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function Vt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function Tt(n,e,t,i){let s,l,o;if(Nt(n))if(l=n.length,i)for(s=l-1;s>=0;s--)e.call(t,n[s],s);else for(s=0;s<l;s++)e.call(t,n[s],s);else if(ut(n))for(o=Object.keys(n),l=o.length,s=0;s<l;s++)e.call(t,n[o[s]],o[s])}function _o(n,e){let t,i,s,l;if(!n||!e||n.length!==e.length)return!1;for(t=0,i=n.length;t<i;++t)if(s=n[t],l=e[t],s.datasetIndex!==l.datasetIndex||s.index!==l.index)return!1;return!0}function bo(n){if(Nt(n))return n.map(bo);if(ut(n)){const e=Object.create(null),t=Object.keys(n),i=t.length;let s=0;for(;s<i;++s)e[t[s]]=bo(n[t[s]]);return e}return n}function Ym(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function m1(n,e,t,i){if(!Ym(n))return;const s=e[n],l=t[n];ut(s)&&ut(l)?ll(s,l,i):e[n]=bo(l)}function ll(n,e,t){const i=Nt(e)?e:[e],s=i.length;if(!ut(n))return n;t=t||{};const l=t.merger||m1;for(let o=0;o<s;++o){if(e=i[o],!ut(e))continue;const r=Object.keys(e);for(let a=0,u=r.length;a<u;++a)l(r[a],n,e,t)}return n}function Js(n,e){return ll(n,e,{merger:g1})}function g1(n,e,t){if(!Ym(n))return;const i=e[n],s=t[n];ut(i)&&ut(s)?Js(i,s):Object.prototype.hasOwnProperty.call(e,n)||(e[n]=bo(s))}const _1="",b1=".";function ju(n,e){const t=n.indexOf(b1,e);return t===-1?n.length:t}function Pi(n,e){if(e===_1)return n;let t=0,i=ju(e,t);for(;n&&i>t;)n=n[e.slice(t,i)],t=i+1,i=ju(e,t);return n}function _a(n){return n.charAt(0).toUpperCase()+n.slice(1)}const jn=n=>typeof n<"u",Li=n=>typeof n=="function",qu=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function v1(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const Bt=Math.PI,At=2*Bt,y1=At+Bt,vo=Number.POSITIVE_INFINITY,k1=Bt/180,zt=Bt/2,Ls=Bt/4,Vu=Bt*2/3,In=Math.log10,ni=Math.sign;function zu(n){const e=Math.round(n);n=Xs(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(In(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function w1(n){const e=[],t=Math.sqrt(n);let i;for(i=1;i<t;i++)n%i===0&&(e.push(i),e.push(n/i));return t===(t|0)&&e.push(t),e.sort((s,l)=>s-l).pop(),e}function ol(n){return!isNaN(parseFloat(n))&&isFinite(n)}function Xs(n,e,t){return Math.abs(n-e)<t}function S1(n,e){const t=Math.round(n);return t-e<=n&&t+e>=n}function Km(n,e,t){let i,s,l;for(i=0,s=n.length;i<s;i++)l=n[i][t],isNaN(l)||(e.min=Math.min(e.min,l),e.max=Math.max(e.max,l))}function Yn(n){return n*(Bt/180)}function ba(n){return n*(180/Bt)}function Bu(n){if(!Ut(n))return;let e=1,t=0;for(;Math.round(n*e)/e!==n;)e*=10,t++;return t}function Zm(n,e){const t=e.x-n.x,i=e.y-n.y,s=Math.sqrt(t*t+i*i);let l=Math.atan2(i,t);return l<-.5*Bt&&(l+=At),{angle:l,distance:s}}function qr(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function $1(n,e){return(n-e+y1)%At-Bt}function kn(n){return(n%At+At)%At}function rl(n,e,t,i){const s=kn(n),l=kn(e),o=kn(t),r=kn(l-s),a=kn(o-s),u=kn(s-l),f=kn(s-o);return s===l||s===o||i&&l===o||r>a&&u<f}function ln(n,e,t){return Math.max(e,Math.min(t,n))}function C1(n){return ln(n,-32768,32767)}function al(n,e,t,i=1e-6){return n>=Math.min(e,t)-i&&n<=Math.max(e,t)+i}const Hl=n=>n===0||n===1,Uu=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*At/t)),Wu=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*At/t)+1,Qs={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*zt)+1,easeOutSine:n=>Math.sin(n*zt),easeInOutSine:n=>-.5*(Math.cos(Bt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(Line truncated
|
||||
* @kurkle/color v0.2.1
|
||||
* https://github.com/kurkle/color#readme
|
||||
* (c) 2022 Jukka Kurkela
|
||||
* Released under the MIT License
|
||||
*/function vl(n){return n+.5|0}const Di=(n,e,t)=>Math.max(Math.min(n,t),e);function Bs(n){return Di(vl(n*2.55),0,255)}function Ai(n){return Di(vl(n*255),0,255)}function hi(n){return Di(vl(n/2.55)/100,0,1)}function Yu(n){return Di(vl(n*100),0,100)}const An={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Vr=[..."0123456789ABCDEF"],M1=n=>Vr[n&15],T1=n=>Vr[(n&240)>>4]+Vr[n&15],jl=n=>(n&240)>>4===(n&15),D1=n=>jl(n.r)&&jl(n.g)&&jl(n.b)&&jl(n.a);function O1(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&An[n[1]]*17,g:255&An[n[2]]*17,b:255&An[n[3]]*17,a:e===5?An[n[4]]*17:255}:(e===7||e===9)&&(t={r:An[n[1]]<<4|An[n[2]],g:An[n[3]]<<4|An[n[4]],b:An[n[5]]<<4|An[n[6]],a:e===9?An[n[7]]<<4|An[n[8]]:255})),t}const E1=(n,e)=>n<255?e(n):"";function A1(n){var e=D1(n)?M1:T1;return n?"#"+e(n.r)+e(n.g)+e(n.b)+E1(n.a,e):void 0}const P1=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Gm(n,e,t){const i=e*Math.min(t,1-t),s=(l,o=(l+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function L1(n,e,t){const i=(s,l=(s+n/60)%6)=>t-t*e*Math.max(Math.min(l,4-l,1),0);return[i(5),i(3),i(1)]}function F1(n,e,t){const i=Gm(n,1,.5);let s;for(e+t>1&&(s=1/(e+t),e*=s,t*=s),s=0;s<3;s++)i[s]*=1-e-t,i[s]+=e;return i}function I1(n,e,t,i,s){return n===s?(e-t)/i+(e<t?6:0):e===s?(t-n)/i+2:(n-e)/i+4}function va(n){const t=n.r/255,i=n.g/255,s=n.b/255,l=Math.max(t,i,s),o=Math.min(t,i,s),r=(l+o)/2;let a,u,f;return l!==o&&(f=l-o,u=r>.5?f/(2-l-o):f/(l+o),a=I1(t,i,s,f,l),a=a*60+.5),[a|0,u||0,r]}function ya(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Ai)}function ka(n,e,t){return ya(Gm,n,e,t)}function R1(n,e,t){return ya(F1,n,e,t)}function N1(n,e,t){return ya(L1,n,e,t)}function Jm(n){return(n%360+360)%360}function H1(n){const e=P1.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Bs(+e[5]):Ai(+e[5]));const s=Jm(+e[2]),l=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=R1(s,l,o):e[1]==="hsv"?i=N1(s,l,o):i=ka(s,l,o),{r:i[0],g:i[1],b:i[2],a:t}}function j1(n,e){var t=va(n);t[0]=Jm(t[0]+e),t=ka(t),n.r=t[0],n.g=t[1],n.b=t[2]}function q1(n){if(!n)return;const e=va(n),t=e[0],i=Yu(e[1]),s=Yu(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${hi(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const Ku={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Zu={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function V1(){const n={},e=Object.keys(Zu),t=Object.keys(Ku);let i,s,l,o,r;for(i=0;i<e.length;i++){for(o=r=e[i],s=0;s<t.length;s++)l=t[s]Line truncated
|
||||
* Chart.js v3.8.2
|
||||
* https://www.chartjs.org
|
||||
* (c) 2022 Chart.js Contributors
|
||||
* Released under the MIT License
|
||||
*/class Yv{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,i,s){const l=t.listeners[s],o=t.duration;l.forEach(r=>r({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Bm.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const l=i.items;let o=l.length-1,r=!1,a;for(;o>=0;--o)a=l[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(l[o]=l[l.length-1],l.pop());r&&(s.draw(),this._notify(s,i,e,"progress")),l.length||(i.running=!1,this._notify(s,i,e,"complete"),i.initial=!1),t+=l.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);!t||(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var ci=new Yv;const af="transparent",Kv={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=Ju(n||af),s=i.valid&&Ju(e||af);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class Zv{constructor(e,t,i,s){const l=t[i];s=zl([e.to,s,l,e.from]);const o=zl([e.from,l,s]);this._active=!0,this._fn=e.fn||Kv[e.type||typeof o],this._easing=Qs[e.easing]||Qs.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const s=this._target[this._prop],l=i-this._start,o=this._duration-l;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=l,this._loop=!!e.loop,this._to=zl([e.to,t,s,e.from]),this._from=zl([e.from,s,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,s=this._prop,l=this._from,o=this._loop,r=this._to;let a;if(this._active=l!==r&&(o||t<i),!this._active){this._target[s]=r,this._notify(!0);return}if(t<0){this._target[s]=l;return}a=t/i%2,a=o&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(l,r,a)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][t]()}}const Gv=["x","y","borderWidth","radius","tension"],Jv=["color","borderColor","backgroundColor"];gt.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const Xv=Object.keys(gt.animation);gt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:n=>n!=="onProgress"&&n!=="onComplete"&&n!=="fn"});gt.set("animations",{colors:{type:"color",properties:Jv},numbers:{type:"number",properties:Gv}});gt.describe("animations",{_fallback:"animation"});gt.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class hg{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!ut(e))return;const t=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!ut(s))return;const l={};for(const o of Xv)l[o]=s[o];(Nt(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!t.has(o))&&t.set(o,l)})})}_animateOptions(e,t){const i=t.options,s=xv(e,i);if(!s)return[];const l=this._createAnimations(s,i);return i.$shared&&Qv(e.options.$animations,i).then(()=>{e.options=i},()=>{}),l}_createAnimations(e,t){const i=this._properties,s=[],l=e.$animations||(e.$animations={}),o=Object.keys(t),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const u=o[a];if(u.charAt(0)==="$")continue;if(u==="options"){s.push(...this._animateOptions(e,t));continue}const f=t[u];let c=l[u];const d=i.get(u);if(c)if(d&&c.active()){c.update(d,f,r);continue}else c.cancel();if(!d||!d.duration){e[u]=f;continue}l[u]=c=new Zv(d,e,u,f),s.push(c)}return s}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return ci.add(this._chart,i),!0}}function Qv(n,e){const t=[]Line truncated
|
||||
`)>-1?n.split(`
|
||||
`):n}function mw(n,e){const{element:t,datasetIndex:i,index:s}=e,l=n.getDatasetMeta(i).controller,{label:o,value:r}=l.getLabelAndValue(s);return{chart:n,label:o,parsed:l.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:l.getDataset(),dataIndex:s,datasetIndex:i,element:t}}function jf(n,e){const t=n.chart.ctx,{body:i,footer:s,title:l}=n,{boxWidth:o,boxHeight:r}=e,a=Sn(e.bodyFont),u=Sn(e.titleFont),f=Sn(e.footerFont),c=l.length,d=s.length,p=i.length,g=qn(e.padding);let v=g.height,b=0,y=i.reduce((M,C)=>M+C.before.length+C.lines.length+C.after.length,0);if(y+=n.beforeBody.length+n.afterBody.length,c&&(v+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),y){const M=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;v+=p*M+(y-p)*a.lineHeight+(y-1)*e.bodySpacing}d&&(v+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let $=0;const S=function(M){b=Math.max(b,t.measureText(M).width+$)};return t.save(),t.font=u.string,Tt(n.title,S),t.font=a.string,Tt(n.beforeBody.concat(n.afterBody),S),$=e.displayColors?o+2+e.boxPadding:0,Tt(i,M=>{Tt(M.before,S),Tt(M.lines,S),Tt(M.after,S)}),$=0,t.font=f.string,Tt(n.footer,S),t.restore(),b+=g.width,{width:b,height:v}}function gw(n,e){const{y:t,height:i}=e;return t<i/2?"top":t>n.height-i/2?"bottom":"center"}function _w(n,e,t,i){const{x:s,width:l}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&s+l+o>e.width||n==="right"&&s-l-o<0)return!0}function bw(n,e,t,i){const{x:s,width:l}=t,{width:o,chartArea:{left:r,right:a}}=n;let u="center";return i==="center"?u=s<=(r+a)/2?"left":"right":s<=l/2?u="left":s>=o-l/2&&(u="right"),_w(u,n,e,t)&&(u="center"),u}function qf(n,e,t){const i=t.yAlign||e.yAlign||gw(n,t);return{xAlign:t.xAlign||e.xAlign||bw(n,e,t,i),yAlign:i}}function vw(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function yw(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function Vf(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=s+l,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:p}=ps(o);let g=vw(e,r);const v=yw(e,a,u);return a==="center"?r==="left"?g+=u:r==="right"&&(g-=u):r==="left"?g-=Math.max(f,d)+s:r==="right"&&(g+=Math.max(c,p)+s),{x:ln(g,0,i.width-e.width),y:ln(v,0,i.height-e.height)}}function Gl(n,e,t){const i=qn(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function zf(n){return xn([],di(n))}function kw(n,e,t){return Ii(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function Bf(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}class Jr extends yi{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart||e._chart,this._chart=this.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&t.options.animation&&i.animations,l=new hg(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(l)),l}getContext(){return this.$context||(this.$context=kw(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,s=i.beforeTitle.apply(this,[e]),l=i.title.apply(this,[e]),o=i.afterTitle.apply(this,[e]);let r=[];return r=xn(r,di(s)),r=xn(r,di(l)),r=xn(r,di(o)),r}getBeforeBody(e,t){return zf(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const{callbacks:i}=t,s=[];return Tt(e,l=>{const o={before:[],lines:[],after:[]},r=Bf(i,l);xn(o.before,di(r.beforeLabel.call(this,l))),xn(o.lines,r.label.call(this,l)),xn(o.after,di(r.afterLabel.call(this,l))),s.push(o)}),s}getAfterBody(e,t){return zf(t.callbacks.afterBody.apply(this,[e]))}getFooter(e,t){const{callbacks:i}=t,s=i.beforeFooter.apply(this,[e]),l=i.footer.apply(this,[e]),o=i.afterFooter.apply(this,[e]);let r=[];return r=xn(r,di(s)),r=xn(r,di(l)),r=xn(r,di(o)),r}_createItems(e){const t=this._active,i=this.chart.data,s=[],l=[],o=[];let r=[],a,u;for(a=0,u=t.length;a<u;++a)r.push(mw(this.chart,t[a]));return e.filter&&(r=r.filter((f,c,d)=>e.filter(f,c,d,i))),e.itemSort&&(r=r.sort((f,c)=>e.itemSort(f,c,i))),Tt(r,f=>{const c=Bf(e.callbacks,f);s.push(c.labelColor.call(this,f)),l.push(c.labelPointStyle.call(this,f)),o.push(c.labelTextColor.call(this,f))}),this.labelColors=s,this.labelPointStyles=l,this.labelTextColors=o,this.dataPoints=r,r}update(e,t){const i=this.options.setContext(this.getContext()),s=this._active;l
Line truncated
|
||||
* chartjs-adapter-luxon v1.1.0
|
||||
* https://www.chartjs.org
|
||||
* (c) 2021 chartjs-adapter-luxon Contributors
|
||||
* Released under the MIT license
|
||||
*/const zw={datetime:Ze.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:Ze.TIME_WITH_SECONDS,minute:Ze.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};_g._date.override({_id:"luxon",_create:function(n){return Ze.fromMillis(n,this.options)},formats:function(){return zw},parse:function(n,e){const t=this.options;if(n===null||typeof n>"u")return null;const i=typeof n;return i==="number"?n=this._create(n):i==="string"?typeof e=="string"?n=Ze.fromFormat(n,e,t):n=Ze.fromISO(n,t):n instanceof Date?n=Ze.fromJSDate(n,t):i==="object"&&!(n instanceof Ze)&&(n=Ze.fromObject(n)),n.isValid?n.valueOf():null},format:function(n,e){const t=this._create(n);return typeof e=="string"?t.toFormat(e,this.options):t.toLocaleString(e)},add:function(n,e,t){const i={};return i[t]=e,this._create(n).plus(i).valueOf()},diff:function(n,e,t){return this._create(n).diff(this._create(e)).as(t).valueOf()},startOf:function(n,e,t){if(e==="isoWeek"){t=Math.trunc(Math.min(Math.max(0,t),6));const i=this._create(n);return i.minus({days:(i.weekday-t+7)%7}).startOf("day").valueOf()}return e?this._create(n).startOf(e).valueOf():n},endOf:function(n,e){return this._create(n).endOf(e).valueOf()}});function Xf(n){let e,t,i;return{c(){e=_("div"),h(e,"class","chart-loader loader svelte-vh4sl8")},m(s,l){w(s,e,l),i=!0},i(s){i||(Ot(()=>{t||(t=lt(e,Hn,{duration:150},!0)),t.run(1)}),i=!0)},o(s){t||(t=lt(e,Hn,{duration:150},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function Bw(n){let e,t,i=n[1]===1?"log":"logs",s;return{c(){e=N(n[1]),t=T(),s=N(i)},m(l,o){w(l,e,o),w(l,t,o),w(l,s,o)},p(l,o){o&2&&ge(e,l[1]),o&2&&i!==(i=l[1]===1?"log":"logs")&&ge(s,i)},d(l){l&&k(e),l&&k(t),l&&k(s)}}}function Uw(n){let e;return{c(){e=N("Loading...")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Ww(n){let e,t,i,s,l,o,r=n[2]&&Xf();function a(c,d){return c[2]?Uw:Bw}let u=a(n),f=u(n);return{c(){e=_("div"),r&&r.c(),t=T(),i=_("canvas"),s=T(),l=_("div"),f.c(),h(i,"class","chart-canvas svelte-vh4sl8"),Ya(i,"height","250px"),Ya(i,"width","100%"),h(e,"class","chart-wrapper svelte-vh4sl8"),se(e,"loading",n[2]),h(l,"class","txt-hint m-t-xs txt-right")},m(c,d){w(c,e,d),r&&r.m(e,null),m(e,t),m(e,i),n[8](i),w(c,s,d),w(c,l,d),f.m(l,null),o=!0},p(c,[d]){c[2]?r?d&4&&A(r,1):(r=Xf(),r.c(),A(r,1),r.m(e,t)):r&&(Ee(),P(r,1,1,()=>{r=null}),Ae()),d&4&&se(e,"loading",c[2]),u===(u=a(c))&&f?f.p(c,d):(f.d(1),f=u(c),f&&(f.c(),f.m(l,null)))},i(c){o||(A(r),o=!0)},o(c){P(r),o=!1},d(c){c&&k(e),r&&r.d(),n[8](null),c&&k(s),c&&k(l),f.d()}}}function Yw(n,e,t){let{filter:i=""}=e,{presets:s=""}=e,l,o,r=[],a=0,u=!1;async function f(){return t(2,u=!0),ye.Logs.getRequestsStats({filter:[s,i].filter(Boolean).join("&&")}).then(p=>{c();for(let g of p)r.push({x:G.getDateTime(g.date).toLocal().toJSDate(),y:g.total}),t(1,a+=g.total);r.push({x:new Date,y:void 0})}).catch(p=>{p!=null&&p.isAbort||(c(),console.warn(p),ye.errorResponseHandler(p,!1))}).finally(()=>{t(2,u=!1)})}function c(){t(1,a=0),t(7,r=[])}zn(()=>(To.register(Ri,Uo,wl,Ha,$l,pw,ww),t(6,o=new To(l,{type:"line",data:{datasets:[{label:"Total requests",data:r,borderColor:"#ef4565",pointBackgroundColor:"#ef4565",backgroundColor:"rgb(239,69,101,0.05)",borderWidth:2,pointRadius:1,pointBorderWidth:0,fill:!0}]},options:{animation:!1,interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,grid:{color:"#edf0f3",borderColor:"#dee3e8"},ticks:{precision:0,maxTicksLimit:6,autoSkip:!0,color:"#666f75"}},x:{type:"time",time:{unit:"hour",tooltipFormat:"DD h a"},grid:{borderColor:"#dee3e8",color:p=>p.tick.major?"#edf0f3":""},ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:p=>p.tick.major?"#16161a":"#666f75"}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function d(p){me[p?"unshift":"push"](()=>{l=p,t(0,l)})}return n.$$set=p=>{"filter"in p&&t(3,i=p.filter),"presets"in p&&t(4,s=p.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof s<"u")&&f(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update())},[l,a,u,i,s,f,o,r,d]}class Kw extends Oe{constructor(e){super(),De(this,e,Yw,Ww,Te,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}var Qf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Hg={exports:{}};(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
||||
* Prism: Lightweight, robust, elegant syntax highlighting
|
||||
*
|
||||
* @license MIT <https://opensource.org/licenses/MIT>
|
||||
* @author Lea Verou <https://lea.verou.me>
|
||||
* @namespace
|
||||
* @public
|
||||
*/var t=function(i){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,o={},r={manual:i.Prism&&i.Prism.manual,disableWorkerMessageHandler:i.Prism&&i.Prism.disableWorkerMessageHandler,util:{encode:function $(S){return S instanceof a?new a(S.type,$(S.content),S.alias):Array.isArray(S)?S.map($):S.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function($){return Object.prototype.toString.call($).slice(8,-1)},objId:function($){return $.__id||Object.defineProperty($,"__id",{value:++l}),$.__id},clone:function $(S,M){M=M||{};var C,D;switch(r.util.type(S)){case"Object":if(D=r.util.objId(S),M[D])return M[D];C={},M[D]=C;for(var O in S)S.hasOwnProperty(O)&&(C[O]=$(S[O],M));return C;case"Array":return D=r.util.objId(S),M[D]?M[D]:(C=[],M[D]=C,S.forEach(function(E,F){C[F]=$(E,M)}),C);default:return S}},getLanguage:function($){for(;$;){var S=s.exec($.className);if(S)return S[1].toLowerCase();$=$.parentElement}return"none"},setLanguage:function($,S){$.className=$.className.replace(RegExp(s,"gi"),""),$.classList.add("language-"+S)},currentScript:function(){if(typeof document>"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(C){var $=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(C.stack)||[])[1];if($){var S=document.getElementsByTagName("script");for(var M in S)if(S[M].src==$)return S[M]}return null}},isActive:function($,S,M){for(var C="no-"+S;$;){var D=$.classList;if(D.contains(S))return!0;if(D.contains(C))return!1;$=$.parentElement}return!!M}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function($,S){var M=r.util.clone(r.languages[$]);for(var C in S)M[C]=S[C];return M},insertBefore:function($,S,M,C){C=C||r.languages;var D=C[$],O={};for(var E in D)if(D.hasOwnProperty(E)){if(E==S)for(var F in M)M.hasOwnProperty(F)&&(O[F]=M[F]);M.hasOwnProperty(E)||(O[E]=D[E])}var L=C[$];return C[$]=O,r.languages.DFS(r.languages,function(R,H){H===L&&R!=$&&(this[R]=O)}),O},DFS:function $(S,M,C,D){D=D||{};var O=r.util.objId;for(var E in S)if(S.hasOwnProperty(E)){M.call(S,E,S[E],C||E);var F=S[E],L=r.util.type(F);L==="Object"&&!D[O(F)]?(D[O(F)]=!0,$(F,M,null,D)):L==="Array"&&!D[O(F)]&&(D[O(F)]=!0,$(F,M,E,D))}}},plugins:{},highlightAll:function($,S){r.highlightAllUnder(document,$,S)},highlightAllUnder:function($,S,M){var C={callback:M,container:$,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",C),C.elements=Array.prototype.slice.apply(C.container.querySelectorAll(C.selector)),r.hooks.run("before-all-elements-highlight",C);for(var D=0,O;O=C.elements[D++];)r.highlightElement(O,S===!0,C.callback)},highlightElement:function($,S,M){var C=r.util.getLanguage($),D=r.languages[C];r.util.setLanguage($,C);var O=$.parentElement;O&&O.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(O,C);var E=$.textContent,F={element:$,language:C,grammar:D,code:E};function L(H){F.highlightedCode=H,r.hooks.run("before-insert",F),F.element.innerHTML=F.highlightedCode,r.hooks.run("after-highlight",F),r.hooks.run("complete",F),M&&M.call(F.element)}if(r.hooks.run("before-sanity-check",F),O=F.element.parentElement,O&&O.nodeName.toLowerCase()==="pre"&&!O.hasAttribute("tabindex")&&O.setAttribute("tabindex","0"),!F.code){r.hooks.run("complete",F),M&&M.call(F.element);return}if(r.hooks.run("before-highlight",F),!F.grammar){L(r.util.encode(F.code));return}if(S&&i.Worker){var R=new Worker(r.filename);R.onmessage=function(H){L(H.data)},R.postMessage(JSON.stringify({language:F.language,code:F.code,immediateClose:!0}))}else L(r.highlight(F.code,F.grammar,F.language))},highlight:function($,S,M){var C={code:$,grammar:S,language:M};if(r.hooks.run("before-tokenize",C),!C.grammar)throw new Error('The language "'+C.language+'" has no grammar.');return C.tokens=r.tokenize(C.code,C.grammar),r.hooks.run("after-tokenize",C),a.stringify(r.util.encode(C.tokens),C.language)},tokenize:function($,S){var M=S.rest;if(M){for(var C in M)S[C]=M[C];delete S.rest}var D=new c;return d(D,D.head,$),f($,D,S,D.head,0),g(D)},hooks:{all:{},add:function($,S){var M=r.hooks.all;M[$]=M[$]||[],M[$].push(S)},run:function($,S){var M=r.hooks.all[$];if(!(!M||!M.length))for(var C=0,D;D=M[C++];)D(S)}},Token:a};i.Prism=r;function a($,S,M,C){this.type=$,this.content=S,this.alias=M,this.length=(C||"").length|0}a.stringify=function $(S,M){if(typeof S=="string")return S;if(Array.isArray(S)){var C="";return S.forEach(function(L){C+=$(L,M)}),C}var D={type:S.type,content:$(S.content,M),tag:"span",classes:["token",S.type],attributes:{},language:M},O=S.alias;O&&(Array.isArray(O)?Array.prototype.push.apply(D.classes,O):D.classes.push(O)),r.hooks.run("wrap",D);var E="";for(var F in D.attributes)E+=" "+F+'="'+(D.attributes[F]||"").replace(/"/g,""")+'"';return"<"+D.tag+' class="'+D.classes.join(" ")+'"'+E+">"+D.content+"</"+D.tag+">"};function u($,S,M,C){$.lastIndex=S;var D=$.exec(M);if(D&&C&&D[1]){var O=D[1].length;D.index+=O,D[0]=D[0].slice(O)}return D}funLine truncated
|
||||
`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(F+1))}y.textContent=D,t.highlightElement(y)},function(D){b.setAttribute(r,f),y.textContent=D})}}),t.plugins.fileHighlight={highlight:function(b){for(var y=(b||document).querySelectorAll(c),$=0,S;S=y[$++];)t.highlightElement(S)}};var g=!1;t.fileHighlight=function(){g||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),g=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(Hg);const js=Hg.exports;var Zw={exports:{}};(function(n){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(l,o){for(var r in o)o.hasOwnProperty(r)&&(l[r]=o[r]);return l};function t(l){this.defaults=e({},l)}function i(l){return l.replace(/-(\w)/g,function(o,r){return r.toUpperCase()})}function s(l){for(var o=0,r=0;r<l.length;++r)l.charCodeAt(r)==" ".charCodeAt(0)&&(o+=3);return l.length+o}t.prototype={setDefaults:function(l){this.defaults=e(this.defaults,l)},normalize:function(l,o){o=e(this.defaults,o);for(var r in o){var a=i(r);r!=="normalize"&&a!=="setDefaults"&&o[r]&&this[a]&&(l=this[a].call(this,l,o[r]))}return l},leftTrim:function(l){return l.replace(/^\s+/,"")},rightTrim:function(l){return l.replace(/\s+$/,"")},tabsToSpaces:function(l,o){return o=o|0||4,l.replace(/\t/g,new Array(++o).join(" "))},spacesToTabs:function(l,o){return o=o|0||4,l.replace(RegExp(" {"+o+"}","g")," ")},removeTrailing:function(l){return l.replace(/\s*?$/gm,"")},removeInitialLineFeed:function(l){return l.replace(/^(?:\r?\n|\r)/,"")},removeIndent:function(l){var o=l.match(/^[^\S\n\r]*(?=\S)/gm);return!o||!o[0].length||(o.sort(function(r,a){return r.length-a.length}),!o[0].length)?l:l.replace(RegExp("^"+o[0],"gm"),"")},indent:function(l,o){return l.replace(/^[^\S\n\r]*(?=\S)/gm,new Array(++o).join(" ")+"$&")},breakLines:function(l,o){o=o===!0?80:o|0||80;for(var r=l.split(`
|
||||
`),a=0;a<r.length;++a)if(!(s(r[a])<=o)){for(var u=r[a].split(/(\s+)/g),f=0,c=0;c<u.length;++c){var d=s(u[c]);f+=d,f>o&&(u[c]=`
|
||||
`+u[c],f=d)}r[a]=u.join("")}return r.join(`
|
||||
`)}},n.exports&&(n.exports=t),Prism.plugins.NormalizeWhitespace=new t({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(l){var o=Prism.plugins.NormalizeWhitespace;if(!(l.settings&&l.settings["whitespace-normalization"]===!1)&&!!Prism.util.isActive(l.element,"whitespace-normalization",!0)){if((!l.element||!l.element.parentNode)&&l.code){l.code=o.normalize(l.code,l.settings);return}var r=l.element.parentNode;if(!(!l.code||!r||r.nodeName.toLowerCase()!=="pre")){for(var a=r.childNodes,u="",f="",c=!1,d=0;d<a.length;++d){var p=a[d];p==l.element?c=!0:p.nodeName==="#text"&&(c?f+=p.nodeValue:u+=p.nodeValue,r.removeChild(p),--d)}if(!l.element.children.length||!Prism.plugins.KeepMarkup)l.code=u+l.code+f,l.code=o.normalize(l.code,l.settings);else{var g=u+l.element.innerHTML+f;l.element.innerHTML=o.normalize(g,l.settings),l.code=l.element.textContent}}}})})()})(Zw);(function(n){var e=[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|final|finally|for|get|hide|if|implements|import|in|interface|library|mixin|new|null|on|operator|part|rethrow|return|set|show|static|super|switch|sync|this|throw|try|typedef|var|void|while|with|yield)\b/],t=/(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,i={pattern:RegExp(t+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}}}};n.languages.dart=n.languages.extend("clike",{"class-name":[i,{pattern:RegExp(t+/[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source),lookbehind:!0,inside:i.inside}],keyword:e,operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),n.languages.insertBefore("dart","string",{"string-literal":{pattern:/r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,lookbehind:!0,inside:{punctuation:/^\$\{?|\}$/,expression:{pattern:/[\s\S]+/,inside:n.languages.dart}}},string:/[\s\S]+/}},string:void 0}),n.languages.insertBefore("dart","class-name",{metadata:{pattern:/@\w+/,alias:"function"}}),n.languages.insertBefore("dart","class-name",{generics:{pattern:/<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,inside:{"class-name":i,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}}})})(Prism);function Gw(n){let e,t;return{c(){e=_("div"),t=_("code"),h(t,"class","svelte-tv7jme"),h(e,"class","code-wrapper prism-light svelte-tv7jme")},m(i,s){w(i,e,s),m(e,t),t.innerHTML=n[0]},p(i,[s]){s&1&&(t.innerHTML=i[0])},i:re,o:re,d(i){i&&k(e)}}}function Jw(n,e,t){let{content:i=""}=e,{language:s="javascript"}=e,l="";function o(r){return r=typeof r=="string"?r:"",r=js.plugins.NormalizeWhitespace.normalize(r,{"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),js.highlight(r,js.languages[s]||js.languages.javascript,s)}return n.$$set=r=>{"content"in r&&t(1,i=r.content),"language"in r&&t(2,s=r.language)},n.$$.update=()=>{n.$$.dirty&2&&typeof js<"u"&&i&&t(0,l=o(i))},[l,i,s]}class gn extends Oe{constructor(e){super(),De(this,e,Jw,Gw,Te,{content:1,language:2})}}const Xw=n=>({}),xf=n=>({}),Qw=n=>({}),ec=n=>({});function tc(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,S=n[4]&&!n[2]&&nc(n);const M=n[18].header,C=$n(M,n,n[17],ec);let D=n[4]&&n[2]&&ic(n);const O=n[18].default,E=$n(O,n,n[17],null),F=n[18].footer,L=$n(F,n,n[17],xf);return{c(){e=_("div"),t=_("div"),s=T(),l=_("div"),o=_("div"),S&&S.c(),r=T(),C&&C.c(),a=T(),D&&D.c(),u=T(),f=_("div"),E&&E.c(),c=T(),d=_("div"),L&&L.c(),h(t,"class","overlay"),h(o,"class","overlay-panel-section panel-header"),h(f,"class","overlay-panel-section panel-content"),h(d,"class","overlay-panel-section panel-footer"),h(l,"class",p="overlay-panel "+n[1]+" "+n[8]),se(l,"popup",n[2]),h(e,"class","overlay-panel-container"),se(e,"padded",n[2]),se(e,"active",n[0])},m(R,H){w(R,e,H),m(e,t),m(e,s),m(e,l),m(l,o),S&&S.m(o,null),m(o,r),C&&C.m(o,null),m(o,a),D&&D.m(o,null),m(l,u),m(l,f),E&&E.m(f,null),n[20](f),m(l,c),m(l,d),L&&L.m(d,null),b=!0,y||($=[Q(t,"click",Wt(n[19])),Q(f,"scroll",n[21])],y=!0)},p(R,H){n=R,n[4]&&!n[2]?S?S.p(n,H):(S=nc(n),S.c(),S.m(o,r)):S&&(S.d(1),S=null),C&&C.p&&(!b||H&131072)&&Mn(C,M,n,n[17],b?Cn(M,n[17],H,Qw):Tn(n[17]),ec),n[4]&&n[2]?D?D.p(n,H):(D=ic(n),D.c(),D.m(o,null)):D&&(D.d(1),D=null),E&&E.p&&(!b||H&131072)&&Mn(E,O,n,n[17],b?Cn(O,n[17],H,null):Tn(n[17]),null),L&&L.p&&(!b||H&131072)&&Mn(L,F,n,n[17],b?Cn(F,n[17],H,Xw):Tn(n[17]),xf),(!b||H&258&&p!==(p="overlay-panel "+n[1]+" "+n[8]))&&h(l,"class",p),H&262&&se(l,"popup",n[2]),H&4&&se(e,"padded",n[2]),H&1&&se(e,"active",n[0])},i(R){b||(Ot(()=>{i||(i=lt(t,go,{duration:cs,opacity:0},!0)),i.run(1)}),A(C,R),A(E,R),A(L,R),Ot(()=>{v&&v.end(1),g=Dp(l,Nn,n[2]?{duration:cs,y:-10}:{duration:cs,x:50}),g.start()}),b=!0)},o(R){i||(i=lt(t,go,{dur
Line truncated
|
||||
This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]))&&h(e,"for",l);const $={};y&16&&($.id=b[4]),y&1&&($.disabled=!G.isEmpty(b[0].onlyDomains)),!a&&y&1&&(a=!0,$.value=b[0].exceptDomains,Ie(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,p()}}}function sS(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;function g(b){n[3](b)}let v={id:n[4]+".options.onlyDomains",disabled:!G.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(v.value=n[0].onlyDomains),r=new ls({props:v}),me.push(()=>Le(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[4]+".options.onlyDomains"),h(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(p=Ye(wt.call(null,s,{text:`List of domains that are ONLY allowed.
|
||||
This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]+".options.onlyDomains"))&&h(e,"for",l);const $={};y&16&&($.id=b[4]+".options.onlyDomains"),y&1&&($.disabled=!G.isEmpty(b[0].exceptDomains)),!a&&y&1&&(a=!0,$.value=b[0].onlyDomains,Ie(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,p()}}}function lS(n){let e,t,i,s,l,o,r;return i=new Pe({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[iS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Pe({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[sS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.exceptDomains"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.onlyDomains"),u&49&&(c.$$scope={dirty:u,ctx:a}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),z(i),z(o)}}}function oS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.exceptDomains,r)&&(s.exceptDomains=r,t(0,s))}function o(r){n.$$.not_equal(s.onlyDomains,r)&&(s.onlyDomains=r,t(0,s))}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class zg extends Oe{constructor(e){super(),De(this,e,oS,lS,Te,{key:1,options:0})}}function rS(n){let e,t,i,s;function l(a){n[2](a)}function o(a){n[3](a)}let r={};return n[0]!==void 0&&(r.key=n[0]),n[1]!==void 0&&(r.options=n[1]),e=new zg({props:r}),me.push(()=>Le(e,"key",l)),me.push(()=>Le(e,"options",o)),{c(){B(e.$$.fragment)},m(a,u){V(e,a,u),s=!0},p(a,[u]){const f={};!t&&u&1&&(t=!0,f.key=a[0],Ie(()=>t=!1)),!i&&u&2&&(i=!0,f.options=a[1],Ie(()=>i=!1)),e.$set(f)},i(a){s||(A(e.$$.fragment,a),s=!0)},o(a){P(e.$$.fragment,a),s=!1},d(a){z(e,a)}}}function aS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){i=r,t(0,i)}function o(r){s=r,t(1,s)}return n.$$set=r=>{"key"in r&&t(0,i=r.key),"options"in r&&t(1,s=r.options)},[i,s,l,o]}class uS extends Oe{constructor(e){super(),De(this,e,aS,rS,Te,{key:0,options:1})}}var br=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],ms={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(n){return typeof console<"u"&&console.warn(n)},getWeek:function(n){var e=new Date(n.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var t=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},cl={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(n){var e=n%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to togg
Line truncated
|
||||
<span class='flatpickr-weekday'>
|
||||
`+j.join("</span><span class='flatpickr-weekday'>")+`
|
||||
</span>
|
||||
`}}function ue(){t.calendarContainer.classList.add("hasWeeks");var I=yt("div","flatpickr-weekwrapper");I.appendChild(yt("span","flatpickr-weekday",t.l10n.weekAbbreviation));var j=yt("div","flatpickr-weeks");return I.appendChild(j),{weekWrapper:I,weekNumbers:j}}function Me(I,j){j===void 0&&(j=!0);var ee=j?I:I-t.currentMonth;ee<0&&t._hidePrevMonthArrow===!0||ee>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=ee,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,We("onYearChange"),te()),H(),We("onMonthChange"),Mt())}function oe(I,j){if(I===void 0&&(I=!0),j===void 0&&(j=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,j===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var ee=wr(t.config),U=ee.hours,ae=ee.minutes,$e=ee.seconds;p(U,ae,$e)}t.redraw(),I&&We("onChange")}function he(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),We("onClose")}function be(){t.config!==void 0&&We("onDestroy");for(var I=t._handlers.length;I--;)t._handlers[I].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var j=t.calendarContainer.parentNode;if(j.lastChild&&j.removeChild(j.lastChild),j.parentNode){for(;j.firstChild;)j.parentNode.insertBefore(j.firstChild,j);j.parentNode.removeChild(j)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(ee){try{delete t[ee]}catch{}})}function K(I){return t.calendarContainer.contains(I)}function Se(I){if(t.isOpen&&!t.config.inline){var j=vn(I),ee=K(j),U=j===t.input||j===t.altInput||t.element.contains(j)||I.path&&I.path.indexOf&&(~I.path.indexOf(t.input)||~I.path.indexOf(t.altInput)),ae=!U&&!ee&&!K(I.relatedTarget),$e=!t.config.ignoredFocusElements.some(function(Ke){return Ke.contains(j)});ae&&$e&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function x(I){if(!(!I||t.config.minDate&&I<t.config.minDate.getFullYear()||t.config.maxDate&&I>t.config.maxDate.getFullYear())){var j=I,ee=t.currentYear!==j;t.currentYear=j||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),ee&&(t.redraw(),We("onYearChange"),te())}}function J(I,j){var ee;j===void 0&&(j=!0);var U=t.parseDate(I,void 0,j);if(t.config.minDate&&U&&yn(U,t.config.minDate,j!==void 0?j:!t.minDateHasTime)<0||t.config.maxDate&&U&&yn(U,t.config.maxDate,j!==void 0?j:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(U===void 0)return!1;for(var ae=!!t.config.enable,$e=(ee=t.config.enable)!==null&&ee!==void 0?ee:t.config.disable,Ke=0,je=void 0;Ke<$e.length;Ke++){if(je=$e[Ke],typeof je=="function"&&je(U))return ae;if(je instanceof Date&&U!==void 0&&je.getTime()===U.getTime())return ae;if(typeof je=="string"){var ce=t.parseDate(je,void 0,!0);return ce&&ce.getTime()===U.getTime()?ae:!ae}else if(typeof je=="object"&&U!==void 0&&je.from&&je.to&&U.getTime()>=je.from.getTime()&&U.getTime()<=je.to.getTime())return ae}return!ae}function ve(I){return t.daysContainer!==void 0?I.className.indexOf("hidden")===-1&&I.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(I):!1}function Re(I){var j=I.target===t._input,ee=t._input.value.trimEnd()!==Ft();j&&ee&&!(I.relatedTarget&&K(I.relatedTarget))&&t.setDate(t._input.value,!0,I.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function Ve(I){var j=
Line truncated
|
||||
`),d=_("span"),p=_("span"),p.textContent="Choose presets",g=T(),B(v.$$.fragment),h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[10]),h(p,"class","txt link-primary"),h(d,"class","inline-flex"),h(f,"class","help-block")},m(C,D){w(C,e,D),m(e,t),m(e,i),m(e,s),w(C,o,D),V(r,C,D),w(C,u,D),w(C,f,D),m(f,c),m(f,d),m(d,p),m(d,g),V(v,d,null),b=!0,y||($=Ye(wt.call(null,s,{text:`Allow files ONLY with the listed mime types.
|
||||
Leave empty for no restriction.`,position:"top"})),y=!0)},p(C,D){(!b||D&1024&&l!==(l=C[10]))&&h(e,"for",l);const O={};D&1024&&(O.id=C[10]),!a&&D&1&&(a=!0,O.value=C[0].mimeTypes,Ie(()=>a=!1)),r.$set(O);const E={};D&2049&&(E.$$scope={dirty:D,ctx:C}),v.$set(E)},i(C){b||(A(r.$$.fragment,C),A(v.$$.fragment,C),b=!0)},o(C){P(r.$$.fragment,C),P(v.$$.fragment,C),b=!1},d(C){C&&k(e),C&&k(o),z(r,C),C&&k(u),C&&k(f),z(v),y=!1,$()}}}function RS(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;function g(b){n[9](b)}let v={id:n[10],placeholder:"eg. 50x50, 480x720"};return n[0].thumbs!==void 0&&(v.value=n[0].thumbs),r=new ls({props:v}),me.push(()=>Le(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Thumb sizes",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[10]),h(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(p=Ye(wt.call(null,s,{text:"List of thumb sizes for image files. The thumbs will be generated lazily on first access.",position:"top"})),d=!0)},p(b,y){(!c||y&1024&&l!==(l=b[10]))&&h(e,"for",l);const $={};y&1024&&($.id=b[10]),!a&&y&1&&(a=!0,$.value=b[0].thumbs,Ie(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,p()}}}function NS(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;return i=new Pe({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[PS,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),o=new Pe({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[LS,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),u=new Pe({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[IS,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),d=new Pe({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[RS,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),f=T(),c=_("div"),B(d.$$.fragment),h(t,"class","col-sm-6"),h(l,"class","col-sm-6"),h(a,"class","col-sm-12"),h(c,"class","col-sm-12"),h(e,"class","grid")},m(g,v){w(g,e,v),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),m(e,a),V(u,a,null),m(e,f),m(e,c),V(d,c,null),p=!0},p(g,[v]){const b={};v&2&&(b.name="schema."+g[1]+".options.maxSize"),v&3073&&(b.$$scope={dirty:v,ctx:g}),i.$set(b);const y={};v&2&&(y.name="schema."+g[1]+".options.maxSelect"),v&3073&&(y.$$scope={dirty:v,ctx:g}),o.$set(y);const $={};v&2&&($.name="schema."+g[1]+".options.mimeTypes"),v&3073&&($.$$scope={dirty:v,ctx:g}),u.$set($);const S={};v&2&&(S.name="schema."+g[1]+".options.thumbs"),v&3073&&(S.$$scope={dirty:v,ctx:g}),d.$set(S)},i(g){p||(A(i.$$.fragment,g),A(o.$$.fragment,g),A(u.$$.fragment,g),A(d.$$.fragment,g),p=!0)},o(g){P(i.$$.fragment,g),P(o.$$.fragment,g),P(u.$$.fragment,g),P(d.$$.fragment,g),p=!1},d(g){g&&k(e),z(i),z(o),z(u),z(d)}}}function HS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.maxSize=Pt(this.value),t(0,s)}function o(){s.maxSelect=Pt(this.value),t(0,s)}function r(p){n.$$.not_equal(s.mimeTypes,p)&&(s.mimeTypes=p,t(0,s))}const a=()=>{t(0,s.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],s)},u=()=>{t(0,s.mimeTypes=["image/jpg","image/jpeg","image/png","image/svg+xml","image/gif"],s)},f=()=>{t(0,s.mimeTypes=["video/mp4","video/x-ms-wmv","video/quicktime","video/3gpp"],s)},c=()=>{t(0,s.mimeTypes=["application/zip","application/x-7z-compressed","application/x-rar-compressed"],s)};function d(p){n.$$.not_equal(s.thumbs,p)&&(s.thumbs=p,t(0,s))}return n.$$set=p=>{"key"in p&&t(1,i=p.key),"options"in p&&t(0,s=p.options)},n.$$.update=()=>{n.$$.dirty&1&&G.isEmpty(s)&&t(0,s={maxSelect:1,maxSize:5242880,thumbs:[],mimeTypes:[]})},[s,i,l,o,r,a,u,f,c,d]}class jS extends Oe{constructor(e){super(),De(this,e,HS,NS,Te,{key:1,options:0})}}function qS(n){let e,t,i,s,l,o,r;function a(f){n[5](f)}let u={searchable:n[3].length>5,selectPlaceholder:n[2]?"Loading...":"Select collection",noOptionsText:"No collections found",selectionKey:"id",items:n[3]};return n[0].collectionId!==void 0&&(u.keyOfSelected=n[0].collectionId),l=new ss({props:u}),me.push(()=>Le(l,"keyOfSelected",a)),{c(){e=_("label"),t=N("Collection"),s=T(),B(l.$$.fragment),h(e,"for",i=n[9])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&512&&i!==(i=f[9]))&&h(e,"for",i);const d={};c&8&&(d.searchable=f[3].length>5),c&4&&(d.selectPlaceholder=f[2]?"Loading...":"Select collection"),c&8&&(d.items=f[3]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].collectionId,Ie(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=
Line truncated
|
||||
form-field
|
||||
required
|
||||
`+(n[5]?"":"invalid")+`
|
||||
`+(n[0].id&&n[0].system?"disabled":"")+`
|
||||
`,name:"schema."+n[1]+".name",$$slots:{default:[QS,({uniqueId:H})=>({38:H}),({uniqueId:H})=>[0,H?128:0]]},$$scope:{ctx:n}}});const O=[u$,a$,r$,o$,l$,s$,i$,n$,t$,e$,xS],E=[];function F(H,te){return H[0].type==="text"?0:H[0].type==="number"?1:H[0].type==="bool"?2:H[0].type==="email"?3:H[0].type==="url"?4:H[0].type==="date"?5:H[0].type==="select"?6:H[0].type==="json"?7:H[0].type==="file"?8:H[0].type==="relation"?9:H[0].type==="user"?10:-1}~(f=F(n))&&(c=E[f]=O[f](n)),g=new Pe({props:{class:"form-field form-field-toggle m-0",name:"requried",$$slots:{default:[f$,({uniqueId:H})=>({38:H}),({uniqueId:H})=>[0,H?128:0]]},$$scope:{ctx:n}}});let L=n[0].type!=="file"&&Ec(n),R=!n[0].toDelete&&Ac(n);return{c(){e=_("form"),t=_("div"),i=_("div"),B(s.$$.fragment),l=T(),o=_("div"),B(r.$$.fragment),a=T(),u=_("div"),c&&c.c(),d=T(),p=_("div"),B(g.$$.fragment),v=T(),b=_("div"),L&&L.c(),y=T(),R&&R.c(),$=T(),S=_("input"),h(i,"class","col-sm-6"),h(o,"class","col-sm-6"),h(u,"class","col-sm-12 hidden-empty"),h(p,"class","col-sm-4 flex"),h(b,"class","col-sm-4 flex"),h(t,"class","grid"),h(S,"type","submit"),h(S,"class","hidden"),h(S,"tabindex","-1"),h(e,"class","field-form")},m(H,te){w(H,e,te),m(e,t),m(t,i),V(s,i,null),m(t,l),m(t,o),V(r,o,null),m(t,a),m(t,u),~f&&E[f].m(u,null),m(t,d),m(t,p),V(g,p,null),m(t,v),m(t,b),L&&L.m(b,null),m(t,y),R&&R.m(t,null),m(e,$),m(e,S),M=!0,C||(D=Q(e,"submit",Wt(n[31])),C=!0)},p(H,te){const le={};te[0]&1&&(le.class="form-field required "+(H[0].id?"disabled":"")),te[0]&2&&(le.name="schema."+H[1]+".type"),te[0]&1|te[1]&384&&(le.$$scope={dirty:te,ctx:H}),s.$set(le);const q={};te[0]&33&&(q.class=`
|
||||
form-field
|
||||
required
|
||||
`+(H[5]?"":"invalid")+`
|
||||
`+(H[0].id&&H[0].system?"disabled":"")+`
|
||||
`),te[0]&2&&(q.name="schema."+H[1]+".name"),te[0]&33|te[1]&384&&(q.$$scope={dirty:te,ctx:H}),r.$set(q);let Y=f;f=F(H),f===Y?~f&&E[f].p(H,te):(c&&(Ee(),P(E[Y],1,1,()=>{E[Y]=null}),Ae()),~f?(c=E[f],c?c.p(H,te):(c=E[f]=O[f](H),c.c()),A(c,1),c.m(u,null)):c=null);const W={};te[0]&1|te[1]&384&&(W.$$scope={dirty:te,ctx:H}),g.$set(W),H[0].type!=="file"?L?(L.p(H,te),te[0]&1&&A(L,1)):(L=Ec(H),L.c(),A(L,1),L.m(b,null)):L&&(Ee(),P(L,1,1,()=>{L=null}),Ae()),H[0].toDelete?R&&(Ee(),P(R,1,1,()=>{R=null}),Ae()):R?(R.p(H,te),te[0]&1&&A(R,1)):(R=Ac(H),R.c(),A(R,1),R.m(t,null))},i(H){M||(A(s.$$.fragment,H),A(r.$$.fragment,H),A(c),A(g.$$.fragment,H),A(L),A(R),M=!0)},o(H){P(s.$$.fragment,H),P(r.$$.fragment,H),P(c),P(g.$$.fragment,H),P(L),P(R),M=!1},d(H){H&&k(e),z(s),z(r),~f&&E[f].d(),z(g),L&&L.d(),R&&R.d(),C=!1,D()}}}function Lc(n){let e,t,i,s,l=n[0].system&&Fc(),o=!n[0].id&&Ic(n),r=n[0].required&&Rc(),a=n[0].unique&&Nc();return{c(){e=_("div"),l&&l.c(),t=T(),o&&o.c(),i=T(),r&&r.c(),s=T(),a&&a.c(),h(e,"class","inline-flex")},m(u,f){w(u,e,f),l&&l.m(e,null),m(e,t),o&&o.m(e,null),m(e,i),r&&r.m(e,null),m(e,s),a&&a.m(e,null)},p(u,f){u[0].system?l||(l=Fc(),l.c(),l.m(e,t)):l&&(l.d(1),l=null),u[0].id?o&&(o.d(1),o=null):o?o.p(u,f):(o=Ic(u),o.c(),o.m(e,i)),u[0].required?r||(r=Rc(),r.c(),r.m(e,s)):r&&(r.d(1),r=null),u[0].unique?a||(a=Nc(),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(u){u&&k(e),l&&l.d(),o&&o.d(),r&&r.d(),a&&a.d()}}}function Fc(n){let e;return{c(){e=_("span"),e.textContent="System",h(e,"class","label label-danger")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Ic(n){let e;return{c(){e=_("span"),e.textContent="New",h(e,"class","label"),se(e,"label-warning",n[8]&&!n[0].toDelete)},m(t,i){w(t,e,i)},p(t,i){i[0]&257&&se(e,"label-warning",t[8]&&!t[0].toDelete)},d(t){t&&k(e)}}}function Rc(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Nc(n){let e;return{c(){e=_("span"),e.textContent="Unique",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Hc(n){let e,t,i,s,l;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Ye(wt.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Ot(()=>{t||(t=lt(e,Hn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=lt(e,Hn,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function jc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Restore</span>',h(e,"type","button"),h(e,"class","btn btn-sm btn-danger btn-secondary")},m(s,l){w(s,e,l),t||(i=Q(e,"click",Gn(n[15])),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function p$(n){let e,t,i,s,l,o,r=(n[0].name||"-")+"",a,u,f,c,d,p,g,v,b,y=!n[0].toDelete&&Lc(n),$=n[7]&&!n[0].system&&Hc(),S=n[0].toDelete&&jc(n);return{c(){e=_("div"),t=_("span"),i=_("i"),l=T(),o=_("strong"),a=N(r),f=T(),y&&y.c(),c=T(),d=_("div"),p=T(),$&&$.c(),g=T(),S&&S.c(),v=st(),h(i,"class",s=Wa(G.getFieldTypeIcon(n[0].type))+" svelte-1tpxlm5"),h(t,"class","icon field-type"),h(o,"class","title field-name svelte-1tpxlm5"),h(o,"title",u=n[0].name),se(o,"txt-strikethrough",n[0].toDelete),h(e,"class","inline-flex"),h(d,"class","flex-fill")},m(M,C){w(M,e,C),m(e,t),m(t,i),m(e,l),m(e,o),m(o,a),w(M,f,C),y&&y.m(M,C),w(M,c,C),w(M,d,C),w(M,p,C),$&&$.m(M,C),w(M,g,C),S&&S.m(M,C),w(M,v,C),b=!0},p(M,C){(!b||C[0]&1&&s!==(s=Wa(G.getFieldTypeIcon(M[0].type))+" svelte-1tpxlm5"))&&h(i,"class",s),(!b||C[0]&1)&&r!==(r=(M[0].name||"-")+"")&&ge(a,r),(!b||C[0]&1&&u!==(u=M[0].name))&&h(o,"title",u),C[0]&1&&se(o,"txt-strikethrough",M[0].toDelete),M[0].toDelete?y&&(y.d(1),y=null):y?y.p(M,C):(y=Lc(M),y.c(),y.m(c.parentNode,c)),M[7]&&!M[0].system?$?C[0]&129&&A($,1):($=Hc(),$.c(),A($,1),$.m(g.parentNode,g)):$&&(Ee(),P($,1,1,()=>{$=null}),Ae()),M[0].toDelete?S?S.p(M,C):(S=jc(M),S.c(),S.m(v.parentNode,v)):S&&(S.d(1),S=null)},i(M){b||(A($),b=!0)},o(M){P($),b=!1},d(M){M&&k(e),M&&k(f),y&&y.d(M),M&&k(c),M&&k(d),M&&k(p),$&&$.d(M),M&&k(g),S&&S.d(M),M&&k(v)}}}function m$(n){let e,t,i={single:!0,interactive:n[8],class:n[2]||n[0].toDelete||n[0].system?"field-accordion disabled":"field-accordion",$$slots:{header:[p$],default:[h$]},$$scope:{ctx:n}};return e=new qa({props:i}),n[32](e),e.$on("expand",n[33]),e.$on("collapse",n[34]),e.$on("toggle",n[35]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const o={};l[0]&256&&(o.interactive=s[8]),l[0]&5&&(o.class=s[2]||s[0].toDelete||s[0].system?"field-accordion disabled":"field-accordion"),l[0]&483|l[1]&256&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[32](null),z(e,s)}}}function g$(n,e,t){let i,s,l,o,r;kt(n,ns,K=>t(14,r=K));const a=rn();let{key:u="0"}=e,{field:f=new bn}=e,{disabled:c=!1}=e,{excludeNames:d=[]}=e,p,g=f.type;function v(){p==null||p.expand()}function b(){p==null||p.collapse()}function y(){f.id?t(0,f.toDelete=!0,f):(b(),a("remove"))}function $(K){if(K=(""+K).toLowerCase(),!K)return!1;for(co
Line truncated
|
||||
<code>@request.query.*</code>
|
||||
<code>@request.data.*</code>
|
||||
<code>@request.user.*</code>`,S=T(),M=_("hr"),C=T(),D=_("p"),D.innerHTML="You could also add constraints and query other collections using the <em>@collection</em> filter:",O=T(),E=_("div"),E.innerHTML="<code>@collection.ANY_COLLECTION_NAME.*</code>",F=T(),L=_("hr"),R=T(),H=_("p"),H.innerHTML=`Example rule:
|
||||
<br/>
|
||||
<code>@request.user.id!="" && created>"2022-01-01 00:00:00"</code>`,h(s,"class","m-b-0"),h(o,"class","inline-flex flex-gap-5"),h(g,"class","m-t-10 m-b-5"),h(b,"class","m-b-0"),h($,"class","inline-flex flex-gap-5"),h(M,"class","m-t-10 m-b-5"),h(D,"class","m-b-0"),h(E,"class","inline-flex flex-gap-5"),h(L,"class","m-t-10 m-b-5"),h(i,"class","content"),h(t,"class","alert alert-warning m-0")},m(W,X){w(W,e,X),m(e,t),m(t,i),m(i,s),m(i,l),m(i,o),m(o,r),m(o,a),m(o,u),m(o,f),m(o,c),m(o,d);for(let ne=0;ne<Y.length;ne+=1)Y[ne].m(o,null);m(i,p),m(i,g),m(i,v),m(i,b),m(i,y),m(i,$),m(i,S),m(i,M),m(i,C),m(i,D),m(i,O),m(i,E),m(i,F),m(i,L),m(i,R),m(i,H),le=!0},p(W,X){if(X&1){q=W[0].schema;let ne;for(ne=0;ne<q.length;ne+=1){const ue=Bc(W,q,ne);Y[ne]?Y[ne].p(ue,X):(Y[ne]=Wc(ue),Y[ne].c(),Y[ne].m(o,null))}for(;ne<Y.length;ne+=1)Y[ne].d(1);Y.length=q.length}},i(W){le||(W&&Ot(()=>{te||(te=lt(e,xt,{duration:150},!0)),te.run(1)}),le=!0)},o(W){W&&(te||(te=lt(e,xt,{duration:150},!1)),te.run(0)),le=!1},d(W){W&&k(e),Zn(Y,W),W&&te&&te.end()}}}function k$(n){let e,t=n[19].name+"",i;return{c(){e=_("code"),i=N(t)},m(s,l){w(s,e,l),m(e,i)},p(s,l){l&1&&t!==(t=s[19].name+"")&&ge(i,t)},d(s){s&&k(e)}}}function w$(n){let e,t=n[19].name+"",i,s;return{c(){e=_("code"),i=N(t),s=N(".*")},m(l,o){w(l,e,o),m(e,i),m(e,s)},p(l,o){o&1&&t!==(t=l[19].name+"")&&ge(i,t)},d(l){l&&k(e)}}}function Wc(n){let e;function t(l,o){return l[19].type==="relation"||l[19].type==="user"?w$:k$}let i=t(n),s=i(n);return{c(){s.c(),e=st()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function S$(n){let e=[],t=new Map,i,s,l=Object.entries(n[6]);const o=r=>r[14];for(let r=0;r<l.length;r+=1){let a=zc(n,l,r),u=o(a);t.set(u,e[r]=Yc(u,a))}return{c(){for(let r=0;r<e.length;r+=1)e[r].c();i=st()},m(r,a){for(let u=0;u<e.length;u+=1)e[u].m(r,a);w(r,i,a),s=!0},p(r,a){a&262235&&(l=Object.entries(r[6]),Ee(),e=St(e,a,o,1,r,l,t,i.parentNode,Gt,Yc,i,zc),Ae())},i(r){if(!s){for(let a=0;a<l.length;a+=1)A(e[a]);s=!0}},o(r){for(let a=0;a<e.length;a+=1)P(e[a]);s=!1},d(r){for(let a=0;a<e.length;a+=1)e[a].d(r);r&&k(i)}}}function $$(n){let e;return{c(){e=_("div"),e.innerHTML='<span class="loader"></span>',h(e,"class","txt-center")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function C$(n){let e,t,i;function s(){return n[9](n[14])}return{c(){e=_("button"),e.innerHTML='<i class="ri-lock-line"></i>',h(e,"type","button"),h(e,"class","rule-toggle-btn btn btn-circle btn-outline svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[Ye(wt.call(null,e,"Lock and set to Admins only")),Q(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,Qe(i)}}}function M$(n){let e,t,i;function s(){return n[8](n[14])}return{c(){e=_("button"),e.innerHTML='<i class="ri-lock-unlock-line"></i>',h(e,"type","button"),h(e,"class","rule-toggle-btn btn btn-circle btn-outline btn-success svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[Ye(wt.call(null,e,"Unlock and set custom rule")),Q(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,Qe(i)}}}function T$(n){let e;return{c(){e=N("Leave empty to grant everyone access")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function D$(n){let e;return{c(){e=N("Only admins will be able to access (unlock to change)")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function O$(n){let e,t=n[15]+"",i,s,l=Ti(n[0][n[14]])?"Admins only":"Custom rule",o,r,a,u,f=n[14],c,d,p,g,v,b,y;function $(){return n[10](n[14])}const S=()=>n[11](u,f),M=()=>n[11](null,f);function C(R){n[12](R,n[14])}var D=n[4];function O(R){let H={baseCollection:R[0],disabled:Ti(R[0][R[14]])};return R[0][R[14]]!==void 0&&(H.value=R[0][R[14]]),{props:H}}D&&(u=new D(O(n)),S(),me.push(()=>Le(u,"value",C)));function E(R,H){return H&1&&(g=null),g==null&&(g=!!Ti(R[0][R[14]])),g?D$:T$}let F=E(n,-1),L=F(n);return{c(){e=_("label"),i=N(t),s=N(" - "),o=N(l),a=T(),u&&B(u.$$.fragment),d=T(),p=_("div"),L.c(),h(e,"for",r=n[18]),h(p,"class","help-block")},m(R,H){w(R,e,H),m(e,i),m(e,s),m(e,o),w(R,a,H),u&&V(u,R,H),w(R,d,H),w(R,p,H),L.m(p,null),v=!0,b||(y=Q(e,"click",$),b=!0)},p(R,H){n=R,(!v||H&1)&&l!==(l=Ti(n[0][n[14]])?"Admins only":"Custom rule")&&ge(o,l),(!v||H&262144&&r!==(r=n[18]))&&h(e,"for",r),f!==n[14]&&(M(),f=n[14],S());const te={};if(H&1&&(te.baseCollection=n[0]),H&1&&(te.disabled=Ti(n[0][n[14]])),!c&&H&65&&(c=!0,te.value=n[0][n[14]],Ie(()=>c=!1)),D!==(D=n[4])){if(u){Ee();const le=u;P(le.$$.fragment,1,0,()=>{z(le,1)}),Ae()}D?(u=new D(O(n)),S(),me.push(()=>Le(u,"value",C)),B(u.$$.fragment),A(u.$$.fragment,1),V(u,d.parentNode,d)):u=null}else D&&u.$set(te);F!==(F=E(n,H))&&(L.d(1),L=F(n),L&&(L.c(),L.m(p,null)))},i(R){v||(u&&A(u.$$.fragment,R),v=!0)},o(R){u&&P(u.$$.fragment,R),v=!1},d(R){R&&k(e),R&&k(a),M(),u&&z(u,R),R&&k(d),R&&k(p),L.d(),b=!1,y()}}}function Yc(n,e){let t,i,s,l,o,r,a,u;function f(p,g){return g&1&&(l=null),l==null&&(l=!!Ti(p[0][p[14]])),l?M$:C$}let c=f(e,-1),d=c(e);return r=new Pe({props:{class:"form-field rule-field m-0 "+(Ti(e[0][e[14]])?"disabled":Line truncated
|
||||
<a href="https://pocketbase.io/docs/manage-collections#rules-filters-syntax" target="_blank" rel="noopener">PocketBase filter syntax and operators
|
||||
</a>.`,s=T(),l=_("span"),r=N(o),a=T(),b&&b.c(),u=T(),c.c(),d=st(),h(l,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),h(t,"class","flex"),h(e,"class","block m-b-base")},m(M,C){w(M,e,C),m(e,t),m(t,i),m(t,s),m(t,l),m(l,r),m(e,a),b&&b.m(e,null),w(M,u,C),$[f].m(M,C),w(M,d,C),p=!0,g||(v=Q(l,"click",n[7]),g=!0)},p(M,[C]){(!p||C&4)&&o!==(o=M[2]?"Hide available fields":"Show available fields")&&ge(r,o),M[2]?b?(b.p(M,C),C&4&&A(b,1)):(b=Uc(M),b.c(),A(b,1),b.m(e,null)):b&&(Ee(),P(b,1,1,()=>{b=null}),Ae());let D=f;f=S(M),f===D?$[f].p(M,C):(Ee(),P($[D],1,1,()=>{$[D]=null}),Ae(),c=$[f],c?c.p(M,C):(c=$[f]=y[f](M),c.c()),A(c,1),c.m(d.parentNode,d))},i(M){p||(A(b),A(c),p=!0)},o(M){P(b),P(c),p=!1},d(M){M&&k(e),b&&b.d(),M&&k(u),$[f].d(M),M&&k(d),g=!1,v()}}}function Ti(n){return n===null}function A$(n,e,t){let{collection:i=new On}=e,s={},l=!1,o={},r,a=!1;const u={listRule:"List Action",viewRule:"View Action",createRule:"Create Action",updateRule:"Update Action",deleteRule:"Delete Action"};async function f(){t(5,a=!0);try{t(4,r=(await Ki(()=>import("./FilterAutocompleteInput.9d9a35b4.js"),[])).default)}catch(y){console.warn(y),t(4,r=null)}t(5,a=!1)}zn(()=>{f()});const c=()=>t(2,l=!l),d=async y=>{var $;t(0,i[y]=s[y]||"",i),await oi(),($=o[y])==null||$.focus()},p=y=>{t(1,s[y]=i[y],s),t(0,i[y]=null,i)},g=y=>{var $;return($=o[y])==null?void 0:$.focus()};function v(y,$){me[y?"unshift":"push"](()=>{o[$]=y,t(3,o)})}function b(y,$){n.$$.not_equal(i[$],y)&&(i[$]=y,t(0,i))}return n.$$set=y=>{"collection"in y&&t(0,i=y.collection)},[i,s,l,o,r,a,u,c,d,p,g,v,b]}class P$ extends Oe{constructor(e){super(),De(this,e,A$,E$,Te,{collection:0})}}function Kc(n,e,t){const i=n.slice();return i[14]=e[t],i}function Zc(n,e,t){const i=n.slice();return i[14]=e[t],i}function Gc(n){let e;return{c(){e=_("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Jc(n){let e,t,i,s,l=n[1].originalName+"",o,r,a,u,f,c=n[1].name+"",d;return{c(){e=_("li"),t=_("div"),i=N(`Renamed collection
|
||||
`),s=_("strong"),o=N(l),r=T(),a=_("i"),u=T(),f=_("strong"),d=N(c),h(s,"class","txt-strikethrough txt-hint"),h(a,"class","ri-arrow-right-line txt-sm"),h(f,"class","txt"),h(t,"class","inline-flex")},m(p,g){w(p,e,g),m(e,t),m(t,i),m(t,s),m(s,o),m(t,r),m(t,a),m(t,u),m(t,f),m(f,d)},p(p,g){g&2&&l!==(l=p[1].originalName+"")&&ge(o,l),g&2&&c!==(c=p[1].name+"")&&ge(d,c)},d(p){p&&k(e)}}}function Xc(n){let e,t,i,s,l=n[14].originalName+"",o,r,a,u,f,c=n[14].name+"",d;return{c(){e=_("li"),t=_("div"),i=N(`Renamed field
|
||||
`),s=_("strong"),o=N(l),r=T(),a=_("i"),u=T(),f=_("strong"),d=N(c),h(s,"class","txt-strikethrough txt-hint"),h(a,"class","ri-arrow-right-line txt-sm"),h(f,"class","txt"),h(t,"class","inline-flex")},m(p,g){w(p,e,g),m(e,t),m(t,i),m(t,s),m(s,o),m(t,r),m(t,a),m(t,u),m(t,f),m(f,d)},p(p,g){g&16&&l!==(l=p[14].originalName+"")&&ge(o,l),g&16&&c!==(c=p[14].name+"")&&ge(d,c)},d(p){p&&k(e)}}}function Qc(n){let e,t,i,s=n[14].name+"",l,o;return{c(){e=_("li"),t=N("Removed field "),i=_("span"),l=N(s),o=T(),h(i,"class","txt-bold"),h(e,"class","txt-danger")},m(r,a){w(r,e,a),m(e,t),m(e,i),m(i,l),m(e,o)},p(r,a){a&8&&s!==(s=r[14].name+"")&&ge(l,s)},d(r){r&&k(e)}}}function L$(n){let e,t,i,s,l,o,r,a,u,f,c,d,p=n[3].length&&Gc(),g=n[5]&&Jc(n),v=n[4],b=[];for(let S=0;S<v.length;S+=1)b[S]=Xc(Zc(n,v,S));let y=n[3],$=[];for(let S=0;S<y.length;S+=1)$[S]=Qc(Kc(n,y,S));return{c(){e=_("div"),t=_("div"),t.innerHTML='<i class="ri-error-warning-line"></i>',i=T(),s=_("div"),l=_("p"),l.textContent=`If any of the following changes is part of another collection rule or filter, you'll have to
|
||||
update it manually!`,o=T(),p&&p.c(),r=T(),a=_("h6"),a.textContent="Changes:",u=T(),f=_("ul"),g&&g.c(),c=T();for(let S=0;S<b.length;S+=1)b[S].c();d=T();for(let S=0;S<$.length;S+=1)$[S].c();h(t,"class","icon"),h(s,"class","content txt-bold"),h(e,"class","alert alert-warning"),h(f,"class","changes-list svelte-1ghly2p")},m(S,M){w(S,e,M),m(e,t),m(e,i),m(e,s),m(s,l),m(s,o),p&&p.m(s,null),w(S,r,M),w(S,a,M),w(S,u,M),w(S,f,M),g&&g.m(f,null),m(f,c);for(let C=0;C<b.length;C+=1)b[C].m(f,null);m(f,d);for(let C=0;C<$.length;C+=1)$[C].m(f,null)},p(S,M){if(S[3].length?p||(p=Gc(),p.c(),p.m(s,null)):p&&(p.d(1),p=null),S[5]?g?g.p(S,M):(g=Jc(S),g.c(),g.m(f,c)):g&&(g.d(1),g=null),M&16){v=S[4];let C;for(C=0;C<v.length;C+=1){const D=Zc(S,v,C);b[C]?b[C].p(D,M):(b[C]=Xc(D),b[C].c(),b[C].m(f,d))}for(;C<b.length;C+=1)b[C].d(1);b.length=v.length}if(M&8){y=S[3];let C;for(C=0;C<y.length;C+=1){const D=Kc(S,y,C);$[C]?$[C].p(D,M):($[C]=Qc(D),$[C].c(),$[C].m(f,null))}for(;C<$.length;C+=1)$[C].d(1);$.length=y.length}},d(S){S&&k(e),p&&p.d(),S&&k(r),S&&k(a),S&&k(u),S&&k(f),g&&g.d(),Zn(b,S),Zn($,S)}}}function F$(n){let e;return{c(){e=_("h4"),e.textContent="Confirm collection changes"},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function I$(n){let e,t,i,s,l;return{c(){e=_("button"),e.innerHTML='<span class="txt">Cancel</span>',t=T(),i=_("button"),i.innerHTML='<span class="txt">Confirm</span>',e.autofocus=!0,h(e,"type","button"),h(e,"class","btn btn-secondary"),h(i,"type","button"),h(i,"class","btn btn-expanded")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),e.focus(),s||(l=[Q(e,"click",n[8]),Q(i,"click",n[9])],s=!0)},p:re,d(o){o&&k(e),o&&k(t),o&&k(i),s=!1,Qe(l)}}}function R$(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[I$],header:[F$],default:[L$]},$$scope:{ctx:n}};return e=new ki({props:i}),n[10](e),e.$on("hide",n[11]),e.$on("show",n[12]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,[l]){const o={};l&524346&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[10](null),z(e,s)}}}function N$(n,e,t){let i,s,l;const o=rn();let r,a;async function u(y){t(1,a=y),await oi(),!i&&!s.length&&!l.length?c():r==null||r.show()}function f(){r==null||r.hide()}function c(){f(),o("confirm")}const d=()=>f(),p=()=>c();function g(y){me[y?"unshift":"push"](()=>{r=y,t(2,r)})}function v(y){at.call(this,n,y)}function b(y){at.call(this,n,y)}return n.$$.update=()=>{n.$$.dirty&2&&t(5,i=(a==null?void 0:a.originalName)!=(a==null?void 0:a.name)),n.$$.dirty&2&&t(4,s=(a==null?void 0:a.schema.filter(y=>y.id&&!y.toDelete&&y.originalName!=y.name))||[]),n.$$.dirty&2&&t(3,l=(a==null?void 0:a.schema.filter(y=>y.id&&y.toDelete))||[])},[f,a,r,l,s,i,c,u,d,p,g,v,b]}class H$ extends Oe{constructor(e){super(),De(this,e,N$,R$,Te,{show:7,hide:0})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}}function xc(n){let e,t,i,s;function l(r){n[26](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new P$({props:o}),me.push(()=>Le(t,"collection",l)),{c(){e=_("div"),B(t.$$.fragment),h(e,"class","tab-item active")},m(r,a){w(r,e,a),V(t,e,null),s=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],Ie(()=>i=!1)),t.$set(u)},i(r){s||(A(t.$$.fragment,r),s=!0)},o(r){P(t.$$.fragment,r),s=!1},d(r){r&&k(e),z(t)}}}function j$(n){let e,t,i,s,l,o;function r(f){n[25](f)}let a={};n[2]!==void 0&&(a.collection=n[2]),i=new y$({props:a}),me.push(()=>Le(i,"collection",r));let u=n[9]===dl&&xc(n);return{c(){e=_("div"),t=_("div"),B(i.$$.fragment),l=T(),u&&u.c(),h(t,"class","tab-item"),se(t,"active",n[9]===xi),h(e,"class","tabs-content svelte-b10vi")},m(f,c){w(f,e,c),m(e,t),V(i,t,null),m(e,l),u&&u.m(e,null),o=!0},p(f,c){const d={};!s&&c[0]&4&&(s=!0,d.collection=f[2],Ie(()=>s=!1)),i.$set(d),c[0]&512&&se(t,"active",f[9]===xi),f[9]===dl?u?(u.p(f,c),c[0]&512&&A(u,1)):(u=xc(f),u.c(),A(u,1),u.m(e,null)):u&&(Ee(),P(u,1,1,()=>{u=null}),Ae())},i(f){o||(A(i.$$.fragment,f),A(u),o=!0)},o(f){P(i.$$.fragment,f),P(u),o=!1},d(f){f&&k(e),z(i),u&&u.d()}}}function ed(n){let e,t,i,s,l,o,r;return o=new Ni({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[q$]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=T(),i=_("button"),s=_("i"),l=T(),B(o.$$.fragment),h(e,"class","flex-fill"),h(s,"class","ri-more-line"),h(i,"type","button"),h(i,"class","btn btn-sm btn-circle btn-secondary flex-gap-0")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),m(i,s),m(i,l),V(o,i,null),r=!0},p(a,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:a}),o.$set(f)},i(a){r||(A(o.$$.fragment,a),r=!0)},o(a){P(o.$$.fragment,a),r=!1},d(a){a&&k(e),a&&k(t),a&&k(i),z(o)}}}function q$(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=`<i class="ri-delete-bin-7-line"></i>
|
||||
<span class="txt">Delete</span>`,h(e,"type","button"),h(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[20]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function td(n){let e;return{c(){e=_("div"),e.textContent="System collection",h(e,"class","help-block")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function V$(n){let e,t,i,s,l,o,r,a,u,f,c,d,p=n[2].system&&td();return{c(){e=_("label"),t=N("Name"),s=T(),l=_("input"),u=T(),p&&p.c(),f=st(),h(e,"for",i=n[38]),h(l,"type","text"),h(l,"id",o=n[38]),l.required=!0,l.disabled=n[11],h(l,"spellcheck","false"),l.autofocus=r=n[2].isNew,h(l,"placeholder",'eg. "posts"'),l.value=a=n[2].name},m(g,v){w(g,e,v),m(e,t),w(g,s,v),w(g,l,v),w(g,u,v),p&&p.m(g,v),w(g,f,v),n[2].isNew&&l.focus(),c||(d=Q(l,"input",n[21]),c=!0)},p(g,v){v[1]&128&&i!==(i=g[38])&&h(e,"for",i),v[1]&128&&o!==(o=g[38])&&h(l,"id",o),v[0]&2048&&(l.disabled=g[11]),v[0]&4&&r!==(r=g[2].isNew)&&(l.autofocus=r),v[0]&4&&a!==(a=g[2].name)&&l.value!==a&&(l.value=a),g[2].system?p||(p=td(),p.c(),p.m(f.parentNode,f)):p&&(p.d(1),p=null)},d(g){g&&k(e),g&&k(s),g&&k(l),g&&k(u),p&&p.d(g),g&&k(f),c=!1,d()}}}function nd(n){let e,t,i,s,l,o;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(r,a){w(r,e,a),s=!0,l||(o=Ye(t=wt.call(null,e,n[12])),l=!0)},p(r,a){t&&Vn(t.update)&&a[0]&4096&&t.update.call(null,r[12])},i(r){s||(r&&Ot(()=>{i||(i=lt(e,Hn,{duration:150,start:.7},!0)),i.run(1)}),s=!0)},o(r){r&&(i||(i=lt(e,Hn,{duration:150,start:.7},!1)),i.run(0)),s=!1},d(r){r&&k(e),r&&i&&i.end(),l=!1,o()}}}function id(n){let e,t,i,s,l;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Ye(wt.call(null,e,"Has errors")),s=!0)},i(o){i||(o&&Ot(()=>{t||(t=lt(e,Hn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){o&&(t||(t=lt(e,Hn,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function z$(n){var R,H,te,le,q,Y;let e,t=n[2].isNew?"New collection":"Edit collection",i,s,l,o,r,a,u,f,c,d,p,g,v=!G.isEmpty((R=n[4])==null?void 0:R.schema),b,y,$,S,M=!G.isEmpty((H=n[4])==null?void 0:H.listRule)||!G.isEmpty((te=n[4])==null?void 0:te.viewRule)||!G.isEmpty((le=n[4])==null?void 0:le.createRule)||!G.isEmpty((q=n[4])==null?void 0:q.updateRule)||!G.isEmpty((Y=n[4])==null?void 0:Y.deleteRule),C,D,O,E=!n[2].isNew&&!n[2].system&&ed(n);r=new Pe({props:{class:"form-field required m-b-0 "+(n[11]?"disabled":""),name:"name",$$slots:{default:[V$,({uniqueId:W})=>({38:W}),({uniqueId:W})=>[0,W?128:0]]},$$scope:{ctx:n}}});let F=v&&nd(n),L=M&&id();return{c(){e=_("h4"),i=N(t),s=T(),E&&E.c(),l=T(),o=_("form"),B(r.$$.fragment),a=T(),u=_("input"),f=T(),c=_("div"),d=_("button"),p=_("span"),p.textContent="Fields",g=T(),F&&F.c(),b=T(),y=_("button"),$=_("span"),$.textContent="API Rules",S=T(),L&&L.c(),h(u,"type","submit"),h(u,"class","hidden"),h(u,"tabindex","-1"),h(o,"class","block"),h(p,"class","txt"),h(d,"type","button"),h(d,"class","tab-item"),se(d,"active",n[9]===xi),h($,"class","txt"),h(y,"type","button"),h(y,"class","tab-item"),se(y,"active",n[9]===dl),h(c,"class","tabs-header stretched")},m(W,X){w(W,e,X),m(e,i),w(W,s,X),E&&E.m(W,X),w(W,l,X),w(W,o,X),V(r,o,null),m(o,a),m(o,u),w(W,f,X),w(W,c,X),m(c,d),m(d,p),m(d,g),F&&F.m(d,null),m(c,b),m(c,y),m(y,$),m(y,S),L&&L.m(y,null),C=!0,D||(O=[Q(o,"submit",Wt(n[22])),Q(d,"click",n[23]),Q(y,"click",n[24])],D=!0)},p(W,X){var ue,Me,oe,he,be,K;(!C||X[0]&4)&&t!==(t=W[2].isNew?"New collection":"Edit collection")&&ge(i,t),!W[2].isNew&&!W[2].system?E?(E.p(W,X),X[0]&4&&A(E,1)):(E=ed(W),E.c(),A(E,1),E.m(l.parentNode,l)):E&&(Ee(),P(E,1,1,()=>{E=null}),Ae());const ne={};X[0]&2048&&(ne.class="form-field required m-b-0 "+(W[11]?"disabled":"")),X[0]&2052|X[1]&384&&(ne.$$scope={dirty:X,ctx:W}),r.$set(ne),X[0]&16&&(v=!G.isEmpty((ue=W[4])==null?void 0:ue.schema)),v?F?(F.p(W,X),X[0]&16&&A(F,1)):(F=nd(W),F.c(),A(F,1),F.m(d,null)):F&&(Ee(),P(F,1,1,()=>{F=null}),Ae()),X[0]&512&&se(d,"active",W[9]===xi),X[0]&16&&(M=!G.isEmpty((Me=W[4])==null?void 0:Me.listRule)||!G.isEmpty((oe=W[4])==null?void 0:oe.viewRule)||!G.isEmpty((he=W[4])==null?void 0:he.createRule)||!G.isEmpty((be=W[4])==null?void 0:be.updateRule)||!G.isEmpty((K=W[4])==null?void 0:K.deleteRule)),M?L?X[0]&16&&A(L,1):(L=id(),L.c(),A(L,1),L.m(y,null)):L&&(Ee(),P(L,1,1,()=>{L=null}),Ae()),X[0]&512&&se(y,"active",W[9]===dl)},i(W){C||(A(E),A(r.$$.fragment,W),A(F),A(L),C=!0)},o(W){P(E),P(r.$$.fragment,W),P(F),P(L),C=!1},d(W){W&&k(e),W&&k(s),E&&E.d(W),W&&k(l),W&&k(o),z(r),W&&k(f),W&&k(c),F&&F.d(),L&&L.d(),D=!1,Qe(O)}}}function B$(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=T(),s=_("button"),l=_("span"),r=N(o),h(t,"class","txt"),h(e,"type","button"),h(e,"class","btn btn-secondary"),e.disabled=n[7],h(l,"class","txt"),h(s,"type","button"),h(s,"class","btn btn-expanded"),s.disabled=a=!n[10]||n[7],se(s,"btn-loading",n[7])},m(c,d){w(c,e,d),m(e,t),w(c,i,d),w(c,s,d),m(s,l),m(l,r),u||(f=[Q(e,"click",n[18]),Q(s,"clickLine truncated
|
||||
<span class="txt">New collection</span>`,y=T(),B($.$$.fragment),h(l,"type","button"),h(l,"class","btn btn-xs btn-secondary btn-circle btn-clear"),se(l,"hidden",!n[4]),h(s,"class","form-field-addon"),h(r,"type","text"),h(r,"placeholder","Search collections..."),h(i,"class","form-field search"),se(i,"active",n[4]),h(t,"class","sidebar-header"),h(u,"class","m-t-5 m-b-xs"),h(c,"class","sidebar-content"),h(b,"type","button"),h(b,"class","btn btn-block btn-outline"),h(v,"class","sidebar-footer"),h(e,"class","page-sidebar collection-sidebar")},m(L,R){w(L,e,R),m(e,t),m(t,i),m(i,s),m(s,l),m(i,o),m(i,r),we(r,n[0]),m(e,a),m(e,u),m(e,f),m(e,c);for(let H=0;H<d.length;H+=1)d[H].m(c,null);E&&E.m(c,null),m(e,g),m(e,v),m(v,b),w(L,y,R),V($,L,R),S=!0,M||(C=[Q(l,"click",n[8]),Q(r,"input",n[9]),Q(b,"click",n[11])],M=!0)},p(L,[R]){R&16&&se(l,"hidden",!L[4]),R&1&&r.value!==L[0]&&we(r,L[0]),R&16&&se(i,"active",L[4]),R&106&&(D=L[3],d=St(d,R,O,1,L,D,p,c,Jn,rd,null,sd),!D.length&&E?E.p(L,R):D.length?E&&(E.d(1),E=null):(E=ld(L),E.c(),E.m(c,null)));const H={};$.$set(H)},i(L){S||(A($.$$.fragment,L),S=!0)},o(L){P($.$$.fragment,L),S=!1},d(L){L&&k(e);for(let R=0;R<d.length;R+=1)d[R].d();E&&E.d(),L&&k(y),n[12](null),z($,L),M=!1,Qe(C)}}}function G$(n,e,t){let i,s,l,o,r;kt(n,ii,b=>t(5,o=b)),kt(n,ks,b=>t(7,r=b));let a,u="";function f(b){_n(ii,o=b,o)}const c=()=>t(0,u="");function d(){u=this.value,t(0,u)}const p=b=>f(b),g=()=>a==null?void 0:a.show();function v(b){me[b?"unshift":"push"](()=>{a=b,t(2,a)})}return n.$$.update=()=>{n.$$.dirty&1&&t(1,i=u.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(4,s=u!==""),n.$$.dirty&131&&t(3,l=r.filter(b=>b.name!="profiles"&&(b.id==u||b.name.replace(/\s+/g,"").toLowerCase().includes(i))))},[u,i,a,l,s,o,f,r,c,d,p,g,v]}class J$ extends Oe{constructor(e){super(),De(this,e,G$,Z$,Te,{})}}function X$(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,S,M,C,D,O,E,F,L,R,H,te,le,q,Y,W,X,ne,ue,Me,oe,he,be,K,Se,x,J,ve,Re,Ve,Z,fe,de,ke,Ge;return{c(){e=_("p"),e.innerHTML=`The syntax basically follows the format
|
||||
<code><span class="txt-success">OPERAND</span>
|
||||
<span class="txt-danger">OPERATOR</span>
|
||||
<span class="txt-success">OPERAND</span></code>, where:`,t=T(),i=_("ul"),s=_("li"),s.innerHTML=`<code class="txt-success">OPERAND</code> - could be any of the above field literal, string (single or double
|
||||
quoted), number, null, true, false`,l=T(),o=_("li"),r=_("code"),r.textContent="OPERATOR",a=N(` - is one of:
|
||||
`),u=_("br"),f=T(),c=_("ul"),d=_("li"),p=_("code"),p.textContent="=",g=T(),v=_("span"),v.textContent="Equal",b=T(),y=_("li"),$=_("code"),$.textContent="!=",S=T(),M=_("span"),M.textContent="NOT equal",C=T(),D=_("li"),O=_("code"),O.textContent=">",E=T(),F=_("span"),F.textContent="Greater than",L=T(),R=_("li"),H=_("code"),H.textContent=">=",te=T(),le=_("span"),le.textContent="Greater than or equal",q=T(),Y=_("li"),W=_("code"),W.textContent="<",X=T(),ne=_("span"),ne.textContent="Less than or equal",ue=T(),Me=_("li"),oe=_("code"),oe.textContent="<=",he=T(),be=_("span"),be.textContent="Less than or equal",K=T(),Se=_("li"),x=_("code"),x.textContent="~",J=T(),ve=_("span"),ve.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard
|
||||
match)`,Re=T(),Ve=_("li"),Z=_("code"),Z.textContent="!~",fe=T(),de=_("span"),de.textContent=`NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for
|
||||
wildcard match)`,ke=T(),Ge=_("p"),Ge.innerHTML=`To group and combine several expressions you could use brackets
|
||||
<code>(...)</code>, <code>&&</code> (AND) and <code>||</code> (OR) tokens.`,h(r,"class","txt-danger"),h(p,"class","filter-op svelte-1w7s5nw"),h(v,"class","txt-hint"),h($,"class","filter-op svelte-1w7s5nw"),h(M,"class","txt-hint"),h(O,"class","filter-op svelte-1w7s5nw"),h(F,"class","txt-hint"),h(H,"class","filter-op svelte-1w7s5nw"),h(le,"class","txt-hint"),h(W,"class","filter-op svelte-1w7s5nw"),h(ne,"class","txt-hint"),h(oe,"class","filter-op svelte-1w7s5nw"),h(be,"class","txt-hint"),h(x,"class","filter-op svelte-1w7s5nw"),h(ve,"class","txt-hint"),h(Z,"class","filter-op svelte-1w7s5nw"),h(de,"class","txt-hint")},m(ot,xe){w(ot,e,xe),w(ot,t,xe),w(ot,i,xe),m(i,s),m(i,l),m(i,o),m(o,r),m(o,a),m(o,u),m(o,f),m(o,c),m(c,d),m(d,p),m(d,g),m(d,v),m(c,b),m(c,y),m(y,$),m(y,S),m(y,M),m(c,C),m(c,D),m(D,O),m(D,E),m(D,F),m(c,L),m(c,R),m(R,H),m(R,te),m(R,le),m(c,q),m(c,Y),m(Y,W),m(Y,X),m(Y,ne),m(c,ue),m(c,Me),m(Me,oe),m(Me,he),m(Me,be),m(c,K),m(c,Se),m(Se,x),m(Se,J),m(Se,ve),m(c,Re),m(c,Ve),m(Ve,Z),m(Ve,fe),m(Ve,de),w(ot,ke,xe),w(ot,Ge,xe)},p:re,i:re,o:re,d(ot){ot&&k(e),ot&&k(t),ot&&k(i),ot&&k(ke),ot&&k(Ge)}}}class Q$ extends Oe{constructor(e){super(),De(this,e,null,X$,Te,{})}}function ad(n,e,t){const i=n.slice();return i[5]=e[t],i}function ud(n,e,t){const i=n.slice();return i[5]=e[t],i}function fd(n,e){let t,i,s=e[5].title+"",l,o,r,a;function u(){return e[4](e[5])}return{key:n,first:null,c(){t=_("button"),i=_("div"),l=N(s),o=T(),h(i,"class","txt"),h(t,"class","tab-item svelte-1maocj6"),se(t,"active",e[0]===e[5].language),this.first=t},m(f,c){w(f,t,c),m(t,i),m(i,l),m(t,o),r||(a=Q(t,"click",u),r=!0)},p(f,c){e=f,c&2&&s!==(s=e[5].title+"")&&ge(l,s),c&3&&se(t,"active",e[0]===e[5].language)},d(f){f&&k(t),r=!1,a()}}}function cd(n,e){let t,i,s,l;return i=new gn({props:{language:e[5].language,content:e[5].content}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item svelte-1maocj6"),se(t,"active",e[0]===e[5].language),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&2&&(a.language=e[5].language),r&2&&(a.content=e[5].content),i.$set(a),r&3&&se(t,"active",e[0]===e[5].language)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function x$(n){let e,t,i=[],s=new Map,l,o,r=[],a=new Map,u,f=n[1];const c=g=>g[5].language;for(let g=0;g<f.length;g+=1){let v=ud(n,f,g),b=c(v);s.set(b,i[g]=fd(b,v))}let d=n[1];const p=g=>g[5].language;for(let g=0;g<d.length;g+=1){let v=ad(n,d,g),b=p(v);a.set(b,r[g]=cd(b,v))}return{c(){e=_("div"),t=_("div");for(let g=0;g<i.length;g+=1)i[g].c();l=T(),o=_("div");for(let g=0;g<r.length;g+=1)r[g].c();h(t,"class","tabs-header compact left"),h(o,"class","tabs-content"),h(e,"class","tabs sdk-tabs m-b-lg svelte-1maocj6")},m(g,v){w(g,e,v),m(e,t);for(let b=0;b<i.length;b+=1)i[b].m(t,null);m(e,l),m(e,o);for(let b=0;b<r.length;b+=1)r[b].m(o,null);u=!0},p(g,[v]){v&3&&(f=g[1],i=St(i,v,c,1,g,f,s,t,Jn,fd,null,ud)),v&3&&(d=g[1],Ee(),r=St(r,v,p,1,g,d,a,o,Gt,cd,null,ad),Ae())},i(g){if(!u){for(let v=0;v<d.length;v+=1)A(r[v]);u=!0}},o(g){for(let v=0;v<r.length;v+=1)P(r[v]);u=!1},d(g){g&&k(e);for(let v=0;v<i.length;v+=1)i[v].d();for(let v=0;v<r.length;v+=1)r[v].d()}}}const dd="pb_sdk_preference";function eC(n,e,t){let i,{js:s=""}=e,{dart:l=""}=e,o=localStorage.getItem(dd)||"javascript";const r=a=>t(0,o=a.language);return n.$$set=a=>{"js"in a&&t(2,s=a.js),"dart"in a&&t(3,l=a.dart)},n.$$.update=()=>{n.$$.dirty&1&&o&&localStorage.setItem(dd,o),n.$$.dirty&12&&t(1,i=[{title:"JavaScript",language:"javascript",content:s},{title:"Dart",language:"dart",content:l}])},[o,i,s,l,r]}class Ms extends Oe{constructor(e){super(),De(this,e,eC,x$,Te,{js:2,dart:3})}}function hd(n,e,t){const i=n.slice();return i[6]=e[t],i}function pd(n,e,t){const i=n.slice();return i[6]=e[t],i}function md(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function gd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("div"),s=N(i),l=T(),h(t,"class","tab-item"),se(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=Q(t,"click",a),o=!0)},p(u,f){e=u,f&20&&se(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function _d(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),se(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o,r&20&&se(t,"active",e[2]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function tC(n){var ui,Cl,os,Ml;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y=n[0].name+"",$,S,M,C,D,O,E,F,L,R,H,te,le,q,Y,W,X,ne,ue,Me,oe,he,be,K,Se,x,J,ve,Re,Ve,Z,fe,de,ke,Ge,ot,xe,_t,tt,$t,ze,Be,ct,ie,_e,Ue,nt,rt,Je,Ct,Lt,It,ht,We,Ce,He,et,Mt,Ft,Rt,Et,it,I,j,ee,U=[],ae=new Map,$e,Ke,je=[],ce=new MaLine truncated
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
const resultList = await client.Records.getList('${(ui=n[0])==null?void 0:ui.name}', 1, 50, {
|
||||
filter: 'created >= '2022-01-01 00:00:00'',
|
||||
});
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
const records = await client.Records.getFullList('${(Cl=n[0])==null?void 0:Cl.name}', 200 /* batch size */, {
|
||||
sort: '-created',
|
||||
});
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
final result = await client.records.getList(
|
||||
'${(os=n[0])==null?void 0:os.name}',
|
||||
page: 1,
|
||||
perPage: 50,
|
||||
filter: 'created >= "2022-01-01 00:00:00"',
|
||||
);
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
final records = await client.records.getFullList('${(Ml=n[0])==null?void 0:Ml.name}', batch: 200, sort: '-created');
|
||||
`}}),Z=new gn({props:{content:`
|
||||
// DESC by created and ASC by id
|
||||
?sort=-created,id
|
||||
`}}),$t=new gn({props:{content:`
|
||||
?filter=(id='abc' && created>'2022-01-01')
|
||||
`}}),Be=new Q$({}),Lt=new gn({props:{content:`
|
||||
?expand=rel1,rel2.subrel21.subrel22
|
||||
`}});let dt=n[4];const tn=Ne=>Ne[6].code;for(let Ne=0;Ne<dt.length;Ne+=1){let Xe=pd(n,dt,Ne),Xt=tn(Xe);ae.set(Xt,U[Ne]=gd(Xt,Xe))}let jt=n[4];const wi=Ne=>Ne[6].code;for(let Ne=0;Ne<jt.length;Ne+=1){let Xe=hd(n,jt,Ne),Xt=wi(Xe);ce.set(Xt,je[Ne]=_d(Xt,Xe))}return{c(){e=_("div"),t=_("strong"),t.textContent="GET",i=T(),s=_("div"),l=_("p"),o=N("/api/collections/"),r=_("strong"),u=N(a),f=N("/records"),c=T(),Fe&&Fe.c(),d=T(),p=_("div"),g=_("p"),v=N("Fetch a paginated "),b=_("strong"),$=N(y),S=N(" records list."),M=T(),C=_("div"),C.textContent="Client SDKs example",D=T(),B(O.$$.fragment),E=T(),F=_("div"),F.textContent="Query parameters",L=T(),R=_("table"),H=_("thead"),H.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr>`,te=T(),le=_("tbody"),q=_("tr"),q.innerHTML=`<td>page</td>
|
||||
<td><span class="label">Number</span></td>
|
||||
<td>The page (aka. offset) of the paginated list (default to 1).</td>`,Y=T(),W=_("tr"),W.innerHTML=`<td>perPage</td>
|
||||
<td><span class="label">Number</span></td>
|
||||
<td>Specify the max returned records per page (default to 30).</td>`,X=T(),ne=_("tr"),ue=_("td"),ue.textContent="sort",Me=T(),oe=_("td"),oe.innerHTML='<span class="label">String</span>',he=T(),be=_("td"),K=N("Specify the records order attribute(s). "),Se=_("br"),x=N(`
|
||||
Add `),J=_("code"),J.textContent="-",ve=N(" / "),Re=_("code"),Re.textContent="+",Ve=N(` (default) in front of the attribute for DESC / ASC order.
|
||||
Ex.:
|
||||
`),B(Z.$$.fragment),fe=T(),de=_("tr"),ke=_("td"),ke.textContent="filter",Ge=T(),ot=_("td"),ot.innerHTML='<span class="label">String</span>',xe=T(),_t=_("td"),tt=N(`Filter the returned records. Ex.:
|
||||
`),B($t.$$.fragment),ze=T(),B(Be.$$.fragment),ct=T(),ie=_("tr"),_e=_("td"),_e.textContent="expand",Ue=T(),nt=_("td"),nt.innerHTML='<span class="label">String</span>',rt=T(),Je=_("td"),Ct=N(`Auto expand record relations. Ex.:
|
||||
`),B(Lt.$$.fragment),It=N(`
|
||||
Supports up to 6-levels depth nested relations expansion. `),ht=_("br"),We=N(`
|
||||
The expanded relations will be appended to each individual record under the
|
||||
`),Ce=_("code"),Ce.textContent="@expand",He=N(" property (eg. "),et=_("code"),et.textContent='"@expand": {"rel1": {...}, ...}',Mt=N(`). Only the
|
||||
relations that the user has permissions to `),Ft=_("strong"),Ft.textContent="view",Rt=N(" will be expanded."),Et=T(),it=_("div"),it.textContent="Responses",I=T(),j=_("div"),ee=_("div");for(let Ne=0;Ne<U.length;Ne+=1)U[Ne].c();$e=T(),Ke=_("div");for(let Ne=0;Ne<je.length;Ne+=1)je[Ne].c();h(t,"class","label label-primary"),h(s,"class","content"),h(e,"class","alert alert-info"),h(p,"class","content m-b-base"),h(C,"class","section-title"),h(F,"class","section-title"),h(R,"class","table-compact table-border m-b-lg"),h(it,"class","section-title"),h(ee,"class","tabs-header compact left"),h(Ke,"class","tabs-content"),h(j,"class","tabs")},m(Ne,Xe){w(Ne,e,Xe),m(e,t),m(e,i),m(e,s),m(s,l),m(l,o),m(l,r),m(r,u),m(l,f),m(e,c),Fe&&Fe.m(e,null),w(Ne,d,Xe),w(Ne,p,Xe),m(p,g),m(g,v),m(g,b),m(b,$),m(g,S),w(Ne,M,Xe),w(Ne,C,Xe),w(Ne,D,Xe),V(O,Ne,Xe),w(Ne,E,Xe),w(Ne,F,Xe),w(Ne,L,Xe),w(Ne,R,Xe),m(R,H),m(R,te),m(R,le),m(le,q),m(le,Y),m(le,W),m(le,X),m(le,ne),m(ne,ue),m(ne,Me),m(ne,oe),m(ne,he),m(ne,be),m(be,K),m(be,Se),m(be,x),m(be,J),m(be,ve),m(be,Re),m(be,Ve),V(Z,be,null),m(le,fe),m(le,de),m(de,ke),m(de,Ge),m(de,ot),m(de,xe),m(de,_t),m(_t,tt),V($t,_t,null),m(_t,ze),V(Be,_t,null),m(le,ct),m(le,ie),m(ie,_e),m(ie,Ue),m(ie,nt),m(ie,rt),m(ie,Je),m(Je,Ct),V(Lt,Je,null),m(Je,It),m(Je,ht),m(Je,We),m(Je,Ce),m(Je,He),m(Je,et),m(Je,Mt),m(Je,Ft),m(Je,Rt),w(Ne,Et,Xe),w(Ne,it,Xe),w(Ne,I,Xe),w(Ne,j,Xe),m(j,ee);for(let Xt=0;Xt<U.length;Xt+=1)U[Xt].m(ee,null);m(j,$e),m(j,Ke);for(let Xt=0;Xt<je.length;Xt+=1)je[Xt].m(Ke,null);pe=!0},p(Ne,[Xe]){var Tl,Dl,Ol,El;(!pe||Xe&1)&&a!==(a=Ne[0].name+"")&&ge(u,a),Ne[1]?Fe||(Fe=md(),Fe.c(),Fe.m(e,null)):Fe&&(Fe.d(1),Fe=null),(!pe||Xe&1)&&y!==(y=Ne[0].name+"")&&ge($,y);const Xt={};Xe&9&&(Xt.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${Ne[3]}');
|
||||
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
const resultList = await client.Records.getList('${(Tl=Ne[0])==null?void 0:Tl.name}', 1, 50, {
|
||||
filter: 'created >= '2022-01-01 00:00:00'',
|
||||
});
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
const records = await client.Records.getFullList('${(Dl=Ne[0])==null?void 0:Dl.name}', 200 /* batch size */, {
|
||||
sort: '-created',
|
||||
});
|
||||
`),Xe&9&&(Xt.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${Ne[3]}');
|
||||
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
final result = await client.records.getList(
|
||||
'${(Ol=Ne[0])==null?void 0:Ol.name}',
|
||||
page: 1,
|
||||
perPage: 50,
|
||||
filter: 'created >= "2022-01-01 00:00:00"',
|
||||
);
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
final records = await client.records.getFullList('${(El=Ne[0])==null?void 0:El.name}', batch: 200, sort: '-created');
|
||||
`),O.$set(Xt),Xe&20&&(dt=Ne[4],U=St(U,Xe,tn,1,Ne,dt,ae,ee,Jn,gd,null,pd)),Xe&20&&(jt=Ne[4],Ee(),je=St(je,Xe,wi,1,Ne,jt,ce,Ke,Gt,_d,null,hd),Ae())},i(Ne){if(!pe){A(O.$$.fragment,Ne),A(Z.$$.fragment,Ne),A($t.$$.fragment,Ne),A(Be.$$.fragment,Ne),A(Lt.$$.fragment,Ne);for(let Xe=0;Xe<jt.length;Xe+=1)A(je[Xe]);pe=!0}},o(Ne){P(O.$$.fragment,Ne),P(Z.$$.fragment,Ne),P($t.$$.fragment,Ne),P(Be.$$.fragment,Ne),P(Lt.$$.fragment,Ne);for(let Xe=0;Xe<je.length;Xe+=1)P(je[Xe]);pe=!1},d(Ne){Ne&&k(e),Fe&&Fe.d(),Ne&&k(d),Ne&&k(p),Ne&&k(M),Ne&&k(C),Ne&&k(D),z(O,Ne),Ne&&k(E),Ne&&k(F),Ne&&k(L),Ne&&k(R),z(Z),z($t),z(Be),z(Lt),Ne&&k(Et),Ne&&k(it),Ne&&k(I),Ne&&k(j);for(let Xe=0;Xe<U.length;Xe+=1)U[Xe].d();for(let Xe=0;Xe<je.length;Xe+=1)je[Xe].d()}}}function nC(n,e,t){let i,s,{collection:l=new On}=e,o=200,r=[];const a=u=>t(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.listRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:200,body:JSON.stringify({page:1,perPage:30,totalItems:2,items:[G.dummyCollectionRecord(l),G.dummyCollectionRecord(l)]},null,2)}),r.push({code:400,body:`
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Something went wrong while processing your request. Invalid filter.",
|
||||
"data": {}
|
||||
}
|
||||
`}),i&&r.push({code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "Only admins can access this action.",
|
||||
"data": {}
|
||||
}
|
||||
`}),r.push({code:404,body:`
|
||||
{
|
||||
"code": 404,
|
||||
"message": "The requested resource wasn't found.",
|
||||
"data": {}
|
||||
}
|
||||
`}))},t(3,s=window.location.href.substring(0,window.location.href.indexOf("/_"))||ye.baseUrl),[l,i,o,s,r,a]}class iC extends Oe{constructor(e){super(),De(this,e,nC,tC,Te,{collection:0})}}function bd(n,e,t){const i=n.slice();return i[6]=e[t],i}function vd(n,e,t){const i=n.slice();return i[6]=e[t],i}function yd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function kd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=N(i),l=T(),h(t,"class","tab-item"),se(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=Q(t,"click",a),o=!0)},p(u,f){e=u,f&20&&se(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function wd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),se(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o,r&20&&se(t,"active",e[2]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function sC(n){var ht,We;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y,$=n[0].name+"",S,M,C,D,O,E,F,L,R,H,te,le,q,Y,W,X,ne,ue,Me,oe,he,be,K,Se,x,J,ve,Re,Ve,Z,fe,de,ke,Ge,ot,xe,_t,tt,$t,ze=[],Be=new Map,ct,ie,_e=[],Ue=new Map,nt,rt=n[1]&&yd();E=new Ms({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
const record = await client.Records.getOne('${(ht=n[0])==null?void 0:ht.name}', 'RECORD_ID', {
|
||||
expand: 'some_relation'
|
||||
});
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
final record = await client.records.getOne('${(We=n[0])==null?void 0:We.name}', 'RECORD_ID', query: {
|
||||
'expand': 'some_relation',
|
||||
});
|
||||
`}}),x=new gn({props:{content:`
|
||||
?expand=rel1,rel2.subrel21.subrel22
|
||||
`}});let Je=n[4];const Ct=Ce=>Ce[6].code;for(let Ce=0;Ce<Je.length;Ce+=1){let He=vd(n,Je,Ce),et=Ct(He);Be.set(et,ze[Ce]=kd(et,He))}let Lt=n[4];const It=Ce=>Ce[6].code;for(let Ce=0;Ce<Lt.length;Ce+=1){let He=bd(n,Lt,Ce),et=It(He);Ue.set(et,_e[Ce]=wd(et,He))}return{c(){e=_("div"),t=_("strong"),t.textContent="GET",i=T(),s=_("div"),l=_("p"),o=N("/api/collections/"),r=_("strong"),u=N(a),f=N("/records/"),c=_("strong"),c.textContent=":id",d=T(),rt&&rt.c(),p=T(),g=_("div"),v=_("p"),b=N("Fetch a single "),y=_("strong"),S=N($),M=N(" record."),C=T(),D=_("div"),D.textContent="Client SDKs example",O=T(),B(E.$$.fragment),F=T(),L=_("div"),L.textContent="Path Parameters",R=T(),H=_("table"),H.innerHTML=`<thead><tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr></thead>
|
||||
<tbody><tr><td>id</td>
|
||||
<td><span class="label">String</span></td>
|
||||
<td>ID of the record to view.</td></tr></tbody>`,te=T(),le=_("div"),le.textContent="Query parameters",q=T(),Y=_("table"),W=_("thead"),W.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr>`,X=T(),ne=_("tbody"),ue=_("tr"),Me=_("td"),Me.textContent="expand",oe=T(),he=_("td"),he.innerHTML='<span class="label">String</span>',be=T(),K=_("td"),Se=N(`Auto expand record relations. Ex.:
|
||||
`),B(x.$$.fragment),J=N(`
|
||||
Supports up to 6-levels depth nested relations expansion. `),ve=_("br"),Re=N(`
|
||||
The expanded relations will be appended to the record under the
|
||||
`),Ve=_("code"),Ve.textContent="@expand",Z=N(" property (eg. "),fe=_("code"),fe.textContent='"@expand": {"rel1": {...}, ...}',de=N(`). Only the
|
||||
relations that the user has permissions to `),ke=_("strong"),ke.textContent="view",Ge=N(" will be expanded."),ot=T(),xe=_("div"),xe.textContent="Responses",_t=T(),tt=_("div"),$t=_("div");for(let Ce=0;Ce<ze.length;Ce+=1)ze[Ce].c();ct=T(),ie=_("div");for(let Ce=0;Ce<_e.length;Ce+=1)_e[Ce].c();h(t,"class","label label-primary"),h(s,"class","content"),h(e,"class","alert alert-info"),h(g,"class","content m-b-base"),h(D,"class","section-title"),h(L,"class","section-title"),h(H,"class","table-compact table-border m-b-lg"),h(le,"class","section-title"),h(Y,"class","table-compact table-border m-b-lg"),h(xe,"class","section-title"),h($t,"class","tabs-header compact left"),h(ie,"class","tabs-content"),h(tt,"class","tabs")},m(Ce,He){w(Ce,e,He),m(e,t),m(e,i),m(e,s),m(s,l),m(l,o),m(l,r),m(r,u),m(l,f),m(l,c),m(e,d),rt&&rt.m(e,null),w(Ce,p,He),w(Ce,g,He),m(g,v),m(v,b),m(v,y),m(y,S),m(v,M),w(Ce,C,He),w(Ce,D,He),w(Ce,O,He),V(E,Ce,He),w(Ce,F,He),w(Ce,L,He),w(Ce,R,He),w(Ce,H,He),w(Ce,te,He),w(Ce,le,He),w(Ce,q,He),w(Ce,Y,He),m(Y,W),m(Y,X),m(Y,ne),m(ne,ue),m(ue,Me),m(ue,oe),m(ue,he),m(ue,be),m(ue,K),m(K,Se),V(x,K,null),m(K,J),m(K,ve),m(K,Re),m(K,Ve),m(K,Z),m(K,fe),m(K,de),m(K,ke),m(K,Ge),w(Ce,ot,He),w(Ce,xe,He),w(Ce,_t,He),w(Ce,tt,He),m(tt,$t);for(let et=0;et<ze.length;et+=1)ze[et].m($t,null);m(tt,ct),m(tt,ie);for(let et=0;et<_e.length;et+=1)_e[et].m(ie,null);nt=!0},p(Ce,[He]){var Mt,Ft;(!nt||He&1)&&a!==(a=Ce[0].name+"")&&ge(u,a),Ce[1]?rt||(rt=yd(),rt.c(),rt.m(e,null)):rt&&(rt.d(1),rt=null),(!nt||He&1)&&$!==($=Ce[0].name+"")&&ge(S,$);const et={};He&9&&(et.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${Ce[3]}');
|
||||
|
||||
...
|
||||
|
||||
const record = await client.Records.getOne('${(Mt=Ce[0])==null?void 0:Mt.name}', 'RECORD_ID', {
|
||||
expand: 'some_relation'
|
||||
});
|
||||
`),He&9&&(et.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${Ce[3]}');
|
||||
|
||||
...
|
||||
|
||||
final record = await client.records.getOne('${(Ft=Ce[0])==null?void 0:Ft.name}', 'RECORD_ID', query: {
|
||||
'expand': 'some_relation',
|
||||
});
|
||||
`),E.$set(et),He&20&&(Je=Ce[4],ze=St(ze,He,Ct,1,Ce,Je,Be,$t,Jn,kd,null,vd)),He&20&&(Lt=Ce[4],Ee(),_e=St(_e,He,It,1,Ce,Lt,Ue,ie,Gt,wd,null,bd),Ae())},i(Ce){if(!nt){A(E.$$.fragment,Ce),A(x.$$.fragment,Ce);for(let He=0;He<Lt.length;He+=1)A(_e[He]);nt=!0}},o(Ce){P(E.$$.fragment,Ce),P(x.$$.fragment,Ce);for(let He=0;He<_e.length;He+=1)P(_e[He]);nt=!1},d(Ce){Ce&&k(e),rt&&rt.d(),Ce&&k(p),Ce&&k(g),Ce&&k(C),Ce&&k(D),Ce&&k(O),z(E,Ce),Ce&&k(F),Ce&&k(L),Ce&&k(R),Ce&&k(H),Ce&&k(te),Ce&&k(le),Ce&&k(q),Ce&&k(Y),z(x),Ce&&k(ot),Ce&&k(xe),Ce&&k(_t),Ce&&k(tt);for(let He=0;He<ze.length;He+=1)ze[He].d();for(let He=0;He<_e.length;He+=1)_e[He].d()}}}function lC(n,e,t){let i,s,{collection:l=new On}=e,o=200,r=[];const a=u=>t(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.viewRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:200,body:JSON.stringify(G.dummyCollectionRecord(l),null,2)}),i&&r.push({code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "Only admins can access this action.",
|
||||
"data": {}
|
||||
}
|
||||
`}),r.push({code:404,body:`
|
||||
{
|
||||
"code": 404,
|
||||
"message": "The requested resource wasn't found.",
|
||||
"data": {}
|
||||
}
|
||||
`}))},t(3,s=window.location.href.substring(0,window.location.href.indexOf("/_"))||ye.baseUrl),[l,i,o,s,r,a]}class oC extends Oe{constructor(e){super(),De(this,e,lC,sC,Te,{collection:0})}}function Sd(n,e,t){const i=n.slice();return i[6]=e[t],i}function $d(n,e,t){const i=n.slice();return i[6]=e[t],i}function Cd(n,e,t){const i=n.slice();return i[11]=e[t],i}function Md(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function rC(n){let e;return{c(){e=_("span"),e.textContent="Optional",h(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function aC(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function uC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=N("User "),i=N(t),s=N(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ge(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function fC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=N("Relation record "),i=N(t),s=N(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ge(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function cC(n){let e,t,i,s,l;return{c(){e=N("FormData object."),t=_("br"),i=N(`
|
||||
Set to `),s=_("code"),s.textContent="null",l=N(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:re,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function dC(n){let e;return{c(){e=N("URL address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function hC(n){let e;return{c(){e=N("Email address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function pC(n){let e;return{c(){e=N("JSON array or object.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function mC(n){let e;return{c(){e=N("Number value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function gC(n){let e;return{c(){e=N("Plain text value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Td(n,e){let t,i,s,l,o,r=e[11].name+"",a,u,f,c,d=G.getFieldValueType(e[11])+"",p,g,v,b;function y(O,E){return O[11].required?aC:rC}let $=y(e),S=$(e);function M(O,E){if(O[11].type==="text")return gC;if(O[11].type==="number")return mC;if(O[11].type==="json")return pC;if(O[11].type==="email")return hC;if(O[11].type==="url")return dC;if(O[11].type==="file")return cC;if(O[11].type==="relation")return fC;if(O[11].type==="user")return uC}let C=M(e),D=C&&C(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),S.c(),l=T(),o=_("span"),a=N(r),u=T(),f=_("td"),c=_("span"),p=N(d),g=T(),v=_("td"),D&&D.c(),b=T(),h(s,"class","inline-flex"),h(c,"class","label"),this.first=t},m(O,E){w(O,t,E),m(t,i),m(i,s),S.m(s,null),m(s,l),m(s,o),m(o,a),m(t,u),m(t,f),m(f,c),m(c,p),m(t,g),m(t,v),D&&D.m(v,null),m(t,b)},p(O,E){e=O,$!==($=y(e))&&(S.d(1),S=$(e),S&&(S.c(),S.m(s,l))),E&1&&r!==(r=e[11].name+"")&&ge(a,r),E&1&&d!==(d=G.getFieldValueType(e[11])+"")&&ge(p,d),C===(C=M(e))&&D?D.p(e,E):(D&&D.d(1),D=C&&C(e),D&&(D.c(),D.m(v,null)))},d(O){O&&k(t),S.d(),D&&D.d()}}}function Dd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=N(i),l=T(),h(t,"class","tab-item"),se(t,"active",e[1]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=Q(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[6].code+"")&&ge(s,i),f&6&&se(t,"active",e[1]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Od(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),se(t,"active",e[1]===e[6].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[6].body),i.$set(a),r&6&&se(t,"active",e[1]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function _C(n){var I,j,ee;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y=n[0].name+"",$,S,M,C,D,O,E,F,L,R,H,te,le,q,Y,W,X,ne=[],ue=new Map,Me,oe,he,be,K,Se,x,J,ve,Re,Ve,Z,fe,de,ke,Ge,ot,xe,_t,tt,$t,ze,Be,ct,ie,_e,Ue,nt,rt,Je=[],Ct=new Map,Lt,It,ht=[],We=new Map,Ce,He=n[4]&&Md();R=new Ms({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.Records.create('${(I=n[0])==null?void 0:I.name}', data);
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
final body = <String, dynamic>{ ... };
|
||||
|
||||
final record = await client.records.create('${(j=n[0])==null?void 0:j.name}', body: body);
|
||||
`}});let et=(ee=n[0])==null?void 0:ee.schema;const Mt=U=>U[11].name;for(let U=0;U<et.length;U+=1){let ae=Cd(n,et,U),$e=Mt(ae);ue.set($e,ne[U]=Td($e,ae))}ke=new gn({props:{content:`
|
||||
?expand=rel1,rel2.subrel21.subrel22
|
||||
`}});let Ft=n[2];const Rt=U=>U[6].code;for(let U=0;U<Ft.length;U+=1){let ae=$d(n,Ft,U),$e=Rt(ae);Ct.set($e,Je[U]=Dd($e,ae))}let Et=n[2];const it=U=>U[6].code;for(let U=0;U<Et.length;U+=1){let ae=Sd(n,Et,U),$e=it(ae);We.set($e,ht[U]=Od($e,ae))}return{c(){e=_("div"),t=_("strong"),t.textContent="POST",i=T(),s=_("div"),l=_("p"),o=N("/api/collections/"),r=_("strong"),u=N(a),f=N("/records"),c=T(),He&&He.c(),d=T(),p=_("div"),g=_("p"),v=N("Create a new "),b=_("strong"),$=N(y),S=N(" record."),M=T(),C=_("p"),C.innerHTML=`Body parameters could be sent as <code>application/json</code> or
|
||||
<code>multipart/form-data</code>.`,D=T(),O=_("p"),O.innerHTML="File upload is supported only via <code>multipart/form-data</code>.",E=T(),F=_("div"),F.textContent="Client SDKs example",L=T(),B(R.$$.fragment),H=T(),te=_("div"),te.textContent="Body Parameters",le=T(),q=_("table"),Y=_("thead"),Y.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="50%">Description</th></tr>`,W=T(),X=_("tbody");for(let U=0;U<ne.length;U+=1)ne[U].c();Me=T(),oe=_("div"),oe.textContent="Query parameters",he=T(),be=_("table"),K=_("thead"),K.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr>`,Se=T(),x=_("tbody"),J=_("tr"),ve=_("td"),ve.textContent="expand",Re=T(),Ve=_("td"),Ve.innerHTML='<span class="label">String</span>',Z=T(),fe=_("td"),de=N(`Auto expand relations when returning the created record. Ex.:
|
||||
`),B(ke.$$.fragment),Ge=N(`
|
||||
Supports up to 6-levels depth nested relations expansion. `),ot=_("br"),xe=N(`
|
||||
The expanded relations will be appended to the record under the
|
||||
`),_t=_("code"),_t.textContent="@expand",tt=N(" property (eg. "),$t=_("code"),$t.textContent='"@expand": {"rel1": {...}, ...}',ze=N(`). Only the
|
||||
relations that the user has permissions to `),Be=_("strong"),Be.textContent="view",ct=N(" will be expanded."),ie=T(),_e=_("div"),_e.textContent="Responses",Ue=T(),nt=_("div"),rt=_("div");for(let U=0;U<Je.length;U+=1)Je[U].c();Lt=T(),It=_("div");for(let U=0;U<ht.length;U+=1)ht[U].c();h(t,"class","label label-primary"),h(s,"class","content"),h(e,"class","alert alert-success"),h(p,"class","content m-b-base"),h(F,"class","section-title"),h(te,"class","section-title"),h(q,"class","table-compact table-border m-b-lg"),h(oe,"class","section-title"),h(be,"class","table-compact table-border m-b-lg"),h(_e,"class","section-title"),h(rt,"class","tabs-header compact left"),h(It,"class","tabs-content"),h(nt,"class","tabs")},m(U,ae){w(U,e,ae),m(e,t),m(e,i),m(e,s),m(s,l),m(l,o),m(l,r),m(r,u),m(l,f),m(e,c),He&&He.m(e,null),w(U,d,ae),w(U,p,ae),m(p,g),m(g,v),m(g,b),m(b,$),m(g,S),m(p,M),m(p,C),m(p,D),m(p,O),w(U,E,ae),w(U,F,ae),w(U,L,ae),V(R,U,ae),w(U,H,ae),w(U,te,ae),w(U,le,ae),w(U,q,ae),m(q,Y),m(q,W),m(q,X);for(let $e=0;$e<ne.length;$e+=1)ne[$e].m(X,null);w(U,Me,ae),w(U,oe,ae),w(U,he,ae),w(U,be,ae),m(be,K),m(be,Se),m(be,x),m(x,J),m(J,ve),m(J,Re),m(J,Ve),m(J,Z),m(J,fe),m(fe,de),V(ke,fe,null),m(fe,Ge),m(fe,ot),m(fe,xe),m(fe,_t),m(fe,tt),m(fe,$t),m(fe,ze),m(fe,Be),m(fe,ct),w(U,ie,ae),w(U,_e,ae),w(U,Ue,ae),w(U,nt,ae),m(nt,rt);for(let $e=0;$e<Je.length;$e+=1)Je[$e].m(rt,null);m(nt,Lt),m(nt,It);for(let $e=0;$e<ht.length;$e+=1)ht[$e].m(It,null);Ce=!0},p(U,[ae]){var Ke,je,ce;(!Ce||ae&1)&&a!==(a=U[0].name+"")&&ge(u,a),U[4]?He||(He=Md(),He.c(),He.m(e,null)):He&&(He.d(1),He=null),(!Ce||ae&1)&&y!==(y=U[0].name+"")&&ge($,y);const $e={};ae&9&&($e.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${U[3]}');
|
||||
|
||||
...
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.Records.create('${(Ke=U[0])==null?void 0:Ke.name}', data);
|
||||
`),ae&9&&($e.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${U[3]}');
|
||||
|
||||
...
|
||||
|
||||
final body = <String, dynamic>{ ... };
|
||||
|
||||
final record = await client.records.create('${(je=U[0])==null?void 0:je.name}', body: body);
|
||||
`),R.$set($e),ae&1&&(et=(ce=U[0])==null?void 0:ce.schema,ne=St(ne,ae,Mt,1,U,et,ue,X,Jn,Td,null,Cd)),ae&6&&(Ft=U[2],Je=St(Je,ae,Rt,1,U,Ft,Ct,rt,Jn,Dd,null,$d)),ae&6&&(Et=U[2],Ee(),ht=St(ht,ae,it,1,U,Et,We,It,Gt,Od,null,Sd),Ae())},i(U){if(!Ce){A(R.$$.fragment,U),A(ke.$$.fragment,U);for(let ae=0;ae<Et.length;ae+=1)A(ht[ae]);Ce=!0}},o(U){P(R.$$.fragment,U),P(ke.$$.fragment,U);for(let ae=0;ae<ht.length;ae+=1)P(ht[ae]);Ce=!1},d(U){U&&k(e),He&&He.d(),U&&k(d),U&&k(p),U&&k(E),U&&k(F),U&&k(L),z(R,U),U&&k(H),U&&k(te),U&&k(le),U&&k(q);for(let ae=0;ae<ne.length;ae+=1)ne[ae].d();U&&k(Me),U&&k(oe),U&&k(he),U&&k(be),z(ke),U&&k(ie),U&&k(_e),U&&k(Ue),U&&k(nt);for(let ae=0;ae<Je.length;ae+=1)Je[ae].d();for(let ae=0;ae<ht.length;ae+=1)ht[ae].d()}}}function bC(n,e,t){let i,s,{collection:l=new On}=e,o=200,r=[];const a=u=>t(1,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{var u,f;n.$$.dirty&1&&t(4,i=(l==null?void 0:l.createRule)===null),n.$$.dirty&1&&t(2,r=[{code:200,body:JSON.stringify(G.dummyCollectionRecord(l),null,2)},{code:400,body:`
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Failed to create record.",
|
||||
"data": {
|
||||
"${(f=(u=l==null?void 0:l.schema)==null?void 0:u[0])==null?void 0:f.name}": {
|
||||
"code": "validation_required",
|
||||
"message": "Missing required value."
|
||||
}
|
||||
}
|
||||
}
|
||||
`},{code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "You are not allowed to perform this request.",
|
||||
"data": {}
|
||||
}
|
||||
`}])},t(3,s=window.location.href.substring(0,window.location.href.indexOf("/_"))||ye.baseUrl),[l,o,r,s,i,a]}class vC extends Oe{constructor(e){super(),De(this,e,bC,_C,Te,{collection:0})}}function Ed(n,e,t){const i=n.slice();return i[6]=e[t],i}function Ad(n,e,t){const i=n.slice();return i[6]=e[t],i}function Pd(n,e,t){const i=n.slice();return i[11]=e[t],i}function Ld(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function yC(n){let e;return{c(){e=_("span"),e.textContent="Optional",h(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function kC(n){let e;return{c(){e=_("span"),e.textContent="Required",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function wC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=N("User "),i=N(t),s=N(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ge(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function SC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=N("Relation record "),i=N(t),s=N(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ge(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function $C(n){let e,t,i,s,l;return{c(){e=N("FormData object."),t=_("br"),i=N(`
|
||||
Set to `),s=_("code"),s.textContent="null",l=N(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:re,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function CC(n){let e;return{c(){e=N("URL address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function MC(n){let e;return{c(){e=N("Email address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function TC(n){let e;return{c(){e=N("JSON array or object.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function DC(n){let e;return{c(){e=N("Number value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function OC(n){let e;return{c(){e=N("Plain text value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Fd(n,e){let t,i,s,l,o,r=e[11].name+"",a,u,f,c,d=G.getFieldValueType(e[11])+"",p,g,v,b;function y(O,E){return O[11].required?kC:yC}let $=y(e),S=$(e);function M(O,E){if(O[11].type==="text")return OC;if(O[11].type==="number")return DC;if(O[11].type==="json")return TC;if(O[11].type==="email")return MC;if(O[11].type==="url")return CC;if(O[11].type==="file")return $C;if(O[11].type==="relation")return SC;if(O[11].type==="user")return wC}let C=M(e),D=C&&C(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),S.c(),l=T(),o=_("span"),a=N(r),u=T(),f=_("td"),c=_("span"),p=N(d),g=T(),v=_("td"),D&&D.c(),b=T(),h(s,"class","inline-flex"),h(c,"class","label"),this.first=t},m(O,E){w(O,t,E),m(t,i),m(i,s),S.m(s,null),m(s,l),m(s,o),m(o,a),m(t,u),m(t,f),m(f,c),m(c,p),m(t,g),m(t,v),D&&D.m(v,null),m(t,b)},p(O,E){e=O,$!==($=y(e))&&(S.d(1),S=$(e),S&&(S.c(),S.m(s,l))),E&1&&r!==(r=e[11].name+"")&&ge(a,r),E&1&&d!==(d=G.getFieldValueType(e[11])+"")&&ge(p,d),C===(C=M(e))&&D?D.p(e,E):(D&&D.d(1),D=C&&C(e),D&&(D.c(),D.m(v,null)))},d(O){O&&k(t),S.d(),D&&D.d()}}}function Id(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=N(i),l=T(),h(t,"class","tab-item"),se(t,"active",e[1]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=Q(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[6].code+"")&&ge(s,i),f&6&&se(t,"active",e[1]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Rd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),se(t,"active",e[1]===e[6].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[6].body),i.$set(a),r&6&&se(t,"active",e[1]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function EC(n){var $e,Ke,je;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y,$=n[0].name+"",S,M,C,D,O,E,F,L,R,H,te,le,q,Y,W,X,ne,ue,Me,oe,he,be=[],K=new Map,Se,x,J,ve,Re,Ve,Z,fe,de,ke,Ge,ot,xe,_t,tt,$t,ze,Be,ct,ie,_e,Ue,nt,rt,Je,Ct,Lt,It,ht,We=[],Ce=new Map,He,et,Mt=[],Ft=new Map,Rt,Et=n[4]&&Ld();H=new Ms({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.Records.update('${($e=n[0])==null?void 0:$e.name}', 'RECORD_ID', data);
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
final body = <String, dynamic>{ ... };
|
||||
|
||||
final record = await client.records.update('${(Ke=n[0])==null?void 0:Ke.name}', 'RECORD_ID', body: body);
|
||||
`}});let it=(je=n[0])==null?void 0:je.schema;const I=ce=>ce[11].name;for(let ce=0;ce<it.length;ce+=1){let pe=Pd(n,it,ce),Fe=I(pe);K.set(Fe,be[ce]=Fd(Fe,pe))}tt=new gn({props:{content:`
|
||||
?expand=rel1,rel2.subrel21.subrel22
|
||||
`}});let j=n[2];const ee=ce=>ce[6].code;for(let ce=0;ce<j.length;ce+=1){let pe=Ad(n,j,ce),Fe=ee(pe);Ce.set(Fe,We[ce]=Id(Fe,pe))}let U=n[2];const ae=ce=>ce[6].code;for(let ce=0;ce<U.length;ce+=1){let pe=Ed(n,U,ce),Fe=ae(pe);Ft.set(Fe,Mt[ce]=Rd(Fe,pe))}return{c(){e=_("div"),t=_("strong"),t.textContent="PATCH",i=T(),s=_("div"),l=_("p"),o=N("/api/collections/"),r=_("strong"),u=N(a),f=N("/records/"),c=_("strong"),c.textContent=":id",d=T(),Et&&Et.c(),p=T(),g=_("div"),v=_("p"),b=N("Update a single "),y=_("strong"),S=N($),M=N(" record."),C=T(),D=_("p"),D.innerHTML=`Body parameters could be sent as <code>application/json</code> or
|
||||
<code>multipart/form-data</code>.`,O=T(),E=_("p"),E.innerHTML="File upload is supported only via <code>multipart/form-data</code>.",F=T(),L=_("div"),L.textContent="Client SDKs example",R=T(),B(H.$$.fragment),te=T(),le=_("div"),le.textContent="Path parameters",q=T(),Y=_("table"),Y.innerHTML=`<thead><tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr></thead>
|
||||
<tbody><tr><td>id</td>
|
||||
<td><span class="label">String</span></td>
|
||||
<td>ID of the record to update.</td></tr></tbody>`,W=T(),X=_("div"),X.textContent="Body Parameters",ne=T(),ue=_("table"),Me=_("thead"),Me.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="50%">Description</th></tr>`,oe=T(),he=_("tbody");for(let ce=0;ce<be.length;ce+=1)be[ce].c();Se=T(),x=_("div"),x.textContent="Query parameters",J=T(),ve=_("table"),Re=_("thead"),Re.innerHTML=`<tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr>`,Ve=T(),Z=_("tbody"),fe=_("tr"),de=_("td"),de.textContent="expand",ke=T(),Ge=_("td"),Ge.innerHTML='<span class="label">String</span>',ot=T(),xe=_("td"),_t=N(`Auto expand relations when returning the updated record. Ex.:
|
||||
`),B(tt.$$.fragment),$t=N(`
|
||||
Supports up to 6-levels depth nested relations expansion. `),ze=_("br"),Be=N(`
|
||||
The expanded relations will be appended to the record under the
|
||||
`),ct=_("code"),ct.textContent="@expand",ie=N(" property (eg. "),_e=_("code"),_e.textContent='"@expand": {"rel1": {...}, ...}',Ue=N(`). Only the
|
||||
relations that the user has permissions to `),nt=_("strong"),nt.textContent="view",rt=N(" will be expanded."),Je=T(),Ct=_("div"),Ct.textContent="Responses",Lt=T(),It=_("div"),ht=_("div");for(let ce=0;ce<We.length;ce+=1)We[ce].c();He=T(),et=_("div");for(let ce=0;ce<Mt.length;ce+=1)Mt[ce].c();h(t,"class","label label-primary"),h(s,"class","content"),h(e,"class","alert alert-warning"),h(g,"class","content m-b-base"),h(L,"class","section-title"),h(le,"class","section-title"),h(Y,"class","table-compact table-border m-b-lg"),h(X,"class","section-title"),h(ue,"class","table-compact table-border m-b-lg"),h(x,"class","section-title"),h(ve,"class","table-compact table-border m-b-lg"),h(Ct,"class","section-title"),h(ht,"class","tabs-header compact left"),h(et,"class","tabs-content"),h(It,"class","tabs")},m(ce,pe){w(ce,e,pe),m(e,t),m(e,i),m(e,s),m(s,l),m(l,o),m(l,r),m(r,u),m(l,f),m(l,c),m(e,d),Et&&Et.m(e,null),w(ce,p,pe),w(ce,g,pe),m(g,v),m(v,b),m(v,y),m(y,S),m(v,M),m(g,C),m(g,D),m(g,O),m(g,E),w(ce,F,pe),w(ce,L,pe),w(ce,R,pe),V(H,ce,pe),w(ce,te,pe),w(ce,le,pe),w(ce,q,pe),w(ce,Y,pe),w(ce,W,pe),w(ce,X,pe),w(ce,ne,pe),w(ce,ue,pe),m(ue,Me),m(ue,oe),m(ue,he);for(let Fe=0;Fe<be.length;Fe+=1)be[Fe].m(he,null);w(ce,Se,pe),w(ce,x,pe),w(ce,J,pe),w(ce,ve,pe),m(ve,Re),m(ve,Ve),m(ve,Z),m(Z,fe),m(fe,de),m(fe,ke),m(fe,Ge),m(fe,ot),m(fe,xe),m(xe,_t),V(tt,xe,null),m(xe,$t),m(xe,ze),m(xe,Be),m(xe,ct),m(xe,ie),m(xe,_e),m(xe,Ue),m(xe,nt),m(xe,rt),w(ce,Je,pe),w(ce,Ct,pe),w(ce,Lt,pe),w(ce,It,pe),m(It,ht);for(let Fe=0;Fe<We.length;Fe+=1)We[Fe].m(ht,null);m(It,He),m(It,et);for(let Fe=0;Fe<Mt.length;Fe+=1)Mt[Fe].m(et,null);Rt=!0},p(ce,[pe]){var dt,tn,jt;(!Rt||pe&1)&&a!==(a=ce[0].name+"")&&ge(u,a),ce[4]?Et||(Et=Ld(),Et.c(),Et.m(e,null)):Et&&(Et.d(1),Et=null),(!Rt||pe&1)&&$!==($=ce[0].name+"")&&ge(S,$);const Fe={};pe&9&&(Fe.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${ce[3]}');
|
||||
|
||||
...
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.Records.update('${(dt=ce[0])==null?void 0:dt.name}', 'RECORD_ID', data);
|
||||
`),pe&9&&(Fe.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${ce[3]}');
|
||||
|
||||
...
|
||||
|
||||
final body = <String, dynamic>{ ... };
|
||||
|
||||
final record = await client.records.update('${(tn=ce[0])==null?void 0:tn.name}', 'RECORD_ID', body: body);
|
||||
`),H.$set(Fe),pe&1&&(it=(jt=ce[0])==null?void 0:jt.schema,be=St(be,pe,I,1,ce,it,K,he,Jn,Fd,null,Pd)),pe&6&&(j=ce[2],We=St(We,pe,ee,1,ce,j,Ce,ht,Jn,Id,null,Ad)),pe&6&&(U=ce[2],Ee(),Mt=St(Mt,pe,ae,1,ce,U,Ft,et,Gt,Rd,null,Ed),Ae())},i(ce){if(!Rt){A(H.$$.fragment,ce),A(tt.$$.fragment,ce);for(let pe=0;pe<U.length;pe+=1)A(Mt[pe]);Rt=!0}},o(ce){P(H.$$.fragment,ce),P(tt.$$.fragment,ce);for(let pe=0;pe<Mt.length;pe+=1)P(Mt[pe]);Rt=!1},d(ce){ce&&k(e),Et&&Et.d(),ce&&k(p),ce&&k(g),ce&&k(F),ce&&k(L),ce&&k(R),z(H,ce),ce&&k(te),ce&&k(le),ce&&k(q),ce&&k(Y),ce&&k(W),ce&&k(X),ce&&k(ne),ce&&k(ue);for(let pe=0;pe<be.length;pe+=1)be[pe].d();ce&&k(Se),ce&&k(x),ce&&k(J),ce&&k(ve),z(tt),ce&&k(Je),ce&&k(Ct),ce&&k(Lt),ce&&k(It);for(let pe=0;pe<We.length;pe+=1)We[pe].d();for(let pe=0;pe<Mt.length;pe+=1)Mt[pe].d()}}}function AC(n,e,t){let i,s,{collection:l=new On}=e,o=200,r=[];const a=u=>t(1,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{var u,f;n.$$.dirty&1&&t(4,i=(l==null?void 0:l.updateRule)===null),n.$$.dirty&1&&t(2,r=[{code:200,body:JSON.stringify(G.dummyCollectionRecord(l),null,2)},{code:400,body:`
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Failed to update record.",
|
||||
"data": {
|
||||
"${(f=(u=l==null?void 0:l.schema)==null?void 0:u[0])==null?void 0:f.name}": {
|
||||
"code": "validation_required",
|
||||
"message": "Missing required value."
|
||||
}
|
||||
}
|
||||
}
|
||||
`},{code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "You are not allowed to perform this request.",
|
||||
"data": {}
|
||||
}
|
||||
`},{code:404,body:`
|
||||
{
|
||||
"code": 404,
|
||||
"message": "The requested resource wasn't found.",
|
||||
"data": {}
|
||||
}
|
||||
`}])},t(3,s=window.location.href.substring(0,window.location.href.indexOf("/_"))||ye.baseUrl),[l,o,r,s,i,a]}class PC extends Oe{constructor(e){super(),De(this,e,AC,EC,Te,{collection:0})}}function Nd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Hd(n,e,t){const i=n.slice();return i[6]=e[t],i}function jd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires <code>Authorization: Admin TOKEN</code> header",h(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function qd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=N(i),l=T(),h(t,"class","tab-item"),se(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=Q(t,"click",a),o=!0)},p(u,f){e=u,f&20&&se(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Vd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),B(i.$$.fragment),s=T(),h(t,"class","tab-item"),se(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),V(i,t,null),m(t,s),l=!0},p(o,r){e=o,r&20&&se(t,"active",e[2]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),z(i)}}}function LC(n){var Re,Ve;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,p,g,v,b,y,$=n[0].name+"",S,M,C,D,O,E,F,L,R,H,te,le,q,Y,W,X=[],ne=new Map,ue,Me,oe=[],he=new Map,be,K=n[1]&&jd();E=new Ms({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
await client.Records.delete('${(Re=n[0])==null?void 0:Re.name}', 'RECORD_ID');
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[3]}');
|
||||
|
||||
...
|
||||
|
||||
await client.records.delete('${(Ve=n[0])==null?void 0:Ve.name}', 'RECORD_ID');
|
||||
`}});let Se=n[4];const x=Z=>Z[6].code;for(let Z=0;Z<Se.length;Z+=1){let fe=Hd(n,Se,Z),de=x(fe);ne.set(de,X[Z]=qd(de,fe))}let J=n[4];const ve=Z=>Z[6].code;for(let Z=0;Z<J.length;Z+=1){let fe=Nd(n,J,Z),de=ve(fe);he.set(de,oe[Z]=Vd(de,fe))}return{c(){e=_("div"),t=_("strong"),t.textContent="DELETE",i=T(),s=_("div"),l=_("p"),o=N("/api/collections/"),r=_("strong"),u=N(a),f=N("/records/"),c=_("strong"),c.textContent=":id",d=T(),K&&K.c(),p=T(),g=_("div"),v=_("p"),b=N("Delete a single "),y=_("strong"),S=N($),M=N(" record."),C=T(),D=_("div"),D.textContent="Client SDKs example",O=T(),B(E.$$.fragment),F=T(),L=_("div"),L.textContent="Path parameters",R=T(),H=_("table"),H.innerHTML=`<thead><tr><th>Param</th>
|
||||
<th>Type</th>
|
||||
<th width="60%">Description</th></tr></thead>
|
||||
<tbody><tr><td>id</td>
|
||||
<td><span class="label">String</span></td>
|
||||
<td>ID of the record to delete.</td></tr></tbody>`,te=T(),le=_("div"),le.textContent="Responses",q=T(),Y=_("div"),W=_("div");for(let Z=0;Z<X.length;Z+=1)X[Z].c();ue=T(),Me=_("div");for(let Z=0;Z<oe.length;Z+=1)oe[Z].c();h(t,"class","label label-primary"),h(s,"class","content"),h(e,"class","alert alert-danger"),h(g,"class","content m-b-base"),h(D,"class","section-title"),h(L,"class","section-title"),h(H,"class","table-compact table-border m-b-lg"),h(le,"class","section-title"),h(W,"class","tabs-header compact left"),h(Me,"class","tabs-content"),h(Y,"class","tabs")},m(Z,fe){w(Z,e,fe),m(e,t),m(e,i),m(e,s),m(s,l),m(l,o),m(l,r),m(r,u),m(l,f),m(l,c),m(e,d),K&&K.m(e,null),w(Z,p,fe),w(Z,g,fe),m(g,v),m(v,b),m(v,y),m(y,S),m(v,M),w(Z,C,fe),w(Z,D,fe),w(Z,O,fe),V(E,Z,fe),w(Z,F,fe),w(Z,L,fe),w(Z,R,fe),w(Z,H,fe),w(Z,te,fe),w(Z,le,fe),w(Z,q,fe),w(Z,Y,fe),m(Y,W);for(let de=0;de<X.length;de+=1)X[de].m(W,null);m(Y,ue),m(Y,Me);for(let de=0;de<oe.length;de+=1)oe[de].m(Me,null);be=!0},p(Z,[fe]){var ke,Ge;(!be||fe&1)&&a!==(a=Z[0].name+"")&&ge(u,a),Z[1]?K||(K=jd(),K.c(),K.m(e,null)):K&&(K.d(1),K=null),(!be||fe&1)&&$!==($=Z[0].name+"")&&ge(S,$);const de={};fe&9&&(de.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${Z[3]}');
|
||||
|
||||
...
|
||||
|
||||
await client.Records.delete('${(ke=Z[0])==null?void 0:ke.name}', 'RECORD_ID');
|
||||
`),fe&9&&(de.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${Z[3]}');
|
||||
|
||||
...
|
||||
|
||||
await client.records.delete('${(Ge=Z[0])==null?void 0:Ge.name}', 'RECORD_ID');
|
||||
`),E.$set(de),fe&20&&(Se=Z[4],X=St(X,fe,x,1,Z,Se,ne,W,Jn,qd,null,Hd)),fe&20&&(J=Z[4],Ee(),oe=St(oe,fe,ve,1,Z,J,he,Me,Gt,Vd,null,Nd),Ae())},i(Z){if(!be){A(E.$$.fragment,Z);for(let fe=0;fe<J.length;fe+=1)A(oe[fe]);be=!0}},o(Z){P(E.$$.fragment,Z);for(let fe=0;fe<oe.length;fe+=1)P(oe[fe]);be=!1},d(Z){Z&&k(e),K&&K.d(),Z&&k(p),Z&&k(g),Z&&k(C),Z&&k(D),Z&&k(O),z(E,Z),Z&&k(F),Z&&k(L),Z&&k(R),Z&&k(H),Z&&k(te),Z&&k(le),Z&&k(q),Z&&k(Y);for(let fe=0;fe<X.length;fe+=1)X[fe].d();for(let fe=0;fe<oe.length;fe+=1)oe[fe].d()}}}function FC(n,e,t){let i,s,{collection:l=new On}=e,o=204,r=[];const a=u=>t(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.deleteRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:204,body:`
|
||||
null
|
||||
`}),r.push({code:400,body:`
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Failed to delete record. Make sure that the record is not part of a required relation reference.",
|
||||
"data": {}
|
||||
}
|
||||
`}),i&&r.push({code:403,body:`
|
||||
{
|
||||
"code": 403,
|
||||
"message": "Only admins can access this action.",
|
||||
"data": {}
|
||||
}
|
||||
`}),r.push({code:404,body:`
|
||||
{
|
||||
"code": 404,
|
||||
"message": "The requested resource wasn't found.",
|
||||
"data": {}
|
||||
}
|
||||
`}))},t(3,s=window.location.href.substring(0,window.location.href.indexOf("/_"))||ye.baseUrl),[l,i,o,s,r,a]}class IC extends Oe{constructor(e){super(),De(this,e,FC,LC,Te,{collection:0})}}function RC(n){var p,g,v,b,y,$,S,M;let e,t,i,s,l,o,r,a,u,f,c,d;return r=new Ms({props:{js:`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${n[1]}');
|
||||
|
||||
...
|
||||
|
||||
// (Optionally) authenticate
|
||||
client.Users.authViaEmail('test@example.com', '123456');
|
||||
|
||||
// Subscribe to changes in any record from the collection
|
||||
client.Realtime.subscribe('${(p=n[0])==null?void 0:p.name}', function (e) {
|
||||
console.log(e.record);
|
||||
});
|
||||
|
||||
// Subscribe to changes in a single record
|
||||
client.Realtime.subscribe('${(g=n[0])==null?void 0:g.name}/RECORD_ID', function (e) {
|
||||
console.log(e.record);
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
client.Realtime.unsubscribe() // remove all subscriptions
|
||||
client.Realtime.unsubscribe('${(v=n[0])==null?void 0:v.name}') // remove only the collection subscription
|
||||
client.Realtime.unsubscribe('${(b=n[0])==null?void 0:b.name}/RECORD_ID') // remove only the record subscription
|
||||
`,dart:`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${n[1]}');
|
||||
|
||||
...
|
||||
|
||||
// (Optionally) authenticate
|
||||
client.users.authViaEmail('test@example.com', '123456');
|
||||
|
||||
// Subscribe to changes in any record from the collection
|
||||
client.realtime.subscribe('${(y=n[0])==null?void 0:y.name}', (e) {
|
||||
print(e.record);
|
||||
});
|
||||
|
||||
// Subscribe to changes in a single record
|
||||
client.realtime.subscribe('${($=n[0])==null?void 0:$.name}/RECORD_ID', (e) {
|
||||
print(e.record);
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
client.realtime.unsubscribe() // remove all subscriptions
|
||||
client.realtime.unsubscribe('${(S=n[0])==null?void 0:S.name}') // remove only the collection subscription
|
||||
client.realtime.unsubscribe('${(M=n[0])==null?void 0:M.name}/RECORD_ID') // remove only the record subscription
|
||||
`}}),c=new gn({props:{content:JSON.stringify({action:"create",record:G.dummyCollectionRecord(n[0])},null,2).replace('"action": "create"','"action": "create" // create, update or delete')}}),{c(){e=_("div"),e.innerHTML=`<strong class="label label-primary">SSE</strong>
|
||||
<div class="content"><p>/api/realtime</p></div>`,t=T(),i=_("div"),i.innerHTML=`<p>Subscribe to realtime changes via Server-Sent Events (SSE).</p>
|
||||
<p>Events are send for <strong>create</strong>, <strong>update</strong>
|
||||
and <strong>delete</strong> record operations (see "Event data format" section below).</p>
|
||||
<div class="alert alert-info m-t-10"><div class="icon"><i class="ri-information-line"></i></div>
|
||||
<div class="contet"><p><strong>You could subscribe to a single record or to an entire collection.</strong></p>
|
||||
<p>When you subscribe to a <strong>single record</strong>, the collection's
|
||||
<strong>ViewRule</strong> will be used to determine whether the subscriber has access to receive
|
||||
the event message.</p>
|
||||
<p>When you subscribe to an <strong>entire collection</strong>, the collection's
|
||||
<strong>ListRule</strong> will be used to determine whether the subscriber has access to receive
|
||||
the event message.</p></div></div>`,s=T(),l=_("div"),l.textContent="Client SDKs example",o=T(),B(r.$$.fragment),a=T(),u=_("div"),u.textContent="Event data format",f=T(),B(c.$$.fragment),h(e,"class","alert"),h(i,"class","content m-b-base"),h(l,"class","section-title"),h(u,"class","section-title")},m(C,D){w(C,e,D),w(C,t,D),w(C,i,D),w(C,s,D),w(C,l,D),w(C,o,D),V(r,C,D),w(C,a,D),w(C,u,D),w(C,f,D),V(c,C,D),d=!0},p(C,[D]){var F,L,R,H,te,le,q,Y;const O={};D&3&&(O.js=`
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
const client = new PocketBase('${C[1]}');
|
||||
|
||||
...
|
||||
|
||||
// (Optionally) authenticate
|
||||
client.Users.authViaEmail('test@example.com', '123456');
|
||||
|
||||
// Subscribe to changes in any record from the collection
|
||||
client.Realtime.subscribe('${(F=C[0])==null?void 0:F.name}', function (e) {
|
||||
console.log(e.record);
|
||||
});
|
||||
|
||||
// Subscribe to changes in a single record
|
||||
client.Realtime.subscribe('${(L=C[0])==null?void 0:L.name}/RECORD_ID', function (e) {
|
||||
console.log(e.record);
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
client.Realtime.unsubscribe() // remove all subscriptions
|
||||
client.Realtime.unsubscribe('${(R=C[0])==null?void 0:R.name}') // remove only the collection subscription
|
||||
client.Realtime.unsubscribe('${(H=C[0])==null?void 0:H.name}/RECORD_ID') // remove only the record subscription
|
||||
`),D&3&&(O.dart=`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
final client = PocketBase('${C[1]}');
|
||||
|
||||
...
|
||||
|
||||
// (Optionally) authenticate
|
||||
client.users.authViaEmail('test@example.com', '123456');
|
||||
|
||||
// Subscribe to changes in any record from the collection
|
||||
client.realtime.subscribe('${(te=C[0])==null?void 0:te.name}', (e) {
|
||||
print(e.record);
|
||||
});
|
||||
|
||||
// Subscribe to changes in a single record
|
||||
client.realtime.subscribe('${(le=C[0])==null?void 0:le.name}/RECORD_ID', (e) {
|
||||
print(e.record);
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
client.realtime.unsubscribe() // remove all subscriptions
|
||||
client.realtime.unsubscribe('${(q=C[0])==null?void 0:q.name}') // remove only the collection subscription
|
||||
client.realtime.unsubscribe('${(Y=C[0])==null?void 0:Y.name}/RECORD_ID') // remove only the record subscription
|
||||
`),r.$set(O);const E={};D&1&&(E.content=JSON.stringify({action:"create",record:G.dummyCollectionRecord(C[0])},null,2).replace('"action": "create"','"action": "create" // create, update or delete')),c.$set(E)},i(C){d||(A(r.$$.fragment,C),A(c.$$.fragment,C),d=!0)},o(C){P(r.$$.fragment,C),P(c.$$.fragment,C),d=!1},d(C){C&&k(e),C&&k(t),C&&k(i),C&&k(s),C&&k(l),C&&k(o),z(r,C),C&&k(a),C&&k(u),C&&k(f),z(c,C)}}}function NC(n,e,t){let i,{collection:s=new On}=e;return n.$$set=l=>{"collection"in l&&t(0,s=l.collection)},t(1,i=window.location.href.substring(0,window.location.href.indexOf("/_"))||ye.baseUrl),[s,i]}class HC extends Oe{constructor(e){super(),De(this,e,NC,RC,Te,{collection:0})}}function zd(n,e,t){const i=n.slice();return i[14]=e[t],i}function Bd(n,e,t){const i=n.slice();return i[14]=e[t],i}function Ud(n){let e,t,i,s;var l=n[14].component;function o(r){return{props:{collection:r[3]}}}return l&&(t=new l(o(n))),{c(){e=_("div"),t&&B(t.$$.fragment),i=T(),h(e,"class","tab-item active")},m(r,a){w(r,e,a),t&&V(t,e,null),m(e,i),s=!0},p(r,a){const u={};if(a&8&&(u.collection=r[3]),l!==(l=r[14].component)){if(t){Ee();const f=t;P(f.$$.fragment,1,0,()=>{z(f,1)}),Ae()}l?(t=new l(o(r)),B(t.$$.fragment),A(t.$$.fragment,1),V(t,e,i)):t=null}else l&&t.$set(u)},i(r){s||(t&&A(t.$$.fragment,r),s=!0)},o(r){t&&P(t.$$.fragment,r),s=!1},d(r){r&&k(e),t&&z(t)}}}function Wd(n,e){let t,i,s,l=e[4]===e[14].id&&Ud(e);return{key:n,first:null,c(){t=st(),l&&l.c(),i=st(),this.first=t},m(o,r){w(o,t,r),l&&l.m(o,r),w(o,i,r),s=!0},p(o,r){e=o,e[4]===e[14].id?l?(l.p(e,r),r&16&&A(l,1)):(l=Ud(e),l.c(),A(l,1),l.m(i.parentNode,i)):l&&(Ee(),P(l,1,1,()=>{l=null}),Ae())},i(o){s||(A(l),s=!0)},o(o){P(l),s=!1},d(o){o&&k(t),l&&l.d(o),o&&k(i)}}}function jC(n){let e,t=[],i=new Map,s,l=n[5];const o=r=>r[14].id;for(let r=0;r<l.length;r+=1){let a=zd(n,l,r),u=o(a);i.set(u,t[r]=Wd(u,a))}return{c(){e=_("div");for(let r=0;r<t.length;r+=1)t[r].c();h(e,"class","tabs-content")},m(r,a){w(r,e,a);for(let u=0;u<t.length;u+=1)t[u].m(e,null);s=!0},p(r,a){a&56&&(l=r[5],Ee(),t=St(t,a,o,1,r,l,i,e,Gt,Wd,null,zd),Ae())},i(r){if(!s){for(let a=0;a<l.length;a+=1)A(t[a]);s=!0}},o(r){for(let a=0;a<t.length;a+=1)P(t[a]);s=!1},d(r){r&&k(e);for(let a=0;a<t.length;a+=1)t[a].d()}}}function Yd(n,e){let t,i,s=e[14].label+"",l,o,r,a;function u(){return e[9](e[14])}function f(...c){return e[10](e[14],...c)}return{key:n,first:null,c(){t=_("button"),i=_("span"),l=N(s),o=T(),h(i,"class","txt"),h(t,"tabindex","0"),h(t,"class","tab-item"),se(t,"active",e[4]===e[14].id),this.first=t},m(c,d){w(c,t,d),m(t,i),m(i,l),m(t,o),r||(a=[Q(t,"click",u),Q(t,"keydown",wp(f))],r=!0)},p(c,d){e=c,d&48&&se(t,"active",e[4]===e[14].id)},d(c){c&&k(t),r=!1,Qe(a)}}}function qC(n){let e,t,i=n[3].name+"",s,l,o,r,a=[],u=new Map,f=n[5];const c=d=>d[14].id;for(let d=0;d<f.length;d+=1){let p=Bd(n,f,d),g=c(p);u.set(g,a[d]=Yd(g,p))}return{c(){e=_("h4"),t=_("strong"),s=N(i),l=N(" records API"),o=T(),r=_("div");for(let d=0;d<a.length;d+=1)a[d].c();h(r,"class","tabs-header stretched")},m(d,p){w(d,e,p),m(e,t),m(t,s),m(e,l),w(d,o,p),w(d,r,p);for(let g=0;g<a.length;g+=1)a[g].m(r,null)},p(d,p){p&8&&i!==(i=d[3].name+"")&&ge(s,i),p&114&&(f=d[5],a=St(a,p,c,1,d,f,u,r,Jn,Yd,null,Bd))},d(d){d&&k(e),d&&k(o),d&&k(r);for(let p=0;p<a.length;p+=1)a[p].d()}}}function VC(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Close</span>',h(e,"type","button"),h(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[8]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function zC(n){let e,t,i={class:"overlay-panel-xl colored-header collection-panel",$$slots:{footer:[VC],header:[qC],default:[jC]},$$scope:{ctx:n}};return e=new ki({props:i}),n[11](e),e.$on("hide",n[12]),e.$on("show",n[13]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,[l]){const o={};l&524312&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[11](null),z(e,s)}}}function BC(n,e,t){const i=[{id:"list",label:"List",component:iC},{id:"view",label:"View",component:oC},{id:"create",label:"Create",component:vC},{id:"update",label:"Update",component:PC},{id:"delete",label:"Delete",component:IC},{id:"realtime",label:"Realtime",component:HC}];let s,l=new On,o=i[0].id;function r(y){return t(3,l=y),u(i[0].id),s==null?void 0:s.show()}function a(){return s==null?void 0:s.hide()}function u(y){t(4,o=y)}function f(y,$){(y.code==="Enter"||y.code==="Space")&&(y.preventDefault(),u($))}const c=()=>a(),d=y=>u(y.id),p=(y,$)=>f($,y.id);function g(y){me[y?"unshift":"push"](()=>{s=y,t(2,s)})}function v(y){at.call(this,n,y)}function b(y){at.call(this,n,y)}return[a,u,s,l,o,i,f,r,c,d,p,g,v,b]}class UC extends Oe{constructor(e){super(),De(this,e,BC,zC,Te,{show:7,hide:0,changeTab:1})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}get changeTab(){return this.$$.ctx[1]}}function WC(n){let e,t,i,s=[n[3]],l={};for(let o=0;o<s.length;o+=1)l=ft(l,s[o]);return{c(){e=_("textarea"),si(e,l),se(e,"svelte-1x1pbts",!0)},m(o,r){w(o,e,r)
Line truncated
|
||||
<span class="txt">Upload new file</span>`,h(t,"type","file"),h(t,"class","hidden"),t.multiple=n[5],h(s,"type","button"),h(s,"class","btn btn-secondary btn-sm btn-block"),h(e,"class","list-item btn-list-item")},m(r,a){w(r,e,a),m(e,t),n[16](t),m(e,i),m(e,s),l||(o=[Q(t,"change",n[17]),Q(s,"click",n[18])],l=!0)},p(r,a){a&32&&(t.multiple=r[5])},d(r){r&&k(e),n[16](null),l=!1,Qe(o)}}}function B3(n){let e,t,i,s,l,o=n[3].name+"",r,a,u,f,c=[],d=new Map,p,g,v,b=n[4];const y=D=>D[25];for(let D=0;D<b.length;D+=1){let O=Gd(n,b,D),E=y(O);d.set(E,c[D]=Jd(E,O))}let $=n[0],S=[];for(let D=0;D<$.length;D+=1)S[D]=Xd(Zd(n,$,D));const M=D=>P(S[D],1,1,()=>{S[D]=null});let C=!n[8]&&Qd(n);return{c(){e=_("label"),t=_("i"),s=T(),l=_("span"),r=N(o),u=T(),f=_("div");for(let D=0;D<c.length;D+=1)c[D].c();p=T();for(let D=0;D<S.length;D+=1)S[D].c();g=T(),C&&C.c(),h(t,"class",i=G.getFieldTypeIcon(n[3].type)),h(l,"class","txt"),h(e,"for",a=n[21]),h(f,"class","files-list")},m(D,O){w(D,e,O),m(e,t),m(e,s),m(e,l),m(l,r),w(D,u,O),w(D,f,O);for(let E=0;E<c.length;E+=1)c[E].m(f,null);m(f,p);for(let E=0;E<S.length;E+=1)S[E].m(f,null);m(f,g),C&&C.m(f,null),n[19](f),v=!0},p(D,O){if((!v||O&8&&i!==(i=G.getFieldTypeIcon(D[3].type)))&&h(t,"class",i),(!v||O&8)&&o!==(o=D[3].name+"")&&ge(r,o),(!v||O&2097152&&a!==(a=D[21]))&&h(e,"for",a),O&1558&&(b=D[4],Ee(),c=St(c,O,y,1,D,b,d,f,Gt,Jd,p,Gd),Ae()),O&2049){$=D[0];let E;for(E=0;E<$.length;E+=1){const F=Zd(D,$,E);S[E]?(S[E].p(F,O),A(S[E],1)):(S[E]=Xd(F),S[E].c(),A(S[E],1),S[E].m(f,g))}for(Ee(),E=$.length;E<S.length;E+=1)M(E);Ae()}D[8]?C&&(C.d(1),C=null):C?C.p(D,O):(C=Qd(D),C.c(),C.m(f,null))},i(D){if(!v){for(let O=0;O<b.length;O+=1)A(c[O]);for(let O=0;O<$.length;O+=1)A(S[O]);v=!0}},o(D){for(let O=0;O<c.length;O+=1)P(c[O]);S=S.filter(Boolean);for(let O=0;O<S.length;O+=1)P(S[O]);v=!1},d(D){D&&k(e),D&&k(u),D&&k(f);for(let O=0;O<c.length;O+=1)c[O].d();Zn(S,D),C&&C.d(),n[19](null)}}}function U3(n){let e,t;return e=new Pe({props:{class:"form-field form-field-file "+(n[3].required?"required":""),name:n[3].name,$$slots:{default:[B3,({uniqueId:i})=>({21:i}),({uniqueId:i})=>i?2097152:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&8&&(l.class="form-field form-field-file "+(i[3].required?"required":"")),s&8&&(l.name=i[3].name),s&136315391&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function W3(n,e,t){let i,s,l,{record:o}=e,{value:r=""}=e,{uploadedFiles:a=[]}=e,{deletedFileIndexes:u=[]}=e,{field:f=new bn}=e,c,d;function p(E){G.removeByValue(u,E),t(1,u)}function g(E){G.pushUnique(u,E),t(1,u)}function v(E){G.isEmpty(a[E])||a.splice(E,1),t(0,a)}function b(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:r,uploadedFiles:a,deletedFileIndexes:u},bubbles:!0}))}const y=E=>p(E),$=E=>g(E),S=E=>v(E);function M(E){me[E?"unshift":"push"](()=>{c=E,t(6,c)})}const C=()=>{for(let E of c.files)a.push(E);t(0,a),t(6,c.value=null,c)},D=()=>c==null?void 0:c.click();function O(E){me[E?"unshift":"push"](()=>{d=E,t(7,d)})}return n.$$set=E=>{"record"in E&&t(2,o=E.record),"value"in E&&t(12,r=E.value),"uploadedFiles"in E&&t(0,a=E.uploadedFiles),"deletedFileIndexes"in E&&t(1,u=E.deletedFileIndexes),"field"in E&&t(3,f=E.field)},n.$$.update=()=>{var E,F;n.$$.dirty&1&&(Array.isArray(a)||t(0,a=G.toArray(a))),n.$$.dirty&2&&(Array.isArray(u)||t(1,u=G.toArray(u))),n.$$.dirty&8&&t(5,i=((E=f.options)==null?void 0:E.maxSelect)>1),n.$$.dirty&4128&&G.isEmpty(r)&&t(12,r=i?[]:""),n.$$.dirty&4096&&t(4,s=G.toArray(r)),n.$$.dirty&27&&t(8,l=(s.length||a.length)&&((F=f.options)==null?void 0:F.maxSelect)<=s.length+a.length-u.length),n.$$.dirty&3&&(a!==-1||u!==-1)&&b()},[a,u,o,f,s,i,c,d,l,p,g,v,r,y,$,S,M,C,D,O]}class Y3 extends Oe{constructor(e){super(),De(this,e,W3,U3,Te,{record:2,value:12,uploadedFiles:0,deletedFileIndexes:1,field:3})}}function xd(n){let e,t;return{c(){e=_("small"),t=N(n[1]),h(e,"class","block txt-hint txt-ellipsis")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s&2&&ge(t,i[1])},d(i){i&&k(e)}}}function K3(n){let e,t,i,s,l,o=n[0].id+"",r,a,u,f,c=n[1]!==""&&n[1]!==n[0].id&&xd(n);return{c(){e=_("i"),i=T(),s=_("div"),l=_("div"),r=N(o),a=T(),c&&c.c(),h(e,"class","ri-information-line link-hint"),h(l,"class","block txt-ellipsis"),h(s,"class","content svelte-1gjwqyd")},m(d,p){w(d,e,p),w(d,i,p),w(d,s,p),m(s,l),m(l,r),m(s,a),c&&c.m(s,null),u||(f=Ye(t=wt.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),u=!0)},p(d,[p]){t&&Vn(t.update)&&p&1&&t.update.call(null,{text:JSON.stringify(d[0],null,2),position:"left",class:"code"}),p&1&&o!==(o=d[0].id+"")&&ge(r,o),d[1]!==""&&d[1]!==d[0].id?c?c.p(d,p):(c=xd(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i:re,o:re,d(d){d&&k(e),d&&k(i),d&&k(s),c&&c.d(),u=!1,f()}}}function Z3(n,e,t){let i;const s=["id","created","updated","@collectionId","@collectionName"];let{item:l={}}=e;function o(r){r=r||{};const a=["name","title","label","key","email","heading","content",...ObjectLine truncated
|
||||
`,h(e,"class","block txt-center txt-disabled")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function m4(n){let e,t,i;function s(o){n[31](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new h4({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function g4(n){let e,t,i;function s(o){n[30](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new i4({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function _4(n){let e,t,i,s,l;function o(f){n[27](f,n[40])}function r(f){n[28](f,n[40])}function a(f){n[29](f,n[40])}let u={field:n[40],record:n[2]};return n[2][n[40].name]!==void 0&&(u.value=n[2][n[40].name]),n[3][n[40].name]!==void 0&&(u.uploadedFiles=n[3][n[40].name]),n[4][n[40].name]!==void 0&&(u.deletedFileIndexes=n[4][n[40].name]),e=new Y3({props:u}),me.push(()=>Le(e,"value",o)),me.push(()=>Le(e,"uploadedFiles",r)),me.push(()=>Le(e,"deletedFileIndexes",a)),{c(){B(e.$$.fragment)},m(f,c){V(e,f,c),l=!0},p(f,c){n=f;const d={};c[0]&1&&(d.field=n[40]),c[0]&4&&(d.record=n[2]),!t&&c[0]&5&&(t=!0,d.value=n[2][n[40].name],Ie(()=>t=!1)),!i&&c[0]&9&&(i=!0,d.uploadedFiles=n[3][n[40].name],Ie(()=>i=!1)),!s&&c[0]&17&&(s=!0,d.deletedFileIndexes=n[4][n[40].name],Ie(()=>s=!1)),e.$set(d)},i(f){l||(A(e.$$.fragment,f),l=!0)},o(f){P(e.$$.fragment,f),l=!1},d(f){z(e,f)}}}function b4(n){let e,t,i;function s(o){n[26](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new C3({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function v4(n){let e,t,i;function s(o){n[25](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new k3({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function y4(n){let e,t,i;function s(o){n[24](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new _3({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function k4(n){let e,t,i;function s(o){n[23](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new h3({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function w4(n){let e,t,i;function s(o){n[22](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new u3({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function S4(n){let e,t,i;function s(o){n[21](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new l3({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function $4(n){let e,t,i;function s(o){n[20](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new t3({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],Ie(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){P(e.$$.fragment,o),i=!1},d(o){z(e,o)}}}function C4(n){let e,t,i;function s(o){n[19](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new XC({props:l}),me.push(()=>Le(e,"value",s)),{c(){B(e.$$.fragment)},m(o,r){V(e,o,r),i=!0},p(o,r){n=o;
Line truncated
|
||||
<span class="txt">Delete</span>`,h(e,"tabindex","0"),h(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[18]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function D4(n){let e,t=n[2].isNew?"New":"Edit",i,s,l=n[0].name+"",o,r,a,u,f,c=!n[2].isNew&&n[10]&&ah(n);return{c(){e=_("h4"),i=N(t),s=T(),o=N(l),r=N(" record"),a=T(),c&&c.c(),u=st()},m(d,p){w(d,e,p),m(e,i),m(e,s),m(e,o),m(e,r),w(d,a,p),c&&c.m(d,p),w(d,u,p),f=!0},p(d,p){(!f||p[0]&4)&&t!==(t=d[2].isNew?"New":"Edit")&&ge(i,t),(!f||p[0]&1)&&l!==(l=d[0].name+"")&&ge(o,l),!d[2].isNew&&d[10]?c?(c.p(d,p),p[0]&1028&&A(c,1)):(c=ah(d),c.c(),A(c,1),c.m(u.parentNode,u)):c&&(Ee(),P(c,1,1,()=>{c=null}),Ae())},i(d){f||(A(c),f=!0)},o(d){P(c),f=!1},d(d){d&&k(e),d&&k(a),c&&c.d(d),d&&k(u)}}}function O4(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=T(),s=_("button"),l=_("span"),r=N(o),h(t,"class","txt"),h(e,"type","button"),h(e,"class","btn btn-secondary"),e.disabled=n[7],h(l,"class","txt"),h(s,"type","submit"),h(s,"form",n[11]),h(s,"class","btn btn-expanded"),s.disabled=a=!n[9]||n[7],se(s,"btn-loading",n[7])},m(c,d){w(c,e,d),m(e,t),w(c,i,d),w(c,s,d),m(s,l),m(l,r),u||(f=Q(e,"click",n[17]),u=!0)},p(c,d){d[0]&128&&(e.disabled=c[7]),d[0]&4&&o!==(o=c[2].isNew?"Create":"Save changes")&&ge(r,o),d[0]&640&&a!==(a=!c[9]||c[7])&&(s.disabled=a),d[0]&128&&se(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,f()}}}function E4(n){let e,t,i={class:"overlay-panel-lg record-panel",beforeHide:n[32],$$slots:{footer:[O4],header:[D4],default:[M4]},$$scope:{ctx:n}};return e=new ki({props:i}),n[33](e),e.$on("hide",n[34]),e.$on("show",n[35]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const o={};l[0]&288&&(o.beforeHide=s[32]),l[0]&1693|l[1]&8192&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[33](null),z(e,s)}}}function uh(n){return JSON.stringify(n)}function A4(n,e,t){let i,s,l,o;const r=rn(),a="record_"+G.randomString(5);let{collection:u}=e,f,c=null,d=new ao,p=!1,g=!1,v={},b={},y="";function $(x){return M(x),t(8,g=!0),f==null?void 0:f.show()}function S(){return f==null?void 0:f.hide()}async function M(x){Fi({}),c=x||{},t(2,d=x!=null&&x.clone?x.clone():new ao),t(3,v={}),t(4,b={}),await oi(),t(15,y=uh(d))}function C(){if(p||!l)return;t(7,p=!0);const x=O();let J;d.isNew?J=ye.Records.create(u==null?void 0:u.id,x):J=ye.Records.update(u==null?void 0:u.id,d.id,x),J.then(async ve=>{cn(d.isNew?"Successfully created record.":"Successfully updated record."),t(8,g=!1),S(),r("save",ve)}).catch(ve=>{ye.errorResponseHandler(ve)}).finally(()=>{t(7,p=!1)})}function D(){!(c!=null&&c.id)||bi("Do you really want to delete the selected record?",()=>ye.Records.delete(c["@collectionId"],c.id).then(()=>{S(),cn("Successfully deleted record."),r("delete",c)}).catch(x=>{ye.errorResponseHandler(x)}))}function O(){const x=(d==null?void 0:d.export())||{},J=new FormData,ve={};for(const Re of(u==null?void 0:u.schema)||[])ve[Re.name]=Re;for(const Re in x)!ve[Re]||(typeof x[Re]>"u"&&(x[Re]=null),G.addValueToFormData(J,Re,x[Re]));for(const Re in v){const Ve=G.toArray(v[Re]);for(const Z of Ve)J.append(Re,Z)}for(const Re in b){const Ve=G.toArray(b[Re]);for(const Z of Ve)J.append(Re+"."+Z,"")}return J}const E=()=>S(),F=()=>D();function L(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function R(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function H(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function te(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function le(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function q(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function Y(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function W(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function X(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function ne(x,J){n.$$.not_equal(v[J.name],x)&&(v[J.name]=x,t(3,v))}function ue(x,J){n.$$.not_equal(b[J.name],x)&&(b[J.name]=x,t(4,b))}function Me(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}function oe(x,J){n.$$.not_equal(d[J.name],x)&&(d[J.name]=x,t(2,d))}const he=()=>s&&g?(bi("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,g=!1),S()}),!1):!0;function be(x){me[x?"unshift":"push"](()=>{f=x,t(6,f)})}function K(x){at.call(this,n,x)}function Se(x){at.call(this,n,x)}return n.$$set=x=>{"collection"in x&&t(0,u=x.collection)},n.$$.update=()=>{n.$$.dirty[0]&24&&t(16,i=G.hasNonEmptyProps(v)||G.hasNonEmptyProps(b)),n.$$.dirty[0]&98308&&t(5,s=i||y!=uh(d)),n.$$.dirty[0]&36&&t(9,l=d.isNew||s),n.$$.dirty[0]&1&&t(10,o=(u==null?void 0:u.name)!=="profiles")},[u,S,d,v,b,s,f,p,g,l,o,a,C,D,$,y,i,E,F,L,R,H,te,le,q,Y,W,X,ne,ue,Me,oe,he,be,K,Se]}class Yg extends Oe{constructor(e){super(),De(this,e,A4,E4,Te,{collection:0,show:14,hide:1},null,[-1,-1])}get show(){return this.$$.ctx[14]}get hide(){return this.$$.ctx[1]}Line truncated
|
||||
`},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function kh(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear filters</span>',h(e,"type","button"),h(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[28]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function wh(n,e){let t,i,s;return i=new Kg({props:{record:e[35],field:e[38]}}),{key:n,first:null,c(){t=st(),B(i.$$.fragment),this.first=t},m(l,o){w(l,t,o),V(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&8&&(r.record=e[35]),o[0]&2048&&(r.field=e[38]),i.$set(r)},i(l){s||(A(i.$$.fragment,l),s=!0)},o(l){P(i.$$.fragment,l),s=!1},d(l){l&&k(t),z(i,l)}}}function Sh(n,e){let t,i,s,l,o,r,a,u,f,c,d,p,g,v=[],b=new Map,y,$,S,M,C,D,O,E,F,L,R,H;function te(){return e[25](e[35])}p=new Ko({props:{id:e[35].id}});let le=e[11];const q=X=>X[38].name;for(let X=0;X<le.length;X+=1){let ne=_h(e,le,X),ue=q(ne);b.set(ue,v[X]=wh(ue,ne))}S=new _i({props:{date:e[35].created}}),D=new _i({props:{date:e[35].updated}});function Y(){return e[26](e[35])}function W(...X){return e[27](e[35],...X)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),l=_("input"),a=T(),u=_("label"),c=T(),d=_("td"),B(p.$$.fragment),g=T();for(let X=0;X<v.length;X+=1)v[X].c();y=T(),$=_("td"),B(S.$$.fragment),M=T(),C=_("td"),B(D.$$.fragment),O=T(),E=_("td"),E.innerHTML='<i class="ri-arrow-right-line"></i>',F=T(),h(l,"type","checkbox"),h(l,"id",o="checkbox_"+e[35].id),l.checked=r=e[5][e[35].id],h(u,"for",f="checkbox_"+e[35].id),h(s,"class","form-field"),h(i,"class","bulk-select-col min-width"),h(d,"class","col-type-text col-field-id"),h($,"class","col-type-date col-field-created"),h(C,"class","col-type-date col-field-updated"),h(E,"class","col-type-action min-width"),h(t,"tabindex","0"),h(t,"class","row-handle"),this.first=t},m(X,ne){w(X,t,ne),m(t,i),m(i,s),m(s,l),m(s,a),m(s,u),m(t,c),m(t,d),V(p,d,null),m(t,g);for(let ue=0;ue<v.length;ue+=1)v[ue].m(t,null);m(t,y),m(t,$),V(S,$,null),m(t,M),m(t,C),V(D,C,null),m(t,O),m(t,E),m(t,F),L=!0,R||(H=[Q(l,"change",te),Q(s,"click",Gn(e[19])),Q(t,"click",Y),Q(t,"keydown",W)],R=!0)},p(X,ne){e=X,(!L||ne[0]&8&&o!==(o="checkbox_"+e[35].id))&&h(l,"id",o),(!L||ne[0]&40&&r!==(r=e[5][e[35].id]))&&(l.checked=r),(!L||ne[0]&8&&f!==(f="checkbox_"+e[35].id))&&h(u,"for",f);const ue={};ne[0]&8&&(ue.id=e[35].id),p.$set(ue),ne[0]&2056&&(le=e[11],Ee(),v=St(v,ne,q,1,e,le,b,t,Gt,wh,y,_h),Ae());const Me={};ne[0]&8&&(Me.date=e[35].created),S.$set(Me);const oe={};ne[0]&8&&(oe.date=e[35].updated),D.$set(oe)},i(X){if(!L){A(p.$$.fragment,X);for(let ne=0;ne<le.length;ne+=1)A(v[ne]);A(S.$$.fragment,X),A(D.$$.fragment,X),L=!0}},o(X){P(p.$$.fragment,X);for(let ne=0;ne<v.length;ne+=1)P(v[ne]);P(S.$$.fragment,X),P(D.$$.fragment,X),L=!1},d(X){X&&k(t),z(p);for(let ne=0;ne<v.length;ne+=1)v[ne].d();z(S),z(D),R=!1,Qe(H)}}}function $h(n){let e,t,i=n[3].length+"",s,l,o;return{c(){e=_("small"),t=N("Showing "),s=N(i),l=N(" of "),o=N(n[4]),h(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),m(e,t),m(e,s),m(e,l),m(e,o)},p(r,a){a[0]&8&&i!==(i=r[3].length+"")&&ge(s,i),a[0]&16&&ge(o,r[4])},d(r){r&&k(e)}}}function Ch(n){let e,t,i,s,l=n[4]-n[3].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=N("Load more ("),o=N(l),r=N(")"),h(i,"class","txt"),h(t,"type","button"),h(t,"class","btn btn-lg btn-secondary btn-expanded"),se(t,"btn-loading",n[8]),se(t,"btn-disabled",n[8]),h(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),m(e,t),m(t,i),m(i,s),m(i,o),m(i,r),a||(u=Q(t,"click",n[29]),a=!0)},p(f,c){c[0]&24&&l!==(l=f[4]-f[3].length+"")&&ge(o,l),c[0]&256&&se(t,"btn-loading",f[8]),c[0]&256&&se(t,"btn-disabled",f[8])},d(f){f&&k(e),a=!1,u()}}}function Mh(n){let e,t,i,s,l,o,r=n[6]===1?"record":"records",a,u,f,c,d,p,g,v,b,y,$;return{c(){e=_("div"),t=_("div"),i=N("Selected "),s=_("strong"),l=N(n[6]),o=T(),a=N(r),u=T(),f=_("button"),f.innerHTML='<span class="txt">Reset</span>',c=T(),d=_("div"),p=T(),g=_("button"),g.innerHTML='<span class="txt">Delete selected</span>',h(t,"class","txt"),h(f,"type","button"),h(f,"class","btn btn-xs btn-secondary btn-outline p-l-5 p-r-5"),se(f,"btn-disabled",n[9]),h(d,"class","flex-fill"),h(g,"type","button"),h(g,"class","btn btn-sm btn-secondary btn-danger"),se(g,"btn-loading",n[9]),se(g,"btn-disabled",n[9]),h(e,"class","bulkbar")},m(S,M){w(S,e,M),m(e,t),m(t,i),m(t,s),m(s,l),m(t,o),m(t,a),m(e,u),m(e,f),m(e,c),m(e,d),m(e,p),m(e,g),b=!0,y||($=[Q(f,"click",n[30]),Q(g,"click",n[31])],y=!0)},p(S,M){(!b||M[0]&64)&&ge(l,S[6]),(!b||M[0]&64)&&r!==(r=S[6]===1?"record":"records")&&ge(a,r),M[0]&512&&se(f,"btn-disabled",S[9]),M[0]&512&&se(g,"btn-loading",S[9]),M[0]&512&&se(g,"btn-disabled",S[9])},i(S){b||(S&&Ot(()=>{v||(v=lt(e,Nn,{duration:150,y:5},!0)),v.run(1)}),b=!0)},o(S){S&&(v||(v=lt(e,Nn,{duration:150,y:5},!1)),v.run(0)),b=!1},d(S){S&&k(e),S&&v&&v.end(),y=!1,Qe($)}}}function x4(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v=[],b=new Map,y,$,S,M,C,D,O,E,F,L,R=[],H=new Map,te,le,q,Y,W,X,ne;function ue(de){n[21](de)}let Me={class:"col-type-text
Line truncated
|
||||
<span class="txt">API Preview</span>`,$=T(),S=_("button"),S.innerHTML=`<i class="ri-add-line"></i>
|
||||
<span class="txt">New record</span>`,M=T(),B(C.$$.fragment),D=T(),B(O.$$.fragment),h(o,"class","breadcrumb-item"),h(a,"class","breadcrumb-item"),h(l,"class","breadcrumbs"),h(d,"type","button"),h(d,"class","btn btn-secondary btn-circle"),h(y,"type","button"),h(y,"class","btn btn-outline"),h(S,"type","button"),h(S,"class","btn btn-expanded"),h(b,"class","btns-group"),h(s,"class","page-header"),h(i,"class","page-wrapper")},m(Y,W){V(e,Y,W),w(Y,t,W),w(Y,i,W),m(i,s),m(s,l),m(l,o),m(l,r),m(l,a),m(a,f),m(s,c),m(s,d),m(s,p),V(g,s,null),m(s,v),m(s,b),m(b,y),m(b,$),m(b,S),m(i,M),V(C,i,null),m(i,D),V(O,i,null),L=!0,R||(H=[Ye(wt.call(null,d,{text:"Edit collection",position:"right"})),Q(d,"click",n[12]),Q(y,"click",n[14]),Q(S,"click",n[15])],R=!0)},p(Y,W){(!L||W&4)&&u!==(u=Y[2].name+"")&&ge(f,u);const X={};W&1&&(X.value=Y[0]),W&4&&(X.autocompleteCollection=Y[2]),C.$set(X);const ne={};W&4&&(ne.collection=Y[2]),!E&&W&1&&(E=!0,ne.filter=Y[0],Ie(()=>E=!1)),!F&&W&2&&(F=!0,ne.sort=Y[1],Ie(()=>F=!1)),O.$set(ne)},i(Y){L||(A(e.$$.fragment,Y),A(g.$$.fragment,Y),A(C.$$.fragment,Y),A(O.$$.fragment,Y),L=!0)},o(Y){P(e.$$.fragment,Y),P(g.$$.fragment,Y),P(C.$$.fragment,Y),P(O.$$.fragment,Y),L=!1},d(Y){z(e,Y),Y&&k(t),Y&&k(i),z(g),z(C),n[17](null),z(O),R=!1,Qe(H)}}}function iM(n){let e,t,i,s,l,o,r,a;return{c(){e=_("div"),t=_("div"),t.innerHTML='<i class="ri-database-2-line"></i>',i=T(),s=_("h1"),s.textContent="Create your first collection to add records!",l=T(),o=_("button"),o.innerHTML=`<i class="ri-add-line"></i>
|
||||
<span class="txt">Create new collection</span>`,h(t,"class","icon"),h(s,"class","m-b-10"),h(o,"type","button"),h(o,"class","btn btn-expanded-lg btn-lg"),h(e,"class","placeholder-section m-b-base")},m(u,f){w(u,e,f),m(e,t),m(e,i),m(e,s),m(e,l),m(e,o),r||(a=Q(o,"click",n[11]),r=!0)},p:re,i:re,o:re,d(u){u&&k(e),r=!1,a()}}}function sM(n){let e;return{c(){e=_("div"),e.innerHTML=`<span class="loader loader-lg"></span>
|
||||
<h1>Loading collections...</h1>`,h(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function lM(n){let e,t,i,s,l,o,r,a,u;const f=[sM,iM,nM],c=[];function d(b,y){return b[8]?0:b[7].length?2:1}e=d(n),t=c[e]=f[e](n);let p={};s=new za({props:p}),n[21](s);let g={};o=new UC({props:g}),n[22](o);let v={collection:n[2]};return a=new Yg({props:v}),n[23](a),a.$on("save",n[24]),a.$on("delete",n[25]),{c(){t.c(),i=T(),B(s.$$.fragment),l=T(),B(o.$$.fragment),r=T(),B(a.$$.fragment)},m(b,y){c[e].m(b,y),w(b,i,y),V(s,b,y),w(b,l,y),V(o,b,y),w(b,r,y),V(a,b,y),u=!0},p(b,[y]){let $=e;e=d(b),e===$?c[e].p(b,y):(Ee(),P(c[$],1,1,()=>{c[$]=null}),Ae(),t=c[e],t?t.p(b,y):(t=c[e]=f[e](b),t.c()),A(t,1),t.m(i.parentNode,i));const S={};s.$set(S);const M={};o.$set(M);const C={};y&4&&(C.collection=b[2]),a.$set(C)},i(b){u||(A(t),A(s.$$.fragment,b),A(o.$$.fragment,b),A(a.$$.fragment,b),u=!0)},o(b){P(t),P(s.$$.fragment,b),P(o.$$.fragment,b),P(a.$$.fragment,b),u=!1},d(b){c[e].d(b),b&&k(i),n[21](null),z(s,b),b&&k(l),n[22](null),z(o,b),b&&k(r),n[23](null),z(a,b)}}}function oM(n,e,t){let i,s,l,o,r,a;kt(n,ii,W=>t(2,s=W)),kt(n,ks,W=>t(10,l=W)),kt(n,Fo,W=>t(26,o=W)),kt(n,Jt,W=>t(27,r=W)),kt(n,xr,W=>t(8,a=W)),_n(Jt,r="Collections",r);const u=new URLSearchParams(o);let f,c,d,p,g=u.get("filter")||"",v=u.get("sort")||"-created",b=u.get("collectionId")||"";function y(){t(9,b=s.id),t(1,v="-created"),t(0,g="")}_2(b);const $=()=>f==null?void 0:f.show(),S=()=>f==null?void 0:f.show(s),M=()=>p==null?void 0:p.load(),C=()=>c==null?void 0:c.show(s),D=()=>d==null?void 0:d.show(),O=W=>t(0,g=W.detail);function E(W){me[W?"unshift":"push"](()=>{p=W,t(6,p)})}function F(W){g=W,t(0,g)}function L(W){v=W,t(1,v)}const R=W=>d==null?void 0:d.show(W==null?void 0:W.detail);function H(W){me[W?"unshift":"push"](()=>{f=W,t(3,f)})}function te(W){me[W?"unshift":"push"](()=>{c=W,t(4,c)})}function le(W){me[W?"unshift":"push"](()=>{d=W,t(5,d)})}const q=()=>p==null?void 0:p.load(),Y=()=>p==null?void 0:p.load();return n.$$.update=()=>{if(n.$$.dirty&1024&&t(7,i=l.filter(W=>W.name!="profiles")),n.$$.dirty&516&&(s==null?void 0:s.id)&&b!=s.id&&y(),n.$$.dirty&7&&(v||g||(s==null?void 0:s.id))){const W=new URLSearchParams({collectionId:(s==null?void 0:s.id)||"",filter:g,sort:v}).toString();vi("/collections?"+W)}},[g,v,s,f,c,d,p,i,a,b,l,$,S,M,C,D,O,E,F,L,R,H,te,le,q,Y]}class rM extends Oe{constructor(e){super(),De(this,e,oM,lM,Te,{})}}function Th(n){let e,t;return e=new Pe({props:{class:"form-field disabled",name:"id",$$slots:{default:[aM,({uniqueId:i})=>({31:i}),({uniqueId:i})=>[0,i?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&2|s[1]&3&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function aM(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="ID",o=T(),r=_("input"),h(t,"class",G.getFieldTypeIcon("primary")),h(s,"class","txt"),h(e,"for",l=n[31]),h(r,"type","text"),h(r,"id",a=n[31]),r.value=u=n[1].id,r.disabled=!0},m(f,c){w(f,e,c),m(e,t),m(e,i),m(e,s),w(f,o,c),w(f,r,c)},p(f,c){c[1]&1&&l!==(l=f[31])&&h(e,"for",l),c[1]&1&&a!==(a=f[31])&&h(r,"id",a),c[0]&2&&u!==(u=f[1].id)&&r.value!==u&&(r.value=u)},d(f){f&&k(e),f&&k(o),f&&k(r)}}}function Dh(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='<i class="ri-shield-check-line"></i>',h(e,"class","form-field-addon txt-success")},m(s,l){w(s,e,l),t||(i=Ye(wt.call(null,e,"Verified")),t=!0)},d(s){s&&k(e),t=!1,i()}}}function uM(n){let e,t,i,s,l,o,r,a,u,f,c,d=n[1].verified&&Dh();return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="Email",o=T(),d&&d.c(),r=T(),a=_("input"),h(t,"class",G.getFieldTypeIcon("email")),h(s,"class","txt"),h(e,"for",l=n[31]),h(a,"type","email"),h(a,"autocomplete","off"),h(a,"id",u=n[31]),a.required=!0},m(p,g){w(p,e,g),m(e,t),m(e,i),m(e,s),w(p,o,g),d&&d.m(p,g),w(p,r,g),w(p,a,g),we(a,n[2]),f||(c=Q(a,"input",n[19]),f=!0)},p(p,g){g[1]&1&&l!==(l=p[31])&&h(e,"for",l),p[1].verified?d||(d=Dh(),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null),g[1]&1&&u!==(u=p[31])&&h(a,"id",u),g[0]&4&&a.value!==p[2]&&we(a,p[2])},d(p){p&&k(e),p&&k(o),d&&d.d(p),p&&k(r),p&&k(a),f=!1,c()}}}function Oh(n){let e,t;return e=new Pe({props:{class:"form-field form-field-toggle",$$slots:{default:[fM,({uniqueId:i})=>({31:i}),({uniqueId:i})=>[0,i?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&8|s[1]&3&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function fM(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=N("Change password"),h(e,"type","checkbox"),h(e,"id",t=n[31]),h(s,"for",o=n[31])},m(u,f){w(u,e,f),e.checked=n[3],w(u,i,f),w(u,s,f),m(s,l),r||(a=Q(e,"change",n[20]),r=!0)},p(u,f){f[1]&1&&t!==(t=u[31])&&h(e,"id",t),f[0]&8&&(e.checked=u[3]),f[1]&1&&o!==(o=u[31])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Eh(Line truncated
|
||||
<span class="txt">Send verification email</span>`,h(e,"type","button"),h(e,"class","dropdown-item")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[16]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function gM(n){let e,t,i,s,l=!n[1].verified&&Lh(n);return{c(){l&&l.c(),e=T(),t=_("button"),t.innerHTML=`<i class="ri-delete-bin-7-line"></i>
|
||||
<span class="txt">Delete</span>`,h(t,"type","button"),h(t,"class","dropdown-item")},m(o,r){l&&l.m(o,r),w(o,e,r),w(o,t,r),i||(s=Q(t,"click",n[17]),i=!0)},p(o,r){o[1].verified?l&&(l.d(1),l=null):l?l.p(o,r):(l=Lh(o),l.c(),l.m(e.parentNode,e))},d(o){l&&l.d(o),o&&k(e),o&&k(t),i=!1,s()}}}function _M(n){let e,t,i,s,l,o,r=n[1].isNew?"Create":"Save changes",a,u,f,c,d,p=!n[1].isNew&&Ph(n);return{c(){p&&p.c(),e=T(),t=_("button"),i=_("span"),i.textContent="Cancel",s=T(),l=_("button"),o=_("span"),a=N(r),h(i,"class","txt"),h(t,"type","button"),h(t,"class","btn btn-secondary"),t.disabled=n[5],h(o,"class","txt"),h(l,"type","submit"),h(l,"form",n[11]),h(l,"class","btn btn-expanded"),l.disabled=u=!n[10]||n[5],se(l,"btn-loading",n[5])},m(g,v){p&&p.m(g,v),w(g,e,v),w(g,t,v),m(t,i),w(g,s,v),w(g,l,v),m(l,o),m(o,a),f=!0,c||(d=Q(t,"click",n[18]),c=!0)},p(g,v){g[1].isNew?p&&(Ee(),P(p,1,1,()=>{p=null}),Ae()):p?(p.p(g,v),v[0]&2&&A(p,1)):(p=Ph(g),p.c(),A(p,1),p.m(e.parentNode,e)),(!f||v[0]&32)&&(t.disabled=g[5]),(!f||v[0]&2)&&r!==(r=g[1].isNew?"Create":"Save changes")&&ge(a,r),(!f||v[0]&1056&&u!==(u=!g[10]||g[5]))&&(l.disabled=u),v[0]&32&&se(l,"btn-loading",g[5])},i(g){f||(A(p),f=!0)},o(g){P(p),f=!1},d(g){p&&p.d(g),g&&k(e),g&&k(t),g&&k(s),g&&k(l),c=!1,d()}}}function bM(n){let e,t,i={popup:!0,class:"user-panel",beforeHide:n[24],$$slots:{footer:[_M],header:[mM],default:[pM]},$$scope:{ctx:n}};return e=new ki({props:i}),n[25](e),e.$on("hide",n[26]),e.$on("show",n[27]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const o={};l[0]&1088&&(o.beforeHide=s[24]),l[0]&1966|l[1]&2&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[25](null),z(e,s)}}}function vM(n,e,t){let i;const s=rn(),l="user_"+G.randomString(5);let o,r=new uo,a=!1,u=!1,f="",c="",d="",p=!1,g=!0;function v(X){return y(X),t(6,u=!0),o==null?void 0:o.show()}function b(){return o==null?void 0:o.hide()}function y(X){Fi({}),t(1,r=X!=null&&X.clone?X.clone():new uo),$()}function $(){t(3,p=!1),t(9,g=!0),t(2,f=(r==null?void 0:r.email)||""),t(7,c=""),t(8,d="")}function S(){if(a||!i)return;t(5,a=!0);const X={email:f};(r.isNew||p)&&(X.password=c,X.passwordConfirm=d);let ne;r.isNew?ne=ye.Users.create(X):ne=ye.Users.update(r.id,X),ne.then(async ue=>{g&&C(!1),t(6,u=!1),b(),cn(r.isNew?"Successfully created user.":"Successfully updated user."),s("save",ue)}).catch(ue=>{ye.errorResponseHandler(ue)}).finally(()=>{t(5,a=!1)})}function M(){!(r!=null&&r.id)||bi("Do you really want to delete the selected user?",()=>ye.Users.delete(r.id).then(()=>{t(6,u=!1),b(),cn("Successfully deleted user."),s("delete",r)}).catch(X=>{ye.errorResponseHandler(X)}))}function C(X=!0){return ye.Users.requestVerification(r.isNew?f:r.email).then(()=>{t(6,u=!1),b(),X&&cn(`Successfully sent verification email to ${r.email}.`)}).catch(ne=>{ye.errorResponseHandler(ne)})}const D=()=>C(),O=()=>M(),E=()=>b();function F(){f=this.value,t(2,f)}function L(){p=this.checked,t(3,p)}function R(){c=this.value,t(7,c)}function H(){d=this.value,t(8,d)}function te(){g=this.checked,t(9,g)}const le=()=>i&&u?(bi("You have unsaved changes. Do you really want to close the panel?",()=>{t(6,u=!1),b()}),!1):!0;function q(X){me[X?"unshift":"push"](()=>{o=X,t(4,o)})}function Y(X){at.call(this,n,X)}function W(X){at.call(this,n,X)}return n.$$.update=()=>{n.$$.dirty[0]&14&&t(10,i=r.isNew&&f!=""||p||f!==r.email)},[b,r,f,p,o,a,u,c,d,g,i,l,S,M,C,v,D,O,E,F,L,R,H,te,le,q,Y,W]}class yM extends Oe{constructor(e){super(),De(this,e,vM,bM,Te,{show:15,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[0]}}function Fh(n,e,t){const i=n.slice();return i[40]=e[t],i}function Ih(n,e,t){const i=n.slice();return i[43]=e[t],i}function Rh(n,e,t){const i=n.slice();return i[43]=e[t],i}function kM(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,S,M,C,D,O,E,F,L,R=[],H=new Map,te,le,q,Y,W,X,ne,ue,Me,oe,he=[],be=new Map,K,Se,x,J,ve;u=new Vo({}),u.$on("refresh",n[17]),v=new qo({props:{value:n[3],placeholder:"Search filter, eg. verified=1",extraAutocompleteKeys:["verified","email"]}}),v.$on("submit",n[19]);function Re(ie){n[20](ie)}let Ve={class:"col-type-text col-field-id",name:"id",$$slots:{default:[SM]},$$scope:{ctx:n}};n[4]!==void 0&&(Ve.sort=n[4]),C=new en({props:Ve}),me.push(()=>Le(C,"sort",Re));function Z(ie){n[21](ie)}let fe={class:"col-type-email col-field-email",name:"email",$$slots:{default:[$M]},$$scope:{ctx:n}};n[4]!==void 0&&(fe.sort=n[4]),E=new en({props:fe}),me.push(()=>Le(E,"sort",Z));let de=n[12];const ke=ie=>ie[43].name;for(let ie=0;ie<de.length;ie+=1){let _e=Rh(n,de,ie),Ue=ke(_e);H.set(Ue,R[ie]=Nh(Ue,_e))}function Ge(ie){n[22](ie)}let ot={class:"col-type-date col-field-created",name:"created",$$slots:{default:[CM]},$$scope:{ctx:n}};n[4]!==void 0&&(ot.sort=n[4]),le=new en({props:ot}),me.push(()=>Le(le,"sort",Ge));function xe(ie){n[23](ie)}let _t={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[MM]},$$scope:{ctx:n}};n[4]!==voLine truncated
|
||||
<span class="txt">New user</span>`,g=T(),B(v.$$.fragment),b=T(),y=_("div"),$=_("table"),S=_("thead"),M=_("tr"),B(C.$$.fragment),O=T(),B(E.$$.fragment),L=T();for(let ie=0;ie<R.length;ie+=1)R[ie].c();te=T(),B(le.$$.fragment),Y=T(),B(W.$$.fragment),ne=T(),ue=_("th"),Me=T(),oe=_("tbody");for(let ie=0;ie<he.length;ie+=1)he[ie].c();ze&&ze.c(),K=T(),Be&&Be.c(),Se=T(),ct&&ct.c(),h(s,"class","breadcrumb-item"),h(i,"class","breadcrumbs"),h(r,"type","button"),h(r,"class","btn btn-secondary btn-circle"),h(c,"class","flex-fill"),h(p,"type","button"),h(p,"class","btn btn-expanded"),h(t,"class","page-header"),h(ue,"class","col-type-action min-width"),h($,"class","table"),se($,"table-loading",n[10]),h(y,"class","table-wrapper"),h(e,"class","page-wrapper")},m(ie,_e){w(ie,e,_e),m(e,t),m(t,i),m(i,s),m(s,l),m(t,o),m(t,r),m(t,a),V(u,t,null),m(t,f),m(t,c),m(t,d),m(t,p),m(e,g),V(v,e,null),m(e,b),m(e,y),m(y,$),m($,S),m(S,M),V(C,M,null),m(M,O),V(E,M,null),m(M,L);for(let Ue=0;Ue<R.length;Ue+=1)R[Ue].m(M,null);m(M,te),V(le,M,null),m(M,Y),V(W,M,null),m(M,ne),m(M,ue),m($,Me),m($,oe);for(let Ue=0;Ue<he.length;Ue+=1)he[Ue].m(oe,null);ze&&ze.m(oe,null),m(e,K),Be&&Be.m(e,null),m(e,Se),ct&&ct.m(e,null),x=!0,J||(ve=[Ye(wt.call(null,r,{text:"Edit profile collection",position:"right"})),Q(r,"click",n[16]),Q(p,"click",n[18])],J=!0)},p(ie,_e){(!x||_e[0]&16384)&&ge(l,ie[14]);const Ue={};_e[0]&8&&(Ue.value=ie[3]),v.$set(Ue);const nt={};_e[1]&131072&&(nt.$$scope={dirty:_e,ctx:ie}),!D&&_e[0]&16&&(D=!0,nt.sort=ie[4],Ie(()=>D=!1)),C.$set(nt);const rt={};_e[1]&131072&&(rt.$$scope={dirty:_e,ctx:ie}),!F&&_e[0]&16&&(F=!0,rt.sort=ie[4],Ie(()=>F=!1)),E.$set(rt),_e[0]&4096&&(de=ie[12],R=St(R,_e,ke,1,ie,de,H,M,Jn,Nh,te,Rh));const Je={};_e[1]&131072&&(Je.$$scope={dirty:_e,ctx:ie}),!q&&_e[0]&16&&(q=!0,Je.sort=ie[4],Ie(()=>q=!1)),le.$set(Je);const Ct={};_e[1]&131072&&(Ct.$$scope={dirty:_e,ctx:ie}),!X&&_e[0]&16&&(X=!0,Ct.sort=ie[4],Ie(()=>X=!1)),W.$set(Ct),_e[0]&5450&&(tt=ie[1],Ee(),he=St(he,_e,$t,1,ie,tt,be,oe,Gt,Vh,null,Fh),Ae(),!tt.length&&ze?ze.p(ie,_e):tt.length?ze&&(ze.d(1),ze=null):(ze=Hh(ie),ze.c(),ze.m(oe,null))),_e[0]&1024&&se($,"table-loading",ie[10]),ie[1].length?Be?Be.p(ie,_e):(Be=zh(ie),Be.c(),Be.m(e,Se)):Be&&(Be.d(1),Be=null),ie[1].length&&ie[13]?ct?ct.p(ie,_e):(ct=Bh(ie),ct.c(),ct.m(e,null)):ct&&(ct.d(1),ct=null)},i(ie){if(!x){A(u.$$.fragment,ie),A(v.$$.fragment,ie),A(C.$$.fragment,ie),A(E.$$.fragment,ie),A(le.$$.fragment,ie),A(W.$$.fragment,ie);for(let _e=0;_e<tt.length;_e+=1)A(he[_e]);x=!0}},o(ie){P(u.$$.fragment,ie),P(v.$$.fragment,ie),P(C.$$.fragment,ie),P(E.$$.fragment,ie),P(le.$$.fragment,ie),P(W.$$.fragment,ie);for(let _e=0;_e<he.length;_e+=1)P(he[_e]);x=!1},d(ie){ie&&k(e),z(u),z(v),z(C),z(E);for(let _e=0;_e<R.length;_e+=1)R[_e].d();z(le),z(W);for(let _e=0;_e<he.length;_e+=1)he[_e].d();ze&&ze.d(),Be&&Be.d(),ct&&ct.d(),J=!1,Qe(ve)}}}function wM(n){let e;return{c(){e=_("div"),e.innerHTML=`<span class="loader loader-lg"></span>
|
||||
<h1>Loading users...</h1>`,h(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function SM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="id",h(t,"class",G.getFieldTypeIcon("primary")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function $M(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="email",h(t,"class",G.getFieldTypeIcon("email")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function Nh(n,e){let t,i,s,l,o,r,a,u=e[43].name+"",f,c,d;return{key:n,first:null,c(){t=_("th"),i=_("div"),s=_("i"),o=T(),r=_("span"),a=N("profile."),f=N(u),h(s,"class",l=G.getFieldTypeIcon(e[43].type)),h(r,"class","txt"),h(i,"class","col-header-content"),h(t,"class",c="col-type-"+e[43].type+" col-field-"+e[43].name),h(t,"name",d=e[43].name),this.first=t},m(p,g){w(p,t,g),m(t,i),m(i,s),m(i,o),m(i,r),m(r,a),m(r,f)},p(p,g){e=p,g[0]&4096&&l!==(l=G.getFieldTypeIcon(e[43].type))&&h(s,"class",l),g[0]&4096&&u!==(u=e[43].name+"")&&ge(f,u),g[0]&4096&&c!==(c="col-type-"+e[43].type+" col-field-"+e[43].name)&&h(t,"class",c),g[0]&4096&&d!==(d=e[43].name)&&h(t,"name",d)},d(p){p&&k(t)}}}function CM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",h(t,"class",G.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function MM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="updated",h(t,"class",G.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function Hh(n){let e;function t(l,o){return l[10]?DM:TM}let i=t(n),s=i(n);return{c(){s.c(),e=st()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function TM(n){var r;let e,t,i,s,l,o=((r=n[3])==null?void 0:r.length)&&jh(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No users found.",s=T(),o&&o.c(),l=T(),h(t,"colspan","99"),h(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),o&&o.m(t,null),m(e,l)},p(a,u){var f;(f=a[3])!=null&&f.length?o?o.p(a,u):(o=jh(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function DM(n){let e;return{c(){e=_("tr"),e.innerHTML=`<td colspan="99" class="p-xs"><span class="skeleton-loader"></span></td>
|
||||
`},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function jh(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear filters</span>',h(e,"type","button"),h(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[26]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function qh(n,e){let t,i,s;return i=new Kg({props:{field:e[43],record:e[40].profile||{}}}),{key:n,first:null,c(){t=st(),B(i.$$.fragment),this.first=t},m(l,o){w(l,t,o),V(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&4096&&(r.field=e[43]),o[0]&2&&(r.record=e[40].profile||{}),i.$set(r)},i(l){s||(A(i.$$.fragment,l),s=!0)},o(l){P(i.$$.fragment,l),s=!1},d(l){l&&k(t),z(i,l)}}}function Vh(n,e){let t,i,s,l,o,r,a,u=e[40].email+"",f,c,d,p,g=e[40].verified?"Verified":"Unverified",v,b,y=[],$=new Map,S,M,C,D,O,E,F,L,R,H,te,le,q,Y,W;s=new Ko({props:{id:e[40].id}});let X=e[12];const ne=oe=>oe[43].name;for(let oe=0;oe<X.length;oe+=1){let he=Ih(e,X,oe),be=ne(he);$.set(be,y[oe]=qh(be,he))}C=new _i({props:{date:e[40].created}}),E=new _i({props:{date:e[40].updated}});function ue(){return e[24](e[40])}function Me(){return e[25](e[40])}return{key:n,first:null,c(){t=_("tr"),i=_("td"),B(s.$$.fragment),l=T(),o=_("td"),r=_("div"),a=_("span"),f=N(u),d=T(),p=_("span"),v=N(g),b=T();for(let oe=0;oe<y.length;oe+=1)y[oe].c();S=T(),M=_("td"),B(C.$$.fragment),D=T(),O=_("td"),B(E.$$.fragment),F=T(),L=_("td"),R=_("button"),R.innerHTML=`<i class="ri-user-settings-line"></i>
|
||||
<span class="txt">Edit user</span>`,H=T(),te=_("button"),te.innerHTML=`<i class="ri-profile-line"></i>
|
||||
<span class="txt">Edit profile</span>`,le=T(),h(i,"class","col-type-text col-field-id"),h(a,"class","txt"),h(a,"title",c=e[40].email),h(p,"class","label"),se(p,"label-success",e[40].verified),se(p,"label-warning",!e[40].verified),h(r,"class","inline-flex"),h(o,"class","col-type-email col-field-email"),h(M,"class","col-type-date col-field-created"),h(O,"class","col-type-date col-field-updated"),h(R,"type","button"),h(R,"class","btn btn-sm btn-outline"),h(te,"type","button"),h(te,"class","btn btn-sm m-l-10"),h(L,"class","col-type-action min-width"),this.first=t},m(oe,he){w(oe,t,he),m(t,i),V(s,i,null),m(t,l),m(t,o),m(o,r),m(r,a),m(a,f),m(r,d),m(r,p),m(p,v),m(t,b);for(let be=0;be<y.length;be+=1)y[be].m(t,null);m(t,S),m(t,M),V(C,M,null),m(t,D),m(t,O),V(E,O,null),m(t,F),m(t,L),m(L,R),m(L,H),m(L,te),m(t,le),q=!0,Y||(W=[Q(R,"click",Gn(ue)),Q(te,"click",Gn(Me))],Y=!0)},p(oe,he){e=oe;const be={};he[0]&2&&(be.id=e[40].id),s.$set(be),(!q||he[0]&2)&&u!==(u=e[40].email+"")&&ge(f,u),(!q||he[0]&2&&c!==(c=e[40].email))&&h(a,"title",c),(!q||he[0]&2)&&g!==(g=e[40].verified?"Verified":"Unverified")&&ge(v,g),he[0]&2&&se(p,"label-success",e[40].verified),he[0]&2&&se(p,"label-warning",!e[40].verified),he[0]&4098&&(X=e[12],Ee(),y=St(y,he,ne,1,e,X,$,t,Gt,qh,S,Ih),Ae());const K={};he[0]&2&&(K.date=e[40].created),C.$set(K);const Se={};he[0]&2&&(Se.date=e[40].updated),E.$set(Se)},i(oe){if(!q){A(s.$$.fragment,oe);for(let he=0;he<X.length;he+=1)A(y[he]);A(C.$$.fragment,oe),A(E.$$.fragment,oe),q=!0}},o(oe){P(s.$$.fragment,oe);for(let he=0;he<y.length;he+=1)P(y[he]);P(C.$$.fragment,oe),P(E.$$.fragment,oe),q=!1},d(oe){oe&&k(t),z(s);for(let he=0;he<y.length;he+=1)y[he].d();z(C),z(E),Y=!1,Qe(W)}}}function zh(n){let e,t,i=n[1].length+"",s,l,o;return{c(){e=_("small"),t=N("Showing "),s=N(i),l=N(" of "),o=N(n[2]),h(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),m(e,t),m(e,s),m(e,l),m(e,o)},p(r,a){a[0]&2&&i!==(i=r[1].length+"")&&ge(s,i),a[0]&4&&ge(o,r[2])},d(r){r&&k(e)}}}function Bh(n){let e,t,i,s,l=n[2]-n[1].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=N("Load more ("),o=N(l),r=N(")"),h(i,"class","txt"),h(t,"type","button"),h(t,"class","btn btn-lg btn-secondary btn-expanded"),se(t,"btn-loading",n[10]),se(t,"btn-disabled",n[10]),h(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),m(e,t),m(t,i),m(i,s),m(i,o),m(i,r),a||(u=Q(t,"click",n[27]),a=!0)},p(f,c){c[0]&6&&l!==(l=f[2]-f[1].length+"")&&ge(o,l),c[0]&1024&&se(t,"btn-loading",f[10]),c[0]&1024&&se(t,"btn-disabled",f[10])},d(f){f&&k(e),a=!1,u()}}}function OM(n){let e,t,i,s,l,o,r,a,u;const f=[wM,kM],c=[];function d(b,y){return b[11]?0:1}e=d(n),t=c[e]=f[e](n);let p={};s=new yM({props:p}),n[28](s),s.$on("save",n[29]),s.$on("delete",n[30]);let g={};o=new za({props:g}),n[31](o),o.$on("save",n[32]);let v={collection:n[5]};return a=new Yg({props:v}),n[33](a),a.$on("save",n[34]),{c(){t.c(),i=T(),B(s.$$.fragment),l=T(),B(o.$$.fragment),r=T(),B(a.$$.fragment)},m(b,y){c[e].m(b,y),w(b,i,y),V(s,b,y),w(b,l,y),V(o,b,y),w(b,r,y),V(a,b,y),u=!0},p(b,y){let $=e;e=d(b),e===$?c[e].p(b,y):(Ee(),P(c[$],1,1,()=>{c[$]=null}),Ae(),t=c[e],t?t.p(b,y):(t=c[e]=f[e](b),t.c()),A(t,1),t.m(i.parentNode,i));const S={};s.$set(S);const M={};o.$set(M);const C={};y[0]&32&&(C.collection=b[5]),a.$set(C)},i(b){u||(A(t),A(s.$$.fragment,b),A(o.$$.fragment,b),A(a.$$.fragment,b),u=!0)},o(b){P(t),P(s.$$.fragment,b),P(o.$$.fragment,b),P(a.$$.fragment,b),u=!1},d(b){c[e].d(b),b&&k(i),n[28](null),z(s,b),b&&k(l),n[31](null),z(o,b),b&&k(r),n[33](null),z(a,b)}}}function EM(n,e,t){let i,s,l,o;kt(n,Fo,x=>t(35,l=x)),kt(n,Jt,x=>t(14,o=x)),_n(Jt,o="Users",o);const r=new URLSearchParams(l),a=["id","userId","created","updated"];let u,f,c,d=[],p=1,g=0,v=!1,b=r.get("filter")||"",y=r.get("sort")||"-created",$=new On,S=!1;O();async function M(x=1){return t(10,v=!0),x<=1&&C(),ye.Users.getList(x,50,{sort:y||"-created",filter:b}).then(J=>{t(10,v=!1),t(1,d=d.concat(J.items)),t(9,p=J.page),t(2,g=J.totalItems)}).catch(J=>{J!=null&&J.isAbort||(t(10,v=!1),console.warn(J),C(),ye.errorResponseHandler(J,!1))})}function C(){t(1,d=[]),t(9,p=1),t(2,g=0)}function D(x){const J=d.find(ve=>ve.id===(x==null?void 0:x.userId));J&&(J.profile=x),t(1,d)}async function O(){t(11,S=!0);try{t(5,$=await ye.Collections.getOne("profiles"))}catch(x){ye.errorResponseHandler(x)}t(11,S=!1)}const E=()=>f==null?void 0:f.show($),F=()=>M(),L=()=>u==null?void 0:u.show(),R=x=>t(3,b=x.detail);function H(x){y=x,t(4,y)}function te(x){y=x,t(4,y)}function le(x){y=x,t(4,y)}function q(x){y=x,t(4,y)}const Y=x=>u==null?void 0:u.show(x),W=x=>c==null?void 0:c.show(x.profile),X=()=>t(3,b=""),ne=()=>M(p+1);function ue(x){me[x?"unshift":"push"](()=>{u=x,t(6,u)})}const Me=()=>M(),oe=()=>M();function he(x){me[x?"unshift":"push"](()=>{f=x,t(7,f)})}const be=x=>t(5,$=x.detail);function K(x){me[x?"unshift":"push"](()=>{c=x,t(8,c)})}const Se=x=>D(x.detail);return n.$$.update=()=>{var x;if(n.$$.dirty[0]&24&&y!==-1&&b!==-1){const J=new URLSearchPaLine truncated
|
||||
<span class="txt">Application</span>`,o=T(),r=_("a"),r.innerHTML=`<i class="ri-send-plane-2-line"></i>
|
||||
<span class="txt">Mail settings</span>`,a=T(),u=_("a"),u.innerHTML=`<i class="ri-archive-drawer-line"></i>
|
||||
<span class="txt">Files storage</span>`,f=T(),c=_("div"),c.textContent="Authentication",d=T(),p=_("a"),p.innerHTML=`<i class="ri-lock-password-line"></i>
|
||||
<span class="txt">Auth providers</span>`,g=T(),v=_("a"),v.innerHTML=`<i class="ri-key-line"></i>
|
||||
<span class="txt">Token options</span>`,b=T(),y=_("a"),y.innerHTML=`<i class="ri-shield-user-line"></i>
|
||||
<span class="txt">Admins</span>`,h(i,"class","sidebar-title"),h(l,"href","/settings"),h(l,"class","sidebar-list-item"),h(r,"href","/settings/mail"),h(r,"class","sidebar-list-item"),h(u,"href","/settings/storage"),h(u,"class","sidebar-list-item"),h(c,"class","sidebar-title"),h(p,"href","/settings/auth-providers"),h(p,"class","sidebar-list-item"),h(v,"href","/settings/tokens"),h(v,"class","sidebar-list-item"),h(y,"href","/settings/admins"),h(y,"class","sidebar-list-item"),h(t,"class","sidebar-content"),h(e,"class","page-sidebar settings-sidebar")},m(M,C){w(M,e,C),m(e,t),m(t,i),m(t,s),m(t,l),m(t,o),m(t,r),m(t,a),m(t,u),m(t,f),m(t,c),m(t,d),m(t,p),m(t,g),m(t,v),m(t,b),m(t,y),$||(S=[Ye(ei.call(null,l,{path:"/settings"})),Ye(wn.call(null,l)),Ye(ei.call(null,r,{path:"/settings/mail/?.*"})),Ye(wn.call(null,r)),Ye(ei.call(null,u,{path:"/settings/storage/?.*"})),Ye(wn.call(null,u)),Ye(ei.call(null,p,{path:"/settings/auth-providers/?.*"})),Ye(wn.call(null,p)),Ye(ei.call(null,v,{path:"/settings/tokens/?.*"})),Ye(wn.call(null,v)),Ye(ei.call(null,y,{path:"/settings/admins/?.*"})),Ye(wn.call(null,y))],$=!0)},p:re,i:re,o:re,d(M){M&&k(e),$=!1,Qe(S)}}}class Ts extends Oe{constructor(e){super(),De(this,e,null,PM,Te,{})}}function Uh(n,e,t){const i=n.slice();return i[31]=e[t],i}function Wh(n){let e,t;return e=new Pe({props:{class:"form-field disabled",name:"id",$$slots:{default:[LM,({uniqueId:i})=>({30:i}),({uniqueId:i})=>[i?1073741824:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&1073741826|s[1]&8&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function LM(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="ID",o=T(),r=_("input"),h(t,"class",G.getFieldTypeIcon("primary")),h(s,"class","txt"),h(e,"for",l=n[30]),h(r,"type","text"),h(r,"id",a=n[30]),r.value=u=n[1].id,r.disabled=!0},m(f,c){w(f,e,c),m(e,t),m(e,i),m(e,s),w(f,o,c),w(f,r,c)},p(f,c){c[0]&1073741824&&l!==(l=f[30])&&h(e,"for",l),c[0]&1073741824&&a!==(a=f[30])&&h(r,"id",a),c[0]&2&&u!==(u=f[1].id)&&r.value!==u&&(r.value=u)},d(f){f&&k(e),f&&k(o),f&&k(r)}}}function Yh(n){let e,t,i,s,l,o,r;function a(){return n[17](n[31])}function u(...f){return n[18](n[31],...f)}return{c(){e=_("figure"),t=_("img"),s=T(),Kn(t.src,i="/_/images/avatars/avatar"+n[31]+".svg")||h(t,"src",i),h(t,"alt","Avatar "+n[31]),h(e,"tabindex","0"),h(e,"class",l="link-fade thumb thumb-circle "+(n[31]==n[2]?"thumb-active":"thumb-sm"))},m(f,c){w(f,e,c),m(e,t),m(e,s),o||(r=[Q(e,"click",a),Q(e,"keydown",u)],o=!0)},p(f,c){n=f,c[0]&4&&l!==(l="link-fade thumb thumb-circle "+(n[31]==n[2]?"thumb-active":"thumb-sm"))&&h(e,"class",l)},d(f){f&&k(e),o=!1,Qe(r)}}}function FM(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=_("i"),i=T(),s=_("span"),s.textContent="Email",o=T(),r=_("input"),h(t,"class",G.getFieldTypeIcon("email")),h(s,"class","txt"),h(e,"for",l=n[30]),h(r,"type","email"),h(r,"autocomplete","off"),h(r,"id",a=n[30]),r.required=!0},m(c,d){w(c,e,d),m(e,t),m(e,i),m(e,s),w(c,o,d),w(c,r,d),we(r,n[3]),u||(f=Q(r,"input",n[19]),u=!0)},p(c,d){d[0]&1073741824&&l!==(l=c[30])&&h(e,"for",l),d[0]&1073741824&&a!==(a=c[30])&&h(r,"id",a),d[0]&8&&r.value!==c[3]&&we(r,c[3])},d(c){c&&k(e),c&&k(o),c&&k(r),u=!1,f()}}}function Kh(n){let e,t;return e=new Pe({props:{class:"form-field form-field-toggle",$$slots:{default:[IM,({uniqueId:i})=>({30:i}),({uniqueId:i})=>[i?1073741824:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,s){const l={};s[0]&1073741840|s[1]&8&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function IM(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=N("Change password"),h(e,"type","checkbox"),h(e,"id",t=n[30]),h(s,"for",o=n[30])},m(u,f){w(u,e,f),e.checked=n[4],w(u,i,f),w(u,s,f),m(s,l),r||(a=Q(e,"change",n[20]),r=!0)},p(u,f){f[0]&1073741824&&t!==(t=u[30])&&h(e,"id",t),f[0]&16&&(e.checked=u[4]),f[0]&1073741824&&o!==(o=u[30])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Zh(n){let e,t,i,s,l,o,r,a,u;return s=new Pe({props:{class:"form-field required",name:"password",$$slots:{default:[RM,({uniqueId:f})=>({30:f}),({uniqueId:f})=>[f?1073741824:0]]},$$scope:{ctx:n}}}),r=new Pe({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[NM,({uniqueId:f})=>({30:f}),({uniqueId:f})=>[f?1073741824:0]]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),i=_("div"),B(s.$$.fragment),l=T(),o=_("div"),B(r.$$.fragment),h(i,"class","col-sm-6"),h(o,"class","col-sm-6"),h(t,"class","grid"),h(e,"class","col-12")},m(f,c){w(f,e,c),m(e,t),m(t,i),V(s,i,null),m(t,l),m(t,o),V(r,o,null),u=!0},p(f,c){const d={};c[0]&1073742080|c[1]&8&&(d.$$scope={dirty:c,ctx:f}),s.$set(d);const p={};c[0]&1073742336|c[1]&8&&(p.$$scope={dirty:c,ctx:f}),r.$set(p)},i(f){u||(A(s.$$.fragment,f),A(r.$$.fragment,f),Ot(()=>{a||(a=lt(t,xt,{duration:150},!0)),a.run(Line truncated
|
||||
<span class="txt">Delete</span>`,h(e,"type","button"),h(e,"class","dropdown-item")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[15]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function VM(n){let e,t,i,s,l,o,r=n[1].isNew?"Create":"Save changes",a,u,f,c,d,p=!n[1].isNew&&Gh(n);return{c(){p&&p.c(),e=T(),t=_("button"),i=_("span"),i.textContent="Cancel",s=T(),l=_("button"),o=_("span"),a=N(r),h(i,"class","txt"),h(t,"type","button"),h(t,"class","btn btn-secondary"),t.disabled=n[6],h(o,"class","txt"),h(l,"type","submit"),h(l,"form",n[11]),h(l,"class","btn btn-expanded"),l.disabled=u=!n[10]||n[6],se(l,"btn-loading",n[6])},m(g,v){p&&p.m(g,v),w(g,e,v),w(g,t,v),m(t,i),w(g,s,v),w(g,l,v),m(l,o),m(o,a),f=!0,c||(d=Q(t,"click",n[16]),c=!0)},p(g,v){g[1].isNew?p&&(Ee(),P(p,1,1,()=>{p=null}),Ae()):p?(p.p(g,v),v[0]&2&&A(p,1)):(p=Gh(g),p.c(),A(p,1),p.m(e.parentNode,e)),(!f||v[0]&64)&&(t.disabled=g[6]),(!f||v[0]&2)&&r!==(r=g[1].isNew?"Create":"Save changes")&&ge(a,r),(!f||v[0]&1088&&u!==(u=!g[10]||g[6]))&&(l.disabled=u),v[0]&64&&se(l,"btn-loading",g[6])},i(g){f||(A(p),f=!0)},o(g){P(p),f=!1},d(g){p&&p.d(g),g&&k(e),g&&k(t),g&&k(s),g&&k(l),c=!1,d()}}}function zM(n){let e,t,i={popup:!0,class:"admin-panel",beforeHide:n[23],$$slots:{footer:[VM],header:[jM],default:[HM]},$$scope:{ctx:n}};return e=new ki({props:i}),n[24](e),e.$on("hide",n[25]),e.$on("show",n[26]),{c(){B(e.$$.fragment)},m(s,l){V(e,s,l),t=!0},p(s,l){const o={};l[0]&1152&&(o.beforeHide=s[23]),l[0]&1886|l[1]&8&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){P(e.$$.fragment,s),t=!1},d(s){n[24](null),z(e,s)}}}function BM(n,e,t){let i;const s=rn(),l="admin_"+G.randomString(5);let o,r=new _s,a=!1,u=!1,f=0,c="",d="",p="",g=!1;function v(W){return y(W),t(7,u=!0),o==null?void 0:o.show()}function b(){return o==null?void 0:o.hide()}function y(W){Fi({}),t(1,r=W!=null&&W.clone?W.clone():new _s),$()}function $(){t(4,g=!1),t(3,c=(r==null?void 0:r.email)||""),t(2,f=(r==null?void 0:r.avatar)||0),t(8,d=""),t(9,p="")}function S(){if(a||!i)return;t(6,a=!0);const W={email:c,avatar:f};(r.isNew||g)&&(W.password=d,W.passwordConfirm=p);let X;r.isNew?X=ye.Admins.create(W):X=ye.Admins.update(r.id,W),X.then(async ne=>{var ue;t(7,u=!1),b(),cn(r.isNew?"Successfully created admin.":"Successfully updated admin."),s("save",ne),((ue=ye.AuthStore.model)==null?void 0:ue.id)===ne.id&&ye.AuthStore.save(ye.AuthStore.token,ne)}).catch(ne=>{ye.errorResponseHandler(ne)}).finally(()=>{t(6,a=!1)})}function M(){!(r!=null&&r.id)||bi("Do you really want to delete the selected admin?",()=>ye.Admins.delete(r.id).then(()=>{t(7,u=!1),b(),cn("Successfully deleted admin."),s("delete",r)}).catch(W=>{ye.errorResponseHandler(W)}))}const C=()=>M(),D=()=>b(),O=W=>t(2,f=W),E=(W,X)=>{(X.code==="Enter"||X.code==="Space")&&(X.preventDefault(),t(2,f=W))};function F(){c=this.value,t(3,c)}function L(){g=this.checked,t(4,g)}function R(){d=this.value,t(8,d)}function H(){p=this.value,t(9,p)}const te=()=>i&&u?(bi("You have unsaved changes. Do you really want to close the panel?",()=>{t(7,u=!1),b()}),!1):!0;function le(W){me[W?"unshift":"push"](()=>{o=W,t(5,o)})}function q(W){at.call(this,n,W)}function Y(W){at.call(this,n,W)}return n.$$.update=()=>{n.$$.dirty[0]&30&&t(10,i=r.isNew&&c!=""||g||c!==r.email||f!==r.avatar)},[b,r,f,c,g,o,a,u,d,p,i,l,S,M,v,C,D,O,E,F,L,R,H,te,le,q,Y]}class UM extends Oe{constructor(e){super(),De(this,e,BM,zM,Te,{show:14,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[14]}get hide(){return this.$$.ctx[0]}}function Jh(n,e,t){const i=n.slice();return i[24]=e[t],i}function WM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="id",h(t,"class",G.getFieldTypeIcon("primary")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function YM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="email",h(t,"class",G.getFieldTypeIcon("email")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function KM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="created",h(t,"class",G.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function ZM(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=T(),s=_("span"),s.textContent="updated",h(t,"class",G.getFieldTypeIcon("date")),h(s,"class","txt"),h(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:re,d(l){l&&k(e)}}}function Xh(n){let e;function t(l,o){return l[5]?JM:GM}let i=t(n),s=i(n);return{c(){s.c(),e=st()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function GM(n){var r;let e,t,i,s,l,o=((r=n[1])==null?void 0:r.length)&&Qh(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No admins found.",s=T(),o&&o.c(),l=T(),h(t,"colspan","99"),h(t,"class","txtLine truncated
|
||||
`},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Qh(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='<span class="txt">Clear filters</span>',h(e,"type","button"),h(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=Q(e,"click",n[17]),t=!0)},p:re,d(s){s&&k(e),t=!1,i()}}}function xh(n){let e;return{c(){e=_("span"),e.textContent="You",h(e,"class","label label-warning m-l-5")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function ep(n,e){let t,i,s,l,o,r,a,u,f,c,d,p,g=e[24].email+"",v,b,y,$,S,M,C,D,O,E,F,L,R,H;u=new Ko({props:{id:e[24].id}});let te=e[24].id===e[7].id&&xh();S=new _i({props:{date:e[24].created}}),D=new _i({props:{date:e[24].updated}});function le(){return e[15](e[24])}function q(...Y){return e[16](e[24],...Y)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("figure"),l=_("img"),r=T(),a=_("td"),B(u.$$.fragment),f=T(),te&&te.c(),c=T(),d=_("td"),p=_("span"),v=N(g),y=T(),$=_("td"),B(S.$$.fragment),M=T(),C=_("td"),B(D.$$.fragment),O=T(),E=_("td"),E.innerHTML='<i class="ri-arrow-right-line"></i>',F=T(),Kn(l.src,o="/_/images/avatars/avatar"+(e[24].avatar||0)+".svg")||h(l,"src",o),h(l,"alt","Admin avatar"),h(s,"class","thumb thumb-sm thumb-circle"),h(i,"class","min-width"),h(a,"class","col-type-text col-field-id"),h(p,"class","txt txt-ellipsis"),h(p,"title",b=e[24].email),h(d,"class","col-type-email col-field-email"),h($,"class","col-type-date col-field-created"),h(C,"class","col-type-date col-field-updated"),h(E,"class","col-type-action min-width"),h(t,"tabindex","0"),h(t,"class","row-handle"),this.first=t},m(Y,W){w(Y,t,W),m(t,i),m(i,s),m(s,l),m(t,r),m(t,a),V(u,a,null),m(a,f),te&&te.m(a,null),m(t,c),m(t,d),m(d,p),m(p,v),m(t,y),m(t,$),V(S,$,null),m(t,M),m(t,C),V(D,C,null),m(t,O),m(t,E),m(t,F),L=!0,R||(H=[Q(t,"click",le),Q(t,"keydown",q)],R=!0)},p(Y,W){e=Y,(!L||W&16&&!Kn(l.src,o="/_/images/avatars/avatar"+(e[24].avatar||0)+".svg"))&&h(l,"src",o);const X={};W&16&&(X.id=e[24].id),u.$set(X),e[24].id===e[7].id?te||(te=xh(),te.c(),te.m(a,null)):te&&(te.d(1),te=null),(!L||W&16)&&g!==(g=e[24].email+"")&&ge(v,g),(!L||W&16&&b!==(b=e[24].email))&&h(p,"title",b);const ne={};W&16&&(ne.date=e[24].created),S.$set(ne);const ue={};W&16&&(ue.date=e[24].updated),D.$set(ue)},i(Y){L||(A(u.$$.fragment,Y),A(S.$$.fragment,Y),A(D.$$.fragment,Y),L=!0)},o(Y){P(u.$$.fragment,Y),P(S.$$.fragment,Y),P(D.$$.fragment,Y),L=!1},d(Y){Y&&k(t),z(u),te&&te.d(),z(S),z(D),R=!1,Qe(H)}}}function tp(n){let e,t,i=n[4].length+"",s,l,o=n[4].length+"",r;return{c(){e=_("small"),t=N("Showing "),s=N(i),l=N(" of "),r=N(o),h(e,"class","block txt-hint txt-right m-t-sm")},m(a,u){w(a,e,u),m(e,t),m(e,s),m(e,l),m(e,r)},p(a,u){u&16&&i!==(i=a[4].length+"")&&ge(s,i),u&16&&o!==(o=a[4].length+"")&&ge(r,o)},d(a){a&&k(e)}}}function XM(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,S,M,C,D,O,E,F,L,R,H,te,le,q,Y,W,X,ne,ue,Me,oe,he,be=[],K=new Map,Se,x,J,ve,Re,Ve;e=new Ts({}),c=new Vo({}),c.$on("refresh",n[8]),y=new qo({props:{value:n[1],placeholder:"Search filter, eg. email='test@example.com'",extraAutocompleteKeys:["email"]}}),y.$on("submit",n[10]);function Z(ie){n[11](ie)}let fe={class:"col-type-text",name:"id",$$slots:{default:[WM]},$$scope:{ctx:n}};n[2]!==void 0&&(fe.sort=n[2]),F=new en({props:fe}),me.push(()=>Le(F,"sort",Z));function de(ie){n[12](ie)}let ke={class:"col-type-email col-field-email",name:"email",$$slots:{default:[YM]},$$scope:{ctx:n}};n[2]!==void 0&&(ke.sort=n[2]),H=new en({props:ke}),me.push(()=>Le(H,"sort",de));function Ge(ie){n[13](ie)}let ot={class:"col-type-date col-field-created",name:"created",$$slots:{default:[KM]},$$scope:{ctx:n}};n[2]!==void 0&&(ot.sort=n[2]),q=new en({props:ot}),me.push(()=>Le(q,"sort",Ge));function xe(ie){n[14](ie)}let _t={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[ZM]},$$scope:{ctx:n}};n[2]!==void 0&&(_t.sort=n[2]),X=new en({props:_t}),me.push(()=>Le(X,"sort",xe));let tt=n[4];const $t=ie=>ie[24].id;for(let ie=0;ie<tt.length;ie+=1){let _e=Jh(n,tt,ie),Ue=$t(_e);K.set(Ue,be[ie]=ep(Ue,_e))}let ze=null;tt.length||(ze=Xh(n));let Be=n[4].length&&tp(n),ct={};return J=new UM({props:ct}),n[18](J),J.$on("save",n[19]),J.$on("delete",n[20]),{c(){B(e.$$.fragment),t=T(),i=_("main"),s=_("header"),l=_("nav"),o=_("div"),o.textContent="Settings",r=T(),a=_("div"),u=N(n[6]),f=T(),B(c.$$.fragment),d=T(),p=_("div"),g=T(),v=_("button"),v.innerHTML=`<i class="ri-add-line"></i>
|
||||
<span class="txt">New admin</span>`,b=T(),B(y.$$.fragment),$=T(),S=_("div"),M=_("table"),C=_("thead"),D=_("tr"),O=_("th"),E=T(),B(F.$$.fragment),R=T(),B(H.$$.fragment),le=T(),B(q.$$.fragment),W=T(),B(X.$$.fragment),ue=T(),Me=_("th"),oe=T(),he=_("tbody");for(let ie=0;ie<be.length;ie+=1)be[ie].c();ze&&ze.c(),Se=T(),Be&&Be.c(),x=T(),B(J.$$.fragment),h(o,"class","breadcrumb-item"),h(a,"class","breadcrumb-item"),h(l,"class","breadcrumbs"),h(p,"class","flex-fill"),h(v,"type","button"),h(v,"class","btn btn-expanded"),h(s,"class","page-header"),h(O,"class","min-width"),h(Me,"class","col-type-action min-width"),h(M,"class","table"),se(M,"table-loading",n[5]),h(S,"class","table-wrapper"),h(i,"class","page-wrapper")},m(ie,_e){V(e,ie,_e),w(ie,t,_e),w(ie,i,_e),m(i,s),m(s,l),m(l,o),m(l,r),m(l,a),m(a,u),m(s,f),V(c,s,null),m(s,d),m(s,p),m(s,g),m(s,v),m(i,b),V(y,i,null),m(i,$),m(i,S),m(S,M),m(M,C),m(C,D),m(D,O),m(D,E),V(F,D,null),m(D,R),V(H,D,null),m(D,le),V(q,D,null),m(D,W),V(X,D,null),m(D,ue),m(D,Me),m(M,oe),m(M,he);for(let Ue=0;Ue<be.length;Ue+=1)be[Ue].m(he,null);ze&&ze.m(he,null),m(i,Se),Be&&Be.m(i,null),w(ie,x,_e),V(J,ie,_e),ve=!0,Re||(Ve=Q(v,"click",n[9]),Re=!0)},p(ie,[_e]){(!ve||_e&64)&&ge(u,ie[6]);const Ue={};_e&2&&(Ue.value=ie[1]),y.$set(Ue);const nt={};_e&134217728&&(nt.$$scope={dirty:_e,ctx:ie}),!L&&_e&4&&(L=!0,nt.sort=ie[2],Ie(()=>L=!1)),F.$set(nt);const rt={};_e&134217728&&(rt.$$scope={dirty:_e,ctx:ie}),!te&&_e&4&&(te=!0,rt.sort=ie[2],Ie(()=>te=!1)),H.$set(rt);const Je={};_e&134217728&&(Je.$$scope={dirty:_e,ctx:ie}),!Y&&_e&4&&(Y=!0,Je.sort=ie[2],Ie(()=>Y=!1)),q.$set(Je);const Ct={};_e&134217728&&(Ct.$$scope={dirty:_e,ctx:ie}),!ne&&_e&4&&(ne=!0,Ct.sort=ie[2],Ie(()=>ne=!1)),X.$set(Ct),_e&186&&(tt=ie[4],Ee(),be=St(be,_e,$t,1,ie,tt,K,he,Gt,ep,null,Jh),Ae(),!tt.length&&ze?ze.p(ie,_e):tt.length?ze&&(ze.d(1),ze=null):(ze=Xh(ie),ze.c(),ze.m(he,null))),_e&32&&se(M,"table-loading",ie[5]),ie[4].length?Be?Be.p(ie,_e):(Be=tp(ie),Be.c(),Be.m(i,null)):Be&&(Be.d(1),Be=null);const Lt={};J.$set(Lt)},i(ie){if(!ve){A(e.$$.fragment,ie),A(c.$$.fragment,ie),A(y.$$.fragment,ie),A(F.$$.fragment,ie),A(H.$$.fragment,ie),A(q.$$.fragment,ie),A(X.$$.fragment,ie);for(let _e=0;_e<tt.length;_e+=1)A(be[_e]);A(J.$$.fragment,ie),ve=!0}},o(ie){P(e.$$.fragment,ie),P(c.$$.fragment,ie),P(y.$$.fragment,ie),P(F.$$.fragment,ie),P(H.$$.fragment,ie),P(q.$$.fragment,ie),P(X.$$.fragment,ie);for(let _e=0;_e<be.length;_e+=1)P(be[_e]);P(J.$$.fragment,ie),ve=!1},d(ie){z(e,ie),ie&&k(t),ie&&k(i),z(c),z(y),z(F),z(H),z(q),z(X);for(let _e=0;_e<be.length;_e+=1)be[_e].d();ze&&ze.d(),Be&&Be.d(),ie&&k(x),n[18](null),z(J,ie),Re=!1,Ve()}}}function QM(n,e,t){let i,s,l;kt(n,Fo,R=>t(21,i=R)),kt(n,Jt,R=>t(6,s=R)),kt(n,ga,R=>t(7,l=R)),_n(Jt,s="Admins",s);const o=new URLSearchParams(i);let r,a=[],u=!1,f=o.get("filter")||"",c=o.get("sort")||"-created";function d(){return t(5,u=!0),t(4,a=[]),ye.Admins.getFullList(100,{sort:c||"-created",filter:f}).then(R=>{t(4,a=R),t(5,u=!1)}).catch(R=>{R!=null&&R.isAbort||(t(5,u=!1),console.warn(R),p(),ye.errorResponseHandler(R,!1))})}function p(){t(4,a=[])}const g=()=>d(),v=()=>r==null?void 0:r.show(),b=R=>t(1,f=R.detail);function y(R){c=R,t(2,c)}function $(R){c=R,t(2,c)}function S(R){c=R,t(2,c)}function M(R){c=R,t(2,c)}const C=R=>r==null?void 0:r.show(R),D=(R,H)=>{(H.code==="Enter"||H.code==="Space")&&(H.preventDefault(),r==null||r.show(R))},O=()=>t(1,f="");function E(R){me[R?"unshift":"push"](()=>{r=R,t(3,r)})}const F=()=>d(),L=()=>d();return n.$$.update=()=>{if(n.$$.dirty&6&&c!==-1&&f!==-1){const R=new URLSearchParams({filter:f,sort:c}).toString();vi("/settings/admins?"+R),d()}},[d,f,c,r,a,u,s,l,g,v,b,y,$,S,M,C,D,O,E,F,L]}class xM extends Oe{constructor(e){super(),De(this,e,QM,XM,Te,{loadAdmins:0})}get loadAdmins(){return this.$$.ctx[0]}}function eT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Email"),s=T(),l=_("input"),h(e,"for",i=n[8]),h(l,"type","email"),h(l,"id",o=n[8]),l.required=!0,l.autofocus=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0]),l.focus(),r||(a=Q(l,"input",n[4]),r=!0)},p(u,f){f&256&&i!==(i=u[8])&&h(e,"for",i),f&256&&o!==(o=u[8])&&h(l,"id",o),f&1&&l.value!==u[0]&&we(l,u[0])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function tT(n){let e,t,i,s,l,o,r,a,u,f,c;return{c(){e=_("label"),t=N("Password"),s=T(),l=_("input"),r=T(),a=_("div"),u=_("a"),u.textContent="Forgotten password?",h(e,"for",i=n[8]),h(l,"type","password"),h(l,"id",o=n[8]),l.required=!0,h(u,"href","/request-password-reset"),h(u,"class","link-hint"),h(a,"class","help-block")},m(d,p){w(d,e,p),m(e,t),w(d,s,p),w(d,l,p),we(l,n[1]),w(d,r,p),w(d,a,p),m(a,u),f||(c=[Q(l,"input",n[5]),Ye(wn.call(null,u))],f=!0)},p(d,p){p&256&&i!==(i=d[8])&&h(e,"for",i),p&256&&o!==(o=d[8])&&h(l,"id",o),p&2&&l.value!==d[1]&&we(l,d[1])},d(d){d&&k(e),d&&k(s),d&&k(l),d&&k(r),d&&k(a),f=!1,Qe(c)}}}function nT(n){let e,t,i,s,l,o,r,a,u,f,c;return s=new Pe({props:{class:"form-field required",name:"email",$$slots:{default:[eT,({uniqueId:d})=>({8:d}),({uniqueId:d})=>d?256:0]},$Line truncated
|
||||
<i class="ri-arrow-right-line"></i>`,h(t,"class","content txt-center m-b-base"),h(a,"type","submit"),h(a,"class","btn btn-lg btn-block btn-next"),se(a,"btn-disabled",n[2]),se(a,"btn-loading",n[2]),h(e,"class","block")},m(d,p){w(d,e,p),m(e,t),m(e,i),V(s,e,null),m(e,l),V(o,e,null),m(e,r),m(e,a),u=!0,f||(c=Q(e,"submit",Wt(n[3])),f=!0)},p(d,p){const g={};p&769&&(g.$$scope={dirty:p,ctx:d}),s.$set(g);const v={};p&770&&(v.$$scope={dirty:p,ctx:d}),o.$set(v),p&4&&se(a,"btn-disabled",d[2]),p&4&&se(a,"btn-loading",d[2])},i(d){u||(A(s.$$.fragment,d),A(o.$$.fragment,d),u=!0)},o(d){P(s.$$.fragment,d),P(o.$$.fragment,d),u=!1},d(d){d&&k(e),z(s),z(o),f=!1,c()}}}function iT(n){let e,t;return e=new Vm({props:{$$slots:{default:[nT]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,s){V(e,i,s),t=!0},p(i,[s]){const l={};s&519&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){P(e.$$.fragment,i),t=!1},d(i){z(e,i)}}}function sT(n,e,t){let i;kt(n,Fo,c=>t(6,i=c));const s=new URLSearchParams(i);let l=s.get("demoEmail")||"",o=s.get("demoPassword")||"",r=!1;function a(){if(!r)return t(2,r=!0),ye.Admins.authViaEmail(l,o).then(()=>{vi("/")}).catch(()=>{Rm("Invalid login credentials.")}).finally(()=>{t(2,r=!1)})}function u(){l=this.value,t(0,l)}function f(){o=this.value,t(1,o)}return[l,o,r,a,u,f]}class lT extends Oe{constructor(e){super(),De(this,e,sT,iT,Te,{})}}function oT(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$;return i=new Pe({props:{class:"form-field required",name:"meta.appName",$$slots:{default:[aT,({uniqueId:S})=>({14:S}),({uniqueId:S})=>S?16384:0]},$$scope:{ctx:n}}}),o=new Pe({props:{class:"form-field required",name:"meta.appUrl",$$slots:{default:[uT,({uniqueId:S})=>({14:S}),({uniqueId:S})=>S?16384:0]},$$scope:{ctx:n}}}),a=new Pe({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[fT,({uniqueId:S})=>({14:S}),({uniqueId:S})=>S?16384:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),B(a.$$.fragment),u=T(),f=_("div"),c=_("div"),d=T(),p=_("button"),g=_("span"),g.textContent="Save changes",h(t,"class","col-lg-6"),h(l,"class","col-lg-6"),h(c,"class","flex-fill"),h(g,"class","txt"),h(p,"type","submit"),h(p,"class","btn btn-expanded"),p.disabled=v=!n[3]||n[2],se(p,"btn-loading",n[2]),h(f,"class","col-lg-12 flex"),h(e,"class","grid")},m(S,M){w(S,e,M),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),V(a,e,null),m(e,u),m(e,f),m(f,c),m(f,d),m(f,p),m(p,g),b=!0,y||($=Q(p,"click",n[9]),y=!0)},p(S,M){const C={};M&49153&&(C.$$scope={dirty:M,ctx:S}),i.$set(C);const D={};M&49153&&(D.$$scope={dirty:M,ctx:S}),o.$set(D);const O={};M&49153&&(O.$$scope={dirty:M,ctx:S}),a.$set(O),(!b||M&12&&v!==(v=!S[3]||S[2]))&&(p.disabled=v),M&4&&se(p,"btn-loading",S[2])},i(S){b||(A(i.$$.fragment,S),A(o.$$.fragment,S),A(a.$$.fragment,S),b=!0)},o(S){P(i.$$.fragment,S),P(o.$$.fragment,S),P(a.$$.fragment,S),b=!1},d(S){S&&k(e),z(i),z(o),z(a),y=!1,$()}}}function rT(n){let e;return{c(){e=_("div"),h(e,"class","loader")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function aT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Application name"),s=T(),l=_("input"),h(e,"for",i=n[14]),h(l,"type","text"),h(l,"id",o=n[14]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].meta.appName),r||(a=Q(l,"input",n[6]),r=!0)},p(u,f){f&16384&&i!==(i=u[14])&&h(e,"for",i),f&16384&&o!==(o=u[14])&&h(l,"id",o),f&1&&l.value!==u[0].meta.appName&&we(l,u[0].meta.appName)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function uT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Application url"),s=T(),l=_("input"),h(e,"for",i=n[14]),h(l,"type","text"),h(l,"id",o=n[14]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].meta.appUrl),r||(a=Q(l,"input",n[7]),r=!0)},p(u,f){f&16384&&i!==(i=u[14])&&h(e,"for",i),f&16384&&o!==(o=u[14])&&h(l,"id",o),f&1&&l.value!==u[0].meta.appUrl&&we(l,u[0].meta.appUrl)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function fT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Logs max days retention"),s=T(),l=_("input"),h(e,"for",i=n[14]),h(l,"type","number"),h(l,"id",o=n[14]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].logs.maxDays),r||(a=Q(l,"input",n[8]),r=!0)},p(u,f){f&16384&&i!==(i=u[14])&&h(e,"for",i),f&16384&&o!==(o=u[14])&&h(l,"id",o),f&1&&Pt(l.value)!==u[0].logs.maxDays&&we(l,u[0].logs.maxDays)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function cT(n){let e,t,i,s,l,o,r,a,u,f,c,d;e=new Ts({});const p=[rT,oT],g=[];function v(b,y){return b[1]?0:1}return a=v(n),u=g[a]=p[a](n),{c(){B(e.$$.fragment),t=T(),i=_("main"),s=_("header"),s.innerHTML=`<nav class="breadcrumbs"><div class="breadcrumb-item">Settings</div>
|
||||
<div class="breadcrumb-item">Application</div></nav>`,l=T(),o=_("div"),r=_("form"),u.c(),h(s,"class","page-header"),h(r,"class","panel"),h(r,"autocomplete","off"),h(o,"class","wrapper"),h(i,"class","page-wrapper")},m(b,y){V(e,b,y),w(b,t,y),w(b,i,y),m(i,s),m(i,l),m(i,o),m(o,r),g[a].m(r,null),f=!0,c||(d=Q(r,"submit",Wt(n[4])),c=!0)},p(b,[y]){let $=a;a=v(b),a===$?g[a].p(b,y):(Ee(),P(g[$],1,1,()=>{g[$]=null}),Ae(),u=g[a],u?u.p(b,y):(u=g[a]=p[a](b),u.c()),A(u,1),u.m(r,null))},i(b){f||(A(e.$$.fragment,b),A(u),f=!0)},o(b){P(e.$$.fragment,b),P(u),f=!1},d(b){z(e,b),b&&k(t),b&&k(i),g[a].d(),c=!1,d()}}}function dT(n,e,t){let i,s,l;kt(n,mo,y=>t(10,s=y)),kt(n,Jt,y=>t(11,l=y)),_n(Jt,l="Application settings",l);let o={},r=!1,a=!1,u="";f();async function f(){t(1,r=!0);try{const y=await ye.Settings.getAll()||{};d(y)}catch(y){ye.errorResponseHandler(y)}t(1,r=!1)}async function c(){if(!(a||!i)){t(2,a=!0);try{const y=await ye.Settings.update(G.filterRedactedProps(o));d(y),cn("Successfully saved application settings.")}catch(y){ye.errorResponseHandler(y)}t(2,a=!1)}}function d(y={}){var $;_n(mo,s=($=y==null?void 0:y.meta)==null?void 0:$.appName,s),t(0,o={meta:(y==null?void 0:y.meta)||{},logs:(y==null?void 0:y.logs)||{}}),t(5,u=JSON.stringify(o))}function p(){o.meta.appName=this.value,t(0,o)}function g(){o.meta.appUrl=this.value,t(0,o)}function v(){o.logs.maxDays=Pt(this.value),t(0,o)}const b=()=>c();return n.$$.update=()=>{n.$$.dirty&33&&t(3,i=u!=JSON.stringify(o))},[o,r,a,i,c,u,p,g,v,b]}class hT extends Oe{constructor(e){super(),De(this,e,dT,cT,Te,{})}}function pT(n){let e,t,i,s=[{type:"password"},{autocomplete:"new-password"},n[5]],l={};for(let o=0;o<s.length;o+=1)l=ft(l,s[o]);return{c(){e=_("input"),si(e,l)},m(o,r){w(o,e,r),e.autofocus&&e.focus(),n[7](e),we(e,n[0]),t||(i=Q(e,"input",n[8]),t=!0)},p(o,r){si(e,l=dn(s,[{type:"password"},{autocomplete:"new-password"},r&32&&o[5]])),r&1&&e.value!==o[0]&&we(e,o[0])},d(o){o&&k(e),n[7](null),t=!1,i()}}}function mT(n){let e,t,i,s,l,o,r=[{readOnly:!0},{type:"text"},{placeholder:n[1]},n[5]],a={};for(let u=0;u<r.length;u+=1)a=ft(a,r[u]);return{c(){e=_("div"),t=_("button"),t.innerHTML='<i class="ri-key-line"></i>',i=T(),s=_("input"),h(t,"type","button"),h(t,"class","btn btn-secondary btn-circle"),h(e,"class","form-field-addon"),si(s,a)},m(u,f){w(u,e,f),m(e,t),w(u,i,f),w(u,s,f),s.autofocus&&s.focus(),l||(o=[Ye(wt.call(null,t,{position:"left",text:"Set new value"})),Q(t,"click",n[6])],l=!0)},p(u,f){si(s,a=dn(r,[{readOnly:!0},{type:"text"},f&2&&{placeholder:u[1]},f&32&&u[5]]))},d(u){u&&k(e),u&&k(i),u&&k(s),l=!1,Qe(o)}}}function gT(n){let e;function t(l,o){return l[3]?mT:pT}let i=t(n),s=i(n);return{c(){s.c(),e=st()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:re,o:re,d(l){s.d(l),l&&k(e)}}}function _T(n,e,t){const i=["value","mask"];let s=Zt(e,i),{value:l=""}=e,{mask:o="******"}=e,r,a=!1;async function u(){t(0,l=""),t(3,a=!1),await oi(),r==null||r.focus()}const f=()=>u();function c(p){me[p?"unshift":"push"](()=>{r=p,t(2,r)})}function d(){l=this.value,t(0,l)}return n.$$set=p=>{e=ft(ft({},e),li(p)),t(5,s=Zt(e,i)),"value"in p&&t(0,l=p.value),"mask"in p&&t(1,o=p.mask)},n.$$.update=()=>{n.$$.dirty&3&&l===o&&t(3,a=!0)},[l,o,r,a,u,s,f,c,d]}class Ba extends Oe{constructor(e){super(),De(this,e,_T,gT,Te,{value:0,mask:1})}}function bT(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,S,M,C,D,O,E,F,L,R,H,te;i=new Pe({props:{class:"form-field required",name:"meta.senderName",$$slots:{default:[yT,({uniqueId:q})=>({23:q}),({uniqueId:q})=>q?8388608:0]},$$scope:{ctx:n}}}),o=new Pe({props:{class:"form-field required",name:"meta.senderAddress",$$slots:{default:[kT,({uniqueId:q})=>({23:q}),({uniqueId:q})=>q?8388608:0]},$$scope:{ctx:n}}}),a=new Pe({props:{class:"form-field required",name:"meta.userVerificationUrl",$$slots:{default:[wT,({uniqueId:q})=>({23:q}),({uniqueId:q})=>q?8388608:0]},$$scope:{ctx:n}}}),f=new Pe({props:{class:"form-field required",name:"meta.userResetPasswordUrl",$$slots:{default:[ST,({uniqueId:q})=>({23:q}),({uniqueId:q})=>q?8388608:0]},$$scope:{ctx:n}}}),d=new Pe({props:{class:"form-field required",name:"meta.userConfirmEmailChangeUrl",$$slots:{default:[$T,({uniqueId:q})=>({23:q}),({uniqueId:q})=>q?8388608:0]},$$scope:{ctx:n}}}),$=new Pe({props:{class:"form-field form-field-toggle",$$slots:{default:[CT,({uniqueId:q})=>({23:q}),({uniqueId:q})=>q?8388608:0]},$$scope:{ctx:n}}});let le=n[0].smtp.enabled&&np(n);return{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),B(a.$$.fragment),u=T(),B(f.$$.fragment),c=T(),B(d.$$.fragment),p=T(),g=_("hr"),v=T(),b=_("div"),b.innerHTML=`<p>By default PocketBase uses the OS <code>sendmail</code> command for sending emails.
|
||||
<br/>
|
||||
<strong class="txt-bold">For better emails deliverability it is recommended to enable the SMTP settings
|
||||
below.</strong></p>`,y=T(),B($.$$.fragment),S=T(),le&&le.c(),M=T(),C=_("div"),D=_("div"),O=T(),E=_("button"),F=_("span"),F.textContent="Save changes",h(t,"class","col-lg-6"),h(l,"class","col-lg-6"),h(e,"class","grid"),h(b,"class","content m-b-sm"),h(D,"class","flex-fill"),h(F,"class","txt"),h(E,"type","submit"),h(E,"class","btn btn-expanded"),E.disabled=L=!n[3]||n[2],se(E,"btn-loading",n[2]),h(C,"class","flex")},m(q,Y){w(q,e,Y),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),V(a,e,null),m(e,u),V(f,e,null),m(e,c),V(d,e,null),w(q,p,Y),w(q,g,Y),w(q,v,Y),w(q,b,Y),w(q,y,Y),V($,q,Y),w(q,S,Y),le&&le.m(q,Y),w(q,M,Y),w(q,C,Y),m(C,D),m(C,O),m(C,E),m(E,F),R=!0,H||(te=Q(E,"click",n[19]),H=!0)},p(q,Y){const W={};Y&25165825&&(W.$$scope={dirty:Y,ctx:q}),i.$set(W);const X={};Y&25165825&&(X.$$scope={dirty:Y,ctx:q}),o.$set(X);const ne={};Y&25165825&&(ne.$$scope={dirty:Y,ctx:q}),a.$set(ne);const ue={};Y&25165825&&(ue.$$scope={dirty:Y,ctx:q}),f.$set(ue);const Me={};Y&25165825&&(Me.$$scope={dirty:Y,ctx:q}),d.$set(Me);const oe={};Y&25165825&&(oe.$$scope={dirty:Y,ctx:q}),$.$set(oe),q[0].smtp.enabled?le?(le.p(q,Y),Y&1&&A(le,1)):(le=np(q),le.c(),A(le,1),le.m(M.parentNode,M)):le&&(Ee(),P(le,1,1,()=>{le=null}),Ae()),(!R||Y&12&&L!==(L=!q[3]||q[2]))&&(E.disabled=L),Y&4&&se(E,"btn-loading",q[2])},i(q){R||(A(i.$$.fragment,q),A(o.$$.fragment,q),A(a.$$.fragment,q),A(f.$$.fragment,q),A(d.$$.fragment,q),A($.$$.fragment,q),A(le),R=!0)},o(q){P(i.$$.fragment,q),P(o.$$.fragment,q),P(a.$$.fragment,q),P(f.$$.fragment,q),P(d.$$.fragment,q),P($.$$.fragment,q),P(le),R=!1},d(q){q&&k(e),z(i),z(o),z(a),z(f),z(d),q&&k(p),q&&k(g),q&&k(v),q&&k(b),q&&k(y),z($,q),q&&k(S),le&&le.d(q),q&&k(M),q&&k(C),H=!1,te()}}}function vT(n){let e;return{c(){e=_("div"),h(e,"class","loader")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function yT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Sender name"),s=T(),l=_("input"),h(e,"for",i=n[23]),h(l,"type","text"),h(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].meta.senderName),r||(a=Q(l,"input",n[8]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&h(e,"for",i),f&8388608&&o!==(o=u[23])&&h(l,"id",o),f&1&&l.value!==u[0].meta.senderName&&we(l,u[0].meta.senderName)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function kT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Sender address"),s=T(),l=_("input"),h(e,"for",i=n[23]),h(l,"type","email"),h(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].meta.senderAddress),r||(a=Q(l,"input",n[9]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&h(e,"for",i),f&8388608&&o!==(o=u[23])&&h(l,"id",o),f&1&&l.value!==u[0].meta.senderAddress&&we(l,u[0].meta.senderAddress)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function wT(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=N("User verification page url"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML=`Used in the user verification email. Available placeholder parameters:
|
||||
<code>%APP_URL%</code>, <code>%TOKEN%</code>.`,h(e,"for",i=n[23]),h(l,"type","text"),h(l,"id",o=n[23]),l.required=!0,h(a,"class","help-block")},m(c,d){w(c,e,d),m(e,t),w(c,s,d),w(c,l,d),we(l,n[0].meta.userVerificationUrl),w(c,r,d),w(c,a,d),u||(f=Q(l,"input",n[10]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&h(e,"for",i),d&8388608&&o!==(o=c[23])&&h(l,"id",o),d&1&&l.value!==c[0].meta.userVerificationUrl&&we(l,c[0].meta.userVerificationUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function ST(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=N("User reset password page url"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML=`Used in the user password reset email. Available placeholder parameters:
|
||||
<code>%APP_URL%</code>, <code>%TOKEN%</code>.`,h(e,"for",i=n[23]),h(l,"type","text"),h(l,"id",o=n[23]),l.required=!0,h(a,"class","help-block")},m(c,d){w(c,e,d),m(e,t),w(c,s,d),w(c,l,d),we(l,n[0].meta.userResetPasswordUrl),w(c,r,d),w(c,a,d),u||(f=Q(l,"input",n[11]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&h(e,"for",i),d&8388608&&o!==(o=c[23])&&h(l,"id",o),d&1&&l.value!==c[0].meta.userResetPasswordUrl&&we(l,c[0].meta.userResetPasswordUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function $T(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=N("User confirm email change page url"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML=`Used in the user email change confirmation email. Available placeholder
|
||||
parameters:
|
||||
<code>%APP_URL%</code>, <code>%TOKEN%</code>.`,h(e,"for",i=n[23]),h(l,"type","text"),h(l,"id",o=n[23]),l.required=!0,h(a,"class","help-block")},m(c,d){w(c,e,d),m(e,t),w(c,s,d),w(c,l,d),we(l,n[0].meta.userConfirmEmailChangeUrl),w(c,r,d),w(c,a,d),u||(f=Q(l,"input",n[12]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&h(e,"for",i),d&8388608&&o!==(o=c[23])&&h(l,"id",o),d&1&&l.value!==c[0].meta.userConfirmEmailChangeUrl&&we(l,c[0].meta.userConfirmEmailChangeUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function CT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=N("Use SMTP mail server"),h(e,"type","checkbox"),h(e,"id",t=n[23]),e.required=!0,h(s,"for",o=n[23])},m(u,f){w(u,e,f),e.checked=n[0].smtp.enabled,w(u,i,f),w(u,s,f),m(s,l),r||(a=Q(e,"change",n[13]),r=!0)},p(u,f){f&8388608&&t!==(t=u[23])&&h(e,"id",t),f&1&&(e.checked=u[0].smtp.enabled),f&8388608&&o!==(o=u[23])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function np(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,S;return i=new Pe({props:{class:"form-field required",name:"smtp.host",$$slots:{default:[MT,({uniqueId:M})=>({23:M}),({uniqueId:M})=>M?8388608:0]},$$scope:{ctx:n}}}),o=new Pe({props:{class:"form-field required",name:"smtp.port",$$slots:{default:[TT,({uniqueId:M})=>({23:M}),({uniqueId:M})=>M?8388608:0]},$$scope:{ctx:n}}}),u=new Pe({props:{class:"form-field required",name:"smtp.tls",$$slots:{default:[DT,({uniqueId:M})=>({23:M}),({uniqueId:M})=>M?8388608:0]},$$scope:{ctx:n}}}),d=new Pe({props:{class:"form-field",name:"smtp.username",$$slots:{default:[OT,({uniqueId:M})=>({23:M}),({uniqueId:M})=>M?8388608:0]},$$scope:{ctx:n}}}),v=new Pe({props:{class:"form-field",name:"smtp.password",$$slots:{default:[ET,({uniqueId:M})=>({23:M}),({uniqueId:M})=>M?8388608:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),f=T(),c=_("div"),B(d.$$.fragment),p=T(),g=_("div"),B(v.$$.fragment),b=T(),y=_("div"),h(t,"class","col-lg-6"),h(l,"class","col-lg-3"),h(a,"class","col-lg-3"),h(c,"class","col-lg-6"),h(g,"class","col-lg-6"),h(y,"class","col-lg-12"),h(e,"class","grid")},m(M,C){w(M,e,C),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),m(e,a),V(u,a,null),m(e,f),m(e,c),V(d,c,null),m(e,p),m(e,g),V(v,g,null),m(e,b),m(e,y),S=!0},p(M,C){const D={};C&25165825&&(D.$$scope={dirty:C,ctx:M}),i.$set(D);const O={};C&25165825&&(O.$$scope={dirty:C,ctx:M}),o.$set(O);const E={};C&25165825&&(E.$$scope={dirty:C,ctx:M}),u.$set(E);const F={};C&25165825&&(F.$$scope={dirty:C,ctx:M}),d.$set(F);const L={};C&25165825&&(L.$$scope={dirty:C,ctx:M}),v.$set(L)},i(M){S||(A(i.$$.fragment,M),A(o.$$.fragment,M),A(u.$$.fragment,M),A(d.$$.fragment,M),A(v.$$.fragment,M),M&&Ot(()=>{$||($=lt(e,xt,{duration:150},!0)),$.run(1)}),S=!0)},o(M){P(i.$$.fragment,M),P(o.$$.fragment,M),P(u.$$.fragment,M),P(d.$$.fragment,M),P(v.$$.fragment,M),M&&($||($=lt(e,xt,{duration:150},!1)),$.run(0)),S=!1},d(M){M&&k(e),z(i),z(o),z(u),z(d),z(v),M&&$&&$.end()}}}function MT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("SMTP server host"),s=T(),l=_("input"),h(e,"for",i=n[23]),h(l,"type","text"),h(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].smtp.host),r||(a=Q(l,"input",n[14]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&h(e,"for",i),f&8388608&&o!==(o=u[23])&&h(l,"id",o),f&1&&l.value!==u[0].smtp.host&&we(l,u[0].smtp.host)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function TT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Port"),s=T(),l=_("input"),h(e,"for",i=n[23]),h(l,"type","number"),h(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].smtp.port),r||(a=Q(l,"input",n[15]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&h(e,"for",i),f&8388608&&o!==(o=u[23])&&h(l,"id",o),f&1&&Pt(l.value)!==u[0].smtp.port&&we(l,u[0].smtp.port)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function DT(n){let e,t,i,s,l,o,r;function a(f){n[16](f)}let u={id:n[23],items:n[5]};return n[0].smtp.tls!==void 0&&(u.keyOfSelected=n[0].smtp.tls),l=new ss({props:u}),me.push(()=>Le(l,"keyOfSelected",a)),{c(){e=_("label"),t=N("TLS Encryption"),s=T(),B(l.$$.fragment),h(e,"for",i=n[23])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&8388608&&i!==(i=f[23]))&&h(e,"for",i);const d={};c&8388608&&(d.id=f[23]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].smtp.tls,Ie(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),z(l,f)}}}function OT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Username"),s=T(),l=_("input"),h(e,"for",i=n[23]),h(l,"type","text"),h(l,"id",o=n[23])},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].smtp.username),r||(a=Q(l,"input",n[17]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&h(e,"for",i),f&8388608&&o!==(o=u[23])&&h(l,"id",o),f&1&&l.value!==u[0].smtp.username&&we(l,u[0].smtp.username)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function ET(n){let e,t,i,s,l,o,r;function a(f){n[18](f)}let u={id:Line truncated
|
||||
the
|
||||
`),r=_("strong"),u=N(a),f=N(`
|
||||
to the
|
||||
`),c=_("strong"),p=N(d),g=N(`.
|
||||
`),v=_("br"),b=N(`
|
||||
There are numerous command line tools that can help you, such as:
|
||||
`),y=_("a"),y.textContent=`rclone
|
||||
`,$=N(`,
|
||||
`),S=_("a"),S.textContent=`s5cmd
|
||||
`,M=N(", etc."),C=T(),D=_("div"),h(i,"class","icon"),h(y,"href","https://github.com/rclone/rclone"),h(y,"target","_blank"),h(y,"rel","noopener"),h(y,"class","txt-bold"),h(S,"href","https://github.com/peak/s5cmd"),h(S,"target","_blank"),h(S,"rel","noopener"),h(S,"class","txt-bold"),h(l,"class","content"),h(t,"class","alert alert-warning m-0"),h(D,"class","clearfix m-t-base")},m(F,L){w(F,e,L),m(e,t),m(t,i),m(t,s),m(t,l),m(l,o),m(l,r),m(r,u),m(l,f),m(l,c),m(c,p),m(l,g),m(l,v),m(l,b),m(l,y),m(l,$),m(l,S),m(l,M),m(e,C),m(e,D),E=!0},p(F,L){(!E||L&8)&&a!==(a=F[3]?"S3 storage":"local file system")&&ge(u,a),(!E||L&1)&&d!==(d=F[0].enabled?"S3 storage":"local file system")&&ge(p,d)},i(F){E||(F&&Ot(()=>{O||(O=lt(e,xt,{duration:150},!0)),O.run(1)}),E=!0)},o(F){F&&(O||(O=lt(e,xt,{duration:150},!1)),O.run(0)),E=!1},d(F){F&&k(e),F&&O&&O.end()}}}function sp(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g,v,b,y,$,S,M,C,D;return i=new Pe({props:{class:"form-field required",name:"s3.endpoint",$$slots:{default:[NT,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),o=new Pe({props:{class:"form-field required",name:"s3.bucket",$$slots:{default:[HT,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),u=new Pe({props:{class:"form-field required",name:"s3.region",$$slots:{default:[jT,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),d=new Pe({props:{class:"form-field required",name:"s3.accessKey",$$slots:{default:[qT,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),v=new Pe({props:{class:"form-field required",name:"s3.secret",$$slots:{default:[VT,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),$=new Pe({props:{class:"form-field",name:"s3.forcePathStyle",$$slots:{default:[zT,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),f=T(),c=_("div"),B(d.$$.fragment),p=T(),g=_("div"),B(v.$$.fragment),b=T(),y=_("div"),B($.$$.fragment),S=T(),M=_("div"),h(t,"class","col-lg-12"),h(l,"class","col-lg-6"),h(a,"class","col-lg-6"),h(c,"class","col-lg-6"),h(g,"class","col-lg-6"),h(y,"class","col-lg-12"),h(M,"class","col-lg-12"),h(e,"class","grid")},m(O,E){w(O,e,E),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),m(e,a),V(u,a,null),m(e,f),m(e,c),V(d,c,null),m(e,p),m(e,g),V(v,g,null),m(e,b),m(e,y),V($,y,null),m(e,S),m(e,M),D=!0},p(O,E){const F={};E&1572865&&(F.$$scope={dirty:E,ctx:O}),i.$set(F);const L={};E&1572865&&(L.$$scope={dirty:E,ctx:O}),o.$set(L);const R={};E&1572865&&(R.$$scope={dirty:E,ctx:O}),u.$set(R);const H={};E&1572865&&(H.$$scope={dirty:E,ctx:O}),d.$set(H);const te={};E&1572865&&(te.$$scope={dirty:E,ctx:O}),v.$set(te);const le={};E&1572865&&(le.$$scope={dirty:E,ctx:O}),$.$set(le)},i(O){D||(A(i.$$.fragment,O),A(o.$$.fragment,O),A(u.$$.fragment,O),A(d.$$.fragment,O),A(v.$$.fragment,O),A($.$$.fragment,O),O&&Ot(()=>{C||(C=lt(e,xt,{duration:150},!0)),C.run(1)}),D=!0)},o(O){P(i.$$.fragment,O),P(o.$$.fragment,O),P(u.$$.fragment,O),P(d.$$.fragment,O),P(v.$$.fragment,O),P($.$$.fragment,O),O&&(C||(C=lt(e,xt,{duration:150},!1)),C.run(0)),D=!1},d(O){O&&k(e),z(i),z(o),z(u),z(d),z(v),z($),O&&C&&C.end()}}}function NT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Endpoint"),s=T(),l=_("input"),h(e,"for",i=n[19]),h(l,"type","text"),h(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].endpoint),r||(a=Q(l,"input",n[9]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&h(e,"for",i),f&524288&&o!==(o=u[19])&&h(l,"id",o),f&1&&l.value!==u[0].endpoint&&we(l,u[0].endpoint)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function HT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Bucket"),s=T(),l=_("input"),h(e,"for",i=n[19]),h(l,"type","text"),h(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].bucket),r||(a=Q(l,"input",n[10]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&h(e,"for",i),f&524288&&o!==(o=u[19])&&h(l,"id",o),f&1&&l.value!==u[0].bucket&&we(l,u[0].bucket)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function jT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Region"),s=T(),l=_("input"),h(e,"for",i=n[19]),h(l,"type","text"),h(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].region),r||(a=Q(l,"input",n[11]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&h(e,"for",i),f&524288&&o!==(o=u[19])&&h(l,"id",o),f&1&&l.value!==u[0].region&&we(l,u[0].region)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function qT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Access key"),s=T(),l=_("input"),h(e,"for",i=n[19]),h(l,"type","text"),h(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].accessKey),r||(a=Q(l,"input",n[12]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&h(e,"for",i),f&524288&&o!==(o=u[19])&&h(l,"id",o),f&1&&l.value!==u[0].accessKey&&we(l,u[0].accessKey)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}func
Line truncated
|
||||
<p>If you have limited disk space, you could optionally connect to a S3 compatible storage.</p>`,g=T(),b.c(),h(o,"class","breadcrumb-item"),h(a,"class","breadcrumb-item"),h(l,"class","breadcrumbs"),h(s,"class","page-header"),h(p,"class","content txt-xl m-b-base"),h(d,"class","panel"),h(d,"autocomplete","off"),h(c,"class","wrapper"),h(i,"class","page-wrapper")},m(O,E){V(e,O,E),w(O,t,E),w(O,i,E),m(i,s),m(s,l),m(l,o),m(l,r),m(l,a),m(a,u),m(i,f),m(i,c),m(c,d),m(d,p),m(d,g),C[v].m(d,null),y=!0,$||(S=Q(d,"submit",Wt(n[16])),$=!0)},p(O,[E]){(!y||E&32)&&ge(u,O[5]);let F=v;v=D(O),v===F?C[v].p(O,E):(Ee(),P(C[F],1,1,()=>{C[F]=null}),Ae(),b=C[v],b?b.p(O,E):(b=C[v]=M[v](O),b.c()),A(b,1),b.m(d,null))},i(O){y||(A(e.$$.fragment,O),A(b),y=!0)},o(O){P(e.$$.fragment,O),P(b),y=!1},d(O){z(e,O),O&&k(t),O&&k(i),C[v].d(),$=!1,S()}}}function UT(n,e,t){let i,s;kt(n,Jt,D=>t(5,s=D)),_n(Jt,s="Files storage",s);let l={},o=!1,r=!1,a="",u=!1;f();async function f(){t(1,o=!0);try{const D=await ye.Settings.getAll()||{};d(D)}catch(D){ye.errorResponseHandler(D)}t(1,o=!1)}async function c(){if(!(r||!i)){t(2,r=!0);try{const D=await ye.Settings.update(G.filterRedactedProps({s3:l}));d(D),Fi({}),cn("Successfully saved Files storage settings.")}catch(D){ye.errorResponseHandler(D)}t(2,r=!1)}}function d(D={}){t(0,l=(D==null?void 0:D.s3)||{}),t(3,u=l.enabled),t(7,a=JSON.stringify(l))}function p(){l.enabled=this.checked,t(0,l)}function g(){l.endpoint=this.value,t(0,l)}function v(){l.bucket=this.value,t(0,l)}function b(){l.region=this.value,t(0,l)}function y(){l.accessKey=this.value,t(0,l)}function $(D){n.$$.not_equal(l.secret,D)&&(l.secret=D,t(0,l))}function S(){l.forcePathStyle=this.checked,t(0,l)}const M=()=>c(),C=()=>c();return n.$$.update=()=>{n.$$.dirty&129&&t(4,i=a!=JSON.stringify(l))},[l,o,r,u,i,s,c,a,p,g,v,b,y,$,S,M,C]}class WT extends Oe{constructor(e){super(),De(this,e,UT,BT,Te,{})}}function YT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=N("Enable"),h(e,"type","checkbox"),h(e,"id",t=n[16]),h(s,"for",o=n[16])},m(u,f){w(u,e,f),e.checked=n[0].enabled,w(u,i,f),w(u,s,f),m(s,l),r||(a=Q(e,"change",n[8]),r=!0)},p(u,f){f&65536&&t!==(t=u[16])&&h(e,"id",t),f&1&&(e.checked=u[0].enabled),f&65536&&o!==(o=u[16])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function lp(n){let e,t,i,s,l,o,r,a,u,f,c;return i=new Pe({props:{class:"form-field required",name:"emailPassword.minPasswordLength",$$slots:{default:[KT,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),o=new Pe({props:{class:"form-field "+(G.isEmpty(n[0].onlyDomains)?"":"disabled"),name:"emailPassword.exceptDomains",$$slots:{default:[ZT,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),u=new Pe({props:{class:"form-field "+(G.isEmpty(n[0].exceptDomains)?"":"disabled"),name:"emailPassword.onlyDomains",$$slots:{default:[GT,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),B(i.$$.fragment),s=T(),l=_("div"),B(o.$$.fragment),r=T(),a=_("div"),B(u.$$.fragment),h(t,"class","col-sm-12 m-t-sm"),h(l,"class","col-lg-6"),h(a,"class","col-lg-6"),h(e,"class","grid")},m(d,p){w(d,e,p),m(e,t),V(i,t,null),m(e,s),m(e,l),V(o,l,null),m(e,r),m(e,a),V(u,a,null),c=!0},p(d,p){const g={};p&196609&&(g.$$scope={dirty:p,ctx:d}),i.$set(g);const v={};p&1&&(v.class="form-field "+(G.isEmpty(d[0].onlyDomains)?"":"disabled")),p&196609&&(v.$$scope={dirty:p,ctx:d}),o.$set(v);const b={};p&1&&(b.class="form-field "+(G.isEmpty(d[0].exceptDomains)?"":"disabled")),p&196609&&(b.$$scope={dirty:p,ctx:d}),u.$set(b)},i(d){c||(A(i.$$.fragment,d),A(o.$$.fragment,d),A(u.$$.fragment,d),d&&Ot(()=>{f||(f=lt(e,xt,{duration:150},!0)),f.run(1)}),c=!0)},o(d){P(i.$$.fragment,d),P(o.$$.fragment,d),P(u.$$.fragment,d),d&&(f||(f=lt(e,xt,{duration:150},!1)),f.run(0)),c=!1},d(d){d&&k(e),z(i),z(o),z(u),d&&f&&f.end()}}}function KT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Minimum password length"),s=T(),l=_("input"),h(e,"for",i=n[16]),h(l,"type","number"),h(l,"id",o=n[16]),l.required=!0,h(l,"min","5"),h(l,"max","200")},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].minPasswordLength),r||(a=Q(l,"input",n[9]),r=!0)},p(u,f){f&65536&&i!==(i=u[16])&&h(e,"for",i),f&65536&&o!==(o=u[16])&&h(l,"id",o),f&1&&Pt(l.value)!==u[0].minPasswordLength&&we(l,u[0].minPasswordLength)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function ZT(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;function g(b){n[10](b)}let v={id:n[16],disabled:!G.isEmpty(n[0].onlyDomains)};return n[0].exceptDomains!==void 0&&(v.value=n[0].exceptDomains),r=new ls({props:v}),me.push(()=>Le(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Except domains",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[16]),h(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(p=Ye(wt.call(null,s,{text:`Email domainsLine truncated
|
||||
This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&65536&&l!==(l=b[16]))&&h(e,"for",l);const $={};y&65536&&($.id=b[16]),y&1&&($.disabled=!G.isEmpty(b[0].onlyDomains)),!a&&y&1&&(a=!0,$.value=b[0].exceptDomains,Ie(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,p()}}}function GT(n){let e,t,i,s,l,o,r,a,u,f,c,d,p;function g(b){n[11](b)}let v={id:n[16]+".config.onlyDomains",disabled:!G.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(v.value=n[0].onlyDomains),r=new ls({props:v}),me.push(()=>Le(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=T(),s=_("i"),o=T(),B(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",h(t,"class","txt"),h(s,"class","ri-information-line link-hint"),h(e,"for",l=n[16]+".config.onlyDomains"),h(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),V(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(p=Ye(wt.call(null,s,{text:`Email domains that are ONLY allowed to sign up.
|
||||
This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&65536&&l!==(l=b[16]+".config.onlyDomains"))&&h(e,"for",l);const $={};y&65536&&($.id=b[16]+".config.onlyDomains"),y&1&&($.disabled=!G.isEmpty(b[0].exceptDomains)),!a&&y&1&&(a=!0,$.value=b[0].onlyDomains,Ie(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),z(r,b),b&&k(u),b&&k(f),d=!1,p()}}}function JT(n){let e,t,i,s;e=new Pe({props:{class:"form-field form-field-toggle m-b-0",name:"emailPassword.enabled",$$slots:{default:[YT,({uniqueId:o})=>({16:o}),({uniqueId:o})=>o?65536:0]},$$scope:{ctx:n}}});let l=n[0].enabled&&lp(n);return{c(){B(e.$$.fragment),t=T(),l&&l.c(),i=st()},m(o,r){V(e,o,r),w(o,t,r),l&&l.m(o,r),w(o,i,r),s=!0},p(o,r){const a={};r&196609&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].enabled?l?(l.p(o,r),r&1&&A(l,1)):(l=lp(o),l.c(),A(l,1),l.m(i.parentNode,i)):l&&(Ee(),P(l,1,1,()=>{l=null}),Ae())},i(o){s||(A(e.$$.fragment,o),A(l),s=!0)},o(o){P(e.$$.fragment,o),P(l),s=!1},d(o){z(e,o),o&&k(t),l&&l.d(o),o&&k(i)}}}function XT(n){let e;return{c(){e=_("span"),e.textContent="Disabled",h(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function QT(n){let e;return{c(){e=_("span"),e.textContent="Enabled",h(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function op(n){let e,t,i,s,l;return{c(){e=_("i"),h(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Ye(wt.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Ot(()=>{t||(t=lt(e,Hn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=lt(e,Hn,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function xT(n){let e,t,i,s,l,o,r;function a(d,p){return d[0].enabled?QT:XT}let u=a(n),f=u(n),c=n[2]&&op();return{c(){e=_("div"),e.innerHTML=`<i class="ri-mail-lock-line"></i>
|
||||
<span class="txt">Email/Password</span>`,t=T(),f.c(),i=T(),s=_("div"),l=T(),c&&c.c(),o=st(),h(e,"class","inline-flex"),h(s,"class","flex-fill")},m(d,p){w(d,e,p),w(d,t,p),f.m(d,p),w(d,i,p),w(d,s,p),w(d,l,p),c&&c.m(d,p),w(d,o,p),r=!0},p(d,p){u!==(u=a(d))&&(f.d(1),f=u(d),f&&(f.c(),f.m(i.parentNode,i))),d[2]?c?p&4&&A(c,1):(c=op(),c.c(),A(c,1),c.m(o.parentNode,o)):c&&(Ee(),P(c,1,1,()=>{c=null}),Ae())},i(d){r||(A(c),r=!0)},o(d){P(c),r=!1},d(d){d&&k(e),d&&k(t),f.d(d),d&&k(i),d&&k(s),d&&k(l),c&&c.d(d),d&&k(o)}}}function eD(n){let e,t;const i=[n[3]];let s={$$slots:{header:[xT],default:[JT]},$$scope:{ctx:n}};for(let l=0;l<i.length;l+=1)s=ft(s,i[l]);return e=new qa({props:s}),n[12](e),e.$on("expand",n[13]),e.$on("collapse",n[14]),e.$on("toggle",n[15]),{c(){B(e.$$.fragment)},m(l,o){V(e,l,o),t=!0},p(l,[o]){const r=o&8?dn(i,[ri(l[3])]):{};o&131077&&(r.$$scope={dirty:o,ctx:l}),e.$set(r)},i(l){t||(A(e.$$.fragment,l),t=!0)},o(l){P(e.$$.fragment,l),t=!1},d(l){n[12](null),z(e,l)}}}function tD(n,e,t){let i;const s=["config","expand","collapse","collapseSiblings"];let l=Zt(e,s),o;kt(n,ns,M=>t(7,o=M));let{config:r={}}=e,a;function u(){a==null||a.expand()}function f(){a==null||a.collapse()}function c(){a==null||a.collapseSiblings()}function d(){r.enabled=this.checked,t(0,r)}function p(){r.minPasswordLength=Pt(this.value),t(0,r)}function g(M){n.$$.not_equal(r.exceptDomains,M)&&(r.exceptDomains=M,t(0,r))}function v(M){n.$$.not_equal(r.onlyDomains,M)&&(r.onlyDomains=M,t(0,r))}function b(M){me[M?"unshift":"push"](()=>{a=M,t(1,a)})}function y(M){at.call(this,n,M)}function $(M){at.call(this,n,M)}function S(M){at.call(this,n,M)}return n.$$set=M=>{e=ft(ft({},e),li(M)),t(3,l=Zt(e,s)),"config"in M&&t(0,r=M.config)},n.$$.update=()=>{n.$$.dirty&128&&t(2,i=!G.isEmpty(o==null?void 0:o.emailPassword))},[r,a,i,l,u,f,c,o,d,p,g,v,b,y,$,S]}class nD extends Oe{constructor(e){super(),De(this,e,tD,eD,Te,{config:0,expand:4,collapse:5,collapseSiblings:6})}get expand(){return this.$$.ctx[4]}get collapse(){return this.$$.ctx[5]}get collapseSiblings(){return this.$$.ctx[6]}}function iD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=N("Enable"),h(e,"type","checkbox"),h(e,"id",t=n[22]),h(s,"for",o=n[22])},m(u,f){w(u,e,f),e.checked=n[0].enabled,w(u,i,f),w(u,s,f),m(s,l),r||(a=Q(e,"change",n[11]),r=!0)},p(u,f){f&4194304&&t!==(t=u[22])&&h(e,"id",t),f&1&&(e.checked=u[0].enabled),f&4194304&&o!==(o=u[22])&&h(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function rp(n){let e,t,i,s,l,o,r,a,u,f,c,d,p,g;l=new Pe({props:{class:"form-field required",name:n[1]+".clientId",$$slots:{default:[sD,({uniqueId:b})=>({22:b}),({uniqueId:b})=>b?4194304:0]},$$scope:{ctx:n}}}),a=new Pe({props:{class:"form-field required",name:n[1]+".clientSecret",$$slots:{default:[lD,({uniqueId:b})=>({22:b}),({uniqueId:b})=>b?4194304:0]},$$scope:{ctx:n}}}),c=new Pe({props:{class:"form-field",name:n[1]+".allowRegistrations",$$slots:{default:[oD,({uniqueId:b})=>({22:b}),({uniqueId:b})=>b?4194304:0]},$$scope:{ctx:n}}});let v=n[4]&&ap(n);return{c(){e=_("div"),t=_("div"),i=T(),s=_("div"),B(l.$$.fragment),o=T(),r=_("div"),B(a.$$.fragment),u=T(),f=_("div"),B(c.$$.fragment),d=T(),v&&v.c(),h(t,"class","col-12 spacing"),h(s,"class","col-lg-6"),h(r,"class","col-lg-6"),h(f,"class","col-lg-12"),h(e,"class","grid")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),V(l,s,null),m(e,o),m(e,r),V(a,r,null),m(e,u),m(e,f),V(c,f,null),m(e,d),v&&v.m(e,null),g=!0},p(b,y){const $={};y&2&&($.name=b[1]+".clientId"),y&12582913&&($.$$scope={dirty:y,ctx:b}),l.$set($);const S={};y&2&&(S.name=b[1]+".clientSecret"),y&12582913&&(S.$$scope={dirty:y,ctx:b}),a.$set(S);const M={};y&2&&(M.name=b[1]+".allowRegistrations"),y&12582913&&(M.$$scope={dirty:y,ctx:b}),c.$set(M),b[4]?v?(v.p(b,y),y&16&&A(v,1)):(v=ap(b),v.c(),A(v,1),v.m(e,null)):v&&(Ee(),P(v,1,1,()=>{v=null}),Ae())},i(b){g||(A(l.$$.fragment,b),A(a.$$.fragment,b),A(c.$$.fragment,b),A(v),b&&Ot(()=>{p||(p=lt(e,xt,{duration:200},!0)),p.run(1)}),g=!0)},o(b){P(l.$$.fragment,b),P(a.$$.fragment,b),P(c.$$.fragment,b),P(v),b&&(p||(p=lt(e,xt,{duration:200},!1)),p.run(0)),g=!1},d(b){b&&k(e),z(l),z(a),z(c),v&&v.d(),b&&p&&p.end()}}}function sD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Client ID"),s=T(),l=_("input"),h(e,"for",i=n[22]),h(l,"type","text"),h(l,"id",o=n[22]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),we(l,n[0].clientId),r||(a=Q(l,"input",n[12]),r=!0)},p(u,f){f&4194304&&i!==(i=u[22])&&h(e,"for",i),f&4194304&&o!==(o=u[22])&&h(l,"id",o),f&1&&l.value!==u[0].clientId&&we(l,u[0].clientId)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function lD(n){let e,t,i,s,l,o,r;function a(f){n[13](f)}let u={id:n[22],required:!0};return n[0].clientSecret!==void 0&&(u.value=n[0].clientSecret),l=new Ba({props:u}),me.push(()=>Le(l,"value",a)),{c(){e=_("label"),t=N("Client Secret"),s=T(),B(l.$$.fragment),h(e,"for",i=n[22])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),V(l,f,c),r=!0},p(f,c){(!r||c&4194304&&i!==(i=f[22]))&&h(e,"for",i);const d={};c&4194304&&(d.id=f[22]),!o&&c&Line truncated
|
||||
<span class="txt">Manage admins</span>`,t=T(),i=_("hr"),s=T(),l=_("div"),l.innerHTML=`<i class="ri-logout-circle-line"></i>
|
||||
<span class="txt">Logout</span>`,h(e,"href","/settings/admins"),h(e,"class","dropdown-item closable"),h(l,"tabindex","0"),h(l,"class","dropdown-item closable")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),w(a,s,u),w(a,l,u),o||(r=[Ye(wn.call(null,e)),Q(l,"click",n[6])],o=!0)},p:re,d(a){a&&k(e),a&&k(t),a&&k(i),a&&k(s),a&&k(l),o=!1,Qe(r)}}}function VD(n){var p;let e,t,i,s,l,o,r,a,u,f,c;document.title=e=G.joinNonEmpty([n[3],n[2],"PocketBase"]," - ");let d=((p=n[0])==null?void 0:p.id)&&n[1]&&mp(n);return o=new p_({props:{routes:TD}}),o.$on("routeLoading",n[4]),o.$on("conditionsFailed",n[5]),a=new FD({}),f=new jD({}),{c(){t=T(),i=_("div"),d&&d.c(),s=T(),l=_("div"),B(o.$$.fragment),r=T(),B(a.$$.fragment),u=T(),B(f.$$.fragment),h(l,"class","app-body"),h(i,"class","app-layout")},m(g,v){w(g,t,v),w(g,i,v),d&&d.m(i,null),m(i,s),m(i,l),V(o,l,null),w(g,r,v),V(a,g,v),w(g,u,v),V(f,g,v),c=!0},p(g,[v]){var b;(!c||v&12)&&e!==(e=G.joinNonEmpty([g[3],g[2],"PocketBase"]," - "))&&(document.title=e),((b=g[0])==null?void 0:b.id)&&g[1]?d?(d.p(g,v),v&3&&A(d,1)):(d=mp(g),d.c(),A(d,1),d.m(i,s)):d&&(Ee(),P(d,1,1,()=>{d=null}),Ae())},i(g){c||(A(d),A(o.$$.fragment,g),A(a.$$.fragment,g),A(f.$$.fragment,g),c=!0)},o(g){P(d),P(o.$$.fragment,g),P(a.$$.fragment,g),P(f.$$.fragment,g),c=!1},d(g){g&&k(t),g&&k(i),d&&d.d(),z(o),g&&k(r),z(a,g),g&&k(u),z(f,g)}}}function zD(n,e,t){let i,s,l;kt(n,mo,d=>t(2,i=d)),kt(n,ga,d=>t(0,s=d)),kt(n,Jt,d=>t(3,l=d));let o,r=!1;function a(d){var p,g,v,b;((p=d==null?void 0:d.detail)==null?void 0:p.location)!==o&&(t(1,r=!!((v=(g=d==null?void 0:d.detail)==null?void 0:g.userData)!=null&&v.showAppSidebar)),o=(b=d==null?void 0:d.detail)==null?void 0:b.location,_n(Jt,l="",l),Fi({}),qg())}function u(){vi("/")}async function f(){var d;if(!!(s!=null&&s.id))try{const p=await ye.Settings.getAll({$cancelKey:"loadAppName"});_n(mo,i=((d=p==null?void 0:p.meta)==null?void 0:d.appName)||"",i)}catch(p){console.warn("Failed to load app name.",p)}}function c(){ye.logout()}return n.$$.update=()=>{n.$$.dirty&1&&s!=null&&s.id&&f()},[s,r,i,l,a,u,c]}class BD extends Oe{constructor(e){super(),De(this,e,zD,VD,Te,{})}}new BD({target:document.getElementById("app")});export{Qe as A,cn as B,G as C,vi as D,st as E,Vm as F,kt as G,ks as H,rn as I,On as J,zn as K,me as L,Oe as S,P as a,T as b,B as c,z as d,_ as e,h as f,w as g,m as h,De as i,Ye as j,Ee as k,wn as l,V as m,Ae as n,k as o,ye as p,Pe as q,se as r,Te as s,A as t,Q as u,Wt as v,N as w,ge as x,re as y,we as z};
|
||||
Vendored
+12
-8
@@ -3,15 +3,19 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' http://127.0.0.1:* data:; connect-src 'self' http://127.0.0.1:*; script-src 'self' 'sha256-GRUzBA7PzKYug7pqxv5rJaec5bwDCw1Vo6/IXwvD3Tc='"
|
||||
/>
|
||||
|
||||
<title>PocketBase</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/_/images/favicon/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/_/images/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/_/images/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="/_/images/favicon/site.webmanifest">
|
||||
<link rel="mask-icon" href="/_/images/favicon/safari-pinned-tab.svg" color="#000000">
|
||||
<link rel="shortcut icon" href="/_/images/favicon/favicon.ico">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="./images/favicon/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="./images/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="./images/favicon/site.webmanifest">
|
||||
<link rel="mask-icon" href="./images/favicon/safari-pinned-tab.svg" color="#000000">
|
||||
<link rel="shortcut icon" href="./images/favicon/favicon.ico">
|
||||
<meta name="msapplication-TileColor" content="#ffffff">
|
||||
<meta name="msapplication-config" content="./images/favicon/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
@@ -20,8 +24,8 @@
|
||||
window.Prism = window.Prism || {};
|
||||
window.Prism.manual = true;
|
||||
</script>
|
||||
<script type="module" crossorigin src="/_/assets/index.9681f446.js"></script>
|
||||
<link rel="stylesheet" href="/_/assets/index.e9cd31f7.css">
|
||||
<script type="module" crossorigin src="./assets/index.3b658553.js"></script>
|
||||
<link rel="stylesheet" href="./assets/index.3b402ee9.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -10,11 +10,5 @@ import (
|
||||
//go:embed all:dist
|
||||
var distDir embed.FS
|
||||
|
||||
//go:embed dist/index.html
|
||||
var indexHTML embed.FS
|
||||
|
||||
// DistDirFS contains the embedded dist directory files (without the "dist" prefix)
|
||||
var DistDirFS = echo.MustSubFS(distDir, "dist")
|
||||
|
||||
// DistIndexHTML contains the embedded dist/index.html file (without the "dist" prefix)
|
||||
var DistIndexHTML = echo.MustSubFS(indexHTML, "dist")
|
||||
+11
-7
@@ -3,15 +3,19 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' http://127.0.0.1:* data:; connect-src 'self' http://127.0.0.1:*; script-src 'self' 'sha256-GRUzBA7PzKYug7pqxv5rJaec5bwDCw1Vo6/IXwvD3Tc='"
|
||||
/>
|
||||
|
||||
<title>PocketBase</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="/images/favicon/site.webmanifest">
|
||||
<link rel="mask-icon" href="/images/favicon/safari-pinned-tab.svg" color="#000000">
|
||||
<link rel="shortcut icon" href="/images/favicon/favicon.ico">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="./images/favicon/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="./images/favicon/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="./images/favicon/favicon-16x16.png">
|
||||
<link rel="manifest" href="./images/favicon/site.webmanifest">
|
||||
<link rel="mask-icon" href="./images/favicon/safari-pinned-tab.svg" color="#000000">
|
||||
<link rel="shortcut icon" href="./images/favicon/favicon.ico">
|
||||
<meta name="msapplication-TileColor" content="#ffffff">
|
||||
<meta name="msapplication-config" content="./images/favicon/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
@@ -23,6 +27,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
<script type="module" src="./src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+281
-256
@@ -17,7 +17,7 @@
|
||||
"chart.js": "^3.7.1",
|
||||
"chartjs-adapter-luxon": "^1.1.0",
|
||||
"luxon": "^2.3.2",
|
||||
"pocketbase": "^0.2.2",
|
||||
"pocketbase": "^0.4.0",
|
||||
"prismjs": "^1.28.0",
|
||||
"sass": "^1.45.0",
|
||||
"svelte": "^3.44.0",
|
||||
@@ -91,15 +91,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/state": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.1.0.tgz",
|
||||
"integrity": "sha512-qbUr94DZTe6/V1VS7LDLz11rM/1t/nJxR1El4I6UaxDEdc0aZZvq6JCLJWiRmUf95NRAnDH6fhXn+PWp9wGCIg==",
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.1.1.tgz",
|
||||
"integrity": "sha512-2s+aXsxmAwnR3Rd+JDHPG/1lw0YsA9PEwl7Re88gHJHGfxyfEzKBmsN4rr53RyPIR4lzbbhJX0DCq0WlqlBIRw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@codemirror/view": {
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.1.2.tgz",
|
||||
"integrity": "sha512-puUydfKwfmOo+ixtuB+uN/ZpcteEYSnpjHmMaow1sOQhNICsKtGBup3i9ybVqyzDagARRYzSHTWjbdeHqmn31w==",
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.2.0.tgz",
|
||||
"integrity": "sha512-3emW1symh+GoteFMBPsltjmF790U/trouLILATh3JodbF/z98HvcQh2g3+H6dfNIHx16uNonsAF4mNzVr1TJNA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@codemirror/state": "^6.0.0",
|
||||
@@ -107,6 +107,22 @@
|
||||
"w3c-keyname": "^2.2.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz",
|
||||
"integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/common": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.0.0.tgz",
|
||||
@@ -123,9 +139,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/lr": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.2.0.tgz",
|
||||
"integrity": "sha512-TgEpfm9br2SX8JwtwKT8HsQZKuFkLRg6g+IRxObk9nVKQLKnkP3oMh+QGcTBL9GQsfQ2ADtKPbj2iGSMf3ytiA==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.2.1.tgz",
|
||||
"integrity": "sha512-RpHRs+Q+5tPsXtobSfSeRFRAnTRD0e4bApDvo74O+JiaWq9812x5S8WgftNX67owdaTQXCB5E8XZGALo4Wt77A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.0.0"
|
||||
@@ -206,19 +222,19 @@
|
||||
}
|
||||
},
|
||||
"node_modules/chart.js": {
|
||||
"version": "3.8.2",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.8.2.tgz",
|
||||
"integrity": "sha512-7rqSlHWMUKFyBDOJvmFGW2lxULtcwaPLegDjX/Nu5j6QybY+GCiQkEY+6cqHw62S5tcwXMD8Y+H5OBGoR7d+ZQ==",
|
||||
"version": "3.9.1",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.9.1.tgz",
|
||||
"integrity": "sha512-Ro2JbLmvg83gXF5F4sniaQ+lTbSv18E+TIf2cOeiH1Iqd2PGFOtem+DUufMZsCJwFE7ywPOpfXFBwRTGq7dh6w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/chartjs-adapter-luxon": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/chartjs-adapter-luxon/-/chartjs-adapter-luxon-1.1.0.tgz",
|
||||
"integrity": "sha512-CS+xBWEyXYVLBZ3dSY/MwlSXhz8er4JjkApazY84ft/++oOLsmkt6TaXBCsUFudum7QdoYmpxiL/gSp20+emkw==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/chartjs-adapter-luxon/-/chartjs-adapter-luxon-1.2.0.tgz",
|
||||
"integrity": "sha512-h1lEns7+8cUN/Dmk24dhrT9hpAimKImQxzHpILqXn2kocdzj9b/fDlBa8v8/OMq5rq0uZEx/NV1WpByH4l2/Rw==",
|
||||
"dev": true,
|
||||
"peerDependencies": {
|
||||
"chart.js": "^3.0.0",
|
||||
"luxon": "^1.0.0 || ^2.0.0"
|
||||
"luxon": ">=1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
@@ -281,9 +297,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.51.tgz",
|
||||
"integrity": "sha512-+CvnDitD7Q5sT7F+FM65sWkF8wJRf+j9fPcprxYV4j+ohmzVj2W7caUqH2s5kCaCJAfcAICjSlKhDCcvDpU7nw==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz",
|
||||
"integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
@@ -293,32 +309,33 @@
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"esbuild-android-64": "0.14.51",
|
||||
"esbuild-android-arm64": "0.14.51",
|
||||
"esbuild-darwin-64": "0.14.51",
|
||||
"esbuild-darwin-arm64": "0.14.51",
|
||||
"esbuild-freebsd-64": "0.14.51",
|
||||
"esbuild-freebsd-arm64": "0.14.51",
|
||||
"esbuild-linux-32": "0.14.51",
|
||||
"esbuild-linux-64": "0.14.51",
|
||||
"esbuild-linux-arm": "0.14.51",
|
||||
"esbuild-linux-arm64": "0.14.51",
|
||||
"esbuild-linux-mips64le": "0.14.51",
|
||||
"esbuild-linux-ppc64le": "0.14.51",
|
||||
"esbuild-linux-riscv64": "0.14.51",
|
||||
"esbuild-linux-s390x": "0.14.51",
|
||||
"esbuild-netbsd-64": "0.14.51",
|
||||
"esbuild-openbsd-64": "0.14.51",
|
||||
"esbuild-sunos-64": "0.14.51",
|
||||
"esbuild-windows-32": "0.14.51",
|
||||
"esbuild-windows-64": "0.14.51",
|
||||
"esbuild-windows-arm64": "0.14.51"
|
||||
"@esbuild/linux-loong64": "0.14.54",
|
||||
"esbuild-android-64": "0.14.54",
|
||||
"esbuild-android-arm64": "0.14.54",
|
||||
"esbuild-darwin-64": "0.14.54",
|
||||
"esbuild-darwin-arm64": "0.14.54",
|
||||
"esbuild-freebsd-64": "0.14.54",
|
||||
"esbuild-freebsd-arm64": "0.14.54",
|
||||
"esbuild-linux-32": "0.14.54",
|
||||
"esbuild-linux-64": "0.14.54",
|
||||
"esbuild-linux-arm": "0.14.54",
|
||||
"esbuild-linux-arm64": "0.14.54",
|
||||
"esbuild-linux-mips64le": "0.14.54",
|
||||
"esbuild-linux-ppc64le": "0.14.54",
|
||||
"esbuild-linux-riscv64": "0.14.54",
|
||||
"esbuild-linux-s390x": "0.14.54",
|
||||
"esbuild-netbsd-64": "0.14.54",
|
||||
"esbuild-openbsd-64": "0.14.54",
|
||||
"esbuild-sunos-64": "0.14.54",
|
||||
"esbuild-windows-32": "0.14.54",
|
||||
"esbuild-windows-64": "0.14.54",
|
||||
"esbuild-windows-arm64": "0.14.54"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-android-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.51.tgz",
|
||||
"integrity": "sha512-6FOuKTHnC86dtrKDmdSj2CkcKF8PnqkaIXqvgydqfJmqBazCPdw+relrMlhGjkvVdiiGV70rpdnyFmA65ekBCQ==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz",
|
||||
"integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -332,9 +349,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-android-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-vBtp//5VVkZWmYYvHsqBRCMMi1MzKuMIn5XDScmnykMTu9+TD9v0NMEDqQxvtFToeYmojdo5UCV2vzMQWJcJ4A==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -348,9 +365,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-darwin-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.51.tgz",
|
||||
"integrity": "sha512-YFmXPIOvuagDcwCejMRtCDjgPfnDu+bNeh5FU2Ryi68ADDVlWEpbtpAbrtf/lvFTWPexbgyKgzppNgsmLPr8PA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz",
|
||||
"integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -364,9 +381,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-darwin-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-juYD0QnSKwAMfzwKdIF6YbueXzS6N7y4GXPDeDkApz/1RzlT42mvX9jgNmyOlWKN7YzQAYbcUEJmZJYQGdf2ow==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -380,9 +397,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-freebsd-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.51.tgz",
|
||||
"integrity": "sha512-cLEI/aXjb6vo5O2Y8rvVSQ7smgLldwYY5xMxqh/dQGfWO+R1NJOFsiax3IS4Ng300SVp7Gz3czxT6d6qf2cw0g==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz",
|
||||
"integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -396,9 +413,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-freebsd-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-TcWVw/rCL2F+jUgRkgLa3qltd5gzKjIMGhkVybkjk6PJadYInPtgtUBp1/hG+mxyigaT7ib+od1Xb84b+L+1Mg==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -412,9 +429,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-32": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.51.tgz",
|
||||
"integrity": "sha512-RFqpyC5ChyWrjx8Xj2K0EC1aN0A37H6OJfmUXIASEqJoHcntuV3j2Efr9RNmUhMfNE6yEj2VpYuDteZLGDMr0w==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz",
|
||||
"integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -428,9 +445,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.51.tgz",
|
||||
"integrity": "sha512-dxjhrqo5i7Rq6DXwz5v+MEHVs9VNFItJmHBe1CxROWNf4miOGoQhqSG8StStbDkQ1Mtobg6ng+4fwByOhoQoeA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz",
|
||||
"integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -444,9 +461,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-arm": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.51.tgz",
|
||||
"integrity": "sha512-LsJynDxYF6Neg7ZC7748yweCDD+N8ByCv22/7IAZglIEniEkqdF4HCaa49JNDLw1UQGlYuhOB8ZT/MmcSWzcWg==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz",
|
||||
"integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -460,9 +477,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-D9rFxGutoqQX3xJPxqd6o+kvYKeIbM0ifW2y0bgKk5HPgQQOo2k9/2Vpto3ybGYaFPCE5qTGtqQta9PoP6ZEzw==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -476,9 +493,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-mips64le": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.51.tgz",
|
||||
"integrity": "sha512-vS54wQjy4IinLSlb5EIlLoln8buh1yDgliP4CuEHumrPk4PvvP4kTRIG4SzMXm6t19N0rIfT4bNdAxzJLg2k6A==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz",
|
||||
"integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
@@ -492,9 +509,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-ppc64le": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.51.tgz",
|
||||
"integrity": "sha512-xcdd62Y3VfGoyphNP/aIV9LP+RzFw5M5Z7ja+zdpQHHvokJM7d0rlDRMN+iSSwvUymQkqZO+G/xjb4/75du8BQ==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz",
|
||||
"integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -508,9 +525,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-riscv64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.51.tgz",
|
||||
"integrity": "sha512-syXHGak9wkAnFz0gMmRBoy44JV0rp4kVCEA36P5MCeZcxFq8+fllBC2t6sKI23w3qd8Vwo9pTADCgjTSf3L3rA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz",
|
||||
"integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
@@ -524,9 +541,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-s390x": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.51.tgz",
|
||||
"integrity": "sha512-kFAJY3dv+Wq8o28K/C7xkZk/X34rgTwhknSsElIqoEo8armCOjMJ6NsMxm48KaWY2h2RUYGtQmr+RGuUPKBhyw==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz",
|
||||
"integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@@ -540,9 +557,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-netbsd-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.51.tgz",
|
||||
"integrity": "sha512-ZZBI7qrR1FevdPBVHz/1GSk1x5GDL/iy42Zy8+neEm/HA7ma+hH/bwPEjeHXKWUDvM36CZpSL/fn1/y9/Hb+1A==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz",
|
||||
"integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -556,9 +573,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-openbsd-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.51.tgz",
|
||||
"integrity": "sha512-7R1/p39M+LSVQVgDVlcY1KKm6kFKjERSX1lipMG51NPcspJD1tmiZSmmBXoY5jhHIu6JL1QkFDTx94gMYK6vfA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz",
|
||||
"integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -572,9 +589,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-sunos-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.51.tgz",
|
||||
"integrity": "sha512-HoHaCswHxLEYN8eBTtyO0bFEWvA3Kdb++hSQ/lLG7TyKF69TeSG0RNoBRAs45x/oCeWaTDntEZlYwAfQlhEtJA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz",
|
||||
"integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -588,9 +605,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-windows-32": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.51.tgz",
|
||||
"integrity": "sha512-4rtwSAM35A07CBt1/X8RWieDj3ZUHQqUOaEo5ZBs69rt5WAFjP4aqCIobdqOy4FdhYw1yF8Z0xFBTyc9lgPtEg==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz",
|
||||
"integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -604,9 +621,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-windows-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.51.tgz",
|
||||
"integrity": "sha512-HoN/5HGRXJpWODprGCgKbdMvrC3A2gqvzewu2eECRw2sYxOUoh2TV1tS+G7bHNapPGI79woQJGV6pFH7GH7qnA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz",
|
||||
"integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -620,9 +637,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-windows-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-JQDqPjuOH7o+BsKMSddMfmVJXrnYZxXDHsoLHc0xgmAZkOOCflRmC43q31pk79F9xuyWY45jDBPolb5ZgGOf9g==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -722,9 +739,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
|
||||
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
|
||||
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
@@ -845,15 +862,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/pocketbase": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/pocketbase/-/pocketbase-0.2.2.tgz",
|
||||
"integrity": "sha512-87UBwZD5HCvBu4PSzRZSxrHVAeFOBwJnMUuvqQjZijdhwNLeR7cVLF34mHpWSeIM4jbwe+RSwDNFP0jOzkwGBQ==",
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/pocketbase/-/pocketbase-0.4.0.tgz",
|
||||
"integrity": "sha512-U/ZBPLijSh+zwwcVo5R5eYjfE2YDxDavLxRXr9PIgIWHpzW1gd1dqrZ/Ba/fQ4lGA89dQjkGBrIYyoX/IL4wyQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.14",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz",
|
||||
"integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==",
|
||||
"version": "8.4.16",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz",
|
||||
"integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -896,9 +913,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/regexparam": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/regexparam/-/regexparam-2.0.0.tgz",
|
||||
"integrity": "sha512-gJKwd2MVPWHAIFLsaYDZfyKzHNS4o7E/v8YmNf44vmeV2e4YfVoDToTOKTvE7ab68cRJ++kLuEXJBaEeJVt5ow==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/regexparam/-/regexparam-2.0.1.tgz",
|
||||
"integrity": "sha512-zRgSaYemnNYxUv+/5SeoHI0eJIgTL/A2pUtXUPLHQxUldagouJ9p+K6IbIZ/JiQuCEv2E2B1O11SjVQy3aMCkw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -922,9 +939,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "2.77.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.2.tgz",
|
||||
"integrity": "sha512-m/4YzYgLcpMQbxX3NmAqDvwLATZzxt8bIegO78FZLl+lAgKJBd1DRAOeEiZcKOIOPjxE6ewHWHNgGEalFXuz1g==",
|
||||
"version": "2.77.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.3.tgz",
|
||||
"integrity": "sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
@@ -937,9 +954,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.54.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.54.0.tgz",
|
||||
"integrity": "sha512-C4zp79GCXZfK0yoHZg+GxF818/aclhp9F48XBu/+bm9vXEVAYov9iU3FBVRMq3Hx3OA4jfKL+p2K9180mEh0xQ==",
|
||||
"version": "1.54.4",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.54.4.tgz",
|
||||
"integrity": "sha512-3tmF16yvnBwtlPrNBHw/H907j8MlOX8aTBnlNX1yrKx24RKcJGPyLhFUwkoKBKesR3unP93/2z14Ll8NicwQUA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
@@ -1020,12 +1037,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-spa-router": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/svelte-spa-router/-/svelte-spa-router-3.2.0.tgz",
|
||||
"integrity": "sha512-igemo5Vs82TGBBw+DjWt6qKameXYzNs6aDXcTxou5XbEvOjiRcAM6MLkdVRCatn6u8r42dE99bt/br7T4qe/AQ==",
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/svelte-spa-router/-/svelte-spa-router-3.3.0.tgz",
|
||||
"integrity": "sha512-cwRNe7cxD43sCvSfEeaKiNZg3FCizGxeMcf7CPiWRP3jKXjEma3vxyyuDtPOam6nWbVxl9TNM3hlE/i87ZlqcQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"regexparam": "2.0.0"
|
||||
"regexparam": "2.0.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ItalyPaleAle"
|
||||
@@ -1044,13 +1061,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-3.0.4.tgz",
|
||||
"integrity": "sha512-NU304nqnBeOx2MkQnskBQxVsa0pRAH5FphokTGmyy8M3oxbvw7qAXts2GORxs+h/2vKsD+osMhZ7An6yK6F1dA==",
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-3.0.5.tgz",
|
||||
"integrity": "sha512-bRvrt9Tw8EGW4jj64aYFTnVg134E8hgDxyl/eEHnxiGqYk7/pTPss6CWlurqPOUzqvEoZkZ58Ws+Iu8MB87iMA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.14.47",
|
||||
"postcss": "^8.4.14",
|
||||
"postcss": "^8.4.16",
|
||||
"resolve": "^1.22.1",
|
||||
"rollup": "^2.75.6"
|
||||
},
|
||||
@@ -1085,9 +1102,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/w3c-keyname": {
|
||||
"version": "2.2.5",
|
||||
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.5.tgz",
|
||||
"integrity": "sha512-WJrK7i6w+ULuZsGscCezbCH4Aev5U3xY87vnSimzzEgPQhb0Sa0a1rE3c2jtEwrFtSfi61Jefw3jI5/DD/3jbQ==",
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.6.tgz",
|
||||
"integrity": "sha512-f+fciywl1SJEniZHD6H+kUO8gOnwIr7f4ijKA6+ZvJFjeGi1r4PDLl53Ayud9O/rk64RqgoQine0feoeOU0kXg==",
|
||||
"dev": true
|
||||
}
|
||||
},
|
||||
@@ -1151,15 +1168,15 @@
|
||||
}
|
||||
},
|
||||
"@codemirror/state": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.1.0.tgz",
|
||||
"integrity": "sha512-qbUr94DZTe6/V1VS7LDLz11rM/1t/nJxR1El4I6UaxDEdc0aZZvq6JCLJWiRmUf95NRAnDH6fhXn+PWp9wGCIg==",
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.1.1.tgz",
|
||||
"integrity": "sha512-2s+aXsxmAwnR3Rd+JDHPG/1lw0YsA9PEwl7Re88gHJHGfxyfEzKBmsN4rr53RyPIR4lzbbhJX0DCq0WlqlBIRw==",
|
||||
"dev": true
|
||||
},
|
||||
"@codemirror/view": {
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.1.2.tgz",
|
||||
"integrity": "sha512-puUydfKwfmOo+ixtuB+uN/ZpcteEYSnpjHmMaow1sOQhNICsKtGBup3i9ybVqyzDagARRYzSHTWjbdeHqmn31w==",
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.2.0.tgz",
|
||||
"integrity": "sha512-3emW1symh+GoteFMBPsltjmF790U/trouLILATh3JodbF/z98HvcQh2g3+H6dfNIHx16uNonsAF4mNzVr1TJNA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@codemirror/state": "^6.0.0",
|
||||
@@ -1167,6 +1184,13 @@
|
||||
"w3c-keyname": "^2.2.4"
|
||||
}
|
||||
},
|
||||
"@esbuild/linux-loong64": {
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz",
|
||||
"integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"@lezer/common": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.0.0.tgz",
|
||||
@@ -1183,9 +1207,9 @@
|
||||
}
|
||||
},
|
||||
"@lezer/lr": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.2.0.tgz",
|
||||
"integrity": "sha512-TgEpfm9br2SX8JwtwKT8HsQZKuFkLRg6g+IRxObk9nVKQLKnkP3oMh+QGcTBL9GQsfQ2ADtKPbj2iGSMf3ytiA==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.2.1.tgz",
|
||||
"integrity": "sha512-RpHRs+Q+5tPsXtobSfSeRFRAnTRD0e4bApDvo74O+JiaWq9812x5S8WgftNX67owdaTQXCB5E8XZGALo4Wt77A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@lezer/common": "^1.0.0"
|
||||
@@ -1241,15 +1265,15 @@
|
||||
}
|
||||
},
|
||||
"chart.js": {
|
||||
"version": "3.8.2",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.8.2.tgz",
|
||||
"integrity": "sha512-7rqSlHWMUKFyBDOJvmFGW2lxULtcwaPLegDjX/Nu5j6QybY+GCiQkEY+6cqHw62S5tcwXMD8Y+H5OBGoR7d+ZQ==",
|
||||
"version": "3.9.1",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.9.1.tgz",
|
||||
"integrity": "sha512-Ro2JbLmvg83gXF5F4sniaQ+lTbSv18E+TIf2cOeiH1Iqd2PGFOtem+DUufMZsCJwFE7ywPOpfXFBwRTGq7dh6w==",
|
||||
"dev": true
|
||||
},
|
||||
"chartjs-adapter-luxon": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/chartjs-adapter-luxon/-/chartjs-adapter-luxon-1.1.0.tgz",
|
||||
"integrity": "sha512-CS+xBWEyXYVLBZ3dSY/MwlSXhz8er4JjkApazY84ft/++oOLsmkt6TaXBCsUFudum7QdoYmpxiL/gSp20+emkw==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/chartjs-adapter-luxon/-/chartjs-adapter-luxon-1.2.0.tgz",
|
||||
"integrity": "sha512-h1lEns7+8cUN/Dmk24dhrT9hpAimKImQxzHpILqXn2kocdzj9b/fDlBa8v8/OMq5rq0uZEx/NV1WpByH4l2/Rw==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
@@ -1291,170 +1315,171 @@
|
||||
"dev": true
|
||||
},
|
||||
"esbuild": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.51.tgz",
|
||||
"integrity": "sha512-+CvnDitD7Q5sT7F+FM65sWkF8wJRf+j9fPcprxYV4j+ohmzVj2W7caUqH2s5kCaCJAfcAICjSlKhDCcvDpU7nw==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz",
|
||||
"integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esbuild-android-64": "0.14.51",
|
||||
"esbuild-android-arm64": "0.14.51",
|
||||
"esbuild-darwin-64": "0.14.51",
|
||||
"esbuild-darwin-arm64": "0.14.51",
|
||||
"esbuild-freebsd-64": "0.14.51",
|
||||
"esbuild-freebsd-arm64": "0.14.51",
|
||||
"esbuild-linux-32": "0.14.51",
|
||||
"esbuild-linux-64": "0.14.51",
|
||||
"esbuild-linux-arm": "0.14.51",
|
||||
"esbuild-linux-arm64": "0.14.51",
|
||||
"esbuild-linux-mips64le": "0.14.51",
|
||||
"esbuild-linux-ppc64le": "0.14.51",
|
||||
"esbuild-linux-riscv64": "0.14.51",
|
||||
"esbuild-linux-s390x": "0.14.51",
|
||||
"esbuild-netbsd-64": "0.14.51",
|
||||
"esbuild-openbsd-64": "0.14.51",
|
||||
"esbuild-sunos-64": "0.14.51",
|
||||
"esbuild-windows-32": "0.14.51",
|
||||
"esbuild-windows-64": "0.14.51",
|
||||
"esbuild-windows-arm64": "0.14.51"
|
||||
"@esbuild/linux-loong64": "0.14.54",
|
||||
"esbuild-android-64": "0.14.54",
|
||||
"esbuild-android-arm64": "0.14.54",
|
||||
"esbuild-darwin-64": "0.14.54",
|
||||
"esbuild-darwin-arm64": "0.14.54",
|
||||
"esbuild-freebsd-64": "0.14.54",
|
||||
"esbuild-freebsd-arm64": "0.14.54",
|
||||
"esbuild-linux-32": "0.14.54",
|
||||
"esbuild-linux-64": "0.14.54",
|
||||
"esbuild-linux-arm": "0.14.54",
|
||||
"esbuild-linux-arm64": "0.14.54",
|
||||
"esbuild-linux-mips64le": "0.14.54",
|
||||
"esbuild-linux-ppc64le": "0.14.54",
|
||||
"esbuild-linux-riscv64": "0.14.54",
|
||||
"esbuild-linux-s390x": "0.14.54",
|
||||
"esbuild-netbsd-64": "0.14.54",
|
||||
"esbuild-openbsd-64": "0.14.54",
|
||||
"esbuild-sunos-64": "0.14.54",
|
||||
"esbuild-windows-32": "0.14.54",
|
||||
"esbuild-windows-64": "0.14.54",
|
||||
"esbuild-windows-arm64": "0.14.54"
|
||||
}
|
||||
},
|
||||
"esbuild-android-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.51.tgz",
|
||||
"integrity": "sha512-6FOuKTHnC86dtrKDmdSj2CkcKF8PnqkaIXqvgydqfJmqBazCPdw+relrMlhGjkvVdiiGV70rpdnyFmA65ekBCQ==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz",
|
||||
"integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-android-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-vBtp//5VVkZWmYYvHsqBRCMMi1MzKuMIn5XDScmnykMTu9+TD9v0NMEDqQxvtFToeYmojdo5UCV2vzMQWJcJ4A==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-darwin-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.51.tgz",
|
||||
"integrity": "sha512-YFmXPIOvuagDcwCejMRtCDjgPfnDu+bNeh5FU2Ryi68ADDVlWEpbtpAbrtf/lvFTWPexbgyKgzppNgsmLPr8PA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz",
|
||||
"integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-darwin-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-juYD0QnSKwAMfzwKdIF6YbueXzS6N7y4GXPDeDkApz/1RzlT42mvX9jgNmyOlWKN7YzQAYbcUEJmZJYQGdf2ow==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-freebsd-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.51.tgz",
|
||||
"integrity": "sha512-cLEI/aXjb6vo5O2Y8rvVSQ7smgLldwYY5xMxqh/dQGfWO+R1NJOFsiax3IS4Ng300SVp7Gz3czxT6d6qf2cw0g==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz",
|
||||
"integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-freebsd-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-TcWVw/rCL2F+jUgRkgLa3qltd5gzKjIMGhkVybkjk6PJadYInPtgtUBp1/hG+mxyigaT7ib+od1Xb84b+L+1Mg==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-linux-32": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.51.tgz",
|
||||
"integrity": "sha512-RFqpyC5ChyWrjx8Xj2K0EC1aN0A37H6OJfmUXIASEqJoHcntuV3j2Efr9RNmUhMfNE6yEj2VpYuDteZLGDMr0w==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz",
|
||||
"integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-linux-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.51.tgz",
|
||||
"integrity": "sha512-dxjhrqo5i7Rq6DXwz5v+MEHVs9VNFItJmHBe1CxROWNf4miOGoQhqSG8StStbDkQ1Mtobg6ng+4fwByOhoQoeA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz",
|
||||
"integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-linux-arm": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.51.tgz",
|
||||
"integrity": "sha512-LsJynDxYF6Neg7ZC7748yweCDD+N8ByCv22/7IAZglIEniEkqdF4HCaa49JNDLw1UQGlYuhOB8ZT/MmcSWzcWg==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz",
|
||||
"integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-linux-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-D9rFxGutoqQX3xJPxqd6o+kvYKeIbM0ifW2y0bgKk5HPgQQOo2k9/2Vpto3ybGYaFPCE5qTGtqQta9PoP6ZEzw==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-linux-mips64le": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.51.tgz",
|
||||
"integrity": "sha512-vS54wQjy4IinLSlb5EIlLoln8buh1yDgliP4CuEHumrPk4PvvP4kTRIG4SzMXm6t19N0rIfT4bNdAxzJLg2k6A==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz",
|
||||
"integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-linux-ppc64le": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.51.tgz",
|
||||
"integrity": "sha512-xcdd62Y3VfGoyphNP/aIV9LP+RzFw5M5Z7ja+zdpQHHvokJM7d0rlDRMN+iSSwvUymQkqZO+G/xjb4/75du8BQ==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz",
|
||||
"integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-linux-riscv64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.51.tgz",
|
||||
"integrity": "sha512-syXHGak9wkAnFz0gMmRBoy44JV0rp4kVCEA36P5MCeZcxFq8+fllBC2t6sKI23w3qd8Vwo9pTADCgjTSf3L3rA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz",
|
||||
"integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-linux-s390x": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.51.tgz",
|
||||
"integrity": "sha512-kFAJY3dv+Wq8o28K/C7xkZk/X34rgTwhknSsElIqoEo8armCOjMJ6NsMxm48KaWY2h2RUYGtQmr+RGuUPKBhyw==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz",
|
||||
"integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-netbsd-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.51.tgz",
|
||||
"integrity": "sha512-ZZBI7qrR1FevdPBVHz/1GSk1x5GDL/iy42Zy8+neEm/HA7ma+hH/bwPEjeHXKWUDvM36CZpSL/fn1/y9/Hb+1A==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz",
|
||||
"integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-openbsd-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.51.tgz",
|
||||
"integrity": "sha512-7R1/p39M+LSVQVgDVlcY1KKm6kFKjERSX1lipMG51NPcspJD1tmiZSmmBXoY5jhHIu6JL1QkFDTx94gMYK6vfA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz",
|
||||
"integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-sunos-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.51.tgz",
|
||||
"integrity": "sha512-HoHaCswHxLEYN8eBTtyO0bFEWvA3Kdb++hSQ/lLG7TyKF69TeSG0RNoBRAs45x/oCeWaTDntEZlYwAfQlhEtJA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz",
|
||||
"integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-windows-32": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.51.tgz",
|
||||
"integrity": "sha512-4rtwSAM35A07CBt1/X8RWieDj3ZUHQqUOaEo5ZBs69rt5WAFjP4aqCIobdqOy4FdhYw1yF8Z0xFBTyc9lgPtEg==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz",
|
||||
"integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-windows-64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.51.tgz",
|
||||
"integrity": "sha512-HoN/5HGRXJpWODprGCgKbdMvrC3A2gqvzewu2eECRw2sYxOUoh2TV1tS+G7bHNapPGI79woQJGV6pFH7GH7qnA==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz",
|
||||
"integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"esbuild-windows-arm64": {
|
||||
"version": "0.14.51",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.51.tgz",
|
||||
"integrity": "sha512-JQDqPjuOH7o+BsKMSddMfmVJXrnYZxXDHsoLHc0xgmAZkOOCflRmC43q31pk79F9xuyWY45jDBPolb5ZgGOf9g==",
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz",
|
||||
"integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
@@ -1526,9 +1551,9 @@
|
||||
}
|
||||
},
|
||||
"is-core-module": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
|
||||
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
|
||||
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
@@ -1613,15 +1638,15 @@
|
||||
"dev": true
|
||||
},
|
||||
"pocketbase": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/pocketbase/-/pocketbase-0.2.2.tgz",
|
||||
"integrity": "sha512-87UBwZD5HCvBu4PSzRZSxrHVAeFOBwJnMUuvqQjZijdhwNLeR7cVLF34mHpWSeIM4jbwe+RSwDNFP0jOzkwGBQ==",
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/pocketbase/-/pocketbase-0.4.0.tgz",
|
||||
"integrity": "sha512-U/ZBPLijSh+zwwcVo5R5eYjfE2YDxDavLxRXr9PIgIWHpzW1gd1dqrZ/Ba/fQ4lGA89dQjkGBrIYyoX/IL4wyQ==",
|
||||
"dev": true
|
||||
},
|
||||
"postcss": {
|
||||
"version": "8.4.14",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz",
|
||||
"integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==",
|
||||
"version": "8.4.16",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz",
|
||||
"integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"nanoid": "^3.3.4",
|
||||
@@ -1645,9 +1670,9 @@
|
||||
}
|
||||
},
|
||||
"regexparam": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/regexparam/-/regexparam-2.0.0.tgz",
|
||||
"integrity": "sha512-gJKwd2MVPWHAIFLsaYDZfyKzHNS4o7E/v8YmNf44vmeV2e4YfVoDToTOKTvE7ab68cRJ++kLuEXJBaEeJVt5ow==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/regexparam/-/regexparam-2.0.1.tgz",
|
||||
"integrity": "sha512-zRgSaYemnNYxUv+/5SeoHI0eJIgTL/A2pUtXUPLHQxUldagouJ9p+K6IbIZ/JiQuCEv2E2B1O11SjVQy3aMCkw==",
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
@@ -1662,18 +1687,18 @@
|
||||
}
|
||||
},
|
||||
"rollup": {
|
||||
"version": "2.77.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.2.tgz",
|
||||
"integrity": "sha512-m/4YzYgLcpMQbxX3NmAqDvwLATZzxt8bIegO78FZLl+lAgKJBd1DRAOeEiZcKOIOPjxE6ewHWHNgGEalFXuz1g==",
|
||||
"version": "2.77.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.3.tgz",
|
||||
"integrity": "sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"sass": {
|
||||
"version": "1.54.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.54.0.tgz",
|
||||
"integrity": "sha512-C4zp79GCXZfK0yoHZg+GxF818/aclhp9F48XBu/+bm9vXEVAYov9iU3FBVRMq3Hx3OA4jfKL+p2K9180mEh0xQ==",
|
||||
"version": "1.54.4",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.54.4.tgz",
|
||||
"integrity": "sha512-3tmF16yvnBwtlPrNBHw/H907j8MlOX8aTBnlNX1yrKx24RKcJGPyLhFUwkoKBKesR3unP93/2z14Ll8NicwQUA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
@@ -1728,12 +1753,12 @@
|
||||
"requires": {}
|
||||
},
|
||||
"svelte-spa-router": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/svelte-spa-router/-/svelte-spa-router-3.2.0.tgz",
|
||||
"integrity": "sha512-igemo5Vs82TGBBw+DjWt6qKameXYzNs6aDXcTxou5XbEvOjiRcAM6MLkdVRCatn6u8r42dE99bt/br7T4qe/AQ==",
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/svelte-spa-router/-/svelte-spa-router-3.3.0.tgz",
|
||||
"integrity": "sha512-cwRNe7cxD43sCvSfEeaKiNZg3FCizGxeMcf7CPiWRP3jKXjEma3vxyyuDtPOam6nWbVxl9TNM3hlE/i87ZlqcQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"regexparam": "2.0.0"
|
||||
"regexparam": "2.0.1"
|
||||
}
|
||||
},
|
||||
"to-regex-range": {
|
||||
@@ -1746,22 +1771,22 @@
|
||||
}
|
||||
},
|
||||
"vite": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-3.0.4.tgz",
|
||||
"integrity": "sha512-NU304nqnBeOx2MkQnskBQxVsa0pRAH5FphokTGmyy8M3oxbvw7qAXts2GORxs+h/2vKsD+osMhZ7An6yK6F1dA==",
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-3.0.5.tgz",
|
||||
"integrity": "sha512-bRvrt9Tw8EGW4jj64aYFTnVg134E8hgDxyl/eEHnxiGqYk7/pTPss6CWlurqPOUzqvEoZkZ58Ws+Iu8MB87iMA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esbuild": "^0.14.47",
|
||||
"fsevents": "~2.3.2",
|
||||
"postcss": "^8.4.14",
|
||||
"postcss": "^8.4.16",
|
||||
"resolve": "^1.22.1",
|
||||
"rollup": "^2.75.6"
|
||||
}
|
||||
},
|
||||
"w3c-keyname": {
|
||||
"version": "2.2.5",
|
||||
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.5.tgz",
|
||||
"integrity": "sha512-WJrK7i6w+ULuZsGscCezbCH4Aev5U3xY87vnSimzzEgPQhb0Sa0a1rE3c2jtEwrFtSfi61Jefw3jI5/DD/3jbQ==",
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.6.tgz",
|
||||
"integrity": "sha512-f+fciywl1SJEniZHD6H+kUO8gOnwIr7f4ijKA6+ZvJFjeGi1r4PDLl53Ayud9O/rk64RqgoQine0feoeOU0kXg==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
"chart.js": "^3.7.1",
|
||||
"chartjs-adapter-luxon": "^1.1.0",
|
||||
"luxon": "^2.3.2",
|
||||
"pocketbase": "^0.2.2",
|
||||
"pocketbase": "^0.4.0",
|
||||
"prismjs": "^1.28.0",
|
||||
"sass": "^1.45.0",
|
||||
"svelte": "^3.44.0",
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@
|
||||
}
|
||||
|
||||
try {
|
||||
const settings = await ApiClient.Settings.getAll({
|
||||
const settings = await ApiClient.settings.getAll({
|
||||
$cancelKey: "loadAppName",
|
||||
});
|
||||
$appName = settings?.meta?.appName || "";
|
||||
@@ -143,9 +143,9 @@
|
||||
|
||||
<div class="app-body">
|
||||
<Router {routes} on:routeLoading={handleRouteLoading} on:conditionsFailed={handleRouteFailure} />
|
||||
|
||||
<Toasts />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Toasts />
|
||||
|
||||
<Confirmation />
|
||||
@@ -61,6 +61,9 @@ function refreshTooltip(node, data) {
|
||||
if (data.class) {
|
||||
tooltip.classList.add(data.class);
|
||||
}
|
||||
if (data.position) {
|
||||
tooltip.classList.add(data.position);
|
||||
}
|
||||
|
||||
// reset tooltip position
|
||||
tooltip.style.top = "0px";
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (ApiClient.AuthStore.isValid) {
|
||||
if (ApiClient.authStore.isValid) {
|
||||
replace("/collections");
|
||||
} else {
|
||||
ApiClient.logout();
|
||||
|
||||
@@ -71,9 +71,9 @@
|
||||
|
||||
let request;
|
||||
if (admin.isNew) {
|
||||
request = ApiClient.Admins.create(data);
|
||||
request = ApiClient.admins.create(data);
|
||||
} else {
|
||||
request = ApiClient.Admins.update(admin.id, data);
|
||||
request = ApiClient.admins.update(admin.id, data);
|
||||
}
|
||||
|
||||
request
|
||||
@@ -83,8 +83,8 @@
|
||||
addSuccessToast(admin.isNew ? "Successfully created admin." : "Successfully updated admin.");
|
||||
dispatch("save", result);
|
||||
|
||||
if (ApiClient.AuthStore.model?.id === result.id) {
|
||||
ApiClient.AuthStore.save(ApiClient.AuthStore.token, result);
|
||||
if (ApiClient.authStore.model?.id === result.id) {
|
||||
ApiClient.authStore.save(ApiClient.authStore.token, result);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -101,7 +101,8 @@
|
||||
}
|
||||
|
||||
confirm(`Do you really want to delete the selected admin?`, () => {
|
||||
return ApiClient.Admins.delete(admin.id)
|
||||
return ApiClient.admins
|
||||
.delete(admin.id)
|
||||
.then(() => {
|
||||
confirmClose = false;
|
||||
hide();
|
||||
@@ -190,7 +191,7 @@
|
||||
|
||||
{#if admin.isNew || changePasswordToggle}
|
||||
<div class="col-12">
|
||||
<div class="grid" transition:slide={{ duration: 150 }}>
|
||||
<div class="grid" transition:slide|local={{ duration: 150 }}>
|
||||
<div class="col-sm-6">
|
||||
<Field class="form-field required" name="password" let:uniqueId>
|
||||
<label for={uniqueId}>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
isLoading = true;
|
||||
|
||||
try {
|
||||
await ApiClient.Admins.confirmPasswordReset(params?.token, newPassword, newPasswordConfirm);
|
||||
await ApiClient.admins.confirmPasswordReset(params?.token, newPassword, newPasswordConfirm);
|
||||
addSuccessToast("Successfully set a new admin password.");
|
||||
replace("/");
|
||||
} catch (err) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
isLoading = true;
|
||||
|
||||
return ApiClient.Admins.authViaEmail(email, password)
|
||||
return ApiClient.admins.authViaEmail(email, password)
|
||||
.then(() => {
|
||||
replace("/");
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
isLoading = true;
|
||||
|
||||
try {
|
||||
await ApiClient.Admins.requestPasswordReset(email);
|
||||
await ApiClient.admins.requestPasswordReset(email);
|
||||
success = true;
|
||||
} catch (err) {
|
||||
ApiClient.errorResponseHandler(err);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import CommonHelper from "@/utils/CommonHelper";
|
||||
import { pageTitle } from "@/stores/app";
|
||||
import { admin as loggedAdmin } from "@/stores/admin";
|
||||
import PageWrapper from "@/components/base/PageWrapper.svelte";
|
||||
import Searchbar from "@/components/base/Searchbar.svelte";
|
||||
import RefreshButton from "@/components/base/RefreshButton.svelte";
|
||||
import SortHeader from "@/components/base/SortHeader.svelte";
|
||||
@@ -35,10 +36,11 @@
|
||||
|
||||
admins = []; // reset
|
||||
|
||||
return ApiClient.Admins.getFullList(100, {
|
||||
sort: sort || "-created",
|
||||
filter: filter,
|
||||
})
|
||||
return ApiClient.admins
|
||||
.getFullList(100, {
|
||||
sort: sort || "-created",
|
||||
filter: filter,
|
||||
})
|
||||
.then((result) => {
|
||||
admins = result;
|
||||
isLoading = false;
|
||||
@@ -60,7 +62,7 @@
|
||||
|
||||
<SettingsSidebar />
|
||||
|
||||
<main class="page-wrapper">
|
||||
<PageWrapper>
|
||||
<header class="page-header">
|
||||
<nav class="breadcrumbs">
|
||||
<div class="breadcrumb-item">Settings</div>
|
||||
@@ -197,6 +199,6 @@
|
||||
{#if admins.length}
|
||||
<small class="block txt-hint txt-right m-t-sm">Showing {admins.length} of {admins.length}</small>
|
||||
{/if}
|
||||
</main>
|
||||
</PageWrapper>
|
||||
|
||||
<AdminUpsertPanel bind:this={adminUpsertPanel} on:save={() => loadAdmins()} on:delete={() => loadAdmins()} />
|
||||
@@ -4,6 +4,9 @@
|
||||
import "prismjs/components/prism-dart.js";
|
||||
import "@/scss/prism_light.scss";
|
||||
|
||||
let classes = "";
|
||||
export { classes as class }; // export reserved keyword
|
||||
|
||||
export let content = "";
|
||||
export let language = "javascript"; // javascript, html
|
||||
|
||||
@@ -28,7 +31,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="code-wrapper prism-light">
|
||||
<div class="code-wrapper prism-light {classes}">
|
||||
<code>{@html formattedContent}</code>
|
||||
</div>
|
||||
|
||||
@@ -43,6 +46,9 @@
|
||||
.code-wrapper {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
overflow: auto; /* fallback */
|
||||
overflow: overlay;
|
||||
}
|
||||
.prism-light code {
|
||||
color: var(--txtPrimaryColor);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
{#each fieldErrors as error}
|
||||
<div class="help-block help-block-error">
|
||||
{#if typeof error === "object"}
|
||||
{error?.message || error?.code || defaultError}
|
||||
<pre>{error?.message || error?.code || defaultError}</pre>
|
||||
{:else}
|
||||
{error || defaultError}
|
||||
{/if}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script>
|
||||
import PageWrapper from "@/components/base/PageWrapper.svelte";
|
||||
|
||||
export let nobranding = false;
|
||||
</script>
|
||||
|
||||
<div class="page-wrapper full-page-panel">
|
||||
<div class="flex-fill" />
|
||||
|
||||
<div class="wrapper wrapper-sm m-b-xl">
|
||||
<PageWrapper class="full-page" center>
|
||||
<div class="wrapper wrapper-sm m-b-xl panel-wrapper">
|
||||
{#if !nobranding}
|
||||
<div class="block txt-center m-b-lg">
|
||||
<figure class="logo">
|
||||
@@ -23,18 +23,10 @@
|
||||
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<div class="flex-fill" />
|
||||
</div>
|
||||
</PageWrapper>
|
||||
|
||||
<style>
|
||||
.full-page-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: var(--baseColor);
|
||||
}
|
||||
.full-page-panel .wrapper {
|
||||
.panel-wrapper {
|
||||
animation: slideIn 200ms;
|
||||
}
|
||||
</style>
|
||||
@@ -18,13 +18,13 @@
|
||||
isLoading = true;
|
||||
|
||||
try {
|
||||
await ApiClient.Admins.create({
|
||||
await ApiClient.admins.create({
|
||||
email,
|
||||
password,
|
||||
passwordConfirm,
|
||||
});
|
||||
|
||||
await ApiClient.Admins.authViaEmail(email, password);
|
||||
await ApiClient.admins.authViaEmail(email, password);
|
||||
|
||||
dispatch("submit");
|
||||
} catch (err) {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<script>
|
||||
export let center = false;
|
||||
|
||||
let classes = "";
|
||||
export { classes as class }; // export reserved keyword
|
||||
</script>
|
||||
|
||||
<div class="page-wrapper {classes}" class:center-content={center}>
|
||||
<main class="page-content">
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
<footer class="page-footer">
|
||||
<a
|
||||
href={import.meta.env.PB_RELEASES}
|
||||
class="inline-flex flex-gap-5"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
title="Releases"
|
||||
>
|
||||
<span class="txt">PocketBase {import.meta.env.PB_VERSION}</span>
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
@@ -86,7 +86,7 @@
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-expanded btn-sm btn-warning"
|
||||
transition:fly={{ duration: 150, x: 5 }}
|
||||
transition:fly|local={{ duration: 150, x: 5 }}
|
||||
>
|
||||
<span class="txt">Search</span>
|
||||
</button>
|
||||
@@ -95,7 +95,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary btn-sm btn-hint p-l-xs p-r-xs m-l-10"
|
||||
transition:fly={{ duration: 150, x: 5 }}
|
||||
transition:fly|local={{ duration: 150, x: 5 }}
|
||||
on:click={() => {
|
||||
clear(false);
|
||||
submit();
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
<i class="ri-information-line" />
|
||||
{:else if toast.type === "success"}
|
||||
<i class="ri-checkbox-circle-line" />
|
||||
{:else if toast.type === "warning"}
|
||||
<i class="ri-error-warning-line" />
|
||||
{:else}
|
||||
<i class="ri-alert-line" />
|
||||
{/if}
|
||||
|
||||
@@ -97,9 +97,9 @@
|
||||
|
||||
let request;
|
||||
if (collection.isNew) {
|
||||
request = ApiClient.Collections.create(data);
|
||||
request = ApiClient.collections.create(data);
|
||||
} else {
|
||||
request = ApiClient.Collections.update(collection.id, data);
|
||||
request = ApiClient.collections.update(collection.id, data);
|
||||
}
|
||||
|
||||
request
|
||||
@@ -146,7 +146,7 @@
|
||||
}
|
||||
|
||||
confirm(`Do you really want to delete collection "${original?.name}" and all its records?`, () => {
|
||||
return ApiClient.Collections.delete(original?.id)
|
||||
return ApiClient.collections.delete(original?.id)
|
||||
.then(() => {
|
||||
hide();
|
||||
addSuccessToast(`Successfully deleted collection "${original?.name}".`);
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
<script>
|
||||
import { Collection } from "pocketbase";
|
||||
import CommonHelper from "@/utils/CommonHelper";
|
||||
|
||||
export let collectionA = new Collection();
|
||||
export let collectionB = new Collection();
|
||||
export let deleteMissing = false;
|
||||
let schemaA = [];
|
||||
let schemaB = [];
|
||||
let removedFields = [];
|
||||
let sharedFields = [];
|
||||
let addedFields = [];
|
||||
|
||||
$: isDeleteDiff = !collectionB?.id && !collectionB?.name;
|
||||
|
||||
$: isCreateDiff = !isDeleteDiff && !collectionA?.id;
|
||||
|
||||
$: schemaA = Array.isArray(collectionA?.schema) ? collectionA?.schema.concat() : [];
|
||||
|
||||
$: if (
|
||||
typeof collectionA?.schema !== "undefined" ||
|
||||
typeof collectionB?.schema !== "undefined" ||
|
||||
typeof deleteMissing !== "undefined"
|
||||
) {
|
||||
setSchemaB();
|
||||
}
|
||||
|
||||
$: removedFields = schemaA.filter((fieldA) => {
|
||||
return !schemaB.find((fieldB) => fieldA.id == fieldB.id);
|
||||
});
|
||||
|
||||
$: sharedFields = schemaB.filter((fieldB) => {
|
||||
return schemaA.find((fieldA) => fieldA.id == fieldB.id);
|
||||
});
|
||||
|
||||
$: addedFields = schemaB.filter((fieldB) => {
|
||||
return !schemaA.find((fieldA) => fieldA.id == fieldB.id);
|
||||
});
|
||||
|
||||
$: hasAnyChange = CommonHelper.hasCollectionChanges(collectionA, collectionB, deleteMissing);
|
||||
|
||||
const mainModelProps = Object.keys(new Collection().export()).filter(
|
||||
(key) => !["schema", "created", "updated"].includes(key)
|
||||
);
|
||||
|
||||
function setSchemaB() {
|
||||
schemaB = Array.isArray(collectionB?.schema) ? collectionB?.schema.concat() : [];
|
||||
|
||||
if (!deleteMissing) {
|
||||
schemaB = schemaB.concat(
|
||||
schemaA.filter((fieldA) => {
|
||||
return !schemaB.find((fieldB) => fieldA.id == fieldB.id);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getFieldById(schema, id) {
|
||||
schema = schema || [];
|
||||
|
||||
for (let field of schema) {
|
||||
if (field.id == id) {
|
||||
return field;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function hasChanges(valA, valB) {
|
||||
// direct match
|
||||
if (valA === valB) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return JSON.stringify(valA) !== JSON.stringify(valB);
|
||||
}
|
||||
|
||||
function displayValue(value) {
|
||||
if (typeof value === "undefined") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return CommonHelper.isObject(value) ? JSON.stringify(value, null, 4) : value;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="section-title">
|
||||
{#if !collectionA?.id}
|
||||
<span class="label label-success">Added</span>
|
||||
<strong>{collectionB?.name}</strong>
|
||||
{:else if !collectionB?.id}
|
||||
<span class="label label-danger">Deleted</span>
|
||||
<strong>{collectionA?.name}</strong>
|
||||
{:else}
|
||||
<div class="inline-flex fleg-gap-5">
|
||||
{#if hasAnyChange}
|
||||
<span class="label label-warning">Changed</span>
|
||||
{/if}
|
||||
{#if collectionA.name !== collectionB.name}
|
||||
<strong class="txt-strikethrough txt-hint">{collectionA.name}</strong>
|
||||
<i class="ri-arrow-right-line txt-sm" />
|
||||
{/if}
|
||||
<strong class="txt">{collectionB.name}</strong>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<table class="table collections-diff-table m-b-base">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Props</th>
|
||||
<th width="10%">Old</th>
|
||||
<th width="10%">New</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{#each mainModelProps as prop}
|
||||
<tr class:txt-primary={hasChanges(collectionA?.[prop], collectionB?.[prop])}>
|
||||
<td class="min-width">
|
||||
<span>{prop}</span>
|
||||
</td>
|
||||
<td
|
||||
class:changed-old-col={!isCreateDiff &&
|
||||
hasChanges(collectionA?.[prop], collectionB?.[prop])}
|
||||
class:changed-none-col={isCreateDiff}
|
||||
>
|
||||
<pre class="txt">{displayValue(collectionA?.[prop])}</pre>
|
||||
</td>
|
||||
<td
|
||||
class:changed-new-col={!isDeleteDiff &&
|
||||
hasChanges(collectionA?.[prop], collectionB?.[prop])}
|
||||
class:changed-none-col={isDeleteDiff}
|
||||
>
|
||||
<pre class="txt">{displayValue(collectionB?.[prop])}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
|
||||
{#if deleteMissing || isDeleteDiff}
|
||||
{#each removedFields as field}
|
||||
<tr>
|
||||
<th class="min-width" colspan="3">
|
||||
<span class="txt">field: {field.name}</span>
|
||||
<span class="label label-danger m-l-5">
|
||||
Deleted - <small>
|
||||
All stored data related to <strong>{field.name}</strong> will be deleted!
|
||||
</small>
|
||||
</span>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
{#each Object.entries(field) as [key, value]}
|
||||
<tr class="txt-primary">
|
||||
<td class="min-width field-key-col">{key}</td>
|
||||
<td class="changed-old-col">
|
||||
<pre class="txt">{displayValue(value)}</pre>
|
||||
</td>
|
||||
<td class="changed-none-col" />
|
||||
</tr>
|
||||
{/each}
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
{#each sharedFields as field}
|
||||
<tr>
|
||||
<th class="min-width" colspan="3">
|
||||
<span class="txt">field: {field.name}</span>
|
||||
{#if hasChanges(getFieldById(schemaA, field.id), getFieldById(schemaB, field.id))}
|
||||
<span class="label label-warning m-l-5">Changed</span>
|
||||
{/if}
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
{#each Object.entries(field) as [key, newValue]}
|
||||
<tr class:txt-primary={hasChanges(getFieldById(schemaA, field.id)?.[key], newValue)}>
|
||||
<td class="min-width field-key-col">{key}</td>
|
||||
<td class:changed-old-col={hasChanges(getFieldById(schemaA, field.id)?.[key], newValue)}>
|
||||
<pre class="txt">{displayValue(getFieldById(schemaA, field.id)?.[key])}</pre>
|
||||
</td>
|
||||
<td class:changed-new-col={hasChanges(getFieldById(schemaA, field.id)?.[key], newValue)}>
|
||||
<pre class="txt">{displayValue(newValue)}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
{/each}
|
||||
|
||||
{#each addedFields as field}
|
||||
<tr>
|
||||
<th class="min-width" colspan="3">
|
||||
<span class="txt">field: {field.name}</span>
|
||||
<span class="label label-success m-l-5">Added</span>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
{#each Object.entries(field) as [key, value]}
|
||||
<tr class="txt-primary">
|
||||
<td class="min-width field-key-col">{key}</td>
|
||||
<td class="changed-none-col" />
|
||||
<td class="changed-new-col">
|
||||
<pre class="txt">{displayValue(value)}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<style lang="scss">
|
||||
.collections-diff-table {
|
||||
color: var(--txtHintColor);
|
||||
border: 2px solid var(--primaryColor);
|
||||
tr {
|
||||
background: none;
|
||||
}
|
||||
th,
|
||||
td {
|
||||
height: auto;
|
||||
padding: 2px 15px;
|
||||
border-bottom: 1px solid rgba(#000, 0.07);
|
||||
}
|
||||
th {
|
||||
height: 35px;
|
||||
padding: 4px 15px;
|
||||
color: var(--txtPrimaryColor);
|
||||
}
|
||||
thead tr {
|
||||
background: var(--primaryColor);
|
||||
th {
|
||||
color: var(--baseColor);
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
.label {
|
||||
font-weight: normal;
|
||||
}
|
||||
.changed-none-col {
|
||||
color: var(--txtDisabledColor);
|
||||
background: var(--baseAlt1Color);
|
||||
}
|
||||
.changed-old-col {
|
||||
color: var(--txtPrimaryColor);
|
||||
background: var(--dangerAltColor);
|
||||
}
|
||||
.changed-new-col {
|
||||
color: var(--txtPrimaryColor);
|
||||
background: var(--successAltColor);
|
||||
}
|
||||
.field-key-col {
|
||||
padding-left: 30px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -12,8 +12,7 @@
|
||||
|
||||
$: adminsOnly = collection?.createRule === null;
|
||||
|
||||
$: backendAbsUrl =
|
||||
window.location.href.substring(0, window.location.href.indexOf("/_")) || ApiClient.baseUrl;
|
||||
$: backendAbsUrl = CommonHelper.getApiExampleUrl(ApiClient.baseUrl);
|
||||
|
||||
$: responses = [
|
||||
{
|
||||
@@ -82,7 +81,7 @@
|
||||
|
||||
const data = { ... };
|
||||
|
||||
const record = await client.Records.create('${collection?.name}', data);
|
||||
const record = await client.records.create('${collection?.name}', data);
|
||||
`}
|
||||
dart={`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
@@ -107,6 +106,22 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="inline-flex">
|
||||
<span class="label label-warning">Optional</span>
|
||||
<span>id</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="label">String</span>
|
||||
</td>
|
||||
<td>
|
||||
<strong>15 characters string</strong> to store as record ID.
|
||||
<br />
|
||||
If not set, it will be auto generated.
|
||||
</td>
|
||||
</tr>
|
||||
{#each collection?.schema as field (field.name)}
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
|
||||
$: adminsOnly = collection?.deleteRule === null;
|
||||
|
||||
$: backendAbsUrl =
|
||||
window.location.href.substring(0, window.location.href.indexOf("/_")) || ApiClient.baseUrl;
|
||||
$: backendAbsUrl = CommonHelper.getApiExampleUrl(ApiClient.baseUrl);
|
||||
|
||||
$: if (collection?.id) {
|
||||
responses.push({
|
||||
@@ -84,7 +83,7 @@
|
||||
|
||||
...
|
||||
|
||||
await client.Records.delete('${collection?.name}', 'RECORD_ID');
|
||||
await client.records.delete('${collection?.name}', 'RECORD_ID');
|
||||
`}
|
||||
dart={`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
|
||||
$: adminsOnly = collection?.listRule === null;
|
||||
|
||||
$: backendAbsUrl =
|
||||
window.location.href.substring(0, window.location.href.indexOf("/_")) || ApiClient.baseUrl;
|
||||
$: backendAbsUrl = CommonHelper.getApiExampleUrl(ApiClient.baseUrl);
|
||||
|
||||
$: if (collection?.id) {
|
||||
responses.push({
|
||||
@@ -97,12 +96,12 @@
|
||||
...
|
||||
|
||||
// fetch a paginated records list
|
||||
const resultList = await client.Records.getList('${collection?.name}', 1, 50, {
|
||||
filter: 'created >= '2022-01-01 00:00:00'',
|
||||
const resultList = await client.records.getList('${collection?.name}', 1, 50, {
|
||||
filter: 'created >= "2022-01-01 00:00:00"',
|
||||
});
|
||||
|
||||
// alternatively you can also fetch all records at once via getFullList:
|
||||
const records = await client.Records.getFullList('${collection?.name}', 200 /* batch size */, {
|
||||
const records = await client.records.getFullList('${collection?.name}', 200 /* batch size */, {
|
||||
sort: '-created',
|
||||
});
|
||||
`}
|
||||
|
||||
Loaded 100 of 145 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user