diff --git a/app/Filament/Admin/Resources/ElectionResource.php b/app/Filament/Admin/Resources/ElectionResource.php index 149ca70..a57fc59 100644 --- a/app/Filament/Admin/Resources/ElectionResource.php +++ b/app/Filament/Admin/Resources/ElectionResource.php @@ -15,6 +15,7 @@ use App\Models\Locality; use Filament\Forms; use Filament\Forms\Components\DatePicker; +use Filament\Forms\Components\Fieldset; use Filament\Forms\Components\KeyValue; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; @@ -28,7 +29,6 @@ use Filament\Infolists\Infolist; use Filament\Pages\SubNavigationPosition; use Filament\Resources\Resource; -use Filament\Support\Enums\MaxWidth; use Filament\Tables; use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\TextColumn; @@ -66,98 +66,99 @@ public static function getPluralModelLabel(): string public static function form(Form $form): Form { return $form + ->columns(2) ->schema([ - Forms\Components\Section::make() - ->maxWidth(MaxWidth::ThreeExtraLarge) - ->columns(2) - ->schema([ - Select::make('type') - ->label(__('app.field.type')) - ->options(ElectionType::options()) - ->enum(ElectionType::class) - ->required(), - - DatePicker::make('date') - ->label(__('app.field.date')) - ->default(today()) - ->required(), - - TextInput::make('title') - ->label(__('app.field.title')) - ->required(), + Select::make('type') + ->label(__('app.field.type')) + ->options(ElectionType::options()) + ->enum(ElectionType::class) + ->required(), - TextInput::make('subtitle') - ->label(__('app.field.subtitle')) - ->nullable(), + DatePicker::make('date') + ->label(__('app.field.date')) + ->default(today()) + ->required(), - TextInput::make('slug') - ->label(__('app.field.slug')) - ->unique(ignoreRecord: true) - ->required() - ->columnSpanFull(), + TextInput::make('title') + ->label(__('app.field.title')) + ->required(), - Toggle::make('is_live') - ->label(__('app.field.is_live')) - ->default(false), + TextInput::make('subtitle') + ->label(__('app.field.subtitle')) + ->nullable(), - Toggle::make('is_visible') - ->label(__('app.field.is_visible')) - ->default(false), + TextInput::make('slug') + ->label(__('app.field.slug')) + ->unique(ignoreRecord: true) + ->required() + ->columnSpanFull(), - Toggle::make('has_lists') - ->label(__('app.field.has_lists')) - ->default(false), + Toggle::make('is_live') + ->label(__('app.field.is_live')) + ->default(false), - Select::make('properties.default_tab') - ->label(__('app.field.default_tab')) - ->options(DefaultElectionPage::options()) - ->enum(DefaultElectionPage::class) - ->selectablePlaceholder(false) + Toggle::make('is_visible') + ->label(__('app.field.is_visible')) + ->default(false), + + Toggle::make('has_lists') + ->label(__('app.field.has_lists')) + ->default(false), + + Select::make('properties.default_tab') + ->label(__('app.field.default_tab')) + ->options(DefaultElectionPage::options()) + ->enum(DefaultElectionPage::class) + ->selectablePlaceholder(false) + ->nullable(), + + Fieldset::make(__('app.field.default_place')) + ->columnSpanFull() + ->statePath('properties.default_place') + ->columns(2) + ->schema([ + Select::make('level') + ->label(__('app.field.level')) + ->options(DataLevel::options()) + ->afterStateUpdated(fn (Set $set) => $set('country', null)) + ->enum(DataLevel::class) + ->live() ->nullable(), - - Forms\Components\Section::make(__('app.field.default_place')) - ->columnSpanFull() - ->statePath('properties.default_place') - ->columns(2) - ->schema([ - Select::make('level') - ->label(__('app.field.level')) - ->options(DataLevel::options()) - ->afterStateUpdated(fn (Set $set) => $set('country', null)) - ->enum(DataLevel::class) - ->live() - ->nullable(), - Select::make('country') - ->label(__('app.field.country')) - ->options(Country::pluck('name', 'id')) - ->hidden(fn (Get $get) => ! DataLevel::isValue($get('level'), DataLevel::DIASPORA)) - ->nullable(), - - Forms\Components\Group::make([ - Select::make('county') - ->label(__('app.field.county')) - ->options(County::pluck('name', 'id')) - ->hidden(fn (Get $get) => ! DataLevel::isValue($get('level'), DataLevel::NATIONAL)) - ->afterStateUpdated(fn (Set $set) => $set('locality', null)) - ->live() - ->nullable(), - Select::make('locality') - ->label(__('app.field.locality')) - ->options(fn (Get $get) => $get('county') ? Locality::where('county_id', $get('county'))->pluck('name', 'id') : []) - ->hidden(fn (Get $get) => ! $get('county')) - ->nullable(), - ]), - ]), - - KeyValue::make('properties.tabs') - ->label(__('app.field.tabs')) - ->columnSpanFull() + Select::make('country') + ->label(__('app.field.country')) + ->options(Country::pluck('name', 'id')) + ->hidden(fn (Get $get) => ! DataLevel::isValue($get('level'), DataLevel::DIASPORA)) ->nullable(), - Toggle::make('properties.show_threshold') - ->label(__('app.field.show_threshold')) - ->default(false), + Forms\Components\Group::make([ + Select::make('county') + ->label(__('app.field.county')) + ->options(County::pluck('name', 'id')) + ->hidden(fn (Get $get) => ! DataLevel::isValue($get('level'), DataLevel::NATIONAL)) + ->afterStateUpdated(fn (Set $set) => $set('locality', null)) + ->live() + ->nullable(), + Select::make('locality') + ->label(__('app.field.locality')) + ->options(fn (Get $get) => $get('county') ? Locality::where('county_id', $get('county'))->pluck('name', 'id') : []) + ->hidden(fn (Get $get) => ! $get('county')) + ->nullable(), + ]), ]), + + KeyValue::make('properties.tabs') + ->label(__('app.field.tabs')) + ->columnSpanFull() + ->nullable(), + + Toggle::make('properties.show_threshold') + ->label(__('app.field.show_threshold')) + ->default(false), + + TextInput::make('properties.total_seats') + ->label(__('app.field.total_seats')) + ->nullable() + ->numeric(), ]); } diff --git a/app/Filament/Admin/Resources/MandateResource.php b/app/Filament/Admin/Resources/MandateResource.php new file mode 100644 index 0000000..9c9ac04 --- /dev/null +++ b/app/Filament/Admin/Resources/MandateResource.php @@ -0,0 +1,121 @@ +schema([ + Select::make('county_id') + ->relationship('county', 'name') + ->label(__('app.field.county')) + ->searchable() + ->preload() + ->live(), + + Select::make('locality_id') + ->relationship( + 'locality', + 'name', + fn (Builder $query, Get $get) => $query + ->where('county_id', $get('county_id')) + ) + ->label(__('app.field.locality')) + ->searchable(), + + MorphToSelect::make('votable') + ->types([ + MorphToSelect\Type::make(Party::class) + ->titleAttribute('name'), + MorphToSelect\Type::make(Candidate::class) + ->titleAttribute('name'), + ]) + ->searchable() + ->required() + ->columnSpanFull(), + + TextInput::make('mandates') + ->required() + ->numeric() + ->default(0) + ->minValue(0) + ->maxValue(255) + ->columnSpanFull(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->modifyQueryUsing(fn (Builder $query) => $query->with('county', 'locality')) + ->columns([ + LocationColumn::make('location'), + + TextColumn::make('votable.name') + ->label(__('app.field.candidate')) + ->searchable(), + + TextColumn::make('mandates') + ->numeric() + ->sortable(), + + ]) + ->filters([ + LocationFilter::make() + ->withoutCountry(), + ]) + ->actions([ + Tables\Actions\EditAction::make(), + Tables\Actions\DeleteAction::make(), + ]) + ->paginated([10, 25, 50, 100]) + ->deferLoading(); + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ManageMandates::route('/'), + ]; + } +} diff --git a/app/Filament/Admin/Resources/MandateResource/Pages/ManageMandates.php b/app/Filament/Admin/Resources/MandateResource/Pages/ManageMandates.php new file mode 100644 index 0000000..a0dd044 --- /dev/null +++ b/app/Filament/Admin/Resources/MandateResource/Pages/ManageMandates.php @@ -0,0 +1,21 @@ +columns([ LocationColumn::make('location'), + TextColumn::make('section') + ->label(__('app.field.section')), + TextColumn::make('part'), TextColumn::make('eligible_voters_total') @@ -109,7 +113,7 @@ public static function table(Table $table): Table ->sortable(), ]) ->filters([ - // + LocationFilter::make(), ]) ->paginated([10, 25, 50, 100]) ->deferLoading() diff --git a/app/Filament/Admin/Resources/TurnoutResource.php b/app/Filament/Admin/Resources/TurnoutResource.php index acdfa5c..50dd512 100644 --- a/app/Filament/Admin/Resources/TurnoutResource.php +++ b/app/Filament/Admin/Resources/TurnoutResource.php @@ -5,6 +5,7 @@ namespace App\Filament\Admin\Resources; use App\Filament\Admin\Resources\TurnoutResource\Pages; +use App\Filament\Filters\LocationFilter; use App\Models\Turnout; use App\Tables\Columns\LocationColumn; use Filament\Resources\Resource; @@ -91,7 +92,7 @@ public static function table(Table $table): Table ->sortable(), ]) ->filters([ - // + LocationFilter::make(), ]) ->paginated([10, 25, 50, 100]) ->deferLoading(); diff --git a/app/Filament/Admin/Resources/VoteResource.php b/app/Filament/Admin/Resources/VoteResource.php new file mode 100644 index 0000000..9eb6dd7 --- /dev/null +++ b/app/Filament/Admin/Resources/VoteResource.php @@ -0,0 +1,79 @@ +modifyQueryUsing(fn (Builder $query) => $query->with('country', 'county', 'locality')) + ->columns([ + LocationColumn::make('location'), + + TextColumn::make('section') + ->label(__('app.field.section')) + ->searchable(), + + TextColumn::make('part'), + + TextColumn::make('votable.name') + ->label(__('app.field.candidate')) + ->searchable(), + + TextColumn::make('votes') + ->numeric() + ->sortable(), + ]) + ->filters([ + LocationFilter::make(), + ]) + ->paginated([10, 25, 50, 100]) + ->deferLoading(); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ManageVotes::route('/'), + + ]; + } +} diff --git a/app/Filament/Admin/Resources/VoteResource/Pages/ManageVotes.php b/app/Filament/Admin/Resources/VoteResource/Pages/ManageVotes.php new file mode 100644 index 0000000..499693a --- /dev/null +++ b/app/Filament/Admin/Resources/VoteResource/Pages/ManageVotes.php @@ -0,0 +1,44 @@ +label(__('app.mandate.action.generate')) + ->form([ + Select::make('type') + ->options([ + 's' => 'Senat', + 'cd' => 'Camera Deputaților', + ]) + ->required(), + + ]) + ->action(function (array $data) { + $election = Filament::getTenant(); + + match (data_get($data, 'type')) { + 's' => GenerateSenateMandatesJob::dispatch($election), + 'cd' => GenerateChamberDeputiesMandatesJob::dispatch($election), + }; + }), + + ]; + } +} diff --git a/app/Filament/Filters/LocationFilter.php b/app/Filament/Filters/LocationFilter.php new file mode 100644 index 0000000..36a7b06 --- /dev/null +++ b/app/Filament/Filters/LocationFilter.php @@ -0,0 +1,103 @@ +form(function () { + $form = []; + + if ($this->withCountry) { + $form[] = Select::make('country') + ->label(__('app.field.country')) + ->relationship('country', 'name') + ->searchable() + ->preload(); + } + + if ($this->withCounty) { + $form[] = Select::make('county') + ->label(__('app.field.county')) + ->relationship('county', 'name') + ->searchable() + ->preload(); + + if ($this->withLocality) { + $form[] = Select::make('locality') + ->label(__('app.field.locality')) + ->relationship('locality', 'name', function (Builder $query, Get $get) { + return $query->orderBy('name'); + }) + ->getSearchResultsUsing(function (string $search, Get $get) { + $countyId = (int) $get('county'); + + if (! $countyId) { + return []; + } + + return Locality::search($search) + ->where('county_id', $countyId) + ->get(); + }) + ->searchable(); + } + } + + return $form; + })->query(function (Builder $query, array $data) { + if ($this->withCountry && isset($data['country'])) { + $query->where('country_id', $data['country']); + } + + if ($this->withCounty && isset($data['county'])) { + $query->where('county_id', $data['county']); + + if ($this->withLocality && isset($data['locality'])) { + $query->where('locality_id', $data['locality']); + } + } + }); + } + + public function withoutCountry(): self + { + $this->withCountry = false; + + return $this; + } + + public function withoutCounty(): self + { + $this->withCounty = false; + + return $this; + } + + public function withoutLocality(): self + { + $this->withLocality = false; + + return $this; + } +} diff --git a/app/Jobs/Mandates/GenerateChamberDeputiesMandatesJob.php b/app/Jobs/Mandates/GenerateChamberDeputiesMandatesJob.php new file mode 100644 index 0000000..08dae04 --- /dev/null +++ b/app/Jobs/Mandates/GenerateChamberDeputiesMandatesJob.php @@ -0,0 +1,34 @@ +election = $election; + } + + /** + * Execute the job. + */ + public function handle(): void + { + // + } +} diff --git a/app/Jobs/Mandates/GenerateSenateMandatesJob.php b/app/Jobs/Mandates/GenerateSenateMandatesJob.php new file mode 100644 index 0000000..4af2bbf --- /dev/null +++ b/app/Jobs/Mandates/GenerateSenateMandatesJob.php @@ -0,0 +1,34 @@ +election = $election; + } + + /** + * Execute the job. + */ + public function handle(): void + { + // + } +} diff --git a/app/Jobs/Y2024/M11/President/Records/ImportCorrespondenceRecordsJob.php b/app/Jobs/Y2024/M11/President/Records/ImportCorrespondenceRecordsJob.php index f58ed06..928158c 100644 --- a/app/Jobs/Y2024/M11/President/Records/ImportCorrespondenceRecordsJob.php +++ b/app/Jobs/Y2024/M11/President/Records/ImportCorrespondenceRecordsJob.php @@ -20,7 +20,7 @@ class ImportCorrespondenceRecordsJob extends SchedulableJob public static function name(): string { - return 'Prezidențiale 24.11.2024 / Procese Verbale Corespondență'; + return '2024-11-24 / Prezidențiale / Procese Verbale Corespondență'; } public function execute(): void diff --git a/app/Jobs/Y2024/M11/ReferendumBucuresti/Records/FetchRecordsJob.php b/app/Jobs/Y2024/M11/ReferendumBucuresti/Records/FetchRecordsJob.php index 9d68fe4..7a1d84f 100644 --- a/app/Jobs/Y2024/M11/ReferendumBucuresti/Records/FetchRecordsJob.php +++ b/app/Jobs/Y2024/M11/ReferendumBucuresti/Records/FetchRecordsJob.php @@ -35,7 +35,7 @@ public function execute(): void 'root' => $cwd, ]); - $tmpDisk->put('turnout.csv', $this->scheduledJob->fetchSource()->resource()); + $tmpDisk->put('records.csv', $this->scheduledJob->fetchSource()->resource()); // Split the CSV by county Process::path($cwd) @@ -43,10 +43,10 @@ public function execute(): void config('import.awk_path'), '-F,', 'FNR==1 {header = $0; next} !seen[$1]++ {print header > $1".csv"} {print > $1".csv"}', - 'turnout.csv', + 'records.csv', ]); - $tmpDisk->delete('turnout.csv'); + $tmpDisk->delete('records.csv'); collect($tmpDisk->allFiles()) ->each(function (string $file) use ($tmpDisk) { diff --git a/app/Jobs/Y2024/M12/Parliament/Records/FetchRecordsJob.php b/app/Jobs/Y2024/M12/Parliament/Records/FetchRecordsJob.php index e10f6b1..31fc5a7 100644 --- a/app/Jobs/Y2024/M12/Parliament/Records/FetchRecordsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Records/FetchRecordsJob.php @@ -25,6 +25,8 @@ public static function name(): string public function execute(): void { + // TODO: uncomment + /* $temporaryDirectory = TemporaryDirectory::make() ->deleteWhenDestroyed(); @@ -35,7 +37,7 @@ public function execute(): void 'root' => $cwd, ]); - $tmpDisk->put('turnout.csv', $this->scheduledJob->fetchSource()->resource()); + $tmpDisk->put('records.csv', $this->scheduledJob->fetchSource()->resource()); // Split the CSV by county Process::path($cwd) @@ -43,10 +45,10 @@ public function execute(): void config('import.awk_path'), '-F,', 'FNR==1 {header = $0; next} !seen[$1]++ {print header > $1".csv"} {print > $1".csv"}', - 'turnout.csv', + 'records.csv', ]); - $tmpDisk->delete('turnout.csv'); + $tmpDisk->delete('records.csv'); collect($tmpDisk->allFiles()) ->each(function (string $file) use ($tmpDisk) { @@ -56,6 +58,7 @@ public function execute(): void $tmpDisk->readStream($file) ); }); + */ $electionName = $this->scheduledJob->election->getFilamentName(); $electionId = $this->scheduledJob->election_id; diff --git a/app/Jobs/Y2024/M12/Parliament/Records/ImportCountyRecordsJob.php b/app/Jobs/Y2024/M12/Parliament/Records/ImportCountyRecordsJob.php index 132ea10..13d5eff 100644 --- a/app/Jobs/Y2024/M12/Parliament/Records/ImportCountyRecordsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Records/ImportCountyRecordsJob.php @@ -67,6 +67,12 @@ public function handle(): void foreach ($reader->getRecords() as $row) { $part = RecordService::getPart($row['report_stage_code']); + // TODO: check if needed for new data + $row['uat_siruta'] = match ($row['uat_siruta']) { + '63171' => '61069', + default => $row['uat_siruta'], + }; + $records->push([ 'election_id' => $this->scheduledJob->election_id, 'county_id' => $this->county->id, diff --git a/app/Models/Election.php b/app/Models/Election.php index 250460e..83edd8c 100644 --- a/app/Models/Election.php +++ b/app/Models/Election.php @@ -95,6 +95,11 @@ public function votes(): HasMany return $this->hasMany(Vote::class); } + public function mandates(): HasMany + { + return $this->hasMany(Mandate::class); + } + public function contributors(): BelongsToMany { return $this->belongsToMany(User::class); diff --git a/app/Models/Mandate.php b/app/Models/Mandate.php index b754d8c..d12cd80 100644 --- a/app/Models/Mandate.php +++ b/app/Models/Mandate.php @@ -4,20 +4,27 @@ namespace App\Models; +use App\Concerns\BelongsToCounty; use App\Concerns\BelongsToElection; -use App\Concerns\HasTemporaryTable; -use App\Contracts\TemporaryTable; +use App\Concerns\BelongsToLocality; +use App\Concerns\CanGroupByDataLevel; +use App\Enums\DataLevel; use Database\Factories\MandateFactory; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\MorphTo; +use Tpetry\QueryExpressions\Function\Aggregate\Sum; +use Tpetry\QueryExpressions\Language\Alias; -class Mandate extends Model implements TemporaryTable +class Mandate extends Model { use BelongsToElection; + use BelongsToCounty; + use BelongsToLocality; + use CanGroupByDataLevel; /** @use HasFactory */ use HasFactory; - use HasTemporaryTable; public $timestamps = false; @@ -29,11 +36,10 @@ class Mandate extends Model implements TemporaryTable * @var array */ protected $fillable = [ - 'election_id', - 'county_id', - - 'party_id', + 'votable_type', + 'votable_id', 'mandates', + ]; /** @@ -48,13 +54,54 @@ protected function casts(): array ]; } - public function party(): BelongsTo + public function votable(): MorphTo { - return $this->belongsTo(Party::class); + return $this->morphTo(); } - public function getTemporaryTableUniqueColumns(): array + public function scopeForLevel(Builder $query, DataLevel $level, ?string $country = null, ?int $county = null, ?int $locality = null, bool $aggregate = false): Builder { - return ['election_id', 'county_id', 'party_id']; + $query + ->select([ + 'votable_type', + 'votable_id', + new Alias(new Sum('mandates'), 'mandates'), + ]) + ->groupBy('votable_type', 'votable_id'); + + if ($level->is(DataLevel::TOTAL)) { + $query->groupByTotal(); + } + + if ($level->is(DataLevel::DIASPORA)) { + $query->whereNull('county_id') + ->groupBy('county_id'); + } + + if ($level->is(DataLevel::NATIONAL)) { + if (filled($locality)) { + $query->where('locality_id', $locality) + ->groupByLocality(); + } elseif (filled($county)) { + $query->where('county_id', $county); + + if ($aggregate) { + $query->groupByCounty(); + } else { + $query->groupByLocality(); + } + } else { + $query->whereNotNull('county_id'); + + if ($aggregate) { + $query->groupByTotal(); + } else { + $query->groupByCounty(); + } + } + } + // ->forDataLevel($level, $country, $county, $locality, $aggregate) + + return $query->orderByDesc('mandates'); } } diff --git a/app/Policies/MandatePolicy.php b/app/Policies/MandatePolicy.php index 5e62041..21b3da5 100644 --- a/app/Policies/MandatePolicy.php +++ b/app/Policies/MandatePolicy.php @@ -30,7 +30,7 @@ public function view(User $user, Mandate $mandate): bool */ public function create(User $user): bool { - return false; + return $user->isAdmin(); } /** @@ -38,7 +38,7 @@ public function create(User $user): bool */ public function update(User $user, Mandate $mandate): bool { - return false; + return $user->isAdmin(); } /** @@ -46,7 +46,7 @@ public function update(User $user, Mandate $mandate): bool */ public function delete(User $user, Mandate $mandate): bool { - return false; + return $user->isAdmin(); } /** @@ -54,7 +54,7 @@ public function delete(User $user, Mandate $mandate): bool */ public function restore(User $user, Mandate $mandate): bool { - return false; + return $this->delete($user, $mandate); } /** @@ -62,6 +62,6 @@ public function restore(User $user, Mandate $mandate): bool */ public function forceDelete(User $user, Mandate $mandate): bool { - return false; + return $this->delete($user, $mandate); } } diff --git a/app/Repositories/VotesRepository.php b/app/Repositories/VotesRepository.php index c51d8c9..f14404f 100644 --- a/app/Repositories/VotesRepository.php +++ b/app/Repositories/VotesRepository.php @@ -7,6 +7,7 @@ use App\Enums\DataLevel; use App\Models\Candidate; use App\Models\Election; +use App\Models\Mandate; use App\Models\Party; use App\Models\Vote; use App\Services\CacheService; @@ -53,18 +54,45 @@ public static function getForLevel( $votables = self::getVotables($result, $election); + if ( + $election->has_lists && + filled($election->properties->get('total_seats')) + ) { + $mandates = Mandate::query() + ->whereBelongsTo($election) + ->forLevel( + level: $level, + county: $county, + // locality: $locality, + aggregate: $aggregate, + ) + ->toBase() + ->get(); + } else { + $mandates = null; + } + $total = $result->sum('votes'); - return $result->map(function (stdClass|Vote $vote) use ($votables, $total) { + return $result->map(function (stdClass|Vote $vote) use ($votables, $total, $mandates) { $votable = $votables->get($vote->votable_type)->get($vote->votable_id); - return [ + $data = [ 'name' => $votable->acronym ?? $votable->name, 'image' => $votable->getFirstMediaUrl(), 'votes' => (int) ensureNumeric($vote->votes), 'percent' => percent($vote->votes, $total), - 'color' => hex2rgb($votable->color ?? '#DDD'), + 'color' => hex2rgb($votable->color), ]; + + if (filled($mandates)) { + $data['mandates'] = (int) $mandates + ->where('votable_type', $vote->votable_type) + ->where('votable_id', $vote->votable_id) + ->first()?->mandates; + } + + return $data; }); }); } diff --git a/app/Tables/Columns/LocationColumn.php b/app/Tables/Columns/LocationColumn.php index 08ea4ff..0b8b5b3 100644 --- a/app/Tables/Columns/LocationColumn.php +++ b/app/Tables/Columns/LocationColumn.php @@ -22,23 +22,28 @@ protected function setUp(): void ); $this->state(function (Model $record) { - if ($record->country) { + if (data_get($record, 'country', false)) { return $record->country->name; } - return \sprintf('%s, %s', $record->locality->name, $record->county->name); + return collect([ + $record->locality?->name, + $record->county?->name, + ]) + ->filter() + ->join(', '); }); $this->description(function (Model $record) { - if ($record->country) { + if (data_get($record, 'country', false)) { return $record->country->id; } - return $record->locality->id; + return $record->locality?->id; }); $this->icon(function (Model $record) { - if ($record->has_issues) { + if (data_get($record, 'has_issues', false)) { return 'heroicon-s-exclamation-triangle'; } @@ -46,7 +51,7 @@ protected function setUp(): void }); $this->iconColor(function (Model $record) { - if ($record->has_issues) { + if (data_get($record, 'has_issues', false)) { return 'warning'; } diff --git a/app/View/Components/ResultsTable.php b/app/View/Components/ResultsTable.php new file mode 100644 index 0000000..8e27f99 --- /dev/null +++ b/app/View/Components/ResultsTable.php @@ -0,0 +1,54 @@ +election = $election; + $this->level = $level; + $this->votables = $votables; + } + + public function shouldRender(): bool + { + return $this->votables->isNotEmpty(); + } + + public function votablesWithMandates(): Collection + { + return $this->votables->where('mandates', '>', 0); + } + + public function votablesWithoutMandates(): Collection + { + return $this->votables->where('mandates', '<=', 0); + } + + public function render(): View + { + if ( + $this->election->has_lists && + \array_key_exists('mandates', $this->votables->first()) + ) { + return view('components.results-tables.lists'); + } + + return view('components.results-tables.simple'); + } +} diff --git a/app/View/Components/SeatsChart.php b/app/View/Components/SeatsChart.php new file mode 100644 index 0000000..4cef531 --- /dev/null +++ b/app/View/Components/SeatsChart.php @@ -0,0 +1,165 @@ +election = $election; + $this->level = $level; + $this->totalSeats = abs((int) $election->properties?->get('total_seats')); + + if ($this->totalSeats > 0) { + $this->r = 45.345892868 / sqrt($this->totalSeats); + + $this->votables = $votables; + $this->dots = $this->generateDots(); + } + } + + public function shouldRender(): bool + { + return $this->level->is(DataLevel::TOTAL) + && $this->election->has_lists + && $this->totalSeats > 0; + } + + public function render(): View + { + return view('components.seats-chart'); + } + + protected function generateDots(): array + { + // Determine how many dots fit in each row + $R = 100 - $this->r; + $seatsLeft = $this->totalSeats; + $rows = []; + + while ($seatsLeft > 0) { + // Offset the first and last dot by a tiny angle so that they're tangent to the bottom of the viewport + $offset = asin($this->r / $R); + $seatsOnRow = 1 + max(0, floor(((pi() - $offset * 2) * $R) / ($this->r * $this->spacing))); + + $seatsLeft -= $seatsOnRow; + + $rows[] = [ + 'R' => $R, + 'offset' => $offset, + 'seatsOnRow' => $seatsOnRow, + ]; + + $R -= $this->r * $this->spacing; + } + + $rowsCount = \count($rows); + + // We might have some empty slots left over that we need to + // remove evenly from amongst the rows. + if ($seatsLeft < 0) { + $div = floor(-$seatsLeft / $rowsCount); + + for ($i = 0; $i < $rowsCount; $i++) { + $rows[$i]['seatsOnRow'] -= $div; + } + + $seatsLeft += $div * $rowsCount; + } + + // If they don't split evenly, remove the rest starting with the innermost row. + if ($seatsLeft < 0) { + for ($i = $rowsCount - 1; $i >= 0 && $seatsLeft < 0; $i--) { + $rows[$i]['seatsOnRow']--; + + $seatsLeft++; + } + } + + $dots = collect(); + + // Position each dot in polar coordinates + for ($i = 0; $i < $rowsCount; $i++) { + $seatsOnRow = $rows[$i]['seatsOnRow']; + $offset = $rows[$i]['offset']; + $R = $rows[$i]['R']; + + $stride = (pi() - $offset * 2) / ($seatsOnRow - 1); + + for ($j = 0; $j < $seatsOnRow; $j++) { + $alpha = $offset + $j * $stride; + + $dots->push([ + 'cx' => 100 - $R * cos($alpha), + 'cy' => 100 - $R * sin($alpha), + 'alpha' => $offset + $stride * $j, + // 'R' => $R, + 'fill' => \sprintf('rgb(%s)', Color::Gray[200]), + ]); + } + } + + // Sort the dots radially left to right + $dots = $dots + ->sortBy('alpha') + ->values() + ->all(); + + // Assign candidates to each dot + $start = 0; + $end = \count($dots) - 1; + $fromStart = false; // Alternate each candidate left/right + + debug($this->votables); + $this->votables->each(function ($votable) use (&$dots, &$start, &$end, &$fromStart) { + $mandates = data_get($votable, 'mandates'); + + if (blank($mandates) || $mandates <= 0) { + return; + } + + $fromStart = ! $fromStart; + + while ($mandates > 0 && $start <= $end) { + $dots[$fromStart ? $start : $end]['fill'] = \sprintf('rgb(%s)', data_get($votable, 'color')); + + if ($fromStart) { + $start++; + } else { + $end--; + } + + $mandates--; + } + }); + + $this->innerRadius = $rows[$rowsCount - 1]['R'] - $this->r; + + return $dots; + } +} diff --git a/composer.lock b/composer.lock index f0ab366..43f466a 100644 --- a/composer.lock +++ b/composer.lock @@ -1160,12 +1160,12 @@ "type": "library", "extra": { "laravel": { - "providers": [ - "Datlechin\\FilamentMenuBuilder\\FilamentMenuBuilderServiceProvider" - ], "aliases": { "FilamentMenuBuilder": "Datlechin\\FilamentMenuBuilder\\Facades\\FilamentMenuBuilder" - } + }, + "providers": [ + "Datlechin\\FilamentMenuBuilder\\FilamentMenuBuilderServiceProvider" + ] } }, "autoload": { @@ -9091,16 +9091,16 @@ }, { "name": "symfony/options-resolver", - "version": "v7.1.9", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "0f4099f5306a92487d13b2a4589068c36a93c447" + "reference": "7da8fbac9dcfef75ffc212235d76b2754ce0cf50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/0f4099f5306a92487d13b2a4589068c36a93c447", - "reference": "0f4099f5306a92487d13b2a4589068c36a93c447", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/7da8fbac9dcfef75ffc212235d76b2754ce0cf50", + "reference": "7da8fbac9dcfef75ffc212235d76b2754ce0cf50", "shasum": "" }, "require": { @@ -9138,7 +9138,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.1.9" + "source": "https://github.com/symfony/options-resolver/tree/v7.2.0" }, "funding": [ { @@ -9154,7 +9154,7 @@ "type": "tidelift" } ], - "time": "2024-11-20T11:08:58+00:00" + "time": "2024-11-20T11:17:29+00:00" }, { "name": "symfony/polyfill-ctype", @@ -9855,16 +9855,16 @@ }, { "name": "symfony/psr-http-message-bridge", - "version": "v7.1.6", + "version": "v7.2.0", "source": { "type": "git", "url": "https://github.com/symfony/psr-http-message-bridge.git", - "reference": "f16471bb19f6685b9ccf0a2c03c213840ae68cd6" + "reference": "03f2f72319e7acaf2a9f6fcbe30ef17eec51594f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/f16471bb19f6685b9ccf0a2c03c213840ae68cd6", - "reference": "f16471bb19f6685b9ccf0a2c03c213840ae68cd6", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/03f2f72319e7acaf2a9f6fcbe30ef17eec51594f", + "reference": "03f2f72319e7acaf2a9f6fcbe30ef17eec51594f", "shasum": "" }, "require": { @@ -9918,7 +9918,7 @@ "psr-7" ], "support": { - "source": "https://github.com/symfony/psr-http-message-bridge/tree/v7.1.6" + "source": "https://github.com/symfony/psr-http-message-bridge/tree/v7.2.0" }, "funding": [ { @@ -9934,7 +9934,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-09-26T08:57:56+00:00" }, { "name": "symfony/routing", @@ -11941,13 +11941,13 @@ }, "type": "phpstan-extension", "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - }, "phpstan": { "includes": [ "extension.neon" ] + }, + "branch-alias": { + "dev-master": "2.0-dev" } }, "autoload": { diff --git a/database/migrations/0001_01_10_000030_create_mandates_table.php b/database/migrations/0001_01_10_000030_create_mandates_table.php index b2357b6..f1bebfc 100644 --- a/database/migrations/0001_01_10_000030_create_mandates_table.php +++ b/database/migrations/0001_01_10_000030_create_mandates_table.php @@ -3,7 +3,6 @@ declare(strict_types=1); use App\Models\Election; -use App\Models\Party; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; @@ -30,29 +29,19 @@ public function up(): void ->references('id') ->on('counties'); - $table->foreignIdFor(Party::class) - ->constrained() - ->cascadeOnDelete(); - - $table->mediumInteger('mandates')->unsigned()->default(0); - - $table->unique(['election_id', 'county_id', 'party_id']); - }); - - Schema::create('_temp_mandates', function (Blueprint $table) { - $table->bigInteger('election_id') + $table->mediumInteger('locality_id') ->unsigned() ->nullable(); - $table->smallInteger('county_id') - ->unsigned() - ->nullable(); + $table->foreign('locality_id') + ->references('id') + ->on('localities'); - $table->bigInteger('party_id') - ->constrained() - ->cascadeOnDelete(); + $table->morphs('votable'); + + $table->tinyInteger('mandates')->unsigned()->default(0); - $table->mediumInteger('mandates')->unsigned(); + $table->unique(['election_id', 'county_id', 'locality_id', 'votable_type', 'votable_id'], 'votes_unique_county_locality_index'); }); } }; diff --git a/lang/ro/app.php b/lang/ro/app.php index a537ab1..73d86ba 100644 --- a/lang/ro/app.php +++ b/lang/ro/app.php @@ -14,6 +14,7 @@ 'acronym' => 'Acronim', 'aliases' => 'Aliasuri', 'color' => 'Culoare', + 'candidate' => 'Partid / Alianță / Candidat independent', 'country' => 'Țară', 'county' => 'Județ', 'level' => 'Nivel', @@ -38,15 +39,19 @@ 'name' => 'Nume', 'party' => 'Partid', 'role' => 'Rol', + 'section' => 'Secție', 'siruta' => 'ID SIRUTA', 'slug' => 'Slug', 'source_part' => 'Parte', 'source_password' => 'Parolă', 'change_password' => 'Schimbă parola', 'default_place' => 'Locație implicită', + 'show_threshold' => 'Afișează prag', 'source_url' => 'URL sursă', 'source_username' => 'Utilizator', 'subtitle' => 'Subtitlu', + 'tabs' => 'Taburi', + 'total_seats' => 'Total mandate', 'title' => 'Titlu', 'type' => 'Tip', 'updated_at' => 'Actualizat la', @@ -123,6 +128,12 @@ ], ], + 'part' => [ + 'prov' => 'Provizorii', + 'part' => 'Parțiale', + 'final' => 'Finale', + ], + 'party' => [ 'label' => [ 'singular' => 'partid', @@ -141,6 +152,24 @@ 'label' => 'prezență', ], + 'vote' => [ + 'label' => [ + 'singular' => 'vot', + 'plural' => 'voturi', + ], + ], + + 'mandate' => [ + 'label' => [ + 'singular' => 'mandat', + 'plural' => 'mandate', + ], + + 'action' => [ + 'generate' => 'Generează mandate', + ], + ], + 'scheduled_job' => [ 'label' => [ 'singular' => 'job programat', diff --git a/public/js/awcodes/tiptap-editor/components/tiptap.js b/public/js/awcodes/tiptap-editor/components/tiptap.js index 6c3c7c6..1e26409 100644 --- a/public/js/awcodes/tiptap-editor/components/tiptap.js +++ b/public/js/awcodes/tiptap-editor/components/tiptap.js @@ -1,7 +1,7 @@ -var eO=Object.create;var cy=Object.defineProperty;var tO=Object.getOwnPropertyDescriptor;var nO=Object.getOwnPropertyNames;var rO=Object.getPrototypeOf,iO=Object.prototype.hasOwnProperty;var Xd=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var oO=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nO(e))!iO.call(t,i)&&i!==n&&cy(t,i,{get:()=>e[i],enumerable:!(r=tO(e,i))||r.enumerable});return t};var Zd=(t,e,n)=>(n=t!=null?eO(rO(t)):{},oO(e||!t||!t.__esModule?cy(n,"default",{value:t,enumerable:!0}):n,t));var uS=Xd((sq,cS)=>{function Z_(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&Z_(n)}),t}var Cu=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function j_(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ti(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var VF="",V_=t=>!!t.scope,GF=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`},Sm=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=j_(e)}openNode(e){if(!V_(e))return;let n=GF(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){V_(e)&&(this.buffer+=VF)}value(){return this.buffer}span(e){this.buffer+=``}},G_=(t={})=>{let e={children:[]};return Object.assign(e,t),e},Tm=class t{constructor(){this.rootNode=G_(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n=G_({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{t._collapse(n)}))}},Cm=class extends Tm{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Sm(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function va(t){return t?typeof t=="string"?t:t.source:null}function Q_(t){return bo("(?=",t,")")}function qF(t){return bo("(?:",t,")*")}function YF(t){return bo("(?:",t,")?")}function bo(...t){return t.map(n=>va(n)).join("")}function JF(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Mm(...t){return"("+(JF(t).capture?"":"?:")+t.map(r=>va(r)).join("|")+")"}function eS(t){return new RegExp(t.toString()+"|").exec("").length-1}function XF(t,e){let n=t&&t.exec(e);return n&&n.index===0}var ZF=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Nm(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=va(r),s="";for(;o.length>0;){let l=ZF.exec(o);if(!l){s+=o;break}s+=o.substring(0,l.index),o=o.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+i):(s+=l[0],l[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(e)}var jF=/\b\B/,tS="[a-zA-Z]\\w*",km="[a-zA-Z_]\\w*",nS="\\b\\d+(\\.\\d+)?",rS="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",iS="\\b(0b[01]+)",QF="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",eH=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=bo(e,/.*\b/,t.binary,/\b.*/)),Ti({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},wa={begin:"\\\\[\\s\\S]",relevance:0},tH={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[wa]},nH={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[wa]},rH={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Mu=function(t,e,n={}){let r=Ti({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=Mm("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:bo(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},iH=Mu("//","$"),oH=Mu("/\\*","\\*/"),sH=Mu("#","$"),aH={scope:"number",begin:nS,relevance:0},lH={scope:"number",begin:rS,relevance:0},cH={scope:"number",begin:iS,relevance:0},uH={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[wa,{begin:/\[/,end:/\]/,relevance:0,contains:[wa]}]}]},dH={scope:"title",begin:tS,relevance:0},fH={scope:"title",begin:km,relevance:0},pH={begin:"\\.\\s*"+km,relevance:0},hH=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},Tu=Object.freeze({__proto__:null,MATCH_NOTHING_RE:jF,IDENT_RE:tS,UNDERSCORE_IDENT_RE:km,NUMBER_RE:nS,C_NUMBER_RE:rS,BINARY_NUMBER_RE:iS,RE_STARTERS_RE:QF,SHEBANG:eH,BACKSLASH_ESCAPE:wa,APOS_STRING_MODE:tH,QUOTE_STRING_MODE:nH,PHRASAL_WORDS_MODE:rH,COMMENT:Mu,C_LINE_COMMENT_MODE:iH,C_BLOCK_COMMENT_MODE:oH,HASH_COMMENT_MODE:sH,NUMBER_MODE:aH,C_NUMBER_MODE:lH,BINARY_NUMBER_MODE:cH,REGEXP_MODE:uH,TITLE_MODE:dH,UNDERSCORE_TITLE_MODE:fH,METHOD_GUARD:pH,END_SAME_AS_BEGIN:hH});function mH(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function gH(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function bH(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=mH,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function yH(t,e){Array.isArray(t.illegal)&&(t.illegal=Mm(...t.illegal))}function EH(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function vH(t,e){t.relevance===void 0&&(t.relevance=1)}var wH=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=bo(n.beforeMatch,Q_(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},xH=["of","and","for","in","not","or","if","then","parent","list","value"],_H="keyword";function oS(t,e,n=_H){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,oS(t[o],e,o))}),r;function i(o,s){e&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){let c=l.split("|");r[c[0]]=[o,SH(c[0],c[1])]})}}function SH(t,e){return e?Number(e):TH(t)?0:1}function TH(t){return xH.includes(t.toLowerCase())}var q_={},go=t=>{console.error(t)},Y_=(t,...e)=>{console.log(`WARN: ${t}`,...e)},us=(t,e)=>{q_[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),q_[`${t}/${e}`]=!0)},Au=new Error;function sS(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let l=1;l<=e.length;l++)s[l+r]=i[l],o[l+r]=!0,r+=eS(e[l-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function CH(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw go("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Au;if(typeof t.beginScope!="object"||t.beginScope===null)throw go("beginScope must be object"),Au;sS(t,t.begin,{key:"beginScope"}),t.begin=Nm(t.begin,{joinWith:""})}}function AH(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw go("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Au;if(typeof t.endScope!="object"||t.endScope===null)throw go("endScope must be object"),Au;sS(t,t.end,{key:"endScope"}),t.end=Nm(t.end,{joinWith:""})}}function MH(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function NH(t){MH(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),CH(t),AH(t)}function kH(t){function e(s,l){return new RegExp(va(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=eS(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let l=this.regexes.map(c=>c[1]);this.matcherRe=e(Nm(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;let c=this.matcherRe.exec(l);if(!c)return null;let d=c.findIndex((h,m)=>m>0&&h!==void 0),f=this.matchIndexes[d];return c.splice(0,d),Object.assign(c,f)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];let c=new n;return this.rules.slice(l).forEach(([d,f])=>c.addRule(d,f)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){let c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let d=c.exec(l);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){let f=this.getMatcher(0);f.lastIndex=this.lastIndex+1,d=f.exec(l)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function i(s){let l=new r;return s.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function o(s,l){let c=s;if(s.isCompiled)return c;[gH,EH,NH,wH].forEach(f=>f(s,l)),t.compilerExtensions.forEach(f=>f(s,l)),s.__beforeBegin=null,[bH,yH,vH].forEach(f=>f(s,l)),s.isCompiled=!0;let d=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),d=s.keywords.$pattern,delete s.keywords.$pattern),d=d||/\w+/,s.keywords&&(s.keywords=oS(s.keywords,t.case_insensitive)),c.keywordPatternRe=e(d,!0),l&&(s.begin||(s.begin=/\B|\b/),c.beginRe=e(c.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(c.endRe=e(c.end)),c.terminatorEnd=va(c.end)||"",s.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(c.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(f){return OH(f==="self"?s:f)})),s.contains.forEach(function(f){o(f,c)}),s.starts&&o(s.starts,l),c.matcher=i(c),c}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Ti(t.classNameAliases||{}),o(t)}function aS(t){return t?t.endsWithParent||aS(t.starts):!1}function OH(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ti(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:aS(t)?Ti(t,{starts:t.starts?Ti(t.starts):null}):Object.isFrozen(t)?Ti(t):t}var RH="11.8.0",Am=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},_m=j_,J_=Ti,X_=Symbol("nomatch"),IH=7,lS=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,o="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Cm};function c(A){return l.noHighlightRe.test(A)}function d(A){let R=A.className+" ";R+=A.parentNode?A.parentNode.className:"";let K=l.languageDetectRe.exec(R);if(K){let J=z(K[1]);return J||(Y_(o.replace("{}",K[1])),Y_("Falling back to no-highlight mode for this block.",A)),J?K[1]:"no-highlight"}return R.split(/\s+/).find(J=>c(J)||z(J))}function f(A,R,K){let J="",se="";typeof R=="object"?(J=A,K=R.ignoreIllegals,se=R.language):(us("10.7.0","highlight(lang, code, ...args) has been deprecated."),us("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),se=A,J=R),K===void 0&&(K=!0);let be={code:J,language:se};ge("before:highlight",be);let De=be.result?be.result:h(be.language,be.code,K);return De.code=be.code,ge("after:highlight",De),De}function h(A,R,K,J){let se=Object.create(null);function be(I,F){return I.keywords[F]}function De(){if(!V.keywords){we.addText(fe);return}let I=0;V.keywordPatternRe.lastIndex=0;let F=V.keywordPatternRe.exec(fe),X="";for(;F;){X+=fe.substring(I,F.index);let oe=Je.case_insensitive?F[0].toLowerCase():F[0],Fe=be(V,oe);if(Fe){let[rt,xr]=Fe;if(we.addText(X),X="",se[oe]=(se[oe]||0)+1,se[oe]<=IH&&(ct+=xr),rt.startsWith("_"))X+=F[0];else{let B=Je.classNameAliases[rt]||rt;Be(F[0],B)}}else X+=F[0];I=V.keywordPatternRe.lastIndex,F=V.keywordPatternRe.exec(fe)}X+=fe.substring(I),we.addText(X)}function je(){if(fe==="")return;let I=null;if(typeof V.subLanguage=="string"){if(!e[V.subLanguage]){we.addText(fe);return}I=h(V.subLanguage,fe,!0,bt[V.subLanguage]),bt[V.subLanguage]=I._top}else I=b(fe,V.subLanguage.length?V.subLanguage:null);V.relevance>0&&(ct+=I.relevance),we.__addSublanguage(I._emitter,I.language)}function Me(){V.subLanguage!=null?je():De(),fe=""}function Be(I,F){I!==""&&(we.startScope(F),we.addText(I),we.endScope())}function xt(I,F){let X=1,oe=F.length-1;for(;X<=oe;){if(!I._emit[X]){X++;continue}let Fe=Je.classNameAliases[I[X]]||I[X],rt=F[X];Fe?Be(rt,Fe):(fe=rt,De(),fe=""),X++}}function Nt(I,F){return I.scope&&typeof I.scope=="string"&&we.openNode(Je.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(Be(fe,Je.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),fe=""):I.beginScope._multi&&(xt(I.beginScope,F),fe="")),V=Object.create(I,{parent:{value:V}}),V}function Oe(I,F,X){let oe=XF(I.endRe,X);if(oe){if(I["on:end"]){let Fe=new Cu(I);I["on:end"](F,Fe),Fe.isMatchIgnored&&(oe=!1)}if(oe){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return Oe(I.parent,F,X)}function _t(I){return V.matcher.regexIndex===0?(fe+=I[0],1):(kt=!0,0)}function Jt(I){let F=I[0],X=I.rule,oe=new Cu(X),Fe=[X.__beforeBegin,X["on:begin"]];for(let rt of Fe)if(rt&&(rt(I,oe),oe.isMatchIgnored))return _t(F);return X.skip?fe+=F:(X.excludeBegin&&(fe+=F),Me(),!X.returnBegin&&!X.excludeBegin&&(fe=F)),Nt(X,I),X.returnBegin?0:F.length}function pt(I){let F=I[0],X=R.substring(I.index),oe=Oe(V,I,X);if(!oe)return X_;let Fe=V;V.endScope&&V.endScope._wrap?(Me(),Be(F,V.endScope._wrap)):V.endScope&&V.endScope._multi?(Me(),xt(V.endScope,I)):Fe.skip?fe+=F:(Fe.returnEnd||Fe.excludeEnd||(fe+=F),Me(),Fe.excludeEnd&&(fe=F));do V.scope&&we.closeNode(),!V.skip&&!V.subLanguage&&(ct+=V.relevance),V=V.parent;while(V!==oe.parent);return oe.starts&&Nt(oe.starts,I),Fe.returnEnd?0:F.length}function sn(){let I=[];for(let F=V;F!==Je;F=F.parent)F.scope&&I.unshift(F.scope);I.forEach(F=>we.openNode(F))}let Xt={};function St(I,F){let X=F&&F[0];if(fe+=I,X==null)return Me(),0;if(Xt.type==="begin"&&F.type==="end"&&Xt.index===F.index&&X===""){if(fe+=R.slice(F.index,F.index+1),!i){let oe=new Error(`0 width match regex (${A})`);throw oe.languageName=A,oe.badRule=Xt.rule,oe}return 1}if(Xt=F,F.type==="begin")return Jt(F);if(F.type==="illegal"&&!K){let oe=new Error('Illegal lexeme "'+X+'" for mode "'+(V.scope||"")+'"');throw oe.mode=V,oe}else if(F.type==="end"){let oe=pt(F);if(oe!==X_)return oe}if(F.type==="illegal"&&X==="")return 1;if(Pt>1e5&&Pt>F.index*3)throw new Error("potential infinite loop, way more iterations than matches");return fe+=X,X.length}let Je=z(A);if(!Je)throw go(o.replace("{}",A)),new Error('Unknown language: "'+A+'"');let Xn=kH(Je),Lt="",V=J||Xn,bt={},we=new l.__emitter(l);sn();let fe="",ct=0,ut=0,Pt=0,kt=!1;try{if(Je.__emitTokens)Je.__emitTokens(R,we);else{for(V.matcher.considerAll();;){Pt++,kt?kt=!1:V.matcher.considerAll(),V.matcher.lastIndex=ut;let I=V.matcher.exec(R);if(!I)break;let F=R.substring(ut,I.index),X=St(F,I);ut=I.index+X}St(R.substring(ut))}return we.finalize(),Lt=we.toHTML(),{language:A,value:Lt,relevance:ct,illegal:!1,_emitter:we,_top:V}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:A,value:_m(R),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:ut,context:R.slice(ut-100,ut+100),mode:I.mode,resultSoFar:Lt},_emitter:we};if(i)return{language:A,value:_m(R),illegal:!1,relevance:0,errorRaised:I,_emitter:we,_top:V};throw I}}function m(A){let R={value:_m(A),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return R._emitter.addText(A),R}function b(A,R){R=R||l.languages||Object.keys(e);let K=m(A),J=R.filter(z).filter(he).map(Me=>h(Me,A,!1));J.unshift(K);let se=J.sort((Me,Be)=>{if(Me.relevance!==Be.relevance)return Be.relevance-Me.relevance;if(Me.language&&Be.language){if(z(Me.language).supersetOf===Be.language)return 1;if(z(Be.language).supersetOf===Me.language)return-1}return 0}),[be,De]=se,je=be;return je.secondBest=De,je}function y(A,R,K){let J=R&&n[R]||K;A.classList.add("hljs"),A.classList.add(`language-${J}`)}function w(A){let R=null,K=d(A);if(c(K))return;if(ge("before:highlightElement",{el:A,language:K}),A.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),l.throwUnescapedHTML))throw new Am("One of your code blocks includes unescaped HTML.",A.innerHTML);R=A;let J=R.textContent,se=K?f(J,{language:K,ignoreIllegals:!0}):b(J);A.innerHTML=se.value,y(A,K,se.language),A.result={language:se.language,re:se.relevance,relevance:se.relevance},se.secondBest&&(A.secondBest={language:se.secondBest.language,relevance:se.secondBest.relevance}),ge("after:highlightElement",{el:A,result:se,text:J})}function _(A){l=J_(l,A)}let S=()=>{T(),us("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function L(){T(),us("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let D=!1;function T(){if(document.readyState==="loading"){D=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function $(){D&&T()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",$,!1);function O(A,R){let K=null;try{K=R(t)}catch(J){if(go("Language definition for '{}' could not be registered.".replace("{}",A)),i)go(J);else throw J;K=s}K.name||(K.name=A),e[A]=K,K.rawDefinition=R.bind(null,t),K.aliases&&re(K.aliases,{languageName:A})}function Y(A){delete e[A];for(let R of Object.keys(n))n[R]===A&&delete n[R]}function ee(){return Object.keys(e)}function z(A){return A=(A||"").toLowerCase(),e[A]||e[n[A]]}function re(A,{languageName:R}){typeof A=="string"&&(A=[A]),A.forEach(K=>{n[K.toLowerCase()]=R})}function he(A){let R=z(A);return R&&!R.disableAutodetect}function Se(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=R=>{A["before:highlightBlock"](Object.assign({block:R.el},R))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=R=>{A["after:highlightBlock"](Object.assign({block:R.el},R))})}function me(A){Se(A),r.push(A)}function Ce(A){let R=r.indexOf(A);R!==-1&&r.splice(R,1)}function ge(A,R){let K=A;r.forEach(function(J){J[K]&&J[K](R)})}function _e(A){return us("10.7.0","highlightBlock will be removed entirely in v12.0"),us("10.7.0","Please use highlightElement now."),w(A)}Object.assign(t,{highlight:f,highlightAuto:b,highlightAll:T,highlightElement:w,highlightBlock:_e,configure:_,initHighlighting:S,initHighlightingOnLoad:L,registerLanguage:O,unregisterLanguage:Y,listLanguages:ee,getLanguage:z,registerAliases:re,autoDetection:he,inherit:J_,addPlugin:me,removePlugin:Ce}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=RH,t.regex={concat:bo,lookahead:Q_,either:Mm,optional:YF,anyNumberOfTimes:qF};for(let A in Tu)typeof Tu[A]=="object"&&Z_(Tu[A]);return Object.assign(t,Tu),t},ds=lS({});ds.newInstance=()=>lS({});cS.exports=ds;ds.HighlightJS=ds;ds.default=ds});var fS=Xd((lq,Om)=>{(function(){var t;typeof Om<"u"?t=Om.exports=r:t=function(){return this||(0,eval)("this")}(),t.format=r,t.vsprintf=n,typeof console<"u"&&typeof console.log=="function"&&(t.printf=e);function e(){console.log(r.apply(null,arguments))}function n(i,o){return r.apply(null,[i].concat(o))}function r(i){for(var o=1,s=[].slice.call(arguments),l=0,c=i.length,d="",f,h=!1,m,b,y=!1,w,_=function(){return s[o++]},S=function(){for(var L="";/\d/.test(i[l]);)L+=i[l++],f=i[l];return L.length>0?parseInt(L):null};l{(function(){var t,e="4.17.21",n=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",o="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",l=500,c="__lodash_placeholder__",d=1,f=2,h=4,m=1,b=2,y=1,w=2,_=4,S=8,L=16,D=32,T=64,$=128,O=256,Y=512,ee=30,z="...",re=800,he=16,Se=1,me=2,Ce=3,ge=1/0,_e=9007199254740991,A=17976931348623157e292,R=NaN,K=4294967295,J=K-1,se=K>>>1,be=[["ary",$],["bind",y],["bindKey",w],["curry",S],["curryRight",L],["flip",Y],["partial",D],["partialRight",T],["rearg",O]],De="[object Arguments]",je="[object Array]",Me="[object AsyncFunction]",Be="[object Boolean]",xt="[object Date]",Nt="[object DOMException]",Oe="[object Error]",_t="[object Function]",Jt="[object GeneratorFunction]",pt="[object Map]",sn="[object Number]",Xt="[object Null]",St="[object Object]",Je="[object Promise]",Xn="[object Proxy]",Lt="[object RegExp]",V="[object Set]",bt="[object String]",we="[object Symbol]",fe="[object Undefined]",ct="[object WeakMap]",ut="[object WeakSet]",Pt="[object ArrayBuffer]",kt="[object DataView]",I="[object Float32Array]",F="[object Float64Array]",X="[object Int8Array]",oe="[object Int16Array]",Fe="[object Int32Array]",rt="[object Uint8Array]",xr="[object Uint8ClampedArray]",B="[object Uint16Array]",ae="[object Uint32Array]",xe=/\b__p \+= '';/g,qe=/\b(__p \+=) '' \+/g,Ke=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Bt=/&(?:amp|lt|gt|quot|#39);/g,an=/[&<>"']/g,Jr=RegExp(Bt.source),Ca=RegExp(an.source),_r=/<%-([\s\S]+?)%>/g,ms=/<%([\s\S]+?)%>/g,Ai=/<%=([\s\S]+?)%>/g,Xr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fu=/^\w*$/,gs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Zr=/[\\^$.*+?()[\]{}|]/g,OS=RegExp(Zr.source),Hu=/^\s+/,RS=/\s/,IS=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,DS=/\{\n\/\* \[wrapped with (.+)\] \*/,LS=/,? & /,PS=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,BS=/[()=,{}\[\]\/\s]/,FS=/\\(\\)?/g,HS=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Bm=/\w*$/,$S=/^[-+]0x[0-9a-f]+$/i,zS=/^0b[01]+$/i,US=/^\[object .+?Constructor\]$/,WS=/^0o[0-7]+$/i,KS=/^(?:0|[1-9]\d*)$/,VS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Aa=/($^)/,GS=/['\n\r\u2028\u2029\\]/g,Ma="\\ud800-\\udfff",qS="\\u0300-\\u036f",YS="\\ufe20-\\ufe2f",JS="\\u20d0-\\u20ff",Fm=qS+YS+JS,Hm="\\u2700-\\u27bf",$m="a-z\\xdf-\\xf6\\xf8-\\xff",XS="\\xac\\xb1\\xd7\\xf7",ZS="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",jS="\\u2000-\\u206f",QS=" \\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",zm="A-Z\\xc0-\\xd6\\xd8-\\xde",Um="\\ufe0e\\ufe0f",Wm=XS+ZS+jS+QS,$u="['\u2019]",eT="["+Ma+"]",Km="["+Wm+"]",Na="["+Fm+"]",Vm="\\d+",tT="["+Hm+"]",Gm="["+$m+"]",qm="[^"+Ma+Wm+Vm+Hm+$m+zm+"]",zu="\\ud83c[\\udffb-\\udfff]",nT="(?:"+Na+"|"+zu+")",Ym="[^"+Ma+"]",Uu="(?:\\ud83c[\\udde6-\\uddff]){2}",Wu="[\\ud800-\\udbff][\\udc00-\\udfff]",Eo="["+zm+"]",Jm="\\u200d",Xm="(?:"+Gm+"|"+qm+")",rT="(?:"+Eo+"|"+qm+")",Zm="(?:"+$u+"(?:d|ll|m|re|s|t|ve))?",jm="(?:"+$u+"(?:D|LL|M|RE|S|T|VE))?",Qm=nT+"?",eg="["+Um+"]?",iT="(?:"+Jm+"(?:"+[Ym,Uu,Wu].join("|")+")"+eg+Qm+")*",oT="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",sT="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",tg=eg+Qm+iT,aT="(?:"+[tT,Uu,Wu].join("|")+")"+tg,lT="(?:"+[Ym+Na+"?",Na,Uu,Wu,eT].join("|")+")",cT=RegExp($u,"g"),uT=RegExp(Na,"g"),Ku=RegExp(zu+"(?="+zu+")|"+lT+tg,"g"),dT=RegExp([Eo+"?"+Gm+"+"+Zm+"(?="+[Km,Eo,"$"].join("|")+")",rT+"+"+jm+"(?="+[Km,Eo+Xm,"$"].join("|")+")",Eo+"?"+Xm+"+"+Zm,Eo+"+"+jm,sT,oT,Vm,aT].join("|"),"g"),fT=RegExp("["+Jm+Ma+Fm+Um+"]"),pT=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,hT=["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"],mT=-1,it={};it[I]=it[F]=it[X]=it[oe]=it[Fe]=it[rt]=it[xr]=it[B]=it[ae]=!0,it[De]=it[je]=it[Pt]=it[Be]=it[kt]=it[xt]=it[Oe]=it[_t]=it[pt]=it[sn]=it[St]=it[Lt]=it[V]=it[bt]=it[ct]=!1;var tt={};tt[De]=tt[je]=tt[Pt]=tt[kt]=tt[Be]=tt[xt]=tt[I]=tt[F]=tt[X]=tt[oe]=tt[Fe]=tt[pt]=tt[sn]=tt[St]=tt[Lt]=tt[V]=tt[bt]=tt[we]=tt[rt]=tt[xr]=tt[B]=tt[ae]=!0,tt[Oe]=tt[_t]=tt[ct]=!1;var gT={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},bT={"&":"&","<":"<",">":">",'"':""","'":"'"},yT={"&":"&","<":"<",">":">",""":'"',"'":"'"},ET={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vT=parseFloat,wT=parseInt,ng=typeof global=="object"&&global&&global.Object===Object&&global,xT=typeof self=="object"&&self&&self.Object===Object&&self,Ft=ng||xT||Function("return this")(),Vu=typeof hs=="object"&&hs&&!hs.nodeType&&hs,Mi=Vu&&typeof Ta=="object"&&Ta&&!Ta.nodeType&&Ta,rg=Mi&&Mi.exports===Vu,Gu=rg&&ng.process,On=function(){try{var N=Mi&&Mi.require&&Mi.require("util").types;return N||Gu&&Gu.binding&&Gu.binding("util")}catch{}}(),ig=On&&On.isArrayBuffer,og=On&&On.isDate,sg=On&&On.isMap,ag=On&&On.isRegExp,lg=On&&On.isSet,cg=On&&On.isTypedArray;function _n(N,H,P){switch(P.length){case 0:return N.call(H);case 1:return N.call(H,P[0]);case 2:return N.call(H,P[0],P[1]);case 3:return N.call(H,P[0],P[1],P[2])}return N.apply(H,P)}function _T(N,H,P,ie){for(var Ae=-1,Ye=N==null?0:N.length;++Ae-1}function qu(N,H,P){for(var ie=-1,Ae=N==null?0:N.length;++ie-1;);return P}function bg(N,H){for(var P=N.length;P--&&vo(H,N[P],0)>-1;);return P}function RT(N,H){for(var P=N.length,ie=0;P--;)N[P]===H&&++ie;return ie}var IT=Zu(gT),DT=Zu(bT);function LT(N){return"\\"+ET[N]}function PT(N,H){return N==null?t:N[H]}function wo(N){return fT.test(N)}function BT(N){return pT.test(N)}function FT(N){for(var H,P=[];!(H=N.next()).done;)P.push(H.value);return P}function td(N){var H=-1,P=Array(N.size);return N.forEach(function(ie,Ae){P[++H]=[Ae,ie]}),P}function yg(N,H){return function(P){return N(H(P))}}function ei(N,H){for(var P=-1,ie=N.length,Ae=0,Ye=[];++P-1}function T1(a,u){var p=this.__data__,g=qa(p,a);return g<0?(++this.size,p.push([a,u])):p[g][1]=u,this}Sr.prototype.clear=w1,Sr.prototype.delete=x1,Sr.prototype.get=_1,Sr.prototype.has=S1,Sr.prototype.set=T1;function Tr(a){var u=-1,p=a==null?0:a.length;for(this.clear();++u=u?a:u)),a}function Ln(a,u,p,g,E,x){var C,M=u&d,k=u&f,U=u&h;if(p&&(C=E?p(a,g,E,x):p(a)),C!==t)return C;if(!dt(a))return a;var W=Ne(a);if(W){if(C=NC(a),!M)return mn(a,C)}else{var q=jt(a),te=q==_t||q==Jt;if(ai(a))return eb(a,M);if(q==St||q==De||te&&!E){if(C=k||te?{}:Eb(a),!M)return k?yC(a,z1(C,a)):bC(a,kg(C,a))}else{if(!tt[q])return E?a:{};C=kC(a,q,M)}}x||(x=new jn);var de=x.get(a);if(de)return de;x.set(a,C),Yb(a)?a.forEach(function(ve){C.add(Ln(ve,u,p,ve,a,x))}):Gb(a)&&a.forEach(function(ve,$e){C.set($e,Ln(ve,u,p,$e,a,x))});var Ee=U?k?Ad:Cd:k?bn:Ht,Le=W?t:Ee(a);return Rn(Le||a,function(ve,$e){Le&&($e=ve,ve=a[$e]),_s(C,$e,Ln(ve,u,p,$e,a,x))}),C}function U1(a){var u=Ht(a);return function(p){return Og(p,a,u)}}function Og(a,u,p){var g=p.length;if(a==null)return!g;for(a=Qe(a);g--;){var E=p[g],x=u[E],C=a[E];if(C===t&&!(E in a)||!x(C))return!1}return!0}function Rg(a,u,p){if(typeof a!="function")throw new In(i);return ks(function(){a.apply(t,p)},u)}function Ss(a,u,p,g){var E=-1,x=ka,C=!0,M=a.length,k=[],U=u.length;if(!M)return k;p&&(u=at(u,Sn(p))),g?(x=qu,C=!1):u.length>=n&&(x=bs,C=!1,u=new Oi(u));e:for(;++EE?0:E+p),g=g===t||g>E?E:Re(g),g<0&&(g+=E),g=p>g?0:Xb(g);p0&&p(M)?u>1?Kt(M,u-1,p,g,E):Qr(E,M):g||(E[E.length]=M)}return E}var ld=sb(),Lg=sb(!0);function ur(a,u){return a&&ld(a,u,Ht)}function cd(a,u){return a&&Lg(a,u,Ht)}function Ja(a,u){return jr(u,function(p){return kr(a[p])})}function Ii(a,u){u=oi(u,a);for(var p=0,g=u.length;a!=null&&pu}function V1(a,u){return a!=null&&Ze.call(a,u)}function G1(a,u){return a!=null&&u in Qe(a)}function q1(a,u,p){return a>=Zt(u,p)&&a=120&&W.length>=120)?new Oi(C&&W):t}W=a[0];var q=-1,te=M[0];e:for(;++q-1;)M!==a&&$a.call(M,k,1),$a.call(a,k,1);return a}function Gg(a,u){for(var p=a?u.length:0,g=p-1;p--;){var E=u[p];if(p==g||E!==x){var x=E;Nr(E)?$a.call(a,E,1):Ed(a,E)}}return a}function gd(a,u){return a+Wa(Cg()*(u-a+1))}function sC(a,u,p,g){for(var E=-1,x=Rt(Ua((u-a)/(p||1)),0),C=P(x);x--;)C[g?x:++E]=a,a+=p;return C}function bd(a,u){var p="";if(!a||u<1||u>_e)return p;do u%2&&(p+=a),u=Wa(u/2),u&&(a+=a);while(u);return p}function He(a,u){return Dd(xb(a,u,yn),a+"")}function aC(a){return Ng(Oo(a))}function lC(a,u){var p=Oo(a);return sl(p,Ri(u,0,p.length))}function As(a,u,p,g){if(!dt(a))return a;u=oi(u,a);for(var E=-1,x=u.length,C=x-1,M=a;M!=null&&++EE?0:E+u),p=p>E?E:p,p<0&&(p+=E),E=u>p?0:p-u>>>0,u>>>=0;for(var x=P(E);++g>>1,C=a[x];C!==null&&!Cn(C)&&(p?C<=u:C=n){var U=u?null:xC(a);if(U)return Ra(U);C=!1,E=bs,k=new Oi}else k=u?[]:M;e:for(;++g=g?a:Pn(a,u,p)}var Qg=QT||function(a){return Ft.clearTimeout(a)};function eb(a,u){if(u)return a.slice();var p=a.length,g=wg?wg(p):new a.constructor(p);return a.copy(g),g}function _d(a){var u=new a.constructor(a.byteLength);return new Fa(u).set(new Fa(a)),u}function pC(a,u){var p=u?_d(a.buffer):a.buffer;return new a.constructor(p,a.byteOffset,a.byteLength)}function hC(a){var u=new a.constructor(a.source,Bm.exec(a));return u.lastIndex=a.lastIndex,u}function mC(a){return xs?Qe(xs.call(a)):{}}function tb(a,u){var p=u?_d(a.buffer):a.buffer;return new a.constructor(p,a.byteOffset,a.length)}function nb(a,u){if(a!==u){var p=a!==t,g=a===null,E=a===a,x=Cn(a),C=u!==t,M=u===null,k=u===u,U=Cn(u);if(!M&&!U&&!x&&a>u||x&&C&&k&&!M&&!U||g&&C&&k||!p&&k||!E)return 1;if(!g&&!x&&!U&&a=M)return k;var U=p[g];return k*(U=="desc"?-1:1)}}return a.index-u.index}function rb(a,u,p,g){for(var E=-1,x=a.length,C=p.length,M=-1,k=u.length,U=Rt(x-C,0),W=P(k+U),q=!g;++M1?p[E-1]:t,C=E>2?p[2]:t;for(x=a.length>3&&typeof x=="function"?(E--,x):t,C&&cn(p[0],p[1],C)&&(x=E<3?t:x,E=1),u=Qe(u);++g-1?E[x?u[C]:C]:t}}function cb(a){return Mr(function(u){var p=u.length,g=p,E=Dn.prototype.thru;for(a&&u.reverse();g--;){var x=u[g];if(typeof x!="function")throw new In(i);if(E&&!C&&il(x)=="wrapper")var C=new Dn([],!0)}for(g=C?g:p;++g1&&Ve.reverse(),W&&k<$e&&(Ve.length=k),this&&this!==Ft&&this instanceof ve&&(Rr=Le||Ms(Rr)),Rr.apply(er,Ve)}return ve}function ub(a,u){return function(p,g){return Y1(p,a,u(g),{})}}function tl(a,u){return function(p,g){var E;if(p===t&&g===t)return u;if(p!==t&&(E=p),g!==t){if(E===t)return g;typeof p=="string"||typeof g=="string"?(p=Tn(p),g=Tn(g)):(p=Jg(p),g=Jg(g)),E=a(p,g)}return E}}function Sd(a){return Mr(function(u){return u=at(u,Sn(ye())),He(function(p){var g=this;return a(u,function(E){return _n(E,g,p)})})})}function nl(a,u){u=u===t?" ":Tn(u);var p=u.length;if(p<2)return p?bd(u,a):u;var g=bd(u,Ua(a/xo(u)));return wo(u)?si(Zn(g),0,a).join(""):g.slice(0,a)}function wC(a,u,p,g){var E=u&y,x=Ms(a);function C(){for(var M=-1,k=arguments.length,U=-1,W=g.length,q=P(W+k),te=this&&this!==Ft&&this instanceof C?x:a;++UM))return!1;var U=x.get(a),W=x.get(u);if(U&&W)return U==u&&W==a;var q=-1,te=!0,de=p&b?new Oi:t;for(x.set(a,u),x.set(u,a);++q1?"& ":"")+u[g],u=u.join(p>2?", ":" "),a.replace(IS,`{ -/* [wrapped with `+u+`] */ -`)}function RC(a){return Ne(a)||Pi(a)||!!(Sg&&a&&a[Sg])}function Nr(a,u){var p=typeof a;return u=u??_e,!!u&&(p=="number"||p!="symbol"&&KS.test(a))&&a>-1&&a%1==0&&a0){if(++u>=re)return arguments[0]}else u=0;return a.apply(t,arguments)}}function sl(a,u){var p=-1,g=a.length,E=g-1;for(u=u===t?g:u;++p1?a[u-1]:t;return p=typeof p=="function"?(a.pop(),p):t,Db(a,p)});function Lb(a){var u=v(a);return u.__chain__=!0,u}function WA(a,u){return u(a),a}function al(a,u){return u(a)}var KA=Mr(function(a){var u=a.length,p=u?a[0]:0,g=this.__wrapped__,E=function(x){return ad(x,a)};return u>1||this.__actions__.length||!(g instanceof Ue)||!Nr(p)?this.thru(E):(g=g.slice(p,+p+(u?1:0)),g.__actions__.push({func:al,args:[E],thisArg:t}),new Dn(g,this.__chain__).thru(function(x){return u&&!x.length&&x.push(t),x}))});function VA(){return Lb(this)}function GA(){return new Dn(this.value(),this.__chain__)}function qA(){this.__values__===t&&(this.__values__=Jb(this.value()));var a=this.__index__>=this.__values__.length,u=a?t:this.__values__[this.__index__++];return{done:a,value:u}}function YA(){return this}function JA(a){for(var u,p=this;p instanceof Ga;){var g=Mb(p);g.__index__=0,g.__values__=t,u?E.__wrapped__=g:u=g;var E=g;p=p.__wrapped__}return E.__wrapped__=a,u}function XA(){var a=this.__wrapped__;if(a instanceof Ue){var u=a;return this.__actions__.length&&(u=new Ue(this)),u=u.reverse(),u.__actions__.push({func:al,args:[Ld],thisArg:t}),new Dn(u,this.__chain__)}return this.thru(Ld)}function ZA(){return Zg(this.__wrapped__,this.__actions__)}var jA=Qa(function(a,u,p){Ze.call(a,p)?++a[p]:Cr(a,p,1)});function QA(a,u,p){var g=Ne(a)?ug:W1;return p&&cn(a,u,p)&&(u=t),g(a,ye(u,3))}function eM(a,u){var p=Ne(a)?jr:Dg;return p(a,ye(u,3))}var tM=lb(Nb),nM=lb(kb);function rM(a,u){return Kt(ll(a,u),1)}function iM(a,u){return Kt(ll(a,u),ge)}function oM(a,u,p){return p=p===t?1:Re(p),Kt(ll(a,u),p)}function Pb(a,u){var p=Ne(a)?Rn:ri;return p(a,ye(u,3))}function Bb(a,u){var p=Ne(a)?ST:Ig;return p(a,ye(u,3))}var sM=Qa(function(a,u,p){Ze.call(a,p)?a[p].push(u):Cr(a,p,[u])});function aM(a,u,p,g){a=gn(a)?a:Oo(a),p=p&&!g?Re(p):0;var E=a.length;return p<0&&(p=Rt(E+p,0)),pl(a)?p<=E&&a.indexOf(u,p)>-1:!!E&&vo(a,u,p)>-1}var lM=He(function(a,u,p){var g=-1,E=typeof u=="function",x=gn(a)?P(a.length):[];return ri(a,function(C){x[++g]=E?_n(u,C,p):Ts(C,u,p)}),x}),cM=Qa(function(a,u,p){Cr(a,p,u)});function ll(a,u){var p=Ne(a)?at:$g;return p(a,ye(u,3))}function uM(a,u,p,g){return a==null?[]:(Ne(u)||(u=u==null?[]:[u]),p=g?t:p,Ne(p)||(p=p==null?[]:[p]),Kg(a,u,p))}var dM=Qa(function(a,u,p){a[p?0:1].push(u)},function(){return[[],[]]});function fM(a,u,p){var g=Ne(a)?Yu:hg,E=arguments.length<3;return g(a,ye(u,4),p,E,ri)}function pM(a,u,p){var g=Ne(a)?TT:hg,E=arguments.length<3;return g(a,ye(u,4),p,E,Ig)}function hM(a,u){var p=Ne(a)?jr:Dg;return p(a,dl(ye(u,3)))}function mM(a){var u=Ne(a)?Ng:aC;return u(a)}function gM(a,u,p){(p?cn(a,u,p):u===t)?u=1:u=Re(u);var g=Ne(a)?F1:lC;return g(a,u)}function bM(a){var u=Ne(a)?H1:uC;return u(a)}function yM(a){if(a==null)return 0;if(gn(a))return pl(a)?xo(a):a.length;var u=jt(a);return u==pt||u==V?a.size:pd(a).length}function EM(a,u,p){var g=Ne(a)?Ju:dC;return p&&cn(a,u,p)&&(u=t),g(a,ye(u,3))}var vM=He(function(a,u){if(a==null)return[];var p=u.length;return p>1&&cn(a,u[0],u[1])?u=[]:p>2&&cn(u[0],u[1],u[2])&&(u=[u[0]]),Kg(a,Kt(u,1),[])}),cl=e1||function(){return Ft.Date.now()};function wM(a,u){if(typeof u!="function")throw new In(i);return a=Re(a),function(){if(--a<1)return u.apply(this,arguments)}}function Fb(a,u,p){return u=p?t:u,u=a&&u==null?a.length:u,Ar(a,$,t,t,t,t,u)}function Hb(a,u){var p;if(typeof u!="function")throw new In(i);return a=Re(a),function(){return--a>0&&(p=u.apply(this,arguments)),a<=1&&(u=t),p}}var Bd=He(function(a,u,p){var g=y;if(p.length){var E=ei(p,No(Bd));g|=D}return Ar(a,g,u,p,E)}),$b=He(function(a,u,p){var g=y|w;if(p.length){var E=ei(p,No($b));g|=D}return Ar(u,g,a,p,E)});function zb(a,u,p){u=p?t:u;var g=Ar(a,S,t,t,t,t,t,u);return g.placeholder=zb.placeholder,g}function Ub(a,u,p){u=p?t:u;var g=Ar(a,L,t,t,t,t,t,u);return g.placeholder=Ub.placeholder,g}function Wb(a,u,p){var g,E,x,C,M,k,U=0,W=!1,q=!1,te=!0;if(typeof a!="function")throw new In(i);u=Fn(u)||0,dt(p)&&(W=!!p.leading,q="maxWait"in p,x=q?Rt(Fn(p.maxWait)||0,u):x,te="trailing"in p?!!p.trailing:te);function de(Et){var er=g,Rr=E;return g=E=t,U=Et,C=a.apply(Rr,er),C}function Ee(Et){return U=Et,M=ks($e,u),W?de(Et):C}function Le(Et){var er=Et-k,Rr=Et-U,ly=u-er;return q?Zt(ly,x-Rr):ly}function ve(Et){var er=Et-k,Rr=Et-U;return k===t||er>=u||er<0||q&&Rr>=x}function $e(){var Et=cl();if(ve(Et))return Ve(Et);M=ks($e,Le(Et))}function Ve(Et){return M=t,te&&g?de(Et):(g=E=t,C)}function An(){M!==t&&Qg(M),U=0,g=k=E=M=t}function un(){return M===t?C:Ve(cl())}function Mn(){var Et=cl(),er=ve(Et);if(g=arguments,E=this,k=Et,er){if(M===t)return Ee(k);if(q)return Qg(M),M=ks($e,u),de(k)}return M===t&&(M=ks($e,u)),C}return Mn.cancel=An,Mn.flush=un,Mn}var xM=He(function(a,u){return Rg(a,1,u)}),_M=He(function(a,u,p){return Rg(a,Fn(u)||0,p)});function SM(a){return Ar(a,Y)}function ul(a,u){if(typeof a!="function"||u!=null&&typeof u!="function")throw new In(i);var p=function(){var g=arguments,E=u?u.apply(this,g):g[0],x=p.cache;if(x.has(E))return x.get(E);var C=a.apply(this,g);return p.cache=x.set(E,C)||x,C};return p.cache=new(ul.Cache||Tr),p}ul.Cache=Tr;function dl(a){if(typeof a!="function")throw new In(i);return function(){var u=arguments;switch(u.length){case 0:return!a.call(this);case 1:return!a.call(this,u[0]);case 2:return!a.call(this,u[0],u[1]);case 3:return!a.call(this,u[0],u[1],u[2])}return!a.apply(this,u)}}function TM(a){return Hb(2,a)}var CM=fC(function(a,u){u=u.length==1&&Ne(u[0])?at(u[0],Sn(ye())):at(Kt(u,1),Sn(ye()));var p=u.length;return He(function(g){for(var E=-1,x=Zt(g.length,p);++E=u}),Pi=Bg(function(){return arguments}())?Bg:function(a){return ht(a)&&Ze.call(a,"callee")&&!_g.call(a,"callee")},Ne=P.isArray,zM=ig?Sn(ig):J1;function gn(a){return a!=null&&fl(a.length)&&!kr(a)}function yt(a){return ht(a)&&gn(a)}function UM(a){return a===!0||a===!1||ht(a)&&ln(a)==Be}var ai=n1||Jd,WM=og?Sn(og):X1;function KM(a){return ht(a)&&a.nodeType===1&&!Os(a)}function VM(a){if(a==null)return!0;if(gn(a)&&(Ne(a)||typeof a=="string"||typeof a.splice=="function"||ai(a)||ko(a)||Pi(a)))return!a.length;var u=jt(a);if(u==pt||u==V)return!a.size;if(Ns(a))return!pd(a).length;for(var p in a)if(Ze.call(a,p))return!1;return!0}function GM(a,u){return Cs(a,u)}function qM(a,u,p){p=typeof p=="function"?p:t;var g=p?p(a,u):t;return g===t?Cs(a,u,t,p):!!g}function Hd(a){if(!ht(a))return!1;var u=ln(a);return u==Oe||u==Nt||typeof a.message=="string"&&typeof a.name=="string"&&!Os(a)}function YM(a){return typeof a=="number"&&Tg(a)}function kr(a){if(!dt(a))return!1;var u=ln(a);return u==_t||u==Jt||u==Me||u==Xn}function Vb(a){return typeof a=="number"&&a==Re(a)}function fl(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=_e}function dt(a){var u=typeof a;return a!=null&&(u=="object"||u=="function")}function ht(a){return a!=null&&typeof a=="object"}var Gb=sg?Sn(sg):j1;function JM(a,u){return a===u||fd(a,u,Nd(u))}function XM(a,u,p){return p=typeof p=="function"?p:t,fd(a,u,Nd(u),p)}function ZM(a){return qb(a)&&a!=+a}function jM(a){if(LC(a))throw new Ae(r);return Fg(a)}function QM(a){return a===null}function eN(a){return a==null}function qb(a){return typeof a=="number"||ht(a)&&ln(a)==sn}function Os(a){if(!ht(a)||ln(a)!=St)return!1;var u=Ha(a);if(u===null)return!0;var p=Ze.call(u,"constructor")&&u.constructor;return typeof p=="function"&&p instanceof p&&La.call(p)==XT}var $d=ag?Sn(ag):Q1;function tN(a){return Vb(a)&&a>=-_e&&a<=_e}var Yb=lg?Sn(lg):eC;function pl(a){return typeof a=="string"||!Ne(a)&&ht(a)&&ln(a)==bt}function Cn(a){return typeof a=="symbol"||ht(a)&&ln(a)==we}var ko=cg?Sn(cg):tC;function nN(a){return a===t}function rN(a){return ht(a)&&jt(a)==ct}function iN(a){return ht(a)&&ln(a)==ut}var oN=rl(hd),sN=rl(function(a,u){return a<=u});function Jb(a){if(!a)return[];if(gn(a))return pl(a)?Zn(a):mn(a);if(ys&&a[ys])return FT(a[ys]());var u=jt(a),p=u==pt?td:u==V?Ra:Oo;return p(a)}function Or(a){if(!a)return a===0?a:0;if(a=Fn(a),a===ge||a===-ge){var u=a<0?-1:1;return u*A}return a===a?a:0}function Re(a){var u=Or(a),p=u%1;return u===u?p?u-p:u:0}function Xb(a){return a?Ri(Re(a),0,K):0}function Fn(a){if(typeof a=="number")return a;if(Cn(a))return R;if(dt(a)){var u=typeof a.valueOf=="function"?a.valueOf():a;a=dt(u)?u+"":u}if(typeof a!="string")return a===0?a:+a;a=mg(a);var p=zS.test(a);return p||WS.test(a)?wT(a.slice(2),p?2:8):$S.test(a)?R:+a}function Zb(a){return dr(a,bn(a))}function aN(a){return a?Ri(Re(a),-_e,_e):a===0?a:0}function Xe(a){return a==null?"":Tn(a)}var lN=Ao(function(a,u){if(Ns(u)||gn(u)){dr(u,Ht(u),a);return}for(var p in u)Ze.call(u,p)&&_s(a,p,u[p])}),jb=Ao(function(a,u){dr(u,bn(u),a)}),hl=Ao(function(a,u,p,g){dr(u,bn(u),a,g)}),cN=Ao(function(a,u,p,g){dr(u,Ht(u),a,g)}),uN=Mr(ad);function dN(a,u){var p=Co(a);return u==null?p:kg(p,u)}var fN=He(function(a,u){a=Qe(a);var p=-1,g=u.length,E=g>2?u[2]:t;for(E&&cn(u[0],u[1],E)&&(g=1);++p1),x}),dr(a,Ad(a),p),g&&(p=Ln(p,d|f|h,_C));for(var E=u.length;E--;)Ed(p,u[E]);return p});function kN(a,u){return ey(a,dl(ye(u)))}var ON=Mr(function(a,u){return a==null?{}:iC(a,u)});function ey(a,u){if(a==null)return{};var p=at(Ad(a),function(g){return[g]});return u=ye(u),Vg(a,p,function(g,E){return u(g,E[0])})}function RN(a,u,p){u=oi(u,a);var g=-1,E=u.length;for(E||(E=1,a=t);++gu){var g=a;a=u,u=g}if(p||a%1||u%1){var E=Cg();return Zt(a+E*(u-a+vT("1e-"+((E+"").length-1))),u)}return gd(a,u)}var WN=Mo(function(a,u,p){return u=u.toLowerCase(),a+(p?ry(u):u)});function ry(a){return Wd(Xe(a).toLowerCase())}function iy(a){return a=Xe(a),a&&a.replace(VS,IT).replace(uT,"")}function KN(a,u,p){a=Xe(a),u=Tn(u);var g=a.length;p=p===t?g:Ri(Re(p),0,g);var E=p;return p-=u.length,p>=0&&a.slice(p,E)==u}function VN(a){return a=Xe(a),a&&Ca.test(a)?a.replace(an,DT):a}function GN(a){return a=Xe(a),a&&OS.test(a)?a.replace(Zr,"\\$&"):a}var qN=Mo(function(a,u,p){return a+(p?"-":"")+u.toLowerCase()}),YN=Mo(function(a,u,p){return a+(p?" ":"")+u.toLowerCase()}),JN=ab("toLowerCase");function XN(a,u,p){a=Xe(a),u=Re(u);var g=u?xo(a):0;if(!u||g>=u)return a;var E=(u-g)/2;return nl(Wa(E),p)+a+nl(Ua(E),p)}function ZN(a,u,p){a=Xe(a),u=Re(u);var g=u?xo(a):0;return u&&g>>0,p?(a=Xe(a),a&&(typeof u=="string"||u!=null&&!$d(u))&&(u=Tn(u),!u&&wo(a))?si(Zn(a),0,p):a.split(u,p)):[]}var ik=Mo(function(a,u,p){return a+(p?" ":"")+Wd(u)});function ok(a,u,p){return a=Xe(a),p=p==null?0:Ri(Re(p),0,a.length),u=Tn(u),a.slice(p,p+u.length)==u}function sk(a,u,p){var g=v.templateSettings;p&&cn(a,u,p)&&(u=t),a=Xe(a),u=hl({},u,g,hb);var E=hl({},u.imports,g.imports,hb),x=Ht(E),C=ed(E,x),M,k,U=0,W=u.interpolate||Aa,q="__p += '",te=nd((u.escape||Aa).source+"|"+W.source+"|"+(W===Ai?HS:Aa).source+"|"+(u.evaluate||Aa).source+"|$","g"),de="//# sourceURL="+(Ze.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++mT+"]")+` +var eO=Object.create;var uy=Object.defineProperty;var tO=Object.getOwnPropertyDescriptor;var nO=Object.getOwnPropertyNames;var rO=Object.getPrototypeOf,iO=Object.prototype.hasOwnProperty;var Xd=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var oO=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nO(e))!iO.call(t,i)&&i!==n&&uy(t,i,{get:()=>e[i],enumerable:!(r=tO(e,i))||r.enumerable});return t};var Zd=(t,e,n)=>(n=t!=null?eO(rO(t)):{},oO(e||!t||!t.__esModule?uy(n,"default",{value:t,enumerable:!0}):n,t));var uS=Xd((sq,cS)=>{function Z_(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&Z_(n)}),t}var Cu=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function j_(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ti(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var VF="",V_=t=>!!t.scope,GF=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`},Tm=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=j_(e)}openNode(e){if(!V_(e))return;let n=GF(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){V_(e)&&(this.buffer+=VF)}value(){return this.buffer}span(e){this.buffer+=``}},G_=(t={})=>{let e={children:[]};return Object.assign(e,t),e},Cm=class t{constructor(){this.rootNode=G_(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n=G_({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{t._collapse(n)}))}},Am=class extends Cm{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Tm(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function va(t){return t?typeof t=="string"?t:t.source:null}function Q_(t){return bo("(?=",t,")")}function qF(t){return bo("(?:",t,")*")}function YF(t){return bo("(?:",t,")?")}function bo(...t){return t.map(n=>va(n)).join("")}function JF(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Nm(...t){return"("+(JF(t).capture?"":"?:")+t.map(r=>va(r)).join("|")+")"}function eS(t){return new RegExp(t.toString()+"|").exec("").length-1}function XF(t,e){let n=t&&t.exec(e);return n&&n.index===0}var ZF=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function km(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=va(r),s="";for(;o.length>0;){let l=ZF.exec(o);if(!l){s+=o;break}s+=o.substring(0,l.index),o=o.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+i):(s+=l[0],l[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(e)}var jF=/\b\B/,tS="[a-zA-Z]\\w*",Om="[a-zA-Z_]\\w*",nS="\\b\\d+(\\.\\d+)?",rS="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",iS="\\b(0b[01]+)",QF="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",eH=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=bo(e,/.*\b/,t.binary,/\b.*/)),Ti({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},wa={begin:"\\\\[\\s\\S]",relevance:0},tH={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[wa]},nH={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[wa]},rH={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Mu=function(t,e,n={}){let r=Ti({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=Nm("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:bo(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},iH=Mu("//","$"),oH=Mu("/\\*","\\*/"),sH=Mu("#","$"),aH={scope:"number",begin:nS,relevance:0},lH={scope:"number",begin:rS,relevance:0},cH={scope:"number",begin:iS,relevance:0},uH={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[wa,{begin:/\[/,end:/\]/,relevance:0,contains:[wa]}]}]},dH={scope:"title",begin:tS,relevance:0},fH={scope:"title",begin:Om,relevance:0},pH={begin:"\\.\\s*"+Om,relevance:0},hH=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},Tu=Object.freeze({__proto__:null,MATCH_NOTHING_RE:jF,IDENT_RE:tS,UNDERSCORE_IDENT_RE:Om,NUMBER_RE:nS,C_NUMBER_RE:rS,BINARY_NUMBER_RE:iS,RE_STARTERS_RE:QF,SHEBANG:eH,BACKSLASH_ESCAPE:wa,APOS_STRING_MODE:tH,QUOTE_STRING_MODE:nH,PHRASAL_WORDS_MODE:rH,COMMENT:Mu,C_LINE_COMMENT_MODE:iH,C_BLOCK_COMMENT_MODE:oH,HASH_COMMENT_MODE:sH,NUMBER_MODE:aH,C_NUMBER_MODE:lH,BINARY_NUMBER_MODE:cH,REGEXP_MODE:uH,TITLE_MODE:dH,UNDERSCORE_TITLE_MODE:fH,METHOD_GUARD:pH,END_SAME_AS_BEGIN:hH});function mH(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function gH(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function bH(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=mH,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function yH(t,e){Array.isArray(t.illegal)&&(t.illegal=Nm(...t.illegal))}function EH(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function vH(t,e){t.relevance===void 0&&(t.relevance=1)}var wH=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=bo(n.beforeMatch,Q_(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},xH=["of","and","for","in","not","or","if","then","parent","list","value"],_H="keyword";function oS(t,e,n=_H){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,oS(t[o],e,o))}),r;function i(o,s){e&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){let u=l.split("|");r[u[0]]=[o,SH(u[0],u[1])]})}}function SH(t,e){return e?Number(e):TH(t)?0:1}function TH(t){return xH.includes(t.toLowerCase())}var q_={},go=t=>{console.error(t)},Y_=(t,...e)=>{console.log(`WARN: ${t}`,...e)},us=(t,e)=>{q_[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),q_[`${t}/${e}`]=!0)},Au=new Error;function sS(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let l=1;l<=e.length;l++)s[l+r]=i[l],o[l+r]=!0,r+=eS(e[l-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function CH(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw go("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Au;if(typeof t.beginScope!="object"||t.beginScope===null)throw go("beginScope must be object"),Au;sS(t,t.begin,{key:"beginScope"}),t.begin=km(t.begin,{joinWith:""})}}function AH(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw go("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Au;if(typeof t.endScope!="object"||t.endScope===null)throw go("endScope must be object"),Au;sS(t,t.end,{key:"endScope"}),t.end=km(t.end,{joinWith:""})}}function MH(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function NH(t){MH(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),CH(t),AH(t)}function kH(t){function e(s,l){return new RegExp(va(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,u){u.position=this.position++,this.matchIndexes[this.matchAt]=u,this.regexes.push([u,l]),this.matchAt+=eS(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let l=this.regexes.map(u=>u[1]);this.matcherRe=e(km(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;let u=this.matcherRe.exec(l);if(!u)return null;let d=u.findIndex((h,m)=>m>0&&h!==void 0),f=this.matchIndexes[d];return u.splice(0,d),Object.assign(u,f)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];let u=new n;return this.rules.slice(l).forEach(([d,f])=>u.addRule(d,f)),u.compile(),this.multiRegexes[l]=u,u}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,u){this.rules.push([l,u]),u.type==="begin"&&this.count++}exec(l){let u=this.getMatcher(this.regexIndex);u.lastIndex=this.lastIndex;let d=u.exec(l);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){let f=this.getMatcher(0);f.lastIndex=this.lastIndex+1,d=f.exec(l)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function i(s){let l=new r;return s.contains.forEach(u=>l.addRule(u.begin,{rule:u,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function o(s,l){let u=s;if(s.isCompiled)return u;[gH,EH,NH,wH].forEach(f=>f(s,l)),t.compilerExtensions.forEach(f=>f(s,l)),s.__beforeBegin=null,[bH,yH,vH].forEach(f=>f(s,l)),s.isCompiled=!0;let d=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),d=s.keywords.$pattern,delete s.keywords.$pattern),d=d||/\w+/,s.keywords&&(s.keywords=oS(s.keywords,t.case_insensitive)),u.keywordPatternRe=e(d,!0),l&&(s.begin||(s.begin=/\B|\b/),u.beginRe=e(u.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(u.endRe=e(u.end)),u.terminatorEnd=va(u.end)||"",s.endsWithParent&&l.terminatorEnd&&(u.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(u.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(f){return OH(f==="self"?s:f)})),s.contains.forEach(function(f){o(f,u)}),s.starts&&o(s.starts,l),u.matcher=i(u),u}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Ti(t.classNameAliases||{}),o(t)}function aS(t){return t?t.endsWithParent||aS(t.starts):!1}function OH(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ti(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:aS(t)?Ti(t,{starts:t.starts?Ti(t.starts):null}):Object.isFrozen(t)?Ti(t):t}var RH="11.8.0",Mm=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},Sm=j_,J_=Ti,X_=Symbol("nomatch"),IH=7,lS=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,o="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Am};function u(A){return l.noHighlightRe.test(A)}function d(A){let R=A.className+" ";R+=A.parentNode?A.parentNode.className:"";let K=l.languageDetectRe.exec(R);if(K){let J=z(K[1]);return J||(Y_(o.replace("{}",K[1])),Y_("Falling back to no-highlight mode for this block.",A)),J?K[1]:"no-highlight"}return R.split(/\s+/).find(J=>u(J)||z(J))}function f(A,R,K){let J="",se="";typeof R=="object"?(J=A,K=R.ignoreIllegals,se=R.language):(us("10.7.0","highlight(lang, code, ...args) has been deprecated."),us("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),se=A,J=R),K===void 0&&(K=!0);let be={code:J,language:se};ge("before:highlight",be);let De=be.result?be.result:h(be.language,be.code,K);return De.code=be.code,ge("after:highlight",De),De}function h(A,R,K,J){let se=Object.create(null);function be(I,F){return I.keywords[F]}function De(){if(!V.keywords){we.addText(fe);return}let I=0;V.keywordPatternRe.lastIndex=0;let F=V.keywordPatternRe.exec(fe),X="";for(;F;){X+=fe.substring(I,F.index);let oe=Je.case_insensitive?F[0].toLowerCase():F[0],Fe=be(V,oe);if(Fe){let[rt,xr]=Fe;if(we.addText(X),X="",se[oe]=(se[oe]||0)+1,se[oe]<=IH&&(ct+=xr),rt.startsWith("_"))X+=F[0];else{let B=Je.classNameAliases[rt]||rt;Be(F[0],B)}}else X+=F[0];I=V.keywordPatternRe.lastIndex,F=V.keywordPatternRe.exec(fe)}X+=fe.substring(I),we.addText(X)}function je(){if(fe==="")return;let I=null;if(typeof V.subLanguage=="string"){if(!e[V.subLanguage]){we.addText(fe);return}I=h(V.subLanguage,fe,!0,bt[V.subLanguage]),bt[V.subLanguage]=I._top}else I=b(fe,V.subLanguage.length?V.subLanguage:null);V.relevance>0&&(ct+=I.relevance),we.__addSublanguage(I._emitter,I.language)}function Me(){V.subLanguage!=null?je():De(),fe=""}function Be(I,F){I!==""&&(we.startScope(F),we.addText(I),we.endScope())}function xt(I,F){let X=1,oe=F.length-1;for(;X<=oe;){if(!I._emit[X]){X++;continue}let Fe=Je.classNameAliases[I[X]]||I[X],rt=F[X];Fe?Be(rt,Fe):(fe=rt,De(),fe=""),X++}}function Nt(I,F){return I.scope&&typeof I.scope=="string"&&we.openNode(Je.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(Be(fe,Je.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),fe=""):I.beginScope._multi&&(xt(I.beginScope,F),fe="")),V=Object.create(I,{parent:{value:V}}),V}function Oe(I,F,X){let oe=XF(I.endRe,X);if(oe){if(I["on:end"]){let Fe=new Cu(I);I["on:end"](F,Fe),Fe.isMatchIgnored&&(oe=!1)}if(oe){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return Oe(I.parent,F,X)}function _t(I){return V.matcher.regexIndex===0?(fe+=I[0],1):(kt=!0,0)}function Jt(I){let F=I[0],X=I.rule,oe=new Cu(X),Fe=[X.__beforeBegin,X["on:begin"]];for(let rt of Fe)if(rt&&(rt(I,oe),oe.isMatchIgnored))return _t(F);return X.skip?fe+=F:(X.excludeBegin&&(fe+=F),Me(),!X.returnBegin&&!X.excludeBegin&&(fe=F)),Nt(X,I),X.returnBegin?0:F.length}function pt(I){let F=I[0],X=R.substring(I.index),oe=Oe(V,I,X);if(!oe)return X_;let Fe=V;V.endScope&&V.endScope._wrap?(Me(),Be(F,V.endScope._wrap)):V.endScope&&V.endScope._multi?(Me(),xt(V.endScope,I)):Fe.skip?fe+=F:(Fe.returnEnd||Fe.excludeEnd||(fe+=F),Me(),Fe.excludeEnd&&(fe=F));do V.scope&&we.closeNode(),!V.skip&&!V.subLanguage&&(ct+=V.relevance),V=V.parent;while(V!==oe.parent);return oe.starts&&Nt(oe.starts,I),Fe.returnEnd?0:F.length}function sn(){let I=[];for(let F=V;F!==Je;F=F.parent)F.scope&&I.unshift(F.scope);I.forEach(F=>we.openNode(F))}let Xt={};function St(I,F){let X=F&&F[0];if(fe+=I,X==null)return Me(),0;if(Xt.type==="begin"&&F.type==="end"&&Xt.index===F.index&&X===""){if(fe+=R.slice(F.index,F.index+1),!i){let oe=new Error(`0 width match regex (${A})`);throw oe.languageName=A,oe.badRule=Xt.rule,oe}return 1}if(Xt=F,F.type==="begin")return Jt(F);if(F.type==="illegal"&&!K){let oe=new Error('Illegal lexeme "'+X+'" for mode "'+(V.scope||"")+'"');throw oe.mode=V,oe}else if(F.type==="end"){let oe=pt(F);if(oe!==X_)return oe}if(F.type==="illegal"&&X==="")return 1;if(Pt>1e5&&Pt>F.index*3)throw new Error("potential infinite loop, way more iterations than matches");return fe+=X,X.length}let Je=z(A);if(!Je)throw go(o.replace("{}",A)),new Error('Unknown language: "'+A+'"');let Xn=kH(Je),Lt="",V=J||Xn,bt={},we=new l.__emitter(l);sn();let fe="",ct=0,ut=0,Pt=0,kt=!1;try{if(Je.__emitTokens)Je.__emitTokens(R,we);else{for(V.matcher.considerAll();;){Pt++,kt?kt=!1:V.matcher.considerAll(),V.matcher.lastIndex=ut;let I=V.matcher.exec(R);if(!I)break;let F=R.substring(ut,I.index),X=St(F,I);ut=I.index+X}St(R.substring(ut))}return we.finalize(),Lt=we.toHTML(),{language:A,value:Lt,relevance:ct,illegal:!1,_emitter:we,_top:V}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:A,value:Sm(R),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:ut,context:R.slice(ut-100,ut+100),mode:I.mode,resultSoFar:Lt},_emitter:we};if(i)return{language:A,value:Sm(R),illegal:!1,relevance:0,errorRaised:I,_emitter:we,_top:V};throw I}}function m(A){let R={value:Sm(A),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return R._emitter.addText(A),R}function b(A,R){R=R||l.languages||Object.keys(e);let K=m(A),J=R.filter(z).filter(he).map(Me=>h(Me,A,!1));J.unshift(K);let se=J.sort((Me,Be)=>{if(Me.relevance!==Be.relevance)return Be.relevance-Me.relevance;if(Me.language&&Be.language){if(z(Me.language).supersetOf===Be.language)return 1;if(z(Be.language).supersetOf===Me.language)return-1}return 0}),[be,De]=se,je=be;return je.secondBest=De,je}function y(A,R,K){let J=R&&n[R]||K;A.classList.add("hljs"),A.classList.add(`language-${J}`)}function v(A){let R=null,K=d(A);if(u(K))return;if(ge("before:highlightElement",{el:A,language:K}),A.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),l.throwUnescapedHTML))throw new Mm("One of your code blocks includes unescaped HTML.",A.innerHTML);R=A;let J=R.textContent,se=K?f(J,{language:K,ignoreIllegals:!0}):b(J);A.innerHTML=se.value,y(A,K,se.language),A.result={language:se.language,re:se.relevance,relevance:se.relevance},se.secondBest&&(A.secondBest={language:se.secondBest.language,relevance:se.secondBest.relevance}),ge("after:highlightElement",{el:A,result:se,text:J})}function x(A){l=J_(l,A)}let S=()=>{T(),us("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function L(){T(),us("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let D=!1;function T(){if(document.readyState==="loading"){D=!0;return}document.querySelectorAll(l.cssSelector).forEach(v)}function $(){D&&T()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",$,!1);function O(A,R){let K=null;try{K=R(t)}catch(J){if(go("Language definition for '{}' could not be registered.".replace("{}",A)),i)go(J);else throw J;K=s}K.name||(K.name=A),e[A]=K,K.rawDefinition=R.bind(null,t),K.aliases&&re(K.aliases,{languageName:A})}function Y(A){delete e[A];for(let R of Object.keys(n))n[R]===A&&delete n[R]}function ee(){return Object.keys(e)}function z(A){return A=(A||"").toLowerCase(),e[A]||e[n[A]]}function re(A,{languageName:R}){typeof A=="string"&&(A=[A]),A.forEach(K=>{n[K.toLowerCase()]=R})}function he(A){let R=z(A);return R&&!R.disableAutodetect}function Se(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=R=>{A["before:highlightBlock"](Object.assign({block:R.el},R))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=R=>{A["after:highlightBlock"](Object.assign({block:R.el},R))})}function me(A){Se(A),r.push(A)}function Ce(A){let R=r.indexOf(A);R!==-1&&r.splice(R,1)}function ge(A,R){let K=A;r.forEach(function(J){J[K]&&J[K](R)})}function _e(A){return us("10.7.0","highlightBlock will be removed entirely in v12.0"),us("10.7.0","Please use highlightElement now."),v(A)}Object.assign(t,{highlight:f,highlightAuto:b,highlightAll:T,highlightElement:v,highlightBlock:_e,configure:x,initHighlighting:S,initHighlightingOnLoad:L,registerLanguage:O,unregisterLanguage:Y,listLanguages:ee,getLanguage:z,registerAliases:re,autoDetection:he,inherit:J_,addPlugin:me,removePlugin:Ce}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=RH,t.regex={concat:bo,lookahead:Q_,either:Nm,optional:YF,anyNumberOfTimes:qF};for(let A in Tu)typeof Tu[A]=="object"&&Z_(Tu[A]);return Object.assign(t,Tu),t},ds=lS({});ds.newInstance=()=>lS({});cS.exports=ds;ds.HighlightJS=ds;ds.default=ds});var fS=Xd((lq,Rm)=>{(function(){var t;typeof Rm<"u"?t=Rm.exports=r:t=function(){return this||(0,eval)("this")}(),t.format=r,t.vsprintf=n,typeof console<"u"&&typeof console.log=="function"&&(t.printf=e);function e(){console.log(r.apply(null,arguments))}function n(i,o){return r.apply(null,[i].concat(o))}function r(i){for(var o=1,s=[].slice.call(arguments),l=0,u=i.length,d="",f,h=!1,m,b,y=!1,v,x=function(){return s[o++]},S=function(){for(var L="";/\d/.test(i[l]);)L+=i[l++],f=i[l];return L.length>0?parseInt(L):null};l{(function(){var t,e="4.17.21",n=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",o="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",l=500,u="__lodash_placeholder__",d=1,f=2,h=4,m=1,b=2,y=1,v=2,x=4,S=8,L=16,D=32,T=64,$=128,O=256,Y=512,ee=30,z="...",re=800,he=16,Se=1,me=2,Ce=3,ge=1/0,_e=9007199254740991,A=17976931348623157e292,R=NaN,K=4294967295,J=K-1,se=K>>>1,be=[["ary",$],["bind",y],["bindKey",v],["curry",S],["curryRight",L],["flip",Y],["partial",D],["partialRight",T],["rearg",O]],De="[object Arguments]",je="[object Array]",Me="[object AsyncFunction]",Be="[object Boolean]",xt="[object Date]",Nt="[object DOMException]",Oe="[object Error]",_t="[object Function]",Jt="[object GeneratorFunction]",pt="[object Map]",sn="[object Number]",Xt="[object Null]",St="[object Object]",Je="[object Promise]",Xn="[object Proxy]",Lt="[object RegExp]",V="[object Set]",bt="[object String]",we="[object Symbol]",fe="[object Undefined]",ct="[object WeakMap]",ut="[object WeakSet]",Pt="[object ArrayBuffer]",kt="[object DataView]",I="[object Float32Array]",F="[object Float64Array]",X="[object Int8Array]",oe="[object Int16Array]",Fe="[object Int32Array]",rt="[object Uint8Array]",xr="[object Uint8ClampedArray]",B="[object Uint16Array]",ae="[object Uint32Array]",xe=/\b__p \+= '';/g,qe=/\b(__p \+=) '' \+/g,Ke=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Bt=/&(?:amp|lt|gt|quot|#39);/g,an=/[&<>"']/g,Jr=RegExp(Bt.source),Ca=RegExp(an.source),_r=/<%-([\s\S]+?)%>/g,ms=/<%([\s\S]+?)%>/g,Ai=/<%=([\s\S]+?)%>/g,Xr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fu=/^\w*$/,gs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Zr=/[\\^$.*+?()[\]{}|]/g,OS=RegExp(Zr.source),Hu=/^\s+/,RS=/\s/,IS=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,DS=/\{\n\/\* \[wrapped with (.+)\] \*/,LS=/,? & /,PS=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,BS=/[()=,{}\[\]\/\s]/,FS=/\\(\\)?/g,HS=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Fm=/\w*$/,$S=/^[-+]0x[0-9a-f]+$/i,zS=/^0b[01]+$/i,US=/^\[object .+?Constructor\]$/,WS=/^0o[0-7]+$/i,KS=/^(?:0|[1-9]\d*)$/,VS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Aa=/($^)/,GS=/['\n\r\u2028\u2029\\]/g,Ma="\\ud800-\\udfff",qS="\\u0300-\\u036f",YS="\\ufe20-\\ufe2f",JS="\\u20d0-\\u20ff",Hm=qS+YS+JS,$m="\\u2700-\\u27bf",zm="a-z\\xdf-\\xf6\\xf8-\\xff",XS="\\xac\\xb1\\xd7\\xf7",ZS="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",jS="\\u2000-\\u206f",QS=" \\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",Um="A-Z\\xc0-\\xd6\\xd8-\\xde",Wm="\\ufe0e\\ufe0f",Km=XS+ZS+jS+QS,$u="['\u2019]",eT="["+Ma+"]",Vm="["+Km+"]",Na="["+Hm+"]",Gm="\\d+",tT="["+$m+"]",qm="["+zm+"]",Ym="[^"+Ma+Km+Gm+$m+zm+Um+"]",zu="\\ud83c[\\udffb-\\udfff]",nT="(?:"+Na+"|"+zu+")",Jm="[^"+Ma+"]",Uu="(?:\\ud83c[\\udde6-\\uddff]){2}",Wu="[\\ud800-\\udbff][\\udc00-\\udfff]",Eo="["+Um+"]",Xm="\\u200d",Zm="(?:"+qm+"|"+Ym+")",rT="(?:"+Eo+"|"+Ym+")",jm="(?:"+$u+"(?:d|ll|m|re|s|t|ve))?",Qm="(?:"+$u+"(?:D|LL|M|RE|S|T|VE))?",eg=nT+"?",tg="["+Wm+"]?",iT="(?:"+Xm+"(?:"+[Jm,Uu,Wu].join("|")+")"+tg+eg+")*",oT="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",sT="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ng=tg+eg+iT,aT="(?:"+[tT,Uu,Wu].join("|")+")"+ng,lT="(?:"+[Jm+Na+"?",Na,Uu,Wu,eT].join("|")+")",cT=RegExp($u,"g"),uT=RegExp(Na,"g"),Ku=RegExp(zu+"(?="+zu+")|"+lT+ng,"g"),dT=RegExp([Eo+"?"+qm+"+"+jm+"(?="+[Vm,Eo,"$"].join("|")+")",rT+"+"+Qm+"(?="+[Vm,Eo+Zm,"$"].join("|")+")",Eo+"?"+Zm+"+"+jm,Eo+"+"+Qm,sT,oT,Gm,aT].join("|"),"g"),fT=RegExp("["+Xm+Ma+Hm+Wm+"]"),pT=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,hT=["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"],mT=-1,it={};it[I]=it[F]=it[X]=it[oe]=it[Fe]=it[rt]=it[xr]=it[B]=it[ae]=!0,it[De]=it[je]=it[Pt]=it[Be]=it[kt]=it[xt]=it[Oe]=it[_t]=it[pt]=it[sn]=it[St]=it[Lt]=it[V]=it[bt]=it[ct]=!1;var tt={};tt[De]=tt[je]=tt[Pt]=tt[kt]=tt[Be]=tt[xt]=tt[I]=tt[F]=tt[X]=tt[oe]=tt[Fe]=tt[pt]=tt[sn]=tt[St]=tt[Lt]=tt[V]=tt[bt]=tt[we]=tt[rt]=tt[xr]=tt[B]=tt[ae]=!0,tt[Oe]=tt[_t]=tt[ct]=!1;var gT={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},bT={"&":"&","<":"<",">":">",'"':""","'":"'"},yT={"&":"&","<":"<",">":">",""":'"',"'":"'"},ET={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vT=parseFloat,wT=parseInt,rg=typeof global=="object"&&global&&global.Object===Object&&global,xT=typeof self=="object"&&self&&self.Object===Object&&self,Ft=rg||xT||Function("return this")(),Vu=typeof hs=="object"&&hs&&!hs.nodeType&&hs,Mi=Vu&&typeof Ta=="object"&&Ta&&!Ta.nodeType&&Ta,ig=Mi&&Mi.exports===Vu,Gu=ig&&rg.process,On=function(){try{var N=Mi&&Mi.require&&Mi.require("util").types;return N||Gu&&Gu.binding&&Gu.binding("util")}catch{}}(),og=On&&On.isArrayBuffer,sg=On&&On.isDate,ag=On&&On.isMap,lg=On&&On.isRegExp,cg=On&&On.isSet,ug=On&&On.isTypedArray;function _n(N,H,P){switch(P.length){case 0:return N.call(H);case 1:return N.call(H,P[0]);case 2:return N.call(H,P[0],P[1]);case 3:return N.call(H,P[0],P[1],P[2])}return N.apply(H,P)}function _T(N,H,P,ie){for(var Ae=-1,Ye=N==null?0:N.length;++Ae-1}function qu(N,H,P){for(var ie=-1,Ae=N==null?0:N.length;++ie-1;);return P}function yg(N,H){for(var P=N.length;P--&&vo(H,N[P],0)>-1;);return P}function RT(N,H){for(var P=N.length,ie=0;P--;)N[P]===H&&++ie;return ie}var IT=Zu(gT),DT=Zu(bT);function LT(N){return"\\"+ET[N]}function PT(N,H){return N==null?t:N[H]}function wo(N){return fT.test(N)}function BT(N){return pT.test(N)}function FT(N){for(var H,P=[];!(H=N.next()).done;)P.push(H.value);return P}function td(N){var H=-1,P=Array(N.size);return N.forEach(function(ie,Ae){P[++H]=[Ae,ie]}),P}function Eg(N,H){return function(P){return N(H(P))}}function ei(N,H){for(var P=-1,ie=N.length,Ae=0,Ye=[];++P-1}function T1(a,c){var p=this.__data__,g=qa(p,a);return g<0?(++this.size,p.push([a,c])):p[g][1]=c,this}Sr.prototype.clear=w1,Sr.prototype.delete=x1,Sr.prototype.get=_1,Sr.prototype.has=S1,Sr.prototype.set=T1;function Tr(a){var c=-1,p=a==null?0:a.length;for(this.clear();++c=c?a:c)),a}function Ln(a,c,p,g,E,_){var C,M=c&d,k=c&f,U=c&h;if(p&&(C=E?p(a,g,E,_):p(a)),C!==t)return C;if(!dt(a))return a;var W=Ne(a);if(W){if(C=NC(a),!M)return mn(a,C)}else{var q=jt(a),te=q==_t||q==Jt;if(ai(a))return tb(a,M);if(q==St||q==De||te&&!E){if(C=k||te?{}:vb(a),!M)return k?yC(a,z1(C,a)):bC(a,Og(C,a))}else{if(!tt[q])return E?a:{};C=kC(a,q,M)}}_||(_=new jn);var de=_.get(a);if(de)return de;_.set(a,C),Jb(a)?a.forEach(function(ve){C.add(Ln(ve,c,p,ve,a,_))}):qb(a)&&a.forEach(function(ve,$e){C.set($e,Ln(ve,c,p,$e,a,_))});var Ee=U?k?Ad:Cd:k?bn:Ht,Le=W?t:Ee(a);return Rn(Le||a,function(ve,$e){Le&&($e=ve,ve=a[$e]),_s(C,$e,Ln(ve,c,p,$e,a,_))}),C}function U1(a){var c=Ht(a);return function(p){return Rg(p,a,c)}}function Rg(a,c,p){var g=p.length;if(a==null)return!g;for(a=Qe(a);g--;){var E=p[g],_=c[E],C=a[E];if(C===t&&!(E in a)||!_(C))return!1}return!0}function Ig(a,c,p){if(typeof a!="function")throw new In(i);return ks(function(){a.apply(t,p)},c)}function Ss(a,c,p,g){var E=-1,_=ka,C=!0,M=a.length,k=[],U=c.length;if(!M)return k;p&&(c=at(c,Sn(p))),g?(_=qu,C=!1):c.length>=n&&(_=bs,C=!1,c=new Oi(c));e:for(;++EE?0:E+p),g=g===t||g>E?E:Re(g),g<0&&(g+=E),g=p>g?0:Zb(g);p0&&p(M)?c>1?Kt(M,c-1,p,g,E):Qr(E,M):g||(E[E.length]=M)}return E}var ld=ab(),Pg=ab(!0);function ur(a,c){return a&&ld(a,c,Ht)}function cd(a,c){return a&&Pg(a,c,Ht)}function Ja(a,c){return jr(c,function(p){return kr(a[p])})}function Ii(a,c){c=oi(c,a);for(var p=0,g=c.length;a!=null&&pc}function V1(a,c){return a!=null&&Ze.call(a,c)}function G1(a,c){return a!=null&&c in Qe(a)}function q1(a,c,p){return a>=Zt(c,p)&&a=120&&W.length>=120)?new Oi(C&&W):t}W=a[0];var q=-1,te=M[0];e:for(;++q-1;)M!==a&&$a.call(M,k,1),$a.call(a,k,1);return a}function qg(a,c){for(var p=a?c.length:0,g=p-1;p--;){var E=c[p];if(p==g||E!==_){var _=E;Nr(E)?$a.call(a,E,1):Ed(a,E)}}return a}function gd(a,c){return a+Wa(Ag()*(c-a+1))}function sC(a,c,p,g){for(var E=-1,_=Rt(Ua((c-a)/(p||1)),0),C=P(_);_--;)C[g?_:++E]=a,a+=p;return C}function bd(a,c){var p="";if(!a||c<1||c>_e)return p;do c%2&&(p+=a),c=Wa(c/2),c&&(a+=a);while(c);return p}function He(a,c){return Dd(_b(a,c,yn),a+"")}function aC(a){return kg(Oo(a))}function lC(a,c){var p=Oo(a);return sl(p,Ri(c,0,p.length))}function As(a,c,p,g){if(!dt(a))return a;c=oi(c,a);for(var E=-1,_=c.length,C=_-1,M=a;M!=null&&++E<_;){var k=fr(c[E]),U=p;if(k==="__proto__"||k==="constructor"||k==="prototype")return a;if(E!=C){var W=M[k];U=g?g(W,k,M):t,U===t&&(U=dt(W)?W:Nr(c[E+1])?[]:{})}_s(M,k,U),M=M[k]}return a}var Yg=Ka?function(a,c){return Ka.set(a,c),a}:yn,cC=za?function(a,c){return za(a,"toString",{configurable:!0,enumerable:!1,value:Kd(c),writable:!0})}:yn;function uC(a){return sl(Oo(a))}function Pn(a,c,p){var g=-1,E=a.length;c<0&&(c=-c>E?0:E+c),p=p>E?E:p,p<0&&(p+=E),E=c>p?0:p-c>>>0,c>>>=0;for(var _=P(E);++g>>1,C=a[_];C!==null&&!Cn(C)&&(p?C<=c:C=n){var U=c?null:xC(a);if(U)return Ra(U);C=!1,E=bs,k=new Oi}else k=c?[]:M;e:for(;++g<_;){var W=a[g],q=c?c(W):W;if(W=p||W!==0?W:0,C&&q===q){for(var te=k.length;te--;)if(k[te]===q)continue e;c&&k.push(q),M.push(W)}else E(k,q,p)||(k!==M&&k.push(q),M.push(W))}return M}function Ed(a,c){return c=oi(c,a),a=Sb(a,c),a==null||delete a[fr(Bn(c))]}function Zg(a,c,p,g){return As(a,c,p(Ii(a,c)),g)}function ja(a,c,p,g){for(var E=a.length,_=g?E:-1;(g?_--:++_=g?a:Pn(a,c,p)}var eb=QT||function(a){return Ft.clearTimeout(a)};function tb(a,c){if(c)return a.slice();var p=a.length,g=xg?xg(p):new a.constructor(p);return a.copy(g),g}function _d(a){var c=new a.constructor(a.byteLength);return new Fa(c).set(new Fa(a)),c}function pC(a,c){var p=c?_d(a.buffer):a.buffer;return new a.constructor(p,a.byteOffset,a.byteLength)}function hC(a){var c=new a.constructor(a.source,Fm.exec(a));return c.lastIndex=a.lastIndex,c}function mC(a){return xs?Qe(xs.call(a)):{}}function nb(a,c){var p=c?_d(a.buffer):a.buffer;return new a.constructor(p,a.byteOffset,a.length)}function rb(a,c){if(a!==c){var p=a!==t,g=a===null,E=a===a,_=Cn(a),C=c!==t,M=c===null,k=c===c,U=Cn(c);if(!M&&!U&&!_&&a>c||_&&C&&k&&!M&&!U||g&&C&&k||!p&&k||!E)return 1;if(!g&&!_&&!U&&a=M)return k;var U=p[g];return k*(U=="desc"?-1:1)}}return a.index-c.index}function ib(a,c,p,g){for(var E=-1,_=a.length,C=p.length,M=-1,k=c.length,U=Rt(_-C,0),W=P(k+U),q=!g;++M1?p[E-1]:t,C=E>2?p[2]:t;for(_=a.length>3&&typeof _=="function"?(E--,_):t,C&&cn(p[0],p[1],C)&&(_=E<3?t:_,E=1),c=Qe(c);++g-1?E[_?c[C]:C]:t}}function ub(a){return Mr(function(c){var p=c.length,g=p,E=Dn.prototype.thru;for(a&&c.reverse();g--;){var _=c[g];if(typeof _!="function")throw new In(i);if(E&&!C&&il(_)=="wrapper")var C=new Dn([],!0)}for(g=C?g:p;++g1&&Ve.reverse(),W&&k<$e&&(Ve.length=k),this&&this!==Ft&&this instanceof ve&&(Rr=Le||Ms(Rr)),Rr.apply(er,Ve)}return ve}function db(a,c){return function(p,g){return Y1(p,a,c(g),{})}}function tl(a,c){return function(p,g){var E;if(p===t&&g===t)return c;if(p!==t&&(E=p),g!==t){if(E===t)return g;typeof p=="string"||typeof g=="string"?(p=Tn(p),g=Tn(g)):(p=Xg(p),g=Xg(g)),E=a(p,g)}return E}}function Sd(a){return Mr(function(c){return c=at(c,Sn(ye())),He(function(p){var g=this;return a(c,function(E){return _n(E,g,p)})})})}function nl(a,c){c=c===t?" ":Tn(c);var p=c.length;if(p<2)return p?bd(c,a):c;var g=bd(c,Ua(a/xo(c)));return wo(c)?si(Zn(g),0,a).join(""):g.slice(0,a)}function wC(a,c,p,g){var E=c&y,_=Ms(a);function C(){for(var M=-1,k=arguments.length,U=-1,W=g.length,q=P(W+k),te=this&&this!==Ft&&this instanceof C?_:a;++UM))return!1;var U=_.get(a),W=_.get(c);if(U&&W)return U==c&&W==a;var q=-1,te=!0,de=p&b?new Oi:t;for(_.set(a,c),_.set(c,a);++q1?"& ":"")+c[g],c=c.join(p>2?", ":" "),a.replace(IS,`{ +/* [wrapped with `+c+`] */ +`)}function RC(a){return Ne(a)||Pi(a)||!!(Tg&&a&&a[Tg])}function Nr(a,c){var p=typeof a;return c=c??_e,!!c&&(p=="number"||p!="symbol"&&KS.test(a))&&a>-1&&a%1==0&&a0){if(++c>=re)return arguments[0]}else c=0;return a.apply(t,arguments)}}function sl(a,c){var p=-1,g=a.length,E=g-1;for(c=c===t?g:c;++p1?a[c-1]:t;return p=typeof p=="function"?(a.pop(),p):t,Lb(a,p)});function Pb(a){var c=w(a);return c.__chain__=!0,c}function WA(a,c){return c(a),a}function al(a,c){return c(a)}var KA=Mr(function(a){var c=a.length,p=c?a[0]:0,g=this.__wrapped__,E=function(_){return ad(_,a)};return c>1||this.__actions__.length||!(g instanceof Ue)||!Nr(p)?this.thru(E):(g=g.slice(p,+p+(c?1:0)),g.__actions__.push({func:al,args:[E],thisArg:t}),new Dn(g,this.__chain__).thru(function(_){return c&&!_.length&&_.push(t),_}))});function VA(){return Pb(this)}function GA(){return new Dn(this.value(),this.__chain__)}function qA(){this.__values__===t&&(this.__values__=Xb(this.value()));var a=this.__index__>=this.__values__.length,c=a?t:this.__values__[this.__index__++];return{done:a,value:c}}function YA(){return this}function JA(a){for(var c,p=this;p instanceof Ga;){var g=Nb(p);g.__index__=0,g.__values__=t,c?E.__wrapped__=g:c=g;var E=g;p=p.__wrapped__}return E.__wrapped__=a,c}function XA(){var a=this.__wrapped__;if(a instanceof Ue){var c=a;return this.__actions__.length&&(c=new Ue(this)),c=c.reverse(),c.__actions__.push({func:al,args:[Ld],thisArg:t}),new Dn(c,this.__chain__)}return this.thru(Ld)}function ZA(){return jg(this.__wrapped__,this.__actions__)}var jA=Qa(function(a,c,p){Ze.call(a,p)?++a[p]:Cr(a,p,1)});function QA(a,c,p){var g=Ne(a)?dg:W1;return p&&cn(a,c,p)&&(c=t),g(a,ye(c,3))}function eM(a,c){var p=Ne(a)?jr:Lg;return p(a,ye(c,3))}var tM=cb(kb),nM=cb(Ob);function rM(a,c){return Kt(ll(a,c),1)}function iM(a,c){return Kt(ll(a,c),ge)}function oM(a,c,p){return p=p===t?1:Re(p),Kt(ll(a,c),p)}function Bb(a,c){var p=Ne(a)?Rn:ri;return p(a,ye(c,3))}function Fb(a,c){var p=Ne(a)?ST:Dg;return p(a,ye(c,3))}var sM=Qa(function(a,c,p){Ze.call(a,p)?a[p].push(c):Cr(a,p,[c])});function aM(a,c,p,g){a=gn(a)?a:Oo(a),p=p&&!g?Re(p):0;var E=a.length;return p<0&&(p=Rt(E+p,0)),pl(a)?p<=E&&a.indexOf(c,p)>-1:!!E&&vo(a,c,p)>-1}var lM=He(function(a,c,p){var g=-1,E=typeof c=="function",_=gn(a)?P(a.length):[];return ri(a,function(C){_[++g]=E?_n(c,C,p):Ts(C,c,p)}),_}),cM=Qa(function(a,c,p){Cr(a,p,c)});function ll(a,c){var p=Ne(a)?at:zg;return p(a,ye(c,3))}function uM(a,c,p,g){return a==null?[]:(Ne(c)||(c=c==null?[]:[c]),p=g?t:p,Ne(p)||(p=p==null?[]:[p]),Vg(a,c,p))}var dM=Qa(function(a,c,p){a[p?0:1].push(c)},function(){return[[],[]]});function fM(a,c,p){var g=Ne(a)?Yu:mg,E=arguments.length<3;return g(a,ye(c,4),p,E,ri)}function pM(a,c,p){var g=Ne(a)?TT:mg,E=arguments.length<3;return g(a,ye(c,4),p,E,Dg)}function hM(a,c){var p=Ne(a)?jr:Lg;return p(a,dl(ye(c,3)))}function mM(a){var c=Ne(a)?kg:aC;return c(a)}function gM(a,c,p){(p?cn(a,c,p):c===t)?c=1:c=Re(c);var g=Ne(a)?F1:lC;return g(a,c)}function bM(a){var c=Ne(a)?H1:uC;return c(a)}function yM(a){if(a==null)return 0;if(gn(a))return pl(a)?xo(a):a.length;var c=jt(a);return c==pt||c==V?a.size:pd(a).length}function EM(a,c,p){var g=Ne(a)?Ju:dC;return p&&cn(a,c,p)&&(c=t),g(a,ye(c,3))}var vM=He(function(a,c){if(a==null)return[];var p=c.length;return p>1&&cn(a,c[0],c[1])?c=[]:p>2&&cn(c[0],c[1],c[2])&&(c=[c[0]]),Vg(a,Kt(c,1),[])}),cl=e1||function(){return Ft.Date.now()};function wM(a,c){if(typeof c!="function")throw new In(i);return a=Re(a),function(){if(--a<1)return c.apply(this,arguments)}}function Hb(a,c,p){return c=p?t:c,c=a&&c==null?a.length:c,Ar(a,$,t,t,t,t,c)}function $b(a,c){var p;if(typeof c!="function")throw new In(i);return a=Re(a),function(){return--a>0&&(p=c.apply(this,arguments)),a<=1&&(c=t),p}}var Bd=He(function(a,c,p){var g=y;if(p.length){var E=ei(p,No(Bd));g|=D}return Ar(a,g,c,p,E)}),zb=He(function(a,c,p){var g=y|v;if(p.length){var E=ei(p,No(zb));g|=D}return Ar(c,g,a,p,E)});function Ub(a,c,p){c=p?t:c;var g=Ar(a,S,t,t,t,t,t,c);return g.placeholder=Ub.placeholder,g}function Wb(a,c,p){c=p?t:c;var g=Ar(a,L,t,t,t,t,t,c);return g.placeholder=Wb.placeholder,g}function Kb(a,c,p){var g,E,_,C,M,k,U=0,W=!1,q=!1,te=!0;if(typeof a!="function")throw new In(i);c=Fn(c)||0,dt(p)&&(W=!!p.leading,q="maxWait"in p,_=q?Rt(Fn(p.maxWait)||0,c):_,te="trailing"in p?!!p.trailing:te);function de(Et){var er=g,Rr=E;return g=E=t,U=Et,C=a.apply(Rr,er),C}function Ee(Et){return U=Et,M=ks($e,c),W?de(Et):C}function Le(Et){var er=Et-k,Rr=Et-U,cy=c-er;return q?Zt(cy,_-Rr):cy}function ve(Et){var er=Et-k,Rr=Et-U;return k===t||er>=c||er<0||q&&Rr>=_}function $e(){var Et=cl();if(ve(Et))return Ve(Et);M=ks($e,Le(Et))}function Ve(Et){return M=t,te&&g?de(Et):(g=E=t,C)}function An(){M!==t&&eb(M),U=0,g=k=E=M=t}function un(){return M===t?C:Ve(cl())}function Mn(){var Et=cl(),er=ve(Et);if(g=arguments,E=this,k=Et,er){if(M===t)return Ee(k);if(q)return eb(M),M=ks($e,c),de(k)}return M===t&&(M=ks($e,c)),C}return Mn.cancel=An,Mn.flush=un,Mn}var xM=He(function(a,c){return Ig(a,1,c)}),_M=He(function(a,c,p){return Ig(a,Fn(c)||0,p)});function SM(a){return Ar(a,Y)}function ul(a,c){if(typeof a!="function"||c!=null&&typeof c!="function")throw new In(i);var p=function(){var g=arguments,E=c?c.apply(this,g):g[0],_=p.cache;if(_.has(E))return _.get(E);var C=a.apply(this,g);return p.cache=_.set(E,C)||_,C};return p.cache=new(ul.Cache||Tr),p}ul.Cache=Tr;function dl(a){if(typeof a!="function")throw new In(i);return function(){var c=arguments;switch(c.length){case 0:return!a.call(this);case 1:return!a.call(this,c[0]);case 2:return!a.call(this,c[0],c[1]);case 3:return!a.call(this,c[0],c[1],c[2])}return!a.apply(this,c)}}function TM(a){return $b(2,a)}var CM=fC(function(a,c){c=c.length==1&&Ne(c[0])?at(c[0],Sn(ye())):at(Kt(c,1),Sn(ye()));var p=c.length;return He(function(g){for(var E=-1,_=Zt(g.length,p);++E<_;)g[E]=c[E].call(this,g[E]);return _n(a,this,g)})}),Fd=He(function(a,c){var p=ei(c,No(Fd));return Ar(a,D,t,c,p)}),Vb=He(function(a,c){var p=ei(c,No(Vb));return Ar(a,T,t,c,p)}),AM=Mr(function(a,c){return Ar(a,O,t,t,t,c)});function MM(a,c){if(typeof a!="function")throw new In(i);return c=c===t?c:Re(c),He(a,c)}function NM(a,c){if(typeof a!="function")throw new In(i);return c=c==null?0:Rt(Re(c),0),He(function(p){var g=p[c],E=si(p,0,c);return g&&Qr(E,g),_n(a,this,E)})}function kM(a,c,p){var g=!0,E=!0;if(typeof a!="function")throw new In(i);return dt(p)&&(g="leading"in p?!!p.leading:g,E="trailing"in p?!!p.trailing:E),Kb(a,c,{leading:g,maxWait:c,trailing:E})}function OM(a){return Hb(a,1)}function RM(a,c){return Fd(xd(c),a)}function IM(){if(!arguments.length)return[];var a=arguments[0];return Ne(a)?a:[a]}function DM(a){return Ln(a,h)}function LM(a,c){return c=typeof c=="function"?c:t,Ln(a,h,c)}function PM(a){return Ln(a,d|h)}function BM(a,c){return c=typeof c=="function"?c:t,Ln(a,d|h,c)}function FM(a,c){return c==null||Rg(a,c,Ht(c))}function Qn(a,c){return a===c||a!==a&&c!==c}var HM=rl(ud),$M=rl(function(a,c){return a>=c}),Pi=Fg(function(){return arguments}())?Fg:function(a){return ht(a)&&Ze.call(a,"callee")&&!Sg.call(a,"callee")},Ne=P.isArray,zM=og?Sn(og):J1;function gn(a){return a!=null&&fl(a.length)&&!kr(a)}function yt(a){return ht(a)&&gn(a)}function UM(a){return a===!0||a===!1||ht(a)&&ln(a)==Be}var ai=n1||Jd,WM=sg?Sn(sg):X1;function KM(a){return ht(a)&&a.nodeType===1&&!Os(a)}function VM(a){if(a==null)return!0;if(gn(a)&&(Ne(a)||typeof a=="string"||typeof a.splice=="function"||ai(a)||ko(a)||Pi(a)))return!a.length;var c=jt(a);if(c==pt||c==V)return!a.size;if(Ns(a))return!pd(a).length;for(var p in a)if(Ze.call(a,p))return!1;return!0}function GM(a,c){return Cs(a,c)}function qM(a,c,p){p=typeof p=="function"?p:t;var g=p?p(a,c):t;return g===t?Cs(a,c,t,p):!!g}function Hd(a){if(!ht(a))return!1;var c=ln(a);return c==Oe||c==Nt||typeof a.message=="string"&&typeof a.name=="string"&&!Os(a)}function YM(a){return typeof a=="number"&&Cg(a)}function kr(a){if(!dt(a))return!1;var c=ln(a);return c==_t||c==Jt||c==Me||c==Xn}function Gb(a){return typeof a=="number"&&a==Re(a)}function fl(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=_e}function dt(a){var c=typeof a;return a!=null&&(c=="object"||c=="function")}function ht(a){return a!=null&&typeof a=="object"}var qb=ag?Sn(ag):j1;function JM(a,c){return a===c||fd(a,c,Nd(c))}function XM(a,c,p){return p=typeof p=="function"?p:t,fd(a,c,Nd(c),p)}function ZM(a){return Yb(a)&&a!=+a}function jM(a){if(LC(a))throw new Ae(r);return Hg(a)}function QM(a){return a===null}function eN(a){return a==null}function Yb(a){return typeof a=="number"||ht(a)&&ln(a)==sn}function Os(a){if(!ht(a)||ln(a)!=St)return!1;var c=Ha(a);if(c===null)return!0;var p=Ze.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&La.call(p)==XT}var $d=lg?Sn(lg):Q1;function tN(a){return Gb(a)&&a>=-_e&&a<=_e}var Jb=cg?Sn(cg):eC;function pl(a){return typeof a=="string"||!Ne(a)&&ht(a)&&ln(a)==bt}function Cn(a){return typeof a=="symbol"||ht(a)&&ln(a)==we}var ko=ug?Sn(ug):tC;function nN(a){return a===t}function rN(a){return ht(a)&&jt(a)==ct}function iN(a){return ht(a)&&ln(a)==ut}var oN=rl(hd),sN=rl(function(a,c){return a<=c});function Xb(a){if(!a)return[];if(gn(a))return pl(a)?Zn(a):mn(a);if(ys&&a[ys])return FT(a[ys]());var c=jt(a),p=c==pt?td:c==V?Ra:Oo;return p(a)}function Or(a){if(!a)return a===0?a:0;if(a=Fn(a),a===ge||a===-ge){var c=a<0?-1:1;return c*A}return a===a?a:0}function Re(a){var c=Or(a),p=c%1;return c===c?p?c-p:c:0}function Zb(a){return a?Ri(Re(a),0,K):0}function Fn(a){if(typeof a=="number")return a;if(Cn(a))return R;if(dt(a)){var c=typeof a.valueOf=="function"?a.valueOf():a;a=dt(c)?c+"":c}if(typeof a!="string")return a===0?a:+a;a=gg(a);var p=zS.test(a);return p||WS.test(a)?wT(a.slice(2),p?2:8):$S.test(a)?R:+a}function jb(a){return dr(a,bn(a))}function aN(a){return a?Ri(Re(a),-_e,_e):a===0?a:0}function Xe(a){return a==null?"":Tn(a)}var lN=Ao(function(a,c){if(Ns(c)||gn(c)){dr(c,Ht(c),a);return}for(var p in c)Ze.call(c,p)&&_s(a,p,c[p])}),Qb=Ao(function(a,c){dr(c,bn(c),a)}),hl=Ao(function(a,c,p,g){dr(c,bn(c),a,g)}),cN=Ao(function(a,c,p,g){dr(c,Ht(c),a,g)}),uN=Mr(ad);function dN(a,c){var p=Co(a);return c==null?p:Og(p,c)}var fN=He(function(a,c){a=Qe(a);var p=-1,g=c.length,E=g>2?c[2]:t;for(E&&cn(c[0],c[1],E)&&(g=1);++p1),_}),dr(a,Ad(a),p),g&&(p=Ln(p,d|f|h,_C));for(var E=c.length;E--;)Ed(p,c[E]);return p});function kN(a,c){return ty(a,dl(ye(c)))}var ON=Mr(function(a,c){return a==null?{}:iC(a,c)});function ty(a,c){if(a==null)return{};var p=at(Ad(a),function(g){return[g]});return c=ye(c),Gg(a,p,function(g,E){return c(g,E[0])})}function RN(a,c,p){c=oi(c,a);var g=-1,E=c.length;for(E||(E=1,a=t);++gc){var g=a;a=c,c=g}if(p||a%1||c%1){var E=Ag();return Zt(a+E*(c-a+vT("1e-"+((E+"").length-1))),c)}return gd(a,c)}var WN=Mo(function(a,c,p){return c=c.toLowerCase(),a+(p?iy(c):c)});function iy(a){return Wd(Xe(a).toLowerCase())}function oy(a){return a=Xe(a),a&&a.replace(VS,IT).replace(uT,"")}function KN(a,c,p){a=Xe(a),c=Tn(c);var g=a.length;p=p===t?g:Ri(Re(p),0,g);var E=p;return p-=c.length,p>=0&&a.slice(p,E)==c}function VN(a){return a=Xe(a),a&&Ca.test(a)?a.replace(an,DT):a}function GN(a){return a=Xe(a),a&&OS.test(a)?a.replace(Zr,"\\$&"):a}var qN=Mo(function(a,c,p){return a+(p?"-":"")+c.toLowerCase()}),YN=Mo(function(a,c,p){return a+(p?" ":"")+c.toLowerCase()}),JN=lb("toLowerCase");function XN(a,c,p){a=Xe(a),c=Re(c);var g=c?xo(a):0;if(!c||g>=c)return a;var E=(c-g)/2;return nl(Wa(E),p)+a+nl(Ua(E),p)}function ZN(a,c,p){a=Xe(a),c=Re(c);var g=c?xo(a):0;return c&&g>>0,p?(a=Xe(a),a&&(typeof c=="string"||c!=null&&!$d(c))&&(c=Tn(c),!c&&wo(a))?si(Zn(a),0,p):a.split(c,p)):[]}var ik=Mo(function(a,c,p){return a+(p?" ":"")+Wd(c)});function ok(a,c,p){return a=Xe(a),p=p==null?0:Ri(Re(p),0,a.length),c=Tn(c),a.slice(p,p+c.length)==c}function sk(a,c,p){var g=w.templateSettings;p&&cn(a,c,p)&&(c=t),a=Xe(a),c=hl({},c,g,mb);var E=hl({},c.imports,g.imports,mb),_=Ht(E),C=ed(E,_),M,k,U=0,W=c.interpolate||Aa,q="__p += '",te=nd((c.escape||Aa).source+"|"+W.source+"|"+(W===Ai?HS:Aa).source+"|"+(c.evaluate||Aa).source+"|$","g"),de="//# sourceURL="+(Ze.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++mT+"]")+` `;a.replace(te,function(ve,$e,Ve,An,un,Mn){return Ve||(Ve=An),q+=a.slice(U,Mn).replace(GS,LT),$e&&(M=!0,q+=`' + __e(`+$e+`) + '`),un&&(k=!0,q+=`'; @@ -9,7 +9,7 @@ __e(`+$e+`) + __p += '`),Ve&&(q+=`' + ((__t = (`+Ve+`)) == null ? '' : __t) + '`),U=Mn+ve.length,ve}),q+=`'; -`;var Ee=Ze.call(u,"variable")&&u.variable;if(!Ee)q=`with (obj) { +`;var Ee=Ze.call(c,"variable")&&c.variable;if(!Ee)q=`with (obj) { `+q+` } `;else if(BS.test(Ee))throw new Ae(o);q=(k?q.replace(xe,""):q).replace(qe,"$1").replace(Ke,"$1;"),q="function("+(Ee||"obj")+`) { @@ -18,19 +18,19 @@ __p += '`),Ve&&(q+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+q+`return __p -}`;var Le=sy(function(){return Ye(x,de+"return "+q).apply(t,C)});if(Le.source=q,Hd(Le))throw Le;return Le}function ak(a){return Xe(a).toLowerCase()}function lk(a){return Xe(a).toUpperCase()}function ck(a,u,p){if(a=Xe(a),a&&(p||u===t))return mg(a);if(!a||!(u=Tn(u)))return a;var g=Zn(a),E=Zn(u),x=gg(g,E),C=bg(g,E)+1;return si(g,x,C).join("")}function uk(a,u,p){if(a=Xe(a),a&&(p||u===t))return a.slice(0,Eg(a)+1);if(!a||!(u=Tn(u)))return a;var g=Zn(a),E=bg(g,Zn(u))+1;return si(g,0,E).join("")}function dk(a,u,p){if(a=Xe(a),a&&(p||u===t))return a.replace(Hu,"");if(!a||!(u=Tn(u)))return a;var g=Zn(a),E=gg(g,Zn(u));return si(g,E).join("")}function fk(a,u){var p=ee,g=z;if(dt(u)){var E="separator"in u?u.separator:E;p="length"in u?Re(u.length):p,g="omission"in u?Tn(u.omission):g}a=Xe(a);var x=a.length;if(wo(a)){var C=Zn(a);x=C.length}if(p>=x)return a;var M=p-xo(g);if(M<1)return g;var k=C?si(C,0,M).join(""):a.slice(0,M);if(E===t)return k+g;if(C&&(M+=k.length-M),$d(E)){if(a.slice(M).search(E)){var U,W=k;for(E.global||(E=nd(E.source,Xe(Bm.exec(E))+"g")),E.lastIndex=0;U=E.exec(W);)var q=U.index;k=k.slice(0,q===t?M:q)}}else if(a.indexOf(Tn(E),M)!=M){var te=k.lastIndexOf(E);te>-1&&(k=k.slice(0,te))}return k+g}function pk(a){return a=Xe(a),a&&Jr.test(a)?a.replace(Bt,UT):a}var hk=Mo(function(a,u,p){return a+(p?" ":"")+u.toUpperCase()}),Wd=ab("toUpperCase");function oy(a,u,p){return a=Xe(a),u=p?t:u,u===t?BT(a)?VT(a):MT(a):a.match(u)||[]}var sy=He(function(a,u){try{return _n(a,t,u)}catch(p){return Hd(p)?p:new Ae(p)}}),mk=Mr(function(a,u){return Rn(u,function(p){p=fr(p),Cr(a,p,Bd(a[p],a))}),a});function gk(a){var u=a==null?0:a.length,p=ye();return a=u?at(a,function(g){if(typeof g[1]!="function")throw new In(i);return[p(g[0]),g[1]]}):[],He(function(g){for(var E=-1;++E_e)return[];var p=K,g=Zt(a,K);u=ye(u),a-=K;for(var E=Qu(g,u);++p0||u<0)?new Ue(p):(a<0?p=p.takeRight(-a):a&&(p=p.drop(a)),u!==t&&(u=Re(u),p=u<0?p.dropRight(-u):p.take(u-a)),p)},Ue.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},Ue.prototype.toArray=function(){return this.take(K)},ur(Ue.prototype,function(a,u){var p=/^(?:filter|find|map|reject)|While$/.test(u),g=/^(?:head|last)$/.test(u),E=v[g?"take"+(u=="last"?"Right":""):u],x=g||/^find/.test(u);E&&(v.prototype[u]=function(){var C=this.__wrapped__,M=g?[1]:arguments,k=C instanceof Ue,U=M[0],W=k||Ne(C),q=function($e){var Ve=E.apply(v,Qr([$e],M));return g&&te?Ve[0]:Ve};W&&p&&typeof U=="function"&&U.length!=1&&(k=W=!1);var te=this.__chain__,de=!!this.__actions__.length,Ee=x&&!te,Le=k&&!de;if(!x&&W){C=Le?C:new Ue(this);var ve=a.apply(C,M);return ve.__actions__.push({func:al,args:[q],thisArg:t}),new Dn(ve,te)}return Ee&&Le?a.apply(this,M):(ve=this.thru(q),Ee?g?ve.value()[0]:ve.value():ve)})}),Rn(["pop","push","shift","sort","splice","unshift"],function(a){var u=Ia[a],p=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",g=/^(?:pop|shift)$/.test(a);v.prototype[a]=function(){var E=arguments;if(g&&!this.__chain__){var x=this.value();return u.apply(Ne(x)?x:[],E)}return this[p](function(C){return u.apply(Ne(C)?C:[],E)})}}),ur(Ue.prototype,function(a,u){var p=v[u];if(p){var g=p.name+"";Ze.call(To,g)||(To[g]=[]),To[g].push({name:u,func:p})}}),To[el(t,w).name]=[{name:"wrapper",func:t}],Ue.prototype.clone=p1,Ue.prototype.reverse=h1,Ue.prototype.value=m1,v.prototype.at=KA,v.prototype.chain=VA,v.prototype.commit=GA,v.prototype.next=qA,v.prototype.plant=JA,v.prototype.reverse=XA,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=ZA,v.prototype.first=v.prototype.head,ys&&(v.prototype[ys]=YA),v},ti=GT();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ft._=ti,define(function(){return ti})):Mi?((Mi.exports=ti)._=ti,Vu._=ti):Ft._=ti}).call(hs)});function Qt(t){this.content=t}Qt.prototype={constructor:Qt,find:function(t){for(var e=0;e>1}};Qt.from=function(t){if(t instanceof Qt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Qt(e)};var jd=Qt;function Ey(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Ey(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function vy(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),c=s.nodeSize;if(s==l){n-=c,r-=c;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let d=0,f=Math.min(s.text.length,l.text.length);for(;de&&r(c,i+l,o||null,s)!==!1&&c.content.size){let f=l+1;c.nodesBetween(Math.max(0,e-f),Math.min(c.content.size,n-f),r,i+f)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=d},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);oe)for(let o=0,s=0;se&&((sn)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),i+=l.nodeSize),s=c}return new t(r,i)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new t(i,o)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?ml(r+1,s):ml(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new t(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}};Ge.none=[];var Hi=class extends Error{},Z=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=xy(this.content,e+this.openStart,n);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(wy(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(G.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new t(e,r,i)}};Z.empty=new Z(G.empty,0,0);function wy(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(wy(o.content,e-i-1,n-i-1)))}function xy(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=xy(s.content,e-o-1,n);return l&&t.replaceChild(i,s.copy(l))}function sO(t,e,n){if(n.openStart>t.depth)throw new Hi("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Hi("Inconsistent open depths");return _y(t,e,n,0)}function _y(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Rs(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Bi(t.nodeAfter,r),o++));for(let l=o;li&&tf(t,e,i+1),s=r.depth>i&&tf(n,r,i+1),l=[];return Rs(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(Sy(o,s),Bi(Fi(o,Ty(t,e,n,r,i+1)),l)):(o&&Bi(Fi(o,yl(t,e,i+1)),l),Rs(e,n,i,l),s&&Bi(Fi(s,yl(n,r,i+1)),l)),Rs(r,null,i,l),new G(l)}function yl(t,e,n){let r=[];if(Rs(null,t,n,r),t.depth>n){let i=tf(t,e,n+1);Bi(Fi(i,yl(t,e,n+1)),r)}return Rs(e,null,n,r),new G(r)}function aO(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(G.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var El=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new $i(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(o),d=o-c;if(r.push(s,l,i+c),!d||(s=s.child(l),s.isText))break;o=d-1,i+=c+1}return new t(n,r,o)}static resolveCached(e,n){let r=uy.get(e);if(r)for(let o=0;oe&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Cy(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=G.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=i;cn.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=G.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};tr.prototype.text=void 0;var rf=class t extends tr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Cy(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Cy(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var zi=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new of(e,n);if(r.next==null)return t.empty;let i=Ay(r);r.next&&r.err("Unexpected trailing text");let o=gO(mO(i));return bO(o,r),o}matchType(e){for(let n=0;nd.createAndFill()));for(let d=0;d=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return o}).join(` -`)}};zi.empty=new zi(!0);var of=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function Ay(t){let e=[];do e.push(uO(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function uO(t){let e=[];do e.push(dO(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function dO(t){let e=hO(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=fO(t,e);else break;return e}function dy(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function fO(t,e){let n=dy(t),r=n;return t.eat(",")&&(t.next!="}"?r=dy(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function pO(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function hO(t){if(t.eat("(")){let e=Ay(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=pO(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function mO(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function i(s,l){s.forEach(c=>c.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(o(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=o(s.exprs[c],l);if(c==s.exprs.length-1)return d;i(d,l=n())}else if(s.type=="star"){let c=n();return r(l,c),i(o(s.expr,c),c),[r(c)]}else if(s.type=="plus"){let c=n();return i(o(s.expr,l),c),i(o(s.expr,c),c),[r(c)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d{t[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let f=0;f{d||i.push([l,d=[]]),d.indexOf(f)==-1&&d.push(f)})})});let o=e[r.join(",")]=new zi(r.indexOf(t.length-1)>-1);for(let s=0;s-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ky(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new tr(this,this.computeAttrs(e),G.from(n),Ge.setFrom(r))}createChecked(e=null,n,r){return n=G.from(n),this.checkContent(n),new tr(this,this.computeAttrs(e),n,Ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=G.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(G.empty,!0);return o?new tr(this,e,n.append(o),Ge.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[o]=new t(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function yO(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}var sf=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?yO(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Ds=class t{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Ry(e,i.attrs),this.excluded=null;let o=Ny(this.attrs);this.instance=o?new Ge(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ge(this,ky(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new t(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n-1}},Ls=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=jd.from(e.nodes),n.marks=jd.from(e.marks||{}),this.nodes=vl.compile(this.spec.nodes,this),this.marks=Ds.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=zi.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?py(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:py(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof vl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new rf(r,r.defaultAttrs,e,Ge.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return tr.fromJSON(this,e)}markFromJSON(e){return Ge.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function py(t,e){let n=[];for(let r=0;r-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function EO(t){return t.tag!=null}function vO(t){return t.style!=null}var Ir=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(EO(i))this.tags.push(i);else if(vO(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new _l(this,n,!1);return r.addAll(e,Ge.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new _l(this,n,!0);return r.addAll(e,Ge.none,n.from,n.to),Z.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s{r(s=my(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=my(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},Iy={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},wO={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Dy={ol:!0,ul:!0},wl=1,xl=2,Is=4;function hy(t,e,n){return e!=null?(e?wl:0)|(e==="full"?xl:0):t&&t.whitespace=="pre"?wl|xl:n&~Is}var Ro=class{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Ge.none,this.match=o||(s&Is?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(G.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wl)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=G.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Iy.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},_l=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,s=hy(null,n.preserveWhitespace,0)|(r?Is:0);i?o=new Ro(i.type,i.attrs,Ge.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Ro(null,null,Ge.none,!0,null,s):o=new Ro(e.schema.topNodeType,null,Ge.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top;if(i.options&xl||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&wl)i.options&xl?r=r.replace(/\r\n?/g,` -`):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=e.nodeName.toLowerCase(),o;Dy.hasOwnProperty(i)&&this.parser.normalizeLists&&xO(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:wO.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,c=this.top,d=this.needsBlock;if(Iy.hasOwnProperty(i))c.content.length&&c.content[0].isInline&&this.open&&(this.open--,c=this.top),l=!0,c.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);return}let f=s&&s.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),l&&this.sync(c),this.needsBlock=d}else{let l=this.readStyles(e,n);l&&this.addElementByRule(e,s,l,s.consuming===!1?o:void 0)}}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` -`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(e,r);else{let c=this.enter(s,n.attrs||null,r,n.preserveWhitespace);c&&(o=!0,r=c)}else{let c=this.parser.schema.marks[n.mark];r=r.concat(c.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}o&&this.sync(l)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=s,!l.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o(s.type?s.type.allowsMarkType(d.type):gy(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Ro(e,n,c,i,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,c)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;c>=o;c--)if(s(l-1,c))return!0;return!1}else{let f=c>0||c==0&&i?this.nodes[c].type:r&&c>=o?r.node(c-o).type:null;if(!f||f.name!=d&&!f.isInGroup(d))return!1;c--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function xO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Dy.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function _O(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function my(t){let e={};for(let n in t)e[n]=t[n];return e}function gy(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=l=>{o.push(l);for(let c=0;c{if(o.length||s.marks.length){let l=0,c=0;for(;l=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&gl(ef(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return gl(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=by(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return by(e.marks)}};function by(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ef(t){return t.document||window.document}var yy=new WeakMap;function SO(t){let e=yy.get(t);return e===void 0&&yy.set(t,e=TO(t)),e}function TO(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let l,c=n?t.createElementNS(n,i):t.createElement(i),d=e[1],f=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){f=2;for(let h in d)if(d[h]!=null){let m=h.indexOf(" ");m>0?c.setAttributeNS(h.slice(0,m),h.slice(m+1),d[h]):c.setAttribute(h,d[h])}}for(let h=f;hf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:b,contentDOM:y}=gl(t,m,n,r);if(c.appendChild(b),y){if(l)throw new RangeError("Multiple content holes");l=y}}}return{dom:c,contentDOM:l}}var By=65535,Fy=Math.pow(2,16);function CO(t,e){return t+e*Fy}function Ly(t){return t&By}function AO(t){return(t-(t&By))/Fy}var Hy=1,$y=2,Sl=4,zy=8,Fs=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&zy)>0}get deletedBefore(){return(this.delInfo&(Hy|Sl))>0}get deletedAfter(){return(this.delInfo&($y|Sl))>0}get deletedAcross(){return(this.delInfo&Sl)>0}},Lr=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=Ly(e);if(!this.inverted)for(let i=0;ie)break;let d=this.ranges[l+o],f=this.ranges[l+s],h=c+d;if(e<=h){let m=d?e==c?-1:e==h?1:n:n,b=c+i+(m<0?0:f);if(r)return b;let y=e==(n<0?c:h)?null:CO(l/3,e-c),w=e==c?$y:e==h?Hy:Sl;return(n<0?e!=c:e!=h)&&(w|=zy),new Fs(b,w,y)}i+=f-d}return r?e+i:new Fs(e+i,0,null)}touches(e,n){let r=0,i=Ly(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;le)break;let d=this.ranges[l+o],f=c+d;if(e<=f&&l==i*3)return!0;r+=this.ranges[l+s]-d}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new t;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ro&&c!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Vt.fromReplace(e,this.from,this.to,o)}invert(){return new Ui(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};$t.jsonID("addMark",$s);var Ui=class t extends $t{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Z(ff(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Vt.fromReplace(e,this.from,this.to,r)}invert(){return new $s(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};$t.jsonID("removeMark",Ui);var zs=class t extends $t{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vt.fromReplace(e,this.pos,this.pos+1,new Z(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,Z.fromJSON(e,n.slice),n.insert,!!n.structure)}};$t.jsonID("replaceAround",Tt);function uf(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function MO(t,e,n,r){let i=[],o=[],s,l;t.doc.nodesBetween(e,n,(c,d,f)=>{if(!c.isInline)return;let h=c.marks;if(!r.isInSet(h)&&f.type.allowsMarkType(r.type)){let m=Math.max(d,e),b=Math.min(d+c.nodeSize,n),y=r.addToSet(h);for(let w=0;wt.step(c)),o.forEach(c=>t.step(c))}function NO(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;o++;let c=null;if(r instanceof Ds){let d=s.marks,f;for(;f=r.isInSet(d);)(c||(c=[])).push(f),d=f.removeFromSet(d)}else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,n);for(let f=0;ft.step(new Ui(s.from,s.to,s.style)))}function pf(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c=0;c--)t.step(s[c])}function kO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Pr(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),o=t.$from.index(r),s=t.$to.indexAfter(r);if(rn;y--)w||r.index(y)>0?(w=!0,f=G.from(r.node(y).copy(f)),h++):c--;let m=G.empty,b=0;for(let y=o,w=!1;y>n;y--)w||i.after(y+1)=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=G.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Tt(i,o,i,o,new Z(r,0,0),n.length,!0))}function LO(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let c=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,c)&&PO(t.doc,t.mapping.slice(o).map(l),r)){let d=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",y=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!y?d=!1:!b&&y&&(d=!0)}d===!1&&Wy(t,s,l,o),pf(t,t.mapping.slice(o).map(l,1),r,void 0,d===null);let f=t.mapping.slice(o),h=f.map(l,1),m=f.map(l+s.nodeSize,1);return t.step(new Tt(h,m,h+1,m-1,new Z(G.from(r.create(c,null,s.marks)),0,0),1,!0)),d===!0&&Uy(t,s,l,o),!1}})}function Uy(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let c=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Wy(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(` -`))}})}function PO(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function BO(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Tt(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new Z(G.from(s),0,0),1,!0))}function Hn(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,f=n-2;d>o;d--,f--){let h=i.node(d),m=i.index(d);if(h.type.spec.isolating)return!1;let b=h.content.cutByIndex(m,h.childCount),y=r&&r[f+1];y&&(b=b.replaceChild(0,y.type.create(y.attrs)));let w=r&&r[f]||h;if(!h.canReplace(m+1,h.childCount)||!w.type.validContent(b))return!1}let l=i.indexAfter(o),c=r&&r[0];return i.node(o).canReplaceWith(l,l,c?c.type:i.node(o+1).type)}function FO(t,e,n=1,r){let i=t.doc.resolve(e),o=G.empty,s=G.empty;for(let l=i.depth,c=i.depth-n,d=n-1;l>c;l--,d--){o=G.from(i.node(l).copy(o));let f=r&&r[d];s=G.from(f?f.type.create(f.attrs,s):i.node(l).copy(s))}t.step(new en(e,e,new Z(o.append(s),n,n),!0))}function nr(t,e){let n=t.resolve(e),r=n.index();return Ky(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function HO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&Ky(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function $O(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let f=s.whitespace=="pre",h=!!s.contentMatch.matchType(i);f&&!h?r=!1:!f&&h&&(r=!0)}let l=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);Wy(t,f.node(),f.before(),l)}s.inlineContent&&pf(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let c=t.mapping.slice(l),d=c.map(e-n);if(t.step(new en(d,c.map(e+n,-1),Z.empty,!0)),r===!0){let f=t.doc.resolve(d);Uy(t,f.node(),f.before(),t.steps.length)}return t}function zO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(l>0?1:0),d=r.node(s),f=!1;if(o==1)f=d.canReplace(c,c,i);else{let h=d.contentMatchAt(c).findWrapping(i.firstChild.type);f=h&&d.canReplaceWith(c,c,h[0])}if(f)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Ws(t,e,n=e,r=Z.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Vy(i,o,r)?new en(e,n,r):new df(i,o,r).fit()}function Vy(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var df=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=G.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=G.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let c=new Z(o,s,l);return e>-1?new Tt(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new en(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=lf(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],f,h=null;if(n==1&&(s?d.matchType(s.type)||(h=d.fillBefore(G.from(s),!1)):o&&c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:h};if(n==2&&s&&(f=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:f};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=lf(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Z(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=lf(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new Z(Ps(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new Z(Ps(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let w=0;w1||c==0||w.content.size)&&(h=_,f.push(Gy(w.mark(m.allowedMarks(w.marks)),d==1?c:0,d==l.childCount?b:-1)))}let y=d==l.childCount;y||(b=-1),this.placed=Bs(this.placed,n,G.from(f)),this.frontier[n].match=h,y&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,_=l;w1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n=0;l--){let{match:c,type:d}=this.frontier[l],f=cf(e,l,d,c,!0);if(!f||f.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Bs(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Bs(this.placed,this.depth,G.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=Bs(this.placed,this.frontier.length,n))}};function Ps(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ps(t.firstChild.content,e-1,n)))}function Bs(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bs(t.lastChild.content,e-1,n)))}function lf(t,e){for(let n=0;n1&&(r=r.replaceChild(0,Gy(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(G.empty,!0)))),t.copy(r)}function cf(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!UO(n,o.content,s)?l:null}function UO(t,e,n){for(let r=n;r0;m--,b--){let y=i.node(m).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;s.indexOf(m)>-1?l=m:i.before(m)==b&&s.splice(1,0,-m)}let c=s.indexOf(l),d=[],f=r.openStart;for(let m=r.content,b=0;;b++){let y=m.firstChild;if(d.push(y),b==r.openStart)break;m=y.content}for(let m=f-1;m>=0;m--){let b=d[m],y=WO(b.type);if(y&&!b.sameMarkup(i.node(Math.abs(l)-1)))f=m;else if(y||!b.type.isTextblock)break}for(let m=r.openStart;m>=0;m--){let b=(m+f+1)%(r.openStart+1),y=d[b];if(y)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>h));m--){let b=s[m];b<0||(e=i.before(b),n=o.after(b))}}function qy(t,e,n,r,i){if(er){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(G.empty,!0))}return t}function VO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=zO(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Z(G.from(r),0,0))}function GO(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Yy(r,i);for(let s=0;s0&&(c||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Yy(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(oe.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}var Tl=class t extends $t{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Vt.fromReplace(e,this.pos,this.pos+1,new Z(G.from(i),0,n.isLeaf?0:1))}getMap(){return Lr.empty}invert(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}};$t.jsonID("attr",Tl);var Cl=class t extends $t{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Vt.ok(r)}getMap(){return Lr.empty}invert(e){return new t(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}};$t.jsonID("docAttr",Cl);var Io=class extends Error{};Io=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Io.prototype=Object.create(Error.prototype);Io.prototype.constructor=Io;Io.prototype.name="TransformError";var li=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hs}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Io(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Z.empty){let i=Ws(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Z(G.from(r),0,0))}delete(e,n){return this.replace(e,n,Z.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return KO(this,e,n,r),this}replaceRangeWith(e,n,r){return VO(this,e,n,r),this}deleteRange(e,n){return GO(this,e,n),this}lift(e,n){return OO(this,e,n),this}join(e,n=1){return $O(this,e,n),this}wrap(e,n){return DO(this,e,n),this}setBlockType(e,n=e,r,i=null){return LO(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return BO(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Tl(e,n,r)),this}setDocAttribute(e,n){return this.step(new Cl(e,n)),this}addNodeMark(e,n){return this.step(new zs(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Ge)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Us(e,n)),this}split(e,n=1,r){return FO(this,e,n,r),this}addMark(e,n,r){return MO(this,e,n,r),this}removeMark(e,n,r){return NO(this,e,n,r),this}clearIncompatible(e,n,r){return pf(this,e,n,r),this}};var hf=Object.create(null),ue=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Bo(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;o--){let s=n<0?Po(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Po(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Nn(e.node(0))}static atStart(e){return Po(e,e,0,0,1)||new Nn(e)}static atEnd(e){return Po(e,e,e.content.size,e.childCount,-1)||new Nn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=hf[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in hf)throw new RangeError("Duplicate use of selection JSON ID "+e);return hf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return le.between(this.$anchor,this.$head).getBookmark()}};ue.prototype.visible=!0;var Bo=class{constructor(e,n){this.$from=e,this.$to=n}},Jy=!1;function Xy(t){!Jy&&!t.parent.inlineContent&&(Jy=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var le=class t extends ue{constructor(e,n=e){Xy(e),Xy(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ue.near(r);let i=e.resolve(n.map(this.anchor));return new t(i.parent.inlineContent?i:r,r)}replace(e,n=Z.empty){if(super.replace(e,n),n==Z.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Nl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=ue.findFrom(n,r,!0)||ue.findFrom(n,-r,!0);if(o)n=o.$head;else return ue.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ue.findFrom(e,-r,!0)||ue.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?s=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&pe.isSelectable(l))return pe.create(t,n-(i<0?l.nodeSize:0))}else{let c=Po(t,l,n+i,i<0?l.childCount:0,i,o);if(c)return c}n+=l.nodeSize*i}return null}function Zy(t,e,n){let r=t.steps.length-1;if(r{s==null&&(s=f)}),t.setSelection(ue.near(t.doc.resolve(s),n))}var jy=1,Ml=2,Qy=4,bf=class extends li{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ml,this}ensureMarks(e){return Ge.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ml)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ml,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ge.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(ue.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Qy,this}get scrolledIntoView(){return(this.updated&Qy)>0}};function e0(t,e){return!e||!t?t:t.bind(e)}var Wi=class{constructor(e,n,r){this.name=e,this.init=e0(n.init,r),this.apply=e0(n.apply,r)}},YO=[new Wi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Wi("selection",{init(t,e){return t.selection||ue.atStart(e.doc)},apply(t){return t.selection}}),new Wi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Wi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],Ks=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=YO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Wi(r.key,r.spec.state,r))})}},kl=class t{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ks(e.schema,e.plugins),o=new t(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=tr.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=ue.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let c=r[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){o[s.name]=d.fromJSON.call(c,e,n[l],o);return}}o[s.name]=s.init(e,o)}}),o}};function t0(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=t0(i,e,{})),n[r]=i}return n}var ke=class{constructor(e){this.spec=e,this.props={},e.props&&t0(e.props,this,this.props),this.key=e.key?e.key.key:n0("plugin")}getState(e){return e[this.key]}},mf=Object.create(null);function n0(t){return t in mf?t+"$"+ ++mf[t]:(mf[t]=0,t+"$")}var ze=class{constructor(e="key"){this.key=n0(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var Gt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ys=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},_f=null,Fr=function(t,e,n){let r=_f||(_f=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},JO=function(){_f=null},Xi=function(t,e,n,r){return n&&(r0(t,e,n,r,-1)||r0(t,e,n,r,1))},XO=/^(img|br|input|textarea|hr)$/i;function r0(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:zn(t))){let o=t.parentNode;if(!o||o.nodeType!=1||js(t)||XO.test(t.nodeName)||t.contentEditable=="false")return!1;e=Gt(t)+(i<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?zn(t):0}else return!1}}function zn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ZO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=zn(t)}else if(t.parentNode&&!js(t))e=Gt(t),t=t.parentNode;else return null}}function jO(t,e){for(;;){if(t.nodeType==3&&e2),$n=Uo||(pr?/Mac/.test(pr.platform):!1),nR=pr?/Win/.test(pr.platform):!1,rr=/Android \d/.test(hi),Qs=!!i0&&"webkitFontSmoothing"in i0.documentElement.style,rR=Qs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function iR(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Br(t,e){return typeof t=="number"?t:t[e]}function oR(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function o0(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=Ys(s)){if(s.nodeType!=1)continue;let l=s,c=l==o.body,d=c?iR(o):oR(l),f=0,h=0;if(e.topd.bottom-Br(r,"bottom")&&(h=e.bottom-e.top>d.bottom-d.top?e.top+Br(i,"top")-d.top:e.bottom-d.bottom+Br(i,"bottom")),e.leftd.right-Br(r,"right")&&(f=e.right-d.right+Br(i,"right")),f||h)if(c)o.defaultView.scrollBy(f,h);else{let m=l.scrollLeft,b=l.scrollTop;h&&(l.scrollTop+=h),f&&(l.scrollLeft+=f);let y=l.scrollLeft-m,w=l.scrollTop-b;e={left:e.left-y,top:e.top-w,right:e.right-y,bottom:e.bottom-w}}if(c||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function sR(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s=n-20){r=l,i=c.top;break}}return{refDOM:r,refTop:i,stack:F0(t.dom)}}function F0(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ys(r));return e}function aR({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;H0(n,r==0?0:r-e)}function H0(t,e){for(let n=0;n=l){s=Math.max(y.bottom,s),l=Math.min(y.top,l);let w=y.left>e.left?y.left-e.left:y.right=(y.left+y.right)/2?1:0));continue}}else y.top>e.top&&!c&&y.left<=e.left&&y.right>=e.left&&(c=f,d={left:Math.max(y.left,Math.min(y.right,e.left)),top:y.top});!n&&(e.left>=y.right&&e.top>=y.top||e.left>=y.left&&e.top>=y.bottom)&&(o=h+1)}}return!n&&c&&(n=c,i=d,r=0),n&&n.nodeType==3?cR(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:$0(n,i)}function cR(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function zf(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function uR(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function fR(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let l=t.docView.nearestDesc(o,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let c=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&c.left>r.left||c.top>r.top?i=l.posBefore:(!s&&c.right-1?i:t.docView.posFromDOM(e,n,-1)}function z0(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let d;Qs&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=fR(t,r,i,e))}l==null&&(l=dR(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function s0(t){return t.top=0&&i==r.nodeValue.length?(c--,f=1):n<0?c--:d++,Vs(ci(Fr(r,c,d),f),f<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==zn(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return yf(c.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==zn(r))){let c=r.childNodes[i-1],d=c.nodeType==3?Fr(c,zn(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Vs(ci(d,1),!1)}if(o==null&&i=0)}function Vs(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function yf(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function W0(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function mR(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return W0(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=U0(t,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Fr(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;df.top+1&&(n=="up"?s.top-f.top>(f.bottom-s.top)*2:f.bottom-s.bottom>(s.bottom-f.top)*2))return!1}}return!0})}var gR=/[\u0590-\u08ac]/;function bR(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=t.domSelection();return l?!gR.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?o:s:W0(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:f,anchorOffset:h}=t.domSelectionRange(),m=l.caretBidiLevel;l.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:y,focusOffset:w}=t.domSelectionRange(),_=y&&!b.contains(y.nodeType==1?y:y.parentNode)||c==y&&d==w;try{l.collapse(f,h),c&&(c!=f||d!=h)&&l.extend&&l.extend(c,d)}catch{}return m!=null&&(l.caretBidiLevel=m),_}):r.pos==r.start()||r.pos==r.end()}var a0=null,l0=null,c0=!1;function yR(t,e,n){return a0==e&&l0==n?c0:(a0=e,l0=n,c0=n=="up"||n=="down"?mR(t,e,n):bR(t,e,n))}var Un=0,u0=1,Vi=2,hr=3,Zi=class{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Un,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nGt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||s instanceof Il){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Ol&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Gt(o.dom)+1:0}}else{let o,s=!0;for(;o=r=f&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,f);e=s;for(let h=l;h>0;h--){let m=this.children[h-1];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(1)){i=Gt(m.dom)+1;break}e-=m.size}i==-1&&(i=0)}if(i>-1&&(d>n||l==this.children.length-1)){n=d;for(let f=l+1;fb&&sn){let b=l;l=c,c=b}let m=document.createRange();m.setEnd(c.node,c.offset),m.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(m)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let l=r+o.border,c=s-o.border;if(e>=l&&n<=c){this.dirty=e==r||n==s?Vi:u0,e==l&&n==c&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=hr:o.markDirty(e-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Vi:hr}r=s}this.dirty=Vi}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Vi:u0;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Un&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},Af=class extends Zi{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Wo=class t extends Zi{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=Dr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new t(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&hr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=hr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Un){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(o=Of(o,0,e,r));for(let l=0;l{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},r,i),f=d&&d.dom,h=d&&d.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:h}=Dr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!h&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let m=f;return f=G0(f,r,n),d?c=new Mf(e,n,r,i,f,h||null,m,d,o,s+1):n.isText?new Rl(e,n,r,i,f,m,o):new t(e,n,r,i,f,h||null,m,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>G.empty)}return e}matchesNode(e,n,r){return this.dirty==Un&&e.eq(this.node)&&Dl(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,c=new kf(this,s&&s.node,e);xR(this.node,this.innerDeco,(d,f,h)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!h&&c.syncToMarks(f==this.node.childCount?Ge.none:this.node.child(f).marks,r,e),c.placeWidget(d,e,i)},(d,f,h,m)=>{c.syncToMarks(d.marks,r,e);let b;c.findNodeMatch(d,f,h,m)||l&&e.state.selection.from>i&&e.state.selection.to-1&&c.updateNodeAt(d,f,h,b,e)||c.updateNextNode(d,f,h,e,m,i)||c.addNode(d,f,h,e,i),i+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Vi)&&(s&&this.protectLocalComposition(e,s),K0(this.contentDOM,this.children,e),Uo&&_R(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof le)||rn+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=SR(this.node.content,s,r-n,i-n);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new Af(this,o,n,i);e.input.compositionNodes.push(s),this.children=Of(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==hr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Un}updateOuterDeco(e){if(Dl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=V0(this.dom,this.nodeDOM,Nf(this.outerDeco,this.node,n),Nf(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function d0(t,e,n,r,i){G0(r,e,t);let o=new pi(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}var Rl=class t extends pi{constructor(e,n,r,i,o,s,l){super(e,n,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==hr||this.dirty!=Un&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Un||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Un,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=hr)}get domAtom(){return!1}isText(e){return this.node.text==e}},Il=class extends Zi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Un&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},Mf=class extends pi{constructor(e,n,r,i,o,s,l,c,d,f){super(e,n,r,i,o,s,l,d,f),this.spec=c}update(e,n,r,i){if(this.dirty==hr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function K0(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o>1,s=Math.min(o,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=Wo.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let d=n.children[r-1];if(d instanceof Wo)n=d,r=d.children.length;else{l=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function wR(t,e){return t.type.side-e.type.side}function xR(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let d=0;do;)l.push(i[s++]);let y=o+m.nodeSize;if(m.isText){let _=y;s!_.inline):l.slice();r(m,w,e.forChild(o,m),b),o=y}}function _R(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function SR(t,e,n,r){for(let i=0,o=0;i=n){if(o>=r&&c.slice(r-e.length-l,r-l)==e)return r-e.length;let d=l=0&&d+e.length+l>=n)return l+d;if(n==r&&c.length>=r+e.length-l&&c.slice(r-l,r-l+e.length)==e)return r}}return-1}function Of(t,e,n,r,i){let o=[];for(let s=0,l=0;s=n||f<=e?o.push(c):(dn&&o.push(c.slice(n-d,c.size,r)))}return o}function Uf(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),c,d;if(Ul(n)){for(c=s;i&&!i.node;)i=i.parent;let h=i.node;if(i&&h.isAtom&&pe.isSelectable(h)&&i.parent&&!(h.isInline&&QO(n.focusNode,n.focusOffset,i.dom))){let m=i.posBefore;d=new pe(s==m?l:r.resolve(m))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let h=s,m=s;for(let b=0;b{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!q0(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function CR(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,Gt(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&En&&fi<=11&&(r.disabled=!0,r.disabled=!1)}function Y0(t,e){if(e instanceof pe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(g0(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else g0(t)}function g0(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Wf(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||le.between(e,n,r)}function b0(t){return t.editable&&!t.hasFocus()?!1:J0(t)}function J0(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function AR(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Xi(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Rf(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&ue.findFrom(o,e)}function ui(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function y0(t,e,n){let r=t.state.selection;if(r instanceof le)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return ui(t,new le(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Rf(t.state,e);return i&&i instanceof pe?ui(t,i):!1}else if(!($n&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?pe.isSelectable(o)?ui(t,new pe(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Qs?ui(t,new le(t.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof pe&&r.node.isInline)return ui(t,new le(e>0?r.$to:r.$from));{let i=Rf(t.state,e);return i?ui(t,i):!1}}}function Ll(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qs(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ho(t,e){return e<0?MR(t):NR(t)}function MR(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(ir&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(qs(l,-1))i=n,o=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(X0(n))break;{let l=n.previousSibling;for(;l&&qs(l,-1);)i=n.parentNode,o=Gt(l),l=l.previousSibling;if(l)n=l,r=Ll(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?If(t,n,r):i&&If(t,i,o)}function NR(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Ll(n),o,s;for(;;)if(r{t.state==i&&Hr(t)},50)}function E0(t,e){let n=t.state.doc.resolve(e);if(!(nn||nR)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s1)return o.lefti.top&&s1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function v0(t,e,n){let r=t.state.selection;if(r instanceof le&&!r.empty||n.indexOf("s")>-1||$n&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Rf(t.state,e);if(s&&s instanceof pe)return ui(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Nn?ue.near(s,e):ue.findFrom(s,e);return l?ui(t,l):!1}return!1}function w0(t,e){if(!(t.state.selection instanceof le))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function x0(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function RR(t){if(!dn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;x0(t,r,"true"),setTimeout(()=>x0(t,r,"false"),20)}return!1}function IR(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function DR(t,e){let n=e.keyCode,r=IR(e);if(n==8||$n&&n==72&&r=="c")return w0(t,-1)||Ho(t,-1);if(n==46&&!e.shiftKey||$n&&n==68&&r=="c")return w0(t,1)||Ho(t,1);if(n==13||n==27)return!0;if(n==37||$n&&n==66&&r=="c"){let i=n==37?E0(t,t.state.selection.from)=="ltr"?-1:1:-1;return y0(t,i,r)||Ho(t,i)}else if(n==39||$n&&n==70&&r=="c"){let i=n==39?E0(t,t.state.selection.from)=="ltr"?1:-1:1;return y0(t,i,r)||Ho(t,i)}else{if(n==38||$n&&n==80&&r=="c")return v0(t,-1,r)||Ho(t,-1);if(n==40||$n&&n==78&&r=="c")return RR(t)||v0(t,1,r)||Ho(t,1);if(r==($n?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Z0(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let s=t.someProp("clipboardSerializer")||Dr.fromSchema(t.state.schema),l=rE(),c=l.createElement("div");c.appendChild(s.serializeFragment(r,{document:l}));let d=c.firstChild,f,h=0;for(;d&&d.nodeType==1&&(f=nE[d.nodeName.toLowerCase()]);){for(let b=f.length-1;b>=0;b--){let y=l.createElement(f[b]);for(;c.firstChild;)y.appendChild(c.firstChild);c.appendChild(y),h++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${o}${h?` -${h}`:""} ${JSON.stringify(n)}`);let m=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,` - -`);return{dom:c,text:m,slice:e}}function j0(t,e,n,r,i){let o=i.parent.type.spec.code,s,l;if(!n&&!e)return null;let c=e&&(r||o||!n);if(c){if(t.someProp("transformPastedText",m=>{e=m(e,o||r,t)}),o)return e?new Z(G.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0):Z.empty;let h=t.someProp("clipboardTextParser",m=>m(e,i,r,t));if(h)l=h;else{let m=i.marks(),{schema:b}=t.state,y=Dr.fromSchema(b);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let _=s.appendChild(document.createElement("p"));w&&_.appendChild(y.serializeNode(b.text(w,m)))})}}else t.someProp("transformPastedHTML",h=>{n=h(n,t)}),s=FR(n),Qs&&HR(s);let d=s&&s.querySelector("[data-pm-slice]"),f=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let h=+f[3];h>0;h--){let m=s.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;s=m}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Ir.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||f),context:i,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!LR.test(m.parentNode.nodeName)?{ignore:!0}:null}})),f)l=$R(_0(l,+f[1],+f[2]),f[4]);else if(l=Z.maxOpen(PR(l.content,i),!0),l.openStart||l.openEnd){let h=0,m=0;for(let b=l.content.firstChild;h{l=h(l,t)}),l}var LR=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function PR(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(l=>{if(!s)return;let c=i.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&o.length&&eE(c,o,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=tE(s[s.length-1],o.length));let f=Q0(l,c);s.push(f),i=i.matchType(f.type),o=c}}),s)return G.from(s)}return t}function Q0(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,G.from(t));return t}function eE(t,e,n,r,i){if(i1&&(o=0),i=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function _0(t,e,n){return en})),vf.createHTML(t)):t}function FR(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=rE().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&nE[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"").reverse().join("")),n.innerHTML=BR(t),i)for(let o=0;o=0;l-=2){let c=n.nodes[r[l]];if(!c||c.hasRequiredAttrs())break;i=G.from(c.create(r[l+1],i)),o++,s++}return new Z(i,o,s)}var fn={},pn={},zR={touchstart:!0,touchmove:!0},Lf=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function UR(t){for(let e in fn){let n=fn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{KR(t,r)&&!Kf(t,r)&&(t.editable||!(r.type in pn))&&n(t,r)},zR[e]?{passive:!0}:void 0)}dn&&t.dom.addEventListener("input",()=>null),Pf(t)}function di(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function WR(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Pf(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Kf(t,r))})}function Kf(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function KR(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function VR(t,e){!Kf(t,e)&&fn[e.type]&&(t.editable||!(e.type in pn))&&fn[e.type](t,e)}pn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!oE(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(rr&&nn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Uo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Ki(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||DR(t,n)?n.preventDefault():di(t,"key")};pn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};pn.keypress=(t,e)=>{let n=e;if(oE(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||$n&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof le)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Wl(t){return{left:t.clientX,top:t.clientY}}function GR(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Vf(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,l=>s>o.depth?l(t,n,o.nodeAfter,o.before(s),i,!0):l(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function zo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function qR(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&pe.isSelectable(r)?(zo(t,new pe(n),"pointer"),!0):!1}function YR(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof pe&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(pe.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(zo(t,pe.create(t.state.doc,i),"pointer"),!0):!1}function JR(t,e,n,r,i){return Vf(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?YR(t,n):qR(t,n))}function XR(t,e,n,r){return Vf(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function ZR(t,e,n,r){return Vf(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||jR(t,n,r)}function jR(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(zo(t,le.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)zo(t,le.create(r,l+1,l+1+s.content.size),"pointer");else if(pe.isSelectable(s))zo(t,pe.create(r,l),"pointer");else continue;return!0}}function Gf(t){return Pl(t)}var iE=$n?"metaKey":"ctrlKey";fn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Gf(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&GR(n,t.input.lastClick)&&!n[iE]&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords(Wl(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Bf(t,s,n,!!r)):(o=="doubleClick"?XR:ZR)(t,s.pos,s.inside,n)?n.preventDefault():di(t,"pointer"))};var Bf=class{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[iE],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let f=e.state.doc.resolve(n.pos);o=f.parent,s=f.depth?f.before():0}let l=i?null:r.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:d}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||d instanceof pe&&d.from<=s&&d.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ir&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),di(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Hr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Wl(e))),this.updateAllowDefault(e),this.allowDefault||!n?di(this.view,"pointer"):JR(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||dn&&this.mightDrag&&!this.mightDrag.node.isAtom||nn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(zo(this.view,ue.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):di(this.view,"pointer")}move(e){this.updateAllowDefault(e),di(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};fn.touchstart=t=>{t.input.lastTouch=Date.now(),Gf(t),di(t,"pointer")};fn.touchmove=t=>{t.input.lastTouch=Date.now(),di(t,"pointer")};fn.contextmenu=t=>Gf(t);function oE(t,e){return t.composing?!0:dn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var QR=rr?5e3:-1;pn.compositionstart=pn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof le&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Pl(t,!0),t.markCursor=null;else if(Pl(t,!e.selection.empty),ir&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}sE(t,QR)};pn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,sE(t,20))};function sE(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Pl(t),e))}function aE(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=tI());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function eI(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=ZO(e.focusNode,e.focusOffset),r=jO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function tI(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Pl(t,e=!1){if(!(rr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),aE(t),e||t.docView&&t.docView.dirty){let n=Uf(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function nI(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}var Js=En&&fi<15||Uo&&rR<604;fn.copy=pn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=Js?null:n.clipboardData,s=r.content(),{dom:l,text:c}=Z0(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",c)):nI(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function rI(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function iI(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Xs(t,r.value,null,i,e):Xs(t,r.textContent,r.innerHTML,i,e)},50)}function Xs(t,e,n,r,i){let o=j0(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,o||Z.empty)))return!0;if(!o)return!1;let s=rI(o),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function lE(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}pn.paste=(t,e)=>{let n=e;if(t.composing&&!rr)return;let r=Js?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Xs(t,lE(r),r.getData("text/html"),i,n)?n.preventDefault():iI(t,n)};var Bl=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},cE=$n?"altKey":"ctrlKey";fn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Wl(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof pe?i.to-1:i.to))){if(r&&r.mightDrag)s=pe.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let h=t.docView.nearestDesc(n.target,!0);h&&h.node.type.spec.draggable&&h!=t.docView&&(s=pe.create(t.state.doc,h.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:d,slice:f}=Z0(t,l);(!n.dataTransfer.files.length||!nn||B0>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Js?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Js||n.dataTransfer.setData("text/plain",d),t.dragging=new Bl(f,!n[cE],s)};fn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};pn.dragover=pn.dragenter=(t,e)=>e.preventDefault();pn.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Wl(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",y=>{s=y(s,t)}):s=j0(t,lE(n.dataTransfer),Js?null:n.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!n[cE]);if(t.someProp("handleDrop",y=>y(t,n,s||Z.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let c=s?Al(t.state.doc,o.pos,s):o.pos;c==null&&(c=o.pos);let d=t.state.tr;if(l){let{node:y}=r;y?y.replace(d):d.deleteSelection()}let f=d.mapping.map(c),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=d.doc;if(h?d.replaceRangeWith(f,f,s.content.firstChild):d.replaceRange(f,f,s),d.doc.eq(m))return;let b=d.doc.resolve(f);if(h&&pe.isSelectable(s.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(s.content.firstChild))d.setSelection(new pe(b));else{let y=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((w,_,S,L)=>y=L),d.setSelection(Wf(t,b,d.doc.resolve(y)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))};fn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Hr(t)},20))};fn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};fn.beforeinput=(t,e)=>{if(nn&&rr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Ki(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in pn)fn[t]=pn[t];function Zs(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}var Fl=class t{constructor(e,n){this.toDOM=e,this.spec=n||Yi,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new vt(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof t&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Zs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},qi=class t{constructor(e,n){this.attrs=e,this.spec=n||Yi}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new vt(o,s,this)}valid(e,n){return n.from=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;se){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,i+l,o)}}map(e,n,r){return this==tn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Yi)}mapInner(e,n,r,i,o){let s;for(let l=0;l{let d=c+r,f;if(f=dE(n,l,d)){for(i||(i=this.children.slice());ol&&h.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+n.content.size;for(let l=0;lo&&c.type instanceof qi){let d=Math.max(o,c.from)-o,f=Math.min(s,c.to)-o;di.map(e,n,Yi));return t.from(r)}forChild(e,n){if(n.isLeaf)return ot.empty;let r=[];for(let i=0;in instanceof ot)?e:e.reduce((n,r)=>n.concat(r instanceof ot?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let _=w-y-(b-m);for(let S=0;SL+f-h)continue;let D=l[S]+f-h;b>=D?l[S+1]=m<=D?-2:-1:m>=f&&_&&(l[S]+=_,l[S+1]+=_)}h+=_}),f=n.maps[d].map(f,-1)}let c=!1;for(let d=0;d=r.content.size){c=!0;continue}let m=n.map(t[d+1]+o,-1),b=m-i,{index:y,offset:w}=r.content.findIndex(h),_=r.maybeChild(y);if(_&&w==h&&w+_.nodeSize==b){let S=l[d+2].mapInner(n,_,f+1,t[d]+o+1,s);S!=tn?(l[d]=h,l[d+1]=b,l[d+2]=S):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=sI(l,t,e,n,i,o,s),f=$l(d,r,0,s);e=f.local;for(let h=0;hn&&s.to{let d=dE(t,l,c+n);if(d){o=!0;let f=$l(d,l,n+c+1,r);f!=tn&&i.push(c,c+l.nodeSize,f)}});let s=uE(o?fE(t):t,-n).sort(Ji);for(let l=0;l0;)e++;t.splice(e,0,n)}function wf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=tn&&e.push(r)}),t.cursorWrapper&&e.push(ot.create(t.state.doc,[t.cursorWrapper.deco])),Hl.from(e)}var aI={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lI=En&&fi<=11,Hf=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},$f=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Hf,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),lI&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,aI)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(b0(this.view)){if(this.suppressingSelectionUpdates)return Hr(this.view);if(En&&fi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Xi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=Ys(o))n.add(o);for(let o=e.anchorNode;o;o=Ys(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&b0(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,c=[];if(e.editable)for(let f=0;fh.nodeName=="BR");if(f.length==2){let[h,m]=f;h.parentNode&&h.parentNode.parentNode==m.parentNode?m.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let m of f){let b=m.parentNode;b&&b.nodeName=="LI"&&(!h||dI(e,h)!=b)&&m.remove()}}}let d=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(o>-1&&(e.docView.markDirty(o,s),cI(e)),this.handleDOMChange(o,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Hr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fi;_--){let S=r.childNodes[_-1],L=S.pmViewDesc;if(S.nodeName=="BR"&&!L){o=_;break}if(!L||L.size)break}let h=t.state.doc,m=t.someProp("domParser")||Ir.fromSchema(t.state.schema),b=h.resolve(s),y=null,w=m.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:o,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:pI,context:b});if(d&&d[0].pos!=null){let _=d[0].pos,S=d[1]&&d[1].pos;S==null&&(S=_),y={anchor:_+s,head:S+s}}return{doc:w,sel:y,from:s,to:l}}function pI(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(dn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||dn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}var hI=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function mI(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let z=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,re=Uf(t,z);if(re&&!t.state.selection.eq(re)){if(nn&&rr&&t.input.lastKeyCode===13&&Date.now()-100Se(t,Ki(13,"Enter"))))return;let he=t.state.tr.setSelection(re);z=="pointer"?he.setMeta("pointer",!0):z=="key"&&he.scrollIntoView(),o&&he.setMeta("composition",o),t.dispatch(he)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,d=fI(t,e,n),f=t.state.doc,h=f.slice(d.from,d.to),m,b;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||rr)&&i.some(z=>z.nodeType==1&&!hI.test(z.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",z=>z(t,Ki(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(r&&c instanceof le&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))y={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let z=N0(t,t.state.doc,d.sel);if(z&&!z.eq(t.state.selection)){let re=t.state.tr.setSelection(z);o&&re.setMeta("composition",o),t.dispatch(re)}}return}t.state.selection.fromt.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?y.start=t.state.selection.from:y.endA=t.state.selection.to-2&&t.state.selection.to<=d.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),En&&fi<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>d.from&&d.doc.textBetween(y.start-d.from-1,y.start-d.from+1)==" \xA0"&&(y.start--,y.endA--,y.endB--);let w=d.doc.resolveNoCache(y.start-d.from),_=d.doc.resolveNoCache(y.endB-d.from),S=f.resolve(y.start),L=w.sameParent(_)&&w.parent.inlineContent&&S.end()>=y.endA,D;if((Uo&&t.input.lastIOSEnter>Date.now()-225&&(!L||i.some(z=>z.nodeName=="DIV"||z.nodeName=="P"))||!L&&w.posz(t,Ki(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&bI(f,y.start,y.endA,w,_)&&t.someProp("handleKeyDown",z=>z(t,Ki(8,"Backspace")))){rr&&nn&&t.domObserver.suppressSelectionUpdates();return}nn&&rr&&y.endB==y.start&&(t.input.lastAndroidDelete=Date.now()),rr&&!L&&w.start()!=_.start()&&_.parentOffset==0&&w.depth==_.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==y.endA&&(y.endB-=2,_=d.doc.resolveNoCache(y.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(z){return z(t,Ki(13,"Enter"))})},20));let T=y.start,$=y.endA,O,Y,ee;if(L){if(w.pos==_.pos)En&&fi<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Hr(t),20)),O=t.state.tr.delete(T,$),Y=f.resolve(y.start).marksAcross(f.resolve(y.endA));else if(y.endA==y.endB&&(ee=gI(w.parent.content.cut(w.parentOffset,_.parentOffset),S.parent.content.cut(S.parentOffset,y.endA-S.start()))))O=t.state.tr,ee.type=="add"?O.addMark(T,$,ee.mark):O.removeMark(T,$,ee.mark);else if(w.parent.child(w.index()).isText&&w.index()==_.index()-(_.textOffset?0:1)){let z=w.parent.textBetween(w.parentOffset,_.parentOffset);if(t.someProp("handleTextInput",re=>re(t,T,$,z)))return;O=t.state.tr.insertText(z,T,$)}}if(O||(O=t.state.tr.replace(T,$,d.doc.slice(y.start-d.from,y.endB-d.from))),d.sel){let z=N0(t,O.doc,d.sel);z&&!(nn&&rr&&t.composing&&z.empty&&(y.start!=y.endB||t.input.lastAndroidDeletee.content.size?null:Wf(t,e.resolve(n.anchor),e.resolve(n.head))}function gI(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,l,c;for(let f=0;ff.mark(l.addToSet(f.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",c=f=>f.mark(l.removeFromSet(f.marks));else return null;let d=[];for(let f=0;fn||xf(s,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function yI(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let c=Math.max(0,o-Math.min(s,l));r-=s+c-o}if(s=s?o-r:0;o-=c,o&&o=l?o-r:0;o-=c,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}var zl=class{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Lf,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(L0),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=I0(this),R0(this),this.nodeViews=D0(this),this.docView=d0(this.state.doc,O0(this),wf(this),this.dom,this),this.domObserver=new $f(this,(r,i,o,s)=>mI(this,r,i,o,s)),this.domObserver.start(),UR(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Pf(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(L0),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(aE(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=D0(this);vI(b,this.nodeViews)&&(this.nodeViews=b,o=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Pf(this),this.editable=I0(this),R0(this);let c=wf(this),d=O0(this),f=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",h=o||!this.docView.matchesNode(e.doc,d,c);(h||!e.selection.eq(i.selection))&&(s=!0);let m=f=="preserve"&&s&&this.dom.style.overflowAnchor==null&&sR(this);if(s){this.domObserver.stop();let b=h&&(En||nn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&EI(i.selection,e.selection);if(h){let y=nn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=eI(this)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=d0(e.doc,d,c,this.dom,this)),y&&!this.trackWrites&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&AR(this))?Hr(this,b):(Y0(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():m&&aR(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof pe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&o0(this,n.getBoundingClientRect(),e)}else o0(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Bl(e.slice,e.move,i<0?void 0:pe.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;sn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return pR(this,e)}coordsAtPos(e,n=1){return U0(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return yR(this,n||this.state,e)}pasteHTML(e,n){return Xs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Xs(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(WR(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],wf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,JO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return VR(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?dn&&this.root.nodeType===11&&eR(this.dom.ownerDocument)==this.dom&&uI(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function O0(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[vt.node(0,t.state.doc.content.size,e)]}function R0(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:vt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function I0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function EI(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function D0(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function vI(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function L0(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var $r={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:"'"},Vl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wI=typeof navigator<"u"&&/Mac/.test(navigator.platform),xI=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ct=0;Ct<10;Ct++)$r[48+Ct]=$r[96+Ct]=String(Ct);var Ct;for(Ct=1;Ct<=24;Ct++)$r[Ct+111]="F"+Ct;var Ct;for(Ct=65;Ct<=90;Ct++)$r[Ct]=String.fromCharCode(Ct+32),Vl[Ct]=String.fromCharCode(Ct);var Ct;for(Kl in $r)Vl.hasOwnProperty(Kl)||(Vl[Kl]=$r[Kl]);var Kl;function pE(t){var e=wI&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||xI&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Vl:$r)[t.keyCode]||t.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}var _I=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function SI(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let l=0;l127)&&(o=$r[r.keyCode])&&o!=i){let l=e[Yf(o,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Gl=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function gE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Xf=(t,e,n)=>{let r=gE(t,n);if(!r)return!1;let i=jf(r);if(!i){let s=r.blockRange(),l=s&&Pr(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(TE(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ko(o,"end")||pe.isSelectable(o)))for(let s=r.depth;;s--){let l=Ws(t.doc,r.before(s),r.after(s),Z.empty);if(l&&l.slice.size1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},bE=(t,e,n)=>{let r=gE(t,n);if(!r)return!1;let i=jf(r);return i?EE(t,i,e):!1},yE=(t,e,n)=>{let r=vE(t,n);if(!r)return!1;let i=tp(r);return i?EE(t,i,e):!1};function EE(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let d=Ws(t.doc,o,c,Z.empty);if(!d||d.from!=o||d instanceof en&&d.slice.size>=c-o)return!1;if(n){let f=t.tr.step(d);f.setSelection(le.create(f.doc,o)),n(f.scrollIntoView())}return!0}function Ko(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Zf=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=jf(r)}let s=o&&o.nodeBefore;return!s||!pe.isSelectable(s)?!1:(e&&e(t.tr.setSelection(pe.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function jf(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function vE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=vE(t,n);if(!r)return!1;let i=tp(r);if(!i)return!1;let o=i.nodeAfter;if(TE(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ko(o,"start")||pe.isSelectable(o))){let s=Ws(t.doc,r.before(),r.after(),Z.empty);if(s&&s.slice.size{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof pe,i;if(r){if(n.node.isTextblock||!nr(t.doc,n.from))return!1;i=n.from}else if(i=Lo(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(pe.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},xE=(t,e)=>{let n=t.selection,r;if(n instanceof pe){if(n.node.isTextblock||!nr(t.doc,n.to))return!1;r=n.to}else if(r=Lo(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},_E=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&Pr(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},np=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` -`).scrollIntoView()),!0)};function rp(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=rp(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(ue.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},op=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Nn||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=rp(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Hn(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Pr(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function CI(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof pe&&e.selection.node.isBlock)return!r.parentOffset||!Hn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,l,c=!1,d=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){c=r.end(b)==r.pos+(r.depth-b),d=r.start(b)==r.pos-(r.depth-b),l=rp(r.node(b-1).contentMatchAt(r.indexAfter(b-1)));let w=t&&t(i.parent,c,r);o.unshift(w||(c&&l?{type:l}:null)),s=b;break}else{if(b==1)return!1;o.unshift(null)}let f=e.tr;(e.selection instanceof le||e.selection instanceof Nn)&&f.deleteSelection();let h=f.mapping.map(r.pos),m=Hn(f.doc,h,o.length,o);if(m||(o[0]=l?{type:l}:null,m=Hn(f.doc,h,o.length,o)),f.split(h,o.length,o),!c&&d&&r.node(s).type!=l){let b=f.mapping.map(r.before(s)),y=f.doc.resolve(b);l&&r.node(s-1).canReplaceWith(y.index(),y.index()+1,l)&&f.setNodeMarkup(f.mapping.map(r.before(s)),l)}return n&&n(f.scrollIntoView()),!0}}var AI=CI();var SE=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(pe.create(t.doc,i))),!0)},MI=(t,e)=>(e&&e(t.tr.setSelection(new Nn(t.doc))),!0);function NI(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||nr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function TE(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,c=i.type.spec.isolating||o.type.spec.isolating;if(!c&&NI(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(n){let b=e.pos+o.nodeSize,y=G.empty;for(let S=s.length-1;S>=0;S--)y=G.from(s[S].create(null,y));y=G.from(i.copy(y));let w=t.tr.step(new Tt(e.pos-1,b,e.pos,b,new Z(y,1,0),s.length,!0)),_=w.doc.resolve(b+2*s.length);_.nodeAfter&&_.nodeAfter.type==i.type&&nr(w.doc,_.pos)&&w.join(_.pos),n(w.scrollIntoView())}return!0}let f=o.type.spec.isolating||r>0&&c?null:ue.findFrom(e,1),h=f&&f.$from.blockRange(f.$to),m=h&&Pr(h);if(m!=null&&m>=e.depth)return n&&n(t.tr.lift(h,m).scrollIntoView()),!0;if(d&&Ko(o,"start",!0)&&Ko(i,"end")){let b=i,y=[];for(;y.push(b),!b.isTextblock;)b=b.lastChild;let w=o,_=1;for(;!w.isTextblock;w=w.firstChild)_++;if(b.canReplace(b.childCount,b.childCount,w.content)){if(n){let S=G.empty;for(let D=y.length-1;D>=0;D--)S=G.from(y[D].copy(S));let L=t.tr.step(new Tt(e.pos-y.length,e.pos+o.nodeSize,e.pos+_,e.pos+o.nodeSize-_,new Z(S,y.length,0),0,!0));n(L.scrollIntoView())}return!0}}return!1}function CE(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(le.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}var ap=CE(-1),lp=CE(1);function AE(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&Do(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function cp(t,e=null){return function(n,r){let i=!1;for(let o=0;o{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)i=!0;else{let f=n.doc.resolve(d),h=f.index();i=f.parent.canReplaceWith(h,h+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s=2&&i.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let f=n.doc.resolve(s.start-2);c=new $i(f,f,s.depth),s.endIndex=0;f--)o=G.from(n[f].type.create(n[f].attrs,o));t.step(new Tt(e.start-(r?2:0),e.end,e.start,e.end,new Z(o,0,0),n.length,!0));let s=0;for(let f=0;fs.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?RI(e,n,t,o):II(e,n,o):!0:!1}}function RI(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);ow;y--)b-=i.child(y).nodeSize,r.delete(b-1,b+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==i.childCount,d=o.node(-1),f=o.index(-1);if(!d.canReplace(f+(l?0:1),f+1,s.content.append(c?G.empty:G.from(i))))return!1;let h=o.pos,m=h+s.nodeSize;return r.step(new Tt(h-(l?1:0),m+(c?1:0),h+1,m-1,new Z((l?G.empty:G.from(i.copy(G.empty))).append(c?G.empty:G.from(i.copy(G.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function kE(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,c=l.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==l.type,f=G.from(d?t.create():null),h=new Z(G.from(t.create(null,G.from(l.type.create(null,f)))),d?3:1,0),m=o.start,b=o.end;n(e.tr.step(new Tt(m-(d?3:1),b,m,b,h,1,!0)).scrollIntoView())}return!0}}function ec(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var Vo=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...f)=>{let h=c(...f)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l=[],c=!!e,d=e||o.tr,f=()=>(!c&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),l.every(m=>m===!0)),h={...Object.fromEntries(Object.entries(r).map(([m,b])=>[m,(...w)=>{let _=this.buildProps(d,n),S=b(...w)(_);return l.push(S),h}])),run:f};return h}createCan(e){let{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([c,d])=>[c,(...f)=>d(...f)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l={tr:e,editor:i,view:s,state:ec({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([c,d])=>[c,(...f)=>d(...f)(l)]))}};return l}},hp=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){let r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){let r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function ne(t,e,n){return t.config[e]===void 0&&t.parent?ne(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ne(t.parent,e,n):null}):t.config[e]}function tc(t){let e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function BE(t){let e=[],{nodeExtensions:n,markExtensions:r}=tc(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage,extensions:i},c=ne(s,"addGlobalAttributes",l);if(!c)return;c().forEach(f=>{f.types.forEach(h=>{Object.entries(f.attributes).forEach(([m,b])=>{e.push({type:h,name:m,attribute:{...o,...b}})})})})}),i.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage},c=ne(s,"addAttributes",l);if(!c)return;let d=c();Object.entries(d).forEach(([f,h])=>{let m={...o,...h};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:s.name,name:f,attribute:m})})}),e}function zt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Q(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){let l=o?o.split(" "):[],c=r[i]?r[i].split(" "):[],d=l.filter(f=>!c.includes(f));r[i]=[...c,...d].join(" ")}else if(i==="style"){let l=o?o.split(";").map(f=>f.trim()).filter(Boolean):[],c=r[i]?r[i].split(";").map(f=>f.trim()).filter(Boolean):[],d=new Map;c.forEach(f=>{let[h,m]=f.split(":").map(b=>b.trim());d.set(h,m)}),l.forEach(f=>{let[h,m]=f.split(":").map(b=>b.trim());d.set(h,m)}),r[i]=Array.from(d.entries()).map(([f,h])=>`${f}: ${h}`).join("; ")}else r[i]=o}),r},{})}function mp(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Q(n,r),{})}function FE(t){return typeof t=="function"}function Te(t,e=void 0,...n){return FE(t)?e?t.bind(e)(...n):t(...n):t}function DI(t={}){return Object.keys(t).length===0&&t.constructor===Object}function LI(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function OE(t,e){return"style"in t?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let i=e.reduce((o,s)=>{let l=s.attribute.parseHTML?s.attribute.parseHTML(n):LI(n.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function RE(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&DI(n)?!1:n!=null))}function PI(t,e){var n;let r=BE(t),{nodeExtensions:i,markExtensions:o}=tc(t),s=(n=i.find(d=>ne(d,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(d=>{let f=r.filter(S=>S.type===d.name),h={name:d.name,options:d.options,storage:d.storage,editor:e},m=t.reduce((S,L)=>{let D=ne(L,"extendNodeSchema",h);return{...S,...D?D(d):{}}},{}),b=RE({...m,content:Te(ne(d,"content",h)),marks:Te(ne(d,"marks",h)),group:Te(ne(d,"group",h)),inline:Te(ne(d,"inline",h)),atom:Te(ne(d,"atom",h)),selectable:Te(ne(d,"selectable",h)),draggable:Te(ne(d,"draggable",h)),code:Te(ne(d,"code",h)),whitespace:Te(ne(d,"whitespace",h)),defining:Te(ne(d,"defining",h)),isolating:Te(ne(d,"isolating",h)),attrs:Object.fromEntries(f.map(S=>{var L;return[S.name,{default:(L=S?.attribute)===null||L===void 0?void 0:L.default}]}))}),y=Te(ne(d,"parseHTML",h));y&&(b.parseDOM=y.map(S=>OE(S,f)));let w=ne(d,"renderHTML",h);w&&(b.toDOM=S=>w({node:S,HTMLAttributes:mp(S,f)}));let _=ne(d,"renderText",h);return _&&(b.toText=_),[d.name,b]})),c=Object.fromEntries(o.map(d=>{let f=r.filter(_=>_.type===d.name),h={name:d.name,options:d.options,storage:d.storage,editor:e},m=t.reduce((_,S)=>{let L=ne(S,"extendMarkSchema",h);return{..._,...L?L(d):{}}},{}),b=RE({...m,inclusive:Te(ne(d,"inclusive",h)),excludes:Te(ne(d,"excludes",h)),group:Te(ne(d,"group",h)),spanning:Te(ne(d,"spanning",h)),code:Te(ne(d,"code",h)),attrs:Object.fromEntries(f.map(_=>{var S;return[_.name,{default:(S=_?.attribute)===null||S===void 0?void 0:S.default}]}))}),y=Te(ne(d,"parseHTML",h));y&&(b.parseDOM=y.map(_=>OE(_,f)));let w=ne(d,"renderHTML",h);return w&&(b.toDOM=_=>w({mark:_,HTMLAttributes:mp(_,f)})),[d.name,b]}));return new Ls({topNode:s,nodes:l,marks:c})}function dp(t,e){return e.nodes[t]||e.marks[t]||null}function IE(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}var BI=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var c,d;let f=((d=(c=i.type.spec).toText)===null||d===void 0?void 0:d.call(c,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?f:f.slice(0,Math.max(0,r-o))}),n};function xp(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var Go=class{constructor(e){this.find=e.find,this.handler=e.handler}},FI=(t,e)=>{if(xp(e))return e.exec(t);let n=e(t);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ql(t){var e;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=t,{view:c}=n;if(c.composing)return!1;let d=c.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(m=>m.type.spec.code))return!1;let f=!1,h=BI(d)+o;return s.forEach(m=>{if(f)return;let b=FI(h,m.find);if(!b)return;let y=c.state.tr,w=ec({state:c.state,transaction:y}),_={from:r-(b[0].length-o.length),to:i},{commands:S,chain:L,can:D}=new Vo({editor:n,state:w});m.handler({state:w,range:_,match:b,commands:S,chain:L,can:D})===null||!y.steps.length||(y.setMeta(l,{transform:y,from:r,to:i,text:o}),c.dispatch(y),f=!0)}),f}function HI(t){let{editor:e,rules:n}=t,r=new ke({state:{init(){return null},apply(i,o){let s=i.getMeta(r);if(s)return s;let l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{from:d,text:f}=l,h=d+f.length;ql({editor:e,from:d,to:h,text:f,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return ql({editor:e,from:o,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&ql({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;let{$cursor:s}=i.state.selection;return s?ql({editor:e,from:s.pos,to:s.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function $I(t){return Object.prototype.toString.call(t).slice(8,-1)}function Yl(t){return $I(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function nc(t,e){let n={...t};return Yl(t)&&Yl(e)&&Object.keys(e).forEach(r=>{Yl(e[r])&&Yl(t[r])?n[r]=nc(t[r],e[r]):n[r]=e[r]}),n}var st=class t{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Te(ne(this,"addOptions",{name:this.name}))),this.storage=Te(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>nc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Te(ne(n,"addOptions",{name:n.name})),n.storage=Te(ne(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){let s=i.marks();if(!!!s.find(d=>d?.type.name===n.name))return!1;let c=s.find(d=>d?.type.name===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}};function zI(t){return typeof t=="number"}var gp=class{constructor(e){this.find=e.find,this.handler=e.handler}},UI=(t,e,n)=>{if(xp(e))return[...t.matchAll(e)];let r=e(t,n);return r?r.map(i=>{let o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function WI(t){let{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:d,can:f}=new Vo({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,i,(b,y)=>{if(!b.isTextblock||b.type.spec.code)return;let w=Math.max(r,y),_=Math.min(i,y+b.content.size),S=b.textBetween(w-y,_-y,void 0,"\uFFFC");UI(S,o.find,s).forEach(D=>{if(D.index===void 0)return;let T=w+D.index+1,$=T+D[0].length,O={from:n.tr.mapping.map(T),to:n.tr.mapping.map($)},Y=o.handler({state:n,range:O,match:D,commands:c,chain:d,can:f,pasteEvent:s,dropEvent:l});h.push(Y)})}),h.every(b=>b!==null)}var KI=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function VI(t){let{editor:e,rules:n}=t,r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l=typeof DragEvent<"u"?new DragEvent("drop"):null,c=({state:f,from:h,to:m,rule:b,pasteEvt:y})=>{let w=f.tr,_=ec({state:f,transaction:w});if(!(!WI({editor:e,state:_,from:Math.max(h-1,0),to:m.b-1,rule:b,pasteEvent:y,dropEvent:l})||!w.steps.length))return l=typeof DragEvent<"u"?new DragEvent("drop"):null,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w};return n.map(f=>new ke({view(h){let m=b=>{var y;r=!((y=h.dom.parentElement)===null||y===void 0)&&y.contains(b.target)?h.dom.parentElement:null};return window.addEventListener("dragstart",m),{destroy(){window.removeEventListener("dragstart",m)}}},props:{handleDOMEvents:{drop:(h,m)=>(o=r===h.dom.parentElement,l=m,!1),paste:(h,m)=>{var b;let y=(b=m.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return s=m,i=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(h,m,b)=>{let y=h[0],w=y.getMeta("uiEvent")==="paste"&&!i,_=y.getMeta("uiEvent")==="drop"&&!o,S=y.getMeta("applyPasteRules"),L=!!S;if(!w&&!_&&!L)return;if(L){let{from:$,text:O}=S,Y=$+O.length,ee=KI(O);return c({rule:f,state:b,from:$,to:{b:Y},pasteEvt:ee})}let D=m.doc.content.findDiffStart(b.doc.content),T=m.doc.content.findDiffEnd(b.doc.content);if(!(!zI(D)||!T||D===T.b))return c({rule:f,state:b,from:D,to:T,pasteEvt:s})}}))}function GI(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}var bp=class t{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=t.resolve(e),this.schema=PI(this.extensions,n),this.setupExtensions()}static resolve(e){let n=t.sort(t.flatten(e)),r=GI(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{let r={name:n.name,options:n.options,storage:n.storage},i=ne(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{let o=ne(r,"priority")||100,s=ne(i,"priority")||100;return o>s?-1:o{let r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:dp(n.name,this.schema)},i=ne(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){let{editor:e}=this,n=t.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{let l={name:s.name,options:s.options,storage:s.storage,editor:e,type:dp(s.name,this.schema)},c=[],d=ne(s,"addKeyboardShortcuts",l),f={};if(s.type==="mark"&&ne(s,"exitable",l)&&(f.ArrowRight=()=>st.handleExit({editor:e,mark:s})),d){let w=Object.fromEntries(Object.entries(d()).map(([_,S])=>[_,()=>S({editor:e})]));f={...f,...w}}let h=hE(f);c.push(h);let m=ne(s,"addInputRules",l);IE(s,e.options.enableInputRules)&&m&&r.push(...m());let b=ne(s,"addPasteRules",l);IE(s,e.options.enablePasteRules)&&b&&i.push(...b());let y=ne(s,"addProseMirrorPlugins",l);if(y){let w=y();c.push(...w)}return c}).flat();return[HI({editor:e,rules:r}),...VI({editor:e,rules:i}),...o]}get attributes(){return BE(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:n}=tc(this.extensions);return Object.fromEntries(n.filter(r=>!!ne(r,"addNodeView")).map(r=>{let i=this.attributes.filter(c=>c.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:zt(r.name,this.schema)},s=ne(r,"addNodeView",o);if(!s)return[];let l=(c,d,f,h,m)=>{let b=mp(c,i);return s()({node:c,view:d,getPos:f,decorations:h,innerDecorations:m,editor:e,extension:r,HTMLAttributes:b})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;let r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:dp(e.name,this.schema)};e.type==="mark"&&(!((n=Te(ne(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);let i=ne(e,"onBeforeCreate",r),o=ne(e,"onCreate",r),s=ne(e,"onUpdate",r),l=ne(e,"onSelectionUpdate",r),c=ne(e,"onTransaction",r),d=ne(e,"onFocus",r),f=ne(e,"onBlur",r),h=ne(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),f&&this.editor.on("blur",f),h&&this.editor.on("destroy",h)})}},We=class t{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Te(ne(this,"addOptions",{name:this.name}))),this.storage=Te(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>nc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Te(ne(n,"addOptions",{name:n.name})),n.storage=Te(ne(n,"addStorage",{name:n.name,options:n.options})),n}};function HE(t,e,n){let{from:r,to:i}=e,{blockSeparator:o=` - -`,textSerializers:s={}}=n||{},l="";return t.nodesBetween(r,i,(c,d,f,h)=>{var m;c.isBlock&&d>r&&(l+=o);let b=s?.[c.type.name];if(b)return f&&(l+=b({node:c,pos:d,parent:f,index:h,range:e})),!1;c.isText&&(l+=(m=c?.text)===null||m===void 0?void 0:m.slice(Math.max(r,d)-d,i-d))}),l}function $E(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}var qI=We.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ke({key:new ze("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(f=>f.$from.pos)),l=Math.max(...o.map(f=>f.$to.pos)),c=$E(n);return HE(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),YI=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),JI=(t=!1)=>({commands:e})=>e.setContent("",t),XI=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(l,c)=>{if(l.type.isText)return;let{doc:d,mapping:f}=e,h=d.resolve(f.map(c)),m=d.resolve(f.map(c+l.nodeSize)),b=h.blockRange(m);if(!b)return;let y=Pr(b);if(l.type.isTextblock){let{defaultType:w}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(b.start,w)}(y||y===0)&&e.lift(b,y)})}),!0},ZI=t=>e=>t(e),jI=()=>({state:t,dispatch:e})=>op(t,e),QI=(t,e)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new le(r.doc.resolve(s-1))),!0},eD=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){let l=i.before(o),c=i.after(o);t.delete(l,c).scrollIntoView()}return!0}return!1},tD=t=>({tr:e,state:n,dispatch:r})=>{let i=zt(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){let c=o.before(s),d=o.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},nD=t=>({tr:e,dispatch:n})=>{let{from:r,to:i}=t;return n&&e.delete(r,i),!0},rD=()=>({state:t,dispatch:e})=>Gl(t,e),iD=()=>({commands:t})=>t.keyboardShortcut("Enter"),oD=()=>({state:t,dispatch:e})=>ip(t,e);function Zl(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:xp(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function yp(t,e,n={}){return t.find(r=>r.type===e&&Zl(r.attrs,n))}function sD(t,e,n={}){return!!yp(t,e,n)}function _p(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e))return;let i=yp([...r.node.marks],e,n);if(!i)return;let o=r.index,s=t.start()+r.offset,l=o+1,c=s+r.node.nodeSize;for(yp([...r.node.marks],e,n);o>0&&i.isInSet(t.parent.child(o-1).marks);)o-=1,s-=t.parent.child(o).nodeSize;for(;l({tr:n,state:r,dispatch:i})=>{let o=gi(t,r.schema),{doc:s,selection:l}=n,{$from:c,from:d,to:f}=l;if(i){let h=_p(c,o,e);if(h&&h.from<=d&&h.to>=f){let m=le.create(s,h.from,h.to);n.setSelection(m)}}return!0},lD=t=>e=>{let n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};let s=()=>{Sp()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!rc(n.state.selection))return s(),!0;let l=zE(i.doc,t)||n.state.selection,c=n.state.selection.eq(l);return o&&(c||i.setSelection(l),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},uD=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),dD=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),UE=t=>{let e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){let r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&UE(r)}return t};function Jl(t){let e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return UE(n)}function jl(t,e,n){n={slice:!0,parseOptions:{},...n};let r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return G.fromArray(t.map(l=>e.nodeFromJSON(l)));let s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),jl("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,l="",c=new Ls({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?Ir.fromSchema(c).parseSlice(Jl(t),n.parseOptions):Ir.fromSchema(c).parse(Jl(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let o=Ir.fromSchema(e);return n.slice?o.parseSlice(Jl(t),n.parseOptions).content:o.parse(Jl(t),n.parseOptions)}return jl("",e,n)}function fD(t,e,n){let r=t.steps.length-1;if(r{s===0&&(s=f)}),t.setSelection(ue.near(t.doc.resolve(s),n))}var pD=t=>!("type"in t),hD=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;try{l=jl(e,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(y){return o.emit("contentError",{editor:o,error:y,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((pD(l)?l:[l]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),c===d&&h){let{parent:y}=r.doc.resolve(c);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(c-=1,d+=1)}let b;f?(Array.isArray(e)?b=e.map(y=>y.text||"").join(""):typeof e=="object"&&e&&e.text?b=e.text:b=e,r.insertText(b,c,d)):(b=l,r.replaceWith(c,d,b)),n.updateSelection&&fD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:b}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:b})}return!0},mD=()=>({state:t,dispatch:e})=>wE(t,e),gD=()=>({state:t,dispatch:e})=>xE(t,e),bD=()=>({state:t,dispatch:e})=>Xf(t,e),yD=()=>({state:t,dispatch:e})=>Qf(t,e),ED=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Lo(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},vD=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Lo(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},wD=()=>({state:t,dispatch:e})=>bE(t,e),xD=()=>({state:t,dispatch:e})=>yE(t,e);function WE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function _D(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let l=0;l({editor:e,view:n,tr:r,dispatch:i})=>{let o=_D(t).split(/-(?!$)/),s=o.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return c?.steps.forEach(d=>{let f=d.map(r.mapping);f&&i&&r.maybeStep(f)}),!0};function ta(t,e,n={}){let{from:r,to:i,empty:o}=t.selection,s=e?zt(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(h,m)=>{if(h.isText)return;let b=Math.max(r,m),y=Math.min(i,m+h.nodeSize);l.push({node:h,from:b,to:y})});let c=i-r,d=l.filter(h=>s?s.name===h.node.type.name:!0).filter(h=>Zl(h.node.attrs,n,{strict:!1}));return o?!!d.length:d.reduce((h,m)=>h+m.to-m.from,0)>=c}var TD=(t,e={})=>({state:n,dispatch:r})=>{let i=zt(t,n.schema);return ta(n,i,e)?_E(n,r):!1},CD=()=>({state:t,dispatch:e})=>sp(t,e),AD=t=>({state:e,dispatch:n})=>{let r=zt(t,e.schema);return NE(r)(e,n)},MD=()=>({state:t,dispatch:e})=>np(t,e);function ic(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function DE(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var ND=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=ic(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(o=zt(t,r.schema)),l==="mark"&&(s=gi(t,r.schema)),i&&n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,f)=>{o&&o===d.type&&n.setNodeMarkup(f,void 0,DE(d.attrs,e)),s&&d.marks.length&&d.marks.forEach(h=>{s===h.type&&n.addMark(f,f+d.nodeSize,s.create(DE(h.attrs,e)))})})}),!0):!1},kD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),OD=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),RD=()=>({state:t,dispatch:e})=>Zf(t,e),ID=()=>({state:t,dispatch:e})=>ep(t,e),DD=()=>({state:t,dispatch:e})=>SE(t,e),LD=()=>({state:t,dispatch:e})=>lp(t,e),PD=()=>({state:t,dispatch:e})=>ap(t,e);function Ep(t,e,n={},r={}){return jl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var BD=(t,e=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{var c,d;let{doc:f}=o;if(n.preserveWhitespace!=="full"){let h=Ep(t,i.schema,n,{errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck});return s&&o.replaceWith(0,f.content.size,h).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:f.content.size},t,{parseOptions:n,errorOnInvalidContent:(d=r.errorOnInvalidContent)!==null&&d!==void 0?d:i.options.enableContentCheck})};function oc(t,e){let n=gi(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,c=>{s.push(...c.marks)});let l=s.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function KE(t,e){let n=new li(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function Tp(t){for(let e=0;e{e(r)&&n.push({node:r,pos:i})}),n}function VE(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function Cp(t,e){for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Qi(t){return e=>Cp(e.$from,t)}function FD(t,e){let n=Dr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function HD(t,e){let n={from:0,to:t.content.size};return HE(t,n,e)}function $D(t,e){let n=zt(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,l=>{o.push(l)});let s=o.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Ap(t,e){let n=ic(typeof e=="string"?e:e.name,t.schema);return n==="node"?$D(t,e):n==="mark"?oc(t,e):{}}function zD(t,e=JSON.stringify){let n={};return t.filter(r=>{let i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function UD(t){let e=zD(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,s)=>s!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function GE(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{let s=[];if(i.ranges.length)i.forEach((l,c)=>{s.push({from:l,to:c})});else{let{from:l,to:c}=n[o];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{let d=e.slice(o).map(l,-1),f=e.slice(o).map(c),h=e.invert().map(d,-1),m=e.invert().map(f);r.push({oldRange:{from:h,to:m},newRange:{from:d,to:f}})})}),UD(r)}function sc(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(i=>{let o=n.resolve(t),s=_p(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Xl(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function vp(t,e,n={}){let{empty:r,ranges:i}=t.selection,o=e?gi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(h=>o?o.name===h.type.name:!0).find(h=>Zl(h.attrs,n,{strict:!1}));let s=0,l=[];if(i.forEach(({$from:h,$to:m})=>{let b=h.pos,y=m.pos;t.doc.nodesBetween(b,y,(w,_)=>{if(!w.isText&&!w.marks.length)return;let S=Math.max(b,_),L=Math.min(y,_+w.nodeSize),D=L-S;s+=D,l.push(...w.marks.map(T=>({mark:T,from:S,to:L})))})}),s===0)return!1;let c=l.filter(h=>o?o.name===h.mark.type.name:!0).filter(h=>Zl(h.mark.attrs,n,{strict:!1})).reduce((h,m)=>h+m.to-m.from,0),d=l.filter(h=>o?h.mark.type!==o&&h.mark.type.excludes(o):!0).reduce((h,m)=>h+m.to-m.from,0);return(c>0?c+d:c)>=s}function Ur(t,e,n={}){if(!e)return ta(t,null,n)||vp(t,null,n);let r=ic(e,t.schema);return r==="node"?ta(t,e,n):r==="mark"?vp(t,e,n):!1}function LE(t,e){let{nodeExtensions:n}=tc(e),r=n.find(s=>s.name===t);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=Te(ne(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function na(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(na(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function ac(t){return t instanceof pe}function lc(t,e,n){let i=t.state.doc.content.size,o=zr(e,0,i),s=zr(n,0,i),l=t.coordsAtPos(o),c=t.coordsAtPos(s,-1),d=Math.min(l.top,c.top),f=Math.max(l.bottom,c.bottom),h=Math.min(l.left,c.left),m=Math.max(l.right,c.right),b=m-h,y=f-d,S={top:d,bottom:f,left:h,right:m,width:b,height:y,x:h,y:d};return{...S,toJSON:()=>S}}function WD(t,e,n){var r;let{selection:i}=e,o=null;if(rc(i)&&(o=i.$cursor),o){let l=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(l)||!l.some(c=>c.type.excludes(n))}let{ranges:s}=i;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(f,h,m)=>{if(d)return!1;if(f.isInline){let b=!m||m.type.allowsMarkType(n),y=!!n.isInSet(f.marks)||!f.marks.some(w=>w.type.excludes(n));d=b&&y}return!d}),d})}var KD=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:l}=o,c=gi(t,r.schema);if(i)if(s){let d=oc(r,c);n.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{let f=d.$from.pos,h=d.$to.pos;r.doc.nodesBetween(f,h,(m,b)=>{let y=Math.max(b,f),w=Math.min(b+m.nodeSize,h);m.marks.find(S=>S.type===c)?m.marks.forEach(S=>{c===S.type&&n.addMark(y,w,c.create({...S.attrs,...e}))}):n.addMark(y,w,c.create(e))})});return WD(r,n,c)},VD=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),GD=(t,e={})=>({state:n,dispatch:r,chain:i})=>{let o=zt(t,n.schema);return o.isTextblock?i().command(({commands:s})=>cp(o,e)(n)?!0:s.clearNodes()).command(({state:s})=>cp(o,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},qD=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,i=zr(t,0,r.content.size),o=pe.create(r,i);e.setSelection(o)}return!0},YD=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=le.atStart(r).from,l=le.atEnd(r).to,c=zr(i,s,l),d=zr(o,s,l),f=le.create(r,c,d);e.setSelection(f)}return!0},JD=t=>({state:e,dispatch:n})=>{let r=zt(t,e.schema);return kE(r)(e,n)};function PE(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var XD=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=e,{$from:l,$to:c}=o,d=i.extensionManager.attributes,f=Xl(d,l.node().type.name,l.node().attrs);if(o instanceof pe&&o.node.isBlock)return!l.parentOffset||!Hn(s,l.pos)?!1:(r&&(t&&PE(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let h=c.parentOffset===c.parent.content.size,m=l.depth===0?void 0:Tp(l.node(-1).contentMatchAt(l.indexAfter(-1))),b=h&&m?[{type:m,attrs:f}]:void 0,y=Hn(e.doc,e.mapping.map(l.pos),1,b);if(!b&&!y&&Hn(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(y=!0,b=m?[{type:m,attrs:f}]:void 0),r){if(y&&(o instanceof le&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,b),m&&!h&&!l.parentOffset&&l.parent.type!==m)){let w=e.mapping.map(l.before()),_=e.doc.resolve(w);l.node(-1).canReplaceWith(_.index(),_.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&PE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return y},ZD=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let l=zt(t,r.schema),{$from:c,$to:d}=r.selection,f=r.selection.node;if(f&&f.isBlock||c.depth<2||!c.sameParent(d))return!1;let h=c.node(-1);if(h.type!==l)return!1;let m=o.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let S=G.empty,L=c.index(-1)?1:c.index(-2)?2:3;for(let ee=c.depth-L;ee>=c.depth-3;ee-=1)S=G.from(c.node(ee).copy(S));let D=c.indexAfter(-1){if(Y>-1)return!1;ee.isTextblock&&ee.content.size===0&&(Y=z+1)}),Y>-1&&n.setSelection(le.near(n.doc.resolve(Y))),n.scrollIntoView()}return!0}let b=d.pos===c.end()?h.contentMatchAt(0).defaultType:null,y={...Xl(m,h.type.name,h.attrs),...e},w={...Xl(m,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);let _=b?[{type:l,attrs:y},{type:b,attrs:w}]:[{type:l,attrs:y}];if(!Hn(n.doc,c.pos,2))return!1;if(i){let{selection:S,storedMarks:L}=r,{splittableMarks:D}=o.extensionManager,T=L||S.$to.parentOffset&&S.$from.marks();if(n.split(c.pos,2,_).scrollIntoView(),!T||!i)return!0;let $=T.filter(O=>D.includes(O.type.name));n.ensureMarks($)}return!0},fp=(t,e)=>{let n=Qi(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=t.doc.nodeAt(r);return n.node.type===i?.type&&nr(t.doc,n.pos)&&t.join(n.pos),!0},pp=(t,e)=>{let n=Qi(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=t.doc.nodeAt(r);return n.node.type===i?.type&&nr(t.doc,r)&&t.join(r),!0},jD=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:c,commands:d,can:f})=>{let{extensions:h,splittableMarks:m}=i.extensionManager,b=zt(t,s.schema),y=zt(e,s.schema),{selection:w,storedMarks:_}=s,{$from:S,$to:L}=w,D=S.blockRange(L),T=_||w.$to.parentOffset&&w.$from.marks();if(!D)return!1;let $=Qi(O=>LE(O.type.name,h))(w);if(D.depth>=1&&$&&D.depth-$.depth<=1){if($.node.type===b)return d.liftListItem(y);if(LE($.node.type.name,h)&&b.validContent($.node.content)&&l)return c().command(()=>(o.setNodeMarkup($.pos,b),!0)).command(()=>fp(o,b)).command(()=>pp(o,b)).run()}return!n||!T||!l?c().command(()=>f().wrapInList(b,r)?!0:d.clearNodes()).wrapInList(b,r).command(()=>fp(o,b)).command(()=>pp(o,b)).run():c().command(()=>{let O=f().wrapInList(b,r),Y=T.filter(ee=>m.includes(ee.type.name));return o.ensureMarks(Y),O?!0:d.clearNodes()}).wrapInList(b,r).command(()=>fp(o,b)).command(()=>pp(o,b)).run()},QD=(t,e={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=gi(t,r.schema);return vp(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},eL=(t,e,n={})=>({state:r,commands:i})=>{let o=zt(t,r.schema),s=zt(e,r.schema),l=ta(r,o,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),l?i.setNode(s,c):i.setNode(o,{...c,...n})},tL=(t,e={})=>({state:n,commands:r})=>{let i=zt(t,n.schema);return ta(n,i,e)?r.lift(i):r.wrapIn(i,e)},nL=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(o.text){let c=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,c))}else s.delete(o.from,o.to)}return!0}}return!1},rL=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},iL=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=gi(t,r.schema),{$from:d,empty:f,ranges:h}=l;if(!i)return!0;if(f&&s){let{from:m,to:b}=l,y=(o=d.marks().find(_=>_.type===c))===null||o===void 0?void 0:o.attrs,w=_p(d,c,y);w&&(m=w.from,b=w.to),n.removeMark(m,b,c)}else h.forEach(m=>{n.removeMark(m.$from.pos,m.$to.pos,c)});return n.removeStoredMark(c),!0},oL=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=ic(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(o=zt(t,r.schema)),l==="mark"&&(s=gi(t,r.schema)),i&&n.selection.ranges.forEach(c=>{let d=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(d,f,(h,m)=>{o&&o===h.type&&n.setNodeMarkup(m,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(b=>{if(s===b.type){let y=Math.max(m,d),w=Math.min(m+h.nodeSize,f);n.addMark(y,w,s.create({...b.attrs,...e}))}})})}),!0):!1},sL=(t,e={})=>({state:n,dispatch:r})=>{let i=zt(t,n.schema);return AE(i,e)(n,r)},aL=(t,e={})=>({state:n,dispatch:r})=>{let i=zt(t,n.schema);return ME(i,e)(n,r)},lL=Object.freeze({__proto__:null,blur:YI,clearContent:JI,clearNodes:XI,command:ZI,createParagraphNear:jI,cut:QI,deleteCurrentNode:eD,deleteNode:tD,deleteRange:nD,deleteSelection:rD,enter:iD,exitCode:oD,extendMarkRange:aD,first:lD,focus:cD,forEach:uD,insertContent:dD,insertContentAt:hD,joinBackward:bD,joinDown:gD,joinForward:yD,joinItemBackward:ED,joinItemForward:vD,joinTextblockBackward:wD,joinTextblockForward:xD,joinUp:mD,keyboardShortcut:SD,lift:TD,liftEmptyBlock:CD,liftListItem:AD,newlineInCode:MD,resetAttributes:ND,scrollIntoView:kD,selectAll:OD,selectNodeBackward:RD,selectNodeForward:ID,selectParentNode:DD,selectTextblockEnd:LD,selectTextblockStart:PD,setContent:BD,setMark:KD,setMeta:VD,setNode:GD,setNodeSelection:qD,setTextSelection:YD,sinkListItem:JD,splitBlock:XD,splitListItem:ZD,toggleList:jD,toggleMark:QD,toggleNode:eL,toggleWrap:tL,undoInputRule:nL,unsetAllMarks:rL,unsetMark:iL,updateAttributes:oL,wrapIn:sL,wrapInList:aL}),cL=We.create({name:"commands",addCommands(){return{...lL}}}),uL=We.create({name:"drop",addProseMirrorPlugins(){return[new ke({key:new ze("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),dL=We.create({name:"editable",addProseMirrorPlugins(){return[new ke({key:new ze("editable"),props:{editable:()=>this.editor.options.editable}})]}}),fL=We.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new ke({key:new ze("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),pL=We.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{let{selection:c,doc:d}=l,{empty:f,$anchor:h}=c,{pos:m,parent:b}=h,y=h.parent.isTextblock&&m>0?l.doc.resolve(m-1):h,w=y.parent.type.spec.isolating,_=h.pos-h.parentOffset,S=w&&y.parent.childCount===1?_===h.pos:ue.atStart(d).from===m;return!f||!b.type.isTextblock||b.textContent.length||!S||S&&h.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Sp()||WE()?o:i},addProseMirrorPlugins(){return[new ke({key:new ze("clearDocument"),appendTransaction:(t,e,n)=>{let r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),i=t.some(w=>w.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:l}=e.selection,c=ue.atStart(e.doc).from,d=ue.atEnd(e.doc).to;if(o||!(s===c&&l===d)||!na(n.doc))return;let m=n.tr,b=ec({state:n,transaction:m}),{commands:y}=new Vo({editor:this.editor,state:b});if(y.clearNodes(),!!m.steps.length)return m}})]}}),hL=We.create({name:"paste",addProseMirrorPlugins(){return[new ke({key:new ze("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),mL=We.create({name:"tabindex",addProseMirrorPlugins(){return[new ke({key:new ze("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var wp=class t{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new t(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new t(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new t(e,this.editor)}get children(){let e=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1),l=this.resolvedPos.doc.resolve(s);if(!i&&l.depth<=this.depth)return;let c=new t(l,this.editor,i,i?n:null);i&&(c.actualDepth=this.depth+1),e.push(new t(l,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){let o=i.node.attrs,s=Object.keys(n);for(let l=0;l{r&&i.length>0||(s.node.type.name===e&&o.every(c=>n[c]===s.node.attrs[c])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},gL=`.ProseMirror { +}`;var Le=ay(function(){return Ye(_,de+"return "+q).apply(t,C)});if(Le.source=q,Hd(Le))throw Le;return Le}function ak(a){return Xe(a).toLowerCase()}function lk(a){return Xe(a).toUpperCase()}function ck(a,c,p){if(a=Xe(a),a&&(p||c===t))return gg(a);if(!a||!(c=Tn(c)))return a;var g=Zn(a),E=Zn(c),_=bg(g,E),C=yg(g,E)+1;return si(g,_,C).join("")}function uk(a,c,p){if(a=Xe(a),a&&(p||c===t))return a.slice(0,vg(a)+1);if(!a||!(c=Tn(c)))return a;var g=Zn(a),E=yg(g,Zn(c))+1;return si(g,0,E).join("")}function dk(a,c,p){if(a=Xe(a),a&&(p||c===t))return a.replace(Hu,"");if(!a||!(c=Tn(c)))return a;var g=Zn(a),E=bg(g,Zn(c));return si(g,E).join("")}function fk(a,c){var p=ee,g=z;if(dt(c)){var E="separator"in c?c.separator:E;p="length"in c?Re(c.length):p,g="omission"in c?Tn(c.omission):g}a=Xe(a);var _=a.length;if(wo(a)){var C=Zn(a);_=C.length}if(p>=_)return a;var M=p-xo(g);if(M<1)return g;var k=C?si(C,0,M).join(""):a.slice(0,M);if(E===t)return k+g;if(C&&(M+=k.length-M),$d(E)){if(a.slice(M).search(E)){var U,W=k;for(E.global||(E=nd(E.source,Xe(Fm.exec(E))+"g")),E.lastIndex=0;U=E.exec(W);)var q=U.index;k=k.slice(0,q===t?M:q)}}else if(a.indexOf(Tn(E),M)!=M){var te=k.lastIndexOf(E);te>-1&&(k=k.slice(0,te))}return k+g}function pk(a){return a=Xe(a),a&&Jr.test(a)?a.replace(Bt,UT):a}var hk=Mo(function(a,c,p){return a+(p?" ":"")+c.toUpperCase()}),Wd=lb("toUpperCase");function sy(a,c,p){return a=Xe(a),c=p?t:c,c===t?BT(a)?VT(a):MT(a):a.match(c)||[]}var ay=He(function(a,c){try{return _n(a,t,c)}catch(p){return Hd(p)?p:new Ae(p)}}),mk=Mr(function(a,c){return Rn(c,function(p){p=fr(p),Cr(a,p,Bd(a[p],a))}),a});function gk(a){var c=a==null?0:a.length,p=ye();return a=c?at(a,function(g){if(typeof g[1]!="function")throw new In(i);return[p(g[0]),g[1]]}):[],He(function(g){for(var E=-1;++E_e)return[];var p=K,g=Zt(a,K);c=ye(c),a-=K;for(var E=Qu(g,c);++p0||c<0)?new Ue(p):(a<0?p=p.takeRight(-a):a&&(p=p.drop(a)),c!==t&&(c=Re(c),p=c<0?p.dropRight(-c):p.take(c-a)),p)},Ue.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},Ue.prototype.toArray=function(){return this.take(K)},ur(Ue.prototype,function(a,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),g=/^(?:head|last)$/.test(c),E=w[g?"take"+(c=="last"?"Right":""):c],_=g||/^find/.test(c);E&&(w.prototype[c]=function(){var C=this.__wrapped__,M=g?[1]:arguments,k=C instanceof Ue,U=M[0],W=k||Ne(C),q=function($e){var Ve=E.apply(w,Qr([$e],M));return g&&te?Ve[0]:Ve};W&&p&&typeof U=="function"&&U.length!=1&&(k=W=!1);var te=this.__chain__,de=!!this.__actions__.length,Ee=_&&!te,Le=k&&!de;if(!_&&W){C=Le?C:new Ue(this);var ve=a.apply(C,M);return ve.__actions__.push({func:al,args:[q],thisArg:t}),new Dn(ve,te)}return Ee&&Le?a.apply(this,M):(ve=this.thru(q),Ee?g?ve.value()[0]:ve.value():ve)})}),Rn(["pop","push","shift","sort","splice","unshift"],function(a){var c=Ia[a],p=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",g=/^(?:pop|shift)$/.test(a);w.prototype[a]=function(){var E=arguments;if(g&&!this.__chain__){var _=this.value();return c.apply(Ne(_)?_:[],E)}return this[p](function(C){return c.apply(Ne(C)?C:[],E)})}}),ur(Ue.prototype,function(a,c){var p=w[c];if(p){var g=p.name+"";Ze.call(To,g)||(To[g]=[]),To[g].push({name:c,func:p})}}),To[el(t,v).name]=[{name:"wrapper",func:t}],Ue.prototype.clone=p1,Ue.prototype.reverse=h1,Ue.prototype.value=m1,w.prototype.at=KA,w.prototype.chain=VA,w.prototype.commit=GA,w.prototype.next=qA,w.prototype.plant=JA,w.prototype.reverse=XA,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=ZA,w.prototype.first=w.prototype.head,ys&&(w.prototype[ys]=YA),w},ti=GT();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ft._=ti,define(function(){return ti})):Mi?((Mi.exports=ti)._=ti,Vu._=ti):Ft._=ti}).call(hs)});function Qt(t){this.content=t}Qt.prototype={constructor:Qt,find:function(t){for(var e=0;e>1}};Qt.from=function(t){if(t instanceof Qt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Qt(e)};var jd=Qt;function vy(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=vy(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function wy(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),u=s.nodeSize;if(s==l){n-=u,r-=u;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let d=0,f=Math.min(s.text.length,l.text.length);for(;de&&r(u,i+l,o||null,s)!==!1&&u.content.size){let f=l+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,i+f)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(l,u)=>{let d=l.isText?l.text.slice(Math.max(e,u)-u,n-u):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=d},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);oe)for(let o=0,s=0;se&&((sn)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),i+=l.nodeSize),s=u}return new t(r,i)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new t(i,o)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?ml(r+1,s):ml(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new t(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}};Ge.none=[];var Hi=class extends Error{},Z=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=_y(this.content,e+this.openStart,n);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(xy(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(G.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new t(e,r,i)}};Z.empty=new Z(G.empty,0,0);function xy(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(xy(o.content,e-i-1,n-i-1)))}function _y(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=_y(s.content,e-o-1,n);return l&&t.replaceChild(i,s.copy(l))}function sO(t,e,n){if(n.openStart>t.depth)throw new Hi("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Hi("Inconsistent open depths");return Sy(t,e,n,0)}function Sy(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Rs(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Bi(t.nodeAfter,r),o++));for(let l=o;li&&tf(t,e,i+1),s=r.depth>i&&tf(n,r,i+1),l=[];return Rs(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(Ty(o,s),Bi(Fi(o,Cy(t,e,n,r,i+1)),l)):(o&&Bi(Fi(o,yl(t,e,i+1)),l),Rs(e,n,i,l),s&&Bi(Fi(s,yl(n,r,i+1)),l)),Rs(r,null,i,l),new G(l)}function yl(t,e,n){let r=[];if(Rs(null,t,n,r),t.depth>n){let i=tf(t,e,n+1);Bi(Fi(i,yl(t,e,n+1)),r)}return Rs(e,null,n,r),new G(r)}function aO(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(G.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var El=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new $i(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:l,offset:u}=s.content.findIndex(o),d=o-u;if(r.push(s,l,i+u),!d||(s=s.child(l),s.isText))break;o=d-1,i+=u+1}return new t(n,r,o)}static resolveCached(e,n){let r=dy.get(e);if(r)for(let o=0;oe&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ay(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=G.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let u=i;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=G.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};tr.prototype.text=void 0;var rf=class t extends tr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ay(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Ay(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var zi=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new of(e,n);if(r.next==null)return t.empty;let i=My(r);r.next&&r.err("Unexpected trailing text");let o=gO(mO(i));return bO(o,r),o}matchType(e){for(let n=0;nd.createAndFill()));for(let d=0;d=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return o}).join(` +`)}};zi.empty=new zi(!0);var of=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function My(t){let e=[];do e.push(uO(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function uO(t){let e=[];do e.push(dO(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function dO(t){let e=hO(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=fO(t,e);else break;return e}function fy(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function fO(t,e){let n=fy(t),r=n;return t.eat(",")&&(t.next!="}"?r=fy(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function pO(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function hO(t){if(t.eat("(")){let e=My(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=pO(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function mO(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,u){let d={term:u,to:l};return e[s].push(d),d}function i(s,l){s.forEach(u=>u.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((u,d)=>u.concat(o(d,l)),[]);if(s.type=="seq")for(let u=0;;u++){let d=o(s.exprs[u],l);if(u==s.exprs.length-1)return d;i(d,l=n())}else if(s.type=="star"){let u=n();return r(l,u),i(o(s.expr,u),u),[r(u)]}else if(s.type=="plus"){let u=n();return i(o(s.expr,l),u),i(o(s.expr,u),u),[r(u)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let u=l;for(let d=0;d{t[s].forEach(({term:l,to:u})=>{if(!l)return;let d;for(let f=0;f{d||i.push([l,d=[]]),d.indexOf(f)==-1&&d.push(f)})})});let o=e[r.join(",")]=new zi(r.indexOf(t.length-1)>-1);for(let s=0;s-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Oy(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new tr(this,this.computeAttrs(e),G.from(n),Ge.setFrom(r))}createChecked(e=null,n,r){return n=G.from(n),this.checkContent(n),new tr(this,this.computeAttrs(e),n,Ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=G.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(G.empty,!0);return o?new tr(this,e,n.append(o),Ge.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[o]=new t(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function yO(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}var sf=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?yO(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Ds=class t{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Iy(e,i.attrs),this.excluded=null;let o=ky(this.attrs);this.instance=o?new Ge(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ge(this,Oy(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new t(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n-1}},Ls=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=jd.from(e.nodes),n.marks=jd.from(e.marks||{}),this.nodes=vl.compile(this.spec.nodes,this),this.marks=Ds.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=zi.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?hy(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:hy(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof vl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new rf(r,r.defaultAttrs,e,Ge.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return tr.fromJSON(this,e)}markFromJSON(e){return Ge.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function hy(t,e){let n=[];for(let r=0;r-1)&&n.push(s=u)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function EO(t){return t.tag!=null}function vO(t){return t.style!=null}var Ir=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(EO(i))this.tags.push(i);else if(vO(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new _l(this,n,!1);return r.addAll(e,Ge.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new _l(this,n,!0);return r.addAll(e,Ge.none,n.from,n.to),Z.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let u=s.getAttrs(n);if(u===!1)continue;s.attrs=u||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s{r(s=gy(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=gy(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},Dy={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},wO={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ly={ol:!0,ul:!0},wl=1,xl=2,Is=4;function my(t,e,n){return e!=null?(e?wl:0)|(e==="full"?xl:0):t&&t.whitespace=="pre"?wl|xl:n&~Is}var Ro=class{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=Ge.none,this.match=o||(s&Is?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(G.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wl)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=G.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Dy.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},_l=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,s=my(null,n.preserveWhitespace,0)|(r?Is:0);i?o=new Ro(i.type,i.attrs,Ge.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Ro(null,null,Ge.none,!0,null,s):o=new Ro(e.schema.topNodeType,null,Ge.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top;if(i.options&xl||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&wl)i.options&xl?r=r.replace(/\r\n?/g,` +`):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=e.nodeName.toLowerCase(),o;Ly.hasOwnProperty(i)&&this.parser.normalizeLists&&xO(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:wO.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,u=this.top,d=this.needsBlock;if(Dy.hasOwnProperty(i))u.content.length&&u.content[0].isInline&&this.open&&(this.open--,u=this.top),l=!0,u.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);return}let f=s&&s.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),l&&this.sync(u),this.needsBlock=d}else{let l=this.readStyles(e,n);l&&this.addElementByRule(e,s,l,s.consuming===!1?o:void 0)}}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` +`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i!u.clearMark(d)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)l=u;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(e,r);else{let u=this.enter(s,n.attrs||null,r,n.preserveWhitespace);u&&(o=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}o&&this.sync(l)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=s,!l.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o(s.type?s.type.allowsMarkType(d.type):by(d.type,e))?(u=d.addToSet(u),!1):!0),this.nodes.push(new Ro(e,n,u,i,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,u)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;u>=o;u--)if(s(l-1,u))return!0;return!1}else{let f=u>0||u==0&&i?this.nodes[u].type:r&&u>=o?r.node(u-o).type:null;if(!f||f.name!=d&&!f.isInGroup(d))return!1;u--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function xO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ly.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function _O(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function gy(t){let e={};for(let n in t)e[n]=t[n];return e}function by(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=l=>{o.push(l);for(let u=0;u{if(o.length||s.marks.length){let l=0,u=0;for(;l=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&gl(ef(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return gl(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=yy(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return yy(e.marks)}};function yy(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ef(t){return t.document||window.document}var Ey=new WeakMap;function SO(t){let e=Ey.get(t);return e===void 0&&Ey.set(t,e=TO(t)),e}function TO(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let l,u=n?t.createElementNS(n,i):t.createElement(i),d=e[1],f=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){f=2;for(let h in d)if(d[h]!=null){let m=h.indexOf(" ");m>0?u.setAttributeNS(h.slice(0,m),h.slice(m+1),d[h]):u.setAttribute(h,d[h])}}for(let h=f;hf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:y}=gl(t,m,n,r);if(u.appendChild(b),y){if(l)throw new RangeError("Multiple content holes");l=y}}}return{dom:u,contentDOM:l}}var Fy=65535,Hy=Math.pow(2,16);function CO(t,e){return t+e*Hy}function Py(t){return t&Fy}function AO(t){return(t-(t&Fy))/Hy}var $y=1,zy=2,Sl=4,Uy=8,Fs=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Uy)>0}get deletedBefore(){return(this.delInfo&($y|Sl))>0}get deletedAfter(){return(this.delInfo&(zy|Sl))>0}get deletedAcross(){return(this.delInfo&Sl)>0}},Lr=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=Py(e);if(!this.inverted)for(let i=0;ie)break;let d=this.ranges[l+o],f=this.ranges[l+s],h=u+d;if(e<=h){let m=d?e==u?-1:e==h?1:n:n,b=u+i+(m<0?0:f);if(r)return b;let y=e==(n<0?u:h)?null:CO(l/3,e-u),v=e==u?zy:e==h?$y:Sl;return(n<0?e!=u:e!=h)&&(v|=Uy),new Fs(b,v,y)}i+=f-d}return r?e+i:new Fs(e+i,0,null)}touches(e,n){let r=0,i=Py(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;le)break;let d=this.ranges[l+o],f=u+d;if(e<=f&&l==i*3)return!0;r+=this.ranges[l+s]-d}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new t;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ro&&u!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Vt.fromReplace(e,this.from,this.to,o)}invert(){return new Ui(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};$t.jsonID("addMark",$s);var Ui=class t extends $t{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Z(ff(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Vt.fromReplace(e,this.from,this.to,r)}invert(){return new $s(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};$t.jsonID("removeMark",Ui);var zs=class t extends $t{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vt.fromReplace(e,this.pos,this.pos+1,new Z(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,Z.fromJSON(e,n.slice),n.insert,!!n.structure)}};$t.jsonID("replaceAround",Tt);function uf(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function MO(t,e,n,r){let i=[],o=[],s,l;t.doc.nodesBetween(e,n,(u,d,f)=>{if(!u.isInline)return;let h=u.marks;if(!r.isInSet(h)&&f.type.allowsMarkType(r.type)){let m=Math.max(d,e),b=Math.min(d+u.nodeSize,n),y=r.addToSet(h);for(let v=0;vt.step(u)),o.forEach(u=>t.step(u))}function NO(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;o++;let u=null;if(r instanceof Ds){let d=s.marks,f;for(;f=r.isInSet(d);)(u||(u=[])).push(f),d=f.removeFromSet(d)}else r?r.isInSet(s.marks)&&(u=[r]):u=s.marks;if(u&&u.length){let d=Math.min(l+s.nodeSize,n);for(let f=0;ft.step(new Ui(s.from,s.to,s.style)))}function pf(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],l=e+1;for(let u=0;u=0;u--)t.step(s[u])}function kO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Pr(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),o=t.$from.index(r),s=t.$to.indexAfter(r);if(rn;y--)v||r.index(y)>0?(v=!0,f=G.from(r.node(y).copy(f)),h++):u--;let m=G.empty,b=0;for(let y=o,v=!1;y>n;y--)v||i.after(y+1)=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=G.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Tt(i,o,i,o,new Z(r,0,0),n.length,!0))}function LO(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let u=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,u)&&PO(t.doc,t.mapping.slice(o).map(l),r)){let d=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",y=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!y?d=!1:!b&&y&&(d=!0)}d===!1&&Ky(t,s,l,o),pf(t,t.mapping.slice(o).map(l,1),r,void 0,d===null);let f=t.mapping.slice(o),h=f.map(l,1),m=f.map(l+s.nodeSize,1);return t.step(new Tt(h,m,h+1,m-1,new Z(G.from(r.create(u,null,s.marks)),0,0),1,!0)),d===!0&&Wy(t,s,l,o),!1}})}function Wy(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let u=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function Ky(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(` +`))}})}function PO(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function BO(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Tt(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new Z(G.from(s),0,0),1,!0))}function Hn(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,f=n-2;d>o;d--,f--){let h=i.node(d),m=i.index(d);if(h.type.spec.isolating)return!1;let b=h.content.cutByIndex(m,h.childCount),y=r&&r[f+1];y&&(b=b.replaceChild(0,y.type.create(y.attrs)));let v=r&&r[f]||h;if(!h.canReplace(m+1,h.childCount)||!v.type.validContent(b))return!1}let l=i.indexAfter(o),u=r&&r[0];return i.node(o).canReplaceWith(l,l,u?u.type:i.node(o+1).type)}function FO(t,e,n=1,r){let i=t.doc.resolve(e),o=G.empty,s=G.empty;for(let l=i.depth,u=i.depth-n,d=n-1;l>u;l--,d--){o=G.from(i.node(l).copy(o));let f=r&&r[d];s=G.from(f?f.type.create(f.attrs,s):i.node(l).copy(s))}t.step(new en(e,e,new Z(o.append(s),n,n),!0))}function nr(t,e){let n=t.resolve(e),r=n.index();return Vy(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function HO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&Vy(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function $O(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let f=s.whitespace=="pre",h=!!s.contentMatch.matchType(i);f&&!h?r=!1:!f&&h&&(r=!0)}let l=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);Ky(t,f.node(),f.before(),l)}s.inlineContent&&pf(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let u=t.mapping.slice(l),d=u.map(e-n);if(t.step(new en(d,u.map(e+n,-1),Z.empty,!0)),r===!0){let f=t.doc.resolve(d);Wy(t,f.node(),f.before(),t.steps.length)}return t}function zO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,u=r.index(s)+(l>0?1:0),d=r.node(s),f=!1;if(o==1)f=d.canReplace(u,u,i);else{let h=d.contentMatchAt(u).findWrapping(i.firstChild.type);f=h&&d.canReplaceWith(u,u,h[0])}if(f)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Ws(t,e,n=e,r=Z.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Gy(i,o,r)?new en(e,n,r):new df(i,o,r).fit()}function Gy(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var df=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=G.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=G.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let u=new Z(o,s,l);return e>-1?new Tt(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new en(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=lf(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:u,match:d}=this.frontier[l],f,h=null;if(n==1&&(s?d.matchType(s.type)||(h=d.fillBefore(G.from(s),!1)):o&&u.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:h};if(n==2&&s&&(f=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:f};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=lf(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Z(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=lf(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new Z(Ps(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new Z(Ps(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let v=0;v1||u==0||v.content.size)&&(h=x,f.push(qy(v.mark(m.allowedMarks(v.marks)),d==1?u:0,d==l.childCount?b:-1)))}let y=d==l.childCount;y||(b=-1),this.placed=Bs(this.placed,n,G.from(f)),this.frontier[n].match=h,y&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,x=l;v1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n=0;l--){let{match:u,type:d}=this.frontier[l],f=cf(e,l,d,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Bs(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Bs(this.placed,this.depth,G.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=Bs(this.placed,this.frontier.length,n))}};function Ps(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ps(t.firstChild.content,e-1,n)))}function Bs(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bs(t.lastChild.content,e-1,n)))}function lf(t,e){for(let n=0;n1&&(r=r.replaceChild(0,qy(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(G.empty,!0)))),t.copy(r)}function cf(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!UO(n,o.content,s)?l:null}function UO(t,e,n){for(let r=n;r0;m--,b--){let y=i.node(m).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;s.indexOf(m)>-1?l=m:i.before(m)==b&&s.splice(1,0,-m)}let u=s.indexOf(l),d=[],f=r.openStart;for(let m=r.content,b=0;;b++){let y=m.firstChild;if(d.push(y),b==r.openStart)break;m=y.content}for(let m=f-1;m>=0;m--){let b=d[m],y=WO(b.type);if(y&&!b.sameMarkup(i.node(Math.abs(l)-1)))f=m;else if(y||!b.type.isTextblock)break}for(let m=r.openStart;m>=0;m--){let b=(m+f+1)%(r.openStart+1),y=d[b];if(y)for(let v=0;v=0&&(t.replace(e,n,r),!(t.steps.length>h));m--){let b=s[m];b<0||(e=i.before(b),n=o.after(b))}}function Yy(t,e,n,r,i){if(er){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(G.empty,!0))}return t}function VO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=zO(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Z(G.from(r),0,0))}function GO(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Jy(r,i);for(let s=0;s0&&(u||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Jy(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(oe.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}var Tl=class t extends $t{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Vt.fromReplace(e,this.pos,this.pos+1,new Z(G.from(i),0,n.isLeaf?0:1))}getMap(){return Lr.empty}invert(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}};$t.jsonID("attr",Tl);var Cl=class t extends $t{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Vt.ok(r)}getMap(){return Lr.empty}invert(e){return new t(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}};$t.jsonID("docAttr",Cl);var Io=class extends Error{};Io=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Io.prototype=Object.create(Error.prototype);Io.prototype.constructor=Io;Io.prototype.name="TransformError";var li=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hs}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Io(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Z.empty){let i=Ws(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Z(G.from(r),0,0))}delete(e,n){return this.replace(e,n,Z.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return KO(this,e,n,r),this}replaceRangeWith(e,n,r){return VO(this,e,n,r),this}deleteRange(e,n){return GO(this,e,n),this}lift(e,n){return OO(this,e,n),this}join(e,n=1){return $O(this,e,n),this}wrap(e,n){return DO(this,e,n),this}setBlockType(e,n=e,r,i=null){return LO(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return BO(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Tl(e,n,r)),this}setDocAttribute(e,n){return this.step(new Cl(e,n)),this}addNodeMark(e,n){return this.step(new zs(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Ge)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Us(e,n)),this}split(e,n=1,r){return FO(this,e,n,r),this}addMark(e,n,r){return MO(this,e,n,r),this}removeMark(e,n,r){return NO(this,e,n,r),this}clearIncompatible(e,n,r){return pf(this,e,n,r),this}};var hf=Object.create(null),ue=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Bo(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;o--){let s=n<0?Po(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Po(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Nn(e.node(0))}static atStart(e){return Po(e,e,0,0,1)||new Nn(e)}static atEnd(e){return Po(e,e,e.content.size,e.childCount,-1)||new Nn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=hf[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in hf)throw new RangeError("Duplicate use of selection JSON ID "+e);return hf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return le.between(this.$anchor,this.$head).getBookmark()}};ue.prototype.visible=!0;var Bo=class{constructor(e,n){this.$from=e,this.$to=n}},Xy=!1;function Zy(t){!Xy&&!t.parent.inlineContent&&(Xy=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var le=class t extends ue{constructor(e,n=e){Zy(e),Zy(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ue.near(r);let i=e.resolve(n.map(this.anchor));return new t(i.parent.inlineContent?i:r,r)}replace(e,n=Z.empty){if(super.replace(e,n),n==Z.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Nl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=ue.findFrom(n,r,!0)||ue.findFrom(n,-r,!0);if(o)n=o.$head;else return ue.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ue.findFrom(e,-r,!0)||ue.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?s=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&pe.isSelectable(l))return pe.create(t,n-(i<0?l.nodeSize:0))}else{let u=Po(t,l,n+i,i<0?l.childCount:0,i,o);if(u)return u}n+=l.nodeSize*i}return null}function jy(t,e,n){let r=t.steps.length-1;if(r{s==null&&(s=f)}),t.setSelection(ue.near(t.doc.resolve(s),n))}var Qy=1,Ml=2,e0=4,bf=class extends li{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ml,this}ensureMarks(e){return Ge.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ml)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ml,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ge.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(ue.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=e0,this}get scrolledIntoView(){return(this.updated&e0)>0}};function t0(t,e){return!e||!t?t:t.bind(e)}var Wi=class{constructor(e,n,r){this.name=e,this.init=t0(n.init,r),this.apply=t0(n.apply,r)}},YO=[new Wi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Wi("selection",{init(t,e){return t.selection||ue.atStart(e.doc)},apply(t){return t.selection}}),new Wi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Wi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],Ks=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=YO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Wi(r.key,r.spec.state,r))})}},kl=class t{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ks(e.schema,e.plugins),o=new t(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=tr.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=ue.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let u=r[l],d=u.spec.state;if(u.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){o[s.name]=d.fromJSON.call(u,e,n[l],o);return}}o[s.name]=s.init(e,o)}}),o}};function n0(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=n0(i,e,{})),n[r]=i}return n}var ke=class{constructor(e){this.spec=e,this.props={},e.props&&n0(e.props,this,this.props),this.key=e.key?e.key.key:r0("plugin")}getState(e){return e[this.key]}},mf=Object.create(null);function r0(t){return t in mf?t+"$"+ ++mf[t]:(mf[t]=0,t+"$")}var ze=class{constructor(e="key"){this.key=r0(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var Gt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ys=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},_f=null,Fr=function(t,e,n){let r=_f||(_f=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},JO=function(){_f=null},Xi=function(t,e,n,r){return n&&(i0(t,e,n,r,-1)||i0(t,e,n,r,1))},XO=/^(img|br|input|textarea|hr)$/i;function i0(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:zn(t))){let o=t.parentNode;if(!o||o.nodeType!=1||js(t)||XO.test(t.nodeName)||t.contentEditable=="false")return!1;e=Gt(t)+(i<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?zn(t):0}else return!1}}function zn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ZO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=zn(t)}else if(t.parentNode&&!js(t))e=Gt(t),t=t.parentNode;else return null}}function jO(t,e){for(;;){if(t.nodeType==3&&e2),$n=Uo||(pr?/Mac/.test(pr.platform):!1),nR=pr?/Win/.test(pr.platform):!1,rr=/Android \d/.test(hi),Qs=!!o0&&"webkitFontSmoothing"in o0.documentElement.style,rR=Qs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function iR(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Br(t,e){return typeof t=="number"?t:t[e]}function oR(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function s0(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=Ys(s)){if(s.nodeType!=1)continue;let l=s,u=l==o.body,d=u?iR(o):oR(l),f=0,h=0;if(e.topd.bottom-Br(r,"bottom")&&(h=e.bottom-e.top>d.bottom-d.top?e.top+Br(i,"top")-d.top:e.bottom-d.bottom+Br(i,"bottom")),e.leftd.right-Br(r,"right")&&(f=e.right-d.right+Br(i,"right")),f||h)if(u)o.defaultView.scrollBy(f,h);else{let m=l.scrollLeft,b=l.scrollTop;h&&(l.scrollTop+=h),f&&(l.scrollLeft+=f);let y=l.scrollLeft-m,v=l.scrollTop-b;e={left:e.left-y,top:e.top-v,right:e.right-y,bottom:e.bottom-v}}if(u||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function sR(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s=n-20){r=l,i=u.top;break}}return{refDOM:r,refTop:i,stack:H0(t.dom)}}function H0(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ys(r));return e}function aR({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;$0(n,r==0?0:r-e)}function $0(t,e){for(let n=0;n=l){s=Math.max(y.bottom,s),l=Math.min(y.top,l);let v=y.left>e.left?y.left-e.left:y.right=(y.left+y.right)/2?1:0));continue}}else y.top>e.top&&!u&&y.left<=e.left&&y.right>=e.left&&(u=f,d={left:Math.max(y.left,Math.min(y.right,e.left)),top:y.top});!n&&(e.left>=y.right&&e.top>=y.top||e.left>=y.left&&e.top>=y.bottom)&&(o=h+1)}}return!n&&u&&(n=u,i=d,r=0),n&&n.nodeType==3?cR(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:z0(n,i)}function cR(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function zf(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function uR(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function fR(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let l=t.docView.nearestDesc(o,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let u=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&u.left>r.left||u.top>r.top?i=l.posBefore:(!s&&u.right-1?i:t.docView.posFromDOM(e,n,-1)}function U0(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let d;Qs&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=fR(t,r,i,e))}l==null&&(l=dR(t,s,e));let u=t.docView.nearestDesc(s,!0);return{pos:l,inside:u?u.posAtStart-u.border:-1}}function a0(t){return t.top=0&&i==r.nodeValue.length?(u--,f=1):n<0?u--:d++,Vs(ci(Fr(r,u,d),f),f<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==zn(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return yf(u.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==zn(r))){let u=r.childNodes[i-1],d=u.nodeType==3?Fr(u,zn(u)-(s?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(d)return Vs(ci(d,1),!1)}if(o==null&&i=0)}function Vs(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function yf(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function K0(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function mR(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return K0(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=W0(t,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let u;if(l.nodeType==1)u=l.getClientRects();else if(l.nodeType==3)u=Fr(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;df.top+1&&(n=="up"?s.top-f.top>(f.bottom-s.top)*2:f.bottom-s.bottom>(s.bottom-f.top)*2))return!1}}return!0})}var gR=/[\u0590-\u08ac]/;function bR(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=t.domSelection();return l?!gR.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?o:s:K0(t,e,()=>{let{focusNode:u,focusOffset:d,anchorNode:f,anchorOffset:h}=t.domSelectionRange(),m=l.caretBidiLevel;l.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:y,focusOffset:v}=t.domSelectionRange(),x=y&&!b.contains(y.nodeType==1?y:y.parentNode)||u==y&&d==v;try{l.collapse(f,h),u&&(u!=f||d!=h)&&l.extend&&l.extend(u,d)}catch{}return m!=null&&(l.caretBidiLevel=m),x}):r.pos==r.start()||r.pos==r.end()}var l0=null,c0=null,u0=!1;function yR(t,e,n){return l0==e&&c0==n?u0:(l0=e,c0=n,u0=n=="up"||n=="down"?mR(t,e,n):bR(t,e,n))}var Un=0,d0=1,Vi=2,hr=3,Zi=class{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Un,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nGt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||s instanceof Il){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Ol&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Gt(o.dom)+1:0}}else{let o,s=!0;for(;o=r=f&&n<=d-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=s;for(let h=l;h>0;h--){let m=this.children[h-1];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(1)){i=Gt(m.dom)+1;break}e-=m.size}i==-1&&(i=0)}if(i>-1&&(d>n||l==this.children.length-1)){n=d;for(let f=l+1;fb&&sn){let b=l;l=u,u=b}let m=document.createRange();m.setEnd(u.node,u.offset),m.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(m)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let l=r+o.border,u=s-o.border;if(e>=l&&n<=u){this.dirty=e==r||n==s?Vi:d0,e==l&&n==u&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=hr:o.markDirty(e-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Vi:hr}r=s}this.dirty=Vi}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Vi:d0;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Un&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},Af=class extends Zi{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Wo=class t extends Zi{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=Dr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new t(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&hr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=hr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Un){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(o=Of(o,0,e,r));for(let l=0;l{if(!u)return s;if(u.parent)return u.parent.posBeforeChild(u)},r,i),f=d&&d.dom,h=d&&d.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:h}=Dr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!h&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let m=f;return f=q0(f,r,n),d?u=new Mf(e,n,r,i,f,h||null,m,d,o,s+1):n.isText?new Rl(e,n,r,i,f,m,o):new t(e,n,r,i,f,h||null,m,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>G.empty)}return e}matchesNode(e,n,r){return this.dirty==Un&&e.eq(this.node)&&Dl(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,u=new kf(this,s&&s.node,e);xR(this.node,this.innerDeco,(d,f,h)=>{d.spec.marks?u.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!h&&u.syncToMarks(f==this.node.childCount?Ge.none:this.node.child(f).marks,r,e),u.placeWidget(d,e,i)},(d,f,h,m)=>{u.syncToMarks(d.marks,r,e);let b;u.findNodeMatch(d,f,h,m)||l&&e.state.selection.from>i&&e.state.selection.to-1&&u.updateNodeAt(d,f,h,b,e)||u.updateNextNode(d,f,h,e,m,i)||u.addNode(d,f,h,e,i),i+=d.nodeSize}),u.syncToMarks([],r,e),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Vi)&&(s&&this.protectLocalComposition(e,s),V0(this.contentDOM,this.children,e),Uo&&_R(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof le)||rn+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=SR(this.node.content,s,r-n,i-n);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new Af(this,o,n,i);e.input.compositionNodes.push(s),this.children=Of(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==hr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Un}updateOuterDeco(e){if(Dl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=G0(this.dom,this.nodeDOM,Nf(this.outerDeco,this.node,n),Nf(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function f0(t,e,n,r,i){q0(r,e,t);let o=new pi(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}var Rl=class t extends pi{constructor(e,n,r,i,o,s,l){super(e,n,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==hr||this.dirty!=Un&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Un||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Un,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=hr)}get domAtom(){return!1}isText(e){return this.node.text==e}},Il=class extends Zi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Un&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},Mf=class extends pi{constructor(e,n,r,i,o,s,l,u,d,f){super(e,n,r,i,o,s,l,d,f),this.spec=u}update(e,n,r,i){if(this.dirty==hr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function V0(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o>1,s=Math.min(o,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=Wo.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,u=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let d=n.children[r-1];if(d instanceof Wo)n=d,r=d.children.length;else{l=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=l.node;if(u){if(u!=t.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function wR(t,e){return t.type.side-e.type.side}function xR(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let d=0;do;)l.push(i[s++]);let y=o+m.nodeSize;if(m.isText){let x=y;s!x.inline):l.slice();r(m,v,e.forChild(o,m),b),o=y}}function _R(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function SR(t,e,n,r){for(let i=0,o=0;i=n){if(o>=r&&u.slice(r-e.length-l,r-l)==e)return r-e.length;let d=l=0&&d+e.length+l>=n)return l+d;if(n==r&&u.length>=r+e.length-l&&u.slice(r-l,r-l+e.length)==e)return r}}return-1}function Of(t,e,n,r,i){let o=[];for(let s=0,l=0;s=n||f<=e?o.push(u):(dn&&o.push(u.slice(n-d,u.size,r)))}return o}function Uf(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),u,d;if(Ul(n)){for(u=s;i&&!i.node;)i=i.parent;let h=i.node;if(i&&h.isAtom&&pe.isSelectable(h)&&i.parent&&!(h.isInline&&QO(n.focusNode,n.focusOffset,i.dom))){let m=i.posBefore;d=new pe(s==m?l:r.resolve(m))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let h=s,m=s;for(let b=0;b{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Y0(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function CR(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,Gt(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&En&&fi<=11&&(r.disabled=!0,r.disabled=!1)}function J0(t,e){if(e instanceof pe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(b0(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else b0(t)}function b0(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Wf(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||le.between(e,n,r)}function y0(t){return t.editable&&!t.hasFocus()?!1:X0(t)}function X0(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function AR(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Xi(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Rf(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&ue.findFrom(o,e)}function ui(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function E0(t,e,n){let r=t.state.selection;if(r instanceof le)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return ui(t,new le(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Rf(t.state,e);return i&&i instanceof pe?ui(t,i):!1}else if(!($n&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?pe.isSelectable(o)?ui(t,new pe(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Qs?ui(t,new le(t.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof pe&&r.node.isInline)return ui(t,new le(e>0?r.$to:r.$from));{let i=Rf(t.state,e);return i?ui(t,i):!1}}}function Ll(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qs(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ho(t,e){return e<0?MR(t):NR(t)}function MR(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(ir&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(qs(l,-1))i=n,o=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Z0(n))break;{let l=n.previousSibling;for(;l&&qs(l,-1);)i=n.parentNode,o=Gt(l),l=l.previousSibling;if(l)n=l,r=Ll(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?If(t,n,r):i&&If(t,i,o)}function NR(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Ll(n),o,s;for(;;)if(r{t.state==i&&Hr(t)},50)}function v0(t,e){let n=t.state.doc.resolve(e);if(!(nn||nR)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s1)return o.lefti.top&&s1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function w0(t,e,n){let r=t.state.selection;if(r instanceof le&&!r.empty||n.indexOf("s")>-1||$n&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Rf(t.state,e);if(s&&s instanceof pe)return ui(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Nn?ue.near(s,e):ue.findFrom(s,e);return l?ui(t,l):!1}return!1}function x0(t,e){if(!(t.state.selection instanceof le))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function _0(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function RR(t){if(!dn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;_0(t,r,"true"),setTimeout(()=>_0(t,r,"false"),20)}return!1}function IR(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function DR(t,e){let n=e.keyCode,r=IR(e);if(n==8||$n&&n==72&&r=="c")return x0(t,-1)||Ho(t,-1);if(n==46&&!e.shiftKey||$n&&n==68&&r=="c")return x0(t,1)||Ho(t,1);if(n==13||n==27)return!0;if(n==37||$n&&n==66&&r=="c"){let i=n==37?v0(t,t.state.selection.from)=="ltr"?-1:1:-1;return E0(t,i,r)||Ho(t,i)}else if(n==39||$n&&n==70&&r=="c"){let i=n==39?v0(t,t.state.selection.from)=="ltr"?1:-1:1;return E0(t,i,r)||Ho(t,i)}else{if(n==38||$n&&n==80&&r=="c")return w0(t,-1,r)||Ho(t,-1);if(n==40||$n&&n==78&&r=="c")return RR(t)||w0(t,1,r)||Ho(t,1);if(r==($n?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function j0(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let s=t.someProp("clipboardSerializer")||Dr.fromSchema(t.state.schema),l=iE(),u=l.createElement("div");u.appendChild(s.serializeFragment(r,{document:l}));let d=u.firstChild,f,h=0;for(;d&&d.nodeType==1&&(f=rE[d.nodeName.toLowerCase()]);){for(let b=f.length-1;b>=0;b--){let y=l.createElement(f[b]);for(;u.firstChild;)y.appendChild(u.firstChild);u.appendChild(y),h++}d=u.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${o}${h?` -${h}`:""} ${JSON.stringify(n)}`);let m=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,` + +`);return{dom:u,text:m,slice:e}}function Q0(t,e,n,r,i){let o=i.parent.type.spec.code,s,l;if(!n&&!e)return null;let u=e&&(r||o||!n);if(u){if(t.someProp("transformPastedText",m=>{e=m(e,o||r,t)}),o)return e?new Z(G.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0):Z.empty;let h=t.someProp("clipboardTextParser",m=>m(e,i,r,t));if(h)l=h;else{let m=i.marks(),{schema:b}=t.state,y=Dr.fromSchema(b);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let x=s.appendChild(document.createElement("p"));v&&x.appendChild(y.serializeNode(b.text(v,m)))})}}else t.someProp("transformPastedHTML",h=>{n=h(n,t)}),s=FR(n),Qs&&HR(s);let d=s&&s.querySelector("[data-pm-slice]"),f=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let h=+f[3];h>0;h--){let m=s.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;s=m}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Ir.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(u||f),context:i,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!LR.test(m.parentNode.nodeName)?{ignore:!0}:null}})),f)l=$R(S0(l,+f[1],+f[2]),f[4]);else if(l=Z.maxOpen(PR(l.content,i),!0),l.openStart||l.openEnd){let h=0,m=0;for(let b=l.content.firstChild;h{l=h(l,t)}),l}var LR=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function PR(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(l=>{if(!s)return;let u=i.findWrapping(l.type),d;if(!u)return s=null;if(d=s.length&&o.length&&tE(u,o,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=nE(s[s.length-1],o.length));let f=eE(l,u);s.push(f),i=i.matchType(f.type),o=u}}),s)return G.from(s)}return t}function eE(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,G.from(t));return t}function tE(t,e,n,r,i){if(i1&&(o=0),i=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function S0(t,e,n){return en})),vf.createHTML(t)):t}function FR(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=iE().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&rE[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"").reverse().join("")),n.innerHTML=BR(t),i)for(let o=0;o=0;l-=2){let u=n.nodes[r[l]];if(!u||u.hasRequiredAttrs())break;i=G.from(u.create(r[l+1],i)),o++,s++}return new Z(i,o,s)}var fn={},pn={},zR={touchstart:!0,touchmove:!0},Lf=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function UR(t){for(let e in fn){let n=fn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{KR(t,r)&&!Kf(t,r)&&(t.editable||!(r.type in pn))&&n(t,r)},zR[e]?{passive:!0}:void 0)}dn&&t.dom.addEventListener("input",()=>null),Pf(t)}function di(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function WR(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Pf(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Kf(t,r))})}function Kf(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function KR(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function VR(t,e){!Kf(t,e)&&fn[e.type]&&(t.editable||!(e.type in pn))&&fn[e.type](t,e)}pn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!sE(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(rr&&nn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Uo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Ki(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||DR(t,n)?n.preventDefault():di(t,"key")};pn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};pn.keypress=(t,e)=>{let n=e;if(sE(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||$n&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof le)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Wl(t){return{left:t.clientX,top:t.clientY}}function GR(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Vf(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,l=>s>o.depth?l(t,n,o.nodeAfter,o.before(s),i,!0):l(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function zo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function qR(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&pe.isSelectable(r)?(zo(t,new pe(n),"pointer"),!0):!1}function YR(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof pe&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(pe.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(zo(t,pe.create(t.state.doc,i),"pointer"),!0):!1}function JR(t,e,n,r,i){return Vf(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?YR(t,n):qR(t,n))}function XR(t,e,n,r){return Vf(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function ZR(t,e,n,r){return Vf(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||jR(t,n,r)}function jR(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(zo(t,le.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)zo(t,le.create(r,l+1,l+1+s.content.size),"pointer");else if(pe.isSelectable(s))zo(t,pe.create(r,l),"pointer");else continue;return!0}}function Gf(t){return Pl(t)}var oE=$n?"metaKey":"ctrlKey";fn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Gf(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&GR(n,t.input.lastClick)&&!n[oE]&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords(Wl(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Bf(t,s,n,!!r)):(o=="doubleClick"?XR:ZR)(t,s.pos,s.inside,n)?n.preventDefault():di(t,"pointer"))};var Bf=class{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[oE],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let f=e.state.doc.resolve(n.pos);o=f.parent,s=f.depth?f.before():0}let l=i?null:r.target,u=l?e.docView.nearestDesc(l,!0):null;this.target=u&&u.dom.nodeType==1?u.dom:null;let{selection:d}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||d instanceof pe&&d.from<=s&&d.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ir&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),di(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Hr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Wl(e))),this.updateAllowDefault(e),this.allowDefault||!n?di(this.view,"pointer"):JR(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||dn&&this.mightDrag&&!this.mightDrag.node.isAtom||nn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(zo(this.view,ue.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):di(this.view,"pointer")}move(e){this.updateAllowDefault(e),di(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};fn.touchstart=t=>{t.input.lastTouch=Date.now(),Gf(t),di(t,"pointer")};fn.touchmove=t=>{t.input.lastTouch=Date.now(),di(t,"pointer")};fn.contextmenu=t=>Gf(t);function sE(t,e){return t.composing?!0:dn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var QR=rr?5e3:-1;pn.compositionstart=pn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof le&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Pl(t,!0),t.markCursor=null;else if(Pl(t,!e.selection.empty),ir&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}aE(t,QR)};pn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,aE(t,20))};function aE(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Pl(t),e))}function lE(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=tI());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function eI(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=ZO(e.focusNode,e.focusOffset),r=jO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function tI(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Pl(t,e=!1){if(!(rr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),lE(t),e||t.docView&&t.docView.dirty){let n=Uf(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function nI(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}var Js=En&&fi<15||Uo&&rR<604;fn.copy=pn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=Js?null:n.clipboardData,s=r.content(),{dom:l,text:u}=j0(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",u)):nI(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function rI(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function iI(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Xs(t,r.value,null,i,e):Xs(t,r.textContent,r.innerHTML,i,e)},50)}function Xs(t,e,n,r,i){let o=Q0(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,o||Z.empty)))return!0;if(!o)return!1;let s=rI(o),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function cE(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}pn.paste=(t,e)=>{let n=e;if(t.composing&&!rr)return;let r=Js?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Xs(t,cE(r),r.getData("text/html"),i,n)?n.preventDefault():iI(t,n)};var Bl=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},uE=$n?"altKey":"ctrlKey";fn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Wl(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof pe?i.to-1:i.to))){if(r&&r.mightDrag)s=pe.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let h=t.docView.nearestDesc(n.target,!0);h&&h.node.type.spec.draggable&&h!=t.docView&&(s=pe.create(t.state.doc,h.posBefore))}}let l=(s||t.state.selection).content(),{dom:u,text:d,slice:f}=j0(t,l);(!n.dataTransfer.files.length||!nn||F0>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Js?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Js||n.dataTransfer.setData("text/plain",d),t.dragging=new Bl(f,!n[uE],s)};fn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};pn.dragover=pn.dragenter=(t,e)=>e.preventDefault();pn.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Wl(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",y=>{s=y(s,t)}):s=Q0(t,cE(n.dataTransfer),Js?null:n.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!n[uE]);if(t.someProp("handleDrop",y=>y(t,n,s||Z.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let u=s?Al(t.state.doc,o.pos,s):o.pos;u==null&&(u=o.pos);let d=t.state.tr;if(l){let{node:y}=r;y?y.replace(d):d.deleteSelection()}let f=d.mapping.map(u),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=d.doc;if(h?d.replaceRangeWith(f,f,s.content.firstChild):d.replaceRange(f,f,s),d.doc.eq(m))return;let b=d.doc.resolve(f);if(h&&pe.isSelectable(s.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(s.content.firstChild))d.setSelection(new pe(b));else{let y=d.mapping.map(u);d.mapping.maps[d.mapping.maps.length-1].forEach((v,x,S,L)=>y=L),d.setSelection(Wf(t,b,d.doc.resolve(y)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))};fn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Hr(t)},20))};fn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};fn.beforeinput=(t,e)=>{if(nn&&rr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Ki(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in pn)fn[t]=pn[t];function Zs(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}var Fl=class t{constructor(e,n){this.toDOM=e,this.spec=n||Yi,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new vt(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof t&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Zs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},qi=class t{constructor(e,n){this.attrs=e,this.spec=n||Yi}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new vt(o,s,this)}valid(e,n){return n.from=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;se){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,i+l,o)}}map(e,n,r){return this==tn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Yi)}mapInner(e,n,r,i,o){let s;for(let l=0;l{let d=u+r,f;if(f=fE(n,l,d)){for(i||(i=this.children.slice());ol&&h.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+n.content.size;for(let l=0;lo&&u.type instanceof qi){let d=Math.max(o,u.from)-o,f=Math.min(s,u.to)-o;di.map(e,n,Yi));return t.from(r)}forChild(e,n){if(n.isLeaf)return ot.empty;let r=[];for(let i=0;in instanceof ot)?e:e.reduce((n,r)=>n.concat(r instanceof ot?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let x=v-y-(b-m);for(let S=0;SL+f-h)continue;let D=l[S]+f-h;b>=D?l[S+1]=m<=D?-2:-1:m>=f&&x&&(l[S]+=x,l[S+1]+=x)}h+=x}),f=n.maps[d].map(f,-1)}let u=!1;for(let d=0;d=r.content.size){u=!0;continue}let m=n.map(t[d+1]+o,-1),b=m-i,{index:y,offset:v}=r.content.findIndex(h),x=r.maybeChild(y);if(x&&v==h&&v+x.nodeSize==b){let S=l[d+2].mapInner(n,x,f+1,t[d]+o+1,s);S!=tn?(l[d]=h,l[d+1]=b,l[d+2]=S):(l[d+1]=-2,u=!0)}else u=!0}if(u){let d=sI(l,t,e,n,i,o,s),f=$l(d,r,0,s);e=f.local;for(let h=0;hn&&s.to{let d=fE(t,l,u+n);if(d){o=!0;let f=$l(d,l,n+u+1,r);f!=tn&&i.push(u,u+l.nodeSize,f)}});let s=dE(o?pE(t):t,-n).sort(Ji);for(let l=0;l0;)e++;t.splice(e,0,n)}function wf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=tn&&e.push(r)}),t.cursorWrapper&&e.push(ot.create(t.state.doc,[t.cursorWrapper.deco])),Hl.from(e)}var aI={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lI=En&&fi<=11,Hf=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},$f=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Hf,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),lI&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,aI)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(y0(this.view)){if(this.suppressingSelectionUpdates)return Hr(this.view);if(En&&fi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Xi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=Ys(o))n.add(o);for(let o=e.anchorNode;o;o=Ys(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&y0(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,u=[];if(e.editable)for(let f=0;fh.nodeName=="BR");if(f.length==2){let[h,m]=f;h.parentNode&&h.parentNode.parentNode==m.parentNode?m.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let m of f){let b=m.parentNode;b&&b.nodeName=="LI"&&(!h||dI(e,h)!=b)&&m.remove()}}}let d=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(o>-1&&(e.docView.markDirty(o,s),cI(e)),this.handleDOMChange(o,s,l,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Hr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fi;x--){let S=r.childNodes[x-1],L=S.pmViewDesc;if(S.nodeName=="BR"&&!L){o=x;break}if(!L||L.size)break}let h=t.state.doc,m=t.someProp("domParser")||Ir.fromSchema(t.state.schema),b=h.resolve(s),y=null,v=m.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:o,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:pI,context:b});if(d&&d[0].pos!=null){let x=d[0].pos,S=d[1]&&d[1].pos;S==null&&(S=x),y={anchor:x+s,head:S+s}}return{doc:v,sel:y,from:s,to:l}}function pI(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(dn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||dn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}var hI=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function mI(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let z=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,re=Uf(t,z);if(re&&!t.state.selection.eq(re)){if(nn&&rr&&t.input.lastKeyCode===13&&Date.now()-100Se(t,Ki(13,"Enter"))))return;let he=t.state.tr.setSelection(re);z=="pointer"?he.setMeta("pointer",!0):z=="key"&&he.scrollIntoView(),o&&he.setMeta("composition",o),t.dispatch(he)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let u=t.state.selection,d=fI(t,e,n),f=t.state.doc,h=f.slice(d.from,d.to),m,b;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||rr)&&i.some(z=>z.nodeType==1&&!hI.test(z.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",z=>z(t,Ki(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(r&&u instanceof le&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))y={start:u.from,endA:u.to,endB:u.to};else{if(d.sel){let z=k0(t,t.state.doc,d.sel);if(z&&!z.eq(t.state.selection)){let re=t.state.tr.setSelection(z);o&&re.setMeta("composition",o),t.dispatch(re)}}return}t.state.selection.fromt.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?y.start=t.state.selection.from:y.endA=t.state.selection.to-2&&t.state.selection.to<=d.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),En&&fi<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>d.from&&d.doc.textBetween(y.start-d.from-1,y.start-d.from+1)==" \xA0"&&(y.start--,y.endA--,y.endB--);let v=d.doc.resolveNoCache(y.start-d.from),x=d.doc.resolveNoCache(y.endB-d.from),S=f.resolve(y.start),L=v.sameParent(x)&&v.parent.inlineContent&&S.end()>=y.endA,D;if((Uo&&t.input.lastIOSEnter>Date.now()-225&&(!L||i.some(z=>z.nodeName=="DIV"||z.nodeName=="P"))||!L&&v.posz(t,Ki(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&bI(f,y.start,y.endA,v,x)&&t.someProp("handleKeyDown",z=>z(t,Ki(8,"Backspace")))){rr&&nn&&t.domObserver.suppressSelectionUpdates();return}nn&&rr&&y.endB==y.start&&(t.input.lastAndroidDelete=Date.now()),rr&&!L&&v.start()!=x.start()&&x.parentOffset==0&&v.depth==x.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==y.endA&&(y.endB-=2,x=d.doc.resolveNoCache(y.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(z){return z(t,Ki(13,"Enter"))})},20));let T=y.start,$=y.endA,O,Y,ee;if(L){if(v.pos==x.pos)En&&fi<=11&&v.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Hr(t),20)),O=t.state.tr.delete(T,$),Y=f.resolve(y.start).marksAcross(f.resolve(y.endA));else if(y.endA==y.endB&&(ee=gI(v.parent.content.cut(v.parentOffset,x.parentOffset),S.parent.content.cut(S.parentOffset,y.endA-S.start()))))O=t.state.tr,ee.type=="add"?O.addMark(T,$,ee.mark):O.removeMark(T,$,ee.mark);else if(v.parent.child(v.index()).isText&&v.index()==x.index()-(x.textOffset?0:1)){let z=v.parent.textBetween(v.parentOffset,x.parentOffset);if(t.someProp("handleTextInput",re=>re(t,T,$,z)))return;O=t.state.tr.insertText(z,T,$)}}if(O||(O=t.state.tr.replace(T,$,d.doc.slice(y.start-d.from,y.endB-d.from))),d.sel){let z=k0(t,O.doc,d.sel);z&&!(nn&&rr&&t.composing&&z.empty&&(y.start!=y.endB||t.input.lastAndroidDeletee.content.size?null:Wf(t,e.resolve(n.anchor),e.resolve(n.head))}function gI(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,l,u;for(let f=0;ff.mark(l.addToSet(f.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",u=f=>f.mark(l.removeFromSet(f.marks));else return null;let d=[];for(let f=0;fn||xf(s,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function yI(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let u=Math.max(0,o-Math.min(s,l));r-=s+u-o}if(s=s?o-r:0;o-=u,o&&o=l?o-r:0;o-=u,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}var zl=class{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Lf,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(P0),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=D0(this),I0(this),this.nodeViews=L0(this),this.docView=f0(this.state.doc,R0(this),wf(this),this.dom,this),this.domObserver=new $f(this,(r,i,o,s)=>mI(this,r,i,o,s)),this.domObserver.start(),UR(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Pf(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(P0),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(lE(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=L0(this);vI(b,this.nodeViews)&&(this.nodeViews=b,o=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Pf(this),this.editable=D0(this),I0(this);let u=wf(this),d=R0(this),f=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",h=o||!this.docView.matchesNode(e.doc,d,u);(h||!e.selection.eq(i.selection))&&(s=!0);let m=f=="preserve"&&s&&this.dom.style.overflowAnchor==null&&sR(this);if(s){this.domObserver.stop();let b=h&&(En||nn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&EI(i.selection,e.selection);if(h){let y=nn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=eI(this)),(o||!this.docView.update(e.doc,d,u,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=f0(e.doc,d,u,this.dom,this)),y&&!this.trackWrites&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&AR(this))?Hr(this,b):(J0(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():m&&aR(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof pe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&s0(this,n.getBoundingClientRect(),e)}else s0(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Bl(e.slice,e.move,i<0?void 0:pe.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;sn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return pR(this,e)}coordsAtPos(e,n=1){return W0(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return yR(this,n||this.state,e)}pasteHTML(e,n){return Xs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Xs(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(WR(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],wf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,JO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return VR(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?dn&&this.root.nodeType===11&&eR(this.dom.ownerDocument)==this.dom&&uI(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function R0(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[vt.node(0,t.state.doc.content.size,e)]}function I0(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:vt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function D0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function EI(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function L0(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function vI(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function P0(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var $r={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:"'"},Vl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wI=typeof navigator<"u"&&/Mac/.test(navigator.platform),xI=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ct=0;Ct<10;Ct++)$r[48+Ct]=$r[96+Ct]=String(Ct);var Ct;for(Ct=1;Ct<=24;Ct++)$r[Ct+111]="F"+Ct;var Ct;for(Ct=65;Ct<=90;Ct++)$r[Ct]=String.fromCharCode(Ct+32),Vl[Ct]=String.fromCharCode(Ct);var Ct;for(Kl in $r)Vl.hasOwnProperty(Kl)||(Vl[Kl]=$r[Kl]);var Kl;function hE(t){var e=wI&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||xI&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Vl:$r)[t.keyCode]||t.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}var _I=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function SI(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let l=0;l127)&&(o=$r[r.keyCode])&&o!=i){let l=e[Yf(o,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Gl=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function bE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Xf=(t,e,n)=>{let r=bE(t,n);if(!r)return!1;let i=jf(r);if(!i){let s=r.blockRange(),l=s&&Pr(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(CE(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ko(o,"end")||pe.isSelectable(o)))for(let s=r.depth;;s--){let l=Ws(t.doc,r.before(s),r.after(s),Z.empty);if(l&&l.slice.size1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},yE=(t,e,n)=>{let r=bE(t,n);if(!r)return!1;let i=jf(r);return i?vE(t,i,e):!1},EE=(t,e,n)=>{let r=wE(t,n);if(!r)return!1;let i=tp(r);return i?vE(t,i,e):!1};function vE(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let s=e.nodeAfter,l=s,u=e.pos+1;for(;!l.isTextblock;u++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let d=Ws(t.doc,o,u,Z.empty);if(!d||d.from!=o||d instanceof en&&d.slice.size>=u-o)return!1;if(n){let f=t.tr.step(d);f.setSelection(le.create(f.doc,o)),n(f.scrollIntoView())}return!0}function Ko(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Zf=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=jf(r)}let s=o&&o.nodeBefore;return!s||!pe.isSelectable(s)?!1:(e&&e(t.tr.setSelection(pe.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function jf(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function wE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=wE(t,n);if(!r)return!1;let i=tp(r);if(!i)return!1;let o=i.nodeAfter;if(CE(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ko(o,"start")||pe.isSelectable(o))){let s=Ws(t.doc,r.before(),r.after(),Z.empty);if(s&&s.slice.size{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof pe,i;if(r){if(n.node.isTextblock||!nr(t.doc,n.from))return!1;i=n.from}else if(i=Lo(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(pe.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},_E=(t,e)=>{let n=t.selection,r;if(n instanceof pe){if(n.node.isTextblock||!nr(t.doc,n.to))return!1;r=n.to}else if(r=Lo(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},SE=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&Pr(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},np=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` +`).scrollIntoView()),!0)};function rp(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=rp(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=n.after(),u=t.tr.replaceWith(l,l,s.createAndFill());u.setSelection(ue.near(u.doc.resolve(l),1)),e(u.scrollIntoView())}return!0},op=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Nn||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=rp(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Hn(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Pr(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function CI(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof pe&&e.selection.node.isBlock)return!r.parentOffset||!Hn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,l,u=!1,d=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){u=r.end(b)==r.pos+(r.depth-b),d=r.start(b)==r.pos-(r.depth-b),l=rp(r.node(b-1).contentMatchAt(r.indexAfter(b-1)));let v=t&&t(i.parent,u,r);o.unshift(v||(u&&l?{type:l}:null)),s=b;break}else{if(b==1)return!1;o.unshift(null)}let f=e.tr;(e.selection instanceof le||e.selection instanceof Nn)&&f.deleteSelection();let h=f.mapping.map(r.pos),m=Hn(f.doc,h,o.length,o);if(m||(o[0]=l?{type:l}:null,m=Hn(f.doc,h,o.length,o)),f.split(h,o.length,o),!u&&d&&r.node(s).type!=l){let b=f.mapping.map(r.before(s)),y=f.doc.resolve(b);l&&r.node(s-1).canReplaceWith(y.index(),y.index()+1,l)&&f.setNodeMarkup(f.mapping.map(r.before(s)),l)}return n&&n(f.scrollIntoView()),!0}}var AI=CI();var TE=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(pe.create(t.doc,i))),!0)},MI=(t,e)=>(e&&e(t.tr.setSelection(new Nn(t.doc))),!0);function NI(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||nr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function CE(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,u=i.type.spec.isolating||o.type.spec.isolating;if(!u&&NI(t,e,n))return!0;let d=!u&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(n){let b=e.pos+o.nodeSize,y=G.empty;for(let S=s.length-1;S>=0;S--)y=G.from(s[S].create(null,y));y=G.from(i.copy(y));let v=t.tr.step(new Tt(e.pos-1,b,e.pos,b,new Z(y,1,0),s.length,!0)),x=v.doc.resolve(b+2*s.length);x.nodeAfter&&x.nodeAfter.type==i.type&&nr(v.doc,x.pos)&&v.join(x.pos),n(v.scrollIntoView())}return!0}let f=o.type.spec.isolating||r>0&&u?null:ue.findFrom(e,1),h=f&&f.$from.blockRange(f.$to),m=h&&Pr(h);if(m!=null&&m>=e.depth)return n&&n(t.tr.lift(h,m).scrollIntoView()),!0;if(d&&Ko(o,"start",!0)&&Ko(i,"end")){let b=i,y=[];for(;y.push(b),!b.isTextblock;)b=b.lastChild;let v=o,x=1;for(;!v.isTextblock;v=v.firstChild)x++;if(b.canReplace(b.childCount,b.childCount,v.content)){if(n){let S=G.empty;for(let D=y.length-1;D>=0;D--)S=G.from(y[D].copy(S));let L=t.tr.step(new Tt(e.pos-y.length,e.pos+o.nodeSize,e.pos+x,e.pos+o.nodeSize-x,new Z(S,y.length,0),0,!0));n(L.scrollIntoView())}return!0}}return!1}function AE(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(le.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}var ap=AE(-1),lp=AE(1);function ME(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&Do(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function cp(t,e=null){return function(n,r){let i=!1;for(let o=0;o{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let f=n.doc.resolve(d),h=f.index();i=f.parent.canReplaceWith(h,h+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s=2&&i.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let f=n.doc.resolve(s.start-2);u=new $i(f,f,s.depth),s.endIndex=0;f--)o=G.from(n[f].type.create(n[f].attrs,o));t.step(new Tt(e.start-(r?2:0),e.end,e.start,e.end,new Z(o,0,0),n.length,!0));let s=0;for(let f=0;fs.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?RI(e,n,t,o):II(e,n,o):!0:!1}}function RI(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);ov;y--)b-=i.child(y).nodeSize,r.delete(b-1,b+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,u=n.endIndex==i.childCount,d=o.node(-1),f=o.index(-1);if(!d.canReplace(f+(l?0:1),f+1,s.content.append(u?G.empty:G.from(i))))return!1;let h=o.pos,m=h+s.nodeSize;return r.step(new Tt(h-(l?1:0),m+(u?1:0),h+1,m-1,new Z((l?G.empty:G.from(i.copy(G.empty))).append(u?G.empty:G.from(i.copy(G.empty))),l?0:1,u?0:1),l?0:1)),e(r.scrollIntoView()),!0}function OE(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,u=l.child(s-1);if(u.type!=t)return!1;if(n){let d=u.lastChild&&u.lastChild.type==l.type,f=G.from(d?t.create():null),h=new Z(G.from(t.create(null,G.from(l.type.create(null,f)))),d?3:1,0),m=o.start,b=o.end;n(e.tr.step(new Tt(m-(d?3:1),b,m,b,h,1,!0)).scrollIntoView())}return!0}}function ec(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var Vo=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([l,u])=>[l,(...f)=>{let h=u(...f)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l=[],u=!!e,d=e||o.tr,f=()=>(!u&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),l.every(m=>m===!0)),h={...Object.fromEntries(Object.entries(r).map(([m,b])=>[m,(...v)=>{let x=this.buildProps(d,n),S=b(...v)(x);return l.push(S),h}])),run:f};return h}createCan(e){let{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([u,d])=>[u,(...f)=>d(...f)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l={tr:e,editor:i,view:s,state:ec({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,d])=>[u,(...f)=>d(...f)(l)]))}};return l}},hp=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){let r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){let r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function ne(t,e,n){return t.config[e]===void 0&&t.parent?ne(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ne(t.parent,e,n):null}):t.config[e]}function tc(t){let e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function FE(t){let e=[],{nodeExtensions:n,markExtensions:r}=tc(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage,extensions:i},u=ne(s,"addGlobalAttributes",l);if(!u)return;u().forEach(f=>{f.types.forEach(h=>{Object.entries(f.attributes).forEach(([m,b])=>{e.push({type:h,name:m,attribute:{...o,...b}})})})})}),i.forEach(s=>{let l={name:s.name,options:s.options,storage:s.storage},u=ne(s,"addAttributes",l);if(!u)return;let d=u();Object.entries(d).forEach(([f,h])=>{let m={...o,...h};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:s.name,name:f,attribute:m})})}),e}function zt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Q(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){let l=o?o.split(" "):[],u=r[i]?r[i].split(" "):[],d=l.filter(f=>!u.includes(f));r[i]=[...u,...d].join(" ")}else if(i==="style"){let l=o?o.split(";").map(f=>f.trim()).filter(Boolean):[],u=r[i]?r[i].split(";").map(f=>f.trim()).filter(Boolean):[],d=new Map;u.forEach(f=>{let[h,m]=f.split(":").map(b=>b.trim());d.set(h,m)}),l.forEach(f=>{let[h,m]=f.split(":").map(b=>b.trim());d.set(h,m)}),r[i]=Array.from(d.entries()).map(([f,h])=>`${f}: ${h}`).join("; ")}else r[i]=o}),r},{})}function mp(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Q(n,r),{})}function HE(t){return typeof t=="function"}function Te(t,e=void 0,...n){return HE(t)?e?t.bind(e)(...n):t(...n):t}function DI(t={}){return Object.keys(t).length===0&&t.constructor===Object}function LI(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function RE(t,e){return"style"in t?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let i=e.reduce((o,s)=>{let l=s.attribute.parseHTML?s.attribute.parseHTML(n):LI(n.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function IE(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&DI(n)?!1:n!=null))}function PI(t,e){var n;let r=FE(t),{nodeExtensions:i,markExtensions:o}=tc(t),s=(n=i.find(d=>ne(d,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(d=>{let f=r.filter(S=>S.type===d.name),h={name:d.name,options:d.options,storage:d.storage,editor:e},m=t.reduce((S,L)=>{let D=ne(L,"extendNodeSchema",h);return{...S,...D?D(d):{}}},{}),b=IE({...m,content:Te(ne(d,"content",h)),marks:Te(ne(d,"marks",h)),group:Te(ne(d,"group",h)),inline:Te(ne(d,"inline",h)),atom:Te(ne(d,"atom",h)),selectable:Te(ne(d,"selectable",h)),draggable:Te(ne(d,"draggable",h)),code:Te(ne(d,"code",h)),whitespace:Te(ne(d,"whitespace",h)),defining:Te(ne(d,"defining",h)),isolating:Te(ne(d,"isolating",h)),attrs:Object.fromEntries(f.map(S=>{var L;return[S.name,{default:(L=S?.attribute)===null||L===void 0?void 0:L.default}]}))}),y=Te(ne(d,"parseHTML",h));y&&(b.parseDOM=y.map(S=>RE(S,f)));let v=ne(d,"renderHTML",h);v&&(b.toDOM=S=>v({node:S,HTMLAttributes:mp(S,f)}));let x=ne(d,"renderText",h);return x&&(b.toText=x),[d.name,b]})),u=Object.fromEntries(o.map(d=>{let f=r.filter(x=>x.type===d.name),h={name:d.name,options:d.options,storage:d.storage,editor:e},m=t.reduce((x,S)=>{let L=ne(S,"extendMarkSchema",h);return{...x,...L?L(d):{}}},{}),b=IE({...m,inclusive:Te(ne(d,"inclusive",h)),excludes:Te(ne(d,"excludes",h)),group:Te(ne(d,"group",h)),spanning:Te(ne(d,"spanning",h)),code:Te(ne(d,"code",h)),attrs:Object.fromEntries(f.map(x=>{var S;return[x.name,{default:(S=x?.attribute)===null||S===void 0?void 0:S.default}]}))}),y=Te(ne(d,"parseHTML",h));y&&(b.parseDOM=y.map(x=>RE(x,f)));let v=ne(d,"renderHTML",h);return v&&(b.toDOM=x=>v({mark:x,HTMLAttributes:mp(x,f)})),[d.name,b]}));return new Ls({topNode:s,nodes:l,marks:u})}function dp(t,e){return e.nodes[t]||e.marks[t]||null}function DE(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}var BI=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var u,d;let f=((d=(u=i.type.spec).toText)===null||d===void 0?void 0:d.call(u,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?f:f.slice(0,Math.max(0,r-o))}),n};function xp(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var Go=class{constructor(e){this.find=e.find,this.handler=e.handler}},FI=(t,e)=>{if(xp(e))return e.exec(t);let n=e(t);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ql(t){var e;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=t,{view:u}=n;if(u.composing)return!1;let d=u.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(m=>m.type.spec.code))return!1;let f=!1,h=BI(d)+o;return s.forEach(m=>{if(f)return;let b=FI(h,m.find);if(!b)return;let y=u.state.tr,v=ec({state:u.state,transaction:y}),x={from:r-(b[0].length-o.length),to:i},{commands:S,chain:L,can:D}=new Vo({editor:n,state:v});m.handler({state:v,range:x,match:b,commands:S,chain:L,can:D})===null||!y.steps.length||(y.setMeta(l,{transform:y,from:r,to:i,text:o}),u.dispatch(y),f=!0)}),f}function HI(t){let{editor:e,rules:n}=t,r=new ke({state:{init(){return null},apply(i,o){let s=i.getMeta(r);if(s)return s;let l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{from:d,text:f}=l,h=d+f.length;ql({editor:e,from:d,to:h,text:f,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return ql({editor:e,from:o,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&ql({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;let{$cursor:s}=i.state.selection;return s?ql({editor:e,from:s.pos,to:s.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function $I(t){return Object.prototype.toString.call(t).slice(8,-1)}function Yl(t){return $I(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function nc(t,e){let n={...t};return Yl(t)&&Yl(e)&&Object.keys(e).forEach(r=>{Yl(e[r])&&Yl(t[r])?n[r]=nc(t[r],e[r]):n[r]=e[r]}),n}var st=class t{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Te(ne(this,"addOptions",{name:this.name}))),this.storage=Te(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>nc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Te(ne(n,"addOptions",{name:n.name})),n.storage=Te(ne(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){let s=i.marks();if(!!!s.find(d=>d?.type.name===n.name))return!1;let u=s.find(d=>d?.type.name===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}};function zI(t){return typeof t=="number"}var gp=class{constructor(e){this.find=e.find,this.handler=e.handler}},UI=(t,e,n)=>{if(xp(e))return[...t.matchAll(e)];let r=e(t,n);return r?r.map(i=>{let o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function WI(t){let{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=t,{commands:u,chain:d,can:f}=new Vo({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,i,(b,y)=>{if(!b.isTextblock||b.type.spec.code)return;let v=Math.max(r,y),x=Math.min(i,y+b.content.size),S=b.textBetween(v-y,x-y,void 0,"\uFFFC");UI(S,o.find,s).forEach(D=>{if(D.index===void 0)return;let T=v+D.index+1,$=T+D[0].length,O={from:n.tr.mapping.map(T),to:n.tr.mapping.map($)},Y=o.handler({state:n,range:O,match:D,commands:u,chain:d,can:f,pasteEvent:s,dropEvent:l});h.push(Y)})}),h.every(b=>b!==null)}var KI=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function VI(t){let{editor:e,rules:n}=t,r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l=typeof DragEvent<"u"?new DragEvent("drop"):null,u=({state:f,from:h,to:m,rule:b,pasteEvt:y})=>{let v=f.tr,x=ec({state:f,transaction:v});if(!(!WI({editor:e,state:x,from:Math.max(h-1,0),to:m.b-1,rule:b,pasteEvent:y,dropEvent:l})||!v.steps.length))return l=typeof DragEvent<"u"?new DragEvent("drop"):null,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v};return n.map(f=>new ke({view(h){let m=b=>{var y;r=!((y=h.dom.parentElement)===null||y===void 0)&&y.contains(b.target)?h.dom.parentElement:null};return window.addEventListener("dragstart",m),{destroy(){window.removeEventListener("dragstart",m)}}},props:{handleDOMEvents:{drop:(h,m)=>(o=r===h.dom.parentElement,l=m,!1),paste:(h,m)=>{var b;let y=(b=m.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return s=m,i=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(h,m,b)=>{let y=h[0],v=y.getMeta("uiEvent")==="paste"&&!i,x=y.getMeta("uiEvent")==="drop"&&!o,S=y.getMeta("applyPasteRules"),L=!!S;if(!v&&!x&&!L)return;if(L){let{from:$,text:O}=S,Y=$+O.length,ee=KI(O);return u({rule:f,state:b,from:$,to:{b:Y},pasteEvt:ee})}let D=m.doc.content.findDiffStart(b.doc.content),T=m.doc.content.findDiffEnd(b.doc.content);if(!(!zI(D)||!T||D===T.b))return u({rule:f,state:b,from:D,to:T,pasteEvt:s})}}))}function GI(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}var bp=class t{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=t.resolve(e),this.schema=PI(this.extensions,n),this.setupExtensions()}static resolve(e){let n=t.sort(t.flatten(e)),r=GI(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{let r={name:n.name,options:n.options,storage:n.storage},i=ne(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{let o=ne(r,"priority")||100,s=ne(i,"priority")||100;return o>s?-1:o{let r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:dp(n.name,this.schema)},i=ne(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){let{editor:e}=this,n=t.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{let l={name:s.name,options:s.options,storage:s.storage,editor:e,type:dp(s.name,this.schema)},u=[],d=ne(s,"addKeyboardShortcuts",l),f={};if(s.type==="mark"&&ne(s,"exitable",l)&&(f.ArrowRight=()=>st.handleExit({editor:e,mark:s})),d){let v=Object.fromEntries(Object.entries(d()).map(([x,S])=>[x,()=>S({editor:e})]));f={...f,...v}}let h=mE(f);u.push(h);let m=ne(s,"addInputRules",l);DE(s,e.options.enableInputRules)&&m&&r.push(...m());let b=ne(s,"addPasteRules",l);DE(s,e.options.enablePasteRules)&&b&&i.push(...b());let y=ne(s,"addProseMirrorPlugins",l);if(y){let v=y();u.push(...v)}return u}).flat();return[HI({editor:e,rules:r}),...VI({editor:e,rules:i}),...o]}get attributes(){return FE(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:n}=tc(this.extensions);return Object.fromEntries(n.filter(r=>!!ne(r,"addNodeView")).map(r=>{let i=this.attributes.filter(u=>u.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:zt(r.name,this.schema)},s=ne(r,"addNodeView",o);if(!s)return[];let l=(u,d,f,h,m)=>{let b=mp(u,i);return s()({node:u,view:d,getPos:f,decorations:h,innerDecorations:m,editor:e,extension:r,HTMLAttributes:b})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;let r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:dp(e.name,this.schema)};e.type==="mark"&&(!((n=Te(ne(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);let i=ne(e,"onBeforeCreate",r),o=ne(e,"onCreate",r),s=ne(e,"onUpdate",r),l=ne(e,"onSelectionUpdate",r),u=ne(e,"onTransaction",r),d=ne(e,"onFocus",r),f=ne(e,"onBlur",r),h=ne(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),u&&this.editor.on("transaction",u),d&&this.editor.on("focus",d),f&&this.editor.on("blur",f),h&&this.editor.on("destroy",h)})}},We=class t{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Te(ne(this,"addOptions",{name:this.name}))),this.storage=Te(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>nc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Te(ne(n,"addOptions",{name:n.name})),n.storage=Te(ne(n,"addStorage",{name:n.name,options:n.options})),n}};function $E(t,e,n){let{from:r,to:i}=e,{blockSeparator:o=` + +`,textSerializers:s={}}=n||{},l="";return t.nodesBetween(r,i,(u,d,f,h)=>{var m;u.isBlock&&d>r&&(l+=o);let b=s?.[u.type.name];if(b)return f&&(l+=b({node:u,pos:d,parent:f,index:h,range:e})),!1;u.isText&&(l+=(m=u?.text)===null||m===void 0?void 0:m.slice(Math.max(r,d)-d,i-d))}),l}function zE(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}var qI=We.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ke({key:new ze("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(f=>f.$from.pos)),l=Math.max(...o.map(f=>f.$to.pos)),u=zE(n);return $E(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),YI=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),JI=(t=!1)=>({commands:e})=>e.setContent("",t),XI=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(l,u)=>{if(l.type.isText)return;let{doc:d,mapping:f}=e,h=d.resolve(f.map(u)),m=d.resolve(f.map(u+l.nodeSize)),b=h.blockRange(m);if(!b)return;let y=Pr(b);if(l.type.isTextblock){let{defaultType:v}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(b.start,v)}(y||y===0)&&e.lift(b,y)})}),!0},ZI=t=>e=>t(e),jI=()=>({state:t,dispatch:e})=>op(t,e),QI=(t,e)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new le(r.doc.resolve(s-1))),!0},eD=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){let l=i.before(o),u=i.after(o);t.delete(l,u).scrollIntoView()}return!0}return!1},tD=t=>({tr:e,state:n,dispatch:r})=>{let i=zt(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){let u=o.before(s),d=o.after(s);e.delete(u,d).scrollIntoView()}return!0}return!1},nD=t=>({tr:e,dispatch:n})=>{let{from:r,to:i}=t;return n&&e.delete(r,i),!0},rD=()=>({state:t,dispatch:e})=>Gl(t,e),iD=()=>({commands:t})=>t.keyboardShortcut("Enter"),oD=()=>({state:t,dispatch:e})=>ip(t,e);function Zl(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:xp(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function yp(t,e,n={}){return t.find(r=>r.type===e&&Zl(r.attrs,n))}function sD(t,e,n={}){return!!yp(t,e,n)}function _p(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e))return;let i=yp([...r.node.marks],e,n);if(!i)return;let o=r.index,s=t.start()+r.offset,l=o+1,u=s+r.node.nodeSize;for(yp([...r.node.marks],e,n);o>0&&i.isInSet(t.parent.child(o-1).marks);)o-=1,s-=t.parent.child(o).nodeSize;for(;l({tr:n,state:r,dispatch:i})=>{let o=gi(t,r.schema),{doc:s,selection:l}=n,{$from:u,from:d,to:f}=l;if(i){let h=_p(u,o,e);if(h&&h.from<=d&&h.to>=f){let m=le.create(s,h.from,h.to);n.setSelection(m)}}return!0},lD=t=>e=>{let n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};let s=()=>{Sp()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!rc(n.state.selection))return s(),!0;let l=UE(i.doc,t)||n.state.selection,u=n.state.selection.eq(l);return o&&(u||i.setSelection(l),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},uD=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),dD=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),WE=t=>{let e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){let r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&WE(r)}return t};function Jl(t){let e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return WE(n)}function jl(t,e,n){n={slice:!0,parseOptions:{},...n};let r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return G.fromArray(t.map(l=>e.nodeFromJSON(l)));let s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),jl("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,l="",u=new Ls({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?Ir.fromSchema(u).parseSlice(Jl(t),n.parseOptions):Ir.fromSchema(u).parse(Jl(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let o=Ir.fromSchema(e);return n.slice?o.parseSlice(Jl(t),n.parseOptions).content:o.parse(Jl(t),n.parseOptions)}return jl("",e,n)}function fD(t,e,n){let r=t.steps.length-1;if(r{s===0&&(s=f)}),t.setSelection(ue.near(t.doc.resolve(s),n))}var pD=t=>!("type"in t),hD=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;try{l=jl(e,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(y){return o.emit("contentError",{editor:o,error:y,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((pD(l)?l:[l]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===d&&h){let{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,d+=1)}let b;f?(Array.isArray(e)?b=e.map(y=>y.text||"").join(""):typeof e=="object"&&e&&e.text?b=e.text:b=e,r.insertText(b,u,d)):(b=l,r.replaceWith(u,d,b)),n.updateSelection&&fD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:b}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:b})}return!0},mD=()=>({state:t,dispatch:e})=>xE(t,e),gD=()=>({state:t,dispatch:e})=>_E(t,e),bD=()=>({state:t,dispatch:e})=>Xf(t,e),yD=()=>({state:t,dispatch:e})=>Qf(t,e),ED=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Lo(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},vD=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Lo(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},wD=()=>({state:t,dispatch:e})=>yE(t,e),xD=()=>({state:t,dispatch:e})=>EE(t,e);function KE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function _D(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let l=0;l({editor:e,view:n,tr:r,dispatch:i})=>{let o=_D(t).split(/-(?!$)/),s=o.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return u?.steps.forEach(d=>{let f=d.map(r.mapping);f&&i&&r.maybeStep(f)}),!0};function ta(t,e,n={}){let{from:r,to:i,empty:o}=t.selection,s=e?zt(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(h,m)=>{if(h.isText)return;let b=Math.max(r,m),y=Math.min(i,m+h.nodeSize);l.push({node:h,from:b,to:y})});let u=i-r,d=l.filter(h=>s?s.name===h.node.type.name:!0).filter(h=>Zl(h.node.attrs,n,{strict:!1}));return o?!!d.length:d.reduce((h,m)=>h+m.to-m.from,0)>=u}var TD=(t,e={})=>({state:n,dispatch:r})=>{let i=zt(t,n.schema);return ta(n,i,e)?SE(n,r):!1},CD=()=>({state:t,dispatch:e})=>sp(t,e),AD=t=>({state:e,dispatch:n})=>{let r=zt(t,e.schema);return kE(r)(e,n)},MD=()=>({state:t,dispatch:e})=>np(t,e);function ic(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function LE(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var ND=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=ic(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(o=zt(t,r.schema)),l==="mark"&&(s=gi(t,r.schema)),i&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{o&&o===d.type&&n.setNodeMarkup(f,void 0,LE(d.attrs,e)),s&&d.marks.length&&d.marks.forEach(h=>{s===h.type&&n.addMark(f,f+d.nodeSize,s.create(LE(h.attrs,e)))})})}),!0):!1},kD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),OD=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),RD=()=>({state:t,dispatch:e})=>Zf(t,e),ID=()=>({state:t,dispatch:e})=>ep(t,e),DD=()=>({state:t,dispatch:e})=>TE(t,e),LD=()=>({state:t,dispatch:e})=>lp(t,e),PD=()=>({state:t,dispatch:e})=>ap(t,e);function Ep(t,e,n={},r={}){return jl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var BD=(t,e=!1,n={},r={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{var u,d;let{doc:f}=o;if(n.preserveWhitespace!=="full"){let h=Ep(t,i.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck});return s&&o.replaceWith(0,f.content.size,h).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:f.content.size},t,{parseOptions:n,errorOnInvalidContent:(d=r.errorOnInvalidContent)!==null&&d!==void 0?d:i.options.enableContentCheck})};function oc(t,e){let n=gi(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{s.push(...u.marks)});let l=s.find(u=>u.type.name===n.name);return l?{...l.attrs}:{}}function VE(t,e){let n=new li(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function Tp(t){for(let e=0;e{e(r)&&n.push({node:r,pos:i})}),n}function GE(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function Cp(t,e){for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Qi(t){return e=>Cp(e.$from,t)}function FD(t,e){let n=Dr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function HD(t,e){let n={from:0,to:t.content.size};return $E(t,n,e)}function $D(t,e){let n=zt(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,l=>{o.push(l)});let s=o.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Ap(t,e){let n=ic(typeof e=="string"?e:e.name,t.schema);return n==="node"?$D(t,e):n==="mark"?oc(t,e):{}}function zD(t,e=JSON.stringify){let n={};return t.filter(r=>{let i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function UD(t){let e=zD(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,s)=>s!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function qE(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{let s=[];if(i.ranges.length)i.forEach((l,u)=>{s.push({from:l,to:u})});else{let{from:l,to:u}=n[o];if(l===void 0||u===void 0)return;s.push({from:l,to:u})}s.forEach(({from:l,to:u})=>{let d=e.slice(o).map(l,-1),f=e.slice(o).map(u),h=e.invert().map(d,-1),m=e.invert().map(f);r.push({oldRange:{from:h,to:m},newRange:{from:d,to:f}})})}),UD(r)}function sc(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(i=>{let o=n.resolve(t),s=_p(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Xl(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function vp(t,e,n={}){let{empty:r,ranges:i}=t.selection,o=e?gi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(h=>o?o.name===h.type.name:!0).find(h=>Zl(h.attrs,n,{strict:!1}));let s=0,l=[];if(i.forEach(({$from:h,$to:m})=>{let b=h.pos,y=m.pos;t.doc.nodesBetween(b,y,(v,x)=>{if(!v.isText&&!v.marks.length)return;let S=Math.max(b,x),L=Math.min(y,x+v.nodeSize),D=L-S;s+=D,l.push(...v.marks.map(T=>({mark:T,from:S,to:L})))})}),s===0)return!1;let u=l.filter(h=>o?o.name===h.mark.type.name:!0).filter(h=>Zl(h.mark.attrs,n,{strict:!1})).reduce((h,m)=>h+m.to-m.from,0),d=l.filter(h=>o?h.mark.type!==o&&h.mark.type.excludes(o):!0).reduce((h,m)=>h+m.to-m.from,0);return(u>0?u+d:u)>=s}function Ur(t,e,n={}){if(!e)return ta(t,null,n)||vp(t,null,n);let r=ic(e,t.schema);return r==="node"?ta(t,e,n):r==="mark"?vp(t,e,n):!1}function PE(t,e){let{nodeExtensions:n}=tc(e),r=n.find(s=>s.name===t);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=Te(ne(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function na(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(na(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function ac(t){return t instanceof pe}function lc(t,e,n){let i=t.state.doc.content.size,o=zr(e,0,i),s=zr(n,0,i),l=t.coordsAtPos(o),u=t.coordsAtPos(s,-1),d=Math.min(l.top,u.top),f=Math.max(l.bottom,u.bottom),h=Math.min(l.left,u.left),m=Math.max(l.right,u.right),b=m-h,y=f-d,S={top:d,bottom:f,left:h,right:m,width:b,height:y,x:h,y:d};return{...S,toJSON:()=>S}}function WD(t,e,n){var r;let{selection:i}=e,o=null;if(rc(i)&&(o=i.$cursor),o){let l=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(l)||!l.some(u=>u.type.excludes(n))}let{ranges:s}=i;return s.some(({$from:l,$to:u})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,u.pos,(f,h,m)=>{if(d)return!1;if(f.isInline){let b=!m||m.type.allowsMarkType(n),y=!!n.isInSet(f.marks)||!f.marks.some(v=>v.type.excludes(n));d=b&&y}return!d}),d})}var KD=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:l}=o,u=gi(t,r.schema);if(i)if(s){let d=oc(r,u);n.addStoredMark(u.create({...d,...e}))}else l.forEach(d=>{let f=d.$from.pos,h=d.$to.pos;r.doc.nodesBetween(f,h,(m,b)=>{let y=Math.max(b,f),v=Math.min(b+m.nodeSize,h);m.marks.find(S=>S.type===u)?m.marks.forEach(S=>{u===S.type&&n.addMark(y,v,u.create({...S.attrs,...e}))}):n.addMark(y,v,u.create(e))})});return WD(r,n,u)},VD=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),GD=(t,e={})=>({state:n,dispatch:r,chain:i})=>{let o=zt(t,n.schema);return o.isTextblock?i().command(({commands:s})=>cp(o,e)(n)?!0:s.clearNodes()).command(({state:s})=>cp(o,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},qD=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,i=zr(t,0,r.content.size),o=pe.create(r,i);e.setSelection(o)}return!0},YD=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=le.atStart(r).from,l=le.atEnd(r).to,u=zr(i,s,l),d=zr(o,s,l),f=le.create(r,u,d);e.setSelection(f)}return!0},JD=t=>({state:e,dispatch:n})=>{let r=zt(t,e.schema);return OE(r)(e,n)};function BE(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var XD=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=e,{$from:l,$to:u}=o,d=i.extensionManager.attributes,f=Xl(d,l.node().type.name,l.node().attrs);if(o instanceof pe&&o.node.isBlock)return!l.parentOffset||!Hn(s,l.pos)?!1:(r&&(t&&BE(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let h=u.parentOffset===u.parent.content.size,m=l.depth===0?void 0:Tp(l.node(-1).contentMatchAt(l.indexAfter(-1))),b=h&&m?[{type:m,attrs:f}]:void 0,y=Hn(e.doc,e.mapping.map(l.pos),1,b);if(!b&&!y&&Hn(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(y=!0,b=m?[{type:m,attrs:f}]:void 0),r){if(y&&(o instanceof le&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,b),m&&!h&&!l.parentOffset&&l.parent.type!==m)){let v=e.mapping.map(l.before()),x=e.doc.resolve(v);l.node(-1).canReplaceWith(x.index(),x.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&BE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return y},ZD=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let l=zt(t,r.schema),{$from:u,$to:d}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(d))return!1;let h=u.node(-1);if(h.type!==l)return!1;let m=o.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==l||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let S=G.empty,L=u.index(-1)?1:u.index(-2)?2:3;for(let ee=u.depth-L;ee>=u.depth-3;ee-=1)S=G.from(u.node(ee).copy(S));let D=u.indexAfter(-1){if(Y>-1)return!1;ee.isTextblock&&ee.content.size===0&&(Y=z+1)}),Y>-1&&n.setSelection(le.near(n.doc.resolve(Y))),n.scrollIntoView()}return!0}let b=d.pos===u.end()?h.contentMatchAt(0).defaultType:null,y={...Xl(m,h.type.name,h.attrs),...e},v={...Xl(m,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,d.pos);let x=b?[{type:l,attrs:y},{type:b,attrs:v}]:[{type:l,attrs:y}];if(!Hn(n.doc,u.pos,2))return!1;if(i){let{selection:S,storedMarks:L}=r,{splittableMarks:D}=o.extensionManager,T=L||S.$to.parentOffset&&S.$from.marks();if(n.split(u.pos,2,x).scrollIntoView(),!T||!i)return!0;let $=T.filter(O=>D.includes(O.type.name));n.ensureMarks($)}return!0},fp=(t,e)=>{let n=Qi(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=t.doc.nodeAt(r);return n.node.type===i?.type&&nr(t.doc,n.pos)&&t.join(n.pos),!0},pp=(t,e)=>{let n=Qi(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=t.doc.nodeAt(r);return n.node.type===i?.type&&nr(t.doc,r)&&t.join(r),!0},jD=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:u,commands:d,can:f})=>{let{extensions:h,splittableMarks:m}=i.extensionManager,b=zt(t,s.schema),y=zt(e,s.schema),{selection:v,storedMarks:x}=s,{$from:S,$to:L}=v,D=S.blockRange(L),T=x||v.$to.parentOffset&&v.$from.marks();if(!D)return!1;let $=Qi(O=>PE(O.type.name,h))(v);if(D.depth>=1&&$&&D.depth-$.depth<=1){if($.node.type===b)return d.liftListItem(y);if(PE($.node.type.name,h)&&b.validContent($.node.content)&&l)return u().command(()=>(o.setNodeMarkup($.pos,b),!0)).command(()=>fp(o,b)).command(()=>pp(o,b)).run()}return!n||!T||!l?u().command(()=>f().wrapInList(b,r)?!0:d.clearNodes()).wrapInList(b,r).command(()=>fp(o,b)).command(()=>pp(o,b)).run():u().command(()=>{let O=f().wrapInList(b,r),Y=T.filter(ee=>m.includes(ee.type.name));return o.ensureMarks(Y),O?!0:d.clearNodes()}).wrapInList(b,r).command(()=>fp(o,b)).command(()=>pp(o,b)).run()},QD=(t,e={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=gi(t,r.schema);return vp(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},eL=(t,e,n={})=>({state:r,commands:i})=>{let o=zt(t,r.schema),s=zt(e,r.schema),l=ta(r,o,n),u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),l?i.setNode(s,u):i.setNode(o,{...u,...n})},tL=(t,e={})=>({state:n,commands:r})=>{let i=zt(t,n.schema);return ta(n,i,e)?r.lift(i):r.wrapIn(i,e)},nL=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r=0;u-=1)s.step(l.steps[u].invert(l.docs[u]));if(o.text){let u=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,u))}else s.delete(o.from,o.to)}return!0}}return!1},rL=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},iL=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,u=gi(t,r.schema),{$from:d,empty:f,ranges:h}=l;if(!i)return!0;if(f&&s){let{from:m,to:b}=l,y=(o=d.marks().find(x=>x.type===u))===null||o===void 0?void 0:o.attrs,v=_p(d,u,y);v&&(m=v.from,b=v.to),n.removeMark(m,b,u)}else h.forEach(m=>{n.removeMark(m.$from.pos,m.$to.pos,u)});return n.removeStoredMark(u),!0},oL=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=ic(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(o=zt(t,r.schema)),l==="mark"&&(s=gi(t,r.schema)),i&&n.selection.ranges.forEach(u=>{let d=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(d,f,(h,m)=>{o&&o===h.type&&n.setNodeMarkup(m,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(b=>{if(s===b.type){let y=Math.max(m,d),v=Math.min(m+h.nodeSize,f);n.addMark(y,v,s.create({...b.attrs,...e}))}})})}),!0):!1},sL=(t,e={})=>({state:n,dispatch:r})=>{let i=zt(t,n.schema);return ME(i,e)(n,r)},aL=(t,e={})=>({state:n,dispatch:r})=>{let i=zt(t,n.schema);return NE(i,e)(n,r)},lL=Object.freeze({__proto__:null,blur:YI,clearContent:JI,clearNodes:XI,command:ZI,createParagraphNear:jI,cut:QI,deleteCurrentNode:eD,deleteNode:tD,deleteRange:nD,deleteSelection:rD,enter:iD,exitCode:oD,extendMarkRange:aD,first:lD,focus:cD,forEach:uD,insertContent:dD,insertContentAt:hD,joinBackward:bD,joinDown:gD,joinForward:yD,joinItemBackward:ED,joinItemForward:vD,joinTextblockBackward:wD,joinTextblockForward:xD,joinUp:mD,keyboardShortcut:SD,lift:TD,liftEmptyBlock:CD,liftListItem:AD,newlineInCode:MD,resetAttributes:ND,scrollIntoView:kD,selectAll:OD,selectNodeBackward:RD,selectNodeForward:ID,selectParentNode:DD,selectTextblockEnd:LD,selectTextblockStart:PD,setContent:BD,setMark:KD,setMeta:VD,setNode:GD,setNodeSelection:qD,setTextSelection:YD,sinkListItem:JD,splitBlock:XD,splitListItem:ZD,toggleList:jD,toggleMark:QD,toggleNode:eL,toggleWrap:tL,undoInputRule:nL,unsetAllMarks:rL,unsetMark:iL,updateAttributes:oL,wrapIn:sL,wrapInList:aL}),cL=We.create({name:"commands",addCommands(){return{...lL}}}),uL=We.create({name:"drop",addProseMirrorPlugins(){return[new ke({key:new ze("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),dL=We.create({name:"editable",addProseMirrorPlugins(){return[new ke({key:new ze("editable"),props:{editable:()=>this.editor.options.editable}})]}}),fL=We.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new ke({key:new ze("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),pL=We.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{let{selection:u,doc:d}=l,{empty:f,$anchor:h}=u,{pos:m,parent:b}=h,y=h.parent.isTextblock&&m>0?l.doc.resolve(m-1):h,v=y.parent.type.spec.isolating,x=h.pos-h.parentOffset,S=v&&y.parent.childCount===1?x===h.pos:ue.atStart(d).from===m;return!f||!b.type.isTextblock||b.textContent.length||!S||S&&h.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Sp()||KE()?o:i},addProseMirrorPlugins(){return[new ke({key:new ze("clearDocument"),appendTransaction:(t,e,n)=>{let r=t.some(v=>v.docChanged)&&!e.doc.eq(n.doc),i=t.some(v=>v.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:l}=e.selection,u=ue.atStart(e.doc).from,d=ue.atEnd(e.doc).to;if(o||!(s===u&&l===d)||!na(n.doc))return;let m=n.tr,b=ec({state:n,transaction:m}),{commands:y}=new Vo({editor:this.editor,state:b});if(y.clearNodes(),!!m.steps.length)return m}})]}}),hL=We.create({name:"paste",addProseMirrorPlugins(){return[new ke({key:new ze("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),mL=We.create({name:"tabindex",addProseMirrorPlugins(){return[new ke({key:new ze("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var wp=class t{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new t(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new t(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new t(e,this.editor)}get children(){let e=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=this.pos+r+(o?0:1),l=this.resolvedPos.doc.resolve(s);if(!i&&l.depth<=this.depth)return;let u=new t(l,this.editor,i,i?n:null);i&&(u.actualDepth=this.depth+1),e.push(new t(l,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){let o=i.node.attrs,s=Object.keys(n);for(let l=0;l{r&&i.length>0||(s.node.type.name===e&&o.every(u=>n[u]===s.node.attrs[u])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},gL=`.ProseMirror { position: relative; } @@ -104,18 +104,18 @@ img.ProseMirror-separator { .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 -}`;function bL(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var Ql=class extends hp{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=bL(gL,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){let r=FE(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;let n=this.state.plugins,r=n;if([].concat(e).forEach(o=>{let s=typeof o=="string"?`${o}$`:o.key;r=n.filter(l=>!l.key.startsWith(s))}),n.length===r.length)return;let i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;let i=[...this.options.enableCoreExtensions?[dL,qI.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),cL,fL,pL,mL,uL,hL].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new bp(i,this)}createCommandManager(){this.commandManager=new Vo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=Ep(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),e=Ep(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let n=zE(e,this.options.autofocus);this.view=new zl(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:kl.create({doc:e,selection:n||void 0})}),this.view.dom.setAttribute("role","textbox"),this.view.dom.getAttribute("aria-label")||this.view.dom.setAttribute("aria-label","Rich-Text Editor");let r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();let i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}let n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Ap(this.state,e)}isActive(e,n){let r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return Ur(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return FD(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:n=` +}`;function bL(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var Ql=class extends hp{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=bL(gL,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){let r=HE(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;let n=this.state.plugins,r=n;if([].concat(e).forEach(o=>{let s=typeof o=="string"?`${o}$`:o.key;r=n.filter(l=>!l.key.startsWith(s))}),n.length===r.length)return;let i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;let i=[...this.options.enableCoreExtensions?[dL,qI.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),cL,fL,pL,mL,uL,hL].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new bp(i,this)}createCommandManager(){this.commandManager=new Vo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=Ep(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),e=Ep(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let n=UE(e,this.options.autofocus);this.view=new zl(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:kl.create({doc:e,selection:n||void 0})}),this.view.dom.setAttribute("role","textbox"),this.view.dom.getAttribute("aria-label")||this.view.dom.setAttribute("aria-label","Rich-Text Editor");let r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();let i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}let n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Ap(this.state,e)}isActive(e,n){let r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return Ur(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return FD(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:n=` -`,textSerializers:r={}}=e||{};return HD(this.state.doc,{blockSeparator:n,textSerializers:{...$E(this.schema),...r}})}get isEmpty(){return na(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){let n=this.state.doc.resolve(e);return new wp(n,this)}get $doc(){return this.$pos(0)}};function Wn(t){return new Go({find:t.find,handler:({state:e,range:n,match:r})=>{let i=Te(t.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:o}=e,s=r[r.length-1],l=r[0];if(s){let c=l.search(/\S/),d=n.from+l.indexOf(s),f=d+s.length;if(sc(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(w=>w===t.type&&w!==b.mark.type)).filter(b=>b.to>d).length)return null;fn.from&&o.delete(n.from+c,d);let m=n.from+c+s.length;o.addMark(n.from+c,m,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function cc(t){return new Go({find:t.find,handler:({state:e,range:n,match:r})=>{let i=Te(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from,l=n.to,c=t.type.create(i);if(r[1]){let d=r[0].lastIndexOf(r[1]),f=s+d;f>l?f=l:l=f+r[1].length;let h=r[0][r[0].length-1];o.insertText(h,s+r[0].length-1),o.replaceWith(f,l,c)}else if(r[0]){let d=t.type.isInline?s:s-1;o.insert(d,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()}})}function ra(t){return new Go({find:t.find,handler:({state:e,range:n,match:r})=>{let i=e.doc.resolve(n.from),o=Te(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function bi(t){return new Go({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{let o=Te(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),d=c&&Do(c,t.type,o);if(!d)return null;if(s.wrap(c,d),t.keepMarks&&t.editor){let{selection:h,storedMarks:m}=e,{splittableMarks:b}=t.editor.extensionManager,y=m||h.$to.parentOffset&&h.$from.marks();if(y){let w=y.filter(_=>b.includes(_.type.name));s.ensureMarks(w)}}if(t.keepAttributes){let h=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(h,o).run()}let f=s.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&nr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&s.join(n.from-1)}})}var ce=class t{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Te(ne(this,"addOptions",{name:this.name}))),this.storage=Te(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>nc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Te(ne(n,"addOptions",{name:n.name})),n.storage=Te(ne(n,"addStorage",{name:n.name,options:n.options})),n}};function vn(t){return new gp({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{let o=Te(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;let{tr:s}=e,l=r[r.length-1],c=r[0],d=n.to;if(l){let f=c.search(/\S/),h=n.from+c.indexOf(l),m=h+l.length;if(sc(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(_=>_===t.type&&_!==y.mark.type)).filter(y=>y.to>h).length)return null;mn.from&&s.delete(n.from+f,h),d=n.from+f+l.length,s.addMark(n.from+f,d,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}function qE(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var yL=/^\s*>\s$/,YE=ce.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[bi({find:yL,type:this.type})]}});var EL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,vL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,wL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,xL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,JE=st.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Wn({find:EL,type:this.type}),Wn({find:wL,type:this.type})]},addPasteRules(){return[vn({find:vL,type:this.type}),vn({find:xL,type:this.type})]}});var _L="listItem",XE="textStyle",ZE=/^\s*([-+*])\s$/,jE=ce.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_L,this.editor.getAttributes(XE)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=bi({find:ZE,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bi({find:ZE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(XE),editor:this.editor})),[t]}});var SL=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,TL=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,QE=st.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Wn({find:SL,type:this.type})]},addPasteRules(){return[vn({find:TL,type:this.type})]}});var ev=st.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{let n=oc(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}});var tv=We.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});var nv=ce.create({name:"doc",topNode:!0,content:"block+"});function rv(t={}){return new ke({view(e){return new Mp(e,t)}})}var Mp=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let l=e.nodeBefore,c=e.nodeAfter;if(l||c){let d=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(d){let f=d.getBoundingClientRect(),h=l?f.bottom:f.top;l&&c&&(h=(h+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:f.left,right:f.right,top:h-this.width/2,bottom:h+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Al(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}};var iv=We.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[rv(this.options)]}});var rn=class t extends ue{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):ue.near(r)}content(){return Z.empty}eq(e){return e instanceof t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))}getBookmark(){return new Np(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!CL(e)||!AL(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&t.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)0){o=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let c=e.doc.resolve(i);if(t.valid(c))return c}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!pe.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let l=e.doc.resolve(i);if(t.valid(l))return l}return null}}};rn.prototype.visible=!1;rn.findFrom=rn.findGapCursorFrom;ue.jsonID("gapcursor",rn);var Np=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return rn.valid(n)?new rn(n):ue.near(n)}};function CL(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function AL(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function ov(){return new ke({props:{decorations:OL,createSelectionBetween(t,e,n){return e.pos==n.pos&&rn.valid(n)?new rn(n):null},handleClick:NL,handleKeyDown:ML,handleDOMEvents:{beforeinput:kL}}})}var ML=ea({ArrowLeft:uc("horiz",-1),ArrowRight:uc("horiz",1),ArrowUp:uc("vert",-1),ArrowDown:uc("vert",1)});function uc(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,c=s.empty;if(s instanceof le){if(!o.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=rn.findGapCursorFrom(l,e,c);return d?(i&&i(r.tr.setSelection(new rn(d))),!0):!1}}function NL(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!rn.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&pe.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new rn(r))),!0)}function kL(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof rn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=G.empty;for(let s=r.length-1;s>=0;s--)i=G.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new Z(i,0,0));return o.setSelection(le.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function OL(t){if(!(t.selection instanceof rn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ot.create(t.doc,[vt.widget(t.selection.head,e,{key:"gapcursor"})])}var sv=We.create({name:"gapCursor",addProseMirrorPlugins(){return[ov()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Te(ne(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}});var av=ce.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Q(this.options.HTMLAttributes,t)]},renderText(){return` -`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,c=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:f})=>{if(f&&c&&s){let h=c.filter(m=>l.includes(m.type.name));d.ensureMarks(h)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var lv=ce.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Q(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ra({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var dc=200,qt=function(){};qt.prototype.append=function(e){return e.length?(e=qt.from(e),!this.length&&e||e.length=n?qt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};qt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};qt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};qt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};qt.from=function(e){return e instanceof qt?e:e&&e.length?new cv(e):qt.empty};var cv=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var c=o;c=s;c--)if(i(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=dc)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=dc)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(qt);qt.empty=new cv([]);var RL=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(qt),kp=qt;var IL=500,to=class t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,c,d=[],f=[];return this.items.forEach((h,m)=>{if(!h.step){i||(i=this.remapping(r,m+1),o=i.maps.length),o--,f.push(h);return}if(i){f.push(new mr(h.map));let b=h.step.map(i.slice(o)),y;b&&s.maybeStep(b).doc&&(y=s.mapping.maps[s.mapping.maps.length-1],d.push(new mr(y,void 0,void 0,d.length+f.length))),o--,y&&i.appendMap(y,o)}else s.maybeStep(h.step);if(h.selection)return l=i?h.selection.map(i.slice(o)):h.selection,c=new t(this.items.slice(0,r).append(f.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:l}}addTransform(e,n,r,i){let o=[],s=this.eventCount,l=this.items,c=!i&&l.length?l.get(l.length-1):null;for(let f=0;fLL&&(l=DL(l,d),s-=d),new t(l.append(o),s)}remapping(e,n){let r=new Hs;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new mr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(m=>{m.selection&&l--},i);let c=n;this.items.forEach(m=>{let b=o.getMirror(--c);if(b==null)return;s=Math.min(s,b);let y=o.maps[b];if(m.step){let w=e.steps[b].invert(e.docs[b]),_=m.selection&&m.selection.map(o.slice(c+1,b));_&&l++,r.push(new mr(y,w,_))}else r.push(new mr(y))},i);let d=[];for(let m=n;mIL&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let c=s.step.map(n.slice(r)),d=c&&c.getMap();if(r--,d&&n.appendMap(d,r),c){let f=s.selection&&s.selection.map(n.slice(r));f&&o++;let h=new mr(d.invert(),c,f),m,b=i.length-1;(m=i.length&&i[b].merge(h))?i[b]=m:i.push(h)}}else s.map&&r--},this.items.length,0),new t(kp.from(i.reverse()),o)}};to.empty=new to(kp.empty,0);function DL(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}var mr=class t{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},gr=class{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}},LL=20;function PL(t,e,n,r){let i=n.getMeta(eo),o;if(i)return i.historyState;n.getMeta(HL)&&(t=new gr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(eo))return s.getMeta(eo).redo?new gr(t.done.addTransform(n,void 0,r,fc(e)),t.undone,uv(n.mapping.maps),t.prevTime,t.prevComposition):new gr(t.done,t.undone.addTransform(n,void 0,r,fc(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),c=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!BL(n,t.prevRanges)),d=s?Op(t.prevRanges,n.mapping):uv(n.mapping.maps);return new gr(t.done.addTransform(n,c?e.selection.getBookmark():void 0,r,fc(e)),to.empty,d,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new gr(t.done.rebased(n,o),t.undone.rebased(n,o),Op(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new gr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Op(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function BL(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function uv(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Op(t,e){if(!t)return null;let n=[];for(let r=0;r{let i=eo.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=FL(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}var Ip=pc(!1,!0),Dp=pc(!0,!0),Oz=pc(!1,!1),Rz=pc(!0,!1);var pv=We.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Ip(t,e),redo:()=>({state:t,dispatch:e})=>Dp(t,e)}},addProseMirrorPlugins(){return[fv(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var hv=ce.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Q(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{let{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):ac(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:l})=>{var c;if(l){let{$to:d}=s.selection,f=d.end();if(d.nodeAfter)d.nodeAfter.isTextblock?s.setSelection(le.create(s.doc,d.pos+1)):d.nodeAfter.isBlock?s.setSelection(pe.create(s.doc,d.pos)):s.setSelection(le.create(s.doc,d.pos));else{let h=(c=d.parent.type.contentMatch.defaultType)===null||c===void 0?void 0:c.create();h&&(s.insert(f,h),s.setSelection(le.create(s.doc,f+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[cc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var $L=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,zL=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,UL=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,WL=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,mv=st.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Wn({find:$L,type:this.type}),Wn({find:UL,type:this.type})]},addPasteRules(){return[vn({find:zL,type:this.type}),vn({find:WL,type:this.type})]}});var Lp=ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Q(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var KL="listItem",gv="textStyle",bv=/^(\d+)\.\s$/,yv=ce.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,...n}=t;return e===1?["ol",Q(this.options.HTMLAttributes,n),0]:["ol",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(KL,this.editor.getAttributes(gv)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=bi({find:bv,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bi({find:bv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(gv)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}});var hc=ce.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Ev=We.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ke({key:new ze("placeholder"),props:{decorations:({doc:t,selection:e})=>{let n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;let o=this.editor.isEmpty;return t.descendants((s,l)=>{let c=r>=l&&r<=l+s.nodeSize,d=!s.isLeaf&&na(s);if((c||!this.options.showOnlyCurrent)&&d){let f=[this.options.emptyNodeClass];o&&f.push(this.options.emptyEditorClass);let h=vt.node(l,l+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:c}):this.options.placeholder});i.push(h)}return this.options.includeChildren}),ot.create(t,i)}}})]}});var VL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,GL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vv=st.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Wn({find:VL,type:this.type})]},addPasteRules(){return[vn({find:GL,type:this.type})]}});var wv=st.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}});var xv=st.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});var Bp,Fp;if(typeof WeakMap<"u"){let t=new WeakMap;Bp=e=>t.get(e),Fp=(e,n)=>(t.set(e,n),n)}else{let t=[],n=0;Bp=r=>{for(let i=0;i(n==10&&(n=0),t[n++]=r,t[n++]=i)}var mt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(o||(o=[])).push({type:"overlong_rowspan",pos:f,n:S-D});break}let T=i+D*e;for(let $=0;$<_;$++){r[T+$]==0?r[T+$]=f:(o||(o=[])).push({type:"collision",row:d,pos:f,n:_-$});let O=L&&L[$];if(O){let Y=(T+$)%e*2,ee=s[Y];ee==null||ee!=O&&s[Y+1]==1?(s[Y]=O,s[Y+1]=1):ee==O&&s[Y+1]++}}}i+=_,f+=w.nodeSize}let m=(d+1)*e,b=0;for(;ir&&(o+=d.attrs.colspan)}}for(let s=0;s1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function JL(t,e,n){t.problems||(t.problems=[]);let r={};for(let i=0;i0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function ZL(t){for(let e=t.depth;e>0;e--){let n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function or(t){let e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function vc(t){let e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let n=qo(e.$head)||jL(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function jL(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Hp(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function QL(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Up(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Rv(t,e,n){let r=t.node(-1),i=mt.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function no(t,e,n=1){let r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Iv(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;if!=n.pos-o);c.unshift(n.pos-o);let d=c.map(f=>{let h=r.nodeAt(f);if(!h)throw RangeError(`No cell with offset ${f} found`);let m=o+f+1;return new Bo(l.resolve(m),l.resolve(m+h.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){let r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Hp(r)&&Hp(i)&&Up(r,i)){let o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Wr.rowSelection(r,i):o&&this.isColSelection()?Wr.colSelection(r,i):new Wr(r,i)}return le.between(r,i)}content(){let e=this.$anchorCell.node(-1),n=mt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let c=i.top;c0||_>0){let S=y.attrs;if(w>0&&(S=no(S,0,w)),_>0&&(S=no(S,S.colspan-_,_)),b.lefti.bottom){let S={...y.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=e.node(-1),i=mt.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(n.pos-o),c=e.node(0);return s.top<=l.top?(s.top>0&&(e=c.resolve(o+i.map[s.left])),l.bottom0&&(n=c.resolve(o+i.map[l.left])),s.bottom0)return!1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof Wr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),i=mt.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(n.pos-o),c=e.node(0);return s.left<=l.left?(s.left>0&&(e=c.resolve(o+i.map[s.top*i.width])),l.right0&&(n=c.resolve(o+i.map[l.top*i.width])),s.right{e.push(vt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ot.create(t.doc,e)}function rP({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(i+1)=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function iP({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){let o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){let o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function oP(t,e,n){let r=(e||t).selection,i=(e||t).doc,o,s;if(r instanceof pe&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=et.create(i,r.from);else if(s=="row"){let l=i.resolve(r.from+1);o=et.rowSelection(l,l)}else if(!n){let l=mt.get(r.node),c=r.from+1,d=c+l.map[l.width*l.height-1];o=et.create(i,c+1,d)}}else r instanceof le&&rP(r)?o=le.create(i,r.from):r instanceof le&&iP(r)&&(o=le.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var sP=new ze("fix-tables");function Lv(t,e,n,r){let i=t.childCount,o=e.childCount;e:for(let s=0,l=0;s{i.type.spec.tableRole=="table"&&(n=aP(t,i,o,n))};return e?e.doc!=t.doc&&Lv(e.doc,t.doc,0,r):t.doc.descendants(r),n}function aP(t,e,n,r){let i=mt.get(e);if(!i.problems)return r;r||(r=t.tr);let o=[];for(let c=0;c0){let b="cell";f.firstChild&&(b=f.firstChild.type.spec.tableRole);let y=[];for(let _=0;_0?-1:0;eP(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s0&&i0&&e.map[l-1]==c||i0?-1:0;cP(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let d=0,f=e.width*i;d0&&i0&&h==e.map[f-e.width]){let m=n.nodeAt(h).attrs;t.setNodeMarkup(t.mapping.slice(l).map(h+r),null,{...m,rowspan:m.rowspan-1}),d+=m.colspan-1}else if(i0&&n[o]==n[o-1]||r.right0&&n[i]==n[i-t]||r.bottomn[r.type.spec.tableRole])(t,e)}function fP(t){return(e,n)=>{var r;let i=e.selection,o,s;if(i instanceof et){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=ZL(i.$from),!o)return!1;s=(r=qo(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let l=o.attrs,c=[],d=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let f=br(e),h=e.tr;for(let b=0;b{s.attrs[t]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}}function pP(t){return function(e,n){if(!or(e))return!1;if(n){let r=on(e.schema),i=br(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(c=>i.table.nodeAt(c));for(let c=0;c{let y=b+o.tableStart,w=s.doc.nodeAt(y);w&&s.setNodeMarkup(y,m,w.attrs)}),r(s)}return!0}}var bU=Yo("row",{useDeprecatedLogic:!0}),yU=Yo("column",{useDeprecatedLogic:!0}),Vv=Yo("cell",{useDeprecatedLogic:!0});function hP(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){let o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function mc(t,e){let n=t.selection;if(!(n instanceof et))return!1;if(e){let r=t.tr,i=on(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new Z(i,0,0))}),r.docChanged&&e(r)}return!0}function mP(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;let i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let c=0;c=0;s--){let{rowspan:l,colspan:c}=o.child(s).attrs;for(let d=i;d=e.length&&e.push(G.empty),n[i]r&&(m=m.type.createChecked(no(m.attrs,m.attrs.colspan,f+m.attrs.colspan-r),m.content)),d.push(m),f+=m.attrs.colspan;for(let b=1;bi&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,i-h.attrs.rowspan)},h.content)),c.push(h)}o.push(G.from(c))}n=o,e=i}return{width:t,height:e,rows:n}}function yP(t,e,n,r,i,o,s){let l=t.doc.type.schema,c=on(l),d,f;if(i>e.width)for(let h=0,m=0;he.height){let h=[];for(let y=0,w=(e.height-1)*e.width;y=e.width?!1:n.nodeAt(e.map[w+y]).type==c.header_cell;h.push(_?f||(f=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}let m=c.row.create(null,G.from(h)),b=[];for(let y=e.height;y{if(!i)return!1;let o=n.selection;if(o instanceof et)return yc(n,r,ue.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;let s=qv(i,t,e);if(s==null)return!1;if(t=="horiz")return yc(n,r,ue.near(n.doc.resolve(o.head+e),e));{let l=n.doc.resolve(s),c=Rv(l,t,e),d;return c?d=ue.near(c,1):e<0?d=ue.near(n.doc.resolve(l.before(-1)),-1):d=ue.near(n.doc.resolve(l.after(-1)),1),yc(n,r,d)}}}function bc(t,e){return(n,r,i)=>{if(!i)return!1;let o=n.selection,s;if(o instanceof et)s=o;else{let c=qv(i,t,e);if(c==null)return!1;s=new et(n.doc.resolve(c))}let l=Rv(s.$headCell,t,e);return l?yc(n,r,new et(s.$anchorCell,l)):!1}}function vP(t,e){let n=t.state.doc,r=qo(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new et(r))),!0):!1}function wP(t,e,n){if(!or(t.state))return!1;let r=mP(n),i=t.state.selection;if(i instanceof et){r||(r={width:1,height:1,rows:[G.from($p(on(t.state.schema).cell,n))]});let o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=mt.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=bP(r,l.right-l.left,l.bottom-l.top),Av(t.state,t.dispatch,s,l,r),!0}else if(r){let o=vc(t.state),s=o.start(-1);return Av(t.state,t.dispatch,s,mt.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function xP(t,e){var n;if(e.ctrlKey||e.metaKey)return;let r=Mv(t,e.target),i;if(e.shiftKey&&t.state.selection instanceof et)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=qo(t.state.selection.$anchor))!=null&&((n=Pp(t,e))==null?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(c,d){let f=Pp(t,d),h=yi.getState(t.state)==null;if(!f||!Up(c,f))if(h)f=c;else return;let m=new et(c,f);if(h||!t.state.selection.eq(m)){let b=t.state.tr.setSelection(m);h&&b.setMeta(yi,c.pos),t.dispatch(b)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),yi.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(yi,-1))}function l(c){let d=c,f=yi.getState(t.state),h;if(f!=null)h=t.state.doc.resolve(f);else if(Mv(t,d.target)!=r&&(h=Pp(t,e),!h))return s();h&&o(h,d)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function qv(t,e,n){if(!(t.state.selection instanceof le))return null;let{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){let l=r.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?l:null}}return null}function Mv(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Pp(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?qo(t.state.doc.resolve(n.pos)):null}var _P=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),zp(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,zp(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function zp(t,e,n,r,i,o){var s;let l=0,c=!0,d=e.firstChild,f=t.firstChild;if(f){for(let h=0,m=0;hnew r(m,n,b)),new SP(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=kn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{TP(s,l,t,i)},mouseleave:s=>{CP(s)},mousedown:(s,l)=>{AP(s,l,e,n)}},decorations:s=>{let l=kn.getState(s);if(l&&l.activeHandle>-1)return RP(s,l.activeHandle)},nodeViews:{}}});return o}var SP=class Ec{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){let n=this,r=e.getMeta(kn);if(r&&r.setHandle!=null)return new Ec(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Ec(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Hp(e.doc.resolve(i))||(i=-1),new Ec(i,n.dragging)}return n}};function TP(t,e,n,r){let i=kn.getState(t.state);if(i&&!i.dragging){let o=NP(e.target),s=-1;if(o){let{left:l,right:c}=o.getBoundingClientRect();e.clientX-l<=n?s=Nv(t,e,"left",n):c-e.clientX<=n&&(s=Nv(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){let l=t.state.doc.resolve(s),c=l.node(-1),d=mt.get(c),f=l.start(-1);if(d.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==d.width-1)return}Jv(t,s)}}}function CP(t){let e=kn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Jv(t,-1)}function AP(t,e,n,r){var i;let o=(i=t.dom.ownerDocument.defaultView)!=null?i:window,s=kn.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=t.state.doc.nodeAt(s.activeHandle),c=MP(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(kn,{setDragging:{startX:e.clientX,startWidth:c}}));function d(h){o.removeEventListener("mouseup",d),o.removeEventListener("mousemove",f);let m=kn.getState(t.state);m?.dragging&&(kP(t,m.activeHandle,kv(m.dragging,h,n)),t.dispatch(t.state.tr.setMeta(kn,{setDragging:null})))}function f(h){if(!h.which)return d(h);let m=kn.getState(t.state);if(m&&m.dragging){let b=kv(m.dragging,h,n);Ov(t,m.activeHandle,b,r)}}return Ov(t,s.activeHandle,c,r),o.addEventListener("mouseup",d),o.addEventListener("mousemove",f),e.preventDefault(),!0}function MP(t,e,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=t.domAtPos(e),l=o.node.childNodes[o.offset].offsetWidth,c=n;if(r)for(let d=0;d{let r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function LP(t,e,n,r,i){let o=DP(t),s=[],l=[];for(let d=0;d{let{selection:e}=t.state;if(!PP(e))return!1;let n=0,r=Cp(e.ranges[0].$from,o=>o.type.name==="table");return r?.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Qv=ce.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:qp,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=IP(t,this.options.cellMinWidth);return["table",Q(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{let s=LP(o.schema,t,e,n);if(i){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(le.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Bv(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Fv(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Hv(t,e),addRowBefore:()=>({state:t,dispatch:e})=>zv(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Uv(t,e),deleteRow:()=>({state:t,dispatch:e})=>Wv(t,e),deleteTable:()=>({state:t,dispatch:e})=>Gv(t,e),mergeCells:()=>({state:t,dispatch:e})=>Kp(t,e),splitCell:()=>({state:t,dispatch:e})=>Vp(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Yo("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Yo("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Vv(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Kp(t,e)?!0:Vp(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Kv(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Gp(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Gp(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Wp(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=et.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:wc,"Mod-Backspace":wc,Delete:wc,"Mod-Delete":wc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Yv({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Xv({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Te(ne(t,"tableRole",e))}}});var ew=ce.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Q(this.options.HTMLAttributes,t),0]}});var tw=ce.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Q(this.options.HTMLAttributes,t),0]}});var nw=ce.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Q(this.options.HTMLAttributes,t),0]}});var rw=ce.create({name:"text",group:"inline"});var iw=st.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var BP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,FP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ow=st.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Wn({find:BP,type:this.type})]},addPasteRules(){return[vn({find:FP,type:this.type})]}});var gt="top",It="bottom",At="right",wt="left",xc="auto",Ei=[gt,It,At,wt],Kr="start",ro="end",sw="clippingParents",_c="viewport",Jo="popper",aw="reference",Yp=Ei.reduce(function(t,e){return t.concat([e+"-"+Kr,e+"-"+ro])},[]),Sc=[].concat(Ei,[xc]).reduce(function(t,e){return t.concat([e,e+"-"+Kr,e+"-"+ro])},[]),HP="beforeRead",$P="read",zP="afterRead",UP="beforeMain",WP="main",KP="afterMain",VP="beforeWrite",GP="write",qP="afterWrite",lw=[HP,$P,zP,UP,WP,KP,VP,GP,qP];function Ut(t){return t?(t.nodeName||"").toLowerCase():null}function lt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Kn(t){var e=lt(t).Element;return t instanceof e||t instanceof Element}function Dt(t){var e=lt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Xo(t){if(typeof ShadowRoot>"u")return!1;var e=lt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function YP(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!Dt(o)||!Ut(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var l=i[s];l===!1?o.removeAttribute(s):o.setAttribute(s,l===!0?"":l)}))})}function JP(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),l=s.reduce(function(c,d){return c[d]="",c},{});!Dt(i)||!Ut(i)||(Object.assign(i.style,l),Object.keys(o).forEach(function(c){i.removeAttribute(c)}))})}}var ia={name:"applyStyles",enabled:!0,phase:"write",fn:YP,effect:JP,requires:["computeStyles"]};function Wt(t){return t.split("-")[0]}var sr=Math.max,io=Math.min,Vr=Math.round;function Zo(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function oa(){return!/^((?!chrome|android).)*safari/i.test(Zo())}function Vn(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&Dt(t)&&(i=t.offsetWidth>0&&Vr(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&Vr(r.height)/t.offsetHeight||1);var s=Kn(t)?lt(t):window,l=s.visualViewport,c=!oa()&&n,d=(r.left+(c&&l?l.offsetLeft:0))/i,f=(r.top+(c&&l?l.offsetTop:0))/o,h=r.width/i,m=r.height/o;return{width:h,height:m,top:f,right:d+h,bottom:f+m,left:d,x:d,y:f}}function oo(t){var e=Vn(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function sa(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Xo(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function hn(t){return lt(t).getComputedStyle(t)}function Jp(t){return["table","td","th"].indexOf(Ut(t))>=0}function Yt(t){return((Kn(t)?t.ownerDocument:t.document)||window.document).documentElement}function Gr(t){return Ut(t)==="html"?t:t.assignedSlot||t.parentNode||(Xo(t)?t.host:null)||Yt(t)}function cw(t){return!Dt(t)||hn(t).position==="fixed"?null:t.offsetParent}function XP(t){var e=/firefox/i.test(Zo()),n=/Trident/i.test(Zo());if(n&&Dt(t)){var r=hn(t);if(r.position==="fixed")return null}var i=Gr(t);for(Xo(i)&&(i=i.host);Dt(i)&&["html","body"].indexOf(Ut(i))<0;){var o=hn(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function ar(t){for(var e=lt(t),n=cw(t);n&&Jp(n)&&hn(n).position==="static";)n=cw(n);return n&&(Ut(n)==="html"||Ut(n)==="body"&&hn(n).position==="static")?e:n||XP(t)||e}function so(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ao(t,e,n){return sr(t,io(e,n))}function uw(t,e,n){var r=ao(t,e,n);return r>n?n:r}function aa(){return{top:0,right:0,bottom:0,left:0}}function la(t){return Object.assign({},aa(),t)}function ca(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var ZP=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,la(typeof e!="number"?e:ca(e,Ei))};function jP(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,l=Wt(n.placement),c=so(l),d=[wt,At].indexOf(l)>=0,f=d?"height":"width";if(!(!o||!s)){var h=ZP(i.padding,n),m=oo(o),b=c==="y"?gt:wt,y=c==="y"?It:At,w=n.rects.reference[f]+n.rects.reference[c]-s[c]-n.rects.popper[f],_=s[c]-n.rects.reference[c],S=ar(o),L=S?c==="y"?S.clientHeight||0:S.clientWidth||0:0,D=w/2-_/2,T=h[b],$=L-m[f]-h[y],O=L/2-m[f]/2+D,Y=ao(T,O,$),ee=c;n.modifiersData[r]=(e={},e[ee]=Y,e.centerOffset=Y-O,e)}}function QP(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||sa(e.elements.popper,i)&&(e.elements.arrow=i))}var dw={name:"arrow",enabled:!0,phase:"main",fn:jP,effect:QP,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Gn(t){return t.split("-")[1]}var eB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function tB(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Vr(n*i)/i||0,y:Vr(r*i)/i||0}}function fw(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,l=t.position,c=t.gpuAcceleration,d=t.adaptive,f=t.roundOffsets,h=t.isFixed,m=s.x,b=m===void 0?0:m,y=s.y,w=y===void 0?0:y,_=typeof f=="function"?f({x:b,y:w}):{x:b,y:w};b=_.x,w=_.y;var S=s.hasOwnProperty("x"),L=s.hasOwnProperty("y"),D=wt,T=gt,$=window;if(d){var O=ar(n),Y="clientHeight",ee="clientWidth";if(O===lt(n)&&(O=Yt(n),hn(O).position!=="static"&&l==="absolute"&&(Y="scrollHeight",ee="scrollWidth")),O=O,i===gt||(i===wt||i===At)&&o===ro){T=It;var z=h&&O===$&&$.visualViewport?$.visualViewport.height:O[Y];w-=z-r.height,w*=c?1:-1}if(i===wt||(i===gt||i===It)&&o===ro){D=At;var re=h&&O===$&&$.visualViewport?$.visualViewport.width:O[ee];b-=re-r.width,b*=c?1:-1}}var he=Object.assign({position:l},d&&eB),Se=f===!0?tB({x:b,y:w},lt(n)):{x:b,y:w};if(b=Se.x,w=Se.y,c){var me;return Object.assign({},he,(me={},me[T]=L?"0":"",me[D]=S?"0":"",me.transform=($.devicePixelRatio||1)<=1?"translate("+b+"px, "+w+"px)":"translate3d("+b+"px, "+w+"px, 0)",me))}return Object.assign({},he,(e={},e[T]=L?w+"px":"",e[D]=S?b+"px":"",e.transform="",e))}function nB(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,l=n.roundOffsets,c=l===void 0?!0:l,d={placement:Wt(e.placement),variation:Gn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,fw(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,fw(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var pw={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:nB,data:{}};var Tc={passive:!0};function rB(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,l=s===void 0?!0:s,c=lt(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&d.forEach(function(f){f.addEventListener("scroll",n.update,Tc)}),l&&c.addEventListener("resize",n.update,Tc),function(){o&&d.forEach(function(f){f.removeEventListener("scroll",n.update,Tc)}),l&&c.removeEventListener("resize",n.update,Tc)}}var hw={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:rB,data:{}};var iB={left:"right",right:"left",bottom:"top",top:"bottom"};function jo(t){return t.replace(/left|right|bottom|top/g,function(e){return iB[e]})}var oB={start:"end",end:"start"};function Cc(t){return t.replace(/start|end/g,function(e){return oB[e]})}function lo(t){var e=lt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function co(t){return Vn(Yt(t)).left+lo(t).scrollLeft}function Xp(t,e){var n=lt(t),r=Yt(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,l=0,c=0;if(i){o=i.width,s=i.height;var d=oa();(d||!d&&e==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:l+co(t),y:c}}function Zp(t){var e,n=Yt(t),r=lo(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=sr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=sr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),l=-r.scrollLeft+co(t),c=-r.scrollTop;return hn(i||n).direction==="rtl"&&(l+=sr(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:l,y:c}}function uo(t){var e=hn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Ac(t){return["html","body","#document"].indexOf(Ut(t))>=0?t.ownerDocument.body:Dt(t)&&uo(t)?t:Ac(Gr(t))}function vi(t,e){var n;e===void 0&&(e=[]);var r=Ac(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=lt(r),s=i?[o].concat(o.visualViewport||[],uo(r)?r:[]):r,l=e.concat(s);return i?l:l.concat(vi(Gr(s)))}function Qo(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function sB(t,e){var n=Vn(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function mw(t,e,n){return e===_c?Qo(Xp(t,n)):Kn(e)?sB(e,n):Qo(Zp(Yt(t)))}function aB(t){var e=vi(Gr(t)),n=["absolute","fixed"].indexOf(hn(t).position)>=0,r=n&&Dt(t)?ar(t):t;return Kn(r)?e.filter(function(i){return Kn(i)&&sa(i,r)&&Ut(i)!=="body"}):[]}function jp(t,e,n,r){var i=e==="clippingParents"?aB(t):[].concat(e),o=[].concat(i,[n]),s=o[0],l=o.reduce(function(c,d){var f=mw(t,d,r);return c.top=sr(f.top,c.top),c.right=io(f.right,c.right),c.bottom=io(f.bottom,c.bottom),c.left=sr(f.left,c.left),c},mw(t,s,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function ua(t){var e=t.reference,n=t.element,r=t.placement,i=r?Wt(r):null,o=r?Gn(r):null,s=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,c;switch(i){case gt:c={x:s,y:e.y-n.height};break;case It:c={x:s,y:e.y+e.height};break;case At:c={x:e.x+e.width,y:l};break;case wt:c={x:e.x-n.width,y:l};break;default:c={x:e.x,y:e.y}}var d=i?so(i):null;if(d!=null){var f=d==="y"?"height":"width";switch(o){case Kr:c[d]=c[d]-(e[f]/2-n[f]/2);break;case ro:c[d]=c[d]+(e[f]/2-n[f]/2);break;default:}}return c}function lr(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,l=n.boundary,c=l===void 0?sw:l,d=n.rootBoundary,f=d===void 0?_c:d,h=n.elementContext,m=h===void 0?Jo:h,b=n.altBoundary,y=b===void 0?!1:b,w=n.padding,_=w===void 0?0:w,S=la(typeof _!="number"?_:ca(_,Ei)),L=m===Jo?aw:Jo,D=t.rects.popper,T=t.elements[y?L:m],$=jp(Kn(T)?T:T.contextElement||Yt(t.elements.popper),c,f,s),O=Vn(t.elements.reference),Y=ua({reference:O,element:D,strategy:"absolute",placement:i}),ee=Qo(Object.assign({},D,Y)),z=m===Jo?ee:O,re={top:$.top-z.top+S.top,bottom:z.bottom-$.bottom+S.bottom,left:$.left-z.left+S.left,right:z.right-$.right+S.right},he=t.modifiersData.offset;if(m===Jo&&he){var Se=he[i];Object.keys(re).forEach(function(me){var Ce=[At,It].indexOf(me)>=0?1:-1,ge=[gt,It].indexOf(me)>=0?"y":"x";re[me]+=Se[ge]*Ce})}return re}function Qp(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?Sc:c,f=Gn(r),h=f?l?Yp:Yp.filter(function(y){return Gn(y)===f}):Ei,m=h.filter(function(y){return d.indexOf(y)>=0});m.length===0&&(m=h);var b=m.reduce(function(y,w){return y[w]=lr(t,{placement:w,boundary:i,rootBoundary:o,padding:s})[Wt(w)],y},{});return Object.keys(b).sort(function(y,w){return b[y]-b[w]})}function lB(t){if(Wt(t)===xc)return[];var e=jo(t);return[Cc(t),e,Cc(e)]}function cB(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,l=s===void 0?!0:s,c=n.fallbackPlacements,d=n.padding,f=n.boundary,h=n.rootBoundary,m=n.altBoundary,b=n.flipVariations,y=b===void 0?!0:b,w=n.allowedAutoPlacements,_=e.options.placement,S=Wt(_),L=S===_,D=c||(L||!y?[jo(_)]:lB(_)),T=[_].concat(D).reduce(function(je,Me){return je.concat(Wt(Me)===xc?Qp(e,{placement:Me,boundary:f,rootBoundary:h,padding:d,flipVariations:y,allowedAutoPlacements:w}):Me)},[]),$=e.rects.reference,O=e.rects.popper,Y=new Map,ee=!0,z=T[0],re=0;re=0,ge=Ce?"width":"height",_e=lr(e,{placement:he,boundary:f,rootBoundary:h,altBoundary:m,padding:d}),A=Ce?me?At:wt:me?It:gt;$[ge]>O[ge]&&(A=jo(A));var R=jo(A),K=[];if(o&&K.push(_e[Se]<=0),l&&K.push(_e[A]<=0,_e[R]<=0),K.every(function(je){return je})){z=he,ee=!1;break}Y.set(he,K)}if(ee)for(var J=y?3:1,se=function(Me){var Be=T.find(function(xt){var Nt=Y.get(xt);if(Nt)return Nt.slice(0,Me).every(function(Oe){return Oe})});if(Be)return z=Be,"break"},be=J;be>0;be--){var De=se(be);if(De==="break")break}e.placement!==z&&(e.modifiersData[r]._skip=!0,e.placement=z,e.reset=!0)}}var gw={name:"flip",enabled:!0,phase:"main",fn:cB,requiresIfExists:["offset"],data:{_skip:!1}};function bw(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function yw(t){return[gt,At,It,wt].some(function(e){return t[e]>=0})}function uB(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=lr(e,{elementContext:"reference"}),l=lr(e,{altBoundary:!0}),c=bw(s,r),d=bw(l,i,o),f=yw(c),h=yw(d);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:f,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":h})}var Ew={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:uB};function dB(t,e,n){var r=Wt(t),i=[wt,gt].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],l=o[1];return s=s||0,l=(l||0)*i,[wt,At].indexOf(r)>=0?{x:l,y:s}:{x:s,y:l}}function fB(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=Sc.reduce(function(f,h){return f[h]=dB(h,e.rects,o),f},{}),l=s[e.placement],c=l.x,d=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[r]=s}var vw={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:fB};function pB(t){var e=t.state,n=t.name;e.modifiersData[n]=ua({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var ww={name:"popperOffsets",enabled:!0,phase:"read",fn:pB,data:{}};function eh(t){return t==="x"?"y":"x"}function hB(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,l=s===void 0?!1:s,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.padding,m=n.tether,b=m===void 0?!0:m,y=n.tetherOffset,w=y===void 0?0:y,_=lr(e,{boundary:c,rootBoundary:d,padding:h,altBoundary:f}),S=Wt(e.placement),L=Gn(e.placement),D=!L,T=so(S),$=eh(T),O=e.modifiersData.popperOffsets,Y=e.rects.reference,ee=e.rects.popper,z=typeof w=="function"?w(Object.assign({},e.rects,{placement:e.placement})):w,re=typeof z=="number"?{mainAxis:z,altAxis:z}:Object.assign({mainAxis:0,altAxis:0},z),he=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,Se={x:0,y:0};if(O){if(o){var me,Ce=T==="y"?gt:wt,ge=T==="y"?It:At,_e=T==="y"?"height":"width",A=O[T],R=A+_[Ce],K=A-_[ge],J=b?-ee[_e]/2:0,se=L===Kr?Y[_e]:ee[_e],be=L===Kr?-ee[_e]:-Y[_e],De=e.elements.arrow,je=b&&De?oo(De):{width:0,height:0},Me=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:aa(),Be=Me[Ce],xt=Me[ge],Nt=ao(0,Y[_e],je[_e]),Oe=D?Y[_e]/2-J-Nt-Be-re.mainAxis:se-Nt-Be-re.mainAxis,_t=D?-Y[_e]/2+J+Nt+xt+re.mainAxis:be+Nt+xt+re.mainAxis,Jt=e.elements.arrow&&ar(e.elements.arrow),pt=Jt?T==="y"?Jt.clientTop||0:Jt.clientLeft||0:0,sn=(me=he?.[T])!=null?me:0,Xt=A+Oe-sn-pt,St=A+_t-sn,Je=ao(b?io(R,Xt):R,A,b?sr(K,St):K);O[T]=Je,Se[T]=Je-A}if(l){var Xn,Lt=T==="x"?gt:wt,V=T==="x"?It:At,bt=O[$],we=$==="y"?"height":"width",fe=bt+_[Lt],ct=bt-_[V],ut=[gt,wt].indexOf(S)!==-1,Pt=(Xn=he?.[$])!=null?Xn:0,kt=ut?fe:bt-Y[we]-ee[we]-Pt+re.altAxis,I=ut?bt+Y[we]+ee[we]-Pt-re.altAxis:ct,F=b&&ut?uw(kt,bt,I):ao(b?kt:fe,bt,b?I:ct);O[$]=F,Se[$]=F-bt}e.modifiersData[r]=Se}}var xw={name:"preventOverflow",enabled:!0,phase:"main",fn:hB,requiresIfExists:["offset"]};function th(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function nh(t){return t===lt(t)||!Dt(t)?lo(t):th(t)}function mB(t){var e=t.getBoundingClientRect(),n=Vr(e.width)/t.offsetWidth||1,r=Vr(e.height)/t.offsetHeight||1;return n!==1||r!==1}function rh(t,e,n){n===void 0&&(n=!1);var r=Dt(e),i=Dt(e)&&mB(e),o=Yt(e),s=Vn(t,i,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Ut(e)!=="body"||uo(o))&&(l=nh(e)),Dt(e)?(c=Vn(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):o&&(c.x=co(o))),{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function gB(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(l){if(!n.has(l)){var c=e.get(l);c&&i(c)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function ih(t){var e=gB(t);return lw.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function oh(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function sh(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var _w={placement:"bottom",modifiers:[],strategy:"absolute"};function Sw(){for(var t=arguments.length,e=new Array(t),n=0;n-1}function Hw(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Cw(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function vB(t){return t.split(/\s+/).filter(Boolean)}function es(t){return[].concat(t)}function Aw(t,e){t.indexOf(e)===-1&&t.push(e)}function wB(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function xB(t){return t.split("-")[0]}function Nc(t){return[].slice.call(t)}function Mw(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function da(){return document.createElement("div")}function kc(t){return["Element","Fragment"].some(function(e){return hh(t,e)})}function _B(t){return hh(t,"NodeList")}function SB(t){return hh(t,"MouseEvent")}function TB(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function CB(t){return kc(t)?[t]:_B(t)?Nc(t):Array.isArray(t)?t:Nc(document.querySelectorAll(t))}function ch(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Nw(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function AB(t){var e,n=es(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function MB(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,l=i.props,c=l.interactiveBorder,d=xB(s.placement),f=s.modifiersData.offset;if(!f)return!0;var h=d==="bottom"?f.top.y:0,m=d==="top"?f.bottom.y:0,b=d==="right"?f.left.x:0,y=d==="left"?f.right.x:0,w=o.top-r+h>c,_=r-o.bottom-m>c,S=o.left-n+b>c,L=n-o.right-y>c;return w||_||S||L})}function uh(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function kw(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var yr={isTouch:!1},Ow=0;function NB(){yr.isTouch||(yr.isTouch=!0,window.performance&&document.addEventListener("mousemove",$w))}function $w(){var t=performance.now();t-Ow<20&&(yr.isTouch=!1,document.removeEventListener("mousemove",$w)),Ow=t}function kB(){var t=document.activeElement;if(TB(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function OB(){document.addEventListener("touchstart",NB,fo),window.addEventListener("blur",kB)}var RB=typeof window<"u"&&typeof document<"u",IB=RB?!!window.msCrypto:!1;var DB={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},LB={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},cr=Object.assign({appendTo:Fw,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},DB,LB),PB=Object.keys(cr),BB=function(e){var n=Object.keys(e);n.forEach(function(r){cr[r]=e[r]})};function zw(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var l;r[o]=t[o]!==void 0?t[o]:(l=cr[o])!=null?l:s}return r},{});return Object.assign({},t,n)}function FB(t,e){var n=e?Object.keys(zw(Object.assign({},cr,{plugins:e}))):PB,r=n.reduce(function(i,o){var s=(t.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function Rw(t,e){var n=Object.assign({},e,{content:Hw(e.content,[t])},e.ignoreAttributes?{}:FB(t,e.plugins));return n.aria=Object.assign({},cr.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var HB=function(){return"innerHTML"};function fh(t,e){t[HB()]=e}function Iw(t){var e=da();return t===!0?e.className=Pw:(e.className=Bw,kc(t)?e.appendChild(t):fh(e,t)),e}function Dw(t,e){kc(e.content)?(fh(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?fh(t,e.content):t.textContent=e.content)}function ph(t){var e=t.firstElementChild,n=Nc(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Lw)}),arrow:n.find(function(r){return r.classList.contains(Pw)||r.classList.contains(Bw)}),backdrop:n.find(function(r){return r.classList.contains(EB)})}}function Uw(t){var e=da(),n=da();n.className=yB,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=da();r.className=Lw,r.setAttribute("data-state","hidden"),Dw(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var l=ph(e),c=l.box,d=l.content,f=l.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&Dw(d,t.props),s.arrow?f?o.arrow!==s.arrow&&(c.removeChild(f),c.appendChild(Iw(s.arrow))):c.appendChild(Iw(s.arrow)):f&&c.removeChild(f)}return{popper:e,onUpdate:i}}Uw.$$tippy=!0;var $B=1,Mc=[],dh=[];function zB(t,e){var n=Rw(t,Object.assign({},cr,zw(Mw(e)))),r,i,o,s=!1,l=!1,c=!1,d=!1,f,h,m,b=[],y=Cw(Xt,n.interactiveDebounce),w,_=$B++,S=null,L=wB(n.plugins),D={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},T={id:_,reference:t,popper:da(),popperInstance:S,props:n,state:D,plugins:L,clearDelayTimeouts:kt,setProps:I,setContent:F,show:X,hide:oe,hideWithInteractivity:Fe,enable:ut,disable:Pt,unmount:rt,destroy:xr};if(!n.render)return T;var $=n.render(T),O=$.popper,Y=$.onUpdate;O.setAttribute("data-tippy-root",""),O.id="tippy-"+T.id,T.popper=O,t._tippy=T,O._tippy=T;var ee=L.map(function(B){return B.fn(T)}),z=t.hasAttribute("aria-expanded");return Jt(),J(),A(),R("onCreate",[T]),n.showOnCreate&&fe(),O.addEventListener("mouseenter",function(){T.props.interactive&&T.state.isVisible&&T.clearDelayTimeouts()}),O.addEventListener("mouseleave",function(){T.props.interactive&&T.props.trigger.indexOf("mouseenter")>=0&&Ce().addEventListener("mousemove",y)}),T;function re(){var B=T.props.touch;return Array.isArray(B)?B:[B,0]}function he(){return re()[0]==="hold"}function Se(){var B;return!!((B=T.props.render)!=null&&B.$$tippy)}function me(){return w||t}function Ce(){var B=me().parentNode;return B?AB(B):document}function ge(){return ph(O)}function _e(B){return T.state.isMounted&&!T.state.isVisible||yr.isTouch||f&&f.type==="focus"?0:lh(T.props.delay,B?0:1,cr.delay)}function A(B){B===void 0&&(B=!1),O.style.pointerEvents=T.props.interactive&&!B?"":"none",O.style.zIndex=""+T.props.zIndex}function R(B,ae,xe){if(xe===void 0&&(xe=!0),ee.forEach(function(Ke){Ke[B]&&Ke[B].apply(Ke,ae)}),xe){var qe;(qe=T.props)[B].apply(qe,ae)}}function K(){var B=T.props.aria;if(B.content){var ae="aria-"+B.content,xe=O.id,qe=es(T.props.triggerTarget||t);qe.forEach(function(Ke){var Bt=Ke.getAttribute(ae);if(T.state.isVisible)Ke.setAttribute(ae,Bt?Bt+" "+xe:xe);else{var an=Bt&&Bt.replace(xe,"").trim();an?Ke.setAttribute(ae,an):Ke.removeAttribute(ae)}})}}function J(){if(!(z||!T.props.aria.expanded)){var B=es(T.props.triggerTarget||t);B.forEach(function(ae){T.props.interactive?ae.setAttribute("aria-expanded",T.state.isVisible&&ae===me()?"true":"false"):ae.removeAttribute("aria-expanded")})}}function se(){Ce().removeEventListener("mousemove",y),Mc=Mc.filter(function(B){return B!==y})}function be(B){if(!(yr.isTouch&&(c||B.type==="mousedown"))){var ae=B.composedPath&&B.composedPath()[0]||B.target;if(!(T.props.interactive&&kw(O,ae))){if(es(T.props.triggerTarget||t).some(function(xe){return kw(xe,ae)})){if(yr.isTouch||T.state.isVisible&&T.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[T,B]);T.props.hideOnClick===!0&&(T.clearDelayTimeouts(),T.hide(),l=!0,setTimeout(function(){l=!1}),T.state.isMounted||Be())}}}function De(){c=!0}function je(){c=!1}function Me(){var B=Ce();B.addEventListener("mousedown",be,!0),B.addEventListener("touchend",be,fo),B.addEventListener("touchstart",je,fo),B.addEventListener("touchmove",De,fo)}function Be(){var B=Ce();B.removeEventListener("mousedown",be,!0),B.removeEventListener("touchend",be,fo),B.removeEventListener("touchstart",je,fo),B.removeEventListener("touchmove",De,fo)}function xt(B,ae){Oe(B,function(){!T.state.isVisible&&O.parentNode&&O.parentNode.contains(O)&&ae()})}function Nt(B,ae){Oe(B,ae)}function Oe(B,ae){var xe=ge().box;function qe(Ke){Ke.target===xe&&(uh(xe,"remove",qe),ae())}if(B===0)return ae();uh(xe,"remove",h),uh(xe,"add",qe),h=qe}function _t(B,ae,xe){xe===void 0&&(xe=!1);var qe=es(T.props.triggerTarget||t);qe.forEach(function(Ke){Ke.addEventListener(B,ae,xe),b.push({node:Ke,eventType:B,handler:ae,options:xe})})}function Jt(){he()&&(_t("touchstart",sn,{passive:!0}),_t("touchend",St,{passive:!0})),vB(T.props.trigger).forEach(function(B){if(B!=="manual")switch(_t(B,sn),B){case"mouseenter":_t("mouseleave",St);break;case"focus":_t(IB?"focusout":"blur",Je);break;case"focusin":_t("focusout",Je);break}})}function pt(){b.forEach(function(B){var ae=B.node,xe=B.eventType,qe=B.handler,Ke=B.options;ae.removeEventListener(xe,qe,Ke)}),b=[]}function sn(B){var ae,xe=!1;if(!(!T.state.isEnabled||Xn(B)||l)){var qe=((ae=f)==null?void 0:ae.type)==="focus";f=B,w=B.currentTarget,J(),!T.state.isVisible&&SB(B)&&Mc.forEach(function(Ke){return Ke(B)}),B.type==="click"&&(T.props.trigger.indexOf("mouseenter")<0||s)&&T.props.hideOnClick!==!1&&T.state.isVisible?xe=!0:fe(B),B.type==="click"&&(s=!xe),xe&&!qe&&ct(B)}}function Xt(B){var ae=B.target,xe=me().contains(ae)||O.contains(ae);if(!(B.type==="mousemove"&&xe)){var qe=we().concat(O).map(function(Ke){var Bt,an=Ke._tippy,Jr=(Bt=an.popperInstance)==null?void 0:Bt.state;return Jr?{popperRect:Ke.getBoundingClientRect(),popperState:Jr,props:n}:null}).filter(Boolean);MB(qe,B)&&(se(),ct(B))}}function St(B){var ae=Xn(B)||T.props.trigger.indexOf("click")>=0&&s;if(!ae){if(T.props.interactive){T.hideWithInteractivity(B);return}ct(B)}}function Je(B){T.props.trigger.indexOf("focusin")<0&&B.target!==me()||T.props.interactive&&B.relatedTarget&&O.contains(B.relatedTarget)||ct(B)}function Xn(B){return yr.isTouch?he()!==B.type.indexOf("touch")>=0:!1}function Lt(){V();var B=T.props,ae=B.popperOptions,xe=B.placement,qe=B.offset,Ke=B.getReferenceClientRect,Bt=B.moveTransition,an=Se()?ph(O).arrow:null,Jr=Ke?{getBoundingClientRect:Ke,contextElement:Ke.contextElement||me()}:t,Ca={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ai){var Xr=Ai.state;if(Se()){var Fu=ge(),gs=Fu.box;["placement","reference-hidden","escaped"].forEach(function(Zr){Zr==="placement"?gs.setAttribute("data-placement",Xr.placement):Xr.attributes.popper["data-popper-"+Zr]?gs.setAttribute("data-"+Zr,""):gs.removeAttribute("data-"+Zr)}),Xr.attributes.popper={}}}},_r=[{name:"offset",options:{offset:qe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Bt}},Ca];Se()&&an&&_r.push({name:"arrow",options:{element:an,padding:3}}),_r.push.apply(_r,ae?.modifiers||[]),T.popperInstance=ah(Jr,O,Object.assign({},ae,{placement:xe,onFirstUpdate:m,modifiers:_r}))}function V(){T.popperInstance&&(T.popperInstance.destroy(),T.popperInstance=null)}function bt(){var B=T.props.appendTo,ae,xe=me();T.props.interactive&&B===Fw||B==="parent"?ae=xe.parentNode:ae=Hw(B,[xe]),ae.contains(O)||ae.appendChild(O),T.state.isMounted=!0,Lt()}function we(){return Nc(O.querySelectorAll("[data-tippy-root]"))}function fe(B){T.clearDelayTimeouts(),B&&R("onTrigger",[T,B]),Me();var ae=_e(!0),xe=re(),qe=xe[0],Ke=xe[1];yr.isTouch&&qe==="hold"&&Ke&&(ae=Ke),ae?r=setTimeout(function(){T.show()},ae):T.show()}function ct(B){if(T.clearDelayTimeouts(),R("onUntrigger",[T,B]),!T.state.isVisible){Be();return}if(!(T.props.trigger.indexOf("mouseenter")>=0&&T.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(B.type)>=0&&s)){var ae=_e(!1);ae?i=setTimeout(function(){T.state.isVisible&&T.hide()},ae):o=requestAnimationFrame(function(){T.hide()})}}function ut(){T.state.isEnabled=!0}function Pt(){T.hide(),T.state.isEnabled=!1}function kt(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function I(B){if(!T.state.isDestroyed){R("onBeforeUpdate",[T,B]),pt();var ae=T.props,xe=Rw(t,Object.assign({},ae,Mw(B),{ignoreAttributes:!0}));T.props=xe,Jt(),ae.interactiveDebounce!==xe.interactiveDebounce&&(se(),y=Cw(Xt,xe.interactiveDebounce)),ae.triggerTarget&&!xe.triggerTarget?es(ae.triggerTarget).forEach(function(qe){qe.removeAttribute("aria-expanded")}):xe.triggerTarget&&t.removeAttribute("aria-expanded"),J(),A(),Y&&Y(ae,xe),T.popperInstance&&(Lt(),we().forEach(function(qe){requestAnimationFrame(qe._tippy.popperInstance.forceUpdate)})),R("onAfterUpdate",[T,B])}}function F(B){T.setProps({content:B})}function X(){var B=T.state.isVisible,ae=T.state.isDestroyed,xe=!T.state.isEnabled,qe=yr.isTouch&&!T.props.touch,Ke=lh(T.props.duration,0,cr.duration);if(!(B||ae||xe||qe)&&!me().hasAttribute("disabled")&&(R("onShow",[T],!1),T.props.onShow(T)!==!1)){if(T.state.isVisible=!0,Se()&&(O.style.visibility="visible"),A(),Me(),T.state.isMounted||(O.style.transition="none"),Se()){var Bt=ge(),an=Bt.box,Jr=Bt.content;ch([an,Jr],0)}m=function(){var _r;if(!(!T.state.isVisible||d)){if(d=!0,O.offsetHeight,O.style.transition=T.props.moveTransition,Se()&&T.props.animation){var ms=ge(),Ai=ms.box,Xr=ms.content;ch([Ai,Xr],Ke),Nw([Ai,Xr],"visible")}K(),J(),Aw(dh,T),(_r=T.popperInstance)==null||_r.forceUpdate(),R("onMount",[T]),T.props.animation&&Se()&&Nt(Ke,function(){T.state.isShown=!0,R("onShown",[T])})}},bt()}}function oe(){var B=!T.state.isVisible,ae=T.state.isDestroyed,xe=!T.state.isEnabled,qe=lh(T.props.duration,1,cr.duration);if(!(B||ae||xe)&&(R("onHide",[T],!1),T.props.onHide(T)!==!1)){if(T.state.isVisible=!1,T.state.isShown=!1,d=!1,s=!1,Se()&&(O.style.visibility="hidden"),se(),Be(),A(!0),Se()){var Ke=ge(),Bt=Ke.box,an=Ke.content;T.props.animation&&(ch([Bt,an],qe),Nw([Bt,an],"hidden"))}K(),J(),T.props.animation?Se()&&xt(qe,T.unmount):T.unmount()}}function Fe(B){Ce().addEventListener("mousemove",y),Aw(Mc,y),y(B)}function rt(){T.state.isVisible&&T.hide(),T.state.isMounted&&(V(),we().forEach(function(B){B._tippy.unmount()}),O.parentNode&&O.parentNode.removeChild(O),dh=dh.filter(function(B){return B!==T}),T.state.isMounted=!1,R("onHidden",[T]))}function xr(){T.state.isDestroyed||(T.clearDelayTimeouts(),T.unmount(),pt(),delete t._tippy,T.state.isDestroyed=!0,R("onDestroy",[T]))}}function fa(t,e){e===void 0&&(e={});var n=cr.plugins.concat(e.plugins||[]);OB();var r=Object.assign({},e,{plugins:n}),i=CB(t);if(0)var o,s;var l=i.reduce(function(c,d){var f=d&&zB(d,r);return f&&c.push(f),c},[]);return kc(t)?l[0]:l}fa.defaultProps=cr;fa.setDefaultProps=BB;fa.currentInput=yr;var $V=Object.assign({},ia,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});fa.setDefaultProps({render:Uw});var ts=fa;var mh=class{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:l,state:c,from:d,to:f})=>{let{doc:h,selection:m}=c,{empty:b}=m,y=!h.textBetween(d,f).length&&rc(c.selection),w=this.element.contains(document.activeElement);return!(!(l.hasFocus()||w)||b||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var c;if(this.preventHide){this.preventHide=!1;return}l?.relatedTarget&&(!((c=this.element.parentNode)===null||c===void 0)&&c.contains(l.relatedTarget))||this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,c)=>{let d=!c?.selection.eq(l.state.selection),f=!c?.doc.eq(l.state.doc);!d&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,d,f,c)},this.updateDelay))},this.updateHandler=(l,c,d,f)=>{var h,m,b;let{state:y,composing:w}=l,{selection:_}=y;if(w||!c&&!d)return;this.createTooltip();let{ranges:L}=_,D=Math.min(...L.map(O=>O.$from.pos)),T=Math.max(...L.map(O=>O.$to.pos));if(!((h=this.shouldShow)===null||h===void 0?void 0:h.call(this,{editor:this.editor,view:l,state:y,oldState:f,from:D,to:T}))){this.hide();return}(m=this.tippy)===null||m===void 0||m.setProps({getReferenceClientRect:((b=this.tippyOptions)===null||b===void 0?void 0:b.getReferenceClientRect)||(()=>{if(ac(y.selection)){let O=l.nodeDOM(D),Y=O.dataset.nodeViewWrapper?O:O.querySelector("[data-node-view-wrapper]");if(Y&&(O=Y.firstChild),O)return O.getBoundingClientRect()}return lc(l,D,T)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=o,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ts(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){let{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}let o=!n?.selection.eq(e.state.selection),s=!n?.doc.eq(e.state.doc);this.updateHandler(e,o,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}},UB=t=>new ke({key:typeof t.pluginKey=="string"?new ze(t.pluginKey):t.pluginKey,view:e=>new mh({view:e,...t})}),Ww=We.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[UB({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});var gh=class{constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:s,state:l})=>{let{selection:c}=l,{$anchor:d,empty:f}=c,h=d.depth===1,m=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent;return!(!s.hasFocus()||!f||!h||!m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var l;if(this.preventHide){this.preventHide=!1;return}s?.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(s.relatedTarget))||this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=r,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ts(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,o;let{state:s}=e,{doc:l,selection:c}=s,{from:d,to:f}=c;if(n&&n.doc.eq(l)&&n.selection.eq(c))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((o=this.tippyOptions)===null||o===void 0?void 0:o.getReferenceClientRect)||(()=>lc(e,d,f))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}},WB=t=>new ke({key:typeof t.pluginKey=="string"?new ze(t.pluginKey):t.pluginKey,view:e=>new gh({view:e,...t})}),Kw=We.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[WB({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});var bh=ce.create({name:"checkedList",priority:50,addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{class:"checked-list"}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul",getAttrs:t=>t.classList.contains("checked-list"),priority:1e3}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleCheckedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}}});var yh=ce.create({name:"lead",group:"block",content:"block+",addOptions(){return{HTMLAttributes:{class:"lead"}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("lead")}]},renderHTML({node:t,HTMLAttributes:e}){return["div",Q(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleLead:()=>({commands:t})=>t.toggleWrap(this.name)}}});var KB="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",VB="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",is=(t,e)=>{for(let n in e)t[n]=e[n];return t},_h="numeric",Sh="ascii",Th="alpha",Lc="asciinumeric",Oc="alphanumeric",Ch="domain",Qw="emoji",GB="scheme",qB="slashscheme",Vw="whitespace";function YB(t,e){return t in e||(e[t]=[]),e[t]}function po(t,e,n){e[_h]&&(e[Lc]=!0,e[Oc]=!0),e[Sh]&&(e[Lc]=!0,e[Th]=!0),e[Lc]&&(e[Oc]=!0),e[Th]&&(e[Oc]=!0),e[Oc]&&(e[Ch]=!0),e[Qw]&&(e[Ch]=!0);for(let r in e){let i=YB(r,n);i.indexOf(t)<0&&i.push(t)}}function JB(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function wn(t){t===void 0&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}wn.groups={};wn.prototype={accepts(){return!!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,i),qn=(t,e,n,r,i)=>t.tr(e,n,r,i),Gw=(t,e,n,r,i)=>t.ts(e,n,r,i),j=(t,e,n,r,i)=>t.tt(e,n,r,i),qr="WORD",Ah="UWORD",ga="LOCALHOST",Mh="TLD",Nh="UTLD",Pc="SCHEME",rs="SLASH_SCHEME",kh="NUM",ex="WS",Oh="NL",pa="OPENBRACE",ha="CLOSEBRACE",Bc="OPENBRACKET",Fc="CLOSEBRACKET",Hc="OPENPAREN",$c="CLOSEPAREN",zc="OPENANGLEBRACKET",Uc="CLOSEANGLEBRACKET",Wc="FULLWIDTHLEFTPAREN",Kc="FULLWIDTHRIGHTPAREN",Vc="LEFTCORNERBRACKET",Gc="RIGHTCORNERBRACKET",qc="LEFTWHITECORNERBRACKET",Yc="RIGHTWHITECORNERBRACKET",Jc="FULLWIDTHLESSTHAN",Xc="FULLWIDTHGREATERTHAN",Zc="AMPERSAND",jc="APOSTROPHE",Qc="ASTERISK",xi="AT",eu="BACKSLASH",tu="BACKTICK",nu="CARET",_i="COLON",Rh="COMMA",ru="DOLLAR",Er="DOT",iu="EQUALS",Ih="EXCLAMATION",vr="HYPHEN",ou="PERCENT",su="PIPE",au="PLUS",lu="POUND",cu="QUERY",Dh="QUOTE",Lh="SEMI",wr="SLASH",ma="TILDE",uu="UNDERSCORE",tx="EMOJI",du="SYM",nx=Object.freeze({__proto__:null,WORD:qr,UWORD:Ah,LOCALHOST:ga,TLD:Mh,UTLD:Nh,SCHEME:Pc,SLASH_SCHEME:rs,NUM:kh,WS:ex,NL:Oh,OPENBRACE:pa,CLOSEBRACE:ha,OPENBRACKET:Bc,CLOSEBRACKET:Fc,OPENPAREN:Hc,CLOSEPAREN:$c,OPENANGLEBRACKET:zc,CLOSEANGLEBRACKET:Uc,FULLWIDTHLEFTPAREN:Wc,FULLWIDTHRIGHTPAREN:Kc,LEFTCORNERBRACKET:Vc,RIGHTCORNERBRACKET:Gc,LEFTWHITECORNERBRACKET:qc,RIGHTWHITECORNERBRACKET:Yc,FULLWIDTHLESSTHAN:Jc,FULLWIDTHGREATERTHAN:Xc,AMPERSAND:Zc,APOSTROPHE:jc,ASTERISK:Qc,AT:xi,BACKSLASH:eu,BACKTICK:tu,CARET:nu,COLON:_i,COMMA:Rh,DOLLAR:ru,DOT:Er,EQUALS:iu,EXCLAMATION:Ih,HYPHEN:vr,PERCENT:ou,PIPE:su,PLUS:au,POUND:lu,QUERY:cu,QUOTE:Dh,SEMI:Lh,SLASH:wr,TILDE:ma,UNDERSCORE:uu,EMOJI:tx,SYM:du}),ns=/[a-z]/,Eh=/\p{L}/u,vh=/\p{Emoji}/u;var wh=/\d/,qw=/\s/;var Yw=` -`,XB="\uFE0F",ZB="\u200D",Rc=null,Ic=null;function jB(t){t===void 0&&(t=[]);let e={};wn.groups=e;let n=new wn;Rc==null&&(Rc=Jw(KB)),Ic==null&&(Ic=Jw(VB)),j(n,"'",jc),j(n,"{",pa),j(n,"}",ha),j(n,"[",Bc),j(n,"]",Fc),j(n,"(",Hc),j(n,")",$c),j(n,"<",zc),j(n,">",Uc),j(n,"\uFF08",Wc),j(n,"\uFF09",Kc),j(n,"\u300C",Vc),j(n,"\u300D",Gc),j(n,"\u300E",qc),j(n,"\u300F",Yc),j(n,"\uFF1C",Jc),j(n,"\uFF1E",Xc),j(n,"&",Zc),j(n,"*",Qc),j(n,"@",xi),j(n,"`",tu),j(n,"^",nu),j(n,":",_i),j(n,",",Rh),j(n,"$",ru),j(n,".",Er),j(n,"=",iu),j(n,"!",Ih),j(n,"-",vr),j(n,"%",ou),j(n,"|",su),j(n,"+",au),j(n,"#",lu),j(n,"?",cu),j(n,'"',Dh),j(n,"/",wr),j(n,";",Lh),j(n,"~",ma),j(n,"_",uu),j(n,"\\",eu);let r=qn(n,wh,kh,{[_h]:!0});qn(r,wh,r);let i=qn(n,ns,qr,{[Sh]:!0});qn(i,ns,i);let o=qn(n,Eh,Ah,{[Th]:!0});qn(o,ns),qn(o,Eh,o);let s=qn(n,qw,ex,{[Vw]:!0});j(n,Yw,Oh,{[Vw]:!0}),j(s,Yw),qn(s,qw,s);let l=qn(n,vh,tx,{[Qw]:!0});qn(l,vh,l),j(l,XB,l);let c=j(l,ZB);qn(c,vh,l);let d=[[ns,i]],f=[[ns,null],[Eh,o]];for(let h=0;hh[0]>m[0]?1:-1);for(let h=0;h=0?y[Ch]=!0:ns.test(m)?wh.test(m)?y[Lc]=!0:y[Sh]=!0:y[_h]=!0,Gw(n,m,m,y)}return Gw(n,"localhost",ga,{ascii:!0}),n.jd=new wn(du),{start:n,tokens:is({groups:e},nx)}}function QB(t,e){let n=e2(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s=0&&(h+=n[s].length,m++),d+=n[s].length,o+=n[s].length,s++;o-=h,s-=m,d-=h,i.push({t:f.t,v:e.slice(o-d,o),s:o-d,e:o})}return i}function e2(t){let e=[],n=t.length,r=0;for(;r56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function wi(t,e,n,r,i){let o,s=e.length;for(let l=0;l=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}var ba={defaultProtocol:"http",events:null,format:Xw,formatHref:Xw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ph(t,e){e===void 0&&(e=null);let n=is({},ba);t&&(n=is(n,t instanceof Ph?t.o:t));let r=n.ignoreTags,i=[];for(let o=0;on?r.substring(0,n)+"\u2026":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return t===void 0&&(t=ba.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},l=t.get("className",n,e),c=t.get("target",n,e),d=t.get("rel",n,e),f=t.getObj("attributes",n,e),h=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),c&&(s.target=c),d&&(s.rel=d),f&&is(s,f),{tagName:i,attributes:s,content:o,eventListeners:h}}};function fu(t,e){class n extends rx{constructor(i,o){super(i,o),this.t=t}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var Zw=fu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),jw=fu("text"),t2=fu("nl"),Dc=fu("url",{isLink:!0,toHref(t){return t===void 0&&(t=ba.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==ga&&t[1].t===_i}});var Yn=t=>new wn(t);function n2(t){let{groups:e}=t,n=e.domain.concat([Zc,Qc,xi,eu,tu,nu,ru,iu,vr,kh,ou,su,au,lu,wr,du,ma,uu]),r=[jc,_i,Rh,Er,Ih,cu,Dh,Lh,zc,Uc,pa,ha,Fc,Bc,Hc,$c,Wc,Kc,Vc,Gc,qc,Yc,Jc,Xc],i=[Zc,jc,Qc,eu,tu,nu,ru,iu,vr,pa,ha,ou,su,au,lu,cu,wr,du,ma,uu],o=Yn(),s=j(o,ma);Pe(s,i,s),Pe(s,e.domain,s);let l=Yn(),c=Yn(),d=Yn();Pe(o,e.domain,l),Pe(o,e.scheme,c),Pe(o,e.slashscheme,d),Pe(l,i,s),Pe(l,e.domain,l);let f=j(l,xi);j(s,xi,f),j(c,xi,f),j(d,xi,f);let h=j(s,Er);Pe(h,i,s),Pe(h,e.domain,s);let m=Yn();Pe(f,e.domain,m),Pe(m,e.domain,m);let b=j(m,Er);Pe(b,e.domain,m);let y=Yn(Zw);Pe(b,e.tld,y),Pe(b,e.utld,y),j(f,ga,y);let w=j(m,vr);Pe(w,e.domain,m),Pe(y,e.domain,m),j(y,Er,b),j(y,vr,w);let _=j(y,_i);Pe(_,e.numeric,Zw);let S=j(l,vr),L=j(l,Er);Pe(S,e.domain,l),Pe(L,i,s),Pe(L,e.domain,l);let D=Yn(Dc);Pe(L,e.tld,D),Pe(L,e.utld,D),Pe(D,e.domain,l),Pe(D,i,s),j(D,Er,L),j(D,vr,S),j(D,xi,f);let T=j(D,_i),$=Yn(Dc);Pe(T,e.numeric,$);let O=Yn(Dc),Y=Yn();Pe(O,n,O),Pe(O,r,Y),Pe(Y,n,O),Pe(Y,r,Y),j(D,wr,O),j($,wr,O);let ee=j(c,_i),z=j(d,_i),re=j(z,wr),he=j(re,wr);Pe(c,e.domain,l),j(c,Er,L),j(c,vr,S),Pe(d,e.domain,l),j(d,Er,L),j(d,vr,S),Pe(ee,e.domain,O),j(ee,wr,O),Pe(he,e.domain,O),Pe(he,n,O),j(he,wr,O);let Se=[[pa,ha],[Bc,Fc],[Hc,$c],[zc,Uc],[Wc,Kc],[Vc,Gc],[qc,Yc],[Jc,Xc]];for(let me=0;me=0&&m++,i++,f++;if(m<0)i-=f,i0&&(o.push(xh(jw,e,s)),s=[]),i-=m,f-=m;let b=h.t,y=n.slice(i-f,i);o.push(xh(b,e,y))}}return s.length>0&&o.push(xh(jw,e,s)),o}function xh(t,e,n){let r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}var i2=typeof console<"u"&&console&&console.warn||(()=>{}),o2="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ft={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ix(){wn.groups={},ft.scanner=null,ft.parser=null,ft.tokenQueue=[],ft.pluginQueue=[],ft.customSchemes=[],ft.initialized=!1}function Bh(t,e){if(e===void 0&&(e=!1),ft.initialized&&i2(`linkifyjs: already initialized - will not register custom scheme "${t}" ${o2}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +`,textSerializers:r={}}=e||{};return HD(this.state.doc,{blockSeparator:n,textSerializers:{...zE(this.schema),...r}})}get isEmpty(){return na(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){let n=this.state.doc.resolve(e);return new wp(n,this)}get $doc(){return this.$pos(0)}};function Wn(t){return new Go({find:t.find,handler:({state:e,range:n,match:r})=>{let i=Te(t.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:o}=e,s=r[r.length-1],l=r[0];if(s){let u=l.search(/\S/),d=n.from+l.indexOf(s),f=d+s.length;if(sc(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(v=>v===t.type&&v!==b.mark.type)).filter(b=>b.to>d).length)return null;fn.from&&o.delete(n.from+u,d);let m=n.from+u+s.length;o.addMark(n.from+u,m,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function cc(t){return new Go({find:t.find,handler:({state:e,range:n,match:r})=>{let i=Te(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from,l=n.to,u=t.type.create(i);if(r[1]){let d=r[0].lastIndexOf(r[1]),f=s+d;f>l?f=l:l=f+r[1].length;let h=r[0][r[0].length-1];o.insertText(h,s+r[0].length-1),o.replaceWith(f,l,u)}else if(r[0]){let d=t.type.isInline?s:s-1;o.insert(d,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()}})}function ra(t){return new Go({find:t.find,handler:({state:e,range:n,match:r})=>{let i=e.doc.resolve(n.from),o=Te(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function bi(t){return new Go({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{let o=Te(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),u=s.doc.resolve(n.from).blockRange(),d=u&&Do(u,t.type,o);if(!d)return null;if(s.wrap(u,d),t.keepMarks&&t.editor){let{selection:h,storedMarks:m}=e,{splittableMarks:b}=t.editor.extensionManager,y=m||h.$to.parentOffset&&h.$from.marks();if(y){let v=y.filter(x=>b.includes(x.type.name));s.ensureMarks(v)}}if(t.keepAttributes){let h=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(h,o).run()}let f=s.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&nr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&s.join(n.from-1)}})}var ce=class t{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Te(ne(this,"addOptions",{name:this.name}))),this.storage=Te(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend({...this.config,addOptions:()=>nc(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Te(ne(n,"addOptions",{name:n.name})),n.storage=Te(ne(n,"addStorage",{name:n.name,options:n.options})),n}};function vn(t){return new gp({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{let o=Te(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;let{tr:s}=e,l=r[r.length-1],u=r[0],d=n.to;if(l){let f=u.search(/\S/),h=n.from+u.indexOf(l),m=h+l.length;if(sc(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(x=>x===t.type&&x!==y.mark.type)).filter(y=>y.to>h).length)return null;mn.from&&s.delete(n.from+f,h),d=n.from+f+l.length,s.addMark(n.from+f,d,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}function YE(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var yL=/^\s*>\s$/,JE=ce.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[bi({find:yL,type:this.type})]}});var EL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,vL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,wL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,xL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,XE=st.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Wn({find:EL,type:this.type}),Wn({find:wL,type:this.type})]},addPasteRules(){return[vn({find:vL,type:this.type}),vn({find:xL,type:this.type})]}});var _L="listItem",ZE="textStyle",jE=/^\s*([-+*])\s$/,QE=ce.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_L,this.editor.getAttributes(ZE)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=bi({find:jE,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bi({find:jE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ZE),editor:this.editor})),[t]}});var SL=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,TL=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,ev=st.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Wn({find:SL,type:this.type})]},addPasteRules(){return[vn({find:TL,type:this.type})]}});var tv=st.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{let n=oc(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}});var nv=We.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});var Mp=ce.create({name:"doc",topNode:!0,content:"block+"});function rv(t={}){return new ke({view(e){return new Np(e,t)}})}var Np=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let l=e.nodeBefore,u=e.nodeAfter;if(l||u){let d=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(d){let f=d.getBoundingClientRect(),h=l?f.bottom:f.top;l&&u&&(h=(h+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:f.left,right:f.right,top:h-this.width/2,bottom:h+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Al(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}};var iv=We.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[rv(this.options)]}});var rn=class t extends ue{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):ue.near(r)}content(){return Z.empty}eq(e){return e instanceof t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))}getBookmark(){return new kp(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!CL(e)||!AL(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&t.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)0){o=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let u=e.doc.resolve(i);if(t.valid(u))return u}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!pe.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let l=e.doc.resolve(i);if(t.valid(l))return l}return null}}};rn.prototype.visible=!1;rn.findFrom=rn.findGapCursorFrom;ue.jsonID("gapcursor",rn);var kp=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return rn.valid(n)?new rn(n):ue.near(n)}};function CL(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function AL(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function ov(){return new ke({props:{decorations:OL,createSelectionBetween(t,e,n){return e.pos==n.pos&&rn.valid(n)?new rn(n):null},handleClick:NL,handleKeyDown:ML,handleDOMEvents:{beforeinput:kL}}})}var ML=ea({ArrowLeft:uc("horiz",-1),ArrowRight:uc("horiz",1),ArrowUp:uc("vert",-1),ArrowDown:uc("vert",1)});function uc(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,u=s.empty;if(s instanceof le){if(!o.endOfTextblock(n)||l.depth==0)return!1;u=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=rn.findGapCursorFrom(l,e,u);return d?(i&&i(r.tr.setSelection(new rn(d))),!0):!1}}function NL(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!rn.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&pe.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new rn(r))),!0)}function kL(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof rn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=G.empty;for(let s=r.length-1;s>=0;s--)i=G.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new Z(i,0,0));return o.setSelection(le.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function OL(t){if(!(t.selection instanceof rn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ot.create(t.doc,[vt.widget(t.selection.head,e,{key:"gapcursor"})])}var sv=We.create({name:"gapCursor",addProseMirrorPlugins(){return[ov()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Te(ne(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}});var av=ce.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Q(this.options.HTMLAttributes,t)]},renderText(){return` +`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,u=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:f})=>{if(f&&u&&s){let h=u.filter(m=>l.includes(m.type.name));d.ensureMarks(h)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var lv=ce.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Q(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ra({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var dc=200,qt=function(){};qt.prototype.append=function(e){return e.length?(e=qt.from(e),!this.length&&e||e.length=n?qt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};qt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};qt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};qt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};qt.from=function(e){return e instanceof qt?e:e&&e.length?new cv(e):qt.empty};var cv=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var u=o;u=s;u--)if(i(this.values[u],l+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=dc)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=dc)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(qt);qt.empty=new cv([]);var RL=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(qt),Op=qt;var IL=500,to=class t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,u,d=[],f=[];return this.items.forEach((h,m)=>{if(!h.step){i||(i=this.remapping(r,m+1),o=i.maps.length),o--,f.push(h);return}if(i){f.push(new mr(h.map));let b=h.step.map(i.slice(o)),y;b&&s.maybeStep(b).doc&&(y=s.mapping.maps[s.mapping.maps.length-1],d.push(new mr(y,void 0,void 0,d.length+f.length))),o--,y&&i.appendMap(y,o)}else s.maybeStep(h.step);if(h.selection)return l=i?h.selection.map(i.slice(o)):h.selection,u=new t(this.items.slice(0,r).append(f.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:s,selection:l}}addTransform(e,n,r,i){let o=[],s=this.eventCount,l=this.items,u=!i&&l.length?l.get(l.length-1):null;for(let f=0;fLL&&(l=DL(l,d),s-=d),new t(l.append(o),s)}remapping(e,n){let r=new Hs;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new mr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(m=>{m.selection&&l--},i);let u=n;this.items.forEach(m=>{let b=o.getMirror(--u);if(b==null)return;s=Math.min(s,b);let y=o.maps[b];if(m.step){let v=e.steps[b].invert(e.docs[b]),x=m.selection&&m.selection.map(o.slice(u+1,b));x&&l++,r.push(new mr(y,v,x))}else r.push(new mr(y))},i);let d=[];for(let m=n;mIL&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let u=s.step.map(n.slice(r)),d=u&&u.getMap();if(r--,d&&n.appendMap(d,r),u){let f=s.selection&&s.selection.map(n.slice(r));f&&o++;let h=new mr(d.invert(),u,f),m,b=i.length-1;(m=i.length&&i[b].merge(h))?i[b]=m:i.push(h)}}else s.map&&r--},this.items.length,0),new t(Op.from(i.reverse()),o)}};to.empty=new to(Op.empty,0);function DL(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}var mr=class t{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},gr=class{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}},LL=20;function PL(t,e,n,r){let i=n.getMeta(eo),o;if(i)return i.historyState;n.getMeta(HL)&&(t=new gr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(eo))return s.getMeta(eo).redo?new gr(t.done.addTransform(n,void 0,r,fc(e)),t.undone,uv(n.mapping.maps),t.prevTime,t.prevComposition):new gr(t.done,t.undone.addTransform(n,void 0,r,fc(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),u=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!BL(n,t.prevRanges)),d=s?Rp(t.prevRanges,n.mapping):uv(n.mapping.maps);return new gr(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,fc(e)),to.empty,d,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new gr(t.done.rebased(n,o),t.undone.rebased(n,o),Rp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new gr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Rp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function BL(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function uv(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function Rp(t,e){if(!t)return null;let n=[];for(let r=0;r{let i=eo.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=FL(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}var Dp=pc(!1,!0),Lp=pc(!0,!0),Oz=pc(!1,!1),Rz=pc(!0,!1);var pv=We.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Dp(t,e),redo:()=>({state:t,dispatch:e})=>Lp(t,e)}},addProseMirrorPlugins(){return[fv(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var hv=ce.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Q(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{let{selection:n}=e,{$from:r,$to:i}=n,o=t();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):ac(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:l})=>{var u;if(l){let{$to:d}=s.selection,f=d.end();if(d.nodeAfter)d.nodeAfter.isTextblock?s.setSelection(le.create(s.doc,d.pos+1)):d.nodeAfter.isBlock?s.setSelection(pe.create(s.doc,d.pos)):s.setSelection(le.create(s.doc,d.pos));else{let h=(u=d.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();h&&(s.insert(f,h),s.setSelection(le.create(s.doc,f+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[cc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var $L=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,zL=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,UL=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,WL=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,mv=st.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Wn({find:$L,type:this.type}),Wn({find:UL,type:this.type})]},addPasteRules(){return[vn({find:zL,type:this.type}),vn({find:WL,type:this.type})]}});var Pp=ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Q(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var KL="listItem",gv="textStyle",bv=/^(\d+)\.\s$/,yv=ce.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,...n}=t;return e===1?["ol",Q(this.options.HTMLAttributes,n),0]:["ol",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(KL,this.editor.getAttributes(gv)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=bi({find:bv,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=bi({find:bv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(gv)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}});var hc=ce.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Ev=We.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ke({key:new ze("placeholder"),props:{decorations:({doc:t,selection:e})=>{let n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;let o=this.editor.isEmpty;return t.descendants((s,l)=>{let u=r>=l&&r<=l+s.nodeSize,d=!s.isLeaf&&na(s);if((u||!this.options.showOnlyCurrent)&&d){let f=[this.options.emptyNodeClass];o&&f.push(this.options.emptyEditorClass);let h=vt.node(l,l+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:u}):this.options.placeholder});i.push(h)}return this.options.includeChildren}),ot.create(t,i)}}})]}});var VL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,GL=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vv=st.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Wn({find:VL,type:this.type})]},addPasteRules(){return[vn({find:GL,type:this.type})]}});var wv=st.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}});var xv=st.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});var Fp,Hp;if(typeof WeakMap<"u"){let t=new WeakMap;Fp=e=>t.get(e),Hp=(e,n)=>(t.set(e,n),n)}else{let t=[],n=0;Fp=r=>{for(let i=0;i(n==10&&(n=0),t[n++]=r,t[n++]=i)}var mt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(o||(o=[])).push({type:"overlong_rowspan",pos:f,n:S-D});break}let T=i+D*e;for(let $=0;$r&&(o+=d.attrs.colspan)}}for(let s=0;s1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function JL(t,e,n){t.problems||(t.problems=[]);let r={};for(let i=0;i0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function ZL(t){for(let e=t.depth;e>0;e--){let n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function or(t){let e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function vc(t){let e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let n=qo(e.$head)||jL(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function jL(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function $p(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function QL(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Wp(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Rv(t,e,n){let r=t.node(-1),i=mt.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function no(t,e,n=1){let r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Iv(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;if!=n.pos-o);u.unshift(n.pos-o);let d=u.map(f=>{let h=r.nodeAt(f);if(!h)throw RangeError(`No cell with offset ${f} found`);let m=o+f+1;return new Bo(l.resolve(m),l.resolve(m+h.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){let r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if($p(r)&&$p(i)&&Wp(r,i)){let o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Wr.rowSelection(r,i):o&&this.isColSelection()?Wr.colSelection(r,i):new Wr(r,i)}return le.between(r,i)}content(){let e=this.$anchorCell.node(-1),n=mt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let u=i.top;u0||x>0){let S=y.attrs;if(v>0&&(S=no(S,0,v)),x>0&&(S=no(S,S.colspan-x,x)),b.lefti.bottom){let S={...y.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=e.node(-1),i=mt.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(n.pos-o),u=e.node(0);return s.top<=l.top?(s.top>0&&(e=u.resolve(o+i.map[s.left])),l.bottom0&&(n=u.resolve(o+i.map[l.left])),s.bottom0)return!1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof Wr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),i=mt.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(n.pos-o),u=e.node(0);return s.left<=l.left?(s.left>0&&(e=u.resolve(o+i.map[s.top*i.width])),l.right0&&(n=u.resolve(o+i.map[l.top*i.width])),s.right{e.push(vt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ot.create(t.doc,e)}function rP({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(i+1)=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function iP({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){let o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){let o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function oP(t,e,n){let r=(e||t).selection,i=(e||t).doc,o,s;if(r instanceof pe&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=et.create(i,r.from);else if(s=="row"){let l=i.resolve(r.from+1);o=et.rowSelection(l,l)}else if(!n){let l=mt.get(r.node),u=r.from+1,d=u+l.map[l.width*l.height-1];o=et.create(i,u+1,d)}}else r instanceof le&&rP(r)?o=le.create(i,r.from):r instanceof le&&iP(r)&&(o=le.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var sP=new ze("fix-tables");function Lv(t,e,n,r){let i=t.childCount,o=e.childCount;e:for(let s=0,l=0;s{i.type.spec.tableRole=="table"&&(n=aP(t,i,o,n))};return e?e.doc!=t.doc&&Lv(e.doc,t.doc,0,r):t.doc.descendants(r),n}function aP(t,e,n,r){let i=mt.get(e);if(!i.problems)return r;r||(r=t.tr);let o=[];for(let u=0;u0){let b="cell";f.firstChild&&(b=f.firstChild.type.spec.tableRole);let y=[];for(let x=0;x0?-1:0;eP(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s0&&i0&&e.map[l-1]==u||i0?-1:0;cP(e,r,i+u)&&(u=i==0||i==e.height?null:0);for(let d=0,f=e.width*i;d0&&i0&&h==e.map[f-e.width]){let m=n.nodeAt(h).attrs;t.setNodeMarkup(t.mapping.slice(l).map(h+r),null,{...m,rowspan:m.rowspan-1}),d+=m.colspan-1}else if(i0&&n[o]==n[o-1]||r.right0&&n[i]==n[i-t]||r.bottomn[r.type.spec.tableRole])(t,e)}function fP(t){return(e,n)=>{var r;let i=e.selection,o,s;if(i instanceof et){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=ZL(i.$from),!o)return!1;s=(r=qo(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let l=o.attrs,u=[],d=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let f=br(e),h=e.tr;for(let b=0;b{s.attrs[t]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}}function pP(t){return function(e,n){if(!or(e))return!1;if(n){let r=on(e.schema),i=br(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(u=>i.table.nodeAt(u));for(let u=0;u{let y=b+o.tableStart,v=s.doc.nodeAt(y);v&&s.setNodeMarkup(y,m,v.attrs)}),r(s)}return!0}}var bU=Yo("row",{useDeprecatedLogic:!0}),yU=Yo("column",{useDeprecatedLogic:!0}),Vv=Yo("cell",{useDeprecatedLogic:!0});function hP(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){let o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function mc(t,e){let n=t.selection;if(!(n instanceof et))return!1;if(e){let r=t.tr,i=on(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new Z(i,0,0))}),r.docChanged&&e(r)}return!0}function mP(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;let i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let u=0;u=0;s--){let{rowspan:l,colspan:u}=o.child(s).attrs;for(let d=i;d=e.length&&e.push(G.empty),n[i]r&&(m=m.type.createChecked(no(m.attrs,m.attrs.colspan,f+m.attrs.colspan-r),m.content)),d.push(m),f+=m.attrs.colspan;for(let b=1;bi&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,i-h.attrs.rowspan)},h.content)),u.push(h)}o.push(G.from(u))}n=o,e=i}return{width:t,height:e,rows:n}}function yP(t,e,n,r,i,o,s){let l=t.doc.type.schema,u=on(l),d,f;if(i>e.width)for(let h=0,m=0;he.height){let h=[];for(let y=0,v=(e.height-1)*e.width;y=e.width?!1:n.nodeAt(e.map[v+y]).type==u.header_cell;h.push(x?f||(f=u.header_cell.createAndFill()):d||(d=u.cell.createAndFill()))}let m=u.row.create(null,G.from(h)),b=[];for(let y=e.height;y{if(!i)return!1;let o=n.selection;if(o instanceof et)return yc(n,r,ue.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;let s=qv(i,t,e);if(s==null)return!1;if(t=="horiz")return yc(n,r,ue.near(n.doc.resolve(o.head+e),e));{let l=n.doc.resolve(s),u=Rv(l,t,e),d;return u?d=ue.near(u,1):e<0?d=ue.near(n.doc.resolve(l.before(-1)),-1):d=ue.near(n.doc.resolve(l.after(-1)),1),yc(n,r,d)}}}function bc(t,e){return(n,r,i)=>{if(!i)return!1;let o=n.selection,s;if(o instanceof et)s=o;else{let u=qv(i,t,e);if(u==null)return!1;s=new et(n.doc.resolve(u))}let l=Rv(s.$headCell,t,e);return l?yc(n,r,new et(s.$anchorCell,l)):!1}}function vP(t,e){let n=t.state.doc,r=qo(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new et(r))),!0):!1}function wP(t,e,n){if(!or(t.state))return!1;let r=mP(n),i=t.state.selection;if(i instanceof et){r||(r={width:1,height:1,rows:[G.from(zp(on(t.state.schema).cell,n))]});let o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=mt.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=bP(r,l.right-l.left,l.bottom-l.top),Av(t.state,t.dispatch,s,l,r),!0}else if(r){let o=vc(t.state),s=o.start(-1);return Av(t.state,t.dispatch,s,mt.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function xP(t,e){var n;if(e.ctrlKey||e.metaKey)return;let r=Mv(t,e.target),i;if(e.shiftKey&&t.state.selection instanceof et)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=qo(t.state.selection.$anchor))!=null&&((n=Bp(t,e))==null?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(u,d){let f=Bp(t,d),h=yi.getState(t.state)==null;if(!f||!Wp(u,f))if(h)f=u;else return;let m=new et(u,f);if(h||!t.state.selection.eq(m)){let b=t.state.tr.setSelection(m);h&&b.setMeta(yi,u.pos),t.dispatch(b)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),yi.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(yi,-1))}function l(u){let d=u,f=yi.getState(t.state),h;if(f!=null)h=t.state.doc.resolve(f);else if(Mv(t,d.target)!=r&&(h=Bp(t,e),!h))return s();h&&o(h,d)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function qv(t,e,n){if(!(t.state.selection instanceof le))return null;let{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){let l=r.before(i),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?l:null}}return null}function Mv(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Bp(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?qo(t.state.doc.resolve(n.pos)):null}var _P=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Up(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,Up(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Up(t,e,n,r,i,o){var s;let l=0,u=!0,d=e.firstChild,f=t.firstChild;if(f){for(let h=0,m=0;hnew r(m,n,b)),new SP(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=kn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{TP(s,l,t,i)},mouseleave:s=>{CP(s)},mousedown:(s,l)=>{AP(s,l,e,n)}},decorations:s=>{let l=kn.getState(s);if(l&&l.activeHandle>-1)return RP(s,l.activeHandle)},nodeViews:{}}});return o}var SP=class Ec{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){let n=this,r=e.getMeta(kn);if(r&&r.setHandle!=null)return new Ec(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Ec(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return $p(e.doc.resolve(i))||(i=-1),new Ec(i,n.dragging)}return n}};function TP(t,e,n,r){let i=kn.getState(t.state);if(i&&!i.dragging){let o=NP(e.target),s=-1;if(o){let{left:l,right:u}=o.getBoundingClientRect();e.clientX-l<=n?s=Nv(t,e,"left",n):u-e.clientX<=n&&(s=Nv(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){let l=t.state.doc.resolve(s),u=l.node(-1),d=mt.get(u),f=l.start(-1);if(d.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==d.width-1)return}Jv(t,s)}}}function CP(t){let e=kn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Jv(t,-1)}function AP(t,e,n,r){var i;let o=(i=t.dom.ownerDocument.defaultView)!=null?i:window,s=kn.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=t.state.doc.nodeAt(s.activeHandle),u=MP(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(kn,{setDragging:{startX:e.clientX,startWidth:u}}));function d(h){o.removeEventListener("mouseup",d),o.removeEventListener("mousemove",f);let m=kn.getState(t.state);m?.dragging&&(kP(t,m.activeHandle,kv(m.dragging,h,n)),t.dispatch(t.state.tr.setMeta(kn,{setDragging:null})))}function f(h){if(!h.which)return d(h);let m=kn.getState(t.state);if(m&&m.dragging){let b=kv(m.dragging,h,n);Ov(t,m.activeHandle,b,r)}}return Ov(t,s.activeHandle,u,r),o.addEventListener("mouseup",d),o.addEventListener("mousemove",f),e.preventDefault(),!0}function MP(t,e,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=t.domAtPos(e),l=o.node.childNodes[o.offset].offsetWidth,u=n;if(r)for(let d=0;d{let r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function LP(t,e,n,r,i){let o=DP(t),s=[],l=[];for(let d=0;d{let{selection:e}=t.state;if(!PP(e))return!1;let n=0,r=Cp(e.ranges[0].$from,o=>o.type.name==="table");return r?.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Qv=ce.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Yp,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=IP(t,this.options.cellMinWidth);return["table",Q(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{let s=LP(o.schema,t,e,n);if(i){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(le.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Bv(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Fv(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Hv(t,e),addRowBefore:()=>({state:t,dispatch:e})=>zv(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Uv(t,e),deleteRow:()=>({state:t,dispatch:e})=>Wv(t,e),deleteTable:()=>({state:t,dispatch:e})=>Gv(t,e),mergeCells:()=>({state:t,dispatch:e})=>Vp(t,e),splitCell:()=>({state:t,dispatch:e})=>Gp(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Yo("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Yo("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Vv(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Vp(t,e)?!0:Gp(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Kv(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>qp(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>qp(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Kp(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=et.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:wc,"Mod-Backspace":wc,Delete:wc,"Mod-Delete":wc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Yv({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Xv({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Te(ne(t,"tableRole",e))}}});var ew=ce.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Q(this.options.HTMLAttributes,t),0]}});var tw=ce.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Q(this.options.HTMLAttributes,t),0]}});var nw=ce.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Q(this.options.HTMLAttributes,t),0]}});var rw=ce.create({name:"text",group:"inline"});var iw=st.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var BP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,FP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ow=st.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Wn({find:BP,type:this.type})]},addPasteRules(){return[vn({find:FP,type:this.type})]}});var gt="top",It="bottom",At="right",wt="left",xc="auto",Ei=[gt,It,At,wt],Kr="start",ro="end",sw="clippingParents",_c="viewport",Jo="popper",aw="reference",Jp=Ei.reduce(function(t,e){return t.concat([e+"-"+Kr,e+"-"+ro])},[]),Sc=[].concat(Ei,[xc]).reduce(function(t,e){return t.concat([e,e+"-"+Kr,e+"-"+ro])},[]),HP="beforeRead",$P="read",zP="afterRead",UP="beforeMain",WP="main",KP="afterMain",VP="beforeWrite",GP="write",qP="afterWrite",lw=[HP,$P,zP,UP,WP,KP,VP,GP,qP];function Ut(t){return t?(t.nodeName||"").toLowerCase():null}function lt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Kn(t){var e=lt(t).Element;return t instanceof e||t instanceof Element}function Dt(t){var e=lt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Xo(t){if(typeof ShadowRoot>"u")return!1;var e=lt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function YP(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!Dt(o)||!Ut(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var l=i[s];l===!1?o.removeAttribute(s):o.setAttribute(s,l===!0?"":l)}))})}function JP(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),l=s.reduce(function(u,d){return u[d]="",u},{});!Dt(i)||!Ut(i)||(Object.assign(i.style,l),Object.keys(o).forEach(function(u){i.removeAttribute(u)}))})}}var ia={name:"applyStyles",enabled:!0,phase:"write",fn:YP,effect:JP,requires:["computeStyles"]};function Wt(t){return t.split("-")[0]}var sr=Math.max,io=Math.min,Vr=Math.round;function Zo(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function oa(){return!/^((?!chrome|android).)*safari/i.test(Zo())}function Vn(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&Dt(t)&&(i=t.offsetWidth>0&&Vr(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&Vr(r.height)/t.offsetHeight||1);var s=Kn(t)?lt(t):window,l=s.visualViewport,u=!oa()&&n,d=(r.left+(u&&l?l.offsetLeft:0))/i,f=(r.top+(u&&l?l.offsetTop:0))/o,h=r.width/i,m=r.height/o;return{width:h,height:m,top:f,right:d+h,bottom:f+m,left:d,x:d,y:f}}function oo(t){var e=Vn(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function sa(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Xo(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function hn(t){return lt(t).getComputedStyle(t)}function Xp(t){return["table","td","th"].indexOf(Ut(t))>=0}function Yt(t){return((Kn(t)?t.ownerDocument:t.document)||window.document).documentElement}function Gr(t){return Ut(t)==="html"?t:t.assignedSlot||t.parentNode||(Xo(t)?t.host:null)||Yt(t)}function cw(t){return!Dt(t)||hn(t).position==="fixed"?null:t.offsetParent}function XP(t){var e=/firefox/i.test(Zo()),n=/Trident/i.test(Zo());if(n&&Dt(t)){var r=hn(t);if(r.position==="fixed")return null}var i=Gr(t);for(Xo(i)&&(i=i.host);Dt(i)&&["html","body"].indexOf(Ut(i))<0;){var o=hn(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function ar(t){for(var e=lt(t),n=cw(t);n&&Xp(n)&&hn(n).position==="static";)n=cw(n);return n&&(Ut(n)==="html"||Ut(n)==="body"&&hn(n).position==="static")?e:n||XP(t)||e}function so(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ao(t,e,n){return sr(t,io(e,n))}function uw(t,e,n){var r=ao(t,e,n);return r>n?n:r}function aa(){return{top:0,right:0,bottom:0,left:0}}function la(t){return Object.assign({},aa(),t)}function ca(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var ZP=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,la(typeof e!="number"?e:ca(e,Ei))};function jP(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,l=Wt(n.placement),u=so(l),d=[wt,At].indexOf(l)>=0,f=d?"height":"width";if(!(!o||!s)){var h=ZP(i.padding,n),m=oo(o),b=u==="y"?gt:wt,y=u==="y"?It:At,v=n.rects.reference[f]+n.rects.reference[u]-s[u]-n.rects.popper[f],x=s[u]-n.rects.reference[u],S=ar(o),L=S?u==="y"?S.clientHeight||0:S.clientWidth||0:0,D=v/2-x/2,T=h[b],$=L-m[f]-h[y],O=L/2-m[f]/2+D,Y=ao(T,O,$),ee=u;n.modifiersData[r]=(e={},e[ee]=Y,e.centerOffset=Y-O,e)}}function QP(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||sa(e.elements.popper,i)&&(e.elements.arrow=i))}var dw={name:"arrow",enabled:!0,phase:"main",fn:jP,effect:QP,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Gn(t){return t.split("-")[1]}var eB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function tB(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Vr(n*i)/i||0,y:Vr(r*i)/i||0}}function fw(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,l=t.position,u=t.gpuAcceleration,d=t.adaptive,f=t.roundOffsets,h=t.isFixed,m=s.x,b=m===void 0?0:m,y=s.y,v=y===void 0?0:y,x=typeof f=="function"?f({x:b,y:v}):{x:b,y:v};b=x.x,v=x.y;var S=s.hasOwnProperty("x"),L=s.hasOwnProperty("y"),D=wt,T=gt,$=window;if(d){var O=ar(n),Y="clientHeight",ee="clientWidth";if(O===lt(n)&&(O=Yt(n),hn(O).position!=="static"&&l==="absolute"&&(Y="scrollHeight",ee="scrollWidth")),O=O,i===gt||(i===wt||i===At)&&o===ro){T=It;var z=h&&O===$&&$.visualViewport?$.visualViewport.height:O[Y];v-=z-r.height,v*=u?1:-1}if(i===wt||(i===gt||i===It)&&o===ro){D=At;var re=h&&O===$&&$.visualViewport?$.visualViewport.width:O[ee];b-=re-r.width,b*=u?1:-1}}var he=Object.assign({position:l},d&&eB),Se=f===!0?tB({x:b,y:v},lt(n)):{x:b,y:v};if(b=Se.x,v=Se.y,u){var me;return Object.assign({},he,(me={},me[T]=L?"0":"",me[D]=S?"0":"",me.transform=($.devicePixelRatio||1)<=1?"translate("+b+"px, "+v+"px)":"translate3d("+b+"px, "+v+"px, 0)",me))}return Object.assign({},he,(e={},e[T]=L?v+"px":"",e[D]=S?b+"px":"",e.transform="",e))}function nB(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,l=n.roundOffsets,u=l===void 0?!0:l,d={placement:Wt(e.placement),variation:Gn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,fw(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:u})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,fw(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var pw={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:nB,data:{}};var Tc={passive:!0};function rB(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,l=s===void 0?!0:s,u=lt(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&d.forEach(function(f){f.addEventListener("scroll",n.update,Tc)}),l&&u.addEventListener("resize",n.update,Tc),function(){o&&d.forEach(function(f){f.removeEventListener("scroll",n.update,Tc)}),l&&u.removeEventListener("resize",n.update,Tc)}}var hw={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:rB,data:{}};var iB={left:"right",right:"left",bottom:"top",top:"bottom"};function jo(t){return t.replace(/left|right|bottom|top/g,function(e){return iB[e]})}var oB={start:"end",end:"start"};function Cc(t){return t.replace(/start|end/g,function(e){return oB[e]})}function lo(t){var e=lt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function co(t){return Vn(Yt(t)).left+lo(t).scrollLeft}function Zp(t,e){var n=lt(t),r=Yt(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,l=0,u=0;if(i){o=i.width,s=i.height;var d=oa();(d||!d&&e==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}return{width:o,height:s,x:l+co(t),y:u}}function jp(t){var e,n=Yt(t),r=lo(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=sr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=sr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),l=-r.scrollLeft+co(t),u=-r.scrollTop;return hn(i||n).direction==="rtl"&&(l+=sr(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:l,y:u}}function uo(t){var e=hn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Ac(t){return["html","body","#document"].indexOf(Ut(t))>=0?t.ownerDocument.body:Dt(t)&&uo(t)?t:Ac(Gr(t))}function vi(t,e){var n;e===void 0&&(e=[]);var r=Ac(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=lt(r),s=i?[o].concat(o.visualViewport||[],uo(r)?r:[]):r,l=e.concat(s);return i?l:l.concat(vi(Gr(s)))}function Qo(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function sB(t,e){var n=Vn(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function mw(t,e,n){return e===_c?Qo(Zp(t,n)):Kn(e)?sB(e,n):Qo(jp(Yt(t)))}function aB(t){var e=vi(Gr(t)),n=["absolute","fixed"].indexOf(hn(t).position)>=0,r=n&&Dt(t)?ar(t):t;return Kn(r)?e.filter(function(i){return Kn(i)&&sa(i,r)&&Ut(i)!=="body"}):[]}function Qp(t,e,n,r){var i=e==="clippingParents"?aB(t):[].concat(e),o=[].concat(i,[n]),s=o[0],l=o.reduce(function(u,d){var f=mw(t,d,r);return u.top=sr(f.top,u.top),u.right=io(f.right,u.right),u.bottom=io(f.bottom,u.bottom),u.left=sr(f.left,u.left),u},mw(t,s,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function ua(t){var e=t.reference,n=t.element,r=t.placement,i=r?Wt(r):null,o=r?Gn(r):null,s=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,u;switch(i){case gt:u={x:s,y:e.y-n.height};break;case It:u={x:s,y:e.y+e.height};break;case At:u={x:e.x+e.width,y:l};break;case wt:u={x:e.x-n.width,y:l};break;default:u={x:e.x,y:e.y}}var d=i?so(i):null;if(d!=null){var f=d==="y"?"height":"width";switch(o){case Kr:u[d]=u[d]-(e[f]/2-n[f]/2);break;case ro:u[d]=u[d]+(e[f]/2-n[f]/2);break;default:}}return u}function lr(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,l=n.boundary,u=l===void 0?sw:l,d=n.rootBoundary,f=d===void 0?_c:d,h=n.elementContext,m=h===void 0?Jo:h,b=n.altBoundary,y=b===void 0?!1:b,v=n.padding,x=v===void 0?0:v,S=la(typeof x!="number"?x:ca(x,Ei)),L=m===Jo?aw:Jo,D=t.rects.popper,T=t.elements[y?L:m],$=Qp(Kn(T)?T:T.contextElement||Yt(t.elements.popper),u,f,s),O=Vn(t.elements.reference),Y=ua({reference:O,element:D,strategy:"absolute",placement:i}),ee=Qo(Object.assign({},D,Y)),z=m===Jo?ee:O,re={top:$.top-z.top+S.top,bottom:z.bottom-$.bottom+S.bottom,left:$.left-z.left+S.left,right:z.right-$.right+S.right},he=t.modifiersData.offset;if(m===Jo&&he){var Se=he[i];Object.keys(re).forEach(function(me){var Ce=[At,It].indexOf(me)>=0?1:-1,ge=[gt,It].indexOf(me)>=0?"y":"x";re[me]+=Se[ge]*Ce})}return re}function eh(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,l=n.flipVariations,u=n.allowedAutoPlacements,d=u===void 0?Sc:u,f=Gn(r),h=f?l?Jp:Jp.filter(function(y){return Gn(y)===f}):Ei,m=h.filter(function(y){return d.indexOf(y)>=0});m.length===0&&(m=h);var b=m.reduce(function(y,v){return y[v]=lr(t,{placement:v,boundary:i,rootBoundary:o,padding:s})[Wt(v)],y},{});return Object.keys(b).sort(function(y,v){return b[y]-b[v]})}function lB(t){if(Wt(t)===xc)return[];var e=jo(t);return[Cc(t),e,Cc(e)]}function cB(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,l=s===void 0?!0:s,u=n.fallbackPlacements,d=n.padding,f=n.boundary,h=n.rootBoundary,m=n.altBoundary,b=n.flipVariations,y=b===void 0?!0:b,v=n.allowedAutoPlacements,x=e.options.placement,S=Wt(x),L=S===x,D=u||(L||!y?[jo(x)]:lB(x)),T=[x].concat(D).reduce(function(je,Me){return je.concat(Wt(Me)===xc?eh(e,{placement:Me,boundary:f,rootBoundary:h,padding:d,flipVariations:y,allowedAutoPlacements:v}):Me)},[]),$=e.rects.reference,O=e.rects.popper,Y=new Map,ee=!0,z=T[0],re=0;re=0,ge=Ce?"width":"height",_e=lr(e,{placement:he,boundary:f,rootBoundary:h,altBoundary:m,padding:d}),A=Ce?me?At:wt:me?It:gt;$[ge]>O[ge]&&(A=jo(A));var R=jo(A),K=[];if(o&&K.push(_e[Se]<=0),l&&K.push(_e[A]<=0,_e[R]<=0),K.every(function(je){return je})){z=he,ee=!1;break}Y.set(he,K)}if(ee)for(var J=y?3:1,se=function(Me){var Be=T.find(function(xt){var Nt=Y.get(xt);if(Nt)return Nt.slice(0,Me).every(function(Oe){return Oe})});if(Be)return z=Be,"break"},be=J;be>0;be--){var De=se(be);if(De==="break")break}e.placement!==z&&(e.modifiersData[r]._skip=!0,e.placement=z,e.reset=!0)}}var gw={name:"flip",enabled:!0,phase:"main",fn:cB,requiresIfExists:["offset"],data:{_skip:!1}};function bw(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function yw(t){return[gt,At,It,wt].some(function(e){return t[e]>=0})}function uB(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=lr(e,{elementContext:"reference"}),l=lr(e,{altBoundary:!0}),u=bw(s,r),d=bw(l,i,o),f=yw(u),h=yw(d);e.modifiersData[n]={referenceClippingOffsets:u,popperEscapeOffsets:d,isReferenceHidden:f,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":h})}var Ew={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:uB};function dB(t,e,n){var r=Wt(t),i=[wt,gt].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],l=o[1];return s=s||0,l=(l||0)*i,[wt,At].indexOf(r)>=0?{x:l,y:s}:{x:s,y:l}}function fB(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=Sc.reduce(function(f,h){return f[h]=dB(h,e.rects,o),f},{}),l=s[e.placement],u=l.x,d=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=u,e.modifiersData.popperOffsets.y+=d),e.modifiersData[r]=s}var vw={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:fB};function pB(t){var e=t.state,n=t.name;e.modifiersData[n]=ua({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var ww={name:"popperOffsets",enabled:!0,phase:"read",fn:pB,data:{}};function th(t){return t==="x"?"y":"x"}function hB(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,l=s===void 0?!1:s,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.padding,m=n.tether,b=m===void 0?!0:m,y=n.tetherOffset,v=y===void 0?0:y,x=lr(e,{boundary:u,rootBoundary:d,padding:h,altBoundary:f}),S=Wt(e.placement),L=Gn(e.placement),D=!L,T=so(S),$=th(T),O=e.modifiersData.popperOffsets,Y=e.rects.reference,ee=e.rects.popper,z=typeof v=="function"?v(Object.assign({},e.rects,{placement:e.placement})):v,re=typeof z=="number"?{mainAxis:z,altAxis:z}:Object.assign({mainAxis:0,altAxis:0},z),he=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,Se={x:0,y:0};if(O){if(o){var me,Ce=T==="y"?gt:wt,ge=T==="y"?It:At,_e=T==="y"?"height":"width",A=O[T],R=A+x[Ce],K=A-x[ge],J=b?-ee[_e]/2:0,se=L===Kr?Y[_e]:ee[_e],be=L===Kr?-ee[_e]:-Y[_e],De=e.elements.arrow,je=b&&De?oo(De):{width:0,height:0},Me=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:aa(),Be=Me[Ce],xt=Me[ge],Nt=ao(0,Y[_e],je[_e]),Oe=D?Y[_e]/2-J-Nt-Be-re.mainAxis:se-Nt-Be-re.mainAxis,_t=D?-Y[_e]/2+J+Nt+xt+re.mainAxis:be+Nt+xt+re.mainAxis,Jt=e.elements.arrow&&ar(e.elements.arrow),pt=Jt?T==="y"?Jt.clientTop||0:Jt.clientLeft||0:0,sn=(me=he?.[T])!=null?me:0,Xt=A+Oe-sn-pt,St=A+_t-sn,Je=ao(b?io(R,Xt):R,A,b?sr(K,St):K);O[T]=Je,Se[T]=Je-A}if(l){var Xn,Lt=T==="x"?gt:wt,V=T==="x"?It:At,bt=O[$],we=$==="y"?"height":"width",fe=bt+x[Lt],ct=bt-x[V],ut=[gt,wt].indexOf(S)!==-1,Pt=(Xn=he?.[$])!=null?Xn:0,kt=ut?fe:bt-Y[we]-ee[we]-Pt+re.altAxis,I=ut?bt+Y[we]+ee[we]-Pt-re.altAxis:ct,F=b&&ut?uw(kt,bt,I):ao(b?kt:fe,bt,b?I:ct);O[$]=F,Se[$]=F-bt}e.modifiersData[r]=Se}}var xw={name:"preventOverflow",enabled:!0,phase:"main",fn:hB,requiresIfExists:["offset"]};function nh(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function rh(t){return t===lt(t)||!Dt(t)?lo(t):nh(t)}function mB(t){var e=t.getBoundingClientRect(),n=Vr(e.width)/t.offsetWidth||1,r=Vr(e.height)/t.offsetHeight||1;return n!==1||r!==1}function ih(t,e,n){n===void 0&&(n=!1);var r=Dt(e),i=Dt(e)&&mB(e),o=Yt(e),s=Vn(t,i,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!n)&&((Ut(e)!=="body"||uo(o))&&(l=rh(e)),Dt(e)?(u=Vn(e,!0),u.x+=e.clientLeft,u.y+=e.clientTop):o&&(u.x=co(o))),{x:s.left+l.scrollLeft-u.x,y:s.top+l.scrollTop-u.y,width:s.width,height:s.height}}function gB(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(l){if(!n.has(l)){var u=e.get(l);u&&i(u)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function oh(t){var e=gB(t);return lw.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function sh(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function ah(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var _w={placement:"bottom",modifiers:[],strategy:"absolute"};function Sw(){for(var t=arguments.length,e=new Array(t),n=0;n-1}function Hw(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Cw(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function vB(t){return t.split(/\s+/).filter(Boolean)}function es(t){return[].concat(t)}function Aw(t,e){t.indexOf(e)===-1&&t.push(e)}function wB(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function xB(t){return t.split("-")[0]}function Nc(t){return[].slice.call(t)}function Mw(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function da(){return document.createElement("div")}function kc(t){return["Element","Fragment"].some(function(e){return mh(t,e)})}function _B(t){return mh(t,"NodeList")}function SB(t){return mh(t,"MouseEvent")}function TB(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function CB(t){return kc(t)?[t]:_B(t)?Nc(t):Array.isArray(t)?t:Nc(document.querySelectorAll(t))}function uh(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Nw(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function AB(t){var e,n=es(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function MB(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,l=i.props,u=l.interactiveBorder,d=xB(s.placement),f=s.modifiersData.offset;if(!f)return!0;var h=d==="bottom"?f.top.y:0,m=d==="top"?f.bottom.y:0,b=d==="right"?f.left.x:0,y=d==="left"?f.right.x:0,v=o.top-r+h>u,x=r-o.bottom-m>u,S=o.left-n+b>u,L=n-o.right-y>u;return v||x||S||L})}function dh(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function kw(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var yr={isTouch:!1},Ow=0;function NB(){yr.isTouch||(yr.isTouch=!0,window.performance&&document.addEventListener("mousemove",$w))}function $w(){var t=performance.now();t-Ow<20&&(yr.isTouch=!1,document.removeEventListener("mousemove",$w)),Ow=t}function kB(){var t=document.activeElement;if(TB(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function OB(){document.addEventListener("touchstart",NB,fo),window.addEventListener("blur",kB)}var RB=typeof window<"u"&&typeof document<"u",IB=RB?!!window.msCrypto:!1;var DB={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},LB={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},cr=Object.assign({appendTo:Fw,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},DB,LB),PB=Object.keys(cr),BB=function(e){var n=Object.keys(e);n.forEach(function(r){cr[r]=e[r]})};function zw(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var l;r[o]=t[o]!==void 0?t[o]:(l=cr[o])!=null?l:s}return r},{});return Object.assign({},t,n)}function FB(t,e){var n=e?Object.keys(zw(Object.assign({},cr,{plugins:e}))):PB,r=n.reduce(function(i,o){var s=(t.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function Rw(t,e){var n=Object.assign({},e,{content:Hw(e.content,[t])},e.ignoreAttributes?{}:FB(t,e.plugins));return n.aria=Object.assign({},cr.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var HB=function(){return"innerHTML"};function ph(t,e){t[HB()]=e}function Iw(t){var e=da();return t===!0?e.className=Pw:(e.className=Bw,kc(t)?e.appendChild(t):ph(e,t)),e}function Dw(t,e){kc(e.content)?(ph(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ph(t,e.content):t.textContent=e.content)}function hh(t){var e=t.firstElementChild,n=Nc(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Lw)}),arrow:n.find(function(r){return r.classList.contains(Pw)||r.classList.contains(Bw)}),backdrop:n.find(function(r){return r.classList.contains(EB)})}}function Uw(t){var e=da(),n=da();n.className=yB,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=da();r.className=Lw,r.setAttribute("data-state","hidden"),Dw(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var l=hh(e),u=l.box,d=l.content,f=l.arrow;s.theme?u.setAttribute("data-theme",s.theme):u.removeAttribute("data-theme"),typeof s.animation=="string"?u.setAttribute("data-animation",s.animation):u.removeAttribute("data-animation"),s.inertia?u.setAttribute("data-inertia",""):u.removeAttribute("data-inertia"),u.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?u.setAttribute("role",s.role):u.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&Dw(d,t.props),s.arrow?f?o.arrow!==s.arrow&&(u.removeChild(f),u.appendChild(Iw(s.arrow))):u.appendChild(Iw(s.arrow)):f&&u.removeChild(f)}return{popper:e,onUpdate:i}}Uw.$$tippy=!0;var $B=1,Mc=[],fh=[];function zB(t,e){var n=Rw(t,Object.assign({},cr,zw(Mw(e)))),r,i,o,s=!1,l=!1,u=!1,d=!1,f,h,m,b=[],y=Cw(Xt,n.interactiveDebounce),v,x=$B++,S=null,L=wB(n.plugins),D={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},T={id:x,reference:t,popper:da(),popperInstance:S,props:n,state:D,plugins:L,clearDelayTimeouts:kt,setProps:I,setContent:F,show:X,hide:oe,hideWithInteractivity:Fe,enable:ut,disable:Pt,unmount:rt,destroy:xr};if(!n.render)return T;var $=n.render(T),O=$.popper,Y=$.onUpdate;O.setAttribute("data-tippy-root",""),O.id="tippy-"+T.id,T.popper=O,t._tippy=T,O._tippy=T;var ee=L.map(function(B){return B.fn(T)}),z=t.hasAttribute("aria-expanded");return Jt(),J(),A(),R("onCreate",[T]),n.showOnCreate&&fe(),O.addEventListener("mouseenter",function(){T.props.interactive&&T.state.isVisible&&T.clearDelayTimeouts()}),O.addEventListener("mouseleave",function(){T.props.interactive&&T.props.trigger.indexOf("mouseenter")>=0&&Ce().addEventListener("mousemove",y)}),T;function re(){var B=T.props.touch;return Array.isArray(B)?B:[B,0]}function he(){return re()[0]==="hold"}function Se(){var B;return!!((B=T.props.render)!=null&&B.$$tippy)}function me(){return v||t}function Ce(){var B=me().parentNode;return B?AB(B):document}function ge(){return hh(O)}function _e(B){return T.state.isMounted&&!T.state.isVisible||yr.isTouch||f&&f.type==="focus"?0:ch(T.props.delay,B?0:1,cr.delay)}function A(B){B===void 0&&(B=!1),O.style.pointerEvents=T.props.interactive&&!B?"":"none",O.style.zIndex=""+T.props.zIndex}function R(B,ae,xe){if(xe===void 0&&(xe=!0),ee.forEach(function(Ke){Ke[B]&&Ke[B].apply(Ke,ae)}),xe){var qe;(qe=T.props)[B].apply(qe,ae)}}function K(){var B=T.props.aria;if(B.content){var ae="aria-"+B.content,xe=O.id,qe=es(T.props.triggerTarget||t);qe.forEach(function(Ke){var Bt=Ke.getAttribute(ae);if(T.state.isVisible)Ke.setAttribute(ae,Bt?Bt+" "+xe:xe);else{var an=Bt&&Bt.replace(xe,"").trim();an?Ke.setAttribute(ae,an):Ke.removeAttribute(ae)}})}}function J(){if(!(z||!T.props.aria.expanded)){var B=es(T.props.triggerTarget||t);B.forEach(function(ae){T.props.interactive?ae.setAttribute("aria-expanded",T.state.isVisible&&ae===me()?"true":"false"):ae.removeAttribute("aria-expanded")})}}function se(){Ce().removeEventListener("mousemove",y),Mc=Mc.filter(function(B){return B!==y})}function be(B){if(!(yr.isTouch&&(u||B.type==="mousedown"))){var ae=B.composedPath&&B.composedPath()[0]||B.target;if(!(T.props.interactive&&kw(O,ae))){if(es(T.props.triggerTarget||t).some(function(xe){return kw(xe,ae)})){if(yr.isTouch||T.state.isVisible&&T.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[T,B]);T.props.hideOnClick===!0&&(T.clearDelayTimeouts(),T.hide(),l=!0,setTimeout(function(){l=!1}),T.state.isMounted||Be())}}}function De(){u=!0}function je(){u=!1}function Me(){var B=Ce();B.addEventListener("mousedown",be,!0),B.addEventListener("touchend",be,fo),B.addEventListener("touchstart",je,fo),B.addEventListener("touchmove",De,fo)}function Be(){var B=Ce();B.removeEventListener("mousedown",be,!0),B.removeEventListener("touchend",be,fo),B.removeEventListener("touchstart",je,fo),B.removeEventListener("touchmove",De,fo)}function xt(B,ae){Oe(B,function(){!T.state.isVisible&&O.parentNode&&O.parentNode.contains(O)&&ae()})}function Nt(B,ae){Oe(B,ae)}function Oe(B,ae){var xe=ge().box;function qe(Ke){Ke.target===xe&&(dh(xe,"remove",qe),ae())}if(B===0)return ae();dh(xe,"remove",h),dh(xe,"add",qe),h=qe}function _t(B,ae,xe){xe===void 0&&(xe=!1);var qe=es(T.props.triggerTarget||t);qe.forEach(function(Ke){Ke.addEventListener(B,ae,xe),b.push({node:Ke,eventType:B,handler:ae,options:xe})})}function Jt(){he()&&(_t("touchstart",sn,{passive:!0}),_t("touchend",St,{passive:!0})),vB(T.props.trigger).forEach(function(B){if(B!=="manual")switch(_t(B,sn),B){case"mouseenter":_t("mouseleave",St);break;case"focus":_t(IB?"focusout":"blur",Je);break;case"focusin":_t("focusout",Je);break}})}function pt(){b.forEach(function(B){var ae=B.node,xe=B.eventType,qe=B.handler,Ke=B.options;ae.removeEventListener(xe,qe,Ke)}),b=[]}function sn(B){var ae,xe=!1;if(!(!T.state.isEnabled||Xn(B)||l)){var qe=((ae=f)==null?void 0:ae.type)==="focus";f=B,v=B.currentTarget,J(),!T.state.isVisible&&SB(B)&&Mc.forEach(function(Ke){return Ke(B)}),B.type==="click"&&(T.props.trigger.indexOf("mouseenter")<0||s)&&T.props.hideOnClick!==!1&&T.state.isVisible?xe=!0:fe(B),B.type==="click"&&(s=!xe),xe&&!qe&&ct(B)}}function Xt(B){var ae=B.target,xe=me().contains(ae)||O.contains(ae);if(!(B.type==="mousemove"&&xe)){var qe=we().concat(O).map(function(Ke){var Bt,an=Ke._tippy,Jr=(Bt=an.popperInstance)==null?void 0:Bt.state;return Jr?{popperRect:Ke.getBoundingClientRect(),popperState:Jr,props:n}:null}).filter(Boolean);MB(qe,B)&&(se(),ct(B))}}function St(B){var ae=Xn(B)||T.props.trigger.indexOf("click")>=0&&s;if(!ae){if(T.props.interactive){T.hideWithInteractivity(B);return}ct(B)}}function Je(B){T.props.trigger.indexOf("focusin")<0&&B.target!==me()||T.props.interactive&&B.relatedTarget&&O.contains(B.relatedTarget)||ct(B)}function Xn(B){return yr.isTouch?he()!==B.type.indexOf("touch")>=0:!1}function Lt(){V();var B=T.props,ae=B.popperOptions,xe=B.placement,qe=B.offset,Ke=B.getReferenceClientRect,Bt=B.moveTransition,an=Se()?hh(O).arrow:null,Jr=Ke?{getBoundingClientRect:Ke,contextElement:Ke.contextElement||me()}:t,Ca={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ai){var Xr=Ai.state;if(Se()){var Fu=ge(),gs=Fu.box;["placement","reference-hidden","escaped"].forEach(function(Zr){Zr==="placement"?gs.setAttribute("data-placement",Xr.placement):Xr.attributes.popper["data-popper-"+Zr]?gs.setAttribute("data-"+Zr,""):gs.removeAttribute("data-"+Zr)}),Xr.attributes.popper={}}}},_r=[{name:"offset",options:{offset:qe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Bt}},Ca];Se()&&an&&_r.push({name:"arrow",options:{element:an,padding:3}}),_r.push.apply(_r,ae?.modifiers||[]),T.popperInstance=lh(Jr,O,Object.assign({},ae,{placement:xe,onFirstUpdate:m,modifiers:_r}))}function V(){T.popperInstance&&(T.popperInstance.destroy(),T.popperInstance=null)}function bt(){var B=T.props.appendTo,ae,xe=me();T.props.interactive&&B===Fw||B==="parent"?ae=xe.parentNode:ae=Hw(B,[xe]),ae.contains(O)||ae.appendChild(O),T.state.isMounted=!0,Lt()}function we(){return Nc(O.querySelectorAll("[data-tippy-root]"))}function fe(B){T.clearDelayTimeouts(),B&&R("onTrigger",[T,B]),Me();var ae=_e(!0),xe=re(),qe=xe[0],Ke=xe[1];yr.isTouch&&qe==="hold"&&Ke&&(ae=Ke),ae?r=setTimeout(function(){T.show()},ae):T.show()}function ct(B){if(T.clearDelayTimeouts(),R("onUntrigger",[T,B]),!T.state.isVisible){Be();return}if(!(T.props.trigger.indexOf("mouseenter")>=0&&T.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(B.type)>=0&&s)){var ae=_e(!1);ae?i=setTimeout(function(){T.state.isVisible&&T.hide()},ae):o=requestAnimationFrame(function(){T.hide()})}}function ut(){T.state.isEnabled=!0}function Pt(){T.hide(),T.state.isEnabled=!1}function kt(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function I(B){if(!T.state.isDestroyed){R("onBeforeUpdate",[T,B]),pt();var ae=T.props,xe=Rw(t,Object.assign({},ae,Mw(B),{ignoreAttributes:!0}));T.props=xe,Jt(),ae.interactiveDebounce!==xe.interactiveDebounce&&(se(),y=Cw(Xt,xe.interactiveDebounce)),ae.triggerTarget&&!xe.triggerTarget?es(ae.triggerTarget).forEach(function(qe){qe.removeAttribute("aria-expanded")}):xe.triggerTarget&&t.removeAttribute("aria-expanded"),J(),A(),Y&&Y(ae,xe),T.popperInstance&&(Lt(),we().forEach(function(qe){requestAnimationFrame(qe._tippy.popperInstance.forceUpdate)})),R("onAfterUpdate",[T,B])}}function F(B){T.setProps({content:B})}function X(){var B=T.state.isVisible,ae=T.state.isDestroyed,xe=!T.state.isEnabled,qe=yr.isTouch&&!T.props.touch,Ke=ch(T.props.duration,0,cr.duration);if(!(B||ae||xe||qe)&&!me().hasAttribute("disabled")&&(R("onShow",[T],!1),T.props.onShow(T)!==!1)){if(T.state.isVisible=!0,Se()&&(O.style.visibility="visible"),A(),Me(),T.state.isMounted||(O.style.transition="none"),Se()){var Bt=ge(),an=Bt.box,Jr=Bt.content;uh([an,Jr],0)}m=function(){var _r;if(!(!T.state.isVisible||d)){if(d=!0,O.offsetHeight,O.style.transition=T.props.moveTransition,Se()&&T.props.animation){var ms=ge(),Ai=ms.box,Xr=ms.content;uh([Ai,Xr],Ke),Nw([Ai,Xr],"visible")}K(),J(),Aw(fh,T),(_r=T.popperInstance)==null||_r.forceUpdate(),R("onMount",[T]),T.props.animation&&Se()&&Nt(Ke,function(){T.state.isShown=!0,R("onShown",[T])})}},bt()}}function oe(){var B=!T.state.isVisible,ae=T.state.isDestroyed,xe=!T.state.isEnabled,qe=ch(T.props.duration,1,cr.duration);if(!(B||ae||xe)&&(R("onHide",[T],!1),T.props.onHide(T)!==!1)){if(T.state.isVisible=!1,T.state.isShown=!1,d=!1,s=!1,Se()&&(O.style.visibility="hidden"),se(),Be(),A(!0),Se()){var Ke=ge(),Bt=Ke.box,an=Ke.content;T.props.animation&&(uh([Bt,an],qe),Nw([Bt,an],"hidden"))}K(),J(),T.props.animation?Se()&&xt(qe,T.unmount):T.unmount()}}function Fe(B){Ce().addEventListener("mousemove",y),Aw(Mc,y),y(B)}function rt(){T.state.isVisible&&T.hide(),T.state.isMounted&&(V(),we().forEach(function(B){B._tippy.unmount()}),O.parentNode&&O.parentNode.removeChild(O),fh=fh.filter(function(B){return B!==T}),T.state.isMounted=!1,R("onHidden",[T]))}function xr(){T.state.isDestroyed||(T.clearDelayTimeouts(),T.unmount(),pt(),delete t._tippy,T.state.isDestroyed=!0,R("onDestroy",[T]))}}function fa(t,e){e===void 0&&(e={});var n=cr.plugins.concat(e.plugins||[]);OB();var r=Object.assign({},e,{plugins:n}),i=CB(t);if(0)var o,s;var l=i.reduce(function(u,d){var f=d&&zB(d,r);return f&&u.push(f),u},[]);return kc(t)?l[0]:l}fa.defaultProps=cr;fa.setDefaultProps=BB;fa.currentInput=yr;var $V=Object.assign({},ia,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});fa.setDefaultProps({render:Uw});var ts=fa;var gh=class{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:l,state:u,from:d,to:f})=>{let{doc:h,selection:m}=u,{empty:b}=m,y=!h.textBetween(d,f).length&&rc(u.selection),v=this.element.contains(document.activeElement);return!(!(l.hasFocus()||v)||b||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var u;if(this.preventHide){this.preventHide=!1;return}l?.relatedTarget&&(!((u=this.element.parentNode)===null||u===void 0)&&u.contains(l.relatedTarget))||this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,u)=>{let d=!u?.selection.eq(l.state.selection),f=!u?.doc.eq(l.state.doc);!d&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,d,f,u)},this.updateDelay))},this.updateHandler=(l,u,d,f)=>{var h,m,b;let{state:y,composing:v}=l,{selection:x}=y;if(v||!u&&!d)return;this.createTooltip();let{ranges:L}=x,D=Math.min(...L.map(O=>O.$from.pos)),T=Math.max(...L.map(O=>O.$to.pos));if(!((h=this.shouldShow)===null||h===void 0?void 0:h.call(this,{editor:this.editor,view:l,state:y,oldState:f,from:D,to:T}))){this.hide();return}(m=this.tippy)===null||m===void 0||m.setProps({getReferenceClientRect:((b=this.tippyOptions)===null||b===void 0?void 0:b.getReferenceClientRect)||(()=>{if(ac(y.selection)){let O=l.nodeDOM(D),Y=O.dataset.nodeViewWrapper?O:O.querySelector("[data-node-view-wrapper]");if(Y&&(O=Y.firstChild),O)return O.getBoundingClientRect()}return lc(l,D,T)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=o,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ts(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){let{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}let o=!n?.selection.eq(e.state.selection),s=!n?.doc.eq(e.state.doc);this.updateHandler(e,o,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}},UB=t=>new ke({key:typeof t.pluginKey=="string"?new ze(t.pluginKey):t.pluginKey,view:e=>new gh({view:e,...t})}),Ww=We.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[UB({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});var bh=class{constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:s,state:l})=>{let{selection:u}=l,{$anchor:d,empty:f}=u,h=d.depth===1,m=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent;return!(!s.hasFocus()||!f||!h||!m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var l;if(this.preventHide){this.preventHide=!1;return}s?.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(s.relatedTarget))||this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=r,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ts(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,o;let{state:s}=e,{doc:l,selection:u}=s,{from:d,to:f}=u;if(n&&n.doc.eq(l)&&n.selection.eq(u))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((o=this.tippyOptions)===null||o===void 0?void 0:o.getReferenceClientRect)||(()=>lc(e,d,f))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}},WB=t=>new ke({key:typeof t.pluginKey=="string"?new ze(t.pluginKey):t.pluginKey,view:e=>new bh({view:e,...t})}),Kw=We.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[WB({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});var yh=ce.create({name:"checkedList",priority:50,addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{class:"checked-list"}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul",getAttrs:t=>t.classList.contains("checked-list"),priority:1e3}]},renderHTML({HTMLAttributes:t}){return["ul",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleCheckedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}}});var Eh=ce.create({name:"lead",group:"block",content:"block+",addOptions(){return{HTMLAttributes:{class:"lead"}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("lead")}]},renderHTML({node:t,HTMLAttributes:e}){return["div",Q(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleLead:()=>({commands:t})=>t.toggleWrap(this.name)}}});var KB="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",VB="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",is=(t,e)=>{for(let n in e)t[n]=e[n];return t},Sh="numeric",Th="ascii",Ch="alpha",Lc="asciinumeric",Oc="alphanumeric",Ah="domain",Qw="emoji",GB="scheme",qB="slashscheme",Vw="whitespace";function YB(t,e){return t in e||(e[t]=[]),e[t]}function po(t,e,n){e[Sh]&&(e[Lc]=!0,e[Oc]=!0),e[Th]&&(e[Lc]=!0,e[Ch]=!0),e[Lc]&&(e[Oc]=!0),e[Ch]&&(e[Oc]=!0),e[Oc]&&(e[Ah]=!0),e[Qw]&&(e[Ah]=!0);for(let r in e){let i=YB(r,n);i.indexOf(t)<0&&i.push(t)}}function JB(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function wn(t){t===void 0&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}wn.groups={};wn.prototype={accepts(){return!!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,i),qn=(t,e,n,r,i)=>t.tr(e,n,r,i),Gw=(t,e,n,r,i)=>t.ts(e,n,r,i),j=(t,e,n,r,i)=>t.tt(e,n,r,i),qr="WORD",Mh="UWORD",ga="LOCALHOST",Nh="TLD",kh="UTLD",Pc="SCHEME",rs="SLASH_SCHEME",Oh="NUM",ex="WS",Rh="NL",pa="OPENBRACE",ha="CLOSEBRACE",Bc="OPENBRACKET",Fc="CLOSEBRACKET",Hc="OPENPAREN",$c="CLOSEPAREN",zc="OPENANGLEBRACKET",Uc="CLOSEANGLEBRACKET",Wc="FULLWIDTHLEFTPAREN",Kc="FULLWIDTHRIGHTPAREN",Vc="LEFTCORNERBRACKET",Gc="RIGHTCORNERBRACKET",qc="LEFTWHITECORNERBRACKET",Yc="RIGHTWHITECORNERBRACKET",Jc="FULLWIDTHLESSTHAN",Xc="FULLWIDTHGREATERTHAN",Zc="AMPERSAND",jc="APOSTROPHE",Qc="ASTERISK",xi="AT",eu="BACKSLASH",tu="BACKTICK",nu="CARET",_i="COLON",Ih="COMMA",ru="DOLLAR",Er="DOT",iu="EQUALS",Dh="EXCLAMATION",vr="HYPHEN",ou="PERCENT",su="PIPE",au="PLUS",lu="POUND",cu="QUERY",Lh="QUOTE",Ph="SEMI",wr="SLASH",ma="TILDE",uu="UNDERSCORE",tx="EMOJI",du="SYM",nx=Object.freeze({__proto__:null,WORD:qr,UWORD:Mh,LOCALHOST:ga,TLD:Nh,UTLD:kh,SCHEME:Pc,SLASH_SCHEME:rs,NUM:Oh,WS:ex,NL:Rh,OPENBRACE:pa,CLOSEBRACE:ha,OPENBRACKET:Bc,CLOSEBRACKET:Fc,OPENPAREN:Hc,CLOSEPAREN:$c,OPENANGLEBRACKET:zc,CLOSEANGLEBRACKET:Uc,FULLWIDTHLEFTPAREN:Wc,FULLWIDTHRIGHTPAREN:Kc,LEFTCORNERBRACKET:Vc,RIGHTCORNERBRACKET:Gc,LEFTWHITECORNERBRACKET:qc,RIGHTWHITECORNERBRACKET:Yc,FULLWIDTHLESSTHAN:Jc,FULLWIDTHGREATERTHAN:Xc,AMPERSAND:Zc,APOSTROPHE:jc,ASTERISK:Qc,AT:xi,BACKSLASH:eu,BACKTICK:tu,CARET:nu,COLON:_i,COMMA:Ih,DOLLAR:ru,DOT:Er,EQUALS:iu,EXCLAMATION:Dh,HYPHEN:vr,PERCENT:ou,PIPE:su,PLUS:au,POUND:lu,QUERY:cu,QUOTE:Lh,SEMI:Ph,SLASH:wr,TILDE:ma,UNDERSCORE:uu,EMOJI:tx,SYM:du}),ns=/[a-z]/,vh=/\p{L}/u,wh=/\p{Emoji}/u;var xh=/\d/,qw=/\s/;var Yw=` +`,XB="\uFE0F",ZB="\u200D",Rc=null,Ic=null;function jB(t){t===void 0&&(t=[]);let e={};wn.groups=e;let n=new wn;Rc==null&&(Rc=Jw(KB)),Ic==null&&(Ic=Jw(VB)),j(n,"'",jc),j(n,"{",pa),j(n,"}",ha),j(n,"[",Bc),j(n,"]",Fc),j(n,"(",Hc),j(n,")",$c),j(n,"<",zc),j(n,">",Uc),j(n,"\uFF08",Wc),j(n,"\uFF09",Kc),j(n,"\u300C",Vc),j(n,"\u300D",Gc),j(n,"\u300E",qc),j(n,"\u300F",Yc),j(n,"\uFF1C",Jc),j(n,"\uFF1E",Xc),j(n,"&",Zc),j(n,"*",Qc),j(n,"@",xi),j(n,"`",tu),j(n,"^",nu),j(n,":",_i),j(n,",",Ih),j(n,"$",ru),j(n,".",Er),j(n,"=",iu),j(n,"!",Dh),j(n,"-",vr),j(n,"%",ou),j(n,"|",su),j(n,"+",au),j(n,"#",lu),j(n,"?",cu),j(n,'"',Lh),j(n,"/",wr),j(n,";",Ph),j(n,"~",ma),j(n,"_",uu),j(n,"\\",eu);let r=qn(n,xh,Oh,{[Sh]:!0});qn(r,xh,r);let i=qn(n,ns,qr,{[Th]:!0});qn(i,ns,i);let o=qn(n,vh,Mh,{[Ch]:!0});qn(o,ns),qn(o,vh,o);let s=qn(n,qw,ex,{[Vw]:!0});j(n,Yw,Rh,{[Vw]:!0}),j(s,Yw),qn(s,qw,s);let l=qn(n,wh,tx,{[Qw]:!0});qn(l,wh,l),j(l,XB,l);let u=j(l,ZB);qn(u,wh,l);let d=[[ns,i]],f=[[ns,null],[vh,o]];for(let h=0;hh[0]>m[0]?1:-1);for(let h=0;h=0?y[Ah]=!0:ns.test(m)?xh.test(m)?y[Lc]=!0:y[Th]=!0:y[Sh]=!0,Gw(n,m,m,y)}return Gw(n,"localhost",ga,{ascii:!0}),n.jd=new wn(du),{start:n,tokens:is({groups:e},nx)}}function QB(t,e){let n=e2(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s=0&&(h+=n[s].length,m++),d+=n[s].length,o+=n[s].length,s++;o-=h,s-=m,d-=h,i.push({t:f.t,v:e.slice(o-d,o),s:o-d,e:o})}return i}function e2(t){let e=[],n=t.length,r=0;for(;r56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function wi(t,e,n,r,i){let o,s=e.length;for(let l=0;l=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}var ba={defaultProtocol:"http",events:null,format:Xw,formatHref:Xw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Bh(t,e){e===void 0&&(e=null);let n=is({},ba);t&&(n=is(n,t instanceof Bh?t.o:t));let r=n.ignoreTags,i=[];for(let o=0;on?r.substring(0,n)+"\u2026":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return t===void 0&&(t=ba.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},l=t.get("className",n,e),u=t.get("target",n,e),d=t.get("rel",n,e),f=t.getObj("attributes",n,e),h=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),u&&(s.target=u),d&&(s.rel=d),f&&is(s,f),{tagName:i,attributes:s,content:o,eventListeners:h}}};function fu(t,e){class n extends rx{constructor(i,o){super(i,o),this.t=t}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var Zw=fu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),jw=fu("text"),t2=fu("nl"),Dc=fu("url",{isLink:!0,toHref(t){return t===void 0&&(t=ba.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==ga&&t[1].t===_i}});var Yn=t=>new wn(t);function n2(t){let{groups:e}=t,n=e.domain.concat([Zc,Qc,xi,eu,tu,nu,ru,iu,vr,Oh,ou,su,au,lu,wr,du,ma,uu]),r=[jc,_i,Ih,Er,Dh,cu,Lh,Ph,zc,Uc,pa,ha,Fc,Bc,Hc,$c,Wc,Kc,Vc,Gc,qc,Yc,Jc,Xc],i=[Zc,jc,Qc,eu,tu,nu,ru,iu,vr,pa,ha,ou,su,au,lu,cu,wr,du,ma,uu],o=Yn(),s=j(o,ma);Pe(s,i,s),Pe(s,e.domain,s);let l=Yn(),u=Yn(),d=Yn();Pe(o,e.domain,l),Pe(o,e.scheme,u),Pe(o,e.slashscheme,d),Pe(l,i,s),Pe(l,e.domain,l);let f=j(l,xi);j(s,xi,f),j(u,xi,f),j(d,xi,f);let h=j(s,Er);Pe(h,i,s),Pe(h,e.domain,s);let m=Yn();Pe(f,e.domain,m),Pe(m,e.domain,m);let b=j(m,Er);Pe(b,e.domain,m);let y=Yn(Zw);Pe(b,e.tld,y),Pe(b,e.utld,y),j(f,ga,y);let v=j(m,vr);Pe(v,e.domain,m),Pe(y,e.domain,m),j(y,Er,b),j(y,vr,v);let x=j(y,_i);Pe(x,e.numeric,Zw);let S=j(l,vr),L=j(l,Er);Pe(S,e.domain,l),Pe(L,i,s),Pe(L,e.domain,l);let D=Yn(Dc);Pe(L,e.tld,D),Pe(L,e.utld,D),Pe(D,e.domain,l),Pe(D,i,s),j(D,Er,L),j(D,vr,S),j(D,xi,f);let T=j(D,_i),$=Yn(Dc);Pe(T,e.numeric,$);let O=Yn(Dc),Y=Yn();Pe(O,n,O),Pe(O,r,Y),Pe(Y,n,O),Pe(Y,r,Y),j(D,wr,O),j($,wr,O);let ee=j(u,_i),z=j(d,_i),re=j(z,wr),he=j(re,wr);Pe(u,e.domain,l),j(u,Er,L),j(u,vr,S),Pe(d,e.domain,l),j(d,Er,L),j(d,vr,S),Pe(ee,e.domain,O),j(ee,wr,O),Pe(he,e.domain,O),Pe(he,n,O),j(he,wr,O);let Se=[[pa,ha],[Bc,Fc],[Hc,$c],[zc,Uc],[Wc,Kc],[Vc,Gc],[qc,Yc],[Jc,Xc]];for(let me=0;me=0&&m++,i++,f++;if(m<0)i-=f,i0&&(o.push(_h(jw,e,s)),s=[]),i-=m,f-=m;let b=h.t,y=n.slice(i-f,i);o.push(_h(b,e,y))}}return s.length>0&&o.push(_h(jw,e,s)),o}function _h(t,e,n){let r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}var i2=typeof console<"u"&&console&&console.warn||(()=>{}),o2="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ft={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ix(){wn.groups={},ft.scanner=null,ft.parser=null,ft.tokenQueue=[],ft.pluginQueue=[],ft.customSchemes=[],ft.initialized=!1}function Fh(t,e){if(e===void 0&&(e=!1),ft.initialized&&i2(`linkifyjs: already initialized - will not register custom scheme "${t}" ${o2}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" -3. "-" cannot repeat`);ft.customSchemes.push([t,e])}function s2(){ft.scanner=jB(ft.customSchemes);for(let t=0;t{let i=e.some(d=>d.docChanged)&&!n.doc.eq(r.doc),o=e.some(d=>d.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r,l=KE(n.doc,[...e]);if(GE(l).forEach(({newRange:d})=>{let f=VE(r.doc,d,b=>b.isTextblock),h,m;if(f.length>1?(h=f[0],m=r.doc.textBetween(h.pos,h.pos+h.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(d.from,d.to," "," ").endsWith(" ")&&(h=f[0],m=r.doc.textBetween(h.pos,d.to,void 0," ")),h&&m){let b=m.split(" ").filter(S=>S!=="");if(b.length<=0)return!1;let y=b[b.length-1],w=h.pos+m.lastIndexOf(y);if(!y)return!1;let _=Fh(y).map(S=>S.toObject(t.defaultProtocol));if(!a2(_))return!1;_.filter(S=>S.isLink).map(S=>({...S,from:w+S.start+1,to:w+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).forEach(S=>{sc(S.from,S.to,r.doc).some(L=>L.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function c2(t){return new ke({key:new ze("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=r.target,l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(m=>m.nodeName==="A"))return!1;let c=Ap(e.state,t.type.name),d=r.target,f=(i=d?.href)!==null&&i!==void 0?i:c.href,h=(o=d?.target)!==null&&o!==void 0?o:c.target;return d&&f?(window.open(f,h),!0):!1}}})}function u2(t){return new ke({key:new ze("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});let c=Hh(l,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c?!1:(t.editor.commands.setMark(t.type,{href:c.href}),!0)}}})}var d2=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function ox(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(d2,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var sx=st.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.protocols.forEach(t=>{if(typeof t=="string"){Bh(t);return}Bh(t.scheme,t.optionalSlashes)})},onDestroy(){ix()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return!e||!ox(e,this.options.protocols)?!1:null}}]},renderHTML({HTMLAttributes:t}){return ox(t.href,this.options.protocols)?["a",Q(this.options.HTMLAttributes,t),0]:["a",Q(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[vn({find:t=>{let e=[];if(t){let{validate:n}=this.options,r=Hh(t).filter(i=>i.isLink&&n(i.value));r.length&&r.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[];return this.options.autolink&&t.push(l2({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:this.options.validate})),this.options.openOnClick===!0&&t.push(c2({type:this.type})),this.options.linkOnPaste&&t.push(u2({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});var $h=sx.extend({addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{},validate:void 0}},addAttributes(){return{href:{default:null},id:{default:null},target:{default:this.options.HTMLAttributes.target},hreflang:{default:null},rel:{default:null},referrerpolicy:{default:null},class:{default:null},as_button:{default:null,parseHTML:t=>t.getAttribute("data-as-button"),renderHTML:t=>({"data-as-button":t.as_button})},button_theme:{default:null,parseHTML:t=>t.getAttribute("data-as-button-theme"),renderHTML:t=>({"data-as-button-theme":t.button_theme})}}}});var f2=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,ax=ce.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Q(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[cc({find:f2,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var zh=ax.extend({addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},lazy:{default:null,parseHTML:t=>t.getAttribute("loading")==="lazy"?t.getAttribute("data-lazy"):null,renderHTML:t=>{if(t.lazy)return{"data-lazy":t.lazy,loading:"lazy"}}}}}});var p2=hc.extend({addAttributes(){return{class:{default:null}}}});var Uh=st.create({name:"small",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"small"}]},renderHTML({HTMLAttributes:t}){return["small",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setSmall:()=>({commands:t})=>t.setMark(this.name),toggleSmall:()=>({commands:t})=>t.toggleMark(this.name),unsetSmall:()=>({commands:t})=>t.unsetMark(this.name)}}});function lx(t,e=null){return e?t.createChecked(null,e):t.createAndFill()}function cx(t){if(t.cached.gridNodeTypes)return t.cached.gridNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.gridRole&&(e[r.spec.gridRole]=r)}),t.cached.gridNodeTypes=e,e}function ux(t,e,n,r){let i=cx(t),o=[];for(let s=0;st.getAttribute("type")},cols:{default:2,parseHTML:t=>t.getAttribute("cols")}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-grid")&&null}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{insertGrid:({cols:t=3,type:e="responsive"}={})=>({tr:n,dispatch:r,editor:i})=>{let o=ux(i.schema,t,e);if(r){let s=n.selection.anchor+1;n.replaceSelectionWith(o).scrollIntoView().setSelection(le.near(n.doc.resolve(s)))}return!0}}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertGrid()}},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{gridRole:Te(ne(t,"gridRole",e))}}});var Kh=ce.create({name:"gridColumn",content:"block+",gridRole:"column",isolating:!0,addOptions(){return{HTMLAttributes:{class:"filament-tiptap-grid__column"}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-grid__column")&&null}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t),0]}});var fx=t=>t.match(/(youtube\.com|youtu\.be)(.+)?$/),dx=(t=!1)=>t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",Vh=t=>{let{url:e,controls:n,nocookie:r,startAt:i}=t;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){let d=e.split("/").pop();return d?`${dx(r)}${d}`:null}let s=/v=([-\w]+)/gm.exec(e);if(!s||!s[1])return null;let l=`${dx(r)}${s[1]}`,c=[];return n?c.push("controls=1"):c.push("controls=0"),i&&c.push(`start=${i}`),c.length&&(l+=`?${c.join("&")}`),l};var Gh=ce.create({name:"youtube",selectable:!0,draggable:!0,atom:!0,addOptions(){return{inline:!1,HTMLAttributes:{},width:640,height:480}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{style:{default:null,parseHTML:t=>t.getAttribute("style")},src:{default:null},width:{default:this.options.width,parseHTML:t=>t.getAttribute("width")},height:{default:this.options.height,parseHTML:t=>t.getAttribute("height")},responsive:{default:!0,parseHTML:t=>t.classList.contains("responsive")??!1},start:{default:0},controls:{default:!0},nocookie:{default:!1},"data-aspect-width":{default:null,parseHTML:t=>t.getAttribute("data-aspect-width")},"data-aspect-height":{default:null,parseHTML:t=>t.getAttribute("data-aspect-height")}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>{if(!fx(t.src))return!1;let n=Vh({url:t.src,controls:t.controls,nocookie:t.nocookie,startAt:t.start||0});return e.insertContent({type:this.name,attrs:{...t,src:n}})}}},renderHTML({HTMLAttributes:t}){let e=Vh({url:t.src,controls:t.controls,nocookie:t.nocookie,startAt:t.start||0});return["div",{"data-youtube-video":"",class:t.responsive?"responsive":null},["iframe",{src:e,width:t.width,height:t.height,allowfullscreen:this.options.allowFullscreen,style:t.responsive?`aspect-ratio: ${t["data-aspect-width"]} / ${t["data-aspect-height"]}; width: 100%; height: auto;`:null,"data-aspect-width":t.responsive?t["data-aspect-width"]:null,"data-aspect-height":t.responsive?t["data-aspect-height"]:null}]]}});var px=t=>t.match(/(vimeo\.com)(.+)?$/),qh=t=>{let{url:e,autoplay:n,loop:r,title:i,byline:o,portrait:s}=t;if(e.includes("/video/"))return e;let c=/\.com\/([0-9]+)/gm.exec(e);if(!c||!c[1])return null;let d=`https://player.vimeo.com/video/${c[1]}`,f=[`autoplay=${n}`,`loop=${r}`,`title=${i}`,`byline=${o}`,`portrait=${s}`];return d+=`?${f.join("&")}`,d};var Yh=ce.create({name:"vimeo",selectable:!0,draggable:!0,atom:!0,addOptions(){return{inline:!1,HTMLAttributes:{},allowFullscreen:!0,width:640,height:480}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{style:{default:null,parseHTML:t=>t.getAttribute("style")},src:{default:null},width:{default:this.options.width,parseHTML:t=>t.getAttribute("width")},height:{default:this.options.height,parseHTML:t=>t.getAttribute("height")},autoplay:{default:0},loop:{default:0},title:{default:0},byline:{default:0},portrait:{default:0},responsive:{default:!0,parseHTML:t=>t.classList.contains("responsive")??!1},"data-aspect-width":{default:null,parseHTML:t=>t.getAttribute("data-aspect-width")},"data-aspect-height":{default:null,parseHTML:t=>t.getAttribute("data-aspect-height")}}},parseHTML(){return[{tag:"div[data-vimeo-video] iframe"}]},addCommands(){return{setVimeoVideo:t=>({commands:e})=>{if(!px(t.src))return!1;let n=qh({url:t.src,autoplay:t?.autoplay||0,loop:t?.loop||0,title:t?.title||0,byline:t?.byline||0,portrait:t?.portrait||0});return e.insertContent({type:this.name,attrs:{...t,src:n}})}}},renderHTML({HTMLAttributes:t}){let e=qh({url:t.src,autoplay:t?.autoplay||0,loop:t?.loop||0,title:t?.title||0,byline:t?.byline||0,portrait:t?.portrait||0});return["div",{"data-vimeo-video":"",class:t.responsive?"responsive":null},["iframe",{src:e,width:t.width,height:t.height,allowfullscreen:this.options.allowfullscreen,frameborder:0,allow:"autoplay; fullscreen; picture-in-picture",style:t.responsive?`aspect-ratio: ${t["data-aspect-width"]} / ${t["data-aspect-height"]}; width: 100%; height: auto;`:null,"data-aspect-width":t.responsive?t["data-aspect-width"]:null,"data-aspect-height":t.responsive?t["data-aspect-height"]:null}]]}});var Jh=ce.create({name:"video",selectable:!0,draggable:!0,atom:!0,inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addOptions(){return{inline:!1,HTMLAttributes:{autoplay:null,controls:null,loop:null},width:640,height:480}},addAttributes(){return{style:{default:null,parseHTML:t=>t.getAttribute("style")},responsive:{default:!0,parseHTML:t=>t.classList.contains("responsive")??!1},src:{default:null},width:{default:this.options.width,parseHTML:t=>t.getAttribute("width")},height:{default:this.options.height,parseHTML:t=>t.getAttribute("height")},autoplay:{default:null,parseHTML:t=>t.getAttribute("autoplay")},controls:{default:null,parseHTML:t=>t.getAttribute("controls")},loop:{default:null,parseHTML:t=>t.getAttribute("loop")},"data-aspect-width":{default:null,parseHTML:t=>t.getAttribute("data-aspect-width")},"data-aspect-height":{default:null,parseHTML:t=>t.getAttribute("data-aspect-height")}}},parseHTML(){return[{tag:"div[data-native-video] video"}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-native-video":"",class:t.responsive?"responsive":null},["video",{src:t.src,width:t.width,height:t.height,autoplay:t.autoplay?"true":null,controls:t.controls?"true":null,loop:t.loop?"true":null,style:t.responsive?`aspect-ratio: ${t["data-aspect-width"]} / ${t["data-aspect-height"]}; width: 100%; height: auto;`:null,"data-aspect-width":t.responsive?t["data-aspect-width"]:null,"data-aspect-height":t.responsive?t["data-aspect-height"]:null}]]}});var Xh=ce.create({name:"details",content:"detailsSummary detailsContent",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{}},parseHTML(){return[{tag:"details"}]},renderHTML({HTMLAttributes:t}){return["details",Q(this.options.HTMLAttributes,t),0]},addNodeView(){return({editor:t,getPos:e,node:n,HTMLAttributes:r})=>{let i=document.createElement("div"),o=document.createElement("div"),s=Q(this.options.HTMLAttributes,r,{"data-type":this.name});return Object.entries(s).forEach(([l,c])=>i.setAttribute(l,c)),{dom:i,contentDOM:i,ignoreMutation(l){return l.type==="selection"?!1:!i.contains(l.target)||i===l.target},update:l=>l.type===this.type}}},addCommands(){return{setDetails:()=>({state:t,chain:e})=>{var n;let{schema:r,selection:i}=t,{$from:o,$to:s}=i,l=o.blockRange(s);if(!l)return!1;let c=t.doc.slice(l.start,l.end);if(!r.nodes.detailsContent.contentMatch.matchFragment(c.content))return!1;let f=((n=c.toJSON())===null||n===void 0?void 0:n.content)||[];return e().insertContentAt({from:l.start,to:l.end},{type:this.name,content:[{type:"detailsSummary"},{type:"detailsContent",content:f}]}).setTextSelection(l.start+2).run()},unsetDetails:()=>({state:t,chain:e})=>{let{selection:n,schema:r}=t,i=Qi(S=>S.type===this.type)(n);if(!i)return!1;let o=ji(i.node,S=>S.type===r.nodes.detailsSummary),s=ji(i.node,S=>S.type===r.nodes.detailsContent);if(!o.length||!s.length)return!1;let l=o[0],c=s[0],d=i.pos,f=t.doc.resolve(d),h=d+i.node.nodeSize,m={from:d,to:h},b=c.node.content.toJSON()||[],y=f.parent.type.contentMatch.defaultType,_=[y?.create(null,l.node.content).toJSON(),...b];return e().insertContentAt(m,_).setTextSelection(d+1).run()}}},addKeyboardShortcuts(){return{Backspace:()=>{let{schema:t,selection:e}=this.editor.state,{empty:n,$anchor:r}=e;return!n||r.parent.type!==t.nodes.detailsSummary?!1:r.parentOffset!==0?this.editor.commands.command(({tr:i})=>{let o=r.pos-1,s=r.pos;return i.delete(o,s),!0}):this.editor.commands.unsetDetails()}}}});var Zh=ce.create({name:"detailsSummary",content:"text*",defining:!0,selectable:!1,isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:t}){return["summary",Q(this.options.HTMLAttributes,t),0]}});var jh=ce.create({name:"detailsContent",content:"block+",defining:!0,selectable:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:'div[data-type="details-content"]'}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t,{"data-type":"details-content"}),0]},addKeyboardShortcuts(){return{Enter:({editor:t})=>{let{state:e,view:n}=t,{selection:r}=e,{$from:i,empty:o}=r,s=Qi(he=>he.type===this.type)(r);if(!o||!s||!s.node.childCount)return!1;let l=i.index(s.depth),{childCount:c}=s.node;if(!(c===l+1))return!1;let f=s.node.type.contentMatch.defaultType,h=f?.createAndFill();if(!h)return!1;let m=e.doc.resolve(s.pos+1),b=c-1,y=s.node.child(b),w=m.posAtIndex(b,s.depth);if(!y.eq(h))return!1;let S=i.node(-3);if(!S)return!1;let L=i.indexAfter(-3),D=Tp(S.contentMatchAt(L));if(!D||!S.canReplaceWith(L,L,D))return!1;let T=D.createAndFill();if(!T)return!1;let{tr:$}=e,O=i.after(-2);$.replaceWith(O,O,T);let Y=$.doc.resolve(O),ee=ue.near(Y,1);$.setSelection(ee);let z=w,re=w+y.nodeSize;return $.delete(z,re),$.scrollIntoView(),n.dispatch($),!0}}}});var h2=/^```([a-z]+)?[\s\n]$/,m2=/^~~~([a-z]+)?[\s\n]$/,hx=ce.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:n}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Q(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(` +3. "-" cannot repeat`);ft.customSchemes.push([t,e])}function s2(){ft.scanner=jB(ft.customSchemes);for(let t=0;t{let i=e.some(d=>d.docChanged)&&!n.doc.eq(r.doc),o=e.some(d=>d.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r,l=VE(n.doc,[...e]);if(qE(l).forEach(({newRange:d})=>{let f=GE(r.doc,d,b=>b.isTextblock),h,m;if(f.length>1?(h=f[0],m=r.doc.textBetween(h.pos,h.pos+h.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(d.from,d.to," "," ").endsWith(" ")&&(h=f[0],m=r.doc.textBetween(h.pos,d.to,void 0," ")),h&&m){let b=m.split(" ").filter(S=>S!=="");if(b.length<=0)return!1;let y=b[b.length-1],v=h.pos+m.lastIndexOf(y);if(!y)return!1;let x=Hh(y).map(S=>S.toObject(t.defaultProtocol));if(!a2(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:v+S.start+1,to:v+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).forEach(S=>{sc(S.from,S.to,r.doc).some(L=>L.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function c2(t){return new ke({key:new ze("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=r.target,l=[];for(;s.nodeName!=="DIV";)l.push(s),s=s.parentNode;if(!l.find(m=>m.nodeName==="A"))return!1;let u=Ap(e.state,t.type.name),d=r.target,f=(i=d?.href)!==null&&i!==void 0?i:u.href,h=(o=d?.target)!==null&&o!==void 0?o:u.target;return d&&f?(window.open(f,h),!0):!1}}})}function u2(t){return new ke({key:new ze("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});let u=$h(l,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!u?!1:(t.editor.commands.setMark(t.type,{href:u.href}),!0)}}})}var d2=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function ox(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(d2,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var sx=st.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.protocols.forEach(t=>{if(typeof t=="string"){Fh(t);return}Fh(t.scheme,t.optionalSlashes)})},onDestroy(){ix()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return!e||!ox(e,this.options.protocols)?!1:null}}]},renderHTML({HTMLAttributes:t}){return ox(t.href,this.options.protocols)?["a",Q(this.options.HTMLAttributes,t),0]:["a",Q(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[vn({find:t=>{let e=[];if(t){let{validate:n}=this.options,r=$h(t).filter(i=>i.isLink&&n(i.value));r.length&&r.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[];return this.options.autolink&&t.push(l2({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:this.options.validate})),this.options.openOnClick===!0&&t.push(c2({type:this.type})),this.options.linkOnPaste&&t.push(u2({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});var zh=sx.extend({addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{},validate:void 0}},addAttributes(){return{href:{default:null},id:{default:null},target:{default:this.options.HTMLAttributes.target},hreflang:{default:null},rel:{default:null},referrerpolicy:{default:null},class:{default:null},as_button:{default:null,parseHTML:t=>t.getAttribute("data-as-button"),renderHTML:t=>({"data-as-button":t.as_button})},button_theme:{default:null,parseHTML:t=>t.getAttribute("data-as-button-theme"),renderHTML:t=>({"data-as-button-theme":t.button_theme})}}}});var f2=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,ax=ce.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Q(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[cc({find:f2,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var Uh=ax.extend({addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null},lazy:{default:null,parseHTML:t=>t.getAttribute("loading")==="lazy"?t.getAttribute("data-lazy"):null,renderHTML:t=>{if(t.lazy)return{"data-lazy":t.lazy,loading:"lazy"}}}}}});var p2=hc.extend({addAttributes(){return{class:{default:null}}}});var Wh=st.create({name:"small",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"small"}]},renderHTML({HTMLAttributes:t}){return["small",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{setSmall:()=>({commands:t})=>t.setMark(this.name),toggleSmall:()=>({commands:t})=>t.toggleMark(this.name),unsetSmall:()=>({commands:t})=>t.unsetMark(this.name)}}});function lx(t,e=null){return e?t.createChecked(null,e):t.createAndFill()}function cx(t){if(t.cached.gridNodeTypes)return t.cached.gridNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.gridRole&&(e[r.spec.gridRole]=r)}),t.cached.gridNodeTypes=e,e}function ux(t,e,n,r){let i=cx(t),o=[];for(let s=0;st.getAttribute("type")},cols:{default:2,parseHTML:t=>t.getAttribute("cols")}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-grid")&&null}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{insertGrid:({cols:t=3,type:e="responsive"}={})=>({tr:n,dispatch:r,editor:i})=>{let o=ux(i.schema,t,e);if(r){let s=n.selection.anchor+1;n.replaceSelectionWith(o).scrollIntoView().setSelection(le.near(n.doc.resolve(s)))}return!0}}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertGrid()}},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{gridRole:Te(ne(t,"gridRole",e))}}});var Vh=ce.create({name:"gridColumn",content:"block+",gridRole:"column",isolating:!0,addOptions(){return{HTMLAttributes:{class:"filament-tiptap-grid__column"}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-grid__column")&&null}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t),0]}});var fx=t=>t.match(/(youtube\.com|youtu\.be)(.+)?$/),dx=(t=!1)=>t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",Gh=t=>{let{url:e,controls:n,nocookie:r,startAt:i}=t;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){let d=e.split("/").pop();return d?`${dx(r)}${d}`:null}let s=/v=([-\w]+)/gm.exec(e);if(!s||!s[1])return null;let l=`${dx(r)}${s[1]}`,u=[];return n?u.push("controls=1"):u.push("controls=0"),i&&u.push(`start=${i}`),u.length&&(l+=`?${u.join("&")}`),l};var qh=ce.create({name:"youtube",selectable:!0,draggable:!0,atom:!0,addOptions(){return{inline:!1,HTMLAttributes:{},width:640,height:480}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{style:{default:null,parseHTML:t=>t.getAttribute("style")},src:{default:null},width:{default:this.options.width,parseHTML:t=>t.getAttribute("width")},height:{default:this.options.height,parseHTML:t=>t.getAttribute("height")},responsive:{default:!0,parseHTML:t=>t.classList.contains("responsive")??!1},start:{default:0},controls:{default:!0},nocookie:{default:!1},"data-aspect-width":{default:null,parseHTML:t=>t.getAttribute("data-aspect-width")},"data-aspect-height":{default:null,parseHTML:t=>t.getAttribute("data-aspect-height")}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>{if(!fx(t.src))return!1;let n=Gh({url:t.src,controls:t.controls,nocookie:t.nocookie,startAt:t.start||0});return e.insertContent({type:this.name,attrs:{...t,src:n}})}}},renderHTML({HTMLAttributes:t}){let e=Gh({url:t.src,controls:t.controls,nocookie:t.nocookie,startAt:t.start||0});return["div",{"data-youtube-video":"",class:t.responsive?"responsive":null},["iframe",{src:e,width:t.width,height:t.height,allowfullscreen:this.options.allowFullscreen,style:t.responsive?`aspect-ratio: ${t["data-aspect-width"]} / ${t["data-aspect-height"]}; width: 100%; height: auto;`:null,"data-aspect-width":t.responsive?t["data-aspect-width"]:null,"data-aspect-height":t.responsive?t["data-aspect-height"]:null}]]}});var px=t=>t.match(/(vimeo\.com)(.+)?$/),Yh=t=>{let{url:e,autoplay:n,loop:r,title:i,byline:o,portrait:s}=t;if(e.includes("/video/"))return e;let u=/\.com\/([0-9]+)/gm.exec(e);if(!u||!u[1])return null;let d=`https://player.vimeo.com/video/${u[1]}`,f=[`autoplay=${n}`,`loop=${r}`,`title=${i}`,`byline=${o}`,`portrait=${s}`];return d+=`?${f.join("&")}`,d};var Jh=ce.create({name:"vimeo",selectable:!0,draggable:!0,atom:!0,addOptions(){return{inline:!1,HTMLAttributes:{},allowFullscreen:!0,width:640,height:480}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{style:{default:null,parseHTML:t=>t.getAttribute("style")},src:{default:null},width:{default:this.options.width,parseHTML:t=>t.getAttribute("width")},height:{default:this.options.height,parseHTML:t=>t.getAttribute("height")},autoplay:{default:0},loop:{default:0},title:{default:0},byline:{default:0},portrait:{default:0},responsive:{default:!0,parseHTML:t=>t.classList.contains("responsive")??!1},"data-aspect-width":{default:null,parseHTML:t=>t.getAttribute("data-aspect-width")},"data-aspect-height":{default:null,parseHTML:t=>t.getAttribute("data-aspect-height")}}},parseHTML(){return[{tag:"div[data-vimeo-video] iframe"}]},addCommands(){return{setVimeoVideo:t=>({commands:e})=>{if(!px(t.src))return!1;let n=Yh({url:t.src,autoplay:t?.autoplay||0,loop:t?.loop||0,title:t?.title||0,byline:t?.byline||0,portrait:t?.portrait||0});return e.insertContent({type:this.name,attrs:{...t,src:n}})}}},renderHTML({HTMLAttributes:t}){let e=Yh({url:t.src,autoplay:t?.autoplay||0,loop:t?.loop||0,title:t?.title||0,byline:t?.byline||0,portrait:t?.portrait||0});return["div",{"data-vimeo-video":"",class:t.responsive?"responsive":null},["iframe",{src:e,width:t.width,height:t.height,allowfullscreen:this.options.allowfullscreen,frameborder:0,allow:"autoplay; fullscreen; picture-in-picture",style:t.responsive?`aspect-ratio: ${t["data-aspect-width"]} / ${t["data-aspect-height"]}; width: 100%; height: auto;`:null,"data-aspect-width":t.responsive?t["data-aspect-width"]:null,"data-aspect-height":t.responsive?t["data-aspect-height"]:null}]]}});var Xh=ce.create({name:"video",selectable:!0,draggable:!0,atom:!0,inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addOptions(){return{inline:!1,HTMLAttributes:{autoplay:null,controls:null,loop:null},width:640,height:480}},addAttributes(){return{style:{default:null,parseHTML:t=>t.getAttribute("style")},responsive:{default:!0,parseHTML:t=>t.classList.contains("responsive")??!1},src:{default:null},width:{default:this.options.width,parseHTML:t=>t.getAttribute("width")},height:{default:this.options.height,parseHTML:t=>t.getAttribute("height")},autoplay:{default:null,parseHTML:t=>t.getAttribute("autoplay")},controls:{default:null,parseHTML:t=>t.getAttribute("controls")},loop:{default:null,parseHTML:t=>t.getAttribute("loop")},"data-aspect-width":{default:null,parseHTML:t=>t.getAttribute("data-aspect-width")},"data-aspect-height":{default:null,parseHTML:t=>t.getAttribute("data-aspect-height")}}},parseHTML(){return[{tag:"div[data-native-video] video"}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-native-video":"",class:t.responsive?"responsive":null},["video",{src:t.src,width:t.width,height:t.height,autoplay:t.autoplay?"true":null,controls:t.controls?"true":null,loop:t.loop?"true":null,style:t.responsive?`aspect-ratio: ${t["data-aspect-width"]} / ${t["data-aspect-height"]}; width: 100%; height: auto;`:null,"data-aspect-width":t.responsive?t["data-aspect-width"]:null,"data-aspect-height":t.responsive?t["data-aspect-height"]:null}]]}});var Zh=ce.create({name:"details",content:"detailsSummary detailsContent",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{}},parseHTML(){return[{tag:"details"}]},renderHTML({HTMLAttributes:t}){return["details",Q(this.options.HTMLAttributes,t),0]},addNodeView(){return({editor:t,getPos:e,node:n,HTMLAttributes:r})=>{let i=document.createElement("div"),o=document.createElement("div"),s=Q(this.options.HTMLAttributes,r,{"data-type":this.name});return Object.entries(s).forEach(([l,u])=>i.setAttribute(l,u)),{dom:i,contentDOM:i,ignoreMutation(l){return l.type==="selection"?!1:!i.contains(l.target)||i===l.target},update:l=>l.type===this.type}}},addCommands(){return{setDetails:()=>({state:t,chain:e})=>{var n;let{schema:r,selection:i}=t,{$from:o,$to:s}=i,l=o.blockRange(s);if(!l)return!1;let u=t.doc.slice(l.start,l.end);if(!r.nodes.detailsContent.contentMatch.matchFragment(u.content))return!1;let f=((n=u.toJSON())===null||n===void 0?void 0:n.content)||[];return e().insertContentAt({from:l.start,to:l.end},{type:this.name,content:[{type:"detailsSummary"},{type:"detailsContent",content:f}]}).setTextSelection(l.start+2).run()},unsetDetails:()=>({state:t,chain:e})=>{let{selection:n,schema:r}=t,i=Qi(S=>S.type===this.type)(n);if(!i)return!1;let o=ji(i.node,S=>S.type===r.nodes.detailsSummary),s=ji(i.node,S=>S.type===r.nodes.detailsContent);if(!o.length||!s.length)return!1;let l=o[0],u=s[0],d=i.pos,f=t.doc.resolve(d),h=d+i.node.nodeSize,m={from:d,to:h},b=u.node.content.toJSON()||[],y=f.parent.type.contentMatch.defaultType,x=[y?.create(null,l.node.content).toJSON(),...b];return e().insertContentAt(m,x).setTextSelection(d+1).run()}}},addKeyboardShortcuts(){return{Backspace:()=>{let{schema:t,selection:e}=this.editor.state,{empty:n,$anchor:r}=e;return!n||r.parent.type!==t.nodes.detailsSummary?!1:r.parentOffset!==0?this.editor.commands.command(({tr:i})=>{let o=r.pos-1,s=r.pos;return i.delete(o,s),!0}):this.editor.commands.unsetDetails()}}}});var jh=ce.create({name:"detailsSummary",content:"text*",defining:!0,selectable:!1,isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:t}){return["summary",Q(this.options.HTMLAttributes,t),0]}});var Qh=ce.create({name:"detailsContent",content:"block+",defining:!0,selectable:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:'div[data-type="details-content"]'}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t,{"data-type":"details-content"}),0]},addKeyboardShortcuts(){return{Enter:({editor:t})=>{let{state:e,view:n}=t,{selection:r}=e,{$from:i,empty:o}=r,s=Qi(he=>he.type===this.type)(r);if(!o||!s||!s.node.childCount)return!1;let l=i.index(s.depth),{childCount:u}=s.node;if(!(u===l+1))return!1;let f=s.node.type.contentMatch.defaultType,h=f?.createAndFill();if(!h)return!1;let m=e.doc.resolve(s.pos+1),b=u-1,y=s.node.child(b),v=m.posAtIndex(b,s.depth);if(!y.eq(h))return!1;let S=i.node(-3);if(!S)return!1;let L=i.indexAfter(-3),D=Tp(S.contentMatchAt(L));if(!D||!S.canReplaceWith(L,L,D))return!1;let T=D.createAndFill();if(!T)return!1;let{tr:$}=e,O=i.after(-2);$.replaceWith(O,O,T);let Y=$.doc.resolve(O),ee=ue.near(Y,1);$.setSelection(ee);let z=v,re=v+y.nodeSize;return $.delete(z,re),$.scrollIntoView(),n.dispatch($),!0}}}});var h2=/^```([a-z]+)?[\s\n]$/,m2=/^~~~([a-z]+)?[\s\n]$/,hx=ce.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:n}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Q(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(` -`);return!o||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;let l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:d})=>(d.setSelection(ue.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[ra({find:h2,type:this.type,getAttributes:t=>({language:t[1]})}),ra({find:m2,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ke({key:new ze("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;let{tr:s,schema:l}=t.state,c=l.text(n.replace(/\r\n?/g,` -`));return s.replaceSelectionWith(this.type.create({language:o},c)),s.selection.$from.parent.type!==this.type&&s.setSelection(le.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});function g2(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function _x(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&_x(n)}),t}var hu=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Sx(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Si(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var b2="",mx=t=>!!t.scope,y2=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`},em=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=Sx(e)}openNode(e){if(!mx(e))return;let n=y2(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){mx(e)&&(this.buffer+=b2)}value(){return this.buffer}span(e){this.buffer+=``}},gx=(t={})=>{let e={children:[]};return Object.assign(e,t),e},tm=class t{constructor(){this.rootNode=gx(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n=gx({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{t._collapse(n)}))}},nm=class extends tm{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new em(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function ya(t){return t?typeof t=="string"?t:t.source:null}function Tx(t){return mo("(?=",t,")")}function E2(t){return mo("(?:",t,")*")}function v2(t){return mo("(?:",t,")?")}function mo(...t){return t.map(n=>ya(n)).join("")}function w2(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function im(...t){return"("+(w2(t).capture?"":"?:")+t.map(r=>ya(r)).join("|")+")"}function Cx(t){return new RegExp(t.toString()+"|").exec("").length-1}function x2(t,e){let n=t&&t.exec(e);return n&&n.index===0}var _2=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function om(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=ya(r),s="";for(;o.length>0;){let l=_2.exec(o);if(!l){s+=o;break}s+=o.substring(0,l.index),o=o.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+i):(s+=l[0],l[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(e)}var S2=/\b\B/,Ax="[a-zA-Z]\\w*",sm="[a-zA-Z_]\\w*",Mx="\\b\\d+(\\.\\d+)?",Nx="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",kx="\\b(0b[01]+)",T2="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",C2=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=mo(e,/.*\b/,t.binary,/\b.*/)),Si({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Ea={begin:"\\\\[\\s\\S]",relevance:0},A2={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ea]},M2={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ea]},N2={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},gu=function(t,e,n={}){let r=Si({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=im("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:mo(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},k2=gu("//","$"),O2=gu("/\\*","\\*/"),R2=gu("#","$"),I2={scope:"number",begin:Mx,relevance:0},D2={scope:"number",begin:Nx,relevance:0},L2={scope:"number",begin:kx,relevance:0},P2={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ea,{begin:/\[/,end:/\]/,relevance:0,contains:[Ea]}]},B2={scope:"title",begin:Ax,relevance:0},F2={scope:"title",begin:sm,relevance:0},H2={begin:"\\.\\s*"+sm,relevance:0},$2=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},pu=Object.freeze({__proto__:null,APOS_STRING_MODE:A2,BACKSLASH_ESCAPE:Ea,BINARY_NUMBER_MODE:L2,BINARY_NUMBER_RE:kx,COMMENT:gu,C_BLOCK_COMMENT_MODE:O2,C_LINE_COMMENT_MODE:k2,C_NUMBER_MODE:D2,C_NUMBER_RE:Nx,END_SAME_AS_BEGIN:$2,HASH_COMMENT_MODE:R2,IDENT_RE:Ax,MATCH_NOTHING_RE:S2,METHOD_GUARD:H2,NUMBER_MODE:I2,NUMBER_RE:Mx,PHRASAL_WORDS_MODE:N2,QUOTE_STRING_MODE:M2,REGEXP_MODE:P2,RE_STARTERS_RE:T2,SHEBANG:C2,TITLE_MODE:B2,UNDERSCORE_IDENT_RE:sm,UNDERSCORE_TITLE_MODE:F2});function z2(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function U2(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function W2(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=z2,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function K2(t,e){Array.isArray(t.illegal)&&(t.illegal=im(...t.illegal))}function V2(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function G2(t,e){t.relevance===void 0&&(t.relevance=1)}var q2=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=mo(n.beforeMatch,Tx(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},Y2=["of","and","for","in","not","or","if","then","parent","list","value"],J2="keyword";function Ox(t,e,n=J2){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,Ox(t[o],e,o))}),r;function i(o,s){e&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){let c=l.split("|");r[c[0]]=[o,X2(c[0],c[1])]})}}function X2(t,e){return e?Number(e):Z2(t)?0:1}function Z2(t){return Y2.includes(t.toLowerCase())}var bx={},ho=t=>{console.error(t)},yx=(t,...e)=>{console.log(`WARN: ${t}`,...e)},ss=(t,e)=>{bx[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),bx[`${t}/${e}`]=!0)},mu=new Error;function Rx(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let l=1;l<=e.length;l++)s[l+r]=i[l],o[l+r]=!0,r+=Cx(e[l-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function j2(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw ho("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),mu;if(typeof t.beginScope!="object"||t.beginScope===null)throw ho("beginScope must be object"),mu;Rx(t,t.begin,{key:"beginScope"}),t.begin=om(t.begin,{joinWith:""})}}function Q2(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw ho("skip, excludeEnd, returnEnd not compatible with endScope: {}"),mu;if(typeof t.endScope!="object"||t.endScope===null)throw ho("endScope must be object"),mu;Rx(t,t.end,{key:"endScope"}),t.end=om(t.end,{joinWith:""})}}function eF(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function tF(t){eF(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),j2(t),Q2(t)}function nF(t){function e(s,l){return new RegExp(ya(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=Cx(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let l=this.regexes.map(c=>c[1]);this.matcherRe=e(om(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;let c=this.matcherRe.exec(l);if(!c)return null;let d=c.findIndex((h,m)=>m>0&&h!==void 0),f=this.matchIndexes[d];return c.splice(0,d),Object.assign(c,f)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];let c=new n;return this.rules.slice(l).forEach(([d,f])=>c.addRule(d,f)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){let c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let d=c.exec(l);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){let f=this.getMatcher(0);f.lastIndex=this.lastIndex+1,d=f.exec(l)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function i(s){let l=new r;return s.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function o(s,l){let c=s;if(s.isCompiled)return c;[U2,V2,tF,q2].forEach(f=>f(s,l)),t.compilerExtensions.forEach(f=>f(s,l)),s.__beforeBegin=null,[W2,K2,G2].forEach(f=>f(s,l)),s.isCompiled=!0;let d=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),d=s.keywords.$pattern,delete s.keywords.$pattern),d=d||/\w+/,s.keywords&&(s.keywords=Ox(s.keywords,t.case_insensitive)),c.keywordPatternRe=e(d,!0),l&&(s.begin||(s.begin=/\B|\b/),c.beginRe=e(c.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(c.endRe=e(c.end)),c.terminatorEnd=ya(c.end)||"",s.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(c.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(f){return rF(f==="self"?s:f)})),s.contains.forEach(function(f){o(f,c)}),s.starts&&o(s.starts,l),c.matcher=i(c),c}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Si(t.classNameAliases||{}),o(t)}function Ix(t){return t?t.endsWithParent||Ix(t.starts):!1}function rF(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Si(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:Ix(t)?Si(t,{starts:t.starts?Si(t.starts):null}):Object.isFrozen(t)?Si(t):t}var iF="11.10.0",rm=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},Qh=Sx,Ex=Si,vx=Symbol("nomatch"),oF=7,Dx=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,o="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:nm};function c(A){return l.noHighlightRe.test(A)}function d(A){let R=A.className+" ";R+=A.parentNode?A.parentNode.className:"";let K=l.languageDetectRe.exec(R);if(K){let J=z(K[1]);return J||(yx(o.replace("{}",K[1])),yx("Falling back to no-highlight mode for this block.",A)),J?K[1]:"no-highlight"}return R.split(/\s+/).find(J=>c(J)||z(J))}function f(A,R,K){let J="",se="";typeof R=="object"?(J=A,K=R.ignoreIllegals,se=R.language):(ss("10.7.0","highlight(lang, code, ...args) has been deprecated."),ss("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),se=A,J=R),K===void 0&&(K=!0);let be={code:J,language:se};ge("before:highlight",be);let De=be.result?be.result:h(be.language,be.code,K);return De.code=be.code,ge("after:highlight",De),De}function h(A,R,K,J){let se=Object.create(null);function be(I,F){return I.keywords[F]}function De(){if(!V.keywords){we.addText(fe);return}let I=0;V.keywordPatternRe.lastIndex=0;let F=V.keywordPatternRe.exec(fe),X="";for(;F;){X+=fe.substring(I,F.index);let oe=Je.case_insensitive?F[0].toLowerCase():F[0],Fe=be(V,oe);if(Fe){let[rt,xr]=Fe;if(we.addText(X),X="",se[oe]=(se[oe]||0)+1,se[oe]<=oF&&(ct+=xr),rt.startsWith("_"))X+=F[0];else{let B=Je.classNameAliases[rt]||rt;Be(F[0],B)}}else X+=F[0];I=V.keywordPatternRe.lastIndex,F=V.keywordPatternRe.exec(fe)}X+=fe.substring(I),we.addText(X)}function je(){if(fe==="")return;let I=null;if(typeof V.subLanguage=="string"){if(!e[V.subLanguage]){we.addText(fe);return}I=h(V.subLanguage,fe,!0,bt[V.subLanguage]),bt[V.subLanguage]=I._top}else I=b(fe,V.subLanguage.length?V.subLanguage:null);V.relevance>0&&(ct+=I.relevance),we.__addSublanguage(I._emitter,I.language)}function Me(){V.subLanguage!=null?je():De(),fe=""}function Be(I,F){I!==""&&(we.startScope(F),we.addText(I),we.endScope())}function xt(I,F){let X=1,oe=F.length-1;for(;X<=oe;){if(!I._emit[X]){X++;continue}let Fe=Je.classNameAliases[I[X]]||I[X],rt=F[X];Fe?Be(rt,Fe):(fe=rt,De(),fe=""),X++}}function Nt(I,F){return I.scope&&typeof I.scope=="string"&&we.openNode(Je.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(Be(fe,Je.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),fe=""):I.beginScope._multi&&(xt(I.beginScope,F),fe="")),V=Object.create(I,{parent:{value:V}}),V}function Oe(I,F,X){let oe=x2(I.endRe,X);if(oe){if(I["on:end"]){let Fe=new hu(I);I["on:end"](F,Fe),Fe.isMatchIgnored&&(oe=!1)}if(oe){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return Oe(I.parent,F,X)}function _t(I){return V.matcher.regexIndex===0?(fe+=I[0],1):(kt=!0,0)}function Jt(I){let F=I[0],X=I.rule,oe=new hu(X),Fe=[X.__beforeBegin,X["on:begin"]];for(let rt of Fe)if(rt&&(rt(I,oe),oe.isMatchIgnored))return _t(F);return X.skip?fe+=F:(X.excludeBegin&&(fe+=F),Me(),!X.returnBegin&&!X.excludeBegin&&(fe=F)),Nt(X,I),X.returnBegin?0:F.length}function pt(I){let F=I[0],X=R.substring(I.index),oe=Oe(V,I,X);if(!oe)return vx;let Fe=V;V.endScope&&V.endScope._wrap?(Me(),Be(F,V.endScope._wrap)):V.endScope&&V.endScope._multi?(Me(),xt(V.endScope,I)):Fe.skip?fe+=F:(Fe.returnEnd||Fe.excludeEnd||(fe+=F),Me(),Fe.excludeEnd&&(fe=F));do V.scope&&we.closeNode(),!V.skip&&!V.subLanguage&&(ct+=V.relevance),V=V.parent;while(V!==oe.parent);return oe.starts&&Nt(oe.starts,I),Fe.returnEnd?0:F.length}function sn(){let I=[];for(let F=V;F!==Je;F=F.parent)F.scope&&I.unshift(F.scope);I.forEach(F=>we.openNode(F))}let Xt={};function St(I,F){let X=F&&F[0];if(fe+=I,X==null)return Me(),0;if(Xt.type==="begin"&&F.type==="end"&&Xt.index===F.index&&X===""){if(fe+=R.slice(F.index,F.index+1),!i){let oe=new Error(`0 width match regex (${A})`);throw oe.languageName=A,oe.badRule=Xt.rule,oe}return 1}if(Xt=F,F.type==="begin")return Jt(F);if(F.type==="illegal"&&!K){let oe=new Error('Illegal lexeme "'+X+'" for mode "'+(V.scope||"")+'"');throw oe.mode=V,oe}else if(F.type==="end"){let oe=pt(F);if(oe!==vx)return oe}if(F.type==="illegal"&&X==="")return 1;if(Pt>1e5&&Pt>F.index*3)throw new Error("potential infinite loop, way more iterations than matches");return fe+=X,X.length}let Je=z(A);if(!Je)throw ho(o.replace("{}",A)),new Error('Unknown language: "'+A+'"');let Xn=nF(Je),Lt="",V=J||Xn,bt={},we=new l.__emitter(l);sn();let fe="",ct=0,ut=0,Pt=0,kt=!1;try{if(Je.__emitTokens)Je.__emitTokens(R,we);else{for(V.matcher.considerAll();;){Pt++,kt?kt=!1:V.matcher.considerAll(),V.matcher.lastIndex=ut;let I=V.matcher.exec(R);if(!I)break;let F=R.substring(ut,I.index),X=St(F,I);ut=I.index+X}St(R.substring(ut))}return we.finalize(),Lt=we.toHTML(),{language:A,value:Lt,relevance:ct,illegal:!1,_emitter:we,_top:V}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:A,value:Qh(R),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:ut,context:R.slice(ut-100,ut+100),mode:I.mode,resultSoFar:Lt},_emitter:we};if(i)return{language:A,value:Qh(R),illegal:!1,relevance:0,errorRaised:I,_emitter:we,_top:V};throw I}}function m(A){let R={value:Qh(A),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return R._emitter.addText(A),R}function b(A,R){R=R||l.languages||Object.keys(e);let K=m(A),J=R.filter(z).filter(he).map(Me=>h(Me,A,!1));J.unshift(K);let se=J.sort((Me,Be)=>{if(Me.relevance!==Be.relevance)return Be.relevance-Me.relevance;if(Me.language&&Be.language){if(z(Me.language).supersetOf===Be.language)return 1;if(z(Be.language).supersetOf===Me.language)return-1}return 0}),[be,De]=se,je=be;return je.secondBest=De,je}function y(A,R,K){let J=R&&n[R]||K;A.classList.add("hljs"),A.classList.add(`language-${J}`)}function w(A){let R=null,K=d(A);if(c(K))return;if(ge("before:highlightElement",{el:A,language:K}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),l.throwUnescapedHTML))throw new rm("One of your code blocks includes unescaped HTML.",A.innerHTML);R=A;let J=R.textContent,se=K?f(J,{language:K,ignoreIllegals:!0}):b(J);A.innerHTML=se.value,A.dataset.highlighted="yes",y(A,K,se.language),A.result={language:se.language,re:se.relevance,relevance:se.relevance},se.secondBest&&(A.secondBest={language:se.secondBest.language,relevance:se.secondBest.relevance}),ge("after:highlightElement",{el:A,result:se,text:J})}function _(A){l=Ex(l,A)}let S=()=>{T(),ss("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function L(){T(),ss("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let D=!1;function T(){if(document.readyState==="loading"){D=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function $(){D&&T()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",$,!1);function O(A,R){let K=null;try{K=R(t)}catch(J){if(ho("Language definition for '{}' could not be registered.".replace("{}",A)),i)ho(J);else throw J;K=s}K.name||(K.name=A),e[A]=K,K.rawDefinition=R.bind(null,t),K.aliases&&re(K.aliases,{languageName:A})}function Y(A){delete e[A];for(let R of Object.keys(n))n[R]===A&&delete n[R]}function ee(){return Object.keys(e)}function z(A){return A=(A||"").toLowerCase(),e[A]||e[n[A]]}function re(A,{languageName:R}){typeof A=="string"&&(A=[A]),A.forEach(K=>{n[K.toLowerCase()]=R})}function he(A){let R=z(A);return R&&!R.disableAutodetect}function Se(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=R=>{A["before:highlightBlock"](Object.assign({block:R.el},R))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=R=>{A["after:highlightBlock"](Object.assign({block:R.el},R))})}function me(A){Se(A),r.push(A)}function Ce(A){let R=r.indexOf(A);R!==-1&&r.splice(R,1)}function ge(A,R){let K=A;r.forEach(function(J){J[K]&&J[K](R)})}function _e(A){return ss("10.7.0","highlightBlock will be removed entirely in v12.0"),ss("10.7.0","Please use highlightElement now."),w(A)}Object.assign(t,{highlight:f,highlightAuto:b,highlightAll:T,highlightElement:w,highlightBlock:_e,configure:_,initHighlighting:S,initHighlightingOnLoad:L,registerLanguage:O,unregisterLanguage:Y,listLanguages:ee,getLanguage:z,registerAliases:re,autoDetection:he,inherit:Ex,addPlugin:me,removePlugin:Ce}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=iF,t.regex={concat:mo,lookahead:Tx,either:im,optional:v2,anyNumberOfTimes:E2};for(let A in pu)typeof pu[A]=="object"&&_x(pu[A]);return Object.assign(t,pu),t},as=Dx({});as.newInstance=()=>Dx({});var sF=as;as.HighlightJS=as;as.default=as;var aF=g2(sF);function Lx(t,e=[]){return t.map(n=>{let r=[...e,...n.properties?n.properties.className:[]];return n.children?Lx(n.children,r):{text:n.value,classes:r}}).flat()}function wx(t){return t.value||t.children||[]}function lF(t){return!!aF.getLanguage(t)}function xx({doc:t,name:e,lowlight:n,defaultLanguage:r}){let i=[];return ji(t,o=>o.type.name===e).forEach(o=>{var s;let l=o.pos+1,c=o.node.attrs.language||r,d=n.listLanguages(),f=c&&(d.includes(c)||lF(c)||!((s=n.registered)===null||s===void 0)&&s.call(n,c))?wx(n.highlight(c,o.node.textContent)):wx(n.highlightAuto(o.node.textContent));Lx(f).forEach(h=>{let m=l+h.text.length;if(h.classes.length){let b=vt.inline(l,m,{class:h.classes.join(" ")});i.push(b)}l=m})}),ot.create(t,i)}function cF(t){return typeof t=="function"}function uF({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>cF(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new ke({key:new ze("lowlight"),state:{init:(i,{doc:o})=>xx({doc:o,name:t,lowlight:e,defaultLanguage:n}),apply:(i,o,s,l)=>{let c=s.selection.$head.parent.type.name,d=l.selection.$head.parent.type.name,f=ji(s.doc,m=>m.type.name===t),h=ji(l.doc,m=>m.type.name===t);return i.docChanged&&([c,d].includes(t)||h.length!==f.length||i.steps.some(m=>m.from!==void 0&&m.to!==void 0&&f.some(b=>b.pos>=m.from&&b.pos+b.node.nodeSize<=m.to)))?xx({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var Px=hx.extend({addOptions(){var t;return{...(t=this.parent)===null||t===void 0?void 0:t.call(this),lowlight:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)===null||t===void 0?void 0:t.call(this))||[],uF({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});var am=Px.extend({addKeyboardShortcuts(){return{...this.parent?.(),ArrowDown:()=>{let t=this.editor.state,{from:e,to:n}=t.selection;if(e>1&&e===n){let r=!1;t.doc.nodesBetween(e-1,n-1,o=>{o.type.name==="codeBlock"&&(r=!0)});let i=!0;if(t.doc.nodesBetween(e+1,n+1,o=>{o&&(i=!1)}),r&&i)return this.editor.commands.setHardBreak()}return!1}}}});var lm=ce.create({name:"hurdle",group:"block",content:"block+",addOptions(){return{colors:["gray_light","gray","gray_dark","primary","secondary","tertiary","accent"],HTMLAttributes:{class:"filament-tiptap-hurdle"}}},addAttributes(){return{color:{default:"gray",parseHTML:t=>t.getAttribute("data-color"),renderHTML:t=>({"data-color":t.color})}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-hurdle")}]},renderHTML({node:t,HTMLAttributes:e}){return["div",Q(this.options.HTMLAttributes,e),0]},addCommands(){return{setHurdle:t=>({commands:e})=>this.options.colors.includes(t.color)?e.toggleWrap(this.name,t):!1}}});var cm=We.create({name:"textAlign",addOptions(){return{types:[],alignments:["start","center","end","justify"],defaultAlignment:"start"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>t.style.textAlign||this.options.defaultAlignment,renderHTML:t=>t.style&&t.style.includes("text-align")?{}:t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.every(n=>e.updateAttributes(n,{textAlign:t})):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("start"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("end"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});function bu(t,e,n=null){return n?t.createChecked({"data-col-span":e},n):t.createAndFill({"data-col-span":e})}function Bx(t){if(t.cached.gridBuilderNodeTypes)return t.cached.gridBuilderNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.gridBuilderRole&&(e[r.spec.gridBuilderRole]=r)}),t.cached.gridBuilderNodeTypes=e,e}function Fx(t,e,n,r,i,o,s){let l=Bx(t),c=[];if(n==="asymmetric")c.push(bu(l.builderColumn,i,s)),c.push(bu(l.builderColumn,o,s));else for(let d=0;dt.getAttribute("data-type")},"data-cols":{default:2,parseHTML:t=>t.getAttribute("data-cols")},"data-stack-at":{default:"md",parseHTML:t=>t.getAttribute("data-stack-at")},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>({style:`grid-template-columns: repeat(${t["data-cols"]}, 1fr);`})}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-grid-builder")&&null}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{insertGridBuilder:({cols:t=3,type:e="responsive",stackAt:n,asymmetricLeft:r=null,asymmetricRight:i=null}={})=>({tr:o,dispatch:s,editor:l})=>{let c=Fx(l.schema,t,e,n,r,i);if(s){let d=o.selection.anchor+1;o.replaceSelectionWith(c).scrollIntoView().setSelection(le.near(o.doc.resolve(d)))}return!0}}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertGridBuilder()}},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{gridBuilderRole:Te(ne(t,"gridBuilderRole",e))}}});var dm=ce.create({name:"gridBuilderColumn",content:"block+",gridBuilderRole:"builderColumn",isolating:!0,addOptions(){return{HTMLAttributes:{class:"filament-tiptap-grid-builder__column"}}},addAttributes(){return{"data-col-span":{default:1,parseHTML:t=>t.getAttribute("data-col-span")},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>({style:`grid-column: span ${t["data-col-span"]};`})}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-grid-builder__column")&&null}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t),0]}});var fm=We.create({name:"dragAndDrop",addProseMirrorPlugins(t){return[new ke({props:{handleDrop(e,n){if(!n)return!1;n.preventDefault();let r=e.posAtCoords({left:n.clientX,top:n.clientY});return n.dataTransfer.getData("block")?(n.target.dispatchEvent(new CustomEvent("dragged-block",{detail:{type:n.dataTransfer.getData("block"),coordinates:r},bubbles:!0})),!1):(n.dataTransfer.getData("mergeTag")&&n.target.dispatchEvent(new CustomEvent("dragged-merge-tag",{detail:{tag:n.dataTransfer.getData("mergeTag"),coordinates:r},bubbles:!0})),!1)}}})]}});var pm=ce.create({name:"tiptapBlock",group:"block",atom:!0,defining:!0,draggable:!0,selectable:!0,isolating:!0,allowGapCursor:!0,inline:!1,addAttributes(){return{preview:{default:null,parseHTML:t=>t.getAttribute("data-preview"),renderHTML:t=>t.preview?{"data-preview":t.preview}:null},statePath:{default:null,parseHTML:t=>t.getAttribute("data-state-path"),renderHTML:t=>t.statePath?{"data-state-path":t.statePath}:null},type:{default:null,parseHTML:t=>t.getAttribute("data-type"),renderHTML:t=>t.type?{"data-type":t.type}:null},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:null},data:{default:null,parseHTML:t=>t.getAttribute("data-data"),renderHTML:t=>t.data?{"data-data":JSON.stringify(t.data)}:null}}},parseHTML(){return[{tag:"tiptap-block"}]},renderHTML({HTMLAttributes:t}){return["tiptap-block",Q(t)]},addNodeView(){return({editor:t,node:e,getPos:n})=>{let r=document.createElement("div");r.contentEditable="false",r.classList.add("tiptap-block-wrapper");let i=typeof e.attrs.data=="object"?JSON.stringify(e.attrs.data):e.attrs.data;return r.innerHTML=` +`);return!o||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;let l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:d})=>(d.setSelection(ue.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[ra({find:h2,type:this.type,getAttributes:t=>({language:t[1]})}),ra({find:m2,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ke({key:new ze("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;let{tr:s,schema:l}=t.state,u=l.text(n.replace(/\r\n?/g,` +`));return s.replaceSelectionWith(this.type.create({language:o},u)),s.selection.$from.parent.type!==this.type&&s.setSelection(le.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});function g2(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function _x(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&_x(n)}),t}var hu=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Sx(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Si(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var b2="",mx=t=>!!t.scope,y2=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`},tm=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=Sx(e)}openNode(e){if(!mx(e))return;let n=y2(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){mx(e)&&(this.buffer+=b2)}value(){return this.buffer}span(e){this.buffer+=``}},gx=(t={})=>{let e={children:[]};return Object.assign(e,t),e},nm=class t{constructor(){this.rootNode=gx(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n=gx({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{t._collapse(n)}))}},rm=class extends nm{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new tm(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function ya(t){return t?typeof t=="string"?t:t.source:null}function Tx(t){return mo("(?=",t,")")}function E2(t){return mo("(?:",t,")*")}function v2(t){return mo("(?:",t,")?")}function mo(...t){return t.map(n=>ya(n)).join("")}function w2(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function om(...t){return"("+(w2(t).capture?"":"?:")+t.map(r=>ya(r)).join("|")+")"}function Cx(t){return new RegExp(t.toString()+"|").exec("").length-1}function x2(t,e){let n=t&&t.exec(e);return n&&n.index===0}var _2=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function sm(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=ya(r),s="";for(;o.length>0;){let l=_2.exec(o);if(!l){s+=o;break}s+=o.substring(0,l.index),o=o.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?s+="\\"+String(Number(l[1])+i):(s+=l[0],l[0]==="("&&n++)}return s}).map(r=>`(${r})`).join(e)}var S2=/\b\B/,Ax="[a-zA-Z]\\w*",am="[a-zA-Z_]\\w*",Mx="\\b\\d+(\\.\\d+)?",Nx="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",kx="\\b(0b[01]+)",T2="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",C2=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=mo(e,/.*\b/,t.binary,/\b.*/)),Si({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Ea={begin:"\\\\[\\s\\S]",relevance:0},A2={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ea]},M2={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ea]},N2={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},gu=function(t,e,n={}){let r=Si({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=om("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:mo(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},k2=gu("//","$"),O2=gu("/\\*","\\*/"),R2=gu("#","$"),I2={scope:"number",begin:Mx,relevance:0},D2={scope:"number",begin:Nx,relevance:0},L2={scope:"number",begin:kx,relevance:0},P2={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ea,{begin:/\[/,end:/\]/,relevance:0,contains:[Ea]}]},B2={scope:"title",begin:Ax,relevance:0},F2={scope:"title",begin:am,relevance:0},H2={begin:"\\.\\s*"+am,relevance:0},$2=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},pu=Object.freeze({__proto__:null,APOS_STRING_MODE:A2,BACKSLASH_ESCAPE:Ea,BINARY_NUMBER_MODE:L2,BINARY_NUMBER_RE:kx,COMMENT:gu,C_BLOCK_COMMENT_MODE:O2,C_LINE_COMMENT_MODE:k2,C_NUMBER_MODE:D2,C_NUMBER_RE:Nx,END_SAME_AS_BEGIN:$2,HASH_COMMENT_MODE:R2,IDENT_RE:Ax,MATCH_NOTHING_RE:S2,METHOD_GUARD:H2,NUMBER_MODE:I2,NUMBER_RE:Mx,PHRASAL_WORDS_MODE:N2,QUOTE_STRING_MODE:M2,REGEXP_MODE:P2,RE_STARTERS_RE:T2,SHEBANG:C2,TITLE_MODE:B2,UNDERSCORE_IDENT_RE:am,UNDERSCORE_TITLE_MODE:F2});function z2(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function U2(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function W2(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=z2,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function K2(t,e){Array.isArray(t.illegal)&&(t.illegal=om(...t.illegal))}function V2(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function G2(t,e){t.relevance===void 0&&(t.relevance=1)}var q2=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=mo(n.beforeMatch,Tx(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},Y2=["of","and","for","in","not","or","if","then","parent","list","value"],J2="keyword";function Ox(t,e,n=J2){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(o){Object.assign(r,Ox(t[o],e,o))}),r;function i(o,s){e&&(s=s.map(l=>l.toLowerCase())),s.forEach(function(l){let u=l.split("|");r[u[0]]=[o,X2(u[0],u[1])]})}}function X2(t,e){return e?Number(e):Z2(t)?0:1}function Z2(t){return Y2.includes(t.toLowerCase())}var bx={},ho=t=>{console.error(t)},yx=(t,...e)=>{console.log(`WARN: ${t}`,...e)},ss=(t,e)=>{bx[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),bx[`${t}/${e}`]=!0)},mu=new Error;function Rx(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let l=1;l<=e.length;l++)s[l+r]=i[l],o[l+r]=!0,r+=Cx(e[l-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0}function j2(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw ho("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),mu;if(typeof t.beginScope!="object"||t.beginScope===null)throw ho("beginScope must be object"),mu;Rx(t,t.begin,{key:"beginScope"}),t.begin=sm(t.begin,{joinWith:""})}}function Q2(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw ho("skip, excludeEnd, returnEnd not compatible with endScope: {}"),mu;if(typeof t.endScope!="object"||t.endScope===null)throw ho("endScope must be object"),mu;Rx(t,t.end,{key:"endScope"}),t.end=sm(t.end,{joinWith:""})}}function eF(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function tF(t){eF(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),j2(t),Q2(t)}function nF(t){function e(s,l){return new RegExp(ya(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,u){u.position=this.position++,this.matchIndexes[this.matchAt]=u,this.regexes.push([u,l]),this.matchAt+=Cx(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let l=this.regexes.map(u=>u[1]);this.matcherRe=e(sm(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;let u=this.matcherRe.exec(l);if(!u)return null;let d=u.findIndex((h,m)=>m>0&&h!==void 0),f=this.matchIndexes[d];return u.splice(0,d),Object.assign(u,f)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];let u=new n;return this.rules.slice(l).forEach(([d,f])=>u.addRule(d,f)),u.compile(),this.multiRegexes[l]=u,u}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,u){this.rules.push([l,u]),u.type==="begin"&&this.count++}exec(l){let u=this.getMatcher(this.regexIndex);u.lastIndex=this.lastIndex;let d=u.exec(l);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){let f=this.getMatcher(0);f.lastIndex=this.lastIndex+1,d=f.exec(l)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function i(s){let l=new r;return s.contains.forEach(u=>l.addRule(u.begin,{rule:u,type:"begin"})),s.terminatorEnd&&l.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&l.addRule(s.illegal,{type:"illegal"}),l}function o(s,l){let u=s;if(s.isCompiled)return u;[U2,V2,tF,q2].forEach(f=>f(s,l)),t.compilerExtensions.forEach(f=>f(s,l)),s.__beforeBegin=null,[W2,K2,G2].forEach(f=>f(s,l)),s.isCompiled=!0;let d=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),d=s.keywords.$pattern,delete s.keywords.$pattern),d=d||/\w+/,s.keywords&&(s.keywords=Ox(s.keywords,t.case_insensitive)),u.keywordPatternRe=e(d,!0),l&&(s.begin||(s.begin=/\B|\b/),u.beginRe=e(u.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(u.endRe=e(u.end)),u.terminatorEnd=ya(u.end)||"",s.endsWithParent&&l.terminatorEnd&&(u.terminatorEnd+=(s.end?"|":"")+l.terminatorEnd)),s.illegal&&(u.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(f){return rF(f==="self"?s:f)})),s.contains.forEach(function(f){o(f,u)}),s.starts&&o(s.starts,l),u.matcher=i(u),u}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Si(t.classNameAliases||{}),o(t)}function Ix(t){return t?t.endsWithParent||Ix(t.starts):!1}function rF(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Si(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:Ix(t)?Si(t,{starts:t.starts?Si(t.starts):null}):Object.isFrozen(t)?Si(t):t}var iF="11.10.0",im=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},em=Sx,Ex=Si,vx=Symbol("nomatch"),oF=7,Dx=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,o="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:rm};function u(A){return l.noHighlightRe.test(A)}function d(A){let R=A.className+" ";R+=A.parentNode?A.parentNode.className:"";let K=l.languageDetectRe.exec(R);if(K){let J=z(K[1]);return J||(yx(o.replace("{}",K[1])),yx("Falling back to no-highlight mode for this block.",A)),J?K[1]:"no-highlight"}return R.split(/\s+/).find(J=>u(J)||z(J))}function f(A,R,K){let J="",se="";typeof R=="object"?(J=A,K=R.ignoreIllegals,se=R.language):(ss("10.7.0","highlight(lang, code, ...args) has been deprecated."),ss("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),se=A,J=R),K===void 0&&(K=!0);let be={code:J,language:se};ge("before:highlight",be);let De=be.result?be.result:h(be.language,be.code,K);return De.code=be.code,ge("after:highlight",De),De}function h(A,R,K,J){let se=Object.create(null);function be(I,F){return I.keywords[F]}function De(){if(!V.keywords){we.addText(fe);return}let I=0;V.keywordPatternRe.lastIndex=0;let F=V.keywordPatternRe.exec(fe),X="";for(;F;){X+=fe.substring(I,F.index);let oe=Je.case_insensitive?F[0].toLowerCase():F[0],Fe=be(V,oe);if(Fe){let[rt,xr]=Fe;if(we.addText(X),X="",se[oe]=(se[oe]||0)+1,se[oe]<=oF&&(ct+=xr),rt.startsWith("_"))X+=F[0];else{let B=Je.classNameAliases[rt]||rt;Be(F[0],B)}}else X+=F[0];I=V.keywordPatternRe.lastIndex,F=V.keywordPatternRe.exec(fe)}X+=fe.substring(I),we.addText(X)}function je(){if(fe==="")return;let I=null;if(typeof V.subLanguage=="string"){if(!e[V.subLanguage]){we.addText(fe);return}I=h(V.subLanguage,fe,!0,bt[V.subLanguage]),bt[V.subLanguage]=I._top}else I=b(fe,V.subLanguage.length?V.subLanguage:null);V.relevance>0&&(ct+=I.relevance),we.__addSublanguage(I._emitter,I.language)}function Me(){V.subLanguage!=null?je():De(),fe=""}function Be(I,F){I!==""&&(we.startScope(F),we.addText(I),we.endScope())}function xt(I,F){let X=1,oe=F.length-1;for(;X<=oe;){if(!I._emit[X]){X++;continue}let Fe=Je.classNameAliases[I[X]]||I[X],rt=F[X];Fe?Be(rt,Fe):(fe=rt,De(),fe=""),X++}}function Nt(I,F){return I.scope&&typeof I.scope=="string"&&we.openNode(Je.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(Be(fe,Je.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),fe=""):I.beginScope._multi&&(xt(I.beginScope,F),fe="")),V=Object.create(I,{parent:{value:V}}),V}function Oe(I,F,X){let oe=x2(I.endRe,X);if(oe){if(I["on:end"]){let Fe=new hu(I);I["on:end"](F,Fe),Fe.isMatchIgnored&&(oe=!1)}if(oe){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return Oe(I.parent,F,X)}function _t(I){return V.matcher.regexIndex===0?(fe+=I[0],1):(kt=!0,0)}function Jt(I){let F=I[0],X=I.rule,oe=new hu(X),Fe=[X.__beforeBegin,X["on:begin"]];for(let rt of Fe)if(rt&&(rt(I,oe),oe.isMatchIgnored))return _t(F);return X.skip?fe+=F:(X.excludeBegin&&(fe+=F),Me(),!X.returnBegin&&!X.excludeBegin&&(fe=F)),Nt(X,I),X.returnBegin?0:F.length}function pt(I){let F=I[0],X=R.substring(I.index),oe=Oe(V,I,X);if(!oe)return vx;let Fe=V;V.endScope&&V.endScope._wrap?(Me(),Be(F,V.endScope._wrap)):V.endScope&&V.endScope._multi?(Me(),xt(V.endScope,I)):Fe.skip?fe+=F:(Fe.returnEnd||Fe.excludeEnd||(fe+=F),Me(),Fe.excludeEnd&&(fe=F));do V.scope&&we.closeNode(),!V.skip&&!V.subLanguage&&(ct+=V.relevance),V=V.parent;while(V!==oe.parent);return oe.starts&&Nt(oe.starts,I),Fe.returnEnd?0:F.length}function sn(){let I=[];for(let F=V;F!==Je;F=F.parent)F.scope&&I.unshift(F.scope);I.forEach(F=>we.openNode(F))}let Xt={};function St(I,F){let X=F&&F[0];if(fe+=I,X==null)return Me(),0;if(Xt.type==="begin"&&F.type==="end"&&Xt.index===F.index&&X===""){if(fe+=R.slice(F.index,F.index+1),!i){let oe=new Error(`0 width match regex (${A})`);throw oe.languageName=A,oe.badRule=Xt.rule,oe}return 1}if(Xt=F,F.type==="begin")return Jt(F);if(F.type==="illegal"&&!K){let oe=new Error('Illegal lexeme "'+X+'" for mode "'+(V.scope||"")+'"');throw oe.mode=V,oe}else if(F.type==="end"){let oe=pt(F);if(oe!==vx)return oe}if(F.type==="illegal"&&X==="")return 1;if(Pt>1e5&&Pt>F.index*3)throw new Error("potential infinite loop, way more iterations than matches");return fe+=X,X.length}let Je=z(A);if(!Je)throw ho(o.replace("{}",A)),new Error('Unknown language: "'+A+'"');let Xn=nF(Je),Lt="",V=J||Xn,bt={},we=new l.__emitter(l);sn();let fe="",ct=0,ut=0,Pt=0,kt=!1;try{if(Je.__emitTokens)Je.__emitTokens(R,we);else{for(V.matcher.considerAll();;){Pt++,kt?kt=!1:V.matcher.considerAll(),V.matcher.lastIndex=ut;let I=V.matcher.exec(R);if(!I)break;let F=R.substring(ut,I.index),X=St(F,I);ut=I.index+X}St(R.substring(ut))}return we.finalize(),Lt=we.toHTML(),{language:A,value:Lt,relevance:ct,illegal:!1,_emitter:we,_top:V}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:A,value:em(R),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:ut,context:R.slice(ut-100,ut+100),mode:I.mode,resultSoFar:Lt},_emitter:we};if(i)return{language:A,value:em(R),illegal:!1,relevance:0,errorRaised:I,_emitter:we,_top:V};throw I}}function m(A){let R={value:em(A),illegal:!1,relevance:0,_top:s,_emitter:new l.__emitter(l)};return R._emitter.addText(A),R}function b(A,R){R=R||l.languages||Object.keys(e);let K=m(A),J=R.filter(z).filter(he).map(Me=>h(Me,A,!1));J.unshift(K);let se=J.sort((Me,Be)=>{if(Me.relevance!==Be.relevance)return Be.relevance-Me.relevance;if(Me.language&&Be.language){if(z(Me.language).supersetOf===Be.language)return 1;if(z(Be.language).supersetOf===Me.language)return-1}return 0}),[be,De]=se,je=be;return je.secondBest=De,je}function y(A,R,K){let J=R&&n[R]||K;A.classList.add("hljs"),A.classList.add(`language-${J}`)}function v(A){let R=null,K=d(A);if(u(K))return;if(ge("before:highlightElement",{el:A,language:K}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),l.throwUnescapedHTML))throw new im("One of your code blocks includes unescaped HTML.",A.innerHTML);R=A;let J=R.textContent,se=K?f(J,{language:K,ignoreIllegals:!0}):b(J);A.innerHTML=se.value,A.dataset.highlighted="yes",y(A,K,se.language),A.result={language:se.language,re:se.relevance,relevance:se.relevance},se.secondBest&&(A.secondBest={language:se.secondBest.language,relevance:se.secondBest.relevance}),ge("after:highlightElement",{el:A,result:se,text:J})}function x(A){l=Ex(l,A)}let S=()=>{T(),ss("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function L(){T(),ss("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let D=!1;function T(){if(document.readyState==="loading"){D=!0;return}document.querySelectorAll(l.cssSelector).forEach(v)}function $(){D&&T()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",$,!1);function O(A,R){let K=null;try{K=R(t)}catch(J){if(ho("Language definition for '{}' could not be registered.".replace("{}",A)),i)ho(J);else throw J;K=s}K.name||(K.name=A),e[A]=K,K.rawDefinition=R.bind(null,t),K.aliases&&re(K.aliases,{languageName:A})}function Y(A){delete e[A];for(let R of Object.keys(n))n[R]===A&&delete n[R]}function ee(){return Object.keys(e)}function z(A){return A=(A||"").toLowerCase(),e[A]||e[n[A]]}function re(A,{languageName:R}){typeof A=="string"&&(A=[A]),A.forEach(K=>{n[K.toLowerCase()]=R})}function he(A){let R=z(A);return R&&!R.disableAutodetect}function Se(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=R=>{A["before:highlightBlock"](Object.assign({block:R.el},R))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=R=>{A["after:highlightBlock"](Object.assign({block:R.el},R))})}function me(A){Se(A),r.push(A)}function Ce(A){let R=r.indexOf(A);R!==-1&&r.splice(R,1)}function ge(A,R){let K=A;r.forEach(function(J){J[K]&&J[K](R)})}function _e(A){return ss("10.7.0","highlightBlock will be removed entirely in v12.0"),ss("10.7.0","Please use highlightElement now."),v(A)}Object.assign(t,{highlight:f,highlightAuto:b,highlightAll:T,highlightElement:v,highlightBlock:_e,configure:x,initHighlighting:S,initHighlightingOnLoad:L,registerLanguage:O,unregisterLanguage:Y,listLanguages:ee,getLanguage:z,registerAliases:re,autoDetection:he,inherit:Ex,addPlugin:me,removePlugin:Ce}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=iF,t.regex={concat:mo,lookahead:Tx,either:om,optional:v2,anyNumberOfTimes:E2};for(let A in pu)typeof pu[A]=="object"&&_x(pu[A]);return Object.assign(t,pu),t},as=Dx({});as.newInstance=()=>Dx({});var sF=as;as.HighlightJS=as;as.default=as;var aF=g2(sF);function Lx(t,e=[]){return t.map(n=>{let r=[...e,...n.properties?n.properties.className:[]];return n.children?Lx(n.children,r):{text:n.value,classes:r}}).flat()}function wx(t){return t.value||t.children||[]}function lF(t){return!!aF.getLanguage(t)}function xx({doc:t,name:e,lowlight:n,defaultLanguage:r}){let i=[];return ji(t,o=>o.type.name===e).forEach(o=>{var s;let l=o.pos+1,u=o.node.attrs.language||r,d=n.listLanguages(),f=u&&(d.includes(u)||lF(u)||!((s=n.registered)===null||s===void 0)&&s.call(n,u))?wx(n.highlight(u,o.node.textContent)):wx(n.highlightAuto(o.node.textContent));Lx(f).forEach(h=>{let m=l+h.text.length;if(h.classes.length){let b=vt.inline(l,m,{class:h.classes.join(" ")});i.push(b)}l=m})}),ot.create(t,i)}function cF(t){return typeof t=="function"}function uF({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>cF(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new ke({key:new ze("lowlight"),state:{init:(i,{doc:o})=>xx({doc:o,name:t,lowlight:e,defaultLanguage:n}),apply:(i,o,s,l)=>{let u=s.selection.$head.parent.type.name,d=l.selection.$head.parent.type.name,f=ji(s.doc,m=>m.type.name===t),h=ji(l.doc,m=>m.type.name===t);return i.docChanged&&([u,d].includes(t)||h.length!==f.length||i.steps.some(m=>m.from!==void 0&&m.to!==void 0&&f.some(b=>b.pos>=m.from&&b.pos+b.node.nodeSize<=m.to)))?xx({doc:i.doc,name:t,lowlight:e,defaultLanguage:n}):o.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var Px=hx.extend({addOptions(){var t;return{...(t=this.parent)===null||t===void 0?void 0:t.call(this),lowlight:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)===null||t===void 0?void 0:t.call(this))||[],uF({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});var lm=Px.extend({addKeyboardShortcuts(){return{...this.parent?.(),ArrowDown:()=>{let t=this.editor.state,{from:e,to:n}=t.selection;if(e>1&&e===n){let r=!1;t.doc.nodesBetween(e-1,n-1,o=>{o.type.name==="codeBlock"&&(r=!0)});let i=!0;if(t.doc.nodesBetween(e+1,n+1,o=>{o&&(i=!1)}),r&&i)return this.editor.commands.setHardBreak()}return!1}}}});var cm=ce.create({name:"hurdle",group:"block",content:"block+",addOptions(){return{colors:["gray_light","gray","gray_dark","primary","secondary","tertiary","accent"],HTMLAttributes:{class:"filament-tiptap-hurdle"}}},addAttributes(){return{color:{default:"gray",parseHTML:t=>t.getAttribute("data-color"),renderHTML:t=>({"data-color":t.color})}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-hurdle")}]},renderHTML({node:t,HTMLAttributes:e}){return["div",Q(this.options.HTMLAttributes,e),0]},addCommands(){return{setHurdle:t=>({commands:e})=>this.options.colors.includes(t.color)?e.toggleWrap(this.name,t):!1}}});var um=We.create({name:"textAlign",addOptions(){return{types:[],alignments:["start","center","end","justify"],defaultAlignment:"start"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>t.style.textAlign||this.options.defaultAlignment,renderHTML:t=>t.style&&t.style.includes("text-align")?{}:t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.every(n=>e.updateAttributes(n,{textAlign:t})):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("start"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("end"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});function bu(t,e,n=null){return n?t.createChecked({"data-col-span":e},n):t.createAndFill({"data-col-span":e})}function Bx(t){if(t.cached.gridBuilderNodeTypes)return t.cached.gridBuilderNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.gridBuilderRole&&(e[r.spec.gridBuilderRole]=r)}),t.cached.gridBuilderNodeTypes=e,e}function Fx(t,e,n,r,i,o,s){let l=Bx(t),u=[];if(n==="asymmetric")u.push(bu(l.builderColumn,i,s)),u.push(bu(l.builderColumn,o,s));else for(let d=0;dt.getAttribute("data-type")},"data-cols":{default:2,parseHTML:t=>t.getAttribute("data-cols")},"data-stack-at":{default:"md",parseHTML:t=>t.getAttribute("data-stack-at")},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>({style:`grid-template-columns: repeat(${t["data-cols"]}, 1fr);`})}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-grid-builder")&&null}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t),0]},addCommands(){return{insertGridBuilder:({cols:t=3,type:e="responsive",stackAt:n,asymmetricLeft:r=null,asymmetricRight:i=null}={})=>({tr:o,dispatch:s,editor:l})=>{let u=Fx(l.schema,t,e,n,r,i);if(s){let d=o.selection.anchor+1;o.replaceSelectionWith(u).scrollIntoView().setSelection(le.near(o.doc.resolve(d)))}return!0}}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertGridBuilder()}},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{gridBuilderRole:Te(ne(t,"gridBuilderRole",e))}}});var fm=ce.create({name:"gridBuilderColumn",content:"block+",gridBuilderRole:"builderColumn",isolating:!0,addOptions(){return{HTMLAttributes:{class:"filament-tiptap-grid-builder__column"}}},addAttributes(){return{"data-col-span":{default:1,parseHTML:t=>t.getAttribute("data-col-span")},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>({style:`grid-column: span ${t["data-col-span"]};`})}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("filament-tiptap-grid-builder__column")&&null}]},renderHTML({HTMLAttributes:t}){return["div",Q(this.options.HTMLAttributes,t),0]}});var pm=We.create({name:"dragAndDrop",addProseMirrorPlugins(t){return[new ke({props:{handleDrop(e,n){if(!n)return!1;n.preventDefault();let r=e.posAtCoords({left:n.clientX,top:n.clientY});return n.dataTransfer.getData("block")?(n.target.dispatchEvent(new CustomEvent("dragged-block",{detail:{type:n.dataTransfer.getData("block"),coordinates:r},bubbles:!0})),!1):(n.dataTransfer.getData("mergeTag")&&n.target.dispatchEvent(new CustomEvent("dragged-merge-tag",{detail:{tag:n.dataTransfer.getData("mergeTag"),coordinates:r},bubbles:!0})),!1)}}})]}});var hm=ce.create({name:"tiptapBlock",group:"block",atom:!0,defining:!0,draggable:!0,selectable:!0,isolating:!0,allowGapCursor:!0,inline:!1,addAttributes(){return{preview:{default:null,parseHTML:t=>t.getAttribute("data-preview"),renderHTML:t=>t.preview?{"data-preview":t.preview}:null},statePath:{default:null,parseHTML:t=>t.getAttribute("data-state-path"),renderHTML:t=>t.statePath?{"data-state-path":t.statePath}:null},type:{default:null,parseHTML:t=>t.getAttribute("data-type"),renderHTML:t=>t.type?{"data-type":t.type}:null},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:null},data:{default:null,parseHTML:t=>t.getAttribute("data-data"),renderHTML:t=>t.data?{"data-data":JSON.stringify(t.data)}:null}}},parseHTML(){return[{tag:"tiptap-block"}]},renderHTML({HTMLAttributes:t}){return["tiptap-block",Q(t)]},addNodeView(){return({editor:t,node:e,getPos:n})=>{let r=document.createElement("div");r.contentEditable="false",r.classList.add("tiptap-block-wrapper");let i=typeof e.attrs.data=="object"?JSON.stringify(e.attrs.data):e.attrs.data;return r.innerHTML=`
- `,{dom:r}}},addCommands(){return{insertBlock:t=>({chain:e,state:n})=>{let r=e();if(![null,void 0].includes(t.coordinates?.pos))return r.insertContentAt({from:t.coordinates.pos,to:t.coordinates.pos},{type:this.name,attrs:t}),r.setTextSelection(t.coordinates.pos);let{selection:i}=n,{$from:o,$to:s}=i,l=o.blockRange(s);return l?(s.parentOffset===0?r.insertContentAt(Math.max(s.pos-1,0),{type:this.name,attrs:t}):r.insertContentAt({from:l.start,to:l.end},{type:this.name,attrs:t}),r.setTextSelection(l.end)):(s.parentOffset===0?r.insertContentAt(Math.max(s.pos-1,0),{type:"paragraph"}).insertContentAt({from:o.pos,to:s.pos},{type:this.name,attrs:t}):r.setNode({type:"paragraph"}).insertContentAt({from:o.pos,to:s.pos},{type:this.name,attrs:t}),r.setTextSelection(s.pos+1))},updateBlock:t=>({commands:e,chain:n,state:r})=>{let{selection:i}=r,{$from:o,$to:s}=i,l=o.blockRange(s),c=n();return l?(c.insertContentAt({from:l.start,to:l.end},{type:this.name,attrs:t}),c.focus(l.end+1)):t.coordinates?(c.insertContentAt({from:t.coordinates,to:t.coordinates+1},{type:this.name,attrs:t}),!1):(c.insertContentAt({from:o.pos,to:o.pos+1},{type:this.name,attrs:t}),!1)},removeBlock:()=>({commands:t})=>t.deleteSelection()}}});function dF(t){var e;let{char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:o,$position:s}=t,l=qE(n),c=new RegExp(`\\s${l}$`),d=o?"^":"",f=r?new RegExp(`${d}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${d}(?:^)?${l}[^\\s${l}]*`,"gm"),h=((e=s.nodeBefore)===null||e===void 0?void 0:e.isText)&&s.nodeBefore.text;if(!h)return null;let m=s.pos-h.length,b=Array.from(h.matchAll(f)).pop();if(!b||b.input===void 0||b.index===void 0)return null;let y=b.input.slice(Math.max(0,b.index-1),b.index),w=new RegExp(`^[${i?.join("")}\0]?$`).test(y);if(i!==null&&!w)return null;let _=m+b.index,S=_+b[0].length;return r&&c.test(h.slice(S-1,S+1))&&(b[0]+=" ",S+=1),_=s.pos?{range:{from:_,to:S},query:b[0].slice(n.length),text:b[0]}:null}var fF=new ze("suggestion");function Hx({pluginKey:t=fF,editor:e,char:n="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:s="span",decorationClass:l="suggestion",command:c=()=>null,items:d=()=>[],render:f=()=>({}),allow:h=()=>!0,findSuggestionMatch:m=dF}){let b,y=f?.(),w=new ke({key:t,view(){return{update:async(_,S)=>{var L,D,T,$,O,Y,ee;let z=(L=this.key)===null||L===void 0?void 0:L.getState(S),re=(D=this.key)===null||D===void 0?void 0:D.getState(_.state),he=z.active&&re.active&&z.range.from!==re.range.from,Se=!z.active&&re.active,me=z.active&&!re.active,Ce=!Se&&!me&&z.query!==re.query,ge=Se||he&&Ce,_e=Ce||he,A=me||he&&Ce;if(!ge&&!_e&&!A)return;let R=A&&!ge?z:re,K=_.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`);b={editor:e,range:R.range,query:R.query,text:R.text,items:[],command:J=>c({editor:e,range:R.range,props:J}),decorationNode:K,clientRect:K?()=>{var J;let{decorationId:se}=(J=this.key)===null||J===void 0?void 0:J.getState(e.state),be=_.dom.querySelector(`[data-decoration-id="${se}"]`);return be?.getBoundingClientRect()||null}:null},ge&&((T=y?.onBeforeStart)===null||T===void 0||T.call(y,b)),_e&&(($=y?.onBeforeUpdate)===null||$===void 0||$.call(y,b)),(_e||ge)&&(b.items=await d({editor:e,query:R.query})),A&&((O=y?.onExit)===null||O===void 0||O.call(y,b)),_e&&((Y=y?.onUpdate)===null||Y===void 0||Y.call(y,b)),ge&&((ee=y?.onStart)===null||ee===void 0||ee.call(y,b))},destroy:()=>{var _;b&&((_=y?.onExit)===null||_===void 0||_.call(y,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(_,S,L,D){let{isEditable:T}=e,{composing:$}=e.view,{selection:O}=_,{empty:Y,from:ee}=O,z={...S};if(z.composing=$,T&&(Y||e.view.composing)){(eeS.range.to)&&!$&&!S.composing&&(z.active=!1);let re=m({char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:o,$position:O.$from}),he=`id_${Math.floor(Math.random()*4294967295)}`;re&&h({editor:e,state:D,range:re.range,isActive:S.active})?(z.active=!0,z.decorationId=S.decorationId?S.decorationId:he,z.range=re.range,z.query=re.query,z.text=re.text):z.active=!1}else z.active=!1;return z.active||(z.decorationId=null,z.range={from:0,to:0},z.query=null,z.text=null),z}},props:{handleKeyDown(_,S){var L;let{active:D,range:T}=w.getState(_.state);return D&&((L=y?.onKeyDown)===null||L===void 0?void 0:L.call(y,{view:_,event:S,range:T}))||!1},decorations(_){let{active:S,range:L,decorationId:D}=w.getState(_);return S?ot.create(_.doc,[vt.inline(L.from,L.to,{nodeName:s,class:l,"data-decoration-id":D})]):null}}});return w}var pF=new ze("mergeTag"),hm=ce.create({name:"mergeTag",group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}}}},parseHTML(){return[{tag:`span[data-type='${this.name}']`}]},renderHTML({node:t,HTMLAttributes:e}){return["span",Q({"data-type":this.name},e),`{{ ${t.attrs.id} }}`]},renderText({node:t}){return`{{ ${t.attrs.id} }}`},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1,{selection:r}=e,{empty:i,anchor:o}=r;return i?(e.doc.nodesBetween(o-1,o,(s,l)=>{if(s.type.name===this.name)return n=!0,t.insertText("{{",l,l+s.nodeSize),!1}),n):!1})}},addCommands(){return{insertMergeTag:t=>({chain:e,state:n})=>{let r=e();if(![null,void 0].includes(t.coordinates?.pos))return r.insertContentAt({from:t.coordinates.pos,to:t.coordinates.pos},[{type:this.name,attrs:{id:t.tag}},{type:"text",text:" "}]),r}}},addProseMirrorPlugins(){return[Hx({editor:this.editor,char:"{{",items:({query:t})=>this.options.mergeTags.filter(e=>e.toLowerCase().startsWith(t.toLowerCase())).slice(0,5),pluginKey:pF,command:({editor:t,range:e,props:n})=>{t.view.state.selection.$to.nodeAfter?.text?.startsWith(" ")&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),window.getSelection()?.collapseToEnd()},allow:({state:t,range:e})=>{let n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)},render:()=>{let t,e;return{onStart:n=>{if(!n.clientRect)return;let r=` + `,{dom:r}}},addCommands(){return{insertBlock:t=>({chain:e,state:n})=>{let r=e();if(![null,void 0].includes(t.coordinates?.pos))return r.insertContentAt({from:t.coordinates.pos,to:t.coordinates.pos},{type:this.name,attrs:t}),r.setTextSelection(t.coordinates.pos);let{selection:i}=n,{$from:o,$to:s}=i,l=o.blockRange(s);return l?(s.parentOffset===0?r.insertContentAt(Math.max(s.pos-1,0),{type:this.name,attrs:t}):r.insertContentAt({from:l.start,to:l.end},{type:this.name,attrs:t}),r.setTextSelection(l.end)):(s.parentOffset===0?r.insertContentAt(Math.max(s.pos-1,0),{type:"paragraph"}).insertContentAt({from:o.pos,to:s.pos},{type:this.name,attrs:t}):r.setNode({type:"paragraph"}).insertContentAt({from:o.pos,to:s.pos},{type:this.name,attrs:t}),r.setTextSelection(s.pos+1))},updateBlock:t=>({commands:e,chain:n,state:r})=>{let{selection:i}=r,{$from:o,$to:s}=i,l=o.blockRange(s),u=n();return l?(u.insertContentAt({from:l.start,to:l.end},{type:this.name,attrs:t}),u.focus(l.end+1)):t.coordinates?(u.insertContentAt({from:t.coordinates,to:t.coordinates+1},{type:this.name,attrs:t}),!1):(u.insertContentAt({from:o.pos,to:o.pos+1},{type:this.name,attrs:t}),!1)},removeBlock:()=>({commands:t})=>t.deleteSelection()}}});function dF(t){var e;let{char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:o,$position:s}=t,l=YE(n),u=new RegExp(`\\s${l}$`),d=o?"^":"",f=r?new RegExp(`${d}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${d}(?:^)?${l}[^\\s${l}]*`,"gm"),h=((e=s.nodeBefore)===null||e===void 0?void 0:e.isText)&&s.nodeBefore.text;if(!h)return null;let m=s.pos-h.length,b=Array.from(h.matchAll(f)).pop();if(!b||b.input===void 0||b.index===void 0)return null;let y=b.input.slice(Math.max(0,b.index-1),b.index),v=new RegExp(`^[${i?.join("")}\0]?$`).test(y);if(i!==null&&!v)return null;let x=m+b.index,S=x+b[0].length;return r&&u.test(h.slice(S-1,S+1))&&(b[0]+=" ",S+=1),x=s.pos?{range:{from:x,to:S},query:b[0].slice(n.length),text:b[0]}:null}var fF=new ze("suggestion");function Hx({pluginKey:t=fF,editor:e,char:n="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:s="span",decorationClass:l="suggestion",command:u=()=>null,items:d=()=>[],render:f=()=>({}),allow:h=()=>!0,findSuggestionMatch:m=dF}){let b,y=f?.(),v=new ke({key:t,view(){return{update:async(x,S)=>{var L,D,T,$,O,Y,ee;let z=(L=this.key)===null||L===void 0?void 0:L.getState(S),re=(D=this.key)===null||D===void 0?void 0:D.getState(x.state),he=z.active&&re.active&&z.range.from!==re.range.from,Se=!z.active&&re.active,me=z.active&&!re.active,Ce=!Se&&!me&&z.query!==re.query,ge=Se||he&&Ce,_e=Ce||he,A=me||he&&Ce;if(!ge&&!_e&&!A)return;let R=A&&!ge?z:re,K=x.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`);b={editor:e,range:R.range,query:R.query,text:R.text,items:[],command:J=>u({editor:e,range:R.range,props:J}),decorationNode:K,clientRect:K?()=>{var J;let{decorationId:se}=(J=this.key)===null||J===void 0?void 0:J.getState(e.state),be=x.dom.querySelector(`[data-decoration-id="${se}"]`);return be?.getBoundingClientRect()||null}:null},ge&&((T=y?.onBeforeStart)===null||T===void 0||T.call(y,b)),_e&&(($=y?.onBeforeUpdate)===null||$===void 0||$.call(y,b)),(_e||ge)&&(b.items=await d({editor:e,query:R.query})),A&&((O=y?.onExit)===null||O===void 0||O.call(y,b)),_e&&((Y=y?.onUpdate)===null||Y===void 0||Y.call(y,b)),ge&&((ee=y?.onStart)===null||ee===void 0||ee.call(y,b))},destroy:()=>{var x;b&&((x=y?.onExit)===null||x===void 0||x.call(y,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,S,L,D){let{isEditable:T}=e,{composing:$}=e.view,{selection:O}=x,{empty:Y,from:ee}=O,z={...S};if(z.composing=$,T&&(Y||e.view.composing)){(eeS.range.to)&&!$&&!S.composing&&(z.active=!1);let re=m({char:n,allowSpaces:r,allowedPrefixes:i,startOfLine:o,$position:O.$from}),he=`id_${Math.floor(Math.random()*4294967295)}`;re&&h({editor:e,state:D,range:re.range,isActive:S.active})?(z.active=!0,z.decorationId=S.decorationId?S.decorationId:he,z.range=re.range,z.query=re.query,z.text=re.text):z.active=!1}else z.active=!1;return z.active||(z.decorationId=null,z.range={from:0,to:0},z.query=null,z.text=null),z}},props:{handleKeyDown(x,S){var L;let{active:D,range:T}=v.getState(x.state);return D&&((L=y?.onKeyDown)===null||L===void 0?void 0:L.call(y,{view:x,event:S,range:T}))||!1},decorations(x){let{active:S,range:L,decorationId:D}=v.getState(x);return S?ot.create(x.doc,[vt.inline(L.from,L.to,{nodeName:s,class:l,"data-decoration-id":D})]):null}}});return v}var pF=new ze("mergeTag"),mm=ce.create({name:"mergeTag",group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}}}},parseHTML(){return[{tag:`span[data-type='${this.name}']`}]},renderHTML({node:t,HTMLAttributes:e}){return["span",Q({"data-type":this.name},e),`{{ ${t.attrs.id} }}`]},renderText({node:t}){return`{{ ${t.attrs.id} }}`},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1,{selection:r}=e,{empty:i,anchor:o}=r;return i?(e.doc.nodesBetween(o-1,o,(s,l)=>{if(s.type.name===this.name)return n=!0,t.insertText("{{",l,l+s.nodeSize),!1}),n):!1})}},addCommands(){return{insertMergeTag:t=>({chain:e,state:n})=>{let r=e();if(![null,void 0].includes(t.coordinates?.pos))return r.insertContentAt({from:t.coordinates.pos,to:t.coordinates.pos},[{type:this.name,attrs:{id:t.tag}},{type:"text",text:" "}]),r}}},addProseMirrorPlugins(){return[Hx({editor:this.editor,char:"{{",items:({query:t})=>this.options.mergeTags.filter(e=>e.toLowerCase().startsWith(t.toLowerCase())).slice(0,5),pluginKey:pF,command:({editor:t,range:e,props:n})=>{t.view.state.selection.$to.nodeAfter?.text?.startsWith(" ")&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),window.getSelection()?.collapseToEnd()},allow:({state:t,range:e})=>{let n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)},render:()=>{let t,e;return{onStart:n=>{if(!n.clientRect)return;let r=`
{n.command({id:i.detail.item})}),e=ts("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t,allowHTML:!0,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate(n){if(!n.items.length){e[0].hide();return}e[0].show(),t.dispatchEvent(new CustomEvent("merge-tags-update-items",{detail:n.items}))},onKeyDown(n){t.dispatchEvent(new CustomEvent("merge-tags-key-down",{detail:n.event}))},onExit(){e[0].destroy()}}}})]}});var mm=We.create({name:"classExtension",addGlobalAttributes(){return[{types:["heading","paragraph","link","image","listItem","bulletList","orderedList","table","tableHeader","tableRow","tableCell","textStyle"],attributes:{class:{default:null,parseHTML:t=>t.getAttribute("class")??null,renderHTML:t=>t.class?{class:t.class}:null}}}]}});var gm=We.create({name:"idExtension",addGlobalAttributes(){return[{types:["heading","link"],attributes:{id:{default:null,parseHTML:t=>t.getAttribute("id")??null,renderHTML:t=>t.id?{id:t.id}:null}}}]}});var bm=We.create({name:"styleExtension",addGlobalAttributes(){return[{types:["heading","paragraph","link","image","listItem","bulletList","orderedList","table","tableHeader","tableRow","tableCell","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.getAttribute("style")??null,renderHTML:t=>t.style?{style:t.style}:null}}}]}});var ym=We.create({name:"statePath",addOptions(){return{statePath:null}},addStorage(){return{statePath:null}},onBeforeCreate(){this.storage.statePath=this.options.statePath},addCommands(){return{getStatePath:()=>()=>this.storage.statePath}}});function hF(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},f={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},b=e.optional(i)+t.IDENT_RE+"\\s*\\(",y=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],w=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],S=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],T={type:w,keyword:y,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},$={className:"function.dispatch",relevance:0,keywords:{_hint:S},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},O=[$,h,l,n,t.C_BLOCK_COMMENT_MODE,f,d],Y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:O.concat([{begin:/\(/,end:/\)/,keywords:T,contains:O.concat(["self"]),relevance:0}]),relevance:0},ee={className:"function",begin:"("+s+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,relevance:0},{begin:b,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,f]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,f,l,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,f,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"",keywords:T,contains:["self",l]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function $x(t){let e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=hF(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function zx(t){let e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});let i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let l={className:"",begin:/\\"/},c={className:"string",begin:/'/,end:/'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=t.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],y=["true","false"],w={match:/(\/[a-z._-]+)+/},_=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias"],L=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],D=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:y,built_in:[..._,...S,"set","shopt",...L,...D]},contains:[h,t.SHEBANG(),m,d,t.HASH_COMMENT_MODE,o,w,s,l,c,n]}}function Ux(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},f={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},b=e.optional(i)+t.IDENT_RE+"\\s*\\(",_={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},S=[h,l,n,t.C_BLOCK_COMMENT_MODE,f,d],L={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:S.concat([{begin:/\(/,end:/\)/,keywords:_,contains:S.concat(["self"]),relevance:0}]),relevance:0},D={begin:"("+s+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:b,returnBegin:!0,contains:[t.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,f,l,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,f,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C",aliases:["h"],keywords:_,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:h,strings:d,keywords:_}}}function Wx(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},f={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},b=e.optional(i)+t.IDENT_RE+"\\s*\\(",y=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],w=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],S=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],T={type:w,keyword:y,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},$={className:"function.dispatch",relevance:0,keywords:{_hint:S},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},O=[$,h,l,n,t.C_BLOCK_COMMENT_MODE,f,d],Y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:O.concat([{begin:/\(/,end:/\)/,keywords:T,contains:O.concat(["self"]),relevance:0}]),relevance:0},ee={className:"function",begin:"("+s+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,relevance:0},{begin:b,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,f]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,f,l,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,f,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"",keywords:T,contains:["self",l]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Kx(t){let e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"],s={keyword:i.concat(o),built_in:e,literal:r},l=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=t.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:s},m=t.inherit(h,{illegal:/\n/}),b={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,m]},y={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},w=t.inherit(y,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]});h.contains=[y,b,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.C_BLOCK_COMMENT_MODE],m.contains=[w,b,f,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let _={variants:[y,b,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},S={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},L=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",D={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:s,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},_,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,S,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,S,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+L+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,S],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[_,c,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},D]}}var mF=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}),gF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],bF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],yF=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],EF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],vF=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function Vx(t){let e=t.regex,n=mF(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",l=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+yF.join("|")+")"},{begin:":(:)?("+EF.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+vF.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:bF.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+gF.join("|")+")\\b"}]}}function Gx(t){let e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function qx(t){let o={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:o,illegal:"Zx(t,e,n-1))}function jx(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+Zx("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},d={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},f={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[f,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Xx,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Xx,d]}}var Qx="[A-Za-z$_][0-9A-Za-z$_]*",wF=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],xF=["true","false","null","undefined","NaN","Infinity"],e_=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],t_=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],n_=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],_F=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],SF=[].concat(n_,e_,t_);function r_(t){let e=t.regex,n=(R,{after:K})=>{let J="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,K)=>{let J=R[0].length+R.index,se=R.input[J];if(se==="<"||se===","){K.ignoreMatch();return}se===">"&&(n(R,{after:J})||K.ignoreMatch());let be,De=R.input.substring(J);if(be=De.match(/^\s*=/)){K.ignoreMatch();return}if((be=De.match(/^\s+extends\s+/))&&be.index===0){K.ignoreMatch();return}}},l={$pattern:Qx,keyword:wF,literal:xF,built_in:SF,"variable.language":_F},c="[0-9](_?[0-9])*",d=`\\.(${c})`,f="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${f})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${f})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},b={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},y={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"css"}},w={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,m]},L={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},D=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,b,y,w,_,{match:/\$\d+/},h];m.contains=D.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(D)});let T=[].concat(L,m.contains),$=T.concat([{begin:/\(/,end:/\)/,keywords:l,contains:["self"].concat(T)}]),O={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:$},Y={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},ee={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...e_,...t_]}},z={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},re={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},he={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Se(R){return e.concat("(?!",R.join("|"),")")}let me={match:e.concat(/\b/,Se([...n_,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},Ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ge={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},_e="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",A={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(_e)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:ee},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),z,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,b,y,w,_,L,{match:/\$\d+/},h,ee,{className:"attr",begin:r+e.lookahead(":"),relevance:0},A,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[L,t.REGEXP_MODE,{className:"function",begin:_e,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},re,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[O,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},me,he,Y,ge,{match:/\$[(.]/}]}}function i_(t){let e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var cs="[0-9](_*[0-9])*",vu=`\\.(${cs})`,wu="[0-9a-fA-F](_*[0-9a-fA-F])*",TF={className:"number",variants:[{begin:`(\\b(${cs})((${vu})|\\.)?|(${vu}))[eE][+-]?(${cs})[fFdD]?\\b`},{begin:`\\b(${cs})((${vu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${vu})[fFdD]?\\b`},{begin:`\\b(${cs})[fFdD]\\b`},{begin:`\\b0[xX]((${wu})\\.?|(${wu})?\\.(${wu}))[pP][+-]?(${cs})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${wu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o_(t){let e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(s);let l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(s,{className:"string"}),"self"]}]},d=TF,f=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),h={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=h;return m.variants[1].contains=[h],h.variants[1].contains=[m],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,f,n,r,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[h,t.C_LINE_COMMENT_MODE,f],relevance:0},t.C_LINE_COMMENT_MODE,f,l,c,s,t.C_NUMBER_MODE]},f]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,c]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},d]}}var CF=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}),AF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],MF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],s_=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],a_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],NF=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),kF=s_.concat(a_);function l_(t){let e=CF(t),n=kF,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",s=[],l=[],c=function(D){return{className:"string",begin:"~?"+D+".*?"+D}},d=function(D,T,$){return{className:D,begin:T,relevance:$}},f={$pattern:/[a-z-]+/,keyword:r,attribute:MF.join(" ")},h={begin:"\\(",end:"\\)",contains:l,keywords:f,relevance:0};l.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,c("'"),c('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,h,d("variable","@@?"+i,10),d("variable","@\\{"+i+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);let m=l.concat({begin:/\{/,end:/\}/,contains:s}),b={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},y={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+NF.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},w={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:f,returnEnd:!0,contains:l,relevance:0}},_={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:m}},S={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,b,d("keyword","all\\b"),d("variable","@\\{"+i+"\\}"),{begin:"\\b("+AF.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,d("selector-tag",o,0),d("selector-id","#"+o),d("selector-class","\\."+o,0),d("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+s_.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+a_.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},e.FUNCTION_DISPATCH]},L={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[S]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,w,_,L,y,S,b,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function c_(t){let e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function u_(t){let e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},f={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=t.inherit(d,{contains:[]}),m=t.inherit(f,{contains:[]});d.contains.push(m),f.contains.push(h);let b=[n,c];return[d,f,h,m].forEach(_=>{_.contains=_.contains.concat(b)}),b=b.concat(d,f),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:b},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:b}]}]},n,o,d,f,{className:"quote",begin:"^>\\s+",contains:b,end:"$"},i,r,c,s]}}function f_(t){let e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function p_(t){let e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},s={begin:/->\{/,end:/\}/},l={variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@][^\s\w{]/,relevance:0}]},c=[t.BACKSLASH_ESCAPE,o,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(b,y,w="\\1")=>{let _=w==="\\1"?w:e.concat(w,y);return e.concat(e.concat("(?:",b,")"),y,/(?:\\.|[^\\\/])*?/,_,/(?:\\.|[^\\\/])*?/,w,r)},h=(b,y,w)=>e.concat(e.concat("(?:",b,")"),y,/(?:\\.|[^\\\/])*?/,w,r),m=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:c,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",e.either(...d,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:h("(?:m|qr)?",/\//,/\//)},{begin:h("m|qr",e.either(...d,{capture:!0}),/\1/)},{begin:h("m|qr",/\(/,/\)/)},{begin:h("m|qr",/\[/,/\]/)},{begin:h("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=m,s.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function h_(t){let e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),o={scope:"variable",match:"\\$+"+r},s={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=t.inherit(t.APOS_STRING_MODE,{illegal:null}),d=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(me,Ce)=>{Ce.data._beginMatch=me[1]||me[2]},"on:end":(me,Ce)=>{Ce.data._beginMatch!==me[1]&&Ce.ignoreMatch()}},h=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),m=`[ -]`,b={scope:"string",variants:[d,c,f,h]},y={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},w=["false","null","true"],_=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],S=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],D={keyword:_,literal:(me=>{let Ce=[];return me.forEach(ge=>{Ce.push(ge),ge.toLowerCase()===ge?Ce.push(ge.toUpperCase()):Ce.push(ge.toLowerCase())}),Ce})(w),built_in:S},T=me=>me.map(Ce=>Ce.replace(/\|\d+$/,"")),$={variants:[{match:[/new/,e.concat(m,"+"),e.concat("(?!",T(S).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},O=e.concat(r,"\\b(?!\\()"),Y={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),O],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),O],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},ee={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},z={relevance:0,begin:/\(/,end:/\)/,keywords:D,contains:[ee,o,Y,t.C_BLOCK_COMMENT_MODE,b,y,$]},re={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",T(_).join("\\b|"),"|",T(S).join("\\b|"),"\\b)"),r,e.concat(m,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[z]};z.contains.push(re);let he=[ee,Y,t.C_BLOCK_COMMENT_MODE,b,y,$],Se={begin:e.concat(/#\[\s*/,i),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:w,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:w,keyword:["new","array"]},contains:["self",...he]},...he,{scope:"meta",match:i}]};return{case_insensitive:!1,keywords:D,contains:[Se,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},s,{scope:"variable.language",match:/\$this\b/},o,re,Y,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},$,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:D,contains:["self",o,Y,t.C_BLOCK_COMMENT_MODE,b,y]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},b,y]}}function m_(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function g_(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function b_(t){let e=t.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},f={begin:/\{\{/,relevance:0},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c,f,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c,f,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,f,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,f,d]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",b=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,y=`\\b|${r.join("|")}`,w={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${b}))[eE][+-]?(${m})[jJ]?(?=${y})`},{begin:`(${b})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${y})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${y})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${y})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${y})`},{begin:`\\b(${m})[jJ](?=${y})`}]},_={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},S={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,w,h,t.HASH_COMMENT_MODE]}]};return d.contains=[h,w,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,w,{begin:/\bself\b/},{beginKeywords:"if",relevance:0},h,_,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[S]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[w,S,h]}]}}function y_(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function E_(t){let e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function v_(t){let e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},d=[t.COMMENT("#","$",{contains:[l]}),t.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],f={className:"subst",begin:/#\{/,end:/\}/,keywords:s},h={className:"string",contains:[t.BACKSLASH_ESCAPE,f],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,f]})]}]},m="[1-9](_?[0-9])*|0",b="[0-9](_?[0-9])*",y={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${b}))?([eE][+-]?(${b})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},w={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},O=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:s},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[w]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[h,{begin:n}],relevance:0},y,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,f],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,d),relevance:0}].concat(c,d);f.contains=O,w.contains=O;let re=[{begin:/^\s*=>/,starts:{end:"$",contains:O}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:O}}];return d.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(re).concat(d).concat(O)}}function w_(t){let e=t.regex,n={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let\b)/,t.IDENT_RE,e.lookahead(/\s*\(/))},r="([ui](8|16|32|64|128|size)|f(32|64))?",i=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","unsafe","unsized","use","virtual","where","while","yield"],o=["true","false","Some","None","Ok","Err"],s=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],l=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:l,keyword:i,literal:o,built_in:s},illegal:""},n]}}var OF=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}),RF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],IF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],DF=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],LF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],PF=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function x_(t){let e=OF(t),n=LF,r=DF,i="@[a-z-]+",o="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+RF.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+PF.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,l,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:IF.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function __(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function S_(t){let e=t.regex,n=t.COMMENT("--","$"),r={className:"string",variants:[{begin:/'/,end:/'/,contains:[{begin:/''/}]}]},i={begin:/"/,end:/"/,contains:[{begin:/""/}]},o=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],d=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],f=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],m=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],b=f,y=[...d,...c].filter(D=>!f.includes(D)),w={className:"variable",begin:/@[a-z0-9][a-z0-9_]*/},_={className:"operator",begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},S={begin:e.concat(/\b/,e.either(...b),/\s*\(/),relevance:0,keywords:{built_in:b}};function L(D,{exceptions:T,when:$}={}){let O=$;return T=T||[],D.map(Y=>Y.match(/\|\d+$/)||T.includes(Y)?Y:O(Y)?`${Y}|0`:Y)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:L(y,{when:D=>D.length<3}),literal:o,type:l,built_in:h},contains:[{begin:e.either(...m),relevance:0,keywords:{$pattern:/[\w\.]+/,keyword:y.concat(m),literal:o,type:l}},{className:"type",begin:e.either(...s)},S,w,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,_]}}function M_(t){return t?typeof t=="string"?t:t.source:null}function xu(t){return nt("(?=",t,")")}function nt(...t){return t.map(n=>M_(n)).join("")}function BF(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function xn(...t){return"("+(BF(t).capture?"":"?:")+t.map(r=>M_(r)).join("|")+")"}var xm=t=>nt(/\b/,t,/\w$/.test(t)?/\b/:/\B/),FF=["Protocol","Type"].map(xm),T_=["init","self"].map(xm),HF=["Any","Self"],Em=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","break","case","catch","class","continue","convenience","default","defer","deinit","didSet","distributed","do","dynamic","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],C_=["false","nil","true"],$F=["assignment","associativity","higherThan","left","lowerThan","none","right"],zF=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warn_unqualified_access","#warning"],A_=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],N_=xn(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),k_=xn(N_,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),vm=nt(N_,k_,"*"),O_=xn(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),_u=xn(O_,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Yr=nt(O_,_u,"*"),wm=nt(/[A-Z]/,_u,"*"),UF=["autoclosure",nt(/convention\(/,xn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",nt(/objc\(/,Yr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","testable","UIApplicationMain","unknown","usableFromInline"],WF=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function R_(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,xn(...FF,...T_)],className:{2:"keyword"}},o={match:nt(/\./,xn(...Em)),relevance:0},s=Em.filter(Oe=>typeof Oe=="string").concat(["_|0"]),l=Em.filter(Oe=>typeof Oe!="string").concat(HF).map(xm),c={variants:[{className:"keyword",match:xn(...l,...T_)}]},d={$pattern:xn(/\b\w+/,/#\w+/),keyword:s.concat(zF),literal:C_},f=[i,o,c],h={match:nt(/\./,xn(...A_)),relevance:0},m={className:"built_in",match:nt(/\b/,xn(...A_),/(?=\()/)},b=[h,m],y={match:/->/,relevance:0},w={className:"operator",relevance:0,variants:[{match:vm},{match:`\\.(\\.|${k_})+`}]},_=[y,w],S="([0-9]_*)+",L="([0-9a-fA-F]_*)+",D={className:"number",relevance:0,variants:[{match:`\\b(${S})(\\.(${S}))?([eE][+-]?(${S}))?\\b`},{match:`\\b0x(${L})(\\.(${L}))?([pP][+-]?(${S}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(Oe="")=>({className:"subst",variants:[{match:nt(/\\/,Oe,/[0\\tnr"']/)},{match:nt(/\\/,Oe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),$=(Oe="")=>({className:"subst",match:nt(/\\/,Oe,/[\t ]*(?:[\r\n]|\r\n)/)}),O=(Oe="")=>({className:"subst",label:"interpol",begin:nt(/\\/,Oe,/\(/),end:/\)/}),Y=(Oe="")=>({begin:nt(Oe,/"""/),end:nt(/"""/,Oe),contains:[T(Oe),$(Oe),O(Oe)]}),ee=(Oe="")=>({begin:nt(Oe,/"/),end:nt(/"/,Oe),contains:[T(Oe),O(Oe)]}),z={className:"string",variants:[Y(),Y("#"),Y("##"),Y("###"),ee(),ee("#"),ee("##"),ee("###")]},re={match:nt(/`/,Yr,/`/)},he={className:"variable",match:/\$\d+/},Se={className:"variable",match:`\\$${_u}+`},me=[re,he,Se],Ce={match:/(@|#(un)?)available/,className:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:WF,contains:[..._,D,z]}]}},ge={className:"keyword",match:nt(/@/,xn(...UF))},_e={className:"meta",match:nt(/@/,Yr)},A=[Ce,ge,_e],R={match:xu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:nt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,_u,"+")},{className:"type",match:wm,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:nt(/\s+&\s+/,xu(wm)),relevance:0}]},K={begin://,keywords:d,contains:[...r,...f,...A,y,R]};R.contains.push(K);let J={match:nt(Yr,/\s*:/),keywords:"_|0",relevance:0},se={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",J,...r,...f,...b,..._,D,z,...me,...A,R]},be={begin://,contains:[...r,R]},De={begin:xn(xu(nt(Yr,/\s*:/)),xu(nt(Yr,/\s+/,Yr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Yr}]},je={begin:/\(/,end:/\)/,keywords:d,contains:[De,...r,...f,..._,D,z,...A,R,se],endsParent:!0,illegal:/["']/},Me={match:[/func/,/\s+/,xn(re.match,Yr,vm)],className:{1:"keyword",3:"title.function"},contains:[be,je,e],illegal:[/\[/,/%/]},Be={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[be,je,e],illegal:/\[|%/},xt={match:[/operator/,/\s+/,vm],className:{1:"keyword",3:"title"}},Nt={begin:[/precedencegroup/,/\s+/,wm],className:{1:"keyword",3:"title"},contains:[R],keywords:[...$F,...C_],end:/}/};for(let Oe of z.variants){let _t=Oe.contains.find(pt=>pt.label==="interpol");_t.keywords=d;let Jt=[...f,...b,..._,D,z,...me];_t.contains=[...Jt,{begin:/\(/,end:/\)/,contains:["self",...Jt]}]}return{name:"Swift",keywords:d,contains:[...r,Me,Be,{beginKeywords:"struct protocol class extension enum actor",end:"\\{",excludeEnd:!0,keywords:d,contains:[t.inherit(t.TITLE_MODE,{className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...f]},xt,Nt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},...f,...b,..._,D,z,...me,...A,R,se]}}var Su="[A-Za-z$_][0-9A-Za-z$_]*",I_=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],D_=["true","false","null","undefined","NaN","Infinity"],L_=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],P_=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],B_=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],F_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],H_=[].concat(B_,L_,P_);function KF(t){let e=t.regex,n=(R,{after:K})=>{let J="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,K)=>{let J=R[0].length+R.index,se=R.input[J];if(se==="<"||se===","){K.ignoreMatch();return}se===">"&&(n(R,{after:J})||K.ignoreMatch());let be,De=R.input.substring(J);if(be=De.match(/^\s*=/)){K.ignoreMatch();return}if((be=De.match(/^\s+extends\s+/))&&be.index===0){K.ignoreMatch();return}}},l={$pattern:Su,keyword:I_,literal:D_,built_in:H_,"variable.language":F_},c="[0-9](_?[0-9])*",d=`\\.(${c})`,f="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${f})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${f})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},b={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},y={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"css"}},w={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,m]},L={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},D=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,b,y,w,_,{match:/\$\d+/},h];m.contains=D.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(D)});let T=[].concat(L,m.contains),$=T.concat([{begin:/\(/,end:/\)/,keywords:l,contains:["self"].concat(T)}]),O={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:$},Y={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},ee={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...L_,...P_]}},z={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},re={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},he={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Se(R){return e.concat("(?!",R.join("|"),")")}let me={match:e.concat(/\b/,Se([...B_,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},Ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ge={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},_e="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",A={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(_e)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:ee},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),z,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,b,y,w,_,L,{match:/\$\d+/},h,ee,{className:"attr",begin:r+e.lookahead(":"),relevance:0},A,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[L,t.REGEXP_MODE,{className:"function",begin:_e,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},re,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[O,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},me,he,Y,ge,{match:/\$[(.]/}]}}function $_(t){let e=KF(t),n=Su,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={beginKeywords:"namespace",end:/\{/,excludeEnd:!0,contains:[e.exports.CLASS_REFERENCE]},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[e.exports.CLASS_REFERENCE]},s={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"],c={$pattern:Su,keyword:I_.concat(l),literal:D_,built_in:H_.concat(r),"variable.language":F_},d={className:"meta",begin:"@"+n},f=(m,b,y)=>{let w=m.contains.findIndex(_=>_.label===b);if(w===-1)throw new Error("can not find mode to replace");m.contains.splice(w,1,y)};Object.assign(e.keywords,c),e.exports.PARAMS_CONTAINS.push(d),e.contains=e.contains.concat([d,i,o]),f(e,"shebang",t.SHEBANG()),f(e,"use_strict",s);let h=e.contains.find(m=>m.label==="func.def");return h.relevance=0,Object.assign(e,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),e}function z_(t){let e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:e.concat(/# */,e.either(o,i),/ *#/)},{begin:e.concat(/# */,l,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(o,i),/ +/,e.either(s,l),/ *#/)}]},d={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},f={className:"label",begin:/^\w+:/},h=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,c,d,f,h,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}function U_(t){t.regex;let e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");let n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},s={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},d={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,s,i,t.QUOTE_STRING_MODE,c,d,l]}}function W_(t){let e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{begin:/\(/,end:/\)/}),l=t.inherit(t.APOS_STRING_MODE,{className:"string"}),c=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[o,c,l,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[o,s,c,l]}]}]},t.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function K_(t){let e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ ]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ ]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ ]|$)"}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},s=t.inherit(o,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},m={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},b={begin:/\{/,end:/\}/,contains:[m],illegal:"\\n",relevance:0},y={begin:"\\[",end:"\\]",contains:[m],illegal:"\\n",relevance:0},w=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},h,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},b,y,o],_=[...w];return _.pop(),_.push(s),m.contains=_,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:w}}var dS=Zd(uS(),1);var Jn=dS.default;var pS=Zd(fS(),1),xa=Object.assign(yo(Error),{eval:yo(EvalError),range:yo(RangeError),reference:yo(ReferenceError),syntax:yo(SyntaxError),type:yo(TypeError),uri:yo(URIError)});function yo(t){return e.displayName=t.displayName||t.name,e;function e(n,...r){let i=n&&(0,pS.default)(n,...r);return new t(i)}}var DH={}.hasOwnProperty,hS="hljs-";function mS(t,e,n={}){let r=n.prefix;if(typeof t!="string")throw xa("Expected `string` for name, got `%s`",t);if(!Jn.getLanguage(t))throw xa("Unknown language: `%s` is not registered",t);if(typeof e!="string")throw xa("Expected `string` for value, got `%s`",e);r==null&&(r=hS),Jn.configure({__emitter:Rm,classPrefix:r});let i=Jn.highlight(e,{language:t,ignoreIllegals:!0});if(Jn.configure({}),i.errorRaised)throw i.errorRaised;return i._emitter.root.data.language=i.language,i._emitter.root.data.relevance=i.relevance,i._emitter.root}function LH(t,e={}){let n=e.subset||Jn.listLanguages(),r=e.prefix,i=-1,o={type:"root",data:{language:null,relevance:0},children:[]};if(r==null&&(r=hS),typeof t!="string")throw xa("Expected `string` for value, got `%s`",t);for(;++io.data.relevance&&(o=l)}return o}function PH(t,e){Jn.registerLanguage(t,e)}var BH=function(t,e){if(typeof t=="string")Jn.registerAliases(e,{languageName:t});else{let n;for(n in t)DH.call(t,n)&&Jn.registerAliases(t[n],{languageName:n})}};function FH(t){return!!Jn.getLanguage(t)}function HH(){return Jn.listLanguages()}var Rm=class{constructor(e){this.options=e,this.root={type:"root",data:{language:null,relevance:0},children:[]},this.stack=[this.root]}addText(e){if(e==="")return;let n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){let r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){let n=e.split(".").map((o,s)=>s?o+"_".repeat(s):this.options.classPrefix+o),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}},Ie={highlight:mS,highlightAuto:LH,registerLanguage:PH,registered:FH,listLanguages:HH,registerAlias:BH};Ie.registerLanguage("arduino",$x);Ie.registerLanguage("bash",zx);Ie.registerLanguage("c",Ux);Ie.registerLanguage("cpp",Wx);Ie.registerLanguage("csharp",Kx);Ie.registerLanguage("css",Vx);Ie.registerLanguage("diff",Gx);Ie.registerLanguage("go",qx);Ie.registerLanguage("graphql",Yx);Ie.registerLanguage("ini",Jx);Ie.registerLanguage("java",jx);Ie.registerLanguage("javascript",r_);Ie.registerLanguage("json",i_);Ie.registerLanguage("kotlin",o_);Ie.registerLanguage("less",l_);Ie.registerLanguage("lua",c_);Ie.registerLanguage("makefile",u_);Ie.registerLanguage("markdown",d_);Ie.registerLanguage("objectivec",f_);Ie.registerLanguage("perl",p_);Ie.registerLanguage("php",h_);Ie.registerLanguage("php-template",m_);Ie.registerLanguage("plaintext",g_);Ie.registerLanguage("python",b_);Ie.registerLanguage("python-repl",y_);Ie.registerLanguage("r",E_);Ie.registerLanguage("ruby",v_);Ie.registerLanguage("rust",w_);Ie.registerLanguage("scss",x_);Ie.registerLanguage("shell",__);Ie.registerLanguage("sql",S_);Ie.registerLanguage("swift",R_);Ie.registerLanguage("typescript",$_);Ie.registerLanguage("vbnet",z_);Ie.registerLanguage("wasm",U_);Ie.registerLanguage("xml",W_);Ie.registerLanguage("yaml",K_);var Ci=(t,e=0,n=1)=>t>n?n:tMath.round(n*t)/n;var t6={grad:360/400,turn:360,rad:360/(Math.PI*2)},gS=t=>WH(ku(t)),ku=t=>(t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Mt(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Mt(parseInt(t.substring(6,8),16)/255,2):1});var bS=t=>UH(zH(t)),$H=({h:t,s:e,v:n,a:r})=>{let i=(200-e)*n/100;return{h:Mt(t),s:Mt(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:Mt(i/2),a:Mt(r,2)}};var _a=t=>{let{h:e,s:n,l:r}=$H(t);return`hsl(${e}, ${n}%, ${r}%)`};var zH=({h:t,s:e,v:n,a:r})=>{t=t/360*6,e=e/100,n=n/100;let i=Math.floor(t),o=n*(1-e),s=n*(1-(t-i)*e),l=n*(1-(1-t+i)*e),c=i%6;return{r:Mt([n,s,o,o,l,n][c]*255),g:Mt([l,n,n,s,o,o][c]*255),b:Mt([o,o,l,n,n,s][c]*255),a:Mt(r,2)}};var Nu=t=>{let e=t.toString(16);return e.length<2?"0"+e:e},UH=({r:t,g:e,b:n,a:r})=>{let i=r<1?Nu(Mt(r*255)):"";return"#"+Nu(t)+Nu(e)+Nu(n)+i},WH=({r:t,g:e,b:n,a:r})=>{let i=Math.max(t,e,n),o=i-Math.min(t,e,n),s=o?i===t?(e-n)/o:i===e?2+(n-t)/o:4+(t-e)/o:0;return{h:Mt(60*(s<0?s+6:s)),s:Mt(i?o/i*100:0),v:Mt(i/255*100),a:r}};var Im=(t,e)=>{if(t===e)return!0;for(let n in t)if(t[n]!==e[n])return!1;return!0};var yS=(t,e)=>t.toLowerCase()===e.toLowerCase()?!0:Im(ku(t),ku(e));var ES={},Ou=t=>{let e=ES[t];return e||(e=document.createElement("template"),e.innerHTML=t,ES[t]=e),e},Sa=(t,e,n)=>{t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:n}))};var fs=!1,Dm=t=>"touches"in t,KH=t=>fs&&!Dm(t)?!1:(fs||(fs=Dm(t)),!0),vS=(t,e)=>{let n=Dm(e)?e.touches[0]:e,r=t.el.getBoundingClientRect();Sa(t.el,"move",t.getMove({x:Ci((n.pageX-(r.left+window.pageXOffset))/r.width),y:Ci((n.pageY-(r.top+window.pageYOffset))/r.height)}))},VH=(t,e)=>{let n=e.keyCode;n>40||t.xy&&n<37||n<33||(e.preventDefault(),Sa(t.el,"move",t.getMove({x:n===39?.01:n===37?-.01:n===34?.05:n===33?-.05:n===35?1:n===36?-1:0,y:n===40?.01:n===38?-.01:0},!0)))},ps=class{constructor(e,n,r,i){let o=Ou(`
`);e.appendChild(o.content.cloneNode(!0));let s=e.querySelector(`[part=${n}]`);s.addEventListener("mousedown",this),s.addEventListener("touchstart",this),s.addEventListener("keydown",this),this.el=s,this.xy=i,this.nodes=[s.firstChild,s]}set dragging(e){let n=e?document.addEventListener:document.removeEventListener;n(fs?"touchmove":"mousemove",this),n(fs?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!KH(e)||!fs&&e.button!=0)return;this.el.focus(),vS(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),vS(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":VH(this,e);break}}style(e){e.forEach((n,r)=>{for(let i in n)this.nodes[r].style.setProperty(i,n[i])})}};var Ru=class extends ps{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:`${e/360*100}%`,color:_a({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${Mt(e)}`)}getMove(e,n){return{h:n?Ci(this.h+e.x*360,0,360):360*e.x}}};var Iu=class extends ps{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:`${100-e.v}%`,left:`${e.s}%`,color:_a(e)},{"background-color":_a({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${Mt(e.s)}%, Brightness ${Mt(e.v)}%`)}getMove(e,n){return{s:n?Ci(this.hsva.s+e.x*100,0,100):e.x*100,v:n?Ci(this.hsva.v-e.y*100,0,100):Math.round(100-e.y*100)}}};var wS=':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}';var xS="[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}";var _S="[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}";var Du=Symbol("same"),Lm=Symbol("color"),SS=Symbol("hsva"),Pm=Symbol("update"),TS=Symbol("parts"),CS=Symbol("css"),AS=Symbol("sliders"),Lu=class extends HTMLElement{static get observedAttributes(){return["color"]}get[CS](){return[wS,xS,_S]}get[AS](){return[Iu,Ru]}get color(){return this[Lm]}set color(e){if(!this[Du](e)){let n=this.colorModel.toHsva(e);this[Pm](n),this[Lm]=e}}constructor(){super();let e=Ou(``),n=this.attachShadow({mode:"open"});n.appendChild(e.content.cloneNode(!0)),n.addEventListener("move",this),this[TS]=this[AS].map(r=>new r(n))}connectedCallback(){if(this.hasOwnProperty("color")){let e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,n,r){let i=this.colorModel.fromAttr(r);this[Du](i)||(this.color=i)}handleEvent(e){let n=this[SS],r={...n,...e.detail};this[Pm](r);let i;!Im(r,n)&&!this[Du](i=this.colorModel.fromHsva(r))&&(this[Lm]=i,Sa(this,"color-changed",{value:i}))}[Du](e){return this.color&&this.colorModel.equal(e,this.color)}[Pm](e){this[SS]=e,this[TS].forEach(n=>n.update(e))}};var GH={defaultColor:"#000",toHsva:gS,fromHsva:({h:t,s:e,v:n})=>bS({h:t,s:e,v:n,a:1}),equal:yS,fromAttr:t=>t},Pu=class extends Lu{get colorModel(){return GH}};var kS=Zd(MS(),1);customElements.define("tiptap-hex-color-picker",Pu);var qH={blockquote:[YE],bold:[JE],"bullet-list":[jE],"checked-list":[bh],code:[QE],"code-block":[am.configure({lowlight:Ie,HTMLAttributes:{class:"hljs"}})],color:[tv],details:[Xh,Zh,jh],grid:[Wh,Kh],"grid-builder":[um,dm],heading:[lv.configure({levels:[1,2,3,4,5,6]})],highlight:[ow],hr:[hv],hurdle:[lm],italic:[mv],lead:[yh],link:[$h.configure({openOnClick:!1,autolink:!1,HTMLAttributes:{rel:null,hreflang:null,class:null}})],media:[zh.configure({inline:!0})],oembed:[Gh,Yh,Jh],"ordered-list":[yv],small:[Uh],strike:[vv],subscript:[wv],superscript:[xv],table:[Qv.configure({resizable:!0}),tw,ew,nw],underline:[iw]},YH=window.TiptapEditorExtensions||{},NS={...qH,...YH},Bu=document.getElementById("activeLocale");Bu&&Bu.addEventListener("change",()=>{let t=new CustomEvent("locale-change",{bubbles:!0,detail:{locale:Bu.value}});Bu.dispatchEvent(t)});document.addEventListener("livewire:navigating",()=>{window.filamentTiptapEditors={}});document.addEventListener("dblclick",function(t){(t.target&&(t.target.hasAttribute("data-youtube-video")||t.target.hasAttribute("data-vimeo-video"))||t.target.hasAttribute("data-native-video"))&&(t.target.firstChild.style.pointerEvents="all")});Livewire.on("insertFromAction",t=>{setTimeout(()=>{let e=new CustomEvent("insert-content",{bubble:!0,detail:t});window.dispatchEvent(e)},100)});Livewire.on("insertBlockFromAction",t=>{setTimeout(()=>{let e=new CustomEvent("insert-block",{bubble:!0,detail:t});window.dispatchEvent(e)},100)});Livewire.on("updateBlockFromAction",t=>{setTimeout(()=>{let e=new CustomEvent("update-block",{bubble:!0,detail:t});window.dispatchEvent(e)},100)});function JH({state:t,statePath:e,tools:n=[],disabled:r=!1,locale:i="en",floatingMenuTools:o=[],placeholder:s=null,mergeTags:l=[]}){let c=null;return{id:null,modalId:null,tools:n,state:t,statePath:e,fullScreenMode:!1,updatedAt:Date.now(),disabled:r,locale:i,floatingMenuTools:o,getExtensions(){let d=this.tools.map(h=>typeof h=="string"?h:h.id),f=[nv,rw,hc,iv,sv,av,pv,ev,fm,mm,gm,bm,ym.configure({statePath:e}),pm];if(s&&!r&&f.push(Ev.configure({placeholder:s})),d.length){let h=Object.keys(NS),m=[],b=["paragraph"];f.push(Ww.configure({element:this.$refs.bubbleMenu,tippyOptions:{duration:[500,0],maxWidth:"none",placement:"top",theme:"tiptap-editor-bubble",interactive:!0,appendTo:this.$refs.element,zIndex:10},shouldShow:({state:y,from:w,to:_})=>{if(Ur(y,"oembed")||Ur(y,"vimeo")||Ur(y,"youtube")||Ur(y,"video")||Ur(y,"tiptapBlock"))return!1;if(Ur(y,"link")||Ur(y,"table")||w!==_)return!0}})),this.floatingMenuTools.length&&(f.push(Kw.configure({element:this.$refs.floatingMenu,tippyOptions:{duration:[500,0],maxWidth:"none",theme:"tiptap-editor-bubble",interactive:!0,appendTo:this.$refs.element,zIndex:10}})),this.floatingMenuTools.forEach(y=>{d.includes(y)||d.push(y)})),d.forEach(y=>{h.includes(y)?NS[y].forEach(w=>{["ordered-list","bullet-list","checked-list"].includes(y)?(f.push(w),f.includes(Lp)||f.push(Lp)):f.push(w)}):["align-left","align-right","align-center","align-justify"].includes(y)&&(y==="align-left"&&m.push("start"),y==="align-center"&&m.push("center"),y==="align-right"&&m.push("end"),y==="align-justify"&&m.push("justify"),d.includes("heading")&&b.push("heading"),typeof f.find(_=>_.name==="textAlign")>"u"&&f.push(cm.configure({types:b,alignments:m})))})}return l?.length&&f.push(hm.configure({mergeTags:l})),f},init:function(){let d=this.$refs.element.querySelector(".tiptap");d&&(d.remove(),c=null),this.initEditor(this.state);let f=this.$el.parentElement.closest("[x-sortable]");f&&(window.Sortable.utils.on(f,"start",()=>{f.classList.add("sorting")}),window.Sortable.utils.on(f,"end",()=>{f.classList.remove("sorting")})),this.$watch("state",(h,m)=>{typeof h<"u"&&((0,kS.isEqual)(m,Alpine.raw(h))||this.updateEditorContent(h))})},initEditor(d){if(!this.$el.querySelector(".tiptap")){let f=this;c=new Ql({element:f.$refs.element,extensions:f.getExtensions(),editable:!f.disabled,content:d,editorProps:{handlePaste(h,m,b){b.content.descendants(y=>{y.type.name==="tiptapBlock"&&(y.attrs.statePath=f.statePath,y.attrs.data=JSON.parse(y.attrs.data))})}},onUpdate({editor:h}){f.state=h.isEmpty?null:h.getJSON(),f.updatedAt=Date.now()},onSelectionUpdate(){f.updatedAt=Date.now()},onBlur(){f.updatedAt=Date.now()},onFocus(){f.updatedAt=Date.now()}})}},isActive(d,f={}){return c.isActive(d,f)},editor(){return c},blur(){let d=this.$el.querySelectorAll("[data-tippy-content]");d&&d.forEach(f=>f.destroy()),this.updatedAt=Date.now()},updateEditorContent(d){if(c.isEditable){let{from:f,to:h}=c.state.selection;c.commands.setContent(d,!0),c.chain().focus().setTextSelection({from:f,to:h}).run()}},refreshEditorContent(){this.$nextTick(()=>this.updateEditorContent(this.state))},updateLocale(d){this.locale=d.detail.locale},insertContent(d){if(d.detail.statePath===this.statePath)switch(d.detail.type){case"media":this.insertMedia(d);return;case"video":this.insertVideo(d);return;case"link":this.insertLink(d);return;case"source":this.insertSource(d);return;case"grid":this.insertGridBuilder(d);return;default:return}},insertMedia(d){Array.isArray(d.detail.media)?d.detail.media.forEach(f=>{this.executeMediaInsert(f)}):this.executeMediaInsert(d.detail.media)},executeMediaInsert(d=null){if(!(!d||d?.url===null)&&d){let f=d?.url||d?.src,h=["jpg","jpeg","svg","png","webp","gif","avif","jxl","heic"],b=/.*\.([a-zA-Z]*)\??/.exec(f.toLowerCase());b!==null&&h.includes(b[1])?c.chain().focus().setImage({src:f,alt:d?.alt,title:d?.title,width:d?.width,height:d?.height,lazy:d?.lazy}).run():c.chain().focus().extendMarkRange("link").setLink({href:f}).insertContent(d?.link_text).run()}},insertVideo(d){let f=d.detail.video;if(!f||f.url===null)return;let h={src:f.url,width:f.responsive?f.width*100:f.width,height:f.responsive?f.height*100:f.height,responsive:f.responsive??!0,"data-aspect-width":f.width,"data-aspect-height":f.height};f.url.includes("youtube")||f.url.includes("youtu.be")?c.chain().focus().setYoutubeVideo({...h,controls:f.youtube_options.includes("controls"),nocookie:f.youtube_options.includes("nocookie"),start:f.start_at??0}).run():f.url.includes("vimeo")?c.chain().focus().setVimeoVideo({...h,autoplay:f.vimeo_options.includes("autoplay"),loop:f.vimeo_options.includes("loop"),title:f.vimeo_options.includes("show_title"),byline:f.vimeo_options.includes("byline"),portrait:f.vimeo_options.includes("portrait")}).run():c.chain().focus().setVideo({...h,autoplay:f.native_options.includes("autoplay"),loop:f.native_options.includes("loop"),controls:f.native_options.includes("controls")}).run()},insertLink(d){let f=d.detail;if(!(f.href===null&&f.id===null)){if(f.href===""&&f.id===null){this.unsetLink();return}c.chain().focus().setTextSelection({from:f.coordinates[0].$from.pos,to:f.coordinates[0].$to.pos}).setLink({href:f.href,id:f.id??null,target:f.target??null,hreflang:f.hreflang??null,rel:f.rel??null,referrerpolicy:f.referrerpolicy??null,as_button:f.as_button??null,button_theme:f.button_theme??null}).selectTextblockEnd().run()}},unsetLink(){c.chain().focus().extendMarkRange("link").unsetLink().selectTextblockEnd().run()},insertSource(d){this.updateEditorContent(d.detail.source)},insertGridBuilder(d){let f=d.detail.data,h="responsive",m=parseInt(f.asymmetric_left)??null,b=parseInt(f.asymmetric_right)??null;f.fixed&&(h="fixed"),f.asymmetric&&(h="asymmetric"),c.chain().focus().insertGridBuilder({cols:f.columns,type:h,stackAt:f.stack_at,asymmetricLeft:m,asymmetricRight:b}).run()},insertBlock(d){d.detail.statePath===this.statePath&&(c.commands.insertBlock({type:d.detail.type,statePath:d.detail.statePath,data:d.detail.data,preview:d.detail.preview,label:d.detail.label,coordinates:d.detail.coordinates}),c.isFocused||c.commands.focus())},insertMergeTag(d){c.commands.insertMergeTag({tag:d.detail.tag,coordinates:d.detail.coordinates}),c.isFocused||c.commands.focus()},openBlockSettings(d){d.detail.statePath===this.statePath&&this.$wire.dispatchFormEvent("tiptap::updateBlock",this.statePath,d.detail)},updateBlock(d){d.detail.statePath===this.statePath&&(c.commands.updateBlock({type:d.detail.type,statePath:d.detail.statePath,data:d.detail.data,preview:d.detail.preview,label:d.detail.label,coordinates:d.detail.coordinates}),c.isFocused||c.commands.focus())},deleteBlock(){c.commands.removeBlock()}}}export{JH as default}; + `;t=document.createElement("div"),t.innerHTML=r,t.addEventListener("merge-tags-select",i=>{n.command({id:i.detail.item})}),e=ts("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t,allowHTML:!0,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate(n){if(!n.items.length){e[0].hide();return}e[0].show(),t.dispatchEvent(new CustomEvent("merge-tags-update-items",{detail:n.items}))},onKeyDown(n){t.dispatchEvent(new CustomEvent("merge-tags-key-down",{detail:n.event}))},onExit(){e[0].destroy()}}}})]}});var gm=We.create({name:"classExtension",addGlobalAttributes(){return[{types:["heading","paragraph","link","image","listItem","bulletList","orderedList","table","tableHeader","tableRow","tableCell","textStyle"],attributes:{class:{default:null,parseHTML:t=>t.getAttribute("class")??null,renderHTML:t=>t.class?{class:t.class}:null}}}]}});var bm=We.create({name:"idExtension",addGlobalAttributes(){return[{types:["heading","link"],attributes:{id:{default:null,parseHTML:t=>t.getAttribute("id")??null,renderHTML:t=>t.id?{id:t.id}:null}}}]}});var ym=We.create({name:"styleExtension",addGlobalAttributes(){return[{types:["heading","paragraph","link","image","listItem","bulletList","orderedList","table","tableHeader","tableRow","tableCell","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.getAttribute("style")??null,renderHTML:t=>t.style?{style:t.style}:null}}}]}});var Em=We.create({name:"statePath",addOptions(){return{statePath:null}},addStorage(){return{statePath:null}},onBeforeCreate(){this.storage.statePath=this.options.statePath},addCommands(){return{getStatePath:()=>()=>this.storage.statePath}}});function hF(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},f={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},b=e.optional(i)+t.IDENT_RE+"\\s*\\(",y=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],v=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],S=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],T={type:v,keyword:y,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},$={className:"function.dispatch",relevance:0,keywords:{_hint:S},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},O=[$,h,l,n,t.C_BLOCK_COMMENT_MODE,f,d],Y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:O.concat([{begin:/\(/,end:/\)/,keywords:T,contains:O.concat(["self"]),relevance:0}]),relevance:0},ee={className:"function",begin:"("+s+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,relevance:0},{begin:b,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,f]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,f,l,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,f,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"",keywords:T,contains:["self",l]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function $x(t){let e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=hF(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function zx(t){let e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});let i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let l={className:"",begin:/\\"/},u={className:"string",begin:/'/,end:/'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=t.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],y=["true","false"],v={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias"],L=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],D=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:y,built_in:[...x,...S,"set","shopt",...L,...D]},contains:[h,t.SHEBANG(),m,d,t.HASH_COMMENT_MODE,o,v,s,l,u,n]}}function Ux(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},f={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},b=e.optional(i)+t.IDENT_RE+"\\s*\\(",x={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},S=[h,l,n,t.C_BLOCK_COMMENT_MODE,f,d],L={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:S.concat([{begin:/\(/,end:/\)/,keywords:x,contains:S.concat(["self"]),relevance:0}]),relevance:0},D={begin:"("+s+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:b,returnBegin:!0,contains:[t.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,f,l,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,f,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C",aliases:["h"],keywords:x,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:h,strings:d,keywords:x}}}function Wx(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},f={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},h={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},b=e.optional(i)+t.IDENT_RE+"\\s*\\(",y=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],v=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],S=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],T={type:v,keyword:y,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},$={className:"function.dispatch",relevance:0,keywords:{_hint:S},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},O=[$,h,l,n,t.C_BLOCK_COMMENT_MODE,f,d],Y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:O.concat([{begin:/\(/,end:/\)/,keywords:T,contains:O.concat(["self"]),relevance:0}]),relevance:0},ee={className:"function",begin:"("+s+"[\\*&\\s]+)+"+b,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,relevance:0},{begin:b,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,f]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,d,f,l,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,d,f,l]}]},l,n,t.C_BLOCK_COMMENT_MODE,h]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"",keywords:T,contains:["self",l]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Kx(t){let e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],o=["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"],s={keyword:i.concat(o),built_in:e,literal:r},l=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),u={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=t.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:s},m=t.inherit(h,{illegal:/\n/}),b={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,m]},y={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},v=t.inherit(y,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]});h.contains=[y,b,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,u,t.C_BLOCK_COMMENT_MODE],m.contains=[v,b,f,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,u,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let x={variants:[y,b,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},S={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},L=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",D={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:s,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},x,u,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,S,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,S,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+L+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,S],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[x,u,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},D]}}var mF=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}),gF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],bF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],yF=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],EF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],vF=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function Vx(t){let e=t.regex,n=mF(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",o=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",l=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+yF.join("|")+")"},{begin:":(:)?("+EF.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+vF.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:o},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:bF.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+gF.join("|")+")\\b"}]}}function Gx(t){let e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function qx(t){let o={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:o,illegal:"Zx(t,e,n-1))}function jx(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+Zx("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),u={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},d={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},f={className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:u,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[f,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:u,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Xx,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Xx,d]}}var Qx="[A-Za-z$_][0-9A-Za-z$_]*",wF=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],xF=["true","false","null","undefined","NaN","Infinity"],e_=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],t_=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],n_=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],_F=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],SF=[].concat(n_,e_,t_);function r_(t){let e=t.regex,n=(R,{after:K})=>{let J="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,K)=>{let J=R[0].length+R.index,se=R.input[J];if(se==="<"||se===","){K.ignoreMatch();return}se===">"&&(n(R,{after:J})||K.ignoreMatch());let be,De=R.input.substring(J);if(be=De.match(/^\s*=/)){K.ignoreMatch();return}if((be=De.match(/^\s+extends\s+/))&&be.index===0){K.ignoreMatch();return}}},l={$pattern:Qx,keyword:wF,literal:xF,built_in:SF,"variable.language":_F},u="[0-9](_?[0-9])*",d=`\\.(${u})`,f="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${f})((${d})|\\.)?|(${d}))[eE][+-]?(${u})\\b`},{begin:`\\b(${f})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},b={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},y={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"css"}},v={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,m]},L={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},D=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,b,y,v,x,{match:/\$\d+/},h];m.contains=D.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(D)});let T=[].concat(L,m.contains),$=T.concat([{begin:/\(/,end:/\)/,keywords:l,contains:["self"].concat(T)}]),O={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:$},Y={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},ee={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...e_,...t_]}},z={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},re={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},he={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Se(R){return e.concat("(?!",R.join("|"),")")}let me={match:e.concat(/\b/,Se([...n_,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},Ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ge={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},_e="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",A={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(_e)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:ee},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),z,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,b,y,v,x,L,{match:/\$\d+/},h,ee,{className:"attr",begin:r+e.lookahead(":"),relevance:0},A,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[L,t.REGEXP_MODE,{className:"function",begin:_e,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},re,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[O,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},me,he,Y,ge,{match:/\$[(.]/}]}}function i_(t){let e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var cs="[0-9](_*[0-9])*",vu=`\\.(${cs})`,wu="[0-9a-fA-F](_*[0-9a-fA-F])*",TF={className:"number",variants:[{begin:`(\\b(${cs})((${vu})|\\.)?|(${vu}))[eE][+-]?(${cs})[fFdD]?\\b`},{begin:`\\b(${cs})((${vu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${vu})[fFdD]?\\b`},{begin:`\\b(${cs})[fFdD]\\b`},{begin:`\\b0[xX]((${wu})\\.?|(${wu})?\\.(${wu}))[pP][+-]?(${cs})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${wu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o_(t){let e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},o={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[o,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(s);let l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},u={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(s,{className:"string"}),"self"]}]},d=TF,f=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),h={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=h;return m.variants[1].contains=[h],h.variants[1].contains=[m],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,f,n,r,l,u,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[h,t.C_LINE_COMMENT_MODE,f],relevance:0},t.C_LINE_COMMENT_MODE,f,l,u,s,t.C_NUMBER_MODE]},f]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,u]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},d]}}var CF=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}),AF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],MF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],s_=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],a_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],NF=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),kF=s_.concat(a_);function l_(t){let e=CF(t),n=kF,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",s=[],l=[],u=function(D){return{className:"string",begin:"~?"+D+".*?"+D}},d=function(D,T,$){return{className:D,begin:T,relevance:$}},f={$pattern:/[a-z-]+/,keyword:r,attribute:MF.join(" ")},h={begin:"\\(",end:"\\)",contains:l,keywords:f,relevance:0};l.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,u("'"),u('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,h,d("variable","@@?"+i,10),d("variable","@\\{"+i+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);let m=l.concat({begin:/\{/,end:/\}/,contains:s}),b={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},y={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+NF.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},v={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:f,returnEnd:!0,contains:l,relevance:0}},x={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:m}},S={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,b,d("keyword","all\\b"),d("variable","@\\{"+i+"\\}"),{begin:"\\b("+AF.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,d("selector-tag",o,0),d("selector-id","#"+o),d("selector-class","\\."+o,0),d("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+s_.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+a_.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},e.FUNCTION_DISPATCH]},L={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[S]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,v,x,L,y,S,b,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function c_(t){let e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function u_(t){let e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,u={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},f={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=t.inherit(d,{contains:[]}),m=t.inherit(f,{contains:[]});d.contains.push(m),f.contains.push(h);let b=[n,u];return[d,f,h,m].forEach(x=>{x.contains=x.contains.concat(b)}),b=b.concat(d,f),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:b},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:b}]}]},n,o,d,f,{className:"quote",begin:"^>\\s+",contains:b,end:"$"},i,r,u,s]}}function f_(t){let e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},u={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+u.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:u,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function p_(t){let e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},o={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},s={begin:/->\{/,end:/\}/},l={variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@][^\s\w{]/,relevance:0}]},u=[t.BACKSLASH_ESCAPE,o,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(b,y,v="\\1")=>{let x=v==="\\1"?v:e.concat(v,y);return e.concat(e.concat("(?:",b,")"),y,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,v,r)},h=(b,y,v)=>e.concat(e.concat("(?:",b,")"),y,/(?:\\.|[^\\\/])*?/,v,r),m=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",e.either(...d,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:h("(?:m|qr)?",/\//,/\//)},{begin:h("m|qr",e.either(...d,{capture:!0}),/\1/)},{begin:h("m|qr",/\(/,/\)/)},{begin:h("m|qr",/\[/,/\]/)},{begin:h("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=m,s.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function h_(t){let e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),o={scope:"variable",match:"\\$+"+r},s={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=t.inherit(t.APOS_STRING_MODE,{illegal:null}),d=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(me,Ce)=>{Ce.data._beginMatch=me[1]||me[2]},"on:end":(me,Ce)=>{Ce.data._beginMatch!==me[1]&&Ce.ignoreMatch()}},h=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),m=`[ +]`,b={scope:"string",variants:[d,u,f,h]},y={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},v=["false","null","true"],x=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],S=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],D={keyword:x,literal:(me=>{let Ce=[];return me.forEach(ge=>{Ce.push(ge),ge.toLowerCase()===ge?Ce.push(ge.toUpperCase()):Ce.push(ge.toLowerCase())}),Ce})(v),built_in:S},T=me=>me.map(Ce=>Ce.replace(/\|\d+$/,"")),$={variants:[{match:[/new/,e.concat(m,"+"),e.concat("(?!",T(S).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},O=e.concat(r,"\\b(?!\\()"),Y={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),O],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),O],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},ee={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},z={relevance:0,begin:/\(/,end:/\)/,keywords:D,contains:[ee,o,Y,t.C_BLOCK_COMMENT_MODE,b,y,$]},re={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",T(x).join("\\b|"),"|",T(S).join("\\b|"),"\\b)"),r,e.concat(m,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[z]};z.contains.push(re);let he=[ee,Y,t.C_BLOCK_COMMENT_MODE,b,y,$],Se={begin:e.concat(/#\[\s*/,i),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...he]},...he,{scope:"meta",match:i}]};return{case_insensitive:!1,keywords:D,contains:[Se,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},s,{scope:"variable.language",match:/\$this\b/},o,re,Y,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},$,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:D,contains:["self",o,Y,t.C_BLOCK_COMMENT_MODE,b,y]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},b,y]}}function m_(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function g_(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function b_(t){let e=t.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},u={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},f={begin:/\{\{/,relevance:0},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,u,f,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,u,f,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,f,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,f,d]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",b=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,y=`\\b|${r.join("|")}`,v={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${b}))[eE][+-]?(${m})[jJ]?(?=${y})`},{begin:`(${b})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${y})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${y})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${y})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${y})`},{begin:`\\b(${m})[jJ](?=${y})`}]},x={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},S={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",u,v,h,t.HASH_COMMENT_MODE]}]};return d.contains=[h,v,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[u,v,{begin:/\bself\b/},{beginKeywords:"if",relevance:0},h,x,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[S]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[v,S,h]}]}}function y_(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function E_(t){let e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,o=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[o,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:o},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function v_(t){let e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),s={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},u={begin:"#<",end:">"},d=[t.COMMENT("#","$",{contains:[l]}),t.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],f={className:"subst",begin:/#\{/,end:/\}/,keywords:s},h={className:"string",contains:[t.BACKSLASH_ESCAPE,f],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,f]})]}]},m="[1-9](_?[0-9])*|0",b="[0-9](_?[0-9])*",y={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${b}))?([eE][+-]?(${b})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},v={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},O=[h,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:s},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[v]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[h,{begin:n}],relevance:0},y,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,f],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(u,d),relevance:0}].concat(u,d);f.contains=O,v.contains=O;let re=[{begin:/^\s*=>/,starts:{end:"$",contains:O}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:O}}];return d.unshift(u),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(re).concat(d).concat(O)}}function w_(t){let e=t.regex,n={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let\b)/,t.IDENT_RE,e.lookahead(/\s*\(/))},r="([ui](8|16|32|64|128|size)|f(32|64))?",i=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","unsafe","unsized","use","virtual","where","while","yield"],o=["true","false","Some","None","Ok","Err"],s=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],l=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:l,keyword:i,literal:o,built_in:s},illegal:""},n]}}var OF=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}),RF=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],IF=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],DF=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],LF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],PF=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function x_(t){let e=OF(t),n=LF,r=DF,i="@[a-z-]+",o="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+RF.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+PF.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,l,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:IF.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function __(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function S_(t){let e=t.regex,n=t.COMMENT("--","$"),r={className:"string",variants:[{begin:/'/,end:/'/,contains:[{begin:/''/}]}]},i={begin:/"/,end:/"/,contains:[{begin:/""/}]},o=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],u=["add","asc","collation","desc","final","first","last","view"],d=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],f=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],m=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],b=f,y=[...d,...u].filter(D=>!f.includes(D)),v={className:"variable",begin:/@[a-z0-9][a-z0-9_]*/},x={className:"operator",begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},S={begin:e.concat(/\b/,e.either(...b),/\s*\(/),relevance:0,keywords:{built_in:b}};function L(D,{exceptions:T,when:$}={}){let O=$;return T=T||[],D.map(Y=>Y.match(/\|\d+$/)||T.includes(Y)?Y:O(Y)?`${Y}|0`:Y)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:L(y,{when:D=>D.length<3}),literal:o,type:l,built_in:h},contains:[{begin:e.either(...m),relevance:0,keywords:{$pattern:/[\w\.]+/,keyword:y.concat(m),literal:o,type:l}},{className:"type",begin:e.either(...s)},S,v,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,x]}}function M_(t){return t?typeof t=="string"?t:t.source:null}function xu(t){return nt("(?=",t,")")}function nt(...t){return t.map(n=>M_(n)).join("")}function BF(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function xn(...t){return"("+(BF(t).capture?"":"?:")+t.map(r=>M_(r)).join("|")+")"}var _m=t=>nt(/\b/,t,/\w$/.test(t)?/\b/:/\B/),FF=["Protocol","Type"].map(_m),T_=["init","self"].map(_m),HF=["Any","Self"],vm=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","break","case","catch","class","continue","convenience","default","defer","deinit","didSet","distributed","do","dynamic","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],C_=["false","nil","true"],$F=["assignment","associativity","higherThan","left","lowerThan","none","right"],zF=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warn_unqualified_access","#warning"],A_=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],N_=xn(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),k_=xn(N_,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),wm=nt(N_,k_,"*"),O_=xn(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),_u=xn(O_,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Yr=nt(O_,_u,"*"),xm=nt(/[A-Z]/,_u,"*"),UF=["autoclosure",nt(/convention\(/,xn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",nt(/objc\(/,Yr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","testable","UIApplicationMain","unknown","usableFromInline"],WF=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function R_(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,xn(...FF,...T_)],className:{2:"keyword"}},o={match:nt(/\./,xn(...vm)),relevance:0},s=vm.filter(Oe=>typeof Oe=="string").concat(["_|0"]),l=vm.filter(Oe=>typeof Oe!="string").concat(HF).map(_m),u={variants:[{className:"keyword",match:xn(...l,...T_)}]},d={$pattern:xn(/\b\w+/,/#\w+/),keyword:s.concat(zF),literal:C_},f=[i,o,u],h={match:nt(/\./,xn(...A_)),relevance:0},m={className:"built_in",match:nt(/\b/,xn(...A_),/(?=\()/)},b=[h,m],y={match:/->/,relevance:0},v={className:"operator",relevance:0,variants:[{match:wm},{match:`\\.(\\.|${k_})+`}]},x=[y,v],S="([0-9]_*)+",L="([0-9a-fA-F]_*)+",D={className:"number",relevance:0,variants:[{match:`\\b(${S})(\\.(${S}))?([eE][+-]?(${S}))?\\b`},{match:`\\b0x(${L})(\\.(${L}))?([pP][+-]?(${S}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(Oe="")=>({className:"subst",variants:[{match:nt(/\\/,Oe,/[0\\tnr"']/)},{match:nt(/\\/,Oe,/u\{[0-9a-fA-F]{1,8}\}/)}]}),$=(Oe="")=>({className:"subst",match:nt(/\\/,Oe,/[\t ]*(?:[\r\n]|\r\n)/)}),O=(Oe="")=>({className:"subst",label:"interpol",begin:nt(/\\/,Oe,/\(/),end:/\)/}),Y=(Oe="")=>({begin:nt(Oe,/"""/),end:nt(/"""/,Oe),contains:[T(Oe),$(Oe),O(Oe)]}),ee=(Oe="")=>({begin:nt(Oe,/"/),end:nt(/"/,Oe),contains:[T(Oe),O(Oe)]}),z={className:"string",variants:[Y(),Y("#"),Y("##"),Y("###"),ee(),ee("#"),ee("##"),ee("###")]},re={match:nt(/`/,Yr,/`/)},he={className:"variable",match:/\$\d+/},Se={className:"variable",match:`\\$${_u}+`},me=[re,he,Se],Ce={match:/(@|#(un)?)available/,className:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:WF,contains:[...x,D,z]}]}},ge={className:"keyword",match:nt(/@/,xn(...UF))},_e={className:"meta",match:nt(/@/,Yr)},A=[Ce,ge,_e],R={match:xu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:nt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,_u,"+")},{className:"type",match:xm,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:nt(/\s+&\s+/,xu(xm)),relevance:0}]},K={begin://,keywords:d,contains:[...r,...f,...A,y,R]};R.contains.push(K);let J={match:nt(Yr,/\s*:/),keywords:"_|0",relevance:0},se={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",J,...r,...f,...b,...x,D,z,...me,...A,R]},be={begin://,contains:[...r,R]},De={begin:xn(xu(nt(Yr,/\s*:/)),xu(nt(Yr,/\s+/,Yr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Yr}]},je={begin:/\(/,end:/\)/,keywords:d,contains:[De,...r,...f,...x,D,z,...A,R,se],endsParent:!0,illegal:/["']/},Me={match:[/func/,/\s+/,xn(re.match,Yr,wm)],className:{1:"keyword",3:"title.function"},contains:[be,je,e],illegal:[/\[/,/%/]},Be={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[be,je,e],illegal:/\[|%/},xt={match:[/operator/,/\s+/,wm],className:{1:"keyword",3:"title"}},Nt={begin:[/precedencegroup/,/\s+/,xm],className:{1:"keyword",3:"title"},contains:[R],keywords:[...$F,...C_],end:/}/};for(let Oe of z.variants){let _t=Oe.contains.find(pt=>pt.label==="interpol");_t.keywords=d;let Jt=[...f,...b,...x,D,z,...me];_t.contains=[...Jt,{begin:/\(/,end:/\)/,contains:["self",...Jt]}]}return{name:"Swift",keywords:d,contains:[...r,Me,Be,{beginKeywords:"struct protocol class extension enum actor",end:"\\{",excludeEnd:!0,keywords:d,contains:[t.inherit(t.TITLE_MODE,{className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...f]},xt,Nt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},...f,...b,...x,D,z,...me,...A,R,se]}}var Su="[A-Za-z$_][0-9A-Za-z$_]*",I_=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],D_=["true","false","null","undefined","NaN","Infinity"],L_=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],P_=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],B_=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],F_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],H_=[].concat(B_,L_,P_);function KF(t){let e=t.regex,n=(R,{after:K})=>{let J="",end:""},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,K)=>{let J=R[0].length+R.index,se=R.input[J];if(se==="<"||se===","){K.ignoreMatch();return}se===">"&&(n(R,{after:J})||K.ignoreMatch());let be,De=R.input.substring(J);if(be=De.match(/^\s*=/)){K.ignoreMatch();return}if((be=De.match(/^\s+extends\s+/))&&be.index===0){K.ignoreMatch();return}}},l={$pattern:Su,keyword:I_,literal:D_,built_in:H_,"variable.language":F_},u="[0-9](_?[0-9])*",d=`\\.(${u})`,f="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${f})((${d})|\\.)?|(${d}))[eE][+-]?(${u})\\b`},{begin:`\\b(${f})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},b={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},y={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"css"}},v={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,m]},L={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},D=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,b,y,v,x,{match:/\$\d+/},h];m.contains=D.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(D)});let T=[].concat(L,m.contains),$=T.concat([{begin:/\(/,end:/\)/,keywords:l,contains:["self"].concat(T)}]),O={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:$},Y={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},ee={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...L_,...P_]}},z={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},re={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[O],illegal:/%/},he={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Se(R){return e.concat("(?!",R.join("|"),")")}let me={match:e.concat(/\b/,Se([...B_,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},Ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ge={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},O]},_e="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",A={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(_e)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[O]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:ee},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),z,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,b,y,v,x,L,{match:/\$\d+/},h,ee,{className:"attr",begin:r+e.lookahead(":"),relevance:0},A,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[L,t.REGEXP_MODE,{className:"function",begin:_e,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:o},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},re,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[O,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[O]},me,he,Y,ge,{match:/\$[(.]/}]}}function $_(t){let e=KF(t),n=Su,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={beginKeywords:"namespace",end:/\{/,excludeEnd:!0,contains:[e.exports.CLASS_REFERENCE]},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[e.exports.CLASS_REFERENCE]},s={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"],u={$pattern:Su,keyword:I_.concat(l),literal:D_,built_in:H_.concat(r),"variable.language":F_},d={className:"meta",begin:"@"+n},f=(m,b,y)=>{let v=m.contains.findIndex(x=>x.label===b);if(v===-1)throw new Error("can not find mode to replace");m.contains.splice(v,1,y)};Object.assign(e.keywords,u),e.exports.PARAMS_CONTAINS.push(d),e.contains=e.contains.concat([d,i,o]),f(e,"shebang",t.SHEBANG()),f(e,"use_strict",s);let h=e.contains.find(m=>m.label==="func.def");return h.relevance=0,Object.assign(e,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),e}function z_(t){let e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,s=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,u={className:"literal",variants:[{begin:e.concat(/# */,e.either(o,i),/ *#/)},{begin:e.concat(/# */,l,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(o,i),/ +/,e.either(s,l),/ *#/)}]},d={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},f={className:"label",begin:/^\w+:/},h=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,u,d,f,h,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}function U_(t){t.regex;let e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");let n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},o={className:"variable",begin:/\$[\w_]+/},s={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},u={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},d={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},o,s,i,t.QUOTE_STRING_MODE,u,d,l]}}function W_(t){let e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},o={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(o,{begin:/\(/,end:/\)/}),l=t.inherit(t.APOS_STRING_MODE,{className:"string"}),u=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[o,u,l,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[o,s,u,l]}]}]},t.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[u]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:d}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function K_(t){let e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ ]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ ]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ ]|$)"}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},s=t.inherit(o,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},m={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},b={begin:/\{/,end:/\}/,contains:[m],illegal:"\\n",relevance:0},y={begin:"\\[",end:"\\]",contains:[m],illegal:"\\n",relevance:0},v=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},h,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},b,y,o],x=[...v];return x.pop(),x.push(s),m.contains=x,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}var dS=Zd(uS(),1);var Jn=dS.default;var pS=Zd(fS(),1),xa=Object.assign(yo(Error),{eval:yo(EvalError),range:yo(RangeError),reference:yo(ReferenceError),syntax:yo(SyntaxError),type:yo(TypeError),uri:yo(URIError)});function yo(t){return e.displayName=t.displayName||t.name,e;function e(n,...r){let i=n&&(0,pS.default)(n,...r);return new t(i)}}var DH={}.hasOwnProperty,hS="hljs-";function mS(t,e,n={}){let r=n.prefix;if(typeof t!="string")throw xa("Expected `string` for name, got `%s`",t);if(!Jn.getLanguage(t))throw xa("Unknown language: `%s` is not registered",t);if(typeof e!="string")throw xa("Expected `string` for value, got `%s`",e);r==null&&(r=hS),Jn.configure({__emitter:Im,classPrefix:r});let i=Jn.highlight(e,{language:t,ignoreIllegals:!0});if(Jn.configure({}),i.errorRaised)throw i.errorRaised;return i._emitter.root.data.language=i.language,i._emitter.root.data.relevance=i.relevance,i._emitter.root}function LH(t,e={}){let n=e.subset||Jn.listLanguages(),r=e.prefix,i=-1,o={type:"root",data:{language:null,relevance:0},children:[]};if(r==null&&(r=hS),typeof t!="string")throw xa("Expected `string` for value, got `%s`",t);for(;++io.data.relevance&&(o=l)}return o}function PH(t,e){Jn.registerLanguage(t,e)}var BH=function(t,e){if(typeof t=="string")Jn.registerAliases(e,{languageName:t});else{let n;for(n in t)DH.call(t,n)&&Jn.registerAliases(t[n],{languageName:n})}};function FH(t){return!!Jn.getLanguage(t)}function HH(){return Jn.listLanguages()}var Im=class{constructor(e){this.options=e,this.root={type:"root",data:{language:null,relevance:0},children:[]},this.stack=[this.root]}addText(e){if(e==="")return;let n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){let r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){let n=e.split(".").map((o,s)=>s?o+"_".repeat(s):this.options.classPrefix+o),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}},Ie={highlight:mS,highlightAuto:LH,registerLanguage:PH,registered:FH,listLanguages:HH,registerAlias:BH};Ie.registerLanguage("arduino",$x);Ie.registerLanguage("bash",zx);Ie.registerLanguage("c",Ux);Ie.registerLanguage("cpp",Wx);Ie.registerLanguage("csharp",Kx);Ie.registerLanguage("css",Vx);Ie.registerLanguage("diff",Gx);Ie.registerLanguage("go",qx);Ie.registerLanguage("graphql",Yx);Ie.registerLanguage("ini",Jx);Ie.registerLanguage("java",jx);Ie.registerLanguage("javascript",r_);Ie.registerLanguage("json",i_);Ie.registerLanguage("kotlin",o_);Ie.registerLanguage("less",l_);Ie.registerLanguage("lua",c_);Ie.registerLanguage("makefile",u_);Ie.registerLanguage("markdown",d_);Ie.registerLanguage("objectivec",f_);Ie.registerLanguage("perl",p_);Ie.registerLanguage("php",h_);Ie.registerLanguage("php-template",m_);Ie.registerLanguage("plaintext",g_);Ie.registerLanguage("python",b_);Ie.registerLanguage("python-repl",y_);Ie.registerLanguage("r",E_);Ie.registerLanguage("ruby",v_);Ie.registerLanguage("rust",w_);Ie.registerLanguage("scss",x_);Ie.registerLanguage("shell",__);Ie.registerLanguage("sql",S_);Ie.registerLanguage("swift",R_);Ie.registerLanguage("typescript",$_);Ie.registerLanguage("vbnet",z_);Ie.registerLanguage("wasm",U_);Ie.registerLanguage("xml",W_);Ie.registerLanguage("yaml",K_);var Ci=(t,e=0,n=1)=>t>n?n:tMath.round(n*t)/n;var t6={grad:360/400,turn:360,rad:360/(Math.PI*2)},gS=t=>WH(ku(t)),ku=t=>(t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Mt(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Mt(parseInt(t.substring(6,8),16)/255,2):1});var bS=t=>UH(zH(t)),$H=({h:t,s:e,v:n,a:r})=>{let i=(200-e)*n/100;return{h:Mt(t),s:Mt(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:Mt(i/2),a:Mt(r,2)}};var _a=t=>{let{h:e,s:n,l:r}=$H(t);return`hsl(${e}, ${n}%, ${r}%)`};var zH=({h:t,s:e,v:n,a:r})=>{t=t/360*6,e=e/100,n=n/100;let i=Math.floor(t),o=n*(1-e),s=n*(1-(t-i)*e),l=n*(1-(1-t+i)*e),u=i%6;return{r:Mt([n,s,o,o,l,n][u]*255),g:Mt([l,n,n,s,o,o][u]*255),b:Mt([o,o,l,n,n,s][u]*255),a:Mt(r,2)}};var Nu=t=>{let e=t.toString(16);return e.length<2?"0"+e:e},UH=({r:t,g:e,b:n,a:r})=>{let i=r<1?Nu(Mt(r*255)):"";return"#"+Nu(t)+Nu(e)+Nu(n)+i},WH=({r:t,g:e,b:n,a:r})=>{let i=Math.max(t,e,n),o=i-Math.min(t,e,n),s=o?i===t?(e-n)/o:i===e?2+(n-t)/o:4+(t-e)/o:0;return{h:Mt(60*(s<0?s+6:s)),s:Mt(i?o/i*100:0),v:Mt(i/255*100),a:r}};var Dm=(t,e)=>{if(t===e)return!0;for(let n in t)if(t[n]!==e[n])return!1;return!0};var yS=(t,e)=>t.toLowerCase()===e.toLowerCase()?!0:Dm(ku(t),ku(e));var ES={},Ou=t=>{let e=ES[t];return e||(e=document.createElement("template"),e.innerHTML=t,ES[t]=e),e},Sa=(t,e,n)=>{t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:n}))};var fs=!1,Lm=t=>"touches"in t,KH=t=>fs&&!Lm(t)?!1:(fs||(fs=Lm(t)),!0),vS=(t,e)=>{let n=Lm(e)?e.touches[0]:e,r=t.el.getBoundingClientRect();Sa(t.el,"move",t.getMove({x:Ci((n.pageX-(r.left+window.pageXOffset))/r.width),y:Ci((n.pageY-(r.top+window.pageYOffset))/r.height)}))},VH=(t,e)=>{let n=e.keyCode;n>40||t.xy&&n<37||n<33||(e.preventDefault(),Sa(t.el,"move",t.getMove({x:n===39?.01:n===37?-.01:n===34?.05:n===33?-.05:n===35?1:n===36?-1:0,y:n===40?.01:n===38?-.01:0},!0)))},ps=class{constructor(e,n,r,i){let o=Ou(`
`);e.appendChild(o.content.cloneNode(!0));let s=e.querySelector(`[part=${n}]`);s.addEventListener("mousedown",this),s.addEventListener("touchstart",this),s.addEventListener("keydown",this),this.el=s,this.xy=i,this.nodes=[s.firstChild,s]}set dragging(e){let n=e?document.addEventListener:document.removeEventListener;n(fs?"touchmove":"mousemove",this),n(fs?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!KH(e)||!fs&&e.button!=0)return;this.el.focus(),vS(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),vS(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":VH(this,e);break}}style(e){e.forEach((n,r)=>{for(let i in n)this.nodes[r].style.setProperty(i,n[i])})}};var Ru=class extends ps{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:`${e/360*100}%`,color:_a({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${Mt(e)}`)}getMove(e,n){return{h:n?Ci(this.h+e.x*360,0,360):360*e.x}}};var Iu=class extends ps{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:`${100-e.v}%`,left:`${e.s}%`,color:_a(e)},{"background-color":_a({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${Mt(e.s)}%, Brightness ${Mt(e.v)}%`)}getMove(e,n){return{s:n?Ci(this.hsva.s+e.x*100,0,100):e.x*100,v:n?Ci(this.hsva.v-e.y*100,0,100):Math.round(100-e.y*100)}}};var wS=':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}';var xS="[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}";var _S="[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}";var Du=Symbol("same"),Pm=Symbol("color"),SS=Symbol("hsva"),Bm=Symbol("update"),TS=Symbol("parts"),CS=Symbol("css"),AS=Symbol("sliders"),Lu=class extends HTMLElement{static get observedAttributes(){return["color"]}get[CS](){return[wS,xS,_S]}get[AS](){return[Iu,Ru]}get color(){return this[Pm]}set color(e){if(!this[Du](e)){let n=this.colorModel.toHsva(e);this[Bm](n),this[Pm]=e}}constructor(){super();let e=Ou(``),n=this.attachShadow({mode:"open"});n.appendChild(e.content.cloneNode(!0)),n.addEventListener("move",this),this[TS]=this[AS].map(r=>new r(n))}connectedCallback(){if(this.hasOwnProperty("color")){let e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,n,r){let i=this.colorModel.fromAttr(r);this[Du](i)||(this.color=i)}handleEvent(e){let n=this[SS],r={...n,...e.detail};this[Bm](r);let i;!Dm(r,n)&&!this[Du](i=this.colorModel.fromHsva(r))&&(this[Pm]=i,Sa(this,"color-changed",{value:i}))}[Du](e){return this.color&&this.colorModel.equal(e,this.color)}[Bm](e){this[SS]=e,this[TS].forEach(n=>n.update(e))}};var GH={defaultColor:"#000",toHsva:gS,fromHsva:({h:t,s:e,v:n})=>bS({h:t,s:e,v:n,a:1}),equal:yS,fromAttr:t=>t},Pu=class extends Lu{get colorModel(){return GH}};var kS=Zd(MS(),1);customElements.define("tiptap-hex-color-picker",Pu);var qH={blockquote:[JE],bold:[XE],"bullet-list":[QE],"checked-list":[yh],code:[ev],"code-block":[lm.configure({lowlight:Ie,HTMLAttributes:{class:"hljs"}})],color:[nv],details:[Zh,jh,Qh],grid:[Kh,Vh],"grid-builder":[dm,fm],heading:[lv.configure({levels:[1,2,3,4,5,6]})],highlight:[ow],hr:[hv],hurdle:[cm],italic:[mv],lead:[Eh],link:[zh.configure({openOnClick:!1,autolink:!1,HTMLAttributes:{rel:null,hreflang:null,class:null}})],media:[Uh.configure({inline:!0})],oembed:[qh,Jh,Xh],"ordered-list":[yv],small:[Wh],strike:[vv],subscript:[wv],superscript:[xv],table:[Qv.configure({resizable:!0}),tw,ew,nw],underline:[iw]},YH=window.TiptapEditorExtensions||{},NS={...qH,...YH},Bu=document.getElementById("activeLocale");Bu&&Bu.addEventListener("change",()=>{let t=new CustomEvent("locale-change",{bubbles:!0,detail:{locale:Bu.value}});Bu.dispatchEvent(t)});document.addEventListener("livewire:navigating",()=>{window.filamentTiptapEditors={}});document.addEventListener("dblclick",function(t){(t.target&&(t.target.hasAttribute("data-youtube-video")||t.target.hasAttribute("data-vimeo-video"))||t.target.hasAttribute("data-native-video"))&&(t.target.firstChild.style.pointerEvents="all")});Livewire.on("insertFromAction",t=>{setTimeout(()=>{let e=new CustomEvent("insert-content",{bubble:!0,detail:t});window.dispatchEvent(e)},100)});Livewire.on("insertBlockFromAction",t=>{setTimeout(()=>{let e=new CustomEvent("insert-block",{bubble:!0,detail:t});window.dispatchEvent(e)},100)});Livewire.on("updateBlockFromAction",t=>{setTimeout(()=>{let e=new CustomEvent("update-block",{bubble:!0,detail:t});window.dispatchEvent(e)},100)});function JH({state:t,statePath:e,tools:n=[],disabled:r=!1,locale:i="en",floatingMenuTools:o=[],placeholder:s=null,mergeTags:l=[],customDocument:u=null}){let d=null;return{id:null,modalId:null,tools:n,state:t,statePath:e,fullScreenMode:!1,updatedAt:Date.now(),disabled:r,locale:i,floatingMenuTools:o,getExtensions(){let f=this.tools.map(m=>typeof m=="string"?m:m.id),h=[u?Mp.extend({content:u}):Mp,rw,hc,iv,sv,av,pv,tv,pm,gm,bm,ym,Em.configure({statePath:e}),hm];if(s&&!r&&h.push(Ev.configure({placeholder:s})),f.length){let m=Object.keys(NS),b=[],y=["paragraph"];h.push(Ww.configure({element:this.$refs.bubbleMenu,tippyOptions:{duration:[500,0],maxWidth:"none",placement:"top",theme:"tiptap-editor-bubble",interactive:!0,appendTo:this.$refs.element,zIndex:10},shouldShow:({state:v,from:x,to:S})=>{if(Ur(v,"oembed")||Ur(v,"vimeo")||Ur(v,"youtube")||Ur(v,"video")||Ur(v,"tiptapBlock"))return!1;if(Ur(v,"link")||Ur(v,"table")||x!==S)return!0}})),this.floatingMenuTools.length&&(h.push(Kw.configure({element:this.$refs.floatingMenu,tippyOptions:{duration:[500,0],maxWidth:"none",theme:"tiptap-editor-bubble",interactive:!0,appendTo:this.$refs.element,zIndex:10}})),this.floatingMenuTools.forEach(v=>{f.includes(v)||f.push(v)})),f.forEach(v=>{m.includes(v)?NS[v].forEach(x=>{["ordered-list","bullet-list","checked-list"].includes(v)?(h.push(x),h.includes(Pp)||h.push(Pp)):h.push(x)}):["align-left","align-right","align-center","align-justify"].includes(v)&&(v==="align-left"&&b.push("start"),v==="align-center"&&b.push("center"),v==="align-right"&&b.push("end"),v==="align-justify"&&b.push("justify"),f.includes("heading")&&y.push("heading"),typeof h.find(S=>S.name==="textAlign")>"u"&&h.push(um.configure({types:y,alignments:b})))})}return l?.length&&h.push(mm.configure({mergeTags:l})),h},init:function(){let f=this.$refs.element.querySelector(".tiptap");f&&(f.remove(),d=null),this.initEditor(this.state);let h=this.$el.parentElement.closest("[x-sortable]");h&&(window.Sortable.utils.on(h,"start",()=>{h.classList.add("sorting")}),window.Sortable.utils.on(h,"end",()=>{h.classList.remove("sorting")})),this.$watch("state",(m,b)=>{typeof m<"u"&&((0,kS.isEqual)(b,Alpine.raw(m))||this.updateEditorContent(m))})},initEditor(f){if(!this.$el.querySelector(".tiptap")){let h=this;d=new Ql({element:h.$refs.element,extensions:h.getExtensions(),editable:!h.disabled,content:f,editorProps:{handlePaste(m,b,y){y.content.descendants(v=>{v.type.name==="tiptapBlock"&&(v.attrs.statePath=h.statePath,v.attrs.data=JSON.parse(v.attrs.data))})}},onUpdate({editor:m}){h.state=m.isEmpty?null:m.getJSON(),h.updatedAt=Date.now()},onSelectionUpdate(){h.updatedAt=Date.now()},onBlur(){h.updatedAt=Date.now()},onFocus(){h.updatedAt=Date.now()}})}},isActive(f,h={}){return d.isActive(f,h)},editor(){return d},blur(){let f=this.$el.querySelectorAll("[data-tippy-content]");f&&f.forEach(h=>h.destroy()),this.updatedAt=Date.now()},updateEditorContent(f){if(d.isEditable){let{from:h,to:m}=d.state.selection;d.commands.setContent(f,!0),d.chain().focus().setTextSelection({from:h,to:m}).run()}},refreshEditorContent(){this.$nextTick(()=>this.updateEditorContent(this.state))},updateLocale(f){this.locale=f.detail.locale},insertContent(f){if(f.detail.statePath===this.statePath)switch(f.detail.type){case"media":this.insertMedia(f);return;case"video":this.insertVideo(f);return;case"link":this.insertLink(f);return;case"source":this.insertSource(f);return;case"grid":this.insertGridBuilder(f);return;default:return}},insertMedia(f){Array.isArray(f.detail.media)?f.detail.media.forEach(h=>{this.executeMediaInsert(h)}):this.executeMediaInsert(f.detail.media)},executeMediaInsert(f=null){if(!(!f||f?.url===null)&&f){let h=f?.url||f?.src,m=["jpg","jpeg","svg","png","webp","gif","avif","jxl","heic"],y=/.*\.([a-zA-Z]*)\??/.exec(h.toLowerCase());y!==null&&m.includes(y[1])?d.chain().focus().setImage({src:h,alt:f?.alt,title:f?.title,width:f?.width,height:f?.height,lazy:f?.lazy}).run():d.chain().focus().extendMarkRange("link").setLink({href:h}).insertContent(f?.link_text).run()}},insertVideo(f){let h=f.detail.video;if(!h||h.url===null)return;let m={src:h.url,width:h.responsive?h.width*100:h.width,height:h.responsive?h.height*100:h.height,responsive:h.responsive??!0,"data-aspect-width":h.width,"data-aspect-height":h.height};h.url.includes("youtube")||h.url.includes("youtu.be")?d.chain().focus().setYoutubeVideo({...m,controls:h.youtube_options.includes("controls"),nocookie:h.youtube_options.includes("nocookie"),start:h.start_at??0}).run():h.url.includes("vimeo")?d.chain().focus().setVimeoVideo({...m,autoplay:h.vimeo_options.includes("autoplay"),loop:h.vimeo_options.includes("loop"),title:h.vimeo_options.includes("show_title"),byline:h.vimeo_options.includes("byline"),portrait:h.vimeo_options.includes("portrait")}).run():d.chain().focus().setVideo({...m,autoplay:h.native_options.includes("autoplay"),loop:h.native_options.includes("loop"),controls:h.native_options.includes("controls")}).run()},insertLink(f){let h=f.detail;if(!(h.href===null&&h.id===null)){if(h.href===""&&h.id===null){this.unsetLink();return}d.chain().focus().setTextSelection({from:h.coordinates[0].$from.pos,to:h.coordinates[0].$to.pos}).setLink({href:h.href,id:h.id??null,target:h.target??null,hreflang:h.hreflang??null,rel:h.rel??null,referrerpolicy:h.referrerpolicy??null,as_button:h.as_button??null,button_theme:h.button_theme??null}).selectTextblockEnd().run()}},unsetLink(){d.chain().focus().extendMarkRange("link").unsetLink().selectTextblockEnd().run()},insertSource(f){this.updateEditorContent(f.detail.source)},insertGridBuilder(f){let h=f.detail.data,m="responsive",b=parseInt(h.asymmetric_left)??null,y=parseInt(h.asymmetric_right)??null;h.fixed&&(m="fixed"),h.asymmetric&&(m="asymmetric"),d.chain().focus().insertGridBuilder({cols:h.columns,type:m,stackAt:h.stack_at,asymmetricLeft:b,asymmetricRight:y}).run()},insertBlock(f){f.detail.statePath===this.statePath&&(d.commands.insertBlock({type:f.detail.type,statePath:f.detail.statePath,data:f.detail.data,preview:f.detail.preview,label:f.detail.label,coordinates:f.detail.coordinates}),d.isFocused||d.commands.focus())},insertMergeTag(f){d.commands.insertMergeTag({tag:f.detail.tag,coordinates:f.detail.coordinates}),d.isFocused||d.commands.focus()},openBlockSettings(f){f.detail.statePath===this.statePath&&this.$wire.dispatchFormEvent("tiptap::updateBlock",this.statePath,f.detail)},updateBlock(f){f.detail.statePath===this.statePath&&(d.commands.updateBlock({type:f.detail.type,statePath:f.detail.statePath,data:f.detail.data,preview:f.detail.preview,label:f.detail.label,coordinates:f.detail.coordinates}),d.isFocused||d.commands.focus())},deleteBlock(){d.commands.removeBlock()}}}export{JH as default}; /*! Bundled license information: lodash/lodash.js: diff --git a/resources/views/components/results-tables/lists.blade.php b/resources/views/components/results-tables/lists.blade.php new file mode 100644 index 0000000..c01aafe --- /dev/null +++ b/resources/views/components/results-tables/lists.blade.php @@ -0,0 +1,133 @@ +@php + $votablesWithMandates = $votablesWithMandates(); + $votablesWithoutMandates = $votablesWithoutMandates(); +@endphp + +
+
+

Partide care au îndeplinit pragul electoral

+ + + + + + Candidat + + + + Voturi + + + + % + + + + Mandate + + + + + @foreach ($votablesWithMandates as $votable) + + + + + + + + + + + {{ $votable['name'] }} + + + + {{ Number::format($votable['votes']) }} + + + + {{ Number::percentage($votable['percent'], 2) }} + + + + {{ $votable['mandates'] }} + + + @endforeach + + + @if ($votablesWithMandates->count() > 5) + + + + + + @endif + + + +
+ +
+

Partide care nu au îndeplinit pragul electoral

+ + + + + + Candidat + + + + Voturi + + + + % + + + + + @foreach ($votablesWithoutMandates as $votable) + + + + + + + + + + + {{ $votable['name'] }} + + + + {{ Number::format($votable['votes']) }} + + + + {{ Number::percentage($votable['percent'], 2) }} + + + @endforeach + + + @if ($votablesWithoutMandates->count() > 5) + + + + + + @endif + + +
+
diff --git a/resources/views/components/candidates/results-table.blade.php b/resources/views/components/results-tables/simple.blade.php similarity index 57% rename from resources/views/components/candidates/results-table.blade.php rename to resources/views/components/results-tables/simple.blade.php index 17ba074..3a034ab 100644 --- a/resources/views/components/candidates/results-table.blade.php +++ b/resources/views/components/results-tables/simple.blade.php @@ -1,10 +1,8 @@ -@props(['items']) - - - Partid / Alianță / Candidat independent + + Candidat @@ -17,30 +15,34 @@ - @foreach ($items as $item) - - - + @foreach ($votables as $votable) + + + + + + + - {{ $item['name'] }} + {{ $votable['name'] }} - {{ Number::format($item['votes']) }} + {{ Number::format($votable['votes']) }} - {{ Number::percentage($item['percent'], 2) }} + {{ Number::percentage($votable['percent'], 2) }} @endforeach - @if ($this->aggregate->count() > 5) + @if ($votables->count() > 5) - +
diff --git a/resources/views/livewire/pages/election-results.blade.php b/resources/views/livewire/pages/election-results.blade.php index 916126b..9ec3a9b 100644 --- a/resources/views/livewire/pages/election-results.blade.php +++ b/resources/views/livewire/pages/election-results.blade.php @@ -41,9 +41,9 @@ @endif - @if (filled($this->aggregate)) - - @endif + + +