Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
454cece1d8 | ||
|
|
c49acd74de | ||
|
|
965b7e660b | ||
|
|
8c7f65abf5 | ||
|
|
507d643aee | ||
|
|
f1a0d6a2b1 | ||
|
|
f74c850e01 | ||
|
|
9d6d39fe62 | ||
|
|
a9851847fc | ||
|
|
d1c896acf4 | ||
|
|
f99aadee83 | ||
|
|
8cd80c016f | ||
|
|
ef29e4d261 | ||
|
|
0725366dd5 | ||
|
|
a2bcd10607 | ||
|
|
37ed966ac3 | ||
|
|
085c307137 | ||
|
|
d961d910d8 | ||
|
|
1dc6d541cc | ||
|
|
7fef89b778 | ||
|
|
6b713e4ffb | ||
|
|
b52a91bf52 | ||
|
|
e8d8340448 | ||
|
|
81371c41a7 | ||
|
|
3cf5f0173b | ||
|
|
65844e030d | ||
|
|
ba7e4ab151 | ||
|
|
ec4e578aee | ||
|
|
1a5f300a78 | ||
|
|
a04cdd753d | ||
|
|
daa4b268a6 | ||
|
|
a5161cb6b4 | ||
|
|
48e32bfdcb | ||
|
|
639ee895cd | ||
|
|
8cf1dd9bfd | ||
|
|
fcadc8d7a1 | ||
|
|
1e2f941f47 | ||
|
|
eeee2afc05 | ||
|
|
98efb76f7b | ||
|
|
dff3748623 | ||
|
|
93a16ee916 | ||
|
|
8b3a3964a5 | ||
|
|
43dd36e20e | ||
|
|
5587e8b4b6 | ||
|
|
16e50e2d49 | ||
|
|
bd01e5c32c | ||
|
|
e058ceadee | ||
|
|
4a7eb217a1 | ||
|
|
57b0727788 | ||
|
|
58b047edd2 | ||
|
|
a78b699a5e | ||
|
|
e910ae9878 | ||
|
|
362c649d36 | ||
|
|
852c4d608d | ||
|
|
aa59e55a41 | ||
|
|
348bad80e0 | ||
|
|
f0d4686141 | ||
|
|
a482ab3c7e | ||
|
|
c580882ec0 | ||
|
|
2cf8379cbe | ||
|
|
c39ec469df | ||
|
|
232fcc8845 | ||
|
|
9d5d4dd930 | ||
|
|
c507dc6031 | ||
|
|
843f560710 | ||
|
|
7574d67d80 | ||
|
|
19931cb4d1 | ||
|
|
6458c1e71d | ||
|
|
63232585ab | ||
|
|
6d15591601 | ||
|
|
32c8378020 | ||
|
|
d0cd8228cc | ||
|
|
c45a3847f8 | ||
|
|
c0b3878674 | ||
|
|
f868219981 | ||
|
|
8ac0567e66 | ||
|
|
02f8f5970a | ||
|
|
0cd4e08716 | ||
|
|
cf3d621587 | ||
|
|
6fc0a65b6f | ||
|
|
a73ee21568 | ||
|
|
ff54bcc2ef | ||
|
|
ab1517cc8f | ||
|
|
9f724a3243 | ||
|
|
ae65ca47f6 | ||
|
|
74d2fcc4fa | ||
|
|
82174afdea | ||
|
|
ffc39f078d | ||
|
|
7c4e19afbc | ||
|
|
7b10bfca1d | ||
|
|
0e5ac08641 | ||
|
|
1505aaa909 | ||
|
|
d9e2c4954a | ||
|
|
97ad9de3d2 | ||
|
|
9e140be0ec | ||
|
|
a737c2d571 | ||
|
|
c43c29eb14 | ||
|
|
0c00f76657 |
No files matched your search
@@ -6,3 +6,4 @@ front/node_modules
|
||||
front/npm-debug.log
|
||||
/.idea
|
||||
/.vscode
|
||||
/.claude
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "/phpactor.schema.json",
|
||||
"language_server_phpstan.enabled": false
|
||||
}
|
||||
@@ -9,8 +9,8 @@ include_toc: true
|
||||
|
||||
### Requirements
|
||||
|
||||
- PHP 8.2
|
||||
- Laravel 10
|
||||
- PHP 8.3
|
||||
- Laravel 11
|
||||
- Postgres or Sqlite database
|
||||
- ImageMagick
|
||||
|
||||
@@ -82,7 +82,9 @@ return [
|
||||
### Database
|
||||
|
||||
The recommended database for small website is sqlite. But you can also use postresql
|
||||
Make sure to delete the existing migration scripts in your database/migrations folder.
|
||||
|
||||
> [!CAUTION]
|
||||
> Make sure to delete the existing migration scripts in your database/migrations folder.
|
||||
|
||||
Then run:
|
||||
|
||||
@@ -90,6 +92,26 @@ Then run:
|
||||
php artisan migrate
|
||||
```
|
||||
|
||||
### File Storage
|
||||
|
||||
You can use your local filesystem or s3 compatible storage. Lucent expects you to have a valid configuration inside ``config/filesystems.php``
|
||||
|
||||
example:
|
||||
|
||||
```php
|
||||
return [
|
||||
'disks' => [
|
||||
'lucent' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => true,
|
||||
],
|
||||
],
|
||||
];
|
||||
```
|
||||
|
||||
### First user
|
||||
|
||||
To create your first user, head to your localhost:8000/lucent
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
# Upgrade from 1.1.* to 1.2.0
|
||||
|
||||
## lucent.php config file
|
||||
|
||||
There is now an array of commands, accepting more than one.
|
||||
|
||||
from
|
||||
```php
|
||||
"generateCommand" => env("LUCENT_GENERATE_COMMAND", "generate:static"),
|
||||
```
|
||||
|
||||
to
|
||||
```php
|
||||
"commands" => [
|
||||
"generate:static" => "Build Website",
|
||||
],
|
||||
```
|
||||
## config/filesystems.php
|
||||
|
||||
Lucent has its own filesystem.
|
||||
|
||||
You should now add:
|
||||
|
||||
```
|
||||
'lucent' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
],
|
||||
```
|
||||
+4
-9
@@ -6,16 +6,12 @@
|
||||
"require": {
|
||||
"ext-xml": "*",
|
||||
"ext-zip": "*",
|
||||
"ext-sqlite3": "*",
|
||||
"ext-imagick": "*",
|
||||
"php": "^8.3",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"intervention/image": "^2.7",
|
||||
"phpoption/phpoption": "^1.9",
|
||||
"spatie/image-optimizer": "^1.6",
|
||||
"staudenmeir/laravel-cte": "^1.0",
|
||||
"ext-pdo": "*",
|
||||
"mustache/mustache": "^2.14"
|
||||
"php": "^8.4",
|
||||
"spatie/image-optimizer": "^1.8",
|
||||
"staudenmeir/laravel-cte": "^1.0",
|
||||
"intervention/image": "^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.8",
|
||||
@@ -39,5 +35,4 @@
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
|
||||
}
|
||||
Generated
+725
-1283
File diff suppressed because it is too large.
Load diff
+145
-298
@@ -5,374 +5,221 @@ include_toc: true
|
||||
|
||||
# Fields
|
||||
|
||||
Fields are similar to a table's columns in a relational databases.
|
||||
Fields define the columns of a schema. Each field has a `ui` type that controls both storage and the admin UI component rendered.
|
||||
|
||||
## Available fields for Collections and Files
|
||||
## Common Optional Properties
|
||||
|
||||
Most fields share these optional properties:
|
||||
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `required` | Whether the field must have a value to save as `published` |
|
||||
| `nullable` | Allow saving as `null` |
|
||||
| `help` | Help text shown below the input |
|
||||
| `default` | Default value when creating a new record |
|
||||
| `readonly` | Prevent editing from the UI |
|
||||
| `group` | Tab group this field belongs to |
|
||||
|
||||
|
||||
## Field Types
|
||||
|
||||
### text
|
||||
One-line text input
|
||||
|
||||
required
|
||||
One-line text input.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
| `selectOptions` | Array of options. Strings or `[{value, label}]` objects |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
| `optionsSuggest` | Allow typing new values not in the options list |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]`
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### textarea
|
||||
textarea input
|
||||
|
||||
required
|
||||
Multi-line text input.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### slug
|
||||
Slug input. Generates automatically if left empty
|
||||
|
||||
required
|
||||
Slug input. Auto-generates from a source field if left empty.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **source**: The source field from which it generates
|
||||
**Required:** `name`, `label`, `source`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `source` | Field name to generate the slug from |
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### rich
|
||||
WYSIWYG editor
|
||||
|
||||
required
|
||||
WYSIWYG rich text editor.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### markdown
|
||||
|
||||
Markdown editor.
|
||||
|
||||
**Required:** `name`, `label`
|
||||
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
|
||||
---
|
||||
|
||||
### number
|
||||
Any numeric value
|
||||
|
||||
required
|
||||
Numeric input.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `decimals` | Number of decimal places. Default: `0` |
|
||||
| `min` | Minimum value |
|
||||
| `max` | Maximum value |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
| `optionsSuggest` | Allow typing new values not in the options list |
|
||||
|
||||
- **decimals**: default is 0
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### checkbox
|
||||
True or false
|
||||
|
||||
required
|
||||
Boolean true/false toggle.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### color
|
||||
Color picker
|
||||
|
||||
required
|
||||
Color picker.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `selectOptions` | Restrict to a predefined palette |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
| `optionsSuggest` | Allow typing new values not in the options list |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]`
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### date
|
||||
Date select
|
||||
|
||||
required
|
||||
Date selector. Stores as a date string.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum date |
|
||||
| `max` | Maximum date |
|
||||
| `selectOptions` | Predefined date options |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]`
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### datetime
|
||||
Date and time selector
|
||||
|
||||
required
|
||||
Date and time selector. Stores as an ISO 8601 string.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum datetime |
|
||||
| `max` | Maximum datetime |
|
||||
| `selectOptions` | Predefined datetime options |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]`
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### uuid
|
||||
|
||||
UUID text field. Stores an arbitrary UUID string. Typically used as a read-only external reference ID.
|
||||
|
||||
**Required:** `name`, `label`
|
||||
|
||||
---
|
||||
|
||||
### json
|
||||
Json data
|
||||
|
||||
required
|
||||
Raw JSON data field. Accepts either a JSON string or a plain array — both are stored as JSON.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
|
||||
### markdown
|
||||
Markdown editor
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### file
|
||||
Upload or select files
|
||||
|
||||
required
|
||||
Upload or select files from a files schema. Files can be uploaded directly or browsed from previously uploaded files. Image files (jpeg, png, webp, gif, tiff) automatically get a 300×300 thumbnail generated on upload.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **collections**: File collections to choose from
|
||||
**Required:** `name`, `label`, `collections`
|
||||
|
||||
optional
|
||||
|
||||
- **mime**: The mime types allowed to select
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum files
|
||||
- **max**: Maximum files
|
||||
- **help**: Help text
|
||||
- **group**: The group that this field belongs to
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `collections` | Array of file schema names to choose from |
|
||||
| `mime` | Allowed MIME types e.g. `["image/*"]` |
|
||||
| `min` | Minimum number of files |
|
||||
| `max` | Maximum number of files |
|
||||
|
||||
---
|
||||
|
||||
### reference
|
||||
Reference other records
|
||||
|
||||
required
|
||||
Reference records from another collection.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **collections**: Collections to choose from
|
||||
**Required:** `name`, `label`, `collections`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `collections` | Array of collection schema names to reference |
|
||||
| `min` | Minimum number of references |
|
||||
| `max` | Maximum number of references |
|
||||
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum files
|
||||
- **max**: Maximum files
|
||||
- **help**: Help text
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
## Example Field
|
||||
|
||||
### block
|
||||
The block editor
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **schema**: The block schema name
|
||||
|
||||
optional
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
|
||||
)
|
||||
## Available fields for the Block Editor
|
||||
|
||||
### heading
|
||||
Single-line text
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
### textarea
|
||||
Multiline text
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
### rich
|
||||
WYSIWYG editor
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
|
||||
### markdown
|
||||
Markdown editor
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
### file
|
||||
Choose files
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **collections**: File collections to choose from
|
||||
|
||||
optional
|
||||
- **mime**: The mime types allowed to select
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
### reference
|
||||
Choose files
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **collections**: Collections to choose from
|
||||
|
||||
optional
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
```json
|
||||
{
|
||||
"ui": "text",
|
||||
"name": "title",
|
||||
"label": "Title",
|
||||
"required": true,
|
||||
"min": 3,
|
||||
"max": 200,
|
||||
"help": "The main title of the post"
|
||||
}
|
||||
```
|
||||
+133
-52
@@ -5,88 +5,169 @@ include_toc: true
|
||||
|
||||
# Queries
|
||||
|
||||
## Graph or Tree
|
||||
|
||||
Queries can return results in 2 formats. A graph or a tree.
|
||||
|
||||
Graphs results are a collection of records (nodes) and a collection of edges. This format is more useful for network visualization.
|
||||
|
||||
The tree format is more straightforward as it returns a collection of records. Each record has a **_children** and a **_parents** field and the tree can continue upwards or downwards according to the depth you have requested.
|
||||
|
||||
For example to request records with their children and their children's children:
|
||||
The `Query` class is the main way to fetch records. Inject it via the Laravel container.
|
||||
|
||||
```php
|
||||
$query->childrenDepth(2);
|
||||
public function __construct(private Query $query) {}
|
||||
```
|
||||
Maybe you only want to get a specific type of relationship:
|
||||
|
||||
```php
|
||||
$query->childrenDepth(2)->childrenFields(["categories"]);
|
||||
```
|
||||
## Return Formats
|
||||
|
||||
Queries return results in two formats:
|
||||
|
||||
**Graph** — via `->run()`. Returns a `Graph` object with `records` and `edges` collections. Useful for network-style data.
|
||||
|
||||
**Tree** — via `->tree()`. Returns a flat `Collection` of records where each record has `_children` and `_parents` arrays populated based on the requested depth. This is the most common format.
|
||||
|
||||
## Chaining Methods
|
||||
|
||||
All methods return `$this` and can be chained:
|
||||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `->filter(array)` | Add an AND filter |
|
||||
| `->orFilter(array)` | Add an OR filter (grouped) |
|
||||
| `->limit(int)` | Max number of root records to return |
|
||||
| `->skip(int)` | Offset for pagination |
|
||||
| `->sort(string)` | Sort by field. Prefix with `-` for descending e.g. `"-_sys.updatedAt"` |
|
||||
| `->status(array)` | Filter by status array e.g. `["published", "draft"]` |
|
||||
| `->onlyPublished()` | Shorthand for `->status(["published"])` |
|
||||
| `->childrenDepth(int)` | How many levels of children to load |
|
||||
| `->childrenLimit(int)` | Max children per record |
|
||||
| `->childrenFields(array)` | Only follow specific relationship fields |
|
||||
| `->parentsDepth(int)` | How many levels of parents to load |
|
||||
| `->parentsLimit(int)` | Max parents per record |
|
||||
| `->parentFields(array)` | Only follow specific relationship fields |
|
||||
| `->notLinked(string)` | Return only records with no parents |
|
||||
| `->run()` | Execute and return a `Graph` |
|
||||
| `->tree()` | Execute and return a `Collection` (tree format) |
|
||||
| `->runWithCount()` | Execute and return a `Graph` with a `total` count |
|
||||
|
||||
|
||||
## Filters
|
||||
|
||||
You can filter your query with the following format:
|
||||
Filter keys use the format `field_operator`. When no operator suffix is given, `eq` is assumed.
|
||||
|
||||
```php
|
||||
$query->filter(["field_operator" => "value"]);
|
||||
|
||||
// example:
|
||||
// No operator = eq
|
||||
$query->filter(["schema" => "blogPosts"]);
|
||||
|
||||
$query->filter(["date_lt" => "2020-09-15"]);
|
||||
// With operator
|
||||
$query->filter(["_sys.updatedAt_gte" => "2024-01-01"]);
|
||||
```
|
||||
|
||||
Or filters are also available:
|
||||
### Operator Reference
|
||||
|
||||
| Operator | Description |
|
||||
|---|---|
|
||||
| _(none)_ or `eq` | Equals (string) |
|
||||
| `ne` | Not equals (string) |
|
||||
| `eqnum` | Equals (numeric) |
|
||||
| `neqnum` | Not equals (numeric) |
|
||||
| `eqtrue` | Equals `true` |
|
||||
| `eqfalse` | Equals `false` |
|
||||
| `netrue` | Not equals `true` |
|
||||
| `nefalse` | Not equals `false` |
|
||||
| `regex` | Regular expression match |
|
||||
| `in` | Value is in array (strings) |
|
||||
| `nin` | Value is not in array (strings) |
|
||||
| `innum` | Value is in array (numeric) |
|
||||
| `ninnum` | Value is not in array (numeric) |
|
||||
| `lt` | Less than |
|
||||
| `lte` | Less than or equal |
|
||||
| `gt` | Greater than |
|
||||
| `gte` | Greater than or equal |
|
||||
| `null` | Field is null |
|
||||
| `nnull` | Field is not null |
|
||||
| `exists` | Field key exists |
|
||||
| `nexists` | Field key does not exist |
|
||||
| `filter` | Raw filter passthrough |
|
||||
|
||||
### OR Filters
|
||||
|
||||
```php
|
||||
$query
|
||||
->filter(["price_eqn" => 10])
|
||||
->orFilter(["title_regex" => "search", "slug_regex" => "search"])
|
||||
;
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->orFilter(["title_regex" => "search", "slug_regex" => "search"]);
|
||||
```
|
||||
## Operator List
|
||||
|
||||
- regex
|
||||
- eq
|
||||
- ne
|
||||
- eqnum
|
||||
- neqnum
|
||||
- filter
|
||||
- eqtrue
|
||||
- eqfalse
|
||||
- netrue
|
||||
- nefalse
|
||||
- in:
|
||||
- innum
|
||||
- nin
|
||||
- ninnum
|
||||
- lt
|
||||
- lte
|
||||
- gt
|
||||
- gte
|
||||
- null
|
||||
- nnull
|
||||
- exists
|
||||
- nexists
|
||||
Each `orFilter` call groups its arguments with OR between them. Multiple `orFilter` / `filter` calls are AND-ed together.
|
||||
|
||||
## Example
|
||||
### Cross-Schema (Children) Filters
|
||||
|
||||
Get 10 posts from the sports category as a tree
|
||||
You can filter records by properties of their related records using the `children.` prefix:
|
||||
|
||||
```php
|
||||
$query->filter([
|
||||
"schema" => "blogPosts",
|
||||
"children.categories.data.slug" => "sports",
|
||||
]);
|
||||
```
|
||||
|
||||
This returns `blogPosts` that have a child in `categories` where `slug` equals `sports`.
|
||||
|
||||
|
||||
## Nested Data Fields
|
||||
|
||||
Use dot notation to filter on JSON data fields and system fields:
|
||||
|
||||
```php
|
||||
// Filter on a data field
|
||||
$query->filter(["data.status_eq" => "draft"]);
|
||||
|
||||
// Filter on a system field
|
||||
$query->filter(["_sys.updatedAt_gte" => "2024-01-01"]);
|
||||
```
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
**Get published blog posts, newest first:**
|
||||
|
||||
```php
|
||||
$posts = $query
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->onlyPublished()
|
||||
->sort("-_sys.updatedAt")
|
||||
->limit(10)
|
||||
->tree();
|
||||
```
|
||||
|
||||
**Get posts from a specific category with children loaded:**
|
||||
|
||||
```php
|
||||
$posts = $query
|
||||
->filter([
|
||||
"schema" => "posts",
|
||||
"schema" => "blogPosts",
|
||||
"children.categories.data.slug" => "sports",
|
||||
]
|
||||
)
|
||||
])
|
||||
->childrenDepth(1)
|
||||
->childrenFields(["categories"])
|
||||
->limit(10)
|
||||
->tree();
|
||||
|
||||
$posts->map(...)->toArray();
|
||||
|
||||
```
|
||||
|
||||
**Paginate records:**
|
||||
|
||||
```php
|
||||
$graph = $query
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->limit(20)
|
||||
->skip(40)
|
||||
->runWithCount();
|
||||
|
||||
$posts = $graph->tree();
|
||||
$total = $graph->total;
|
||||
```
|
||||
|
||||
**Search across fields:**
|
||||
|
||||
```php
|
||||
$results = $query
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->orFilter(["title_regex" => $term, "slug_regex" => $term])
|
||||
->limit(10)
|
||||
->tree();
|
||||
```
|
||||
+74
-41
@@ -5,76 +5,106 @@ include_toc: true
|
||||
|
||||
# Schemas
|
||||
|
||||
Schemas define both the shape of your data and how the UI on the admin will behave.
|
||||
Schemas define both the shape of your data and how the admin UI behaves.
|
||||
|
||||
There are 3 types of schemas
|
||||
There are 2 types of schemas:
|
||||
|
||||
- Collections: Normal data
|
||||
- Files: Images and files
|
||||
- Block: Used in the block editor
|
||||
- **collection** — Regular data records
|
||||
- **files** — Images and file uploads
|
||||
|
||||
|
||||
## Collection Reference
|
||||
|
||||
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
|
||||
- **label**: The friendly name of the schema
|
||||
- **type**: The type of the collection. Should be "collection"
|
||||
- **visible**: An array of field id to show on the content browser _optional_
|
||||
- **groups**: A list if group ids to separate your field in different tabs _optional_
|
||||
- **fields**: The list of your fields. Look the field reference for more
|
||||
- **isEntry**: If this schema is important, it will show be visible on the main the sidebar. Default: false _optional_
|
||||
- **sortBy**: The default sorting in the content browser _optional_
|
||||
- **titleTemplate**: Mustache code to customize the preview field _optional_
|
||||
- **revisions**: How many revisions are going to be kept for each record _optional_
|
||||
- **read**: Array of user groups that have read permissions _optional_
|
||||
- **write**: Array of user groups that have write permissions _optional_
|
||||
| Field | Required | Description |
|
||||
|---|---|---|
|
||||
| `name` | yes | Unique ID. Use camelCase plural e.g. `blogPosts` |
|
||||
| `label` | yes | Friendly display name |
|
||||
| `type` | yes | Must be `"collection"` |
|
||||
| `fields` | yes | Array of field definitions. See [Fields](Fields.md) |
|
||||
| `visible` | no | Field IDs to show in the content browser list |
|
||||
| `groups` | no | Group IDs to split fields into tabs |
|
||||
| `isEntry` | no | Show in sidebar. Default: `false` |
|
||||
| `sortBy` | no | Default sort in browser. Prefix with `-` for descending e.g. `-_sys.updatedAt` |
|
||||
| `cardTitle` | no | Mustache template for the record preview title e.g. `{{name}} - {{slug}}` |
|
||||
| `cardImage` | no | Field name to use as the preview image |
|
||||
| `revisions` | no | Number of revisions to keep per record. Default: `0` (disabled) |
|
||||
| `read` | no | Roles with read access. Empty means all roles can read |
|
||||
| `write` | no | Roles with write access. Empty means all roles can write |
|
||||
|
||||
|
||||
## Files Reference
|
||||
|
||||
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
|
||||
- **label**: The friendly name of the schema
|
||||
- **type**: The type of the collection. Should be "files"
|
||||
- **path**: The relative directory that these files will be stored.
|
||||
- **groups**: A list if group ids to separate your field in different tabs _optional_
|
||||
- **fields**: The list of your fields. Look the field reference for more
|
||||
- **isEntry**: If this schema is important, it will show be visible on the main the sidebar _optional_
|
||||
- **sortBy**: The default sorting in the content browser _optional_
|
||||
- **titleTemplate**: Mustache code to customize the preview field _optional_
|
||||
- **revisions**: How many revisions are going to be kept for each record _optional_
|
||||
- **read**: Array of user groups that have read permissions _optional_
|
||||
- **write**: Array of user groups that have write permissions _optional_
|
||||
| Field | Required | Description |
|
||||
|---|---|---|
|
||||
| `name` | yes | Unique ID. Use camelCase plural e.g. `heroImages` |
|
||||
| `label` | yes | Friendly display name |
|
||||
| `type` | yes | Must be `"files"` |
|
||||
| `fields` | yes | Array of field definitions. See [Fields](Fields.md) |
|
||||
| `groups` | no | Group IDs to split fields into tabs |
|
||||
| `isEntry` | no | Show in sidebar. Default: `false` |
|
||||
| `sortBy` | no | Default sort in browser |
|
||||
| `cardTitle` | no | Mustache template for the record preview title |
|
||||
| `cardImage` | no | Field name to use as the preview image |
|
||||
| `revisions` | no | Number of revisions to keep per record |
|
||||
| `read` | no | Roles with read access |
|
||||
| `write` | no | Roles with write access |
|
||||
|
||||
### File Metadata
|
||||
|
||||
Every uploaded file is automatically stored with the following metadata (stored in `lucent_files`):
|
||||
|
||||
| Field | Description |
|
||||
|---|---|
|
||||
| `id` | Unique file ID |
|
||||
| `recordId` | ID of the record this file belongs to |
|
||||
| `originalName` | Original filename as uploaded |
|
||||
| `mime` | MIME type e.g. `image/webp` |
|
||||
| `path` | Storage path e.g. `files/{recordId}/{filename}` |
|
||||
| `size` | File size in bytes |
|
||||
| `width` | Image width in pixels (0 for non-images) |
|
||||
| `height` | Image height in pixels (0 for non-images) |
|
||||
| `checksum` | SHA-1 hash of the file contents |
|
||||
|
||||
Image files (jpeg, png, webp, gif, tiff) also get a 300×300 thumbnail generated automatically at `thumbs/{path}`, plus any image filter presets configured in `lucent.imageFilters`.
|
||||
|
||||
|
||||
## Block Reference
|
||||
## System Fields
|
||||
|
||||
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
|
||||
- **label**: The friendly name of the schema
|
||||
- **type**: The type of the collection. Should be "block"
|
||||
- **fields**: The list of your fields. Look the field reference for more
|
||||
Every record automatically has these read-only system fields available in queries:
|
||||
|
||||
| Field | Description |
|
||||
|---|---|
|
||||
| `_sys.createdAt` | ISO 8601 creation timestamp |
|
||||
| `_sys.updatedAt` | ISO 8601 last update timestamp |
|
||||
| `_sys.createdBy` | User ID who created the record |
|
||||
| `_sys.updatedBy` | User ID who last updated the record |
|
||||
| `_sys.version` | Revision version number |
|
||||
| `status` | `draft` or `published` |
|
||||
|
||||
|
||||
A full Collection example without the fields:
|
||||
## Example
|
||||
|
||||
```json
|
||||
{
|
||||
"label": "Departments",
|
||||
"name": "departments",
|
||||
"schemas": [
|
||||
{
|
||||
"label": "Blog Posts",
|
||||
"name": "blogPosts",
|
||||
"isEntry": true,
|
||||
"type": "collection",
|
||||
"visible": [
|
||||
"title",
|
||||
"slug",
|
||||
"cover",
|
||||
"_sys.updatedAt",
|
||||
"status"
|
||||
],
|
||||
"groups": [
|
||||
"Extra Info",
|
||||
"Metadata",
|
||||
"Content",
|
||||
"SEO"
|
||||
],
|
||||
"sortBy": "-_sys.createdAt",
|
||||
"titleTemplate": "{{name}} {{slug}}",
|
||||
"cardTitle": "{{title}}",
|
||||
"cardImage": "cover",
|
||||
"revisions": 15,
|
||||
"read": [
|
||||
"admin",
|
||||
@@ -86,5 +116,8 @@ A full Collection example without the fields:
|
||||
"editors"
|
||||
],
|
||||
"fields": []
|
||||
}
|
||||
],
|
||||
"roles": ["admin", "editors", "reviewers"]
|
||||
}
|
||||
```
|
||||
+82
-23
@@ -5,51 +5,94 @@ To generate the static content of the website, lucent provides a helper class.
|
||||
|
||||
## Laravel Command
|
||||
|
||||
Just create a command and name it as you like. Make sure to inject the StaticGenerator class.
|
||||
Create an Artisan command and inject `StaticGenerator`:
|
||||
|
||||
```php
|
||||
public function __construct(
|
||||
class GenerateStatic extends Command
|
||||
{
|
||||
protected $signature = 'generate:static';
|
||||
|
||||
public function __construct(
|
||||
public StaticGenerator $staticGenerator,
|
||||
) {
|
||||
public Context $ctx,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$this->staticGenerator->run('generate:static', function ($writer) {
|
||||
$writer->save("/", $this->ctx->render("homepage"));
|
||||
$writer->save("/about", $this->ctx->render("about"));
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Redirect command
|
||||
`run(string $signature, callable $callback)` — the first argument must match the command's artisan signature. This is used to stream live build logs in the Lucent UI. The callback receives a `Writer` instance.
|
||||
|
||||
There are cases which is useful to create a redirect like when you have a multilingual website:
|
||||
|
||||
## Writer: save
|
||||
|
||||
Writes an HTML file at the given path:
|
||||
|
||||
```php
|
||||
$this->staticGenerator->run(function ($writer) {
|
||||
$writer->createRedirect("/", "/el");
|
||||
});
|
||||
$writer->save("/blog/my-post", $html);
|
||||
// writes to: storage/lucent/build/blog/my-post/index.html
|
||||
```
|
||||
|
||||
## The Writer save command
|
||||
An optional third argument changes the file extension (default `"html"`).
|
||||
|
||||
In order to create an html file, you have to use the writer's save command
|
||||
|
||||
The first argument is the url and the second is the rendered HTML. That's where the page classes do come handy.
|
||||
## Writer: createRedirect
|
||||
|
||||
Generates an HTML meta-refresh redirect. Useful for root-level locale redirects:
|
||||
|
||||
```php
|
||||
$this->staticGenerator->run(function ($writer) {
|
||||
$writer->save("/", $this->ctx->render("homepage"));
|
||||
$writer->save("/about", $this->ctx->render("about"));
|
||||
});
|
||||
$writer->createRedirect("/", "/el");
|
||||
$writer->createRedirect("/", "/el", "Redirecting", "Please wait...");
|
||||
```
|
||||
|
||||
Arguments: `from`, `to`, `title` (default `"Redirecting"`), `message` (default `"Redirecting Soon..."`).
|
||||
|
||||
|
||||
## Writer: recordIterator
|
||||
|
||||
Iterates over all records in paginated batches — useful when there are too many records to load at once:
|
||||
|
||||
```php
|
||||
$writer->recordIterator(
|
||||
query: fn(int $limit, int $skip) => $query
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->onlyPublished()
|
||||
->limit($limit)
|
||||
->skip($skip)
|
||||
->tree(),
|
||||
parser: function ($records) use ($writer) {
|
||||
foreach ($records as $record) {
|
||||
$writer->save(
|
||||
"/blog/" . $record->data->slug,
|
||||
$this->ctx->render("blogPost", $record),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
Signature: `recordIterator(callable $query, callable $parser, int $skip = 0, int $limit = 100): int`
|
||||
|
||||
The `$query` callable receives `($limit, $skip)` and must return a collection. Iteration stops automatically when a batch returns zero records.
|
||||
|
||||
|
||||
## Storage and Permissions
|
||||
|
||||
All the generated html is stored on `storage/lucent/live`
|
||||
In order to make it accessible you have to create symlink:
|
||||
All generated HTML is written to `storage/lucent/build` during the run, then atomically swapped to `storage/lucent/live` on completion. Create the public symlink with:
|
||||
|
||||
```bash
|
||||
php artisan lucent:livelink
|
||||
```
|
||||
|
||||
Now your static website is accessible in http://localhost:8000/live
|
||||
|
||||
But it would not be nice to have the **live** prefix everywhere. That's why you need to make the following tweak in the nginx vhost
|
||||
The static site is then accessible at `http://localhost:8000/live`. To serve it without the `/live` prefix, add this to your nginx vhost:
|
||||
|
||||
```nginxconf
|
||||
location / {
|
||||
@@ -57,14 +100,30 @@ location / {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Artisan Commands
|
||||
|
||||
| Command | Description |
|
||||
|---|---|
|
||||
| `lucent:setup-db` | Create all Lucent database tables |
|
||||
| `lucent:schemas` | Compile schema JSON files |
|
||||
| `lucent:livelink` | Create the `public/live` symlink |
|
||||
| `lucent:rebuild:thumbnails` | Regenerate thumbnails for all uploaded images |
|
||||
| `lucent:removeOrphanEdges` | Remove edges pointing to deleted records |
|
||||
| `lucent:generate:collection {name}` | Scaffold a new collection schema JSON file |
|
||||
|
||||
|
||||
## Build from the Lucent UI
|
||||
|
||||
In your lucent.php config file you can define your command that is used to generate the static files:
|
||||
Register your generate command in `config/lucent.php` so admin users can trigger it from the UI:
|
||||
|
||||
```php
|
||||
"generateCommand" => "generate:static"
|
||||
"commands" => [
|
||||
"generate:static" => "Generate Static Site",
|
||||
],
|
||||
```
|
||||
That way, the users will be able to initiate the build command through the user interface.
|
||||
|
||||
Only roles listed in `canBuild` can trigger commands from the UI.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -99,3 +99,113 @@ class Context
|
||||
```
|
||||
|
||||
Add the middleware inside the HTTP Kernel file.
|
||||
|
||||
## Configuration
|
||||
|
||||
After publishing the config (`php artisan vendor:publish --tag=lucent-config`), configure `config/lucent.php` via `.env`:
|
||||
|
||||
| Key | Env var | Default | Description |
|
||||
|---|---|---|---|
|
||||
| `env` | `LUCENT_ENV` | `production` | `production` or `development` |
|
||||
| `auth` | `LUCENT_AUTH` | `lucent` | Auth driver: `lucent` or `lunar` |
|
||||
| `disk` | `LUCENT_DISK` | `public` | Laravel filesystem disk for uploads |
|
||||
| `schemas_path` | `LUCENT_SCHEMAS_PATH` | `resources/lucent/schemas` | Where schema JSON files live |
|
||||
| `database` | `LUCENT_DB_CONNECTION` | `DB_CONNECTION` | Database connection name |
|
||||
| `name` | `LUCENT_NAME` | `Lucent` | CMS display name |
|
||||
| `url` | `LUCENT_URL` | `APP_URL` | Base URL of the CMS |
|
||||
| `previewTarget` | `LUCENT_PREVIEW_TARGET` | `previewTarget` | Preview route parameter |
|
||||
| `commands` | — | `[]` | Artisan commands exposed to admin users (see [Static Generator](Static%20Generator.md)) |
|
||||
| `imageFilters` | — | `[]` | Image filter presets applied to uploads (see below) |
|
||||
| `canInvite` | — | `["admin"]` | Roles that can invite new users |
|
||||
| `canBuild` | — | `["admin"]` | Roles that can trigger static builds |
|
||||
| `systemUserId` | — | `""` | User ID used for console-initiated record writes |
|
||||
|
||||
|
||||
## Image Filters
|
||||
|
||||
Image filters are Intervention Image filter classes applied to every uploaded image, producing additional versions (e.g. a cropped or watermarked variant). Each preset is stored at `templates/{name}/{original-path}` on the configured disk.
|
||||
|
||||
Define filters in `config/lucent.php`:
|
||||
|
||||
```php
|
||||
"imageFilters" => [
|
||||
"hero" => \App\ImageFilters\HeroFilter::class,
|
||||
"thumb" => \App\ImageFilters\ThumbFilter::class,
|
||||
],
|
||||
```
|
||||
|
||||
A filter class must implement `Intervention\Image\Filters\FilterInterface`:
|
||||
|
||||
```php
|
||||
namespace App\ImageFilters;
|
||||
|
||||
use Intervention\Image\Filters\FilterInterface;
|
||||
use Intervention\Image\Image;
|
||||
|
||||
class HeroFilter implements FilterInterface
|
||||
{
|
||||
public function applyFilter(Image $image): Image
|
||||
{
|
||||
return $image->fit(1200, 600)->encode('webp', 80);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Every uploaded image automatically gets a 300×300 WebP thumbnail at `thumbs/{path}` in addition to any configured presets.
|
||||
|
||||
|
||||
## Authentication
|
||||
|
||||
Lucent uses **email-link (magic link) login** — no passwords. Users receive a time-limited link by email.
|
||||
|
||||
### Auth modes
|
||||
|
||||
Set `LUCENT_AUTH` to choose how users are stored:
|
||||
|
||||
| Value | Description |
|
||||
|---|---|
|
||||
| `lucent` | Users stored in the `lucent_users` table. Supports roles. |
|
||||
| `lunar` | Delegates to Lunar's `lunar_staff` table. Roles not supported. |
|
||||
|
||||
### Login flow
|
||||
|
||||
1. User submits their email at `/lucent/login`
|
||||
2. A 32-character token is stored against the user with a timestamp
|
||||
3. Lucent emails a login link containing the token
|
||||
4. User clicks the link → token is validated (must be used within **1 hour**)
|
||||
5. Session is established; token is cleared
|
||||
|
||||
### First-time setup
|
||||
|
||||
The `/lucent/register` route is only available when **no users exist** in the system. Once the first admin registers, the route returns a redirect to `/lucent/login`. Registration automatically assigns the `admin` role and sends a login link.
|
||||
|
||||
### Middleware
|
||||
|
||||
Two middleware aliases are available for your routes:
|
||||
|
||||
| Alias | Description |
|
||||
|---|---|
|
||||
| `lucent.auth` | Requires an active Lucent session |
|
||||
| `lucent.guest` | Redirects authenticated users away |
|
||||
|
||||
### Roles
|
||||
|
||||
Roles are defined in your channel config. Only roles listed there are valid — anything else is silently stripped on assignment. The `canInvite` and `canBuild` config keys control which roles can invite users and trigger builds respectively.
|
||||
|
||||
On console commands and non-`/lucent` routes, `currentUserId()` returns `config("lucent.systemUserId")` instead of the session user.
|
||||
|
||||
|
||||
## Database Tables
|
||||
|
||||
All Lucent-managed tables use the `lucent_` prefix:
|
||||
|
||||
| Table | Description |
|
||||
|---|---|
|
||||
| `lucent_records` | All collection and file schema records |
|
||||
| `lucent_files` | Uploaded file metadata |
|
||||
| `lucent_edges` | Relationships between records |
|
||||
| `lucent_revisions` | Record revision history |
|
||||
| `lucent_users` | Users (when using `lucent` auth mode) |
|
||||
| `lucent_command_logs` | Background command execution logs |
|
||||
|
||||
These are created automatically by running `php artisan lucent:setup`.
|
||||
Vendored
-198
@@ -1,198 +0,0 @@
|
||||
var nX=Object.defineProperty;var oX=(o,e,n)=>e in o?nX(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n;var cU=(o,e,n)=>(oX(o,typeof e!="symbol"?e+"":e,n),n);function bind$1(o,e){return function(){return o.apply(e,arguments)}}const{toString:toString$1}=Object.prototype,{getPrototypeOf}=Object,kindOf=(o=>e=>{const n=toString$1.call(e);return o[n]||(o[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=o=>(o=o.toLowerCase(),e=>kindOf(e)===o),typeOfTest=o=>e=>typeof e===o,{isArray:isArray$2}=Array,isUndefined=typeOfTest("undefined");function isBuffer(o){return o!==null&&!isUndefined(o)&&o.constructor!==null&&!isUndefined(o.constructor)&&isFunction$1(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(o){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(o):e=o&&o.buffer&&isArrayBuffer(o.buffer),e}const isString$1=typeOfTest("string"),isFunction$1=typeOfTest("function"),isNumber$1=typeOfTest("number"),isObject$1=o=>o!==null&&typeof o=="object",isBoolean$1=o=>o===!0||o===!1,isPlainObject=o=>{if(kindOf(o)!=="object")return!1;const e=getPrototypeOf(o);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in o)&&!(Symbol.iterator in o)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=o=>isObject$1(o)&&isFunction$1(o.pipe),isFormData=o=>{let e;return o&&(typeof FormData=="function"&&o instanceof FormData||isFunction$1(o.append)&&((e=kindOf(o))==="formdata"||e==="object"&&isFunction$1(o.toString)&&o.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(o,e,{allOwnKeys:n=!1}={}){if(o===null||typeof o>"u")return;let r,c;if(typeof o!="object"&&(o=[o]),isArray$2(o))for(r=0,c=o.length;r<c;r++)e.call(null,o[r],r,o);else{const u=n?Object.getOwnPropertyNames(o):Object.keys(o),h=u.length;let p;for(r=0;r<h;r++)p=u[r],e.call(null,o[p],p,o)}}function findKey$1(o,e){e=e.toLowerCase();const n=Object.keys(o);let r=n.length,c;for(;r-- >0;)if(c=n[r],e===c.toLowerCase())return c;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,isContextDefined=o=>!isUndefined(o)&&o!==_global;function merge(){const{caseless:o}=isContextDefined(this)&&this||{},e={},n=(r,c)=>{const u=o&&findKey$1(e,c)||c;isPlainObject(e[u])&&isPlainObject(r)?e[u]=merge(e[u],r):isPlainObject(r)?e[u]=merge({},r):isArray$2(r)?e[u]=r.slice():e[u]=r};for(let r=0,c=arguments.length;r<c;r++)arguments[r]&&forEach(arguments[r],n);return e}const extend$2=(o,e,n,{allOwnKeys:r}={})=>(forEach(e,(c,u)=>{n&&isFunction$1(c)?o[u]=bind$1(c,n):o[u]=c},{allOwnKeys:r}),o),stripBOM=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),inherits=(o,e,n,r)=>{o.prototype=Object.create(e.prototype,r),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:e.prototype}),n&&Object.assign(o.prototype,n)},toFlatObject=(o,e,n,r)=>{let c,u,h;const p={};if(e=e||{},o==null)return e;do{for(c=Object.getOwnPropertyNames(o),u=c.length;u-- >0;)h=c[u],(!r||r(h,o,e))&&!p[h]&&(e[h]=o[h],p[h]=!0);o=n!==!1&&getPrototypeOf(o)}while(o&&(!n||n(o,e))&&o!==Object.prototype);return e},endsWith=(o,e,n)=>{o=String(o),(n===void 0||n>o.length)&&(n=o.length),n-=e.length;const r=o.indexOf(e,n);return r!==-1&&r===n},toArray=o=>{if(!o)return null;if(isArray$2(o))return o;let e=o.length;if(!isNumber$1(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=o[e];return n},isTypedArray=(o=>e=>o&&e instanceof o)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(o,e)=>{const r=(o&&o[Symbol.iterator]).call(o);let c;for(;(c=r.next())&&!c.done;){const u=c.value;e.call(o,u[0],u[1])}},matchAll=(o,e)=>{let n;const r=[];for(;(n=o.exec(e))!==null;)r.push(n);return r},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,c){return r.toUpperCase()+c}),hasOwnProperty=(({hasOwnProperty:o})=>(e,n)=>o.call(e,n))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(o,e)=>{const n=Object.getOwnPropertyDescriptors(o),r={};forEach(n,(c,u)=>{let h;(h=e(c,u,o))!==!1&&(r[u]=h||c)}),Object.defineProperties(o,r)},freezeMethods=o=>{reduceDescriptors(o,(e,n)=>{if(isFunction$1(o)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=o[n];if(isFunction$1(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},toObjectSet=(o,e)=>{const n={},r=c=>{c.forEach(u=>{n[u]=!0})};return isArray$2(o)?r(o):r(String(o).split(e)),n},noop$1=()=>{},toFiniteNumber=(o,e)=>o!=null&&Number.isFinite(o=+o)?o:e,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789"Line truncated
|
||||
`).forEach(function(h){c=h.indexOf(":"),n=h.substring(0,c).trim().toLowerCase(),r=h.substring(c+1).trim(),!(!n||e[n]&&ignoreDuplicateOf[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},$internals=Symbol("internals");function normalizeHeader(o){return o&&String(o).trim().toLowerCase()}function normalizeValue(o){return o===!1||o==null?o:utils$1.isArray(o)?o.map(normalizeValue):String(o)}function parseTokens(o){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(o);)e[r[1]]=r[2];return e}const isValidHeaderName=o=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());function matchHeaderValue(o,e,n,r,c){if(utils$1.isFunction(r))return r.call(this,e,n);if(c&&(e=n),!!utils$1.isString(e)){if(utils$1.isString(r))return e.indexOf(r)!==-1;if(utils$1.isRegExp(r))return r.test(e)}}function formatHeader(o){return o.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function buildAccessors(o,e){const n=utils$1.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(o,r+n,{value:function(c,u,h){return this[r].call(this,e,c,u,h)},configurable:!0})})}class AxiosHeaders{constructor(e){e&&this.set(e)}set(e,n,r){const c=this;function u(p,b,y){const k=normalizeHeader(b);if(!k)throw new Error("header name must be a non-empty string");const A=utils$1.findKey(c,k);(!A||c[A]===void 0||y===!0||y===void 0&&c[A]!==!1)&&(c[A||b]=normalizeValue(p))}const h=(p,b)=>utils$1.forEach(p,(y,k)=>u(y,k,b));if(utils$1.isPlainObject(e)||e instanceof this.constructor)h(e,n);else if(utils$1.isString(e)&&(e=e.trim())&&!isValidHeaderName(e))h(parseHeaders(e),n);else if(utils$1.isHeaders(e))for(const[p,b]of e.entries())u(b,p,r);else e!=null&&u(n,e,r);return this}get(e,n){if(e=normalizeHeader(e),e){const r=utils$1.findKey(this,e);if(r){const c=this[r];if(!n)return c;if(n===!0)return parseTokens(c);if(utils$1.isFunction(n))return n.call(this,c,r);if(utils$1.isRegExp(n))return n.exec(c);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=normalizeHeader(e),e){const r=utils$1.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||matchHeaderValue(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let c=!1;function u(h){if(h=normalizeHeader(h),h){const p=utils$1.findKey(r,h);p&&(!n||matchHeaderValue(r,r[p],p,n))&&(delete r[p],c=!0)}}return utils$1.isArray(e)?e.forEach(u):u(e),c}clear(e){const n=Object.keys(this);let r=n.length,c=!1;for(;r--;){const u=n[r];(!e||matchHeaderValue(this,this[u],u,e,!0))&&(delete this[u],c=!0)}return c}normalize(e){const n=this,r={};return utils$1.forEach(this,(c,u)=>{const h=utils$1.findKey(r,u);if(h){n[h]=normalizeValue(c),delete n[u];return}const p=e?formatHeader(u):String(u).trim();p!==u&&delete n[u],n[p]=normalizeValue(c),r[p]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return utils$1.forEach(this,(r,c)=>{r!=null&&r!==!1&&(n[c]=e&&utils$1.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
||||
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(c=>r.set(c)),r}static accessor(e){const r=(this[$internals]=this[$internals]={accessors:{}}).accessors,c=this.prototype;function u(h){const p=normalizeHeader(h);r[p]||(buildAccessors(c,h),r[p]=!0)}return utils$1.isArray(e)?e.forEach(u):u(e),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$1.reduceDescriptors(AxiosHeaders.prototype,({value:o},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>o,set(r){this[n]=r}}});utils$1.freezeMethods(AxiosHeaders);function transformData(o,e){const n=this||defaults$4,r=e||n,c=AxiosHeaders.from(r.headers);let u=r.data;return utils$1.forEach(o,function(p){u=p.call(n,u,c.normalize(),e?e.status:void 0)}),c.normalize(),u}function isCancel(o){return!!(o&&o.__CANCEL__)}function CanceledError(o,e,n){AxiosError.call(this,o??"canceled",AxiosError.ERR_CANCELED,e,n),this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(o,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?o(n):e(new AxiosError("Request failed with status code "+n.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function parseProtocol(o){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return e&&e[1]||""}function speedometer(o,e){o=o||10;const n=new Array(o),r=new Array(o);let c=0,u=0,h;return e=e!==void 0?e:1e3,function(b){const y=Date.now(),k=r[u];h||(h=y),n[c]=b,r[c]=y;let A=u,R=0;for(;A!==c;)R+=n[A++],A=A%o;if(c=(c+1)%o,c===u&&(u=(u+1)%o),y-h<e)return;const N=k&&y-k;return N?Math.round(R*1e3/N):void 0}}function throttle$1(o,e){let n=0,r=1e3/e,c,u;const h=(y,k=Date.now())=>{n=k,c=null,u&&(clearTimeout(u),u=null),o.apply(null,y)};return[(...y)=>{const k=Date.now(),A=k-n;A>=r?h(y,k):(c=y,u||(u=setTimeout(()=>{u=null,h(c)},r-A)))},()=>c&&h(c)]}const progressEventReducer=(o,e,n=3)=>{let r=0;const c=speedometer(50,250);return throttle$1(u=>{const h=u.loaded,p=u.lengthComputable?u.total:void 0,b=h-r,y=c(b),k=h<=p;r=h;const A={loaded:h,total:p,progress:p?h/p:void 0,bytes:b,rate:y||void 0,estimated:y&&p&&k?(p-h)/y:void 0,event:u,lengthComputable:p!=null,[e?"download":"upload"]:!0};o(A)},n)},progressEventDecorator=(o,e)=>{const n=o!=null;return[r=>e[0]({lengthComputable:n,total:o,loaded:r}),e[1]]},asyncDecorator=o=>(...e)=>utils$1.asap(()=>o(...e)),isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function c(u){let h=u;return e&&(n.setAttribute("href",h),h=n.href),n.setAttribute("href",h),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=c(window.location.href),function(h){const p=utils$1.isString(h)?c(h):h;return p.protocol===r.protocol&&p.host===r.host}}():function(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(o,e,n,r,c,u){const h=[o+"="+encodeURIComponent(e)];utils$1.isNumber(n)&&h.push("expires="+new Date(n).toGMTString()),utils$1.isString(r)&&h.push("path="+r),utils$1.isString(c)&&h.push("domain="+c),u===!0&&h.push("secure"),document.cookie=h.join("; ")},read(o){const e=document.cookie.match(new RegExp("(^|;\\s*)("+o+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(o){this.write(o,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function combineURLs(o,e){return e?o.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):o}function buildFullPath(o,e){return o&&!isAbsoluteURL(e)?combineURLs(o,e):e}const headersToObject=o=>o instanceof AxiosHeaders?{...o}:o;function mergeConfig(o,e){e=e||{};const n={};function r(y,k,A){return utils$1.isPlainObject(y)&&utils$1.isPlainObject(k)?utils$1.merge.call({caseless:A},y,k):utils$1.isPlainObject(k)?utils$1.merge({},k):utils$1.isArray(k)?k.slice():k}function c(y,k,A){if(utils$1.isUndefined(k)){if(!utils$1.isUndefined(y))return r(void 0,y,A)}else return r(y,k,A)}function u(y,k){if(!utils$1.isUndefined(k))return r(void 0,k)}function h(y,k){if(utils$1.isUndefined(k)){if(!utils$1.isUndefined(y))return r(void 0,y)}else return r(void 0,k)}function p(y,k,A){if(A in e)return r(y,k);if(A in o)return r(void 0,y)}const b={url:u,method:u,data:u,baseURL:h,transformRequest:h,transformResponse:h,paramsSerializer:h,timeout:h,timeoutMessage:h,withCredentials:h,withXSRFToken:h,adapter:h,responseType:h,xsrfCookieName:h,xsrfHeaderName:h,onUploadProgress:h,onDownloadProgress:h,decompress:h,maxContentLength:h,maxBodyLength:h,beforeRedirect:h,transport:h,httpAgent:h,httpsAgent:h,cancelToken:h,socketPath:h,responseEncoding:h,v
Line truncated
|
||||
`+u.map(renderReason).join(`
|
||||
`):" "+renderReason(u[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+h,"ERR_NOT_SUPPORT")}return r},adapters:knownAdapters};function throwIfCancellationRequested(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new CanceledError(null,o)}function dispatchRequest(o){return throwIfCancellationRequested(o),o.headers=AxiosHeaders.from(o.headers),o.data=transformData.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(o.adapter||defaults$4.adapter)(o).then(function(r){return throwIfCancellationRequested(o),r.data=transformData.call(o,o.transformResponse,r),r.headers=AxiosHeaders.from(r.headers),r},function(r){return isCancel(r)||(throwIfCancellationRequested(o),r&&r.response&&(r.response.data=transformData.call(o,o.transformResponse,r.response),r.response.headers=AxiosHeaders.from(r.response.headers))),Promise.reject(r)})}const VERSION="1.7.4",validators$1={};["object","boolean","number","function","string","symbol"].forEach((o,e)=>{validators$1[o]=function(r){return typeof r===o||"a"+(e<1?"n ":" ")+o}});const deprecatedWarnings={};validators$1.transitional=function(e,n,r){function c(u,h){return"[Axios v"+VERSION+"] Transitional option '"+u+"'"+h+(r?". "+r:"")}return(u,h,p)=>{if(e===!1)throw new AxiosError(c(h," has been removed"+(n?" in "+n:"")),AxiosError.ERR_DEPRECATED);return n&&!deprecatedWarnings[h]&&(deprecatedWarnings[h]=!0,console.warn(c(h," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(u,h,p):!0}};function assertOptions(o,e,n){if(typeof o!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const r=Object.keys(o);let c=r.length;for(;c-- >0;){const u=r[c],h=e[u];if(h){const p=o[u],b=p===void 0||h(p,u,o);if(b!==!0)throw new AxiosError("option "+u+" must be "+b,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new AxiosError("Unknown option "+u,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(e){this.defaults=e,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let c;Error.captureStackTrace?Error.captureStackTrace(c={}):c=new Error;const u=c.stack?c.stack.replace(/^.+\n/,""):"";try{r.stack?u&&!String(r.stack).endsWith(u.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
||||
`+u):r.stack=u}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=mergeConfig(this.defaults,n);const{transitional:r,paramsSerializer:c,headers:u}=n;r!==void 0&&validator.assertOptions(r,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),c!=null&&(utils$1.isFunction(c)?n.paramsSerializer={serialize:c}:validator.assertOptions(c,{encode:validators.function,serialize:validators.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let h=u&&utils$1.merge(u.common,u[n.method]);u&&utils$1.forEach(["delete","get","head","post","put","patch","common"],F=>{delete u[F]}),n.headers=AxiosHeaders.concat(h,u);const p=[];let b=!0;this.interceptors.request.forEach(function(V){typeof V.runWhen=="function"&&V.runWhen(n)===!1||(b=b&&V.synchronous,p.unshift(V.fulfilled,V.rejected))});const y=[];this.interceptors.response.forEach(function(V){y.push(V.fulfilled,V.rejected)});let k,A=0,R;if(!b){const F=[dispatchRequest.bind(this),void 0];for(F.unshift.apply(F,p),F.push.apply(F,y),R=F.length,k=Promise.resolve(n);A<R;)k=k.then(F[A++],F[A++]);return k}R=p.length;let N=n;for(A=0;A<R;){const F=p[A++],V=p[A++];try{N=F(N)}catch(W){V.call(this,W);break}}try{k=dispatchRequest.call(this,N)}catch(F){return Promise.reject(F)}for(A=0,R=y.length;A<R;)k=k.then(y[A++],y[A++]);return k}getUri(e){e=mergeConfig(this.defaults,e);const n=buildFullPath(e.baseURL,e.url);return buildURL(n,e.params,e.paramsSerializer)}}utils$1.forEach(["delete","get","head","options"],function(e){Axios.prototype[e]=function(n,r){return this.request(mergeConfig(r||{},{method:e,url:n,data:(r||{}).data}))}});utils$1.forEach(["post","put","patch"],function(e){function n(r){return function(u,h,p){return this.request(mergeConfig(p||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:u,data:h}))}}Axios.prototype[e]=n(),Axios.prototype[e+"Form"]=n(!0)});class CancelToken{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(u){n=u});const r=this;this.promise.then(c=>{if(!r._listeners)return;let u=r._listeners.length;for(;u-- >0;)r._listeners[u](c);r._listeners=null}),this.promise.then=c=>{let u;const h=new Promise(p=>{r.subscribe(p),u=p}).then(c);return h.cancel=function(){r.unsubscribe(u)},h},e(function(u,h,p){r.reason||(r.reason=new CanceledError(u,h,p),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new CancelToken(function(c){e=c}),cancel:e}}}function spread(o){return function(n){return o.apply(null,n)}}function isAxiosError(o){return utils$1.isObject(o)&&o.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([o,e])=>{HttpStatusCode[e]=o});function createInstance(o){const e=new Axios(o),n=bind$1(Axios.prototype.request,e);return utils$1.extend(n,Axios.prototype,e,{allOwnKeys:!0}),utils$1.extend(n,e,null,{allOwnKeys:!0}),n.create=function(c){return createInstance(mergeConfig(o,c))},n}const axios$1=createInstance(defaults$4);axios$1.Axios=Axios;axios$1.CanceledError=CanceledError;axios$1.CancelToken=CancelToken;axios$1.isCancel=isCancel;axios$1.VERSION=VERSION;axios$1.toFormData=toFormData;axios$1.AxiosError=AxiosError;axios$1.Cancel=axios$1.CanceledError;axios$1.all=function(e){return Promise.all(e)};axios$1.spread=spread;axios$1.isAxiosError=isAxiosError;axios$1.mergeConfig=mergeConfig;axios$1.AxiosHeaders=AxiosHeaders;axi
Line truncated
|
||||
`;for(let W=0;W<=1;W+=b){const J=e+(n-e)*u(W);y+=W*100+`%{${h(J,1-J)}}
|
||||
`}const k=y+`100% {${h(n,1-n)}}
|
||||
}`,A=`__svelte_${hash$1(k)}_${p}`,R=get_root_for_style(o),{stylesheet:N,rules:F}=managed_styles.get(R)||create_style_information(R,o);F[A]||(F[A]=!0,N.insertRule(`@keyframes ${A} ${k}`,N.cssRules.length));const V=o.style.animation||"";return o.style.animation=`${V?`${V}, `:""}${A} ${r}ms linear ${c}ms 1 both`,active+=1,A}function delete_rule(o,e){const n=(o.style.animation||"").split(", "),r=n.filter(e?u=>u.indexOf(e)<0:u=>u.indexOf("__svelte")===-1),c=n.length-r.length;c&&(o.style.animation=r.join(", "),active-=c,active||clear_rules())}function clear_rules(){raf(()=>{active||(managed_styles.forEach(o=>{const{ownerNode:e}=o.stylesheet;e&&detach(e)}),managed_styles.clear())})}let current_component;function set_current_component(o){current_component=o}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(o){get_current_component().$$.on_mount.push(o)}function afterUpdate(o){get_current_component().$$.after_update.push(o)}function onDestroy(o){get_current_component().$$.on_destroy.push(o)}function createEventDispatcher(){const o=get_current_component();return(e,n,{cancelable:r=!1}={})=>{const c=o.$$.callbacks[e];if(c){const u=custom_event(e,n,{cancelable:r});return c.slice().forEach(h=>{h.call(o,u)}),!u.defaultPrevented}return!0}}function setContext(o,e){return get_current_component().$$.context.set(o,e),e}function getContext$1(o){return get_current_component().$$.context.get(o)}function bubble(o,e){const n=o.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const dirty_components=[],binding_callbacks=[];let render_callbacks=[];const flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function add_render_callback(o){render_callbacks.push(o)}function add_flush_callback(o){flush_callbacks.push(o)}const seen_callbacks=new Set;let flushidx=0;function flush(){if(flushidx!==0)return;const o=current_component;do{try{for(;flushidx<dirty_components.length;){const e=dirty_components[flushidx];flushidx++,set_current_component(e),update(e.$$)}}catch(e){throw dirty_components.length=0,flushidx=0,e}for(set_current_component(null),dirty_components.length=0,flushidx=0;binding_callbacks.length;)binding_callbacks.pop()();for(let e=0;e<render_callbacks.length;e+=1){const n=render_callbacks[e];seen_callbacks.has(n)||(seen_callbacks.add(n),n())}render_callbacks.length=0}while(dirty_components.length);for(;flush_callbacks.length;)flush_callbacks.pop()();update_scheduled=!1,seen_callbacks.clear(),set_current_component(o)}function update(o){if(o.fragment!==null){o.update(),run_all(o.before_update);const e=o.dirty;o.dirty=[-1],o.fragment&&o.fragment.p(o.ctx,e),o.after_update.forEach(add_render_callback)}}function flush_render_callbacks(o){const e=[],n=[];render_callbacks.forEach(r=>o.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),render_callbacks=e}let promise;function wait(){return promise||(promise=Promise.resolve(),promise.then(()=>{promise=null})),promise}function dispatch(o,e,n){o.dispatchEvent(custom_event(`${e?"intro":"outro"}${n}`))}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){outros.r||run_all(outros.c),outros=outros.p}function transition_in(o,e){o&&o.i&&(outroing.delete(o),o.i(e))}function transition_out(o,e,n,r){if(o&&o.o){if(outroing.has(o))return;outroing.add(o),outros.c.push(()=>{outroing.delete(o),r&&(n&&o.d(1),r())}),o.o(e)}else r&&r()}const null_transition={duration:0};function create_bidirectional_transition(o,e,n,r){let u=e(o,n,{direction:"both"}),h=r?0:1,p=null,b=null,y=null,k;function A(){y&&delete_rule(o,y)}function R(F,V){const W=F.b-h;return V*=Math.abs(W),{a:h,b:F.b,d:W,duration:V,start:F.start,end:F.start+V,group:F.group}}function N(F){const{delay:V=0,duration:W=300,easing:J=identity,tick:te=noop,css:j}=u||null_transition,ae={start:now()+V,b:F};F||(ae.group=outros,outros.r+=1),"inert"in o&&(F?k!==void 0&&(o.inert=k):(k=o.inert,o.inert=!0)),p||b?b=ae:(j&&(A(),y=create_rule(o,h,F,W,V,J,j)),F&&te(0,1),p=R(ae,W),add_render_callback(()=>dispatch(o,F,"start")),loop(fe=>{if(b&&fe>b.start&&(p=R(b,W),b=null,dispatch(o,p.b,"start"),j&&(A(),y=create_rule(o,h,p.b,p.duration,0,J,u.css))),p){if(fe>=p.end)te(h=p.b,1-h),dispatch(o,p.b,"end"),b||(p.b?A():--p.group.r||run_all(p.group.c)),p=null;else if(fe>=p.start){const _e=fe-p.start;h=p.a+p.d*J(_e/p.duration),te(h,1-h)}}return!!(p||b)}))}return{run(F){is_function(u)?wait().then(()=>{u=u({direction:F?"in":"out"}),N(F)}):N(F)},end(){A(),p=b=null}}}function ensure_array_like(o){return(o==null?void 0:o.length)!==void 0?o:Array.from(o)}function destroy_block(o,e){o.d(1),e.delete(o.key)}function outro_and_destroy_block(o,e){transition_out(o,1,1,()=>{e.delete(o.key)})}function update_keyed_each(o,e,n,r,c,u,h,p,b,y,k,A){let R=o.length,N=u.length,F=R;const V={};for(;F--;)V
Line truncated
|
||||
transform: ${y} translate(${(1-V)*A}${R}, ${(1-V)*N}${F});
|
||||
opacity: ${b-k*W}`}}function create_if_block$U(o){let e,n,r,c,u,h,p;return{c(){e=element("div"),n=element("div"),n.textContent="Success",r=space$3(),c=element("div"),u=text(o[1]),attr(n,"class","title"),attr(c,"class","content"),attr(e,"class","notice notice-success"),attr(e,"role","alert")},m(b,y){insert$1(b,e,y),append(e,n),append(e,r),append(e,c),append(c,u),p=!0},p(b,y){(!p||y&2)&&set_data(u,b[1])},i(b){p||(b&&add_render_callback(()=>{p&&(h||(h=create_bidirectional_transition(e,fly,{duration:500},!0)),h.run(1))}),p=!0)},o(b){b&&(h||(h=create_bidirectional_transition(e,fly,{duration:500},!1)),h.run(0)),p=!1},d(b){b&&detach(e),b&&h&&h.end()}}}function create_fragment$1n(o){let e,n=o[0]&&create_if_block$U(o);return{c(){n&&n.c(),e=empty$1()},m(r,c){n&&n.m(r,c),insert$1(r,e,c)},p(r,[c]){r[0]?n?(n.p(r,c),c&1&&transition_in(n,1)):(n=create_if_block$U(r),n.c(),transition_in(n,1),n.m(e.parentNode,e)):n&&(group_outros(),transition_out(n,1,1,()=>{n=null}),check_outros())},i(r){transition_in(n)},o(r){transition_out(n)},d(r){r&&detach(e),n&&n.d(r)}}}function instance$1n(o,e,n){let r,c;function u(h="Saved"){n(1,r=h),n(0,c=!0),setTimeout(function(){n(0,c=!1)},2e3)}return n(1,r="Saved"),n(0,c=!1),[c,r,u]}class SuccessAlert extends SvelteComponent{constructor(e){super(),init(this,e,instance$1n,create_fragment$1n,safe_not_equal,{show:2})}get show(){return this.$$.ctx[2]}}function create_fragment$1m(o){let e,n,r,c,u,h,p,b,y,k,A,R,N,F,V={};return e=new SuccessAlert({props:V}),o[4](e),A=new SpinnerButton({props:{label:"Enter"}}),{c(){create_component(e.$$.fragment),n=space$3(),r=element("div"),c=element("form"),u=element("div"),h=element("h3"),p=text("Login as "),b=text(o[0]),y=space$3(),k=element("div"),create_component(A.$$.fragment),attr(u,"class","mb-3 text-center"),attr(k,"class","text-center mt-5 d-block"),attr(r,"class","wrapper-tiny")},m(W,J){mount_component(e,W,J),insert$1(W,n,J),insert$1(W,r,J),append(r,c),append(c,u),append(u,h),append(h,p),append(h,b),append(c,y),append(c,k),mount_component(A,k,null),R=!0,N||(F=listen(c,"submit",o[2]),N=!0)},p(W,[J]){const te={};e.$set(te),(!R||J&1)&&set_data(b,W[0])},i(W){R||(transition_in(e.$$.fragment,W),transition_in(A.$$.fragment,W),R=!0)},o(W){transition_out(e.$$.fragment,W),transition_out(A.$$.fragment,W),R=!1},d(W){W&&(detach(n),detach(r)),o[4](null),destroy_component(e,W),destroy_component(A),N=!1,F()}}}function instance$1m(o,e,n){const r=getContext$1("channel");let{email:c}=e,{token:u}=e,h;function p(y){y.preventDefault(),axios.post(r.lucentUrl+"/verify",{email:c,token:u}).then(k=>{window.location=r.lucentUrl}).catch(k=>{})}function b(y){binding_callbacks[y?"unshift":"push"](()=>{h=y,n(1,h)})}return o.$$set=y=>{"email"in y&&n(0,c=y.email),"token"in y&&n(3,u=y.token)},[c,h,p,u,b]}class Verify extends SvelteComponent{constructor(e){super(),init(this,e,instance$1m,create_fragment$1m,safe_not_equal,{email:0,token:3})}}function create_fragment$1l(o){let e,n,r;return{c(){e=element("div"),n=element("div"),r=text(o[2]),attr(n,"class","avatar__letters"),attr(e,"class","avatar"),attr(e,"title",o[0]),set_style(e,"background-color",o[3][o[4]]),set_style(e,"height",o[1]+"px"),set_style(e,"width",o[1]+"px"),set_style(e,"font-size",o[1]/2+"px")},m(c,u){insert$1(c,e,u),append(e,n),append(n,r)},p(c,[u]){u&4&&set_data(r,c[2]),u&1&&attr(e,"title",c[0]),u&2&&set_style(e,"height",c[1]+"px"),u&2&&set_style(e,"width",c[1]+"px"),u&2&&set_style(e,"font-size",c[1]/2+"px")},i:noop,o:noop,d(c){c&&detach(e)}}}function instance$1l(o,e,n){let{name:r}=e,{side:c=48}=e;const u=["#00AA55","#009FD4","#B381B3","#939393","#E3BC00","#D47500","#DC2A2A","#3ede91","#377dd4","#0256b0","#053d82","#3d026e","#b378e3","#c4065c","#543208","#d97811","#0c6b40"];let h="";r.split(" ").length>1?h=r.split(" ")[0].charAt(0).toUpperCase()+r.split(" ")[1].charAt(0).toUpperCase():h=r.split(" ")[0].charAt(0).toUpperCase()+r.split(" ")[0].charAt(1).toUpperCase();let b=(r.charCodeAt(1)+r.length)%19;return o.$$set=y=>{"name"in y&&n(0,r=y.name),"side"in y&&n(1,c=y.side)},[r,c,h,u,b]}class Avatar extends SvelteComponent{constructor(e){super(),init(this,e,instance$1l,create_fragment$1l,safe_not_equal,{name:0,side:1})}}function create_fragment$1k(o){let e,n,r,c,u,h,p,b,y,k,A,R,N,F,V,W,J,te,j,ae,fe,_e,ne,Se,Ae,Ne;n=new ErrorAlert({props:{message:o[2]}});let xe={};return c=new SuccessAlert({props:xe}),o[8](c),p=new Avatar({props:{name:o[4].name}}),N=new SpinnerButton({props:{label:"Update Name"}}),j=new SpinnerButton({props:{label:"Update Email"}}),{c(){e=element("div"),create_component(n.$$.fragment),r=space$3(),create_component(c.$$.fragment),u=space$3(),h=element("h3"),create_component(p.$$.fragment),b=space$3(),y=element("form"),k=element("div"),A=element("input"),R=space$3(),create_component(N.$$.fragment),F=space$3(),V=element("form"),W=element("div"),J=element("input"),te=space$3(),create_component(j.$$.fragment),ae=space$3(),fe=element("div"),_e=element("a"),ne=text(`Logout from this
|
||||
device`),attr(h,"class","header-small mb-5"),attr(A,"type","text"),attr(A,"class","form-control mb-3"),attr(A,"placeholder","Name"),A.required=!0,attr(k,"class","input-group mb-5"),attr(J,"type","email"),attr(J,"class","form-control mb-3"),attr(J,"placeholder","Email"),J.required=!0,attr(W,"class","input-group mb-5"),attr(_e,"class","list-group-item list-group-item-action"),attr(_e,"href",o[5].lucentUrl+"/logout"),attr(fe,"class","list-group"),attr(e,"class","wrapper-tiny")},m(Oe,Ft){insert$1(Oe,e,Ft),mount_component(n,e,null),append(e,r),mount_component(c,e,null),append(e,u),append(e,h),mount_component(p,h,null),append(e,b),append(e,y),append(y,k),append(k,A),set_input_value(A,o[0]),append(k,R),mount_component(N,k,null),append(e,F),append(e,V),append(V,W),append(W,J),set_input_value(J,o[1]),append(W,te),mount_component(j,W,null),append(e,ae),append(e,fe),append(fe,_e),append(_e,ne),Se=!0,Ae||(Ne=[listen(A,"input",o[9]),listen(y,"submit",o[6]),listen(J,"input",o[10]),listen(V,"submit",o[7])],Ae=!0)},p(Oe,[Ft]){const Qt={};Ft&4&&(Qt.message=Oe[2]),n.$set(Qt);const St={};c.$set(St),Ft&1&&A.value!==Oe[0]&&set_input_value(A,Oe[0]),Ft&2&&J.value!==Oe[1]&&set_input_value(J,Oe[1])},i(Oe){Se||(transition_in(n.$$.fragment,Oe),transition_in(c.$$.fragment,Oe),transition_in(p.$$.fragment,Oe),transition_in(N.$$.fragment,Oe),transition_in(j.$$.fragment,Oe),Se=!0)},o(Oe){transition_out(n.$$.fragment,Oe),transition_out(c.$$.fragment,Oe),transition_out(p.$$.fragment,Oe),transition_out(N.$$.fragment,Oe),transition_out(j.$$.fragment,Oe),Se=!1},d(Oe){Oe&&detach(e),destroy_component(n),o[8](null),destroy_component(c),destroy_component(p),destroy_component(N),destroy_component(j),Ae=!1,run_all(Ne)}}}function instance$1k(o,e,n){const r=getContext$1("user"),c=getContext$1("channel");let u=r.name,h=r.email,p="",b;function y(F){F.preventDefault(),n(2,p=""),axios.post(c.lucentUrl+"/account/update-name",{name:u}).then(V=>{b.show()}).catch(V=>{var W;n(2,p=(W=V.response)==null?void 0:W.data.error),console.log({errorMessage:p})})}function k(F){F.preventDefault(),n(2,p=""),axios.post(c.lucentUrl+"/account/update-email",{email:h}).then(V=>{b.show()}).catch(V=>{var W;n(2,p=(W=V.response)==null?void 0:W.data.error),console.log({errorMessage:p})})}function A(F){binding_callbacks[F?"unshift":"push"](()=>{b=F,n(3,b)})}function R(){u=this.value,n(0,u)}function N(){h=this.value,n(1,h)}return[u,h,p,b,r,c,y,k,A,R,N]}class Profile extends SvelteComponent{constructor(e){super(),init(this,e,instance$1k,create_fragment$1k,safe_not_equal,{})}}function create_fragment$1j(o){let e,n,r,c=o[3].name+"",u,h,p,b,y,k;const A=[{title:o[0]},o[2]];var R=o[4][o[1]];function N(F,V){let W={};for(let J=0;J<A.length;J+=1)W=assign(W,A[J]);return V!==void 0&&V&5&&(W=assign(W,get_spread_update(A,[V&1&&{title:F[0]},V&4&&get_spread_object(F[2])]))),{props:W}}return R&&(y=construct_svelte_component(R,N(o))),{c(){e=element("div"),n=element("h1"),r=element("a"),u=text(c),p=space$3(),b=element("div"),y&&create_component(y.$$.fragment),attr(r,"class","text-decoration-none"),attr(r,"href",h=o[3].lucentUrl),set_style(e,"text-align","center"),set_style(e,"background","var(--p20)"),set_style(e,"padding","20px"),set_style(e,"color","var(--p90)")},m(F,V){insert$1(F,e,V),append(e,n),append(n,r),append(r,u),insert$1(F,p,V),insert$1(F,b,V),y&&mount_component(y,b,null),k=!0},p(F,[V]){if((!k||V&8)&&c!==(c=F[3].name+"")&&set_data(u,c),(!k||V&8&&h!==(h=F[3].lucentUrl))&&attr(r,"href",h),V&2&&R!==(R=F[4][F[1]])){if(y){group_outros();const W=y;transition_out(W.$$.fragment,1,0,()=>{destroy_component(W,1)}),check_outros()}R?(y=construct_svelte_component(R,N(F,V)),create_component(y.$$.fragment),transition_in(y.$$.fragment,1),mount_component(y,b,null)):y=null}else if(R){const W=V&5?get_spread_update(A,[V&1&&{title:F[0]},V&4&&get_spread_object(F[2])]):{};y.$set(W)}},i(F){k||(y&&transition_in(y.$$.fragment,F),k=!0)},o(F){y&&transition_out(y.$$.fragment,F),k=!1},d(F){F&&(detach(e),detach(p),detach(b)),y&&destroy_component(y)}}}function instance$1j(o,e,n){const r={register:Register,login:Login,verify:Verify,profile:Profile};let{title:c}=e,{view:u}=e,{user:h}=e,{data:p}=e,{channel:b}=e;return setContext("channel",b),setContext("user",h),o.$$set=y=>{"title"in y&&n(0,c=y.title),"view"in y&&n(1,u=y.view),"user"in y&&n(5,h=y.user),"data"in y&&n(2,p=y.data),"channel"in y&&n(3,b=y.channel)},[c,u,p,b,r,h]}class Account extends SvelteComponent{constructor(e){super(),init(this,e,instance$1j,create_fragment$1j,safe_not_equal,{title:0,view:1,user:5,data:2,channel:3})}}function toDate(o){const e=Object.prototype.toString.call(o);return o instanceof Date||typeof o=="object"&&e==="[object Date]"?new o.constructor(+o):typeof o=="number"||e==="[object Number]"||typeof o=="string"||e==="[object String]"?new Date(o):new Date(NaN)}function constructFrom(o,e){return o instanceof Date?new o.constructor(e):new Date(e)}const millisecondsInWeek=6048e5,millisecondsInDay=864e5,minutesInMonth=43200,minutesInDay=144
Line truncated
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/lodash.exports;(function(o,e){(function(){var n,r="4.17.21",c=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",h="Expected a function",p="Invalid `variable` option passed into `_.template`",b="__lodash_hash_undefined__",y=500,k="__lodash_placeholder__",A=1,R=2,N=4,F=1,V=2,W=1,J=2,te=4,j=8,ae=16,fe=32,_e=64,ne=128,Se=256,Ae=512,Ne=30,xe="...",Oe=800,Ft=16,Qt=1,St=2,q=3,Le=1/0,je=9007199254740991,mn=17976931348623157e292,Pt=NaN,Ue=4294967295,ct=Ue-1,dn=Ue>>>1,Zt=[["ary",ne],["bind",W],["bindKey",J],["curry",j],["curryRight",ae],["flip",Ae],["partial",fe],["partialRight",_e],["rearg",Se]],rn="[object Arguments]",Fe="[object Array]",mt="[object AsyncFunction]",de="[object Boolean]",Eo="[object Date]",jn="[object DOMException]",Yn="[object Error]",po="[object Function]",cs="[object GeneratorFunction]",gt="[object Map]",Ut="[object Number]",pt="[object Null]",Ie="[object Object]",Rt="[object Promise]",pn="[object Proxy]",kt="[object RegExp]",kn="[object Set]",Dn="[object String]",is="[object Symbol]",Gn="[object Undefined]",as="[object WeakMap]",vr="[object WeakSet]",Ns="[object ArrayBuffer]",Vs="[object DataView]",Ts="[object Float32Array]",Ki="[object Float64Array]",vs="[object Int8Array]",ms="[object Int16Array]",dr="[object Int32Array]",Oo="[object Uint8Array]",wo="[object Uint8ClampedArray]",Gs="[object Uint16Array]",ws="[object Uint32Array]",Pi=/\b__p \+= '';/g,ts=/\b(__p \+=) '' \+/g,Qi=/(__e\(.*?\)|\b__t\)) \+\n'';/g,nn=/&(?:amp|lt|gt|quot|#39);/g,ns=/[&<>"']/g,Xr=RegExp(nn.source),Qe=RegExp(ns.source),Ye=/<%-([\s\S]+?)%>/g,_t=/<%([\s\S]+?)%>/g,Bt=/<%=([\s\S]+?)%>/g,Rn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xn=/^\w*$/,ro=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,an=/[\\^$.*+?()[\]{}|]/g,Do=RegExp(an.source),io=/^\s+/,Wo=/\s/,sr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,mr=/\{\n\/\* \[wrapped with (.+)\] \*/,Ks=/,? & /,pr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Di=/[()=,{}\[\]\/\s]/,cc=/\\(\\)?/g,mi=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ge=/\w*$/,Xe=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,Ht=/^\[object .+?Constructor\]$/,eo=/^0o[0-7]+$/i,co=/^(?:0|[1-9]\d*)$/,qo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,fr=/($^)/,nt=/['\n\r\u2028\u2029\\]/g,xo="\\ud800-\\udfff",jr="\\u0300-\\u036f",Oi="\\ufe20-\\ufe2f",ra="\\u20d0-\\u20ff",zs=jr+Oi+ra,Ec="\\u2700-\\u27bf",ul="a-z\\xdf-\\xf6\\xf8-\\xff",ga="\\xac\\xb1\\xd7\\xf7",Ri="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",As="\\u2000-\\u206f",rr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Vi="A-Z\\xc0-\\xd6\\xd8-\\xde",ia="\\ufe0e\\ufe0f",Pl=ga+Ri+As+rr,Tc="['’]",Ac="["+xo+"]",Ls="["+Pl+"]",Ji="["+zs+"]",ka="\\d+",Gc="["+Ec+"]",xa="["+ul+"]",Yr="[^"+xo+Pl+ka+Ec+ul+Vi+"]",hr="\\ud83c[\\udffb-\\udfff]",ja="(?:"+Ji+"|"+hr+")",bu="[^"+xo+"]",Us="(?:\\ud83c[\\udde6-\\uddff]){2}",Mi="[\\ud800-\\udbff][\\udc00-\\udfff]",zi="["+Vi+"]",yi="\\u200d",yl="(?:"+xa+"|"+Yr+")",ql="(?:"+zi+"|"+Yr+")",ba="(?:"+Tc+"(?:d|ll|m|re|s|t|ve))?",Dl="(?:"+Tc+"(?:D|LL|M|RE|S|T|VE))?",Rl=ja+"?",cd="["+ia+"]?",Ml="(?:"+yi+"(?:"+[bu,Us,Mi].join("|")+")"+cd+Rl+")*",Qu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ya="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",uc=cd+Rl+Ml,vu="(?:"+[Gc,Us,Mi].join("|")+")"+uc,ud="(?:"+[bu+Ji+"?",Ji,Us,Mi,Ac].join("|")+")",Kd=RegExp(Tc,"g"),Te=RegExp(Ji,"g"),Ke=RegExp(hr+"(?="+hr+")|"+ud+uc,"g"),ht=RegExp([zi+"?"+xa+"+"+ba+"(?="+[Ls,zi,"$"].join("|")+")",ql+"+"+Dl+"(?="+[Ls,zi+yl,"$"].join("|")+")",zi+"?"+yl+"+"+ba,zi+"+"+Dl,Ya,Qu,ka,vu].join("|"),"g"),Et=RegExp("["+yi+xo+zs+ia+"]"),fn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,go=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ar=-1,Ko={};Ko[Ts]=Ko[Ki]=Ko[vs]=Ko[ms]=Ko[dr]=Ko[Oo]=Ko[wo]=Ko[Gs]=Ko[ws]=!0,Ko[rn]=Ko[Fe]=Ko[Ns]=Ko[de]=Ko[Vs]=Ko[Eo]=Ko[Yn]=Ko[po]=Ko[gt]=Ko[Ut]=Ko[Ie]=Ko[kt]=Ko[kn]=Ko[Dn]=Ko[as]=!1;var Io={};Io[rn]=Io[Fe]=Io[Ns]=Io[Vs]=Io[de]=Io[Eo]=Io[Ts]=Io[Ki]=Io[vs]=Io[ms]=Io[dr]=Io[gt]=Io[Ut]=Io[Ie]=Io[kt]=Io[kn]=Io[Dn]=Io[is]=Io[Oo]=Io[wo]=Io[Gs]=Io[ws]=!0,Io[Yn]=Io[po]=Io[as]=!1;var Mr={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"CLine truncated
|
||||
/* [wrapped with `+D+`] */
|
||||
`)}function z0(E){return os(E)||Va(E)||!!(ef&&E&&E[ef])}function Ch(E,D){var Z=typeof E;return D=D??je,!!D&&(Z=="number"||Z!="symbol"&&co.test(E))&&E>-1&&E%1==0&&E<D}function Hc(E,D,Z){if(!ha(Z))return!1;var ce=typeof D;return(ce=="number"?zr(Z)&&Ch(D,Z.length):ce=="string"&&D in Z)?sa(Z[D],E):!1}function kh(E,D){if(os(E))return!1;var Z=typeof E;return Z=="number"||Z=="symbol"||Z=="boolean"||E==null||ji(E)?!0:Xn.test(E)||!Rn.test(E)||D!=null&&E in br(D)}function ig(E){var D=typeof E;return D=="string"||D=="number"||D=="symbol"||D=="boolean"?E!=="__proto__":E===null}function sp(E){var D=sg(E),Z=Ee[D];if(typeof Z!="function"||!(D in _r.prototype))return!1;if(E===Z)return!0;var ce=Pd(Z);return!!ce&&E===ce[0]}function ag(E){return!!el&&el in E}var hb=Ci?Lf:bp;function Gu(E){var D=E&&E.constructor,Z=typeof D=="function"&&D.prototype||la;return E===Z}function Dd(E){return E===E&&!ha(E)}function lg(E,D){return function(Z){return Z==null?!1:Z[E]===D&&(D!==n||E in br(Z))}}function Ku(E){var D=ed(E,function(ce){return Z.size===y&&Z.clear(),ce}),Z=D.cache;return D}function mb(E,D){var Z=E[1],ce=D[1],Ce=Z|ce,ze=Ce<(W|J|ne),it=ce==ne&&Z==j||ce==ne&&Z==Se&&E[7].length<=D[8]||ce==(ne|Se)&&D[7].length<=D[8]&&Z==j;if(!(ze||it))return E;ce&W&&(E[2]=D[2],Ce|=Z&W?0:te);var bt=D[3];if(bt){var It=E[3];E[3]=It?h1(It,bt,D[4]):bt,E[4]=It?hl(E[3],k):D[4]}return bt=D[5],bt&&(It=E[5],E[5]=It?vh(It,bt,D[6]):bt,E[6]=It?hl(E[5],k):D[6]),bt=D[7],bt&&(E[7]=bt),ce&ne&&(E[8]=E[8]==null?D[8]:Ia(E[8],D[8])),E[9]==null&&(E[9]=D[9]),E[0]=D[0],E[1]=Ce,E}function LO(E){var D=[];if(E!=null)for(var Z in br(E))D.push(Z);return D}function cg(E){return xf.call(E)}function Df(E,D,Z){return D=qi(D===n?E.length-1:D,0),function(){for(var ce=arguments,Ce=-1,ze=qi(ce.length-D,0),it=Kt(ze);++Ce<ze;)it[Ce]=ce[D+Ce];Ce=-1;for(var bt=Kt(D+1);++Ce<D;)bt[Ce]=ce[Ce];return bt[D]=Z(it),yr(E,this,bt)}}function FO(E,D){return D.length<2?E:tl(E,ds(D,0,-1))}function ug(E,D){for(var Z=E.length,ce=Ia(D.length,Z),Ce=ec(E);ce--;){var ze=D[ce];E[ce]=Ch(ze,Z)?Ce[ze]:n}return E}function xh(E,D){if(!(D==="constructor"&&typeof E[D]=="function")&&D!="__proto__")return E[D]}var Ju=U0(Lc),Hl=Ea||function(E,D){return me.setTimeout(E,D)},W0=U0(lm);function Z0(E,D,Z){var ce=D+"";return W0(E,ow(ce,pb(eC(ce),Z)))}function U0(E){var D=0,Z=0;return function(){var ce=Zp(),Ce=Ft-(ce-Z);if(Z=ce,Ce>0){if(++D>=Oe)return arguments[0]}else D=0;return E.apply(n,arguments)}}function dg(E,D){var Z=-1,ce=E.length,Ce=ce-1;for(D=D===n?ce:D;++Z<D;){var ze=Cd(Z,Ce),it=E[ze];E[ze]=E[Z],E[Z]=it}return E.length=D,E}var Qc=Ku(function(E){var D=[];return E.charCodeAt(0)===46&&D.push(""),E.replace(ro,function(Z,ce,Ce,ze){D.push(Ce?ze.replace(cc,"$1"):ce||Z)}),D});function lu(E){if(typeof E=="string"||ji(E))return E;var D=E+"";return D=="0"&&1/E==-Le?"-0":D}function Rf(E){if(E!=null){try{return nu.call(E)}catch{}try{return E+""}catch{}}return""}function pb(E,D){return Jo(Zt,function(Z){var ce="_."+Z[0];D&Z[1]&&!Nr(E,ce)&&E.push(ce)}),E.sort()}function HO(E){if(E instanceof _r)return E.clone();var D=new jl(E.__wrapped__,E.__chain__);return D.__actions__=ec(E.__actions__),D.__index__=E.__index__,D.__values__=E.__values__,D}function QO(E,D,Z){(Z?Hc(E,D,Z):D===n)?D=1:D=qi(cr(D),0);var ce=E==null?0:E.length;if(!ce||D<1)return[];for(var Ce=0,ze=0,it=Kt(Dc(ce/D));Ce<ce;)it[ze++]=ds(E,Ce,Ce+=D);return it}function q0(E){for(var D=-1,Z=E==null?0:E.length,ce=0,Ce=[];++D<Z;){var ze=E[D];ze&&(Ce[ce++]=ze)}return Ce}function fg(){var E=arguments.length;if(!E)return[];for(var D=Kt(E-1),Z=arguments[0],ce=E;ce--;)D[ce-1]=arguments[ce];return Vu(os(Z)?ec(Z):[Z],Li(D,1))}var hg=Xs(function(E,D){return za(E)?ca(E,Li(D,1,za,!0)):[]}),gb=Xs(function(E,D){var Z=Rd(D);return za(Z)&&(Z=n),za(E)?ca(E,Li(D,1,za,!0),ls(Z,2)):[]}),sw=Xs(function(E,D){var Z=Rd(D);return za(Z)&&(Z=n),za(E)?ca(E,Li(D,1,za,!0),n,Z):[]});function bb(E,D,Z){var ce=E==null?0:E.length;return ce?(D=Z||D===n?1:cr(D),ds(E,D<0?0:D,ce)):[]}function mg(E,D,Z){var ce=E==null?0:E.length;return ce?(D=Z||D===n?1:cr(D),D=ce-D,ds(E,0,D<0?0:D)):[]}function rw(E,D){return E&&E.length?Af(E,ls(D,3),!0,!0):[]}function g1(E,D){return E&&E.length?Af(E,ls(D,3),!0):[]}function X0(E,D,Z,ce){var Ce=E==null?0:E.length;return Ce?(Z&&typeof Z!="number"&&Hc(E,D,Z)&&(Z=0,ce=Ce),Km(E,D,Z,ce)):[]}function Vc(E,D,Z){var ce=E==null?0:E.length;if(!ce)return-1;var Ce=Z==null?0:cr(Z);return Ce<0&&(Ce=qi(ce+Ce,0)),Ii(E,ls(D,3),Ce)}function b1(E,D,Z){var ce=E==null?0:E.length;if(!ce)return-1;var Ce=ce-1;return Z!==n&&(Ce=cr(Z),Ce=Z<0?qi(ce+Ce,0):Ia(Ce,ce-1)),Ii(E,ls(D,3),Ce,!0)}function j0(E){var D=E==null?0:E.length;return D?Li(E,1):[]}function vb(E){var D=E==null?0:E.length;return D?Li(E,Le):[]}function tC(E,D){var Z=E==null?0:E.length;return Z?(D=D===n?1:cr(D),Li(E,D)):[]}function Ob(E){for(var D=-1,Z=E==null?0:E.length,ce={};++D<Z;){var Ce=E[D];ce[Ce[0]]=Ce[1]}return ce}function Eh(E){return E&&E.length?E[0]:n}function Mf(E,D,Z){var ce=E==null?0:E.length;if(!ce)return-1;var Ce=Z==null?0:cr(Z);r
Line truncated
|
||||
`;E.replace(yo,function(bs,Tr,Wr,El,rc,nd){return Wr||(Wr=El),Bn+=E.slice(wn,nd).replace(nt,_l),Tr&&(bt=!0,Bn+=`' +
|
||||
__e(`+Tr+`) +
|
||||
'`),rc&&(It=!0,Bn+=`';
|
||||
`+rc+`;
|
||||
__p += '`),Wr&&(Bn+=`' +
|
||||
((__t = (`+Wr+`)) == null ? '' : __t) +
|
||||
'`),wn=nd+bs.length,bs}),Bn+=`';
|
||||
`;var Cs=Dr.call(D,"variable")&&D.variable;if(!Cs)Bn=`with (obj) {
|
||||
`+Bn+`
|
||||
}
|
||||
`;else if(Di.test(Cs))throw new ps(p);Bn=(It?Bn.replace(Pi,""):Bn).replace(ts,"$1").replace(Qi,"$1;"),Bn="function("+(Cs||"obj")+`) {
|
||||
`+(Cs?"":`obj || (obj = {});
|
||||
`)+"var __t, __p = ''"+(bt?", __e = _.escape":"")+(It?`, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
`:`;
|
||||
`)+Bn+`return __p
|
||||
}`;var nr=gy(function(){return qs(ze,jo+"return "+Bn).apply(n,it)});if(nr.source=Bn,lv(nr))throw nr;return nr}function Nw(E){return vi(E).toLowerCase()}function Fb(E){return vi(E).toUpperCase()}function Iw(E,D,Z){if(E=vi(E),E&&(Z||D===n))return Ja(E);if(!E||!(D=gi(D)))return E;var ce=ml(E),Ce=ml(D),ze=hc(ce,Ce),it=md(ce,Ce)+1;return Xu(ce,ze,it).join("")}function py(E,D,Z){if(E=vi(E),E&&(Z||D===n))return E.slice(0,Wm(E)+1);if(!E||!(D=gi(D)))return E;var ce=ml(E),Ce=md(ce,ml(D))+1;return Xu(ce,0,Ce).join("")}function Pg(E,D,Z){if(E=vi(E),E&&(Z||D===n))return E.replace(io,"");if(!E||!(D=gi(D)))return E;var ce=ml(E),Ce=hc(ce,ml(D));return Xu(ce,Ce).join("")}function _v(E,D){var Z=Ne,ce=xe;if(ha(D)){var Ce="separator"in D?D.separator:Ce;Z="length"in D?cr(D.length):Z,ce="omission"in D?gi(D.omission):ce}E=vi(E);var ze=E.length;if(Oa(E)){var it=ml(E);ze=it.length}if(Z>=ze)return E;var bt=Z-pd(ce);if(bt<1)return ce;var It=it?Xu(it,0,bt).join(""):E.slice(0,bt);if(Ce===n)return It+ce;if(it&&(bt+=It.length-bt),x1(Ce)){if(E.slice(bt).search(Ce)){var wn,_n=It;for(Ce.global||(Ce=rh(Ce.source,vi(Ge.exec(Ce))+"g")),Ce.lastIndex=0;wn=Ce.exec(_n);)var Bn=wn.index;It=It.slice(0,Bn===n?bt:Bn)}}else if(E.indexOf(gi(Ce),bt)!=bt){var yo=It.lastIndexOf(Ce);yo>-1&&(It=It.slice(0,yo))}return It+ce}function wv(E){return E=vi(E),E&&Xr.test(E)?E.replace(nn,qe):E}var Sv=yh(function(E,D,Z){return E+(Z?" ":"")+D.toUpperCase()}),Hb=Kp("toUpperCase");function Qb(E,D,Z){return E=vi(E),D=Z?n:D,D===n?tu(E)?Cf(E):th(E):E.match(D)||[]}var gy=Xs(function(E,D){try{return yr(E,n,D)}catch(Z){return lv(Z)?Z:new ps(Z)}}),Vb=wh(function(E,D){return Jo(D,function(Z){Z=lu(Z),ru(E,Z,wa(E[Z],E))}),E});function zb(E){var D=E==null?0:E.length,Z=ls();return E=D?Ni(E,function(ce){if(typeof ce[1]!="function")throw new Ui(h);return[Z(ce[0]),ce[1]]}):[],Xs(function(ce){for(var Ce=-1;++Ce<D;){var ze=E[Ce];if(yr(ze[0],this,ce))return yr(ze[1],this,ce)}})}function Bw(E){return wl(Ei(E,A))}function D1(E){return function(){return E}}function by(E,D){return E==null||E!==E?D:E}var Lw=tg(),Cv=tg(!0);function Du(E){return E}function _m(E){return z(typeof E=="function"?E:Ei(E,A))}function Fw(E){return Vt(Ei(E,A))}function kv(E,D){return gn(E,Ei(D,A))}var Hw=Xs(function(E,D){return function(Z){return xu(Z,E,D)}}),Qw=Xs(function(E,D){return function(Z){return xu(E,Z,D)}});function xv(E,D,Z){var ce=xl(D),Ce=am(D,ce);Z==null&&!(ha(D)&&(Ce.length||!ce.length))&&(Z=D,D=E,E=this,Ce=am(D,xl(D)));var ze=!(ha(Z)&&"chain"in Z)||!!Z.chain,it=Lf(E);return Jo(Ce,function(bt){var It=D[bt];E[bt]=It,it&&(E.prototype[bt]=function(){var wn=this.__chain__;if(ze||wn){var _n=E(this.__wrapped__),Bn=_n.__actions__=ec(this.__actions__);return Bn.push({func:It,args:arguments,thisArg:E}),_n.__chain__=wn,_n}return It.apply(E,Vu([this.value()],arguments))})}),E}function vy(){return me._===this&&(me._=ih),this}function Ev(){}function bl(E){return E=cr(E),Xs(function(D){return Uo(D,E)})}var iC=ng(Ni),Dg=ng(Fr),Wb=ng(eu);function Tv(E){return kh(E)?va(lu(E)):gc(E)}function Av(E){return function(D){return E==null?n:tl(E,D)}}var Oy=cb(),yy=cb(!0);function Nh(){return[]}function bp(){return!1}function Vw(){return{}}function zw(){return""}function R1(){return!0}function $v(E,D){if(E=cr(E),E<1||E>je)return[];var Z=Ue,ce=Ia(E,Ue);D=ls(D),E-=Ue;for(var Ce=Sr(ce,D);++Z<E;)D(Z);return Ce}function _y(E){return os(E)?Ni(E,lu):ji(E)?[E]:ec(Qc(vi(E)))}function Ua(E){var D=++Pc;return vi(E)+D}var wy=Td(function(E,D){return E+D},0),Pv=m1("ceil"),aC=Td(function(E,D){return E/D},1),Rg=m1("floor");function Ww(E){return E&&E.length?Sl(E,Du,rf):n}function Sy(E,D){return E&&E.length?Sl(E,ls(D,2),rf):n}function Dv(E){return Ra(E,Du)}function M1(E,D){return Ra(E,ls(D,2))}function Zb(E){return E&&E.length?Sl(E,Du,$e):n}function Mg(E,D){return E&&E.length?Sl(E,ls(D,2),$e):n}var Zw=Td(function(E,D){return E*D},1),wm=m1("round"),Cy=Td(function(E,D){return E-D},0);function Sm(E){return E&&E.length?_f(E,Du):0}function Cm(E,D){return E&&E.length?_f(E,ls(D,2)):0}return Ee.after=Er,Ee.ary=Cg,Ee.assign=vw,Ee.assignIn=Vl,Ee.assignInWith=Om,Ee.assignWith=Ow,Ee.at=yw,Ee.before=Eb,Ee.bind=wa,Ee.bindAll=Vb,Ee.bindKey=ff,Ee.castArray=Pb,Ee.chain=cu,Ee.chunk=QO,Ee.compact=q0,Ee.concat=fg,Ee.cond=zb,Ee.conforms=Bw,Ee.constant=D1,Ee.countBy=yg,Ee.create=hv,Ee.curry=$h,Ee.curryRight=Tb,Ee.debounce=_1,Ee.defaults=_w,Ee.defaultsDeep=ny,Ee.defer=w1,Ee.delay=tv,Ee.difference=hg,Ee.differenceBy=gb,Ee.differenceWith=sw,Ee.drop=bb,Ee.dropRight=mg,Ee.dropRightWhile=rw,Ee.dropWhile=g1,Ee.fill=X0,Ee.filter=up,Ee.flatMap=YO,Ee.flatMapDeep=fp,Ee.flatMapDepth=pm,Ee.flatten=j0,Ee.flattenDeep=vb,Ee.flattenDepth=tC,Ee.flip=Ab,Ee.flow=Lw,Ee.flowRight=Cv,Ee.fromPairs=Ob,Ee.functions=Sw,Ee.functionsIn=pv,Ee.groupBy=uw,Ee.initial=Y0,Ee.intersection=pg,Ee.intersectionBy=yb,Ee.intersectionWith=VO,Ee.invert=bv,Ee.invertBy=sc,Ee.invokeMap=dw,Ee.iteratee=_m,Ee.keyBy=kb,Ee.keys=xl,Ee.keysIn=Zc,Ee.map=_g,Ee.mapKeys=Nb,Ee.mapValues=ry,Ee.matches=Fw,Ee.matchesProperty=kv,Ee
Line truncated
|
||||
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
||||
* http://github.com/janl/mustache.js
|
||||
*/var objectToString=Object.prototype.toString,isArray=Array.isArray||function(e){return objectToString.call(e)==="[object Array]"};function isFunction(o){return typeof o=="function"}function typeStr(o){return isArray(o)?"array":typeof o}function escapeRegExp(o){return o.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(o,e){return o!=null&&typeof o=="object"&&e in o}function primitiveHasOwnProperty(o,e){return o!=null&&typeof o!="object"&&o.hasOwnProperty&&o.hasOwnProperty(e)}var regExpTest=RegExp.prototype.test;function testRegExp(o,e){return regExpTest.call(o,e)}var nonSpaceRe=/\S/;function isWhitespace(o){return!testRegExp(nonSpaceRe,o)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml(o){return String(o).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})}var whiteRe=/\s*/,spaceRe=/\s+/,equalsRe=/\s*=/,curlyRe=/\s*\}/,tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(o,e){if(!o)return[];var n=!1,r=[],c=[],u=[],h=!1,p=!1,b="",y=0;function k(){if(h&&!p)for(;u.length;)delete c[u.pop()];else u=[];h=!1,p=!1}var A,R,N;function F(Se){if(typeof Se=="string"&&(Se=Se.split(spaceRe,2)),!isArray(Se)||Se.length!==2)throw new Error("Invalid tags: "+Se);A=new RegExp(escapeRegExp(Se[0])+"\\s*"),R=new RegExp("\\s*"+escapeRegExp(Se[1])),N=new RegExp("\\s*"+escapeRegExp("}"+Se[1]))}F(e||mustache.tags);for(var V=new Scanner(o),W,J,te,j,ae,fe;!V.eos();){if(W=V.pos,te=V.scanUntil(A),te)for(var _e=0,ne=te.length;_e<ne;++_e)j=te.charAt(_e),isWhitespace(j)?(u.push(c.length),b+=j):(p=!0,n=!0,b+=" "),c.push(["text",j,W,W+1]),W+=1,j===`
|
||||
`&&(k(),b="",y=0,n=!1);if(!V.scan(A))break;if(h=!0,J=V.scan(tagRe)||"name",V.scan(whiteRe),J==="="?(te=V.scanUntil(equalsRe),V.scan(equalsRe),V.scanUntil(R)):J==="{"?(te=V.scanUntil(N),V.scan(curlyRe),V.scanUntil(R),J="&"):te=V.scanUntil(R),!V.scan(R))throw new Error("Unclosed tag at "+V.pos);if(J==">"?ae=[J,te,W,V.pos,b,y,n]:ae=[J,te,W,V.pos],y++,c.push(ae),J==="#"||J==="^")r.push(ae);else if(J==="/"){if(fe=r.pop(),!fe)throw new Error('Unopened section "'+te+'" at '+W);if(fe[1]!==te)throw new Error('Unclosed section "'+fe[1]+'" at '+W)}else J==="name"||J==="{"||J==="&"?p=!0:J==="="&&F(te)}if(k(),fe=r.pop(),fe)throw new Error('Unclosed section "'+fe[1]+'" at '+V.pos);return nestTokens(squashTokens(c))}function squashTokens(o){for(var e=[],n,r,c=0,u=o.length;c<u;++c)n=o[c],n&&(n[0]==="text"&&r&&r[0]==="text"?(r[1]+=n[1],r[3]=n[3]):(e.push(n),r=n));return e}function nestTokens(o){for(var e=[],n=e,r=[],c,u,h=0,p=o.length;h<p;++h)switch(c=o[h],c[0]){case"#":case"^":n.push(c),r.push(c),n=c[4]=[];break;case"/":u=r.pop(),u[5]=c[2],n=r.length>0?r[r.length-1][4]:e;break;default:n.push(c)}return e}function Scanner(o){this.string=o,this.tail=o,this.pos=0}Scanner.prototype.eos=function(){return this.tail===""};Scanner.prototype.scan=function(e){var n=this.tail.match(e);if(!n||n.index!==0)return"";var r=n[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};Scanner.prototype.scanUntil=function(e){var n=this.tail.search(e),r;switch(n){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=r.length,r};function Context$1(o,e){this.view=o,this.cache={".":this.view},this.parent=e}Context$1.prototype.push=function(e){return new Context$1(e,this)};Context$1.prototype.lookup=function(e){var n=this.cache,r;if(n.hasOwnProperty(e))r=n[e];else{for(var c=this,u,h,p,b=!1;c;){if(e.indexOf(".")>0)for(u=c.view,h=e.split("."),p=0;u!=null&&p<h.length;)p===h.length-1&&(b=hasProperty(u,h[p])||primitiveHasOwnProperty(u,h[p])),u=u[h[p++]];else u=c.view[e],b=hasProperty(c.view,e);if(b){r=u;break}c=c.parent}n[e]=r}return isFunction(r)&&(r=r.call(this.view)),r};function Writer(){this.templateCache={_cache:{},set:function(e,n){this._cache[e]=n},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Writer.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Writer.prototype.parse=function(e,n){var r=this.templateCache,c=e+":"+(n||mustache.tags).join(":"),u=typeof r<"u",h=u?r.get(c):void 0;return h==null&&(h=parseTemplate(e,n),u&&r.set(c,h)),h};Writer.prototype.render=function(e,n,r,c){var u=this.getConfigTags(c),h=this.parse(e,u),p=n instanceof Context$1?n:new Context$1(n,void 0);return this.renderTokens(h,p,r,e,c)};Writer.prototype.renderTokens=function(e,n,r,c,u){for(var h="",p,b,y,k=0,A=e.length;k<A;++k)y=void 0,p=e[k],b=p[0],b==="#"?y=this.renderSection(p,n,r,c,u):b==="^"?y=this.renderInverted(p,n,r,c,u):b===">"?y=this.renderPartial(p,n,r,u):b==="&"?y=this.unescapedValue(p,n):b==="name"?y=this.escapedValue(p,n,u):b==="text"&&(y=this.rawValue(p)),y!==void 0&&(h+=y);return h};Writer.prototype.renderSection=function(e,n,r,c,u){var h=this,p="",b=n.lookup(e[1]);function y(R){return h.render(R,n,r,u)}if(b){if(isArray(b))for(var k=0,A=b.length;k<A;++k)p+=this.renderTokens(e[4],n.push(b[k]),r,c,u);else if(typeof b=="object"||typeof b=="string"||typeof b=="number")p+=this.renderTokens(e[4],n.push(b),r,c,u);else if(isFunction(b)){if(typeof c!="string")throw new Error("Cannot use higher-order sections without the original template");b=b.call(n.view,c.slice(e[3],e[5]),y),b!=null&&(p+=b)}else p+=this.renderTokens(e[4],n,r,c,u);return p}};Writer.prototype.renderInverted=function(e,n,r,c,u){var h=n.lookup(e[1]);if(!h||isArray(h)&&h.length===0)return this.renderTokens(e[4],n,r,c,u)};Writer.prototype.indentPartial=function(e,n,r){for(var c=n.replace(/[^ \t]/g,""),u=e.split(`
|
||||
`),h=0;h<u.length;h++)u[h].length&&(h>0||!r)&&(u[h]=c+u[h]);return u.join(`
|
||||
`)};Writer.prototype.renderPartial=function(e,n,r,c){if(r){var u=this.getConfigTags(c),h=isFunction(r)?r(e[1]):r[e[1]];if(h!=null){var p=e[6],b=e[5],y=e[4],k=h;b==0&&y&&(k=this.indentPartial(h,y,p));var A=this.parse(k,u);return this.renderTokens(A,n,r,k,c)}}};Writer.prototype.unescapedValue=function(e,n){var r=n.lookup(e[1]);if(r!=null)return r};Writer.prototype.escapedValue=function(e,n,r){var c=this.getConfigEscape(r)||mustache.escape,u=n.lookup(e[1]);if(u!=null)return typeof u=="number"&&c===mustache.escape?String(u):c(u)};Writer.prototype.rawValue=function(e){return e[1]};Writer.prototype.getConfigTags=function(e){return isArray(e)?e:e&&typeof e=="object"?e.tags:void 0};Writer.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!isArray(e))return e.escape};var mustache={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(o){defaultWriter.templateCache=o},get templateCache(){return defaultWriter.templateCache}},defaultWriter=new Writer;mustache.clearCache=function(){return defaultWriter.clearCache()};mustache.parse=function(e,n){return defaultWriter.parse(e,n)};mustache.render=function(e,n,r,c){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+typeStr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return defaultWriter.render(e,n,r,c)};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context$1;mustache.Writer=Writer;function previewTitle(o,e,n){let r=o.find(h=>h.name===(e==null?void 0:e.schema));if(!(r!=null&&r.cardTitle))return noTemplate(r,e);let c=e.data,u=mustache.render(r.cardTitle,c);return!u||u===""?noTemplate(r,e):stripHtml(u.slice(0,300))}function noTemplate(o,e){var r;if((o==null?void 0:o.type)==="files")return e._file.path;let n=stripHtml(e==null?void 0:e.data[(r=o.fields.filter(c=>c.info.name==="text")[0])==null?void 0:r.name]).slice(0,300);return n.trim()===""?"~Untitled~":n}function create_else_block$j(o){let e;return{c(){e=text("New Record")},m(n,r){insert$1(n,e,r)},p:noop,d(n){n&&detach(e)}}}function create_if_block$J(o){let e=previewTitle(o[3].schemas,o[1])+"",n;return{c(){n=text(e)},m(r,c){insert$1(r,n,c)},p(r,c){c&2&&e!==(e=previewTitle(r[3].schemas,r[1])+"")&&set_data(n,e)},d(r){r&&detach(n)}}}function create_fragment$13(o){let e,n,r=o[0].label.toUpperCase()+"",c,u,h,p;function b(A,R){return A[2]?create_else_block$j:create_if_block$J}let y=b(o),k=y(o);return{c(){e=element("div"),n=element("a"),c=text(r),h=space$3(),p=element("span"),k.c(),attr(n,"class","schema-name"),attr(n,"href",u=o[3].lucentUrl+"/content/"+o[0].name),attr(p,"class","record-title"),attr(e,"class","record-header")},m(A,R){insert$1(A,e,R),append(e,n),append(n,c),append(e,h),append(e,p),k.m(p,null)},p(A,[R]){R&1&&r!==(r=A[0].label.toUpperCase()+"")&&set_data(c,r),R&1&&u!==(u=A[3].lucentUrl+"/content/"+A[0].name)&&attr(n,"href",u),y===(y=b(A))&&k?k.p(A,R):(k.d(1),k=y(A),k&&(k.c(),k.m(p,null)))},i:noop,o:noop,d(A){A&&detach(e),k.d()}}}function instance$13(o,e,n){const r=getContext$1("channel");let{schema:c}=e,{record:u}=e,{isCreateMode:h}=e;return o.$$set=p=>{"schema"in p&&n(0,c=p.schema),"record"in p&&n(1,u=p.record),"isCreateMode"in p&&n(2,h=p.isCreateMode)},[c,u,h,r]}class Title extends SvelteComponent{constructor(e){super(),init(this,e,instance$13,create_fragment$13,safe_not_equal,{schema:0,record:1,isCreateMode:2})}}function get_each_context$l(o,e,n){const r=o.slice();return r[24]=e[n],r}function create_if_block_2$b(o){let e,n,r;return{c(){e=element("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Save`,attr(e,"type","button"),attr(e,"class","button primary ms-2 btn btn-primary btn-spinner")},m(c,u){insert$1(c,e,u),n||(r=listen(e,"click",o[10]),n=!0)},p:noop,d(c){c&&detach(e),n=!1,r()}}}function create_if_block_1$n(o){let e,n,r;return{c(){e=element("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Create`,attr(e,"class","button primary btn-spinner")},m(c,u){insert$1(c,e,u),n||(r=listen(e,"click",o[10]),n=!0)},p:noop,d(c){c&&detach(e),n=!1,r()}}}function create_if_block$I(o){let e,n,r,c;function u(b){o[14](b)}function h(b){o[15](b)}let p={field:o[24],schema:o[2],record:o[0],validationErrors:o[4],isCreateMode:o[3]};return o[0].data!==void 0&&(p.data=o[0].data),o[1]!==void 0&&(p.graph=o[1]),e=new FormField({props:p}),binding_callbacks.push(()=>bind(e,"data",u)),binding_callbacks.push(()=>bind(e,"graph",h)),{c(){create_component(e.$$.fragment)},m(b,y){mount_component(e,b,y),c=!0},p(b,y){const k={};y&4&&(k.schema=b[2]),y&1&&(k.record=b[0]),y&16&&(k.validationErrors=b[4]),y&8&&(k.isCreateMode=b[3]),!n&&y&1&&(n=!0,k.data=b[0].data,add_flush_callback(()=>n=!1)),!r&&y&2&&(r=!0,k.graph=b[1],add_flush_callback(()=>r=!1)),e.$set(k)},i(b){c||(transition_in(e.$$.fragment,b),c=!0)},o(b){transition_out(e.$$.fragment,b),c=!1},d(b){destroy_component(e,b)}}}function create_each_block$l(o,e){let n,r,c,u=e[5]===e[24].group&&create_if_block$I(e);return{key:o,first:null,c(){n=empty$1(),u&&u.c(),r=empty$1(),this.first=n},m(h,p){insert$1(h,n,p),u&&u.m(h,p),insert$1(h,r,p),c=!0},p(h,p){e=h,e[5]===e[24].group?u?(u.p(e,p),p&32&&transition_in(u,1)):(u=create_if_block$I(e),u.c(),transition_in(u,1),u.m(r.parentNode,r)):u&&(group_outros(),transition_out(u,1,1,()=>{u=null}),check_outros())},i(h){c||(transition_in(u),c=!0)},o(h){transition_out(u),c=!1},d(h){h&&(detach(n),detach(r)),u&&u.d(h)}}}function create_fragment$12(o){let e,n,r,c,u,h,p,b,y,k,A,R,N,F,V,W,J,te=[],j=new Map,ae,fe,_e;function ne(Le){o[11](Le)}function Se(Le){o[12](Le)}let Ae={schema:o[2],isCreateMode:o[3]};o[0]!==void 0&&(Ae.record=o[0]),o[5]!==void 0&&(Ae.activeContentTab=o[5]),r=new EditHeader({props:Ae}),binding_callbacks.push(()=>bind(r,"record",ne)),binding_callbacks.push(()=>bind(r,"activeContentTab",Se));function Ne(Le,je){if(Le[3])return create_if_block_1$n;if(Le[6])return create_if_block_2$b}let xe=Ne(o),Oe=xe&&xe(o);b=new Title({props:{schema:o[2],record:o[0],isCreateMode:o[3]}}),k=new ErrorAlert({props:{message:o[7]}});function Ft(Le){o[13](Le)}let Qt={schema:o[2],isCreateMode:o[3]};o[5]!==void 0&&(Qt.active=o[5]),N=new ContentTabs({props:Qt}),binding_callbacks.push(()=>bind(N,"active",Ft)),W=new FilePreview({props:{record:o[0],schema:o[2]}});let St=ensure_array_like(o[8]);const q=Le=>Le[24].name;for(let Le=0;Le<St.length;Le+=1){let je=get_each_context$l(o,St,Le),mn=q(je);j.set(mn,te[Le]=create_each_block$l(mn,je))}return{c(){e=element("div"),n=element("div"),create_component(r.$$.fragment),h=space$3(),Oe&&Oe.c(),p=space$3(),create_component(b.$$.fragment),y=space$3(),create_component(k.$$.fragment),A=space$3(),R=element("div"),create_component(N.$$.fragment),V=space$3(),create_component(W.$$.fragment),J=space$3();for(let Le=0;Le<te.length;Le+=1)te[Le].c();attr(n,"class","tools-header"),attr(R,"class","mt-4"),set_style(R,"margin-bottom","150px"),set_style(R,"position","relative"),attr(e,"class","inline-edit record-edit")},m(Le,je){insert$1(Le,e,je),append(e,n),mount_component(r,n,null),append(n,h),Oe&&Oe.m(n,null),append(e,p),mount_component(b,e,null),append(e,y),mount_component(k,e,null),append(e,A),append(e,R),mount_component(N,R,null),append(R,V),mount_component(W,R,null),append(R,J);for(let mn=0;mn<te.length;mn+=1)te[mn]&&te[mn].m(R,null);ae=!0,fe||(_e=listen(window,"beforeunload",o[9]),fe=!0)},p(Le,[je]){const mn={};je&4&&(mn.schema=Le[2]),je&8&&(mn.isCreateMode=Le[3]),!c&&je&1&&(c=!0,mn.record=Le[0],add_flush_callback(()=>c=!1)),!u&&je&32&&(u=!0,mn.activeContentTab=Le[5],add_flush_callback(()=>u=!1)),r.$set(mn),xe===(xe=Ne(Le))&&Oe?Oe.p(Le,je):(Oe&&Oe.d(1),Oe=xe&&xe(Le),Oe&&(Oe.c(),Oe.m(n,null)));const Pt={};je&4&&(Pt.schema=Le[2]),je&1&&(Pt.record=Le[0]),je&8&&(Pt.isCreateMode=Le[3]),b.$set(Pt);const Ue={};je&128&&(Ue.message=Le[7]),k.$set(Ue);const ct={};je&4&&(ct.schema=Le[2]),je&8&&(ct.isCreateMode=Le[3]),!F&&je&32&&(F=!0,ct.active=Le[5],add_flush_callback(()=>F=!1)),N.$set(ct);const dn={};je&1&&(dn.record=Le[0]),je&4&&(dn.schema=Le[2]),W.$set(dn),je&319&&(St=ensure_array_like(Le[8]),group_outros(),te=update_keyed_each(te,je,q,1,Le,St,j,R,outro_and_destroy_block,create_each_block$l,null,get_each_context$l),check_outros())},i(Le){if(!ae){transition_in(r.$$.fragment,Le),transition_in(b.$$.fragment,Le),transition_in(k.$$.fragment,Le),transition_in(N.$$.fragment,Le),transition_in(W.$$.fragment,Le);for(let je=0;je<St.length;je+=1)transition_in(te[je]);ae=!0}},o(Le){transition_out(r.$$.fragment,Le),transition_out(b.$$.fragment,Le),transition_out(k.$$.fragment,Le),transition_out(N.$$.fragment,Le),transition_out(W.$$.fragment,Le);for(let je=0;je<te.length;je+=1)transition_out(te[je]);ae=!1},d(Le){Le&&detach(e),destroy_component(r),Oe&&Oe.d(),destroy_component(b),destroy_component(k),destroy_component(N),destroy_component(W);for(let je=0;je<te.length;je+=1)te[je].d();fe=!1,_e()}}}function instance$12(o,e,n){let r,c;const u=getContext$1(
Line truncated
|
||||
`,attr(e,"class","start-typing")},m(n,r){insert$1(n,e,r)},p:noop,d(n){n&&detach(e)}}}function create_each_block$k(o,e){let n,r=previewTitle(e[3].schemas,e[11])+"",c,u,h,p;function b(...k){return e[8](e[11],...k)}function y(...k){return e[9](e[11],...k)}return{key:o,first:null,c(){n=element("div"),c=text(r),u=space$3(),attr(n,"class","reference-tags-option"),attr(n,"role","button"),attr(n,"tabindex","0"),this.first=n},m(k,A){insert$1(k,n,A),append(n,c),append(n,u),h||(p=[listen(n,"click",b),listen(n,"keypress",y)],h=!0)},p(k,A){e=k,A&4&&r!==(r=previewTitle(e[3].schemas,e[11])+"")&&set_data(c,r)},d(k){k&&detach(n),h=!1,run_all(p)}}}function create_fragment$11(o){let e,n,r,c,u,h,p,b=o[2]&&create_if_block$H(o);return{c(){e=element("div"),n=element("input"),c=space$3(),u=element("div"),b&&b.c(),attr(n,"type","search"),attr(n,"placeholder",r="Search for "+o[0].label),attr(n,"autocomplete","off"),attr(u,"class","reference-tags-results"),attr(e,"class","reference-tags")},m(y,k){insert$1(y,e,k),append(e,n),set_input_value(n,o[1]),append(e,c),append(e,u),b&&b.m(u,null),h||(p=[listen(n,"keyup",o[4]),listen(n,"input",o[7])],h=!0)},p(y,[k]){k&1&&r!==(r="Search for "+y[0].label)&&attr(n,"placeholder",r),k&2&&n.value!==y[1]&&set_input_value(n,y[1]),y[2]?b?b.p(y,k):(b=create_if_block$H(y),b.c(),b.m(u,null)):b&&(b.d(1),b=null)},i:noop,o:noop,d(y){y&&detach(e),b&&b.d(),h=!1,run_all(p)}}}function instance$11(o,e,n){let r;const c=getContext$1("channel"),u=createEventDispatcher();let{value:h=""}=e,{field:p}=e,b="";const y=lodashExports.debounce(F=>{axios.get(c.lucentUrl+"/records/suggestions",{params:{schema:p.collections[0],field:"search",value:b,ui:"search"}}).then(V=>{n(2,r=V.data)}).catch(V=>{n(2,r=[]),console.log(V)})},500);function k(F,V){F.preventDefault(),n(6,h=V.id),u("addFilter"),n(6,h="")}function A(){b=this.value,n(1,b)}const R=(F,V)=>k(V,F),N=(F,V)=>k(V,F);return o.$$set=F=>{"value"in F&&n(6,h=F.value),"field"in F&&n(0,p=F.field)},n(2,r=[]),[p,b,r,c,y,k,h,A,R,N]}class FilterReferenceInput extends SvelteComponent{constructor(e){super(),init(this,e,instance$11,create_fragment$11,safe_not_equal,{value:6,field:0})}}function get_each_context$j(o,e,n){const r=o.slice();return r[38]=e[n],r}function get_each_context_1$6(o,e,n){const r=o.slice();return r[41]=e[n],r}function get_each_context_2$2(o,e,n){const r=o.slice();return r[38]=e[n],r}function create_if_block_4$5(o){let e,n,r,c,u,h,p,b;n=new Icon({props:{icon:"arrow-left"}});let y=ensure_array_like(o[9]),k=[];for(let A=0;A<y.length;A+=1)k[A]=create_each_block_2$2(get_each_context_2$2(o,y,A));return{c(){e=element("button"),create_component(n.$$.fragment),r=text(`
|
||||
Back`),c=space$3();for(let A=0;A<k.length;A+=1)k[A].c();u=empty$1(),attr(e,"class","dropdown-item button")},m(A,R){insert$1(A,e,R),mount_component(n,e,null),append(e,r),insert$1(A,c,R);for(let N=0;N<k.length;N+=1)k[N]&&k[N].m(A,R);insert$1(A,u,R),h=!0,p||(b=listen(e,"click",o[22]),p=!0)},p(A,R){if(R[0]&2560){y=ensure_array_like(A[9]);let N;for(N=0;N<y.length;N+=1){const F=get_each_context_2$2(A,y,N);k[N]?k[N].p(F,R):(k[N]=create_each_block_2$2(F),k[N].c(),k[N].m(u.parentNode,u))}for(;N<k.length;N+=1)k[N].d(1);k.length=y.length}},i(A){h||(transition_in(n.$$.fragment,A),h=!0)},o(A){transition_out(n.$$.fragment,A),h=!1},d(A){A&&(detach(e),detach(c),detach(u)),destroy_component(n),destroy_each(k,A),p=!1,b()}}}function create_each_block_2$2(o){let e,n,r;function c(...u){return o[23](o[38],...u)}return{c(){e=element("button"),e.textContent=`${o[38].label} `,attr(e,"class","dropdown-item button")},m(u,h){insert$1(u,e,h),n||(r=listen(e,"click",c),n=!0)},p(u,h){o=u},d(u){u&&detach(e),n=!1,r()}}}function create_if_block_3$8(o){let e,n,r,c,u,h,p=o[3].label+"",b,y,k,A,R,N;n=new Icon({props:{icon:"arrow-left"}});let F=ensure_array_like(o[7]),V=[];for(let W=0;W<F.length;W+=1)V[W]=create_each_block_1$6(get_each_context_1$6(o,F,W));return{c(){e=element("button"),create_component(n.$$.fragment),r=text(`
|
||||
Back`),c=space$3(),u=element("div"),h=text("field: "),b=text(p),y=space$3();for(let W=0;W<V.length;W+=1)V[W].c();k=empty$1(),attr(e,"class","dropdown-item button"),attr(u,"class","selected-filter")},m(W,J){insert$1(W,e,J),mount_component(n,e,null),append(e,r),insert$1(W,c,J),insert$1(W,u,J),append(u,h),append(u,b),insert$1(W,y,J);for(let te=0;te<V.length;te+=1)V[te]&&V[te].m(W,J);insert$1(W,k,J),A=!0,R||(N=listen(e,"click",o[24]),R=!0)},p(W,J){if((!A||J[0]&8)&&p!==(p=W[3].label+"")&&set_data(b,p),J[0]&160){F=ensure_array_like(W[7]);let te;for(te=0;te<F.length;te+=1){const j=get_each_context_1$6(W,F,te);V[te]?V[te].p(j,J):(V[te]=create_each_block_1$6(j),V[te].c(),V[te].m(k.parentNode,k))}for(;te<V.length;te+=1)V[te].d(1);V.length=F.length}},i(W){A||(transition_in(n.$$.fragment,W),A=!0)},o(W){transition_out(n.$$.fragment,W),A=!1},d(W){W&&(detach(e),detach(c),detach(u),detach(y),detach(k)),destroy_component(n),destroy_each(V,W),R=!1,N()}}}function create_each_block_1$6(o){let e,n=o[41].label+"",r,c,u,h;function p(...b){return o[25](o[41],...b)}return{c(){e=element("button"),r=text(n),c=space$3(),attr(e,"class","dropdown-item button")},m(b,y){insert$1(b,e,y),append(e,r),append(e,c),u||(h=listen(e,"click",p),u=!0)},p(b,y){o=b,y[0]&128&&n!==(n=o[41].label+"")&&set_data(r,n)},d(b){b&&detach(e),u=!1,h()}}}function create_if_block_2$a(o){let e,n,r,c,u,h,p=o[3].label+"",b,y,k=o[5].label+"",A,R,N,F,V,W,J,te,j;return n=new Icon({props:{icon:"arrow-left"}}),{c(){e=element("button"),create_component(n.$$.fragment),r=text(`
|
||||
Back`),c=space$3(),u=element("div"),h=text("field: "),b=text(p),y=text(" operator: "),A=text(k),R=space$3(),N=element("div"),F=element("input"),V=space$3(),W=element("button"),W.textContent="Add filter",attr(e,"class","dropdown-item button"),attr(u,"class","selected-filter"),attr(F,"type","text"),attr(F,"class","form-control"),attr(N,"class","filter-input"),attr(W,"class","button applied-filter"),attr(W,"type","button")},m(ae,fe){insert$1(ae,e,fe),mount_component(n,e,null),append(e,r),insert$1(ae,c,fe),insert$1(ae,u,fe),append(u,h),append(u,b),append(u,y),append(u,A),insert$1(ae,R,fe),insert$1(ae,N,fe),append(N,F),set_input_value(F,o[2]),insert$1(ae,V,fe),insert$1(ae,W,fe),J=!0,te||(j=[listen(e,"click",o[26]),listen(F,"input",o[27]),listen(W,"click",o[13])],te=!0)},p(ae,fe){(!J||fe[0]&8)&&p!==(p=ae[3].label+"")&&set_data(b,p),(!J||fe[0]&32)&&k!==(k=ae[5].label+"")&&set_data(A,k),fe[0]&4&&F.value!==ae[2]&&set_input_value(F,ae[2])},i(ae){J||(transition_in(n.$$.fragment,ae),J=!0)},o(ae){transition_out(n.$$.fragment,ae),J=!1},d(ae){ae&&(detach(e),detach(c),detach(u),detach(R),detach(N),detach(V),detach(W)),destroy_component(n),te=!1,run_all(j)}}}function create_if_block_1$m(o){let e,n,r,c,u,h,p,b;n=new Icon({props:{icon:"arrow-left"}});let y=ensure_array_like(o[10]),k=[];for(let A=0;A<y.length;A+=1)k[A]=create_each_block$j(get_each_context$j(o,y,A));return{c(){e=element("button"),create_component(n.$$.fragment),r=text(`
|
||||
Back`),c=space$3();for(let A=0;A<k.length;A+=1)k[A].c();u=empty$1(),attr(e,"class","dropdown-item button")},m(A,R){insert$1(A,e,R),mount_component(n,e,null),append(e,r),insert$1(A,c,R);for(let N=0;N<k.length;N+=1)k[N]&&k[N].m(A,R);insert$1(A,u,R),h=!0,p||(b=listen(e,"click",o[28]),p=!0)},p(A,R){if(R[0]&5120){y=ensure_array_like(A[10]);let N;for(N=0;N<y.length;N+=1){const F=get_each_context$j(A,y,N);k[N]?k[N].p(F,R):(k[N]=create_each_block$j(F),k[N].c(),k[N].m(u.parentNode,u))}for(;N<k.length;N+=1)k[N].d(1);k.length=y.length}},i(A){h||(transition_in(n.$$.fragment,A),h=!0)},o(A){transition_out(n.$$.fragment,A),h=!1},d(A){A&&(detach(e),detach(c),detach(u)),destroy_component(n),destroy_each(k,A),p=!1,b()}}}function create_each_block$j(o){let e,n,r;function c(...u){return o[29](o[38],...u)}return{c(){e=element("button"),e.textContent=`${o[38].label} `,attr(e,"class","dropdown-item button")},m(u,h){insert$1(u,e,h),n||(r=listen(e,"click",c),n=!0)},p(u,h){o=u},d(u){u&&detach(e),n=!1,r()}}}function create_if_block$G(o){let e,n,r,c,u,h,p=o[4].label+"",b,y,k,A,R,N,F,V;n=new Icon({props:{icon:"arrow-left"}});function W(te){o[31](te)}let J={field:o[4]};return o[2]!==void 0&&(J.value=o[2]),A=new FilterReferenceInput({props:J}),binding_callbacks.push(()=>bind(A,"value",W)),A.$on("addFilter",o[13]),{c(){e=element("button"),create_component(n.$$.fragment),r=text(`
|
||||
Back`),c=space$3(),u=element("div"),h=text("field: "),b=text(p),y=space$3(),k=element("div"),create_component(A.$$.fragment),attr(e,"class","dropdown-item button"),attr(u,"class","selected-filter"),attr(k,"class","mt-2")},m(te,j){insert$1(te,e,j),mount_component(n,e,null),append(e,r),insert$1(te,c,j),insert$1(te,u,j),append(u,h),append(u,b),insert$1(te,y,j),insert$1(te,k,j),mount_component(A,k,null),N=!0,F||(V=listen(e,"click",o[30]),F=!0)},p(te,j){(!N||j[0]&16)&&p!==(p=te[4].label+"")&&set_data(b,p);const ae={};j[0]&16&&(ae.field=te[4]),!R&&j[0]&4&&(R=!0,ae.value=te[2],add_flush_callback(()=>R=!1)),A.$set(ae)},i(te){N||(transition_in(n.$$.fragment,te),transition_in(A.$$.fragment,te),N=!0)},o(te){transition_out(n.$$.fragment,te),transition_out(A.$$.fragment,te),N=!1},d(te){te&&(detach(e),detach(c),detach(u),detach(y),detach(k)),destroy_component(n),destroy_component(A),F=!1,V()}}}function create_default_slot$7(o){let e,n,r,c,u,h,p,b,y,k,A,R,N,F,V,W,J,te,j,ae,fe,_e,ne,Se,Ae,Ne,xe=!o[3]&&create_if_block_4$5(o),Oe=o[3]&&!o[5]&&create_if_block_3$8(o),Ft=o[3]&&o[5]&&create_if_block_2$a(o),Qt=!o[4]&&create_if_block_1$m(o),St=o[4]&&create_if_block$G(o);return J=new Icon({props:{icon:"arrow-left"}}),{c(){e=element("div"),n=element("button"),n.textContent="Filter by field",r=space$3(),c=element("button"),c.textContent="Filter by Reference",u=space$3(),h=element("button"),h.textContent="Advanced filter",p=space$3(),b=element("div"),xe&&xe.c(),y=space$3(),Oe&&Oe.c(),k=space$3(),Ft&&Ft.c(),A=space$3(),R=element("div"),Qt&&Qt.c(),N=space$3(),St&&St.c(),F=space$3(),V=element("div"),W=element("button"),create_component(J.$$.fragment),te=text(`
|
||||
Back`),j=space$3(),ae=element("form"),fe=element("input"),_e=space$3(),ne=element("button"),ne.textContent="Submit",attr(n,"class","dropdown-item button"),attr(c,"class","dropdown-item button"),attr(h,"class","dropdown-item button"),toggle_class(e,"hide",o[6]!=="main"),toggle_class(b,"hide",o[6]!=="byField"),toggle_class(R,"hide",o[6]!=="byReference"),attr(W,"class","dropdown-item button"),attr(fe,"type","search"),attr(fe,"class","mb-2 mt-2"),attr(fe,"placeholder","Advanced filters"),fe.required=!0,attr(ne,"class","button applied-filter"),toggle_class(V,"hide",o[6]!=="advanced")},m(q,Le){insert$1(q,e,Le),append(e,n),append(e,r),append(e,c),append(e,u),append(e,h),insert$1(q,p,Le),insert$1(q,b,Le),xe&&xe.m(b,null),append(b,y),Oe&&Oe.m(b,null),append(b,k),Ft&&Ft.m(b,null),insert$1(q,A,Le),insert$1(q,R,Le),Qt&&Qt.m(R,null),append(R,N),St&&St.m(R,null),insert$1(q,F,Le),insert$1(q,V,Le),append(V,W),mount_component(J,W,null),append(W,te),append(V,j),append(V,ae),append(ae,fe),set_input_value(fe,o[1]),append(ae,_e),append(ae,ne),Se=!0,Ae||(Ne=[listen(n,"click",o[19]),listen(c,"click",o[20]),listen(h,"click",o[21]),listen(W,"click",o[32]),listen(fe,"input",o[33]),listen(ae,"submit",o[8])],Ae=!0)},p(q,Le){(!Se||Le[0]&64)&&toggle_class(e,"hide",q[6]!=="main"),q[3]?xe&&(group_outros(),transition_out(xe,1,1,()=>{xe=null}),check_outros()):xe?(xe.p(q,Le),Le[0]&8&&transition_in(xe,1)):(xe=create_if_block_4$5(q),xe.c(),transition_in(xe,1),xe.m(b,y)),q[3]&&!q[5]?Oe?(Oe.p(q,Le),Le[0]&40&&transition_in(Oe,1)):(Oe=create_if_block_3$8(q),Oe.c(),transition_in(Oe,1),Oe.m(b,k)):Oe&&(group_outros(),transition_out(Oe,1,1,()=>{Oe=null}),check_outros()),q[3]&&q[5]?Ft?(Ft.p(q,Le),Le[0]&40&&transition_in(Ft,1)):(Ft=create_if_block_2$a(q),Ft.c(),transition_in(Ft,1),Ft.m(b,null)):Ft&&(group_outros(),transition_out(Ft,1,1,()=>{Ft=null}),check_outros()),(!Se||Le[0]&64)&&toggle_class(b,"hide",q[6]!=="byField"),q[4]?Qt&&(group_outros(),transition_out(Qt,1,1,()=>{Qt=null}),check_outros()):Qt?(Qt.p(q,Le),Le[0]&16&&transition_in(Qt,1)):(Qt=create_if_block_1$m(q),Qt.c(),transition_in(Qt,1),Qt.m(R,N)),q[4]?St?(St.p(q,Le),Le[0]&16&&transition_in(St,1)):(St=create_if_block$G(q),St.c(),transition_in(St,1),St.m(R,null)):St&&(group_outros(),transition_out(St,1,1,()=>{St=null}),check_outros()),(!Se||Le[0]&64)&&toggle_class(R,"hide",q[6]!=="byReference"),Le[0]&2&&fe.value!==q[1]&&set_input_value(fe,q[1]),(!Se||Le[0]&64)&&toggle_class(V,"hide",q[6]!=="advanced")},i(q){Se||(transition_in(xe),transition_in(Oe),transition_in(Ft),transition_in(Qt),transition_in(St),transition_in(J.$$.fragment,q),Se=!0)},o(q){transition_out(xe),transition_out(Oe),transition_out(Ft),transition_out(Qt),transition_out(St),transition_out(J.$$.fragment,q),Se=!1},d(q){q&&(detach(e),detach(p),detach(b),detach(A),detach(R),detach(F),detach(V)),xe&&xe.d(),Oe&&Oe.d(),Ft&&Ft.d(),Qt&&Qt.d(),St&&St.d(),destroy_component(J),Ae=!1,run_all(Ne)}}}function create_button_slot$6(o){let e,n,r,c,u;return n=new Icon({props:{icon:"filter"}}),{c(){e=element("div"),create_component(n.$$.fragment),r=space$3(),c=element("span"),c.textContent="Filter",attr(c,"class","ms-1"),attr(e,"slot","button")},m(h,p){insert$1(h,e,p),mount_component(n,e,null),append(e,r),append(e,c),u=!0},p:noop,i(h){u||(transition_in(n.$$.fragment,h),u=!0)},o(h){transition_out(n.$$.fragment,h),u=!1},d(h){h&&detach(e),destroy_component(n)}}}function create_fragment$10(o){let e,n,r,c={$$slots:{button:[create_button_slot$6],default:[create_default_slot$7]},$$scope:{ctx:o}};return n=new Dropdown({props:c}),o[34](n),{c(){e=element("div"),create_component(n.$$.fragment)},m(u,h){insert$1(u,e,h),mount_component(n,e,null),r=!0},p(u,h){const p={};h[0]&254|h[1]&32768&&(p.$$scope={dirty:h,ctx:u}),n.$set(p)},i(u){r||(transition_in(n.$$.fragment,u),r=!0)},o(u){transition_out(n.$$.fragment,u),r=!1},d(u){u&&detach(e),o[34](null),destroy_component(n)}}}function instance$10(o,e,n){const r=createEventDispatcher();let{schema:c}=e,{systemFields:u=[]}=e,{operators:h}=e,{inModal:p}=e,{modalUrl:b}=e,y,k="",A=u;c.type==="collection"&&(A=u.filter(rn=>rn.files===!1));function R(rn){rn.preventDefault();let Fe=k.split("=")[0]??"";if(!Fe)return;let mt=`filter[${Fe}]`,de=k.split("=")[1]??"";if(!de)return;const Eo=new URL(b??window.location.href);Eo.searchParams.set("skip","0"),Eo.searchParams.set(mt,de),p?r("refresh",Eo):window.location.replace(Eo),Se()}let N=null,F=null,V=null,W=null,J="main",te=null,j=[...c.fields,...A].filter(rn=>{var Fe;return!["file","json","reference"].includes(((Fe=rn.info)==null?void 0:Fe.name)??rn.ui)}),ae=[...c.fields].filter(rn=>{var Fe;return["reference"].includes(((Fe=rn.info)==null?void 0:Fe.name)??rn.ui)});function fe(rn,Fe){n(3,F=Fe),n(7,te=h.filter(mt=>{var de;return mt.uis.includes((de=F==null?void 0:F.info)==null?void 0:de.name)||mt.uis[0]==="*"}))}function _e(rn,Fe){n(4,V=Fe),n(5,W=h.find(mt=>mt.name==="eq"))}function ne(rn){rn.preventDefault();let Fe="",mt,de=F??V;c.fields.find(jn=>jn.name===de.name)&&(de.info
Line truncated
|
||||
Upload file
|
||||
|
||||
`),u=element("input"),attr(r,"class","spinner-border spinner-border-sm"),attr(r,"role","status"),attr(r,"aria-hidden","true"),attr(u,"class","form-control"),attr(u,"type","file"),attr(u,"id","formFile"),u.multiple=!0,attr(u,"accept",mimeTypes),u.disabled=o[0],u.hidden=!0,attr(n,"class","button primary btn-spinner "),attr(e,"class","upload-button"),e.disabled=o[0]},m(b,y){insert$1(b,e,y),append(e,n),append(n,r),append(n,c),append(n,u),h||(p=listen(u,"input",o[1]),h=!0)},p(b,[y]){y&1&&(u.disabled=b[0]),y&1&&(e.disabled=b[0])},i:noop,o:noop,d(b){b&&detach(e),h=!1,p()}}}let mimeTypes="";function instance$$(o,e,n){const r=createEventDispatcher(),c=getContext$1("channel");let{schema:u}=e,h=[],p=!1;function b(y){n(0,p=!0),h=y.target.files?[...y.target.files]:[];let k=new FormData;k.append("schema",u.name),Array.from(h).forEach(function(A){k.append("files[]",A)}),r("beforeUpload",h),axios.post(c.lucentUrl+"/files/upload",k,{headers:{"Content-Type":"multipart/form-data"}}).then(A=>{A.data.error?r("uploadError",A.data.error):r("uploadComplete",A.data),n(0,p=!1)}).catch(A=>{n(0,p=!1),console.log(A.response.data)})}return o.$$set=y=>{"schema"in y&&n(2,u=y.schema)},[p,b,u]}class Uploader extends SvelteComponent{constructor(e){super(),init(this,e,instance$$,create_fragment$$,safe_not_equal,{schema:2})}}function get_each_context$i(o,e,n){const r=o.slice();return r[18]=e[n],r}function get_each_context_1$5(o,e,n){const r=o.slice();return r[18]=e[n],r}function create_each_block_1$5(o){let e,n,r,c,u,h,p,b,y,k,A=o[18].label+"",R,N,F,V;r=new Icon({props:{icon:"arrow-up-short-wide"}});function W(...j){return o[10](o[18],...j)}p=new Icon({props:{icon:"arrow-down-wide-short"}});function J(...j){return o[11](o[18],...j)}function te(...j){return o[12](o[18],...j)}return{c(){e=element("div"),n=element("button"),create_component(r.$$.fragment),u=space$3(),h=element("button"),create_component(p.$$.fragment),y=space$3(),k=element("button"),R=text(A),attr(n,"title","Sort Ascending"),attr(n,"class",c="button button-icon "+(o[18].name==o[1].name&&!o[0].startsWith("-")?"active":"")),attr(h,"title","Sort Descending"),attr(h,"class",b="button button-icon "+(o[18].name==o[1].name&&o[0].startsWith("-")?"active":"")),attr(k,"title","Sort Ascending"),attr(k,"class","button"),attr(e,"class","dropdown-item")},m(j,ae){insert$1(j,e,ae),append(e,n),mount_component(r,n,null),append(e,u),append(e,h),mount_component(p,h,null),append(e,y),append(e,k),append(k,R),N=!0,F||(V=[listen(n,"click",W),listen(h,"click",J),listen(k,"click",te)],F=!0)},p(j,ae){o=j,(!N||ae&11&&c!==(c="button button-icon "+(o[18].name==o[1].name&&!o[0].startsWith("-")?"active":"")))&&attr(n,"class",c),(!N||ae&11&&b!==(b="button button-icon "+(o[18].name==o[1].name&&o[0].startsWith("-")?"active":"")))&&attr(h,"class",b),(!N||ae&8)&&A!==(A=o[18].label+"")&&set_data(R,A)},i(j){N||(transition_in(r.$$.fragment,j),transition_in(p.$$.fragment,j),N=!0)},o(j){transition_out(r.$$.fragment,j),transition_out(p.$$.fragment,j),N=!1},d(j){j&&detach(e),destroy_component(r),destroy_component(p),F=!1,run_all(V)}}}function create_each_block$i(o){let e,n,r,c,u,h,p,b,y,k,A=o[18].label+"",R,N,F,V,W;r=new Icon({props:{icon:"arrow-up-short-wide"}});function J(...ae){return o[13](o[18],...ae)}p=new Icon({props:{icon:"arrow-down-wide-short"}});function te(...ae){return o[14](o[18],...ae)}function j(...ae){return o[15](o[18],...ae)}return{c(){e=element("div"),n=element("button"),create_component(r.$$.fragment),u=space$3(),h=element("button"),create_component(p.$$.fragment),y=space$3(),k=element("button"),R=text(A),N=space$3(),attr(n,"title","Sort Ascending"),attr(n,"class",c="button button-icon "+(o[18].name==o[0]?"active":"")),attr(h,"title","Sort Descending"),attr(h,"class",b="button button-icon "+("-"+o[18].name==o[0]?"active":"")),attr(k,"title","Sort Ascending"),attr(k,"class","button"),attr(e,"class","dropdown-item")},m(ae,fe){insert$1(ae,e,fe),append(e,n),mount_component(r,n,null),append(e,u),append(e,h),mount_component(p,h,null),append(e,y),append(e,k),append(k,R),append(e,N),F=!0,V||(W=[listen(n,"click",J),listen(h,"click",te),listen(k,"click",j)],V=!0)},p(ae,fe){o=ae,(!F||fe&5&&c!==(c="button button-icon "+(o[18].name==o[0]?"active":"")))&&attr(n,"class",c),(!F||fe&5&&b!==(b="button button-icon "+("-"+o[18].name==o[0]?"active":"")))&&attr(h,"class",b),(!F||fe&4)&&A!==(A=o[18].label+"")&&set_data(R,A)},i(ae){F||(transition_in(r.$$.fragment,ae),transition_in(p.$$.fragment,ae),F=!0)},o(ae){transition_out(r.$$.fragment,ae),transition_out(p.$$.fragment,ae),F=!1},d(ae){ae&&detach(e),destroy_component(r),destroy_component(p),V=!1,run_all(W)}}}function create_default_slot$6(o){let e,n,r,c,u,h=ensure_array_like(o[3]),p=[];for(let R=0;R<h.length;R+=1)p[R]=create_each_block_1$5(get_each_context_1$5(o,h,R));const b=R=>transition_out(p[R],1,1,()=>{p[R]=null});let y=ensure_array_like(o[2]),k=[];for(let R=0;R<y.length;R+=1)k[R]=create_each_block$i(get_each_context$i(o,y,R));const A=R=>transition_out(k[R],1,
Line truncated
|
||||
|
||||
`),r=element("button"),create_component(c.$$.fragment),attr(r,"type","button"),attr(r,"class","button-text"),attr(r,"aria-label","Close"),attr(e,"class","applied-filter")},m(b,y){insert$1(b,e,y),append(e,n),append(e,r),mount_component(c,r,null),u=!0,h||(p=listen(r,"click",prevent_default(o[4])),h=!0)},p:noop,i(b){u||(transition_in(c.$$.fragment,b),u=!0)},o(b){transition_out(c.$$.fragment,b),u=!1},d(b){b&&detach(e),destroy_component(c),h=!1,p()}}}function create_fragment$Y(o){let e=o[0].searchParams.get("notlinked"),n,r,c=e&&create_if_block$D(o);return{c(){c&&c.c(),n=empty$1()},m(u,h){c&&c.m(u,h),insert$1(u,n,h),r=!0},p(u,[h]){e&&c.p(u,h)},i(u){r||(transition_in(c),r=!0)},o(u){transition_out(c),r=!1},d(u){u&&detach(n),c&&c.d(u)}}}function instance$Y(o,e,n){getContext$1("channel");const r=createEventDispatcher();let{inModal:c}=e,{modalUrl:u}=e;const h=new URL(u??window.location.href);function p(y){const k=new URL(u??window.location.href);k.searchParams.set("skip","0"),k.searchParams.delete("notlinked"),c?r("refresh",k):window.location.replace(k)}const b=()=>p();return o.$$set=y=>{"inModal"in y&&n(2,c=y.inModal),"modalUrl"in y&&n(3,u=y.modalUrl)},[h,p,c,u,b]}class AppliedFilterNotLinked extends SvelteComponent{constructor(e){super(),init(this,e,instance$Y,create_fragment$Y,safe_not_equal,{inModal:2,modalUrl:3})}}function get_each_context$h(o,e,n){const r=o.slice();return r[22]=e[n][0],r[23]=e[n][1],r}function create_else_block_1$2(o){let e,n,r;return n=new Uploader({props:{schema:o[0]}}),n.$on("uploadComplete",o[13]),{c(){e=element("div"),create_component(n.$$.fragment)},m(c,u){insert$1(c,e,u),mount_component(n,e,null),r=!0},p(c,u){const h={};u&1&&(h.schema=c[0]),n.$set(h)},i(c){r||(transition_in(n.$$.fragment,c),r=!0)},o(c){transition_out(n.$$.fragment,c),r=!1},d(c){c&&detach(e),destroy_component(n)}}}function create_if_block_4$4(o){let e,n=!o[5]&&o[7]&&create_if_block_5$2(o);return{c(){n&&n.c(),e=empty$1()},m(r,c){n&&n.m(r,c),insert$1(r,e,c)},p(r,c){!r[5]&&r[7]?n?n.p(r,c):(n=create_if_block_5$2(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:noop,o:noop,d(r){r&&detach(e),n&&n.d(r)}}}function create_if_block_5$2(o){let e,n,r;return{c(){e=element("a"),n=text("New Record"),attr(e,"href",r=o[10].lucentUrl+"/records/new?schema="+o[0].name),attr(e,"class","button")},m(c,u){insert$1(c,e,u),append(e,n)},p(c,u){u&1&&r!==(r=c[10].lucentUrl+"/records/new?schema="+c[0].name)&&attr(e,"href",r)},d(c){c&&detach(e)}}}function create_if_block_1$l(o){let e,n;return e=new Dropdown({props:{orientation:"right",$$slots:{button:[create_button_slot$4],default:[create_default_slot$5]},$$scope:{ctx:o}}}),{c(){create_component(e.$$.fragment)},m(r,c){mount_component(e,r,c),n=!0},p(r,c){const u={};c&67109009&&(u.$$scope={dirty:c,ctx:r}),e.$set(u)},i(r){n||(transition_in(e.$$.fragment,r),n=!0)},o(r){transition_out(e.$$.fragment,r),n=!1},d(r){destroy_component(e,r)}}}function create_else_block$f(o){let e,n,r,c,u,h,p,b,y,k;return{c(){e=element("a"),n=text("Export to CSV"),r=space$3(),c=element("a"),u=text("View trashed records"),p=space$3(),b=element("a"),y=text("View unlinked records"),attr(e,"class","dropdown-item"),attr(e,"href",o[11]),attr(c,"class","dropdown-item"),attr(c,"href",h=o[10].lucentUrl+"/content/"+o[0].name+"?filter[status_in]=trashed"),attr(b,"class","dropdown-item"),attr(b,"href",k=o[10].lucentUrl+"/content/"+o[0].name+"?notlinked=*")},m(A,R){insert$1(A,e,R),append(e,n),insert$1(A,r,R),insert$1(A,c,R),append(c,u),insert$1(A,p,R),insert$1(A,b,R),append(b,y)},p(A,R){R&1&&h!==(h=A[10].lucentUrl+"/content/"+A[0].name+"?filter[status_in]=trashed")&&attr(c,"href",h),R&1&&k!==(k=A[10].lucentUrl+"/content/"+A[0].name+"?notlinked=*")&&attr(b,"href",k)},d(A){A&&(detach(e),detach(r),detach(c),detach(p),detach(b))}}}function create_if_block_2$9(o){let e,n=o[7]&&create_if_block_3$7(o);return{c(){n&&n.c(),e=empty$1()},m(r,c){n&&n.m(r,c),insert$1(r,e,c)},p(r,c){r[7]?n?n.p(r,c):(n=create_if_block_3$7(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(r){r&&detach(e),n&&n.d(r)}}}function create_if_block_3$7(o){let e,n,r;return{c(){e=element("a"),n=text("Empty trash"),attr(e,"class","dropdown-item"),attr(e,"href",r=o[10].lucentUrl+"/content/"+o[0].name+"/emptyTrash")},m(c,u){insert$1(c,e,u),append(e,n)},p(c,u){u&1&&r!==(r=c[10].lucentUrl+"/content/"+c[0].name+"/emptyTrash")&&attr(e,"href",r)},d(c){c&&detach(e)}}}function create_default_slot$5(o){let e;function n(u,h){return u[4].status_in==="trashed"?create_if_block_2$9:create_else_block$f}let r=n(o),c=r(o);return{c(){c.c(),e=empty$1()},m(u,h){c.m(u,h),insert$1(u,e,h)},p(u,h){r===(r=n(u))&&c?c.p(u,h):(c.d(1),c=r(u),c&&(c.c(),c.m(e.parentNode,e)))},d(u){u&&detach(e),c.d(u)}}}function create_button_slot$4(o){let e,n,r;return n=new Icon({props:{icon:"ellipsis-vertical"}}),{c(){e=element("div"),create_component(n.$$.fragment),attr(e,"slot","button")},m(c,u){insert$1(c,e,u),mount_component(n,e,null),r=!0},p:noop,i(c){r||(transition_in(n.$$.fragment,c),r=!0)},o(c){transition_out(n.
Line truncated
|
||||
`),h=element("span"),b=text(p),y=text(`
|
||||
to
|
||||
`),k=element("span"),R=text(A),N=text(`
|
||||
of
|
||||
`),F=element("span"),V=text(o[4]),W=text(`
|
||||
total`),attr(n,"class","pagination"),attr(h,"class","font-medium"),attr(k,"class","font-medium"),attr(F,"class","font-medium"),set_style(c,"display","flex"),set_style(c,"justify-content","center"),set_style(c,"gap","4px")},m(j,ae){insert$1(j,e,ae),append(e,n),te&&te.m(n,null),insert$1(j,r,ae),insert$1(j,c,ae),append(c,u),append(c,h),append(h,b),append(c,y),append(c,k),append(k,R),append(c,N),append(c,F),append(F,V),append(c,W),J=!0},p(j,[ae]){j[5]>1?te?(te.p(j,ae),ae&32&&transition_in(te,1)):(te=create_if_block$A(j),te.c(),transition_in(te,1),te.m(n,null)):te&&(group_outros(),transition_out(te,1,1,()=>{te=null}),check_outros()),(!J||ae&8)&&p!==(p=+j[3]+1+"")&&set_data(b,p),(!J||ae&28)&&A!==(A=(+j[3]+j[2]>j[4]?j[4]:+j[3]+j[2])+"")&&set_data(R,A),(!J||ae&16)&&set_data(V,j[4])},i(j){J||(transition_in(te),J=!0)},o(j){transition_out(te),J=!1},d(j){j&&(detach(e),detach(r),detach(c)),te&&te.d()}}}function instance$V(o,e,n){let r,c,u;const h=createEventDispatcher();let{inModal:p}=e,{modalUrl:b}=e,{limit:y}=e,{skip:k}=e,{total:A}=e;function R(W){W.preventDefault(),F(r)}function N(W){W.preventDefault(),F(1)}function F(W){const J=new URL(b??window.location.href);let te=W*y-y;J.searchParams.set("skip",te),p?h("refresh",J):window.location=J}function V(W){bubble.call(this,o,W)}return o.$$set=W=>{"inModal"in W&&n(0,p=W.inModal),"modalUrl"in W&&n(1,b=W.modalUrl),"limit"in W&&n(2,y=W.limit),"skip"in W&&n(3,k=W.skip),"total"in W&&n(4,A=W.total)},o.$$.update=()=>{o.$$.dirty&20&&n(5,r=Math.ceil(A/y)),o.$$.dirty&12&&n(6,c=Math.ceil((k-1)/y)+1),o.$$.dirty&96&&n(7,u=lodashExports.range(c-3,c+4).filter(W=>W>0&&W<=r))},[p,b,y,k,A,r,c,u,R,N,V]}class Pagination extends SvelteComponent{constructor(e){super(),init(this,e,instance$V,create_fragment$V,safe_not_equal,{inModal:0,modalUrl:1,limit:2,skip:3,total:4})}}function create_else_block$d(o){let e,n,r;return{c(){e=element("button"),e.textContent="Move to trash",attr(e,"type","button"),attr(e,"class","button")},m(c,u){insert$1(c,e,u),n||(r=listen(e,"click",prevent_default(o[9])),n=!0)},p:noop,d(c){c&&detach(e),n=!1,r()}}}function create_if_block$z(o){let e,n,r,c,u,h,p=o[1].hasDrafts&&create_if_block_1$k(o);return{c(){e=element("button"),e.textContent="Publish",n=space$3(),p&&p.c(),r=space$3(),c=element("button"),c.textContent="Delete forever",attr(e,"type","button"),attr(e,"class","button"),attr(c,"type","button"),attr(c,"class","button")},m(b,y){insert$1(b,e,y),insert$1(b,n,y),p&&p.m(b,y),insert$1(b,r,y),insert$1(b,c,y),u||(h=[listen(e,"click",prevent_default(o[7])),listen(c,"click",prevent_default(o[3]))],u=!0)},p(b,y){b[1].hasDrafts?p?p.p(b,y):(p=create_if_block_1$k(b),p.c(),p.m(r.parentNode,r)):p&&(p.d(1),p=null)},d(b){b&&(detach(e),detach(n),detach(r),detach(c)),p&&p.d(b),u=!1,run_all(h)}}}function create_if_block_1$k(o){let e,n,r;return{c(){e=element("button"),e.textContent="Make Draft",attr(e,"type","button"),attr(e,"class","button")},m(c,u){insert$1(c,e,u),n||(r=listen(e,"click",prevent_default(o[8])),n=!0)},p:noop,d(c){c&&detach(e),n=!1,r()}}}function create_fragment$U(o){let e,n,r=o[0].length+"",c,u,h,p,b,y,k,A,R;function N(W,J){return W[2].status_in==="trashed"?create_if_block$z:create_else_block$d}let F=N(o),V=F(o);return{c(){e=element("div"),n=element("span"),c=text(r),u=text(" records selected"),h=space$3(),p=element("button"),p.textContent="Publish",b=space$3(),y=element("button"),y.textContent="Make Draft",k=space$3(),V.c(),attr(n,"class","me-2"),attr(p,"type","button"),attr(p,"class","button"),attr(y,"type","button"),attr(y,"class","button"),set_style(e,"display","flex"),set_style(e,"align-items","center"),set_style(e,"gap","8px")},m(W,J){insert$1(W,e,J),append(e,n),append(n,c),append(n,u),append(e,h),append(e,p),append(e,b),append(e,y),append(e,k),V.m(e,null),A||(R=[listen(p,"click",prevent_default(o[5])),listen(y,"click",prevent_default(o[6]))],A=!0)},p(W,[J]){J&1&&r!==(r=W[0].length+"")&&set_data(c,r),F===(F=N(W))&&V?V.p(W,J):(V.d(1),V=F(W),V&&(V.c(),V.m(e,null)))},i:noop,o:noop,d(W){W&&detach(e),V.d(),A=!1,run_all(R)}}}function instance$U(o,e,n){const r=getContext$1("channel");let{selected:c}=e,{schema:u}=e,{filter:h}=e;function p(F){F.preventDefault(),axios.post(r.lucentUrl+"/records/delete",{ids:c.map(V=>V.id)}).then(V=>{window.location.reload()}).catch(V=>{console.log(V)})}function b(F,V){axios.post(r.lucentUrl+"/records/status/"+V,{schemaName:u.name,records:c}).then(W=>{window.location.reload()}).catch(W=>{console.log(W)})}const y=F=>b(F,"published"),k=F=>b(F,"draft"),A=F=>b(F,"published"),R=F=>b(F,"draft"),N=F=>b(F,"trashed");return o.$$set=F=>{"selected"in F&&n(0,c=F.selected),"schema"in F&&n(1,u=F.schema),"filter"in F&&n(2,h=F.filter)},[c,u,h,p,b,y,k,A,R,N]}class ActionsOnSelected extends SvelteComponent{constructor(e){super(),init(this,e,instance$U,create_fragment$U,safe_not_equal,{selected:0,schema:1,filter:2})}}function create_fragment$T(o){let e;return{c(){e=text(o[0])},m(n,r){insert$1(n,e,r)},p(n,[r]){r&1&&set_data(e,n[0])},i:noop,o:noop,d(n){n&&de
Line truncated
|
||||
Search`),h=space$3(),attr(e,"class","button"),attr(r,"class","button")},m(R,N){insert$1(R,e,N),insert$1(R,n,N),insert$1(R,r,N),mount_component(c,r,null),append(r,u),insert$1(R,h,N),p=!0,b||(y=[listen(e,"click",k),listen(r,"click",A)],b=!0)},p(R,N){o=R},i(R){p||(transition_in(c.$$.fragment,R),p=!0)},o(R){transition_out(c.$$.fragment,R),p=!1},d(R){R&&(detach(e),detach(n),detach(r),detach(h)),destroy_component(c),b=!1,run_all(y)}}}function create_button_slot$3(o){let e,n=o[18].label+"",r,c;return{c(){e=element("div"),r=text(n),c=space$3(),attr(e,"slot","button"),toggle_class(e,"is-first",!o[1])},m(u,h){insert$1(u,e,h),append(e,r),append(e,c)},p(u,h){h&1&&n!==(n=u[18].label+"")&&set_data(r,n),h&2&&toggle_class(e,"is-first",!u[1])},d(u){u&&detach(e)}}}function create_each_block$b(o){let e,n;return e=new Dropdown({props:{$$slots:{button:[create_button_slot$3],default:[create_default_slot_1$1]},$$scope:{ctx:o}}}),{c(){create_component(e.$$.fragment)},m(r,c){mount_component(e,r,c),n=!0},p(r,c){const u={};c&2097155&&(u.$$scope={dirty:c,ctx:r}),e.$set(u)},i(r){n||(transition_in(e.$$.fragment,r),n=!0)},o(r){transition_out(e.$$.fragment,r),n=!1},d(r){destroy_component(e,r)}}}function create_if_block$s(o){let e,n;const r=[o[4]];let c={};for(let u=0;u<r.length;u+=1)c=assign(c,r[u]);return e=new InlineEdit({props:c}),e.$on("cancel",o[13]),e.$on("inlinesaved",o[6]),{c(){create_component(e.$$.fragment)},m(u,h){mount_component(e,u,h),n=!0},p(u,h){const p=h&16?get_spread_update(r,[get_spread_object(u[4])]):{};e.$set(p)},i(u){n||(transition_in(e.$$.fragment,u),n=!0)},o(u){transition_out(e.$$.fragment,u),n=!1},d(u){destroy_component(e,u)}}}function create_default_slot$4(o){let e,n,r=o[4]&&create_if_block$s(o);return{c(){r&&r.c(),e=empty$1()},m(c,u){r&&r.m(c,u),insert$1(c,e,u),n=!0},p(c,u){c[4]?r?(r.p(c,u),u&16&&transition_in(r,1)):(r=create_if_block$s(c),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(c){n||(transition_in(r),n=!0)},o(c){transition_out(r),n=!1},d(c){c&&detach(e),r&&r.d(c)}}}function create_fragment$z(o){let e,n,r,c,u,h,p;const b=[create_if_block_1$g,create_else_block$a],y=[];function k(N,F){return N[0].length>1?0:1}e=k(o),n=y[e]=b[e](o);let A={$$slots:{default:[create_default_slot$4]},$$scope:{ctx:o}};c=new DialogRecord({props:A}),o[14](c);let R={};return h=new Dialog({props:R}),o[15](h),h.$on("insert",o[7]),{c(){n.c(),r=space$3(),create_component(c.$$.fragment),u=space$3(),create_component(h.$$.fragment)},m(N,F){y[e].m(N,F),insert$1(N,r,F),mount_component(c,N,F),insert$1(N,u,F),mount_component(h,N,F),p=!0},p(N,[F]){let V=e;e=k(N),e===V?y[e].p(N,F):(group_outros(),transition_out(y[V],1,1,()=>{y[V]=null}),check_outros(),n=y[e],n?n.p(N,F):(n=y[e]=b[e](N),n.c()),transition_in(n,1),n.m(r.parentNode,r));const W={};F&2097168&&(W.$$scope={dirty:F,ctx:N}),c.$set(W);const J={};h.$set(J)},i(N){p||(transition_in(n),transition_in(c.$$.fragment,N),transition_in(h.$$.fragment,N),p=!0)},o(N){transition_out(n),transition_out(c.$$.fragment,N),transition_out(h.$$.fragment,N),p=!1},d(N){N&&(detach(r),detach(u)),y[e].d(N),o[14](null),destroy_component(c,N),o[15](null),destroy_component(h,N)}}}function instance$z(o,e,n){const r=createEventDispatcher(),c=getContext$1("channel");let{schemas:u}=e,{recordId:h}=e,p,b,y;function k(fe,_e){fe.preventDefault(),p.open(_e)}function A(fe){fe.preventDefault(),console.log("Save inline"),n(4,y=null),b.close(),r("save",{records:fe.detail.records,after:h})}function R(fe){fe.preventDefault(),p.close(),r("insert",{records:fe.detail.records,schema:fe.detail.schema,after:h})}function N(fe,_e){fe.preventDefault(),axios$1.get(c.lucentUrl+"/records/newInline?schema="+_e).then(ne=>{n(4,y=ne.data),b.open()}).catch(ne=>{console.log(ne)})}const F=(fe,_e)=>N(_e,fe.name),V=(fe,_e)=>k(_e,fe.name),W=fe=>N(fe,u[0].name),J=fe=>k(fe,u[0].name),te=fe=>n(4,y=null);function j(fe){binding_callbacks[fe?"unshift":"push"](()=>{b=fe,n(3,b)})}function ae(fe){binding_callbacks[fe?"unshift":"push"](()=>{p=fe,n(2,p)})}return o.$$set=fe=>{"schemas"in fe&&n(0,u=fe.schemas),"recordId"in fe&&n(1,h=fe.recordId)},[u,h,p,b,y,k,A,R,N,F,V,W,J,te,j,ae]}class ReferenceInlineButtons extends SvelteComponent{constructor(e){super(),init(this,e,instance$z,create_fragment$z,safe_not_equal,{schemas:0,recordId:1})}}/**!
|
||||
* Sortable 1.15.2
|
||||
* @author RubaXa <trash@rubaxa.org>
|
||||
* @author owenm <owen23355@gmail.com>
|
||||
* @license MIT
|
||||
*/function ownKeys(o,e){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter(function(c){return Object.getOwnPropertyDescriptor(o,c).enumerable})),n.push.apply(n,r)}return n}function _objectSpread2(o){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(r){_defineProperty(o,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(r){Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(n,r))})}return o}function _typeof(o){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(e){return typeof e}:_typeof=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(o)}function _defineProperty(o,e,n){return e in o?Object.defineProperty(o,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):o[e]=n,o}function _extends(){return _extends=Object.assign||function(o){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(o[r]=n[r])}return o},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(o,e){if(o==null)return{};var n={},r=Object.keys(o),c,u;for(u=0;u<r.length;u++)c=r[u],!(e.indexOf(c)>=0)&&(n[c]=o[c]);return n}function _objectWithoutProperties(o,e){if(o==null)return{};var n=_objectWithoutPropertiesLoose(o,e),r,c;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(o);for(c=0;c<u.length;c++)r=u[c],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(o,r)&&(n[r]=o[r])}return n}var version="1.15.2";function userAgent(o){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(o)}var IE11OrLess=userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Edge=userAgent(/Edge/i),FireFox=userAgent(/firefox/i),Safari=userAgent(/safari/i)&&!userAgent(/chrome/i)&&!userAgent(/android/i),IOS=userAgent(/iP(ad|od|hone)/i),ChromeForAndroid=userAgent(/chrome/i)&&userAgent(/android/i),captureMode={capture:!1,passive:!1};function on(o,e,n){o.addEventListener(e,n,!IE11OrLess&&captureMode)}function off(o,e,n){o.removeEventListener(e,n,!IE11OrLess&&captureMode)}function matches(o,e){if(e){if(e[0]===">"&&(e=e.substring(1)),o)try{if(o.matches)return o.matches(e);if(o.msMatchesSelector)return o.msMatchesSelector(e);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(e)}catch{return!1}return!1}}function getParentOrHost(o){return o.host&&o!==document&&o.host.nodeType?o.host:o.parentNode}function closest(o,e,n,r){if(o){n=n||document;do{if(e!=null&&(e[0]===">"?o.parentNode===n&&matches(o,e):matches(o,e))||r&&o===n)return o;if(o===n)break}while(o=getParentOrHost(o))}return null}var R_SPACE=/\s+/g;function toggleClass$1(o,e,n){if(o&&e)if(o.classList)o.classList[n?"add":"remove"](e);else{var r=(" "+o.className+" ").replace(R_SPACE," ").replace(" "+e+" "," ");o.className=(r+(n?" "+e:"")).replace(R_SPACE," ")}}function css$1(o,e,n){var r=o&&o.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(n=o.currentStyle),e===void 0?n:n[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=n+(typeof n=="string"?"":"px")}}function matrix(o,e){var n="";if(typeof o=="string")n=o;else do{var r=css$1(o,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!e&&(o=o.parentNode));var c=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return c&&new c(n)}function find$1(o,e,n){if(o){var r=o.getElementsByTagName(e),c=0,u=r.length;if(n)for(;c<u;c++)n(r[c],c);return r}return[]}function getWindowScrollingElement(){var o=document.scrollingElement;return o||document.documentElement}function getRect(o,e,n,r,c){if(!(!o.getBoundingClientRect&&o!==window)){var u,h,p,b,y,k,A;if(o!==window&&o.parentNode&&o!==getWindowScrollingElement()?(u=o.getBoundingClientRect(),h=u.top,p=u.left,b=u.bottom,y=u.right,k=u.height,A=u.width):(h=0,p=0,b=window.innerHeight,y=window.innerWidth,k=window.innerHeight,A=window.innerWidth),(e||n)&&o!==window&&(c=c||o.parentNode,!IE11OrLess))do if(c&&c.getBoundingClientRect&&(css$1(c,"transform")!=="none"||n&&css$1(c,"position")!=="static")){var R=c.getBoundingClientRect();h-=R.top+parseInt(css$1(c,"border-top-width")),p-=R.left+parseInt(css$1(c,"border-left-width")),b=h+u.height,y=p+u.width;break}while(c=c.parentNode);if(r&&o!==window){var N=matrix(c||o),F=N&&N.a,V=N&&N.d;N&&(h/=V,p/=F,A/=F,k/=V,b=h+k,y=p+A)}return{top:h,left:p,bottom:b,right:y,width:A,height:k}}}function isScrolledPast(o,e,n){for(var r=getParentAutoScrollElement(o,!0),c=getRect(o)[e];r;){var u=getRect(r)[n],h=void 0;if(h=c>=u,!h)return r;if(r===getWindowScrollingElement())break;r=getParentAutoScrollElement(r,!1)}return!1}function getChild(o,e,n,r){for(var c=0,u=0,h=o.children;u<h.length;){if(h[u].styleLine truncated
|
||||
<span class='flatpickr-weekday'>
|
||||
`+Ye.join("</span><span class='flatpickr-weekday'>")+`
|
||||
</span>
|
||||
`}}function Pt(){n.calendarContainer.classList.add("hasWeeks");var Qe=createElement("div","flatpickr-weekwrapper");Qe.appendChild(createElement("span","flatpickr-weekday",n.l10n.weekAbbreviation));var Ye=createElement("div","flatpickr-weeks");return Qe.appendChild(Ye),{weekWrapper:Qe,weekNumbers:Ye}}function Ue(Qe,Ye){Ye===void 0&&(Ye=!0);var _t=Ye?Qe:Qe-n.currentMonth;_t<0&&n._hidePrevMonthArrow===!0||_t>0&&n._hideNextMonthArrow===!0||(n.currentMonth+=_t,(n.currentMonth<0||n.currentMonth>11)&&(n.currentYear+=n.currentMonth>11?1:-1,n.currentMonth=(n.currentMonth+12)%12,wo("onYearChange"),Ft()),Oe(),wo("onMonthChange"),ts())}function ct(Qe,Ye){if(Qe===void 0&&(Qe=!0),Ye===void 0&&(Ye=!0),n.input.value="",n.altInput!==void 0&&(n.altInput.value=""),n.mobileInput!==void 0&&(n.mobileInput.value=""),n.selectedDates=[],n.latestSelectedDateObj=void 0,Ye===!0&&(n.currentYear=n._initialDate.getFullYear(),n.currentMonth=n._initialDate.getMonth()),n.config.enableTime===!0){var _t=getDefaultHours(n.config),Bt=_t.hours,Rn=_t.minutes,Xn=_t.seconds;N(Bt,Rn,Xn)}n.redraw(),Qe&&wo("onChange")}function dn(){n.isOpen=!1,n.isMobile||(n.calendarContainer!==void 0&&n.calendarContainer.classList.remove("open"),n._input!==void 0&&n._input.classList.remove("active")),wo("onClose")}function Zt(){n.config!==void 0&&wo("onDestroy");for(var Qe=n._handlers.length;Qe--;)n._handlers[Qe].remove();if(n._handlers=[],n.mobileInput)n.mobileInput.parentNode&&n.mobileInput.parentNode.removeChild(n.mobileInput),n.mobileInput=void 0;else if(n.calendarContainer&&n.calendarContainer.parentNode)if(n.config.static&&n.calendarContainer.parentNode){var Ye=n.calendarContainer.parentNode;if(Ye.lastChild&&Ye.removeChild(Ye.lastChild),Ye.parentNode){for(;Ye.firstChild;)Ye.parentNode.insertBefore(Ye.firstChild,Ye);Ye.parentNode.removeChild(Ye)}}else n.calendarContainer.parentNode.removeChild(n.calendarContainer);n.altInput&&(n.input.type="text",n.altInput.parentNode&&n.altInput.parentNode.removeChild(n.altInput),delete n.altInput),n.input&&(n.input.type=n.input._type,n.input.classList.remove("flatpickr-input"),n.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(_t){try{delete n[_t]}catch{}})}function rn(Qe){return n.calendarContainer.contains(Qe)}function Fe(Qe){if(n.isOpen&&!n.config.inline){var Ye=getEventTarget(Qe),_t=rn(Ye),Bt=Ye===n.input||Ye===n.altInput||n.element.contains(Ye)||Qe.path&&Qe.path.indexOf&&(~Qe.path.indexOf(n.input)||~Qe.path.indexOf(n.altInput)),Rn=!Bt&&!_t&&!rn(Qe.relatedTarget),Xn=!n.config.ignoredFocusElements.some(function(ro){return ro.contains(Ye)});Rn&&Xn&&(n.config.allowInput&&n.setDate(n._input.value,!1,n.config.altInput?n.config.altFormat:n.config.dateFormat),n.timeContainer!==void 0&&n.minuteElement!==void 0&&n.hourElement!==void 0&&n.input.value!==""&&n.input.value!==void 0&&b(),n.close(),n.config&&n.config.mode==="range"&&n.selectedDates.length===1&&n.clear(!1))}}function mt(Qe){if(!(!Qe||n.config.minDate&&Qe<n.config.minDate.getFullYear()||n.config.maxDate&&Qe>n.config.maxDate.getFullYear())){var Ye=Qe,_t=n.currentYear!==Ye;n.currentYear=Ye||n.currentYear,n.config.maxDate&&n.currentYear===n.config.maxDate.getFullYear()?n.currentMonth=Math.min(n.config.maxDate.getMonth(),n.currentMonth):n.config.minDate&&n.currentYear===n.config.minDate.getFullYear()&&(n.currentMonth=Math.max(n.config.minDate.getMonth(),n.currentMonth)),_t&&(n.redraw(),wo("onYearChange"),Ft())}}function de(Qe,Ye){var _t;Ye===void 0&&(Ye=!0);var Bt=n.parseDate(Qe,void 0,Ye);if(n.config.minDate&&Bt&&compareDates(Bt,n.config.minDate,Ye!==void 0?Ye:!n.minDateHasTime)<0||n.config.maxDate&&Bt&&compareDates(Bt,n.config.maxDate,Ye!==void 0?Ye:!n.maxDateHasTime)>0)return!1;if(!n.config.enable&&n.config.disable.length===0)return!0;if(Bt===void 0)return!1;for(var Rn=!!n.config.enable,Xn=(_t=n.config.enable)!==null&&_t!==void 0?_t:n.config.disable,ro=0,an=void 0;ro<Xn.length;ro++){if(an=Xn[ro],typeof an=="function"&&an(Bt))return Rn;if(an instanceof Date&&Bt!==void 0&&an.getTime()===Bt.getTime())return Rn;if(typeof an=="string"){var Do=n.parseDate(an,void 0,!0);return Do&&Do.getTime()===Bt.getTime()?Rn:!Rn}else if(typeof an=="object"&&Bt!==void 0&&an.from&&an.to&&Bt.getTime()>=an.from.getTime()&&Bt.getTime()<=an.to.getTime())return Rn}return!Rn}function Eo(Qe){return n.daysContainer!==void 0?Qe.className.indexOf("hidden")===-1&&Qe.className.indexOf("flatpickr-disabled")===-1&&n.daysContainer.contains(Qe):!1}function jn(Qe){var Ye=Qe.target===n._input,_t=n._input.valu
Line truncated
|
||||
`||s==="\r",NO=(s,l)=>l<s.length&&l>=0?lf(s[l]):!1,mh=(s,l=4,d=!0,m=!0)=>{const v=ka(" ",l),w=s.replace(/\t/g,v);return Dn(w,(B,H)=>ep(H)||H===Fs?B.pcIsSpace||B.str===""&&d||B.str.length===w.length-1&&m||NO(w,B.str.length+1)?{pcIsSpace:!1,str:B.str+Fs}:{pcIsSpace:!0,str:B.str+" "}:{pcIsSpace:lf(H),str:B.str+H},{pcIsSpace:!1,str:""}).str},d1=(s,l)=>{const d=qe.fromDom(l),m=qe.fromDom(s);return F0(m,"pre,code",Ue(dt,d))},ph=(s,l)=>un(s)&&hh(s.data)&&!d1(s,l),ta=s=>Zn(s)&&s.nodeName==="A"&&!s.hasAttribute("href")&&(s.hasAttribute("name")||s.hasAttribute("id")),Xu=(s,l)=>_s(s)&&!ph(s,l)||ta(s)||xd(s),xd=Ym("data-mce-bookmark"),gh=Ym("data-mce-bogus"),bh=Ta("data-mce-bogus","all"),tp=s=>br(qe.fromDom(s)).exists(l=>!Zo(l)),au=(s,l)=>{let d=0;if(Xu(s,s))return!1;{let m=s.firstChild;if(!m)return!0;const v=new Hr(m,s);do{if(l){if(bh(m)){m=v.next(!0);continue}if(gh(m)){m=v.next();continue}}if(wl(m)&&tp(m))return!1;if(Js(m)){d++,m=v.next();continue}if(Xu(m,s))return!1;m=v.next()}while(m);return d<=1}},Fi=(s,l=!0)=>au(s.dom,l),Ed=s=>s.toLowerCase()==="svg",ib=s=>Ed(s.nodeName),f1=s=>(s==null?void 0:s.nodeName)==="svg"?"svg":"html",h1=["svg"],vh=()=>{let s=[];const l=()=>s[s.length-1];return{track:w=>{ib(w)&&s.push(w);let $=l();return $&&!$.contains(w)&&(s.pop(),$=l()),f1($)},current:()=>f1(l()),reset:()=>{s=[]}}},ec="data-mce-block",ju=s=>kt(ts(s),l=>!/[A-Z]/.test(l)),$f=s=>pt(ju(s),l=>`${l}:`+pt(h1,d=>`not(${d} ${l})`).join(":")).join(","),cf=(s,l)=>xe(l.querySelector(s))?(l.setAttribute(ec,"true"),l.getAttribute("data-mce-selected")==="inline-boundary"&&l.removeAttribute("data-mce-selected"),!0):(l.removeAttribute(ec),!1),bc=(s,l)=>{const d=$f(s.getTransparentElements()),m=$f(s.getBlockElements());return kt(l.querySelectorAll(d),v=>cf(m,v))},Yu=(s,l)=>{var d;const m=l?"lastChild":"firstChild";for(let v=s[m];v;v=v[m])if(Fi(qe.fromDom(v))){(d=v.parentNode)===null||d===void 0||d.removeChild(v);return}},Oh=(s,l)=>{const d=document.createRange(),m=s.parentNode;if(m){d.setStartBefore(s),d.setEndBefore(l);const v=d.extractContents();Yu(v,!0),d.setStartAfter(l),d.setEndAfter(s);const w=d.extractContents();Yu(w,!1),Fi(qe.fromDom(v))||m.insertBefore(v,s),Fi(qe.fromDom(l))||m.insertBefore(l,s),Fi(qe.fromDom(w))||m.insertBefore(w,s),m.removeChild(s)}},H0=(s,l,d)=>{const m=s.getBlockElements(),v=qe.fromDom(l),w=B=>Os(B)in m,$=B=>dt(B,v);Ie(wu(d),B=>{Rr(B,w,$).each(H=>{const G=Yl(B,le=>w(le)&&!s.isValidChild(Os(H),Os(le)));if(G.length>0){const le=br(H);Ie(G,ue=>{Rr(ue,w,$).each(ge=>{Oh(ge.dom,ue.dom)})}),le.each(ue=>bc(s,ue.dom))}})})},ab=(s,l,d)=>{Ie([...d,...gs(s,l)?[l]:[]],m=>Ie(Fa(qe.fromDom(m),m.nodeName.toLowerCase()),v=>{ho(s,v.dom)&&La(v)}))},Kp=(s,l)=>{const d=bc(s,l);H0(s,l,d),ab(s,l,d)},yh=(s,l)=>{if(tg(s,l)){const d=$f(s.getBlockElements());cf(d,l)}},Jp=(s,l,d)=>{const m=w=>dt(w,qe.fromDom(l)),v=rh(qe.fromDom(d),m);dr(v,v.length-2).filter(Ra).fold(()=>Kp(s,l),w=>Kp(s,w.dom))},lb=s=>s.hasAttribute(ec),eg=(s,l)=>an(s.getTransparentElements(),l),tg=(s,l)=>Zn(l)&&eg(s,l.nodeName),gs=(s,l)=>tg(s,l)&&lb(l),ho=(s,l)=>tg(s,l)&&!lb(l),Td=(s,l)=>l.type===1&&eg(s,l.name)&&j(l.attr(ec)),ng=Ko().browser,cm=s=>Gn(s,Ra),tw=s=>ng.isFirefox()&&Os(s)==="table"?cm(Ci(s)).filter(l=>Os(l)==="caption").bind(l=>cm(la(l)).map(d=>{const m=d.dom.offsetTop,v=l.dom.offsetTop,w=l.dom.offsetHeight;return m<=v?-w:0})).getOr(0):0,cb=(s,l)=>s.children&>(s.children,l),kr=(s,l,d)=>{let m=0,v=0;const w=s.ownerDocument;if(d=d||s,l){if(d===s&&l.getBoundingClientRect&&ki(qe.fromDom(s),"position")==="static"){const B=l.getBoundingClientRect();return m=B.left+(w.documentElement.scrollLeft||s.scrollLeft)-w.documentElement.clientLeft,v=B.top+(w.documentElement.scrollTop||s.scrollTop)-w.documentElement.clientTop,{x:m,y:v}}let $=l;for(;$&&$!==d&&$.nodeType&&!cb($,d);){const B=$;m+=B.offsetLeft||0,v+=B.offsetTop||0,$=B.offsetParent}for($=l.parentNode;$&&$!==d&&$.nodeType&&!cb($,d);)m-=$.scrollLeft||0,v-=$.scrollTop||0,$=$.parentNode;v+=tw(qe.fromDom(l))}return{x:m,y:v}},ub=(s,l={})=>{let d=0;const m={},v=qe.fromDom(s),w=uo(v),$=rt=>{l.referrerPolicy=rt},B=rt=>{l.contentCssCors=rt},H=rt=>{di(ah(v),rt)},G=rt=>{const ft=ah(v);Na(ft,"#"+rt).each($s)},le=rt=>ro(m,rt).getOrThunk(()=>({id:"mce-u"+d++,passed:[],failed:[],count:0})),ue=rt=>new Promise((ft,ut)=>{let Ct;const en=cn._addCacheSuffix(rt),vn=le(en);m[en]=vn,vn.count++;const Fn=(qn,mo)=>{Ie(qn,rn),vn.status=mo,vn.passed=[],vn.failed=[],Ct&&(Ct.onload=null,Ct.onerror=null,Ct=null)},zt=()=>Fn(vn.passed,2),Mt=()=>Fn(vn.failed,3);if(ft&&vn.passed.push(ft),ut&&vn.failed.push(ut),vn.status===1)return;if(vn.status===2){zt();return}if(vn.status===3){Mt();return}vn.status=1;const Jt=qe.fromTag("link",w.dom);$c(Jt,{rel:"stylesheet",type:"text/css",id:vn.id}),l.contentCssCors&&Sr(Jt,"crossOrigin","anonymous"),l.referrerPolicy&&Sr(Jt,"referrerpolicy",l.referrerPolicy),Ct=Jt.dom,Ct.onload=zt,Ct.onerror=Mt,H(Jt),Sr(Jt,"href",en)}),ge=(rt,ft)=>{const ut=le(rt);m[rt]=ut,ut.count++;const Ct=qe.fromTag("style",w.dom);$c(Ct,{rel
Line truncated
|
||||
Actual: `+ge.join(","));if(!Vs(l,He=>gt(ge,He)))throw new Error("Not all branches were specified when using match. Specified: "+ge.join(", ")+`
|
||||
Required: `+l.join(", "));return ue[$].apply(null,H)},log:ue=>{console.log(ue,{constructors:l,constructor:$,params:H})}}}}),d}};hf.generate([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const On=s=>{const l=[],d=[];return Ie(s,m=>{m.fold(v=>{l.push(v)},v=>{d.push(v)})}),{errors:l,values:d}},cv=s=>s.type==="inline-command"||s.type==="inline-format",Za=s=>s.type==="block-command"||s.type==="block-format",uv=s=>{const l=m=>zc.error({message:m,pattern:s}),d=(m,v,w)=>{if(s.format!==void 0){let $;if(_e(s.format)){if(!Vs(s.format,j))return l(m+" pattern has non-string items in the `format` array");$=s.format}else if(j(s.format))$=[s.format];else return l(m+" pattern has non-string `format` parameter");return zc.value(v($))}else return s.cmd!==void 0?j(s.cmd)?zc.value(w(s.cmd,s.value)):l(m+" pattern has non-string `cmd` parameter"):l(m+" pattern is missing both `format` and `cmd` parameters")};if(!ae(s))return l("Raw pattern is not an object");if(!j(s.start))return l("Raw pattern is missing `start` parameter");if(s.end!==void 0){if(!j(s.end))return l("Inline pattern has non-string `end` parameter");if(s.start.length===0&&s.end.length===0)return l("Inline pattern has empty `start` and `end` parameters");let m=s.start,v=s.end;return v.length===0&&(v=m,m=""),d("Inline",w=>({type:"inline-format",start:m,end:v,format:w}),(w,$)=>({type:"inline-command",start:m,end:v,cmd:w,value:$}))}else return s.replacement!==void 0?j(s.replacement)?s.start.length===0?l("Replacement pattern has empty `start` parameter"):zc.value({type:"inline-command",start:"",end:s.start,cmd:"mceInsertContent",value:s.replacement}):l("Replacement pattern has non-string `replacement` parameter"):s.start.length===0?l("Block pattern has empty `start` parameter"):d("Block",m=>({type:"block-format",start:s.start,format:m[0]}),(m,v)=>({type:"block-command",start:s.start,cmd:m,value:v}))},vm=s=>kt(s,Za),x1=s=>kt(s,cv),Wc=(s,l)=>({inlinePatterns:x1(s),blockPatterns:vm(s),dynamicPatternsLookup:l}),ty=s=>{const l=On(pt(s,uv));return Ie(l.errors,d=>console.error(d.message,d.pattern)),l.values},E1=s=>l=>{const d=s(l);return ty(d)},ji=Ko().deviceType,mf=ji.isTouch(),T1=Jr.DOM,Ff=s=>{const l=s.indexOf("=")>0?s.split(/[;,](?![^=;,]*(?:[;,]|$))/):s.split(",");return Dn(l,(d,m)=>{const v=m.split("="),w=v[0],$=v.length>1?v[1]:w;return d[Pl(w)]=Pl($),d},{})},Id=s=>te(s,RegExp),Hn=s=>l=>l.options.get(s),$u=s=>j(s)||ae(s),dv=(s,l="")=>d=>{const m=j(d);if(m)if(d.indexOf("=")!==-1){const v=Ff(d);return{value:ro(v,s.id).getOr(l),valid:m}}else return{value:d,valid:m};else return{valid:!1,message:"Must be a string."}},Hf=s=>{const l=s.options.register;l("id",{processor:"string",default:s.id}),l("selector",{processor:"string"}),l("target",{processor:"object"}),l("suffix",{processor:"string"}),l("cache_suffix",{processor:"string"}),l("base_url",{processor:"string"}),l("referrer_policy",{processor:"string",default:""}),l("language_load",{processor:"boolean",default:!0}),l("inline",{processor:"boolean",default:!1}),l("iframe_attrs",{processor:"object",default:{}}),l("doctype",{processor:"string",default:"<!DOCTYPE html>"}),l("document_base_url",{processor:"string",default:s.documentBaseUrl}),l("body_id",{processor:dv(s,"tinymce"),default:"tinymce"}),l("body_class",{processor:dv(s),default:""}),l("content_security_policy",{processor:"string",default:""}),l("br_in_pre",{processor:"boolean",default:!0}),l("forced_root_block",{processor:d=>{const m=j(d)&&Ls(d);return m?{value:d,valid:m}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),l("forced_root_block_attrs",{processor:"object",default:{}}),l("newline_behavior",{processor:d=>{const m=gt(["block","linebreak","invert","default"],d);return m?{value:d,valid:m}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),l("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),l("no_newline_selector",{processor:"string",default:""}),l("keep_styles",{processor:"boolean",default:!0}),l("end_container_on_empty_block",{processor:d=>Se(d)?{valid:!0,value:d}:j(d)?{valid:!0,value:d}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),l("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),l("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),l("font_size_classes",{processor:"string",default:""}),l("automatic_uploads",{processor:"boolean",default:!0}),l("images_reuse_filename",{processor:"boolean",default:!1}),l("images_replace_blob_uris",{processor:"boolean",default:!0}),l("icons",{processor:"string",default:""}),l("icons_url",{processor:"string",default:""}),l("images_upload_url",{processor:"string",default:""}),l("images_upload_base_path",{processor:"string",default:""}),l("images_upload_credentials",{processor:"boolean",default:!1}),l("images_u
Line truncated
|
||||
\r \v`.indexOf(s)!==-1,Bg=s=>!Kb(s)&&!$y(s)&&!Li(s),Py=s=>{const l=[];if(s)for(let d=0;d<s.rangeCount;d++)l.push(s.getRangeAt(d));return l},Dy=s=>Ns(s,l=>{const d=_g(l);return d?[qe.fromDom(d)]:[]}),L1=s=>Py(s).length>1,UE=s=>kt(Dy(s),Kl),mC=s=>Fa(s,"td[data-mce-selected],th[data-mce-selected]"),qE=(s,l)=>{const d=mC(l);return d.length>0?d:UE(s)},Jb=s=>qE(Py(s.selection.getSel()),qe.fromDom(s.getBody())),yp=(s,l)=>Dc(s,"table",l),XE=s=>{const l=s.startContainer,d=s.startOffset;return un(l)?d===0?de.some(qe.fromDom(l)):de.none():de.from(l.childNodes[d]).map(qe.fromDom)},jE=s=>{const l=s.endContainer,d=s.endOffset;return un(l)?d===l.data.length?de.some(qe.fromDom(l)):de.none():de.from(l.childNodes[d-1]).map(qe.fromDom)},pC=s=>Dr(s).fold(je([s]),l=>[s].concat(pC(l))),Gw=s=>Pc(s).fold(je([s]),l=>Os(l)==="br"?Ui(l).map(d=>[s].concat(Gw(d))).getOr([]):[s].concat(Gw(l))),Kw=(s,l)=>yr(XE(l),jE(l),(d,m)=>{const v=Gn(pC(s),Ue(dt,d)),w=Gn(Gw(s),Ue(dt,m));return v.isSome()&&w.isSome()}).getOr(!1),Jw=(s,l,d,m)=>{const v=d,w=new Hr(d,v),$=Bt(s.schema.getMoveCaretBeforeOnEnterElements(),(H,G)=>!gt(["td","th","table"],G.toLowerCase()));let B=d;do{if(un(B)&&cn.trim(B.data).length!==0){m?l.setStart(B,0):l.setEnd(B,B.data.length);return}if($[B.nodeName]){m?l.setStartBefore(B):B.nodeName==="BR"?l.setEndBefore(B):l.setEndAfter(B);return}}while(B=m?w.next():w.prev());v.nodeName==="BODY"&&(m?l.setStart(v,0):l.setEnd(v,v.childNodes.length))},Ry=s=>{const l=s.selection.getSel();return xe(l)&&l.rangeCount>0},Lg=(s,l)=>{const d=Jb(s);d.length>0?Ie(d,m=>{const v=m.dom,w=s.dom.createRng();w.setStartBefore(v),w.setEndAfter(v),l(w,!0)}):l(s.selection.getRng(),!1)},gC=(s,l,d)=>{const m=Lf(s,l);d(m),s.moveToBookmark(m)},Bv=s=>Ft(s==null?void 0:s.nodeType),eS=s=>Zn(s)&&!Ld(s)&&!Bd(s)&&!Su(s),YE=(s,l)=>{if(eS(l)&&!/^(TD|TH)$/.test(l.nodeName)){const d=s.getAttrib(l,"data-mce-selected"),m=parseInt(d,10);return!isNaN(m)&&m>0}else return!1},Lv=(s,l,d)=>{const{selection:m,dom:v}=s,w=m.getNode(),$=ys(w);gC(m,!0,()=>{l()}),$&&ys(w)&&v.isChildOf(w,s.getBody())?s.selection.select(w):d(m.getStart())&&GE(v,m)},GE=(s,l)=>{var d,m;const v=l.getRng(),{startContainer:w,startOffset:$}=v,B=l.getNode();if(!YE(s,B)&&Zn(w)){const H=w.childNodes,G=s.getRoot();let le;if($<H.length){const ue=H[$];le=new Hr(ue,(d=s.getParent(ue,s.isBlock))!==null&&d!==void 0?d:G)}else{const ue=H[H.length-1];le=new Hr(ue,(m=s.getParent(ue,s.isBlock))!==null&&m!==void 0?m:G),le.next(!0)}for(let ue=le.current();ue;ue=le.next()){if(s.getContentEditable(ue)==="false")return;if(un(ue)&&!$a(ue)){v.setStart(ue,0),l.setRng(v);return}}}},Ln=(s,l,d)=>{if(s){const m=l?"nextSibling":"previousSibling";for(s=s[m];s;s=s[m])if(Zn(s)||!$a(s))return s}},il=(s,l)=>!!s.getTextBlockElements()[l.nodeName.toLowerCase()]||gs(s,l),_p=(s,l,d)=>s.schema.isValidChild(l,d),$a=(s,l=!1)=>{if(xe(s)&&un(s)){const d=l?s.data.replace(/ /g," "):s.data;return hh(d)}else return!1},gf=s=>xe(s)&&un(s)&&s.length===0,My=(s,l)=>{const d="[data-mce-cef-wrappable]",m=pf(s),v=Ji(m)?d:`${d},${m}`;return mc(qe.fromDom(l),v)},Fv=(s,l)=>{const d=s.dom;return eS(l)&&d.getContentEditable(l)==="false"&&My(s,l)&&d.select('[contenteditable="true"]',l).length===0},Lh=(s,l)=>Oe(s)?s(l):(xe(l)&&(s=s.replace(/%(\w+)/g,(d,m)=>l[m]||d)),s),Ny=(s,l)=>(s=s||"",l=l||"",s=""+(s.nodeName||s),l=""+(l.nodeName||l),s.toLowerCase()===l.toLowerCase()),Iy=(s,l)=>{if(Ne(s))return null;{let d=String(s);return(l==="color"||l==="backgroundColor")&&(d=lu(d)),l==="fontWeight"&&s===700&&(d="bold"),l==="fontFamily"&&(d=d.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),d}},e0=(s,l,d)=>{const m=s.getStyle(l,d);return Iy(m,d)},bC=(s,l)=>{let d;return s.getParent(l,m=>Zn(m)?(d=s.getStyle(m,"text-decoration"),!!d&&d!=="none"):!1),d},Hv=(s,l,d)=>s.getParents(l,d,s.getRoot()),tS=(s,l,d)=>{const m=s.formatter.get(l);return xe(m)&&Ut(m,d)},nS=(s,l)=>tS(s,l,m=>{const v=w=>Oe(w)||w.length>1&&w.charAt(0)==="%";return Ut(["styles","attributes"],w=>ro(m,w).exists($=>{const B=_e($)?$:Xn($);return Ut(B,v)}))}),KE=(s,l,d)=>{const m=["inline","block","selector","attributes","styles","classes"],v=w=>Bt(w,($,B)=>Ut(m,H=>H===B));return tS(s,l,w=>{const $=v(w);return tS(s,d,B=>{const H=v(B);return io($,H)})})},Fh=s=>Do(s,"block"),By=s=>Fh(s)&&s.wrapper===!0,t0=s=>Fh(s)&&s.wrapper!==!0,ic=s=>Do(s,"selector"),qa=s=>Do(s,"inline"),Ly=s=>ic(s)&&qa(s)&&Or(ro(s,"mixed"),!0),Qv=s=>ic(s)&&s.expand!==!1&&!qa(s),Fy=s=>{const l=[];let d=s;for(;d;){if(un(d)&&d.data!==z||d.childNodes.length>1)return[];Zn(d)&&l.push(d),d=d.firstChild}return l},Vv=s=>Fy(s).length>0,zv=s=>Bd(s.dom)&&Vv(s.dom),n0=Ld,vC=Hv,Wv=$a,OC=il,yC=s=>Js(s)&&s.getAttribute("data-mce-bogus")&&!s.nextSibling,_C=(s,l)=>{let d=l;for(;d;){if(Zn(d)&&s.getContentEditable(d))return s.getContentEditable(d)==="false"?d:l;d=d.parentNode}return l},bf=(s,l,d,m)=>{const v=l.data;if(s){for(let w=d;w>0;w--)if(m(v.charAt(w-1)))return w}else for(let w=d;w<v.length;w++)if(m(v.charAt(w)))return w;return-1},yc=(s,l,d)=>bf(s,l,d,m=>$y(m)||Kb(m)),Wf=(
Line truncated
|
||||
]*|<br \\/>[\r
|
||||
]*)$`);return l.replace(m,"")},dU=(s,l)=>{const d=s.getDoc(),m=pl(qe.fromDom(s.getBody())),v=qe.fromTag("div",d);Sr(v,"data-mce-bogus","all"),Ba(v,{position:"fixed",left:"-9999999px",top:"0"}),Nc(v,l.innerHTML),ss(v),ET(v);const w=l1(m);di(w,v);const $=ve(v.dom.innerText);return $s(v),$},w6=(s,l,d)=>{let m;return l.format==="raw"?m=cn.trim(ve(P4(d,s.serializer.getTempAttrs()).innerHTML)):l.format==="text"?m=dU(s,d):l.format==="tree"?m=s.serializer.serialize(d,l):m=uU(s,s.serializer.serialize(d,l)),l.format!=="text"&&!ya(qe.fromDom(d))&&j(m)?cn.trim(m):m},fU=(s,l)=>de.from(s.getBody()).fold(je(l.format==="tree"?new Iu("body",11):""),d=>w6(s,l,d)),S6=cn.makeMap,D4=s=>{const l=[];s=s||{};const d=s.indent,m=S6(s.indent_before||""),v=S6(s.indent_after||""),w=op.getEncodeFunc(s.entity_encoding||"raw",s.entities),$=s.element_format!=="xhtml";return{start:(B,H,G)=>{if(d&&m[B]&&l.length>0){const le=l[l.length-1];le.length>0&&le!==`
|
||||
`&&l.push(`
|
||||
`)}if(l.push("<",B),H)for(let le=0,ue=H.length;le<ue;le++){const ge=H[le];l.push(" ",ge.name,'="',w(ge.value,!0),'"')}if(!G||$?l[l.length]=">":l[l.length]=" />",G&&d&&v[B]&&l.length>0){const le=l[l.length-1];le.length>0&&le!==`
|
||||
`&&l.push(`
|
||||
`)}},end:B=>{let H;l.push("</",B,">"),d&&v[B]&&l.length>0&&(H=l[l.length-1],H.length>0&&H!==`
|
||||
`&&l.push(`
|
||||
`))},text:(B,H)=>{B.length>0&&(l[l.length]=H?B:w(B))},cdata:B=>{l.push("<![CDATA[",B,"]]>")},comment:B=>{l.push("<!--",B,"-->")},pi:(B,H)=>{H?l.push("<?",B," ",w(H),"?>"):l.push("<?",B,"?>"),d&&l.push(`
|
||||
`)},doctype:B=>{l.push("<!DOCTYPE",B,">",d?`
|
||||
`:"")},reset:()=>{l.length=0},getContent:()=>l.join("").replace(/\n$/,"")}},u0=(s={},l=Df())=>{const d=D4(s);return s.validate="validate"in s?s.validate:!0,{serialize:v=>{const w=s.validate,$={3:H=>{var G;d.text((G=H.value)!==null&&G!==void 0?G:"",H.raw)},8:H=>{var G;d.comment((G=H.value)!==null&&G!==void 0?G:"")},7:H=>{d.pi(H.name,H.value)},10:H=>{var G;d.doctype((G=H.value)!==null&&G!==void 0?G:"")},4:H=>{var G;d.cdata((G=H.value)!==null&&G!==void 0?G:"")},11:H=>{let G=H;if(G=G.firstChild)do B(G);while(G=G.next)}};d.reset();const B=H=>{var G;const le=$[H.type];if(le)le(H);else{const ue=H.name,ge=ue in l.getVoidElements();let Me=H.attributes;if(w&&Me&&Me.length>1){const He=[];He.map={};const Pe=l.getElementRule(H.name);if(Pe){for(let Ve=0,rt=Pe.attributesOrder.length;Ve<rt;Ve++){const ft=Pe.attributesOrder[Ve];if(ft in Me.map){const ut=Me.map[ft];He.map[ft]=ut,He.push({name:ft,value:ut})}}for(let Ve=0,rt=Me.length;Ve<rt;Ve++){const ft=Me[Ve].name;if(!(ft in He.map)){const ut=Me.map[ft];He.map[ft]=ut,He.push({name:ft,value:ut})}}Me=He}}if(d.start(ue,Me,ge),Ed(ue))j(H.value)&&d.text(H.value,!0),d.end(ue);else if(!ge){let He=H.firstChild;if(He){(ue==="pre"||ue==="textarea")&&He.type===3&&((G=He.value)===null||G===void 0?void 0:G[0])===`
|
||||
`&&d.text(`
|
||||
`,!0);do B(He);while(He=He.next)}d.end(ue)}}};return v.type===1&&!s.inner?B(v):v.type===3?$[3](v):$[11](v),d.getContent()}}},Ao=new Set;Ie(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function"],l=>{Ao.add(l)});const R4=["font","text-decoration","text-emphasis"],TT=(s,l)=>ts(s.parseStyle(s.getAttrib(l,"style"))),C6=s=>Ao.has(s),yS=(s,l)=>Vs(TT(s,l),d=>!C6(d)),M4=s=>kt(s,l=>Ut(R4,d=>rr(l,d))),k6=(s,l,d)=>{const m=TT(s,l),v=TT(s,d),w=$=>{var B,H;const G=(B=s.getStyle(l,$))!==null&&B!==void 0?B:"",le=(H=s.getStyle(d,$))!==null&&H!==void 0?H:"";return Ls(G)&&Ls(le)&&G!==le};return Ut(m,$=>{const B=H=>Ut(H,G=>G===$);if(!B(v)&&B(R4)){const H=M4(v);return Ut(H,w)}else return w($)})},N4=(s,l,d)=>de.from(d.container()).filter(un).exists(m=>{const v=s?0:-1;return l(m.data.charAt(d.offset()+v))}),AT=Ue(N4,!0,Kb),qC=Ue(N4,!1,Kb),x6=s=>{const l=s.container();return un(l)&&(l.data.length===0||K(l.data)&&F1.isBookmarkNode(l.parentNode))},nO=(s,l)=>d=>Bn(s?0:-1,d).filter(l).isSome(),E6=s=>Ei(s)&&ki(qe.fromDom(s),"display")==="block",I4=s=>ys(s)&&!Xp(s),T6=nO(!0,E6),A6=nO(!1,E6),_S=nO(!0,Qr),Yy=nO(!1,Qr),B4=nO(!0,wd),hs=nO(!1,wd),W1=nO(!0,I4),Tp=nO(!1,I4),L4=s=>s.slice(0,-1),F4=(s,l,d)=>sn(l,s)?L4(rh(s,m=>d(m)||dt(m,l))):[],$T=(s,l)=>F4(s,l,Fe),Vg=(s,l)=>[s].concat($T(s,l)),XC=(s,l,d)=>Vf(s,l,d,x6),$6=s=>l=>s.isBlock(Os(l)),PT=(s,l,d)=>Gn(Vg(qe.fromDom(l.container()),s),$6(d)),H4=(s,l,d,m)=>XC(s,l.dom,d).forall(v=>PT(l,d,m).fold(()=>!_n(v,d,l.dom),w=>!_n(v,d,l.dom)&&sn(w,qe.fromDom(v.container())))),Q4=(s,l,d,m)=>PT(l,d,m).fold(()=>XC(s,l.dom,d).forall(v=>!_n(v,d,l.dom)),v=>XC(s,v.dom,d).isNone()),DT=Ue(Q4,!1),V4=Ue(Q4,!0),P6=Ue(H4,!1),D6=Ue(H4,!0),R6=s=>rc(s).exists(xu),jC=(s,l,d,m)=>{const v=kt(Vg(qe.fromDom(d.container()),l),$=>m.isBlock(Os($))),w=Oo(v).getOr(l);return zl(s,w.dom,d).filter(R6)},wS=(s,l,d)=>rc(l).exists(xu)||jC(!0,s,l,d).isSome(),SS=(s,l,d)=>nd(l).exists(xu)||jC(!1,s,l,d).isSome(),M6=Ue(jC,!1),N6=Ue(jC,!0),z4=s=>$t.isTextPosition(s)&&!s.isAtStart()&&!s.isAtEnd(),W4=(s,l,d)=>{const m=kt(Vg(qe.fromDom(l.container()),s),v=>d.isBlock(Os(v)));return Oo(m).getOr(s)},Z4=(s,l,d)=>z4(l)?qC(l):qC(l)||Ru(W4(s,l,d).dom,l).exists(qC),U4=(s,l,d)=>z4(l)?AT(l):AT(l)||Uc(W4(s,l,d).dom,l).exists(AT),I6=s=>gt(["pre","pre-wrap"],s),RT=s=>rc(s).bind(l=>Ma(l,Ra)).exists(l=>I6(ki(l,"white-space"))),q4=(s,l)=>Ru(s.dom,l).isNone(),B6=(s,l)=>Uc(s.dom,l).isNone(),L6=(s,l,d)=>q4(s,l)||B6(s,l)||DT(s,l,d)||V4(s,l,d)||SS(s,l,d)||wS(s,l,d),oO=s=>xe(s)&&ys(s)&&Sm(s),X4=(s,l)=>d=>oO(new Hr(d,s)[l]()),j4=(s,l)=>{const d=Uc(s.dom,l).getOr(l),m=X4(s.dom,"next");return l.isAtEnd()&&(m(l.container())||m(d.container()))},F6=(s,l)=>{const d=Ru(s.dom,l).getOr(l),m=X4(s.dom,"prev");return l.isAtStart()&&(m(l.container())||m(d.container()))},Y4=(s,l,d)=>RT(l)?!1:L6(s,l,d)||Z4(s,l,d)||U4(s,l,d),Gy=(s,l,d)=>RT(l)?!1:DT(s,l,d)||P6(s,l,d)||SS(s,l,d)||Z4(s,l,d)||F6(s,l),G4=s=>{const l=s.container(),d=s.offset();return un(l)&&d<l.data.length?$t(l,d+1):s},Ky=(s,l,d)=>RT(l)?!1:V4(s,l,d)||D6(s,l,d)||wS(s,l,d)||U4(s,l,d)||j4(s,l),YC=(s,l,d)=>Gy(s,l,d)||Ky(s,G4(l),d),Bu=(s,l)=>$y(s.charAt(l)),K4=(s,l)=>Kb(s.charAt(l)),H6=s=>{const l=s.container();return un(l)&&As(l.data,Fs)},Q6=s=>{const l=s.split("");return pt(l,(d,m)=>$y(d)&&m>0&&m<l.length-1&&Bg(l[m-1])&&Bg(l[m+1])?" ":d).join("")},J4=(s,l,d,m)=>{const v=l.data,w=$t(l,0);return!d&&Bu(v,0)&&!YC(s,w,m)?(l.data=" "+v.slice(1),!0):d&&K4(v,0)&&Gy(s,w,m)?(l.data=Fs+v.slice(1),!0):!1},V6=s=>{const l=s.data,d=Q6(l);return d!==l?(s.data=d,!0):!1},d0=(s,l,d,m)=>{const v=l.data,w=$t(l,v.length-1);return!d&&Bu(v,v.length-1)&&!YC(s,w,m)?(l.data=v.slice(0,-1)+" ",!0):d&&K4(v,v.length-1)&&Ky(s,w,m)?(l.data=v.slice(0,-1)+Fs,!0):!1},z6=(s,l,d)=>{const m=l.container();if(!un(m))return de.none();if(H6(l)){const v=J4(s,m,!1,d)||V6(m)||d0(s,m,!1,d);return Jo(v,l)}else if(YC(s,l,d)){const v=J4(s,m,!0,d)||d0(s,m,!0,d);return Jo(v,l)}else return de.none()},W6=s=>{const l=qe.fromDom(s.getBody());s.selection.isCollapsed()&&z6(l,$t.fromRangeStart(s.selection.getRng()),s.schema).each(d=>{s.selection.setRng(d.toRange())})},Yi=(s,l,d,m)=>{if(d===0)return;const v=qe.fromDom(s),w=Rr(v,G=>m.isBlock(Os(G))).getOr(v),$=s.data.slice(l,l+d),B=l+d>=s.data.length&&Ky(w,$t(s,s.data.length),m),H=l===0&&Gy(w,$t(s,0),m);s.replaceData(l,d,mh($,4,H,B))},sO=(s,l,d)=>{const m=s.data.slice(l),v=m.length-Tc(m).length;Yi(s,l,v,d)},
Line truncated
|
||||
`+Ul),Br&&(Ul=Dm(Ul,qn," "),Ul=Dm(Ul,mo," "),Ul=Dm(Ul,es," ")),ut&&Xo?ut.createHTML(Ul):Ul},l.setConfig=function(xs){j2(xs),Hm=!0},l.clearConfig=function(){I0=null,Hm=!1},l.isValidAttribute=function(xs,Nt,so){I0||j2({});const $o=Yc(xs),Da=Yc(Nt);return GP($o,Da,so)},l.addHook=function(xs,Nt){typeof Nt=="function"&&(Jt[xs]=Jt[xs]||[],jg(Jt[xs],Nt))},l.removeHook=function(xs){if(Jt[xs])return h_(Jt[xs])},l.removeHooks=function(xs){Jt[xs]&&(Jt[xs]=[])},l.removeAllHooks=function(){Jt={}},l}var $R=qS();const PR=cn.each,m0=cn.trim,WA=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],DR={ftp:21,http:80,https:443,mailto:25},XS=["img","video"],RR=(s,l)=>xe(s)?!s:xe(l)?!gt(XS,l):!0,ZA=s=>{try{return decodeURIComponent(s)}catch{return unescape(s)}},UA=(s,l,d)=>{const m=ZA(l).replace(/\s/g,"");return s.allow_script_urls?!1:/((java|vb)script|mhtml):/i.test(m)?!0:s.allow_html_data_urls?!1:/^data:image\//i.test(m)?RR(s.allow_svg_data_urls,d)&&/^data:image\/svg\+xml/i.test(m):/^data:/i.test(m)};class zh{static parseDataUri(l){let d;const m=decodeURIComponent(l).split(","),v=/data:([^;]+)/.exec(m[0]);return v&&(d=v[1]),{type:d,data:m[1]}}static isDomSafe(l,d,m={}){if(m.allow_script_urls)return!0;{const v=op.decode(l).replace(/[\s\u0000-\u001F]+/g,"");return!UA(m,v,d)}}static getDocumentBaseUrl(l){var d;let m;return l.protocol.indexOf("http")!==0&&l.protocol!=="file:"?m=(d=l.href)!==null&&d!==void 0?d:"":m=l.protocol+"//"+l.host+l.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(m)&&(m=m.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(m)||(m+="/")),m}constructor(l,d={}){this.path="",this.directory="",l=m0(l),this.settings=d;const m=d.base_uri,v=this;if(/^([\w\-]+):([^\/]{2})/i.test(l)||/^\s*#/.test(l)){v.source=l;return}const w=l.indexOf("//")===0;if(l.indexOf("/")===0&&!w&&(l=(m&&m.protocol||"http")+"://mce_host"+l),!/^[\w\-]*:?\/\//.test(l)){const B=m?m.path:new zh(document.location.href).directory;if((m==null?void 0:m.protocol)==="")l="//mce_host"+v.toAbsPath(B,l);else{const H=/([^#?]*)([#?]?.*)/.exec(l);H&&(l=(m&&m.protocol||"http")+"://mce_host"+v.toAbsPath(B,H[1])+H[2])}}l=l.replace(/@@/g,"(mce_at)");const $=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(l);$&&PR(WA,(B,H)=>{let G=$[H];G&&(G=G.replace(/\(mce_at\)/g,"@@")),v[B]=G}),m&&(v.protocol||(v.protocol=m.protocol),v.userInfo||(v.userInfo=m.userInfo),!v.port&&v.host==="mce_host"&&(v.port=m.port),(!v.host||v.host==="mce_host")&&(v.host=m.host),v.source=""),w&&(v.protocol="")}setPath(l){const d=/^(.*?)\/?(\w+)?$/.exec(l);d&&(this.path=d[0],this.directory=d[1],this.file=d[2]),this.source="",this.getURI()}toRelative(l){if(l==="./")return l;const d=new zh(l,{base_uri:this});if(d.host!=="mce_host"&&this.host!==d.host&&d.host||this.port!==d.port||this.protocol!==d.protocol&&d.protocol!=="")return d.getURI();const m=this.getURI(),v=d.getURI();if(m===v||m.charAt(m.length-1)==="/"&&m.substr(0,m.length-1)===v)return m;let w=this.toRelPath(this.path,d.path);return d.query&&(w+="?"+d.query),d.anchor&&(w+="#"+d.anchor),w}toAbsolute(l,d){const m=new zh(l,{base_uri:this});return m.getURI(d&&this.isSameOrigin(m))}isSameOrigin(l){if(this.host==l.host&&this.protocol==l.protocol){if(this.port==l.port)return!0;const d=this.protocol?DR[this.protocol]:null;if(d&&(this.port||d)==(l.port||d))return!0}return!1}toRelPath(l,d){let m=0,v="",w,$;const B=l.substring(0,l.lastIndexOf("/")).split("/"),H=d.split("/");if(B.length>=H.length){for(w=0,$=B.length;w<$;w++)if(w>=H.length||B[w]!==H[w]){m=w+1;break}}if(B.length<H.length){for(w=0,$=H.length;w<$;w++)if(w>=B.length||B[w]!==H[w]){m=w+1;break}}if(m===1)return d;for(w=0,$=B.length-(m-1);w<$;w++)v+="../";for(w=m-1,$=H.length;w<$;w++)w!==m-1?v+="/"+H[w]:v+=H[w];return v}toAbsPath(l,d){let m=0;const v=/\/$/.test(d)?"/":"",w=l.split("/"),$=d.split("/"),B=[];PR(w,ue=>{ue&&B.push(ue)});const H=[];for(let ue=$.length-1;ue>=0;ue--)if(!($[ue].length===0||$[ue]===".")){if($[ue]===".."){m++;continue}if(m>0){m--;continue}H.push($[ue])}const G=B.length-m;let le;return G<=0?le=Ts(H).join("/"):le=B.slice(0,G).join("/")+"/"+Ts(H).join("/"),le.indexOf("/")!==0&&(le="/"+le),v&&le.lastIndexOf("/")!==le.length-1&&(le+=v),le}getURI(l=!1){let d;return(!this.source||l)&&(d="",l||(this.protocol?d+=this.protocol+"://":d+="//",this.userInfo&&(d+=this.userInfo+"@"),this.host&&(d+=this.host),this.port&&(d+=":"+this.port)),this.path&&(d+=this.path),this.query&&(d+="?"+this.query),this.anchor&&(d+="#"+this.anchor),this.source=d),this.source}}const rF=cn.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),qA="data-mce-type";let MR=0;const Pk=(s,l,d,m,v)=>{var w,$,B,H;const G=l.validate,le=d.getSpecialElements();s.nodeType===Jc&&!l.allow_conditional_comments&&/^\[if/i.test((w=s.nodeValue)!==null&&w!==
Line truncated
|
||||
`).replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let B=m.length;for(;B--;){const H=m[B],G=H.firstChild,le=(w=G==null?void 0:G.value)!==null&&w!==void 0?w:"";if(v==="script"){const ue=H.attr("type");ue&&H.attr("type",ue==="mce-no/type"?null:ue.replace(/^mce\-/,"")),l.element_format==="xhtml"&&G&&le.length>0&&(G.value=`// <![CDATA[
|
||||
`+$(le)+`
|
||||
// ]]>`)}else l.element_format==="xhtml"&&G&&le.length>0&&(G.value=`<!--
|
||||
`+$(le)+`
|
||||
-->`)}}),s.addNodeFilter("#comment",m=>{let v=m.length;for(;v--;){const w=m[v],$=w.value;l.preserve_cdata&&($==null?void 0:$.indexOf("[CDATA["))===0?(w.name="#cdata",w.type=4,w.value=d.decode($.replace(/^\[CDATA\[|\]\]$/g,""))):($==null?void 0:$.indexOf("mce:protected "))===0&&(w.name="#text",w.type=3,w.raw=!0,w.value=unescape($).substr(14))}}),s.addNodeFilter("xml:namespace,input",(m,v)=>{let w=m.length;for(;w--;){const $=m[w];$.type===7?$.remove():$.type===1&&v==="input"&&!$.attr("type")&&$.attr("type","text")}}),s.addAttributeFilter("data-mce-type",m=>{Ie(m,v=>{v.attr("data-mce-type")==="format-caret"&&(v.isEmpty(s.schema.getNonEmptyElements())?v.remove():v.unwrap())})}),s.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",(m,v)=>{let w=m.length;for(;w--;)m[w].attr(v,null)}),l.remove_trailing_brs&&NA(l,s,s.schema)},JS=s=>{const l=m=>(m==null?void 0:m.name)==="br",d=s.lastChild;if(l(d)){const m=d.prev;l(m)&&(d.remove(),m.remove())}},fM=(s,l,d)=>{let m;const v=s.dom;let w=l.cloneNode(!0);const $=document.implementation;if($.createHTMLDocument){const B=$.createHTMLDocument("");cn.each(w.nodeName==="BODY"?w.childNodes:[w],H=>{B.body.appendChild(B.importNode(H,!0))}),w.nodeName!=="BODY"?w=B.body.firstChild:w=B.body,m=v.doc,v.doc=B}return lS(s,{...d,node:w}),m&&(v.doc=m),w},hM=(s,l)=>xe(s)&&s.hasEventListeners("PreProcess")&&!l.no_events,l8=(s,l,d)=>hM(s,d)?fM(s,l,d):l,mM=(s,l,d)=>{cn.inArray(l,d)===-1&&(s.addAttributeFilter(d,(m,v)=>{let w=m.length;for(;w--;)m[w].attr(v,null)}),l.push(d))},c8=(s,l,d)=>!l.no_events&&s?eT(s,{...l,content:d}).content:d,u8=(s,l,d)=>{const m=ve(d.getInner?l.innerHTML:s.getOuterHTML(l));return d.selection||ya(qe.fromDom(l))?m:cn.trim(m)},d8=(s,l,d)=>{const m=d.selection?{forced_root_block:!1,...d}:d,v=s.parse(l,m);return JS(v),v},f8=(s,l,d)=>u0(s,l).serialize(d),pM=(s,l,d,m,v)=>{const w=f8(l,d,m);return c8(s,v,w)},h8=(s,l)=>{const d=["data-mce-selected"],m={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...s},v=l&&l.dom?l.dom:Jr.DOM,w=l&&l.schema?l.schema:Df(m),$=Mm(m,w);b_($,m,v);const B=(H,G={})=>{const le={format:"html",...G},ue=l8(l,H,le),ge=u8(v,ue,le),Me=d8($,ge,le);return le.format==="tree"?Me:pM(l,m,w,Me,le)};return{schema:w,addNodeFilter:$.addNodeFilter,addAttributeFilter:$.addAttributeFilter,serialize:B,addRules:w.addValidElements,setRules:w.setValidElements,addTempAttr:Ue(mM,$,d),getTempAttrs:je(d),getNodeFilters:$.getNodeFilters,getAttributeFilters:$.getAttributeFilters,removeNodeFilter:$.removeNodeFilter,removeAttributeFilter:$.removeAttributeFilter}},gM=(s,l)=>{const d=h8(s,l);return{schema:d.schema,addNodeFilter:d.addNodeFilter,addAttributeFilter:d.addAttributeFilter,serialize:d.serialize,addRules:d.addRules,setRules:d.setRules,addTempAttr:d.addTempAttr,getTempAttrs:d.getTempAttrs,getNodeFilters:d.getNodeFilters,getAttributeFilters:d.getAttributeFilters,removeNodeFilter:d.removeNodeFilter,removeAttributeFilter:d.removeAttributeFilter}},e2="html",bM=(s,l)=>({...s,format:l,get:!0,getInner:!0}),vM=(s,l={})=>{const d=l.format?l.format:e2,m=bM(l,d);return p0(s,m).fold(mn,v=>{const w=XF(s,v);return jA(s,w,v)})},m8="html",p8=(s,l)=>({format:m8,...s,set:!0,content:l}),O3=(s,l,d={})=>{const m=p8(d,l);return YA(s,m).map(v=>{const w=jF(s,v.content,v);return Rk(s,w.html,v),w.content}).getOr(l)},OM="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists".split(","),g8="template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format".split(","),b8="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,textcolor".split(","),yM=[{name:"template",replacedWith:"Advanced Template"},{name:"rtc"}],_M=(s,l)=>{const d=kt(l,m=>an(s,m));return ms(d)},xU=s=>{const l=_M(s,OM),d=s.forced_root_block;return(d===!1||d==="")&&l.push("forced_root_block (false only)"),ms(l)},Dp=s=>_M(s,g8),Wk=(s,l)=>{const d=cn.makeMap(s.plugins," "),v=kt(l,w=>an(d,w));return ms(v)},v8=s=>Wk(s,b8),O8=s=>Wk(s,yM.map(l=>l.name)),y8=(s,l)=>{const d=xU(s),m=v8(l),v=m.length>0,w=d.length>0,$=l.theme==="mobile";if(v||w||$){const B=`
|
||||
- `,H=$?`
|
||||
|
||||
Themes:${B}mobile`:"",G=v?`
|
||||
|
||||
Plugins:${B}${m.join(B)}`:"",le=w?`
|
||||
|
||||
Options:${B}${d.join(B)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 6.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/ for more information."+H+G+le)}},_8=s=>Gn(yM,l=>l.name===s).fold(()=>s,l=>l.replacedWith?`${s}, replaced by ${l.replacedWith}`:s),$r=(s,l)=>{const d=Dp(s),m=O8(l),v=m.length>0,w=d.length>0;if(v||w){const $=`
|
||||
- `,B=v?`
|
||||
|
||||
Plugins:${$}${m.map(_8).join($)}`:"",H=w?`
|
||||
|
||||
Options:${$}${d.join($)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+B+H)}},EU=(s,l)=>{y8(s,l),$r(s,l)},Zk=Jr.DOM,w8=s=>{Zk.setStyle(s.id,"display",s.orgDisplay)},$i=s=>de.from(s).each(l=>l.destroy()),S8=s=>{const l=s;l.contentAreaContainer=l.formElement=l.container=l.editorContainer=null,l.bodyElement=l.contentDocument=l.contentWindow=null,l.iframeElement=l.targetElm=null;const d=s.selection;if(d){const m=d.dom;l.selection=d.win=d.dom=m.doc=null}},t2=s=>{const l=s.formElement;l&&(l._mceOldSubmit&&(l.submit=l._mceOldSubmit,delete l._mceOldSubmit),Zk.unbind(l,"submit reset",s.formEventDelegate))},C8=s=>{if(!s.removed){const{_selectionOverrides:l,editorUpload:d}=s,m=s.getBody(),v=s.getElement();m&&s.save({is_removing:!0}),s.removed=!0,s.unbindAllNativeEvents(),s.hasHiddenInput&&xe(v==null?void 0:v.nextSibling)&&Zk.remove(v.nextSibling),o0(s),s.editorManager.remove(s),!s.inline&&m&&w8(s),s0(s),Zk.remove(s.getContainer()),$i(l),$i(d),s.destroy()}},k8=(s,l)=>{const{selection:d,dom:m}=s;if(!s.destroyed){if(!l&&!s.removed){s.remove();return}l||(s.editorManager.off("beforeunload",s._beforeUnload),s.theme&&s.theme.destroy&&s.theme.destroy(),$i(d),$i(m)),t2(s),S8(s),s.destroyed=!0}},n2=(()=>{const s={};return{add:(v,w)=>{s[v]=w},get:v=>s[v]?s[v]:{icons:{}},has:v=>an(s,v)}})(),Zh=nc.ModelManager,zd=(s,l)=>l.dom[s],v_=(s,l)=>parseInt(ki(l,s),10),v0=Ue(zd,"clientWidth"),Gg=Ue(zd,"clientHeight"),o2=Ue(v_,"margin-top"),y3=Ue(v_,"margin-left"),_3=s=>s.dom.getBoundingClientRect(),wM=(s,l,d)=>{const m=v0(s),v=Gg(s);return l>=0&&d>=0&&l<=m&&d<=v},SM=(s,l,d,m)=>{const v=_3(l),w=s?v.left+l.dom.clientLeft+y3(l):0,$=s?v.top+l.dom.clientTop+o2(l):0,B=d-w,H=m-$;return{x:B,y:H}},x8=(s,l,d)=>{const m=qe.fromDom(s.getBody()),v=s.inline?m:ps(m),w=SM(s.inline,v,l,d);return wM(v,w.x,w.y)},E8=s=>de.from(s).map(qe.fromDom),CM=s=>{const l=s.inline?s.getBody():s.getContentAreaContainer();return E8(l).map(ef).getOr(!1)};var kM=()=>{const s=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:s,close:s,getArgs:s}};const w3=s=>{const l=[],d=()=>{const ge=s.theme;return ge&&ge.getNotificationManagerImpl?ge.getNotificationManagerImpl():kM()},m=()=>de.from(l[0]),v=(ge,Me)=>ge.type===Me.type&&ge.text===Me.text&&!ge.progressBar&&!ge.timeout&&!Me.progressBar&&!Me.timeout,w=()=>{Ie(l,ge=>{ge.reposition()})},$=ge=>{l.push(ge)},B=ge=>{as(l,Me=>Me===ge).each(Me=>{l.splice(Me,1)})},H=(ge,Me=!0)=>s.removed||!CM(s)?{}:(Me&&s.dispatch("BeforeOpenNotification",{notification:ge}),Gn(l,He=>v(d().getArgs(He),ge)).getOrThunk(()=>{s.editorManager.setActive(s);const He=d().open(ge,()=>{B(He),w(),b4(s)&&m().fold(()=>s.focus(),Pe=>NC(qe.fromDom(Pe.getEl())))});return $(He),w(),s.dispatch("OpenNotification",{notification:{...He}}),He})),G=()=>{m().each(ge=>{d().close(ge),B(ge),w()})},le=je(l);return(ge=>{ge.on("SkinLoaded",()=>{const Me=kw(ge);Me&&H({text:Me,type:"warning",timeout:0},!1),w()}),ge.on("show ResizeEditor ResizeWindow NodeChange",()=>{requestAnimationFrame(w)}),ge.on("remove",()=>{Ie(l.slice(),Me=>{d().close(Me)})})})(s),{open:H,close:G,getNotifications:le}},hO=nc.PluginManager,G1=nc.ThemeManager;var AU=()=>{const s=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:s,openUrl:s,alert:s,confirm:s,close:s}};const xM=s=>{let l=[];const d=()=>{const Pe=s.theme;return Pe&&Pe.getWindowManagerImpl?Pe.getWindowManagerImpl():AU()},m=(Pe,Ve)=>(...rt)=>Ve?Ve.apply(Pe,rt):void 0,v=Pe=>{s.dispatch("OpenWindow",{dialog:Pe})},w=Pe=>{s.dispatch("CloseWindow",{dialog:Pe})},$=Pe=>{l.push(Pe),v(Pe)},B=Pe=>{w(Pe),l=kt(l,Ve=>Ve!==Pe),l.length===0&&s.focus()},H=()=>de.from(l[l.length-1]),G=Pe=>{s.editorManager.setActive(s),jy(s),s.ui.show();const Ve=Pe();return $(Ve),Ve},le=(Pe,Ve)=>G(()=>d().open(Pe,Ve,B)),ue=Pe=>G(()=>d().openUrl(Pe,B)),ge=(Pe,Ve,rt)=>{const ft=d();ft.alert(Pe,m(rt||ft,Ve))},Me=(Pe,Ve,rt)=>{const ft=d();ft.confirm(Pe,m(rt||ft,Ve))},He=()=>{H().each(Pe=>{d().close(Pe),B(Pe)})};return s.on("remove",()=>{Ie(l,Pe=>{d().close(Pe)})}),{open:le,openUrl:ue,alert:ge,confirm:Me,close:He}},T8=(s,l)=>{s.notificationManager.open({type:"error",text:l})},Uk=(s,l)=>{s._skinLoaded?T8(s,l):s.on("SkinLoaded",()=>{T8(s,l)})},A8=(s,l)=>{Uk(s,Md.translate(["Failed to upload image: {0}",l]))},Yf=(s,l,d)=>{sd(s,l,{message:d}),console.error(d)},qk=(s,l,d)=>d?`Failed to load ${s}: ${d} from url ${l}`:`Failed to load ${s} url: ${l}`,$U=(s,l,d)=>{Yf(s,"PluginLoadError",qk("plugin",l,d))},$8=(s,l,d)=>{Yf(s,"IconsLoadError",qk("icons",l,d))},s2=(s,l,d)=>{Yf(s,"LanguageLoadError",qk("language",l,d))},P8=(s,l,d)=>{Yf(s,"ThemeLoadError",qk("theme",l,d))},EM=(s,l,d)=>{Yf(s,"ModelLoadError",qk("model",l,d))},TM=(s,l,d)=>{const m=Md.translate(["Failed to initialize plugin: {0}",l]);sd(s,"PluginLoadError",{message:m}),r2(m,d),Uk(s,m)},r2=(s,...l)=>{const d=window.console;d&&(d.error?d.error(s,...l):d.log(s,...l))},D8=s=>/^[a-z0-9\-]+$/i.test(s),S3=s=>"con
Line truncated
|
||||
\r \v`.indexOf(s)!==-1,OO=(s,l)=>s.substring(l.length),C2=(s,l,d)=>{let m;const v=d.charAt(0);for(m=l-1;m>=0;m--){const w=s.charAt(m);if(S2(w))return de.none();if(v===w&&As(s,d,m,l))break}return de.some(m)},Fm=(s,l,d,m=0)=>{if(!fN(l))return de.none();const v={text:"",offset:0},w=(B,H,G)=>(v.text=G+v.text,v.offset+=H,C2(v.text,v.offset,d).getOr(H)),$=s.getParent(l.startContainer,s.isBlock)||s.getRoot();return _2(s,l.startContainer,l.startOffset,w,$).bind(B=>{const H=l.cloneRange();if(H.setStart(B.container,B.offset),H.setEnd(l.endContainer,l.endOffset),H.collapsed)return de.none();const G=w2(H);return G.lastIndexOf(d)!==0||OO(G,d).length<m?de.none():de.some({text:OO(G,d),range:H,trigger:d})})},P_=(s,l,d,m=0)=>h6(qe.fromDom(l.startContainer)).fold(()=>Fm(s,l,d,m),v=>{const w=s.createRng();w.selectNode(v.dom);const $=w2(w);return de.some({range:w,text:OO($,d),trigger:d})}),hN=s=>s.nodeType===th,mN=s=>s.nodeType===dc,pN=s=>{if(hN(s))return Lm(s,s.data.length);{const l=s.childNodes;return l.length>0?pN(l[l.length-1]):Lm(s,l.length)}},C$=(s,l)=>{const d=s.childNodes;return d.length>0&&l<d.length?C$(d[l],0):d.length>0&&mN(s)&&d.length===l?pN(d[d.length-1]):Lm(s,l)},jH=(s,l)=>{var d;const m=(d=s.getParent(l.container,s.isBlock))!==null&&d!==void 0?d:s.getRoot();return _2(s,l.container,l.offset,(v,w)=>w===0?-1:w,m).filter(v=>{const w=v.container.data.charAt(v.offset-1);return!S2(w)}).isSome()},YH=s=>l=>{const d=C$(l.startContainer,l.startOffset);return!jH(s,d)},k2=(s,l,d)=>ws(d.triggers,m=>P_(s,l,m)),GH=(s,l)=>{const d=l(),m=s.selection.getRng();return k2(s.dom,m,d).bind(v=>gN(s,l,v))},gN=(s,l,d,m={})=>{var v;const w=l(),B=(v=s.selection.getRng().startContainer.nodeValue)!==null&&v!==void 0?v:"",H=kt(w.lookupByTrigger(d.trigger),le=>d.text.length>=le.minChars&&le.matches.getOrThunk(()=>YH(s.dom))(d.range,B,d.text));if(H.length===0)return de.none();const G=Promise.all(pt(H,le=>le.fetch(d.text,le.maxResults,m).then(ge=>({matchText:d.text,items:ge,columns:le.columns,onAction:le.onAction,highlightOn:le.highlightOn}))));return de.some({lookupData:G,context:d})};var Np;(function(s){s[s.Error=0]="Error",s[s.Value=1]="Value"})(Np||(Np={}));const k$=(s,l,d)=>s.stype===Np.Error?l(s.serror):d(s.svalue),KH=s=>{const l=[],d=[];return Ie(s,m=>{k$(m,v=>d.push(v),v=>l.push(v))}),{values:l,errors:d}},JH=(s,l)=>s.stype===Np.Error?{stype:Np.Error,serror:l(s.serror)}:s,eQ=(s,l)=>s.stype===Np.Value?{stype:Np.Value,svalue:l(s.svalue)}:s,tQ=(s,l)=>s.stype===Np.Value?l(s.svalue):s,nQ=(s,l)=>s.stype===Np.Error?l(s.serror):s,bN=s=>({stype:Np.Value,svalue:s}),vN=s=>({stype:Np.Error,serror:s}),jc={fromResult:s=>s.fold(vN,bN),toResult:s=>k$(s,zc.error,zc.value),svalue:bN,partition:KH,serror:vN,bind:tQ,bindError:nQ,map:eQ,mapError:JH,fold:k$},kx=s=>ae(s)&&ts(s).length>100?" removed due to size":JSON.stringify(s,null,2),ON=s=>{const l=s.length>10?s.slice(0,10).concat([{path:[],getErrorInfo:je("... (only showing first ten failures)")}]):s;return pt(l,d=>"Failed path: ("+d.path.join(" > ")+`)
|
||||
`+d.getErrorInfo())},x2=(s,l)=>jc.serror([{path:s,getErrorInfo:l}]),oQ=(s,l,d)=>x2(s,()=>'Could not find valid *required* value for "'+l+'" in '+kx(d)),sQ=(s,l)=>x2(s,()=>'Choice schema did not contain choice key: "'+l+'"'),rQ=(s,l,d)=>x2(s,()=>'The chosen schema: "'+d+'" did not exist in branches: '+kx(l)),iQ=(s,l)=>x2(s,je(l)),yN=(s,l,d,m)=>ro(d,m).fold(()=>rQ(s,d,m),w=>w.extract(s.concat(["branch: "+m]),l)),aQ=(s,l)=>({extract:(v,w)=>ro(w,s).fold(()=>sQ(v,s),B=>yN(v,w,l,B)),toString:()=>"chooseOn("+s+"). Possible values: "+ts(l)}),_N=(s,l)=>l,lQ=(s,l)=>fe(s)&&fe(l)?E2(s,l):l,x$=s=>(...l)=>{if(l.length===0)throw new Error("Can't merge zero objects");const d={};for(let m=0;m<l.length;m++){const v=l[m];for(const w in v)an(v,w)&&(d[w]=s(d[w],v[w]))}return d},E2=x$(lQ),cQ=x$(_N),wN=()=>({tag:"required",process:{}}),uQ=s=>({tag:"defaultedThunk",process:s}),E$=s=>uQ(je(s)),dQ=()=>({tag:"option",process:{}}),fQ=(s,l)=>s.length>0?jc.svalue(E2(l,cQ.apply(void 0,s))):jc.svalue(l),T$=s=>q(jc.serror,vr)(s),SN={consolidateObj:(s,l)=>{const d=jc.partition(s);return d.errors.length>0?T$(d.errors):fQ(d.values,l)},consolidateArr:s=>{const l=jc.partition(s);return l.errors.length>0?T$(l.errors):jc.svalue(l.values)}},hQ=(s,l,d,m)=>({tag:"field",key:s,newKey:l,presence:d,prop:m}),mQ=(s,l)=>({tag:"custom",newKey:s,instantiator:l}),CN=(s,l,d)=>{switch(s.tag){case"field":return l(s.key,s.newKey,s.presence,s.prop);case"custom":return d(s.newKey,s.instantiator)}},xx=s=>{const l=(m,v)=>jc.bindError(s(v),w=>iQ(m,w)),d=je("val");return{extract:l,toString:d}},kN=xx(jc.svalue),pQ=(s,l,d,m)=>ro(l,d).fold(()=>oQ(s,d,l),m),xN=(s,l,d,m)=>{const v=ro(s,l).getOrThunk(()=>d(s));return m(v)},gQ=(s,l,d)=>d(ro(s,l)),bQ=(s,l,d,m)=>{const v=ro(s,l).map(w=>w===!0?d(s):w);return m(v)},vQ=(s,l,d,m,v)=>{const w=B=>v.extract(l.concat([m]),B),$=B=>B.fold(()=>jc.svalue(de.none()),H=>{const G=v.extract(l.concat([m]),H);return jc.map(G,de.some)});switch(s.tag){case"required":return pQ(l,d,m,w);case"defaultedThunk":return xN(d,m,s.process,w);case"option":return gQ(d,m,$);case"defaultedOptionThunk":return bQ(d,m,s.process,$);case"mergeWithThunk":return xN(d,m,je({}),B=>{const H=E2(s.process(d),B);return w(H)})}},OQ=(s,l,d)=>{const m={},v=[];for(const w of d)CN(w,($,B,H,G)=>{const le=vQ(H,s,l,$,G);jc.fold(le,ue=>{v.push(...ue)},ue=>{m[B]=ue})},($,B)=>{m[$]=B(l)});return v.length>0?jc.serror(v):jc.svalue(m)},A$=s=>({extract:(m,v)=>OQ(m,v,s),toString:()=>`obj{
|
||||
`+pt(s,v=>CN(v,(w,$,B,H)=>w+" -> "+H.toString(),(w,$)=>"state("+w+")")).join(`
|
||||
`)+"}"}),EN=s=>({extract:(m,v)=>{const w=pt(v,($,B)=>s.extract(m.concat(["["+B+"]"]),$));return SN.consolidateArr(w)},toString:()=>"array("+s.toString()+")"}),WU=s=>xx(l=>s(l).fold(jc.serror,jc.svalue)),yQ=(s,l,d)=>{const m=l.extract([s],d);return jc.mapError(m,v=>({input:d,errors:v}))},Ex=(s,l,d)=>jc.toResult(yQ(s,l,d)),TN=s=>`Errors:
|
||||
`+ON(s.errors).join(`
|
||||
`)+`
|
||||
|
||||
Input object: `+kx(s.input),$$=(s,l)=>aQ(s,ns(l,A$)),_Q=je(kN),T2=(s,l)=>xx(d=>{const m=typeof d;return s(d)?jc.svalue(d):jc.serror(`Expected type: ${l} but got: ${m}`)}),AN=T2(Ft,"number"),Tx=T2(j,"string"),wQ=T2(Se,"boolean"),P$=T2(Oe,"function"),D_=hQ,$N=mQ,D$=s=>WU(l=>gt(s,l)?zc.value(l):zc.error(`Unsupported value: "${l}", choose one of "${s.join(", ")}".`)),PN=(s,l)=>D_(s,s,wN(),l),DN=s=>PN(s,Tx),RN=s=>PN(s,P$),MN=(s,l)=>D_(s,s,wN(),EN(l)),R$=(s,l)=>D_(s,s,dQ(),l),Ax=s=>R$(s,Tx),SQ=s=>R$(s,P$),CQ=(s,l)=>D_(s,s,E$(l),_Q()),R_=(s,l,d)=>D_(s,s,E$(l),d),$l=(s,l)=>R_(s,l,AN),t1=(s,l)=>R_(s,l,Tx),NN=(s,l,d)=>R_(s,l,D$(d)),IN=(s,l)=>R_(s,l,wQ),M$=(s,l)=>R_(s,l,P$),kQ=(s,l,d)=>R_(s,l,EN(d)),xQ=DN("type"),EQ=RN("fetch"),$x=RN("onAction"),M_=M$("onSetup",()=>St),ZU=Ax("text"),TQ=Ax("icon"),AQ=Ax("tooltip"),Ip=Ax("label"),$Q=IN("active",!1),PQ=IN("enabled",!0),N$=IN("primary",!1),DQ=s=>CQ("columns",s),yO=s=>t1("type",s),BN=A$([xQ,DN("trigger"),$l("minChars",1),DQ(1),$l("maxResults",10),SQ("matches"),EQ,$x,kQ("highlightOn",[],Tx)]),RQ=s=>Ex("Autocompleter",BN,{trigger:s.ch,...s}),I$=[PQ,AQ,TQ,ZU,M_],LN=[$Q].concat(I$),FN=[M$("predicate",Fe),NN("scope","node",["node","editor"]),NN("position","selection",["node","selection","line"])],HN=I$.concat([yO("contextformbutton"),N$,$x,$N("original",mn)]),B$=LN.concat([yO("contextformbutton"),N$,$x,$N("original",mn)]),L$=I$.concat([yO("contextformbutton")]),F$=LN.concat([yO("contextformtogglebutton")]),MQ=$$("type",{contextformbutton:HN,contextformtogglebutton:B$});A$([yO("contextform"),M$("initValue",je("")),Ip,MN("commands",MQ),R$("launch",$$("type",{contextformbutton:L$,contextformtogglebutton:F$}))].concat(FN));const NQ=s=>{const l=s.ui.registry.getAll().popups,d=ns(l,$=>RQ($).fold(B=>{throw new Error(TN(B))},mn)),m=Wo(Rn(d,$=>$.trigger)),v=Xn(d);return{dataset:d,triggers:m,lookupByTrigger:$=>kt(v,B=>B.trigger===$)}},IQ=(s,l)=>{const d=_b(l.load,50);s.on("keypress compositionend",m=>{m.which!==27&&d.throttle()}),s.on("keydown",m=>{const v=m.which;v===8?d.throttle():v===27&&l.cancelIfNecessary()}),s.on("remove",d.cancel)},BQ=s=>{const l=fm(),d=Ai(!1),m=l.isSet,v=()=>{m()&&(e8(s),fS(s),d.set(!1),l.clear())},w=G=>{m()||(JF(s,G.range),l.set({trigger:G.trigger,matchLength:G.text.length}))},$=Ht(()=>NQ(s)),B=G=>l.get().map(le=>P_(s.dom,s.selection.getRng(),le.trigger).bind(ue=>gN(s,$,ue,G))).getOrThunk(()=>GH(s,$)),H=G=>{B(G).fold(v,le=>{w(le.context),le.lookupData.then(ue=>{l.get().map(ge=>{const Me=le.context;ge.trigger===Me.trigger&&(Me.text.length-ge.matchLength>=10?v():(l.set({...ge,matchLength:Me.text.length}),d.get()?EC(s,{lookupData:ue}):(d.set(!0),dS(s,{lookupData:ue}))))})})})};s.addCommand("mceAutocompleterReload",(G,le)=>{const ue=ae(le)?le.fetchOptions:{};H(ue)}),s.addCommand("mceAutocompleterClose",v),IQ(s,{cancelIfNecessary:v,load:H})},VN=Ko().browser.isSafari(),zN=s=>Sd(qe.fromDom(s)),H$=(s,l)=>{var d;return s.startOffset===0&&s.endOffset===((d=l.textContent)===null||d===void 0?void 0:d.length)},Px=(s,l)=>de.from(s.getParent(l.container(),"details")),Dx=(s,l)=>Px(s,l).isSome(),LQ=(s,l)=>{const d=de.from(s.getParent(l.startContainer,"details")),m=de.from(s.getParent(l.endContainer,"details"));if(d.isSome()||m.isSome()){const v=d.bind(w=>de.from(s.select("summary",w)[0]));return de.some({startSummary:v,startDetails:d,endDetails:m})}else return de.none()},FQ=(s,l)=>hu(l).exists(d=>d.isEqual(s)),HQ=(s,l)=>zf(l).exists(d=>Js(d.getNode())&&Ru(l,d).exists(m=>m.isEqual(s))||d.isEqual(s)),QQ=(s,l)=>l.startSummary.exists(d=>FQ(s,d)),VQ=(s,l)=>l.startSummary.exists(d=>HQ(s,d)),WN=(s,l)=>l.startDetails.exists(d=>Ru(d,s).forall(m=>l.startSummary.exists(v=>!v.contains(s.container())&&v.contains(m.container())))),Q$=(s,l,d)=>d.startDetails.exists(m=>Uc(s,l).forall(v=>!m.contains(v.container()))),V$=(s,l)=>{const d=l.getNode();Ae(d)||s.selection.setCursorLocation(d,l.offset())},z$=(s,l,d)=>{const m=s.dom.getParent(l.container(),"details");if(m&&!m.open){const v=s.dom.select("summary",m)[0];v&&(d?hu(v):zf(v)).each($=>V$(s,$))}else V$(s,l)},zQ=(s,l)=>{const d=H=>H.contains(s.startContainer),m=H=>H.contains(s.endContainer),v=l.startSummary.exists(d),w=l.startSummary.exists(m),$=l.startDetails.forall(H=>l.endDetails.forall(G=>H!==G));return(v||w)&&!(v&&w)||$},ZN=(s,l,d)=>{const{dom:m,selection:v}=s,w=s.getBody();if(d==="character"){const $=$t.fromRangeStart(v.getRng()),B=m.getParent($.container(),m.isBlock),H=Px(m,$),G=B&&m.isEmpty(B),le=ne(B==null?void 0:B.previousSibling),ue=ne(B==null?void 0:B.nextSibling);return G&&(l?ue:le)&&Op(!l,w,$).exists(He=>Dx(m,He)&&!Ka(H,Px(m,He)))?!0:Op(l,w,$).fold(Fe,ge=>{const Me=Px(m,ge);if(Dx(m,ge)&&!Ka(H,Me)){if(l||z$(s,ge,!1),B&&G){if(l&&le)return!0;if(!l&&ue)return!0;z$(s,ge,l),s.dom.remove(B)}return!0}else return!1})}else return!1},WQ=(s,l,d,m)=>{const w=s.selection.getRng(),$=$t.fromRangeStart(w),B=s.getBody();return m==="selection"?zQ(w,l):d?VQ($,l)||Q$(B,$,l):QQ($,l)||WN($,l)},Rx=(s,l,d)=>LQ(s.dom,s.selection.getRng()).fold(()=>ZN(s,l,d)
Line truncated
|
||||
`;return}if(G!=="wbr"){if(v[G]&&(m+=" "),w[G]){m+=" ";return}if(H.type===3&&(m+=H.value),!(H.name in l.getVoidElements())){let ue=H.firstChild;if(ue)do B(ue);while(ue=ue.next)}$[G]&&le.next&&(m+=`
|
||||
`,G==="p"&&(m+=`
|
||||
`))}};return s=PI(s,[/<!\[[^\]]+\]>/g]),B(d.parse(s)),m},DI=s=>(s=PI(s,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,(d,m,v)=>!m&&!v?" ":Fs],/<br class="Apple-interchange-newline">/g,/<br>$/i]),s),YV=s=>{let l=0;return()=>s+l++},GV=s=>{const l=s.toLowerCase(),d={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return cn.hasOwn(d,l)?"image/"+d[l]:"image/"+l},fi=(s,l)=>{const d=Mm({sanitize:_m(s),sandbox_iframes:Wb(s)},s.schema);d.addNodeFilter("meta",v=>{cn.each(v,w=>{w.remove()})});const m=d.parse(l,{forced_root_block:!1,isRootContent:!0});return u0({validate:!0},s.schema).serialize(m)},RI=(s,l)=>({content:s,cancelled:l}),MI=(s,l,d)=>{const m=s.dom.create("div",{style:"display:none"},l),v=rT(s,m,d);return RI(v.node.innerHTML,v.isDefaultPrevented())},KV=(s,l,d)=>{const m=sT(s,l,d),v=fi(s,m.content);return s.hasEventListeners("PastePostProcess")&&!m.isDefaultPrevented()?MI(s,v,d):RI(v,m.isDefaultPrevented())},dP=(s,l,d)=>KV(s,l,d),Kx=(s,l)=>(s.insertContent(l,{merge:Sv(s),paste:!0}),!0),fP=s=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(s),JV=(s,l)=>fP(l)&&Ut(vy(s),d=>Vi(l.toLowerCase(),`.${d.toLowerCase()}`)),NI=(s,l,d)=>(s.undoManager.extra(()=>{d(s,l)},()=>{s.insertContent('<img src="'+l+'">')}),!0),hP=(s,l,d)=>(s.undoManager.extra(()=>{d(s,l)},()=>{s.execCommand("mceInsertLink",!1,l)}),!0),ez=(s,l,d)=>!s.selection.isCollapsed()&&fP(l)?hP(s,l,d):!1,tz=(s,l,d)=>JV(s,l)?NI(s,l,d):!1,nz=(s,l)=>{cn.each([ez,tz,Kx],d=>!d(s,l,Kx))},II=(s,l,d)=>{d||!Hb(s)?Kx(s,l):nz(s,l)},oz=YV("mceclip"),sz=s=>{const l=aP();return xI(l,s),iP(l),l},wO=(s,l,d,m,v)=>{const w=dP(s,l,d);if(!w.cancelled){const $=w.content,B=()=>II(s,$,m);v?W$(s,"insertFromPaste",{dataTransfer:sz($)}).isDefaultPrevented()||(B(),A2(s,"insertFromPaste")):B()}},Jx=(s,l,d,m)=>{const v=d||TI(l);wO(s,EI(l),v,!1,m)},A0=(s,l,d)=>{const m=s.dom.encode(l).replace(/\r\n/g,`
|
||||
`),v=mh(m,gy(s)),w=Gx(v,Vl(s),Om(s));wO(s,w,!1,!0,d)},L_=s=>{const l={};if(s&&s.types)for(let d=0;d<s.types.length;d++){const m=s.types[d];try{l[m]=s.getData(m)}catch{l[m]=""}}return l},$0=(s,l)=>l in s&&s[l].length>0,BI=s=>$0(s,"text/html")||$0(s,"text/plain"),F_=(s,l)=>{const d=l.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return xe(d)?s.dom.encode(d[1]):void 0},rz=(s,l,d,m)=>{const v=oz(),w=A1(s)&&xe(d.name),$=w?F_(s,d.name):v,B=w?d.name:void 0,H=l.create(v,d,m,$,B);return l.add(H),H},mP=(s,l)=>{xk(l.uri).each(({data:d,type:m,base64Encoded:v})=>{const w=v?d:btoa(d),$=l.file,B=s.editorUpload.blobCache,H=B.getByData(w,m),G=H??rz(s,B,$,w);Jx(s,`<img src="${G.blobUri()}">`,!1,!0)})},iz=s=>s.type==="paste",LI=s=>Promise.all(pt(s,l=>X7(l).then(d=>({file:l,uri:d})))),FI=s=>{const l=vy(s);return d=>rr(d.type,"image/")&&Ut(l,m=>GV(m)===d.type)},pP=(s,l)=>{const d=l.items?Ns(Gs(l.items),v=>v.kind==="file"?[v.getAsFile()]:[]):[],m=l.files?Gs(l.files):[];return kt(d.length>0?d:m,FI(s))},gP=(s,l,d)=>{const m=iz(l)?l.clipboardData:l.dataTransfer;if(Fb(s)&&m){const v=pP(s,m);if(v.length>0)return l.preventDefault(),LI(v).then(w=>{d&&s.selection.setRng(d),Ie(w,$=>{mP(s,$)})}),!0}return!1},az=s=>{var l,d;return Mn.os.isAndroid()&&((d=(l=s.clipboardData)===null||l===void 0?void 0:l.items)===null||d===void 0?void 0:d.length)===0},lz=s=>zn.metaKeyPressed(s)&&s.keyCode===86||s.shiftKey&&s.keyCode===45,eE=(s,l,d,m,v)=>{let w=DI(d);const $=$0(l,Yx())||TI(d),B=!$&&zV(w),H=fP(w);($I(w)||!w.length||B&&!H)&&(m=!0),(m||H)&&($0(l,"text/plain")&&B?w=l["text/plain"]:w=jV(w)),!$I(w)&&(m?A0(s,w,v):Jx(s,w,$,v))},cz=(s,l,d)=>{let m;const v=()=>l.getLastRng()||s.selection.getRng();s.on("keydown",w=>{lz(w)&&!w.isDefaultPrevented()&&(m=w.shiftKey&&w.keyCode===86)}),s.on("paste",w=>{if(w.isDefaultPrevented()||az(w))return;const $=d.get()==="text"||m;m=!1;const B=L_(w.clipboardData);!BI(B)&&gP(s,w,v())||($0(B,"text/html")?(w.preventDefault(),eE(s,B,B["text/html"],$,!0)):$0(B,"text/plain")&&$0(B,"text/uri-list")?(w.preventDefault(),eE(s,B,B["text/plain"],$,!0)):(l.create(),Uf.setEditorTimeout(s,()=>{const H=l.getHtml();l.remove(),eE(s,B,H,$,!1)},0)))})},HI=s=>{const l=v=>rr(v,"webkit-fake-url"),d=v=>rr(v,"data:"),m=v=>{var w;return((w=v.data)===null||w===void 0?void 0:w.paste)===!0};s.parser.addNodeFilter("img",(v,w,$)=>{if(!Fb(s)&&m($))for(const B of v){const H=B.attr("src");j(H)&&!B.attr("data-mce-object")&&H!==Mn.transparentSrc&&(l(H)||!Vb(s)&&d(H))&&B.remove()}})},bP=(s,l,d)=>{cz(s,l,d),HI(s)},QI=(s,l)=>{l.get()==="text"?(l.set("html"),TC(s,!1)):(l.set("text"),TC(s,!0)),s.focus()},uz=(s,l)=>{s.addCommand("mceTogglePlainTextPaste",()=>{QI(s,l)}),s.addCommand("mceInsertClipboardContent",(d,m)=>{m.html&&Jx(s,m.html,m.internal,!1),m.text&&A0(s,m.text,!1)})},dz=(s,l,d)=>{if(s)try{return s.clearData(),s.setData("text/html",l),s.setData("text/plain",d),s.setData(Yx(),l),!0}catch{return!1}else return!1},VI=(s,l,d,m)=>{dz(s.clipboardData,l.html,l.text)?(s.preventDefault(),m()):d(l.html,m)},vP=s=>(l,d)=>{const{dom:m,selection:v}=s,w=m.create("div",{contenteditable:"false","data-mce-bogus":"all"}),$=m.create("div",{contenteditable:"true"},l);m.setStyles(w,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),w.appendChild($),m.add(s.getBody(),w);const B=v.getRng();$.focus();const H=m.createRng();H.selectNodeContents($),v.setRng(H),Uf.setEditorTimeout(s,()=>{v.setRng(B),m.remove(w),d()},0)},tE=s=>({html:VV(s.selection.getContent({contextual:!0})),text:s.selection.getContent({format:"text"})}),fz=s=>!!s.dom.getParent(s.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",s.getBody()),OP=s=>!s.selection.isCollapsed()||fz(s),zI=s=>l=>{!l.isDefaultPrevented()&&OP(s)&&s.selection.isEditable()&&VI(l,tE(s),vP(s),()=>{if(Mn.browser.isChromium()||Mn.browser.isFirefox()){const d=s.selection.getRng();Uf.setEditorTimeout(s,()=>{s.selection.setRng(d),s.execCommand("Delete")},0)}else s.execCommand("Delete")})},hz=s=>l=>{!l.isDefaultPrevented()&&OP(s)&&VI(l,tE(s),vP(s),St)},WI=s=>{s.on("cut",zI(s)),s.on("copy",hz(s))},ZI=(s,l)=>{var d,m;return ke.getCaretRangeFromPoint((d=l.clientX)!==null&&d!==void 0?d:0,(m=l.clientY)!==null&&m!==void 0?m:0,s.getDoc())},mz=s=>{const l=s["text/plain"];return l?l.indexOf("file://")===0:!1},UI=(s,l)=>{s.focus(),l&&s.selection.setRng(l)},pz=s=>Ut(s.files,l=>/^image\//.test(l.type)),gz=(s,l,d,m)=>{const v=s.getParent(d,$=>gs(l,$));if(!ne(s.getParent(d,"summary")))return!0;if(v&&an(m,"text/html")){const $=new DOMParser().parseFromString(m["text/html"],"text/html").body;return!ne($.querySelector(v.nodeName.toLowerCase()))}else return!1},nE=s=>{s.on("input",l=>{const d=m=>ne(m.querySelector("summary"));if(l.inputType==="deleteByDrag"){const m=kt(s.dom.select("details"),d);Ie(m,v=>{Js(v.firstChild)&&v.firstChild.remove();const w=s.dom.create("summary");w.appendChild(Jl().dom),v.prepend(w)})}})},bz=(s,l)=>{Nw(s)&&s.on("dragend dragover draggesture dragdrop drop drag",d=>{d.preventDefault(),d.stopPropagation()}),F
Line truncated
|
||||
`}),s.dom.addStyle(H)}const $=Promise.all(OW(s,m,d)).then(w).catch(w),B=Nb(s);return B&&mW(s,B),$},yW=s=>{const l=s.getDoc(),d=s.getBody();Fg(s),Mw(s)||(l.body.spellcheck=!1,mE.setAttrib(d,"spellcheck","false")),s.quirks=hW(s),tT(s);const m=Cw(s);m!==void 0&&(d.dir=m);const v=my(s);v&&s.on("BeforeSetContent",w=>{cn.each(v,$=>{w.content=w.content.replace($,B=>"<!--mce:protected "+escape(B)+"-->")})}),s.on("SetContent",()=>{s.addVisual(s.getBody())}),s.on("compositionstart compositionend",w=>{s.composing=w.type==="compositionstart"})},_W=s=>{Y1(s)||s.load({initial:!0,format:"html"}),s.startContent=s.getContent({format:"raw"})},RP=s=>{s.removed!==!0&&(_W(s),vW(s))},wW=s=>{let l=!1;const d=setTimeout(()=>{l||s.setProgressState(!0)},500);return()=>{clearTimeout(d),l=!0,s.setProgressState(!1)}},VB=s=>{const l=s.getElement();let d=s.getDoc();s.inline&&(mE.addClass(l,"mce-content-body"),s.contentDocument=d=document,s.contentWindow=window,s.bodyElement=l,s.contentAreaContainer=l);const m=s.getBody();m.disabled=!0,s.readonly=$1(s),s._editableRoot=td(s),!s.readonly&&s.hasEditableRoot()&&(s.inline&&mE.getStyle(m,"position",!0)==="static"&&(m.style.position="relative"),m.contentEditable="true"),m.disabled=!1,s.editorUpload=Z8(s),s.schema=Df(HB(s)),s.dom=Jr(d,{keep_values:!0,url_converter:s.convertURL,url_converter_scope:s,update_styles:!0,root_element:s.inline?s.getBody():null,collect:s.inline,schema:s.schema,contentCssCors:Rh(s),referrerPolicy:fs(s),onSetAttrib:$=>{s.dispatch("SetAttrib",$)},force_hex_color:Dg(s)}),s.parser=gW(s),s.serializer=gM(pW(s),s),s.selection=b0(s.dom,s.getWin(),s.serializer,s),s.annotator=iS(s),s.formatter=E3(s),s.undoManager=T3(s),s._nodeChangeDispatcher=new vI(s),s._selectionOverrides=Jz(s),dH(s),Cz(s),RU(s),Y1(s)||(tB(s),fW(s));const v=PV(s);vO(s,v),pH(s),Im(s),_z(s);const w=HF(s);yW(s),w.fold(()=>{const $=wW(s);QB(s).then(()=>{RP(s),$()})},$=>{s.setProgressState(!0),QB(s).then(()=>{$().then(B=>{s.setProgressState(!1),RP(s),b3(s)},B=>{s.notificationManager.open({type:"error",text:String(B)}),RP(s),b3(s)})})})},zB=mt,SW=(s,l,d)=>jm(s,l,zB,d),gE=Jr.DOM,CW=(s,l,d,m)=>{const v=qe.fromTag("iframe");return m.each(w=>Sr(v,"tabindex",w)),$c(v,d),$c(v,{id:s+"_ifr",frameBorder:"0",allowTransparency:"true",title:l}),Ou(v,"tox-edit-area__iframe"),v},kW=s=>{let l=fv(s)+"<html><head>";Pu(s)!==s.documentBaseUrl&&(l+='<base href="'+s.documentBaseURI.getURI()+'" />'),l+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';const d=Rb(s),m=bw(s),v=s.translate(Pw(s));return vi(s)&&(l+='<meta http-equiv="Content-Security-Policy" content="'+vi(s)+'" />'),l+=`</head><body id="${d}" class="mce-content-body ${m}" data-id="${s.id}" aria-label="${v}"><br></body></html>`,l},WB=(s,l)=>{const d=s.translate("Rich Text Area"),m=aa(qe.fromDom(s.getElement()),"tabindex").bind(Gc),v=CW(s.id,d,cr(s),m).dom;v.onload=()=>{v.onload=null,s.dispatch("load")},s.contentAreaContainer=l.iframeContainer,s.iframeElement=v,s.iframeHTML=kW(s),gE.add(l.iframeContainer,v)},F2=s=>{const l=s.iframeElement,d=()=>{s.contentDocument=l.contentDocument,VB(s)};if(Fw(s)||Mn.browser.isFirefox()){const m=s.getDoc();m.open(),m.write(s.iframeHTML),m.close(),d()}else{const m=SW(qe.fromDom(l),"load",()=>{m.unbind(),d()});l.srcdoc=s.iframeHTML}},xW=(s,l)=>{WB(s,l),l.editorContainer&&(l.editorContainer.style.display=s.orgDisplay,s.hidden=gE.isHidden(l.editorContainer)),s.getElement().style.display="none",gE.setAttrib(s.id,"aria-hidden","true"),s.getElement().style.visibility=s.orgVisibility,F2(s)},MP=Jr.DOM,EW=(s,l,d)=>{const m=hO.get(d),v=hO.urls[d]||s.documentBaseUrl.replace(/\/$/,"");if(d=cn.trim(d),m&&cn.inArray(l,d)===-1){if(s.plugins[d])return;try{const w=m(s,v)||{};s.plugins[d]=w,Oe(w.init)&&(w.init(s,v),l.push(d))}catch(w){TM(s,d,w)}}},TW=s=>s.replace(/^\-/,""),AW=s=>{const l=[];Ie(P1(s),d=>{EW(s,l,TW(d))})},$W=s=>{const l=cn.trim(mv(s)),d=s.ui.registry.getAll().icons,m={...n2.get("default").icons,...n2.get(l).icons};nn(m,(v,w)=>{an(d,w)||s.ui.registry.addIcon(w,v)})},ZB=s=>{const l=Eg(s);if(j(l)){const d=G1.get(l);s.theme=d(s,G1.urls[l])||{},Oe(s.theme.init)&&s.theme.init(s,G1.urls[l]||s.documentBaseUrl.replace(/\/$/,""))}else s.theme={}},PW=s=>{const l=Ib(s),d=Zh.get(l);s.model=d(s,Zh.urls[l])},UB=s=>{const l=s.theme.renderUI;return l?l():XB(s)},DW=s=>{const l=s.getElement(),m=Eg(s)(s,l);return m.editorContainer.nodeType&&(m.editorContainer.id=m.editorContainer.id||s.id+"_parent"),m.iframeContainer&&m.iframeContainer.nodeType&&(m.iframeContainer.id=m.iframeContainer.id||s.id+"_iframecontainer"),m.height=m.iframeHeight?m.iframeHeight:l.offsetHeight,m},qB=(s,l)=>({editorContainer:s,iframeContainer:l,api:{}}),RW=s=>{const l=MP.create("div");return MP.insertAfter(l,s),qB(l,l)},XB=s=>{const l=s.getElement();return s.inline?qB(null):RW(l)},MW=s=>{const l=s.getElement();return s.orgDisplay=l.style.display,j(Eg(s))?UB(s):Oe(Eg(s))?DW(s):XB(s)},NW=(s,l)=>{const d={show:de.from(l.show).getOr(St),hide:de.from(l.hide).getOr(St),isEnabled:deLine truncated
|
||||
Actual: `+Nn.join(","));if(!po(T,Yt=>Le(Nn,Yt)))throw new Error("Not all branches were specified when using match. Specified: "+Nn.join(", ")+`
|
||||
Required: `+T.join(", "));return ln[pe].apply(null,Be)},log:ln=>{console.log(ln,{constructors:T,constructor:pe,params:Be})}}}}),M}},wg={...du.generate([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},KO=(_,T)=>_.length===0?wg.none():_.length===1?wg.only(0):T===0?wg.left(0,1):T===_.length-1?wg.right(T-1,T):T>0&&T<_.length-1?wg.middle(T-1,T,T+1):wg.none(),fw=(_,T,M,L,Y)=>{const oe=_.slice(0),pe=KO(_,T),ke=j(Pt(oe,j(0))),Be=Nn=>L.singleColumnWidth(oe[Nn],M),et=(Nn,Pn)=>Y.calcLeftEdgeDeltas(oe,Nn,Pn,M,L.minCellWidth(),L.isRelative),vt=(Nn,Pn,Yt)=>Y.calcMiddleDeltas(oe,Nn,Pn,Yt,M,L.minCellWidth(),L.isRelative),ln=(Nn,Pn)=>Y.calcRightEdgeDeltas(oe,Nn,Pn,M,L.minCellWidth(),L.isRelative);return pe.fold(ke,Be,et,vt,ln)},y1=(_,T,M)=>{let L=0;for(let Y=_;Y<T;Y++)L+=M[Y]!==void 0?M[Y]:0;return L},bm=(_,T)=>{const M=Ee.justCells(_);return Pt(M,L=>{const Y=y1(L.column,L.column+L.colspan,T);return{element:L.element,width:Y,colspan:L.colspan}})},xb=(_,T)=>{const M=Ee.justColumns(_);return Pt(M,(L,Y)=>({element:L.element,width:T[Y],colspan:L.colspan}))},Ps=(_,T)=>{const M=Ee.justCells(_);return Pt(M,L=>{const Y=y1(L.row,L.row+L.rowspan,T);return{element:L.element,height:Y,rowspan:L.rowspan}})},fu=(_,T)=>Pt(_.all,(M,L)=>({element:M.element,height:T[L]})),df=_=>rn(_,(T,M)=>T+M,0),Sg=(_,T)=>Ee.hasColumns(_)?xb(_,T):bm(_,T),Er=(_,T,M)=>{const L=Sg(_,T);Ue(L,Y=>{M.setElementWidth(Y.element,Y.width)})},Cg=(_,T,M,L,Y)=>{const oe=Ee.fromTable(_),pe=Y.getCellDelta(T),ke=Y.getWidths(oe,Y),Be=M===oe.grid.columns-1,et=L.clampTableDelta(ke,M,pe,Y.minCellWidth(),Be),vt=fw(ke,M,et,Y,L),ln=Pt(vt,(Nn,Pn)=>Nn+ke[Pn]);Er(oe,ln,Y),L.resizeTable(Y.adjustTableWidth,et,Be)},Eb=(_,T,M,L)=>{const Y=Ee.fromTable(_),oe=yt(Y,_,L),pe=Pt(oe,(vt,ln)=>M===ln?Math.max(T+vt,hc()):vt),ke=Ps(Y,pe),Be=fu(Y,pe);Ue(Be,vt=>{of(vt.element,vt.height)}),Ue(ke,vt=>{of(vt.element,vt.height)});const et=df(pe);of(_,et)},wa=(_,T,M,L,Y)=>{const oe=Ee.generate(T),pe=L.getWidths(oe,L),ke=L.pixelWidth(),{newSizes:Be,delta:et}=Y.calcRedestributedWidths(pe,ke,M.pixelDelta,L.isRelative);Er(oe,Be,L),L.adjustTableWidth(et)},ff=(_,T,M,L)=>{const Y=Ee.generate(T),oe=L.getWidths(Y,L);Er(Y,oe,L)},$h=_=>Fe(_,(M,L)=>je(M,oe=>oe.column===L.column)?M:M.concat([L]),[]).sort((M,L)=>M.column-L.column),Tb=mr("col"),_1=mr("colgroup"),w1=_=>Bt(_)==="tr"||_1(_),tv=_=>{const T=Sr(_,"colspan",1),M=Sr(_,"rowspan",1);return{element:_,colspan:T,rowspan:M}},Ab=(_,T=tv)=>{const M=ke=>Tb(ke.element)?_.col(ke):_.cell(ke),L=ke=>_1(ke.element)?_.colgroup(ke):_.row(ke),Y=ke=>{if(w1(ke))return L({element:ke});{const Be=ke,et=M(T(Be));return oe=Oe.some({item:Be,replacement:et}),et}};let oe=Oe.none();return{getOrInit:(ke,Be)=>oe.fold(()=>Y(ke),et=>Be(ke,et.item)?et.replacement:Y(ke))}},ed=_=>T=>{const M=[],L=(pe,ke)=>de(M,Be=>ke(Be.item,pe)),Y=pe=>{const ke=_==="td"?{scope:null}:{},Be=T.replace(pe,_,ke);return M.push({item:pe,sub:Be}),Be};return{replaceOrInit:(pe,ke)=>{if(w1(pe)||Tb(pe))return pe;{const Be=pe;return L(Be,ke).fold(()=>Y(Be),et=>ke(pe,et.item)?et.sub:Y(Be))}}}},Nd=_=>Ge(_,"scope").map(T=>T.substr(0,3)),$t={modification:Ab,transform:ed,merging:_=>({unmerge:L=>{const Y=Nd(L);return Y.each(oe=>pr(L,"scope",oe)),()=>{const oe=_.cell({element:L,colspan:1,rowspan:1});return fc(oe,"width"),fc(L,"width"),Y.each(pe=>pr(oe,"scope",pe)),oe}},merge:L=>{const Y=()=>{const oe=Nr(Pt(L,Nd));if(oe.length===0)return Oe.none();{const pe=oe[0],ke=["row","col"];return je(oe,et=>et!==pe&&Le(ke,et))?Oe.none():Oe.from(pe)}};return fc(L[0],"width"),Y().fold(()=>Xe(L[0],"scope"),oe=>pr(L[0],"scope",oe+"group")),j(L[0])}})},hp=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],mp=(_,T)=>{const M=_.property().name(T);return Le(["ol","ul"],M)},Au=(_,T)=>{const M=_.property().name(T);return Le(hp,M)},nv=(_,T)=>Le(["br","img","hr","input"],_.property().name(T)),bi=qt(),$b=_=>Au(bi,_),Ph=_=>mp(bi,_),ov=_=>nv(bi,_),Pb=_=>{const T=mr("br"),M=Be=>po(Be,et=>T(et)||io(et)&&ao(et).trim().length===0),L=Be=>Bt(Be)==="li"||Or(Be,Ph).isSome(),Y=Be=>Ac(Be).map(et=>$b(et)?!0:ov(et)?Bt(et)!=="img":!1).getOr(!1),oe=Be=>qu(Be).bind(et=>{const vt=Y(et);return Vi(et).map(ln=>vt===!0||L(ln)||T(et)||$b(ln)&&!zs(Be,ln)?[]:[nt.fromTag("br")])}).getOr([]),ke=(()=>{const Be=Yn(_,et=>{const vt=Ls(et);return M(vt)?[]:vt.concat(oe(et))});return Be.length===0?[nt.fromTag("br")]:Be})();zi(_[0]),Mi(_[0],ke)},sv=_=>vh(_,!0),S1=_=>{_l(_).length===0&&yi(_)},kg=(_,T)=>({grid:_,cursor:T}),rv=_=>pn(_,T=>pn(T.cells,M=>{const L=M.element;return Ni(sv(L),L)})),mw=(_,T,M)=>{var L,Y;const oe=Bi(_).rows;return Oe.from((Y=(L=oe[T])===null||L===void 0?void 0:L.cells[M])===null||Y===void 0?void 0:Y.element).filter(sv).orThunk(()=>rv(oe))},sa=(_,T,M)=>{const L=mw(_,T,M);return kg(_,L)},Qa=_=>Fe(_,(M,L)=>je(M,oe=>oe.row===L.row)?M:M.concat([L
Line truncated
|
||||
`+g.getErrorInfo())},X=(a,f)=>Kr.serror([{path:a,getErrorInfo:f}]),re=(a,f,g)=>X(a,()=>'Could not find valid *required* value for "'+f+'" in '+jm(g)),ye=(a,f)=>X(a,()=>'Choice schema did not contain choice key: "'+f+'"'),Ze=(a,f,g)=>X(a,()=>'The chosen schema: "'+g+'" did not exist in branches: '+jm(f)),tt=(a,f)=>X(a,()=>"There are unsupported fields: ["+f.join(", ")+"] specified"),tn=(a,f)=>X(a,ne(f)),Kn=a=>{const f=(O,x)=>Kr.bindError(a(x),P=>tn(O,P)),g=ne("val");return{extract:f,toString:g}},Mo=Kn(Kr.svalue),To=(a,f,g,O)=>nn(f,g).fold(()=>re(a,g,f),O),_o=(a,f,g,O)=>{const x=nn(a,f).getOrThunk(()=>g(a));return O(x)},ai=(a,f,g)=>g(nn(a,f)),pi=(a,f,g,O)=>{const x=nn(a,f).map(P=>P===!0?g(a):P);return O(x)},Yl=(a,f,g,O,x)=>{const P=Q=>x.extract(f.concat([O]),Q),I=Q=>Q.fold(()=>Kr.svalue(q.none()),U=>{const ee=x.extract(f.concat([O]),U);return Kr.map(ee,q.some)});switch(a.tag){case"required":return To(f,g,O,P);case"defaultedThunk":return _o(g,O,a.process,P);case"option":return ai(g,O,I);case"defaultedOptionThunk":return pi(g,O,a.process,I);case"mergeWithThunk":return _o(g,O,ne({}),Q=>{const U=lr(a.process(g),Q);return P(U)})}},Uu=(a,f,g)=>{const O={},x=[];for(const P of g)_u(P,(I,Q,U,ee)=>{const se=Yl(U,a,f,I,ee);Kr.fold(se,he=>{x.push(...he)},he=>{O[Q]=he})},(I,Q)=>{O[I]=Q(f)});return x.length>0?Kr.serror(x):Kr.svalue(O)},Fa=a=>({extract:(O,x)=>a().extract(O,x),toString:()=>a().toString()}),F0=a=>Ts(ws(a,V)),Hr=a=>{const f=Jn(a),g=Yn(a,(x,P)=>_u(P,I=>lr(x,{[I]:!0}),ne(x)),{});return{extract:(x,P)=>{const I=R(P)?[]:F0(P),Q=jn(I,U=>!Xr(g,U));return Q.length===0?f.extract(x,P):tt(x,Q)},toString:f.toString}},Jn=a=>({extract:(O,x)=>Uu(O,x,a),toString:()=>`obj{
|
||||
`+Fe(a,x=>_u(x,(P,I,Q,U)=>P+" -> "+U.toString(),(P,I)=>"state("+P+")")).join(`
|
||||
`)+"}"}),yd=a=>({extract:(O,x)=>{const P=Fe(x,(I,Q)=>a.extract(O.concat(["["+Q+"]"]),I));return im.consolidateArr(P)},toString:()=>"array("+a.toString()+")"}),Zn=(a,f)=>{const g=f!==void 0?f:Se;return{extract:(P,I)=>{const Q=[];for(const U of a){const ee=U.extract(P,I);if(ee.stype===Il.Value)return{stype:Il.Value,svalue:g(ee.svalue)};Q.push(ee)}return im.consolidateArr(Q)},toString:()=>"oneOf("+Fe(a,P=>P.toString()).join(", ")+")"}},Ha=(a,f)=>{const g=(P,I)=>yd(Kn(a)).extract(P,I);return{extract:(P,I)=>{const Q=Ts(I),U=g(P,Q);return Kr.bind(U,ee=>{const se=Fe(ee,he=>xi(he,he,$s(),f));return Jn(se).extract(P,I)})},toString:()=>"setOf("+f.toString()+")"}},sb=(a,f)=>{const g=ri(f);return{extract:(P,I)=>g().extract(P,I),toString:()=>g().toString()}},_d=fe(yd,Jn),ea=ne(Mo),tf=(a,f)=>Kn(g=>{const O=typeof g;return a(g)?Kr.svalue(g):Kr.serror(`Expected type: ${f} but got: ${O}`)}),Ym=tf(J,"number"),Ta=tf(p,"string"),Su=tf(R,"boolean"),Xp=tf(W,"function"),wd=a=>{if(Object(a)!==a)return!0;switch({}.toString.call(a).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(a).every(f=>wd(a[f]));default:return!1}},jp=Kn(a=>wd(a)?Kr.svalue(a):Kr.serror("Expected value to be acceptable for sending via postMessage")),nf=(a,f,g,O)=>nn(g,O).fold(()=>Ze(a,g,O),P=>P.extract(a.concat(["branch: "+O]),f)),un=(a,f)=>({extract:(x,P)=>nn(P,a).fold(()=>ye(x,a),Q=>nf(x,P,f,Q)),toString:()=>"chooseOn("+a+"). Possible values: "+Ts(f)}),rb=()=>yd(Mo),of=a=>Kn(f=>a(f).fold(Kr.serror,Kr.svalue)),sf=(a,f)=>Ha(g=>Kr.fromResult(a(g)),f),ru=(a,f,g)=>{const O=f.extract([a],g);return Kr.mapError(O,x=>({input:g,errors:x}))},li=(a,f,g)=>Kr.toResult(ru(a,f,g)),Js=a=>a.fold(f=>{throw new Error(wl(f))},Se),Ei=(a,f,g)=>Js(li(a,f,g)),wl=a=>`Errors:
|
||||
`+su(a.errors).join(`
|
||||
`)+`
|
||||
|
||||
Input object: `+jm(a.input),ys=(a,f)=>un(a,ms(f,Jn)),lh=(a,f)=>sb(a,f),ca=xi,Qr=Bl,Gm=a=>of(f=>ct(a,f)?Zo.value(f):Zo.error(`Unsupported value: "${f}", choose one of "${a.join(", ")}".`)),Gt=a=>ca(a,a,$s(),ea()),Sl=(a,f)=>ca(a,a,$s(),f),Km=a=>Sl(a,Ym),Fs=a=>Sl(a,Ta),Li=(a,f)=>ca(a,a,$s(),Gm(f)),Yp=a=>Sl(a,Su),Cu=a=>Sl(a,Xp),ku=(a,f)=>ca(a,a,wu(),Kn(g=>Kr.serror("The field: "+a+" is forbidden. "+f))),Ic=(a,f)=>ca(a,a,$s(),Jn(f)),am=(a,f)=>ca(a,a,$s(),_d(f)),tl=(a,f)=>ca(a,a,$s(),yd(f)),er=a=>ca(a,a,wu(),ea()),ua=(a,f)=>ca(a,a,wu(),f),rf=a=>ua(a,Ym),nl=a=>ua(a,Ta),c1=(a,f)=>ua(a,Gm(f)),ch=a=>ua(a,Xp),af=(a,f)=>ua(a,yd(f)),Ll=(a,f)=>ua(a,Jn(f)),xu=(a,f)=>ua(a,Hr(f)),yt=(a,f)=>ca(a,a,Mc(f),ea()),Gl=(a,f,g)=>ca(a,a,Mc(f),g),iu=(a,f)=>Gl(a,f,Ym),Fl=(a,f)=>Gl(a,f,Ta),Kl=(a,f,g)=>Gl(a,f,Gm(g)),ya=(a,f)=>Gl(a,f,Su),da=(a,f)=>Gl(a,f,Xp),u1=(a,f)=>Gl(a,f,jp),Jl=(a,f,g)=>Gl(a,f,yd(g)),Sd=(a,f,g)=>Gl(a,f,Jn(g)),bo=a=>{let f=a;return{get:()=>f,set:x=>{f=x}}},K={generate:a=>{if(!k(a))throw new Error("cases must be an array");if(a.length===0)throw new Error("there must be at least one case");const f=[],g={};return mt(a,(O,x)=>{const P=Ts(O);if(P.length!==1)throw new Error("one and only one name per case");const I=P[0],Q=O[I];if(g[I]!==void 0)throw new Error("duplicate key detected:"+I);if(I==="cata")throw new Error("cannot have a case named cata (sorry)");if(!k(Q))throw new Error("case arguments must be an array");f.push(I),g[I]=(...U)=>{const ee=U.length;if(ee!==Q.length)throw new Error("Wrong number of arguments to case "+I+". Expected "+Q.length+" ("+Q+"), got "+ee);return{fold:(...he)=>{if(he.length!==a.length)throw new Error("Wrong number of arguments to fold. Expected "+a.length+", got "+he.length);return he[x].apply(null,U)},match:he=>{const be=Ts(he);if(f.length!==be.length)throw new Error("Wrong number of arguments to match. Expected: "+f.join(",")+`
|
||||
Actual: `+be.join(","));if(!Rt(f,Re=>ct(be,Re)))throw new Error("Not all branches were specified when using match. Specified: "+be.join(", ")+`
|
||||
Required: `+f.join(", "));return he[I].apply(null,U)},log:he=>{console.log(he,{constructors:f,constructor:I,params:U})}}}}),g}};K.generate([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const ve=a=>{const f=[],g=[];return mt(a,O=>{O.fold(x=>{f.push(x)},x=>{g.push(x)})}),{errors:f,values:g}},$e=(a,f)=>{const g={};return vs(a,(O,x)=>{ct(f,x)||(g[x]=O)}),g},ot=(a,f)=>({[a]:f}),Vt=a=>{const f={};return mt(a,g=>{f[g.key]=g.value}),f},gn=(a,f)=>$e(a,f),xn=(a,f)=>ot(a,f),ao=a=>Vt(a),Uo=(a,f)=>a.length===0?Zo.value(f):Zo.value(lr(f,ou.apply(void 0,a))),_i=a=>Zo.error(pt(a)),tr=(a,f)=>{const g=ve(a);return g.errors.length>0?_i(g.errors):Uo(g.values,f)},Vr=a=>W(a)?a:Qt,gc=(a,f,g)=>{let O=a.dom;const x=Vr(g);for(;O.parentNode;){O=O.parentNode;const P=nt.fromDom(O),I=f(P);if(I.isSome())return I;if(x(P))break}return q.none()},Cl=(a,f,g)=>{const O=f(a),x=Vr(g);return O.orThunk(()=>x(a)?q.none():gc(a,f,x))},Bc=(a,f)=>Us(a.element,f.event.target),Cd={can:St,abort:Qt,run:j},qu=a=>{if(!Xr(a,"can")&&!Xr(a,"abort")&&!Xr(a,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(a,null,2)+" does not have can, abort, or run!");return{...Cd,...a}},uh=(a,f)=>(...g)=>po(a,(O,x)=>O&&f(x).apply(void 0,g),!0),Xs=(a,f)=>(...g)=>po(a,(O,x)=>O||f(x).apply(void 0,g),!1),dh=a=>W(a)?{can:St,abort:Qt,run:a}:a,Jm=a=>{const f=uh(a,x=>x.can),g=Xs(a,x=>x.abort);return{can:f,abort:g,run:(...x)=>{mt(a,P=>{P.run.apply(void 0,x)})}}},Ti=ne,Lc=Ti("touchstart"),lm=Ti("touchmove"),fh=Ti("touchend"),ds=Ti("touchcancel"),_s=Ti("mousedown"),fa=Ti("mousemove"),ol=Ti("mouseout"),Gp=Ti("mouseup"),kd=Ti("mouseover"),gi=Ti("focusin"),Fc=Ti("focusout"),Eu=Ti("keydown"),hh=Ti("keyup"),Af=Ti("input"),ep=Ti("change"),lf=Ti("click"),NO=Ti("transitioncancel"),mh=Ti("transitionend"),d1=Ti("transitionstart"),ph=Ti("selectstart"),ta=a=>ne("alloy."+a),Xu={tap:ta("tap")},xd=ta("focus"),gh=ta("blur.post"),bh=ta("paste.post"),tp=ta("receive"),au=ta("execute"),Fi=ta("focus.item"),Ed=Xu.tap,ib=ta("longpress"),f1=ta("sandbox.close"),h1=ta("typeahead.cancel"),vh=ta("system.init"),ec=ta("system.touchmove"),ju=ta("system.touchend"),$f=ta("system.scroll"),cf=ta("system.resize"),bc=ta("system.attached"),Yu=ta("system.detached"),Oh=ta("system.dismissRequested"),H0=ta("system.repositionRequested"),ab=ta("focusmanager.shifted"),Kp=ta("slotcontainer.visibility"),yh=ta("system.external.element.scroll"),Jp=ta("change.tab"),lb=ta("dismiss.tab"),eg=ta("highlight"),tg=ta("dehighlight"),gs=(a,f)=>{cm(a,a.element,f,{})},ho=(a,f,g)=>{cm(a,a.element,f,g)},Td=a=>{gs(a,au())},ng=(a,f,g)=>{cm(a,f,g,{})},cm=(a,f,g,O)=>{const x={target:f,...O};a.getSystem().triggerEvent(g,f,x)},tw=(a,f,g,O)=>{const x={...O,target:f};a.getSystem().triggerEvent(g,f,x)},cb=(a,f,g,O)=>{a.getSystem().triggerEvent(g,f,O.event)},kr=a=>ao(a),ub=(a,f)=>({key:a,value:qu({abort:f})}),m1=(a,f)=>({key:a,value:qu({can:f})}),Q0=a=>({key:a,value:qu({run:(f,g)=>{g.event.prevent()}})}),qt=(a,f)=>({key:a,value:qu({run:f})}),Ad=(a,f,g)=>({key:a,value:qu({run:(O,x)=>{f.apply(void 0,[O,x].concat(g))}})}),IO=a=>f=>qt(a,f),og=a=>f=>({key:a,value:qu({run:(g,O)=>{Bc(g,O)&&f(g,O)}})}),nw=(a,f)=>qt(a,(g,O)=>{g.getSystem().getByUid(f).each(x=>{cb(x,x.element,a,O)})}),np=(a,f,g)=>{const O=f.partUids[g];return nw(a,O)},V0=(a,f)=>qt(a,(g,O)=>{const x=O.event,P=g.getSystem().getByDom(x.target).getOrThunk(()=>Cl(x.target,Q=>g.getSystem().getByDom(Q).toOptional(),Qt).getOr(g));f(g,P,O)}),_h=a=>qt(a,(f,g)=>{g.cut()}),wh=a=>qt(a,(f,g)=>{g.stop()}),$d=(a,f)=>og(a)(f),xr=og(bc()),Pd=og(Yu()),sg=og(vh()),vc=IO(au()),ls=(a,f)=>{const O=(f||document).createElement("div");return O.innerHTML=a,Ya(nt.fromDom(O))},rg=a=>a.dom.innerHTML,Sh=(a,f)=>{const O=zi(a).dom,x=nt.fromDom(O.createDocumentFragment()),P=ls(f,O);nu(x,P),Dr(a),la(a,x)},um=a=>{const f=nt.fromTag("div"),g=nt.fromDom(a.dom.cloneNode(!0));return la(f,g),rg(f)},db=(a,f)=>nt.fromDom(a.dom.cloneNode(f)),p1=a=>db(a,!1),BO=a=>db(a,!0),tc=a=>{if(Te(a))return"#shadow-root";{const f=p1(a);return um(f)}},Pf=a=>tc(a),eC=(a,f,g)=>Us(f,a.element)&&!Us(f,g),fb=kr([m1(xd(),(a,f)=>{const g=f.event,O=g.originator,x=g.target;return eC(a,O,x)?(console.warn(xd()+` did not get interpreted by the desired target.
|
||||
Originator: `+Pf(O)+`
|
||||
Target: `+Pf(x)+`
|
||||
Check the `+xd()+" event handlers"),!1):!0})]);var op=Object.freeze({__proto__:null,events:fb});let gl=0;const Vn=a=>{const g=new Date().getTime(),O=Math.floor(Math.random()*1e9);return gl++,a+"_"+O+gl+String(g)},ow=ne("alloy-id-"),z0=ne("data-alloy-id"),Ch=ow(),Hc=z0(),kh=(a,f)=>{const g=Vn(Ch+a);return ig(f,g),g},ig=(a,f)=>{Object.defineProperty(a.dom,Hc,{value:f,writable:!0})},sp=a=>{const f=Ls(a)?a.dom[Hc]:null;return q.from(f)},ag=a=>Vn(a),hb=Se,Gu=a=>{const f=x=>`The component must be in a context to execute: ${x}`+(a?`
|
||||
`+Pf(a().element)+" is not in context.":""),g=x=>()=>{throw new Error(f(x))},O=x=>()=>{console.warn(f(x))};return{debugInfo:ne("fake"),triggerEvent:O("triggerEvent"),triggerFocus:O("triggerFocus"),triggerEscape:O("triggerEscape"),broadcast:O("broadcast"),broadcastOn:O("broadcastOn"),broadcastEvent:O("broadcastEvent"),build:g("build"),buildOrPatch:g("buildOrPatch"),addToWorld:g("addToWorld"),removeFromWorld:g("removeFromWorld"),addToGui:g("addToGui"),removeFromGui:g("removeFromGui"),getByUid:g("getByUid"),getByDom:g("getByDom"),isConnected:Qt}},Dd=Gu(),lg=(a,f,g)=>{const O=g.toString(),x=O.indexOf(")")+1,P=O.indexOf("("),I=O.substring(P+1,x-1).split(/,\s*/);return a.toFunctionAnnotation=()=>({name:f,parameters:Ku(I.slice(0,1).concat(I.slice(3)))}),a},Ku=a=>Fe(a,f=>Di(f,"/*")?f.substring(0,f.length-2):f),mb=(a,f)=>{const g=a.toString(),O=g.indexOf(")")+1,x=g.indexOf("("),P=g.substring(x+1,O-1).split(/,\s*/);return a.toFunctionAnnotation=()=>({name:f,parameters:Ku(P)}),a},LO=(a,f)=>{const g=f.toString(),O=g.indexOf(")")+1,x=g.indexOf("("),P=g.substring(x+1,O-1).split(/,\s*/);return a.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:Ku(P.slice(1))}),a},cg=Vn("alloy-premade"),Df=a=>(Object.defineProperty(a.element.dom,cg,{value:a.uid,writable:!0}),xn(cg,a)),FO=a=>ns(a.dom,cg),ug=a=>nn(a,cg),xh=a=>LO((f,...g)=>a(f.getApis(),f,...g),a),Ju={init:()=>Hl({readState:ne("No State required")})},Hl=a=>a,W0=(a,f)=>{const g=Fe(f,x=>Ll(x.name(),[Gt("config"),yt("state",Ju)])),O=li("component.behaviours",Jn(g),a.behaviours).fold(x=>{throw new Error(wl(x)+`
|
||||
Complete spec:
|
||||
`+JSON.stringify(a,null,2))},Se);return{list:f,data:ms(O,x=>{const P=x.map(I=>({config:I.config,state:I.state.init(I.config)}));return ne(P)})}},Z0=a=>a.list,U0=a=>a.data,dg=(a,f)=>{const g={};return vs(a,(O,x)=>{vs(O,(P,I)=>{const Q=nn(g,I).getOr([]);g[I]=Q.concat([f(x,P)])})}),g},Qc=a=>({classes:N(a.classes)?[]:a.classes,attributes:N(a.attributes)?{}:a.attributes,styles:N(a.styles)?{}:a.styles}),lu=(a,f)=>({...a,attributes:{...a.attributes,...f.attributes},styles:{...a.styles,...f.styles},classes:a.classes.concat(f.classes)}),Rf=(a,f,g,O)=>{const x={...f};mt(g,se=>{x[se.name()]=se.exhibit(a,O)});const P=dg(x,(se,he)=>({name:se,modification:he})),I=se=>Yn(se,(he,be)=>({...be.modification,...he}),{}),Q=Yn(P.classes,(se,he)=>he.modification.concat(se),[]),U=I(P.attributes),ee=I(P.styles);return Qc({classes:Q,attributes:U,styles:ee})},pb=(a,f,g,O)=>{try{const x=is(g,(P,I)=>{const Q=P[f],U=I[f],ee=O.indexOf(Q),se=O.indexOf(U);if(ee===-1)throw new Error("The ordering for "+a+" does not have an entry for "+Q+`.
|
||||
Order specified: `+JSON.stringify(O,null,2));if(se===-1)throw new Error("The ordering for "+a+" does not have an entry for "+U+`.
|
||||
Order specified: `+JSON.stringify(O,null,2));return ee<se?-1:se<ee?1:0});return Zo.value(x)}catch(x){return Zo.error([x])}},HO=(a,f)=>({handler:a,purpose:f}),QO=(a,f)=>({cHandler:a,purpose:f}),q0=(a,f)=>QO(Ne.apply(void 0,[a.handler].concat(f)),a.purpose),fg=a=>a.cHandler,hg=(a,f)=>({name:a,handler:f}),gb=(a,f)=>{const g={};return mt(a,O=>{g[O.name()]=O.handlers(f)}),g},sw=(a,f,g)=>{const O={...g,...gb(f,a)};return dg(O,hg)},bb=(a,f,g,O)=>{const x=sw(a,g,O);return X0(x,f)},mg=a=>{const f=dh(a);return(g,O,...x)=>{const P=[g,O].concat(x);f.abort.apply(void 0,P)?O.stop():f.can.apply(void 0,P)&&f.run.apply(void 0,P)}},rw=(a,f)=>Zo.error(["The event ("+a+`) has more than one behaviour that listens to it.
|
||||
When this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).
|
||||
The behaviours that can trigger it are: `+JSON.stringify(Fe(f,g=>g.name),null,2)]),g1=(a,f,g)=>{const O=f[g];return O?pb("Event: "+g,"name",a,O).map(x=>{const P=Fe(x,I=>I.handler);return Jm(P)}):rw(g,a)},X0=(a,f)=>{const g=Pi(a,(O,x)=>(O.length===1?Zo.value(O[0].handler):g1(O,f,x)).map(I=>{const Q=mg(I),U=O.length>1?jn(f[x],ee=>dn(O,se=>se.name===ee)).join(" > "):O[0].name;return xn(x,HO(Q,U))}));return tr(g,{})},Vc="alloy.base.behaviour",b1=Jn([ca("dom","dom",$s(),Jn([Gt("tag"),yt("styles",{}),yt("classes",[]),yt("attributes",{}),er("value"),er("innerHtml")])),Gt("components"),Gt("uid"),yt("events",{}),yt("apis",{}),ca("eventOrder","eventOrder",Nc({[au()]:["disabling",Vc,"toggling","typeaheadevents"],[xd()]:[Vc,"focusing","keying"],[vh()]:[Vc,"disabling","toggling","representing"],[Af()]:[Vc,"representing","streaming","invalidating"],[Yu()]:[Vc,"representing","item-events","tooltipping"],[_s()]:["focusing",Vc,"item-type-events"],[Lc()]:["focusing",Vc,"item-type-events"],[kd()]:["item-type-events","tooltipping"],[tp()]:["receiving","reflecting","tooltipping"]}),ea()),er("domModification")]),j0=a=>li("custom.definition",b1,a),vb=a=>({...a.dom,uid:a.uid,domChildren:Fe(a.components,f=>f.element)}),tC=a=>a.domModification.fold(()=>Qc({}),Qc),Ob=a=>a.events,Eh=(a,f)=>{const g=ui(a,f);return g===void 0||g===""?[]:g.split(" ")},Mf=(a,f,g)=>{const x=Eh(a,f).concat([g]);return Mn(a,f,x.join(" ")),!0},Y0=(a,f,g)=>{const O=jn(Eh(a,f),x=>x!==g);return O.length>0?Mn(a,f,O.join(" ")):We(a,f),!1},pg=a=>a.dom.classList!==void 0,yb=a=>Eh(a,"class"),VO=(a,f)=>Mf(a,"class",f),Jr=(a,f)=>Y0(a,"class",f),Rd=(a,f)=>ct(yb(a),f)?Jr(a,f):VO(a,f),na=(a,f)=>{pg(a)?a.dom.classList.add(f):VO(a,f)},zO=a=>{(pg(a)?a.dom.classList:yb(a)).length===0&&We(a,"class")},wi=(a,f)=>{pg(a)?a.dom.classList.remove(f):Jr(a,f),zO(a)},rp=(a,f)=>{const g=pg(a)?a.dom.classList.toggle(f):Rd(a,f);return zO(a),g},Aa=(a,f)=>pg(a)&&a.dom.classList.contains(f),Ai=(a,f)=>{mt(f,g=>{na(a,g)})},Tu=(a,f)=>{mt(f,g=>{wi(a,g)})},G0=(a,f)=>{mt(f,g=>{rp(a,g)})},sl=(a,f)=>Rt(f,g=>Aa(a,g)),v1=a=>{const f=a.dom.classList,g=new Array(f.length);for(let O=0;O<f.length;O++){const x=f.item(O);x!==null&&(g[O]=x)}return g},gg=a=>pg(a)?v1(a):yb(a),Nf=a=>a.dom.value,bg=(a,f)=>{if(f===void 0)throw new Error("Value.set was undefined");a.dom.value=f},dm=(a,f,g)=>uc(a,f).map(x=>{if(g.exists(I=>!Us(I,x))){const I=g.map(ia).getOr("span"),Q=nt.fromTag(I);return Ui(x,Q),Q}else return x}),Th=(a,f,g)=>{g.fold(()=>la(a,f),O=>{Us(O,f)||(Ui(O,f),Pc(O))})},iw=(a,f,g)=>{const O=Fe(f,g),x=Ya(a);return mt(x.slice(O.length),Pc),O},WO=(a,f,g,O)=>{const x=uc(a,f),P=O(g,x),I=dm(a,f,x);return Th(a,P.element,I),P},nC=(a,f,g)=>iw(a,f,(O,x)=>WO(a,x,O,g)),oC=(a,f)=>iw(a,f,(g,O)=>{const x=uc(a,O);return Th(a,g,x),g}),Md=(a,f)=>{const g=Ts(a),O=Ts(f),x=kt(O,g),P=Gs(a,(I,Q)=>!ns(f,Q)||I!==f[Q]).t;return{toRemove:x,toSet:P}},nc=(a,f)=>{const{class:g,style:O,...x}=At(f),{toSet:P,toRemove:I}=Md(a.attributes,x),Q=()=>{mt(I,Ot=>We(f,Ot)),fd(f,P)},U=yr(f),{toSet:ee,toRemove:se}=Md(a.styles,U),he=()=>{mt(se,Ot=>Jo(f,Ot)),Lr(f,ee)},be=gg(f),we=kt(be,a.classes),Re=kt(a.classes,be),Je=()=>{Ai(f,Re),Tu(f,we)},wt=Ot=>{Sh(f,Ot)},at=()=>{const Ot=a.domChildren;oC(f,Ot)},st=()=>{const Ot=f,hn=a.value.getOrUndefined();hn!==Nf(Ot)&&bg(Ot,hn??"")};return Q(),Je(),he(),a.innerHtml.fold(at,wt),st(),f},aw=a=>{const f=nt.fromTag(a.tag);fd(f,a.attributes),Ai(f,a.classes),Lr(f,a.styles),a.innerHtml.each(O=>Sh(f,O));const g=a.domChildren;return nu(f,g),a.value.each(O=>{bg(f,O)}),f},lw=(a,f)=>{try{const g=nc(a,f);return q.some(g)}catch{return q.none()}},fm=a=>a.innerHtml.isSome()&&a.domChildren.length>0,O1=(a,f)=>{const g=x=>ia(x)===a.tag&&!fm(a)&&!FO(x),O=f.filter(g).bind(x=>lw(a,x)).getOrThunk(()=>aw(a));return ig(O,a.uid),O},_b=a=>{const f=nn(a,"behaviours").getOr({});return Ie(Ts(f),g=>{const O=f[g];return V(O)?[O.me]:[]})},wb=(a,f)=>W0(a,f),If=a=>{const f=_b(a);return wb(a,f)},vg=(a,f,g)=>{const O=vb(a),x=tC(a),P={"alloy.base.modification":x},I=f.length>0?Rf(g,P,f,O):x;return lu(O,I)},hm=(a,f,g)=>{const O={"alloy.base.behaviour":Ob(a)};return bb(g,a.eventOrder,f,O).getOrDie()},ip=(a,f)=>{const g=()=>Ot,O=bo(Dd),x=Js(j0(a)),P=If(a),I=Z0(P),Q=U0(P),U=vg(x,I,Q),ee=O1(U,f),se=hm(x,I,Q),he=bo(x.components),be=hn=>{O.set(hn)},we=()=>{O.set(Gu(g))},Re=()=>{const hn=Ya(ee),jt=Ie(hn,Wt=>O.get().getByDom(Wt).fold(()=>[],Dn));he.set(jt)},Je=hn=>{const jt=Q;return(W(jt[hn.name()])?jt[hn.name()]:()=>{throw new Error("Could not find "+hn.name()+" in "+JSON.stringify(a,null,2))})()},wt=hn=>W(Q[hn.name()]),at=()=>x.apis,st=hn=>Q[hn]().map(jt=>jt.state.readState()).getOr("not enabled"),Ot={uid:a.uid,getSystem:O.get,config:Je,hasConfigured:wt,spec:a,readState:st,getApis:at,connect:be,disconnect:we,element:ee,syncComponents:Re,components:he.get,events:se};return Ot},ap=(a,f)=>{const g=nn(a,"components").getOr([]);return f.fold(()=>Fe(g,Ql),O=>Fe(g,(x,P)=>Sb(x,uc(O,P))))},ZO=(a,f)=>{const{events:g,...O}=hb(a),x=ap(O,f),P={...O,events:{...op,...g},comp
Line truncated
|
||||
`);return gt(f,g=>g.indexOf("alloy")>0&&!dn(uw,O=>g.indexOf(O)>-1)).getOr(YO)}else return YO},dw={logEventCut:j,logEventStopped:j,logNoParent:j,logEventNoHandlers:j,logEventResponse:j,write:j},kb=(a,f,g)=>J0(a,f,g),_g=ne(dw),du=ne([Gt("menu"),Gt("selectedMenu")]),GO=ne([Gt("item"),Gt("selectedItem")]);ne(Jn(GO().concat(du())));const wg=ne(Jn(GO())),KO=Ic("initSize",[Gt("numColumns"),Gt("numRows")]),fw=()=>Sl("markers",wg()),y1=()=>Ic("markers",[Gt("backgroundMenu")].concat(du()).concat(GO())),bm=a=>Ic("markers",Fe(a,Gt)),xb=(a,f,g)=>(ev(),ca(f,f,g,of(O=>Zo.value((...x)=>O.apply(void 0,x))))),Ps=a=>xb("onHandler",a,Mc(j)),fu=a=>xb("onKeyboardHandler",a,Mc(q.none)),df=a=>xb("onHandler",a,$s()),Sg=a=>xb("onKeyboardHandler",a,$s()),Er=(a,f)=>Qr(a,ne(f)),Cg=a=>Qr(a,Se),Eb=ne(KO),wa=(a,f,g,O,x,P,I,Q=!1)=>({x:a,y:f,bubble:g,direction:O,placement:x,restriction:P,label:`${I}-${x}`,alwaysFit:Q}),ff=K.generate([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),$h=(a,f,g,O,x,P,I,Q,U)=>a.fold(f,g,O,x,P,I,Q,U),Tb=(a,f,g,O)=>a.fold(f,f,O,O,f,O,g,g),_1=(a,f,g,O)=>a.fold(f,O,f,O,g,g,f,O),w1=ff.southeast,tv=ff.southwest,Ab=ff.northeast,ed=ff.northwest,Nd=ff.south,hw=ff.north,$t=ff.east,hp=ff.west,mp=(a,f,g,O)=>{const x=a+f;return x>O?g:x<g?O:x},Au=(a,f,g)=>Math.min(Math.max(a,f),g),nv=(a,f)=>{switch(f){case 1:return a.x;case 0:return a.x+a.width;case 2:return a.y;case 3:return a.y+a.height}},bi=(a,f)=>kn(["left","right","top","bottom"],g=>nn(f,g).map(O=>nv(a,O))),$b=(a,f,g)=>{const O=(U,ee)=>f[U].map(se=>{const he=U==="top"||U==="bottom",be=he?g.top:g.left,Re=(U==="left"||U==="top"?Math.max:Math.min)(se,ee)+be;return he?Au(Re,a.y,a.bottom):Au(Re,a.x,a.right)}).getOr(ee),x=O("left",a.x),P=O("top",a.y),I=O("right",a.right),Q=O("bottom",a.bottom);return Cr(x,P,I-x,Q-P)},Ph="layout",ov=a=>a.x,Pb=(a,f)=>a.x+a.width/2-f.width/2,sv=(a,f)=>a.x+a.width-f.width,S1=(a,f)=>a.y-f.height,kg=a=>a.y+a.height,rv=(a,f)=>a.y+a.height/2-f.height/2,mw=a=>a.x+a.width,sa=(a,f)=>a.x-f.width,Qa=(a,f,g)=>wa(ov(a),kg(a),g.southeast(),w1(),"southeast",bi(a,{left:1,top:3}),Ph),kl=(a,f,g)=>wa(sv(a,f),kg(a),g.southwest(),tv(),"southwest",bi(a,{right:0,top:3}),Ph),Va=(a,f,g)=>wa(ov(a),S1(a,f),g.northeast(),Ab(),"northeast",bi(a,{left:1,bottom:2}),Ph),os=(a,f,g)=>wa(sv(a,f),S1(a,f),g.northwest(),ed(),"northwest",bi(a,{right:0,bottom:2}),Ph),oc=(a,f,g)=>wa(Pb(a,f),S1(a,f),g.north(),hw(),"north",bi(a,{bottom:2}),Ph),zr=(a,f,g)=>wa(Pb(a,f),kg(a),g.south(),Nd(),"south",bi(a,{top:3}),Ph),za=(a,f,g)=>wa(mw(a),rv(a,f),g.east(),$t(),"east",bi(a,{left:0}),Ph),C1=(a,f,g)=>wa(sa(a,f),rv(a,f),g.west(),hp(),"west",bi(a,{right:1}),Ph),Bf=()=>[Qa,kl,Va,os,zr,oc,za,C1],k1=()=>[kl,Qa,os,Va,zr,oc,za,C1],iv=()=>[Va,os,Qa,kl,oc,zr],JO=()=>[os,Va,kl,Qa,oc,zr],Db=()=>[Qa,kl,Va,os,zr,oc],av=()=>[kl,Qa,os,Va,zr,oc],lv=(a,f)=>f.universal?a:jn(a,g=>ct(f.channels,g));var Lf=Object.freeze({__proto__:null,events:a=>kr([qt(tp(),(f,g)=>{const O=a.channels,x=Ts(O),P=g,I=lv(x,P);mt(I,Q=>{const U=O[Q],ee=U.schema,se=Ei("channel["+Q+`] data
|
||||
Receiver: `+Pf(f.element),ee,P.data);U.onReceive(f,se)})})])}),ey=[Sl("channels",sf(Zo.value,Hr([df("onReceive"),yt("schema",ea())])))];const Dh=(a,f,g)=>vc(O=>{g(O,a,f)}),ha=(a,f,g)=>sg((O,x)=>{g(O,a,f)}),Wa=(a,f,g,O,x,P)=>{const I=Hr(a),Q=Ll(f,[xu("config",a)]);return hf(I,Q,f,g,O,x,P)},gw=(a,f,g,O,x,P)=>{const I=a,Q=Ll(f,[ua("config",a)]);return hf(I,Q,f,g,O,x,P)},zc=(a,f,g)=>lg((x,...P)=>{const I=[x].concat(P);return x.config({name:ne(a)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+a+". Using API: "+g)},Q=>{const U=Array.prototype.slice.call(I,1);return f.apply(void 0,[x,Q.config,Q.state].concat(U))})},g,f),sC=a=>({key:a,value:void 0}),hf=(a,f,g,O,x,P,I)=>{const Q=he=>Xr(he,g)?he[g]():q.none(),U=ms(x,(he,be)=>zc(g,he,be)),se={...ms(P,(he,be)=>mb(he,be)),...U,revoke:Ne(sC,g),config:he=>{const be=Ei(g+"-config",a,he);return{key:g,value:{config:be,me:se,configAsRaw:ri(()=>Ei(g+"-config",a,he)),initialConfig:he,state:I}}},schema:ne(f),exhibit:(he,be)=>Rn(Q(he),nn(O,"exhibit"),(we,Re)=>Re(be,we.config,we.state)).getOrThunk(()=>Qc({})),name:ne(g),handlers:he=>Q(he).map(be=>nn(O,"events").getOr(()=>({}))(be.config,be.state)).getOr({})};return se},On=a=>ao(a),cv=Hr([Gt("fields"),Gt("name"),yt("active",{}),yt("apis",{}),yt("state",Ju),yt("extra",{})]),Za=a=>{const f=Ei("Creating behaviour: "+a.name,cv,a);return Wa(f.fields,f.name,f.active,f.apis,f.extra,f.state)},uv=Hr([Gt("branchKey"),Gt("branches"),Gt("name"),yt("active",{}),yt("apis",{}),yt("state",Ju),yt("extra",{})]),vm=a=>{const f=Ei("Creating behaviour: "+a.name,uv,a);return gw(ys(f.branchKey,f.branches),f.name,f.active,f.apis,f.extra,f.state)},x1=ne(void 0),Wc=Za({fields:ey,name:"receiving",active:Lf});var E1=Object.freeze({__proto__:null,exhibit:(a,f)=>Qc({classes:[],styles:f.useFixed()?{}:{position:"relative"}})});const ji=(a,f=!1)=>a.dom.focus({preventScroll:f}),mf=a=>a.dom.blur(),T1=a=>{const f=Et(a).dom;return a.dom===f.activeElement},Ff=(a=Wu())=>q.from(a.dom.activeElement).map(nt.fromDom),Id=a=>Ff(Et(a)).filter(f=>a.dom.contains(f.dom)),Hn=(a,f)=>{const g=Et(f),O=Ff(g).bind(P=>{const I=Q=>Us(P,Q);return I(f)?q.some(f):jO(f,I)}),x=a(f);return O.each(P=>{Ff(g).filter(I=>Us(I,P)).fold(()=>{ji(P)},j)}),x},$u=(a,f,g,O,x)=>{const P=I=>I+"px";return{position:a,left:f.map(P),top:g.map(P),right:O.map(P),bottom:x.map(P)}},dv=a=>({...a,position:q.some(a.position)}),Hf=(a,f)=>{cn(a,dv(f))},cr=K.generate([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),fv=(a,f,g,O,x,P)=>{const I=f.rect,Q=I.x-g,U=I.y-O,ee=I.width,se=I.height,he=x-(Q+ee),be=P-(U+se),we=q.some(Q),Re=q.some(U),Je=q.some(he),wt=q.some(be),at=q.none();return $h(f.direction,()=>$u(a,we,Re,at,at),()=>$u(a,at,Re,Je,at),()=>$u(a,we,at,at,wt),()=>$u(a,at,at,Je,wt),()=>$u(a,we,Re,at,at),()=>$u(a,we,at,at,wt),()=>$u(a,we,Re,at,at),()=>$u(a,at,Re,Je,at))},Pu=(a,f)=>a.fold(()=>{const g=f.rect;return $u("absolute",q.some(g.x),q.some(g.y),q.none(),q.none())},(g,O,x,P)=>fv("absolute",f,g,O,x,P),(g,O,x,P)=>fv("fixed",f,g,O,x,P)),Rb=(a,f)=>{const g=Ne(bd,f),O=a.fold(g,g,()=>{const I=el();return bd(f).translate(-I.left,-I.top)}),x=Wi(f),P=hd(f);return Cr(O.left,O.top,x,P)},bw=(a,f)=>f.fold(()=>a.fold(Ea,Ea,Cr),g=>a.fold(ne(g),ne(g),()=>{const O=vi(a,g.x,g.y);return Cr(O.left,O.top,g.width,g.height)})),vi=(a,f,g)=>{const O=Ws(f,g),x=()=>{const P=el();return O.translate(-P.left,-P.top)};return a.fold(ne(O),ne(O),x)},vw=(a,f,g,O)=>a.fold(f,g,O);cr.none;const Vl=cr.relative,Om=cr.fixed,Ow=(a,f)=>({anchorBox:a,origin:f}),yw=(a,f)=>Ow(a,f),hv="data-alloy-placement",_w=(a,f)=>{Mn(a,hv,f)},ny=a=>me(a,hv),oy=a=>We(a,hv),A1=K.generate([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),sy=(a,f)=>{const{x:g,y:O,right:x,bottom:P}=f,{x:I,y:Q,right:U,bottom:ee,width:se,height:he}=a,be=I>=g&&I<=x,we=Q>=O&&Q<=P,Re=be&&we,Je=U<=x&&U>=g,wt=ee<=P&&ee>=O,at=Je&&wt,st=Math.min(se,I>=g?x-I:U-g),Ot=Math.min(he,Q>=O?P-Q:ee-O);return{originInBounds:Re,sizeInBounds:at,visibleW:st,visibleH:Ot}},mv=(a,f)=>{const{x:g,y:O,right:x,bottom:P}=f,{x:I,y:Q,width:U,height:ee}=a,se=Math.max(g,x-U),he=Math.max(O,P-ee),be=Au(I,g,se),we=Au(Q,O,he),Re=Math.min(be+U,x)-be,Je=Math.min(we+ee,P)-we;return Cr(be,we,Re,Je)},pp=(a,f,g)=>{const O=ne(f.bottom-g.y),x=ne(g.bottom-f.y),P=Tb(a,x,x,O),I=ne(f.right-g.x),Q=ne(g.right-f.x);return{maxWidth:_1(a,Q,Q,I),maxHeight:P}},ww=(a,f,g,O)=>{const x=a.bubble,P=x.offset,I=$b(O,a.restriction,P),Q=a.x+P.left,U=a.y+P.top,ee=Cr(Q,U,f,g),{originInBounds:se,sizeInBounds:he,visibleW:be,visibleH:we}=sy(ee,I),Re=se&&he,Je=Re?ee:mv(ee,I),wt=Je.width>0&&Je.height>0,{maxWidth:at,maxHeight:st}=pp(a.direction,Je,O),Ot={rect:Je,maxHeight:st,maxWidth:at,direction:a.direction,placement:a.placement,classes:{on:x.classesOn,off:x.classesOff},layout:a.label,testY:U};return Re||a.alwaysFit?A1.fit(Ot):A1.nofit(Ot,be,we,wt)},Sw=(a,f,g,O,x,P)=>{const I=O.width,Q=O.height,U=(se,he,be,we,Re)=>{const Je=se(g,O,x,a,P),wt=ww(Je,I,Q,P);return wt.f
Line truncated
|
||||
Known: [`+Ts(O)+`]
|
||||
Namespace: `+a.getOr("none")+`
|
||||
Spec: `+JSON.stringify(g,null,2))},x=>x.replace()),Iy=(a,f,g,O)=>Lh(g)&&g.uiType===My?Ny(a,f,g,O):Fv.single(!1,ne(g)),e0=(a,f,g,O)=>Iy(a,f,g,O).fold((P,I)=>{const Q=Lh(g)?I(f,g.config,g.validated):I(f),U=nn(Q,"components").getOr([]),ee=Ie(U,se=>e0(a,f,se,O));return[{...Q,components:ee}]},(P,I)=>{if(Lh(g)){const Q=I(f,g.config,g.validated);return g.validated.preprocess.getOr(Se)(Q)}else return I(f)}),bC=(a,f,g,O)=>Ie(g,x=>e0(a,f,x,O)),Hv=(a,f)=>{let g=!1;const O=()=>g,x=()=>{if(g)throw new Error("Trying to use the same placeholder more than once: "+a);return g=!0,f},P=()=>f.fold((I,Q)=>I,(I,Q)=>I);return{name:ne(a),required:P,used:O,replace:x}},tS=(a,f,g,O)=>{const x=ms(O,(I,Q)=>Hv(Q,I)),P=bC(a,f,g,x);return vs(x,I=>{if(I.used()===!1&&I.required())throw new Error("Placeholder: "+I.name()+` was not found in components list
|
||||
Namespace: `+a.getOr("none")+`
|
||||
Components: `+JSON.stringify(f.components,null,2))}),P},nS=Fv.single,KE=Fv.multiple,Fh=ne(My),By=K.generate([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),t0=yt("factory",{sketch:Se}),ic=yt("schema",[]),qa=Gt("name"),Ly=ca("pname","pname",La(a=>"<alloy."+Vn(a.name)+">"),ea()),Qv=Qr("schema",()=>[er("preprocess")]),Fy=yt("defaults",ne({})),Vv=yt("overrides",ne({})),zv=Jn([t0,ic,qa,Ly,Fy,Vv]),n0=Jn([t0,ic,qa,Fy,Vv]),vC=Jn([t0,ic,qa,Ly,Fy,Vv]),Wv=Jn([t0,Qv,qa,Gt("unit"),Ly,Fy,Vv]),OC=a=>a.fold(q.some,q.none,q.some,q.some),yC=a=>{const f=g=>g.name;return a.fold(f,f,f,f)},_C=a=>a.fold(Se,Se,Se,Se),bf=(a,f)=>g=>{const O=Ei("Converting part type",f,g);return a(O)},yc=bf(By.required,zv),Wf=bf(By.external,n0),Mu=bf(By.optional,vC),Zv=bf(By.group,Wv),Hy=ne("entirety");var wC=Object.freeze({__proto__:null,required:yc,external:Wf,optional:Mu,group:Zv,asNamedPart:OC,name:yC,asCommon:_C,original:Hy});const Uv=(a,f,g,O)=>lr(f.defaults(a,g,O),g,{uid:a.partUids[f.name]},f.overrides(a,g,O)),JE=(a,f,g)=>{const O={},x={};return mt(g,P=>{P.fold(I=>{O[I.pname]=nS(!0,(Q,U,ee)=>I.factory.sketch(Uv(Q,I,U,ee)))},I=>{const Q=f.parts[I.name];x[I.name]=ne(I.factory.sketch(Uv(f,I,Q[Hy()]),Q))},I=>{O[I.pname]=nS(!1,(Q,U,ee)=>I.factory.sketch(Uv(Q,I,U,ee)))},I=>{O[I.pname]=KE(!0,(Q,U,ee)=>{const se=Q[I.name];return Fe(se,he=>I.factory.sketch(lr(I.defaults(Q,he,ee),he,I.overrides(Q,he))))})})}),{internals:ne(O),externals:ne(x)}},wp=(a,f)=>{const g={};return mt(f,O=>{OC(O).each(x=>{const P=qv(a,x.pname);g[x.name]=I=>{const Q=Ei("Part: "+x.name+" in "+a,Jn(x.schema),I);return{...P,config:I,validated:Q}}})}),g},qv=(a,f)=>({uiType:Fh(),owner:a,name:f}),oS=(a,f,g)=>({uiType:Fh(),owner:a,name:f,config:g,validated:{}}),SC=a=>Ie(a,f=>f.fold(q.none,q.some,q.none,q.none).map(g=>Ic(g.name,g.schema.concat([Cg(Hy())]))).toArray()),CC=a=>Fe(a,yC),sS=(a,f,g)=>JE(a,f,g),Qy=(a,f,g)=>tS(q.some(a),f,f.components,g),ti=(a,f,g)=>{const O=f.partUids[g];return a.getSystem().getByUid(O).toOptional()},Sp=(a,f,g)=>ti(a,f,g).getOrDie("Could not find part: "+g),kC=(a,f,g)=>{const O={},x=f.partUids,P=a.getSystem();return mt(g,I=>{O[I]=ne(P.getByUid(x[I]))}),O},rS=(a,f)=>{const g=a.getSystem();return ms(f.partUids,(O,x)=>ne(g.getByUid(O)))},iS=a=>Ts(a.partUids),F1=(a,f,g)=>{const O={},x=f.partUids,P=a.getSystem();return mt(g,I=>{O[I]=ne(P.getByUid(x[I]).getOrDie())}),O},aS=(a,f)=>{const g=CC(f);return ao(Fe(g,O=>({key:O,value:a+"-"+O})))},lS=a=>ca("partUids","partUids",Ee(f=>aS(f.uid,a)),ea());var eT=Object.freeze({__proto__:null,generate:wp,generateOne:oS,schemas:SC,names:CC,substitutes:sS,components:Qy,defaultUids:aS,defaultUidsSchema:lS,getAllParts:rS,getAllPartNames:iS,getPart:ti,getPartOrDie:Sp,getParts:kC,getPartsOrDie:F1});const o0=(a,f)=>(a.length>0?[Ic("parts",a)]:[]).concat([Gt("uid"),yt("dom",{}),yt("components",[]),Cg("originalSpec"),yt("debug.sketcher",{})]).concat(f),s0=(a,f,g,O,x)=>{const P=o0(O,x);return Ei(a+" [SpecSchema]",Hr(P.concat(f)),g)},cS=(a,f,g,O)=>{const x=Fg(O),P=s0(a,f,x,[],[]);return g(P,x)},uS=(a,f,g,O,x)=>{const P=Fg(x),I=SC(g),Q=lS(g),U=s0(a,f,P,I,[Q]),ee=sS(a,U,g),se=Qy(a,U,ee.internals());return O(U,se,P,ee.externals())},Zf=a=>ns(a,"uid"),Fg=a=>Zf(a)?a:{...a,uid:ag("uid")},tT=a=>a.uid!==void 0,Xv=Hr([Gt("name"),Gt("factory"),Gt("configFields"),yt("apis",{}),yt("extraApis",{})]),nT=Hr([Gt("name"),Gt("factory"),Gt("configFields"),Gt("partFields"),yt("apis",{}),yt("extraApis",{})]),sd=a=>{const f=Ei("Sketcher for "+a.name,Xv,a),g=P=>cS(f.name,f.configFields,f.factory,P),O=ms(f.apis,xh),x=ms(f.extraApis,(P,I)=>mb(P,I));return{name:f.name,configFields:f.configFields,sketch:g,...O,...x}},_c=a=>{const f=Ei("Sketcher for "+a.name,nT,a),g=I=>uS(f.name,f.configFields,f.partFields,f.factory,I),O=wp(f.name,f.partFields),x=ms(f.apis,xh),P=ms(f.extraApis,(I,Q)=>mb(I,Q));return{name:f.name,partFields:f.partFields,configFields:f.configFields,sketch:g,parts:O,...x,...P}},H1=a=>xa("input")(a)&&ui(a,"type")!=="radio"||xa("textarea")(a);var xC=Object.freeze({__proto__:null,getCurrent:(a,f,g)=>f.find(a)});const oT=[Gt("find")],Ds=Za({fields:oT,name:"composing",apis:xC}),dS=["input","button","textarea","select"],EC=(a,f,g)=>{(f.disabled()?AC:jv)(a,f)},fS=(a,f)=>f.useNative===!0&&ct(dS,ia(a.element)),sT=a=>De(a.element,"disabled"),rT=a=>{Mn(a.element,"disabled","disabled")},TC=a=>{We(a.element,"disabled")},iT=a=>ui(a.element,"aria-disabled")==="true",zn=a=>{Mn(a.element,"aria-disabled","true")},Hg=a=>{Mn(a.element,"aria-disabled","false")},AC=(a,f,g)=>{f.disableClass.each(x=>{na(a.element,x)}),(fS(a,f)?rT:zn)(a),f.onDisabled(a)},jv=(a,f,g)=>{f.disableClass.each(x=>{wi(a.element,x)}),(fS(a,f)?TC:Hg)(a),f.onEnabled(a)},Yv=(a,f)=>fS(a,f)?sT(a):iT(a);var r4=Object.freeze({__proto__:null,enable:jv,disable:AC,isDisabled:Yv,onLoad:EC,set:(a,f,g,O)=>{(O?AC:jv)(a,f)}}),lT=Object.freeze({__proto__:null,exhibit:(a,f)=>Qc({classes:f.disabled()?f.disableClass.toArray():[]}),events:(a,f)=>kr([ub(au(),(g,O)=>Yv(g,a)),ha(a,f,EC)])}),$C=[da
Line truncated
|
||||
`+xc),Hp&&(xc=$p(xc,Lo," "),xc=$p(xc,Po," "),xc=$p(xc,wr," ")),Ot&&PL?Ot.createHTML(xc):xc},f.setConfig=function(Ms){iU(Ms),G2=!0},f.clearConfig=function(){FE=null,G2=!1},f.isValidAttribute=function(Ms,Lt,lo){FE||iU({});const zo=Yd(Ms),cl=Yd(Lt);return Tq(zo,cl,lo)},f.addHook=function(Ms,Lt){typeof Lt=="function"&&(Un[Ms]=Un[Ms]||[],CS(Un[Ms],Lt))},f.removeHook=function(Ms){if(Un[Ms])return K6(Un[Ms])},f.removeHooks=function(Ms){Un[Ms]&&(Un[Ms]=[])},f.removeAllHooks=function(){Un={}},f}var sD=$S();const zT=a=>sD().sanitize(a);var qf=tinymce.util.Tools.resolve("tinymce.util.I18n");const c7={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},rD="temporary-placeholder",WT=a=>()=>nn(a,rD).getOr("!not found!"),PS=(a,f)=>{const g=a.toLowerCase();if(qf.isRtl()){const O=mr(g,"-rtl");return ns(f,O)?O:g}else return g},ZT=(a,f)=>nn(f,PS(a,f)),UT=(a,f)=>{const g=f();return ZT(a,g).getOrThunk(WT(g))},qT=(a,f,g)=>{const O=f();return ZT(a,O).or(g).getOrThunk(WT(O))},u7=a=>qf.isRtl()?ns(c7,a):!1,nk=()=>ss("add-focusable",[xr(a=>{Cb(a.element,"svg").each(f=>Mn(f,"focusable","false"))})]),iD=(a,f,g,O)=>{var x,P;const I=u7(f)?["tox-icon--flip"]:[],Q=nn(g,PS(f,g)).or(O).getOrThunk(WT(g));return{dom:{tag:a.tag,attributes:(x=a.attributes)!==null&&x!==void 0?x:{},classes:a.classes.concat(I),innerHtml:Q},behaviours:On([...(P=a.behaviours)!==null&&P!==void 0?P:[],nk()])}},Pm=(a,f,g,O=q.none())=>iD(f,a,g(),O),d7=(a,f,g)=>{const O=g(),x=gt(a,P=>ns(O,PS(P,O)));return iD(f,x.getOr(rD),O,q.none())},aD={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},XT=sd({name:"Notification",factory:a=>{const f=Ar({dom:Z1(`<p>${zT(a.translationProvider(a.text))}</p>`),behaviours:On([Yo.config({})])}),g=we=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${we}%`}}}),O=we=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${we}%`}}),x=Ar({dom:{tag:"div",classes:a.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[g(0)]},O(0)],behaviours:On([Yo.config({})])}),Q={updateProgress:(we,Re)=>{we.getSystem().isConnected()&&x.getOpt(we).each(Je=>{Yo.set(Je,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[g(Re)]},O(Re)])})},updateText:(we,Re)=>{if(we.getSystem().isConnected()){const Je=f.get(we);Yo.set(Je,[Xi(Re)])}}},U=pt([a.icon.toArray(),a.level.toArray(),a.level.bind(we=>q.from(aD[we])).toArray()]),ee=Ar(Wl.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[Pm("close",{tag:"span",classes:["tox-icon"],attributes:{"aria-label":a.translationProvider("Close")}},a.iconProvider)],action:we=>{a.onAction(we)}})),se=d7(U,{tag:"div",classes:["tox-notification__icon"]},a.iconProvider),he={dom:{tag:"div",classes:["tox-notification__body"]},components:[f.asSpec()],behaviours:On([Yo.config({})])},be=[se,he];return{uid:a.uid,dom:{tag:"div",attributes:{role:"alert"},classes:a.level.map(we=>["tox-notification","tox-notification--in",`tox-notification--${we}`]).getOr(["tox-notification","tox-notification--in"])},behaviours:On([Ao.config({}),ss("notification-events",[qt(gi(),we=>{ee.getOpt(we).each(Ao.focus)})])]),components:be.concat(a.progress?[x.asSpec()]:[]).concat(a.closeButton?[ee.asSpec()]:[]),apis:Q}},configFields:[er("level"),Gt("progress"),er("icon"),Gt("onAction"),Gt("text"),Gt("iconProvider"),Gt("translationProvider"),ya("closeButton",!0)],apis:{updateProgress:(a,f,g)=>{a.updateProgress(f,g)},updateText:(a,f,g)=>{a.updateText(f,g)}}});var jT=(a,f,g)=>{const O=f.backstage.shared,x=()=>{const U=Rr(nt.fromDom(a.getContentAreaContainer())),ee=Ea(),se=Au(ee.x,U.x,U.right),he=Au(ee.y,U.y,U.bottom),be=Math.max(U.right,ee.right),we=Math.max(U.bottom,ee.bottom);return q.some(Cr(se,he,be-se,we-he))};return{open:(U,ee)=>{const se=()=>{ee(),Yi.hide(be)},he=Ql(XT.sketch({text:U.text,level:ct(["success","error","warning","warn","info"],U.type)?U.type:void 0,progress:U.progressBar===!0,icon:U.icon,closeButton:U.closeButton,onAction:se,iconProvider:O.providers.icons,translationProvider:O.providers.translate})),be=Ql(Yi.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:O.getSink,fireDismissalEventInstead:{},...O.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}}}));g.add(be),J(U.timeout)&&U.timeout>0&&sO.setEditorTimeout(a,()=>{se()},U.timeout);const Re={close:se,reposition:()=>{const Je=cu(he),wt={maxHeightFunction:pf()},at=a.notificationManager.getNotifications();if(at[0]===Re){const st={...O.anchors.banner(),overrides:wt};Yi.showWithinBounds(be,Je,{anchor:st},x)}else Ue(at,Re).each(st=>{const Ot=at[st-1].getEl(),hn={type:"node",root:si(),node:q.some(nt.fromDom(Ot)),overrides:wt,layouts:{onRtl:()=>[zr],onLtr:()=>[zr]}};Yi.showWithinBounds(be,Je,{anchLine truncated
|
||||
Cannot use it for: `+Pf(ee.element)+`
|
||||
The conflicting element is`+(Ss(he.element)?" ":" not ")+"already in the DOM")},x=ee=>{const se=g(ee);Xr(f,se)&&O(ee,se);const he=[ee];a.registerId(he,se,ee.events),f[se]=ee},P=ee=>{sp(ee.element).each(se=>{delete f[se],a.unregisterId(se)})};return{find:(ee,se,he)=>a.find(ee,se,he),filter:ee=>a.filterByType(ee),register:x,unregister:P,getById:ee=>nn(f,ee)}},Dp=sd({name:"Container",factory:a=>{const{attributes:f,...g}=a.dom;return{uid:a.uid,dom:{tag:"div",attributes:{role:"presentation",...f},...g},components:a.components,behaviours:_p(a.containerBehaviours),events:a.events,domModification:a.domModification,eventOrder:a.eventOrder}},configFields:[yt("components",[]),il("containerBehaviours",[]),yt("events",{}),yt("domModification",{}),yt("eventOrder",{})]}),Wk=a=>{const f=at=>ba(a.element).fold(St,st=>Us(at,st)),g=_M(),O=(at,st)=>g.find(f,at,st),x=f8(a.element,{triggerEvent:(at,st)=>kb(at,st.target,Ot=>O3(O,at,st,Ot))}),P={debugInfo:ne("real"),triggerEvent:(at,st,Ot)=>{kb(at,st,hn=>OM(O,at,Ot,st,hn))},triggerFocus:(at,st)=>{sp(at).fold(()=>{ji(at)},Ot=>{kb(xd(),at,hn=>(m8(O,xd(),{originator:st,kill:j,prevent:j,target:at},at,hn),!1))})},triggerEscape:(at,st)=>{P.triggerEvent("keydown",at.element,st.event)},getByUid:at=>Je(at),getByDom:at=>wt(at),build:Ql,buildOrPatch:Sb,addToGui:at=>{U(at)},removeFromGui:at=>{ee(at)},addToWorld:at=>{I(at)},removeFromWorld:at=>{Q(at)},broadcast:at=>{be(at)},broadcastOn:(at,st)=>{we(at,st)},broadcastEvent:(at,st)=>{Re(at,st)},isConnected:St},I=at=>{at.connect(P),Ji(at.element)||(g.register(at),mt(at.components(),I),P.triggerEvent(vh(),at.element,{target:at.element}))},Q=at=>{Ji(at.element)||(mt(at.components(),Q),g.unregister(at)),at.disconnect()},U=at=>{Ig(a,at)},ee=at=>{km(at)},se=()=>{x.unbind(),Pc(a.element)},he=at=>{const st=g.filter(tp());mt(st,Ot=>{const hn=Ot.descHandler;fg(hn)(at)})},be=at=>{he({universal:!0,data:at})},we=(at,st)=>{he({universal:!1,channels:at,data:st})},Re=(at,st)=>{const Ot=g.filter(at);return p8(Ot,st)},Je=at=>g.getById(at).fold(()=>Zo.error(new Error('Could not find component with uid: "'+at+'" in system.')),Zo.value),wt=at=>{const st=sp(at).getOr("not found");return Je(st)};return I(a),{root:a,element:a.element,destroy:se,add:U,remove:ee,getByUid:Je,getByDom:wt,addToWorld:I,removeFromWorld:Q,broadcast:be,broadcastOn:we,broadcastEvent:Re}},v8=(a,f)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:Fe(a.items,f.interpreter)}),O8=ne([yt("prefix","form-field"),il("fieldBehaviours",[Ds,Ln])]),y8=ne([Mu({schema:[Gt("dom")],name:"label"}),Mu({factory:{sketch:a=>({uid:a.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:a.text}})},schema:[Gt("text")],name:"aria-descriptor"}),yc({factory:{sketch:a=>{const f=gn(a,["factory"]);return a.factory.sketch(f)}},schema:[Gt("factory")],name:"field"})]),_8=(a,f,g,O)=>{const x=$a(a.fieldBehaviours,[Ds.config({find:Q=>ti(Q,a,"field")}),Ln.config({store:{mode:"manual",getValue:Q=>Ds.getCurrent(Q).bind(Ln.getValue),setValue:(Q,U)=>{Ds.getCurrent(Q).each(ee=>{Ln.setValue(ee,U)})}}})]),P=kr([xr((Q,U)=>{const ee=kC(Q,a,["label","field","aria-descriptor"]);ee.field().each(se=>{const he=Vn(a.prefix);ee.label().each(be=>{Mn(be.element,"for",he),Mn(se.element,"id",he)}),ee["aria-descriptor"]().each(be=>{const we=Vn(a.prefix);Mn(be.element,"id",we),Mn(se.element,"aria-describedby",we)})})})]),I={getField:Q=>ti(Q,a,"field"),getLabel:Q=>ti(Q,a,"label")};return{uid:a.uid,dom:a.dom,components:f,behaviours:x,events:P,apis:I}},$r=_c({name:"FormField",configFields:O8(),partFields:y8(),factory:_8,apis:{getField:(a,f)=>a.getField(f),getLabel:(a,f)=>a.getLabel(f)}});var Zk=Object.freeze({__proto__:null,exhibit:(a,f)=>Qc({attributes:ao([{key:f.tabAttr,value:"true"}])})}),w8=[yt("tabAttr","data-alloy-tabstop")];const $i=Za({fields:w8,name:"tabstopping",active:Zk});var S8=tinymce.util.Tools.resolve("tinymce.html.Entities");const t2=(a,f,g,O)=>{const x=k8(a,f,g,O);return $r.sketch(x)},C8=(a,f)=>t2(a,f,[],[]),k8=(a,f,g,O)=>({dom:n2(g),components:a.toArray().concat([f]),fieldBehaviours:On(O)}),TU=()=>n2([]),n2=a=>({tag:"div",classes:["tox-form__group"].concat(a)}),Zh=(a,f)=>$r.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Xi(f.translate(a))]}),zd=Vn("form-component-change"),v_=Vn("form-close"),v0=Vn("form-cancel"),Gg=Vn("form-action"),o2=Vn("form-submit"),y3=Vn("form-block"),_3=Vn("form-unblock"),wM=Vn("form-tabchange"),SM=Vn("form-resize"),x8=(a,f,g)=>{const O=a.label.map(we=>Zh(we,f)),x=f.icons(),P=we=>{var Re;return(Re=x[we])!==null&&Re!==void 0?Re:we},I=we=>(Re,Je)=>{uf(Je.event.target,"[data-collection-item-value]").each(wt=>{we(Re,Je,wt,ui(wt,"data-collection-item-value"))})},Q=(we,Re)=>{const Je=Fe(Re,st=>{const Ot=qf.translate(st.text),hn=a.columns===1?`<div class="tox-collection__item-label">${Ot}</div>`:"",jt=`<div class="tox-collection__item-icon">${P(st.icon)}</div>`,Wt={_:" "," - ":" ","-":" "},yn=Ot.replace(/\_| \- |\-/g,rs=>Wt[rs]);return`<div cLine truncated
|
||||
`+JSON.stringify(a));p0.setItem(Ex,JSON.stringify(a))},wQ=a=>{const f=AN();return nn(f,a).getOr([])},P$=(a,f)=>{if(!$$(a))return;const g=AN(),O=nn(g,f).getOr([]),x=jn(O,P=>P!==a);g[f]=[a].concat(x).slice(0,TN),Tx(g)},D_=a=>!!a,$N=a=>ms(J1.makeMap(a,/[, ]/),D_),D$=a=>q.from(bD(a)),PN=a=>{const f=q.from(tA(a)).filter(D_).map($N);return D$(a).fold(Qt,g=>f.fold(St,O=>Ts(O).length>0?O:!1))},DN=(a,f)=>{const g=PN(a);return R(g)?g?D$(a):q.none():g[f]?D$(a):q.none()},RN=(a,f)=>DN(a,f).map(g=>O=>Xc.nu(x=>{const P=(Q,U)=>{if(!p(Q))throw new Error("Expected value to be string");if(U!==void 0&&!b(U))throw new Error("Expected meta to be a object");x({value:Q,meta:U})},I={filetype:f,fieldname:O.fieldname,...q.from(O.meta).getOr({})};g.call(a,P,O.value,I)})),MN=a=>q.from(a).filter(p).getOrUndefined(),R$=a=>nA(a)?q.some({targets:yQ.find(a.getBody()),anchorTop:MN(ak(a)),anchorBottom:MN(OD(a))}):q.none(),Ax=a=>q.from(eA(a)),SQ=a=>({getHistory:wQ,addToHistory:P$,getLinkInformation:()=>R$(a),getValidationHandler:()=>Ax(a),getUrlPicker:f=>RN(a,f)}),CQ=(a,f,g,O)=>{const x=bo(!1),P=jc(f),I={icons:()=>f.ui.registry.getAll().icons,menuItems:()=>f.ui.registry.getAll().menuItems,translate:qf.translate,isDisabled:()=>f.mode.isReadOnly()||!f.ui.isEnabled(),getOption:f.options.get},Q=SQ(f),U=cQ(f),ee=vN(f),se=QU(f),he=()=>x.get(),be=wt=>x.set(wt),we={shared:{providers:I,anchors:JH(f,g,O,P.isPositionedAtTop),header:P},urlinput:Q,styles:U,colorinput:ee,dialog:se,isContextMenuOpen:he,setContextMenuState:be},Re={...we,shared:{...we.shared,interpreter:wt=>v2(wt,{},Re),getSink:a.popup}},Je={...we,shared:{...we.shared,interpreter:wt=>v2(wt,{},Je),getSink:a.dialog}};return{popup:Re,dialog:Je}},R_=(a,f,g)=>{const O=(Wt,yn)=>{mt([f,...g],An=>{An.broadcastEvent(Wt,yn)})},x=(Wt,yn)=>{mt([f,...g],An=>{An.broadcastOn([Wt],yn)})},P=Wt=>x(Bh(),{target:Wt.target}),I=Wu(),Q=sc(I,"touchstart",P),U=sc(I,"touchmove",Wt=>O(ec(),Wt)),ee=sc(I,"touchend",Wt=>O(ju(),Wt)),se=sc(I,"mousedown",P),he=sc(I,"mouseup",Wt=>{Wt.raw.button===0&&x(Yw(),{target:Wt.target})}),be=Wt=>x(Bh(),{target:nt.fromDom(Wt.target)}),we=Wt=>{Wt.button===0&&x(Yw(),{target:nt.fromDom(Wt.target)})},Re=()=>{mt(a.editorManager.get(),Wt=>{a!==Wt&&Wt.dispatch("DismissPopups",{relatedTarget:a})})},Je=Wt=>O($f(),xl(Wt)),wt=Wt=>{x(B1(),{}),O(cf(),xl(Wt))},at=Et(nt.fromDom(a.getElement())),st=Mb(at,"scroll",Wt=>{requestAnimationFrame(()=>{const yn=a.getContainer();if(yn!=null){const rs=b0(a,f.element).map(Un=>[Un.element,...Un.others]).getOr([]);dn(rs,Un=>Us(Un,Wt.target))&&(a.dispatch("ElementScroll",{target:Wt.target.dom}),O(yh(),Wt))}})}),Ot=()=>x(B1(),{}),hn=Wt=>{Wt.state&&x(Bh(),{target:nt.fromDom(a.getContainer())})},jt=Wt=>{x(Bh(),{target:nt.fromDom(Wt.relatedTarget.getContainer())})};a.on("PostRender",()=>{a.on("click",be),a.on("tap",be),a.on("mouseup",we),a.on("mousedown",Re),a.on("ScrollWindow",Je),a.on("ResizeWindow",wt),a.on("ResizeEditor",Ot),a.on("AfterProgressState",hn),a.on("DismissPopups",jt)}),a.on("remove",()=>{a.off("click",be),a.off("tap",be),a.off("mouseup",we),a.off("mousedown",Re),a.off("ScrollWindow",Je),a.off("ResizeWindow",wt),a.off("ResizeEditor",Ot),a.off("AfterProgressState",hn),a.off("DismissPopups",jt),se.unbind(),Q.unbind(),U.unbind(),ee.unbind(),he.unbind(),st.unbind()}),a.on("detach",()=>{mt([f,...g],Yb),mt([f,...g],Wt=>Wt.destroy())})},$l=eT,t1=wC,NN=ne([yt("shell",!1),Gt("makeItem"),yt("setupItem",j),gf.field("listBehaviours",[Yo])]),M$=Mu({name:"items",overrides:()=>({behaviours:On([Yo.config({})])})}),kQ=ne([M$]),xQ=ne("CustomList"),EQ=(a,f,g,O)=>{const x=(Q,U)=>{I(Q).fold(()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},ee=>{const se=Yo.contents(ee),he=U.length,be=he-se.length,we=be>0?Zt(be,()=>a.makeItem()):[],Re=se.slice(he);mt(Re,wt=>Yo.remove(ee,wt)),mt(we,wt=>Yo.append(ee,wt));const Je=Yo.contents(ee);mt(Je,(wt,at)=>{a.setupItem(Q,wt,U[at],at)})})},P=a.shell?{behaviours:[Yo.config({})],components:[]}:{behaviours:[],components:f},I=Q=>a.shell?q.some(Q):ti(Q,a,"items");return{uid:a.uid,dom:a.dom,components:P.components,behaviours:$a(a.listBehaviours,P.behaviours),apis:{setItems:x}}},$x=_c({name:xQ(),configFields:NN(),partFields:kQ(),factory:EQ,apis:{setItems:(a,f,g)=>{a.setItems(f,g)}}}),M_=ne([Gt("dom"),yt("shell",!0),il("toolbarBehaviours",[Yo])]),TQ=ne([Mu({name:"groups",overrides:()=>({behaviours:On([Yo.config({})])})})]),AQ=(a,f,g,O)=>{const x=(Q,U)=>{P(Q).fold(()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")},ee=>{Yo.set(ee,U)})},P=Q=>a.shell?q.some(Q):ti(Q,a,"groups"),I=a.shell?{behaviours:[Yo.config({})],components:[]}:{behaviours:[],components:f};return{uid:a.uid,dom:a.dom,components:I.components,beh
Line truncated
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.143 0c2.608.015 5.186 2.178 5.186 5.331 0 0 .077 3.812-.084 4.87-.361 2.41-2.164 4.074-4.65 4.496-1.453.284-2.523.49-3.212.623-.373.071-.634.122-.785.152-.184.038-.997.145-1.35.145-2.732 0-5.21-2.04-5.248-5.33 0 0 0-3.514.03-4.442.093-2.4 1.758-4.342 4.926-4.963 0 0 3.875-.752 4.036-.782.368-.07.775-.1 1.15-.1Zm1.826 2.8L5.83 3.989v2.393l-2.455.475v5.968l6.137-1.189V9.243l2.456-.476V2.8ZM5.83 6.382l3.682-.713v3.574l-3.682.713V6.382Zm27.173-1.64-.084-1.066h-2.226v9.132h2.456V7.743c-.008-1.151.998-2.064 2.149-2.072 1.15-.008 1.987.92 1.995 2.072v5.065h2.455V7.359c-.015-2.18-1.657-3.929-3.837-3.913a3.993 3.993 0 0 0-2.908 1.296Zm-6.3-4.266L29.16 0v2.387l-2.456.475V.476Zm0 3.2v9.132h2.456V3.676h-2.456Zm18.179 11.787L49.11 3.676H46.58l-1.612 4.527-.46 1.382-.384-1.382-1.611-4.527H39.98l3.3 9.132L42.15 16l2.732-.537ZM22.867 9.738c0 .752.568 1.075.921 1.075.353 0 .668-.047.998-.154l.537 1.765c-.23.154-.92.537-2.225.537-1.305 0-2.655-.997-2.686-2.686a136.877 136.877 0 0 1 0-4.374H18.8V3.676h1.612v-1.98l2.455-.476v2.456h2.302V5.9h-2.302v3.837Z"/>
|
||||
</svg>
|
||||
`;const WP=a=>a.nodeName==="BR"||!!a.getAttribute("data-mce-bogus")||a.getAttribute("data-mce-type")==="bookmark",wE=(a,f,g)=>{var O;const x=(O=f.delimiter)!==null&&O!==void 0?O:"›",P=(ee,se,he)=>Wl.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":he,"aria-level":he+1}},components:[Xi(ee)],action:be=>{a.focus(),a.selection.select(se),a.nodeChanged()},buttonBehaviours:On([al.button(g.isDisabled),Ol()])}),I=()=>({dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[Xi(` ${x} `)]}),Q=ee=>po(ee,(se,he,be)=>{const we=P(he.name,he.element,be);return be===0?se.concat([we]):se.concat([I(),we])},[]),U=ee=>{const se=[];let he=ee.length;for(;he-- >0;){const be=ee[he];if(be.nodeType===1&&!WP(be)){const we=IR(a,be);if(we.isDefaultPrevented()||se.push({name:we.name,element:be}),we.isPropagationStopped())break}}return se};return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:On([vo.config({mode:"flow",selector:"div[role=button]"}),ko.config({disabled:g.isDisabled}),Ol(),$i.config({}),Yo.config({}),ss("elementPathEvents",[xr((ee,se)=>{a.shortcuts.add("alt+F11","focus statusbar elementpath",()=>vo.focusIn(ee)),a.on("NodeChange",he=>{const be=U(he.parents),we=be.length>0?Q(be):[];Yo.set(ee,we)})})])]),components:[]}};var D0;(function(a){a[a.None=0]="None",a[a.Both=1]="Both",a[a.Vertical=2]="Vertical"})(D0||(D0={}));const vZ=(a,f,g,O,x)=>{const P={height:I2(O+f.top,e_(a),GT(a))};return g===D0.Both&&(P.width=I2(x+f.left,YT(a),sk(a))),P},hL=(a,f,g)=>{const O=nt.fromDom(a.getContainer()),x=vZ(a,f,g,Nr(O),Ii(O));vs(x,(P,I)=>{J(P)&&Wn(O,I,wP(P))}),MR(a)},OZ=a=>{const f=_D(a);return f===!1?D0.None:f==="both"?D0.Both:D0.Vertical},SE=(a,f,g,O)=>{const P=Ws(g*20,O*20);return hL(a,P,f),q.some(!0)},TO=(a,f)=>{const g=OZ(a);if(g===D0.None)return q.none();const O=g===D0.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return q.some(Pm("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:f.translate("Resize"),"aria-label":f.translate(O)},behaviours:[xO.config({mode:"mouse",repositionTarget:!1,onDrag:(x,P,I)=>hL(a,I,g),blockerClass:"tox-blocker"}),vo.config({mode:"special",onLeft:()=>SE(a,g,-1,0),onRight:()=>SE(a,g,1,0),onUp:()=>SE(a,g,0,-1),onDown:()=>SE(a,g,0,1)}),$i.config({}),Ao.config({})]},f.icons))},mL=(a,f)=>{const g=(O,x,P)=>Yo.set(O,[Xi(f.translate(["{0} "+P,x[P]]))]);return Wl.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:On([al.button(f.isDisabled),Ol(),$i.config({}),Yo.config({}),Ln.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),ss("wordcount-events",[vc(O=>{const x=Ln.getValue(O),P=x.mode==="words"?"characters":"words";Ln.setValue(O,{mode:P,count:x.count}),g(O,x.count,P)}),xr(O=>{a.on("wordCountUpdate",x=>{const{mode:P}=Ln.getValue(O);Ln.setValue(O,{mode:P,count:x.wordCount}),g(O,x.wordCount,P)})})])]),eventOrder:{[au()]:["disabling","alloy.base.behaviour","wordcount-events"]}})},yZ=(a,f)=>{const g=()=>({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v6",rel:"noopener",target:"_blank","aria-label":qf.translate(["Powered by {0}","Tiny"])},innerHtml:bZ.trim()},behaviours:On([Ao.config({})])}]}),O=()=>{const Q=Tk("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[Xi(qf.translate(["Press {0} for help",Q]))]}},x=()=>{const Q=[];return a.hasPlugin("wordcount")&&Q.push(mL(a,f)),sA(a)&&Q.push(g()),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:Q}},P=()=>{const Q=[],U=uk(a),ee=n_(a),se=sA(a)||a.hasPlugin("wordcount"),he=()=>{const be="tox-statusbar__text-container--flex-start",we="tox-statusbar__text-container--flex-end",Re="tox-statusbar__text-container--space-around";if(U){const Je="tox-statusbar__text-container-3-cols";return!se&&!ee?[Je,Re]:se&&!ee?[Je,we]:[Je,be]}return[se&&!ee?we:be]};return ee&&Q.push(wE(a,{},f)),U&&Q.push(O()),se&&Q.push(x()),Q.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...he()]},components:Q}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const Q=P(),U=TO(a,f);return Q.concat(U.toArray())})()}},pL=(a,f)=>f.get().getOrDie(`UI for ${a} has not been rendered`),_Z=(a,f)=>{const g=a.inline,O=g?vB:mB,x=BS(a)?GN:DQ,P=Yz(),I=fs(),Q=fs(),U=fs(),be=Kt().deviceType.isTouch()?["tox-platform-touch"]:[],we=aA(a),Re=t_(a),Je=Ar({dom:{tag:"div",classes:["tox-anchorbar"]}}),wt=Ar({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),at=()=>P.mainUi.get().map(Co=>Co.outerContainer).bind(fi.getHeader),st=()=>Zo.fromOption(P.dialogUi.get().map(Co=>Co.sink),"UI has not been rendered"),Ot=()=>Zo.fromOption(P.popupUi.get().map(Co=>Co.sink),"(popup) UI has not been rendered")
Line truncated
|
||||
`+JSON.stringify(f,null,2)).message),getBounds:a.getDragBounds})])})}),yc({schema:[Gt("dom")],name:"title"}),yc({factory:ZP,schema:[Gt("dom")],name:"close"}),yc({factory:ZP,schema:[Gt("dom")],name:"body"}),Mu({factory:ZP,schema:[Gt("dom")],name:"footer"}),Wf({factory:{sketch:(a,f)=>({...a,dom:f.dom,components:f.components})},schema:[yt("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),yt("components",[])],name:"blocker"})]),kZ=(a,f,g,O)=>{const x=fs(),P=we=>{x.set(we);const Re=a.lazySink(we).getOrDie(),Je=O.blocker(),wt=Re.getSystem().build({...Je,components:Je.components.concat([cu(we)]),behaviours:On([Ao.config({}),ss("dialog-blocker-events",[$d(gi(),()=>{Bp.isBlocked(we)?j():vo.focusIn(we)})])])});Ig(Re,wt),vo.focusIn(we)},I=we=>{x.clear(),ba(we.element).each(Re=>{we.getSystem().getByDom(Re).each(Je=>{km(Je)})})},Q=we=>Sp(we,a,"body"),U=we=>ti(we,a,"footer"),ee=(we,Re)=>{Bp.block(we,Re)},se=we=>{Bp.unblock(we)},he=Vn("modal-events"),be={...a.eventOrder,[bc()]:[he].concat(a.eventOrder["alloy.system.attached"]||[])};return{uid:a.uid,dom:a.dom,components:f,apis:{show:P,hide:I,getBody:Q,getFooter:U,setIdle:se,setBusy:ee},eventOrder:be,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:$a(a.modalBehaviours,[Yo.config({}),vo.config({mode:"cyclic",onEnter:a.onExecute,onEscape:a.onEscape,useTabstopAt:a.useTabstopAt,firstTabstop:a.firstTabstop}),Bp.config({getRoot:x.get}),ss(he,[xr(we=>{wZ(we.element,Sp(we,a,"title").element)})])])}},ll=_c({name:"ModalDialog",configFields:SZ(),partFields:CZ(),factory:kZ,apis:{show:(a,f)=>{a.show(f)},hide:(a,f)=>{a.hide(f)},getBody:(a,f)=>a.getBody(f),getFooter:(a,f)=>a.getFooter(f),setBusy:(a,f,g)=>{a.setBusy(f,g)},setIdle:(a,f)=>{a.setIdle(f)}}}),z2=Jn([Xa,kA].concat(dO)),UP=Su,Z_=[Ck("button"),Xf,Kl("align","end",["start","end"]),qg,Qh,c1("buttonType",["primary","secondary"])],R0=[...Z_,X1],U_=[Li("type",["submit","cancel","custom"]),...R0],xZ=[Li("type",["menu"]),Ug,QS,Xf,tl("items",z2),...Z_],gL=[...Z_,Li("type",["togglebutton"]),Fs("tooltip"),Xf,Ug,ya("active",!1)],bL=ys("type",{submit:U_,cancel:U_,custom:U_,menu:xZ,togglebutton:gL}),vL=[Xa,X1,Li("level",["info","warn","error","success"]),xA,yt("url","")],EZ=Jn(vL),TZ=a=>[Xa,a],AZ=[Xa,X1,Qh,Ck("button"),Xf,UD,c1("buttonType",["primary","secondary","toolbar"]),qg],OL=Jn(AZ),AO=[Xa,kA],qh=AO.concat([wk]),$Z=AO.concat([_k,Qh]),PZ=Jn($Z),DZ=Su,yL=qh.concat([qD("auto")]),RZ=Jn(yL),MZ=_d([l_,X1,xA]),NZ=qh.concat([Fl("storageKey","default")]),qP=Jn(NZ),XP=Ta,_L=Jn(qh),IZ=Ta,BZ=AO.concat([Fl("tag","textarea"),Fs("scriptId"),Fs("scriptUrl"),u1("settings",void 0)]),wL=AO.concat([Fl("tag","textarea"),Cu("init")]),LZ=of(a=>li("customeditor.old",Hr(wL),a).orThunk(()=>li("customeditor.new",Hr(BZ),a))),FZ=Ta,SL=Jn(qh),HZ=rb(),CE=a=>[Xa,Km("columns"),a],X_=[Xa,Fs("html"),Kl("presets","presentation",["presentation","document"])],kE=Jn(X_),CL=qh.concat([ya("border",!1),ya("sandboxed",!0),ya("streamContent",!1),ya("transparent",!0)]),xE=Jn(CL),qd=Ta,EE=Jn(AO.concat([nl("height")])),kL=Jn([Fs("url"),rf("zoom"),rf("cachedWidth"),rf("cachedHeight")]),xL=qh.concat([nl("inputMode"),nl("placeholder"),ya("maximized",!1),Qh]),QZ=Jn(xL),VZ=Ta,M0=a=>[Xa,_k,a,Kl("align","start",["start","center","end"])],cq=[X1,l_],zZ=[X1,tl("items",lh("items",()=>jP))],jP=Zn([Jn(cq),Jn(zZ)]),j_=qh.concat([tl("items",jP),Qh]),TE=Jn(j_),EL=Ta,WZ=qh.concat([am("items",[X1,l_]),iu("size",1),Qh]),ZZ=Jn(WZ),UZ=Ta,qZ=qh.concat([ya("constrain",!0),Qh]),Y_=Jn(qZ),XZ=Jn([Fs("width"),Fs("height")]),jZ=AO.concat([_k,iu("min",0),iu("max",0)]),YZ=Jn(jZ),uq=Ym,GZ=[Xa,tl("header",Ta),tl("cells",yd(Ta))],KZ=Jn(GZ),W2=qh.concat([nl("placeholder"),ya("maximized",!1),Qh]),JZ=Jn(W2),eU=Ta,YP=[Li("type",["directory","leaf"]),zD,Fs("id"),ua("menu",$2)],tU=Jn(YP),s=YP.concat([tl("children",lh("children",()=>un("type",{directory:l,leaf:tU})))]),l=Jn(s),d=un("type",{directory:l,leaf:tU}),m=[Xa,tl("items",d),ch("onLeafAction"),ch("onToggleExpand"),Jl("defaultExpandedIds",[],Ta),nl("defaultSelectedId")],v=Jn(m),w=qh.concat([Kl("filetype","file",["image","media","file"]),Qh,nl("picker_text")]),$=Jn(w),B=Jn([l_,VS]),H=a=>ca("items","items",$s(),yd(of(f=>li(`Checking item of ${a}`,G,f).fold(g=>Zo.error(wl(g)),g=>Zo.value(g))))),G=Fa(()=>un("type",{alertbanner:EZ,bar:Jn(TZ(H("bar"))),button:OL,checkbox:PZ,colorinput:qP,colorpicker:_L,dropzone:SL,grid:Jn(CE(H("grid"))),iframe:xE,input:QZ,listbox:TE,selectbox:ZZ,sizeinput:Y_,slider:YZ,textarea:JZ,urlinput:$,customeditor:LZ,htmlpanel:kE,imagepreview:EE,collection:RZ,label:Jn(M0(H("label"))),table:KZ,tree:v,panel:ue})),le=[Xa,yt("classes",[]),tl("items",G)],ue=Jn(le),ge=[Ck("tab"),zD,tl("items",G)],Me=[Xa,am("tabs",ge)],He=Jn(Me),Pe=R0,Ve=bL,rt=Jn([Fs("title"),Sl("body",un("type",{panel:ue,tabpanel:He})),Fl("size","normal"),Jl("buttons",[],Ve),yt("initialData",{}),da("onAction",j),da("onChange",j),da("onSubmit",j),da("onClose",j),da("onCancel",j),da("onTabChange",j)]),ft=a=>li("dialog",rt,
Line truncated
|
||||
Actual: `+Vr.join(","));if(!Rt(K,Cl=>Zt(Vr,Cl)))throw new Error("Not all branches were specified when using match. Specified: "+Vr.join(", ")+`
|
||||
Required: `+K.join(", "));return tr[gn].apply(null,ao)},log:tr=>{console.log(tr,{constructors:K,constructor:gn,params:ao})}}}}),ve}}.generate([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])});const Zn=(z,K)=>{const ve=Jc.fromTable(z);return ai(ve,K).bind(ot=>{const Vt=ot[ot.length-1],gn=ot[0].row,xn=Vt.row+Vt.rowspan,ao=ve.all.slice(gn,xn);return tt(ao)}).getOr("")},Ha=z=>Dl(z,"rgb")?Bl(z):z,sb=z=>{const K=Oo.fromDom(z);return{borderwidth:Et(K,"border-width").getOr(""),borderstyle:Et(K,"border-style").getOr(""),bordercolor:Et(K,"border-color").map(Ha).getOr(""),backgroundcolor:Et(K,"background-color").map(Ha).getOr("")}},_d=z=>{const K=z[0],ve=z.slice(1);return de(ve,$e=>{de(Se(K),ot=>{Ne($e,(Vt,gn)=>{const xn=K[ot];xn!==""&&ot===gn&&xn!==Vt&&(K[ot]="")})})}),K},ea=(z,K,ve,$e)=>Ut(z,ot=>!y(ve.formatter.matchNode($e,K+ot))).getOr(""),tf=j(ea,["left","center","right"],"align"),Ym=j(ea,["top","middle","bottom"],"valign"),Ta=(z,K)=>{const ve=pd(z),$e=ml(z),ot=()=>({borderstyle:Le(ve,"border-style").getOr(""),bordercolor:Ha(Le(ve,"border-color").getOr("")),backgroundcolor:Ha(Le(ve,"background-color").getOr(""))}),Vt={height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:""},gn=()=>{const _i=ve["border-width"];return tu(z)&&_i?{border:_i}:Le($e,"border").fold(()=>({}),tr=>({border:tr}))},xn=K?ot():{},ao=()=>{const _i=Le(ve,"border-spacing").or(Le($e,"cellspacing")).fold(()=>({}),Vr=>({cellspacing:Vr})),tr=Le(ve,"border-padding").or(Le($e,"cellpadding")).fold(()=>({}),Vr=>({cellpadding:Vr}));return{..._i,...tr}};return{...Vt,...ve,...$e,...xn,...gn(),...ao()}},Su=z=>Tn(Oo.fromDom(z)).map(K=>{const ve={selection:Ef(z.cells)};return Zn(K,ve)}).getOr(""),Xp=(z,K,ve)=>{const $e=(xn,ao)=>{const Uo=Et(Oo.fromDom(ao),"border-width");return tu(z)&&Uo.isSome()?Uo.getOr(""):xn.getAttrib(ao,"border")||Nl(z.dom,ao,"border-width")||Nl(z.dom,ao,"border")||""},ot=z.dom,Vt=tu(z)?ot.getStyle(K,"border-spacing")||ot.getAttrib(K,"cellspacing"):ot.getAttrib(K,"cellspacing")||ot.getStyle(K,"border-spacing"),gn=tu(z)?Nl(ot,K,"padding")||ot.getAttrib(K,"cellpadding"):ot.getAttrib(K,"cellpadding")||Nl(ot,K,"padding");return{width:ot.getStyle(K,"width")||ot.getAttrib(K,"width"),height:ot.getStyle(K,"height")||ot.getAttrib(K,"height"),cellspacing:Vt??"",cellpadding:gn??"",border:$e(ot,K),caption:!!ot.select("caption",K)[0],class:ot.getAttrib(K,"class",""),align:tf(z,K),...ve?sb(K):{}}},wd=(z,K,ve)=>{const $e=z.dom;return{height:$e.getStyle(K,"height")||$e.getAttrib(K,"height"),class:$e.getAttrib(K,"class",""),type:Su(K),align:tf(z,K),...ve?sb(K):{}}},jp=(z,K,ve,$e)=>{const ot=z.dom,Vt=$e.getOr(K),gn=(xn,ao)=>ot.getStyle(xn,ao)||ot.getAttrib(xn,ao);return{width:gn(Vt,"width"),height:gn(K,"height"),scope:ot.getAttrib(K,"scope"),celltype:Ec(K),class:ot.getAttrib(K,"class",""),halign:tf(z,K),valign:Ym(z,K),...ve?sb(K):{}}},nf=(z,K)=>{const ve=Jc.fromTable(z),$e=Jc.justCells(ve),ot=Yn($e,Vt=>rn(K,gn=>ts(Vt.element,gn)));return mt(ot,Vt=>({element:Vt.element.dom,column:Jc.getColumnAt(ve,Vt.column).map(gn=>gn.element.dom)}))},un=(z,K,ve,$e)=>{$e("scope")&&z.setAttrib("scope",ve.scope),$e("class")&&z.setAttrib("class",ve.class),$e("height")&&z.setStyle("height",As(ve.height)),$e("width")&&K.setStyle("width",As(ve.width))},rb=(z,K,ve)=>{ve("backgroundcolor")&&z.setFormat("tablecellbackgroundcolor",K.backgroundcolor),ve("bordercolor")&&z.setFormat("tablecellbordercolor",K.bordercolor),ve("borderstyle")&&z.setFormat("tablecellborderstyle",K.borderstyle),ve("borderwidth")&&z.setFormat("tablecellborderwidth",As(K.borderwidth))},of=(z,K,ve,$e)=>{const ot=K.length===1;de(K,Vt=>{const gn=Vt.element,xn=ot?_e:$e,ao=su.normal(z,gn),Uo=Vt.column.map(_i=>su.normal(z,_i)).getOr(ao);un(ao,Uo,ve,xn),tm(z)&&rb(ao,ve,xn),$e("halign")&&dc(z,gn,ve.halign),$e("valign")&&th(z,gn,ve.valign)})},sf=(z,K)=>{z.execCommand("mceTableCellType",!1,{type:K.celltype,no_events:!0})},ru=(z,K,ve,$e)=>{const ot=Ft($e,(Vt,gn)=>ve[gn]!==Vt);q(ot)>0&&K.length>=1&&Tn(K[0]).each(Vt=>{const gn=nf(Vt,K),xn=q(Ft(ot,(Uo,_i)=>_i!=="scope"&&_i!=="celltype"))>0,ao=je(ot,"celltype");(xn||je(ot,"scope"))&&of(z,gn,$e,j(je,ot)),ao&&sf(z,$e),Os(z,Vt.dom,{structure:ao,style:xn})})},li=(z,K,ve,$e)=>{const ot=$e.getData();$e.close(),z.undoManager.transact(()=>{ru(z,K,ve,ot),z.focus()})},Js=(z,K)=>{const ve=Tn(K[0]).map($e=>mt(nf($e,K),ot=>jp(z,ot.element,tm(z),ot.column)));return _d(ve.getOrDie())},Ei=z=>{const K=Na(z);if(K.length===0)return;const ve=Js(z,K),$e={type:"tabpanel",tabs:[{title:"General",name:"general",items:qp(z)},im(z,"cell")]},ot={type:"panel",items:[{type:"grid",columns:2,items:qp(z)}]};z.windowManager.open({title:"Cell Properties",size:"normal",body:tm(z)?$e:ot,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:ve,onSubmit:j(li,z,K,ve)})},wl=z=>{const K=ou(Ou(z));return K.length>0?ne.some({name:"class",type:"listbox",label
Line truncated
|
||||
`),Ue)}),mn.innerHTML=Le.encode((Pt=mn.textContent)!==null&&Pt!==void 0?Pt:""),V(q).highlightElement(mn),Le.setAttrib(mn,"data-mce-highlighted",!0),mn.className=Ae(mn.className)})})}),q.on("PreInit",()=>{q.parser.addNodeFilter("pre",Le=>{var je;for(let mn=0,Pt=Le.length;mn<Pt;mn++){const Ue=Le[mn];((je=Ue.attr("class"))!==null&&je!==void 0?je:"").indexOf("language-")!==-1&&(Ue.attr("contenteditable","false"),Ue.attr("data-mce-highlighted","false"))}})})},Oe=(q,Le=r)=>je=>{const mn=()=>{je.setEnabled(q.selection.isEditable()),Le(je)};return q.on("NodeChange",mn),mn(),()=>{q.off("NodeChange",mn)}},Ft=q=>{const Le=q.selection.getStart();return q.dom.is(Le,'pre[class*="language-"]')},Qt=q=>{const Le=()=>q.execCommand("codesample");q.ui.registry.addToggleButton("codesample",{icon:"code-sample",tooltip:"Insert/edit code sample",onAction:Le,onSetup:Oe(q,je=>{je.setActive(Ft(q))})}),q.ui.registry.addMenuItem("codesample",{text:"Code sample...",icon:"code-sample",onAction:Le,onSetup:Oe(q)})};var St=()=>{o.add("codesample",q=>{R(q),xe(q),Qt(q),ne(q),q.on("dblclick",Le=>{W(Le.target)&&_e(q)})})};St()})();(function(){var o=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(Ge,Xe,Tt)=>{var Ht;return Tt(Ge,Xe.prototype)?!0:((Ht=Ge.constructor)===null||Ht===void 0?void 0:Ht.name)===Xe.name},n=Ge=>{const Xe=typeof Ge;return Ge===null?"null":Xe==="object"&&Array.isArray(Ge)?"array":Xe==="object"&&e(Ge,String,(Tt,Ht)=>Ht.isPrototypeOf(Tt))?"string":Xe},r=Ge=>Xe=>n(Xe)===Ge,c=r("string"),u=r("object"),h=r("array"),p=Ge=>Ge==null,b=Ge=>!p(Ge);class y{constructor(Xe,Tt){this.tag=Xe,this.value=Tt}static some(Xe){return new y(!0,Xe)}static none(){return y.singletonNone}fold(Xe,Tt){return this.tag?Tt(this.value):Xe()}isSome(){return this.tag}isNone(){return!this.tag}map(Xe){return this.tag?y.some(Xe(this.value)):y.none()}bind(Xe){return this.tag?Xe(this.value):y.none()}exists(Xe){return this.tag&&Xe(this.value)}forall(Xe){return!this.tag||Xe(this.value)}filter(Xe){return!this.tag||Xe(this.value)?this:y.none()}getOr(Xe){return this.tag?this.value:Xe}or(Xe){return this.tag?this:Xe}getOrThunk(Xe){return this.tag?this.value:Xe()}orThunk(Xe){return this.tag?this:Xe()}getOrDie(Xe){if(this.tag)return this.value;throw new Error(Xe??"Called getOrDie on None")}static from(Xe){return b(Xe)?y.some(Xe):y.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(Xe){this.tag&&Xe(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}y.singletonNone=new y(!1);const k=Array.prototype.push,A=(Ge,Xe)=>{for(let Tt=0,Ht=Ge.length;Tt<Ht;Tt++){const eo=Ge[Tt];Xe(eo,Tt)}},R=Ge=>{const Xe=[];for(let Tt=0,Ht=Ge.length;Tt<Ht;++Tt){if(!h(Ge[Tt]))throw new Error("Arr.flatten item "+Tt+" was not an array, input: "+Ge);k.apply(Xe,Ge[Tt])}return Xe},N=Ge=>{let Xe=Ge;return{get:()=>Xe,set:eo=>{Xe=eo}}},F=Object.keys,V=Object.hasOwnProperty,W=(Ge,Xe)=>{const Tt=F(Ge);for(let Ht=0,eo=Tt.length;Ht<eo;Ht++){const co=Tt[Ht],qo=Ge[co];Xe(qo,co)}},J=(Ge,Xe)=>te(Ge,Xe)?y.from(Ge[Xe]):y.none(),te=(Ge,Xe)=>V.call(Ge,Xe),j=Ge=>Xe=>Xe.options.get(Ge),ae=Ge=>{const Xe=Ge.options.register;Xe("audio_template_callback",{processor:"function"}),Xe("video_template_callback",{processor:"function"}),Xe("iframe_template_callback",{processor:"function"}),Xe("media_live_embeds",{processor:"boolean",default:!0}),Xe("media_filter_html",{processor:"boolean",default:!0}),Xe("media_url_resolver",{processor:"function"}),Xe("media_alt_source",{processor:"boolean",default:!0}),Xe("media_poster",{processor:"boolean",default:!0}),Xe("media_dimensions",{processor:"boolean",default:!0})},fe=j("audio_template_callback"),_e=j("video_template_callback"),ne=j("iframe_template_callback"),Se=j("media_live_embeds"),Ae=j("media_filter_html"),Ne=j("media_url_resolver"),xe=j("media_alt_source"),Oe=j("media_poster"),Ft=j("media_dimensions");var Qt=tinymce.util.Tools.resolve("tinymce.util.Tools"),St=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),q=tinymce.util.Tools.resolve("tinymce.html.DomParser");const Le=St.DOM,je=Ge=>Ge.replace(/px$/,""),mn=Ge=>{const Xe=Ge.attr("style"),Tt=Xe?Le.parseStyle(Xe):{};return{type:"ephox-embed-iri",source:Ge.attr("data-ephox-embed-iri"),altsource:"",poster:"",width:J(Tt,"max-width").map(je).getOr(""),height:J(Tt,"max-height").map(je).getOr("")}},Pt=(Ge,Xe)=>{let Tt={};const eo=q({validate:!1,forced_root_block:!1},Xe).parse(Ge);for(let co=eo;co;co=co.walk())if(co.type===1){const qo=co.name;if(co.attr("data-ephox-embed-iri")){Tt=mn(co);break}else!Tt.source&&qo==="param"&&(Tt.source=co.attr("movie")),(qo==="iframe"||qo==="object"||qo==="embed"||qo==="video"||qo==="audio")&&(Tt.type||(Tt.type=qo),Tt=Qt.extend(co.attributes.map,Tt)),qo==="source"&&(Tt.source?Tt.altsource||(Tt.altsource=co.attr("src")):Tt.source=co.attr("src")),qo==="img"&&!Tt.poster&&(Tt.poster=co.attr("src"))}return Tt.source=Tt.source||Tt.src||"",Tt.altsource=Tt.altsource||"",Tt.poster=Tt.poster||"",Tt},Ue=G
Line truncated
|
||||
<source src="`+Ge.altsource+'"'+(Ge.altsourcemime?' type="'+Ge.altsourcemime+'"':"")+` />
|
||||
`:"")+"</audio>",Ie=(Ge,Xe)=>Xe?Xe(Ge):'<video width="'+Ge.width+'" height="'+Ge.height+'"'+(Ge.poster?' poster="'+Ge.poster+'"':"")+` controls="controls">
|
||||
<source src="`+Ge.source+'"'+(Ge.sourcemime?' type="'+Ge.sourcemime+'"':"")+` />
|
||||
`+(Ge.altsource?'<source src="'+Ge.altsource+'"'+(Ge.altsourcemime?' type="'+Ge.altsourcemime+'"':"")+` />
|
||||
`:"")+"</video>",Rt=(Ge,Xe)=>{var Tt;const Ht=Qt.extend({},Xe);if(!Ht.source&&(Qt.extend(Ht,Pt((Tt=Ht.embed)!==null&&Tt!==void 0?Tt:"",Ge.schema)),!Ht.source))return"";Ht.altsource||(Ht.altsource=""),Ht.poster||(Ht.poster=""),Ht.source=Ge.convertURL(Ht.source,"source"),Ht.altsource=Ge.convertURL(Ht.altsource,"source"),Ht.sourcemime=Ue(Ht.source),Ht.altsourcemime=Ue(Ht.altsource),Ht.poster=Ge.convertURL(Ht.poster,"poster");const eo=cs(Ht.source);if(eo&&(Ht.source=eo.url,Ht.type=eo.type,Ht.allowfullscreen=eo.allowFullscreen,Ht.width=Ht.width||String(eo.w),Ht.height=Ht.height||String(eo.h)),Ht.embed)return Eo(Ht.embed,Ht,!0,Ge.schema);{const co=fe(Ge),qo=_e(Ge),fr=ne(Ge);return Ht.width=Ht.width||"300",Ht.height=Ht.height||"150",Qt.each(Ht,(nt,xo)=>{Ht[xo]=Ge.dom.encode(""+nt)}),Ht.type==="iframe"?gt(Ht,fr):Ht.sourcemime==="application/x-shockwave-flash"?Ut(Ht):Ht.sourcemime.indexOf("audio")!==-1?pt(Ht,co):Ie(Ht,qo)}},pn=Ge=>Ge.hasAttribute("data-mce-object")||Ge.hasAttribute("data-ephox-embed-iri"),kt=Ge=>{Ge.on("click keyup touchend",()=>{const Xe=Ge.selection.getNode();Xe&&Ge.dom.hasClass(Xe,"mce-preview-object")&&Ge.dom.getAttrib(Xe,"data-mce-selected")&&Xe.setAttribute("data-mce-selected","2")}),Ge.on("ObjectResized",Xe=>{const Tt=Xe.target;if(Tt.getAttribute("data-mce-object")){let Ht=Tt.getAttribute("data-mce-html");Ht&&(Ht=unescape(Ht),Tt.setAttribute("data-mce-html",escape(Eo(Ht,{width:String(Xe.width),height:String(Xe.height)},!1,Ge.schema))))}})},kn={},Dn=(Ge,Xe,Tt)=>new Promise((Ht,eo)=>{const co=qo=>(qo.html&&(kn[Ge.source]=qo),Ht({url:Ge.source,html:qo.html?qo.html:Xe(Ge)}));kn[Ge.source]?co(kn[Ge.source]):Tt({url:Ge.source},co,eo)}),is=(Ge,Xe)=>Promise.resolve({html:Xe(Ge),url:Ge.source}),Gn=Ge=>Xe=>Rt(Ge,Xe),as=(Ge,Xe)=>{const Tt=Ne(Ge);return Tt?Dn(Xe,Gn(Ge),Tt):is(Xe,Gn(Ge))},vr=Ge=>te(kn,Ge),Ns=(Ge,Xe)=>J(Xe,Ge).bind(Tt=>J(Tt,"meta")),Vs=(Ge,Xe,Tt)=>Ht=>{const eo=()=>J(Ge,Ht),co=()=>J(Xe,Ht),qo=xo=>J(xo,"value").bind(jr=>jr.length>0?y.some(jr):y.none()),fr=()=>eo().bind(xo=>u(xo)?qo(xo).orThunk(co):co().orThunk(()=>y.from(xo))),nt=()=>co().orThunk(()=>eo().bind(xo=>u(xo)?qo(xo):y.from(xo)));return{[Ht]:(Ht===Tt?fr():nt()).getOr("")}},Ts=(Ge,Xe)=>{const Tt={};return J(Ge,"dimensions").each(Ht=>{A(["width","height"],eo=>{J(Xe,eo).orThunk(()=>J(Ht,eo)).each(co=>Tt[eo]=co)})}),Tt},Ki=(Ge,Xe)=>{const Tt=Xe&&Xe!=="dimensions"?Ns(Xe,Ge).getOr({}):{},Ht=Vs(Ge,Tt,Xe);return{...Ht("source"),...Ht("altsource"),...Ht("poster"),...Ht("embed"),...Ts(Ge,Tt)}},vs=Ge=>{const Xe={...Ge,source:{value:J(Ge,"source").getOr("")},altsource:{value:J(Ge,"altsource").getOr("")},poster:{value:J(Ge,"poster").getOr("")}};return A(["width","height"],Tt=>{J(Ge,Tt).each(Ht=>{const eo=Xe.dimensions||{};eo[Tt]=Ht,Xe.dimensions=eo})}),Xe},ms=Ge=>Xe=>{const Tt=Xe&&Xe.msg?"Media embed handler error: "+Xe.msg:"Media embed handler threw unknown error.";Ge.notificationManager.open({type:"error",text:Tt})},dr=Ge=>{const Xe=Ge.selection.getNode(),Tt=pn(Xe)?Ge.serializer.serialize(Xe,{selection:!0}):"",Ht=Pt(Tt,Ge.schema),co=(()=>{if(ws(Ht.source,Ht.type)){const qo=Ge.dom.getRect(Xe);return{width:qo.w.toString().replace(/px$/,""),height:qo.h.toString().replace(/px$/,"")}}else return{}})();return{embed:Tt,...Ht,...co}},Oo=(Ge,Xe)=>Tt=>{if(c(Tt.url)&&Tt.url.trim().length>0){const Ht=Tt.html,co={...Pt(Ht,Xe.schema),source:Tt.url,embed:Ht};Ge.setData(vs(co))}},wo=(Ge,Xe)=>{const Tt=Ge.dom.select("*[data-mce-object]");for(let Ht=0;Ht<Xe.length;Ht++)for(let eo=Tt.length-1;eo>=0;eo--)Xe[Ht]===Tt[eo]&&Tt.splice(eo,1);Ge.selection.select(Tt[0])},Gs=(Ge,Xe)=>{const Tt=Ge.dom.select("*[data-mce-object]");Ge.insertContent(Xe),wo(Ge,Tt),Ge.nodeChanged()},ws=(Ge,Xe)=>b(Xe)&&Xe==="ephox-embed-iri"&&b(cs(Ge)),Pi=(Ge,Xe)=>((Ht,eo)=>Ht.width!==eo.width||Ht.height!==eo.height)(Ge,Xe)&&ws(Xe.source,Ge.type),ts=(Ge,Xe,Tt)=>{var Ht;Xe.embed=Pi(Ge,Xe)&&Ft(Tt)?Rt(Tt,{...Xe,embed:""}):Eo((Ht=Xe.embed)!==null&&Ht!==void 0?Ht:"",Xe,!1,Tt.schema),Xe.embed&&(Ge.source===Xe.source||vr(Xe.source))?Gs(Tt,Xe.embed):as(Tt,Xe).then(eo=>{Gs(Tt,eo.html)}).catch(ms(Tt))},Qi=Ge=>{const Xe=dr(Ge),Tt=N(Xe),Ht=vs(Xe),eo=(Ri,As)=>{const rr=Ki(As.getData(),"source");Ri.source!==rr.source&&(Oo(ga,Ge)({url:rr.source,html:""}),as(Ge,rr).then(Oo(ga,Ge)).catch(ms(Ge)))},co=Ri=>{var As;const rr=Ki(Ri.getData()),Vi=Pt((As=rr.embed)!==null&&As!==void 0?As:"",Ge.schema);Ri.setData(vs(Vi))},qo=(Ri,As,rr)=>{const Vi=Ki(Ri.getData(),As),ia=Pi(rr,Vi)&&Ft(Ge)?{...Vi,embed:""}:Vi,Pl=Rt(Ge,ia);Ri.setData(vs({...ia,embed:Pl}))},fr=[{name:"source",type:"urlinput",filetype:"media",label:"Source",picker_text:"Browse files"}],nt=Ft(Ge)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],xo={title:"General",name:"general",items:R([fr,nt])},Oi={title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]},ra=[];xe(Ge)&&ra.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),Oe(Ge)&&ra.push({name:"poste
Line truncated
|
||||
`));return Oe(pt.split(""),r).length},mn=(gt,Ut)=>{const pt=St(gt,Ut).join("");return Le(pt)},Pt=(gt,Ut)=>{const pt=St(gt,Ut).join("").replace(/\s/g,"");return Le(pt)},Ue=(gt,Ut)=>()=>Ut(gt.getBody(),gt.schema),ct=(gt,Ut)=>()=>Ut(gt.selection.getRng().cloneContents(),gt.schema),dn=gt=>Ue(gt,je),Zt=gt=>({body:{getWordCount:dn(gt),getCharacterCount:Ue(gt,mn),getCharacterCountWithoutSpaces:Ue(gt,Pt)},selection:{getWordCount:ct(gt,je),getCharacterCount:ct(gt,mn),getCharacterCountWithoutSpaces:ct(gt,Pt)},getCount:dn(gt)}),rn=(gt,Ut)=>{gt.windowManager.open({title:"Word Count",body:{type:"panel",items:[{type:"table",header:["Count","Document","Selection"],cells:[["Words",String(Ut.body.getWordCount()),String(Ut.selection.getWordCount())],["Characters (no spaces)",String(Ut.body.getCharacterCountWithoutSpaces()),String(Ut.selection.getCharacterCountWithoutSpaces())],["Characters",String(Ut.body.getCharacterCount()),String(Ut.selection.getCharacterCount())]]}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}]})},Fe=(gt,Ut)=>{gt.addCommand("mceWordCount",()=>rn(gt,Ut))},mt=(gt,Ut)=>{let pt=null;return{cancel:()=>{n(pt)||(clearTimeout(pt),pt=null)},throttle:(...pn)=>{n(pt)&&(pt=setTimeout(()=>{pt=null,gt.apply(null,pn)},Ut))}}};var de=tinymce.util.Tools.resolve("tinymce.util.Delay");const Eo=(gt,Ut)=>{gt.dispatch("wordCountUpdate",{wordCount:{words:Ut.body.getWordCount(),characters:Ut.body.getCharacterCount(),charactersWithoutSpaces:Ut.body.getCharacterCountWithoutSpaces()}})},jn=(gt,Ut)=>{Eo(gt,Ut)},Yn=(gt,Ut,pt)=>{const Ie=mt(()=>jn(gt,Ut),pt);gt.on("init",()=>{jn(gt,Ut),de.setEditorTimeout(gt,()=>{gt.on("SetContent BeforeAddUndo Undo Redo ViewUpdate keyup",Ie.throttle)},0),gt.on("remove",Ie.cancel)})},po=gt=>{const Ut=()=>gt.execCommand("mceWordCount");gt.ui.registry.addButton("wordcount",{tooltip:"Word count",icon:"character-count",onAction:Ut}),gt.ui.registry.addMenuItem("wordcount",{text:"Word count",icon:"character-count",onAction:Ut})};var cs=(gt=300)=>{o.add("wordcount",Ut=>{const pt=Zt(Ut);return Fe(Ut,pt),po(Ut),Yn(Ut,pt,gt),pt})};cs()})();function create_fragment$l(o){let e,n;return{c(){e=element("div"),n=element("div"),attr(n,"class","form-control"),attr(e,"class","tox-wrapper")},m(r,c){insert$1(r,e,c),append(e,n),n.innerHTML=o[0],o[5](n),o[6](e)},p(r,[c]){c&1&&(n.innerHTML=r[0])},i:noop,o:noop,d(r){r&&detach(e),o[5](null),o[6](null)}}}const toolbar="bold italic underline strikethrough removeformat | link | subscript superscript bullist numlist media image codesample table code wordcount blockquote indent outdent blocks";function instance$l(o,e,n){let{value:r=""}=e,{additionalConfig:c={}}=e,u="",h,p,b;const y=["autoresize","code","image","table","codesample","link","lists","media","wordcount"];onDestroy(()=>{p&&p.destroy()}),onMount(()=>{const N={target:h,toolbar_mode:"sliding",toolbar_sticky:!0,skin:!1,content_css:!1,content_style:contentUiSkinCss.toString()+customcss.toString(),branding:!1,inline:!1,plugins:y,contextmenu:!1,menubar:!1,statusbar:!1,entity_encoding:"raw",convert_urls:!1,toolbar,image_caption:!0,relative_urls:!1,browser_spellcheck:!0,max_height:600,setup(F){p=F,F.on("init",function(V){F.setContent(r??"")}),F.on("change input undo redo",function(V){u=F.getContent(),u!==r&&n(0,r=u)})}};tinymce$1.init({...N,...c})});function k(N){p.execCommand("InsertHTML",!1,N)}function A(N){binding_callbacks[N?"unshift":"push"](()=>{h=N,n(1,h)})}function R(N){binding_callbacks[N?"unshift":"push"](()=>{b=N,n(2,b)})}return o.$$set=N=>{"value"in N&&n(0,r=N.value),"additionalConfig"in N&&n(3,c=N.additionalConfig)},[r,h,b,c,k,A,R]}class Tinymce extends SvelteComponent{constructor(e){super(),init(this,e,instance$l,create_fragment$l,safe_not_equal,{value:0,additionalConfig:3,insertMedia:4})}get insertMedia(){return this.$$.ctx[4]}}function get_each_context$7(o,e,n){const r=o.slice();return r[14]=e[n],r}function get_each_context_1$2(o,e,n){const r=o.slice();return r[17]=e[n],r}function create_else_block$7(o){let e,n;return e=new Dropdown({props:{$$slots:{button:[create_button_slot],default:[create_default_slot]},$$scope:{ctx:o}}}),{c(){create_component(e.$$.fragment)},m(r,c){mount_component(e,r,c),n=!0},p(r,c){const u={};c&1048576&&(u.$$scope={dirty:c,ctx:r}),e.$set(u)},i(r){n||(transition_in(e.$$.fragment,r),n=!0)},o(r){transition_out(e.$$.fragment,r),n=!1},d(r){destroy_component(e,r)}}}function create_if_block_1$9(o){let e,n,r;return{c(){e=element("button"),e.textContent="Browse",attr(e,"class","button")},m(c,u){insert$1(c,e,u),n||(r=listen(e,"click",o[9]),n=!0)},p:noop,i:noop,o:noop,d(c){c&&detach(e),n=!1,r()}}}function create_each_block_1$2(o){let e,n,r;function c(...u){return o[10](o[17],...u)}return{c(){e=element("a"),e.textContent=`${o[17].label}`,attr(e,"class","dropdown-item"),attr(e,"href","/")},m(u,h){insert$1(u,e,h),n||(r=listen(e,"click",c),n=!0)},p(u,h){o=u},d(u){u&&detach(e),n=!1,r()}}}function create_default_slot(o){let e,n=ensure_array_like(o[3]),r=[];for(let c=0;c<n.length;c+=1)
Line truncated
|
||||
`){[e,n]=clip(this,e,n);let c="";for(let u=0,h=0;u<=n&&h<this.text.length;h++){let p=this.text[h],b=u+p.length;u>e&&h&&(c+=r),e<b&&n>u&&(c+=p.slice(Math.max(0,e-u),n-u)),u=b+1}return c}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],c=-1;for(let u of e)r.push(u),c+=u.length+1,r.length==32&&(n.push(new TextLeaf(r,c)),r=[],c=-1);return c>-1&&n.push(new TextLeaf(r,c)),n}}class TextNode extends Text{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,c){for(let u=0;;u++){let h=this.children[u],p=c+h.length,b=r+h.lines-1;if((n?b:p)>=e)return h.lineInner(e,n,r,c);c=p+1,r=b+1}}decompose(e,n,r,c){for(let u=0,h=0;h<=n&&u<this.children.length;u++){let p=this.children[u],b=h+p.length;if(e<=b&&n>=h){let y=c&((h<=e?1:0)|(b>=n?2:0));h>=e&&b<=n&&!y?r.push(p):p.decompose(e-h,n-h,r,y)}h=b+1}}replace(e,n,r){if([e,n]=clip(this,e,n),r.lines<this.lines)for(let c=0,u=0;c<this.children.length;c++){let h=this.children[c],p=u+h.length;if(e>=u&&n<=p){let b=h.replace(e-u,n-u,r),y=this.lines-h.lines+b.lines;if(b.lines<y>>4&&b.lines>y>>6){let k=this.children.slice();return k[c]=b,new TextNode(k,this.length-(n-e)+r.length)}return super.replace(u,p,b)}u=p+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
||||
`){[e,n]=clip(this,e,n);let c="";for(let u=0,h=0;u<this.children.length&&h<=n;u++){let p=this.children[u],b=h+p.length;h>e&&u&&(c+=r),e<b&&n>h&&(c+=p.sliceString(e-h,n-h,r)),h=b+1}return c}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof TextNode))return 0;let r=0,[c,u,h,p]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;c+=n,u+=n){if(c==h||u==p)return r;let b=this.children[c],y=e.children[u];if(b!=y)return r+b.scanIdentical(y,n);r+=b.length+1}}static from(e,n=e.reduce((r,c)=>r+c.length+1,-1)){let r=0;for(let N of e)r+=N.lines;if(r<32){let N=[];for(let F of e)F.flatten(N);return new TextLeaf(N,n)}let c=Math.max(32,r>>5),u=c<<1,h=c>>1,p=[],b=0,y=-1,k=[];function A(N){let F;if(N.lines>u&&N instanceof TextNode)for(let V of N.children)A(V);else N.lines>h&&(b>h||!b)?(R(),p.push(N)):N instanceof TextLeaf&&b&&(F=k[k.length-1])instanceof TextLeaf&&N.lines+F.lines<=32?(b+=N.lines,y+=N.length+1,k[k.length-1]=new TextLeaf(F.text.concat(N.text),F.length+1+N.length)):(b+N.lines>c&&R(),b+=N.lines,y+=N.length+1,k.push(N))}function R(){b!=0&&(p.push(k.length==1?k[0]:TextNode.from(k,y)),y=-1,b=k.length=0)}for(let N of e)A(N);return R(),p.length==1?p[0]:new TextNode(p,n)}}Text.empty=new TextLeaf([""],0);function textLength(o){let e=-1;for(let n of o)e+=n.length+1;return e}function appendText(o,e,n=0,r=1e9){for(let c=0,u=0,h=!0;u<o.length&&c<=r;u++){let p=o[u],b=c+p.length;b>=n&&(b>r&&(p=p.slice(0,r-c)),c<n&&(p=p.slice(n-c)),h?(e[e.length-1]+=p,h=!1):e.push(p)),c=b+1}return e}function sliceText(o,e,n){return appendText(o,[""],e,n)}class RawTextCursor{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof TextLeaf?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,c=this.nodes[r],u=this.offsets[r],h=u>>1,p=c instanceof TextLeaf?c.text.length:c.children.length;if(h==(n>0?p:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((u&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(c instanceof TextLeaf){let b=c.text[h+(n<0?-1:0)];if(this.offsets[r]+=n,b.length>Math.max(0,e))return this.value=e==0?b:n>0?b.slice(e):b.slice(0,b.length-e),this;e-=b.length}else{let b=c.children[h+(n<0?-1:0)];e>b.length?(e-=b.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(b),this.offsets.push(n>0?1:(b instanceof TextLeaf?b.text.length:b.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class PartialTextCursor{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new RawTextCursor(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:c}=this.cursor.next(e);return this.pos+=(c.length+e)*n,this.value=c.length<=r?c:n<0?c.slice(c.length-r):c.slice(0,r),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 LineCursor{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:c}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=c,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Text.prototype[Symbol.iterator]=function(){return this.iter()},RawTextCursor.prototype[Symbol.iterator]=PartialTextCursor.prototype[Symbol.iterator]=LineCursor.prototype[Symbol.iterator]=function(){return this});let Line$1=class{constructor(e,n,r,c){this.from=e,this.to=n,this.number=r,this.text=c}get length(){return this.to-this.from}};function clip(o,e,n){return e=Math.max(0,Math.min(o.length,e)),[e,Math.max(e,Math.min(o.length,n))]}let extend="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(o=>o?parseInt(o,36):1);for(let o=1;o<extend.length;o++)extend[o]+=extend[o-1];function isExtendingChar(o){for(let e=1;e<extend.length;e+=2)if(extend[e]>o)return extend[e-1]<=o;return!1}function isRegionalIndicator(o){return o>=127462&&o<=127487}const ZWJ=8205;function findClusterBreak(o,e,n=!0,r=!0){return(n?nextClusterBreak:prevClusterBreak)(o,e,r)}function nextClusterBreak(o,e,n){if(e==o.length)return e;e&&surrogateLow(o.charCodeAt(e))&&surrogateHigh(o.charCodeAt(e-1))&&e--;let r=codePointAt(o,e);for(e+=codePointSize(r);e<o.length;){let c=codePointAt(o,e);if(r==ZWJ||c==ZWJ||n&&isExtendingChar(c))e+=codePointSize(c),r=c;else if(isRegionalIndicator(c)){let u=0,h=e-2;for(;h>=0&&isRegionalIndicator(codePointAt(o,h));)u++,h-=2;if(u%2==0)break;e+=2}else break}return e}function prevClusterBreak(o,e,n){for(;e>0;){let r=nextClusterBreak(o,e-2,n);if(r<e)return r;e--}return 0}function surrogateLow(o){return o>=56320&&o<57344}function surrogateHigh(o){return o>=55296&&o<56320}function codePointAt(o,e){let n=o.charCodeAt(e);if(!surrogateHigh(n)||e+1==o.length)return n;let r=o.charCodeAt(e+1);return surrogateLow(r)?(n-55296<<10)+(r-56320)+65536:n}function fromCodePoint(o){return o<=65535?String.fromCharCode(o):(o-=65536,String.fromCharCode((o>>10)+55296,(o&1023)+56320))}function codePointSize(o){return o<65536?1:2}const DefaultSplit=/\r\n?|\n/;var MapMode=function(o){return o[o.Simple=0]="Simple",o[o.TrackDel=1]="TrackDel",o[o.TrackBefore=2]="TrackBefore",o[o.TrackAfter=3]="TrackAfter",o}(MapMode||(MapMode={}));class ChangeDesc{constructor(e){this.sectio
Line truncated
|
||||
`}get readOnly(){return this.facet(readOnly)}phrase(e,...n){for(let r of this.facet(EditorState.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,c)=>{if(c=="$")return"$";let u=+(c||1);return!u||u>n.length?r:n[u-1]})),e}languageDataAt(e,n,r=-1){let c=[];for(let u of this.facet(languageData))for(let h of u(this,n,r))Object.prototype.hasOwnProperty.call(h,e)&&c.push(h[e]);return c}charCategorizer(e){return makeCategorizer(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:c}=this.doc.lineAt(e),u=this.charCategorizer(e),h=e-r,p=e-r;for(;h>0;){let b=findClusterBreak(n,h,!1);if(u(n.slice(b,h))!=CharCategory.Word)break;h=b}for(;p<c;){let b=findClusterBreak(n,p);if(u(n.slice(p,b))!=CharCategory.Word)break;p=b}return h==p?null:EditorSelection.range(h+r,p+r)}}EditorState.allowMultipleSelections=allowMultipleSelections;EditorState.tabSize=Facet.define({combine:o=>o.length?o[0]:4});EditorState.lineSeparator=lineSeparator;EditorState.readOnly=readOnly;EditorState.phrases=Facet.define({compare(o,e){let n=Object.keys(o),r=Object.keys(e);return n.length==r.length&&n.every(c=>o[c]==e[c])}});EditorState.languageData=languageData;EditorState.changeFilter=changeFilter;EditorState.transactionFilter=transactionFilter;EditorState.transactionExtender=transactionExtender;Compartment.reconfigure=StateEffect.define();function combineConfig(o,e,n={}){let r={};for(let c of o)for(let u of Object.keys(c)){let h=c[u],p=r[u];if(p===void 0)r[u]=h;else if(!(p===h||h===void 0))if(Object.hasOwnProperty.call(n,u))r[u]=n[u](p,h);else throw new Error("Config merge conflict for field "+u)}for(let c in e)r[c]===void 0&&(r[c]=e[c]);return r}class RangeValue{eq(e){return this==e}range(e,n=e){return Range$2.create(e,n,this)}}RangeValue.prototype.startSide=RangeValue.prototype.endSide=0;RangeValue.prototype.point=!1;RangeValue.prototype.mapMode=MapMode.TrackDel;let Range$2=class Dq{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new Dq(e,n,r)}};function cmpRange(o,e){return o.from-e.from||o.value.startSide-e.value.startSide}class Chunk{constructor(e,n,r,c){this.from=e,this.to=n,this.value=r,this.maxPoint=c}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,c=0){let u=r?this.to:this.from;for(let h=c,p=u.length;;){if(h==p)return h;let b=h+p>>1,y=u[b]-e||(r?this.value[b].endSide:this.value[b].startSide)-n;if(b==h)return y>=0?h:p;y>=0?p=b:h=b+1}}between(e,n,r,c){for(let u=this.findIndex(n,-1e9,!0),h=this.findIndex(r,1e9,!1,u);u<h;u++)if(c(this.from[u]+e,this.to[u]+e,this.value[u])===!1)return!1}map(e,n){let r=[],c=[],u=[],h=-1,p=-1;for(let b=0;b<this.value.length;b++){let y=this.value[b],k=this.from[b]+e,A=this.to[b]+e,R,N;if(k==A){let F=n.mapPos(k,y.startSide,y.mapMode);if(F==null||(R=N=F,y.startSide!=y.endSide&&(N=n.mapPos(k,y.endSide),N<R)))continue}else if(R=n.mapPos(k,y.startSide),N=n.mapPos(A,y.endSide),R>N||R==N&&y.startSide>0&&y.endSide<=0)continue;(N-R||y.endSide-y.startSide)<0||(h<0&&(h=R),y.point&&(p=Math.max(p,N-R)),r.push(y),c.push(R-h),u.push(N-h))}return{mapped:r.length?new Chunk(c,u,r,p):null,pos:h}}}class RangeSet{constructor(e,n,r,c){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=c}static create(e,n,r,c){return new RangeSet(e,n,r,c)}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 n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:c=0,filterTo:u=this.length}=e,h=e.filter;if(n.length==0&&!h)return this;if(r&&(n=n.slice().sort(cmpRange)),this.isEmpty)return n.length?RangeSet.of(n):this;let p=new LayerCursor(this,null,-1).goto(0),b=0,y=[],k=new RangeSetBuilder;for(;p.value||b<n.length;)if(b<n.length&&(p.from-n[b].from||p.startSide-n[b].value.startSide)>=0){let A=n[b++];k.addInner(A.from,A.to,A.value)||y.push(A)}else p.rangeIndex==1&&p.chunkIndex<this.chunk.length&&(b==n.length||this.chunkEnd(p.chunkIndex)<n[b].from)&&(!h||c>this.chunkEnd(p.chunkIndex)||u<this.chunkPos[p.chunkIndex])&&k.addChunk(this.chunkPos[p.chunkIndex],this.chunk[p.chunkIndex])?p.nextChunk():((!h||c>p.to||u<p.from||h(p.from,p.to,p.value))&&(k.addInner(p.from,p.to,p.value)||y.push(Range$2.create(p.from,p.to,p.value))),p.next());return k.finishInner(this.nextLayer.isEmpty&&!y.length?RangeSet.empty:this.nextLayer.update({add:y,filter:h,filterFrom:c,filterTo:u}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],c=-1;for(let h=0;h<this.chunk.length;h++){let p=this.chunkPos[h],b=this.chunk[h],y=e.touchesRange(p,p+b.length);if(y===!1)c=Math.max(c,b.maxPoint),n.push(b),r.push(e.mapPos(p));else if(y===!0){let{mapped:k,pos:A}=b.map(p,e);k&&(c=Math.max(c,k.maxPoint),n.push(k),r.push(A))}}let u=this.nextLayer.map(e);return n.length==0?u:new RangeSet(r,n,u||RangeSet.empty,c)}between(e,n,r){if(!this.isEmpty){for(le
Line truncated
|
||||
`)}static newName(){let e=top[COUNT]||1;return top[COUNT]=e+1,C+e.toString(36)}static mount(e,n,r){let c=e[SET],u=r&&r.nonce;c?u&&c.setNonce(u):c=new StyleSet(e,u),c.mount(Array.isArray(n)?n:[n],e)}}let adoptedSet=new Map;class StyleSet{constructor(e,n){let r=e.ownerDocument||e,c=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&c.CSSStyleSheet){let u=adoptedSet.get(r);if(u)return e[SET]=u;this.sheet=new c.CSSStyleSheet,adoptedSet.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[SET]=this}mount(e,n){let r=this.sheet,c=0,u=0;for(let h=0;h<e.length;h++){let p=e[h],b=this.modules.indexOf(p);if(b<u&&b>-1&&(this.modules.splice(b,1),u--,b=-1),b==-1){if(this.modules.splice(u++,0,p),r)for(let y=0;y<p.rules.length;y++)r.insertRule(p.rules[y],c++)}else{for(;u<b;)c+=this.modules[u++].rules.length;c+=p.rules.length,u++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let h="";for(let b=0;b<this.modules.length;b++)h+=this.modules[b].getRules()+`
|
||||
`;this.styleTag.textContent=h;let p=n.head||n;this.styleTag.parentNode!=p&&p.insertBefore(this.styleTag,p.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var base={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:"'"},shift={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mac=typeof navigator<"u"&&/Mac/.test(navigator.platform),ie$1=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var i=0;i<10;i++)base[48+i]=base[96+i]=String(i);for(var i=1;i<=24;i++)base[i+111]="F"+i;for(var i=65;i<=90;i++)base[i]=String.fromCharCode(i+32),shift[i]=String.fromCharCode(i);for(var code in base)shift.hasOwnProperty(code)||(shift[code]=base[code]);function keyName(o){var e=mac&&o.metaKey&&o.shiftKey&&!o.ctrlKey&&!o.altKey||ie$1&&o.shiftKey&&o.key&&o.key.length==1||o.key=="Unidentified",n=!e&&o.key||(o.shiftKey?shift:base)[o.keyCode]||o.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function getSelection(o){let e;return o.nodeType==11?e=o.getSelection?o:o.ownerDocument:e=o,e.getSelection()}function contains(o,e){return e?o==e||o.contains(e.nodeType!=1?e.parentNode:e):!1}function deepActiveElement(o){let e=o.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function hasSelection(o,e){if(!e.anchorNode)return!1;try{return contains(o,e.anchorNode)}catch{return!1}}function clientRectsFor(o){return o.nodeType==3?textRange(o,0,o.nodeValue.length).getClientRects():o.nodeType==1?o.getClientRects():[]}function isEquivalentPosition(o,e,n,r){return n?scanFor(o,e,n,r,-1)||scanFor(o,e,n,r,1):!1}function domIndex(o){for(var e=0;;e++)if(o=o.previousSibling,!o)return e}function isBlockElement(o){return o.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(o.nodeName)}function scanFor(o,e,n,r,c){for(;;){if(o==n&&e==r)return!0;if(e==(c<0?0:maxOffset(o))){if(o.nodeName=="DIV")return!1;let u=o.parentNode;if(!u||u.nodeType!=1)return!1;e=domIndex(o)+(c<0?0:1),o=u}else if(o.nodeType==1){if(o=o.childNodes[e+(c<0?-1:0)],o.nodeType==1&&o.contentEditable=="false")return!1;e=c<0?maxOffset(o):0}else return!1}}function maxOffset(o){return o.nodeType==3?o.nodeValue.length:o.childNodes.length}function flattenRect(o,e){let n=e?o.left:o.right;return{left:n,right:n,top:o.top,bottom:o.bottom}}function windowRect(o){let e=o.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:o.innerWidth,top:0,bottom:o.innerHeight}}function getScale(o,e){let n=e.width/o.offsetWidth,r=e.height/o.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-o.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-o.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function scrollRectIntoView(o,e,n,r,c,u,h,p){let b=o.ownerDocument,y=b.defaultView||window;for(let k=o,A=!1;k&&!A;)if(k.nodeType==1){let R,N=k==b.body,F=1,V=1;if(N)R=windowRect(y);else{if(/^(fixed|sticky)$/.test(getComputedStyle(k).position)&&(A=!0),k.scrollHeight<=k.clientHeight&&k.scrollWidth<=k.clientWidth){k=k.assignedSlot||k.parentNode;continue}let te=k.getBoundingClientRect();({scaleX:F,scaleY:V}=getScale(k,te)),R={left:te.left,right:te.left+k.clientWidth*F,top:te.top,bottom:te.top+k.clientHeight*V}}let W=0,J=0;if(c=="nearest")e.top<R.top?(J=-(R.top-e.top+h),n>0&&e.bottom>R.bottom+J&&(J=e.bottom-R.bottom+J+h)):e.bottom>R.bottom&&(J=e.bottom-R.bottom+h,n<0&&e.top-J<R.top&&(J=-(R.top+J-e.top+h)));else{let te=e.bottom-e.top,j=R.bottom-R.top;J=(c=="center"&&te<=j?e.top+te/2-j/2:c=="start"||c=="center"&&n<0?e.top-h:e.bottom-j+h)-R.top}if(r=="nearest"?e.left<R.left?(W=-(R.left-e.left+u),n>0&&e.right>R.right+W&&(W=e.right-R.right+W+u)):e.right>R.right&&(W=e.right-R.right+u,n<0&&e.left<R.left+W&&(W=-(R.left+W-e.left+u))):W=(r=="center"?e.left+(e.right-e.left)/2-(R.right-R.left)/2:r=="start"==p?e.left-u:e.right-(R.right-R.left)+u)-R.left,W||J)if(N)y.scrollBy(W,J);else{let te=0,j=0;if(J){let ae=k.scrollTop;k.scrollTop+=J/V,j=(k.scrollTop-ae)*V}if(W){let ae=k.scrollLeft;k.scrollLeft+=W/F,te=(k.scrollLeft-ae)*F}e={left:e.left-te,top:e.top-j,right:e.right-te,bottom:e.bottom-j},te&&Math.abs(te-W)<1&&(r="nearest"),j&&Math.abs(j-J)<1&&(c="nearest")}if(N)break;k=k.assignedSLine truncated
|
||||
`,c=o.state.doc.line(c.number+(n?1:-1)),u=o.bidiSpans(c),y=o.visualLineSide(c,!n)}if(b){if(!b(k))return p}else{if(!r)return y;b=r(k)}p=y}}function byGroup(o,e,n){let r=o.state.charCategorizer(e),c=r(n);return u=>{let h=r(u);return c==CharCategory.Space&&(c=h),c==h}}function moveVertically(o,e,n,r){let c=e.head,u=n?1:-1;if(c==(n?o.state.doc.length:0))return EditorSelection.cursor(c,e.assoc);let h=e.goalColumn,p,b=o.contentDOM.getBoundingClientRect(),y=o.coordsAtPos(c,e.assoc||-1),k=o.documentTop;if(y)h==null&&(h=y.left-b.left),p=u<0?y.top:y.bottom;else{let N=o.viewState.lineBlockAt(c);h==null&&(h=Math.min(b.right-b.left,o.defaultCharacterWidth*(c-N.from))),p=(u<0?N.top:N.bottom)+k}let A=b.left+h,R=r??o.viewState.heightOracle.textHeight>>1;for(let N=0;;N+=10){let F=p+(R+N)*u,V=posAtCoords(o,{x:A,y:F},!1,u);if(F<b.top||F>b.bottom||(u<0?V<c:V>c)){let W=o.docView.coordsForChar(V),J=!W||F<W.top?-1:1;return EditorSelection.cursor(V,J,void 0,h)}}}function skipAtomicRanges(o,e,n){for(;;){let r=0;for(let c of o)c.between(e-1,e+1,(u,h,p)=>{if(e>u&&e<h){let b=r||n||(e-u<h-e?-1:1);e=b<0?u:h,r=b}});if(!r)return e}}function skipAtoms(o,e,n){let r=skipAtomicRanges(o.state.facet(atomicRanges).map(c=>c(o)),n.from,e.head>n.from?-1:1);return r==n.from?n:EditorSelection.cursor(r,r<n.from?1:-1)}const LineBreakPlaceholder="";class DOMReader{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(EditorState.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=LineBreakPlaceholder}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let c=e;;){this.findPointBefore(r,c);let u=this.text.length;this.readNode(c);let h=c.nextSibling;if(h==n)break;let p=ContentView.get(c),b=ContentView.get(h);(p&&b?p.breakAfter:(p?p.breakAfter:isBlockElement(c))||isBlockElement(h)&&(c.nodeName!="BR"||c.cmIgnore)&&this.text.length>u)&&this.lineBreak(),c=h}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,c=this.lineSeparator?null:/\r\n?|\n/g;;){let u=-1,h=1,p;if(this.lineSeparator?(u=n.indexOf(this.lineSeparator,r),h=this.lineSeparator.length):(p=c.exec(n))&&(u=p.index,h=p[0].length),this.append(n.slice(r,u<0?n.length:u)),u<0)break;if(this.lineBreak(),h>1)for(let b of this.points)b.node==e&&b.pos>this.text.length&&(b.pos-=h-1);r=u+h}}readNode(e){if(e.cmIgnore)return;let n=ContentView.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let c=r.iter();!c.next().done;)c.lineBreak?this.lineBreak():this.append(c.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(isAtEnd(e,r.node,r.offset)?n:0))}}function isAtEnd(o,e,n){for(;;){if(!e||n<maxOffset(e))return!1;if(e==o)return!0;n=domIndex(e)+1,e=e.parentNode}}class DOMPoint{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class DOMChange{constructor(e,n,r,c){this.typeOver=c,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:u,impreciseAnchor:h}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let p=u||h?[]:selectionPoints(e),b=new DOMReader(p,e.state);b.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=b.text,this.newSel=selectionFromPoints(p,this.bounds.from)}else{let p=e.observer.selectionRange,b=u&&u.node==p.focusNode&&u.offset==p.focusOffset||!contains(e.contentDOM,p.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(p.focusNode,p.focusOffset),y=h&&h.node==p.anchorNode&&h.offset==p.anchorOffset||!contains(e.contentDOM,p.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(p.anchorNode,p.anchorOffset),k=e.viewport;if((browser.ios||browser.chrome)&&e.state.selection.main.empty&&b!=y&&(k.from>0||k.to<e.state.doc.length)){let A=Math.min(b,y),R=Math.max(b,y),N=k.from-A,F=k.to-R;(N==0||N==1||A==0)&&(F==0||F==-1||R==e.state.doc.length)&&(b=0,y=e.state.doc.length)}this.newSel=EditorSelection.single(y,b)}}}function applyDOMChange(o,e){let n,{newSel:r}=e,c=o.state.selection.main,u=o.inputState.lastKeyTime>Date.now()-100?o.inputState.lastKeyCode:-1;if(e.bounds){let{from:h,to:p}=e.bounds,b=c.from,y=null;(u===8||browser.android&&e.text.length<p-h)&&(b=c.to,y="end");let k=findDiff(o.state.doc.sliceString(h,p,LineBreakPlaceholder),e.text,b-h,y);k&&(browser.chrome&&u==13&&k.toB==k.from+2&&e.text.slice(k.from,k.toB)==LineBreakPlaceholder+LineBreakPlaceholder&&k.toB--,n={from:h+k.from,to:h+k.toA,insert:Text.of(e.text.slice(k.from,k.toB).split(LineBreakPlaceholder))})}else r&&(!o.hasFocus&&o.state.facet(editable)||r.main.eq(c))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!c.empty&&r&&r.main.empty?n={from:c.from,to:
Line truncated
|
||||
`&&o.lineWrapping&&(r&&(r=EditorSelection.single(r.main.anchor-1,r.main.head-1)),n={from:c.from,to:c.to,insert:Text.of([" "])}),n)return applyDOMChangeInner(o,n,r,u);if(r&&!r.main.eq(c)){let h=!1,p="select";return o.inputState.lastSelectionTime>Date.now()-50&&(o.inputState.lastSelectionOrigin=="select"&&(h=!0),p=o.inputState.lastSelectionOrigin),o.dispatch({selection:r,scrollIntoView:h,userEvent:p}),!0}else return!1}function applyDOMChangeInner(o,e,n,r=-1){if(browser.ios&&o.inputState.flushIOSKey(e))return!0;let c=o.state.selection.main;if(browser.android&&(e.to==c.to&&(e.from==c.from||e.from==c.from-1&&o.state.sliceDoc(e.from,c.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&dispatchKey(o.contentDOM,"Enter",13)||(e.from==c.from-1&&e.to==c.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>c.head)&&dispatchKey(o.contentDOM,"Backspace",8)||e.from==c.from&&e.to==c.to+1&&e.insert.length==0&&dispatchKey(o.contentDOM,"Delete",46)))return!0;let u=e.insert.toString();o.inputState.composing>=0&&o.inputState.composing++;let h,p=()=>h||(h=applyDefaultInsert(o,e,n));return o.state.facet(inputHandler$1).some(b=>b(o,e.from,e.to,u,p))||o.dispatch(p()),!0}function applyDefaultInsert(o,e,n){let r,c=o.state,u=c.selection.main;if(e.from>=u.from&&e.to<=u.to&&e.to-e.from>=(u.to-u.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&o.inputState.composing<0){let p=u.from<e.from?c.sliceDoc(u.from,e.from):"",b=u.to>e.to?c.sliceDoc(e.to,u.to):"";r=c.replaceSelection(o.state.toText(p+e.insert.sliceString(0,void 0,o.state.lineBreak)+b))}else{let p=c.changes(e),b=n&&n.main.to<=p.newLength?n.main:void 0;if(c.selection.ranges.length>1&&o.inputState.composing>=0&&e.to<=u.to&&e.to>=u.to-10){let y=o.state.sliceDoc(e.from,e.to),k,A=n&&findCompositionNode(o,n.main.head);if(A){let F=e.insert.length-(e.to-e.from);k={from:A.from,to:A.to-F}}else k=o.state.doc.lineAt(u.head);let R=u.to-e.to,N=u.to-u.from;r=c.changeByRange(F=>{if(F.from==u.from&&F.to==u.to)return{changes:p,range:b||F.map(p)};let V=F.to-R,W=V-y.length;if(F.to-F.from!=N||o.state.sliceDoc(W,V)!=y||F.to>=k.from&&F.from<=k.to)return{range:F};let J=c.changes({from:W,to:V,insert:e.insert}),te=F.to-u.to;return{changes:J,range:b?EditorSelection.range(Math.max(0,b.anchor+te),Math.max(0,b.head+te)):F.map(J)}})}else r={changes:p,selection:b&&c.selection.replaceRange(b)}}let h="input.type";return(o.composing||o.inputState.compositionPendingChange&&o.inputState.compositionEndedAt>Date.now()-50)&&(o.inputState.compositionPendingChange=!1,h+=".compose",o.inputState.compositionFirstChange&&(h+=".start",o.inputState.compositionFirstChange=!1)),c.update(r,{userEvent:h,scrollIntoView:!0})}function findDiff(o,e,n,r){let c=Math.min(o.length,e.length),u=0;for(;u<c&&o.charCodeAt(u)==e.charCodeAt(u);)u++;if(u==c&&o.length==e.length)return null;let h=o.length,p=e.length;for(;h>0&&p>0&&o.charCodeAt(h-1)==e.charCodeAt(p-1);)h--,p--;if(r=="end"){let b=Math.max(0,u-Math.min(h,p));n-=h+b-u}if(h<u&&o.length<e.length){let b=n<=u&&n>=h?u-n:0;u-=b,p=u+(p-h),h=u}else if(p<u){let b=n<=u&&n>=p?u-n:0;u-=b,h=u+(h-p),p=u}return{from:u,toA:h,toB:p}}function selectionPoints(o){let e=[];if(o.root.activeElement!=o.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:c,focusOffset:u}=o.observer.selectionRange;return n&&(e.push(new DOMPoint(n,r)),(c!=n||u!=r)&&e.push(new DOMPoint(c,u))),e}function selectionFromPoints(o,e){if(o.length==0)return null;let n=o[0].pos,r=o.length==2?o[1].pos:n;return n>-1&&r>-1?EditorSelection.single(n+e,r+e):null}class InputState{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,browser.safari&&e.contentDOM.addEventListener("input",()=>null),browser.gecko&&firefoxCopyCutHack(e.contentDOM.ownerDocument)}handleEvent(e){!eventBelongsToEditor(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,n){let r=this.handlers[e];if(r){for(let c of r.observers)c(this.view,n);for(let c of r.handlers){if(n.defaultPrevented)break;if(c(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=computeHandlers(e),r=this.handlers,c=this.view.contentDOM;for(let u in n)if(u!="scroll"){let h=!n[u].handlers.length,p=r[u];p&&h!=!p.handlers.length&&(c.removeEventListener(u,this.handleEvent),p=null),p||c.addEventListener(u,this.handleEvent,{passive:h})}for(let u in r)u!="scroll"&&!n[u]&&
Line truncated
|
||||
`))};u.from==this.from&&c<this.from?u.from=c:u.to==this.to&&c>this.to&&(u.to=c),!(u.from==u.to&&!u.insert.length)&&(this.pendingContextChange=u,e.state.readOnly||applyDOMChangeInner(e,u,EditorSelection.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=r=>{let c=[],u=null;for(let h=this.toEditorPos(r.rangeStart),p=this.toEditorPos(r.rangeEnd);h<p;h++){let b=e.coordsForChar(h);u=b&&new DOMRect(b.left,b.top,b.right-b.left,b.bottom-b.top)||u||new DOMRect,c.push(u)}n.updateCharacterBounds(r.rangeStart,c)},this.handlers.textformatupdate=r=>{let c=[];for(let u of r.getTextFormats()){let h=u.underlineStyle,p=u.underlineThickness;if(h!="None"&&p!="None"){let b=`text-decoration: underline ${h=="Dashed"?"dashed ":h=="Squiggle"?"wavy ":""}${p=="Thin"?1:2}px`;c.push(Decoration.mark({attributes:{style:b}}).range(this.toEditorPos(u.rangeStart),this.toEditorPos(u.rangeEnd)))}}e.dispatch({effects:setEditContextFormatting.of(Decoration.set(c))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let c=getSelection(r.root);c&&c.rangeCount&&this.editContext.updateSelectionBounds(c.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,c=this.pendingContextChange;return e.changes.iterChanges((u,h,p,b,y)=>{if(r)return;let k=y.length-(h-u);if(c&&h>=c.to)if(c.from==u&&c.to==h&&c.insert.eq(y)){c=this.pendingContextChange=null,n+=k,this.to+=k;return}else c=null,this.revertPending(e.state);if(u+=n,h+=n,h<=this.from)this.from+=k,this.to+=k;else if(u<this.to){if(u<this.from||h>this.to||this.to-this.from+y.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(u),this.toContextPos(h),y.toString()),this.to+=k}n+=k}),c&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),c=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=c)&&this.editContext.updateSelection(r,c)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class EditorView{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(c=>c.forEach(u=>r(u,this)))||(c=>this.update(c)),this.dispatch=this.dispatch.bind(this),this._root=e.root||getRoot(e.parent)||document,this.viewState=new ViewState(e.state||EditorState.create(e)),e.scrollTo&&e.scrollTo.is(scrollIntoView$1)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.fa
Line truncated
|
||||
--\u2028\u2029\uFEFF-]`,UnicodeRegexpSupport),Names={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 _supportsTabSize=null;function supportsTabSize(){var o;if(_supportsTabSize==null&&typeof document<"u"&&document.body){let e=document.body.style;_supportsTabSize=((o=e.tabSize)!==null&&o!==void 0?o:e.MozTabSize)!=null}return _supportsTabSize||!1}const specialCharConfig=Facet.define({combine(o){let e=combineConfig(o,{render:null,specialChars:Specials,addSpecialChars:null});return(e.replaceTabs=!supportsTabSize())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,UnicodeRegexpSupport)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,UnicodeRegexpSupport)),e}});function highlightSpecialChars(o={}){return[specialCharConfig.of(o),specialCharPlugin()]}let _plugin=null;function specialCharPlugin(){return _plugin||(_plugin=ViewPlugin.fromClass(class{constructor(o){this.view=o,this.decorations=Decoration.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(o.state.facet(specialCharConfig)),this.decorations=this.decorator.createDeco(o)}makeDecorator(o){return new MatchDecorator({regexp:o.specialChars,decoration:(e,n,r)=>{let{doc:c}=n.state,u=codePointAt(e[0],0);if(u==9){let h=c.lineAt(r),p=n.state.tabSize,b=countColumn(h.text,p,r-h.from);return Decoration.replace({widget:new TabWidget((p-b%p)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[u]||(this.decorationCache[u]=Decoration.replace({widget:new SpecialCharWidget(o,u)}))},boundary:o.replaceTabs?void 0:/[^]/})}update(o){let e=o.state.facet(specialCharConfig);o.startState.facet(specialCharConfig)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(o.view)):this.decorations=this.decorator.updateDeco(o,this.decorations)}},{decorations:o=>o.decorations}))}const DefaultPlaceholder="•";function placeholder$1(o){return o>=32?DefaultPlaceholder:o==10?"":String.fromCharCode(9216+o)}class SpecialCharWidget extends WidgetType{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=placeholder$1(this.code),r=e.state.phrase("Control character")+" "+(Names[this.code]||"0x"+this.code.toString(16)),c=this.options.render&&this.options.render(this.code,r,n);if(c)return c;let u=document.createElement("span");return u.textContent=n,u.title=r,u.setAttribute("aria-label",r),u.className="cm-specialChar",u}ignoreEvent(){return!1}}class TabWidget extends WidgetType{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}}function highlightActiveLine(){return activeLineHighlighter}const lineDeco=Decoration.line({class:"cm-activeLine"}),activeLineHighlighter=ViewPlugin.fromClass(class{constructor(o){this.decorations=this.getDeco(o)}update(o){(o.docChanged||o.selectionSet)&&(this.decorations=this.getDeco(o.view))}getDeco(o){let e=-1,n=[];for(let r of o.state.selection.ranges){let c=o.lineBlockAt(r.head);c.from>e&&(n.push(lineDeco.range(c.from)),e=c.from)}return Decoration.set(n)}},{decorations:o=>o.decorations}),MaxOff=2e3;function rectangleFor(o,e,n){let r=Math.min(e.line,n.line),c=Math.max(e.line,n.line),u=[];if(e.off>MaxOff||n.off>MaxOff||e.col<0||n.col<0){let h=Math.min(e.off,n.off),p=Math.max(e.off,n.off);for(let b=r;b<=c;b++){let y=o.doc.line(b);y.length<=p&&u.push(EditorSelection.range(y.from+h,y.to+p))}}else{let h=Math.min(e.col,n.col),p=Math.max(e.col,n.col);for(let b=r;b<=c;b++){let y=o.doc.line(b),k=findColumn(y.text,h,o.tabSize,!0);if(k<0)u.push(EditorSelection.cursor(y.to));else{let A=findColumn(y.text,p,o.tabSize);u.push(EditorSelection.range(y.from+k,y.from+A))}}}return u}function absoluteColumn(o,e){let n=o.coordsAtPos(o.viewport.from);return n?Math.round(Math.abs((n.left-e)/o.defaultCharacterWidth)):-1}function getPos(o,e){let n=o.posAtCoords({x:e.clientX,y:e.clientY},!1),r=o.state.doc.lineAt(n),c=n-r.from,u=c>MaxOff?-1:c==r.length?absoluteColumn(o,e.clientX):countColumn(r.text,o.state.tabSize,n-r.from);return{line:r.number,col:u,off:c}}function rectangleSelectionStyle(o,e){let n=getPos(o,e),r=o.state.selection;return n?{update(c){if(c.docChanged){let u=c.changes.mapPos(c.startState.doc.line(n.line).from),h=c.state.doc.lineAt(u);n={line:h.number,col:n.col,off:Math.min(n.off,h.length)},r=r.map(c.changes)}},get(c,u,h){let p=getPos(o,c);if(!p)return r;let b=rectang
Line truncated
|
||||
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new RegExpQuery(this):new StringQuery(this)}getCursor(e,n=0,r){let c=e.doc?e:EditorState.create({doc:e});return r==null&&(r=c.doc.length),this.regexp?regexpCursor(this,c,n,r):stringCursor(this,c,n,r)}}class QueryType{constructor(e){this.spec=e}}function stringCursor(o,e,n,r){return new SearchCursor(e.doc,o.unquoted,n,r,o.caseSensitive?void 0:c=>c.toLowerCase(),o.wholeWord?stringWordTest(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function stringWordTest(o,e){return(n,r,c,u)=>((u>n||u+c.length<r)&&(u=Math.max(0,n-2),c=o.sliceString(u,Math.min(o.length,r+2))),(e(charBefore(c,n-u))!=CharCategory.Word||e(charAfter(c,n-u))!=CharCategory.Word)&&(e(charAfter(c,r-u))!=CharCategory.Word||e(charBefore(c,r-u))!=CharCategory.Word))}class StringQuery extends QueryType{constructor(e){super(e)}nextMatch(e,n,r){let c=stringCursor(this.spec,e,r,e.doc.length).nextOverlapping();return c.done&&(c=stringCursor(this.spec,e,0,n).nextOverlapping()),c.done?null:c.value}prevMatchInRange(e,n,r){for(let c=r;;){let u=Math.max(n,c-1e4-this.spec.unquoted.length),h=stringCursor(this.spec,e,u,c),p=null;for(;!h.nextOverlapping().done;)p=h.value;if(p)return p;if(u==n)return null;c-=1e4}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=stringCursor(this.spec,e,0,e.doc.length),c=[];for(;!r.next().done;){if(c.length>=n)return null;c.push(r.value)}return c}highlight(e,n,r,c){let u=stringCursor(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!u.next().done;)c(u.value.from,u.value.to)}}function regexpCursor(o,e,n,r){return new RegExpCursor(e.doc,o.search,{ignoreCase:!o.caseSensitive,test:o.wholeWord?regexpWordTest(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function charBefore(o,e){return o.slice(findClusterBreak(o,e,!1),e)}function charAfter(o,e){return o.slice(e,findClusterBreak(o,e))}function regexpWordTest(o){return(e,n,r)=>!r[0].length||(o(charBefore(r.input,r.index))!=CharCategory.Word||o(charAfter(r.input,r.index))!=CharCategory.Word)&&(o(charAfter(r.input,r.index+r[0].length))!=CharCategory.Word||o(charBefore(r.input,r.index+r[0].length))!=CharCategory.Word)}class RegExpQuery extends QueryType{nextMatch(e,n,r){let c=regexpCursor(this.spec,e,r,e.doc.length).next();return c.done&&(c=regexpCursor(this.spec,e,0,n).next()),c.done?null:c.value}prevMatchInRange(e,n,r){for(let c=1;;c++){let u=Math.max(n,r-c*1e4),h=regexpCursor(this.spec,e,u,r),p=null;for(;!h.next().done;)p=h.value;if(p&&(u==n||p.from>u+10))return p;if(u==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(n,r)=>r=="$"?"$":r=="&"?e.match[0]:r!="0"&&+r<e.match.length?e.match[r]:n)}matchAll(e,n){let r=regexpCursor(this.spec,e,0,e.doc.length),c=[];for(;!r.next().done;){if(c.length>=n)return null;c.push(r.value)}return c}highlight(e,n,r,c){let u=regexpCursor(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!u.next().done;)c(u.value.from,u.value.to)}}const setSearchQuery=StateEffect.define(),togglePanel$1=StateEffect.define(),searchState=StateField.define({create(o){return new SearchState(defaultQuery(o).create(),null)},update(o,e){for(let n of e.effects)n.is(setSearchQuery)?o=new SearchState(n.value.create(),o.panel):n.is(togglePanel$1)&&(o=new SearchState(o.query,n.value?createSearchPanel:null));return o},provide:o=>showPanel.from(o,e=>e.panel)});class SearchState{constructor(e,n){this.query=e,this.panel=n}}const matchMark=Decoration.mark({class:"cm-searchMatch"}),selectedMatchMark=Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),searchHighlighter=ViewPlugin.fromClass(class{constructor(o){this.view=o,this.decorations=this.highlight(o.state.field(searchState))}update(o){let e=o.state.field(searchState);(e!=o.startState.field(searchState)||o.docChanged||o.selectionSet||o.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:o,panel:e}){if(!e||!o.spec.valid)return Decoration.none;let{view:n}=this,r=new RangeSetBuilder;for(let c=0,u=n.visibleRanges,h=u.length;c<h;c++){let{from:p,to:b}=u[c];for(;c<h-1&&b>u[c+1].from-2*250;)b=u[++c].to;o.highlight(n.state,p,b,(y,k)=>{let A=n.state.selection.ranges.some(R=>R.from==y&&R.to==k);r.add(y,k,A?selectedMatchMark:matchMark)})}return r.finish()}},{decorations:o=>o.decorations});function searchCommand(o){return e=>{let n=e.state.field(searchState,!1);return n&&n.query.spec.valid?o(e,n):openSearchPanel(e)}}const findNext=searchCommand((o,{query:e})=>{let{to:n}=o.state.selection.main,r=e.nextMatch(o.state,n,n);if(!r)return!1;let c=EditorSelection.sing
Line truncated
|
||||
`+n.scrub(),u=this.advance(c);return u>-1&&u<c.length?this.complete(e,r,u):!1}finish(e,n){return(this.stage==2||this.stage==3)&&skipSpace(n.content,this.pos)==n.content.length?this.complete(e,n,n.content.length):!1}complete(e,n,r){return e.addLeafElement(n,elt(Type.LinkReference,this.start,this.start+r,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(parseLinkLabel(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(elt(Type.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(parseURL(e,skipSpace(e,this.pos),this.start)))return-1}else if(this.stage==2){let n=skipSpace(e,this.pos),r=0;if(n>this.pos){let c=parseLinkTitle(e,n,this.start);if(c){let u=lineEnd(e,c.to-this.start);u>0&&(this.nextStage(c),r=u)}}return r||(r=lineEnd(e,this.pos)),r>0&&r<e.length?r:-1}else return lineEnd(e,this.pos)}}}function lineEnd(o,e){for(;e<o.length;e++){let n=o.charCodeAt(e);if(n==10)break;if(!space$2(n))return-1}return e}class SetextHeadingParser{nextLine(e,n,r){let c=n.depth<e.stack.length?-1:isSetextUnderline(n),u=n.next;if(c<0)return!1;let h=elt(Type.HeaderMark,e.lineStart+n.pos,e.lineStart+c);return e.nextLine(),e.addLeafElement(r,elt(u==61?Type.SetextHeading1:Type.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),h])),!0}finish(){return!1}}const DefaultLeafBlocks={LinkReference(o,e){return e.content.charCodeAt(0)==91?new LinkReferenceParser(e):null},SetextHeading(){return new SetextHeadingParser}},DefaultEndLeaf=[(o,e)=>isAtxHeading(e)>=0,(o,e)=>isFencedCode(e)>=0,(o,e)=>isBlockquote(e)>=0,(o,e)=>isBulletList(e,o,!0)>=0,(o,e)=>isOrderedList(e,o,!0)>=0,(o,e)=>isHorizontalRule(e,o,!0)>=0,(o,e)=>isHTMLBlock(e,o,!0)>=0],scanLineResult={text:"",end:0};class BlockContext{constructor(e,n,r,c){this.parser=e,this.input=n,this.ranges=c,this.line=new Line,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=c[c.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=c[0].from,this.block=CompositeBlock.create(Type.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new FragmentCursor(r,n):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let r=0;;){let c=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!c||e.markers[r].from<c.end);){let u=e.markers[r++];this.addNode(u.type,u.from,u.to)}if(!c)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let r of this.parser.blockParsers)if(r){let c=r(this,e);if(c!=!1){if(c==!0)return null;e.forward();continue e}}break}let n=new LeafBlock(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let c=r(this,n);c&&n.parsers.push(c)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,n))break e}for(let r of n.parsers)if(r.nextLine(this,e,n))return null;n.content+=`
|
||||
`+e.scrub();for(let r of e.markers)n.marks.push(r)}return this.finishLeaf(n),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let n=this.fragments.takeNodes(this);return n?(this.absoluteLineStart+=n,this.lineStart=toRelative(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let n=scanLineResult;if(n.end=e,e>=this.to)n.text="";else if(n.text=this.lineChunkAt(e),n.end+=n.text.length,this.ranges.length>1){let r=this.absoluteLineStart,c=this.rangeI;for(;this.ranges[c].to<n.end;){c++;let u=this.ranges[c].from,h=this.lineChunkAt(u);n.end=u+h.length,n.text=n.text.slice(0,this.ranges[c-1].to-r)+h,r=n.end-n.text.length}}return n}readLine(){let{line:e}=this,{text:n,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(n);e.depth<this.stack.length;e.depth++){let c=this.stack[e.depth],u=this.parser.skipContextMarkup[c.type];if(!u)throw new Error("Unhandled block context "+Type[c.type]);if(!u(c,this,e))break;e.forward()}}lineChunkAt(e){let n=this.input.chunk(e),r;if(this.input.lineChunks)r=n==`
|
||||
`?"":n;else{let c=n.indexOf(`
|
||||
`);r=c<0?n:n.slice(0,c)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,n,r=0){this.block=CompositeBlock.create(e,r,this.lineStart+n,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,n,r=0){this.startContext(this.parser.getNodeType(e),n,r)}addNode(e,n,r){typeof e=="number"&&(e=new Tree(this.parser.nodeSet.types[e],none,none,(r??this.prevLineEnd())-n)),this.block.addChild(e,n-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,n){this.addNode(this.buffer.writeElements(injectMarks(n.children,e.marks),-n.from).finish(n.type,n.to-n.from),n.from)}finishContext(){let e=this.stack.pop(),n=this.stack[this.stack.length-1];n.addChild(e.toTree(this.parser.nodeSet),e.from-n.from),this.block=n}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?injectGaps(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let n=injectMarks(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(n,-e.start).finish(Type.Paragraph,e.content.length),e.start)}elt(e,n,r,c){return typeof e=="string"?elt(this.parser.getNodeType(e),n,r,c):new TreeElement(e,n)}get buffer(){return new Buffer$1(this.parser.nodeSet)}}function injectGaps(o,e,n,r,c){let u=o[e].to,h=[],p=[],b=n.from+r;function y(k,A){for(;A?k>=u:k>u;){let R=o[e+1].from-u;r+=R,k+=R,e++,u=o[e].to}}for(let k=n.firstChild;k;k=k.nextSibling){y(k.from+r,!0);let A=k.from+r,R,N=c.get(k.tree);N?R=N:k.to+r>u?(R=injectGaps(o,e,k,r,c),y(k.to+r,!1)):R=k.toTree(),h.push(R),p.push(A-b)}return y(n.to+r,!1),new Tree(n.type,h,p,n.to+r-b,n.tree?n.tree.propValues:void 0)}class MarkdownParser extends Parser{constructor(e,n,r,c,u,h,p,b,y){super(),this.nodeSet=e,this.blockParsers=n,this.leafBlockParsers=r,this.blockNames=c,this.endLeafBlock=u,this.skipContextMarkup=h,this.inlineParsers=p,this.inlineNames=b,this.wrappers=y,this.nodeTypes=Object.create(null);for(let k of e.types)this.nodeTypes[k.name]=k.id}createParse(e,n,r){let c=new BlockContext(this,e,n,r);for(let u of this.wrappers)c=u(c,e,n,r);return c}configure(e){let n=resolveConfig(e);if(!n)return this;let{nodeSet:r,skipContextMarkup:c}=this,u=this.blockParsers.slice(),h=this.leafBlockParsers.slice(),p=this.blockNames.slice(),b=this.inlineParsers.slice(),y=this.inlineNames.slice(),k=this.endLeafBlock.slice(),A=this.wrappers;if(nonEmpty(n.defineNodes)){c=Object.assign({},c);let R=r.types.slice(),N;for(let F of n.defineNodes){let{name:V,block:W,composite:J,style:te}=typeof F=="string"?{name:F}:F;if(R.some(fe=>fe.name==V))continue;J&&(c[R.length]=(fe,_e,ne)=>J(_e,ne,fe.value));let j=R.length,ae=J?["Block","BlockContext"]:W?j>=Type.ATXHeading1&&j<=Type.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;R.push(NodeType.define({id:j,name:V,props:ae&&[[NodeProp.group,ae]]})),te&&(N||(N={}),Array.isArray(te)||te instanceof Tag?N[V]=te:Object.assign(N,te))}r=new NodeSet(R),N&&(r=r.extend(styleTags(N)))}if(nonEmpty(n.props)&&(r=r.extend(...n.props)),nonEmpty(n.remove))for(let R of n.remove){let N=this.blockNames.indexOf(R),F=this.inlineNames.indexOf(R);N>-1&&(u[N]=h[N]=void 0),F>-1&&(b[F]=void 0)}if(nonEmpty(n.parseBlock))for(let R of n.parseBlock){let N=p.indexOf(R.name);if(N>-1)u[N]=R.parse,h[N]=R.leaf;else{let F=R.before?findName(p,R.before):R.after?findName(p,R.after)+1:p.length-1;u.splice(F,0,R.parse),h.splice(F,0,R.leaf),p.splice(F,0,R.name)}R.endLeaf&&k.push(R.endLeaf)}if(nonEmpty(n.parseInline))for(let R of n.parseInline){let N=y.indexOf(R.name);if(N>-1)b[N]=R.parse;else{let F=R.before?findName(y,R.before):R.after?findName(y,R.after)+1:y.length-1;b.splice(F,0,R.parse),y.splice(F,0,R.name)}}return n.wrap&&(A=A.concat(n.wrap)),new MarkdownParser(r,u,h,p,k,c,b,y,A)}getNodeType(e){let n=this.nodeTypes[e];if(n==null)throw new RangeError(`Unknown node type '${e}'`);return n}parseInline(e,n){let r=new InlineContext(this,e,n);e:for(let c=n;c<r.end;){let u=r.char(c);for(let h of this.inlineParsers)if(h){let p=h(r,u,c);if(p>=0){c=p;continue e}}c++}return r.resolveMarkers(0)}}function nonEmpty(o){return o!=null&&o.length>0}function resolveConfig(o){if(!Array.isArray(o))return o;if(o.length==0)return null;let e=resolveConfig(o[0]);if(o.length==1)return e;let n=resolveConfig(o.slice(1));if(!n||!e)return e||n;let r=(h,p)=>(h||none).concat(p||none),c=e.wrap,u=n.wrap;return{props:r(e.props,n.props),defineNodes:r(e.defineNodes,n.defineNodes),parseBlock:r(e.parseBlock,n.parseBlock),parseInline:r(e.parseInline,n.parseInline),remove:r(e.remove,n.remove),wrap:c?u?(h,p,b,y)=>c(u(h,p,b,y),p,b,y):c:u}}function findName(o,e){let n=o.indexOf(e);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);re
Line truncated
|
||||
`;)u--;this.fragmentEnd=u?u-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let c=e+this.fragment.offset;for(;r.to<=c;)if(!r.parent())return!1;for(;;){if(r.from>=c)return this.fragment.from<=n;if(!r.childAfter(c))return!1}}matches(e){let n=this.cursor.tree;return n&&n.prop(NodeProp.contextHash)==e}takeNodes(e){let n=this.cursor,r=this.fragment.offset,c=this.fragmentEnd-(this.fragment.openEnd?1:0),u=e.absoluteLineStart,h=u,p=e.block.children.length,b=h,y=p;for(;;){if(n.to-r>c){if(n.type.isAnonymous&&n.firstChild())continue;break}let k=toRelative(n.from-r,e.ranges);if(n.to-r<=e.ranges[e.rangeI].to)e.addNode(n.tree,k);else{let A=new Tree(e.parser.nodeSet.types[Type.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(A,n.tree),e.addNode(A,k)}if(n.type.is("Block")&&(NotLast.indexOf(n.type.id)<0?(h=n.to-r,p=e.block.children.length):(h=b,p=y,b=n.to-r,y=e.block.children.length)),!n.nextSibling())break}for(;e.block.children.length>p;)e.block.children.pop(),e.block.positions.pop();return h-u}}function toRelative(o,e){let n=o;for(let r=1;r<e.length;r++){let c=e[r-1].to,u=e[r].from;c<o&&(n-=u-c)}return n}const markdownHighlighting=styleTags({"Blockquote/...":tags$1.quote,HorizontalRule:tags$1.contentSeparator,"ATXHeading1/... SetextHeading1/...":tags$1.heading1,"ATXHeading2/... SetextHeading2/...":tags$1.heading2,"ATXHeading3/...":tags$1.heading3,"ATXHeading4/...":tags$1.heading4,"ATXHeading5/...":tags$1.heading5,"ATXHeading6/...":tags$1.heading6,"Comment CommentBlock":tags$1.comment,Escape:tags$1.escape,Entity:tags$1.character,"Emphasis/...":tags$1.emphasis,"StrongEmphasis/...":tags$1.strong,"Link/... Image/...":tags$1.link,"OrderedList/... BulletList/...":tags$1.list,"BlockQuote/...":tags$1.quote,"InlineCode CodeText":tags$1.monospace,"URL Autolink":tags$1.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":tags$1.processingInstruction,"CodeInfo LinkLabel":tags$1.labelName,LinkTitle:tags$1.string,Paragraph:tags$1.content}),parser$3=new MarkdownParser(new NodeSet(nodeTypes).extend(markdownHighlighting),Object.keys(DefaultBlockParsers).map(o=>DefaultBlockParsers[o]),Object.keys(DefaultBlockParsers).map(o=>DefaultLeafBlocks[o]),Object.keys(DefaultBlockParsers),DefaultEndLeaf,DefaultSkipMarkup,Object.keys(DefaultInline).map(o=>DefaultInline[o]),Object.keys(DefaultInline),[]);function leftOverSpace(o,e,n){let r=[];for(let c=o.firstChild,u=e;;c=c.nextSibling){let h=c?c.from:n;if(h>u&&r.push({from:u,to:h}),!c)break;u=c.to}return r}function parseCode(o){let{codeParser:e,htmlParser:n}=o;return{wrap:parseMixed((c,u)=>{let h=c.type.id;if(e&&(h==Type.CodeBlock||h==Type.FencedCode)){let p="";if(h==Type.FencedCode){let y=c.node.getChild(Type.CodeInfo);y&&(p=u.read(y.from,y.to))}let b=e(p);if(b)return{parser:b,overlay:y=>y.type.id==Type.CodeText}}else if(n&&(h==Type.HTMLBlock||h==Type.HTMLTag))return{parser:n,overlay:leftOverSpace(c.node,c.from,c.to)};return null})}}const StrikethroughDelim={resolve:"Strikethrough",mark:"StrikethroughMark"},Strikethrough={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":tags$1.strikethrough}},{name:"StrikethroughMark",style:tags$1.processingInstruction}],parseInline:[{name:"Strikethrough",parse(o,e,n){if(e!=126||o.char(n+1)!=126||o.char(n+2)==126)return-1;let r=o.slice(n-1,n),c=o.slice(n+2,n+3),u=/\s|^$/.test(r),h=/\s|^$/.test(c),p=Punctuation.test(r),b=Punctuation.test(c);return o.addDelimiter(StrikethroughDelim,n,n+2,!h&&(!b||u||p),!u&&(!p||h||b))},after:"Emphasis"}]};function parseRow(o,e,n=0,r,c=0){let u=0,h=!0,p=-1,b=-1,y=!1,k=()=>{r.push(o.elt("TableCell",c+p,c+b,o.parser.parseInline(e.slice(p,b),c+p)))};for(let A=n;A<e.length;A++){let R=e.charCodeAt(A);R==124&&!y?((!h||p>-1)&&u++,h=!1,r&&(p>-1&&k(),r.push(o.elt("TableDelimiter",A+c,A+c+1))),p=b=-1):(y||R!=32&&R!=9)&&(p<0&&(p=A),b=A+1),y=!y&&R==92}return p>-1&&(u++,r&&k()),u}function hasPipe(o,e){for(let n=e;n<o.length;n++){let r=o.charCodeAt(n);if(r==124)return!0;r==92&&n++}return!1}const delimiterLine=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class TableParser{constructor(){this.rows=null}nextLine(e,n,r){if(this.rows==null){this.rows=!1;let c;if((n.next==45||n.next==58||n.next==124)&&delimiterLine.test(c=n.text.slice(n.pos))){let u=[];parseRow(e,r.content,0,u,r.start)==parseRow(e,c,n.pos)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,u),e.elt("TableDelimiter",e.lineStart+n.pos,e.lineStart+n.text.length)])}}else if(this.rows){let c=[];parseRow(e,n.text,n.pos,c,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+n.pos,e.lineStart+n.text.length,c))}return!1}finish(e,n){return this.rows?(e.addLeafElement(n,e.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}}const Table={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":tags$1.heading}},"TableRow",{name:"TableCell",style:tags$1.content},{name:"TableDelimiter",style:tags$1.processingInstruction}],parseBlock:[{name:"Table",leaf(o,e){return hasPip
Line truncated
|
||||
\${}
|
||||
} catch (\${error}) {
|
||||
\${}
|
||||
}`,{label:"try",detail:"/ catch block",type:"keyword"}),snippetCompletion("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),snippetCompletion(`if (\${}) {
|
||||
\${}
|
||||
} else {
|
||||
\${}
|
||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),snippetCompletion(`class \${name} {
|
||||
constructor(\${params}) {
|
||||
\${}
|
||||
}
|
||||
}`,{label:"class",detail:"definition",type:"keyword"}),snippetCompletion('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),snippetCompletion('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],typescriptSnippets=snippets.concat([snippetCompletion("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),snippetCompletion("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),snippetCompletion("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),cache=new NodeWeakMap,ScopeNodes=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function defID(o){return(e,n)=>{let r=e.node.getChild("VariableDefinition");return r&&n(r,o),!0}}const functionContext=["FunctionDeclaration"],gatherCompletions={FunctionDeclaration:defID("function"),ClassDeclaration:defID("class"),ClassExpression:()=>!0,EnumDeclaration:defID("constant"),TypeAliasDeclaration:defID("type"),NamespaceDeclaration:defID("namespace"),VariableDefinition(o,e){o.matchContext(functionContext)||e(o,"variable")},TypeDefinition(o,e){e(o,"type")},__proto__:null};function getScope(o,e){let n=cache.get(e);if(n)return n;let r=[],c=!0;function u(h,p){let b=o.sliceString(h.from,h.to);r.push({label:b,type:p})}return e.cursor(IterMode.IncludeAnonymous).iterate(h=>{if(c)c=!1;else if(h.name){let p=gatherCompletions[h.name];if(p&&p(h,u)||ScopeNodes.has(h.name))return!1}else if(h.to-h.from>8192){for(let p of getScope(o,h.node))r.push(p);return!1}}),cache.set(e,r),r}const Identifier=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,dontComplete=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function localCompletionSource(o){let e=syntaxTree(o.state).resolveInner(o.pos,-1);if(dontComplete.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&Identifier.test(o.state.sliceDoc(e.from,e.to));if(!n&&!o.explicit)return null;let r=[];for(let c=e;c;c=c.parent)ScopeNodes.has(c.name)&&(r=r.concat(getScope(o.state.doc,c)));return{options:r,from:n?e.from:o.pos,validFor:Identifier}}const javascriptLanguage=LRLanguage.define({name:"javascript",parser:parser.configure({props:[indentNodeProp.add({IfStatement:continuedIndent({except:/^\s*({|else\b)/}),TryStatement:continuedIndent({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:flatIndent,SwitchBody:o=>{let e=o.textAfter,n=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return o.baseIndent+(n?0:r?1:2)*o.unit},Block:delimitedIndent({closing:"}"}),ArrowFunction:o=>o.baseIndent+o.unit,"TemplateString BlockComment":()=>null,"Statement Property":continuedIndent({except:/^{/}),JSXElement(o){let e=/^\s*<\//.test(o.textAfter);return o.lineIndent(o.node.from)+(e?0:o.unit)},JSXEscape(o){let e=/\s*\}/.test(o.textAfter);return o.lineIndent(o.node.from)+(e?0:o.unit)},"JSXOpenTag JSXSelfClosingTag"(o){return o.column(o.node.from)+o.unit}}),foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":foldInside,BlockComment(o){return{from:o.from+2,to:o.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),jsxSublanguage={test:o=>/^JSX/.test(o.name),facet:defineLanguageFacet({commentTokens:{block:{open:"{/*",close:"*/}"}}})},typescriptLanguage=javascriptLanguage.configure({dialect:"ts"},"typescript"),jsxLanguage=javascriptLanguage.configure({dialect:"jsx",props:[sublanguageProp.add(o=>o.isTop?[jsxSublanguage]:void 0)]}),tsxLanguage=javascriptLanguage.configure({dialect:"jsx ts",props:[sublanguageProp.add(o=>o.isTop?[jsxSublanguage]:void 0)]},"typescript");let kwCompletion=o=>({label:o,type:"keyword"});const keywords="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(kwCompletion),typescriptKeywords=keywords.concat(["declare","implements","private","protected","public"].map(kwCompletion));function javascript(o={}){let e=o.jsx?o.typescript?tsxLanguage:jsxLanguage:o.typescript?typescriptLanguage:javascriptLanguage,n=o.typescript?typescriptSnippets.concat(typescriptKeywords):snippets.concat(keywords);return new LanguageSupport(e,[javascriptLanguage.data.of({autocomplete:ifNotIn(dontComplete,completeFromList(n))}),javascriptLanguage.data.of({autocomplete:localCompletionSource}),o.jsx?autoCloseTags$1:[]])}function findOpenTag(o){for(;;){if(o.name=="JSXOpenTag"||o.name=="JSXSelfClosingTag"||o.name=="JSXFragmentTag")return o;if(o.name=="JSXEscape"||!o.parent)return null;o=o.parent}}function elementName$1(o,e,n=o.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibli
Line truncated
|
||||
`,attr(e,"class","start-typing")},m(n,r){insert$1(n,e,r)},p:noop,d(n){n&&detach(e)}}}function create_each_block_1$1(o,e){let n,r=previewTitle(e[9].schemas,e[24],e[0])+"",c,u,h,p;function b(...k){return e[17](e[24],...k)}function y(...k){return e[18](e[24],...k)}return{key:o,first:null,c(){n=element("div"),c=text(r),u=space$3(),attr(n,"class","reference-tags-option"),attr(n,"role","button"),attr(n,"tabindex","0"),this.first=n},m(k,A){insert$1(k,n,A),append(n,c),append(n,u),h||(p=[listen(n,"click",b),listen(n,"keypress",y)],h=!0)},p(k,A){e=k,A&65&&r!==(r=previewTitle(e[9].schemas,e[24],e[0])+"")&&set_data(c,r)},d(k){k&&detach(n),h=!1,run_all(p)}}}function create_if_block_1$7(o){let e,n,r,c,u,h;return{c(){e=element("div"),n=text('Add "'),r=text(o[5]),c=text('"'),attr(e,"class","reference-tags-option"),attr(e,"role","button"),attr(e,"tabindex","0")},m(p,b){insert$1(p,e,b),append(e,n),append(e,r),append(e,c),u||(h=[listen(e,"click",o[19]),listen(e,"keypress",o[20])],u=!0)},p(p,b){b&32&&set_data(r,p[5])},d(p){p&&detach(e),u=!1,run_all(h)}}}function create_if_block$9(o){let e,n=[],r=new Map,c,u=ensure_array_like(o[7]);const h=p=>p[3].id;for(let p=0;p<u.length;p+=1){let b=get_each_context$6(o,u,p),y=h(b);r.set(y,n[p]=create_each_block$6(y,b))}return{c(){e=element("div");for(let p=0;p<n.length;p+=1)n[p].c();set_style(e,"display","flex"),set_style(e,"align-items","center"),set_style(e,"gap","4px")},m(p,b){insert$1(p,e,b);for(let y=0;y<n.length;y+=1)n[y]&&n[y].m(e,null);c=!0},p(p,b){b&1664&&(u=ensure_array_like(p[7]),group_outros(),n=update_keyed_each(n,b,h,1,p,u,r,e,outro_and_destroy_block,create_each_block$6,null,get_each_context$6),check_outros())},i(p){if(!c){for(let b=0;b<u.length;b+=1)transition_in(n[b]);c=!0}},o(p){for(let b=0;b<n.length;b+=1)transition_out(n[b]);c=!1},d(p){p&&detach(e);for(let b=0;b<n.length;b+=1)n[b].d()}}}function create_each_block$6(o,e){let n,r,c=previewTitle(e[9].schemas,e[3])+"",u,h,p,b,y,k,A,R,N;y=new Icon({props:{width:12,height:12,icon:"close"}});function F(...V){return e[21](e[3],...V)}return{key:o,first:null,c(){n=element("span"),r=element("a"),u=text(c),p=space$3(),b=element("button"),create_component(y.$$.fragment),k=space$3(),attr(r,"class","record-title"),attr(r,"href",h=e[9].lucentUrl+"/records/"+e[3].id),attr(b,"type","button"),attr(b,"class","button-text"),attr(b,"aria-label","Close"),attr(n,"class","reference-tags-selected-value"),this.first=n},m(V,W){insert$1(V,n,W),append(n,r),append(r,u),append(n,p),append(n,b),mount_component(y,b,null),append(n,k),A=!0,R||(N=listen(b,"click",prevent_default(F)),R=!0)},p(V,W){e=V,(!A||W&128)&&c!==(c=previewTitle(e[9].schemas,e[3])+"")&&set_data(u,c),(!A||W&128&&h!==(h=e[9].lucentUrl+"/records/"+e[3].id))&&attr(r,"href",h)},i(V){A||(transition_in(y.$$.fragment,V),A=!0)},o(V){transition_out(y.$$.fragment,V),A=!1},d(V){V&&detach(n),destroy_component(y),R=!1,N()}}}function create_fragment$d(o){let e,n,r,c,u,h,p,b,y,k,A,R,N=o[8]&&create_if_block_3$4(o),F=o[6]&&create_if_block_2$4(o),V=o[5]&&create_if_block_1$7(o),W=o[7].length>0&&create_if_block$9(o);return{c(){e=element("div"),N&&N.c(),n=space$3(),r=element("input"),u=space$3(),h=element("div"),F&&F.c(),p=space$3(),V&&V.c(),b=space$3(),W&&W.c(),y=empty$1(),attr(r,"type","search"),attr(r,"id",o[2]),attr(r,"placeholder",c="Search for "+o[1].label),attr(r,"autocomplete","off"),toggle_class(r,"is-invalid",o[8]),attr(h,"class","reference-tags-results"),attr(e,"class","reference-tags")},m(J,te){insert$1(J,e,te),N&&N.m(e,null),append(e,n),append(e,r),o[15](r),set_input_value(r,o[5]),append(e,u),append(e,h),F&&F.m(h,null),append(h,p),V&&V.m(h,null),insert$1(J,b,te),W&&W.m(J,te),insert$1(J,y,te),k=!0,A||(R=[listen(r,"keyup",o[13]),listen(r,"input",o[16])],A=!0)},p(J,[te]){J[8]?N?N.p(J,te):(N=create_if_block_3$4(J),N.c(),N.m(e,n)):N&&(N.d(1),N=null),(!k||te&4)&&attr(r,"id",J[2]),(!k||te&2&&c!==(c="Search for "+J[1].label))&&attr(r,"placeholder",c),te&32&&r.value!==J[5]&&set_input_value(r,J[5]),(!k||te&256)&&toggle_class(r,"is-invalid",J[8]),J[6]?F?F.p(J,te):(F=create_if_block_2$4(J),F.c(),F.m(h,p)):F&&(F.d(1),F=null),J[5]?V?V.p(J,te):(V=create_if_block_1$7(J),V.c(),V.m(h,null)):V&&(V.d(1),V=null),J[7].length>0?W?(W.p(J,te),te&128&&transition_in(W,1)):(W=create_if_block$9(J),W.c(),transition_in(W,1),W.m(y.parentNode,y)):W&&(group_outros(),transition_out(W,1,1,()=>{W=null}),check_outros())},i(J){k||(transition_in(W),k=!0)},o(J){transition_out(W),k=!1},d(J){J&&(detach(e),detach(b),detach(y)),N&&N.d(),o[15](null),F&&F.d(),V&&V.d(),W&&W.d(J),A=!1,run_all(R)}}}function instance$d(o,e,n){let r,c,u;const h=getContext$1("channel");let{field:p}=e,{id:b}=e,{record:y}=e,{graph:k}=e,A,{validationErrors:R}=e,N="";function F(Ae,Ne){Ae.preventDefault(),n(0,k.edges=k.edges.filter(xe=>!(xe.target===Ne&&xe.field===p.name)),k)}function V(Ae,Ne){Ae.preventDefault(),axios.post(h.lucentUrl+"/records",{isCreateMode:!0,record:{schema:p.collections[0],status:"published",data:{[p.searchField]:Ne}}}).then(xe=>{n(
Line truncated
|
||||
versions`),rn=space$3(),Fe=element("div"),de.c(),Eo=space$3(),jn=element("div"),Ut&&Ut.c(),attr(u,"class","label text-end text-muted"),attr(R,"class","label text-end text-muted"),attr(te,"class","label text-end text-muted"),attr(Ne,"class","label text-end text-muted"),attr(r,"class","col-8"),attr(je,"class","label d-block text-muted "),attr(Le,"class","col-4"),attr(n,"class","row"),attr(e,"class","lx-card "),attr(Fe,"class","revisions")},m(pt,Ie){insert$1(pt,e,Ie),append(e,n),append(n,r),append(r,c),append(c,u),append(c,h),append(c,p),append(p,y),append(r,k),append(r,A),append(A,R),append(A,N),append(A,V),append(r,W),append(r,J),append(J,te),append(J,j),mount_component(ae,J,null),append(J,fe),append(J,ne),append(r,Se),append(r,Ae),append(Ae,Ne),append(Ae,xe),mount_component(Oe,Ae,null),append(Ae,Ft),append(Ae,St),append(n,q),append(n,Le),append(Le,je),append(Le,mn),append(Le,Pt),append(Pt,Ue),append(Pt,dn),append(Pt,Zt),insert$1(pt,rn,Ie),insert$1(pt,Fe,Ie),cs[mt].m(Fe,null),insert$1(pt,Eo,Ie),insert$1(pt,jn,Ie),Ut&&Ut.m(jn,null),o[13](jn),Yn=!0},p(pt,[Ie]){(!Yn||Ie&1)&&b!==(b=pt[0].id+"")&&set_data(y,b),(!Yn||Ie&1)&&F!==(F=pt[0]._sys.version+"")&&set_data(V,F);const Rt={};Ie&3&&(Rt.name=usernameById(pt[1],pt[0]._sys.createdBy)),ae.$set(Rt),(!Yn||Ie&1)&&_e!==(_e=friendlyDate(pt[0]._sys.createdAt)+"")&&set_data(ne,_e);const pn={};Ie&3&&(pn.name=usernameById(pt[1],pt[0]._sys.updatedBy)),Oe.$set(pn),(!Yn||Ie&1)&&Qt!==(Qt=friendlyDate(pt[0]._sys.updatedAt)+"")&&set_data(St,Qt),(!Yn||Ie&4)&&ct!==(ct=pt[2].revisions+"")&&set_data(dn,ct);let kt=mt;mt=gt(pt),mt===kt?cs[mt].p(pt,Ie):(group_outros(),transition_out(cs[kt],1,1,()=>{cs[kt]=null}),check_outros(),de=cs[mt],de?de.p(pt,Ie):(de=cs[mt]=po[mt](pt),de.c()),transition_in(de,1),de.m(Fe,null)),pt[5]?Ut?(Ut.p(pt,Ie),Ie&32&&transition_in(Ut,1)):(Ut=create_if_block$6(pt),Ut.c(),transition_in(Ut,1),Ut.m(jn,null)):Ut&&(group_outros(),transition_out(Ut,1,1,()=>{Ut=null}),check_outros())},i(pt){Yn||(transition_in(ae.$$.fragment,pt),transition_in(Oe.$$.fragment,pt),transition_in(de),transition_in(Ut),Yn=!0)},o(pt){transition_out(ae.$$.fragment,pt),transition_out(Oe.$$.fragment,pt),transition_out(de),transition_out(Ut),Yn=!1},d(pt){pt&&(detach(e),detach(rn),detach(Fe),detach(Eo),detach(jn)),destroy_component(ae),destroy_component(Oe),cs[mt].d(),Ut&&Ut.d(),o[13](null)}}}function instance$8(o,e,n){let r,c,u,h;const p=getContext$1("channel");let{record:b}=e,{graph:y}=e,{users:k}=e,{schema:A}=e,R,N="";axios.get(`${p.lucentUrl}/records/${b.id}/revisions`).then(j=>{n(8,r=j.data)}).catch(j=>{console.log(j)});function F(j,ae){n(7,h=y.edges.filter(fe=>fe.depth===1).reduce((fe,_e)=>(fe[_e.field]||(fe[_e.field]={record:[],revision:[]}),fe[_e.field].record.push(_e),fe),{})),n(7,h=ae._edges.reduce((fe,_e)=>(fe[_e.field]||(fe[_e.field]={record:[],revision:[]}),fe[_e.field].revision.push(_e),fe),h))}function V(j,ae){j.preventDefault(),n(5,u=ae),n(6,c=A.fields.filter(fe=>!lodashExports.isEqual(u.data[fe.name],b.data[fe.name]))),F(c,ae),R.scrollIntoView()}function W(j){j.preventDefault(),n(4,N=""),axios.post(`${p.lucentUrl}/records/${b.id}/rollback/${u._sys.version}`).then(ae=>{window.location.reload()}).catch(ae=>{const fe=ae.response.data.error;n(4,N=fe.fieldLabel+": "+fe.message)})}const J=(j,ae)=>V(ae,j);function te(j){binding_callbacks[j?"unshift":"push"](()=>{R=j,n(3,R)})}return o.$$set=j=>{"record"in j&&n(0,b=j.record),"graph"in j&&n(11,y=j.graph),"users"in j&&n(1,k=j.users),"schema"in j&&n(2,A=j.schema)},n(8,r=[]),n(6,c=[]),n(5,u=null),n(7,h={}),[b,k,A,R,N,u,c,h,r,V,W,y,J,te]}class Info extends SvelteComponent{constructor(e){super(),init(this,e,instance$8,create_fragment$8,safe_not_equal,{record:0,graph:11,users:1,schema:2})}}const{window:window_1}=globals;function get_each_context$2(o,e,n){const r=o.slice();return r[21]=e[n],r}function create_if_block_5(o){let e,n,r;return{c(){e=element("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Save`,attr(e,"type","button"),attr(e,"class","button primary ms-2 btn btn-primary btn-spinner")},m(c,u){insert$1(c,e,u),n||(r=listen(e,"click",o[11]),n=!0)},p:noop,d(c){c&&detach(e),n=!1,r()}}}function create_if_block_4(o){let e,n,r;return{c(){e=element("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Create`,attr(e,"class","button primary btn-spinner")},m(c,u){insert$1(c,e,u),n||(r=listen(e,"click",o[11]),n=!0)},p:noop,d(c){c&&detach(e),n=!1,r()}}}function create_if_block_3(o){let e,n;return e=new Info({props:{record:o[0],graph:o[1],users:o[4],schema:o[2]}}),{c(){create_component(e.$$.fragment)},m(r,c){mount_component(e,r,c),n=!0},p(r,c){const u={};c&1&&(u.record=r[0]),c&2&&(u.graph=r[1]),c&16&&(u.users=r[4]),c&4&&(u.schema=r[2]),e.$set(u)},i(r){n||(transition_in(e.$$.fragment,r),n=!0)},o(r){transition_out(e.$$.fragment,r),n=!1},d(r){destroy_component(e,r)}}}function create_if_block_2(o){let e,n;return e=new Graph({props:{graph:o[1],record:o[0]}}),{c(){create_component(e.$$.fragment)},m(r,c){mount_component(e,r,c),n=!0},p(r,c){const u={};c&2&&(u.graph=r[1]),c&1&&(u.record=r[0]),e.$set(u)},i(r){n||(transition_in(e.$$.fragment,r),n=!0)},o(r){transition_out(e.$$.fragment,r),n=!1},d(r){destroy_component(e,r)}}}function create_if_block$5(o){let e,n,r=[],c=new Map,u,h;e=new FilePreview({props:{record:o[0],schema:o[2]}});let p=ensure_array_like(o[9]);const b=y=>y[21].name;for(let y=0;y<p.length;y+=1){let k=get_each_context$2(o,p,y),A=b(k);c.set(A,r[y]=create_each_block$2(A,k))}return{c(){create_component(e.$$.fragment),n=space$3();for(let y=0;y<r.length;y+=1)r[y].c();u=empty$1()},m(y,k){mount_component(e,y,k),insert$1(y,n,k);for(let A=0;A<r.length;A+=1)r[A]&&r[A].m(y,k);insert$1(y,u,k),h=!0},p(y,k){const A={};k&1&&(A.record=y[0]),k&4&&(A.schema=y[2]),e.$set(A),k&623&&(p=ensure_array_like(y[9]),group_outros(),r=update_keyed_each(r,k,b,1,y,p,c,u.parentNode,outro_and_destroy_block,create_each_block$2,u,get_each_context$2),check_outros())},i(y){if(!h){transition_in(e.$$.fragment,y);for(let k=0;k<p.length;k+=1)transition_in(r[k]);h=!0}},o(y){transition_out(e.$$.fragment,y);for(let k=0;k<r.length;k+=1)transition_out(r[k]);h=!1},d(y){y&&(detach(n),detach(u)),destroy_component(e,y);for(let k=0;k<r.length;k+=1)r[k].d(y)}}}function create_if_block_1$3(o){let e,n,r,c;function u(b){o[15](b)}function h(b){o[16](b)}let p={field:o[21],schema:o[2],record:o[0],validationErrors:o[5],isCreateMode:o[3]};return o[0].data!==void 0&&(p.data=o[0].data),o[1]!==void 0&&(p.graph=o[1]),e=new FormField({props:p}),binding_callbacks.push(()=>bind(e,"data",u)),binding_callbacks.push(()=>bind(e,"graph",h)),{c(){create_component(e.$$.fragment)},m(b,y){mount_component(e,b,y),c=!0},p(b,y){const k={};y&4&&(k.schema=b[2]),y&1&&(k.record=b[0]),y&32&&(k.validationErrors=b[5]),y&8&&(k.isCreateMode=b[3]),!n&&y&1&&(n=!0,k.data=b[0].data,add_flush_callback(()=>n=!1)),!r&&y&2&&(r=!0,k.graph=b[1],add_flush_callback(()=>r=!1)),e.$set(k)},i(b){c||(transition_in(e.$$.fragment,b),c=!0)},o(b){transition_out(e.$$.fragment,b),c=!1},d(b){destroy_component(e,b)}}}function create_each_block$2(o,e){let n,r,c,u=e[6]===e[21].group&&create_if_block_1$3(e);return{key:o,first:null,c(){n=empty$1(),u&&u.c(),r=empty$1(),this.first=n},m(h,p){insert$1(h,n,p),u&&u.m(h,p),insert$1(h,r,p),c=!0},p(h,p){e=h,e[6]===e[21].group?u?(u.p(e,p),p&64&&transition_in(u,1)):(u=create_if_block_1$3(e),u.c(),transition_in(u,1),u.m(r.parentNode,r)):u&&(group_outros(),transition_out(u,1,1,()=>{u=null}),check_outros())},i(h){c||(transition_in(u),c=!0)},o(h){transition_out(u),c=!1},d(h){h&&(detach(n),detach(r)),u&&u.d(h)}}}function create_fragment$7(o){let e,n,r,c,u,h,p,b,y,k,A,R,N,F,V,W,J,te,j,ae,fe;function _e(Le){o[12](Le)}function ne(Le){o[13](Le)}let Se={schema:o[2],isCreateMode:o[3]};o[0]!==void 0&&(Se.record=o[0]),o[6]!==void 0&&(Se.activeContentTab=o[6]),r=new EditHeader({props:Se}),binding_callbacks.push(()=>bind(r,"record",_e)),binding_callbacks.push(()=>bind(r,"activeContentTab",ne));function Ae(Le,je){if(Le[3])return create_if_block_4;if(Le[8])return create_if_block_5}let Ne=Ae(o),xe=Ne&&Ne(o);b=new Title({props:{schema:o[2],record:o[0],isCreateMode:o[3]}}),k=new ErrorAlert({props:{message:o[7]}});function Oe(Le){o[14](Le)}let Ft={schema:o[2],isCreateMode:o[3]};o[6]!==void 0&&(Ft.active=o[6]),N=new ContentTabs({props:Ft}),binding_callbacks.push(()=>bind(N,"active",Oe));const Qt=[create_if_block$5,create_if_block_2,create_if_block_3],St=[];function q(Le,je){return je&64&&(W=null),W==null&&(W=!["_graph","_info"].includes(Le[6])),W?0:Le[6]==="_graph"?1:Le[6]==="_info"?2:-1}return~(J=q(o,-1))&&(te=St[J]=Qt[J](o)),{c(){e=element("div"),n=element("div"),create_component(r.$$.fragment),h=space$3(),xe&&xe.c(),p=space$3(),create_component(b.$$.fragment),y=space$3(),create_component(k.$$.fragment),A=space$3(),R=element("div"),create_component(N.$$.fragment),V=space$3(),te&&te.c(),attr(n,"class","tools-header"),attr(R,"class","mt-4"),set_style(R,"margin-bottom","150px"),set_style(R,"position","relative"),attr(e,"class","record-edit")},m(Le,je){insert$1(Le,e,je),append(e,n),mount_component(r,n,null),append(n,h),xe&&xe.m(n,null),append(e,p),mount_component(b,e,null),append(e,y),mount_component(k,e,null),append(e,A),append(e,R),mount_component(N,R,null),append(R,V),~J&&St[J].m(R,null
Line truncated
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";:root{--p10: #f4f9ff;--p20: #eaf1f9;--p30: #b3ceff;--p40: #8db5ff;--p50: #70a2ff;--p60: #679cff;--p70: #4284ff;--p80: #1c6bff;--p90: #002b7a;--p100: #000C23;--suc10: #d1ffb8;--suc20: #d1ffb8;--suc30: #b5ff8d;--suc40: #a2ff70;--suc50: #82cc5a;--suc80: #71b34e;--suc90: #314c22;--err10: #ffb9d0;--err20: #ff9bb3;--err30: #fe7e97;--err40: #de617b;--err50: #be4461;--err80: #61001a;--err90: #560012;--grey-dark: #424656;--grey-light: #a6abbd;--text: var(--p100);--text-light: var(--grey-dark);--text-error: var(--err50);--main-font: ‘Open Sans‘, Arial, Helvetica, sans-serif}*,*:before,*:after{box-sizing:border-box}*{margin:0}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}#root,#__next{isolation:isolate}.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-5{margin-top:20px}.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-5{margin-bottom:20px}.pt-1{padding-top:4px}.pt-2{padding-top:8px}.pt-3{padding-top:12px}.pt-4{padding-top:16px}.pt-5{padding-top:20px}.pb-1{padding-bottom:4px}.pb-2{padding-bottom:8px}.pb-3{padding-bottom:12px}.pb-4{padding-bottom:16px}.pb-5{padding-bottom:20px}.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-5{gap:20px}.hide{display:none!important}.hidden{visibility:hidden}.d-block{display:block}.d-inline-block{display:inline-block}.is-bold{font-weight:700}.in-place{padding:36px}.notice{background-color:var(--p20);padding:14px;margin:2rem 0;position:relative;font-size:16px;line-height:24px;border-radius:12px}.notice .title{content:"NOTE";border-radius:12px;display:block;font-weight:700}.notice.notice-success{background:var(--suc20)}.notice.notice-error{background:var(--err10)}.scope-login{display:flex;height:100vh}.scope-login .bg-image{width:50%;background:url(/vendor/lucent/public/art.jpg);background-size:cover;background-repeat:no-repeat;background-position:center center}.scope-login .login-form{width:50%;height:100vh;display:flex;align-items:center;justify-content:center}.content{font-size:16px;line-height:20px;font-family:var(--main-font);color:var(--text)}.content p{margin-bottom:14px}.content p:last-child{margin-bottom:0}.content h1{font-size:24px;line-height:34px}.content h2{font-size:20px;line-height:30px}.content h3{font-size:18px;line-height:28px}.content ul{padding:0 0 0 16px;list-style:none outside none}.content ul li:before{content:"—";opacity:.5;font-size:12px;padding-right:6px;vertical-align:10%}.content ul li{list-style:none;padding:0}.content code{background:var(--p30);padding:0 6px;border-radius:12px}.content img{margin-bottom:14px}.content blockquote{border:1px solid var(--p30);border-radius:12px;padding:12px 40px;position:relative}.content blockquote:before{content:"“";color:var(--p60);font-size:4em;position:absolute;left:10px;top:20px}.content blockquote:after{content:""}.content pre{background:var(--grey-light);border-radius:.5rem;color:var(--white);font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem}.content pre code{background:none;color:inherit;font-size:.8rem;padding:0}.lx-small-text{font-size:12px;line-height:15px}.light-text{color:var(--text-light)}.sidebar-top{border:0px solid var(--p30);font-size:18px;padding:20px;display:flex;align-items:center;justify-content:space-between;background:var(--p20);margin-bottom:15px;border-radius:12px}.sidebar{border-radius:12px;font-size:15px;line-height:28px;padding:20px;background:var(--p20);display:flex;flex-direction:column;gap:3px}.sidebar-header{display:flex;cursor:pointer;justify-content:space-between;align-items:center;background:var(--p30);font-size:16px;padding:3px 12px;color:var(--text);border:none;border-radius:12px}.sidebar-header:focus{box-shadow:none}.sidebar-header:hover{background:var(--p40)}.sidebar-header:last-child{border-bottom:none}.sidebar-item{color:var(--text);display:block;font-size:14px;padding:3px 12px;text-decoration:none;transition:.6s;border-radius:12px}.sidebar-item:last-child{border-bottom:none}.sidebar-item:hover{background:var(--p30)}.sidebar-item.active{background:var(--p40)}.top-nav{display:flex;justify-content:end;align-items:center;gap:10px}.top-nav-item{border-radius:12px;font-size:14px;background:var(--p20);padding:3px 10px}.top-nav-item:hover{background:var(--p30)}label{display:block;font-weight:700;margin-bottom:4px}input[type=text],input[type=number],input[type=search],input[type=email],textarea{width:100%;background:var(--p20);border:1px solid var(--p50);border-radius:5px;padding:5px 7px;font-size:16px}input[type=text]:focus,input[type=number]:focus,input[type=search]:focus,input[type=email]:focus,textarea:focus{background:var(--p10)}textarea{resize:none}select{width:100%;background:var(--p20);border:1px solid var(--p50);border-radius:5px;padding:5px 7px;font-size:16px}select:focus{backgrouLine truncated
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
@charset "UTF-8";:root{--p10: #f4f9ff;--p20: #eaf1f9;--p30: #b3ceff;--p40: #8db5ff;--p50: #70a2ff;--p60: #679cff;--p70: #4284ff;--p80: #1c6bff;--p90: #002b7a;--p100: #000C23;--suc10: #d1ffb8;--suc20: #d1ffb8;--suc30: #b5ff8d;--suc40: #a2ff70;--suc50: #82cc5a;--suc80: #71b34e;--suc90: #314c22;--err10: #ffb9d0;--err20: #ff9bb3;--err30: #fe7e97;--err40: #de617b;--err50: #be4461;--err80: #61001a;--err90: #560012;--grey-dark: #424656;--grey-light: #a6abbd;--text: var(--p100);--text-light: var(--grey-dark);--text-error: var(--err50);--main-font: ‘Open Sans‘, Arial, Helvetica, sans-serif}*,*:before,*:after{box-sizing:border-box}*{margin:0}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}#root,#__next{isolation:isolate}.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-5{margin-top:20px}.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-5{margin-bottom:20px}.pt-1{padding-top:4px}.pt-2{padding-top:8px}.pt-3{padding-top:12px}.pt-4{padding-top:16px}.pt-5{padding-top:20px}.pb-1{padding-bottom:4px}.pb-2{padding-bottom:8px}.pb-3{padding-bottom:12px}.pb-4{padding-bottom:16px}.pb-5{padding-bottom:20px}.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-5{gap:20px}.hide{display:none!important}.hidden{visibility:hidden}.d-block{display:block}.d-inline-block{display:inline-block}.is-bold{font-weight:700}.in-place{padding:36px}.notice{background-color:var(--p20);padding:14px;margin:2rem 0;position:relative;font-size:16px;line-height:24px;border-radius:12px}.notice .title{content:"NOTE";border-radius:12px;display:block;font-weight:700}.notice.notice-success{background:var(--suc20)}.notice.notice-error{background:var(--err10)}.scope-login{display:flex;height:100vh}.scope-login .bg-image{width:50%;background:url(/vendor/lucent/public/art.jpg);background-size:cover;background-repeat:no-repeat;background-position:center center}.scope-login .login-form{width:50%;height:100vh;display:flex;align-items:center;justify-content:center}.content{font-size:16px;line-height:20px;font-family:var(--main-font);color:var(--text)}.content p{margin-bottom:14px}.content p:last-child{margin-bottom:0}.content ul{padding:0 0 0 16px;list-style:none outside none}.content ul li:before{content:"—";opacity:.5;font-size:12px;padding-right:6px;vertical-align:10%}.content ul li{list-style:none;padding:0}.lx-small-text{font-size:12px;line-height:15px}.light-text{color:var(--text-light)}.sidebar-top{border:0px solid var(--p30);font-size:18px;padding:20px;display:flex;align-items:center;justify-content:space-between;background:var(--p20);margin-bottom:15px;border-radius:12px}.sidebar{border-radius:12px;font-size:15px;line-height:28px;padding:20px;background:var(--p20);display:flex;flex-direction:column;gap:3px}.sidebar-header{display:flex;cursor:pointer;justify-content:space-between;align-items:center;background:var(--p30);font-size:16px;padding:3px 12px 6px;color:var(--text);border:none;border-radius:12px}.sidebar-header:hover{background:var(--p40)}.sidebar-header:last-child{border-bottom:none}.sidebar-item{color:var(--text);display:block;font-size:14px;padding:3px 12px;text-decoration:none;transition:.6s;border-radius:12px}.sidebar-item:last-child{border-bottom:none}.sidebar-item:hover{background:var(--p30)}.sidebar-item.active{background:var(--p40)}.top-nav{display:flex;justify-content:end;align-items:center;gap:10px}.top-nav-item{border-radius:12px;font-size:14px;background:var(--p20);padding:3px 10px}.top-nav-item:hover{background:var(--p30)}label{display:block;font-weight:700;margin-bottom:4px}input[type=text],input[type=number],input[type=search],input[type=email],textarea{width:100%;background:var(--p20);border:1px solid var(--p50);border-radius:5px;padding:5px 7px;font-size:16px}input[type=text]:focus,input[type=number]:focus,input[type=search]:focus,input[type=email]:focus,textarea:focus{background:var(--p10)}textarea{resize:none}select{width:100%;background:var(--p20);border:1px solid var(--p50);border-radius:5px;padding:5px 7px;font-size:16px}select:focus{background:var(--p10)}.htmx-indicator{display:none}.htmx-request .htmx-indicator,.htmx-request.htmx-indicator{display:inline}.bt{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#000;background-image:none;border:1px solid #000;border-radius:4px;box-shadow:#fff 4px 4px,#000 4px 4px 0 1px;box-sizing:border-box;color:#fff;cursor:pointer;display:inline-block;font-family:ITCAvantGardeStd-Bk,Arial,sans-serif;font-size:16px;font-weight:400;line-height:20px;margin:0 5px 10px 0;overflow:visible;padding:8px 40px;text-align:center;text-transform:none;touch-action:manipulation;user-select:none;-webkit-user-select:none;vertical-align:middle;white-space:nowrap}.bt:focus{text-decoration:none}.bt:hover{text-decoration:none}.bt:aLine truncated
|
||||
Vendored
+213
@@ -0,0 +1,213 @@
|
||||
var uP=Object.defineProperty;var hP=(i,e,t)=>e in i?uP(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Qh=(i,e,t)=>(hP(i,typeof e!="symbol"?e+"":e,t),t);function U(){}const fP=i=>i;function Ps(i,e){for(const t in e)i[t]=e[t];return i}function Yw(i){return i()}function Jp(){return Object.create(null)}function ht(i){i.forEach(Yw)}function nh(i){return typeof i=="function"}function re(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}let qa;function ad(i,e){return i===e?!0:(qa||(qa=document.createElement("a")),qa.href=e,i===qa.href)}function dP(i){return Object.keys(i).length===0}function Hl(i,e,t,n){if(i){const r=zw(i,e,t,n);return i[0](r)}}function zw(i,e,t,n){return i[1]&&n?Ps(t.ctx.slice(),i[1](n(e))):t.ctx}function Kl(i,e,t,n){if(i[2]&&n){const r=i[2](n(t));if(e.dirty===void 0)return r;if(typeof r=="object"){const s=[],o=Math.max(e.dirty.length,r.length);for(let l=0;l<o;l+=1)s[l]=e.dirty[l]|r[l];return s}return e.dirty|r}return e.dirty}function Jl(i,e,t,n,r,s){if(r){const o=zw(e,t,n,s);i.p(o,r)}}function ea(i){if(i.ctx.length>32){const e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function mP(i){return i&&nh(i.destroy)?i.destroy:U}function eg(i){const e=typeof i=="string"&&i.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[i,"px"]}const Vw=typeof window<"u";let pP=Vw?()=>window.performance.now():()=>Date.now(),Xm=Vw?i=>requestAnimationFrame(i):U;const lo=new Set;function Uw(i){lo.forEach(e=>{e.c(i)||(lo.delete(e),e.f())}),lo.size!==0&&Xm(Uw)}function gP(i){let e;return lo.size===0&&Xm(Uw),{promise:new Promise(t=>{lo.add(e={c:i,f:t})}),abort(){lo.delete(e)}}}const OP=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function b(i,e){i.appendChild(e)}function jw(i){if(!i)return document;const e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function bP(i){const e=y("style");return e.textContent="/* empty */",vP(jw(i),e),e.sheet}function vP(i,e){return b(i.head||i,e),e.sheet}function x(i,e,t){i.insertBefore(e,t||null)}function P(i){i.parentNode&&i.parentNode.removeChild(i)}function Ot(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function y(i){return document.createElement(i)}function wP(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function W(i){return document.createTextNode(i)}function D(){return W(" ")}function Ie(){return W("")}function G(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function Ln(i){return function(e){return e.preventDefault(),i.call(this,e)}}function O(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Jo(i,e,t){const n=e.toLowerCase();n in i?i[n]=typeof i[n]=="boolean"&&t===""?!0:t:e in i?i[e]=typeof i[e]=="boolean"&&t===""?!0:t:O(i,e,t)}function qw(i){let e;return{p(...t){e=t,e.forEach(n=>i.push(n))},r(){e.forEach(t=>i.splice(i.indexOf(t),1))}}}function Gw(i){return i===""?null:+i}function yP(i){return Array.from(i.childNodes)}function K(i,e){e=""+e,i.data!==e&&(i.data=e)}function Le(i,e){i.value=e??""}function le(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function tg(i,e,t){for(let n=0;n<i.options.length;n+=1){const r=i.options[n];if(r.__value===e){r.selected=!0;return}}(!t||e!==void 0)&&(i.selectedIndex=-1)}function kP(i){const e=i.querySelector(":checked");return e&&e.__value}function Ae(i,e,t){i.classList.toggle(e,!!t)}function Hw(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}function Xr(i,e){return new i(e)}const su=new Map;let ou=0;function SP(i){let e=5381,t=i.length;for(;t--;)e=(e<<5)-e^i.charCodeAt(t);return e>>>0}function _P(i,e){const t={stylesheet:bP(e),rules:{}};return su.set(i,t),t}function ng(i,e,t,n,r,s,o,l=0){const a=16.666/n;let c=`{
|
||||
`;for(let g=0;g<=1;g+=a){const v=e+(t-e)*s(g);c+=g*100+`%{${o(v,1-v)}}
|
||||
`}const u=c+`100% {${o(t,1-t)}}
|
||||
}`,h=`__svelte_${SP(u)}_${l}`,f=jw(i),{stylesheet:d,rules:m}=su.get(f)||_P(f,i);m[h]||(m[h]=!0,d.insertRule(`@keyframes ${h} ${u}`,d.cssRules.length));const p=i.style.animation||"";return i.style.animation=`${p?`${p}, `:""}${h} ${n}ms linear ${r}ms 1 both`,ou+=1,h}function CP(i,e){const t=(i.style.animation||"").split(", "),n=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),r=t.length-n.length;r&&(i.style.animation=n.join(", "),ou-=r,ou||PP())}function PP(){Xm(()=>{ou||(su.forEach(i=>{const{ownerNode:e}=i.stylesheet;e&&P(e)}),su.clear())})}let ta;function Tl(i){ta=i}function Bo(){if(!ta)throw new Error("Function called outside component initialization");return ta}function xi(i){Bo().$$.on_mount.push(i)}function Kw(i){Bo().$$.after_update.push(i)}function Jw(i){Bo().$$.on_destroy.push(i)}function nn(){const i=Bo();return(e,t,{cancelable:n=!1}={})=>{const r=i.$$.callbacks[e];if(r){const s=Hw(e,t,{cancelable:n});return r.slice().forEach(o=>{o.call(i,s)}),!s.defaultPrevented}return!0}}function Ql(i,e){return Bo().$$.context.set(i,e),e}function Ue(i){return Bo().$$.context.get(i)}function vs(i,e){const t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const Hs=[],Ce=[];let ao=[];const cd=[],AP=Promise.resolve();let ud=!1;function xP(){ud||(ud=!0,AP.then(ey))}function As(i){ao.push(i)}function st(i){cd.push(i)}const Mh=new Set;let Vs=0;function ey(){if(Vs!==0)return;const i=ta;do{try{for(;Vs<Hs.length;){const e=Hs[Vs];Vs++,Tl(e),TP(e.$$)}}catch(e){throw Hs.length=0,Vs=0,e}for(Tl(null),Hs.length=0,Vs=0;Ce.length;)Ce.pop()();for(let e=0;e<ao.length;e+=1){const t=ao[e];Mh.has(t)||(Mh.add(t),t())}ao.length=0}while(Hs.length);for(;cd.length;)cd.pop()();ud=!1,Mh.clear(),Tl(i)}function TP(i){if(i.fragment!==null){i.update(),ht(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(As)}}function QP(i){const e=[],t=[];ao.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),ao=e}let el;function MP(){return el||(el=Promise.resolve(),el.then(()=>{el=null})),el}function Eh(i,e,t){i.dispatchEvent(Hw(`${e?"intro":"outro"}${t}`))}const Lc=new Set;let sr;function Oe(){sr={r:0,c:[],p:sr}}function be(){sr.r||ht(sr.c),sr=sr.p}function T(i,e){i&&i.i&&(Lc.delete(i),i.i(e))}function R(i,e,t,n){if(i&&i.o){if(Lc.has(i))return;Lc.add(i),sr.c.push(()=>{Lc.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}const EP={duration:0};function lu(i,e,t,n){let s=e(i,t,{direction:"both"}),o=n?0:1,l=null,a=null,c=null,u;function h(){c&&CP(i,c)}function f(m,p){const g=m.b-o;return p*=Math.abs(g),{a:o,b:m.b,d:g,duration:p,start:m.start,end:m.start+p,group:m.group}}function d(m){const{delay:p=0,duration:g=300,easing:v=fP,tick:w=U,css:S}=s||EP,_={start:pP()+p,b:m};m||(_.group=sr,sr.r+=1),"inert"in i&&(m?u!==void 0&&(i.inert=u):(u=i.inert,i.inert=!0)),l||a?a=_:(S&&(h(),c=ng(i,o,m,g,p,v,S)),m&&w(0,1),l=f(_,g),As(()=>Eh(i,m,"start")),gP(k=>{if(a&&k>a.start&&(l=f(a,g),a=null,Eh(i,l.b,"start"),S&&(h(),c=ng(i,o,l.b,l.duration,0,v,s.css))),l){if(k>=l.end)w(o=l.b,1-o),Eh(i,l.b,"end"),a||(l.b?h():--l.group.r||ht(l.group.c)),l=null;else if(k>=l.start){const A=k-l.start;o=l.a+l.d*v(A/l.duration),w(o,1-o)}}return!!(l||a)}))}return{run(m){nh(s)?MP().then(()=>{s=s({direction:m?"in":"out"}),d(m)}):d(m)},end(){h(),l=a=null}}}function fe(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Fm(i,e){i.d(1),e.delete(i.key)}function Jr(i,e){R(i,1,1,()=>{e.delete(i.key)})}function Ti(i,e,t,n,r,s,o,l,a,c,u,h){let f=i.length,d=s.length,m=f;const p={};for(;m--;)p[i[m].key]=m;const g=[],v=new Map,w=new Map,S=[];for(m=d;m--;){const C=h(r,s,m),Q=t(C);let M=o.get(Q);M?S.push(()=>M.p(C,e)):(M=c(Q,C),M.c()),v.set(Q,g[m]=M),Q in p&&w.set(Q,Math.abs(m-p[Q]))}const _=new Set,k=new Set;function A(C){T(C,1),C.m(l,u),o.set(C.key,C),u=C.first,d--}for(;f&&d;){const C=g[d-1],Q=i[f-1],M=C.key,L=Q.key;C===Q?(u=C.first,f--,d--):v.has(L)?!o.has(M)||_.has(M)?A(C):k.has(L)?f--:w.get(M)>w.get(L)?(k.add(M),A(C)):(_.add(L),f--):(a(Q,o),f--)}for(;f--;){const C=i[f];v.has(C.key)||a(C,o)}for(;d;)A(g[d-1]);return ht(S),g}function _o(i,e){const t={},n={},r={$$scope:1};let s=i.length;for(;s--;){const o=i[s],l=e[s];if(l){for(const a in o)a in l||(n[a]=1);for(const a in l)r[a]||(t[a]=l[a],r[a]=1);i[s]=l}else for(const a in o)r[a]=1}for(const o in n)o in t||(t[o]=void 0);return t}function Co(i){return typeof i=="object"&&i!==null?i:{}}function nt(i,e,t){const n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function V(i){i&&i.c()}function Y(i,e,t){const{fragment:n,after_update:r}=i.$$;n&&n.m(e,t),As(()=>{const s=i.$$.on_mount.map(Yw).filter(nh);i.$$.on_destroy?i.$$.on_destroy.push(...s):ht(s),i.$$.on_mount=[]}),r.forEach(As)}function z(i,e){const t=i.$$;t.fragment!==null&&(QP(t.after_update),ht(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function RP(i,e){i.$$.dirty[0]===-1&&(Hs.push(i),xP(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function se(i,e,t,n,r,
Line truncated
|
||||
<img alt="indicator" id="indicator" class="htmx-indicator" src="/img/spinner.svg"/>`,O(t,"class","mb-5"),O(u,"for","emailaddress"),O(u,"class","form-label"),O(f,"type","email"),O(f,"class","form-control"),O(f,"id","emailaddress"),f.required=!0,O(c,"class","mt-5 mb-3"),O(m,"class","bt bt-primary"),O(e,"class","form")},m(v,w){x(v,e,w),b(e,t),b(e,n),b(e,r),b(r,s),b(r,o),b(r,l),b(r,a),b(r,c),b(c,u),b(c,h),b(c,f),Le(f,i[0]),b(r,d),b(r,m),p||(g=[G(f,"input",i[3]),G(r,"submit",i[2])],p=!0)},p(v,w){w&1&&f.value!==v[0]&&Le(f,v[0])},d(v){v&&P(e),p=!1,ht(g)}}}function sx(i){let e,t,n,r,s,o,l,a;return{c(){e=y("div"),t=y("p"),n=W("You will receive an email with a login link at "),r=y("b"),s=W(i[0]),o=W("."),l=D(),a=y("p"),a.textContent="Check your spam folder",O(e,"class","alert alert-info"),O(e,"role","alert")},m(c,u){x(c,e,u),b(e,t),b(t,n),b(t,r),b(r,s),b(t,o),b(e,l),b(e,a)},p(c,u){u&1&&K(s,c[0])},d(c){c&&P(e)}}}function ox(i){let e,t,n,r;function s(a,c){return a[1]?sx:rx}let o=s(i),l=o(i);return{c(){e=y("div"),t=y("div"),n=D(),r=y("div"),l.c(),O(t,"class","bg-image"),O(r,"class","login-form"),O(e,"class","scope-login")},m(a,c){x(a,e,c),b(e,t),b(e,n),b(e,r),l.m(r,null)},p(a,[c]){o===(o=s(a))&&l?l.p(a,c):(l.d(1),l=o(a),l&&(l.c(),l.m(r,null)))},i:U,o:U,d(a){a&&P(e),l.d()}}}function lx(i,e,t){const n=Ue("channel");let r="",s=!1;function o(a){a.preventDefault(),Jn(n.lucentUrl+"/login",{email:r}).then(()=>{t(1,s=!0)}).catch(()=>{})}function l(){r=this.value,t(0,r)}return[r,s,o,l]}class ax extends oe{constructor(e){super(),se(this,e,lx,ox,re,{})}}function cx(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w;return{c(){e=y("div"),t=y("div"),n=D(),r=y("div"),s=y("div"),o=y("h2"),o.textContent="Welcome to Lucent",l=D(),a=y("form"),c=y("button"),u=W("Enter as "),h=W(i[0]),f=D(),d=y("img"),p=D(),g=y("div"),O(t,"class","bg-image"),O(o,"class","mb-5"),O(d,"alt","indicator"),O(d,"id","indicator"),O(d,"class","htmx-indicator"),ad(d.src,m="/img/spinner.svg")||O(d,"src",m),O(c,"class","bt bt-primary"),O(g,"class","form-errors"),O(s,"class","form"),O(r,"class","login-form"),O(e,"class","scope-login")},m(S,_){x(S,e,_),b(e,t),b(e,n),b(e,r),b(r,s),b(s,o),b(s,l),b(s,a),b(a,c),b(c,u),b(c,h),b(c,f),b(c,d),b(s,p),b(s,g),v||(w=G(a,"submit",i[1]),v=!0)},p(S,[_]){_&1&&K(h,S[0])},i:U,o:U,d(S){S&&P(e),v=!1,w()}}}function ux(i,e,t){const n=Ue("channel");let{email:r}=e,{token:s}=e;function o(l){l.preventDefault(),Jn(n.lucentUrl+"/verify",{email:r,token:s}).then(a=>{window.location=n.lucentUrl}).catch(a=>{})}return i.$$set=l=>{"email"in l&&t(0,r=l.email),"token"in l&&t(2,s=l.token)},[r,o,s]}class hx extends oe{constructor(e){super(),se(this,e,ux,cx,re,{email:0,token:2})}}function fx(i){let e,t,n;return{c(){e=y("div"),t=y("div"),n=W(i[2]),O(t,"class","avatar__letters"),O(e,"class","avatar"),O(e,"title",i[0]),le(e,"background-color",i[3][i[4]]),le(e,"height",i[1]+"px"),le(e,"width",i[1]+"px"),le(e,"font-size",i[1]/2+"px")},m(r,s){x(r,e,s),b(e,t),b(t,n)},p(r,[s]){s&4&&K(n,r[2]),s&1&&O(e,"title",r[0]),s&2&&le(e,"height",r[1]+"px"),s&2&&le(e,"width",r[1]+"px"),s&2&&le(e,"font-size",r[1]/2+"px")},i:U,o:U,d(r){r&&P(e)}}}function dx(i,e,t){let{name:n}=e,{side:r=48}=e;const s=["#00AA55","#009FD4","#B381B3","#939393","#E3BC00","#D47500","#DC2A2A","#3ede91","#377dd4","#0256b0","#053d82","#3d026e","#b378e3","#c4065c","#543208","#d97811","#0c6b40"];let o="";n.split(" ").length>1?o=n.split(" ")[0].charAt(0).toUpperCase()+n.split(" ")[1].charAt(0).toUpperCase():o=n.split(" ")[0].charAt(0).toUpperCase()+n.split(" ")[0].charAt(1).toUpperCase();let a=(n.charCodeAt(1)+n.length)%19;return i.$$set=c=>{"name"in c&&t(0,n=c.name),"side"in c&&t(1,r=c.side)},[n,r,o,s,a]}class _i extends oe{constructor(e){super(),se(this,e,dx,fx,re,{name:0,side:1})}}function mx(i){const e=i-1;return e*e*e+1}function hu(i,{delay:e=0,duration:t=400,easing:n=mx,x:r=0,y:s=0,opacity:o=0}={}){const l=getComputedStyle(i),a=+l.opacity,c=l.transform==="none"?"":l.transform,u=a*(1-o),[h,f]=eg(r),[d,m]=eg(s);return{delay:e,duration:t,easing:n,css:(p,g)=>`
|
||||
transform: ${c} translate(${(1-p)*h}${f}, ${(1-p)*d}${m});
|
||||
opacity: ${a-u*g}`}}function dg(i){let e,t,n,r,s,o,l;return{c(){e=y("div"),t=y("div"),t.textContent="Success",n=D(),r=y("div"),s=W(i[1]),O(t,"class","title"),O(r,"class","content"),O(e,"class","notice notice-success"),O(e,"role","alert")},m(a,c){x(a,e,c),b(e,t),b(e,n),b(e,r),b(r,s),l=!0},p(a,c){(!l||c&2)&&K(s,a[1])},i(a){l||(a&&As(()=>{l&&(o||(o=lu(e,hu,{duration:500},!0)),o.run(1))}),l=!0)},o(a){a&&(o||(o=lu(e,hu,{duration:500},!1)),o.run(0)),l=!1},d(a){a&&P(e),a&&o&&o.end()}}}function px(i){let e,t=i[0]&&dg(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&T(t,1)):(t=dg(n),t.c(),T(t,1),t.m(e.parentNode,e)):t&&(Oe(),R(t,1,1,()=>{t=null}),be())},i(n){T(t)},o(n){R(t)},d(n){n&&P(e),t&&t.d(n)}}}function gx(i,e,t){let n,r;function s(o="Saved"){t(1,n=o),t(0,r=!0),setTimeout(function(){t(0,r=!1)},2e3)}return t(1,n="Saved"),t(0,r=!1),[r,n,s]}class ay extends oe{constructor(e){super(),se(this,e,gx,px,re,{show:2})}get show(){return this.$$.ctx[2]}}function Ox(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k,A,C,Q,M,L;t=new Ma({props:{message:i[2]}});let N={};return r=new ay({props:N}),i[8](r),l=new _i({props:{name:i[4].name}}),d=new uu({props:{label:"Update Name"}}),S=new uu({props:{label:"Update Email"}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),V(r.$$.fragment),s=D(),o=y("h3"),V(l.$$.fragment),a=D(),c=y("form"),u=y("div"),h=y("input"),f=D(),V(d.$$.fragment),m=D(),p=y("form"),g=y("div"),v=y("input"),w=D(),V(S.$$.fragment),_=D(),k=y("div"),A=y("a"),C=W("Logout from this device"),O(o,"class","header-small mb-5"),O(h,"type","text"),O(h,"class","form-control mb-3"),O(h,"placeholder","Name"),h.required=!0,O(u,"class","input-group mb-5"),O(v,"type","email"),O(v,"class","form-control mb-3"),O(v,"placeholder","Email"),v.required=!0,O(g,"class","input-group mb-5"),O(A,"class","list-group-item list-group-item-action"),O(A,"href",i[5].lucentUrl+"/logout"),O(k,"class","list-group"),O(e,"class","wrapper-tiny")},m(B,J){x(B,e,J),Y(t,e,null),b(e,n),Y(r,e,null),b(e,s),b(e,o),Y(l,o,null),b(e,a),b(e,c),b(c,u),b(u,h),Le(h,i[0]),b(u,f),Y(d,u,null),b(e,m),b(e,p),b(p,g),b(g,v),Le(v,i[1]),b(g,w),Y(S,g,null),b(e,_),b(e,k),b(k,A),b(A,C),Q=!0,M||(L=[G(h,"input",i[9]),G(c,"submit",i[6]),G(v,"input",i[10]),G(p,"submit",i[7])],M=!0)},p(B,[J]){const te={};J&4&&(te.message=B[2]),t.$set(te);const ie={};r.$set(ie),J&1&&h.value!==B[0]&&Le(h,B[0]),J&2&&v.value!==B[1]&&Le(v,B[1])},i(B){Q||(T(t.$$.fragment,B),T(r.$$.fragment,B),T(l.$$.fragment,B),T(d.$$.fragment,B),T(S.$$.fragment,B),Q=!0)},o(B){R(t.$$.fragment,B),R(r.$$.fragment,B),R(l.$$.fragment,B),R(d.$$.fragment,B),R(S.$$.fragment,B),Q=!1},d(B){B&&P(e),z(t),i[8](null),z(r),z(l),z(d),z(S),M=!1,ht(L)}}}function bx(i,e,t){const n=Ue("user"),r=Ue("channel");let s=n.name,o=n.email,l="",a;function c(m){m.preventDefault(),t(2,l=""),Jn(r.lucentUrl+"/account/update-name",{name:s}).then(p=>{a.show()}).catch(p=>{var g;t(2,l=(g=p.response)==null?void 0:g.data.error),console.log({errorMessage:l})})}function u(m){m.preventDefault(),t(2,l=""),Jn(r.lucentUrl+"/account/update-email",{email:o}).then(p=>{a.show()}).catch(p=>{var g;t(2,l=(g=p.response)==null?void 0:g.data.error),console.log({errorMessage:l})})}function h(m){Ce[m?"unshift":"push"](()=>{a=m,t(3,a)})}function f(){s=this.value,t(0,s)}function d(){o=this.value,t(1,o)}return[s,o,l,a,n,r,c,u,h,f,d]}class vx extends oe{constructor(e){super(),se(this,e,bx,Ox,re,{})}}function wx(i){let e,t,n;const r=[{channel:i[3]},{title:i[0]},i[2]];var s=i[4][i[1]];function o(l,a){let c={};for(let u=0;u<r.length;u+=1)c=Ps(c,r[u]);return a!==void 0&&a&13&&(c=Ps(c,_o(r,[a&8&&{channel:l[3]},a&1&&{title:l[0]},a&4&&Co(l[2])]))),{props:c}}return s&&(t=Xr(s,o(i))),{c(){e=y("div"),t&&V(t.$$.fragment)},m(l,a){x(l,e,a),t&&Y(t,e,null),n=!0},p(l,[a]){if(a&2&&s!==(s=l[4][l[1]])){if(t){Oe();const c=t;R(c.$$.fragment,1,0,()=>{z(c,1)}),be()}s?(t=Xr(s,o(l,a)),V(t.$$.fragment),T(t.$$.fragment,1),Y(t,e,null)):t=null}else if(s){const c=a&13?_o(r,[a&8&&{channel:l[3]},a&1&&{title:l[0]},a&4&&Co(l[2])]):{};t.$set(c)}},i(l){n||(t&&T(t.$$.fragment,l),n=!0)},o(l){t&&R(t.$$.fragment,l),n=!1},d(l){l&&P(e),t&&z(t)}}}function yx(i,e,t){const n={register:ix,login:ax,verify:hx,profile:vx};let{title:r}=e,{view:s}=e,{user:o}=e,{data:l}=e,{channel:a}=e;return Ql("channel",a),Ql("user",o),i.$$set=c=>{"title"in c&&t(0,r=c.title),"view"in c&&t(1,s=c.view),"user"in c&&t(5,o=c.user),"data"in c&&t(2,l=c.data),"channel"in c&&t(3,a=c.channel)},[r,s,l,a,n,o]}class kx extends oe{constructor(e){super(),se(this,e,yx,wx,re,{title:0,view:1,user:5,data:2,channel:3})}}const Sx=i=>({}),mg=i=>({});function _x(i){let e;return{c(){e=W("Dropdown")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function Cx(i){let e,t,n,r,s,o,l,a;const c=i[6].button,u=Hl(c,i,i[5],mg),h=u||_x(),f=i[6].default,d=Hl(f,i,i[5],null);return{c(){e=y("div"),t=y("button"),h&&h.c(),n=D(),r=y("div"),d&&d.c(),O(t,"class","button dropdown-button"),O(t,"type","button"),O(t,"aria-expanded","false"),O(r,"class",s="dropdown-menu hide ori
Line truncated
|
||||
Save`,O(e,"type","button"),O(e,"class","button primary ms-2 btn btn-primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[10]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function gT(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Create`,O(e,"class","button primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[10]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function qg(i){let e,t,n,r;function s(a){i[14](a)}function o(a){i[15](a)}let l={field:i[24],schema:i[2],record:i[0],validationErrors:i[4],isCreateMode:i[3]};return i[0].data!==void 0&&(l.data=i[0].data),i[1]!==void 0&&(l.graph=i[1]),e=new aP({props:l}),Ce.push(()=>nt(e,"data",s)),Ce.push(()=>nt(e,"graph",o)),{c(){V(e.$$.fragment)},m(a,c){Y(e,a,c),r=!0},p(a,c){const u={};c&4&&(u.schema=a[2]),c&1&&(u.record=a[0]),c&16&&(u.validationErrors=a[4]),c&8&&(u.isCreateMode=a[3]),!t&&c&1&&(t=!0,u.data=a[0].data,st(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],st(()=>n=!1)),e.$set(u)},i(a){r||(T(e.$$.fragment,a),r=!0)},o(a){R(e.$$.fragment,a),r=!1},d(a){z(e,a)}}}function Gg(i,e){let t,n,r,s=e[5]===e[24].group&&qg(e);return{key:i,first:null,c(){t=Ie(),s&&s.c(),n=Ie(),this.first=t},m(o,l){x(o,t,l),s&&s.m(o,l),x(o,n,l),r=!0},p(o,l){e=o,e[5]===e[24].group?s?(s.p(e,l),l&32&&T(s,1)):(s=qg(e),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(Oe(),R(s,1,1,()=>{s=null}),be())},i(o){r||(T(s),r=!0)},o(o){R(s),r=!1},d(o){o&&(P(t),P(n)),s&&s.d(o)}}}function OT(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w=[],S=new Map,_,k,A;function C(X){i[11](X)}function Q(X){i[12](X)}let M={schema:i[2],isCreateMode:i[3]};i[0]!==void 0&&(M.record=i[0]),i[5]!==void 0&&(M.activeContentTab=i[5]),n=new cy({props:M}),Ce.push(()=>nt(n,"record",C)),Ce.push(()=>nt(n,"activeContentTab",Q));function L(X,ee){if(X[3])return gT;if(X[6])return pT}let N=L(i),B=N&&N(i);a=new _y({props:{schema:i[2],record:i[0],isCreateMode:i[3]}}),u=new Ma({props:{message:i[7]}});function J(X){i[13](X)}let te={schema:i[2],isCreateMode:i[3]};i[5]!==void 0&&(te.active=i[5]),d=new uy({props:te}),Ce.push(()=>nt(d,"active",J)),g=new uT({props:{record:i[0],schema:i[2]}});let ie=fe(i[8]);const ae=X=>X[24].name;for(let X=0;X<ie.length;X+=1){let ee=jg(i,ie,X),Te=ae(ee);S.set(Te,w[X]=Gg(Te,ee))}return{c(){e=y("div"),t=y("div"),V(n.$$.fragment),o=D(),B&&B.c(),l=D(),V(a.$$.fragment),c=D(),V(u.$$.fragment),h=D(),f=y("div"),V(d.$$.fragment),p=D(),V(g.$$.fragment),v=D();for(let X=0;X<w.length;X+=1)w[X].c();O(t,"class","tools-header"),O(f,"class","mt-4"),le(f,"margin-bottom","150px"),le(f,"position","relative"),O(e,"class","inline-edit record-edit")},m(X,ee){x(X,e,ee),b(e,t),Y(n,t,null),b(t,o),B&&B.m(t,null),b(e,l),Y(a,e,null),b(e,c),Y(u,e,null),b(e,h),b(e,f),Y(d,f,null),b(f,p),Y(g,f,null),b(f,v);for(let Te=0;Te<w.length;Te+=1)w[Te]&&w[Te].m(f,null);_=!0,k||(A=G(window,"beforeunload",i[9]),k=!0)},p(X,[ee]){const Te={};ee&4&&(Te.schema=X[2]),ee&8&&(Te.isCreateMode=X[3]),!r&&ee&1&&(r=!0,Te.record=X[0],st(()=>r=!1)),!s&&ee&32&&(s=!0,Te.activeContentTab=X[5],st(()=>s=!1)),n.$set(Te),N===(N=L(X))&&B?B.p(X,ee):(B&&B.d(1),B=N&&N(X),B&&(B.c(),B.m(t,null)));const ve={};ee&4&&(ve.schema=X[2]),ee&1&&(ve.record=X[0]),ee&8&&(ve.isCreateMode=X[3]),a.$set(ve);const je={};ee&128&&(je.message=X[7]),u.$set(je);const ne={};ee&4&&(ne.schema=X[2]),ee&8&&(ne.isCreateMode=X[3]),!m&&ee&32&&(m=!0,ne.active=X[5],st(()=>m=!1)),d.$set(ne);const Ee={};ee&1&&(Ee.record=X[0]),ee&4&&(Ee.schema=X[2]),g.$set(Ee),ee&319&&(ie=fe(X[8]),Oe(),w=Ti(w,ee,ae,1,X,ie,S,f,Jr,Gg,null,jg),be())},i(X){if(!_){T(n.$$.fragment,X),T(a.$$.fragment,X),T(u.$$.fragment,X),T(d.$$.fragment,X),T(g.$$.fragment,X);for(let ee=0;ee<ie.length;ee+=1)T(w[ee]);_=!0}},o(X){R(n.$$.fragment,X),R(a.$$.fragment,X),R(u.$$.fragment,X),R(d.$$.fragment,X),R(g.$$.fragment,X);for(let ee=0;ee<w.length;ee+=1)R(w[ee]);_=!1},d(X){X&&P(e),z(n),B&&B.d(),z(a),z(u),z(d),z(g);for(let ee=0;ee<w.length;ee+=1)w[ee].d();k=!1,A()}}}function bT(i,e,t){let n,r;const s=Ue("channel"),o=nn();let{schema:l}=e,{record:a}=e,{graph:c={records:[],edges:[]}}=e,{isCreateMode:u}=e,h,f="",d=!1,m=l.fields.filter(M=>M.name!=="id"),p="_default";l.fields.reduce((M,L)=>L.ui==="tab"?(p=L.name,M):(M[p]=[...M[p]??[],L.name],M),[]),xi(()=>{g()});function g(){h={data:JSON.parse(JSON.stringify(a.data)),schema:a.schema,status:a.status,edges:JSON.parse(JSON.stringify(c.edges))}}Kw(()=>{t(6,d=w())});function v(M){return d?M.returnValue="You have unsaved changes. Are you sure you want to exit?":(delete M.returnValue,"...")}function w(){return u?!1:!ia(h,{data:a.data,schema:a.schema,status:a.status,edges:c.edges})}function S(M){return M.preventDefault(),console.log("SAVE: Attempt"),t(4,n=null),t(7,r=""),new Promise(function(L,N){var B;if(!d&&!u){L(null);return}if(!a){L(null);return}t(1,c.edges=((B=c.edges)==null?void 0:B.filter(J=>!J._isTrashed&&J.source===a.id))??[],c),Jn(s.lucentUrl+"/records",{record:a,edges:c.edges,isCreateMode:u}).then(function(J){console.log("SAVE: SAVED INLINE"),t(0,a=J.records[0]),t(1,c=J),u||g(),o("inlinesaved",{records:[a]}),L(null)}).catch(function(J){J.response&&(typeof J.response.data.error=="string"?t(7,r=J.response.data.error):t(4,n=J.response.data.error)),L(null)})})}function _(M){a=M,t(0,a)}function k(M){f=M,t(5,f)}function A(M){f=M,t(5,f)}function C(M){i.$$.not_e
Line truncated
|
||||
Back`),r=D();for(let h=0;h<u.length;h+=1)u[h].c();s=Ie(),O(e,"class","dropdown-item button")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),x(h,r,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);x(h,s,f),o=!0,l||(a=G(e,"click",i[23]),l=!0)},p(h,f){if(f[0]&2560){c=fe(h[9]);let d;for(d=0;d<c.length;d+=1){const m=iO(h,c,d);u[d]?u[d].p(m,f):(u[d]=sO(m),u[d].c(),u[d].m(s.parentNode,s))}for(;d<u.length;d+=1)u[d].d(1);u.length=c.length}},i(h){o||(T(t.$$.fragment,h),o=!0)},o(h){R(t.$$.fragment,h),o=!1},d(h){h&&(P(e),P(r),P(s)),z(t),Ot(u,h),l=!1,a()}}}function sO(i){let e,t,n;function r(...s){return i[24](i[39],...s)}return{c(){e=y("button"),e.textContent=`${i[39].label} `,O(e,"class","dropdown-item button")},m(s,o){x(s,e,o),t||(n=G(e,"click",r),t=!0)},p(s,o){i=s},d(s){s&&P(e),t=!1,n()}}}function oO(i){let e,t,n,r,s,o,l=i[3].label+"",a,c,u,h,f,d;t=new ut({props:{icon:"arrow-left"}});let m=fe(i[7]),p=[];for(let g=0;g<m.length;g+=1)p[g]=lO(nO(i,m,g));return{c(){e=y("button"),V(t.$$.fragment),n=W(`
|
||||
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=D();for(let g=0;g<p.length;g+=1)p[g].c();u=Ie(),O(e,"class","dropdown-item button"),O(s,"class","selected-filter")},m(g,v){x(g,e,v),Y(t,e,null),b(e,n),x(g,r,v),x(g,s,v),b(s,o),b(s,a),x(g,c,v);for(let w=0;w<p.length;w+=1)p[w]&&p[w].m(g,v);x(g,u,v),h=!0,f||(d=G(e,"click",i[25]),f=!0)},p(g,v){if((!h||v[0]&8)&&l!==(l=g[3].label+"")&&K(a,l),v[0]&8320){m=fe(g[7]);let w;for(w=0;w<m.length;w+=1){const S=nO(g,m,w);p[w]?p[w].p(S,v):(p[w]=lO(S),p[w].c(),p[w].m(u.parentNode,u))}for(;w<p.length;w+=1)p[w].d(1);p.length=m.length}},i(g){h||(T(t.$$.fragment,g),h=!0)},o(g){R(t.$$.fragment,g),h=!1},d(g){g&&(P(e),P(r),P(s),P(c),P(u)),z(t),Ot(p,g),f=!1,d()}}}function lO(i){let e,t=i[42].label+"",n,r,s,o;function l(...a){return i[26](i[42],...a)}return{c(){e=y("button"),n=W(t),r=D(),O(e,"class","dropdown-item button")},m(a,c){x(a,e,c),b(e,n),b(e,r),s||(o=G(e,"click",l),s=!0)},p(a,c){i=a,c[0]&128&&t!==(t=i[42].label+"")&&K(n,t)},d(a){a&&P(e),s=!1,o()}}}function aO(i){let e,t,n,r,s,o,l=i[3].label+"",a,c,u=i[5].label+"",h,f,d,m,p,g,v,w,S;return t=new ut({props:{icon:"arrow-left"}}),{c(){e=y("button"),V(t.$$.fragment),n=W(`
|
||||
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=W(" operator: "),h=W(u),f=D(),d=y("div"),m=y("input"),p=D(),g=y("button"),g.textContent="Add filter",O(e,"class","dropdown-item button"),O(s,"class","selected-filter"),O(m,"type","text"),O(m,"class","form-control"),O(d,"class","filter-input"),O(g,"class","button applied-filter"),O(g,"type","button")},m(_,k){x(_,e,k),Y(t,e,null),b(e,n),x(_,r,k),x(_,s,k),b(s,o),b(s,a),b(s,c),b(s,h),x(_,f,k),x(_,d,k),b(d,m),Le(m,i[2]),x(_,p,k),x(_,g,k),v=!0,w||(S=[G(e,"click",i[27]),G(m,"input",i[28]),G(g,"click",i[14])],w=!0)},p(_,k){(!v||k[0]&8)&&l!==(l=_[3].label+"")&&K(a,l),(!v||k[0]&32)&&u!==(u=_[5].label+"")&&K(h,u),k[0]&4&&m.value!==_[2]&&Le(m,_[2])},i(_){v||(T(t.$$.fragment,_),v=!0)},o(_){R(t.$$.fragment,_),v=!1},d(_){_&&(P(e),P(r),P(s),P(f),P(d),P(p),P(g)),z(t),w=!1,ht(S)}}}function cO(i){let e,t,n,r,s,o,l,a;t=new ut({props:{icon:"arrow-left"}});let c=fe(i[10]),u=[];for(let h=0;h<c.length;h+=1)u[h]=uO(tO(i,c,h));return{c(){e=y("button"),V(t.$$.fragment),n=W(`
|
||||
Back`),r=D();for(let h=0;h<u.length;h+=1)u[h].c();s=Ie(),O(e,"class","dropdown-item button")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),x(h,r,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);x(h,s,f),o=!0,l||(a=G(e,"click",i[29]),l=!0)},p(h,f){if(f[0]&5120){c=fe(h[10]);let d;for(d=0;d<c.length;d+=1){const m=tO(h,c,d);u[d]?u[d].p(m,f):(u[d]=uO(m),u[d].c(),u[d].m(s.parentNode,s))}for(;d<u.length;d+=1)u[d].d(1);u.length=c.length}},i(h){o||(T(t.$$.fragment,h),o=!0)},o(h){R(t.$$.fragment,h),o=!1},d(h){h&&(P(e),P(r),P(s)),z(t),Ot(u,h),l=!1,a()}}}function uO(i){let e,t,n;function r(...s){return i[30](i[39],...s)}return{c(){e=y("button"),e.textContent=`${i[39].label} `,O(e,"class","dropdown-item button")},m(s,o){x(s,e,o),t||(n=G(e,"click",r),t=!0)},p(s,o){i=s},d(s){s&&P(e),t=!1,n()}}}function hO(i){let e,t,n,r,s,o,l=i[4].label+"",a,c,u,h,f,d,m,p;t=new ut({props:{icon:"arrow-left"}});function g(w){i[32](w)}let v={field:i[4]};return i[2]!==void 0&&(v.value=i[2]),h=new kT({props:v}),Ce.push(()=>nt(h,"value",g)),h.$on("addFilter",i[14]),{c(){e=y("button"),V(t.$$.fragment),n=W(`
|
||||
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=D(),u=y("div"),V(h.$$.fragment),O(e,"class","dropdown-item button"),O(s,"class","selected-filter"),O(u,"class","mt-2")},m(w,S){x(w,e,S),Y(t,e,null),b(e,n),x(w,r,S),x(w,s,S),b(s,o),b(s,a),x(w,c,S),x(w,u,S),Y(h,u,null),d=!0,m||(p=G(e,"click",i[31]),m=!0)},p(w,S){(!d||S[0]&16)&&l!==(l=w[4].label+"")&&K(a,l);const _={};S[0]&16&&(_.field=w[4]),!f&&S[0]&4&&(f=!0,_.value=w[2],st(()=>f=!1)),h.$set(_)},i(w){d||(T(t.$$.fragment,w),T(h.$$.fragment,w),d=!0)},o(w){R(t.$$.fragment,w),R(h.$$.fragment,w),d=!1},d(w){w&&(P(e),P(r),P(s),P(c),P(u)),z(t),z(h),m=!1,p()}}}function ST(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k,A,C,Q,M,L,N=!i[3]&&rO(i),B=i[3]&&!i[5]&&oO(i),J=i[3]&&i[5]&&aO(i),te=!i[4]&&cO(i),ie=i[4]&&hO(i);return v=new ut({props:{icon:"arrow-left"}}),{c(){e=y("div"),t=y("button"),t.textContent="Filter by field",n=D(),r=y("button"),r.textContent="Filter by Reference",s=D(),o=y("button"),o.textContent="Advanced filter",l=D(),a=y("div"),N&&N.c(),c=D(),B&&B.c(),u=D(),J&&J.c(),h=D(),f=y("div"),te&&te.c(),d=D(),ie&&ie.c(),m=D(),p=y("div"),g=y("button"),V(v.$$.fragment),w=W(`
|
||||
Back`),S=D(),_=y("form"),k=y("input"),A=D(),C=y("button"),C.textContent="Submit",O(t,"class","dropdown-item button"),O(r,"class","dropdown-item button"),O(o,"class","dropdown-item button"),Ae(e,"hide",i[6]!=="main"),Ae(a,"hide",i[6]!=="byField"),Ae(f,"hide",i[6]!=="byReference"),O(g,"class","dropdown-item button"),O(k,"type","search"),O(k,"class","mb-2 mt-2"),O(k,"placeholder","Advanced filters"),k.required=!0,O(C,"class","button applied-filter"),Ae(p,"hide",i[6]!=="advanced")},m(ae,X){x(ae,e,X),b(e,t),b(e,n),b(e,r),b(e,s),b(e,o),x(ae,l,X),x(ae,a,X),N&&N.m(a,null),b(a,c),B&&B.m(a,null),b(a,u),J&&J.m(a,null),x(ae,h,X),x(ae,f,X),te&&te.m(f,null),b(f,d),ie&&ie.m(f,null),x(ae,m,X),x(ae,p,X),b(p,g),Y(v,g,null),b(g,w),b(p,S),b(p,_),b(_,k),Le(k,i[1]),b(_,A),b(_,C),Q=!0,M||(L=[G(t,"click",i[20]),G(r,"click",i[21]),G(o,"click",i[22]),G(g,"click",i[33]),G(k,"input",i[34]),G(_,"submit",i[8])],M=!0)},p(ae,X){(!Q||X[0]&64)&&Ae(e,"hide",ae[6]!=="main"),ae[3]?N&&(Oe(),R(N,1,1,()=>{N=null}),be()):N?(N.p(ae,X),X[0]&8&&T(N,1)):(N=rO(ae),N.c(),T(N,1),N.m(a,c)),ae[3]&&!ae[5]?B?(B.p(ae,X),X[0]&40&&T(B,1)):(B=oO(ae),B.c(),T(B,1),B.m(a,u)):B&&(Oe(),R(B,1,1,()=>{B=null}),be()),ae[3]&&ae[5]?J?(J.p(ae,X),X[0]&40&&T(J,1)):(J=aO(ae),J.c(),T(J,1),J.m(a,null)):J&&(Oe(),R(J,1,1,()=>{J=null}),be()),(!Q||X[0]&64)&&Ae(a,"hide",ae[6]!=="byField"),ae[4]?te&&(Oe(),R(te,1,1,()=>{te=null}),be()):te?(te.p(ae,X),X[0]&16&&T(te,1)):(te=cO(ae),te.c(),T(te,1),te.m(f,d)),ae[4]?ie?(ie.p(ae,X),X[0]&16&&T(ie,1)):(ie=hO(ae),ie.c(),T(ie,1),ie.m(f,null)):ie&&(Oe(),R(ie,1,1,()=>{ie=null}),be()),(!Q||X[0]&64)&&Ae(f,"hide",ae[6]!=="byReference"),X[0]&2&&k.value!==ae[1]&&Le(k,ae[1]),(!Q||X[0]&64)&&Ae(p,"hide",ae[6]!=="advanced")},i(ae){Q||(T(N),T(B),T(J),T(te),T(ie),T(v.$$.fragment,ae),Q=!0)},o(ae){R(N),R(B),R(J),R(te),R(ie),R(v.$$.fragment,ae),Q=!1},d(ae){ae&&(P(e),P(l),P(a),P(h),P(f),P(m),P(p)),N&&N.d(),B&&B.d(),J&&J.d(),te&&te.d(),ie&&ie.d(),z(v),M=!1,ht(L)}}}function _T(i){let e,t,n,r,s;return t=new ut({props:{icon:"filter"}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),r=y("span"),r.textContent="Filter",O(r,"class","ms-1"),O(e,"slot","button")},m(o,l){x(o,e,l),Y(t,e,null),b(e,n),b(e,r),s=!0},p:U,i(o){s||(T(t.$$.fragment,o),s=!0)},o(o){R(t.$$.fragment,o),s=!1},d(o){o&&P(e),z(t)}}}function CT(i){let e,t,n,r={$$slots:{button:[_T],default:[ST]},$$scope:{ctx:i}};return t=new ur({props:r}),i[35](t),{c(){e=y("div"),V(t.$$.fragment)},m(s,o){x(s,e,o),Y(t,e,null),n=!0},p(s,o){const l={};o[0]&254|o[1]&65536&&(l.$$scope={dirty:o,ctx:s}),t.$set(l)},i(s){n||(T(t.$$.fragment,s),n=!0)},o(s){R(t.$$.fragment,s),n=!1},d(s){s&&P(e),i[35](null),z(t)}}}function PT(i,e,t){const n=nn();let{schema:r}=e,{systemFields:s=[]}=e,{operators:o}=e,{inModal:l}=e,{modalUrl:a}=e,c,u="",h=s;r.type==="collection"&&(h=s.filter(H=>H.files===!1));function f(H){H.preventDefault();let Pe=u.split("=")[0]??"";if(!Pe)return;let Ye=`filter[${Pe}]`,Tt=u.split("=")[1]??"";if(!Tt)return;const yt=new URL(a??window.location.href);yt.searchParams.set("skip","0"),yt.searchParams.set(Ye,Tt),l?n("refresh",yt):window.location.replace(yt),M()}let d=null,m=null,p=null,g=null,v="main",w=null,S=[...r.fields,...h].filter(H=>{var Pe;return!["file","json","reference"].includes(((Pe=H.info)==null?void 0:Pe.name)??H.ui)}),_=[...r.fields].filter(H=>{var Pe;return["reference"].includes(((Pe=H.info)==null?void 0:Pe.name)??H.ui)});function k(H,Pe){t(3,m=Pe),t(7,w=o.filter(Ye=>{var Tt;return Ye.uis.includes((Tt=m==null?void 0:m.info)==null?void 0:Tt.name)||Ye.uis[0]==="*"}))}function A(H,Pe){t(4,p=Pe),t(5,g=o.find(Ye=>Ye.name==="eq"))}function C(H,Pe){t(5,g=Pe),Pe.hasValue||Q(H)}function Q(H){H.preventDefault();let Pe="",Ye,Tt=m??p;r.fields.find(wt=>wt.name===Tt.name)&&(Tt.info.name==="reference"&&g.name==="eq"?(Pe="children."+Tt.name+".id",Ye=`filter[${Pe}]`):(Pe="data.",Ye=`filter[${Pe+Tt.name}_${g.name}]`));const yt=new URL(a??window.location.href);yt.searchParams.set("skip","0"),yt.searchParams.set(Ye,d),l?(n("refresh",yt),c.close()):window.location.href=yt.toString(),M()}function M(){t(3,m=null),t(5,g=null),t(6,v="main"),t(4,p=null)}const L=H=>t(6,v="byField"),N=H=>t(6,v="byReference"),B=H=>t(6,v="advanced"),J=H=>t(6,v="main"),te=(H,Pe)=>k(Pe,H),ie=H=>t(3,m=null),ae=(H,Pe)=>C(Pe,H),X=H=>t(5,g=null);function ee(){d=this.value,t(2,d)}const Te=H=>t(6,v="main"),ve=(H,Pe)=>A(Pe,H),je=H=>t(4,p=null);function ne(H){d=H,t(2,d)}const Ee=H=>t(6,v="main");function Re(){u=this.value,t(1,u)}function xt(H){Ce[H?"unshift":"push"](()=>{c=H,t(0,c)})}return i.$$set=H=>{"schema"in H&&t(15,r=H.schema),"systemFields"in H&&t(16,s=H.systemFields),"operators"in H&&t(17,o=H.operators),"inModal"in H&&t(18,l=H.inModal),"modalUrl"in H&&t(19,a=H.modalUrl)},[c,u,d,m,p,g,v,w,f,S,_,k,A,C,Q,r,s,o,l,a,L,N,B,J,te,ie,ae,X,ee,Te,ve,je,ne,Ee,Re,xt]}class AT extends oe{constructor(e){super(),se(this,e,PT,CT,re,{schema:15,systemFields:16,operators:17,inModal:18,modalUrl:19},null,[-1,-1])}}function fO(i,e,t){const n=i.slice();return n[18]=e[t],n}func
Line truncated
|
||||
|
||||
`),n=y("button"),V(r.$$.fragment),O(n,"type","button"),O(n,"class","button-text"),O(n,"aria-label","Close"),O(e,"class","applied-filter")},m(a,c){x(a,e,c),b(e,t),b(e,n),Y(r,n,null),s=!0,o||(l=G(n,"click",Ln(i[4])),o=!0)},p:U,i(a){s||(T(r.$$.fragment,a),s=!0)},o(a){R(r.$$.fragment,a),s=!1},d(a){a&&P(e),z(r),o=!1,l()}}}function FT(i){let e=i[0].searchParams.get("notlinked"),t,n,r=e&&XT(i);return{c(){r&&r.c(),t=Ie()},m(s,o){r&&r.m(s,o),x(s,t,o),n=!0},p(s,[o]){e&&r.p(s,o)},i(s){n||(T(r),n=!0)},o(s){R(r),n=!1},d(s){s&&P(t),r&&r.d(s)}}}function YT(i,e,t){Ue("channel");const n=nn();let{inModal:r}=e,{modalUrl:s}=e;const o=new URL(s??window.location.href);function l(c){const u=new URL(s??window.location.href);u.searchParams.set("skip","0"),u.searchParams.delete("notlinked"),r?n("refresh",u):window.location.replace(u)}const a=()=>l();return i.$$set=c=>{"inModal"in c&&t(2,r=c.inModal),"modalUrl"in c&&t(3,s=c.modalUrl)},[o,l,r,s,a]}class zT extends oe{constructor(e){super(),se(this,e,YT,FT,re,{inModal:2,modalUrl:3})}}function gO(i,e,t){const n=i.slice();return n[21]=e[t][0],n[22]=e[t][1],n}function OO(i){let e,t,n;return{c(){e=y("a"),t=W("New Record"),O(e,"href",n=i[10].lucentUrl+"/records/new?schema="+i[0].name),O(e,"class","button")},m(r,s){x(r,e,s),b(e,t)},p(r,s){s&1&&n!==(n=r[10].lucentUrl+"/records/new?schema="+r[0].name)&&O(e,"href",n)},d(r){r&&P(e)}}}function bO(i){let e,t;return e=new ur({props:{orientation:"right",$$slots:{button:[qT],default:[jT]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&33554577&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function VT(i){let e,t,n,r,s,o,l,a,c,u;return{c(){e=y("a"),t=W("Export to CSV"),n=D(),r=y("a"),s=W("View trashed records"),l=D(),a=y("a"),c=W("View unlinked records"),O(e,"class","dropdown-item"),O(e,"href",i[11]),O(r,"class","dropdown-item"),O(r,"href",o=i[10].lucentUrl+"/content/"+i[0].name+"?filter[status_in]=trashed"),O(a,"class","dropdown-item"),O(a,"href",u=i[10].lucentUrl+"/content/"+i[0].name+"?notlinked=*")},m(h,f){x(h,e,f),b(e,t),x(h,n,f),x(h,r,f),b(r,s),x(h,l,f),x(h,a,f),b(a,c)},p(h,f){f&1&&o!==(o=h[10].lucentUrl+"/content/"+h[0].name+"?filter[status_in]=trashed")&&O(r,"href",o),f&1&&u!==(u=h[10].lucentUrl+"/content/"+h[0].name+"?notlinked=*")&&O(a,"href",u)},d(h){h&&(P(e),P(n),P(r),P(l),P(a))}}}function UT(i){let e,t=i[7]&&vO(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,r){n[7]?t?t.p(n,r):(t=vO(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(n){n&&P(e),t&&t.d(n)}}}function vO(i){let e,t,n;return{c(){e=y("a"),t=W("Empty trash"),O(e,"class","dropdown-item"),O(e,"href",n=i[10].lucentUrl+"/content/"+i[0].name+"/emptyTrash")},m(r,s){x(r,e,s),b(e,t)},p(r,s){s&1&&n!==(n=r[10].lucentUrl+"/content/"+r[0].name+"/emptyTrash")&&O(e,"href",n)},d(r){r&&P(e)}}}function jT(i){let e;function t(s,o){return s[4].status_in==="trashed"?UT:VT}let n=t(i),r=n(i);return{c(){r.c(),e=Ie()},m(s,o){r.m(s,o),x(s,e,o)},p(s,o){n===(n=t(s))&&r?r.p(s,o):(r.d(1),r=n(s),r&&(r.c(),r.m(e.parentNode,e)))},d(s){s&&P(e),r.d(s)}}}function qT(i){let e,t,n;return t=new ut({props:{icon:"ellipsis-vertical"}}),{c(){e=y("div"),V(t.$$.fragment),O(e,"slot","button")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function wO(i){let e,t,n=fe(Object.entries(i[4])),r=[];for(let o=0;o<n.length;o+=1)r[o]=yO(gO(i,n,o));const s=o=>R(r[o],1,1,()=>{r[o]=null});return{c(){for(let o=0;o<r.length;o+=1)r[o].c();e=Ie()},m(o,l){for(let a=0;a<r.length;a+=1)r[a]&&r[a].m(o,l);x(o,e,l),t=!0},p(o,l){if(l&377){n=fe(Object.entries(o[4]));let a;for(a=0;a<n.length;a+=1){const c=gO(o,n,a);r[a]?(r[a].p(c,l),T(r[a],1)):(r[a]=yO(c),r[a].c(),T(r[a],1),r[a].m(e.parentNode,e))}for(Oe(),a=n.length;a<r.length;a+=1)s(a);be()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)T(r[l]);t=!0}},o(o){r=r.filter(Boolean);for(let l=0;l<r.length;l+=1)R(r[l]);t=!1},d(o){o&&P(e),Ot(r,o)}}}function yO(i){let e,t;return e=new WT({props:{schema:i[0],operators:i[3],key:i[21],value:i[22],inModal:i[5],modalUrl:i[6],graph:i[8]}}),e.$on("refresh",i[18]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.schema=n[0]),r&8&&(s.operators=n[3]),r&16&&(s.key=n[21]),r&16&&(s.value=n[22]),r&32&&(s.inModal=n[5]),r&64&&(s.modalUrl=n[6]),r&256&&(s.graph=n[8]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function GT(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g=Object.entries(i[4]).length>0,v,w,S;n=new DT({props:{schema:i[0],sortParam:i[1],sortField:i[2],systemFields:i[9],inModal:i[5],modalUrl:i[6]}}),n.$on("refresh",i[14]);function _(M){i[15](M)}let k={systemFields:i[9],operators:i[3],filter:i[4],inModal:i[5],modalUrl:i[6]};i[0]!==void 0&&(k.schema=i[0]),s=new AT({props:k}),Ce.push(()=>nt(s,"schema",_)),s.$on("refresh",i[16]);let A=!i[5]&&i[7]&&OO(i),C=!i[5]&&bO(i);m=new zT({props:{inModal:i[5],modalUrl:
Line truncated
|
||||
`),o=y("span"),a=W(l),c=W(`
|
||||
to
|
||||
`),u=y("span"),f=W(h),d=W(`
|
||||
of
|
||||
`),m=y("span"),p=W(i[4]),g=W(`
|
||||
total`),O(t,"class","pagination"),O(o,"class","font-medium"),O(u,"class","font-medium"),O(m,"class","font-medium"),le(r,"display","flex"),le(r,"justify-content","center"),le(r,"gap","4px")},m(S,_){x(S,e,_),b(e,t),w&&w.m(t,null),x(S,n,_),x(S,r,_),b(r,s),b(r,o),b(o,a),b(r,c),b(r,u),b(u,f),b(r,d),b(r,m),b(m,p),b(r,g),v=!0},p(S,[_]){S[5]>1?w?(w.p(S,_),_&32&&T(w,1)):(w=_O(S),w.c(),T(w,1),w.m(t,null)):w&&(Oe(),R(w,1,1,()=>{w=null}),be()),(!v||_&8)&&l!==(l=+S[3]+1+"")&&K(a,l),(!v||_&28)&&h!==(h=(+S[3]+S[2]>S[4]?S[4]:+S[3]+S[2])+"")&&K(f,h),(!v||_&16)&&K(p,S[4])},i(S){v||(T(w),v=!0)},o(S){R(w),v=!1},d(S){S&&(P(e),P(n),P(r)),w&&w.d()}}}function sQ(i,e,t){let n,r,s;const o=nn();let{inModal:l}=e,{modalUrl:a}=e,{limit:c}=e,{skip:u}=e,{total:h}=e;const f=(v,w,S=1)=>Array.from({length:Math.ceil((w-v)/S)},(_,k)=>v+k*S);function d(v){v.preventDefault(),p(n)}function m(v){v.preventDefault(),p(1)}function p(v){const w=new URL(a??window.location.href);let S=v*c-c;w.searchParams.set("skip",S),l?o("refresh",w):window.location=w}function g(v){vs.call(this,i,v)}return i.$$set=v=>{"inModal"in v&&t(0,l=v.inModal),"modalUrl"in v&&t(1,a=v.modalUrl),"limit"in v&&t(2,c=v.limit),"skip"in v&&t(3,u=v.skip),"total"in v&&t(4,h=v.total)},i.$$.update=()=>{i.$$.dirty&20&&t(5,n=Math.ceil(h/c)),i.$$.dirty&12&&t(6,r=Math.ceil((u-1)/c)+1),i.$$.dirty&96&&t(7,s=f(r-3,r+4).filter(v=>v>0&&v<=n))},[l,a,c,u,h,n,r,s,d,m,g]}class oQ extends oe{constructor(e){super(),se(this,e,sQ,rQ,re,{inModal:0,modalUrl:1,limit:2,skip:3,total:4})}}function lQ(i){let e,t,n;return{c(){e=y("button"),e.textContent="Move to trash",O(e,"type","button"),O(e,"class","button")},m(r,s){x(r,e,s),t||(n=G(e,"click",Ln(i[9])),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function aQ(i){let e,t,n,r,s,o,l=i[1].hasDrafts&&CO(i);return{c(){e=y("button"),e.textContent="Publish",t=D(),l&&l.c(),n=D(),r=y("button"),r.textContent="Delete forever",O(e,"type","button"),O(e,"class","button"),O(r,"type","button"),O(r,"class","button")},m(a,c){x(a,e,c),x(a,t,c),l&&l.m(a,c),x(a,n,c),x(a,r,c),s||(o=[G(e,"click",Ln(i[7])),G(r,"click",Ln(i[3]))],s=!0)},p(a,c){a[1].hasDrafts?l?l.p(a,c):(l=CO(a),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(a){a&&(P(e),P(t),P(n),P(r)),l&&l.d(a),s=!1,ht(o)}}}function CO(i){let e,t,n;return{c(){e=y("button"),e.textContent="Make Draft",O(e,"type","button"),O(e,"class","button")},m(r,s){x(r,e,s),t||(n=G(e,"click",Ln(i[8])),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function cQ(i){let e,t,n=i[0].length+"",r,s,o,l,a,c,u,h,f;function d(g,v){return g[2].status_in==="trashed"?aQ:lQ}let m=d(i),p=m(i);return{c(){e=y("div"),t=y("span"),r=W(n),s=W(" records selected"),o=D(),l=y("button"),l.textContent="Publish",a=D(),c=y("button"),c.textContent="Make Draft",u=D(),p.c(),O(t,"class","me-2"),O(l,"type","button"),O(l,"class","button"),O(c,"type","button"),O(c,"class","button"),le(e,"display","flex"),le(e,"align-items","center"),le(e,"gap","8px")},m(g,v){x(g,e,v),b(e,t),b(t,r),b(t,s),b(e,o),b(e,l),b(e,a),b(e,c),b(e,u),p.m(e,null),h||(f=[G(l,"click",Ln(i[5])),G(c,"click",Ln(i[6]))],h=!0)},p(g,[v]){v&1&&n!==(n=g[0].length+"")&&K(r,n),m===(m=d(g))&&p?p.p(g,v):(p.d(1),p=m(g),p&&(p.c(),p.m(e,null)))},i:U,o:U,d(g){g&&P(e),p.d(),h=!1,ht(f)}}}function uQ(i,e,t){const n=Ue("channel");let{selected:r}=e,{schema:s}=e,{filter:o}=e;function l(m){m.preventDefault(),Jn(n.lucentUrl+"/records/delete",{ids:r.map(p=>p.id)}).then(p=>{window.location.reload()}).catch(p=>{console.log(p)})}function a(m,p){Jn(n.lucentUrl+"/records/status/"+p,{schemaName:s.name,records:r}).then(g=>{window.location.reload()}).catch(g=>{console.log(g)})}const c=m=>a(m,"published"),u=m=>a(m,"draft"),h=m=>a(m,"published"),f=m=>a(m,"draft"),d=m=>a(m,"trashed");return i.$$set=m=>{"selected"in m&&t(0,r=m.selected),"schema"in m&&t(1,s=m.schema),"filter"in m&&t(2,o=m.filter)},[r,s,o,l,a,c,u,h,f,d]}class hQ extends oe{constructor(e){super(),se(this,e,uQ,cQ,re,{selected:0,schema:1,filter:2})}}function fQ(i){let e;return{c(){e=W(i[0])},m(t,n){x(t,e,n)},p(t,[n]){n&1&&K(e,t[0])},i:U,o:U,d(t){t&&P(e)}}}function dQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let mQ=class extends oe{constructor(e){super(),se(this,e,dQ,fQ,re,{value:0})}};function PO(i){let e,t,n,r;return{c(){e=y("div"),t=y("span"),n=D(),r=W(i[0]),O(t,"class","color border border-2 svelte-78o2k4"),le(t,"background",i[0]),O(e,"class","d-inline-flex")},m(s,o){x(s,e,o),b(e,t),b(e,n),b(e,r)},p(s,o){o&1&&le(t,"background",s[0]),o&1&&K(r,s[0])},d(s){s&&P(e)}}}function pQ(i){let e,t=i[0]&&PO(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[0]?t?t.p(n,r):(t=PO(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:U,o:U,d(n){n&&P(e),t&&t.d(n)}}}function gQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let OQ=class extends oe{constructor(e){super(),se(this,e,gQ,pQ,re,{value:0})}};function AO(i){let e,t,n;return{c(){e=y("a"),t=W(i[1]),O(e,"href",n=i[2].lucentUrl+"/records/"+i[0].id),O(e,"title",i[1]),O(e,"class","reference svel
Line truncated
|
||||
* Sortable 1.15.2
|
||||
* @author RubaXa <trash@rubaxa.org>
|
||||
* @author owenm <owen23355@gmail.com>
|
||||
* @license MIT
|
||||
*/function t1(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Hi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?t1(Object(t),!0).forEach(function(n){TM(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):t1(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Nc(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nc=function(e){return typeof e}:Nc=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nc(i)}function TM(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fr(){return fr=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},fr.apply(this,arguments)}function QM(i,e){if(i==null)return{};var t={},n=Object.keys(i),r,s;for(s=0;s<n.length;s++)r=n[s],!(e.indexOf(r)>=0)&&(t[r]=i[r]);return t}function MM(i,e){if(i==null)return{};var t=QM(i,e),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(r=0;r<s.length;r++)n=s[r],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(t[n]=i[n])}return t}var EM="1.15.2";function lr(i){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(i)}var pr=lr(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ea=lr(/Edge/i),n1=lr(/firefox/i),Ml=lr(/safari/i)&&!lr(/chrome/i)&&!lr(/android/i),xy=lr(/iP(ad|od|hone)/i),Ty=lr(/chrome/i)&&lr(/android/i),Qy={capture:!1,passive:!1};function mt(i,e,t){i.addEventListener(e,t,!pr&&Qy)}function lt(i,e,t){i.removeEventListener(e,t,!pr&&Qy)}function du(i,e){if(e){if(e[0]===">"&&(e=e.substring(1)),i)try{if(i.matches)return i.matches(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e)}catch{return!1}return!1}}function RM(i){return i.host&&i!==document&&i.host.nodeType?i.host:i.parentNode}function ki(i,e,t,n){if(i){t=t||document;do{if(e!=null&&(e[0]===">"?i.parentNode===t&&du(i,e):du(i,e))||n&&i===t)return i;if(i===t)break}while(i=RM(i))}return null}var i1=/\s+/g;function Fn(i,e,t){if(i&&e)if(i.classList)i.classList[t?"add":"remove"](e);else{var n=(" "+i.className+" ").replace(i1," ").replace(" "+e+" "," ");i.className=(n+(t?" "+e:"")).replace(i1," ")}}function De(i,e,t){var n=i&&i.style;if(n){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(t=i.currentStyle),e===void 0?t:t[e];!(e in n)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),n[e]=t+(typeof t=="string"?"":"px")}}function co(i,e){var t="";if(typeof i=="string")t=i;else do{var n=De(i,"transform");n&&n!=="none"&&(t=n+" "+t)}while(!e&&(i=i.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(t)}function My(i,e,t){if(i){var n=i.getElementsByTagName(e),r=0,s=n.length;if(t)for(;r<s;r++)t(n[r],r);return n}return[]}function Ui(){var i=document.scrollingElement;return i||document.documentElement}function Gt(i,e,t,n,r){if(!(!i.getBoundingClientRect&&i!==window)){var s,o,l,a,c,u,h;if(i!==window&&i.parentNode&&i!==Ui()?(s=i.getBoundingClientRect(),o=s.top,l=s.left,a=s.bottom,c=s.right,u=s.height,h=s.width):(o=0,l=0,a=window.innerHeight,c=window.innerWidth,u=window.innerHeight,h=window.innerWidth),(e||t)&&i!==window&&(r=r||i.parentNode,!pr))do if(r&&r.getBoundingClientRect&&(De(r,"transform")!=="none"||t&&De(r,"position")!=="static")){var f=r.getBoundingClientRect();o-=f.top+parseInt(De(r,"border-top-width")),l-=f.left+parseInt(De(r,"border-left-width")),a=o+s.height,c=l+s.width;break}while(r=r.parentNode);if(n&&i!==window){var d=co(r||i),m=d&&d.a,p=d&&d.d;d&&(o/=p,l/=m,h/=m,u/=p,a=o+u,c=l+h)}return{top:o,left:l,bottom:a,right:c,width:h,height:u}}}function r1(i,e,t){for(var n=Lr(i,!0),r=Gt(i)[e];n;){var s=Gt(n)[t],o=void 0;if(o=r>=s,!o)return n;if(n===Ui())break;n=Lr(n,!1)}return!1}function Po(i,e,t,n){for(var r=0,s=0,o=i.children;s<o.length;){if(o[s].style.display!=="none"&&o[s]!==$e.ghost&&(n||o[s]!==$e.dragged)&&ki(o[s],t.draggable,i,!1)){if(r===e)return o[s];r++}s++}return null}function zm(i,e){for(var t=i.lastElementChild;t&&(t===$e.ghost||De(t,"display")==="none"||e&&!du(t,e));)t=t.previousElementSibling;return t||null}function ii(i,e){var t=0;if(!i||!i.parentNode)return-1;for(;i=i.previousElementSibling;)i.nodeName.toUpperCase()!=="TEMPLATE"&&i!==$e.clone&&(!e||du(i,e))&&t++;return t}function s1(i){var e=0,t=0,n=Ui();if(i)do{var r=co(i),s=r.a,o=r.d;e+=i.scrollLeft*s,t+=i.scrollTop*o}while(i!==n&&(i=i.parentNode));returLine truncated
|
||||
<span class='flatpickr-weekday'>
|
||||
`+$.join("</span><span class='flatpickr-weekday'>")+`
|
||||
</span>
|
||||
`}}function ve(){t.calendarContainer.classList.add("hasWeeks");var E=dt("div","flatpickr-weekwrapper");E.appendChild(dt("span","flatpickr-weekday",t.l10n.weekAbbreviation));var $=dt("div","flatpickr-weeks");return E.appendChild($),{weekWrapper:E,weekNumbers:$}}function je(E,$){$===void 0&&($=!0);var F=$?E:E-t.currentMonth;F<0&&t._hidePrevMonthArrow===!0||F>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=F,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,pt("onYearChange"),J()),B(),pt("onMonthChange"),er())}function ne(E,$){if(E===void 0&&(E=!0),$===void 0&&($=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,$===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var F=qh(t.config),j=F.hours,ce=F.minutes,ge=F.seconds;d(j,ce,ge)}t.redraw(),E&&pt("onChange")}function Ee(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),pt("onClose")}function Re(){t.config!==void 0&&pt("onDestroy");for(var E=t._handlers.length;E--;)t._handlers[E].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 $=t.calendarContainer.parentNode;if($.lastChild&&$.removeChild($.lastChild),$.parentNode){for(;$.firstChild;)$.parentNode.insertBefore($.firstChild,$);$.parentNode.removeChild($)}}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(F){try{delete t[F]}catch{}})}function xt(E){return t.calendarContainer.contains(E)}function H(E){if(t.isOpen&&!t.config.inline){var $=Zn(E),F=xt($),j=$===t.input||$===t.altInput||t.element.contains($)||E.path&&E.path.indexOf&&(~E.path.indexOf(t.input)||~E.path.indexOf(t.altInput)),ce=!j&&!F&&!xt(E.relatedTarget),ge=!t.config.ignoredFocusElements.some(function(We){return We.contains($)});ce&&ge&&(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 Pe(E){if(!(!E||t.config.minDate&&E<t.config.minDate.getFullYear()||t.config.maxDate&&E>t.config.maxDate.getFullYear())){var $=E,F=t.currentYear!==$;t.currentYear=$||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)),F&&(t.redraw(),pt("onYearChange"),J())}}function Ye(E,$){var F;$===void 0&&($=!0);var j=t.parseDate(E,void 0,$);if(t.config.minDate&&j&&Yn(j,t.config.minDate,$!==void 0?$:!t.minDateHasTime)<0||t.config.maxDate&&j&&Yn(j,t.config.maxDate,$!==void 0?$:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(j===void 0)return!1;for(var ce=!!t.config.enable,ge=(F=t.config.enable)!==null&&F!==void 0?F:t.config.disable,We=0,we=void 0;We<ge.length;We++){if(we=ge[We],typeof we=="function"&&we(j))return ce;if(we instanceof Date&&j!==void 0&&we.getTime()===j.getTime())return ce;if(typeof we=="string"){var Ne=t.parseDate(we,void 0,!0);return Ne&&Ne.getTime()===j.getTime()?ce:!ce}else if(typeof we=="object"&&j!==void 0&&we.from&&we.to&&j.getTime()>=we.from.getTime()&&j.getTime()<=we.to.getTime())return ce}return!ce}function Tt(E){return t.daysContainer!==void 0?E.className.indexOf("hidden")===-1&&E.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(E):!1}function yt(E){var $=E.target===t._input,F=t._input.value.trimEnd()!==yr();$&&F&&!(E.relatedTarget&&xt(E.relatedTarget))&&t.setDate(t._input.value,!0,E.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function wt(E){var $=Zn(E),F=t.config.
Line truncated
|
||||
Upload file
|
||||
|
||||
`),l=y("input"),O(s,"class","spinner-border spinner-border-sm"),O(s,"role","status"),O(s,"aria-hidden","true"),O(l,"class","form-control"),O(l,"type","file"),O(l,"id","formFile"),l.multiple=!0,O(l,"accept",qE),l.disabled=i[0],l.hidden=!0,O(t,"class","button primary btn-spinner"),O(e,"class","upload-button"),e.disabled=i[0]},m(h,f){x(h,e,f),b(e,t),Y(n,t,null),b(t,r),b(t,s),b(t,o),b(t,l),a=!0,c||(u=G(l,"input",i[1]),c=!0)},p(h,[f]){(!a||f&1)&&(l.disabled=h[0]),(!a||f&1)&&(e.disabled=h[0])},i(h){a||(T(n.$$.fragment,h),a=!0)},o(h){R(n.$$.fragment,h),a=!1},d(h){h&&P(e),z(n),c=!1,u()}}}let qE="";function GE(i,e,t){const n=nn(),r=Ue("channel");let{recordId:s}=e,o=[],l=!1;function a(c){t(0,l=!0),o=c.target.files?[...c.target.files]:[];let u=new FormData;u.append("recordId",s),Array.from(o).forEach(function(h){u.append("files[]",h)}),n("beforeUpload",o),fetch(r.lucentUrl+"/files/upload",{method:"POST",body:u,headers:{"X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').content}}).then(h=>h.json()).then(h=>{h.error?n("uploadError",h.error):n("uploadComplete",h),t(0,l=!1)})}return i.$$set=c=>{"recordId"in c&&t(2,s=c.recordId)},[l,a,s]}class jy extends oe{constructor(e){super(),se(this,e,GE,jE,re,{recordId:2})}}function D1(i,e,t){const n=i.slice();return n[11]=e[t],n}function $1(i){let e,t;return e=new Xy({props:{sortableClass:"mt-3",$$slots:{default:[HE]},$$scope:{ctx:i}}}),e.$on("update",i[4]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&16385&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function L1(i,e){let t,n,r,s;return n=new Vy({props:{file:e[11],hasDelete:!0}}),n.$on("remove_file",e[3]),{key:i,first:null,c(){t=y("div"),V(n.$$.fragment),r=D(),this.first=t},m(o,l){x(o,t,l),Y(n,t,null),b(t,r),s=!0},p(o,l){e=o;const a={};l&1&&(a.file=e[11]),n.$set(a)},i(o){s||(T(n.$$.fragment,o),s=!0)},o(o){R(n.$$.fragment,o),s=!1},d(o){o&&P(t),z(n)}}}function HE(i){let e=[],t=new Map,n,r,s=fe(i[0]??[]);const o=l=>l[11].id;for(let l=0;l<s.length;l+=1){let a=D1(i,s,l),c=o(a);t.set(c,e[l]=L1(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),r=!0},p(l,a){a&9&&(s=fe(l[0]??[]),Oe(),e=Ti(e,a,o,1,l,s,t,n.parentNode,Jr,L1,n,D1),be())},i(l){if(!r){for(let a=0;a<s.length;a+=1)T(e[a]);r=!0}},o(l){for(let a=0;a<e.length;a+=1)R(e[a]);r=!1},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l)}}}function KE(i){let e,t,n,r,s,o,l,a,c,u,h,f;n=new ut({props:{icon:"photo-film"}}),o=new jy({props:{recordId:i[1].id}}),o.$on("uploadComplete",i[7]);let d=i[0].length>0&&$1(i),m={};return c=new Uy({props:m}),i[10](c),c.$on("insert_files",i[5]),c.$on("replace_files",i[6]),{c(){e=y("div"),t=y("button"),V(n.$$.fragment),r=W(" Browse"),s=D(),V(o.$$.fragment),l=D(),d&&d.c(),a=D(),V(c.$$.fragment),O(t,"class","button"),O(e,"class","mb-0"),le(e,"display","flex"),le(e,"align-items","start"),le(e,"justify-content","start"),le(e,"gap","6px")},m(p,g){x(p,e,g),b(e,t),Y(n,t,null),b(t,r),b(e,s),Y(o,e,null),x(p,l,g),d&&d.m(p,g),x(p,a,g),Y(c,p,g),u=!0,h||(f=G(t,"click",i[8]),h=!0)},p(p,[g]){const v={};g&2&&(v.recordId=p[1].id),o.$set(v),p[0].length>0?d?(d.p(p,g),g&1&&T(d,1)):(d=$1(p),d.c(),T(d,1),d.m(a.parentNode,a)):d&&(Oe(),R(d,1,1,()=>{d=null}),be());const w={};c.$set(w)},i(p){u||(T(n.$$.fragment,p),T(o.$$.fragment,p),T(d),T(c.$$.fragment,p),u=!0)},o(p){R(n.$$.fragment,p),R(o.$$.fragment,p),R(d),R(c.$$.fragment,p),u=!1},d(p){p&&(P(e),P(l),P(a)),z(n),z(o),d&&d.d(p),i[10](null),z(c,p),h=!1,f()}}}function JE(i,e,t){let{field:n}=e,{record:r}=e,{value:s=[]}=e,o;function l(m){m.preventDefault(),t(0,s=s.filter(p=>p.id!==m.detail))}async function a(m){t(0,s=await Sy(s,m.detail.source,m.detail.target))}function c(m){m.preventDefault(),o.close(),t(0,s=[...s??[],...m.detail.files??[]])}function u(m){m.preventDefault(),o.close(),t(0,s=m.detail??[])}function h(m){t(0,s=[...s,...m.detail])}function f(m){m.preventDefault(),o.open(r.id)}function d(m){Ce[m?"unshift":"push"](()=>{o=m,t(2,o)})}return i.$$set=m=>{"field"in m&&t(9,n=m.field),"record"in m&&t(1,r=m.record),"value"in m&&t(0,s=m.value)},[s,r,o,l,a,c,u,h,f,n,d]}class eR extends oe{constructor(e){super(),se(this,e,JE,KE,re,{field:9,record:1,value:0})}}function I1(i){let e,t;return{c(){e=y("div"),t=W(i[5]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&32&&K(t,n[5])},d(n){n&&P(e)}}}function tR(i){let e,t,n,r,s,o,l=i[5]&&I1(i);return{c(){e=y("div"),t=y("textarea"),r=D(),l&&l.c(),O(t,"id",i[3]),O(t,"class","form-control svelte-1er4ovm"),O(t,"rows","2"),t.readOnly=n=i[1].readonly&&!i[2],Ae(t,"is-invalid",i[5]),O(e,"class","mb-0")},m(a,c){x(a,e,c),b(e,t),Le(t,i[0]),i[8](t),b(e,r),l&&l.m(e,null),s||(o=[G(t,"input",i[7]),G(t,"input",kd),G(t,"focus",kd)],s=!0)},p(a,[c]){c&8&&O(t,"id",a[3]),c&6&&n!==(n=a[1].readonly&&!a[2])&&(t.readOnly=n),c&1&&Le(t,a[0]),c&32&&Ae(t,"is-invalid",a[5]),a[5]?l?l.p(a,c):(l=I1(a),l.c(),l.m(e,null)):l
Line truncated
|
||||
`},xs={bold:{tagName:"strong",inheritable:!0,parser(i){const e=window.getComputedStyle(i);return e.fontWeight==="bold"||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:i=>window.getComputedStyle(i).fontStyle==="italic"},href:{groupTagName:"a",parser(i){const e="a:not(".concat(_s,")"),t=i.closest(e);if(t)return t.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},ik={getDefaultHTML:()=>`<div class="trix-button-row">
|
||||
<span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="`.concat(Ve.bold,'" tabindex="-1">').concat(Ve.bold,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="`).concat(Ve.italic,'" tabindex="-1">').concat(Ve.italic,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="`).concat(Ve.strike,'" tabindex="-1">').concat(Ve.strike,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="`).concat(Ve.link,'" tabindex="-1">').concat(Ve.link,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="`).concat(Ve.heading1,'" tabindex="-1">').concat(Ve.heading1,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="`).concat(Ve.quote,'" tabindex="-1">').concat(Ve.quote,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="`).concat(Ve.code,'" tabindex="-1">').concat(Ve.code,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="`).concat(Ve.bullets,'" tabindex="-1">').concat(Ve.bullets,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="`).concat(Ve.numbers,'" tabindex="-1">').concat(Ve.numbers,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="`).concat(Ve.outdent,'" tabindex="-1">').concat(Ve.outdent,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="`).concat(Ve.indent,'" tabindex="-1">').concat(Ve.indent,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="`).concat(Ve.attachFiles,'" tabindex="-1">').concat(Ve.attachFiles,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group-spacer"></span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="`).concat(Ve.undo,'" tabindex="-1">').concat(Ve.undo,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="`).concat(Ve.redo,'" tabindex="-1">').concat(Ve.redo,`</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="trix-dialogs" data-trix-dialogs>
|
||||
<div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">
|
||||
<div class="trix-dialog__link-fields">
|
||||
<input type="url" name="href" class="trix-input trix-input--dialog" placeholder="`).concat(Ve.urlPlaceholder,'" aria-label="').concat(Ve.url,`" data-trix-validate-href required data-trix-input>
|
||||
<div class="trix-button-group">
|
||||
<input type="button" class="trix-button trix-button--dialog" value="`).concat(Ve.link,`" data-trix-method="setAttribute">
|
||||
<input type="button" class="trix-button trix-button--dialog" value="`).concat(Ve.unlink,`" data-trix-method="removeAttribute">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`)};const Sd={interval:5e3};var $a=Object.freeze({__proto__:null,attachments:jm,blockAttributes:Sn,browser:Da,css:{attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},dompurify:Hy,fileSize:Ky,input:Hm,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:Ve,parser:Fc,textAttributes:xs,toolbar:ik,undo:Sd});class Kt{static proxyMethod(e){const{name:t,toMethod:n,toProperty:r,optional:s}=dR(e);this.prototype[t]=function(){let o,l;var a,c;return n?l=s?(a=this[n])===null||a===void 0?void 0:a.call(this):this[n]():r&&(l=this[r]),s?(o=(c=l)===null||c===void 0?void 0:c[t],o?W1.call(o,l,arguments):void 0):(o=l[t],W1.call(o,l,arguments))}}}const dR=function(i){const e=i.match(mR);if(!e)throw new Error("can't parse @proxyMethod expression: ".concat(i));const t={name:e[4]};return e[2]!=null?t.toMethod=e[1]:t.toProperty=e[1],e[3]!=null&&(t.optional=!0),t},{apply:W1}=Function.prototype,mR=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var ef,tf,nf;class sa extends Kt{static box(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e instanceof this?e:this.fromUCS2String(e==null?void 0:e.toString())}static fromUCS2String(e){return new this(e,_d(e))}static fromCodepoints(e){return new this(Cd(e),e)}constructor(e,t){super(...arguments),this.ucs2String=e,this.codepoints=t,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(e){return Cd(this.codepoints.slice(0,Math.max(0,e))).length}offsetFromUCS2Offset(e){return _d(this.ucs2String.slice(0,Math.max(0,e))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(e){return this.slice(e,e+1)}isEqualTo(e){return this.constructor.box(e).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}const pR=((ef=Array.from)===null||ef===void 0?void 0:ef.call(Array,"👼").length)===1,gR=((tf=" ".codePointAt)===null||tf===void 0?void 0:tf.call(" ",0))!=null,OR=((nf=String.fromCodePoint)===null||nf===void 0?void 0:nf.call(String,32,128124))===" 👼";let _d,Cd;_d=pR&&gR?i=>Array.from(i).map(e=>e.codePointAt(0)):function(i){const e=[];let t=0;const{length:n}=i;for(;t<n;){let r=i.charCodeAt(t++);if(55296<=r&&r<=56319&&t<n){const s=i.charCodeAt(t++);(64512&s)==56320?r=((1023&r)<<10)+(1023&s)+65536:t--}e.push(r)}return e},Cd=OR?i=>String.fromCodePoint(...Array.from(i||[])):function(i){return(()=>{const e=[];return Array.from(i).forEach(t=>{let n="";t>65535&&(t-=65536,n+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e.push(n+String.fromCharCode(t))}),e})().join("")};let bR=0;class Ns extends Kt{static fromJSONString(e){return this.fromJSON(JSON.parse(e))}constructor(){super(...arguments),this.id=++bR}hasSameConstructorAs(e){return this.constructor===(e==null?void 0:e.constructor)}isEqualTo(e){return this===e}inspect(){const e=[],t=this.contentsForInspection()||{};for(const n in t){const r=t[n];e.push("".concat(n,"=").concat(r))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(e.length?" ".concat(e.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return sa.box(this)}getCacheKey(){return this.id.toString()}}const Ts=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==e[t])return!1;return!0},Km=function(i){const e=i.slice(0);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.splice(...n),e},vR=/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,wR=function(){const i=Ge("input",{dir:"auto",name:"x",dirName:"x.dir"}),e=Ge("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),t=Ge("form");t.appendChild(i),t.appendChild(e);const n=function(){try{return new FormData(t).has(e.dirName)}catch{return!1}}(),r=function(){try{return i.matches(":dir(ltr),:dir(rtl)")}catch{return!1}}();return n?function(s){return e.value=s,new FormData(t).get(e.dirName)}:r?function(s){return i.value=s,i.matches(":dir(rtl)")?"rtl":"ltr"}:function(s){const o=s.trim().charAt(0);return vR.test(o)?"rtl":"ltr"}}();let rf=null,sf=null,of=null,rc=null;const Pd=()=>(rf||(rf=kR().concat(yR())),rLine truncated
|
||||
`+Sr),He&&sc([J,te,ie],bi=>{Sr=ol(Sr,bi," ")}),k&&Ri?k.createHTML(Sr):Sr},t.setConfig=function(){ce(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),qe=!0},t.clearConfig=function(){$=null,qe=!1},t.isValidAttribute=function(Z,_e,me){$||ce({});const Ke=E(Z),ot=E(_e);return tr(Ke,ot,me)},t.addHook=function(Z,_e){typeof _e=="function"&&sl(B[Z],_e)},t.removeHook=function(Z,_e){if(_e!==void 0){const me=$R(B[Z],_e);return me===-1?void 0:LR(B[Z],me,1)[0]}return q1(B[Z])},t.removeHooks=function(Z){B[Z]=[]},t.removeAllHooks=function(){B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},t}();Ao.addHook("uponSanitizeAttribute",function(i,e){if(e.attrName==="data-trix-serialized-attributes")return void(e.keepAttr=!1);/^data-trix-/.test(e.attrName)&&(e.forceKeepAttr=!0)});const n4="style href src width height language class".split(" "),i4="javascript:".split(" "),r4="script iframe form noscript".split(" ");class lh extends Kt{static setHTML(e,t,n){const r=new this(t,n).sanitize(),s=r.getHTML?r.getHTML():r.outerHTML;e.innerHTML=s}static sanitize(e,t){const n=new this(e,t);return n.sanitize(),n}constructor(e){let{allowedAttributes:t,forbiddenProtocols:n,forbiddenElements:r,purifyOptions:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.allowedAttributes=t||n4,this.forbiddenProtocols=n||i4,this.forbiddenElements=r||r4,this.purifyOptions=s||{},this.body=s4(e)}sanitize(){this.sanitizeElements(),this.normalizeListElementNesting();const e=Object.assign({},Hy,this.purifyOptions);return Ao.setConfig(e),this.body=Ao.sanitize(this.body),this.body}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){const e=vu(this.body),t=[];for(;e.nextNode();){const n=e.currentNode;switch(n.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(n)?t.push(n):this.sanitizeElement(n);break;case Node.COMMENT_NODE:t.push(n)}}return t.forEach(n=>zr(n)),this.body}sanitizeElement(e){return e.hasAttribute("href")&&this.forbiddenProtocols.includes(e.protocol)&&e.removeAttribute("href"),Array.from(e.attributes).forEach(t=>{let{name:n}=t;this.allowedAttributes.includes(n)||n.indexOf("data-trix")===0||e.removeAttribute(n)}),e}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach(e=>{const t=e.previousElementSibling;t&&kn(t)==="li"&&t.appendChild(e)}),this.body}elementIsRemovable(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE)return this.elementIsForbidden(e)||this.elementIsntSerializable(e)}elementIsForbidden(e){return this.forbiddenElements.includes(kn(e))}elementIsntSerializable(e){return e.getAttribute("data-trix-serialize")==="false"&&!Cs(e)}}const s4=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";i=i.replace(/<\/html[^>]*>[^]*$/i,"</html>");const e=document.implementation.createHTMLDocument("");return e.documentElement.innerHTML=i,Array.from(e.head.querySelectorAll("style")).forEach(t=>{e.body.appendChild(t)}),e.body},{css:Cr}=$a;class ip extends Zs{constructor(){super(...arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}createContentNodes(){return[]}createNodes(){let e;const t=e=Ge({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),n=this.getHref();return n&&(e=Ge({tagName:"a",editable:!1,attributes:{href:n,tabindex:-1}}),t.appendChild(e)),this.attachment.hasContent()?lh.setHTML(e,this.attachment.getContent()):this.createContentNodes().forEach(r=>{e.appendChild(r)}),e.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=Ge({tagName:"progress",attributes:{class:Cr.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),t.appendChild(this.progressElement)),[n0("left"),t,n0("right")]}createCaptionElement(){const e=Ge({tagName:"figcaption",className:Cr.attachmentCaption}),t=this.attachmentPiece.getCaption();if(t)e.classList.add("".concat(Cr.attachmentCaption,"--edited")),e.textContent=t;else{let n,r;const s=this.getCaptionConfig();if(s.name&&(n=this.attachment.getFilename()),s.size&&(r=this.attachment.getFormattedFilesize()),n){const o=Ge({tagName:"span",className:Cr.attachmentName,textContent:n});e.appendChild(o)}if(r){n&&e.appendChild(document.createTextNode(" "));const o=Ge({tagName:"span",className:Cr.attachmentSize,textContent:r});e.appendChild(o)}}return e}getClassName(){const e=[Cr.attachment,"".concat(Cr.attachment,"--").concat(this.attachment.getType())],t=this.attachment.getExtension();return t&&e.push("".concat(Cr.attachment,"--").concat(t)),e.join(" ")}getData(){const e={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:thi
Line truncated
|
||||
`);for(let r=0;r<n.length;r++){const s=n[r];if(r>0){const o=Ge("br");t.push(o)}if(s.length){const o=document.createTextNode(this.preserveSpaces(s));t.push(o)}}return t}}createElement(){let e,t,n;const r={};for(t in this.attributes){n=this.attributes[t];const o=Ad(t);if(o){if(o.tagName){var s;const l=Ge(o.tagName);s?(s.appendChild(l),s=l):e=s=l}if(o.styleProperty&&(r[o.styleProperty]=n),o.style)for(t in o.style)n=o.style[t],r[t]=n}}if(Object.keys(r).length)for(t in e||(e=Ge("span")),r)n=r[t],e.style[t]=n;return e}createContainerElement(){for(const e in this.attributes){const t=this.attributes[e],n=Ad(e);if(n&&n.groupTagName){const r={};return r[e]=t,Ge(n.groupTagName,r)}}}preserveSpaces(e){return this.context.isLast&&(e=e.replace(/\ $/,Rr)),e=e.replace(/(\S)\ {3}(\S)/g,"$1 ".concat(Rr," $2")).replace(/\ {2}/g,"".concat(Rr," ")).replace(/\ {2}/g," ".concat(Rr)),(this.context.isFirst||this.context.followsWhitespace)&&(e=e.replace(/^\ /,Rr)),e}}class Ok extends Zs{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){const e=[],t=np.groupObjects(this.getPieces()),n=t.length-1;for(let s=0;s<t.length;s++){const o=t[s],l={};s===0&&(l.isFirst=!0),s===n&&(l.isLast=!0),l4(r)&&(l.followsWhitespace=!0);const a=this.findOrCreateCachedChildView(gk,o,{textConfig:this.textConfig,context:l});e.push(...Array.from(a.getNodes()||[]));var r=o}return e}getPieces(){return Array.from(this.text.getPieces()).filter(e=>!e.hasAttribute("blockBreak"))}}const l4=i=>/\s$/.test(i==null?void 0:i.toString()),{css:i0}=$a;class bk extends Zs{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){const e=[document.createComment("block")];if(this.block.isEmpty())e.push(Ge("br"));else{var t;const n=(t=zt(this.block.getLastAttribute()))===null||t===void 0?void 0:t.text,r=this.findOrCreateCachedChildView(Ok,this.block.text,{textConfig:n});e.push(...Array.from(r.getNodes()||[])),this.shouldAddExtraNewlineElement()&&e.push(Ge("br"))}if(this.attributes.length)return e;{let n;const{tagName:r}=Sn.default;this.block.isRTL()&&(n={dir:"rtl"});const s=Ge({tagName:r,attributes:n});return e.forEach(o=>s.appendChild(o)),[s]}}createContainerElement(e){const t={};let n;const r=this.attributes[e],{tagName:s,htmlAttributes:o=[]}=zt(r);if(e===0&&this.block.isRTL()&&Object.assign(t,{dir:"rtl"}),r==="attachmentGallery"){const l=this.block.getBlockBreakPosition();n="".concat(i0.attachmentGallery," ").concat(i0.attachmentGallery,"--").concat(l)}return Object.entries(this.block.htmlAttributes).forEach(l=>{let[a,c]=l;o.includes(a)&&(t[a]=c)}),Ge({tagName:s,className:n,attributes:t})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class ah extends Zs{static render(e){const t=Ge("div"),n=new this(e,{element:t});return n.render(),n.sync(),t}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new QR,this.setDocument(this.object)}setDocument(e){e.isEqualTo(this.document)||(this.document=this.object=e)}render(){if(this.childViews=[],this.shadowElement=Ge("div"),!this.document.isEmpty()){const e=np.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(e).forEach(t=>{const n=this.findOrCreateCachedChildView(bk,t);Array.from(n.getNodes()).map(r=>this.shadowElement.appendChild(r))})}}isSynced(){return a4(this.shadowElement,this.element)}sync(){const e=ek("trix-before-render",{cancelable:!1,attributes:{render:(n,r)=>{for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(r)}}});this.element.dispatchEvent(e);const t=this.createDocumentFragmentForSync();return e.render(this.element,t),this.didSync()}didSync(){return this.elementStore.reset(r0(this.element)),Jm(()=>this.garbageCollectCachedViews())}createDocumentFragmentForSync(){const e=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(t=>{e.appendChild(t.cloneNode(!0))}),Array.from(r0(e)).forEach(t=>{const n=this.elementStore.remove(t);n&&t.parentNode.replaceChild(n,t)}),e}}const r0=i=>i.querySelectorAll("[data-trix-store-key]"),a4=(i,e)=>s0(i.innerHTML)===s0(e.innerHTML),s0=i=>i.replace(/ /g," ");function c4(i){var e=function(t,n){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,n);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}(i,"string");return typeof e=="symbol"?e:String(e)}function gn(i,e,t){return(e=c4(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function it(i,e){return u4(i,vk(i,e,"get"))}function Wl(i,e,t){return h4(i,vk(i,e,"set"),t),t}function vk(i,e,t){if(!e.has(i))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(i)}function u4(i,e){return e.get?e.get.call(i):e.value}function h4(i,e,t){if(e.set)e.set.call(i,t);else{if(!e.writable)throw new TypeError("attempted to set read
Line truncated
|
||||
`))(e),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return this.toString()===`
|
||||
`&&this.getAttribute("blockBreak")===!0}toJSON(){const e=super.toJSON(...arguments);return e.string=this.string,e}canBeConsolidatedWith(e){return e&&this.hasSameConstructorAs(e)&&this.hasSameAttributesAsPiece(e)}consolidateWith(e){return new this.constructor(this.toString()+e.toString(),this.attributes)}splitAtOffset(e){let t,n;return e===0?(t=null,n=this):e===this.length?(t=this,n=null):(t=new this.constructor(this.string.slice(0,e),this.attributes),n=new this.constructor(this.string.slice(e),this.attributes)),[t,n]}toConsole(){let{string:e}=this;return e.length>15&&(e=e.slice(0,14)+"…"),JSON.stringify(e.toString())}}Bs.registerType("string",rp);class ku extends Ns{static box(e){return e instanceof this?e:new this(e)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects=e.slice(0),this.length=this.objects.length}indexOf(e){return this.objects.indexOf(e)}splice(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new this.constructor(Km(this.objects,...t))}eachObject(e){return this.objects.map((t,n)=>e(t,n))}insertObjectAtIndex(e,t){return this.splice(t,0,e)}insertSplittableListAtIndex(e,t){return this.splice(t,0,...e.objects)}insertSplittableListAtPosition(e,t){const[n,r]=this.splitObjectAtPosition(t);return new this.constructor(n).insertSplittableListAtIndex(e,r)}editObjectAtIndex(e,t){return this.replaceObjectAtIndex(t(this.objects[e]),e)}replaceObjectAtIndex(e,t){return this.splice(t,1,e)}removeObjectAtIndex(e){return this.splice(e,1)}getObjectAtIndex(e){return this.objects[e]}getSplittableListInRange(e){const[t,n,r]=this.splitObjectsAtRange(e);return new this.constructor(t.slice(n,r+1))}selectSplittableList(e){const t=this.objects.filter(n=>e(n));return new this.constructor(t)}removeObjectsInRange(e){const[t,n,r]=this.splitObjectsAtRange(e);return new this.constructor(t).splice(n,r-n+1)}transformObjectsInRange(e,t){const[n,r,s]=this.splitObjectsAtRange(e),o=n.map((l,a)=>r<=a&&a<=s?t(l):l);return new this.constructor(o)}splitObjectsAtRange(e){let t,[n,r,s]=this.splitObjectAtPosition(d4(e));return[n,t]=new this.constructor(n).splitObjectAtPosition(m4(e)+s),[n,r,t-1]}getObjectAtPosition(e){const{index:t}=this.findIndexAndOffsetAtPosition(e);return this.objects[t]}splitObjectAtPosition(e){let t,n;const{index:r,offset:s}=this.findIndexAndOffsetAtPosition(e),o=this.objects.slice(0);if(r!=null)if(s===0)t=r,n=0;else{const l=this.getObjectAtIndex(r),[a,c]=l.splitAtOffset(s);o.splice(r,1,a,c),t=r+1,n=a.getLength()-s}else t=o.length,n=0;return[o,t,n]}consolidate(){const e=[];let t=this.objects[0];return this.objects.slice(1).forEach(n=>{var r,s;(r=(s=t).canBeConsolidatedWith)!==null&&r!==void 0&&r.call(s,n)?t=t.consolidateWith(n):(e.push(t),t=n)}),t&&e.push(t),new this.constructor(e)}consolidateFromIndexToIndex(e,t){const n=this.objects.slice(0).slice(e,t+1),r=new this.constructor(n).consolidate().toArray();return this.splice(e,n.length,...r)}findIndexAndOffsetAtPosition(e){let t,n=0;for(t=0;t<this.objects.length;t++){const r=n+this.objects[t].getLength();if(n<=e&&e<r)return{index:t,offset:e-n};n=r}return{index:null,offset:null}}findPositionAtIndexAndOffset(e,t){let n=0;for(let r=0;r<this.objects.length;r++){const s=this.objects[r];if(r<e)n+=s.getLength();else if(r===e){n+=t;break}}return n}getEndPosition(){return this.endPosition==null&&(this.endPosition=0,this.objects.forEach(e=>this.endPosition+=e.getLength())),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(e){return super.isEqualTo(...arguments)||f4(this.objects,e==null?void 0:e.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(e=>e.inspect()).join(", "),"]")}}}const f4=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(i.length!==e.length)return!1;let t=!0;for(let n=0;n<i.length;n++){const r=i[n];t&&!r.isEqualTo(e[n])&&(t=!1)}return t},d4=i=>i[0],m4=i=>i[1];class Si extends Ns{static textForAttachmentWithAttributes(e,t){return new this([new xo(e,t)])}static textForStringWithAttributes(e,t){return new this([new rp(e,t)])}static fromJSON(e){return new this(Array.from(e).map(t=>Bs.fromJSON(t)))}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments);const t=e.filter(n=>!n.isEmpty());this.pieceList=new ku(t)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(e){return new this.constructor(e.consolidate().toArray())}copyUsingObjectMap(e){const t=this.getPieces().map(n=>e.find(n)||n);return new this.constructor(t)}appendText(e){return this.insertTextAtPosition(e,this.getLength())}insertTextAtPosition(e,t){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(e.pieceList,t))}removeTextAtRange(e){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(e))}replaceTextAtRange(e,t){return this.removeTextAtRange(t).insertTextAtPosition(e,t[0])}moveTe
Line truncated
|
||||
`,t);break;case"backward":r=n.slice(0,t).lastIndexOf(`
|
||||
`)}if(r!==-1)return r}contentsForInspection(){return{text:this.text.inspect(),attributes:this.attributes}}toString(){return this.text.toString()}toJSON(){return{text:this.text,attributes:this.attributes,htmlAttributes:this.htmlAttributes}}getDirection(){return this.text.getDirection()}isRTL(){return this.text.isRTL()}getLength(){return this.text.getLength()}canBeConsolidatedWith(e){return!this.hasAttributes()&&!e.hasAttributes()&&this.getDirection()===e.getDirection()}consolidateWith(e){const t=Si.textForStringWithAttributes(`
|
||||
`),n=this.getTextWithoutBlockBreak().appendText(t);return this.copyWithText(n.appendText(e.text))}splitAtOffset(e){let t,n;return e===0?(t=null,n=this):e===this.getLength()?(t=this,n=null):(t=this.copyWithText(this.text.getTextAtRange([0,e])),n=this.copyWithText(this.text.getTextAtRange([e,this.getLength()]))),[t,n]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return kk(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(e){return this.attributes[e]}canBeGroupedWith(e,t){const n=e.getAttributes(),r=n[t],s=this.attributes[t];return s===r&&!(zt(s).group===!1&&!(()=>{if(!rc){rc=[];for(const o in Sn){const{listAttribute:l}=Sn[o];l!=null&&rc.push(l)}}return rc})().includes(n[t+1]))&&(this.getDirection()===e.getDirection()||e.isEmpty())}}const p4=function(i){return i=g4(i),i=b4(i)},g4=function(i){let e=!1;const t=i.getPieces();let n=t.slice(0,t.length-1);const r=t[t.length-1];return r?(n=n.map(s=>s.isBlockBreak()?(e=!0,v4(s)):s),e?new Si([...n,r]):i):i},O4=Si.textForStringWithAttributes(`
|
||||
`,{blockBreak:!0}),b4=function(i){return kk(i)?i:i.appendText(O4)},kk=function(i){const e=i.getLength();return e===0?!1:i.getTextAtRange([e-1,e]).isBlockBreak()},v4=i=>i.copyWithoutAttribute("blockBreak"),o0=function(i){const{listAttribute:e}=zt(i);return e?[e,i]:[i]},l0=i=>i.slice(-1)[0],a0=function(i,e){const t=i.lastIndexOf(e);return t===-1?i:Km(i,t,1)};class si extends Ns{static fromJSON(e){return new this(Array.from(e).map(t=>Xi.fromJSON(t)))}static fromString(e,t){const n=Si.textForStringWithAttributes(e,t);return new this([new Xi(n)])}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),e.length===0&&(e=[new Xi]),this.blockList=ku.box(e)}isEmpty(){const e=this.getBlockAtIndex(0);return this.blockList.length===1&&e.isEmpty()&&!e.hasAttributes()}copy(){const e=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(e)}copyUsingObjectsFromDocument(e){const t=new TR(e.getObjects());return this.copyUsingObjectMap(t)}copyUsingObjectMap(e){const t=this.getBlocks().map(n=>e.find(n)||n.copyUsingObjectMap(e));return new this.constructor(t)}copyWithBaseBlockAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const t=this.getBlocks().map(n=>{const r=e.concat(n.getAttributes());return n.copyWithAttributes(r)});return new this.constructor(t)}replaceBlock(e,t){const n=this.blockList.indexOf(e);return n===-1?this:new this.constructor(this.blockList.replaceObjectAtIndex(t,n))}insertDocumentAtRange(e,t){const{blockList:n}=e;t=bt(t);let[r]=t;const{index:s,offset:o}=this.locationFromPosition(r);let l=this;const a=this.getBlockAtPosition(r);return or(t)&&a.isEmpty()&&!a.hasAttributes()?l=new this.constructor(l.blockList.removeObjectAtIndex(s)):a.getBlockBreakPosition()===o&&r++,l=l.removeTextAtRange(t),new this.constructor(l.blockList.insertSplittableListAtPosition(n,r))}mergeDocumentAtRange(e,t){let n,r;t=bt(t);const[s]=t,o=this.locationFromPosition(s),l=this.getBlockAtIndex(o.index).getAttributes(),a=e.getBaseBlockAttributes(),c=l.slice(-a.length);if(Ts(a,c)){const f=l.slice(0,-a.length);n=e.copyWithBaseBlockAttributes(f)}else n=e.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(l);const u=n.getBlockCount(),h=n.getBlockAtIndex(0);if(Ts(l,h.getAttributes())){const f=h.getTextWithoutBlockBreak();if(r=this.insertTextAtRange(f,t),u>1){n=new this.constructor(n.getBlocks().slice(1));const d=s+f.getLength();r=r.insertDocumentAtRange(n,d)}}else r=this.insertDocumentAtRange(n,t);return r}insertTextAtRange(e,t){t=bt(t);const[n]=t,{index:r,offset:s}=this.locationFromPosition(n),o=this.removeTextAtRange(t);return new this.constructor(o.blockList.editObjectAtIndex(r,l=>l.copyWithText(l.text.insertTextAtPosition(e,s))))}removeTextAtRange(e){let t;e=bt(e);const[n,r]=e;if(or(e))return this;const[s,o]=Array.from(this.locationRangeFromRange(e)),l=s.index,a=s.offset,c=this.getBlockAtIndex(l),u=o.index,h=o.offset,f=this.getBlockAtIndex(u);if(r-n==1&&c.getBlockBreakPosition()===a&&f.getBlockBreakPosition()!==h&&f.text.getStringAtPosition(h)===`
|
||||
`)t=this.blockList.editObjectAtIndex(u,d=>d.copyWithText(d.text.removeTextAtRange([h,h+1])));else{let d;const m=c.text.getTextAtRange([0,a]),p=f.text.getTextAtRange([h,f.getLength()]),g=m.appendText(p);d=l!==u&&a===0&&c.getAttributeLevel()>=f.getAttributeLevel()?f.copyWithText(g):c.copyWithText(g);const v=u+1-l;t=this.blockList.splice(l,v,d)}return new this.constructor(t)}moveTextFromRangeToPosition(e,t){let n;e=bt(e);const[r,s]=e;if(r<=t&&t<=s)return this;let o=this.getDocumentAtRange(e),l=this.removeTextAtRange(e);const a=r<t;a&&(t-=o.getLength());const[c,...u]=o.getBlocks();return u.length===0?(n=c.getTextWithoutBlockBreak(),a&&(t+=1)):n=c.text,l=l.insertTextAtRange(n,t),u.length===0?l:(o=new this.constructor(u),t+=n.getLength(),l.insertDocumentAtRange(o,t))}addAttributeAtRange(e,t,n){let{blockList:r}=this;return this.eachBlockAtRange(n,(s,o,l)=>r=r.editObjectAtIndex(l,function(){return zt(e)?s.addAttribute(e,t):o[0]===o[1]?s:s.copyWithText(s.text.addAttributeAtRange(e,t,o))})),new this.constructor(r)}addAttribute(e,t){let{blockList:n}=this;return this.eachBlock((r,s)=>n=n.editObjectAtIndex(s,()=>r.addAttribute(e,t))),new this.constructor(n)}removeAttributeAtRange(e,t){let{blockList:n}=this;return this.eachBlockAtRange(t,function(r,s,o){zt(e)?n=n.editObjectAtIndex(o,()=>r.removeAttribute(e)):s[0]!==s[1]&&(n=n.editObjectAtIndex(o,()=>r.copyWithText(r.text.removeAttributeAtRange(e,s))))}),new this.constructor(n)}updateAttributesForAttachment(e,t){const n=this.getRangeOfAttachment(t),[r]=Array.from(n),{index:s}=this.locationFromPosition(r),o=this.getTextAtIndex(s);return new this.constructor(this.blockList.editObjectAtIndex(s,l=>l.copyWithText(o.updateAttributesForAttachment(e,t))))}removeAttributeForAttachment(e,t){const n=this.getRangeOfAttachment(t);return this.removeAttributeAtRange(e,n)}setHTMLAttributeAtPosition(e,t,n){const r=this.getBlockAtPosition(e),s=r.addHTMLAttribute(t,n);return this.replaceBlock(r,s)}insertBlockBreakAtRange(e){let t;e=bt(e);const[n]=e,{offset:r}=this.locationFromPosition(n),s=this.removeTextAtRange(e);return r===0&&(t=[new Xi]),new this.constructor(s.blockList.insertSplittableListAtPosition(new ku(t),n))}applyBlockAttributeAtRange(e,t,n){const r=this.expandRangeToLineBreaksAndSplitBlocks(n);let s=r.document;n=r.range;const o=zt(e);if(o.listAttribute){s=s.removeLastListAttributeAtRange(n,{exceptAttributeName:e});const l=s.convertLineBreaksToBlockBreaksInRange(n);s=l.document,n=l.range}else s=o.exclusive?s.removeBlockAttributesAtRange(n):o.terminal?s.removeLastTerminalAttributeAtRange(n):s.consolidateBlocksAtRange(n);return s.addAttributeAtRange(e,t,n)}removeLastListAttributeAtRange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{blockList:n}=this;return this.eachBlockAtRange(e,function(r,s,o){const l=r.getLastAttribute();l&&zt(l).listAttribute&&l!==t.exceptAttributeName&&(n=n.editObjectAtIndex(o,()=>r.removeAttribute(l)))}),new this.constructor(n)}removeLastTerminalAttributeAtRange(e){let{blockList:t}=this;return this.eachBlockAtRange(e,function(n,r,s){const o=n.getLastAttribute();o&&zt(o).terminal&&(t=t.editObjectAtIndex(s,()=>n.removeAttribute(o)))}),new this.constructor(t)}removeBlockAttributesAtRange(e){let{blockList:t}=this;return this.eachBlockAtRange(e,function(n,r,s){n.hasAttributes()&&(t=t.editObjectAtIndex(s,()=>n.copyWithoutAttributes()))}),new this.constructor(t)}expandRangeToLineBreaksAndSplitBlocks(e){let t;e=bt(e);let[n,r]=e;const s=this.locationFromPosition(n),o=this.locationFromPosition(r);let l=this;const a=l.getBlockAtIndex(s.index);if(s.offset=a.findLineBreakInDirectionFromPosition("backward",s.offset),s.offset!=null&&(t=l.positionFromLocation(s),l=l.insertBlockBreakAtRange([t,t+1]),o.index+=1,o.offset-=l.getBlockAtIndex(s.index).getLength(),s.index+=1),s.offset=0,o.offset===0&&o.index>s.index)o.index-=1,o.offset=l.getBlockAtIndex(o.index).getBlockBreakPosition();else{const c=l.getBlockAtIndex(o.index);c.text.getStringAtRange([o.offset-1,o.offset])===`
|
||||
`?o.offset-=1:o.offset=c.findLineBreakInDirectionFromPosition("forward",o.offset),o.offset!==c.getBlockBreakPosition()&&(t=l.positionFromLocation(o),l=l.insertBlockBreakAtRange([t,t+1]))}return n=l.positionFromLocation(s),r=l.positionFromLocation(o),{document:l,range:e=bt([n,r])}}convertLineBreaksToBlockBreaksInRange(e){e=bt(e);let[t]=e;const n=this.getStringAtRange(e).slice(0,-1);let r=this;return n.replace(/.*?\n/g,function(s){t+=s.length,r=r.insertBlockBreakAtRange([t-1,t])}),{document:r,range:e}}consolidateBlocksAtRange(e){e=bt(e);const[t,n]=e,r=this.locationFromPosition(t).index,s=this.locationFromPosition(n).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(r,s))}getDocumentAtRange(e){e=bt(e);const t=this.blockList.getSplittableListInRange(e).toArray();return new this.constructor(t)}getStringAtRange(e){let t;const n=e=bt(e);return n[n.length-1]!==this.getLength()&&(t=-1),this.getDocumentAtRange(e).toString().slice(0,t)}getBlockAtIndex(e){return this.blockList.getObjectAtIndex(e)}getBlockAtPosition(e){const{index:t}=this.locationFromPosition(e);return this.getBlockAtIndex(t)}getTextAtIndex(e){var t;return(t=this.getBlockAtIndex(e))===null||t===void 0?void 0:t.text}getTextAtPosition(e){const{index:t}=this.locationFromPosition(e);return this.getTextAtIndex(t)}getPieceAtPosition(e){const{index:t,offset:n}=this.locationFromPosition(e);return this.getTextAtIndex(t).getPieceAtPosition(n)}getCharacterAtPosition(e){const{index:t,offset:n}=this.locationFromPosition(e);return this.getTextAtIndex(t).getStringAtRange([n,n+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(e){return this.blockList.eachObject(e)}eachBlockAtRange(e,t){let n,r;e=bt(e);const[s,o]=e,l=this.locationFromPosition(s),a=this.locationFromPosition(o);if(l.index===a.index)return n=this.getBlockAtIndex(l.index),r=[l.offset,a.offset],t(n,r,l.index);for(let c=l.index;c<=a.index;c++)if(n=this.getBlockAtIndex(c),n){switch(c){case l.index:r=[l.offset,n.text.getLength()];break;case a.index:r=[0,a.offset];break;default:r=[0,n.text.getLength()]}t(n,r,c)}}getCommonAttributesAtRange(e){e=bt(e);const[t]=e;if(or(e))return this.getCommonAttributesAtPosition(t);{const n=[],r=[];return this.eachBlockAtRange(e,function(s,o){if(o[0]!==o[1])return n.push(s.text.getCommonAttributesAtRange(o)),r.push(c0(s))}),Kn.fromCommonAttributesOfObjects(n).merge(Kn.fromCommonAttributesOfObjects(r)).toObject()}}getCommonAttributesAtPosition(e){let t,n;const{index:r,offset:s}=this.locationFromPosition(e),o=this.getBlockAtIndex(r);if(!o)return{};const l=c0(o),a=o.text.getAttributesAtPosition(s),c=o.text.getAttributesAtPosition(s-1),u=Object.keys(xs).filter(h=>xs[h].inheritable);for(t in c)n=c[t],(n===a[t]||u.includes(t))&&(l[t]=n);return l}getRangeOfCommonAttributeAtPosition(e,t){const{index:n,offset:r}=this.locationFromPosition(t),s=this.getTextAtIndex(n),[o,l]=Array.from(s.getExpandedRangeForAttributeAtOffset(e,r)),a=this.positionFromLocation({index:n,offset:o}),c=this.positionFromLocation({index:n,offset:l});return bt([a,c])}getBaseBlockAttributes(){let e=this.getBlockAtIndex(0).getAttributes();for(let t=1;t<this.getBlockCount();t++){const n=this.getBlockAtIndex(t).getAttributes(),r=Math.min(e.length,n.length);e=(()=>{const s=[];for(let o=0;o<r&&n[o]===e[o];o++)s.push(n[o]);return s})()}return e}getAttachmentById(e){for(const t of this.getAttachments())if(t.id===e)return t}getAttachmentPieces(){let e=[];return this.blockList.eachObject(t=>{let{text:n}=t;return e=e.concat(n.getAttachmentPieces())}),e}getAttachments(){return this.getAttachmentPieces().map(e=>e.attachment)}getRangeOfAttachment(e){let t=0;const n=this.blockList.toArray();for(let r=0;r<n.length;r++){const{text:s}=n[r],o=s.getRangeOfAttachment(e);if(o)return bt([t+o[0],t+o[1]]);t+=s.getLength()}}getLocationRangeOfAttachment(e){const t=this.getRangeOfAttachment(e);return this.locationRangeFromRange(t)}getAttachmentPieceForAttachment(e){for(const t of this.getAttachmentPieces())if(t.attachment===e)return t}findRangesForBlockAttribute(e){let t=0;const n=[];return this.getBlocks().forEach(r=>{const s=r.getLength();r.hasAttribute(e)&&n.push([t,t+s]),t+=s}),n}findRangesForTextAttribute(e){let{withValue:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=0,r=[];const s=[];return this.getPieces().forEach(o=>{const l=o.getLength();(function(a){return t?a.getAttribute(e)===t:a.hasAttribute(e)})(o)&&(r[1]===n?r[1]=n+l:s.push(r=[n,n+l])),n+=l}),s}locationFromPosition(e){const t=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,e));if(t.index!=null)return t;{const n=this.getBlocks();return{index:n.length-1,offset:n[n.length-1].getLength()}}}positionFromLocation(e){return this.blockList.findPositionAtIndexAndOffset(e.index,e.offset)}locationRangeFromPosition(e){return bt(this.locationFromPosition(e))}locationRangeFromRange(e){if(!(e=bt(e)))return;co
Line truncated
|
||||
`);if(t===this.containerElement||this.isBlockElement(t)){var n;const r=this.getBlockAttributes(t),s=this.getBlockHTMLAttributes(t);Ts(r,(n=this.currentBlock)===null||n===void 0?void 0:n.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(r,t,s),this.currentBlockElement=t)}}appendBlockForElement(e){const t=this.isBlockElement(e),n=ws(this.currentBlockElement,e);if(t&&!this.isBlockElement(e.firstChild)){if(!this.isInsignificantTextNode(e.firstChild)||!this.isBlockElement(e.firstElementChild)){const r=this.getBlockAttributes(e),s=this.getBlockHTMLAttributes(e);if(e.firstChild){if(n&&Ts(r,this.currentBlock.attributes))return this.appendStringWithAttributes(`
|
||||
`);this.currentBlock=this.appendBlockForAttributesWithElement(r,e,s),this.currentBlockElement=e}}}else if(this.currentBlockElement&&!n&&!t){const r=this.findParentBlockElement(e);if(r)return this.appendBlockForElement(r);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(e){let{parentElement:t}=e;for(;t&&t!==this.containerElement;){if(this.isBlockElement(t)&&this.blockElements.includes(t))return t;t=t.parentElement}return null}processTextNode(e){let t=e.data;var n;return h0(e.parentNode)||(t=tp(t),Sk((n=e.previousSibling)===null||n===void 0?void 0:n.textContent)&&(t=k4(t))),this.appendStringWithAttributes(t,this.getTextAttributes(e.parentNode))}processElement(e){let t;if(Cs(e)){if(t=u0(e,"attachment"),Object.keys(t).length){const n=this.getTextAttributes(e);this.appendAttachmentWithAttributes(t,n),e.innerHTML=""}return this.processedElements.push(e)}switch(kn(e)){case"br":return this.isExtraBR(e)||this.isBlockElement(e.nextSibling)||this.appendStringWithAttributes(`
|
||||
`,this.getTextAttributes(e)),this.processedElements.push(e);case"img":t={url:e.getAttribute("src"),contentType:"image"};const n=(r=>{const s=r.getAttribute("width"),o=r.getAttribute("height"),l={};return s&&(l.width=parseInt(s,10)),o&&(l.height=parseInt(o,10)),l})(e);for(const r in n){const s=n[r];t[r]=s}return this.appendAttachmentWithAttributes(t,this.getTextAttributes(e)),this.processedElements.push(e);case"tr":if(this.needsTableSeparator(e))return this.appendStringWithAttributes(Fc.tableRowSeparator);break;case"td":if(this.needsTableSeparator(e))return this.appendStringWithAttributes(Fc.tableCellSeparator)}}appendBlockForAttributesWithElement(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.blockElements.push(t);const r=function(){return{text:[],attributes:arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},htmlAttributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}}}(e,n);return this.blocks.push(r),r}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(e,t){return this.appendPiece(mf(e,t))}appendAttachmentWithAttributes(e,t){return this.appendPiece(function(n){return{attachment:n,attributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},type:"attachment"}}(e,t))}appendPiece(e){return this.blocks.length===0&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(e)}appendStringToTextAtIndex(e,t){const{text:n}=this.blocks[t],r=n[n.length-1];if((r==null?void 0:r.type)!=="string")return n.push(mf(e));r.string+=e}prependStringToTextAtIndex(e,t){const{text:n}=this.blocks[t],r=n[0];if((r==null?void 0:r.type)!=="string")return n.unshift(mf(e));r.string=e+r.string}getTextAttributes(e){let t;const n={};for(const r in xs){const s=xs[r];if(s.tagName&&Yr(e,{matchingSelector:s.tagName,untilNode:this.containerElement}))n[r]=!0;else if(s.parser){if(t=s.parser(e),t){let o=!1;for(const l of this.findBlockElementAncestors(e))if(s.parser(l)===t){o=!0;break}o||(n[r]=t)}}else s.styleProperty&&(t=e.style[s.styleProperty],t&&(n[r]=t))}if(Cs(e)){const r=u0(e,"attributes");for(const s in r)t=r[s],n[s]=t}return n}getBlockAttributes(e){const t=[];for(;e&&e!==this.containerElement;){for(const r in Sn){const s=Sn[r];var n;s.parse!==!1&&kn(e)===s.tagName&&((n=s.test)!==null&&n!==void 0&&n.call(s,e)||!s.test)&&(t.push(r),s.listAttribute&&t.push(s.listAttribute))}e=e.parentNode}return t.reverse()}getBlockHTMLAttributes(e){const t={},n=Object.values(Sn).find(r=>r.tagName===kn(e));return((n==null?void 0:n.htmlAttributes)||[]).forEach(r=>{e.hasAttribute(r)&&(t[r]=e.getAttribute(r))}),t}findBlockElementAncestors(e){const t=[];for(;e&&e!==this.containerElement;){const n=kn(e);Nl().includes(n)&&t.push(e),e=e.parentNode}return t}isBlockElement(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&!Cs(e)&&!Yr(e,{matchingSelector:"td",untilNode:this.containerElement}))return Nl().includes(kn(e))||window.getComputedStyle(e).display==="block"}isInsignificantTextNode(e){if((e==null?void 0:e.nodeType)!==Node.TEXT_NODE||!S4(e.data))return;const{parentNode:t,previousSibling:n,nextSibling:r}=e;return w4(t.previousSibling)&&!this.isBlockElement(t.previousSibling)||h0(t)?void 0:!n||this.isBlockElement(n)||!r||this.isBlockElement(r)}isExtraBR(e){return kn(e)==="br"&&this.isBlockElement(e.parentNode)&&e.parentNode.lastChild===e}needsTableSeparator(e){if(Fc.removeBlankTableCells){var t;const n=(t=e.previousSibling)===null||t===void 0?void 0:t.textContent;return n&&/\S/.test(n)}return e.previousSibling}translateBlockElementMarginsToNewlines(){const e=this.getMarginOfDefaultBlockElement();for(let t=0;t<this.blocks.length;t++){const n=this.getMarginOfBlockElementAtIndex(t);n&&(n.top>2*e.top&&this.prependStringToTextAtIndex(`
|
||||
`,t),n.bottom>2*e.bottom&&this.appendStringToTextAtIndex(`
|
||||
`,t))}}getMarginOfBlockElementAtIndex(e){const t=this.blockElements[e];if(t&&t.textContent&&!Nl().includes(kn(t))&&!this.processedElements.includes(t))return f0(t)}getMarginOfDefaultBlockElement(){const e=Ge(Sn.default.tagName);return this.containerElement.appendChild(e),f0(e)}}const h0=function(i){const{whiteSpace:e}=window.getComputedStyle(i);return["pre","pre-wrap","pre-line"].includes(e)},w4=i=>i&&!Sk(i.textContent),f0=function(i){const e=window.getComputedStyle(i);if(e.display==="block")return{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}},y4=function(i){return kn(i)==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},k4=i=>i.replace(new RegExp("^".concat(ep.source,"+")),""),S4=i=>new RegExp("^".concat(ep.source,"*$")).test(i),Sk=i=>/\s$/.test(i),_4=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],Md="data-trix-serialized-attributes",C4="[".concat(Md,"]"),P4=new RegExp("<!--block-->","g"),A4={"application/json":function(i){let e;if(i instanceof si)e=i;else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");e=oa.parse(i.innerHTML).getDocument()}return e.toSerializableDocument().toJSONString()},"text/html":function(i){let e;if(i instanceof si)e=ah.render(i);else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");e=i.cloneNode(!0)}return Array.from(e.querySelectorAll("[data-trix-serialize=false]")).forEach(t=>{zr(t)}),_4.forEach(t=>{Array.from(e.querySelectorAll("[".concat(t,"]"))).forEach(n=>{n.removeAttribute(t)})}),Array.from(e.querySelectorAll(C4)).forEach(t=>{try{const n=JSON.parse(t.getAttribute(Md));t.removeAttribute(Md);for(const r in n){const s=n[r];t.setAttribute(r,s)}}catch{}}),e.innerHTML.replace(P4,"")}};var x4=Object.freeze({__proto__:null});class Nt extends Kt{constructor(e,t){super(...arguments),this.attachmentManager=e,this.attachment=t,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}}Nt.proxyMethod("attachment.getAttribute"),Nt.proxyMethod("attachment.hasAttribute"),Nt.proxyMethod("attachment.setAttribute"),Nt.proxyMethod("attachment.getAttributes"),Nt.proxyMethod("attachment.setAttributes"),Nt.proxyMethod("attachment.isPending"),Nt.proxyMethod("attachment.isPreviewable"),Nt.proxyMethod("attachment.getURL"),Nt.proxyMethod("attachment.getPreviewURL"),Nt.proxyMethod("attachment.setPreviewURL"),Nt.proxyMethod("attachment.getHref"),Nt.proxyMethod("attachment.getFilename"),Nt.proxyMethod("attachment.getFilesize"),Nt.proxyMethod("attachment.getFormattedFilesize"),Nt.proxyMethod("attachment.getExtension"),Nt.proxyMethod("attachment.getContentType"),Nt.proxyMethod("attachment.getFile"),Nt.proxyMethod("attachment.setFile"),Nt.proxyMethod("attachment.releaseFile"),Nt.proxyMethod("attachment.getUploadProgress"),Nt.proxyMethod("attachment.setUploadProgress");class _k extends Kt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(e).forEach(t=>{this.manageAttachment(t)})}getAttachments(){const e=[];for(const t in this.managedAttachments){const n=this.managedAttachments[t];e.push(n)}return e}manageAttachment(e){return this.managedAttachments[e.id]||(this.managedAttachments[e.id]=new Nt(this,e)),this.managedAttachments[e.id]}attachmentIsManaged(e){return e.id in this.managedAttachments}requestRemovalOfAttachment(e){var t,n;if(this.attachmentIsManaged(e))return(t=this.delegate)===null||t===void 0||(n=t.attachmentManagerDidRequestRemovalOfAttachment)===null||n===void 0?void 0:n.call(t,e)}unmanageAttachment(e){const t=this.managedAttachments[e.id];return delete this.managedAttachments[e.id],t}}class Ck{constructor(e){this.composition=e,this.document=this.composition.document;const t=this.composition.getSelectedRange();this.startPosition=t[0],this.endPosition=t[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}shouldInsertBlockBreak(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?this.startLocation.offset!==0:this.breaksOnReturn&&this.nextCharacter!==`
|
||||
`}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&this.nextCharacter===`
|
||||
`||this.previousCharacter===`
|
||||
`)}shouldDecreaseListLevel(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()}shouldPrependListItem(){return this.block.isListItem()&&this.startLocation.offset===0&&!this.block.isEmpty()}shouldRemoveLastBlockAttribute(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()}}class Tr extends Kt{constructor(){super(...arguments),this.document=new si,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(e){var t,n;if(!e.isEqualTo(this.document))return this.document=e,this.refreshAttachments(),this.revision++,(t=this.delegate)===null||t===void 0||(n=t.compositionDidChangeDocument)===null||n===void 0?void 0:n.call(t,e)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}loadSnapshot(e){var t,n,r,s;let{document:o,selectedRange:l}=e;return(t=this.delegate)===null||t===void 0||(n=t.compositionWillLoadSnapshot)===null||n===void 0||n.call(t),this.setDocument(o??new si),this.setSelection(l??[0,0]),(r=this.delegate)===null||r===void 0||(s=r.compositionDidLoadSnapshot)===null||s===void 0?void 0:s.call(r)}insertText(e){let{updatePosition:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{updatePosition:!0};const n=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(e,n));const r=n[0],s=r+e.getLength();return t&&this.setSelection(s),this.notifyDelegateOfInsertionAtRange([r,s])}insertBlock(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Xi;const t=new si([e]);return this.insertDocument(t)}insertDocument(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new si;const t=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(e,t));const n=t[0],r=n+e.getLength();return this.setSelection(r),this.notifyDelegateOfInsertionAtRange([n,r])}insertString(e,t){const n=this.getCurrentTextAttributes(),r=Si.textForStringWithAttributes(e,n);return this.insertText(r,t)}insertBlockBreak(){const e=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(e));const t=e[0],n=t+1;return this.setSelection(n),this.notifyDelegateOfInsertionAtRange([t,n])}insertLineBreak(){const e=new Ck(this);if(e.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(e.startPosition);if(e.shouldPrependListItem()){const t=new si([e.block.copyWithoutText()]);return this.insertDocument(t)}return e.shouldInsertBlockBreak()?this.insertBlockBreak():e.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():e.shouldBreakFormattedBlock()?this.breakFormattedBlock(e):this.insertString(`
|
||||
`)}insertHTML(e){const t=oa.parse(e,{purifyOptions:{SAFE_FOR_XML:!0}}).getDocument(),n=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(t,n));const r=n[0],s=r+t.getLength()-1;return this.setSelection(s),this.notifyDelegateOfInsertionAtRange([r,s])}replaceHTML(e){const t=oa.parse(e).getDocument().copyUsingObjectsFromDocument(this.document),n=this.getLocationRange({strict:!1}),r=this.document.rangeFromLocationRange(n);return this.setDocument(t),this.setSelection(r)}insertFile(e){return this.insertFiles([e])}insertFiles(e){const t=[];return Array.from(e).forEach(n=>{var r;if((r=this.delegate)!==null&&r!==void 0&&r.compositionShouldAcceptFile(n)){const s=Yo.attachmentForFile(n);t.push(s)}}),this.insertAttachments(t)}insertAttachment(e){return this.insertAttachments([e])}insertAttachments(e){let t=new Si;return Array.from(e).forEach(n=>{var r;const s=n.getType(),o=(r=jm[s])===null||r===void 0?void 0:r.presentation,l=this.getCurrentTextAttributes();o&&(l.presentation=o);const a=Si.textForAttachmentWithAttributes(n,l);t=t.appendText(a)}),this.insertText(t)}shouldManageDeletingInDirection(e){const t=this.getLocationRange();if(or(t)){if(e==="backward"&&t[0].offset===0||this.shouldManageMovingCursorInDirection(e))return!0}else if(t[0].index!==t[1].index)return!0;return!1}deleteInDirection(e){let t,n,r,{length:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getLocationRange();let l=this.getSelectedRange();const a=or(l);if(a?n=e==="backward"&&o[0].offset===0:r=o[0].index!==o[1].index,n&&this.canDecreaseBlockAttributeLevel()){const c=this.getBlock();if(c.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(l[0]),c.isEmpty())return!1}return a&&(l=this.getExpandedRangeInDirection(e,{length:s}),e==="backward"&&(t=this.getAttachmentAtRange(l))),t?(this.editAttachment(t),!1):(this.setDocument(this.document.removeTextAtRange(l)),this.setSelection(l[0]),!n&&!r&&void 0)}moveTextFromRange(e){const[t]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(e,t)),this.setSelection(t)}removeAttachment(e){const t=this.document.getRangeOfAttachment(e);if(t)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(t)),this.setSelection(t[0])}removeLastBlockAttribute(){const[e,t]=Array.from(this.getSelectedRange()),n=this.document.getBlockAtPosition(t);return this.removeCurrentAttribute(n.getLastAttribute()),this.setSelection(e)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")}selectPlaceholder(){if(this.placeholderPosition!=null)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+1]),this.getSelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(e){const t=this.currentAttributes[e];return t!=null&&t!==!1}toggleCurrentAttribute(e){const t=!this.currentAttributes[e];return t?this.setCurrentAttribute(e,t):this.removeCurrentAttribute(e)}canSetCurrentAttribute(e){return zt(e)?this.canSetCurrentBlockAttribute(e):this.canSetCurrentTextAttribute(e)}canSetCurrentTextAttribute(e){const t=this.getSelectedDocument();if(t){for(const n of Array.from(t.getAttachments()))if(!n.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(e){const t=this.getBlock();if(t)return!t.isTerminalBlock()}setCurrentAttribute(e,t){return zt(e)?this.setBlockAttribute(e,t):(this.setTextAttribute(e,t),this.currentAttributes[e]=t,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(e,t,n){var r;const s=this.document.getBlockAtPosition(e),o=(r=zt(s.getLastAttribute()))===null||r===void 0?void 0:r.htmlAttributes;if(s&&o!=null&&o.includes(t)){const l=this.document.setHTMLAttributeAtPosition(e,t,n);this.setDocument(l)}}setTextAttribute(e,t){const n=this.getSelectedRange();if(!n)return;const[r,s]=Array.from(n);if(r!==s)return this.setDocument(this.document.addAttributeAtRange(e,t,n));if(e==="href"){const o=Si.textForStringWithAttributes(t,{href:t});return this.insertText(o)}}setBlockAttribute(e,t){const n=this.getSelectedRange();if(this.canSetCurrentAttribute(e))return this.setDocument(this.document.applyBlockAttributeAtRange(e,t,n)),this.setSelection(n)}removeCurrentAttribute(e){return zt(e)?(this.removeBlockAttribute(e),this.updateCurrentAttributes()):(this.removeTextAttribute(e),delete this.currentAttributes[e],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(e){const t=this.getSelectedRange();if(t)return this.setDocument(this.document.removeAttributeAtRange(e,t))}removeBlockAttribute(e){const t=this.getSelectedRange();if(t)return this.setDocument(this.document.removeAttributeAtRange(e,t))}canDecreaseNestingLevel(){var e;return((e=this.getBlock())===null||e===void 0?void 0:e.getNestingLevel())>0}canIncreaseNestingLevel(){var e;const t=this.getBlock();if(t){if((e=zt(t.getLastNestableAttribute()))===null||e===void 0||!e.listAttribute)return t.getNestingLevel()>0;{cons
Line truncated
|
||||
`?r+=1:t=t.removeTextAtRange(s),s=[r,r]):e.nextCharacter===`
|
||||
`?e.previousCharacter===`
|
||||
`?s=[r-1,r+1]:(s=[r,r+1],r+=1):e.startLocation.offset-1!=0&&(r+=1);const o=new si([n.removeLastAttribute().copyWithoutText()]);return this.setDocument(t.insertDocumentAtRange(o,s)),this.setSelection(r)}getPreviousBlock(){const e=this.getLocationRange();if(e){const{index:t}=e[0];if(t>0)return this.document.getBlockAtIndex(t-1)}}getBlock(){const e=this.getLocationRange();if(e)return this.document.getBlockAtIndex(e[0].index)}getAttachmentAtRange(e){const t=this.document.getDocumentAtRange(e);if(t.toString()==="".concat("",`
|
||||
`))return t.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.compositionDidChangeCurrentAttributes)===null||t===void 0?void 0:t.call(e,this.currentAttributes)}notifyDelegateOfInsertionAtRange(e){var t,n;return(t=this.delegate)===null||t===void 0||(n=t.compositionDidPerformInsertionAtRange)===null||n===void 0?void 0:n.call(t,e)}translateUTF16PositionFromOffset(e,t){const n=this.document.toUTF16String(),r=n.offsetFromUCS2Offset(e);return n.offsetToUCS2Offset(r+t)}}Tr.proxyMethod("getSelectionManager().getPointRange"),Tr.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),Tr.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),Tr.proxyMethod("getSelectionManager().locationIsCursorTarget"),Tr.proxyMethod("getSelectionManager().selectionIsExpanded"),Tr.proxyMethod("delegate?.getSelectionManager");class Ed extends Kt{constructor(e){super(...arguments),this.composition=e,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(e){let{context:t,consolidatable:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.undoEntries.slice(-1)[0];if(!n||!T4(r,e,t)){const s=this.createEntry({description:e,context:t});this.undoEntries.push(s),this.redoEntries=[]}}undo(){const e=this.undoEntries.pop();if(e){const t=this.createEntry(e);return this.redoEntries.push(t),this.composition.loadSnapshot(e.snapshot)}}redo(){const e=this.redoEntries.pop();if(e){const t=this.createEntry(e);return this.undoEntries.push(t),this.composition.loadSnapshot(e.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:e,context:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{description:e==null?void 0:e.toString(),context:JSON.stringify(t),snapshot:this.composition.getSnapshot()}}}const T4=(i,e,t)=>(i==null?void 0:i.description)===(e==null?void 0:e.toString())&&(i==null?void 0:i.context)===JSON.stringify(t),pf="attachmentGallery";class Pk{constructor(e){this.document=e.document,this.selectedRange=e.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map(e=>this.document=this.document.removeAttributeAtRange(pf,e))}applyBlockAttribute(){let e=0;this.findRangesOfPieces().forEach(t=>{t[1]-t[0]>1&&(t[0]+=e,t[1]+=e,this.document.getCharacterAtPosition(t[1])!==`
|
||||
`&&(this.document=this.document.insertBlockBreakAtRange(t[1]),t[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),t[1]++,e++),t[0]!==0&&this.document.getCharacterAtPosition(t[0]-1)!==`
|
||||
`&&(this.document=this.document.insertBlockBreakAtRange(t[0]),t[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),t[0]++,e++),this.document=this.document.applyBlockAttributeAtRange(pf,!0,t))})}findRangesOfBlocks(){return this.document.findRangesForBlockAttribute(pf)}findRangesOfPieces(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})}moveSelectedRangeForward(){this.selectedRange[0]+=1,this.selectedRange[1]+=1}}const Ak=function(i){const e=new Pk(i);return e.perform(),e.getSnapshot()},Q4=[Ak];class xk{constructor(e,t,n){this.insertFiles=this.insertFiles.bind(this),this.composition=e,this.selectionManager=t,this.element=n,this.undoManager=new Ed(this.composition),this.filters=Q4.slice(0)}loadDocument(e){return this.loadSnapshot({document:e,selectedRange:[0,0]})}loadHTML(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const t=oa.parse(e,{referenceElement:this.element}).getDocument();return this.loadDocument(t)}loadJSON(e){let{document:t,selectedRange:n}=e;return t=si.fromJSON(t),this.loadSnapshot({document:t,selectedRange:n})}loadSnapshot(e){return this.undoManager=new Ed(this.composition),this.composition.loadSnapshot(e)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(e){return this.composition.deleteInDirection(e)}insertAttachment(e){return this.composition.insertAttachment(e)}insertAttachments(e){return this.composition.insertAttachments(e)}insertDocument(e){return this.composition.insertDocument(e)}insertFile(e){return this.composition.insertFile(e)}insertFiles(e){return this.composition.insertFiles(e)}insertHTML(e){return this.composition.insertHTML(e)}insertString(e){return this.composition.insertString(e)}insertText(e){return this.composition.insertText(e)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(e){const t=this.getDocument().locationRangeFromRange([e,e+1]);return this.selectionManager.getClientRectAtLocationRange(t)}expandSelectionInDirection(e){return this.composition.expandSelectionInDirection(e)}moveCursorInDirection(e){return this.composition.moveCursorInDirection(e)}setSelectedRange(e){return this.composition.setSelectedRange(e)}activateAttribute(e){let t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.composition.setCurrentAttribute(e,t)}attributeIsActive(e){return this.composition.hasCurrentAttribute(e)}canActivateAttribute(e){return this.composition.canSetCurrentAttribute(e)}deactivateAttribute(e){return this.composition.removeCurrentAttribute(e)}setHTMLAtributeAtPosition(e,t,n){this.composition.setHTMLAtributeAtPosition(e,t,n)}canDecreaseNestingLevel(){return this.composition.canDecreaseNestingLevel()}canIncreaseNestingLevel(){return this.composition.canIncreaseNestingLevel()}decreaseNestingLevel(){if(this.canDecreaseNestingLevel())return this.composition.decreaseNestingLevel()}increaseNestingLevel(){if(this.canIncreaseNestingLevel())return this.composition.increaseNestingLevel()}canRedo(){return this.undoManager.canRedo()}canUndo(){return this.undoManager.canUndo()}recordUndoEntry(e){let{context:t,consolidatable:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.undoManager.recordUndoEntry(e,{context:t,consolidatable:n})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class Tk{constructor(e){this.element=e}findLocationFromContainerAndOffset(e,t){let{strict:n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{strict:!0},r=0,s=!1;const o={index:0,offset:0},l=this.findAttachmentElementParentForNode(e);l&&(e=l.parentNode,t=Hh(l));const a=vu(this.element,{usingFilter:Qk});for(;a.nextNode();){const c=a.currentNode;if(c===e&&Zl(e)){mo(c)||(o.offset+=t);break}if(c.parentNode===e){if(r++===t){!n&&Jh(c,{strict:n})&&(s&&o.index++,o.offset=0,s=!0);break}}else if(!ws(e,c)&&r>0)break;Jh(c,{strict:n})?(s&&o.index++,o.offset=0,s=!0):o.offset+=gf(c)}return o}findContainerAndOffsetFromLocation(e){let t,n;if(e.index===0&&e.offset===0){for(t=this.element,n=0;t.firstChild;)if(t=t.firstChild,Kh(t)){n=1;break}return[t,n]}let[r,s]=this.findNodeAndOffsetFromLocation(e);if(r){if(Zl(r))gf(r)===0?(t=r.parentNode.parentNode,n=Hh(r.parentNode),mo(r,{name:"right"})&&n++):(t=r,n=e.offset-s);else{if(t=r.parentNode,!Jh(r.previousSibling)&&!Kh(t))for(;r===t.lastChild&&(r=t,t=t.parentNode,!Kh(t)););n=Hh(r),e.offset!==0&&n++}return[t,n]}}findNodeAndOffsetFromLocation(e){let t,n,r=0;for(const s of this.getSignificantNodesForIndex(e.index)){const o=gf(s);if(e.offset<=r+o)if(Zl(s)){if(t=s,n=r,e.offset===n&&mo(t))break}else t||(t=s,n=r);if(r+=o,r>e.offset)break}return[t,n]}findAttachmentElementParentForNode(e){for(;e&&e!==this.eleme
Line truncated
|
||||
`]):(e=Rd(n),t=Rd(r));const s=e.filter((l,a)=>l!==t[a]).map(kl),o=t.filter((l,a)=>l!==e[a]).map(kl);return{additions:s,deletions:o}}getTextChangesFromCharacterData(){let e,t;const n=this.getMutationsByType("characterData");if(n.length){const r=n[0],s=n[n.length-1],o=function(l,a){let c,u;return l=sa.box(l),(a=sa.box(a)).length<l.length?[u,c]=V1(l,a):[c,u]=V1(a,l),{added:c,removed:u}}(kl(r.oldValue),kl(s.target.data));e=o.added,t=o.removed}return{additions:e?[e]:[],deletions:t?[t]:[]}}}const Rd=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const e=[];for(const t of Array.from(i))switch(t.nodeType){case Node.TEXT_NODE:e.push(t.data);break;case Node.ELEMENT_NODE:kn(t)==="br"?e.push(`
|
||||
`):e.push(...Array.from(Rd(t.childNodes)||[]))}return e};class Nk extends yu{constructor(e){super(...arguments),this.file=e}perform(e){const t=new FileReader;return t.onerror=()=>e(!1),t.onload=()=>{t.onerror=null;try{t.abort()}catch{}return e(!0,this.file)},t.readAsArrayBuffer(this.file)}}class I4{constructor(e){this.element=e}shouldIgnore(e){return!!Da.samsungAndroid&&(this.previousEvent=this.event,this.event=e,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode)}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar()&&N4(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&this.event.inputType!=="insertText"&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var e;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&((e=this.event.data)===null||e===void 0?void 0:e.length)>50}isBeforeInputInsertText(){return this.event.type==="beforeinput"&&this.event.inputType==="insertText"}previousEventWasUnidentifiedKeydown(){var e,t;return((e=this.previousEvent)===null||e===void 0?void 0:e.type)==="keydown"&&((t=this.previousEvent)===null||t===void 0?void 0:t.key)==="Unidentified"}}const N4=(i,e)=>d0(i)===d0(e),Z4=new RegExp("(".concat("","|").concat(oh,"|").concat(Rr,"|\\s)+"),"g"),d0=i=>i.replace(Z4," ").trim();class ch extends Kt{constructor(e){super(...arguments),this.element=e,this.mutationObserver=new Ik(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new I4(this.element);for(const t in this.constructor.events)Zt(t,{onElement:this.element,withCallback:this.handlerFor(t)})}elementDidMutate(e){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidRequestRender)===null||t===void 0?void 0:t.call(e)}requestReparse(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidRequestReparse)===null||t===void 0||t.call(e),this.requestRender()}attachFiles(e){const t=Array.from(e).map(n=>new Nk(n));return Promise.all(t).then(n=>{this.handleInput(function(){var r,s;return(r=this.delegate)===null||r===void 0||r.inputControllerWillAttachFiles(),(s=this.responder)===null||s===void 0||s.insertFiles(n),this.requestRender()})})}handlerFor(e){return t=>{t.defaultPrevented||this.handleInput(()=>{if(!Gm(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(t))return;this.eventName=e,this.constructor.events[e].call(this,t)}})}}handleInput(e){try{var t;(t=this.delegate)===null||t===void 0||t.inputControllerWillHandleInput(),e.call(this)}finally{var n;(n=this.delegate)===null||n===void 0||n.inputControllerDidHandleInput()}}createLinkHTML(e,t){const n=document.createElement("a");return n.href=e,n.textContent=t||e,n.outerHTML}}var vf;gn(ch,"events",{});const{browser:B4,keyNames:Zk}=$a;let W4=0;class ir extends ch{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(const t in e){const n=e[t];this.inputSummary[t]=n}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),Qs.reset()}elementDidMutate(e){var t,n;return this.isComposing()?(t=this.delegate)===null||t===void 0||(n=t.inputControllerDidAllowUnhandledInput)===null||n===void 0?void 0:n.call(t):this.handleInput(function(){return this.mutationIsSignificant(e)&&(this.mutationIsExpected(e)?this.requestRender():this.requestReparse()),this.reset()})}mutationIsExpected(e){let{textAdded:t,textDeleted:n}=e;if(this.inputSummary.preferDocument)return!0;const r=t!=null?t===this.inputSummary.textAdded:!this.inputSummary.textAdded,s=n!=null?this.inputSummary.didDelete:!this.inputSummary.didDelete,o=[`
|
||||
`,`
|
||||
`].includes(t)&&!r,l=n===`
|
||||
`&&!s;if(o&&!l||l&&!o){const c=this.getSelectedRange();if(c){var a;const u=o?t.replace(/\n$/,"").length||-1:(t==null?void 0:t.length)||1;if((a=this.responder)!==null&&a!==void 0&&a.positionIsBlockBreak(c[1]+u))return!0}}return r&&s}mutationIsSignificant(e){var t;const n=Object.keys(e).length>0,r=((t=this.compositionInput)===null||t===void 0?void 0:t.getEndData())==="";return n||!r}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new Ar(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(e,t){var n;return((n=this.responder)===null||n===void 0?void 0:n.deleteInDirection(e))!==!1?this.setInputSummary({didDelete:!0}):t?(t.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(e){var t;if(!function(r){if(r==null||!r.setData)return!1;for(const s in F1){const o=F1[s];try{if(r.setData(s,o),!r.getData(s)===o)return!1}catch{return!1}}return!0}(e))return;const n=(t=this.responder)===null||t===void 0?void 0:t.getSelectedDocument().toSerializableDocument();return e.setData("application/x-trix-document",JSON.stringify(n)),e.setData("text/html",ah.render(n).innerHTML),e.setData("text/plain",n.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(e){const t={};return Array.from((e==null?void 0:e.types)||[]).forEach(n=>{t[n]=!0}),t.Files||t["application/x-trix-document"]||t["text/html"]||t["text/plain"]}getPastedHTMLUsingHiddenElement(e){const t=this.getSelectedRange(),n={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},r=Ge({style:n,tagName:"div",editable:!0});return document.body.appendChild(r),r.focus(),requestAnimationFrame(()=>{const s=r.innerHTML;return zr(r),this.setSelectedRange(t),e(s)})}}gn(ir,"events",{keydown(i){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;const e=Zk[i.keyCode];if(e){var t;let r=this.keys;["ctrl","alt","shift","meta"].forEach(s=>{var o;i["".concat(s,"Key")]&&(s==="ctrl"&&(s="control"),r=(o=r)===null||o===void 0?void 0:o[s])}),((t=r)===null||t===void 0?void 0:t[e])!=null&&(this.setInputSummary({keyName:e}),Qs.reset(),r[e].call(this,i))}if(ok(i)){const r=String.fromCharCode(i.keyCode).toLowerCase();if(r){var n;const s=["alt","shift"].map(o=>{if(i["".concat(o,"Key")])return o}).filter(o=>o);s.push(r),(n=this.delegate)!==null&&n!==void 0&&n.inputControllerDidReceiveKeyboardCommand(s)&&i.preventDefault()}}},keypress(i){if(this.inputSummary.eventName!=null||i.metaKey||i.ctrlKey&&!i.altKey)return;const e=Y4(i);var t,n;return e?((t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.insertString(e),this.setInputSummary({textAdded:e,didDelete:this.selectionIsExpanded()})):void 0},textInput(i){const{data:e}=i,{textAdded:t}=this.inputSummary;if(t&&t!==e&&t.toUpperCase()===e){var n;const r=this.getSelectedRange();return this.setSelectedRange([r[0],r[1]+t.length]),(n=this.responder)===null||n===void 0||n.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(r)}},dragenter(i){i.preventDefault()},dragstart(i){var e,t;return this.serializeSelectionToDataTransfer(i.dataTransfer),this.draggedRange=this.getSelectedRange(),(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidStartDrag)===null||t===void 0?void 0:t.call(e)},dragover(i){if(this.draggedRange||this.canAcceptDataTransfer(i.dataTransfer)){i.preventDefault();const n={x:i.clientX,y:i.clientY};var e,t;if(!Fo(n,this.draggingPoint))return this.draggingPoint=n,(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidReceiveDragOverPoint)===null||t===void 0?void 0:t.call(e,this.draggingPoint)}},dragend(i){var e,t;(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidCancelDrag)===null||t===void 0||t.call(e),this.draggedRange=null,this.draggingPoint=null},drop(i){var e,t;i.preventDefault();const n=(e=i.dataTransfer)===null||e===void 0?void 0:e.files,r=i.dataTransfer.getData("application/x-trix-document"),s={x:i.clientX,y:i.clientY};if((t=this.responder)===null||t===void 0||t.setLocationRangeFromPointRange(s),n!=null&&n.length)this.attachFiles(n);else if(this.draggedRange){var o,l;(o=this.delegate)===null||o===void 0||o.inputControllerWillMoveText(),(l=this.responder)===null||l===void 0||l.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()}else if(r){var a;const c=si.fromJSONString(r);(a=this.responder)===null||a===void 0||a.insertDocument(c),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(i){var e,t;if((e=this.responder)!==null&&e!==void 0&&e.selectionIsExpanded()&&(this.serializeSelectionToDataTransfer(i.clipboardData)&&i.preventDefault(),(t=this.delegate)===null||t===void 0||t.inputControllerWillCutText(),this.deleteInDirection("backward"),i.defaultPrevented))return this.requestRender()},copy(i){var e;(e=this.responder)!==null&&e!==void 0&&e.selectionIsExpanded()&&this.serializeSelectionToDataTransfer
Line truncated
|
||||
`,{updatePosition:!1}),this.requestRender()}},shift:{return(i){var e,t;(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(t=this.responder)===null||t===void 0||t.insertString(`
|
||||
`),this.requestRender(),i.preventDefault()},tab(i){var e,t;(e=this.responder)!==null&&e!==void 0&&e.canDecreaseNestingLevel()&&((t=this.responder)===null||t===void 0||t.decreaseNestingLevel(),this.requestRender(),i.preventDefault())},left(i){if(this.selectionIsInCursorTarget())return i.preventDefault(),this.expandSelectionInDirection("backward")},right(i){if(this.selectionIsInCursorTarget())return i.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(i){var e;return this.setInputSummary({preferDocument:!1}),(e=this.delegate)===null||e===void 0?void 0:e.inputControllerWillPerformTyping()}},meta:{backspace(i){var e;return this.setInputSummary({preferDocument:!1}),(e=this.delegate)===null||e===void 0?void 0:e.inputControllerWillPerformTyping()}}}),ir.proxyMethod("responder?.getSelectedRange"),ir.proxyMethod("responder?.setSelectedRange"),ir.proxyMethod("responder?.expandSelectionInDirection"),ir.proxyMethod("responder?.selectionIsInCursorTarget"),ir.proxyMethod("responder?.selectionIsExpanded");const X4=i=>{var e;return(e=i.type)===null||e===void 0||(e=e.match(/\/(\w+)$/))===null||e===void 0?void 0:e[1]},F4=!((vf=" ".codePointAt)===null||vf===void 0||!vf.call(" ",0)),Y4=function(i){if(i.key&&F4&&i.key.codePointAt(0)===i.keyCode)return i.key;{let e;if(i.which===null?e=i.keyCode:i.which!==0&&i.charCode!==0&&(e=i.charCode),e!=null&&Zk[e]!=="escape")return sa.fromCodepoints([e]).toString()}},z4=function(i){const e=i.clipboardData;if(e){if(e.types.includes("text/html")){for(const t of e.types){const n=/^CorePasteboardFlavorType/.test(t),r=/^dyn\./.test(t)&&e.getData(t);if(n||r)return!0}return!1}{const t=e.types.includes("com.apple.webarchive"),n=e.types.includes("com.apple.flat-rtfd");return t||n}}};class Ar extends Kt{constructor(e){super(...arguments),this.inputController=e,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(e){if(this.data.start=e,this.isSignificant()){var t,n;this.inputSummary.eventName==="keypress"&&this.inputSummary.textAdded&&((n=this.responder)===null||n===void 0||n.deleteInDirection("left")),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=(t=this.responder)===null||t===void 0?void 0:t.getSelectedRange()}}update(e){if(this.data.update=e,this.isSignificant()){const t=this.selectPlaceholder();t&&(this.forgetPlaceholder(),this.range=t)}}end(e){return this.data.end=e,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.setSelectedRange(this.range),(r=this.responder)===null||r===void 0||r.insertString(this.data.end),(s=this.responder)===null||s===void 0?void 0:s.setSelectedRange(this.range[0]+this.data.end.length)):this.data.start!=null||this.data.update!=null?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset();var t,n,r,s}getEndData(){return this.data.end}isEnded(){return this.getEndData()!=null}isSignificant(){return!B4.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var e,t;return((e=this.data.start)===null||e===void 0?void 0:e.length)===0&&((t=this.data.end)===null||t===void 0?void 0:t.length)>0&&this.range}}Ar.proxyMethod("inputController.setInputSummary"),Ar.proxyMethod("inputController.requestRender"),Ar.proxyMethod("inputController.requestReparse"),Ar.proxyMethod("responder?.selectionIsExpanded"),Ar.proxyMethod("responder?.insertPlaceholder"),Ar.proxyMethod("responder?.selectPlaceholder"),Ar.proxyMethod("responder?.forgetPlaceholder");class Xl extends ch{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){return this.scheduledRender?this.composing?(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidAllowUnhandledInput)===null||t===void 0?void 0:t.call(e):void 0:this.reparse();var e,t}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var e,t;cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||(t=this.delegate)===null||t===void 0||t.render(),(e=this.afterRender)===null||e===void 0||e.call(this),this.afterRender=null}reparse(){var e;return(e=this.delegate)===null||e===void 0?void 0:e.reparse()}insertString(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var r;return(r=this.responder)===null||r===void 0?void 0:r.insertString(t,n)})}toggleAttributeIfSupported(e){var t;if(Pd().includes(e))return(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformFormatting(e),this.withTargetDOMRange(function(){var n;return(n=this.responder)===nul
Line truncated
|
||||
`)},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var i;return(i=this.delegate)===null||i===void 0||i.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.insertLineBreak()})},insertReplacementText(){const i=this.event.dataTransfer.getData("text/plain"),e=this.event.getTargetRanges()[0];this.withTargetDOMRange(e,()=>{this.insertString(i,{updatePosition:!1})})},insertText(){var i;return this.insertString(this.event.data||((i=this.event.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});const V4=function(i){const e=document.createRange();return e.setStart(i.startContainer,i.startOffset),e.setEnd(i.endContainer,i.endOffset),e},wf=i=>{var e;return Array.from(((e=i.dataTransfer)===null||e===void 0?void 0:e.types)||[]).includes("Files")},U4=i=>{var e;return((e=i.dataTransfer.files)===null||e===void 0?void 0:e[0])&&!Bk(i)&&!(t=>{let{dataTransfer:n}=t;return n.types.includes("Files")&&n.types.includes("text/html")&&n.getData("text/html").includes("urn:schemas-microsoft-com:office:office")})(i)},Bk=function(i){const e=i.clipboardData;if(e)return Array.from(e.types).filter(t=>t.match(/file/i)).length===e.types.length&&e.files.length>=1},j4=function(i){const e=i.clipboardData;if(e)return e.types.includes("text/plain")&&e.types.length===1},q4=function(i){const e=[];return i.altKey&&e.push("alt"),i.shiftKey&&e.push("shift"),e.push(i.key),e},yf=i=>({x:i.clientX,y:i.clientY}),Dd="[data-trix-attribute]",$d="[data-trix-action]",G4="".concat(Dd,", ").concat($d),uh="[data-trix-dialog]",H4="".concat(uh,"[data-trix-active]"),K4="".concat(uh," [data-trix-method]"),m0="".concat(uh," [data-trix-input]"),p0=(i,e)=>(e||(e=Js(i)),i.querySelector("[data-trix-input][name='".concat(e,"']"))),g0=i=>i.getAttribute("data-trix-action"),Js=i=>i.getAttribute("data-trix-attribute")||i.getAttribute("data-trix-dialog-attribute");class Wk extends Kt{constructor(e){super(e),this.didClickActionButton=this.didClickActionButton.bind(this),this.didClickAttributeButton=this.didClickAttributeButton.bind(this),this.didClickDialogButton=this.didClickDialogButton.bind(this),this.didKeyDownDialogInput=this.didKeyDownDialogInput.bind(this),this.element=e,this.attributes={},this.actions={},this.resetDialogInputs(),Zt("mousedown",{onElement:this.element,matchingSelector:$d,withCallback:this.didClickActionButton}),Zt("mousedown",{onElement:this.element,matchingSelector:Dd,withCallback:this.didClickAttributeButton}),Zt("click",{onElement:this.element,matchingSelector:G4,preventDefault:!0}),Zt("click",{onElement:this.element,matchingSelector:K4,withCallback:this.didClickDialogButton}),Zt("keydown",{onElement:this.element,matchingSelector:m0,withCallback:this.didKeyDownDialogInput})}didClickActionButton(e,t){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),e.preventDefault();const r=g0(t);return this.getDialog(r)?this.toggleDialog(r):(s=this.delegate)===null||s===void 0?void 0:s.toolbarDidInvokeAction(r,t);var s}didClickAttributeButton(e,t){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),e.preventDefault();const r=Js(t);var s;return this.getDialog(r)?this.toggleDialog(r):(s=this.delegate)===null||s===void 0||s.toolbarDidToggleAttribute(r),this.refreshAttributeButtons()}didClickDialogButton(e,t){const n=Yr(t,{matchingSelector:uh});return this[t.getAttribute("data-trix-method")].call(this,n)}didKeyDownDialogInput(e,t){if(e.keyCode===13){e.preventDefault();const n=t.getAttribute("name"),r=this.getDialog(n);this.setAttribute(r)}if(e.keyCode===27)return e.preventDefault(),this.hideDialog()}updateActions(e){return this.actions=e,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton((e,t)=>{e.disabled=this.actions[t]===!1})}eachActionButton(e){return Array.from(this.element.querySelectorAll($d)).map(t=>e(t,g0(t)))}updateAttributes(e){return this.attributes=e,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton((e,t)=>(e.disabled=this.attributes[t]===!1,this.attributes[t]||this.dialogIsVisible(t)?(e.setAttribute("data-trix-active",""),e.classList.add("trix-active")):(e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"))))}eachAttributeButton(e){return Array.from(this.element.querySelectorAll(Dd)).map(t=>e(t,Js(t)))}applyKeyboardCommand(e){const t=JSON.stringify(e.sort());for(const n of Array.from(this.element.querySelectorAll("[data-trix-key]"))){const r=n.getAttribute("data-trix-key").split("+");if(JSON.stringify(r.sort())===t)return Il("mousedown",{onElement:n}),!0}return!1}dialogIsVisible(e){const t=this.getDialog(e);if(t)return t.hasAttribute("data-trix-active")}toggleDialog(e){return this.dialogIsVisibl
Line truncated
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog][data-trix-active] {
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog] [data-trix-validate]:invalid {
|
||||
background-color: #ffdddd;
|
||||
}`);class Xk extends HTMLElement{connectedCallback(){this.innerHTML===""&&(this.innerHTML=ik.getDefaultHTML())}get editorElements(){if(this.id){var e;const t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll('trix-editor[toolbar="'.concat(this.id,'"]'));return Array.from(t)}return[]}get editorElement(){const[e]=this.editorElements;return e}}let nD=0;const iD=function(i){if(!i.hasAttribute("contenteditable"))return i.toggleAttribute("contenteditable",!i.disabled),function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.times=1,Zt(e,t)}("focus",{onElement:i,withCallback:()=>rD(i)})},rD=function(i){return sD(i),oD()},sD=function(i){var e,t;if((e=(t=document).queryCommandSupported)!==null&&e!==void 0&&e.call(t,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),Zt("mscontrolselect",{onElement:i,preventDefault:!0})},oD=function(i){var e,t;if((e=(t=document).queryCommandSupported)!==null&&e!==void 0&&e.call(t,"DefaultParagraphSeparator")){const{tagName:n}=Sn.default;if(["div","p"].includes(n))return document.execCommand("DefaultParagraphSeparator",!1,n)}},O0=Da.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};rk("trix-editor",`%t {
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t:empty::before {
|
||||
content: attr(placeholder);
|
||||
color: graytext;
|
||||
cursor: text;
|
||||
pointer-events: none;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
%t a[contenteditable=false] {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
%t img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
%t `.concat(_s,` figcaption textarea {
|
||||
resize: none;
|
||||
}
|
||||
|
||||
%t `).concat(_s,` figcaption textarea.trix-autoresize-clone {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
max-height: 0px;
|
||||
}
|
||||
|
||||
%t `).concat(_s,` figcaption[data-trix-placeholder]:empty::before {
|
||||
content: attr(data-trix-placeholder);
|
||||
color: graytext;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target] {
|
||||
display: `).concat(O0.display,` !important;
|
||||
width: `).concat(O0.width,` !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target=left] {
|
||||
vertical-align: top !important;
|
||||
margin-left: -1px !important;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target=right] {
|
||||
vertical-align: bottom !important;
|
||||
margin-right: -1px !important;
|
||||
}`));var wi=new WeakMap,ac=new WeakMap,cl=new WeakSet;class lD{constructor(e){var t,n;wk(t=this,n=cl),n.add(t),gn(this,"value",""),po(this,wi,{writable:!0,value:void 0}),po(this,ac,{writable:!0,value:void 0}),this.element=e,Wl(this,wi,e.attachInternals()),Wl(this,ac,!1)}connectedCallback(){lc(this,cl,cc).call(this)}disconnectedCallback(){}get form(){return it(this,wi).form}get name(){return this.element.getAttribute("name")}set name(e){this.element.setAttribute("name",e)}get labels(){return it(this,wi).labels}get disabled(){return it(this,ac)||this.element.hasAttribute("disabled")}set disabled(e){this.element.toggleAttribute("disabled",e)}get required(){return this.element.hasAttribute("required")}set required(e){this.element.toggleAttribute("required",e),lc(this,cl,cc).call(this)}get validity(){return it(this,wi).validity}get validationMessage(){return it(this,wi).validationMessage}get willValidate(){return it(this,wi).willValidate}formDisabledCallback(e){Wl(this,ac,e)}setFormValue(e){this.value=e,lc(this,cl,cc).call(this),it(this,wi).setFormValue(this.element.disabled?void 0:this.value)}checkValidity(){return it(this,wi).checkValidity()}reportValidity(){return it(this,wi).reportValidity()}setCustomValidity(e){lc(this,cl,cc).call(this,e)}}function cc(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const{required:e,value:t}=this.element,n=e&&!t,r=!!i,s=Ge("input",{required:e}),o=i||s.validationMessage;it(this,wi).setValidity({valueMissing:n,customError:r},o)}var kf=new WeakMap,Sf=new WeakMap,_f=new WeakMap;class aD{constructor(e){po(this,kf,{writable:!0,value:void 0}),po(this,Sf,{writable:!0,value:t=>{t.defaultPrevented||t.target===this.element.form&&this.element.reset()}}),po(this,_f,{writable:!0,value:t=>{if(t.defaultPrevented||this.element.contains(t.target))return;const n=Yr(t.target,{matchingSelector:"label"});n&&Array.from(this.labels).includes(n)&&this.element.focus()}}),this.element=e}connectedCallback(){Wl(this,kf,function(e){if(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby"))return;const t=function(){const n=Array.from(e.labels).map(s=>{if(!s.contains(e))return s.textContent}).filter(s=>s),r=n.join(" ");return r?e.setAttribute("aria-label",r):e.removeAttribute("aria-label")};return t(),Zt("focus",{onElement:e,withCallback:t})}(this.element)),window.addEventListener("reset",it(this,Sf),!1),window.addEventListener("click",it(this,_f),!1)}disconnectedCallback(){var e;(e=it(this,kf))===null||e===void 0||e.destroy(),window.removeEventListener("reset",it(this,Sf),!1),window.removeEventListener("click",it(this,_f),!1)}get labels(){const e=[];this.element.id&&this.element.ownerDocument&&e.push(...Array.from(this.element.ownerDocument.querySelectorAll("label[for='".concat(this.element.id,"']"))||[]));const t=Yr(this.element,{matchingSelector:"label"});return t&&[this.element,null].includes(t.control)&&e.push(t),e}get form(){return console.warn("This browser does not support the .form property for trix-editor elements."),null}get name(){return console.warn("This browser does not support the .name property for trix-editor elements."),null}set name(e){console.warn("This browser does not support the .name property for trix-editor elements.")}get disabled(){return console.warn("This browser does not support the [disabled] attribute for trix-editor elements."),!1}set disabled(e){console.warn("This browser does not support the [disabled] attribute for trix-editor elements.")}get required(){return console.warn("This browser does not support the [required] attribute for trix-editor elements."),!1}set required(e){console.warn("This browser does not support the [required] attribute for trix-editor elements.")}get validity(){return console.warn("This browser does not support the validity property for trix-editor elements."),null}get validationMessage(){return console.warn("This browser does not support the validationMessage property for trix-editor elements."),""}get willValidate(){return console.warn("This browser does not support the willValidate property for trix-editor elements."),!1}formDisabledCallback(e){}setFormValue(e){}checkValidity(){return console.warn("This browser does not support checkValidity() for trix-editor elements."),!0}reportValidity(){return console.warn("This browser does not support reportValidity() for trix-editor elements."),!0}setCustomValidity(e){console.warn("This browser does not support setCustomValidity(validationMessage) for trix-editor elements.")}}var Xt=new WeakMap;class Su extends HTMLElement{constructor(){super(),po(this,Xt,{writable:!0,value:void 0}),this.willCreateInput=!0,Wl(this,Xt,this.constructor.formAssociated?new lD(this):new aD(this))}get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++nD),this.trixId)}get labels(){return it(this,Xt).labels}get disabled(){const{inputElement:e}=this;return e?e.disabled:it(this,Xt).disabled}set disabled(e){const{inputElement:t}=this;t&&(t.disabled=e
Line truncated
|
||||
`){[e,t]=To(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=n),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new Ft(n,r)),n=[],r=-1);return r>-1&&t.push(new Ft(n,r)),t}}class Ni extends at{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,r);r=l+1,n=a+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let c=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!c?n.push(l):l.decompose(e-o,t-o,n,c)}o=a+1}}replace(e,t,n){if([e,t]=To(this,e,t),n.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,n),c=this.lines-o.lines+a.lines;if(a.lines<c>>4&&a.lines>c>>6){let u=this.children.slice();return u[r]=a,new Ni(u,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
||||
`){[e,t]=To(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=n),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ni))return 0;let n=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return n;let a=this.children[r],c=e.children[s];if(a!=c)return n+a.scanIdentical(c,t);n+=a.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let m of e)m.flatten(d);return new Ft(d,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,c=-1,u=[];function h(d){let m;if(d.lines>s&&d instanceof Ni)for(let p of d.children)h(p);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof Ft&&a&&(m=u[u.length-1])instanceof Ft&&d.lines+m.lines<=32?(a+=d.lines,c+=d.length+1,u[u.length-1]=new Ft(m.text.concat(d.text),m.length+1+d.length)):(a+d.lines>r&&f(),a+=d.lines,c+=d.length+1,u.push(d))}function f(){a!=0&&(l.push(u.length==1?u[0]:Ni.from(u,c)),c=-1,a=u.length=0)}for(let d of e)h(d);return f(),l.length==1?l[0]:new Ni(l,t)}}at.empty=new Ft([""],0);function mD(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Vc(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s<i.length&&r<=n;s++){let l=i[s],a=r+l.length;a>=t&&(a>n&&(l=l.slice(0,n-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function v0(i,e,t){return Vc(i,[""],e,t)}class Yl{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 Ft?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof Ft?r.text.length:r.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(r instanceof Ft){let a=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Ft?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Yk{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Yl(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),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 zk{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(at.prototype[Symbol.iterator]=function(){return this.iter()},Yl.prototype[Symbol.iterator]=Yk.prototype[Symbol.iterator]=zk.prototype[Symbol.iterator]=function(){return this});let pD=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function To(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}let go="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(i=>i?parseInt(i,36):1);for(let i=1;i<go.length;i++)go[i]+=go[i-1];function gD(i){for(let e=1;e<go.length;e+=2)if(go[e]>i)return go[e-1]<=i;return!1}function w0(i){return i>=127462&&i<=127487}const y0=8205;function hn(i,e,t=!0,n=!0){return(t?Vk:OD)(i,e,n)}function Vk(i,e,t){if(e==i.length)return e;e&&Uk(i.charCodeAt(e))&&jk(i.charCodeAt(e-1))&&e--;let n=ln(i,e);for(e+=oi(n);e<i.length;){let r=ln(i,e);if(n==y0||r==y0||t&&gD(r))e+=oi(r),n=r;else if(w0(r)){let s=0,o=e-2;for(;o>=0&&w0(ln(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function OD(i,e,t){for(;e>0;){let n=Vk(i,e-2,t);if(n<e)return n;e--}return 0}function Uk(i){return i>=56320&&i<57344}function jk(i){return i>=55296&&i<56320}function ln(i,e){let t=i.charCodeAt(e);if(!jk(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Uk(n)?(t-55296<<10)+(n-56320)+65536:t}function sp(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function oi(i){return i<65536?1:2}const Ld=/\r\n?|\n/;var cn=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(cn||(cn={}));class ji{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 n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,s),r+=s):r+=o,n+=s}}iterChangedRan
Line truncated
|
||||
`}get readOnly(){return this.facet(iS)}phrase(e,...t){for(let n of this.facet(et.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let s of this.facet(Kk))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return xD(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=hn(t,o,!1);if(s(t.slice(a,o))!=$t.Word)break;o=a}for(;l<r;){let a=hn(t,l);if(s(t.slice(l,a))!=$t.Word)break;l=a}return o==l?null:q.range(o+n,l+n)}}et.allowMultipleSelections=Wd;et.tabSize=ye.define({combine:i=>i.length?i[0]:4});et.lineSeparator=Jk;et.readOnly=iS;et.phrases=ye.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(r=>i[r]==e[r])}});et.languageData=Kk;et.changeFilter=eS;et.transactionFilter=tS;et.transactionExtender=nS;Vr.reconfigure=Fe.define();function Qi(i,e,t={}){let n={};for(let r of i)for(let s of Object.keys(r)){let o=r[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}class Ms{eq(e){return this==e}range(e,t=e){return Yd.create(e,t,this)}}Ms.prototype.startSide=Ms.prototype.endSide=0;Ms.prototype.point=!1;Ms.prototype.mapMode=cn.TrackDel;let Yd=class oS{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new oS(e,t,n)}};function zd(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class ap{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let s=n?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,c=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return c>=0?o:l;c>=0?l=a:o=a+1}}between(e,t,n,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let c=this.value[a],u=this.from[a]+e,h=this.to[a]+e,f,d;if(u==h){let m=t.mapPos(u,c.startSide,c.mapMode);if(m==null||(f=d=m,c.startSide!=c.endSide&&(d=t.mapPos(u,c.endSide),d<f)))continue}else if(f=t.mapPos(u,c.startSide),d=t.mapPos(h,c.endSide),f>d||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(l=Math.max(l,d-f)),n.push(c),r.push(f-o),s.push(d-o))}return{mapped:n.length?new ap(r,s,n,l):null,pos:o}}}class tt{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new tt(e,t,n,r)}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:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(zd)),this.isEmpty)return t.length?tt.of(t):this;let l=new lS(this,null,-1).goto(0),a=0,c=[],u=new Ur;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let h=t[a++];u.addInner(h.from,h.to,h.value)||c.push(h)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&u.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(u.addInner(l.from,l.to,l.value)||c.push(Yd.create(l.from,l.to,l.value))),l.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?tt.empty:this.nextLayer.update({add:c,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],c=e.touchesRange(l,l+a.length);if(c===!1)r=Math.max(r,a.maxPoint),t.push(a),n.push(e.mapPos(l));else if(c===!0){let{mapped:u,pos:h}=a.map(l,e);u&&(r=Math.max(r,u.maxPoint),t.push(u),n.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new tt(n,t,s||tt.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return aa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return aa.from(e).goto(t)}static compare(e,t,n,r,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=_0(o,l,n)
Line truncated
|
||||
`)}static newName(){let e=x0[A0]||1;return x0[A0]=e+1,jd+e.toString(36)}static mount(e,t,n){let r=e[qd],s=n&&n.nonce;r?s&&r.setNonce(s):r=new QD(e,s),r.mount(Array.isArray(t)?t:[t],e)}}let T0=new Map;class QD{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=T0.get(n);if(s)return e[qd]=s;this.sheet=new r.CSSStyleSheet,T0.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[qd]=this}mount(e,t){let n=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let c=0;c<l.rules.length;c++)n.insertRule(l.rules[c],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
||||
`;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var qr={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:"'"},ca={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},MD=typeof navigator<"u"&&/Mac/.test(navigator.platform),ED=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var an=0;an<10;an++)qr[48+an]=qr[96+an]=String(an);for(var an=1;an<=24;an++)qr[an+111]="F"+an;for(var an=65;an<=90;an++)qr[an]=String.fromCharCode(an+32),ca[an]=String.fromCharCode(an);for(var Pf in qr)ca.hasOwnProperty(Pf)||(ca[Pf]=qr[Pf]);function RD(i){var e=MD&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||ED&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?ca:qr)[i.keyCode]||i.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 ua(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function Gd(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function DD(i){let e=i.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function jc(i,e){if(!e.anchorNode)return!1;try{return Gd(i,e.anchorNode)}catch{return!1}}function ha(i){return i.nodeType==3?Rs(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Vl(i,e,t,n){return t?Q0(i,e,t,n,-1)||Q0(i,e,t,n,1):!1}function Es(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Pu(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Q0(i,e,t,n,r){for(;;){if(i==t&&e==n)return!0;if(e==(r<0?0:dr(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=Es(i)+(r<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[e+(r<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=r<0?dr(i):0}else return!1}}function dr(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function hh(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function $D(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function aS(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function LD(i,e,t,n,r,s,o,l){let a=i.ownerDocument,c=a.defaultView||window;for(let u=i,h=!1;u&&!h;)if(u.nodeType==1){let f,d=u==a.body,m=1,p=1;if(d)f=$D(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let w=u.getBoundingClientRect();({scaleX:m,scaleY:p}=aS(u,w)),f={left:w.left,right:w.left+u.clientWidth*m,top:w.top,bottom:w.top+u.clientHeight*p}}let g=0,v=0;if(r=="nearest")e.top<f.top?(v=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+v&&(v=e.bottom-f.bottom+v+o)):e.bottom>f.bottom&&(v=e.bottom-f.bottom+o,t<0&&e.top-v<f.top&&(v=-(f.top+v-e.top+o)));else{let w=e.bottom-e.top,S=f.bottom-f.top;v=(r=="center"&&w<=S?e.top+w/2-S/2:r=="start"||r=="center"&&t<0?e.top-o:e.bottom-S+o)-f.top}if(n=="nearest"?e.left<f.left?(g=-(f.left-e.left+s),t>0&&e.right>f.right+g&&(g=e.right-f.right+g+s)):e.right>f.right&&(g=e.right-f.right+s,t<0&&e.left<f.left+g&&(g=-(f.left+g-e.left+s))):g=(n=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:n=="start"==l?e.left-s:e.right-(f.right-f.left)+s)-f.left,g||v)if(d)c.scrollBy(g,v);else{let w=0,S=0;if(v){let _=u.scrollTop;u.scrollTop+=v/p,S=(u.scrollTop-_)*p}if(g){let _=u.scrollLeft;u.scrollLeft+=g/m,w=(u.scrollLeft-_)*m}e={left:e.left-w,top:e.top-S,right:e.right-w,bottom:e.bottom-S},w&&Math.abs(w-g)<1&&(n="nearest"),S&&Math.abs(S-v)<1&&(r="nearest")}if(d)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function ID(i){let e=i.ownerDocument,t,n;for(let r=i.parentNode;r&&!(r==e.body||t&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),!t&&r.scrollWidth>r.clientWidth&&(t=r),r=rLine truncated
|
||||
`,r=i.state.doc.line(r.number+(t?1:-1)),s=i.bidiSpans(r),c=i.visualLineSide(r,!t)}if(a){if(!a(u))return l}else{if(!n)return c;a=n(u)}l=c}}function g5(i,e,t){let n=i.state.charCategorizer(e),r=n(t);return s=>{let o=n(s);return r==$t.Space&&(r=o),r==o}}function O5(i,e,t,n){let r=e.head,s=t?1:-1;if(r==(t?i.state.doc.length:0))return q.cursor(r,e.assoc);let o=e.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),c=i.coordsAtPos(r,e.assoc||-1),u=i.documentTop;if(c)o==null&&(o=c.left-a.left),l=s<0?c.top:c.bottom;else{let d=i.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+u}let h=a.left+o,f=n??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=l+(f+d)*s,p=YS(i,{x:h,y:m},!1,s);if(m<a.top||m>a.bottom||(s<0?p<r:p>r)){let g=i.docView.coordsForChar(p),v=!g||m<g.top?-1:1;return q.cursor(p,v,void 0,o)}}}function qc(i,e,t){for(;;){let n=0;for(let r of i)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=n||t||(e-s<o-e?-1:1);e=a<0?s:o,n=a}});if(!n)return e}}function Qf(i,e,t){let n=qc(i.state.facet(fp).map(r=>r(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:q.cursor(n,n<t.from?1:-1)}const Cl="";class b5{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(et.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Cl}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=r.nextSibling;if(o==t)break;let l=St.get(r),a=St.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Pu(r))||Pu(o)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>s)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=r.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=St.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(v5(e,n.node,n.offset)?t:0))}}function v5(i,e,t){for(;;){if(!e||t<dr(e))return!1;if(e==i)return!0;t=Es(e)+1,e=e.parentNode}}class F0{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class w5{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let l=s||o?[]:S5(e),a=new b5(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=_5(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Gd(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Gd(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=e.viewport;if((ke.ios||ke.chrome)&&e.state.selection.main.empty&&a!=c&&(u.from>0||u.to<e.state.doc.length)){let h=Math.min(a,c),f=Math.max(a,c),d=u.from-h,m=u.to-f;(d==0||d==1||h==0)&&(m==0||m==-1||f==e.state.doc.length)&&(a=0,c=e.state.doc.length)}this.newSel=q.single(c,a)}}}function zS(i,e){let t,{newSel:n}=e,r=i.state.selection.main,s=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=r.from,c=null;(s===8||ke.android&&e.text.length<l-o)&&(a=r.to,c="end");let u=k5(i.state.doc.sliceString(o,l,Cl),e.text,a-o,c);u&&(ke.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Cl+Cl&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:at.of(e.text.slice(u.from,u.toB).split(Cl))})}else n&&(!i.hasFocus&&i.state.facet(Dr)||n.main.eq(r))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!r.empty&&n&&n.main.empty?t={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,r.to)}:t&&t.from>=r.from&&t.to<=r.to&&(t.from!=r.from||t.to!=r.to)&&r.to-r.from-(t.to-t.from)<=4?t={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,r.to))}:(ke.mac||ke.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=q.single(n.main.anchor-
Line truncated
|
||||
`&&i.lineWrapping&&(n&&(n=q.single(n.main.anchor-1,n.main.head-1)),t={from:r.from,to:r.to,insert:at.of([" "])}),t)return dp(i,t,n,s);if(n&&!n.main.eq(r)){let o=!1,l="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function dp(i,e,t,n=-1){if(ke.ios&&i.inputState.flushIOSKey(e))return!0;let r=i.state.selection.main;if(ke.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&bo(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&bo(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&bo(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,l=()=>o||(o=y5(i,e,t));return i.state.facet(ES).some(a=>a(i,e.from,e.to,s,l))||i.dispatch(l()),!0}function y5(i,e,t){let n,r=i.state,s=r.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let l=s.from<e.from?r.sliceDoc(s.from,e.from):"",a=s.to>e.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=r.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(r.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=i.state.sliceDoc(e.from,e.to),u,h=t&&FS(i,t.main.head);if(h){let m=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-m}}else u=i.state.doc.lineAt(s.head);let f=s.to-e.to,d=s.to-s.from;n=r.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:a||m.map(l)};let p=m.to-f,g=p-c.length;if(m.to-m.from!=d||i.state.sliceDoc(g,p)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let v=r.changes({from:g,to:p,insert:e.insert}),w=m.to-s.to;return{changes:v,range:a?q.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):m.map(v)}})}else n={changes:l,selection:a&&r.selection.replaceRange(a)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:o,scrollIntoView:!0})}function k5(i,e,t,n){let r=Math.min(i.length,e.length),s=0;for(;s<r&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&i.length==e.length)return null;let o=i.length,l=e.length;for(;o>0&&l>0&&i.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&i.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function S5(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new F0(t,n)),(r!=t||s!=n)&&e.push(new F0(r,s))),e}function _5(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?q.single(t+e,n+e):null}class C5{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ke.safari&&e.contentDOM.addEventListener("input",()=>null),ke.gecko&&W5(e.contentDOM.ownerDocument)}handleEvent(e){!R5(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,t);for(let r of n.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=P5(e),n=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&US.indexOf(e.keyCode)<0&&(thi
Line truncated
|
||||
`))};s.from==this.from&&r<this.from?s.from=r:s.to==this.to&&r>this.to&&(s.to=r),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||dp(e,s,q.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(o!="None"&&l!="None"){let a=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;r.push(Qe.mark({attributes:{style:a}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:IS.of(Qe.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=ua(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,c)=>{if(n)return;let u=c.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=u,this.to+=u;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=u}t+=u}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class pe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(s=>n(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||ZD(e.parent)||document,this.viewState=new nb(e.state||et.create(e)),e.scrollTo&&e.scrollTo.is(dc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Sl).map(r=>new xf(r));for(let r of this.plugins)r.update(this);this.observer=new t$(this),this.inputState=new C5(this)
Line truncated
|
||||
--\u2028\u2029\uFEFF-]`,gm),S$={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 Rf=null;function _$(){var i;if(Rf==null&&typeof document<"u"&&document.body){let e=document.body.style;Rf=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Rf||!1}const Kc=ye.define({combine(i){let e=Qi(i,{render:null,specialChars:k$,addSpecialChars:null});return(e.replaceTabs=!_$())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,gm)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,gm)),e}});function C$(i={}){return[Kc.of(i),P$()]}let fb=null;function P$(){return fb||(fb=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=Qe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(Kc)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new y$({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:r}=t.state,s=ln(e[0],0);if(s==9){let o=r.lineAt(n),l=t.state.tabSize,a=Ci(o.text,l,n-o.from);return Qe.replace({widget:new Q$((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Qe.replace({widget:new T$(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(Kc);i.startState.facet(Kc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const A$="•";function x$(i){return i>=32?A$:i==10?"":String.fromCharCode(9216+i)}class T$ extends br{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=x$(this.code),n=e.state.phrase("Control character")+" "+(S$[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Q$ extends br{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}}function M$(){return R$}const E$=Qe.line({class:"cm-activeLine"}),R$=Vt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let n of i.state.selection.ranges){let r=i.lineBlockAt(n.head);r.from>e&&(t.push(E$.range(r.from)),e=r.from)}return Qe.set(t)}},{decorations:i=>i.decorations}),Om=2e3;function D$(i,e,t){let n=Math.min(e.line,t.line),r=Math.max(e.line,t.line),s=[];if(e.off>Om||t.off>Om||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=n;a<=r;a++){let c=i.doc.line(a);c.length<=l&&s.push(q.range(c.from+o,c.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=n;a<=r;a++){let c=i.doc.line(a),u=Ud(c.text,o,i.tabSize,!0);if(u<0)s.push(q.cursor(c.to));else{let h=Ud(c.text,l,i.tabSize);s.push(q.range(c.from+u,c.from+h))}}}return s}function $$(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function db(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),n=i.state.doc.lineAt(t),r=t-n.from,s=r>Om?-1:r==n.length?$$(i,e.clientX):Ci(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:s,off:r}}function L$(i,e){let t=db(i,e),n=i.state.selection;return t?{update(r){if(r.docChanged){let s=r.changes.mapPos(r.startState.doc.line(t.line).from),o=r.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(r.changes)}},get(r,s,o){let l=db(i,r);if(!l)return n;let a=D$(i.state,t,l);return a.length?o?q.create(a.concat(n.ranges)):q.create(a):n}}:null}function I$(i){let e=t=>t.altKey&&t.button==0;return pe.mouseSelectionStyle.of((t,n)=>e(n)?L$(t,n):null)}const N$={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Z$={style:"cursor: crosshair"};function B$(i={}){let[e,t]=N$[i.key||"Alt"],n=Vt.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||t(r))},keyup(r){(r.keyCode==e||!t(r))&&this.set(!1)},mousemove(r){this.set(t(r))}}});return[n,pe.contentAttributes.of(r=>{var s;return!((s=r.plugin(n))===null||s===void 0)
Line truncated
|
||||
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new z7(this):new F7(this)}getCursor(e,t=0,n){let r=e.doc?e:et.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?to(this,r,t,n):eo(this,r,t,n)}}class C_{constructor(e){this.spec=e}}function eo(i,e,t,n){return new $o(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:r=>r.toLowerCase(),i.wholeWord?X7(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function X7(i,e){return(t,n,r,s)=>((s>t||s+r.length<n)&&(s=Math.max(0,t-2),r=i.sliceString(s,Math.min(i.length,n+2))),(e(Xu(r,t-s))!=$t.Word||e(Fu(r,t-s))!=$t.Word)&&(e(Fu(r,n-s))!=$t.Word||e(Xu(r,n-s))!=$t.Word))}class F7 extends C_{constructor(e){super(e)}nextMatch(e,t,n){let r=eo(this.spec,e,n,e.doc.length).nextOverlapping();return r.done&&(r=eo(this.spec,e,0,t).nextOverlapping()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let s=Math.max(t,r-1e4-this.spec.unquoted.length),o=eo(this.spec,e,s,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==t)return null;r-=1e4}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=eo(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let s=eo(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}function to(i,e,t,n){return new k_(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?Y7(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function Xu(i,e){return i.slice(hn(i,e,!1),e)}function Fu(i,e){return i.slice(e,hn(i,e))}function Y7(i){return(e,t,n)=>!n[0].length||(i(Xu(n.input,n.index))!=$t.Word||i(Fu(n.input,n.index))!=$t.Word)&&(i(Fu(n.input,n.index+n[0].length))!=$t.Word||i(Xu(n.input,n.index+n[0].length))!=$t.Word)}class z7 extends C_{nextMatch(e,t,n){let r=to(this.spec,e,n,e.doc.length).next();return r.done&&(r=to(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let s=Math.max(t,n-r*1e4),o=to(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:t)}matchAll(e,t){let n=to(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let s=to(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const wa=Fe.define(),Qp=Fe.define(),Br=Jt.define({create(i){return new zf(Qm(i).create(),null)},update(i,e){for(let t of e.effects)t.is(wa)?i=new zf(t.value.create(),i.panel):t.is(Qp)&&(i=new zf(i.query,t.value?Mp:null));return i},provide:i=>pa.from(i,e=>e.panel)});class zf{constructor(e,t){this.query=e,this.panel=t}}const V7=Qe.mark({class:"cm-searchMatch"}),U7=Qe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),j7=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Br))}update(i){let e=i.state.field(Br);(e!=i.startState.field(Br)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return Qe.none;let{view:t}=this,n=new Ur;for(let r=0,s=t.visibleRanges,o=s.length;r<o;r++){let{from:l,to:a}=s[r];for(;r<o-1&&a>s[r+1].from-2*250;)a=s[++r].to;i.highlight(t.state,l,a,(c,u)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==u);n.add(c,u,h?U7:V7)})}return n.finish()}},{decorations:i=>i.decorations});function Fa(i){return e=>{let t=e.state.field(Br,!1);return t&&t.query.spec.valid?i(e,t):x_(e)}}const Yu=Fa((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let r=q.single(n.from,n.to),s=i.state.facet(Uo);return i.dispatch({selection:r,effects:[Ep(i,n),s.scrollToMatch(r.main,i)],userEvent:"select.search"}),A_(i),!0}),zu=Fa((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,r=e.prevMatch(t,n,n);if(!r)return!1;let s=q.single(r.from,r.to),o=i.state.facet(Uo);return i.dispatch({selection:s,effects:[Ep(i,r),o.scrollToMatch(s.main,i)],userEvent:"select.search"}),A_(i),!0}),q7=Fa((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:q.create(t.map(n=>q.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),G7=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:r}=t.main,s=[],o=0;for(let l=new $o(i.doc,i.sliceDoc(n,r));!l.next().done;){if(s.length>1e3)return!1;l.va
Line truncated
|
||||
`+t.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,n,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&ql(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,rt(ue.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(OC(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(rt(ue.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(pC(e,ql(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=ql(e,this.pos),n=0;if(t>this.pos){let r=gC(e,t,this.start);if(r){let s=Gf(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=Gf(e,this.pos)),n>0&&n<e.length?n:-1}else return Gf(e,this.pos)}}}function Gf(i,e){for(;e<i.length;e++){let t=i.charCodeAt(e);if(t==10)break;if(!mi(t))return-1}return e}class IN{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:sC(t),s=t.next;if(r<0)return!1;let o=rt(ue.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,rt(s==61?ue.SetextHeading1:ue.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}}const NN={LinkReference(i,e){return e.content.charCodeAt(0)==91?new LN(e):null},SetextHeading(){return new IN}},ZN=[(i,e)=>rC(e)>=0,(i,e)=>tC(e)>=0,(i,e)=>nC(e)>=0,(i,e)=>Yp(e,i,!0)>=0,(i,e)=>zp(e,i,!0)>=0,(i,e)=>Fp(e,i,!0)>=0,(i,e)=>aC(e,i,!0)>=0],BN={text:"",end:0};class WN{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new $N,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=Ku.create(ue.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new zN(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!r||e.markers[n].from<r.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let r=n(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let t=new DN(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let r=n(this,t);r&&t.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break e}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
|
||||
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=bC(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=BN;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let n=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[r-1].to-n)+o,n=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+ue[r.type]);if(!s(r,this,e))break;e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
|
||||
`?"":t;else{let r=t.indexOf(`
|
||||
`);n=r<0?t:t.slice(0,r)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=Ku.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e=="number"&&(e=new gt(this.parser.nodeSet.types[e],Io,Io,(n??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements($m(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?cC(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let t=$m(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(ue.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e=="string"?rt(this.parser.getNodeType(e),t,n,r):new fC(e,t)}get buffer(){return new hC(this.parser.nodeSet)}}function cC(i,e,t,n,r){let s=i[e].to,o=[],l=[],a=t.from+n;function c(u,h){for(;h?u>=s:u>s;){let f=i[e+1].from-s;n+=f,u+=f,e++,s=i[e].to}}for(let u=t.firstChild;u;u=u.nextSibling){c(u.from+n,!0);let h=u.from+n,f,d=r.get(u.tree);d?f=d:u.to+n>s?(f=cC(i,e,u,n,r),c(u.to+n,!1)):f=u.toTree(),o.push(f),l.push(h-a)}return c(t.to+n,!1),new gt(t.type,o,l,t.to+n-a,t.tree?t.tree.propValues:void 0)}class Ch extends wp{constructor(e,t,n,r,s,o,l,a,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=c,this.nodeTypes=Object.create(null);for(let u of e.types)this.nodeTypes[u.name]=u.id}createParse(e,t,n){let r=new WN(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}configure(e){let t=Rm(e);if(!t)return this;let{nodeSet:n,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),c=this.inlineNames.slice(),u=this.endLeafBlock.slice(),h=this.wrappers;if(gl(t.defineNodes)){r=Object.assign({},r);let f=n.types.slice(),d;for(let m of t.defineNodes){let{name:p,block:g,composite:v,style:w}=typeof m=="string"?{name:m}:m;if(f.some(k=>k.name==p))continue;v&&(r[f.length]=(k,A,C)=>v(A,C,k.value));let S=f.length,_=v?["Block","BlockContext"]:g?S>=ue.ATXHeading1&&S<=ue.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;f.push(tn.define({id:S,name:p,props:_&&[[Ze.group,_]]})),w&&(d||(d={}),Array.isArray(w)||w instanceof jn?d[p]=w:Object.assign(d,w))}n=new Za(f),d&&(n=n.extend(Xs(d)))}if(gl(t.props)&&(n=n.extend(...t.props)),gl(t.remove))for(let f of t.remove){let d=this.blockNames.indexOf(f),m=this.inlineNames.indexOf(f);d>-1&&(s[d]=o[d]=void 0),m>-1&&(a[m]=void 0)}if(gl(t.parseBlock))for(let f of t.parseBlock){let d=l.indexOf(f.name);if(d>-1)s[d]=f.parse,o[d]=f.leaf;else{let m=f.before?Rc(l,f.before):f.after?Rc(l,f.after)+1:l.length-1;s.splice(m,0,f.parse),o.splice(m,0,f.leaf),l.splice(m,0,f.name)}f.endLeaf&&u.push(f.endLeaf)}if(gl(t.parseInline))for(let f of t.parseInline){let d=c.indexOf(f.name);if(d>-1)a[d]=f.parse;else{let m=f.before?Rc(c,f.before):f.after?Rc(c,f.after)+1:c.length-1;a.splice(m,0,f.parse),c.splice(m,0,f.name)}}return t.wrap&&(h=h.concat(t.wrap)),new Ch(n,s,o,l,u,r,a,c,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new FN(this,e,t);e:for(let r=t;r<n.end;){let s=n.char(r);for(let o of this.inlineParsers)if(o){let l=o(n,s,r);if(l>=0){r=l;continue e}}r++}return n.resolveMarkers(0)}}function gl(i){return i!=null&&i.length>0}function Rm(i){if(!Array.isArray(i))return i;if(i.length==0)return null;let e=Rm(i[0]);if(i.length==1)return e;let t=Rm(i.slice(1));if(!t||!e)return e||t;let n=(o,l)=>(o||Io).concat(l||Io),r=e.wrap,s=t.wrap;return{props:n(e.props,t.props),defineNodes:n(e.defineNodes,t.defineNodes),parseBlock:n(e.parseBlock,t.parseBlock),parseInline:n(e.parseInline,t.parseInline),remove:n(e.remove,t.remove),wrap:r?s?(o,l,a,c)=>r(s(o,l,a,c),l,a,c):r:s}}function Rc(i,e){let t=i.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}let uC=[tn.none];for(let i=1,e;e=ue[i];i++)uC[i]=tn.define({id:i,name:e,props:i>=ue.Escape?[]:[[Ze.group,i in eC?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const Io=[];class hC{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,n,r=0){re
Line truncated
|
||||
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(Ze.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,c=l;for(;;){if(t.to-n>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let u=bC(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,u);else{let h=new gt(e.parser.nodeSet.types[ue.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,u)}if(t.type.is("Block")&&(YN.indexOf(t.type.id)<0?(o=t.to-n,l=e.block.children.length):(o=a,l=c,a=t.to-n,c=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}}function bC(i,e){let t=i;for(let n=1;n<e.length;n++){let r=e[n-1].to,s=e[n].from;r<i&&(t-=s-r)}return t}const VN=Xs({"Blockquote/...":I.quote,HorizontalRule:I.contentSeparator,"ATXHeading1/... SetextHeading1/...":I.heading1,"ATXHeading2/... SetextHeading2/...":I.heading2,"ATXHeading3/...":I.heading3,"ATXHeading4/...":I.heading4,"ATXHeading5/...":I.heading5,"ATXHeading6/...":I.heading6,"Comment CommentBlock":I.comment,Escape:I.escape,Entity:I.character,"Emphasis/...":I.emphasis,"StrongEmphasis/...":I.strong,"Link/... Image/...":I.link,"OrderedList/... BulletList/...":I.list,"BlockQuote/...":I.quote,"InlineCode CodeText":I.monospace,"URL Autolink":I.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":I.processingInstruction,"CodeInfo LinkLabel":I.labelName,LinkTitle:I.string,Paragraph:I.content}),UN=new Ch(new Za(uC).extend(VN),Object.keys(Ec).map(i=>Ec[i]),Object.keys(Ec).map(i=>NN[i]),Object.keys(Ec),ZN,eC,Object.keys(Hf).map(i=>Hf[i]),Object.keys(Hf),[]);function jN(i,e,t){let n=[];for(let r=i.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function qN(i){let{codeParser:e,htmlParser:t}=i;return{wrap:k2((r,s)=>{let o=r.type.id;if(e&&(o==ue.CodeBlock||o==ue.FencedCode)){let l="";if(o==ue.FencedCode){let c=r.node.getChild(ue.CodeInfo);c&&(l=s.read(c.from,c.to))}let a=e(l);if(a)return{parser:a,overlay:c=>c.type.id==ue.CodeText}}else if(t&&(o==ue.HTMLBlock||o==ue.HTMLTag))return{parser:t,overlay:jN(r.node,r.from,r.to)};return null})}}const GN={resolve:"Strikethrough",mark:"StrikethroughMark"},HN={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":I.strikethrough}},{name:"StrikethroughMark",style:I.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let n=i.slice(t-1,t),r=i.slice(t+2,t+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),l=Pa.test(n),a=Pa.test(r);return i.addDelimiter(GN,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function Gl(i,e,t=0,n,r=0){let s=0,o=!0,l=-1,a=-1,c=!1,u=()=>{n.push(i.elt("TableCell",r+l,r+a,i.parser.parseInline(e.slice(l,a),r+l)))};for(let h=t;h<e.length;h++){let f=e.charCodeAt(h);f==124&&!c?((!o||l>-1)&&s++,o=!1,n&&(l>-1&&u(),n.push(i.elt("TableDelimiter",h+r,h+r+1))),l=a=-1):(c||f!=32&&f!=9)&&(l<0&&(l=h),a=h+1),c=!c&&f==92}return l>-1&&(s++,n&&u()),s}function wv(i,e){for(let t=e;t<i.length;t++){let n=i.charCodeAt(t);if(n==124)return!0;n==92&&t++}return!1}const vC=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class yv{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&vC.test(r=t.text.slice(t.pos))){let s=[];Gl(e,n.content,0,s,n.start)==Gl(e,r,t.pos)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];Gl(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}}const KN={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":I.heading}},"TableRow",{name:"TableCell",style:I.content},{name:"TableDelimiter",style:I.processingInstruction}],parseBlock:[{name:"Table",leaf(i,e){return wv(e.content,0)?new yv:null},endLeaf(i,e,t){if(t.parsers.some(r=>r instanceof yv)||!wv(e.text,e.basePos))return!1;let n=i.scanLine(i.absoluteLineEnd+1).text;return vC.test(n)&&Gl(i,e.text,e.basePos)==Gl(i,n,e.basePos)},before:"SetextHeading"}]};class JN{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}}const eZ={defineNodes:[{name:"Task",block:!0,style:I.list},{name:"TaskMarker",style:I.atom}],parseBlock:[
Line truncated
|
||||
\${}
|
||||
} catch (\${error}) {
|
||||
\${}
|
||||
}`,{label:"try",detail:"/ catch block",type:"keyword"}),Qn("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Qn(`if (\${}) {
|
||||
\${}
|
||||
} else {
|
||||
\${}
|
||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),Qn(`class \${name} {
|
||||
constructor(\${params}) {
|
||||
\${}
|
||||
}
|
||||
}`,{label:"class",detail:"definition",type:"keyword"}),Qn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Qn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],U8=IC.concat([Qn("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Qn("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Qn("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Xv=new y2,NC=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ol(i){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,i),!0}}const j8=["FunctionDeclaration"],q8={FunctionDeclaration:Ol("function"),ClassDeclaration:Ol("class"),ClassExpression:()=>!0,EnumDeclaration:Ol("constant"),TypeAliasDeclaration:Ol("type"),NamespaceDeclaration:Ol("namespace"),VariableDefinition(i,e){i.matchContext(j8)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function ZC(i,e){let t=Xv.get(e);if(t)return t;let n=[],r=!0;function s(o,l){let a=i.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(Pt.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=q8[o.name];if(l&&l(o,s)||NC.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of ZC(i,o.node))n.push(l);return!1}}),Xv.set(e,n),n}const Fv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,BC=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function G8(i){let e=At(i.state).resolveInner(i.pos,-1);if(BC.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Fv.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let n=[];for(let r=e;r;r=r.parent)NC.has(r.name)&&(n=n.concat(ZC(i.state.doc,r)));return{options:n,from:t?e.from:i.pos,validFor:Fv}}const qi=$s.define({name:"javascript",parser:V8.configure({props:[zo.add({IfStatement:wo({except:/^\s*({|else\b)/}),TryStatement:wo({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ZL,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:n?1:2)*i.unit},Block:NL({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":wo({except:/^{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),Fs.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Cp,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),WC={test:i=>/^JSX/.test(i.name),facet:yp({commentTokens:{block:{open:"{/*",close:"*/}"}}})},XC=qi.configure({dialect:"ts"},"typescript"),FC=qi.configure({dialect:"jsx",props:[kp.add(i=>i.isTop?[WC]:void 0)]}),YC=qi.configure({dialect:"jsx ts",props:[kp.add(i=>i.isTop?[WC]:void 0)]},"typescript");let zC=i=>({label:i,type:"keyword"});const VC="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(zC),H8=VC.concat(["declare","implements","private","protected","public"].map(zC));function K8(i={}){let e=i.jsx?i.typescript?YC:FC:i.typescript?XC:qi,t=i.typescript?U8.concat(H8):IC.concat(VC);return new Do(e,[qi.data.of({autocomplete:iI(BC,Q_(t))}),qi.data.of({autocomplete:G8}),i.jsx?tB:[]])}function J8(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function Yv(i,e,t=i.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return i.sliceString(n.from,Math.min(n.to,t));return""}const eB=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),tB=pe.inputHandler.of((i,e,t,n,r)=>{if((eB?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||n!=">"&&n!="/"||!qi.isActiveAt(i.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var c;let{head:u}=a,h=At(o).resolveInner(u-1,-1),f;if(h.name=="JSXStartTag"&&(h=h.parent),!(o.doc.sliceString(u-1,u)!=n||h.name=="JSXAttributeValue"&&h.to>u)){if(n==">"&&h.name=="JSXFragmentTag")return{range:a,changes:{from:u,insert:"</>"}};if(n=="/"&&h.name=="JSXStartCloseTag"){let d=h.parent,m=d.parent;if(m&&d.from==u-2&&((f=Yv(o.doc,m.firstChild,u))||((c=m.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let
Line truncated
|
||||
`+w},""),d=r.state.selection.main.head,m=r.state.update({changes:{from:d,insert:f},selection:{anchor:d+1},scrollIntoView:!0});m&&r.dispatch(m)}xi(()=>{let c=new Vr,u=new Vr,h=et.create({doc:s,extensions:[ju,Ws.of([v_,...V_,...Bp]),c.of(Gv()),Gv(),W_(),u.of(et.tabSize.of(4)),ju,pe.editable.of(o),pe.updateListener.of(function(f){f.docChanged&&t(2,s=f.state.doc.toString())}),pe.lineWrapping,pe.contentAttributes.of({spellcheck:"true"})]});r=new pe({state:h,parent:n})}),Jw(()=>{r&&r.destroy()});function a(c){Ce[c?"unshift":"push"](()=>{n=c,t(1,n)})}return i.$$set=c=>{"value"in c&&t(2,s=c.value),"editable"in c&&t(0,o=c.editable)},[o,n,s,l,a]}class PB extends oe{constructor(e){super(),se(this,e,CB,_B,re,{value:2,editable:0,insertMedia:3})}get insertMedia(){return this.$$.ctx[3]}}function Hv(i){let e,t;return{c(){e=y("div"),t=W(i[6]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&64&&K(t,n[6])},d(n){n&&P(e)}}}function AB(i){let e,t,n,r,s,o,l;t=new Gy({props:{record:i[2],field:i[1],validationErrors:i[4],onFilesInserted:i[7]}});function a(h){i[9](h)}let c={editable:!i[1].readonly||i[3]};i[0]!==void 0&&(c.value=i[0]),r=new PB({props:c}),i[8](r),Ce.push(()=>nt(r,"value",a));let u=i[6]&&Hv(i);return{c(){e=y("div"),V(t.$$.fragment),n=D(),V(r.$$.fragment),o=D(),u&&u.c(),O(e,"class","mb-3")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),Y(r,e,null),b(e,o),u&&u.m(e,null),l=!0},p(h,[f]){const d={};f&4&&(d.record=h[2]),f&2&&(d.field=h[1]),f&16&&(d.validationErrors=h[4]),t.$set(d);const m={};f&10&&(m.editable=!h[1].readonly||h[3]),!s&&f&1&&(s=!0,m.value=h[0],st(()=>s=!1)),r.$set(m),h[6]?u?u.p(h,f):(u=Hv(h),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(h){l||(T(t.$$.fragment,h),T(r.$$.fragment,h),l=!0)},o(h){R(t.$$.fragment,h),R(r.$$.fragment,h),l=!1},d(h){h&&P(e),z(t),i[8](null),z(r),u&&u.d()}}}function xB(i,e,t){let n;const r=Ue("channel");let{value:s}=e,{field:o}=e,{record:l}=e,{isCreateMode:a}=e,{validationErrors:c}=e,u;function h(m){const p=m.detail.preset.path;u.insertMedia(r,m.detail.files,p)}function f(m){Ce[m?"unshift":"push"](()=>{u=m,t(5,u)})}function d(m){s=m,t(0,s)}return i.$$set=m=>{"value"in m&&t(0,s=m.value),"field"in m&&t(1,o=m.field),"record"in m&&t(2,l=m.record),"isCreateMode"in m&&t(3,a=m.isCreateMode),"validationErrors"in m&&t(4,c=m.validationErrors)},i.$$.update=()=>{i.$$.dirty&18&&t(6,n=In(c,o.name))},[s,o,l,a,c,u,n,h,f,d]}class lP extends oe{constructor(e){super(),se(this,e,xB,AB,re,{value:0,field:1,record:2,isCreateMode:3,validationErrors:4})}}function Kv(i){let e,t=i[0].help+"",n;return{c(){e=y("small"),n=W(t),O(e,"class","help-text light-text")},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&1&&t!==(t=r[0].help+"")&&K(n,t)},d(r){r&&P(e)}}}function TB(i){let e,t,n,r,s=i[0].label+"",o,l,a,c,u,h=i[0].name+"",f,d=i[0].help&&Kv(i);return{c(){e=y("div"),t=y("div"),n=y("div"),r=y("label"),o=W(s),l=D(),d&&d.c(),a=D(),c=y("span"),u=y("code"),f=W(h),O(r,"for",i[1]),O(n,"class","label-and-help"),O(u,"class","field-id"),O(c,"tabindex","-1"),O(c,"class","text-decoration-none"),O(t,"class","labels"),O(e,"class","field-header")},m(m,p){x(m,e,p),b(e,t),b(t,n),b(n,r),b(r,o),b(n,l),d&&d.m(n,null),b(t,a),b(t,c),b(c,u),b(u,f)},p(m,[p]){p&1&&s!==(s=m[0].label+"")&&K(o,s),p&2&&O(r,"for",m[1]),m[0].help?d?d.p(m,p):(d=Kv(m),d.c(),d.m(n,null)):d&&(d.d(1),d=null),p&1&&h!==(h=m[0].name+"")&&K(f,h)},i:U,o:U,d(m){m&&P(e),d&&d.d()}}}function QB(i,e,t){let{field:n}=e,{id:r}=e;return i.$$set=s=>{"field"in s&&t(0,n=s.field),"id"in s&&t(1,r=s.id)},[n,r]}class MB extends oe{constructor(e){super(),se(this,e,QB,TB,re,{field:0,id:1})}}function Jv(i,e,t){const n=i.slice();return n[2]=e[t],n}function ew(i,e,t){const n=i.slice();return n[24]=e[t],n}function tw(i){let e,t;return{c(){e=y("div"),t=W(i[7]),O(e,"class","invalid-feedback d-block mb-3")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&128&&K(t,n[7])},d(n){n&&P(e)}}}function nw(i){let e=[],t=new Map,n,r=fe(i[5]);const s=l=>l[24].id;for(let l=0;l<r.length;l+=1){let a=ew(i,r,l),c=s(a);t.set(c,e[l]=rw(c,a))}let o=null;return r.length||(o=iw()),{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie(),o&&o.c()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),o&&o.m(l,a)},p(l,a){a&2080&&(r=fe(l[5]),e=Ti(e,a,s,1,l,r,t,n.parentNode,Fm,rw,n,ew),!r.length&&o?o.p(l,a):r.length?o&&(o.d(1),o=null):(o=iw(),o.c(),o.m(n.parentNode,n)))},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l);o&&o.d(l)}}}function iw(i){let e;return{c(){e=y("div"),e.textContent="Start typing...",O(e,"class","start-typing")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function rw(i,e){let t,n=e[24].data.name+"",r,s,o,l;function a(...u){return e[17](e[24],...u)}function c(...u){return e[18](e[24],...u)}return{key:i,first:null,c(){t=y("div"),r=W(n),s=D(),O(t,"class","reference-tags-option"),O(t,"role","button"),O(t,"tabindex","0"),this.first=t},m(u,h){x(u,t,h),b(t,r),b(t,s),o||(l=[G(t,"click",a),G(t,"keypress",c)],o=!0)},p(u,h){e=u,h&32&&n!==(n=e[24].data.name+"")&&K(r,n)},d(u){u&&P(t),o=!1,ht(l)}}}function sw(i){let e,t,n,r,s,o;return{c(){e=y
Line truncated
|
||||
versions`),xt=D(),H=y("div"),Ye.c(),Tt=D(),yt=y("div"),ct&&ct.c(),O(s,"class","label text-end text-muted"),O(f,"class","label text-end text-muted"),O(w,"class","label text-end text-muted"),O(L,"class","label text-end text-muted"),O(n,"class","col-8"),O(ee,"class","label d-block text-muted"),O(X,"class","col-4"),O(t,"class","row"),O(e,"class","lx-card"),O(H,"class","revisions")},m(qe,Mt){x(qe,e,Mt),b(e,t),b(t,n),b(n,r),b(r,s),b(r,o),b(r,l),b(l,c),b(n,u),b(n,h),b(h,f),b(h,d),b(h,p),b(n,g),b(n,v),b(v,w),b(v,S),Y(_,v,null),b(v,k),b(v,C),b(n,Q),b(n,M),b(M,L),b(M,N),Y(B,M,null),b(M,J),b(M,ie),b(t,ae),b(t,X),b(X,ee),b(X,Te),b(X,ve),b(ve,je),b(ve,Ee),b(ve,Re),x(qe,xt,Mt),x(qe,H,Mt),He[Pe].m(H,null),x(qe,Tt,Mt),x(qe,yt,Mt),ct&&ct.m(yt,null),i[13](yt),wt=!0},p(qe,[Mt]){(!wt||Mt&1)&&a!==(a=qe[0].id+"")&&K(c,a),(!wt||Mt&1)&&m!==(m=qe[0].version+"")&&K(p,m);const ei={};Mt&3&&(ei.name=Dn(qe[1],qe[0].createdBy)),_.$set(ei),(!wt||Mt&1)&&A!==(A=Bi(qe[0].createdAt)+"")&&K(C,A);const ti={};Mt&3&&(ti.name=Dn(qe[1],qe[0].updatedBy)),B.$set(ti),(!wt||Mt&1)&&te!==(te=Bi(qe[0].updatedAt)+"")&&K(ie,te),(!wt||Mt&4)&&ne!==(ne=qe[2].revisions+"")&&K(Ee,ne);let Ri=Pe;Pe=Ut(qe),Pe===Ri?He[Pe].p(qe,Mt):(Oe(),R(He[Ri],1,1,()=>{He[Ri]=null}),be(),Ye=He[Pe],Ye?Ye.p(qe,Mt):(Ye=He[Pe]=Qt[Pe](qe),Ye.c()),T(Ye,1),Ye.m(H,null)),qe[5]?ct?(ct.p(qe,Mt),Mt&32&&T(ct,1)):(ct=Sw(qe),ct.c(),T(ct,1),ct.m(yt,null)):ct&&(Oe(),R(ct,1,1,()=>{ct=null}),be())},i(qe){wt||(T(_.$$.fragment,qe),T(B.$$.fragment,qe),T(Ye),T(ct),wt=!0)},o(qe){R(_.$$.fragment,qe),R(B.$$.fragment,qe),R(Ye),R(ct),wt=!1},d(qe){qe&&(P(e),P(xt),P(H),P(Tt),P(yt)),z(_),z(B),He[Pe].d(),ct&&ct.d(),i[13](null)}}}function uW(i,e,t){let n,r,s,o;const l=Ue("channel");let{record:a}=e,{graph:c}=e,{users:u}=e,{schema:h}=e,f,d="";axios.get(`${l.lucentUrl}/records/${a.id}/revisions`).then(S=>{t(8,n=S.data)}).catch(S=>{console.log(S)});function m(S,_){t(7,o=c.edges.filter(k=>k.depth===1).reduce((k,A)=>(k[A.field]||(k[A.field]={record:[],revision:[]}),k[A.field].record.push(A),k),{})),t(7,o=_._edges.reduce((k,A)=>(k[A.field]||(k[A.field]={record:[],revision:[]}),k[A.field].revision.push(A),k),o))}function p(S,_){S.preventDefault(),t(5,s=_),t(6,r=h.fields.filter(k=>!ia(s.data[k.name],a.data[k.name]))),m(r,_),f.scrollIntoView()}function g(S){S.preventDefault(),t(4,d=""),axios.post(`${l.lucentUrl}/records/${a.id}/rollback/${s.version}`).then(_=>{window.location.reload()}).catch(_=>{const k=_.response.data.error;t(4,d=k.fieldLabel+": "+k.message)})}const v=(S,_)=>p(_,S);function w(S){Ce[S?"unshift":"push"](()=>{f=S,t(3,f)})}return i.$$set=S=>{"record"in S&&t(0,a=S.record),"graph"in S&&t(11,c=S.graph),"users"in S&&t(1,u=S.users),"schema"in S&&t(2,h=S.schema)},t(8,n=[]),t(6,r=[]),t(5,s=null),t(7,o={}),[a,u,h,f,d,s,r,o,n,p,g,c,v,w]}class hW extends oe{constructor(e){super(),se(this,e,uW,cW,re,{record:0,graph:11,users:1,schema:2})}}const{window:fW}=OP;function Mw(i,e,t){const n=i.slice();return n[21]=e[t],n}function dW(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Save`,O(e,"type","button"),O(e,"class","button primary ms-2 btn btn-primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[11]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function mW(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Create`,O(e,"class","button primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[11]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function pW(i){let e,t;return e=new hW({props:{record:i[0],graph:i[1],users:i[4],schema:i[2]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.record=n[0]),r&2&&(s.graph=n[1]),r&16&&(s.users=n[4]),r&4&&(s.schema=n[2]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function gW(i){let e,t;return e=new qB({props:{graph:i[1],record:i[0]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&2&&(s.graph=n[1]),r&1&&(s.record=n[0]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function OW(i){let e=[],t=new Map,n,r,s=fe(i[9]);const o=l=>l[21].name;for(let l=0;l<s.length;l+=1){let a=Mw(i,s,l),c=o(a);t.set(c,e[l]=Rw(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),r=!0},p(l,a){a&623&&(s=fe(l[9]),Oe(),e=Ti(e,a,o,1,l,s,t,n.parentNode,Jr,Rw,n,Mw),be())},i(l){if(!r){for(let a=0;a<s.length;a+=1)T(e[a]);r=!0}},o(l){for(let a=0;a<e.length;a+=1)R(e[a]);r=!1},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l)}}}function Ew(i){let e,t,n,r;function s(a){i[15](a)}function o(a){i[16](a)}let l={field:i[21],schema:i[2],record:i[0],validationErrors:i[5],isCreateMode:i[3]};return i[0].data!==void 0&&(l.data=i[0].data),i[1]!==void 0&&(l.graph=i[1]),e=new aP({props:l}),Ce.push(()=>nt(e,"data",s)),Ce.push(()=>nt(e,"graph",o)),{c(){V(e.$$.fragment)},m(a,c){Y(e,a,c),r=!0},p(a,c){const u={};c&4&&(u.schema=a[2]),c&1&&(u.record=a[0]),c&32&&(u.validationErrors=a[5]),c&8&&(u.isCreateMode=a[3]),!t&&c&1&&(t=!0,u.data=a[0].data,st(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],st(()=>n=!1)),e.$set(u)},i(a){r||(T(e.$$.fragment,a),r=!0)},o(a){R(e.$$.fragment,a),r=!1},d(a){z(e,a)}}}function Rw(i,e){let t,n,r,s=e[6]===e[21].group&&Ew(e);return{key:i,first:null,c(){t=Ie(),s&&s.c(),n=Ie(),this.first=t},m(o,l){x(o,t,l),s&&s.m(o,l),x(o,n,l),r=!0},p(o,l){e=o,e[6]===e[21].group?s?(s.p(e,l),l&64&&T(s,1)):(s=Ew(e),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(Oe(),R(s,1,1,()=>{s=null}),be())},i(o){r||(T(s),r=!0)},o(o){R(s),r=!1},d(o){o&&(P(t),P(n)),s&&s.d(o)}}}function bW(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k;function A(X){i[12](X)}function C(X){i[13](X)}let Q={schema:i[2],isCreateMode:i[3]};i[0]!==void 0&&(Q.record=i[0]),i[6]!==void 0&&(Q.activeContentTab=i[6]),n=new cy({props:Q}),Ce.push(()=>nt(n,"record",A)),Ce.push(()=>nt(n,"activeContentTab",C));function M(X,ee){if(X[3])return mW;if(X[8])return dW}let L=M(i),N=L&&L(i);a=new _y({props:{schema:i[2],record:i[0],isCreateMode:i[3]}}),u=new Ma({props:{message:i[7]}});function B(X){i[14](X)}let J={schema:i[2],isCreateMode:i[3]};i[6]!==void 0&&(J.active=i[6]),d=new uy({props:J}),Ce.push(()=>nt(d,"active",B));const te=[OW,gW,pW],ie=[];function ae(X,ee){return ee&64&&(g=null),g==null&&(g=!["_graph","_info"].includes(X[6])),g?0:X[6]==="_graph"?1:X[6]==="_info"?2:-1}return~(v=ae(i,-1))&&(w=ie[v]=te[v](i)),{c(){e=y("div"),t=y("div"),V(n.$$.fragment),o=D(),N&&N.c(),l=D(),V(a.$$.fragment),c=D(),V(u.$$.fragment),h=D(),f=y("div"),V(d.$$.fragment),p=D(),w&&w.c(),O(t,"class","tools-header"),O(f,"class","mt-4"),le(f,"margin-bottom","150px"),le(f,"position","relative"),O(e,"class","record-edit")},m(X,ee){x(X,e,ee),b(e,t),Y(n,t,null),b(t,o),N&&N.m(t,null),b(e,l),Y(a,e,null),b(e,c),Y(u,e,null),b(e,h),b(e,f),Y(d,f,null),b(f,p),~v&&ie[v].m(f,null),S=!0,_||(k=G(fW,"beforeunload",i[10]),_=!0)},p(X,[ee]){const Te={};ee&4&&(Te.schema=X[2]),ee&8&&(Te.isCreateMode=X[3]),!r&&ee&1&&(r=!0,Te.record=X[0],st(()=>r=!1)),!s&&ee&64&&(s=!0,Te.activeContentTab=X[6],st(()=>s=!1)),n.$set(Te),L===(L=M(X))&&N?N.p(X,ee):(N&&N.d(1),N=L&&L(X),N&&(N.c(),N.m(t,null)));const ve={};ee&4&&(ve.schema=X[2]),ee&1&&(ve.record=X[0]),ee&8&&(ve.isCreateMode=X[3]),a.$set(ve);const je={};ee&128&&(je.message=X[7]),u.$set(je);const ne={};ee&4&&(ne.schema=X[2]),ee&8&&(ne.isCreateMode=X[3]),!m&&ee&64&&(m=!0,ne.active=X[6],st(()=>m=!1)),d.$set(ne);let Ee=v;v=ae(X,ee),v===Ee?~v&&ie[v].p(X,ee):(w&&(Oe(),R(ie[Ee],1,1,()=>{ie[Ee]=null}),be()),~v?(w=ie[v],w?w.p(X,ee):(w=ie[v]=te[v](X),w.c()),T(w,1),w.m(f,null)):w=null)},i(X){S||(T(n.$$.fragment,X),T(a.$$.fragment,X),T(u.$$.fragment,X),T(d.$$.fragment,X),T(w),S=!0)},o(X){R(n.$$.fragment,X),R(a.$$.fragment,X),R(u.$$.fragment,X),R(d.$$.fragment,X),R(w),S=!1},d(X){X&&P(e),z(n),N&&N.d(),z(a),z(u),z(d),~v&&ie[v].d(),_=!1,k()}}}function vW(i,e,t){let n,r,s;const o=Ue("channel");let{schema:l}=e,{record:a}=e,{graph:c={records:[],edges:[]}}=e,{isCreateMode:u}=e,{users:h}=e,f,d="",m=l.fields.filter(Q=>Q.name!=="id");xi(()=>{p()});function p(){f={data:JSON.parse(JSON.stringify(a.data)),status:a.status,edges:JSON.parse(JSON.stringify(c.edges))}}Kw(()=>{t(8,n=v())});function g(Q){return n?Q.returnValue="You have unsaved changes. Are you sure you want to exit?":(delete Q.returnValue,"...")}function v(){retu
Line truncated
|
||||
`),p=y("div"),p.textContent=" ",g=W(`
|
||||
`),O(n,"class","header-small mb-5"),O(o,"class","button primary mb-3"),o.disabled=i[2],O(c,"class","mb-3"),O(f,"class","logs svelte-16mig2w"),O(t,"class","lx-card mt-5"),O(e,"class","common-wrapper")},m(k,A){x(k,e,A),b(e,t),b(t,n),b(n,r),b(t,s),b(t,o),b(o,l),b(t,a),b(t,c),S&&S.m(c,null),b(c,u),_&&_.m(c,null),b(t,h),b(t,f),b(f,d),b(f,m),b(f,p),i[6](p),b(f,g),v||(w=G(o,"click",i[4]),v=!0)},p(k,[A]){A&1&&K(r,k[0]),A&4&&(o.disabled=k[2]),k[2]?S||(S=Bw(),S.c(),S.m(c,u)):S&&(S.d(1),S=null),!k[2]&&k[3]?_||(_=Ww(),_.c(),_.m(c,null)):_&&(_.d(1),_=null),A&8&&K(d,k[3])},i:U,o:U,d(k){k&&P(e),S&&S.d(),_&&_.d(),i[6](null),v=!1,w()}}}function RW(i,e,t){let n;const r=Ue("channel");let{title:s}=e,{command:o}=e,l,a=!1;function c(){const f=new EventSource(r.lucentUrl+"/command-report-source/"+o.signature);f.onmessage=function(d){t(2,a=!0);const m=JSON.parse(d.data);m.date,t(3,n=m.logs),l.scrollIntoView()},f.onerror=d=>{console.log(d),f.close(),t(2,a=!1)}}function u(f){f.preventDefault(),t(2,a=!0),Jn(r.lucentUrl+"/command/"+o.signature).then(d=>{c()})}xi(()=>{c()});function h(f){Ce[f?"unshift":"push"](()=>{l=f,t(1,l)})}return i.$$set=f=>{"title"in f&&t(0,s=f.title),"command"in f&&t(5,o=f.command)},t(3,n=""),[s,l,a,n,u,o,h]}class DW extends oe{constructor(e){super(),se(this,e,RW,EW,re,{title:0,command:5})}}function Xw(i,e,t){const n=i.slice();return n[2]=e[t],n}function $W(i){let e;return{c(){e=y("a"),e.textContent="Store admin",O(e,"href","/lunar")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function LW(i){let e,t;return{c(){e=y("a"),t=W("Members"),O(e,"class","top-nav-item"),O(e,"href",i[0].lucentUrl+"/members")},m(n,r){x(n,e,r),b(e,t)},p:U,d(n){n&&P(e)}}}function IW(i){let e,t;return e=new ur({props:{$$slots:{button:[ZW],default:[NW]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&32&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function Fw(i){let e,t=i[2].name+"",n;return{c(){e=y("a"),n=W(t),O(e,"href",i[0].lucentUrl+"/command-report/"+i[2].signature),O(e,"class","top-nav-item")},m(r,s){x(r,e,s),b(e,n)},p:U,d(r){r&&P(e)}}}function NW(i){let e,t=fe(i[0].commands),n=[];for(let r=0;r<t.length;r+=1)n[r]=Fw(Xw(i,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=Ie()},m(r,s){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(r,s);x(r,e,s)},p(r,s){if(s&1){t=fe(r[0].commands);let o;for(o=0;o<t.length;o+=1){const l=Xw(r,t,o);n[o]?n[o].p(l,s):(n[o]=Fw(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(r){r&&P(e),Ot(n,r)}}}function ZW(i){let e;return{c(){e=y("div"),e.textContent="Actions",O(e,"slot","button")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function BW(i){let e,t;return e=new _i({props:{side:"28",name:i[1].name}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p:U,i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function WW(i){let e,t,n;return t=new _i({props:{side:"28",name:i[1].name}}),{c(){e=y("a"),V(t.$$.fragment),O(e,"href",i[0].lucentUrl+"/profile")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function XW(i){let e,t,n,r,s,o;function l(m,p){return m[0].auth=="lucent"?LW:$W}let c=l(i)(i),u=i[0].commands.length>0&&IW(i);const h=[WW,BW],f=[];function d(m,p){return m[0].auth=="lucent"?0:1}return r=d(i),s=f[r]=h[r](i),{c(){e=y("div"),c.c(),t=D(),u&&u.c(),n=D(),s.c(),O(e,"class","top-nav")},m(m,p){x(m,e,p),c.m(e,null),b(e,t),u&&u.m(e,null),b(e,n),f[r].m(e,null),o=!0},p(m,[p]){c.p(m,p),m[0].commands.length>0&&u.p(m,p),s.p(m,p)},i(m){o||(T(u),T(s),o=!0)},o(m){R(u),R(s),o=!1},d(m){m&&P(e),c.d(),u&&u.d(),f[r].d()}}}function FW(i){const e=Ue("channel"),t=Ue("user");return[e,t]}class YW extends oe{constructor(e){super(),se(this,e,FW,XW,re,{})}}function zW(i){let e,t,n,r,s,o,l,a,c;n=new SW({props:{schema:i[2].schema}}),o=new YW({});const u=[{title:i[0]},i[2]];var h=i[3][i[1]];function f(d,m){let p={};for(let g=0;g<u.length;g+=1)p=Ps(p,u[g]);return m!==void 0&&m&5&&(p=Ps(p,_o(u,[m&1&&{title:d[0]},m&4&&Co(d[2])]))),{props:p}}return h&&(a=Xr(h,f(i))),{c(){e=y("div"),t=y("div"),V(n.$$.fragment),r=D(),s=y("div"),V(o.$$.fragment),l=D(),a&&V(a.$$.fragment),O(t,"class","sidebar-content"),O(s,"class","main-content"),O(e,"class","main-wrapper")},m(d,m){x(d,e,m),b(e,t),Y(n,t,null),b(e,r),b(e,s),Y(o,s,null),b(s,l),a&&Y(a,s,null),c=!0},p(d,[m]){const p={};if(m&4&&(p.schema=d[2].schema),n.$set(p),m&2&&h!==(h=d[3][d[1]])){if(a){Oe();const g=a;R(g.$$.fragment,1,0,()=>{z(g,1)}),be()}h?(a=Xr(h,f(d,m)),V(a.$$.fragment),T(a.$$.fragment,1),Y(a,s,null)):a=null}else if(h){const g=m&5?_o(u,[m&1&&{title:d[0]},m&4&&Co(d[2])]):{};a.$set(g)}},i(d){c||(T(n.$$.fragment,d),T(o.$$.fragment,d),a&&T(a.$$.fragment,d),c=!0)},o(d){R(n.$$.fragment,d),R(o.$$.fragment,d),a&&R(a.$$.fragment,d),c=!1},d(d){d&&P(e),z(n),z(o),a&&z(a)}}}function VW(i,e,t){const n={members:Dx,recordEdit:wW,recordNotFound:Ix,contentIndex:Ay,homeIndex:MW
Line truncated
|
||||
Vendored
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"main.js": {
|
||||
"file": "assets/main-B-nfEWyS.js",
|
||||
"file": "assets/main-DtbuHUXl.js",
|
||||
"name": "main",
|
||||
"src": "main.js",
|
||||
"isEntry": true,
|
||||
"css": [
|
||||
"assets/main-CaexgiEy.css"
|
||||
"assets/main-BadhVKbO.css"
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
-51
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* We'll load the axios HTTP library which allows us to easily issue requests
|
||||
* to our Laravel back-end. This library automatically handles sending the
|
||||
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import {loadHtmxFormsBehaviour} from "./htmx-form.js";
|
||||
|
||||
loadHtmxFormsBehaviour();
|
||||
window.axios = axios;
|
||||
export const axiosInstance = axios;
|
||||
|
||||
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
||||
window.axios.interceptors.request.use(
|
||||
function (config) {
|
||||
let list;
|
||||
list = document.querySelectorAll(".btn-spinner");
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
list[i].classList.add("spinner-on");
|
||||
list[i].disabled = true;
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
function (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
window.axios.interceptors.response.use(
|
||||
function (response) {
|
||||
let list;
|
||||
list = document.querySelectorAll(".btn-spinner");
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
list[i].classList.remove("spinner-on");
|
||||
list[i].disabled = false;
|
||||
}
|
||||
return response;
|
||||
},
|
||||
function (error) {
|
||||
let list;
|
||||
list = document.querySelectorAll(".btn-spinner");
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
list[i].classList.remove("spinner-on");
|
||||
list[i].disabled = false;
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
+116
-17
@@ -1,52 +1,151 @@
|
||||
import {formatDistanceToNow, parseJSON, format, parse} from "date-fns";
|
||||
import { formatDistanceToNow, parseJSON, format, parse } from "date-fns";
|
||||
|
||||
export function friendlyDate(date) {
|
||||
return formatDistanceToNow(parseJSON(date), {addSuffix: true});
|
||||
return formatDistanceToNow(parseJSON(date), { addSuffix: true });
|
||||
}
|
||||
|
||||
export function readableDate(date) {
|
||||
if(!date){
|
||||
if (!date) {
|
||||
return "";
|
||||
}
|
||||
return format(parseJSON(date), "dd MMM yyyy");
|
||||
}
|
||||
|
||||
export function readableDatetime(date) {
|
||||
if(!date){
|
||||
if (!date) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return format(parseJSON(date), "dd MMM yyyy HH:mm");
|
||||
}
|
||||
|
||||
|
||||
export function stripHtml(html = "") {
|
||||
let tmp = document.createElement("div");
|
||||
tmp.innerHTML = html;
|
||||
return tmp.textContent || tmp.innerText || "";
|
||||
}
|
||||
|
||||
|
||||
export function randomId(length = 10) {
|
||||
return Math.random().toString(36).substring(2, length + 2);
|
||||
return Math.random()
|
||||
.toString(36)
|
||||
.substring(2, length + 2);
|
||||
}
|
||||
|
||||
export function clickOutside(node) {
|
||||
|
||||
const handleClick = event => {
|
||||
const handleClick = (event) => {
|
||||
if (node && !node.contains(event.target) && !event.defaultPrevented) {
|
||||
node.dispatchEvent(
|
||||
new CustomEvent('click_outside', node)
|
||||
)
|
||||
}
|
||||
node.dispatchEvent(new CustomEvent("click_outside", node));
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('click', handleClick, true);
|
||||
document.addEventListener("click", handleClick, true);
|
||||
|
||||
return {
|
||||
destroy() {
|
||||
document.removeEventListener('click', handleClick, true);
|
||||
}
|
||||
}
|
||||
document.removeEventListener("click", handleClick, true);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function apiFetch(url, options = {}) {
|
||||
return fetch(url, {
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').content,
|
||||
...options.headers,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function apiPost(url, body, options = {}) {
|
||||
return fetch(url, {
|
||||
...options,
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').content,
|
||||
...options.headers,
|
||||
},
|
||||
}).then((r) => r.json());
|
||||
}
|
||||
|
||||
export function apiGet(url, options = {}) {
|
||||
return fetch(url, {
|
||||
...options,
|
||||
method: "GET",
|
||||
headers: {
|
||||
"X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').content,
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
...options.headers,
|
||||
},
|
||||
}).then((r) => r.json());
|
||||
}
|
||||
|
||||
export function isEqual(db, ed) {
|
||||
let isObject = (x) =>
|
||||
typeof x === "object" && !Array.isArray(x) && x !== null;
|
||||
let isArray = (x) => x?.constructor === Array;
|
||||
let isEmpty = (x) => x === null || x === undefined;
|
||||
const db_value = db ?? null;
|
||||
const ed_value = ed ?? null;
|
||||
|
||||
if (isObject(db_value)) {
|
||||
let keys = Object.keys(db_value);
|
||||
return keys.reduce((acc, k) => {
|
||||
if (acc === false) {
|
||||
return false;
|
||||
}
|
||||
return isEqual(db_value?.[k], ed_value?.[k]);
|
||||
}, true);
|
||||
}
|
||||
if (isArray(db_value)) {
|
||||
if (!isArray(ed_value) || db_value.length !== ed_value.length) {
|
||||
return false;
|
||||
}
|
||||
return db_value.reduce((c, v, i) => {
|
||||
if (c === false) {
|
||||
return false;
|
||||
}
|
||||
return isEqual(v, ed_value[i]);
|
||||
}, true);
|
||||
}
|
||||
|
||||
if (isEmpty(db_value) && isEmpty(ed_value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (db_value == ed_value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function debounce(fn, delay) {
|
||||
let timer;
|
||||
return (...args) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn(...args), delay);
|
||||
};
|
||||
}
|
||||
|
||||
export function arrayUnique(array) {
|
||||
return array.filter((value, index) => array.indexOf(value) === index);
|
||||
}
|
||||
|
||||
export function arrayUniqueBy(items, uniqueBy) {
|
||||
const ids = new Set(items.map((item) => item[uniqueBy]));
|
||||
return [...ids].map((id) => items.find((i) => i[uniqueBy] === id));
|
||||
}
|
||||
export function arrayUniqueCb(items, aFilter) {
|
||||
const cache = new Set();
|
||||
return items.filter((item) => {
|
||||
const cacheValue = aFilter(item);
|
||||
if (cache.has(cacheValue)) return false;
|
||||
cache.add(cacheValue);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
export function loadHtmxFormsBehaviour(){
|
||||
document.querySelectorAll(".form").forEach(el => {
|
||||
initHtmxForm(el);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function initHtmxForm(el){
|
||||
el.addEventListener("htmx:responseError", (e) => {
|
||||
el.querySelector(".form-errors").innerHTML = e.detail.xhr.response;
|
||||
});
|
||||
|
||||
const formEl = el.querySelector("form");
|
||||
|
||||
if(!formEl.getAttribute("hx-redirect")){
|
||||
return;
|
||||
}
|
||||
el.addEventListener("htmx:afterOnLoad", (e) => {
|
||||
if(e.detail.successful){
|
||||
return window.location.href = formEl.getAttribute("hx-redirect");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
+6
-12
@@ -1,14 +1,11 @@
|
||||
import {axiosInstance} from "./bootstrap";
|
||||
import "../sass/app.scss";
|
||||
import Account from "./svelte/Account.svelte";
|
||||
import Channel from "./svelte/Channel.svelte";
|
||||
import Mustache from "mustache";
|
||||
import 'htmx.org';
|
||||
|
||||
Mustache.escape = function (value) {
|
||||
return value;
|
||||
};
|
||||
// import Mustache from "mustache";
|
||||
|
||||
// Mustache.escape = function (value) {
|
||||
// return value;
|
||||
// };
|
||||
|
||||
// Define all components
|
||||
const entryComponents = {
|
||||
@@ -29,17 +26,14 @@ let loadSvelte = function () {
|
||||
const loadElement = function (element) {
|
||||
const componentId = element.attributes["data-layout"].value;
|
||||
const [_, component] = Object.entries(entryComponents).find(
|
||||
([key, _]) => componentId === key
|
||||
([key, _]) => componentId === key,
|
||||
);
|
||||
if (!component) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const jsonData = document.getElementById(
|
||||
"json-" + componentId
|
||||
).innerHTML;
|
||||
const jsonData = document.getElementById("json-" + componentId).innerHTML;
|
||||
const props = JSON.parse(jsonData);
|
||||
props.axios = axiosInstance;
|
||||
const compOptions = {
|
||||
target: element,
|
||||
props: props,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import Login from "./account/Login.svelte";
|
||||
import Verify from "./account/Verify.svelte";
|
||||
import Profile from "./account/Profile.svelte";
|
||||
import {setContext} from "svelte";
|
||||
import { setContext } from "svelte";
|
||||
|
||||
const components = {
|
||||
register: Register,
|
||||
@@ -21,10 +21,7 @@
|
||||
setContext("channel", channel);
|
||||
setContext("user", user);
|
||||
</script>
|
||||
<div style="text-align: center;background: var(--p20);padding: 20px;color: var(--p90)">
|
||||
<h1><a class="text-decoration-none" href="{channel.lucentUrl}">{channel.name}</a></h1>
|
||||
</div>
|
||||
<div>
|
||||
<svelte:component this={components[view]} {title} {...data}/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<svelte:component this={components[view]} {channel} {title} {...data} />
|
||||
</div>
|
||||
@@ -3,7 +3,7 @@
|
||||
import RecordNotFound from "./records/NotFound.svelte";
|
||||
import RecordEdit from "./records/Edit.svelte";
|
||||
import ContentIndex from "./content/Index.svelte";
|
||||
import {setContext} from "svelte";
|
||||
import { setContext } from "svelte";
|
||||
import Navbar from "./layout/Navbar.svelte";
|
||||
import HomeIndex from "./home/Index.svelte";
|
||||
import BuildReport from "./build/Report.svelte";
|
||||
@@ -25,27 +25,22 @@
|
||||
// export let layout;
|
||||
export let channel;
|
||||
|
||||
export let axios;
|
||||
export let readableSchemas;
|
||||
|
||||
|
||||
setContext("axios", axios);
|
||||
setContext("channel", channel);
|
||||
setContext("readableSchemas", channel.schemas.filter((s) => readableSchemas.includes(s.name)));
|
||||
setContext(
|
||||
"readableSchemas",
|
||||
channel.schemas.filter((s) => readableSchemas.includes(s.name)),
|
||||
);
|
||||
setContext("user", user);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="sidebar-content">
|
||||
<Navbar schema={data.schema}/>
|
||||
</div>
|
||||
<div class="main-content">
|
||||
<div class="sidebar-content">
|
||||
<Navbar schema={data.schema} />
|
||||
</div>
|
||||
<div class="main-content">
|
||||
<Header />
|
||||
<svelte:component this={components[view]} {title} {...data}/>
|
||||
<svelte:component this={components[view]} {title} {...data} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +1,48 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import { getContext } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
let email = "";
|
||||
let message = "";
|
||||
let submitted = false;
|
||||
|
||||
function login(e) {
|
||||
e.preventDefault();
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/login", {
|
||||
email: email,
|
||||
apiPost(channel.lucentUrl + "/login", { email: email })
|
||||
.then(() => {
|
||||
submitted = true;
|
||||
})
|
||||
.then((response) => {
|
||||
console.log(response)
|
||||
message = "You will receive an email with a login link"
|
||||
})
|
||||
.catch((error) => {
|
||||
});
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="wrapper-tiny">
|
||||
{#if message}
|
||||
<div class="scope-login">
|
||||
<div class="bg-image"></div>
|
||||
<div class="login-form">
|
||||
{#if submitted}
|
||||
<div class="alert alert-info" role="alert">
|
||||
{message}
|
||||
<p>
|
||||
You will receive an email with a login link at <b>{email}</b
|
||||
>.
|
||||
</p>
|
||||
<p>Check your spam folder</p>
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<div class="form">
|
||||
<h2 class="mb-5">Enter Lucent</h2>
|
||||
|
||||
<form on:submit={login}>
|
||||
<div class="mb-3">
|
||||
<label for="emailaddress" class="form-label">Email address</label>
|
||||
<p>
|
||||
Submit your email address and you will receive a <b
|
||||
>login link</b
|
||||
> to your email
|
||||
</p>
|
||||
<p>Don't forget to check your spam folder</p>
|
||||
<div class="mt-5 mb-3">
|
||||
<label for="emailaddress" class="form-label"
|
||||
>Email address</label
|
||||
>
|
||||
<input
|
||||
type="email"
|
||||
bind:value={email}
|
||||
@@ -43,12 +52,17 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center mt-5 d-block">
|
||||
<SpinnerButton label="Login"/>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="bt bt-primary">
|
||||
Send email
|
||||
<img
|
||||
alt="indicator"
|
||||
id="indicator"
|
||||
class="htmx-indicator"
|
||||
src="/img/spinner.svg"
|
||||
/>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,8 +2,9 @@
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import Avatar from "./Avatar.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import SuccessAlert from "../common/SuccessAlert.svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const user = getContext("user");
|
||||
const channel = getContext("channel");
|
||||
@@ -16,8 +17,7 @@
|
||||
e.preventDefault();
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/account/update-name", {
|
||||
apiPost(channel.lucentUrl + "/account/update-name", {
|
||||
name: name,
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -25,7 +25,7 @@
|
||||
})
|
||||
.catch((error) => {
|
||||
errorMessage = error.response?.data.error;
|
||||
console.log({errorMessage});
|
||||
console.log({ errorMessage });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
e.preventDefault();
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/account/update-email", {
|
||||
apiPost(channel.lucentUrl + "/account/update-email", {
|
||||
email: email,
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -42,17 +41,16 @@
|
||||
})
|
||||
.catch((error) => {
|
||||
errorMessage = error.response?.data.error;
|
||||
console.log({errorMessage});
|
||||
console.log({ errorMessage });
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="wrapper-tiny">
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<ErrorAlert message={errorMessage} />
|
||||
<SuccessAlert bind:this={successAlert} />
|
||||
<h3 class="header-small mb-5">
|
||||
<Avatar name={user.name}/>
|
||||
<Avatar name={user.name} />
|
||||
</h3>
|
||||
<form on:submit={saveName}>
|
||||
<div class="input-group mb-5">
|
||||
@@ -63,7 +61,7 @@
|
||||
placeholder="Name"
|
||||
required
|
||||
/>
|
||||
<SpinnerButton label="Update Name"/>
|
||||
<SpinnerButton label="Update Name" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -76,12 +74,14 @@
|
||||
placeholder="Email"
|
||||
required
|
||||
/>
|
||||
<SpinnerButton label="Update Email"/>
|
||||
<SpinnerButton label="Update Email" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="list-group">
|
||||
<a class="list-group-item list-group-item-action" href="{ channel.lucentUrl }/logout">Logout from this
|
||||
device</a>
|
||||
<a
|
||||
class="list-group-item list-group-item-action"
|
||||
href="{channel.lucentUrl}/logout">Logout from this device</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,8 @@
|
||||
<script>
|
||||
import { apiPost } from "../../helpers";
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
let name = "";
|
||||
@@ -12,8 +13,7 @@
|
||||
e.preventDefault();
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/register", {
|
||||
apiPost(channel.lucentUrl + "/register", {
|
||||
name: name,
|
||||
email: email,
|
||||
})
|
||||
@@ -22,13 +22,13 @@
|
||||
})
|
||||
.catch((error) => {
|
||||
errorMessage = error.response?.data.error;
|
||||
console.log({errorMessage});
|
||||
console.log({ errorMessage });
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrapper-tiny">
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<ErrorAlert message={errorMessage} />
|
||||
|
||||
<form on:submit={register}>
|
||||
<div class="mb-3">
|
||||
@@ -50,10 +50,8 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center mt-5 d-block">
|
||||
<SpinnerButton label="Register"/>
|
||||
<SpinnerButton label="Register" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -1,43 +1,42 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import SuccessAlert from "../common/SuccessAlert.svelte";
|
||||
import { getContext } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let email;
|
||||
export let token;
|
||||
let successAlert;
|
||||
|
||||
function login(e) {
|
||||
e.preventDefault();
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/verify", {
|
||||
apiPost(channel.lucentUrl + "/verify", {
|
||||
email: email,
|
||||
token: token,
|
||||
})
|
||||
.then((response) => {
|
||||
window.location = channel.lucentUrl;
|
||||
})
|
||||
.catch((error) => {
|
||||
});
|
||||
.catch((error) => {});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<SuccessAlert bind:this={successAlert}/>
|
||||
<div class="wrapper-tiny">
|
||||
|
||||
<div class="scope-login">
|
||||
<div class="bg-image"></div>
|
||||
<div class="login-form">
|
||||
<div class="form">
|
||||
<h2 class="mb-5">Welcome to Lucent</h2>
|
||||
<form on:submit={login}>
|
||||
<div class="mb-3 text-center">
|
||||
<h3>Login as {email}</h3>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center mt-5 d-block">
|
||||
<SpinnerButton label="Enter"/>
|
||||
</div>
|
||||
<button class="bt bt-primary">
|
||||
Enter as {email}
|
||||
<img
|
||||
alt="indicator"
|
||||
id="indicator"
|
||||
class="htmx-indicator"
|
||||
src="/img/spinner.svg"
|
||||
/>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="form-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,139 @@
|
||||
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
||||
|
||||
/**
|
||||
* Throttle execution of a function. Especially useful for rate limiting
|
||||
* execution of handlers on events like resize and scroll.
|
||||
*
|
||||
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
||||
* are most useful.
|
||||
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
||||
* as-is, to `callback` when the throttled-function is executed.
|
||||
* @param {object} [options] - An object to configure options.
|
||||
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
||||
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
||||
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
||||
* `delay` milliseconds, the internal counter is reset).
|
||||
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
||||
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
||||
* callback will never executed if both noLeading = true and noTrailing = true.
|
||||
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
||||
* false (at end), schedule `callback` to execute after `delay` ms.
|
||||
*
|
||||
* @returns {Function} A new, throttled, function.
|
||||
*/
|
||||
export function throttle(delay, callback, options) {
|
||||
const {
|
||||
noTrailing = false,
|
||||
noLeading = false,
|
||||
debounceMode = undefined,
|
||||
} = options || {};
|
||||
/*
|
||||
* After wrapper has stopped being called, this timeout ensures that
|
||||
* `callback` is executed at the proper times in `throttle` and `end`
|
||||
* debounce modes.
|
||||
*/
|
||||
let timeoutID;
|
||||
let cancelled = false;
|
||||
|
||||
// Keep track of the last time `callback` was executed.
|
||||
let lastExec = 0;
|
||||
|
||||
// Function to clear existing timeout
|
||||
function clearExistingTimeout() {
|
||||
if (timeoutID) {
|
||||
clearTimeout(timeoutID);
|
||||
}
|
||||
}
|
||||
|
||||
// Function to cancel next exec
|
||||
function cancel(options) {
|
||||
const { upcomingOnly = false } = options || {};
|
||||
clearExistingTimeout();
|
||||
cancelled = !upcomingOnly;
|
||||
}
|
||||
|
||||
/*
|
||||
* The `wrapper` function encapsulates all of the throttling / debouncing
|
||||
* functionality and when executed will limit the rate at which `callback`
|
||||
* is executed.
|
||||
*/
|
||||
function wrapper(...arguments_) {
|
||||
let self = this;
|
||||
let elapsed = Date.now() - lastExec;
|
||||
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute `callback` and update the `lastExec` timestamp.
|
||||
function exec() {
|
||||
lastExec = Date.now();
|
||||
callback.apply(self, arguments_);
|
||||
}
|
||||
|
||||
/*
|
||||
* If `debounceMode` is true (at begin) this is used to clear the flag
|
||||
* to allow future `callback` executions.
|
||||
*/
|
||||
function clear() {
|
||||
timeoutID = undefined;
|
||||
}
|
||||
|
||||
if (!noLeading && debounceMode && !timeoutID) {
|
||||
/*
|
||||
* Since `wrapper` is being called for the first time and
|
||||
* `debounceMode` is true (at begin), execute `callback`
|
||||
* and noLeading != true.
|
||||
*/
|
||||
exec();
|
||||
}
|
||||
|
||||
clearExistingTimeout();
|
||||
|
||||
if (debounceMode === undefined && elapsed > delay) {
|
||||
if (noLeading) {
|
||||
/*
|
||||
* In throttle mode with noLeading, if `delay` time has
|
||||
* been exceeded, update `lastExec` and schedule `callback`
|
||||
* to execute after `delay` ms.
|
||||
*/
|
||||
lastExec = Date.now();
|
||||
if (!noTrailing) {
|
||||
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
||||
* `callback`.
|
||||
*/
|
||||
exec();
|
||||
}
|
||||
} else if (noTrailing !== true) {
|
||||
/*
|
||||
* In trailing throttle mode, since `delay` time has not been
|
||||
* exceeded, schedule `callback` to execute `delay` ms after most
|
||||
* recent execution.
|
||||
*
|
||||
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
||||
* after `delay` ms.
|
||||
*
|
||||
* If `debounceMode` is false (at end), schedule `callback` to
|
||||
* execute after `delay` ms.
|
||||
*/
|
||||
timeoutID = setTimeout(
|
||||
debounceMode ? clear : exec,
|
||||
debounceMode === undefined ? delay - elapsed : delay,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
wrapper.cancel = cancel;
|
||||
|
||||
// Return the wrapper function.
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
export function debounce(delay, callback, options) {
|
||||
const { atBegin = false } = options || {};
|
||||
return throttle(delay, callback, { debounceMode: atBegin !== false });
|
||||
}
|
||||
@@ -1,71 +1,81 @@
|
||||
<script>
|
||||
import {getContext, onMount} from "svelte";
|
||||
|
||||
|
||||
import { getContext, onMount } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
const channel = getContext("channel");
|
||||
export let title;
|
||||
export let command;
|
||||
$: date = "";
|
||||
$: logs = "";
|
||||
|
||||
let anchorEl;
|
||||
let inProgress = false;
|
||||
|
||||
function connect() {
|
||||
const eventSource = new EventSource(channel.lucentUrl + "/build-report-source");
|
||||
const eventSource = new EventSource(
|
||||
channel.lucentUrl + "/command-report-source/" + command.signature,
|
||||
);
|
||||
|
||||
eventSource.onmessage = function (event) {
|
||||
inProgress = true;
|
||||
const data = JSON.parse(event.data);
|
||||
date = data.date;
|
||||
logs = data.logs;
|
||||
|
||||
}
|
||||
anchorEl.scrollIntoView();
|
||||
};
|
||||
eventSource.onerror = (e) => {
|
||||
console.log(e)
|
||||
console.log(e);
|
||||
eventSource.close();
|
||||
inProgress = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function buildWebsite(e) {
|
||||
e.preventDefault();
|
||||
inProgress = true;
|
||||
|
||||
axios.post(channel.lucentUrl + "/build").then(response => {
|
||||
connect()
|
||||
})
|
||||
|
||||
apiPost(channel.lucentUrl + "/command/" + command.signature).then(
|
||||
(response) => {
|
||||
connect();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
connect()
|
||||
})
|
||||
|
||||
connect();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="common-wrapper">
|
||||
<div class="lx-card mt-5">
|
||||
|
||||
<h3 class="header-small mb-5">{title}</h3>
|
||||
|
||||
<button on:click={buildWebsite} class="button primary mb-3" disabled={inProgress}>Start Build
|
||||
<button
|
||||
on:click={buildWebsite}
|
||||
class="button primary mb-3"
|
||||
disabled={inProgress}
|
||||
>Start
|
||||
</button>
|
||||
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
{#if inProgress}
|
||||
<span class="badge text-bg-warning">
|
||||
Build in progress
|
||||
</span>
|
||||
<span class="badge text-bg-warning"> Action in progress </span>
|
||||
{/if}
|
||||
{#if !inProgress && logs}
|
||||
<span class="badge text-bg-info">
|
||||
Build completed
|
||||
</span>
|
||||
<span class="badge text-bg-info"> Action completed </span>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<pre>{logs}</pre>
|
||||
<pre class="logs">{logs}
|
||||
<div bind:this={anchorEl}> </div>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.logs {
|
||||
max-height: 70vh;
|
||||
overflow: scroll;
|
||||
background: var(--p90);
|
||||
color: var(--p10);
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -56,23 +56,23 @@
|
||||
path: '<path d="M416 288h-95.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H416c17.67 0 32-14.33 32-32S433.7 288 416 288zM544 32h-223.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H544c17.67 0 32-14.33 32-32S561.7 32 544 32zM352 416h-32c-17.67 0-32 14.33-32 32s14.33 32 32 32h32c17.67 0 31.1-14.33 31.1-32S369.7 416 352 416zM480 160h-159.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H480c17.67 0 32-14.33 32-32S497.7 160 480 160zM192.4 330.7L160 366.1V64.03C160 46.33 145.7 32 128 32S96 46.33 96 64.03v302L63.6 330.7c-6.312-6.883-14.94-10.38-23.61-10.38c-7.719 0-15.47 2.781-21.61 8.414c-13.03 11.95-13.9 32.22-1.969 45.27l87.1 96.09c12.12 13.26 35.06 13.26 47.19 0l87.1-96.09c11.94-13.05 11.06-33.31-1.969-45.27C224.6 316.8 204.4 317.7 192.4 330.7z"/>',
|
||||
viewBox: "0 0 576 512",
|
||||
},
|
||||
"filter": {
|
||||
filter: {
|
||||
path: '<path d="M3.853 54.87C10.47 40.9 24.54 32 40 32H472C487.5 32 501.5 40.9 508.1 54.87C514.8 68.84 512.7 85.37 502.1 97.33L320 320.9V448C320 460.1 313.2 471.2 302.3 476.6C291.5 482 278.5 480.9 268.8 473.6L204.8 425.6C196.7 419.6 192 410.1 192 400V320.9L9.042 97.33C-.745 85.37-2.765 68.84 3.854 54.87L3.853 54.87z"/>',
|
||||
viewBox: "0 0 512 512",
|
||||
},
|
||||
"calendar": {
|
||||
calendar: {
|
||||
path: '<path d="M96 32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32zM448 464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192H448V464z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"pencil": {
|
||||
pencil: {
|
||||
path: '<path d="M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"/>',
|
||||
viewBox: "0 0 512 512",
|
||||
},
|
||||
"database": {
|
||||
database: {
|
||||
path: '<path d="M448 80V128C448 172.2 347.7 208 224 208C100.3 208 0 172.2 0 128V80C0 35.82 100.3 0 224 0C347.7 0 448 35.82 448 80zM393.2 214.7C413.1 207.3 433.1 197.8 448 186.1V288C448 332.2 347.7 368 224 368C100.3 368 0 332.2 0 288V186.1C14.93 197.8 34.02 207.3 54.85 214.7C99.66 230.7 159.5 240 224 240C288.5 240 348.3 230.7 393.2 214.7V214.7zM54.85 374.7C99.66 390.7 159.5 400 224 400C288.5 400 348.3 390.7 393.2 374.7C413.1 367.3 433.1 357.8 448 346.1V432C448 476.2 347.7 512 224 512C100.3 512 0 476.2 0 432V346.1C14.93 357.8 34.02 367.3 54.85 374.7z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"dice": {
|
||||
dice: {
|
||||
path: '<path d="M447.1 224c0-12.56-4.781-25.13-14.35-34.76l-174.9-174.9C249.1 4.786 236.5 0 223.1 0C211.4 0 198.9 4.786 189.2 14.35L14.35 189.2C4.783 198.9-.0011 211.4-.0011 223.1c0 12.56 4.785 25.17 14.35 34.8l174.9 174.9c9.625 9.562 22.19 14.35 34.75 14.35s25.13-4.783 34.75-14.35l174.9-174.9C443.2 249.1 447.1 236.6 447.1 224zM96 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1S120 210.8 120 224S109.3 248 96 248zM224 376c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S237.3 376 224 376zM224 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1S248 210.8 248 224S237.3 248 224 248zM224 120c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S237.3 120 224 120zM352 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S365.3 248 352 248zM591.1 192l-118.7 0c4.418 10.27 6.604 21.25 6.604 32.23c0 20.7-7.865 41.38-23.63 57.14l-136.2 136.2v46.37C320 490.5 341.5 512 368 512h223.1c26.5 0 47.1-21.5 47.1-47.1V240C639.1 213.5 618.5 192 591.1 192zM479.1 376c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S493.2 376 479.1 376z"/>',
|
||||
viewBox: "0 0 640 512",
|
||||
},
|
||||
@@ -81,7 +81,7 @@
|
||||
path: '<path d="M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/>',
|
||||
viewBox: "0 0 512 512",
|
||||
},
|
||||
"eye": {
|
||||
eye: {
|
||||
path: '<path d="M279.6 160.4C282.4 160.1 285.2 160 288 160C341 160 384 202.1 384 256C384 309 341 352 288 352C234.1 352 192 309 192 256C192 253.2 192.1 250.4 192.4 247.6C201.7 252.1 212.5 256 224 256C259.3 256 288 227.3 288 192C288 180.5 284.1 169.7 279.6 160.4zM480.6 112.6C527.4 156 558.7 207.1 573.5 243.7C576.8 251.6 576.8 260.4 573.5 268.3C558.7 304 527.4 355.1 480.6 399.4C433.5 443.2 368.8 480 288 480C207.2 480 142.5 443.2 95.42 399.4C48.62 355.1 17.34 304 2.461 268.3C-.8205 260.4-.8205 251.6 2.461 243.7C17.34 207.1 48.62 156 95.42 112.6C142.5 68.84 207.2 32 288 32C368.8 32 433.5 68.84 480.6 112.6V112.6zM288 112C208.5 112 144 176.5 144 256C144 335.5 208.5 400 288 400C367.5 400 432 335.5 432 256C432 176.5 367.5 112 288 112z"/>',
|
||||
viewBox: "0 0 576 512",
|
||||
},
|
||||
@@ -93,19 +93,19 @@
|
||||
path: '<path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"/>',
|
||||
viewBox: "0 0 512 512",
|
||||
},
|
||||
"expand": {
|
||||
expand: {
|
||||
path: '<path d="M128 32H32C14.31 32 0 46.31 0 64v96c0 17.69 14.31 32 32 32s32-14.31 32-32V96h64c17.69 0 32-14.31 32-32S145.7 32 128 32zM416 32h-96c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32V64C448 46.31 433.7 32 416 32zM128 416H64v-64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96c0 17.69 14.31 32 32 32h96c17.69 0 32-14.31 32-32S145.7 416 128 416zM416 320c-17.69 0-32 14.31-32 32v64h-64c-17.69 0-32 14.31-32 32s14.31 32 32 32h96c17.69 0 32-14.31 32-32v-96C448 334.3 433.7 320 416 320z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"compress": {
|
||||
compress: {
|
||||
path: '<path d="M128 320H32c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32v-96C160 334.3 145.7 320 128 320zM416 320h-96c-17.69 0-32 14.31-32 32v96c0 17.69 14.31 32 32 32s32-14.31 32-32v-64h64c17.69 0 32-14.31 32-32S433.7 320 416 320zM320 192h96c17.69 0 32-14.31 32-32s-14.31-32-32-32h-64V64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96C288 177.7 302.3 192 320 192zM128 32C110.3 32 96 46.31 96 64v64H32C14.31 128 0 142.3 0 160s14.31 32 32 32h96c17.69 0 32-14.31 32-32V64C160 46.31 145.7 32 128 32z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"check": {
|
||||
check: {
|
||||
path: '<path d="M438.6 105.4C451.1 117.9 451.1 138.1 438.6 150.6L182.6 406.6C170.1 419.1 149.9 419.1 137.4 406.6L9.372 278.6C-3.124 266.1-3.124 245.9 9.372 233.4C21.87 220.9 42.13 220.9 54.63 233.4L159.1 338.7L393.4 105.4C405.9 92.88 426.1 92.88 438.6 105.4H438.6z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"close": {
|
||||
close: {
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18 17.94 6M18 18 6.06 6"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
@@ -113,6 +113,22 @@
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12l4-4m-4 4 4 4"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
list: {
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
"ordered-list": {
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
italic: {
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m8.874 19 6.143-14M6 19h6.33m-.66-14H18"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
upload: {
|
||||
path: '<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/> <path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708z"/>',
|
||||
viewBox: "0 0 16 16",
|
||||
},
|
||||
};
|
||||
|
||||
export let width = 16;
|
||||
@@ -134,7 +150,6 @@
|
||||
role="presentation"
|
||||
{stroke}
|
||||
{fill}
|
||||
|
||||
>
|
||||
{@html selectedIcon.path}
|
||||
</svg>
|
||||
@@ -142,6 +157,5 @@
|
||||
<style>
|
||||
svg {
|
||||
vertical-align: text-top;
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -3,11 +3,11 @@
|
||||
export let disabled = false;
|
||||
</script>
|
||||
|
||||
<button type="submit" class="button secondary btn-spinner" {disabled}>
|
||||
<button type="submit" class="button secondary btn-spinner" {disabled}>
|
||||
<span
|
||||
class="spinner-border spinner-border-sm"
|
||||
role="status"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{label}
|
||||
</button>
|
||||
</button>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let selected;
|
||||
@@ -8,8 +9,7 @@
|
||||
|
||||
function deleteRecords(e) {
|
||||
e.preventDefault();
|
||||
axios
|
||||
.post(channel.lucentUrl + "/records/delete", {
|
||||
apiPost(channel.lucentUrl + "/records/delete", {
|
||||
ids: selected.map((s) => s.id),
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -21,10 +21,9 @@
|
||||
}
|
||||
|
||||
function changeStatus(e, status) {
|
||||
axios
|
||||
.post(channel.lucentUrl + "/records/status/" + status, {
|
||||
apiPost(channel.lucentUrl + "/records/status/" + status, {
|
||||
schemaName: schema.name,
|
||||
records: selected
|
||||
records: selected,
|
||||
})
|
||||
.then((response) => {
|
||||
window.location.reload();
|
||||
@@ -40,42 +39,42 @@
|
||||
<button
|
||||
on:click|preventDefault={(e) => changeStatus(e, "published")}
|
||||
type="button"
|
||||
class="button">Publish
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Publish
|
||||
</button>
|
||||
<button
|
||||
on:click|preventDefault={(e) => changeStatus(e, "draft")}
|
||||
type="button"
|
||||
class="button">Make Draft
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Make Draft
|
||||
</button>
|
||||
{#if filter["status_in"] === "trashed"}
|
||||
<button
|
||||
on:click|preventDefault={(e) => changeStatus(e, "published")}
|
||||
type="button"
|
||||
class="button">Publish
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Publish
|
||||
</button>
|
||||
{#if schema.hasDrafts}
|
||||
<button
|
||||
on:click|preventDefault={(e) => changeStatus(e, "draft")}
|
||||
type="button"
|
||||
class="button">Make Draft
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Make Draft
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
on:click|preventDefault={deleteRecords}
|
||||
type="button"
|
||||
class="button">Delete forever
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Delete forever
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
on:click|preventDefault={(e) => changeStatus(e, "trashed")}
|
||||
class="button">Move to trash
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Move to trash
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1,68 +0,0 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import {selectRecord} from "./functions/recordSelect.js";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
export let schema;
|
||||
export let records;
|
||||
export let isWritable;
|
||||
export let selected = [];
|
||||
|
||||
function select(record) {
|
||||
selected = selectRecord(record, selected)
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<div class="row" style="max-width:1000px">
|
||||
{#each records as record (record.id)}
|
||||
<div class="col-6 col-md-4">
|
||||
<div
|
||||
class="file-wrapper rounded p-2 mb-4 bg-light"
|
||||
class:selected={selected.includes(record)}
|
||||
>
|
||||
{#if isWritable}
|
||||
<div class="form-check">
|
||||
<input
|
||||
on:change={() => select(record)}
|
||||
class="form-check-input "
|
||||
type="checkbox"
|
||||
checked={selected.find(
|
||||
(r) => r.id === record.id
|
||||
)}
|
||||
value={record}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="d-flex justify-content-center">
|
||||
<Preview {record} size="medium"/>
|
||||
</div>
|
||||
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
title={record._file.path}
|
||||
class="d-block text-center overflow-hidden text-nowrap my-2 "
|
||||
style="
|
||||
text-overflow: ellipsis;
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
">{record._file.path}</a
|
||||
>
|
||||
<span
|
||||
class="lx-small-text text-muted d-block text-center"
|
||||
>{record._file.mime}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
.form-check {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -3,9 +3,9 @@
|
||||
import Pagination from "./pagination/Pagination.svelte";
|
||||
import ActionsOnSelected from "./ActionsOnSelected.svelte";
|
||||
import Table from "./Table.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import { apiGet } from "../../helpers";
|
||||
|
||||
const axios = getContext("axios");
|
||||
export let schema;
|
||||
export let users;
|
||||
export let records;
|
||||
@@ -26,18 +26,17 @@
|
||||
|
||||
function refresh(e) {
|
||||
const newUrl = e.detail;
|
||||
axios
|
||||
.get(newUrl)
|
||||
apiGet(newUrl)
|
||||
.then((response) => {
|
||||
records = response.data.records;
|
||||
sortParam = response.data.sortParam;
|
||||
sortField = response.data.sortField;
|
||||
operators = response.data.operators;
|
||||
filter = response.data.filter;
|
||||
skip = response.data.skip;
|
||||
limit = response.data.limit;
|
||||
total = response.data.total;
|
||||
modalUrl = response.data.modalUrl;
|
||||
records = response.records;
|
||||
sortParam = response.sortParam;
|
||||
sortField = response.sortField;
|
||||
operators = response.operators;
|
||||
filter = response.filter;
|
||||
skip = response.skip;
|
||||
limit = response.limit;
|
||||
total = response.total;
|
||||
modalUrl = response.modalUrl;
|
||||
document.querySelector("dialog h3").scrollIntoView();
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -47,12 +46,12 @@
|
||||
</script>
|
||||
|
||||
<div class="">
|
||||
<div class="{inModal ? 'mt-0' : 'mt-5'}">
|
||||
<h3 class="header-normal mb-5 ">
|
||||
<div class={inModal ? "mt-0" : "mt-5"}>
|
||||
<h3 class="header-normal mb-5">
|
||||
{schema.label}
|
||||
</h3>
|
||||
{#if selected.length > 0 && !inModal && isWritable}
|
||||
<ActionsOnSelected {schema} {selected} {filter}/>
|
||||
<ActionsOnSelected {schema} {selected} {filter} />
|
||||
{:else}
|
||||
<Tools
|
||||
bind:schema
|
||||
@@ -82,7 +81,6 @@
|
||||
{isWritable}
|
||||
bind:selected
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<Pagination
|
||||
@@ -94,4 +92,3 @@
|
||||
{modalUrl}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import RenderField from "./RenderField.svelte";
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import Status from "../records/Status.svelte";
|
||||
import {usernameById} from "../account/users";
|
||||
import {friendlyDate} from "../../helpers";
|
||||
import { usernameById } from "../account/users";
|
||||
import { friendlyDate } from "../../helpers";
|
||||
|
||||
export let schema;
|
||||
export let users;
|
||||
@@ -12,7 +12,6 @@
|
||||
export let sortParam;
|
||||
export let sortField;
|
||||
export let visibleColumns;
|
||||
|
||||
</script>
|
||||
|
||||
{#each visibleColumns as field, index}
|
||||
@@ -20,40 +19,48 @@
|
||||
class="field-ui-{field.info.name}"
|
||||
class:is-sort={field.name === sortField.name}
|
||||
>
|
||||
<RenderField {record} {schema} {graph} {field}/>
|
||||
<RenderField {record} {schema} {graph} {field} />
|
||||
</td>
|
||||
{/each}
|
||||
{#if schema.visible?.includes("status")}
|
||||
{#if schema.visible?.includes("_sys.status")}
|
||||
<td
|
||||
class="text-center"
|
||||
class:is-sort={"-status" == sortParam || "status" == sortParam}
|
||||
>
|
||||
<Status status={record.status}/>
|
||||
<Status status={record.status} />
|
||||
</td>
|
||||
{/if}
|
||||
{#if schema.visible?.includes("_sys.createdBy")}
|
||||
<td
|
||||
class="text-center"
|
||||
class:is-sort={"-_sys.createdBy" == sortParam || "_sys.createdBy" == sortParam}
|
||||
class:is-sort={"-_sys.createdBy" == sortParam ||
|
||||
"_sys.createdBy" == sortParam}
|
||||
>
|
||||
<Avatar name={usernameById(users, record._sys.createdBy)} side={24}/>
|
||||
<Avatar name={usernameById(users, record.createdBy)} side={24} />
|
||||
</td>
|
||||
{/if}
|
||||
{#if schema.visible?.includes("_sys.updatedBy")}
|
||||
<td
|
||||
class="text-center"
|
||||
class:is-sort={"-_sys.updatedBy" == sortParam || "_sys.updatedBy" == sortParam}
|
||||
class:is-sort={"-_sys.updatedBy" == sortParam ||
|
||||
"_sys.updatedBy" == sortParam}
|
||||
>
|
||||
<Avatar name={usernameById(users, record._sys.updatedBy)} side={24}/>
|
||||
<Avatar name={usernameById(users, record.updatedBy)} side={24} />
|
||||
</td>
|
||||
{/if}
|
||||
{#if schema.visible?.includes("_sys.createdAt")}
|
||||
<td class:is-sort={"-_sys.createdAt" == sortParam || "_sys.createdAt" == sortParam}>
|
||||
{friendlyDate(record._sys.createdAt)}
|
||||
<td
|
||||
class:is-sort={"-_sys.createdAt" == sortParam ||
|
||||
"_sys.createdAt" == sortParam}
|
||||
>
|
||||
{friendlyDate(record.createdAt)}
|
||||
</td>
|
||||
{/if}
|
||||
{#if schema.visible?.includes("_sys.updatedAt")}
|
||||
<td class:is-sort={"-_sys.updatedAt" == sortParam || "_sys.updatedAt" == sortParam}>
|
||||
{friendlyDate(record._sys.updatedAt)}
|
||||
<td
|
||||
class:is-sort={"-_sys.updatedAt" == sortParam ||
|
||||
"_sys.updatedAt" == sortParam}
|
||||
>
|
||||
{friendlyDate(record.updatedAt)}
|
||||
</td>
|
||||
{/if}
|
||||
@@ -1,13 +1,10 @@
|
||||
<script>
|
||||
import RecordRow from "./RecordRow.svelte";
|
||||
import {previewTitle} from "../records/Preview";
|
||||
import {usernameById} from "../account/users";
|
||||
import {getContext} from "svelte";
|
||||
import { usernameById } from "../account/users";
|
||||
import { getContext } from "svelte";
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import {selectRecord, toggleAll} from "./functions/recordSelect.js";
|
||||
import { selectRecord, toggleAll } from "./functions/recordSelect.js";
|
||||
import Checkbox from "../common/Checkbox.svelte";
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import {fileurl} from "../files/imageserver.js";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
@@ -23,17 +20,19 @@
|
||||
export let selected = [];
|
||||
|
||||
function eventToggleAll(e) {
|
||||
selected = toggleAll(e, records, selected)
|
||||
selected = toggleAll(e, records, selected);
|
||||
}
|
||||
|
||||
function select(record) {
|
||||
selected = selectRecord(record, selected)
|
||||
selected = selectRecord(record, selected);
|
||||
}
|
||||
|
||||
$: visibleColumns = schema.fields.filter(c => schema.visible?.includes(c.name) ?? [])
|
||||
console.log(schema);
|
||||
$: visibleColumns = schema.fields.filter(
|
||||
(c) => schema.visible?.includes(c.name) ?? [],
|
||||
);
|
||||
</script>
|
||||
|
||||
<div class="table mt-5 ">
|
||||
<div class="table mt-5">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -42,10 +41,10 @@
|
||||
<Checkbox
|
||||
value=""
|
||||
on:change={eventToggleAll}
|
||||
indeterminate={selected.length > 0 && selected.length < records.length}
|
||||
indeterminate={selected.length > 0 &&
|
||||
selected.length < records.length}
|
||||
checked={selected.length === records.length}
|
||||
>
|
||||
</Checkbox>
|
||||
></Checkbox>
|
||||
</th>
|
||||
{/if}
|
||||
|
||||
@@ -54,12 +53,13 @@
|
||||
class="field-ui-{field.info.name ?? field.ui}"
|
||||
class:is-sort={field.name === sortField.name}
|
||||
scope="col"
|
||||
title={field.help}
|
||||
>{field.label}</th
|
||||
title={field.help}>{field.label}</th
|
||||
>
|
||||
{/each}
|
||||
{#each systemFields.filter(c => schema.visible?.includes(c.name)) as sysField}
|
||||
<th class:is-sort={sysField.name === sortField.name}>{sysField.label}</th>
|
||||
{#each systemFields.filter( (c) => schema.visible?.includes(c.name), ) as sysField}
|
||||
<th class:is-sort={sysField.name === sortField.name}
|
||||
>{sysField.label}</th
|
||||
>
|
||||
{/each}
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -68,52 +68,29 @@
|
||||
{#each records as record (record.id)}
|
||||
<tr>
|
||||
<td class="title-td">
|
||||
<div
|
||||
class="title-td-contents"
|
||||
>
|
||||
<div class="title-td-contents">
|
||||
{#if isWritable}
|
||||
<Checkbox
|
||||
on:change={() => select(record)}
|
||||
checked={selected.find((r) => r.id === record.id)}
|
||||
checked={selected.find(
|
||||
(r) => r.id === record.id,
|
||||
)}
|
||||
value={record}
|
||||
>
|
||||
</Checkbox>
|
||||
|
||||
></Checkbox>
|
||||
{/if}
|
||||
{#if record._file?.path}
|
||||
<div class="file-table-row">
|
||||
<Preview record={record} size={record._file?.width > 0 ? "medium" : "small"}/>
|
||||
<div>
|
||||
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
target={inModal ? "_blank" : "_self"}
|
||||
>
|
||||
{previewTitle(channel.schemas, record, graph)}
|
||||
</a>
|
||||
<span>{(record._file.size / 1024).toFixed(1)}kB</span>
|
||||
|
||||
{#if record._file.width > 0}
|
||||
<span>{record._file.width + "x" + record._file.height}</span>
|
||||
{/if}
|
||||
<a
|
||||
href="{fileurl(channel,record)}"
|
||||
target="_blank"
|
||||
{#if record.status === "draft"}
|
||||
<span
|
||||
style="text-transform: uppercase;font-size:10px"
|
||||
>{record.status}</span
|
||||
>
|
||||
Download
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{:else}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
target={inModal ? "_blank" : "_self"}
|
||||
>
|
||||
{previewTitle(channel.schemas, record, graph)}
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
|
||||
{record.data.name}
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<RecordRow
|
||||
@@ -127,10 +104,7 @@
|
||||
/>
|
||||
<td>
|
||||
<Avatar
|
||||
name={usernameById(
|
||||
users,
|
||||
record._sys.updatedBy
|
||||
)}
|
||||
name={usernameById(users, record.updatedBy)}
|
||||
side={24}
|
||||
/>
|
||||
</td>
|
||||
@@ -139,4 +113,3 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<div class="references">
|
||||
{#each recordEdges as recordEdge}
|
||||
<span class="mr-3">
|
||||
<span class="reference">
|
||||
<PreviewCardSmall {schemas} {graph} record={recordEdge}/>
|
||||
</span>
|
||||
{/each}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { createEventDispatcher } from "svelte";
|
||||
const dispatch = createEventDispatcher();
|
||||
import { range } from "lodash";
|
||||
|
||||
import NavItem from "./NavItem.svelte";
|
||||
export let inModal;
|
||||
export let modalUrl;
|
||||
@@ -11,7 +11,11 @@
|
||||
|
||||
$: totalPages = Math.ceil(total / limit);
|
||||
$: currentPage = Math.ceil((skip - 1) / limit) + 1;
|
||||
|
||||
const range = (start, end, step = 1) =>
|
||||
Array.from(
|
||||
{ length: Math.ceil((end - start) / step) },
|
||||
(_, i) => start + i * step,
|
||||
);
|
||||
$: pageRange = range(currentPage - 3, currentPage + 4).filter((i) => {
|
||||
return i > 0 && i <= totalPages;
|
||||
});
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import {previewTitle} from "../../records/Preview";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
const dispatch = createEventDispatcher();
|
||||
export let schema;
|
||||
export let operators;
|
||||
@@ -12,7 +10,6 @@
|
||||
export let inModal;
|
||||
export let modalUrl;
|
||||
export let graph;
|
||||
|
||||
let filter = {
|
||||
label: "",
|
||||
operator: "",
|
||||
@@ -20,13 +17,10 @@
|
||||
isReference: key.startsWith("children"),
|
||||
};
|
||||
|
||||
filter = [
|
||||
extractOperator(key),
|
||||
extractLabel(schema, key),
|
||||
].reduce((mem, fn) => fn(mem), filter);
|
||||
|
||||
|
||||
|
||||
filter = [extractOperator(key), extractLabel(schema, key)].reduce(
|
||||
(mem, fn) => fn(mem),
|
||||
filter,
|
||||
);
|
||||
|
||||
function extractOperator(key) {
|
||||
return (filter) => {
|
||||
@@ -51,8 +45,7 @@
|
||||
const filterField = schema.fields.find((f) => f.name === fieldName);
|
||||
filter.label = filterField?.label ?? fieldName;
|
||||
return filter;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
const filterRecord = extractFilterRecord(graph, value);
|
||||
@@ -61,7 +54,7 @@
|
||||
if (!filter.isReference) {
|
||||
return null;
|
||||
}
|
||||
return graph.records.find(r => r.id === value);
|
||||
return graph.records.find((r) => r.id === value);
|
||||
}
|
||||
|
||||
function removeFilter(k) {
|
||||
@@ -78,11 +71,14 @@
|
||||
</script>
|
||||
|
||||
<span class="applied-filter">
|
||||
|
||||
{#if filter.isReference && filterRecord}
|
||||
{filter.label} is {previewTitle(channel.schemas, filterRecord)}
|
||||
{filter.label} is {filterRecord.data.name}
|
||||
{:else}
|
||||
{filter.label} {operators.find((o) => o.name === filter.operator)?.symbol ?? ""} {value}
|
||||
{filter.label}
|
||||
{operators.find((o) => o.name === filter.operator)?.symbol ?? ""}
|
||||
{operators.find((o) => o.name === filter.operator)?.hasValue
|
||||
? value
|
||||
: ""}
|
||||
{/if}
|
||||
|
||||
<button
|
||||
@@ -90,7 +86,6 @@
|
||||
type="button"
|
||||
class="button-text"
|
||||
aria-label="Close"
|
||||
><Icon width={12} height={12} icon="close"></Icon></button>
|
||||
><Icon width={12} height={12} icon="close"></Icon></button
|
||||
>
|
||||
</span>
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
const channel = getContext("channel");
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let inModal;
|
||||
export let modalUrl;
|
||||
const url = new URL(modalUrl ?? window.location.href);
|
||||
|
||||
function removeFilter(k) {
|
||||
|
||||
const url = new URL(modalUrl ?? window.location.href);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
export let inModal;
|
||||
export let modalUrl;
|
||||
|
||||
|
||||
let dropdown;
|
||||
let search = "";
|
||||
let systemFieldsFiltered = systemFields;
|
||||
@@ -70,6 +69,13 @@
|
||||
activeOperator = operators.find(o => o.name === "eq")
|
||||
}
|
||||
|
||||
function selectOperator(e, operator) {
|
||||
activeOperator = operator;
|
||||
if (!operator.hasValue) {
|
||||
applyFilter(e)
|
||||
}
|
||||
}
|
||||
|
||||
function applyFilter(e) {
|
||||
e.preventDefault();
|
||||
let filterPrefix = "";
|
||||
@@ -146,7 +152,7 @@
|
||||
<div class="selected-filter">field: {activeField.label}</div>
|
||||
|
||||
{#each activeOperators as operator}
|
||||
<button class="dropdown-item button" on:click={e => activeOperator = operator }>
|
||||
<button class="dropdown-item button" on:click={e => selectOperator(e,operator)}>
|
||||
{operator.label}
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import {debounce} from "lodash";
|
||||
import {previewTitle} from "../../records/Preview";
|
||||
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import { apiGet, debounce } from "../../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
const dispatch = createEventDispatcher();
|
||||
@@ -10,13 +8,11 @@
|
||||
export let value = "";
|
||||
export let field;
|
||||
|
||||
let search = ""
|
||||
$: searchOptions = []
|
||||
|
||||
let search = "";
|
||||
$: searchOptions = [];
|
||||
|
||||
const updateResults = debounce((e) => {
|
||||
axios
|
||||
.get(channel.lucentUrl + "/records/suggestions", {
|
||||
apiGet(channel.lucentUrl + "/records/suggestions", {
|
||||
params: {
|
||||
schema: field.collections[0],
|
||||
field: "search",
|
||||
@@ -25,7 +21,7 @@
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
searchOptions = response.data;
|
||||
searchOptions = response;
|
||||
})
|
||||
.catch((error) => {
|
||||
searchOptions = [];
|
||||
@@ -35,24 +31,22 @@
|
||||
|
||||
function apply(e, newOption) {
|
||||
e.preventDefault();
|
||||
value = newOption.id
|
||||
value = newOption.id;
|
||||
dispatch("addFilter");
|
||||
value = ""
|
||||
|
||||
value = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="reference-tags">
|
||||
<input
|
||||
type="search"
|
||||
on:keyup={updateResults}
|
||||
bind:value={search}
|
||||
placeholder={"Search for "+field.label}
|
||||
placeholder={"Search for " + field.label}
|
||||
autocomplete="off"
|
||||
/>
|
||||
|
||||
<div class="reference-tags-results">
|
||||
|
||||
{#if searchOptions}
|
||||
{#each searchOptions as option (option.id)}
|
||||
<div
|
||||
@@ -62,19 +56,11 @@
|
||||
on:click={(e) => apply(e, option)}
|
||||
on:keypress={(e) => apply(e, option)}
|
||||
>
|
||||
{previewTitle(channel.schemas, option)}
|
||||
{option.data.name}
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<div
|
||||
class="start-typing">
|
||||
Start typing...
|
||||
</div>
|
||||
<div class="start-typing">Start typing...</div>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<script>
|
||||
import FilterFields from "./FilterFields.svelte";
|
||||
import Uploader from "../../files/Uploader.svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import SortFields from "./SortFields.svelte";
|
||||
import AppliedFilter from "./AppliedFilter.svelte";
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import AppliedFilterNotLinked from "./AppliedFilterNotLinked.svelte";
|
||||
|
||||
@@ -41,17 +40,11 @@
|
||||
} else {
|
||||
window.location = url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function uploadComplete(e) {
|
||||
records = e.detail;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-filters">
|
||||
|
||||
<SortFields
|
||||
{schema}
|
||||
{sortParam}
|
||||
@@ -62,7 +55,6 @@
|
||||
on:refresh
|
||||
/>
|
||||
|
||||
|
||||
<FilterFields
|
||||
bind:schema
|
||||
{systemFields}
|
||||
@@ -74,15 +66,17 @@
|
||||
/>
|
||||
|
||||
<form method="GET" on:submit={search}>
|
||||
<input type="search" name="filter[search_regex]" placeholder="Search"
|
||||
class="search" required>
|
||||
<input
|
||||
type="search"
|
||||
name="filter[search_regex]"
|
||||
placeholder="Search"
|
||||
class="search"
|
||||
required
|
||||
/>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div style="display:flex;align-items: center;gap:4px">
|
||||
{#if schema.type === "collection"}
|
||||
{#if !inModal && isWritable}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/new?schema={schema.name}"
|
||||
@@ -91,15 +85,11 @@
|
||||
New Record
|
||||
</a>
|
||||
{/if}
|
||||
{:else }
|
||||
<div>
|
||||
<Uploader {schema} on:uploadComplete={uploadComplete}/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !inModal}
|
||||
<Dropdown orientation="right">
|
||||
<div slot="button">
|
||||
<Icon icon="ellipsis-vertical"/>
|
||||
<Icon icon="ellipsis-vertical" />
|
||||
</div>
|
||||
{#if filter["status_in"] === "trashed"}
|
||||
{#if isWritable}
|
||||
@@ -111,12 +101,7 @@
|
||||
</a>
|
||||
{/if}
|
||||
{:else}
|
||||
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href={csvUrl}
|
||||
>Export to CSV</a
|
||||
>
|
||||
<a class="dropdown-item" href={csvUrl}>Export to CSV</a>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="{channel.lucentUrl}/content/{schema.name}?filter[status_in]=trashed"
|
||||
@@ -129,19 +114,14 @@
|
||||
>
|
||||
{/if}
|
||||
</Dropdown>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{#if Object.entries(filter).length > 0}
|
||||
<div class="applied-filters">
|
||||
<AppliedFilterNotLinked
|
||||
{inModal}
|
||||
{modalUrl}
|
||||
on:refresh
|
||||
/>
|
||||
<div class="applied-filters">
|
||||
<AppliedFilterNotLinked {inModal} {modalUrl} on:refresh
|
||||
></AppliedFilterNotLinked>
|
||||
{#if Object.entries(filter).length > 0}
|
||||
{#each Object.entries(filter) as [k, v]}
|
||||
<AppliedFilter
|
||||
{schema}
|
||||
@@ -154,6 +134,5 @@
|
||||
on:refresh
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1,9 +1,8 @@
|
||||
<script>
|
||||
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import Index from "../content/Index.svelte";
|
||||
import axios from "axios";
|
||||
import { apiGet } from "../../helpers";
|
||||
|
||||
let dialogEl;
|
||||
|
||||
@@ -15,21 +14,19 @@
|
||||
// load();
|
||||
// });
|
||||
|
||||
|
||||
export function close(e) {
|
||||
if(e){
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
dialogEl.close()
|
||||
dialogEl.close();
|
||||
selectedRecords = [];
|
||||
}
|
||||
|
||||
function load(schema) {
|
||||
axios
|
||||
.get(channel.lucentUrl + "/content/" + schema)
|
||||
apiGet(channel.lucentUrl + "/content/" + schema)
|
||||
.then((response) => {
|
||||
data = response.data;
|
||||
data = response;
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}
|
||||
@@ -52,12 +49,11 @@
|
||||
}
|
||||
|
||||
export function open(schema) {
|
||||
dialogEl.showModal()
|
||||
dialogEl.showModal();
|
||||
load(schema);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialogEl}>
|
||||
{#if data.schema}
|
||||
<div class="dialog-header">
|
||||
@@ -96,6 +92,5 @@
|
||||
<div class="dialog-body">
|
||||
<Index {...data} bind:selected={selectedRecords}></Index>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
</dialog>
|
||||
@@ -0,0 +1,102 @@
|
||||
<script>
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import FileIndex from "./FileIndex.svelte";
|
||||
import Dropdown from "../common/Dropdown.svelte";
|
||||
|
||||
let dialogEl;
|
||||
export let presetMode = false;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const channel = getContext("channel");
|
||||
$: files = [];
|
||||
$: selectedFiles = [];
|
||||
// onMount(() => {
|
||||
// load();
|
||||
// });
|
||||
|
||||
export function close(e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
dialogEl.close();
|
||||
selectedFiles = [];
|
||||
}
|
||||
|
||||
function load(recordId) {
|
||||
fetch(channel.lucentUrl + "/records/files/?recordId=" + recordId)
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
files = json;
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}
|
||||
|
||||
function insert(e, preset) {
|
||||
e.preventDefault();
|
||||
dispatch("insert_files", { files: selectedFiles, preset: preset });
|
||||
}
|
||||
|
||||
function replace(e) {
|
||||
e.preventDefault();
|
||||
dispatch("replace_files", selectedFiles);
|
||||
}
|
||||
|
||||
export function open(recordId) {
|
||||
dialogEl.showModal();
|
||||
load(recordId);
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialogEl}>
|
||||
<div class="dialog-header">
|
||||
{#if presetMode}
|
||||
<Dropdown>
|
||||
<div slot="button">Insert Preset</div>
|
||||
{#each channel.imagePresets as preset}
|
||||
<button
|
||||
class=" dropdown-item button"
|
||||
on:click={(e) => insert(e, preset)}
|
||||
>{preset.name}</button
|
||||
>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
class="button"
|
||||
on:click={insert}
|
||||
disabled={selectedFiles.length === 0}
|
||||
>
|
||||
Insert
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="button"
|
||||
on:click={replace}
|
||||
disabled={selectedFiles.length === 0}
|
||||
>
|
||||
Replace
|
||||
</button>
|
||||
{/if}
|
||||
{#if selectedFiles.length > 0}
|
||||
<span class="">
|
||||
{selectedFiles.length} records selected
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
on:click|preventDefault={close}
|
||||
type="button"
|
||||
class="button close"
|
||||
aria-label="Close"
|
||||
>
|
||||
<Icon icon="close"></Icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body">
|
||||
<FileIndex {files} bind:selected={selectedFiles}></FileIndex>
|
||||
</div>
|
||||
</dialog>
|
||||
@@ -0,0 +1,104 @@
|
||||
<script>
|
||||
import { getContext } from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import Checkbox from "../common/Checkbox.svelte";
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import { fileurl } from "../files/imageserver";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
export let files = [];
|
||||
export let selected = [];
|
||||
export let isWritable = true;
|
||||
|
||||
function eventToggleAll(e) {
|
||||
selected = toggleAll(e, files, selected);
|
||||
}
|
||||
|
||||
function select(file) {
|
||||
selected = selectFile(file, selected);
|
||||
}
|
||||
|
||||
export const toggleAll = (e, files, selected) => {
|
||||
if (selected.length === files.length) {
|
||||
return [];
|
||||
}
|
||||
e.currentTarget.checked = selected.length > 0;
|
||||
return files;
|
||||
};
|
||||
|
||||
export const selectFile = (file, selected) => {
|
||||
let fileExists = selected.find((r) => r.id === file.id);
|
||||
if (fileExists) {
|
||||
return selected.filter((r) => r.id !== file.id);
|
||||
}
|
||||
return [...selected, file];
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="table mt-5">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{#if isWritable}
|
||||
<th>
|
||||
<Checkbox
|
||||
value=""
|
||||
on:change={eventToggleAll}
|
||||
indeterminate={selected.length > 0 &&
|
||||
selected.length < files.length}
|
||||
checked={selected.length === files.length}
|
||||
></Checkbox>
|
||||
</th>
|
||||
{/if}
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each files as file (file.id)}
|
||||
<tr>
|
||||
<td class="title-td">
|
||||
<div class="title-td-contents">
|
||||
{#if isWritable}
|
||||
<Checkbox
|
||||
on:change={() => select(file)}
|
||||
checked={selected.find(
|
||||
(s) => s.id === file.id,
|
||||
)}
|
||||
value={file}
|
||||
></Checkbox>
|
||||
{/if}
|
||||
<div class="file-table-row">
|
||||
<Preview
|
||||
{file}
|
||||
size={file.width > 0 ? "medium" : "small"}
|
||||
/>
|
||||
|
||||
<div>
|
||||
{file.filename}
|
||||
<span
|
||||
>{(file.size / 1024).toFixed(1)}kB</span
|
||||
>
|
||||
|
||||
{#if file.width > 0}
|
||||
<span
|
||||
>{file.width +
|
||||
"x" +
|
||||
file.height}</span
|
||||
>
|
||||
{/if}
|
||||
<a
|
||||
href={fileurl(channel, file)}
|
||||
target="_blank"
|
||||
>
|
||||
Download
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -1,19 +1,23 @@
|
||||
|
||||
|
||||
|
||||
export function sortByField(from, to, edges, fieldName, references) {
|
||||
if (from === to) {
|
||||
return edges;
|
||||
}
|
||||
let referenceIds = references.map(r => r.id);
|
||||
let edgesTosort = edges?.filter((ed) => ed.field === fieldName && ed.depth === 1 && referenceIds.includes(ed.target)) ?? [];
|
||||
let remainingEdge = edges?.filter((ed) => !(ed.field === fieldName && ed.depth === 1)) ?? [];
|
||||
let referenceIds = references.map((r) => r.id);
|
||||
let edgesTosort =
|
||||
edges?.filter(
|
||||
(ed) =>
|
||||
ed.field === fieldName &&
|
||||
ed.depth === 1 &&
|
||||
referenceIds.includes(ed.target),
|
||||
) ?? [];
|
||||
let remainingEdge =
|
||||
edges?.filter((ed) => !(ed.field === fieldName && ed.depth === 1)) ?? [];
|
||||
|
||||
edgesTosort = array_move(edgesTosort,from, to);
|
||||
edgesTosort = array_move(edgesTosort, from, to);
|
||||
return [...remainingEdge, ...edgesTosort];
|
||||
}
|
||||
|
||||
function array_move(arr, old_index, new_index) {
|
||||
export function array_move(arr, old_index, new_index) {
|
||||
if (new_index >= arr.length) {
|
||||
var k = new_index - arr.length + 1;
|
||||
while (k--) {
|
||||
@@ -22,4 +26,4 @@ function array_move(arr, old_index, new_index) {
|
||||
}
|
||||
arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
|
||||
return arr; // for testing
|
||||
};
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
<script>
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import {imgurl} from "./imageserver.js";
|
||||
import {getContext} from "svelte";
|
||||
import { fileurl, imgurl } from "./imageserver.js";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
export let record;
|
||||
export let file;
|
||||
const channel = getContext("channel");
|
||||
export let size = "small";
|
||||
export let showFilename = false;
|
||||
let imageSide;
|
||||
let fileSide;
|
||||
let fontSize;
|
||||
|
||||
if (size == "large") {
|
||||
imageSide = 256;
|
||||
fileSide = 32;
|
||||
@@ -28,50 +29,50 @@
|
||||
fontSize = "13";
|
||||
}
|
||||
</script>
|
||||
<div style="display: flex;align-items: center;gap: 5px;">
|
||||
{#if record}
|
||||
|
||||
{#if record._file.mime.startsWith("image")}
|
||||
<div style="display: flex;align-items: center;gap: 5px;">
|
||||
{#if file}
|
||||
{#if file.mime.startsWith("image")}
|
||||
<!-- href={imgurl(record)} -->
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
title={record._file.originalName}
|
||||
target="_blank"
|
||||
href={fileurl(channel, file)}
|
||||
title={file.filename}
|
||||
style="width:{imageSide}px;height:{imageSide}px"
|
||||
>
|
||||
<img
|
||||
class="rounded w-100"
|
||||
src={imgurl(channel,record)}
|
||||
alt={record._file.path}
|
||||
src={imgurl(channel, file)}
|
||||
alt={file.path}
|
||||
/>
|
||||
</a>
|
||||
{:else}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
title={record._file.path}
|
||||
href="{channel.lucentUrl}/files/{file.id}"
|
||||
title={file.path}
|
||||
class="file-preview-small"
|
||||
style="width:{imageSide}px;height:{imageSide}px"
|
||||
>
|
||||
<Icon icon="file" width={fileSide} height={fileSide}/>
|
||||
<Icon icon="file" width={fileSide} height={fileSide} />
|
||||
<span class="ms-2"
|
||||
>.{record._file.path.split(".").pop().toLowerCase()}</span
|
||||
>.{file.path.split(".").pop().toLowerCase()}</span
|
||||
>
|
||||
</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if showFilename}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
title={record._file.path}
|
||||
href="{channel.lucentUrl}/files/{file.id}"
|
||||
title={file.path}
|
||||
class="preview-file-filename lx-small-text text-decoration-none"
|
||||
>{record._file.path} </a
|
||||
>
|
||||
>{file.path}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
img{
|
||||
img {
|
||||
border-radius: 12px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,10 +1,11 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let schema;
|
||||
export let recordId;
|
||||
let mimeTypes = "";
|
||||
let files = [];
|
||||
let isLoading = false;
|
||||
@@ -17,34 +18,35 @@
|
||||
files = e.target.files ? [...e.target.files] : [];
|
||||
let formData = new FormData();
|
||||
|
||||
formData.append("schema", schema.name);
|
||||
formData.append("recordId", recordId);
|
||||
Array.from(files).forEach(function (file) {
|
||||
formData.append("files[]", file);
|
||||
});
|
||||
dispatch("beforeUpload", files);
|
||||
axios
|
||||
.post(channel.lucentUrl + "/files/upload", formData, {
|
||||
fetch(channel.lucentUrl + "/files/upload", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
"X-CSRF-TOKEN": document.querySelector(
|
||||
'meta[name="csrf-token"]',
|
||||
).content,
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.error) {
|
||||
dispatch("uploadError", response.data.error);
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.error) {
|
||||
dispatch("uploadError", data.error);
|
||||
} else {
|
||||
dispatch("uploadComplete", response.data);
|
||||
dispatch("uploadComplete", data);
|
||||
}
|
||||
isLoading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
isLoading = false;
|
||||
console.log(error.response.data);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<fieldset class="upload-button" disabled={isLoading}>
|
||||
<label class="button primary btn-spinner ">
|
||||
<label class="button primary btn-spinner">
|
||||
<Icon icon="upload"></Icon>
|
||||
<span
|
||||
class="spinner-border spinner-border-sm"
|
||||
role="status"
|
||||
|
||||
@@ -1,32 +1,38 @@
|
||||
|
||||
export function imgurl(channel,record) {
|
||||
|
||||
if (record._file.mime === "image/svg+xml") {
|
||||
return fileurl(channel, record);
|
||||
export function imgurl(channel, file) {
|
||||
if (file.mime === "image/svg+xml") {
|
||||
return fileurl(channel, file);
|
||||
}
|
||||
return channel.filesUrl + `/thumbs/${record._file.path}`;
|
||||
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
|
||||
return channel.filesUrl + `/thumbs/${webpPath}`;
|
||||
}
|
||||
|
||||
export function fileurl(channel, record) {
|
||||
return channel.filesUrl + `/${record._file.path}`;
|
||||
export function presetUrl(channel, file, preset) {
|
||||
if (file.mime === "image/svg+xml") {
|
||||
return fileurl(channel, file);
|
||||
}
|
||||
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
|
||||
return channel.filesUrl + `/templates/${preset}/${webpPath}`;
|
||||
}
|
||||
|
||||
export function htmlurl(channel,record, preset) {
|
||||
export function fileurl(channel, file) {
|
||||
return channel.filesUrl + `/${file.path}`;
|
||||
}
|
||||
|
||||
export function htmlurl(channel, file, preset) {
|
||||
let html = "";
|
||||
let url = fileurl(channel,record)
|
||||
let url = fileurl(channel, file);
|
||||
|
||||
if (record._file.width > 0) {
|
||||
if (file.width > 0) {
|
||||
let presetUrl = url;
|
||||
if (preset) {
|
||||
presetUrl = channel.filesUrl + `/templates/${preset}/${record._file.path}`;
|
||||
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
|
||||
presetUrl = channel.filesUrl + `/templates/${preset}/${webpPath}`;
|
||||
}
|
||||
|
||||
html = `<img src="${presetUrl}" alt="${record._file.path}" />`
|
||||
} else if (record._file.mime === "image/svg+xml") {
|
||||
html = `<img src="${url}" alt="${record._file.path}"/>`
|
||||
html = `<img src="${presetUrl}" alt="${file.path}" />`;
|
||||
} else if (file.mime === "image/svg+xml") {
|
||||
html = `<img src="${url}" alt="${file.path}"/>`;
|
||||
} else {
|
||||
html = `<a href="${url}">${record._file.originalName}</a>`
|
||||
html = `<a href="${url}">${file.filename}</a>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<script>
|
||||
|
||||
import {getContext, onMount} from "svelte";
|
||||
import RecordRow from "./RecordRow.svelte"
|
||||
import { getContext, onMount } from "svelte";
|
||||
import RecordRow from "./RecordRow.svelte";
|
||||
import { apiGet } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
let records = [];
|
||||
let graph = null;
|
||||
let users = [];
|
||||
onMount(() => {
|
||||
axios
|
||||
.get(channel.lucentUrl + "/home/records")
|
||||
.then((response) => {
|
||||
records = response.data.records;
|
||||
graph = response.data.graph;
|
||||
users = response.data.users;
|
||||
apiGet(channel.lucentUrl + "/home/records")
|
||||
.then((data) => {
|
||||
records = data.records;
|
||||
users = data.users;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
@@ -21,21 +19,17 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<h3 class="header-small mb-4 mt-5">Latest Content changes</h3>
|
||||
{#if records.length > 0}
|
||||
|
||||
<div class="table">
|
||||
<table class="">
|
||||
<tbody>
|
||||
{#each records as record (record.id)}
|
||||
<tr>
|
||||
<RecordRow {graph} {record} {users}/>
|
||||
<RecordRow {record} {users} />
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
<script>
|
||||
import {formatDistanceToNow, parseJSON} from "date-fns";
|
||||
import { formatDistanceToNow, parseJSON } from "date-fns";
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import {previewTitle} from "../records/Preview";
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import {usernameById} from "../account/users";
|
||||
import {getContext} from "svelte";
|
||||
import { usernameById } from "../account/users";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let users;
|
||||
export let graph;
|
||||
export let record;
|
||||
let schema = channel.schemas.find((s) => s.name === record.schema);
|
||||
let frieldlyUpdatedAt = formatDistanceToNow(
|
||||
parseJSON(record._sys.updatedAt),
|
||||
{addSuffix: true}
|
||||
);
|
||||
let frieldlyUpdatedAt = formatDistanceToNow(parseJSON(record.updatedAt), {
|
||||
addSuffix: true,
|
||||
});
|
||||
</script>
|
||||
|
||||
<td>
|
||||
@@ -23,26 +20,19 @@
|
||||
<span class="status">DRAFT</span>
|
||||
{/if}
|
||||
{#if schema.type === "files"}
|
||||
<Preview {record} size="tiny" showFilename={true}/>
|
||||
<Preview {record} size="tiny" showFilename={true} />
|
||||
{:else}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
|
||||
>
|
||||
{previewTitle(channel.schemas, record, graph)}
|
||||
<a href="{channel.lucentUrl}/records/{record.id}">
|
||||
{record.data.name}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
<td><a
|
||||
href="{channel.lucentUrl}/content/{schema.name}">{schema.label}</a
|
||||
>
|
||||
</td>
|
||||
|
||||
<td><a href="{channel.lucentUrl}/content/{schema.name}">{schema.label}</a> </td>
|
||||
|
||||
<td>
|
||||
<div style="display: flex;gap: 14px">
|
||||
<Avatar name={usernameById(users, record._sys.updatedBy)} side={24}/>
|
||||
<Avatar name={usernameById(users, record.updatedBy)} side={24} />
|
||||
<div class="ms-2">
|
||||
{frieldlyUpdatedAt}
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
<script>
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import Dropdown from "../common/Dropdown.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
const user = getContext("user");
|
||||
</script>
|
||||
|
||||
|
||||
<div class="top-nav ">
|
||||
<div class="top-nav">
|
||||
{#if channel.auth == "lucent"}
|
||||
<a class="top-nav-item" href="{channel.lucentUrl}/members">Members</a>
|
||||
|
||||
{#if channel.generateCommand}
|
||||
<a href="{channel.lucentUrl}/build-report" class="top-nav-item">Build website</a>
|
||||
{:else}
|
||||
<a href="/lunar">Store admin</a>
|
||||
{/if}
|
||||
{#if channel.commands.length > 0}
|
||||
<Dropdown>
|
||||
<div slot="button">Actions</div>
|
||||
{#each channel.commands as command}
|
||||
<a
|
||||
href="{channel.lucentUrl}/command-report/{command.signature}"
|
||||
class="top-nav-item">{command.name}</a
|
||||
>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
{/if}
|
||||
<!-- <div>-->
|
||||
<!-- <form method="GET">-->
|
||||
@@ -19,8 +30,11 @@
|
||||
<!-- class="form-control" required/>-->
|
||||
<!-- </form>-->
|
||||
<!-- </div>-->
|
||||
{#if channel.auth == "lucent"}
|
||||
<a href="{channel.lucentUrl}/profile">
|
||||
<Avatar side="28" name={user.name}/>
|
||||
<Avatar side="28" name={user.name} />
|
||||
</a>
|
||||
{:else}
|
||||
<Avatar side="28" name={user.name} />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,39 +1,21 @@
|
||||
<script>
|
||||
import NavbarMenu from "./NavbarMenu.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
export let schema;
|
||||
const channel = getContext("channel");
|
||||
const readableSchemas = getContext("readableSchemas");
|
||||
|
||||
const fileSchemas = readableSchemas.filter((sc) => sc.type === "files");
|
||||
const otherSchemas = readableSchemas.filter((sc) => !sc.isEntry && sc.type === "collection");
|
||||
|
||||
</script>
|
||||
|
||||
<div class="sidebar-top">
|
||||
<a class="logo" href="{channel.lucentUrl}">{channel.name}</a>
|
||||
<a class="nav-item" href="{channel.lucentUrl}/profile">
|
||||
</a>
|
||||
<a class="logo" href={channel.lucentUrl}>{channel.name}</a>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
|
||||
|
||||
<NavbarMenu
|
||||
title="Content"
|
||||
schemas={ readableSchemas.filter((sc) => sc.isEntry)}
|
||||
schema={schema}
|
||||
expanded={true}
|
||||
/>
|
||||
|
||||
<NavbarMenu
|
||||
title="Files"
|
||||
schemas={ fileSchemas}
|
||||
schema={schema}
|
||||
/>
|
||||
|
||||
<NavbarMenu
|
||||
title="Other"
|
||||
schemas={ otherSchemas}
|
||||
schema={schema}
|
||||
/>
|
||||
{#each readableSchemas as aschema}
|
||||
<a
|
||||
class="sidebar-item"
|
||||
class:active={aschema.name === schema?.name}
|
||||
aria-current="page"
|
||||
href="{channel.lucentUrl}/content/{aschema.name}">{aschema.label}</a
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,34 +0,0 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let schemas;
|
||||
export let title;
|
||||
export let schema;
|
||||
export let expanded = false;
|
||||
|
||||
if(schemas.find(s => s.name === schema?.name)){
|
||||
expanded = true;
|
||||
}
|
||||
|
||||
function toggleExpand(){
|
||||
expanded = !expanded;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="sidebar-header" tabindex="0" on:click={toggleExpand}>
|
||||
{title}
|
||||
{#if expanded}
|
||||
<Icon icon="circle-chevron-up"></Icon>
|
||||
{:else}
|
||||
<Icon icon="circle-chevron-down"></Icon>
|
||||
{/if}
|
||||
</button>
|
||||
{#if expanded}
|
||||
{#each schemas as aschema}
|
||||
<a class="sidebar-item" class:active={aschema.name === schema?.name}
|
||||
aria-current="page"
|
||||
href="{channel.lucentUrl}/content/{aschema.name}">{aschema.label}</a>
|
||||
{/each}
|
||||
{/if}
|
||||
@@ -1,20 +1,48 @@
|
||||
<script>
|
||||
|
||||
// https://codesandbox.io/s/codemirror-remark-editor-4m4z9?file=/src/CodeEditor.js:374-387
|
||||
import {onMount, onDestroy} from "svelte";
|
||||
import {basicSetup, EditorView} from "codemirror";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import { basicSetup, EditorView } from "codemirror";
|
||||
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
||||
import {EditorState, Compartment} from "@codemirror/state";
|
||||
import {keymap} from "@codemirror/view";
|
||||
import {indentWithTab} from "@codemirror/commands";
|
||||
import {markdown} from "@codemirror/lang-markdown";
|
||||
import {lintKeymap} from "@codemirror/lint";
|
||||
import { Compartment, EditorState } from "@codemirror/state";
|
||||
import { keymap } from "@codemirror/view";
|
||||
import { indentWithTab } from "@codemirror/commands";
|
||||
import { markdown } from "@codemirror/lang-markdown";
|
||||
import { lintKeymap } from "@codemirror/lint";
|
||||
import { fileurl, presetUrl } from "../files/imageserver";
|
||||
|
||||
let parentElement;
|
||||
let codeMirrorView;
|
||||
export let value;
|
||||
export let editable = true;
|
||||
|
||||
export function insertMedia(channel, files, presetPath) {
|
||||
const insertText = files.reduce((text, aFile) => {
|
||||
const url =
|
||||
aFile.width > 0
|
||||
? presetUrl(channel, aFile, presetPath)
|
||||
: fileurl(channel, aFile);
|
||||
|
||||
let addTest = ``;
|
||||
|
||||
return text + "\n" + addTest;
|
||||
}, "");
|
||||
|
||||
const cursor = codeMirrorView.state.selection.main.head;
|
||||
const transaction = codeMirrorView.state.update({
|
||||
changes: {
|
||||
from: cursor,
|
||||
insert: insertText,
|
||||
},
|
||||
// the next 2 lines will set the appropriate cursor position after inserting the new text.
|
||||
selection: { anchor: cursor + 1 },
|
||||
scrollIntoView: true,
|
||||
});
|
||||
|
||||
if (transaction) {
|
||||
codeMirrorView.dispatch(transaction);
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
let language = new Compartment();
|
||||
let tabSize = new Compartment();
|
||||
@@ -23,11 +51,7 @@
|
||||
doc: value,
|
||||
extensions: [
|
||||
basicSetup,
|
||||
keymap.of([
|
||||
indentWithTab,
|
||||
...lintKeymap,
|
||||
...completionKeymap
|
||||
]),
|
||||
keymap.of([indentWithTab, ...lintKeymap, ...completionKeymap]),
|
||||
language.of(markdown()),
|
||||
markdown(),
|
||||
autocompletion(),
|
||||
@@ -40,18 +64,14 @@
|
||||
}
|
||||
}),
|
||||
EditorView.lineWrapping,
|
||||
EditorView.contentAttributes.of({spellcheck: "true"})
|
||||
EditorView.contentAttributes.of({ spellcheck: "true" }),
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
codeMirrorView = new EditorView({
|
||||
state,
|
||||
parent: parentElement,
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
@@ -61,4 +81,4 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="is-editable-{editable}" bind:this={parentElement}/>
|
||||
<div class="is-editable-{editable}" bind:this={parentElement} />
|
||||
@@ -1,129 +0,0 @@
|
||||
<script>
|
||||
import {onDestroy, onMount} from "svelte";
|
||||
|
||||
import tinymce from "tinymce/tinymce";
|
||||
import "tinymce/models/dom";
|
||||
import "tinymce/icons/default";
|
||||
import "tinymce/themes/silver";
|
||||
import "tinymce/skins/ui/oxide/skin.css";
|
||||
import contentUiSkinCss from "tinymce/skins/ui/oxide/content.css?inline";
|
||||
import customcss from "./tinymce.css?inline";
|
||||
|
||||
import "tinymce/plugins/link";
|
||||
import "tinymce/plugins/code";
|
||||
import "tinymce/plugins/image";
|
||||
import "tinymce/plugins/table";
|
||||
import "tinymce/plugins/codesample";
|
||||
import "tinymce/plugins/media";
|
||||
|
||||
import "tinymce/plugins/lists";
|
||||
import "tinymce/plugins/autoresize";
|
||||
import "tinymce/plugins/wordcount";
|
||||
|
||||
export let value = "";
|
||||
export let additionalConfig = {};
|
||||
let lastVal = "";
|
||||
let textareaEl;
|
||||
let activeEditor;
|
||||
let editorWrapper;
|
||||
const plugins = [
|
||||
"autoresize",
|
||||
"code",
|
||||
"image",
|
||||
"table",
|
||||
"codesample",
|
||||
"link",
|
||||
"lists",
|
||||
"media",
|
||||
"wordcount",
|
||||
];
|
||||
const toolbar =
|
||||
"bold italic underline strikethrough removeformat | link | subscript superscript bullist numlist media image codesample table code wordcount blockquote indent outdent blocks";
|
||||
|
||||
onDestroy(() => {
|
||||
if (activeEditor) {
|
||||
activeEditor.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
const config = {
|
||||
target: textareaEl,
|
||||
toolbar_mode: "sliding",
|
||||
toolbar_sticky: true,
|
||||
skin: false,
|
||||
content_css: false,
|
||||
content_style: contentUiSkinCss.toString() + customcss.toString(),
|
||||
branding: false,
|
||||
inline: false,
|
||||
plugins: plugins,
|
||||
contextmenu: false,
|
||||
menubar: false,
|
||||
statusbar: false,
|
||||
entity_encoding: "raw",
|
||||
convert_urls: false,
|
||||
toolbar: toolbar,
|
||||
image_caption: true,
|
||||
relative_urls: false,
|
||||
browser_spellcheck: true,
|
||||
max_height: 600,
|
||||
// media_poster: false,
|
||||
|
||||
setup: function (editor) {
|
||||
activeEditor = editor;
|
||||
|
||||
editor.on("init", function (e) {
|
||||
editor.setContent(value ?? "");
|
||||
});
|
||||
|
||||
// editor.on("blur", function (e) {
|
||||
// let content = setImageDimensions(editor.getContent());
|
||||
// dispatch("editorBlur", content);
|
||||
// editorWrapper.classList.remove("editorFocus");
|
||||
// // return false;
|
||||
// });
|
||||
|
||||
// editor.on("focus", function (e) {
|
||||
// editorWrapper.classList.add("editorFocus");
|
||||
// // return false;
|
||||
// });
|
||||
|
||||
editor.on("change input undo redo", function (e) {
|
||||
lastVal = editor.getContent();
|
||||
if (lastVal !== value) {
|
||||
value = lastVal;
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
tinymce.init({...config, ...additionalConfig});
|
||||
});
|
||||
|
||||
export function insertMedia(html){
|
||||
activeEditor.execCommand('InsertHTML', false, html);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div bind:this={editorWrapper} class="tox-wrapper">
|
||||
<div class="form-control" bind:this={textareaEl}>
|
||||
{@html value}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:global(.tox:not(.tox-tinymce-inline) .tox-editor-header) {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ced4da;
|
||||
box-shadow: none;
|
||||
padding: 4px 0;
|
||||
transition: box-shadow 0.5s;
|
||||
}
|
||||
|
||||
:global(.tox-tinymce) {
|
||||
border: 1px solid #ced4da;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@@ -3,9 +3,12 @@
|
||||
import {Editor} from '@tiptap/core'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Dropcursor from '@tiptap/extension-dropcursor'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import Heading from '@tiptap/extension-heading'
|
||||
import HardBreak from '@tiptap/extension-hard-break'
|
||||
import Blockquote from '@tiptap/extension-blockquote';
|
||||
import CodeBlock from '@tiptap/extension-code-block';
|
||||
import Bold from '@tiptap/extension-bold';
|
||||
import BulletList from '@tiptap/extension-bullet-list';
|
||||
import Code from '@tiptap/extension-code';
|
||||
@@ -19,6 +22,8 @@
|
||||
import TableCell from '@tiptap/extension-table-cell';
|
||||
import TableHeader from '@tiptap/extension-table-header';
|
||||
import Underline from '@tiptap/extension-underline';
|
||||
import Image from '@tiptap/extension-image';
|
||||
import Icon from "../common/Icon.svelte";
|
||||
|
||||
let element;
|
||||
let editor;
|
||||
@@ -32,19 +37,22 @@
|
||||
Paragraph,
|
||||
Text,
|
||||
Bold,
|
||||
ListItem,
|
||||
BulletList,
|
||||
Code,
|
||||
CodeBlock,
|
||||
History,
|
||||
Italic,
|
||||
ListItem,
|
||||
HardBreak,
|
||||
OrderedList,
|
||||
ListItem,
|
||||
Strike,
|
||||
Table,
|
||||
TableRow,
|
||||
TableCell,
|
||||
TableHeader,
|
||||
Underline,
|
||||
Dropcursor,
|
||||
Image,
|
||||
Heading.configure({
|
||||
levels: [1, 2, 3],
|
||||
}),
|
||||
@@ -56,7 +64,11 @@
|
||||
// force re-render so `editor.isActive` works as expected
|
||||
editor = editor;
|
||||
},
|
||||
onUpdate: ({editor}) => {
|
||||
value = editor.getHTML()
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
@@ -64,33 +76,99 @@
|
||||
editor.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
export function insertMedia(info){
|
||||
editor.chain().focus().setImage({ src: info.url }).run()
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if editor}
|
||||
<div class="editor-toolbar">
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
||||
class:active={editor.isActive('heading', { level: 1 })}
|
||||
>
|
||||
H1
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}
|
||||
class:active={editor.isActive('heading', { level: 2 })}
|
||||
>
|
||||
H2
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={() => editor.chain().focus().setParagraph().run()}
|
||||
class:active={editor.isActive('paragraph')}
|
||||
>
|
||||
P
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleBold().run()}
|
||||
class:active={editor.isActive('bold')}
|
||||
>
|
||||
Bold
|
||||
B
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleItalic().run()}
|
||||
class:active={editor.isActive('italic')}
|
||||
>
|
||||
<em>IT</em>
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleUnderline().run()}
|
||||
class:active={editor.isActive('underline')}
|
||||
>
|
||||
<u>U</u>
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleStrike().run()}
|
||||
class:active={editor.isActive('strike')}
|
||||
>
|
||||
<s>S</s>
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.commands.unsetAllMarks()}
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleCode().run()}
|
||||
class:active={editor.isActive('code')}
|
||||
>
|
||||
Code
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleBulletList().run()}
|
||||
class:active={editor.isActive('bulletList')}
|
||||
>
|
||||
<Icon icon="list"></Icon>
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleOrderedList().run()}
|
||||
class:active={editor.isActive('orderedList')}
|
||||
>
|
||||
<Icon icon="ordered-list"></Icon>
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleBlockquote().run()}
|
||||
class:active={editor.isActive('blockquote')}
|
||||
>
|
||||
""
|
||||
</button>
|
||||
<button
|
||||
class="button"
|
||||
on:click={() => editor.chain().focus().toggleCodeBlock().run()}
|
||||
class:active={editor.isActive('codeBlock')}
|
||||
>
|
||||
cb
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div bind:this={element} class="content"/>
|
||||
@@ -1,21 +1,67 @@
|
||||
<script>
|
||||
import {onMount} from "svelte";
|
||||
import Trix from "trix"
|
||||
import customcss from "./tinymce.css?inline";
|
||||
import "trix/dist/trix.css"
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import Trix from "trix";
|
||||
import "trix/dist/trix.css";
|
||||
|
||||
export let value = "";
|
||||
let textareaEl;
|
||||
let lastVal;
|
||||
let editorWrapper;
|
||||
let activeEditor;
|
||||
export let field;
|
||||
let editor;
|
||||
|
||||
Trix.config.blockAttributes.default.breakOnReturn = false
|
||||
console.log(Trix.config)
|
||||
function updateValue(e) {
|
||||
value = e.target.value;
|
||||
}
|
||||
|
||||
export function insertMedia(html) {
|
||||
console.log({ html });
|
||||
var attachment = new Trix.Attachment({ content: html });
|
||||
editor.editor.insertAttachment(attachment);
|
||||
// if (info.file.width > 0) {
|
||||
// var attachment = new Trix.Attachment({ content: html });
|
||||
// editor.editor.insertAttachment(attachment);
|
||||
// } else {
|
||||
// editor.editor.insertHTML(html);
|
||||
// }
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
editor.addEventListener("trix-file-accept", (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
editor.addEventListener("trix-before-initialize", (e) => {
|
||||
Trix.config.blockAttributes.heading1.tagName = "h2";
|
||||
const { toolbarElement } = e.target;
|
||||
const h1Button = toolbarElement.querySelector(
|
||||
"[data-trix-attribute=heading1]",
|
||||
);
|
||||
h1Button.insertAdjacentHTML(
|
||||
"afterend",
|
||||
`<button style="text-indent: initial;padding: 14px 10px !important;" type="button" class="trix-button trix-button--icon" data-trix-attribute="heading3" title="Heading 3" tabindex="-1" data-trix-active="">H3</button>`,
|
||||
);
|
||||
});
|
||||
});
|
||||
// onDestroy(() => {
|
||||
// editor.removeEventListener("trix-before-initialize")
|
||||
// })
|
||||
|
||||
Trix.config.blockAttributes.default.breakOnReturn = false;
|
||||
Trix.config.blockAttributes.heading3 = {
|
||||
tagName: "h3",
|
||||
terminal: true,
|
||||
breakOnReturn: true,
|
||||
group: false,
|
||||
};
|
||||
// console.log(Trix.config)
|
||||
</script>
|
||||
|
||||
<div bind:this={editorWrapper} class="tox-wrapper">
|
||||
<input bind:this={textareaEl} id="x" bind:value type="hidden">
|
||||
<trix-editor class="trix-content content" input="x"></trix-editor>
|
||||
<div class="tox-wrapper">
|
||||
<input id="x-{field.name}" {value} type="hidden" />
|
||||
<trix-editor
|
||||
bind:this={editor}
|
||||
class=" content"
|
||||
input="x-{field.name}"
|
||||
role="textbox"
|
||||
tabindex="0"
|
||||
on:trix-change={updateValue}
|
||||
></trix-editor>
|
||||
</div>
|
||||
@@ -1,37 +0,0 @@
|
||||
.mce-content-body .img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.mce-content-body{
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.mce-content-body p{
|
||||
|
||||
margin-bottom: 14px;
|
||||
&:last-child{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.mce-content-body ul {
|
||||
padding: 0 0 0 16px;
|
||||
list-style: none outside none;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.mce-content-body li::before {
|
||||
content: "—";
|
||||
opacity: .5;
|
||||
font-size: 12px;
|
||||
padding-right: 6px;
|
||||
vertical-align: 10%;
|
||||
}
|
||||
|
||||
.mce-content-body li {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
@@ -3,9 +3,8 @@
|
||||
import SuccessAlert from "../common/SuccessAlert.svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import MemberSettingsCard from "./MemberSettingsCard.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import axios from "axios";
|
||||
|
||||
import { getContext } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let users;
|
||||
@@ -23,15 +22,14 @@
|
||||
function invite(newName, newEmail, newRole) {
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/members/invite", {
|
||||
apiPost(channel.lucentUrl + "/members/invite", {
|
||||
name: newName,
|
||||
email: newEmail,
|
||||
roles: [newRole],
|
||||
})
|
||||
.then((response) => {
|
||||
successAlert.show("User was invited");
|
||||
users = [...users, response.data.user];
|
||||
users = [...users, response.user];
|
||||
name = null;
|
||||
email = null;
|
||||
role = null;
|
||||
@@ -45,14 +43,13 @@
|
||||
e.preventDefault();
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/members/update", {
|
||||
apiPost(channel.lucentUrl + "/members/update", {
|
||||
id: e.detail.user,
|
||||
roles: e.detail.roles,
|
||||
})
|
||||
.then((response) => {
|
||||
successAlert.show("Users updated");
|
||||
users = response.data.users;
|
||||
users = response.users;
|
||||
})
|
||||
.catch((error) => {
|
||||
errorMessage = error.response?.data?.error ?? "";
|
||||
@@ -63,14 +60,12 @@
|
||||
<div class="common-wrapper">
|
||||
<div class="lx-card mt-5">
|
||||
<h3 class="header-small mb-5">Invite people</h3>
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<SuccessAlert bind:this={successAlert}/>
|
||||
<ErrorAlert message={errorMessage} />
|
||||
<SuccessAlert bind:this={successAlert} />
|
||||
|
||||
<form on:submit={submitInvite}>
|
||||
<div class="mb-3">
|
||||
<label for="inviteeName" class="form-label"
|
||||
>Invitee Name</label
|
||||
>
|
||||
<label for="inviteeName" class="form-label">Invitee Name</label>
|
||||
<input
|
||||
type="text"
|
||||
bind:value={name}
|
||||
@@ -97,16 +92,13 @@
|
||||
<div class="me-3">
|
||||
<select bind:value={role}>
|
||||
{#each channel.roles.filter((r) => r !== "removed") as arole}
|
||||
<option
|
||||
value={arole}
|
||||
|
||||
>{arole}</option>
|
||||
<option value={arole}>{arole}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 d-block text-center">
|
||||
<SpinnerButton label="Invite"/>
|
||||
<SpinnerButton label="Invite" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
<script>
|
||||
import {afterUpdate, getContext, onMount} from "svelte";
|
||||
import {isEqual} from "lodash";
|
||||
import axios from "axios";
|
||||
import EditHeader from "./header/EditHeader.svelte"
|
||||
import FilePreview from "./FilePreview.svelte"
|
||||
import ContentTabs from "./header/ContentTabs.svelte"
|
||||
import FormField from "./FormField.svelte"
|
||||
import Graph from "./Graph.svelte"
|
||||
import Info from "./Info.svelte"
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte"
|
||||
import { afterUpdate, getContext, onMount } from "svelte";
|
||||
import EditHeader from "./header/EditHeader.svelte";
|
||||
import ContentTabs from "./header/ContentTabs.svelte";
|
||||
import FormField from "./FormField.svelte";
|
||||
import Graph from "./Graph.svelte";
|
||||
import Info from "./Info.svelte";
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||
import Title from "./header/Title.svelte";
|
||||
import { apiPost, isEqual } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
@@ -17,7 +15,7 @@
|
||||
export let record;
|
||||
export let graph = {
|
||||
records: [],
|
||||
edges: []
|
||||
edges: [],
|
||||
};
|
||||
// export let recordHistory;
|
||||
export let isCreateMode;
|
||||
@@ -33,10 +31,7 @@
|
||||
} error(s)`
|
||||
: null;
|
||||
|
||||
let activeFields = schema.fields.filter(
|
||||
(f) => f.name !== "id"
|
||||
);
|
||||
|
||||
let activeFields = schema.fields.filter((f) => f.name !== "id");
|
||||
|
||||
onMount(() => {
|
||||
setOriginalContent();
|
||||
@@ -45,10 +40,7 @@
|
||||
function setOriginalContent() {
|
||||
originalContent = {
|
||||
data: JSON.parse(JSON.stringify(record.data)),
|
||||
schema: record.schema,
|
||||
status: record.status,
|
||||
_sys: JSON.parse(JSON.stringify(record._sys)),
|
||||
_file: JSON.parse(JSON.stringify(record._file)),
|
||||
edges: JSON.parse(JSON.stringify(graph.edges)),
|
||||
};
|
||||
}
|
||||
@@ -77,12 +69,10 @@
|
||||
if (isCreateMode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !isEqual(originalContent, {
|
||||
data: record.data,
|
||||
schema: record.schema,
|
||||
status: record.status,
|
||||
_sys: record._sys,
|
||||
_file: record._file,
|
||||
edges: graph.edges,
|
||||
});
|
||||
}
|
||||
@@ -104,9 +94,10 @@
|
||||
}
|
||||
|
||||
// remove trashed edges
|
||||
graph.edges = graph.edges?.filter((edge) => !edge._isTrashed && edge.source === record.id);
|
||||
axios
|
||||
.post(channel.lucentUrl + "/records", {
|
||||
graph.edges = graph.edges?.filter(
|
||||
(edge) => !edge._isTrashed && edge.source === record.id,
|
||||
);
|
||||
apiPost(channel.lucentUrl + "/records", {
|
||||
record: record,
|
||||
edges: graph.edges,
|
||||
isCreateMode: isCreateMode,
|
||||
@@ -115,16 +106,17 @@
|
||||
console.log("SAVE: SAVED");
|
||||
|
||||
if (isCreateMode) {
|
||||
window.location = channel.lucentUrl + "/records/" + record.id;
|
||||
window.location =
|
||||
channel.lucentUrl + "/records/" + record.id;
|
||||
} else {
|
||||
record = response.data.records[0] ?? null;
|
||||
record = response.records[0] ?? null;
|
||||
if (!record) {
|
||||
// means trashed
|
||||
hasUnsavedData = false;
|
||||
window.location = channel.lucentUrl;
|
||||
return;
|
||||
}
|
||||
graph = response.data;
|
||||
graph = response;
|
||||
setOriginalContent();
|
||||
}
|
||||
|
||||
@@ -137,7 +129,7 @@
|
||||
errorMessage = error.response.data.error;
|
||||
} else {
|
||||
validationErrors = error.response.data.error;
|
||||
console.log(validationErrors)
|
||||
console.log(validationErrors);
|
||||
}
|
||||
}
|
||||
resolve(null);
|
||||
@@ -149,17 +141,14 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:beforeunload={beforeUnload}/>
|
||||
<svelte:window on:beforeunload={beforeUnload} />
|
||||
|
||||
<div class="record-edit">
|
||||
<div class="tools-header">
|
||||
<!-- <Manager managerRecords={recordHistory} {graph}/>-->
|
||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab/>
|
||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab />
|
||||
{#if isCreateMode}
|
||||
<button
|
||||
class="button primary btn-spinner"
|
||||
on:click={save}
|
||||
>
|
||||
<button class="button primary btn-spinner" on:click={save}>
|
||||
<span
|
||||
class="spinner-border spinner-border-sm"
|
||||
role="status"
|
||||
@@ -181,26 +170,19 @@
|
||||
Save
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
<Title {schema} {record} {isCreateMode}/>
|
||||
<Title {schema} {record} {isCreateMode} />
|
||||
|
||||
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<ErrorAlert message={errorMessage} />
|
||||
|
||||
<div class=" mt-4" style="margin-bottom:150px;position:relative;">
|
||||
<ContentTabs
|
||||
{schema}
|
||||
{isCreateMode}
|
||||
bind:active={activeContentTab}
|
||||
/>
|
||||
<ContentTabs {schema} {isCreateMode} bind:active={activeContentTab} />
|
||||
{#if !["_graph", "_info"].includes(activeContentTab)}
|
||||
<FilePreview {record} {schema}/>
|
||||
{#each activeFields as field (field.name)}
|
||||
{#if activeContentTab === field.group}
|
||||
<FormField
|
||||
bind:data={record.data}
|
||||
bind:graph={graph}
|
||||
bind:graph
|
||||
{field}
|
||||
{schema}
|
||||
{record}
|
||||
@@ -210,9 +192,9 @@
|
||||
{/if}
|
||||
{/each}
|
||||
{:else if activeContentTab === "_graph"}
|
||||
<Graph {graph} {record}/>
|
||||
<Graph {graph} {record} />
|
||||
{:else if activeContentTab === "_info"}
|
||||
<Info {record} {graph} {users} {schema}/>
|
||||
<Info {record} {graph} {users} {schema} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import {fileurl} from "../files/imageserver"
|
||||
import {getContext} from "svelte"
|
||||
import { fileurl } from "../files/imageserver";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let record;
|
||||
@@ -11,10 +11,9 @@
|
||||
{#if schema.type === "files"}
|
||||
<div class="record-edit-file-preview">
|
||||
<div>
|
||||
<Preview {record} size="large"/>
|
||||
<Preview {record} size="large" />
|
||||
</div>
|
||||
<div class="file-details">
|
||||
|
||||
<div class="file-details-item">
|
||||
<span class="text-muted">Filename</span>
|
||||
<span>{record._file.path}</span>
|
||||
@@ -42,9 +41,13 @@
|
||||
<span>{record._file.checksum}</span>
|
||||
</div>
|
||||
<div class="file-details-item">
|
||||
<a class="button primary" target="_blank" style="display: inline-flex" href="{fileurl(channel,record)}">Download</a>
|
||||
<a
|
||||
class="button primary"
|
||||
target="_blank"
|
||||
style="display: inline-flex"
|
||||
href={fileurl(channel, record)}>Download</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -45,25 +45,20 @@
|
||||
</script>
|
||||
|
||||
<div class="editor-field">
|
||||
<FieldHeader {field} {id}/>
|
||||
<FieldHeader {field} {id} />
|
||||
{#if field.info.name === "reference" && field.layout === "tags"}
|
||||
<ReferenceTags
|
||||
bind:graph
|
||||
{id}
|
||||
{record}
|
||||
{field}
|
||||
{validationErrors}
|
||||
/>
|
||||
<ReferenceTags bind:graph {id} {record} {field} {validationErrors} />
|
||||
{:else if field.info.name === "reference"}
|
||||
<Reference
|
||||
bind:graph
|
||||
{id}
|
||||
<Reference bind:graph {id} {record} {field} {validationErrors} />
|
||||
{:else if field.info.name === "file"}
|
||||
<!-- <File bind:graph {record} {field} {validationErrors} /> -->
|
||||
<File
|
||||
bind:value={data[field.name]}
|
||||
{record}
|
||||
{id}
|
||||
{field}
|
||||
{validationErrors}
|
||||
/>
|
||||
{:else if field.info.name === "file"}
|
||||
<File bind:graph {record} {field} {validationErrors}/>
|
||||
{:else if field.info.name === "text"}
|
||||
<Text
|
||||
bind:value={data[field.name]}
|
||||
@@ -90,6 +85,13 @@
|
||||
/>
|
||||
{:else if field.info.name === "rich"}
|
||||
<RichEditor
|
||||
bind:value={data[field.name]}
|
||||
{field}
|
||||
{validationErrors}
|
||||
{record}
|
||||
/>
|
||||
{:else if field.info.name === "markdown"}
|
||||
<Markdown
|
||||
bind:value={data[field.name]}
|
||||
{schema}
|
||||
{field}
|
||||
|
||||
@@ -15,11 +15,14 @@
|
||||
let backlinks = graph.parentEdges.map(edge => {
|
||||
let schema = channel.schemas.find((s) => s.name === edge.sourceSchema);
|
||||
let edgeField = findEdgeField(schema,edge.field);
|
||||
if(!edgeField){
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
field: edgeField.label,
|
||||
record: graph.records.find( record => record.id === edge.source)
|
||||
}
|
||||
})
|
||||
}).filter( edgeOrNull => !!edgeOrNull)
|
||||
</script>
|
||||
<div class="editor-field">
|
||||
{#each backlinks as backlink}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script>
|
||||
import {friendlyDate} from "../../helpers";
|
||||
import { friendlyDate, isEqual } from "../../helpers";
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import {usernameById} from "../account/users";
|
||||
import {isEqual} from "lodash";
|
||||
import { usernameById } from "../account/users";
|
||||
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import RevisionCell from "./revisions/RevisionCell.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import RevisionEdgeRow from "./revisions/RevisionEdgeRow.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
@@ -30,27 +30,27 @@
|
||||
});
|
||||
|
||||
function getEdgesByField(fieldsWithDiff, revision) {
|
||||
|
||||
edgeFieldsDiff = graph.edges.filter((e) => e.depth === 1).reduce((c, e) => {
|
||||
edgeFieldsDiff = graph.edges
|
||||
.filter((e) => e.depth === 1)
|
||||
.reduce((c, e) => {
|
||||
if (!c[e.field]) {
|
||||
c[e.field] = {
|
||||
record: [],
|
||||
revision: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
c[e.field]["record"].push(e)
|
||||
c[e.field]["record"].push(e);
|
||||
return c;
|
||||
}, {});
|
||||
|
||||
|
||||
edgeFieldsDiff = revision._edges.reduce((c, e) => {
|
||||
if (!c[e.field]) {
|
||||
c[e.field] = {
|
||||
record: [],
|
||||
revision: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
c[e.field]["revision"].push(e)
|
||||
c[e.field]["revision"].push(e);
|
||||
return c;
|
||||
}, edgeFieldsDiff);
|
||||
}
|
||||
@@ -62,7 +62,7 @@
|
||||
fieldsWithDiff = schema.fields.filter((f) => {
|
||||
return !isEqual(selectedRevision.data[f.name], record.data[f.name]);
|
||||
});
|
||||
getEdgesByField(fieldsWithDiff, revision)
|
||||
getEdgesByField(fieldsWithDiff, revision);
|
||||
revisionSection.scrollIntoView();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
rollbackError = "";
|
||||
axios
|
||||
.post(
|
||||
`${channel.lucentUrl}/records/${record.id}/rollback/${selectedRevision._sys.version}`
|
||||
`${channel.lucentUrl}/records/${record.id}/rollback/${selectedRevision.version}`,
|
||||
)
|
||||
.then((response) => {
|
||||
window.location.reload();
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="lx-card ">
|
||||
<div class="lx-card">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div>
|
||||
@@ -93,29 +93,27 @@
|
||||
</div>
|
||||
<div>
|
||||
<span class="label text-end text-muted">current version </span>
|
||||
{record._sys.version}
|
||||
{record.version}
|
||||
</div>
|
||||
<div>
|
||||
<span class="label text-end text-muted"> created </span>
|
||||
<Avatar
|
||||
name={usernameById(users, record._sys.createdBy)}
|
||||
name={usernameById(users, record.createdBy)}
|
||||
side={24}
|
||||
/>
|
||||
{friendlyDate(record._sys.createdAt)}
|
||||
{friendlyDate(record.createdAt)}
|
||||
</div>
|
||||
<div>
|
||||
<span class="label text-end text-muted">updated </span>
|
||||
<Avatar
|
||||
name={usernameById(users, record._sys.updatedBy)}
|
||||
name={usernameById(users, record.updatedBy)}
|
||||
side={24}
|
||||
/>
|
||||
{friendlyDate(record._sys.updatedAt)}
|
||||
{friendlyDate(record.updatedAt)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<span class="label d-block text-muted "
|
||||
>Rules for this schema
|
||||
</span>
|
||||
<span class="label d-block text-muted">Rules for this schema </span>
|
||||
<small>
|
||||
Each record maintains the last {schema.revisions}
|
||||
versions
|
||||
@@ -127,31 +125,29 @@
|
||||
{#if schema.revisions > 0}
|
||||
<div class="header-small mb-3">Revisions</div>
|
||||
{#each revisions as revision}
|
||||
{#if revision._sys.version !== record._sys.version}
|
||||
{#if revision.version !== record.version}
|
||||
<div
|
||||
class="revision"
|
||||
class:active={revision._sys.version ===
|
||||
selectedRevision?._sys.version}
|
||||
class:active={revision.version ===
|
||||
selectedRevision?.version}
|
||||
>
|
||||
|
||||
<div class="version">
|
||||
<span>version {revision._sys.version}</span>
|
||||
<span>version {revision.version}</span>
|
||||
<Avatar
|
||||
name={usernameById(users, revision._sys.updatedBy)}
|
||||
name={usernameById(users, revision.updatedBy)}
|
||||
side={24}
|
||||
/>
|
||||
{friendlyDate(revision._sys.updatedAt)}
|
||||
{friendlyDate(revision.updatedAt)}
|
||||
</div>
|
||||
|
||||
<div class="col-3 text-center">
|
||||
<button
|
||||
disabled={revision._sys.version ===
|
||||
selectedRevision?._sys.version}
|
||||
disabled={revision.version ===
|
||||
selectedRevision?.version}
|
||||
class="button"
|
||||
on:click={(e) => compare(e, revision)}
|
||||
>Compare
|
||||
</button
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -169,15 +165,13 @@
|
||||
<p class="text-center fw-bold mb-3 mt-5">
|
||||
If you choose to rollback to this revision
|
||||
</p>
|
||||
<button
|
||||
on:click={rollback}
|
||||
class="button"
|
||||
>
|
||||
Rollback to version {selectedRevision._sys.version}
|
||||
<button on:click={rollback} class="button">
|
||||
Rollback to version {selectedRevision.version}
|
||||
</button>
|
||||
|
||||
{#if rollbackError}
|
||||
<span class="d-block text-danger mt-3">{rollbackError}</span>
|
||||
<span class="d-block text-danger mt-3">{rollbackError}</span
|
||||
>
|
||||
{/if}
|
||||
<div class="mt-3">
|
||||
{#each fieldsWithDiff as field}
|
||||
@@ -188,10 +182,7 @@
|
||||
<!-- <div class="d-block" style="width:200px;">
|
||||
{field.label}
|
||||
</div> -->
|
||||
<div
|
||||
class="revision-field"
|
||||
style="overflow:hidden"
|
||||
>
|
||||
<div class="revision-field" style="overflow:hidden">
|
||||
<div class="compare-left">
|
||||
<RevisionCell
|
||||
{field}
|
||||
@@ -226,22 +217,16 @@
|
||||
{/if}
|
||||
|
||||
<div class="mt-3">
|
||||
<p class="text-center fw-bold mb-3 mt-5">
|
||||
Record References
|
||||
</p>
|
||||
<p class="text-center fw-bold mb-3 mt-5">Record References</p>
|
||||
{#each Object.entries(edgeFieldsDiff) as [field, edges]}
|
||||
<div
|
||||
class="revision-references"
|
||||
style="overflow:hidden"
|
||||
>
|
||||
<div class="revision-references" style="overflow:hidden">
|
||||
<div class="reference-field">
|
||||
{field}:
|
||||
</div>
|
||||
<div class="reference-compare">
|
||||
|
||||
<p class="">Record</p>
|
||||
{#each edges.record as edge}
|
||||
<RevisionEdgeRow {edge}/>
|
||||
<RevisionEdgeRow {edge} />
|
||||
{:else}
|
||||
<p>No references</p>
|
||||
{/each}
|
||||
@@ -249,7 +234,7 @@
|
||||
<div class="reference-compare">
|
||||
<p class="text-success">Revision</p>
|
||||
{#each edges.revision as edge}
|
||||
<RevisionEdgeRow {edge}/>
|
||||
<RevisionEdgeRow {edge} />
|
||||
{:else}
|
||||
<p>No references</p>
|
||||
{/each}
|
||||
@@ -258,7 +243,5 @@
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
<script>
|
||||
import {afterUpdate, createEventDispatcher, getContext, onMount} from "svelte";
|
||||
import {
|
||||
afterUpdate,
|
||||
createEventDispatcher,
|
||||
getContext,
|
||||
onMount,
|
||||
} from "svelte";
|
||||
|
||||
import {isEqual} from "lodash";
|
||||
import FormField from "./FormField.svelte";
|
||||
import FilePreview from "./FilePreview.svelte";
|
||||
import ContentTabs from "./header/ContentTabs.svelte";
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||
import EditHeader from "./header/EditHeader.svelte";
|
||||
import axios from "axios";
|
||||
import Title from "./header/Title.svelte";
|
||||
import { apiPost, isEqual } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
const dispatch = createEventDispatcher();
|
||||
@@ -16,7 +20,7 @@
|
||||
export let record;
|
||||
export let graph = {
|
||||
records: [],
|
||||
edges: []
|
||||
edges: [],
|
||||
};
|
||||
export let isCreateMode;
|
||||
let originalContent;
|
||||
@@ -29,9 +33,7 @@
|
||||
} error(s)`
|
||||
: null;
|
||||
|
||||
let activeFields = schema.fields.filter(
|
||||
(f) => f.name !== "id"
|
||||
);
|
||||
let activeFields = schema.fields.filter((f) => f.name !== "id");
|
||||
|
||||
let tabname = "_default";
|
||||
let fieldToTabs = schema.fields.reduce((c, f) => {
|
||||
@@ -53,8 +55,6 @@
|
||||
data: JSON.parse(JSON.stringify(record.data)),
|
||||
schema: record.schema,
|
||||
status: record.status,
|
||||
_sys: JSON.parse(JSON.stringify(record._sys)),
|
||||
_file: JSON.parse(JSON.stringify(record._file)),
|
||||
edges: JSON.parse(JSON.stringify(graph.edges)),
|
||||
};
|
||||
}
|
||||
@@ -87,8 +87,6 @@
|
||||
data: record.data,
|
||||
schema: record.schema,
|
||||
status: record.status,
|
||||
_sys: record._sys,
|
||||
_file: record._file,
|
||||
edges: graph.edges,
|
||||
});
|
||||
}
|
||||
@@ -114,11 +112,12 @@
|
||||
return;
|
||||
}
|
||||
// remove trashed edges
|
||||
graph.edges = graph.edges?.filter((edge) => !edge._isTrashed && edge.source === record.id) ?? [];
|
||||
graph.edges =
|
||||
graph.edges?.filter(
|
||||
(edge) => !edge._isTrashed && edge.source === record.id,
|
||||
) ?? [];
|
||||
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/records", {
|
||||
apiPost(channel.lucentUrl + "/records", {
|
||||
record: record,
|
||||
edges: graph.edges,
|
||||
isCreateMode: isCreateMode,
|
||||
@@ -126,8 +125,8 @@
|
||||
.then(function (response) {
|
||||
console.log("SAVE: SAVED INLINE");
|
||||
|
||||
record = response.data.records[0];
|
||||
graph = response.data;
|
||||
record = response.records[0];
|
||||
graph = response;
|
||||
if (!isCreateMode) {
|
||||
setOriginalContent();
|
||||
}
|
||||
@@ -150,16 +149,13 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:beforeunload={beforeUnload}/>
|
||||
<svelte:window on:beforeunload={beforeUnload} />
|
||||
|
||||
<div class="inline-edit record-edit">
|
||||
<div class="tools-header">
|
||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab/>
|
||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab />
|
||||
{#if isCreateMode}
|
||||
<button
|
||||
class="button primary btn-spinner"
|
||||
on:click={save}
|
||||
>
|
||||
<button class="button primary btn-spinner" on:click={save}>
|
||||
<span
|
||||
class="spinner-border spinner-border-sm"
|
||||
role="status"
|
||||
@@ -181,24 +177,19 @@
|
||||
Save
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
<Title {schema} {record} {isCreateMode}/>
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<Title {schema} {record} {isCreateMode} />
|
||||
<ErrorAlert message={errorMessage} />
|
||||
|
||||
<div class=" mt-4" style="margin-bottom:150px;position:relative;">
|
||||
<ContentTabs
|
||||
{schema}
|
||||
{isCreateMode}
|
||||
bind:active={activeContentTab}
|
||||
/>
|
||||
<FilePreview {record} {schema}/>
|
||||
<ContentTabs {schema} {isCreateMode} bind:active={activeContentTab} />
|
||||
<FilePreview {record} {schema} />
|
||||
<!-- <fieldset disabled="disabled"> -->
|
||||
{#each activeFields as field (field.name)}
|
||||
{#if activeContentTab === field.group}
|
||||
<FormField
|
||||
bind:data={record.data}
|
||||
bind:graph={graph}
|
||||
bind:graph
|
||||
{field}
|
||||
{schema}
|
||||
{record}
|
||||
@@ -210,4 +201,3 @@
|
||||
<!-- </fieldset> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import Mustache from "mustache";
|
||||
import {stripHtml} from "../../helpers";
|
||||
|
||||
export function previewTitle(schemas, record, graph) {
|
||||
let schema = schemas.find((aSchema) => aSchema.name === record?.schema);
|
||||
if (!schema?.cardTitle) {
|
||||
return noTemplate(schema, record);
|
||||
}
|
||||
|
||||
let recordData = record.data;
|
||||
let render = Mustache.render(schema.cardTitle, recordData);
|
||||
if (!render || render === "") {
|
||||
return noTemplate(schema, record);
|
||||
}
|
||||
|
||||
return stripHtml(render.slice(0, 300));
|
||||
}
|
||||
|
||||
function noTemplate(schema, record) {
|
||||
if (schema?.type === "files") {
|
||||
return record._file.path;
|
||||
}
|
||||
|
||||
let title = stripHtml(
|
||||
record?.data[schema.fields.filter((f) => f.info.name === "text")[0]?.name]
|
||||
).slice(0, 300);
|
||||
|
||||
if(title.trim() === ""){
|
||||
return "~Untitled~";
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
@@ -1,24 +1,13 @@
|
||||
<script>
|
||||
import {previewTitle} from "./Preview";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let record;
|
||||
export let graph;
|
||||
$: schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
||||
|
||||
$: title = previewTitle(channel.schemas, record, graph);
|
||||
$: title = record.data.name;
|
||||
</script>
|
||||
|
||||
{#if record?.data}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
class="text-decoration-none rounded py-1 px-2 d-inline-block"
|
||||
{title}
|
||||
style="border:2px solid {!schema.color
|
||||
? '#999'
|
||||
: schema.color}!important;white-space: nowrap;"
|
||||
>
|
||||
<a href="{channel.lucentUrl}/records/{record.id}" {title} class="reference">
|
||||
{title}
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
@@ -9,13 +9,17 @@
|
||||
export let value;
|
||||
export let isCreateMode;
|
||||
export let validationErrors;
|
||||
|
||||
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
|
||||
export let id;
|
||||
let wrapperDiv;
|
||||
let pickerInput;
|
||||
let pickerInstance;
|
||||
let flatpickrOptions = {
|
||||
appendTo: wrapperDiv,
|
||||
static: true,
|
||||
allowInput: true,
|
||||
altInput: true,
|
||||
altFormat: "Y-m-d H:i:S",
|
||||
@@ -40,7 +44,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
<div class="mb-0" bind:this={wrapperDiv}>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
|
||||
@@ -1,84 +1,73 @@
|
||||
<script>
|
||||
import {sortByField} from "../../edges/sortEdges";
|
||||
import { array_move } from "../../edges/sortEdges";
|
||||
import Sortable from "../../libs/Sortable.svelte";
|
||||
import PreviewFile from "../previews/PreviewFile.svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import Dialog from "../../dialog/Dialog.svelte";
|
||||
import {insertEdges} from "./reference.js";
|
||||
import {getContext} from "svelte";
|
||||
import FileDialog from "../../dialog/FileDialog.svelte";
|
||||
import Uploader from "../../files/Uploader.svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let field;
|
||||
export let record;
|
||||
export let graph
|
||||
export let value = [];
|
||||
let browseModal;
|
||||
$: references = graph?.edges
|
||||
.filter((edge) => edge.field === field.name)
|
||||
.map((edge) => {
|
||||
return graph.records.find((increc) => increc.id === edge.target && record.id === edge.source);
|
||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let collections = channel.schemas.filter((aschema) =>
|
||||
field.collections.includes(aschema.name)
|
||||
);
|
||||
|
||||
function removeReference(e) {
|
||||
function removeFile(e) {
|
||||
e.preventDefault();
|
||||
graph.edges = graph.edges.filter(
|
||||
(edge) => !(edge.target === e.detail && edge.field === field.name)
|
||||
);
|
||||
}
|
||||
|
||||
function openBrowseModal(e, schema) {
|
||||
e.preventDefault();
|
||||
browseModal.open(schema);
|
||||
value = value.filter((f) => !(f.id === e.detail));
|
||||
}
|
||||
|
||||
async function reorder(e) {
|
||||
|
||||
graph.edges = await sortByField(e.detail.source, e.detail.target, graph.edges, field.name, references);
|
||||
|
||||
value = await array_move(value, e.detail.source, e.detail.target);
|
||||
}
|
||||
|
||||
function insert(e) {
|
||||
function insertFiles(e) {
|
||||
e.preventDefault();
|
||||
browseModal.close();
|
||||
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
|
||||
value = [...(value ?? []), ...(e.detail.files ?? [])];
|
||||
}
|
||||
|
||||
function replaceFiles(e) {
|
||||
e.preventDefault();
|
||||
browseModal.close();
|
||||
value = e.detail ?? [];
|
||||
}
|
||||
|
||||
function uploadComplete(e) {
|
||||
value = [...value, ...e.detail];
|
||||
}
|
||||
|
||||
function openBrowseModal(e) {
|
||||
e.preventDefault();
|
||||
browseModal.open(record.id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
{#if field.collections.length === 1}
|
||||
<button
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, collections[0].name)}
|
||||
>
|
||||
Browse
|
||||
<div
|
||||
class="mb-0"
|
||||
style="display: flex; align-items: start; justify-content: start; gap:6px"
|
||||
>
|
||||
<button class="button" on:click={openBrowseModal}>
|
||||
<Icon icon="photo-film"></Icon> Browse
|
||||
</button>
|
||||
{:else}
|
||||
<Dropdown>
|
||||
<div slot="button">
|
||||
Browse
|
||||
</div>
|
||||
{#each collections as collection}
|
||||
<!-- {`${channelurl}/content/${collection.name}?parent=${record.id}&parentfield=${field.name}`} -->
|
||||
<a
|
||||
class="dropdown-item"
|
||||
on:click={(e) => openBrowseModal(e, collection.name)}
|
||||
href="/">{collection.label}</a
|
||||
>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
{/if}
|
||||
|
||||
<Uploader recordId={record.id} on:uploadComplete={uploadComplete} />
|
||||
</div>
|
||||
{#if references.length > 0}
|
||||
{#if value.length > 0}
|
||||
<Sortable sortableClass="mt-3" on:update={reorder}>
|
||||
{#each references as reference (reference.id)}
|
||||
{#each value ?? [] as aFile (aFile.id)}
|
||||
<!--This div helps the sorting thing-->
|
||||
<div>
|
||||
<PreviewFile record={reference} hasDelete={true} on:remove={removeReference}></PreviewFile>
|
||||
<PreviewFile
|
||||
file={aFile}
|
||||
hasDelete={true}
|
||||
on:remove_file={removeFile}
|
||||
></PreviewFile>
|
||||
</div>
|
||||
{/each}
|
||||
</Sortable>
|
||||
{/if}
|
||||
<Dialog bind:this={browseModal} on:insert={insert}></Dialog>
|
||||
<FileDialog
|
||||
bind:this={browseModal}
|
||||
on:insert_files={insertFiles}
|
||||
on:replace_files={replaceFiles}
|
||||
></FileDialog>
|
||||
@@ -1,20 +1,34 @@
|
||||
<script>
|
||||
import { getContext } from "svelte";
|
||||
import { htmlurl, presetUrl } from "../../files/imageserver";
|
||||
import Codemirror from "../../libs/CodemirrorMarkdown.svelte";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
|
||||
|
||||
import RichEditorFiles from "./RichEditorFiles.svelte";
|
||||
const channel = getContext("channel");
|
||||
export let value;
|
||||
export let field;
|
||||
|
||||
export let record;
|
||||
export let isCreateMode;
|
||||
// export let id;
|
||||
export let validationErrors;
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
let editor;
|
||||
|
||||
function onFilesInserted(e) {
|
||||
const presetPath = e.detail.preset.path;
|
||||
editor.insertMedia(channel, e.detail.files, presetPath);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mb-3">
|
||||
|
||||
<Codemirror bind:value editable={!field.readonly || isCreateMode} />
|
||||
<RichEditorFiles {record} {field} {validationErrors} {onFilesInserted}
|
||||
></RichEditorFiles>
|
||||
<Codemirror
|
||||
bind:this={editor}
|
||||
bind:value
|
||||
editable={!field.readonly || isCreateMode}
|
||||
/>
|
||||
|
||||
{#if errorMessage}
|
||||
<div class="invalid-feedback d-block">
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import {insertEdges} from "./reference";
|
||||
import {getErrorMessage} from "./errorMessage";
|
||||
import {sortByField} from "../../edges/sortEdges";
|
||||
import { getContext } from "svelte";
|
||||
import { insertEdges } from "./reference";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
import { sortByField } from "../../edges/sortEdges";
|
||||
import ReferenceInlineButtons from "./ReferenceInlineButtons.svelte";
|
||||
import Sortable from "../../libs/Sortable.svelte";
|
||||
import PreviewReference from "../previews/PreviewReference.svelte";
|
||||
import axios from "axios";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let record;
|
||||
@@ -15,27 +14,36 @@
|
||||
export let validationErrors;
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
|
||||
|
||||
$: references = graph.edges
|
||||
$: references =
|
||||
graph.edges
|
||||
.filter((edge) => edge.field === field.name)
|
||||
.map((edge) => {
|
||||
return graph.records.find((increc) => increc.id === edge.target && record.id === edge.source);
|
||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
return graph.records.find(
|
||||
(increc) =>
|
||||
increc.id === edge.target && record.id === edge.source,
|
||||
);
|
||||
})
|
||||
.filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let collections = channel.schemas.filter((aschema) =>
|
||||
field.collections.includes(aschema.name)
|
||||
field.collections.includes(aschema.name),
|
||||
);
|
||||
|
||||
function removeReference(e) {
|
||||
e.preventDefault();
|
||||
graph.edges = graph.edges.filter(
|
||||
(edge) => !(edge.target === e.detail && edge.field === field.name)
|
||||
(edge) => !(edge.target === e.detail && edge.field === field.name),
|
||||
);
|
||||
}
|
||||
|
||||
function reorder(e) {
|
||||
|
||||
graph.edges = sortByField(e.detail.source, e.detail.target, graph.edges, field.name, references);
|
||||
graph.edges = sortByField(
|
||||
e.detail.source,
|
||||
e.detail.target,
|
||||
graph.edges,
|
||||
field.name,
|
||||
references,
|
||||
);
|
||||
}
|
||||
|
||||
function insert(e) {
|
||||
@@ -49,9 +57,14 @@
|
||||
// }).then(function (response) {
|
||||
// graph = response.data.graph;
|
||||
// })
|
||||
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
|
||||
graph = insertEdges(
|
||||
graph,
|
||||
record,
|
||||
e.detail.records,
|
||||
field.name,
|
||||
e.detail.action,
|
||||
);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{#if errorMessage}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import InlineEdit from "../InlineEdit.svelte";
|
||||
import Dialog from "../../dialog/Dialog.svelte";
|
||||
import DialogRecord from "../../dialog/DialogRecord.svelte";
|
||||
import axios from "axios";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import { apiGet } from "../../../helpers";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const channel = getContext("channel");
|
||||
@@ -24,7 +24,7 @@
|
||||
e.preventDefault();
|
||||
console.log("Save inline");
|
||||
inLineCreateRecord = null;
|
||||
dialogRecord.close()
|
||||
dialogRecord.close();
|
||||
dispatch("save", {
|
||||
records: e.detail.records,
|
||||
after: recordId,
|
||||
@@ -43,11 +43,11 @@
|
||||
|
||||
function createInlineReference(e, schemaUId) {
|
||||
e.preventDefault();
|
||||
axios
|
||||
.get(channel.lucentUrl + "/records/newInline?schema=" + schemaUId)
|
||||
inLineCreateRecord = null;
|
||||
apiGet(channel.lucentUrl + "/records/newInline?schema=" + schemaUId)
|
||||
.then((response) => {
|
||||
inLineCreateRecord = response.data;
|
||||
dialogRecord.open()
|
||||
inLineCreateRecord = response;
|
||||
dialogRecord.open();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
@@ -56,30 +56,27 @@
|
||||
</script>
|
||||
|
||||
{#if schemas.length > 1}
|
||||
<div
|
||||
style="display: flex;align-items: center;gap:4px"
|
||||
>
|
||||
{#each schemas as schema}
|
||||
<div style="display: flex;align-items: center;gap:4px">
|
||||
<Dropdown>
|
||||
<div slot="button" class:is-first={!recordId}>
|
||||
{schema.label}
|
||||
</div>
|
||||
<div slot="button">New</div>
|
||||
{#each schemas as schema}
|
||||
<button
|
||||
class=" button"
|
||||
on:click={(e) =>
|
||||
createInlineReference(e, schema.name)}
|
||||
>Create New Record
|
||||
on:click={(e) => createInlineReference(e, schema.name)}
|
||||
>{schema.label}
|
||||
</button>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
<Dropdown>
|
||||
<div slot="button"><Icon icon="magnifying-glass" /></div>
|
||||
{#each schemas as schema}
|
||||
<button
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, schema.name)}
|
||||
>
|
||||
<Icon icon="magnifying-glass"/>
|
||||
Search
|
||||
</button
|
||||
>
|
||||
</Dropdown>
|
||||
>{schema.label}
|
||||
</button>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
</div>
|
||||
{:else}
|
||||
<div style="display:flex;align-items: center;gap: 4px">
|
||||
@@ -92,22 +89,20 @@
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, schemas[0].name)}
|
||||
>
|
||||
<Icon icon="magnifying-glass"/>
|
||||
</button
|
||||
>
|
||||
<Icon icon="magnifying-glass" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<DialogRecord bind:this={dialogRecord}>
|
||||
{#if inLineCreateRecord}
|
||||
|
||||
<InlineEdit
|
||||
{...inLineCreateRecord}
|
||||
isCreateMode={true}
|
||||
on:cancel={(e) => (inLineCreateRecord = null)}
|
||||
on:inlinesaved={save}
|
||||
/>
|
||||
|
||||
{/if}
|
||||
</DialogRecord>
|
||||
|
||||
<Dialog bind:this={browseModal} on:insert={insert}/>
|
||||
<Dialog bind:this={browseModal} on:insert={insert} />
|
||||
@@ -1,9 +1,7 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import {debounce} from "lodash";
|
||||
import {previewTitle} from "../Preview";
|
||||
import {getErrorMessage} from "./errorMessage";
|
||||
import {insertEdges} from "./reference.js";
|
||||
import { getContext } from "svelte";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
import { insertEdges } from "./reference.js";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
@@ -15,20 +13,24 @@
|
||||
export let validationErrors;
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
|
||||
$: references = graph.edges
|
||||
$: references =
|
||||
graph.edges
|
||||
.filter((edge) => edge.field === field.name)
|
||||
.map((edge) => {
|
||||
return graph.records.find((increc) => increc.id == edge.target && record.id == edge.source);
|
||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let search = ""
|
||||
$: searchOptions = []
|
||||
return graph.records.find(
|
||||
(increc) =>
|
||||
increc.id == edge.target && record.id == edge.source,
|
||||
);
|
||||
})
|
||||
.filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let search = "";
|
||||
$: searchOptions = [];
|
||||
|
||||
function removeReference(e, recordId) {
|
||||
e.preventDefault();
|
||||
graph.edges = graph.edges.filter(
|
||||
(edge) => !(edge.target === recordId && edge.field === field.name)
|
||||
(edge) => !(edge.target === recordId && edge.field === field.name),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,14 +43,14 @@
|
||||
schema: field.collections[0],
|
||||
status: "published",
|
||||
data: {
|
||||
[field.searchField]: newValue
|
||||
}
|
||||
[field.searchField]: newValue,
|
||||
},
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
searchOptions = [];
|
||||
insert(e, response.data.records[0]);
|
||||
console.log(response)
|
||||
console.log(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
searchOptions = [];
|
||||
@@ -58,10 +60,16 @@
|
||||
|
||||
function insert(e, insertRecord) {
|
||||
e.preventDefault();
|
||||
graph = insertEdges(graph, record, [insertRecord], field.name, e.detail.action);
|
||||
search = ""
|
||||
searchEl.focus()
|
||||
searchEl.blur()
|
||||
graph = insertEdges(
|
||||
graph,
|
||||
record,
|
||||
[insertRecord],
|
||||
field.name,
|
||||
e.detail.action,
|
||||
);
|
||||
search = "";
|
||||
searchEl.focus();
|
||||
searchEl.blur();
|
||||
}
|
||||
|
||||
const updateResults = debounce((e) => {
|
||||
@@ -82,9 +90,8 @@
|
||||
console.log(error);
|
||||
});
|
||||
}, 500);
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div class="reference-tags">
|
||||
{#if errorMessage}
|
||||
<div class="invalid-feedback d-block mb-3">
|
||||
@@ -99,12 +106,11 @@
|
||||
on:keyup={updateResults}
|
||||
class:is-invalid={errorMessage}
|
||||
bind:value={search}
|
||||
placeholder={"Search for "+field.label}
|
||||
placeholder={"Search for " + field.label}
|
||||
autocomplete="off"
|
||||
/>
|
||||
|
||||
<div class="reference-tags-results">
|
||||
|
||||
{#if searchOptions}
|
||||
{#each searchOptions as option (option.id)}
|
||||
<div
|
||||
@@ -114,23 +120,19 @@
|
||||
on:click={(e) => insert(e, option)}
|
||||
on:keypress={(e) => insert(e, option)}
|
||||
>
|
||||
{previewTitle(channel.schemas, option ,graph)}
|
||||
{option.data.name}
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<div
|
||||
class="start-typing">
|
||||
Start typing...
|
||||
</div>
|
||||
<div class="start-typing">Start typing...</div>
|
||||
{/each}
|
||||
{/if}
|
||||
{#if search }
|
||||
{#if search}
|
||||
<div
|
||||
class="reference-tags-option"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
on:click={(e) => saveNew(e,search)}
|
||||
on:keypress={(e) => saveNew(e,search)}
|
||||
on:click={(e) => saveNew(e, search)}
|
||||
on:keypress={(e) => saveNew(e, search)}
|
||||
>
|
||||
Add "{search}"
|
||||
</div>
|
||||
@@ -146,22 +148,19 @@
|
||||
class="record-title"
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
>
|
||||
{previewTitle(channel.schemas, record)}
|
||||
{record.data.name}
|
||||
</a>
|
||||
|
||||
<button
|
||||
on:click|preventDefault={(e) => removeReference(e, record.id)}
|
||||
on:click|preventDefault={(e) =>
|
||||
removeReference(e, record.id)}
|
||||
type="button"
|
||||
class="button-text"
|
||||
aria-label="Close"
|
||||
>
|
||||
<Icon width={12} height={12} icon="close"></Icon>
|
||||
</button>
|
||||
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
@@ -1,44 +1,32 @@
|
||||
<script>
|
||||
import Tinymce from "../../libs/Tinymce.svelte";
|
||||
import RichEditorFiles from "./RichEditorFiles.svelte";
|
||||
import {getErrorMessage} from "./errorMessage";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
import Trix from "../../libs/Trix.svelte";
|
||||
import { htmlurl } from "../../files/imageserver";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let value;
|
||||
export let field;
|
||||
export let isCreateMode;
|
||||
export let graph;
|
||||
export let record;
|
||||
export let validationErrors;
|
||||
|
||||
let editor;
|
||||
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
let additionalConfig = {
|
||||
readonly: field.readonly && !isCreateMode,
|
||||
};
|
||||
|
||||
function insertMedia(e){
|
||||
editor.insertMedia(e.detail)
|
||||
function onFilesInserted(e) {
|
||||
const presetPath = e.detail.preset.path;
|
||||
e.detail.files.map((aFile) => {
|
||||
const html = htmlurl(channel, aFile, presetPath);
|
||||
editor.insertMedia(html);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
|
||||
|
||||
<Tinymce bind:this={editor} bind:value {additionalConfig}/>
|
||||
{#if field.collections.length > 0}
|
||||
<RichEditorFiles
|
||||
bind:graph
|
||||
{record}
|
||||
{field}
|
||||
{validationErrors}
|
||||
on:editor-insert={insertMedia}
|
||||
>
|
||||
|
||||
|
||||
</RichEditorFiles>
|
||||
{/if}
|
||||
<!-- <TipTap bind:value />-->
|
||||
<Trix {field} bind:this={editor} bind:value></Trix>
|
||||
<RichEditorFiles {record} {field} {onFilesInserted}></RichEditorFiles>
|
||||
|
||||
{#if errorMessage}
|
||||
<div class="invalid-feedback d-block">
|
||||
|
||||
@@ -1,77 +1,48 @@
|
||||
<script>
|
||||
import {sortByField} from "../../edges/sortEdges";
|
||||
import Sortable from "../../libs/Sortable.svelte";
|
||||
import PreviewFile from "../previews/PreviewFile.svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import Dialog from "../../dialog/Dialog.svelte";
|
||||
import {insertEdges} from "./reference.js";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import FileDialog from "../../dialog/FileDialog.svelte";
|
||||
import Uploader from "../../files/Uploader.svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let field;
|
||||
export let record;
|
||||
export let graph
|
||||
export let onFilesInserted;
|
||||
let browseModal;
|
||||
$: references = graph?.edges
|
||||
.filter((edge) => edge.field === field.name)
|
||||
.map((edge) => {
|
||||
return graph.records.find((increc) => increc.id === edge.target && record.id === edge.source);
|
||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let collections = channel.schemas.filter((aschema) =>
|
||||
field.collections.includes(aschema.name)
|
||||
);
|
||||
|
||||
function removeReference(e) {
|
||||
function openBrowseModal(e) {
|
||||
e.preventDefault();
|
||||
graph.edges = graph.edges.filter(
|
||||
(edge) => !(edge.target === e.detail && edge.field === field.name)
|
||||
);
|
||||
browseModal.open(record.id);
|
||||
}
|
||||
|
||||
function openBrowseModal(e, schema) {
|
||||
function insertFiles(e) {
|
||||
e.preventDefault();
|
||||
browseModal.open(schema);
|
||||
onFilesInserted(e);
|
||||
browseModal.close();
|
||||
}
|
||||
|
||||
function insert(e) {
|
||||
function replaceFiles(e) {
|
||||
e.preventDefault();
|
||||
browseModal.close();
|
||||
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
|
||||
}
|
||||
|
||||
function uploadComplete(e) {}
|
||||
</script>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="mt-4 mb-3">Rich editor files</label>
|
||||
{#if field.collections.length === 1}
|
||||
<button
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, collections[0].name)}
|
||||
>
|
||||
Browse
|
||||
<div
|
||||
class="mb-0"
|
||||
style="display: flex; align-items: start; justify-content: start; gap:6px"
|
||||
>
|
||||
<button class="button" on:click={openBrowseModal}>
|
||||
<Icon icon="photo-film"></Icon> Browse
|
||||
</button>
|
||||
{:else}
|
||||
<Dropdown>
|
||||
<div slot="button">
|
||||
Browse
|
||||
</div>
|
||||
{#each collections as collection}
|
||||
<!-- {`${channelurl}/content/${collection.name}?parent=${record.id}&parentfield=${field.name}`} -->
|
||||
<a
|
||||
class="dropdown-item"
|
||||
on:click={(e) => openBrowseModal(e, collection.name)}
|
||||
href="/">{collection.label}</a
|
||||
>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
{/if}
|
||||
|
||||
<Uploader recordId={record.id} on:uploadComplete={uploadComplete} />
|
||||
</div>
|
||||
{#if references.length > 0}
|
||||
{#each references as reference (reference.id)}
|
||||
<!--This div helps the sorting thing-->
|
||||
<div>
|
||||
<PreviewFile record={reference} hasDelete={true} hasInsert={true} on:remove={removeReference} on:editor-insert></PreviewFile>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
<Dialog bind:this={browseModal} on:insert={insert}></Dialog>
|
||||
|
||||
<FileDialog
|
||||
bind:this={browseModal}
|
||||
on:insert_files={insertFiles}
|
||||
on:replace_files={replaceFiles}
|
||||
presetMode={true}
|
||||
></FileDialog>
|
||||
@@ -1,5 +1,4 @@
|
||||
<script>
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
@@ -14,12 +13,11 @@
|
||||
|
||||
function generateId(e) {
|
||||
e.preventDefault();
|
||||
value = uuidv4();
|
||||
value = self.crypto.randomUUID();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<input
|
||||
type="text"
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<script>
|
||||
import { uniqueId } from "lodash";
|
||||
import { getContext } from "svelte";
|
||||
const channelurl = getContext("channelurl");
|
||||
export let field;
|
||||
export let value;
|
||||
export let schema;
|
||||
let id = uniqueId();
|
||||
let id = self.crypto.randomUUID();
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import {uniqBy} from "lodash";
|
||||
import { arrayUniqueCb } from "../../../helpers";
|
||||
|
||||
export function insertEdges(graph, sourceRecord, targetRecords, fieldName, action = "") {
|
||||
export function insertEdges(
|
||||
graph,
|
||||
sourceRecord,
|
||||
targetRecords,
|
||||
fieldName,
|
||||
action = "",
|
||||
) {
|
||||
let newEdges = targetRecords.map((r) => {
|
||||
return {
|
||||
target: r.id,
|
||||
@@ -9,7 +15,7 @@ export function insertEdges(graph, sourceRecord, targetRecords, fieldName, actio
|
||||
targetSchema: r.schema,
|
||||
field: fieldName,
|
||||
depth: 1,
|
||||
rank: ""
|
||||
rank: "",
|
||||
};
|
||||
});
|
||||
|
||||
@@ -18,7 +24,13 @@ export function insertEdges(graph, sourceRecord, targetRecords, fieldName, actio
|
||||
replacedEdges = replacedEdges.filter((edge) => edge.field !== field.name);
|
||||
}
|
||||
|
||||
graph.records = uniqBy([...graph.records, ...targetRecords], (r) => r.id);
|
||||
graph.edges = uniqBy([...replacedEdges, ...newEdges], (edge) => edge.source + edge.target + edge.field + edge.depth);
|
||||
graph.records = arrayUniqueCb(
|
||||
[...graph.records, ...targetRecords],
|
||||
(r) => r.id,
|
||||
);
|
||||
graph.edges = arrayUniqueCb(
|
||||
[...replacedEdges, ...newEdges],
|
||||
(edge) => edge.source + edge.target + edge.field + edge.depth,
|
||||
);
|
||||
return graph;
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import StatusSelect from "./StatusSelect.svelte";
|
||||
import { apiPost } from "../../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let schema;
|
||||
@@ -12,21 +13,19 @@
|
||||
|
||||
function clone(e) {
|
||||
e.preventDefault();
|
||||
axios.post(channel.lucentUrl + "/records/clone/" + record.id).then(response => {
|
||||
window.location = channel.lucentUrl + "/records/" + response.data.id;
|
||||
}).catch(error => {
|
||||
|
||||
});
|
||||
apiPost(channel.lucentUrl + "/records/clone/" + record.id)
|
||||
.then((response) => {
|
||||
window.location = channel.lucentUrl + "/records/" + response.id;
|
||||
})
|
||||
.catch((error) => {});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<div style="display: flex;align-items: center; gap:10px;">
|
||||
{#if !isCreateMode}
|
||||
<Dropdown >
|
||||
<Dropdown>
|
||||
<div slot="button">
|
||||
<Icon icon="ellipsis"/>
|
||||
<Icon icon="ellipsis" />
|
||||
</div>
|
||||
<h6 class="dropdown-header">Record Actions</h6>
|
||||
<a
|
||||
@@ -44,13 +43,12 @@
|
||||
</a>
|
||||
{/if}
|
||||
<a
|
||||
on:click|preventDefault={(e) =>
|
||||
(activeContentTab = "_info")}
|
||||
on:click|preventDefault={(e) => (activeContentTab = "_info")}
|
||||
class="dropdown-item"
|
||||
href="{channel.lucentUrl}">Revisions</a
|
||||
href={channel.lucentUrl}>Revisions</a
|
||||
>
|
||||
</Dropdown>
|
||||
{/if}
|
||||
|
||||
<StatusSelect bind:status={record.status} {record}></StatusSelect>
|
||||
<StatusSelect bind:status={record.status} {record}></StatusSelect>
|
||||
</div>
|
||||
@@ -1,27 +1,21 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import {previewTitle} from "./../Preview";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let schema;
|
||||
export let record;
|
||||
export let isCreateMode;
|
||||
|
||||
</script>
|
||||
|
||||
<div class="record-header">
|
||||
|
||||
<a
|
||||
class="schema-name"
|
||||
href="{channel.lucentUrl}/content/{schema.name}"
|
||||
<a class="schema-name" href="{channel.lucentUrl}/content/{schema.name}"
|
||||
>{schema.label.toUpperCase()}</a
|
||||
>
|
||||
<span class="record-title">
|
||||
{#if !isCreateMode}
|
||||
{previewTitle(channel.schemas, record)}
|
||||
{record.data.name}
|
||||
{:else}
|
||||
New Record
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
</div>
|
||||
@@ -1,85 +1,40 @@
|
||||
<script>
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import Preview from "../../files/Preview.svelte";
|
||||
import {previewTitle} from "./../Preview";
|
||||
import {htmlurl} from "../../files/imageserver.js"
|
||||
import Status from "./../Status.svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const channel = getContext("channel");
|
||||
export let record;
|
||||
export let hasDelete = false;
|
||||
export let hasInsert = false;
|
||||
|
||||
let schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
||||
let cardTitle = previewTitle(channel.schemas, record);
|
||||
let imagePresets = Object.keys(channel.imageFilters);
|
||||
export let file;
|
||||
export let hasDelete = false;
|
||||
|
||||
function remove(e) {
|
||||
e.preventDefault();
|
||||
dispatch("remove", record.id);
|
||||
dispatch("remove_file", file.id);
|
||||
}
|
||||
|
||||
function insert(e, preset) {
|
||||
e.preventDefault();
|
||||
let html = htmlurl(channel,record, preset)
|
||||
dispatch("editor-insert", html);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="preview-file">
|
||||
<div style="display: flex;align-items: center;gap: 10px;">
|
||||
<div class="image">
|
||||
<Preview {record} size="small"/>
|
||||
<Preview {file} size="small" />
|
||||
</div>
|
||||
<div class="title">
|
||||
<div>
|
||||
<a
|
||||
class="record-title"
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
{file.filename}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="display: flex;gap:4px; align-items: center; margin-right: 10px;"
|
||||
>
|
||||
{cardTitle}
|
||||
</a>
|
||||
<small class="d-block">
|
||||
from {schema.label}
|
||||
{#if record.status === "draft"}
|
||||
<Status status={record.status}/>
|
||||
{/if}
|
||||
</small>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;gap:4px; align-items: center; margin-right: 10px;">
|
||||
{#if hasInsert}
|
||||
<div class="reference-action">
|
||||
<Dropdown>
|
||||
<div slot="button">
|
||||
<Icon icon="photo-film"/>
|
||||
</div>
|
||||
<button class="dropdown-item button" on:click={e => insert(e,null)}>original</button>
|
||||
{#each imagePresets as preset}
|
||||
<button class="dropdown-item button" on:click={e => insert(e,preset)}>{preset}</button>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
{#if hasDelete}
|
||||
<div class="reference-action">
|
||||
<button
|
||||
class="button"
|
||||
on:click={remove}
|
||||
>
|
||||
<Icon icon="trash-can"/>
|
||||
<button class="button" on:click={remove}>
|
||||
<Icon icon="trash-can" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<script>
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import {previewTitle} from "./../Preview";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Status from "./../Status.svelte";
|
||||
import Preview from "../../files/Preview.svelte";
|
||||
|
||||
@@ -12,10 +11,15 @@
|
||||
export let record;
|
||||
export let hasDelete = false;
|
||||
|
||||
let schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
||||
let cardTitle = previewTitle(channel.schemas, record, graph);
|
||||
const cardImageEdge = graph.edges.find(e => e.source === record.id && e.field === schema.cardImage);
|
||||
let cardImageRecord = graph.records.find(r => r.id === cardImageEdge?.target);
|
||||
let schema = channel.schemas.find(
|
||||
(aschema) => aschema.name === record.schema,
|
||||
);
|
||||
const cardImageEdge = graph.edges.find(
|
||||
(e) => e.source === record.id && e.field === schema.cardImage,
|
||||
);
|
||||
let cardImageRecord = graph.records.find(
|
||||
(r) => r.id === cardImageEdge?.target,
|
||||
);
|
||||
|
||||
function remove(e) {
|
||||
e.preventDefault();
|
||||
@@ -23,13 +27,11 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="preview-reference">
|
||||
<div style="display: flex;align-items: center;gap: 10px;">
|
||||
|
||||
{#if cardImageRecord}
|
||||
<div class="image">
|
||||
<Preview record={cardImageRecord} size="small"/>
|
||||
<Preview record={cardImageRecord} size="small" />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="title">
|
||||
@@ -38,28 +40,22 @@
|
||||
class="record-title"
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
>
|
||||
{cardTitle}
|
||||
{record.data.name}
|
||||
</a>
|
||||
<small class="d-block">
|
||||
from {schema.label}
|
||||
{#if record.status === "draft"}
|
||||
<Status status={record.status}/>
|
||||
<Status status={record.status} />
|
||||
{/if}
|
||||
</small>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{#if hasDelete}
|
||||
<div class="reference-action">
|
||||
<button
|
||||
class="button"
|
||||
on:click={remove}
|
||||
>
|
||||
<Icon icon="trash-can"/>
|
||||
<button class="button" on:click={remove}>
|
||||
<Icon icon="trash-can" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import Preview from "../../files/Preview.svelte";
|
||||
import PreviewCardSmall from "../PreviewCardSmall.svelte";
|
||||
import PreviewFile from "../previews/PreviewFile.svelte";
|
||||
|
||||
export let field;
|
||||
export let side;
|
||||
@@ -8,26 +8,23 @@
|
||||
export let colorClass;
|
||||
</script>
|
||||
|
||||
{#if ["reference", "file"].includes(field.info.name)}
|
||||
{#if ["reference"].includes(field.info.name)}
|
||||
<div class="{colorClass} field-content">
|
||||
<div class="d-flex align-items-center text-center flex-wrap">
|
||||
{#each edges[field.name] as edgeRecord}
|
||||
{#if edgeRecord._file?.path}
|
||||
<div
|
||||
class="ms-2 "
|
||||
style="max-width:64px;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;"
|
||||
>
|
||||
<Preview
|
||||
record={edgeRecord}
|
||||
size="small"
|
||||
showFilename={true}
|
||||
/>
|
||||
<div class="ms-2">
|
||||
<PreviewCardSmall record={edgeRecord} />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="ms-2 ">
|
||||
<PreviewCardSmall record={edgeRecord}/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{:else if ["file"].includes(field.info.name)}
|
||||
<div class="{colorClass} field-content">
|
||||
<div class="d-flex align-items-center text-center flex-wrap">
|
||||
{#each side as aFile}
|
||||
<div class="ms-2">
|
||||
<PreviewFile file={aFile} />
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,7 +40,6 @@
|
||||
|
||||
<!-- {/if} -->
|
||||
<style>
|
||||
|
||||
.field-content {
|
||||
max-height: 200px;
|
||||
overflow-y: scroll;
|
||||
|
||||
Generated
+292
-864
File diff suppressed because it is too large.
Load diff
+1
-27
@@ -11,41 +11,15 @@
|
||||
"@codemirror/lang-markdown": "^6.2.5",
|
||||
"@codemirror/state": "^6.4.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
||||
"@tiptap/core": "^2.6.4",
|
||||
"@tiptap/extension-blockquote": "^2.6.4",
|
||||
"@tiptap/extension-bold": "^2.6.4",
|
||||
"@tiptap/extension-bullet-list": "^2.6.4",
|
||||
"@tiptap/extension-code": "^2.6.4",
|
||||
"@tiptap/extension-document": "^2.6.4",
|
||||
"@tiptap/extension-heading": "^2.6.4",
|
||||
"@tiptap/extension-history": "^2.6.4",
|
||||
"@tiptap/extension-italic": "^2.6.4",
|
||||
"@tiptap/extension-list-item": "^2.6.4",
|
||||
"@tiptap/extension-ordered-list": "^2.6.4",
|
||||
"@tiptap/extension-paragraph": "^2.6.4",
|
||||
"@tiptap/extension-strike": "^2.6.4",
|
||||
"@tiptap/extension-table": "^2.6.4",
|
||||
"@tiptap/extension-table-cell": "^2.6.4",
|
||||
"@tiptap/extension-table-header": "^2.6.4",
|
||||
"@tiptap/extension-table-row": "^2.6.4",
|
||||
"@tiptap/extension-text": "^2.6.4",
|
||||
"@tiptap/extension-underline": "^2.6.4",
|
||||
"@tiptap/pm": "^2.6.4",
|
||||
"axios": "^1.7.4",
|
||||
"codemirror": "^6.0.1",
|
||||
"date-fns": "^3.6.0",
|
||||
"flatpickr": "^4.6.13",
|
||||
"fuse.js": "^7.0.0",
|
||||
"htmx.org": "^2.0.1",
|
||||
"laravel-vite-plugin": "^1.0.5",
|
||||
"lodash": "^4.17.21",
|
||||
"mustache": "^4.2.0",
|
||||
"postcss": "8.4.31",
|
||||
"sass": "^1.77.8",
|
||||
"sortablejs": "^1.15.2",
|
||||
"svelte": "^4.2.18",
|
||||
"tinymce": "^6.8.4",
|
||||
"uuid": "^10.0.0",
|
||||
"trix": "^2.1.5",
|
||||
"vite": "5.2.6"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
.autocomplete {
|
||||
position: relative;
|
||||
z-index: 1000;
|
||||
overflow: visible;
|
||||
.autocomplete-option {
|
||||
@@ -12,12 +11,10 @@
|
||||
}
|
||||
}
|
||||
&:focus-within {
|
||||
.autocomplete-results{
|
||||
.autocomplete-results {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.autocomplete-selected-value {
|
||||
font-size: 13px;
|
||||
|
||||
+10
-13
@@ -1,4 +1,4 @@
|
||||
.button{
|
||||
.button {
|
||||
border-radius: 12px;
|
||||
background: var(--p20);
|
||||
padding: 3px 10px;
|
||||
@@ -11,7 +11,6 @@
|
||||
gap: 4px;
|
||||
color: var(--text);
|
||||
|
||||
|
||||
&:focus {
|
||||
}
|
||||
|
||||
@@ -20,20 +19,20 @@
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: var(--p50)!important;
|
||||
background: var(--p50) !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
&.active {
|
||||
background: var(--p30);
|
||||
}
|
||||
|
||||
&.secondary{
|
||||
&.secondary {
|
||||
background: var(--p30);
|
||||
&:hover {
|
||||
background: var(--p40);
|
||||
}
|
||||
}
|
||||
&.primary{
|
||||
&.primary {
|
||||
background: var(--p70);
|
||||
color: var(--p10);
|
||||
|
||||
@@ -42,36 +41,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&[disabled] {
|
||||
pointer-events: none;
|
||||
opacity: .7;
|
||||
opacity: 0.7;
|
||||
color: var(--text);
|
||||
}
|
||||
}
|
||||
|
||||
.upload-button{
|
||||
.upload-button {
|
||||
padding: 0;
|
||||
border: none;
|
||||
|
||||
|
||||
label{
|
||||
label {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
font-weight: normal;
|
||||
background: var(--p80)!important;
|
||||
background: var(--p80) !important;
|
||||
color: var(--p10);
|
||||
}
|
||||
}
|
||||
|
||||
.button-text{
|
||||
.button-text {
|
||||
border: none;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.spinner-border {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
|
||||
@@ -7,11 +7,16 @@
|
||||
|
||||
.cm-content{
|
||||
background-color: var(--p10);
|
||||
color: var(--p100);
|
||||
}
|
||||
}
|
||||
|
||||
.cm-content{
|
||||
background-color: var(--p20);
|
||||
|
||||
}
|
||||
.ͼ4 .cm-line ::selection, .ͼ4 .cm-line::selection{
|
||||
background: var(--p40) !important;
|
||||
}
|
||||
|
||||
.cm-activeLine{
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
.flatpickr-wrapper {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.editor-field {
|
||||
.flatpickr-calendar {
|
||||
border-radius: 12px !important;
|
||||
}
|
||||
|
||||
.flatpickr-months .flatpickr-month {
|
||||
background: var(--p30);
|
||||
color: var(--text);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.flatpickr-current-month .flatpickr-monthDropdown-months {
|
||||
background: var(--p30);
|
||||
}
|
||||
|
||||
.flatpickr-weekdays{
|
||||
background: var(--p30);
|
||||
color: var(--text);
|
||||
|
||||
}
|
||||
|
||||
.flatpickr-weekdaycontainer .flatpickr-weekday{
|
||||
background: var(--p30);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.flatpickr-days{
|
||||
background: var(--p10);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.flatpickr-time{
|
||||
background: var(--p10);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ body:has(dialog[open]) {
|
||||
|
||||
dialog {
|
||||
margin: 2vh auto;
|
||||
background-color: #fff;
|
||||
background-color: var(--p10);
|
||||
padding: 34px;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
@@ -49,6 +49,6 @@ dialog::backdrop {
|
||||
position: sticky;
|
||||
top: -34px;
|
||||
z-index: 999;
|
||||
background: #fff;
|
||||
background-color: var(--p10);
|
||||
padding: 10px 0;
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
overflow: visible;
|
||||
position: absolute;
|
||||
border-radius: 12px;
|
||||
z-index: 20;
|
||||
z-index: 22;
|
||||
background: var(--p20);
|
||||
transition: 600ms;
|
||||
flex-grow: 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.record-edit {
|
||||
position: relative;
|
||||
|
||||
max-width: 900px;
|
||||
.invalid-feedback {
|
||||
color: var(--text-error);
|
||||
font-size: 15px;
|
||||
@@ -44,7 +44,7 @@
|
||||
margin: 6px 0;
|
||||
border-color: transparent;
|
||||
|
||||
.button {
|
||||
.button:not(.primary) {
|
||||
background: var(--p30);
|
||||
|
||||
&:hover {
|
||||
@@ -53,9 +53,10 @@
|
||||
}
|
||||
|
||||
dialog {
|
||||
.button {
|
||||
.button:not(.primary) {
|
||||
background: var(--p20);
|
||||
|
||||
|
||||
&:hover {
|
||||
background: var(--p30);
|
||||
}
|
||||
@@ -143,3 +144,4 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
.tiptap {
|
||||
width: 100%;
|
||||
background: var(--p20);
|
||||
border: 1px solid var(--p50);
|
||||
border-radius: 0 0 5px 5px;
|
||||
padding: 15px 15px;
|
||||
font-size: 16px;
|
||||
|
||||
:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
&:focus {
|
||||
background: var(--p10);
|
||||
|
||||
}
|
||||
|
||||
img {
|
||||
&.ProseMirror-selectednode {
|
||||
box-shadow: 0 0 1px 2px var(--p70);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.editor-field {
|
||||
.editor-toolbar {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
background: var(--p30);
|
||||
border-radius: 5px 5px 0 0;
|
||||
padding: 5px 7px;
|
||||
|
||||
.button:not(.primary) {
|
||||
font-weight: 700;
|
||||
|
||||
&.active {
|
||||
background: var(--p40);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
.tiptap {
|
||||
li > p {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
trix-editor {
|
||||
background: var(--p20)!important;
|
||||
border: 1px solid var(--p50)!important;
|
||||
border-radius: 0 0 5px 5px!important;
|
||||
padding: 15px 15px!important;
|
||||
& > div {
|
||||
margin-bottom: 14px;
|
||||
font-size: 16px;
|
||||
line-height: 23px;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
background: var(--p10)!important;
|
||||
|
||||
}
|
||||
figure.attachment{
|
||||
display: flex!important;
|
||||
flex-direction: column!important;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.attachment {
|
||||
background: var(--p20);
|
||||
padding: 12px 0;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[data-trix-mutable].attachment img {
|
||||
box-shadow: 0 0 1px 2px var(--p70) !important;
|
||||
|
||||
}
|
||||
|
||||
.trix-button--remove {
|
||||
box-shadow: none !important;
|
||||
border: 2px solid var(--p40) !important;
|
||||
}
|
||||
|
||||
.trix-button--remove:hover {
|
||||
border: 2px solid var(--p40);
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--p80);
|
||||
}
|
||||
}
|
||||
|
||||
trix-toolbar {
|
||||
.trix-button-row {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.trix-button-group {
|
||||
background: transparent !important;
|
||||
border: none !important;
|
||||
display: flex !important;
|
||||
gap: 4px;
|
||||
}
|
||||
.trix-button-group--history-tools,.trix-button-group--file-tools
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.trix-button {
|
||||
border-radius: 6px !important;
|
||||
background: var(--p30) !important;
|
||||
padding: 14px 22px !important;
|
||||
margin: 0 !important;
|
||||
cursor: pointer;
|
||||
border: 0px solid var(--p30) !important;
|
||||
font-size: 14px !important;
|
||||
min-height: 27px !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
gap: 4px;
|
||||
color: var(--text) !important;
|
||||
|
||||
&:before{
|
||||
background-size: 22px!important;
|
||||
}
|
||||
|
||||
&:hover{
|
||||
background: var(--p40) !important;
|
||||
}
|
||||
&.trix-active{
|
||||
background: var(--p50) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,14 @@
|
||||
align-items: center;
|
||||
background: var(--p30);
|
||||
font-size: 16px;
|
||||
padding: 3px 12px 6px;
|
||||
padding: 3px 12px 3px;
|
||||
color: var(--text);
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
&:focus{
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
|
||||
&:hover {
|
||||
background: var(--p40);
|
||||
|
||||
@@ -113,6 +113,18 @@
|
||||
.field-ui-number {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.references{
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
|
||||
.reference{
|
||||
font-size: 13px;
|
||||
border-radius: 12px;
|
||||
background: var(--p30);
|
||||
padding: 1px 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.file-table-row {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
margin: 20px 0 20px;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
.tab{
|
||||
list-style: none;
|
||||
|
||||
|
||||
@@ -12,6 +12,20 @@
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
h1{
|
||||
font-size: 24px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
h2{
|
||||
font-size: 20px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
h3{
|
||||
font-size: 18px;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0 0 0 16px;
|
||||
@@ -31,6 +45,54 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
code{
|
||||
background: var(--p30);
|
||||
padding: 0 6px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
img{
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
blockquote{
|
||||
border:1px solid var(--p30);
|
||||
border-radius: 12px;
|
||||
padding: 12px 40px;
|
||||
position: relative;
|
||||
|
||||
&::before{
|
||||
content: "\201C";
|
||||
color: var(--p60);
|
||||
font-size:4em;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 20px;
|
||||
}
|
||||
|
||||
&::after{
|
||||
content: '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pre {
|
||||
background: var(--grey-light);
|
||||
border-radius: 0.5rem;
|
||||
color: var(--white);
|
||||
font-family: 'JetBrainsMono', monospace;
|
||||
margin: 1.5rem 0;
|
||||
padding: 0.75rem 1rem;
|
||||
|
||||
code {
|
||||
background: none;
|
||||
color: inherit;
|
||||
font-size: 0.8rem;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.lx-small-text {
|
||||
|
||||
+2
-1
@@ -53,6 +53,7 @@
|
||||
@import "./table";
|
||||
@import "./avatar";
|
||||
@import "./codemirror";
|
||||
@import "./rich";
|
||||
@import "./layout";
|
||||
@import "./wrappers";
|
||||
@import "./toolbar";
|
||||
@@ -69,6 +70,7 @@
|
||||
@import "./reference-tags";
|
||||
@import "./members";
|
||||
@import "./revisions";
|
||||
@import "./datepicker";
|
||||
|
||||
body {
|
||||
background-color: var(--p10);
|
||||
@@ -103,4 +105,3 @@ a {
|
||||
.lucent-component {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
Whitespace-only changes.
Loaded 100 of 272 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user