@moontra/moonui-pro 0.1.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,453 +1,159 @@
1
- // src/index.ts
2
- export * from "@moontra/moonui";
1
+ import Mn, { forwardRef, createContext, useState, useRef, useMemo, useCallback, useEffect, useContext, useDebugValue, useLayoutEffect } from 'react';
2
+ import { ResponsiveContainer, ScatterChart, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Scatter, PieChart, Pie, Cell, AreaChart, Area, ReferenceLine, Brush, BarChart, Bar, LineChart, Line, ReferenceArea } from 'recharts';
3
+ import { Card, cn, CardContent, Button, CardHeader, CardTitle, CardDescription, Badge, Input, Progress, Avatar, AvatarImage, AvatarFallback, toast, TooltipProvider, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, Popover, PopoverTrigger, PopoverContent, Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, Label, DropdownMenuSeparator, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Slider, ColorPicker, Textarea, DialogFooter, Tooltip as Tooltip$1, TooltipTrigger, TooltipContent } from '@moontra/moonui';
4
+ import { CheckCircle2, AlertCircle, XCircle, Circle, Clock, Lock, Sparkles, RefreshCw, TrendingUp, TrendingDown, Minus, Settings, Download, Maximize2, Calendar, ChevronLeft, ChevronRight, Edit, Trash2, MapPin, User, Plus, Users, DollarSign, Activity, Star, Search, Filter, ArrowUp, ArrowDown, ArrowUpDown, ChevronsLeft, ChevronsRight, Upload, Loader2, X, MoreHorizontal, GripVertical, MessageCircle, Paperclip, Bold, Italic, Underline, Strikethrough, Code, Type, ChevronDown, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, CheckSquare, Quote, Palette, Highlighter, Link2, Image, Table, Undo, Redo, Eye, Wand2, Maximize, FileText, Check, Languages, BarChart3, Video, Music, Archive, File, ExternalLink, ArrowDownRight, ArrowUpRight } from 'lucide-react';
5
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
6
+ import { useReactTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, flexRender } from '@tanstack/react-table';
7
+ import cC from 'react-dom';
3
8
 
4
- // src/components/data-table/index.tsx
5
- import React from "react";
6
- import {
7
- useReactTable,
8
- getCoreRowModel,
9
- getFilteredRowModel,
10
- getPaginationRowModel,
11
- getSortedRowModel,
12
- flexRender
13
- } from "@tanstack/react-table";
14
- import { Button } from "@moontra/moonui";
15
- import { Input } from "@moontra/moonui";
16
- import {
17
- ChevronLeft,
18
- ChevronRight,
19
- ChevronsLeft,
20
- ChevronsRight,
21
- ArrowUpDown,
22
- ArrowUp,
23
- ArrowDown,
24
- Search,
25
- Filter,
26
- Download,
27
- Settings
28
- } from "lucide-react";
29
- import { cn } from "@moontra/moonui";
30
- import { jsx, jsxs } from "react/jsx-runtime";
31
- function DataTable({
32
- columns,
33
- data,
34
- searchable = true,
35
- filterable = true,
36
- exportable = true,
37
- selectable = false,
38
- pagination = true,
39
- pageSize = 10,
40
- className,
41
- onRowSelect,
42
- onExport
43
- }) {
44
- const [sorting, setSorting] = React.useState([]);
45
- const [columnFilters, setColumnFilters] = React.useState([]);
46
- const [columnVisibility, setColumnVisibility] = React.useState({});
47
- const [rowSelection, setRowSelection] = React.useState({});
48
- const [globalFilter, setGlobalFilter] = React.useState("");
49
- const table = useReactTable({
50
- data,
51
- columns,
52
- onSortingChange: setSorting,
53
- onColumnFiltersChange: setColumnFilters,
54
- getCoreRowModel: getCoreRowModel(),
55
- getPaginationRowModel: getPaginationRowModel(),
56
- getSortedRowModel: getSortedRowModel(),
57
- getFilteredRowModel: getFilteredRowModel(),
58
- onColumnVisibilityChange: setColumnVisibility,
59
- onRowSelectionChange: setRowSelection,
60
- onGlobalFilterChange: setGlobalFilter,
61
- globalFilterFn: "includesString",
62
- state: {
63
- sorting,
64
- columnFilters,
65
- columnVisibility,
66
- rowSelection,
67
- globalFilter
68
- },
69
- initialState: {
70
- pagination: {
71
- pageSize
72
- }
73
- }
74
- });
75
- React.useEffect(() => {
76
- if (onRowSelect && selectable) {
77
- const selectedRows = table.getFilteredSelectedRowModel().rows.map((row) => row.original);
78
- onRowSelect(selectedRows);
79
- }
80
- }, [rowSelection, onRowSelect, selectable, table]);
81
- const handleExport = () => {
82
- if (onExport) {
83
- const selectedRows = table.getFilteredSelectedRowModel().rows;
84
- const dataToExport = selectedRows.length > 0 ? selectedRows.map((row) => row.original) : table.getFilteredRowModel().rows.map((row) => row.original);
85
- onExport(dataToExport);
86
- }
87
- };
88
- return /* @__PURE__ */ jsxs("div", { className: cn("space-y-4", className), children: [
89
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
90
- /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
91
- searchable && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
92
- /* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
93
- /* @__PURE__ */ jsx(
94
- Input,
95
- {
96
- placeholder: "Search all columns...",
97
- value: globalFilter,
98
- onChange: (e) => setGlobalFilter(e.target.value),
99
- className: "pl-8 w-64"
100
- }
101
- )
102
- ] }),
103
- filterable && /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", children: [
104
- /* @__PURE__ */ jsx(Filter, { className: "mr-2 h-4 w-4" }),
105
- "Filters"
106
- ] })
107
- ] }),
108
- /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
109
- exportable && /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", onClick: handleExport, children: [
110
- /* @__PURE__ */ jsx(Download, { className: "mr-2 h-4 w-4" }),
111
- "Export"
112
- ] }),
113
- /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", children: [
114
- /* @__PURE__ */ jsx(Settings, { className: "mr-2 h-4 w-4" }),
115
- "Columns"
116
- ] })
117
- ] })
118
- ] }),
119
- /* @__PURE__ */ jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs("table", { className: "w-full", children: [
120
- /* @__PURE__ */ jsx("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", { className: "border-b", children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(
121
- "th",
122
- {
123
- className: "h-12 px-4 text-left align-middle font-medium text-muted-foreground",
124
- children: header.isPlaceholder ? null : /* @__PURE__ */ jsxs(
125
- "div",
126
- {
127
- className: cn(
128
- "flex items-center space-x-2",
129
- header.column.getCanSort() && "cursor-pointer select-none"
130
- ),
131
- onClick: header.column.getToggleSortingHandler(),
132
- children: [
133
- flexRender(header.column.columnDef.header, header.getContext()),
134
- header.column.getCanSort() && /* @__PURE__ */ jsx("div", { className: "ml-2", children: header.column.getIsSorted() === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { className: "h-4 w-4" }) : header.column.getIsSorted() === "desc" ? /* @__PURE__ */ jsx(ArrowDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ArrowUpDown, { className: "h-4 w-4" }) })
135
- ]
136
- }
137
- )
138
- },
139
- header.id
140
- )) }, headerGroup.id)) }),
141
- /* @__PURE__ */ jsx("tbody", { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(
142
- "tr",
143
- {
144
- className: cn(
145
- "border-b transition-colors hover:bg-muted/50",
146
- row.getIsSelected() && "bg-muted"
147
- ),
148
- children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx("td", { className: "p-4 align-middle", children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
149
- },
150
- row.id
151
- )) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columns.length, className: "h-24 text-center", children: "No results found." }) }) })
152
- ] }) }),
153
- pagination && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-2", children: [
154
- /* @__PURE__ */ jsx("div", { className: "flex-1 text-sm text-muted-foreground", children: selectable && table.getFilteredSelectedRowModel().rows.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
155
- table.getFilteredSelectedRowModel().rows.length,
156
- " of",
157
- " ",
158
- table.getFilteredRowModel().rows.length,
159
- " row(s) selected."
160
- ] }) }),
161
- /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
162
- /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
163
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Rows per page" }),
164
- /* @__PURE__ */ jsx(
165
- "select",
166
- {
167
- value: table.getState().pagination.pageSize,
168
- onChange: (e) => table.setPageSize(Number(e.target.value)),
169
- className: "h-8 w-[70px] rounded border border-input bg-background px-3 py-1 text-sm",
170
- children: [10, 20, 30, 40, 50].map((pageSize2) => /* @__PURE__ */ jsx("option", { value: pageSize2, children: pageSize2 }, pageSize2))
171
- }
172
- )
173
- ] }),
174
- /* @__PURE__ */ jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
175
- "Page ",
176
- table.getState().pagination.pageIndex + 1,
177
- " of",
178
- " ",
179
- table.getPageCount()
180
- ] }),
181
- /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
182
- /* @__PURE__ */ jsx(
183
- Button,
184
- {
185
- variant: "outline",
186
- className: "hidden h-8 w-8 p-0 lg:flex",
187
- onClick: () => table.setPageIndex(0),
188
- disabled: !table.getCanPreviousPage(),
189
- children: /* @__PURE__ */ jsx(ChevronsLeft, { className: "h-4 w-4" })
190
- }
191
- ),
192
- /* @__PURE__ */ jsx(
193
- Button,
194
- {
195
- variant: "outline",
196
- className: "h-8 w-8 p-0",
197
- onClick: () => table.previousPage(),
198
- disabled: !table.getCanPreviousPage(),
199
- children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
200
- }
201
- ),
202
- /* @__PURE__ */ jsx(
203
- Button,
204
- {
205
- variant: "outline",
206
- className: "h-8 w-8 p-0",
207
- onClick: () => table.nextPage(),
208
- disabled: !table.getCanNextPage(),
209
- children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
210
- }
211
- ),
212
- /* @__PURE__ */ jsx(
213
- Button,
214
- {
215
- variant: "outline",
216
- className: "hidden h-8 w-8 p-0 lg:flex",
217
- onClick: () => table.setPageIndex(table.getPageCount() - 1),
218
- disabled: !table.getCanNextPage(),
219
- children: /* @__PURE__ */ jsx(ChevronsRight, { className: "h-4 w-4" })
220
- }
221
- )
222
- ] })
223
- ] })
224
- ] })
225
- ] });
9
+ /**
10
+ * @moontra/moonui-pro v1.0.0
11
+ * Premium UI components for MoonUI
12
+ * (c) 2025 MoonUI. All rights reserved.
13
+ * @license Commercial - https://moonui.dev/license
14
+ */
15
+ var ny=Object.create;var Ad=Object.defineProperty;var ry=Object.getOwnPropertyDescriptor;var iy=Object.getOwnPropertyNames;var oy=Object.getPrototypeOf,sy=Object.prototype.hasOwnProperty;var lo=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var _n=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ay=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of iy(e))!sy.call(t,i)&&i!==n&&Ad(t,i,{get:()=>e[i],enumerable:!(r=ry(e,i))||r.enumerable});return t};var ai=(t,e,n)=>(n=t!=null?ny(oy(t)):{},ay(e||!t||!t.__esModule?Ad(n,"default",{value:t,enumerable:!0}):n,t));var eu=_n(Qd=>{var _r=lo("react");function OE(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var RE=typeof Object.is=="function"?Object.is:OE,DE=_r.useState,IE=_r.useEffect,LE=_r.useLayoutEffect,PE=_r.useDebugValue;function BE(t,e){var n=e(),r=DE({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return LE(function(){i.value=n,i.getSnapshot=e,Oa(i)&&o({inst:i});},[t,n,e]),IE(function(){return Oa(i)&&o({inst:i}),t(function(){Oa(i)&&o({inst:i});})},[t]),PE(n),n}function Oa(t){var e=t.getSnapshot;t=t.value;try{var n=e();return !RE(t,n)}catch{return !0}}function zE(t,e){return e()}var FE=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?zE:BE;Qd.useSyncExternalStore=_r.useSyncExternalStore!==void 0?_r.useSyncExternalStore:FE;});var nu=_n(tu=>{process.env.NODE_ENV!=="production"&&function(){function t(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}function e(p,h){d||i.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=h();if(!u){var g=h();o(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0);}g=s({inst:{value:m,getSnapshot:h}});var b=g[0].inst,v=g[1];return l(function(){b.value=m,b.getSnapshot=h,n(b)&&v({inst:b});},[p,m,h]),a(function(){return n(b)&&v({inst:b}),p(function(){n(b)&&v({inst:b});})},[p]),c(m),m}function n(p){var h=p.getSnapshot;p=p.value;try{var m=h();return !o(p,m)}catch{return !0}}function r(p,h){return h()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=lo("react"),o=typeof Object.is=="function"?Object.is:t,s=i.useState,a=i.useEffect,l=i.useLayoutEffect,c=i.useDebugValue,d=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;tu.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());}();});var fi=_n((J1,Ra)=>{process.env.NODE_ENV==="production"?Ra.exports=eu():Ra.exports=nu();});var uh=_n((QR,dh)=>{dh.exports=function t(e,n){if(e===n)return !0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return !1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=n.length)return !1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return !1;return !0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return !1;for(i of e.entries())if(!n.has(i[0]))return !1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return !1;return !0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return !1;for(i of e.entries())if(!n.has(i[0]))return !1;return !0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return !1;for(i=r;i--!==0;)if(e[i]!==n[i])return !1;return !0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return !1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return !1;for(i=r;i--!==0;){var s=o[i];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return !1}return !0}return e!==e&&n!==n};});var ph=_n(fh=>{var es=lo("react"),QS=fi();function eC(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var tC=typeof Object.is=="function"?Object.is:eC,nC=QS.useSyncExternalStore,rC=es.useRef,iC=es.useEffect,oC=es.useMemo,sC=es.useDebugValue;fh.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=rC(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s;}else s=o.current;o=oC(function(){function l(p){if(!c){if(c=!0,d=p,p=r(p),i!==void 0&&s.hasValue){var h=s.value;if(i(h,p))return u=h}return u=p}if(h=u,tC(d,p))return h;var m=r(p);return i!==void 0&&i(h,m)?(d=p,h):(d=p,u=m)}var c=!1,d,u,f=n===void 0?null:n;return [function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,n,r,i]);var a=nC(t,o[0],o[1]);return iC(function(){s.hasValue=!0,s.value=a;},[a]),sC(a),a};});var mh=_n(hh=>{process.env.NODE_ENV!=="production"&&function(){function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=lo("react"),n=fi(),r=typeof Object.is=="function"?Object.is:t,i=n.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;hh.useSyncExternalStoreWithSelector=function(c,d,u,f,p){var h=o(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m;}else m=h.current;h=a(function(){function b(I){if(!v){if(v=!0,S=I,I=f(I),p!==void 0&&m.hasValue){var k=m.value;if(p(k,I))return T=k}return T=I}if(k=T,r(S,I))return k;var y=f(I);return p!==void 0&&p(k,y)?(S=I,k):(S=I,T=y)}var v=!1,S,T,_=u===void 0?null:u;return [function(){return b(d())},_===null?void 0:function(){return b(_())}]},[d,u,f,p]);var g=i(c,h[0],h[1]);return s(function(){m.hasValue=!0,m.value=g;},[g]),l(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());}();});var gh=_n((nD,sc)=>{process.env.NODE_ENV==="production"?sc.exports=ph():sc.exports=mh();});var _g=_n((EB,Tg)=>{function mg(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)&&mg(n);}),t}var Qs=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1;}ignoreMatch(){this.isMatchIgnored=!0;}};function gg(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Vn(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 hT="</span>",cg=t=>!!t.scope,mT=(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}`},ud=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this);}addText(e){this.buffer+=gg(e);}openNode(e){if(!cg(e))return;let n=mT(e.scope,{prefix:this.classPrefix});this.span(n);}closeNode(e){cg(e)&&(this.buffer+=hT);}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`;}},dg=(t={})=>{let e={children:[]};return Object.assign(e,t),e},Xi=class{constructor(){this.rootNode=dg(),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=dg({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=>{Xi._collapse(n);}));}},fd=class extends Xi{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 ud(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Qi(t){return t?typeof t=="string"?t:t.source:null}function bg(t){return Er("(?=",t,")")}function gT(t){return Er("(?:",t,")*")}function bT(t){return Er("(?:",t,")?")}function Er(...t){return t.map(n=>Qi(n)).join("")}function yT(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function hd(...t){return "("+(yT(t).capture?"":"?:")+t.map(r=>Qi(r)).join("|")+")"}function yg(t){return new RegExp(t.toString()+"|").exec("").length-1}function ET(t,e){let n=t&&t.exec(e);return n&&n.index===0}var vT=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function md(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,o=Qi(r),s="";for(;o.length>0;){let a=vT.exec(o);if(!a){s+=o;break}s+=o.substring(0,a.index),o=o.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+i):(s+=a[0],a[0]==="("&&n++);}return s}).map(r=>`(${r})`).join(e)}var wT=/\b\B/,Eg="[a-zA-Z]\\w*",gd="[a-zA-Z_]\\w*",vg="\\b\\d+(\\.\\d+)?",wg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",xg="\\b(0b[01]+)",xT="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ST=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=Er(e,/.*\b/,t.binary,/\b.*/)),Vn({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch();}},t)},eo={begin:"\\\\[\\s\\S]",relevance:0},CT={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[eo]},kT={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[eo]},NT={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/},ta=function(t,e,n={}){let r=Vn({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=hd("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:Er(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},TT=ta("//","$"),_T=ta("/\\*","\\*/"),MT=ta("#","$"),AT={scope:"number",begin:vg,relevance:0},OT={scope:"number",begin:wg,relevance:0},RT={scope:"number",begin:xg,relevance:0},DT={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[eo,{begin:/\[/,end:/\]/,relevance:0,contains:[eo]}]},IT={scope:"title",begin:Eg,relevance:0},LT={scope:"title",begin:gd,relevance:0},PT={begin:"\\.\\s*"+gd,relevance:0},BT=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();}})},Xs=Object.freeze({__proto__:null,APOS_STRING_MODE:CT,BACKSLASH_ESCAPE:eo,BINARY_NUMBER_MODE:RT,BINARY_NUMBER_RE:xg,COMMENT:ta,C_BLOCK_COMMENT_MODE:_T,C_LINE_COMMENT_MODE:TT,C_NUMBER_MODE:OT,C_NUMBER_RE:wg,END_SAME_AS_BEGIN:BT,HASH_COMMENT_MODE:MT,IDENT_RE:Eg,MATCH_NOTHING_RE:wT,METHOD_GUARD:PT,NUMBER_MODE:AT,NUMBER_RE:vg,PHRASAL_WORDS_MODE:NT,QUOTE_STRING_MODE:kT,REGEXP_MODE:DT,RE_STARTERS_RE:xT,SHEBANG:ST,TITLE_MODE:IT,UNDERSCORE_IDENT_RE:gd,UNDERSCORE_TITLE_MODE:LT});function zT(t,e){t.input[t.index-1]==="."&&e.ignoreMatch();}function FT(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className);}function UT(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=zT,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0));}function HT(t,e){Array.isArray(t.illegal)&&(t.illegal=hd(...t.illegal));}function $T(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 KT(t,e){t.relevance===void 0&&(t.relevance=1);}var VT=(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=Er(n.beforeMatch,bg(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch;},WT=["of","and","for","in","not","or","if","then","parent","list","value"],GT="keyword";function Sg(t,e,n=GT){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,Sg(t[o],e,o));}),r;function i(o,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){let l=a.split("|");r[l[0]]=[o,qT(l[0],l[1])];});}}function qT(t,e){return e?Number(e):jT(t)?0:1}function jT(t){return WT.includes(t.toLowerCase())}var ug={},yr=t=>{console.error(t);},fg=(t,...e)=>{console.log(`WARN: ${t}`,...e);},Qr=(t,e)=>{ug[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),ug[`${t}/${e}`]=!0);},ea=new Error;function Cg(t,e,{key:n}){let r=0,i=t[n],o={},s={};for(let a=1;a<=e.length;a++)s[a+r]=i[a],o[a+r]=!0,r+=yg(e[a-1]);t[n]=s,t[n]._emit=o,t[n]._multi=!0;}function JT(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw yr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ea;if(typeof t.beginScope!="object"||t.beginScope===null)throw yr("beginScope must be object"),ea;Cg(t,t.begin,{key:"beginScope"}),t.begin=md(t.begin,{joinWith:""});}}function YT(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw yr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ea;if(typeof t.endScope!="object"||t.endScope===null)throw yr("endScope must be object"),ea;Cg(t,t.end,{key:"endScope"}),t.end=md(t.end,{joinWith:""});}}function ZT(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope);}function XT(t){ZT(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),JT(t),YT(t);}function QT(t){function e(s,a){return new RegExp(Qi(s),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0;}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=yg(a)+1;}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(md(a,{joinWith:"|"}),!0),this.lastIndex=0;}exec(a){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(a);if(!l)return null;let c=l.findIndex((u,f)=>f>0&&u!==void 0),d=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0;}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];let l=new n;return this.rules.slice(a).forEach(([c,d])=>l.addRule(c,d)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0;}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++;}exec(a){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){let d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,c=d.exec(a);}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(s){let a=new r;return s.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function o(s,a){let l=s;if(s.isCompiled)return l;[FT,$T,XT,VT].forEach(d=>d(s,a)),t.compilerExtensions.forEach(d=>d(s,a)),s.__beforeBegin=null,[UT,HT,KT].forEach(d=>d(s,a)),s.isCompiled=!0;let c=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),c=s.keywords.$pattern,delete s.keywords.$pattern),c=c||/\w+/,s.keywords&&(s.keywords=Sg(s.keywords,t.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(s.begin||(s.begin=/\B|\b/),l.beginRe=e(l.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(l.endRe=e(l.end)),l.terminatorEnd=Qi(l.end)||"",s.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(l.illegalRe=e(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(d){return e_(d==="self"?s:d)})),s.contains.forEach(function(d){o(d,l);}),s.starts&&o(s.starts,a),l.matcher=i(l),l}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=Vn(t.classNameAliases||{}),o(t)}function kg(t){return t?t.endsWithParent||kg(t.starts):!1}function e_(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Vn(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:kg(t)?Vn(t,{starts:t.starts?Vn(t.starts):null}):Object.isFrozen(t)?Vn(t):t}var t_="11.11.1",pd=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n;}},dd=gg,pg=Vn,hg=Symbol("nomatch"),n_=7,Ng=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:[]},a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:fd};function l(x){return a.noHighlightRe.test(x)}function c(x){let C=x.className+" ";C+=x.parentNode?x.parentNode.className:"";let M=a.languageDetectRe.exec(C);if(M){let U=y(M[1]);return U||(fg(o.replace("{}",M[1])),fg("Falling back to no-highlight mode for this block.",x)),U?M[1]:"no-highlight"}return C.split(/\s+/).find(U=>l(U)||y(U))}function d(x,C,M){let U="",z="";typeof C=="object"?(U=x,M=C.ignoreIllegals,z=C.language):(Qr("10.7.0","highlight(lang, code, ...args) has been deprecated."),Qr("10.7.0",`Please use highlight(code, options) instead.
16
+ https://github.com/highlightjs/highlight.js/issues/2277`),z=x,U=C),M===void 0&&(M=!0);let J={code:U,language:z};Q("before:highlight",J);let ie=J.result?J.result:u(J.language,J.code,M);return ie.code=J.code,Q("after:highlight",ie),ie}function u(x,C,M,U){let z=Object.create(null);function J(D,K){return D.keywords[K]}function ie(){if(!A.keywords){de.addText(Y);return}let D=0;A.keywordPatternRe.lastIndex=0;let K=A.keywordPatternRe.exec(Y),ue="";for(;K;){ue+=Y.substring(D,K.index);let we=ot.case_insensitive?K[0].toLowerCase():K[0],Je=J(A,we);if(Je){let[Ht,Qe]=Je;if(de.addText(ue),ue="",z[we]=(z[we]||0)+1,z[we]<=n_&&(st+=Qe),Ht.startsWith("_"))ue+=K[0];else {let dn=ot.classNameAliases[Ht]||Ht;_e(K[0],dn);}}else ue+=K[0];D=A.keywordPatternRe.lastIndex,K=A.keywordPatternRe.exec(Y);}ue+=Y.substring(D),de.addText(ue);}function $(){if(Y==="")return;let D=null;if(typeof A.subLanguage=="string"){if(!e[A.subLanguage]){de.addText(Y);return}D=u(A.subLanguage,Y,!0,ee[A.subLanguage]),ee[A.subLanguage]=D._top;}else D=p(Y,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(st+=D.relevance),de.__addSublanguage(D._emitter,D.language);}function ae(){A.subLanguage!=null?$():ie(),Y="";}function _e(D,K){D!==""&&(de.startScope(K),de.addText(D),de.endScope());}function $e(D,K){let ue=1,we=K.length-1;for(;ue<=we;){if(!D._emit[ue]){ue++;continue}let Je=ot.classNameAliases[D[ue]]||D[ue],Ht=K[ue];Je?_e(Ht,Je):(Y=Ht,ie(),Y=""),ue++;}}function it(D,K){return D.scope&&typeof D.scope=="string"&&de.openNode(ot.classNameAliases[D.scope]||D.scope),D.beginScope&&(D.beginScope._wrap?(_e(Y,ot.classNameAliases[D.beginScope._wrap]||D.beginScope._wrap),Y=""):D.beginScope._multi&&($e(D.beginScope,K),Y="")),A=Object.create(D,{parent:{value:A}}),A}function ln(D,K,ue){let we=ET(D.endRe,ue);if(we){if(D["on:end"]){let Je=new Qs(D);D["on:end"](K,Je),Je.isMatchIgnored&&(we=!1);}if(we){for(;D.endsParent&&D.parent;)D=D.parent;return D}}if(D.endsWithParent)return ln(D.parent,K,ue)}function ht(D){return A.matcher.regexIndex===0?(Y+=D[0],1):(F=!0,0)}function Wt(D){let K=D[0],ue=D.rule,we=new Qs(ue),Je=[ue.__beforeBegin,ue["on:begin"]];for(let Ht of Je)if(Ht&&(Ht(D,we),we.isMatchIgnored))return ht(K);return ue.skip?Y+=K:(ue.excludeBegin&&(Y+=K),ae(),!ue.returnBegin&&!ue.excludeBegin&&(Y=K)),it(ue,D),ue.returnBegin?0:K.length}function mt(D){let K=D[0],ue=C.substring(D.index),we=ln(A,D,ue);if(!we)return hg;let Je=A;A.endScope&&A.endScope._wrap?(ae(),_e(K,A.endScope._wrap)):A.endScope&&A.endScope._multi?(ae(),$e(A.endScope,D)):Je.skip?Y+=K:(Je.returnEnd||Je.excludeEnd||(Y+=K),ae(),Je.excludeEnd&&(Y=K));do A.scope&&de.closeNode(),!A.skip&&!A.subLanguage&&(st+=A.relevance),A=A.parent;while(A!==we.parent);return we.starts&&it(we.starts,D),Je.returnEnd?0:K.length}function jn(){let D=[];for(let K=A;K!==ot;K=K.parent)K.scope&&D.unshift(K.scope);D.forEach(K=>de.openNode(K));}let Ut={};function cn(D,K){let ue=K&&K[0];if(Y+=D,ue==null)return ae(),0;if(Ut.type==="begin"&&K.type==="end"&&Ut.index===K.index&&ue===""){if(Y+=C.slice(K.index,K.index+1),!i){let we=new Error(`0 width match regex (${x})`);throw we.languageName=x,we.badRule=Ut.rule,we}return 1}if(Ut=K,K.type==="begin")return Wt(K);if(K.type==="illegal"&&!M){let we=new Error('Illegal lexeme "'+ue+'" for mode "'+(A.scope||"<unnamed>")+'"');throw we.mode=A,we}else if(K.type==="end"){let we=mt(K);if(we!==hg)return we}if(K.type==="illegal"&&ue==="")return Y+=`
17
+ `,1;if(si>1e5&&si>K.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Y+=ue,ue.length}let ot=y(x);if(!ot)throw yr(o.replace("{}",x)),new Error('Unknown language: "'+x+'"');let ve=QT(ot),Nt="",A=U||ve,ee={},de=new a.__emitter(a);jn();let Y="",st=0,Tt=0,si=0,F=!1;try{if(ot.__emitTokens)ot.__emitTokens(C,de);else {for(A.matcher.considerAll();;){si++,F?F=!1:A.matcher.considerAll(),A.matcher.lastIndex=Tt;let D=A.matcher.exec(C);if(!D)break;let K=C.substring(Tt,D.index),ue=cn(K,D);Tt=D.index+ue;}cn(C.substring(Tt));}return de.finalize(),Nt=de.toHTML(),{language:x,value:Nt,relevance:st,illegal:!1,_emitter:de,_top:A}}catch(D){if(D.message&&D.message.includes("Illegal"))return {language:x,value:dd(C),illegal:!0,relevance:0,_illegalBy:{message:D.message,index:Tt,context:C.slice(Tt-100,Tt+100),mode:D.mode,resultSoFar:Nt},_emitter:de};if(i)return {language:x,value:dd(C),illegal:!1,relevance:0,errorRaised:D,_emitter:de,_top:A};throw D}}function f(x){let C={value:dd(x),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return C._emitter.addText(x),C}function p(x,C){C=C||a.languages||Object.keys(e);let M=f(x),U=C.filter(y).filter(O).map(ae=>u(ae,x,!1));U.unshift(M);let z=U.sort((ae,_e)=>{if(ae.relevance!==_e.relevance)return _e.relevance-ae.relevance;if(ae.language&&_e.language){if(y(ae.language).supersetOf===_e.language)return 1;if(y(_e.language).supersetOf===ae.language)return -1}return 0}),[J,ie]=z,$=J;return $.secondBest=ie,$}function h(x,C,M){let U=C&&n[C]||M;x.classList.add("hljs"),x.classList.add(`language-${U}`);}function m(x){let C=null,M=c(x);if(l(M))return;if(Q("before:highlightElement",{el:x,language:M}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(a.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(x)),a.throwUnescapedHTML))throw new pd("One of your code blocks includes unescaped HTML.",x.innerHTML);C=x;let U=C.textContent,z=M?d(U,{language:M,ignoreIllegals:!0}):p(U);x.innerHTML=z.value,x.dataset.highlighted="yes",h(x,M,z.language),x.result={language:z.language,re:z.relevance,relevance:z.relevance},z.secondBest&&(x.secondBest={language:z.secondBest.language,relevance:z.secondBest.relevance}),Q("after:highlightElement",{el:x,result:z,text:U});}function g(x){a=pg(a,x);}let b=()=>{T(),Qr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.");};function v(){T(),Qr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.");}let S=!1;function T(){function x(){T();}if(document.readyState==="loading"){S||window.addEventListener("DOMContentLoaded",x,!1),S=!0;return}document.querySelectorAll(a.cssSelector).forEach(m);}function _(x,C){let M=null;try{M=C(t);}catch(U){if(yr("Language definition for '{}' could not be registered.".replace("{}",x)),i)yr(U);else throw U;M=s;}M.name||(M.name=x),e[x]=M,M.rawDefinition=C.bind(null,t),M.aliases&&w(M.aliases,{languageName:x});}function I(x){delete e[x];for(let C of Object.keys(n))n[C]===x&&delete n[C];}function k(){return Object.keys(e)}function y(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function w(x,{languageName:C}){typeof x=="string"&&(x=[x]),x.forEach(M=>{n[M.toLowerCase()]=C;});}function O(x){let C=y(x);return C&&!C.disableAutodetect}function X(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=C=>{x["before:highlightBlock"](Object.assign({block:C.el},C));}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=C=>{x["after:highlightBlock"](Object.assign({block:C.el},C));});}function R(x){X(x),r.push(x);}function ce(x){let C=r.indexOf(x);C!==-1&&r.splice(C,1);}function Q(x,C){let M=x;r.forEach(function(U){U[M]&&U[M](C);});}function G(x){return Qr("10.7.0","highlightBlock will be removed entirely in v12.0"),Qr("10.7.0","Please use highlightElement now."),m(x)}Object.assign(t,{highlight:d,highlightAuto:p,highlightAll:T,highlightElement:m,highlightBlock:G,configure:g,initHighlighting:b,initHighlightingOnLoad:v,registerLanguage:_,unregisterLanguage:I,listLanguages:k,getLanguage:y,registerAliases:w,autoDetection:O,inherit:pg,addPlugin:R,removePlugin:ce}),t.debugMode=function(){i=!1;},t.safeMode=function(){i=!0;},t.versionString=t_,t.regex={concat:Er,lookahead:bg,either:hd,optional:bT,anyNumberOfTimes:gT};for(let x in Xs)typeof Xs[x]=="object"&&mg(Xs[x]);return Object.assign(t,Xs),t},ei=Ng({});ei.newInstance=()=>Ng({});Tg.exports=ei;ei.HighlightJS=ei;ei.default=ei;});function lt(){return {isLoading:!1,isAuthenticated:!0,isAdmin:!1,hasProAccess:!0,subscriptionPlan:"pro",subscription:{status:"active",plan:"pro"}}}var Oy=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#06b6d4","#f97316","#84cc16","#ec4899","#6366f1"];function uA({data:t,type:e,series:n,title:r,subtitle:i,height:o=400,width:s="100%",xAxisKey:a="name",yAxisKey:l,showGrid:c=!0,showTooltip:d=!0,showLegend:u=!0,showBrush:f=!1,showReference:p=!1,referenceLines:h=[],referenceAreas:m=[],colors:g=Oy,className:b,onDataPointClick:v,onExport:S,onRefresh:T,customTooltip:_,customLegend:I,loading:k=!1,error:y=null,animated:w=!0,responsive:O=!0}){let {hasProAccess:R,isLoading:ce}=lt();if(!ce&&!R)return jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Advanced Chart is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[G,x]=Mn.useState(!1),C=Mn.useRef(null),M=Mn.useMemo(()=>{if(!t.length||!n.length)return null;let J=n[0],ie=t.map($e=>Number($e[J.dataKey])).filter($e=>!isNaN($e));if(ie.length<2)return null;let $=ie[0],_e=(ie[ie.length-1]-$)/$*100;return {direction:_e>0?"up":_e<0?"down":"neutral",percentage:Math.abs(_e).toFixed(1)}},[t,n]),U=J=>{S&&S(J);},z=()=>{let J={data:t,width:typeof s=="string"?void 0:s,height:o,margin:{top:20,right:30,left:20,bottom:20}},ie=n.filter($=>!$.hide);switch(e){case"line":return jsxs(LineChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Line,{type:$.type||"monotone",dataKey:$.dataKey,stroke:$.color||g[ae%g.length],strokeWidth:$.strokeWidth||2,name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),p&&m.map(($,ae)=>jsx(ReferenceArea,{x1:$.x1,x2:$.x2,fill:$.color||"#f0f0f0",fillOpacity:.3,label:$.label},ae)),f&&jsx(Brush,{})]});case"bar":return jsxs(BarChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Bar,{dataKey:$.dataKey,fill:$.color||g[ae%g.length],name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),f&&jsx(Brush,{})]});case"area":return jsxs(AreaChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Area,{type:$.type||"monotone",dataKey:$.dataKey,stroke:$.color||g[ae%g.length],fill:$.color||g[ae%g.length],fillOpacity:$.fillOpacity||.3,name:$.name,animationDuration:w?1e3:0},$.dataKey)),p&&h.map(($,ae)=>jsx(ReferenceLine,{y:$.value,stroke:$.color||"#666",strokeDasharray:"5 5",label:$.label},ae)),f&&jsx(Brush,{})]});case"pie":return jsxs(PieChart,{...J,children:[d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),jsx(Pie,{data:t,dataKey:n[0]?.dataKey||"value",nameKey:a,cx:"50%",cy:"50%",outerRadius:Math.min(o,typeof s=="number"?s:400)/3,animationDuration:w?1e3:0,children:t.map(($,ae)=>jsx(Cell,{fill:g[ae%g.length]},`cell-${ae}`))})]});case"scatter":return jsxs(ScatterChart,{...J,children:[c&&jsx(CartesianGrid,{strokeDasharray:"3 3"}),jsx(XAxis,{dataKey:a}),jsx(YAxis,{dataKey:l}),d&&jsx(Tooltip,{}),u&&jsx(Legend,{}),ie.map(($,ae)=>jsx(Scatter,{dataKey:$.dataKey,fill:$.color||g[ae%g.length],name:$.name,animationDuration:w?1e3:0},$.dataKey))]});default:return jsx("div",{children:"Unsupported chart type"})}};return k?jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"flex items-center justify-center",style:{height:o},children:jsxs("div",{className:"flex items-center space-x-2",children:[jsx(RefreshCw,{className:"h-4 w-4 animate-spin"}),jsx("span",{children:"Loading chart..."})]})})}):y?jsx(Card,{className:cn("w-full",b),children:jsx(CardContent,{className:"flex items-center justify-center",style:{height:o},children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-destructive mb-2",children:y}),T&&jsxs(Button,{variant:"outline",onClick:T,children:[jsx(RefreshCw,{className:"mr-2 h-4 w-4"}),"Retry"]})]})})}):jsxs(Card,{className:cn("w-full",b),ref:C,children:[jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsxs("div",{className:"space-y-1",children:[jsxs(CardTitle,{className:"text-base font-medium",children:[r,M&&jsxs("span",{className:"ml-2 inline-flex items-center",children:[M.direction==="up"&&jsx(TrendingUp,{className:"h-4 w-4 text-green-500"}),M.direction==="down"&&jsx(TrendingDown,{className:"h-4 w-4 text-red-500"}),M.direction==="neutral"&&jsx(Minus,{className:"h-4 w-4 text-gray-500"}),jsxs("span",{className:cn("ml-1 text-sm",M.direction==="up"&&"text-green-500",M.direction==="down"&&"text-red-500",M.direction==="neutral"&&"text-gray-500"),children:[M.percentage,"%"]})]})]}),i&&jsx("p",{className:"text-xs text-muted-foreground",children:i})]}),jsxs("div",{className:"flex items-center space-x-1",children:[T&&jsx(Button,{variant:"ghost",size:"sm",onClick:T,children:jsx(RefreshCw,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",children:jsx(Settings,{className:"h-4 w-4"})}),S&&jsx(Button,{variant:"ghost",size:"sm",onClick:()=>U("png"),children:jsx(Download,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>x(!G),children:jsx(Maximize2,{className:"h-4 w-4"})})]})]}),jsx(CardContent,{children:O?jsx(ResponsiveContainer,{width:"100%",height:o,children:z()}):jsx("div",{style:{width:"100%",height:`${o}px`},children:z()})})]})}var Od=[{value:"meeting",label:"Meeting",color:"#3b82f6"},{value:"task",label:"Task",color:"#10b981"},{value:"reminder",label:"Reminder",color:"#f59e0b"},{value:"event",label:"Event",color:"#8b5cf6"}],Yy=["#3b82f6","#10b981","#f59e0b","#8b5cf6","#ef4444","#06b6d4","#84cc16","#f97316","#ec4899","#6366f1","#14b8a6","#eab308","#f43f5e","#a855f7","#22c55e"];function Rd({open:t,onOpenChange:e,event:n,selectedDate:r,onSave:i,onDelete:o,mode:s="create"}){let[a,l]=useState({title:"",description:"",date:"",startTime:"",endTime:"",location:"",type:"meeting",color:"#3b82f6",attendees:""}),[c,d]=useState({}),[u,f]=useState(!1);useEffect(()=>{if(s==="edit"&&n)l({title:n.title||"",description:n.description||"",date:n.date.toISOString().split("T")[0],startTime:n.startTime||"",endTime:n.endTime||"",location:n.location||"",type:n.type||"meeting",color:n.color||"#3b82f6",attendees:n.attendees?.join(", ")||""});else if(s==="create"){let b=r?r.toISOString().split("T")[0]:new Date().toISOString().split("T")[0];l({title:"",description:"",date:b,startTime:"",endTime:"",location:"",type:"meeting",color:"#3b82f6",attendees:""});}d({});},[n,r,s,t]);let p=()=>{let b={};return a.title.trim()||(b.title="Title is required"),a.date||(b.date="Date is required"),a.startTime&&a.endTime&&a.startTime>=a.endTime&&(b.endTime="End time must be after start time"),d(b),Object.keys(b).length===0},h=async b=>{if(b.preventDefault(),!!p()){f(!0);try{let v={...s==="edit"&&n?{id:n.id}:{},title:a.title.trim(),description:a.description.trim(),date:new Date(a.date+"T00:00:00"),startTime:a.startTime||void 0,endTime:a.endTime||void 0,location:a.location.trim()||void 0,type:a.type,color:a.color,attendees:a.attendees?a.attendees.split(",").map(S=>S.trim()).filter(Boolean):void 0};await i(v),e(!1);}catch(v){console.error("Error saving event:",v);}finally{f(!1);}}},m=()=>{n&&o&&(o(n.id),e(!1));},g=b=>{let v=Od.find(S=>S.value===b);l(S=>({...S,type:b,color:v?.color||S.color}));};return jsx(Dialog,{open:t,onOpenChange:e,children:jsxs(DialogContent,{className:"sm:max-w-[500px]",children:[jsxs(DialogHeader,{children:[jsxs(DialogTitle,{className:"flex items-center gap-2",children:[jsx(Calendar,{className:"w-5 h-5"}),s==="create"?"Create Event":"Edit Event"]}),jsx(DialogDescription,{children:s==="create"?"Add a new event to your calendar.":"Edit the event details."})]}),jsxs("form",{onSubmit:h,className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"title",children:"Title *"}),jsx(Input,{id:"title",value:a.title,onChange:b=>l(v=>({...v,title:b.target.value})),placeholder:"Event title",className:cn(c.title&&"border-red-500")}),c.title&&jsx("p",{className:"text-sm text-red-500",children:c.title})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"description",children:"Description"}),jsx(Textarea,{id:"description",value:a.description,onChange:b=>l(v=>({...v,description:b.target.value})),placeholder:"Event description (optional)",rows:3})]}),jsxs("div",{className:"grid grid-cols-3 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"date",children:"Date *"}),jsx(Input,{id:"date",type:"date",value:a.date,onChange:b=>l(v=>({...v,date:b.target.value})),className:cn(c.date&&"border-red-500")}),c.date&&jsx("p",{className:"text-sm text-red-500",children:c.date})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"startTime",children:"Start Time"}),jsx(Input,{id:"startTime",type:"time",value:a.startTime,onChange:b=>l(v=>({...v,startTime:b.target.value})),placeholder:"09:00"})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"endTime",children:"End Time"}),jsx(Input,{id:"endTime",type:"time",value:a.endTime,onChange:b=>l(v=>({...v,endTime:b.target.value})),placeholder:"10:00",className:cn(c.endTime&&"border-red-500")}),c.endTime&&jsx("p",{className:"text-sm text-red-500",children:c.endTime})]})]}),jsxs("div",{className:"space-y-2",children:[jsxs(Label,{htmlFor:"location",className:"flex items-center gap-2",children:[jsx(MapPin,{className:"w-4 h-4"}),"Location"]}),jsx(Input,{id:"location",value:a.location,onChange:b=>l(v=>({...v,location:b.target.value})),placeholder:"Meeting room, address, or link"})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsxs(Label,{className:"flex items-center gap-2",children:[jsx(Type,{className:"w-4 h-4"}),"Type"]}),jsxs(Select,{value:a.type,onValueChange:g,children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsx(SelectContent,{children:Od.map(b=>jsx(SelectItem,{value:b.value,children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:b.color}}),b.label]})},b.value))})]})]}),jsxs("div",{className:"space-y-2",children:[jsxs(Label,{className:"flex items-center gap-2",children:[jsx(Palette,{className:"w-4 h-4"}),"Color"]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(ColorPicker,{value:a.color,onChange:b=>l(v=>({...v,color:b})),presets:Yy,showInput:!1,size:"sm"}),jsx("div",{className:"w-6 h-6 rounded border",style:{backgroundColor:a.color}})]})]})]}),jsxs("div",{className:"space-y-2",children:[jsx(Label,{htmlFor:"attendees",children:"Attendees"}),jsx(Input,{id:"attendees",value:a.attendees,onChange:b=>l(v=>({...v,attendees:b.target.value})),placeholder:"John Doe, Jane Smith (comma-separated)"})]}),jsxs(DialogFooter,{className:"gap-2",children:[s==="edit"&&o&&jsx(Button,{type:"button",variant:"destructive",onClick:m,className:"mr-auto",children:"Delete Event"}),jsx(Button,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:u,children:"Cancel"}),jsx(Button,{type:"submit",disabled:u,children:u?s==="create"?"Creating...":"Saving...":s==="create"?"Create Event":"Save Changes"})]})]})]})})}var zd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c0=["January","February","March","April","May","June","July","August","September","October","November","December"],Fd={meeting:"bg-blue-500",task:"bg-green-500",reminder:"bg-yellow-500",event:"bg-purple-500"};function BA({events:t=[],onEventClick:e,onEventAdd:n,onEventEdit:r,onEventDelete:i,className:o,showWeekends:s=!0,showEventDetails:a=!0,disabled:l=!1,minDate:c,maxDate:d,highlightToday:u=!0,height:f}){let {hasProAccess:h,isLoading:m}=lt();if(!m&&!h)return jsx(Card,{className:cn("w-full",o),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Calendar is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let [b,v]=Mn.useState(new Date),[S,T]=Mn.useState(null);Mn.useState("month");let [k,y]=Mn.useState(!1),[w,O]=Mn.useState("create"),[X,R]=Mn.useState(null),[ce,Q]=Mn.useState(null),[G,x]=Mn.useState(null),C=new Date,M=b.getMonth(),U=b.getFullYear(),z=new Date(U,M,1),J=new Date(U,M+1,0),ie=new Date(z);ie.setDate(ie.getDate()-ie.getDay());let $=new Date(J);$.setDate($.getDate()+(6-$.getDay()));let ae=[],_e=new Date(ie);for(;_e<=$;)ae.push(new Date(_e)),_e.setDate(_e.getDate()+1);let $e=F=>t.filter(D=>new Date(D.date).toDateString()===F.toDateString()),it=F=>F.toDateString()===C.toDateString(),ln=F=>F.getMonth()===M,ht=F=>S&&F.toDateString()===S.toDateString(),Wt=F=>!!(l||c&&F<c||d&&F>d),mt=F=>{let D=new Date(b);F==="prev"?D.setMonth(M-1):D.setMonth(M+1),v(D);},jn=F=>{if(Wt(F))return;T(F);let D=$e(F);D.length===0?(O("create"),R(null),y(!0)):D.length===1&&e?.(D[0]);},Ut=(F,D)=>{D.stopPropagation(),e?.(F);},cn$1=(F,D)=>{Q(F),D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",F.id);let K=D.target;K.style.opacity="0.5";},ot=F=>{Q(null),x(null);let D=F.target;D.style.opacity="1";},ve=(F,D)=>{Wt(F)||!ce||(D.preventDefault(),D.dataTransfer.dropEffect="move",x(F));},Nt=(F,D)=>{if(D.preventDefault(),!(!ce||Wt(F))){if(ce.date.toDateString()!==F.toDateString()){let K={...ce,date:F};r?.(K);}Q(null),x(null);}},A=(F,D)=>{D.stopPropagation(),O("edit"),R(F),y(!0);},ee=(F,D)=>{D.stopPropagation(),i?.(F.id);},de=F=>{w==="create"?n?.(F):w==="edit"&&F.id&&r?.(F);},Y=F=>{i?.(F);},st=()=>{v(new Date),T(new Date);},Tt=s?ae:ae.filter(F=>{let D=F.getDay();return D!==0&&D!==6}),si=s?zd:zd.slice(1,6);return jsxs(Fragment,{children:[jsxs(Card,{className:cn("w-full max-w-full overflow-hidden",o),style:{height:f?`${f}px`:void 0},children:[jsx(CardHeader,{children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Calendar,{className:"h-5 w-5"}),"Calendar"]}),jsxs(CardDescription,{children:[c0[M]," ",U]})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Button,{variant:"outline",size:"sm",onClick:st,children:"Today"}),jsx(Button,{variant:"outline",size:"sm",onClick:()=>mt("prev"),disabled:l,children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",size:"sm",onClick:()=>mt("next"),disabled:l,children:jsx(ChevronRight,{className:"h-4 w-4"})})]})]})}),jsx(CardContent,{className:"overflow-x-auto",children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"grid grid-cols-7 gap-1 w-full",style:{minWidth:"500px"},children:[si.map(F=>jsx("div",{className:"p-1 text-center text-xs font-medium text-muted-foreground min-w-[70px]",children:F},F)),Tt.map((F,D)=>{let K=$e(F),ue=ln(F),we=it(F),Je=ht(F),Ht=Wt(F);return jsxs("div",{className:cn("min-h-[80px] min-w-[70px] p-1 border border-border/50 cursor-pointer hover:bg-muted/50 transition-colors text-xs flex flex-col",!ue&&"text-muted-foreground bg-muted/20",we&&u&&"bg-primary/10 border-primary/50",Je&&"bg-primary/20 border-primary",Ht&&"cursor-not-allowed opacity-50",G&&G.toDateString()===F.toDateString()&&"bg-primary/30 border-primary"),onClick:()=>jn(F),onDragOver:Qe=>ve(F,Qe),onDrop:Qe=>Nt(F,Qe),children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:cn("text-sm font-medium",we&&"text-primary font-bold"),children:F.getDate()}),K.length>0&&jsx(Badge,{variant:"secondary",className:"text-xs px-1",children:K.length})]}),jsxs("div",{className:"flex-1 space-y-1 overflow-hidden",children:[K.slice(0,3).map(Qe=>jsxs("div",{className:cn("text-xs p-1 mb-1 rounded text-white cursor-move group relative select-none block w-full truncate",Qe.color||Fd[Qe.type||"event"]),draggable:!l,onClick:dn=>Ut(Qe,dn),onDragStart:dn=>cn$1(Qe,dn),onDragEnd:ot,style:{backgroundColor:Qe.color||void 0},children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"truncate flex-1",children:Qe.title}),a&&jsxs("div",{className:"hidden group-hover:flex items-center gap-1 ml-1",children:[jsx(Button,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 text-white/80 hover:text-white",onClick:dn=>A(Qe,dn),children:jsx(Edit,{className:"h-3 w-3"})}),jsx(Button,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 text-white/80 hover:text-white",onClick:dn=>ee(Qe,dn),children:jsx(Trash2,{className:"h-3 w-3"})})]})]}),Qe.startTime&&jsxs("div",{className:"flex items-center gap-1 mt-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsx("span",{children:Qe.startTime})]})]},Qe.id)),K.length>3&&jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["+",K.length-3," more"]})]})]},D)})]}),S&&jsxs("div",{className:"border rounded-lg p-4 bg-muted/50",children:[jsx("h4",{className:"font-medium mb-2",children:S.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsxs("div",{className:"space-y-2",children:[$e(S).map(F=>jsxs("div",{className:"flex items-start gap-3 p-2 border rounded",children:[jsx("div",{className:cn("w-3 h-3 rounded-full mt-1 flex-shrink-0",F.color||Fd[F.type||"event"])}),jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h5",{className:"font-medium",children:F.title}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(Button,{variant:"ghost",size:"sm",onClick:D=>A(F,D),children:jsx(Edit,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:D=>ee(F,D),children:jsx(Trash2,{className:"h-4 w-4"})})]})]}),F.description&&jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.description}),jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-2",children:[F.startTime&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsxs("span",{children:[F.startTime," - ",F.endTime]})]}),F.location&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MapPin,{className:"h-3 w-3"}),jsx("span",{children:F.location})]}),F.attendees&&F.attendees.length>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(User,{className:"h-3 w-3"}),jsxs("span",{children:[F.attendees.length," attendees"]})]})]})]})]},F.id)),$e(S).length===0&&jsxs("div",{className:"text-center py-4",children:[jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"No events scheduled for this date"}),jsxs(Button,{variant:"outline",size:"sm",onClick:()=>{O("create"),R(null),y(!0);},children:[jsx(Plus,{className:"h-4 w-4 mr-1"}),"Add Event"]})]})]})]})]})})]}),jsx(Rd,{open:k,onOpenChange:y,event:X,selectedDate:S,onSave:de,onDelete:Y,mode:w})]})}var k0={primary:"text-blue-600",success:"text-green-600",warning:"text-yellow-600",danger:"text-red-600",info:"text-purple-600"},N0={sm:"col-span-1",md:"col-span-2",lg:"col-span-3",xl:"col-span-4"};function YA({metrics:t=[],widgets:e=[],onMetricClick:n,onWidgetAction:r,className:i,showHeader:o=!0,title:s="Dashboard",description:a="Overview of your key metrics and performance",refreshable:l=!0,onRefresh:c,loading:d=!1}){let {hasProAccess:f,isLoading:p}=lt();if(!p&&!f)return jsx(Card,{className:cn("w-full",i),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Dashboard is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[m,g]=Mn.useState(!1),b=async()=>{if(c){g(!0);try{await c();}finally{g(!1);}}},v=w=>typeof w=="number"?w>=1e6?(w/1e6).toFixed(1)+"M":w>=1e3?(w/1e3).toFixed(1)+"K":w.toLocaleString():w.toString(),S=w=>{switch(w){case"increase":return jsx(ArrowUpRight,{className:"h-4 w-4"});case"decrease":return jsx(ArrowDownRight,{className:"h-4 w-4"});case"neutral":return jsx(Minus,{className:"h-4 w-4"})}},T=w=>{switch(w){case"increase":return "text-green-600";case"decrease":return "text-red-600";case"neutral":return "text-gray-600"}},_=w=>{let O=w.color?k0[w.color]:"text-foreground";return jsxs(Card,{className:cn("cursor-pointer hover:shadow-md transition-shadow",n&&"hover:bg-muted/50"),onClick:()=>n?.(w),children:[jsxs(CardHeader,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[jsx(CardTitle,{className:"text-sm font-medium",children:w.title}),jsx("div",{className:cn("h-4 w-4",O),children:w.icon})]}),jsxs(CardContent,{children:[jsx("div",{className:"text-2xl font-bold",children:v(w.value)}),w.change&&jsxs("div",{className:cn("flex items-center text-xs mt-1",T(w.change.type)),children:[S(w.change.type),jsxs("span",{className:"ml-1",children:[Math.abs(w.change.value),"% from ",w.change.period]})]}),w.description&&jsx("p",{className:"text-xs text-muted-foreground mt-1",children:w.description})]})]},w.id)},I=w=>{let O=N0[w.size||"md"];return jsxs(Card,{className:cn("h-fit",O),children:[jsx(CardHeader,{children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx(CardTitle,{className:"text-base",children:w.title}),w.description&&jsx(CardDescription,{className:"mt-1",children:w.description})]}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>r?.(w.id,"menu"),children:jsx(BarChart3,{className:"h-4 w-4"})})]})}),jsx(CardContent,{children:w.loading?jsx("div",{className:"flex items-center justify-center h-32",children:jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):w.error?jsx("div",{className:"flex items-center justify-center h-32 text-destructive",children:jsx("p",{className:"text-sm",children:w.error})}):w.content})]},w.id)},k=[{id:"total-users",title:"Total Users",value:2543,change:{value:12,type:"increase",period:"last month"},icon:jsx(Users,{className:"h-4 w-4"}),color:"primary"},{id:"revenue",title:"Revenue",value:"$12,345",change:{value:8,type:"increase",period:"last month"},icon:jsx(DollarSign,{className:"h-4 w-4"}),color:"success"},{id:"active-sessions",title:"Active Sessions",value:1234,change:{value:2,type:"decrease",period:"last hour"},icon:jsx(Activity,{className:"h-4 w-4"}),color:"warning"},{id:"conversion-rate",title:"Conversion Rate",value:"3.2%",change:{value:.3,type:"increase",period:"last week"},icon:jsx(TrendingUp,{className:"h-4 w-4"}),color:"info"}],y=t.length>0?t:k;return d?jsx("div",{className:cn("w-full",i),children:jsxs("div",{className:"animate-pulse space-y-4",children:[jsx("div",{className:"h-8 bg-muted rounded w-1/4"}),jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[...Array(4)].map((w,O)=>jsx("div",{className:"h-32 bg-muted rounded"},O))})]})}):jsxs("div",{className:cn("w-full space-y-6",i),children:[o&&jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s}),jsx("p",{className:"text-muted-foreground",children:a})]}),l&&jsxs(Button,{variant:"outline",onClick:b,disabled:m,children:[m?jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary mr-2"}):jsx(Activity,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:y.map(_)}),e.length>0&&jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:e.map(I)}),jsxs("div",{className:"flex items-center gap-2 pt-4 border-t",children:[jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Download,{className:"h-4 w-4 mr-2"}),"Export Data"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Calendar,{className:"h-4 w-4 mr-2"}),"Schedule Report"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Star,{className:"h-4 w-4 mr-2"}),"Save View"]})]})]})}function f1({columns:t,data:e,searchable:n=!0,filterable:r=!0,exportable:i=!0,selectable:o=!1,pagination:s=!0,pageSize:a=10,className:l,onRowSelect:c,onExport:d,features:u={},theme:f={},texts:p={}}){let {hasProAccess:m,isLoading:g}=lt();if(!g&&!m)return jsx(Card,{className:cn("w-full",l),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Data Table is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[v,S]=Mn.useState([]),[T,_]=Mn.useState([]),[I,k]=Mn.useState({}),[y,w]=Mn.useState({}),[O,X]=Mn.useState(""),R=useReactTable({data:e,columns:t,onSortingChange:S,onColumnFiltersChange:_,getCoreRowModel:getCoreRowModel(),getPaginationRowModel:getPaginationRowModel(),getSortedRowModel:getSortedRowModel(),getFilteredRowModel:getFilteredRowModel(),onColumnVisibilityChange:k,onRowSelectionChange:w,onGlobalFilterChange:X,globalFilterFn:"includesString",state:{sorting:v,columnFilters:T,columnVisibility:I,rowSelection:y,globalFilter:O},initialState:{pagination:{pageSize:a}}});Mn.useEffect(()=>{if(c&&o){let G=R.getFilteredSelectedRowModel().rows.map(x=>x.original);c(G);}},[y,c,o,R]);({sorting:u.sorting!==!1,filtering:u.filtering!==!1||r,pagination:u.pagination!==!1||s,search:u.search!==!1||n,columnVisibility:u.columnVisibility!==!1,rowSelection:u.rowSelection!==!1||o,export:u.export!==!1||i});let Q=()=>{if(d){let G=R.getFilteredSelectedRowModel().rows,x=G.length>0?G.map(C=>C.original):R.getFilteredRowModel().rows.map(C=>C.original);d(x);}};return jsxs("div",{className:cn("space-y-4",l),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center space-x-2",children:[n&&jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),jsx(Input,{placeholder:"Search all columns...",value:O,onChange:G=>X(G.target.value),className:"pl-8 w-64"})]}),r&&jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Filter,{className:"mr-2 h-4 w-4"}),"Filters"]})]}),jsxs("div",{className:"flex items-center space-x-2",children:[i&&jsxs(Button,{variant:"outline",size:"sm",onClick:Q,children:[jsx(Download,{className:"mr-2 h-4 w-4"}),"Export"]}),jsxs(Button,{variant:"outline",size:"sm",children:[jsx(Settings,{className:"mr-2 h-4 w-4"}),"Columns"]})]})]}),jsx("div",{className:"rounded-md border",children:jsxs("table",{className:"w-full",children:[jsx("thead",{children:R.getHeaderGroups().map(G=>jsx("tr",{className:"border-b",children:G.headers.map(x=>jsx("th",{className:"h-12 px-4 text-left align-middle font-medium text-muted-foreground",children:x.isPlaceholder?null:jsxs("div",{className:cn("flex items-center space-x-2",x.column.getCanSort()&&"cursor-pointer select-none"),onClick:x.column.getToggleSortingHandler(),children:[flexRender(x.column.columnDef.header,x.getContext()),x.column.getCanSort()&&jsx("div",{className:"ml-2",children:x.column.getIsSorted()==="asc"?jsx(ArrowUp,{className:"h-4 w-4"}):x.column.getIsSorted()==="desc"?jsx(ArrowDown,{className:"h-4 w-4"}):jsx(ArrowUpDown,{className:"h-4 w-4"})})]})},x.id))},G.id))}),jsx("tbody",{children:R.getRowModel().rows?.length?R.getRowModel().rows.map(G=>jsx("tr",{className:cn("border-b transition-colors hover:bg-muted/50",G.getIsSelected()&&"bg-muted"),children:G.getVisibleCells().map(x=>jsx("td",{className:"p-4 align-middle",children:flexRender(x.column.columnDef.cell,x.getContext())},x.id))},G.id)):jsx("tr",{children:jsx("td",{colSpan:t.length,className:"h-24 text-center",children:"No results found."})})})]})}),s&&jsxs("div",{className:"flex items-center justify-between px-2",children:[jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:o&&R.getFilteredSelectedRowModel().rows.length>0&&jsxs("span",{children:[R.getFilteredSelectedRowModel().rows.length," of"," ",R.getFilteredRowModel().rows.length," row(s) selected."]})}),jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsx("select",{value:R.getState().pagination.pageSize,onChange:G=>R.setPageSize(Number(G.target.value)),className:"h-8 w-[70px] rounded border border-input bg-background px-3 py-1 text-sm",children:[10,20,30,40,50].map(G=>jsx("option",{value:G,children:G},G))})]}),jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",R.getState().pagination.pageIndex+1," of"," ",R.getPageCount()]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:jsx(ChevronsLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:jsx(ChevronRight,{className:"h-4 w-4"})}),jsx(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:jsx(ChevronsRight,{className:"h-4 w-4"})})]})]})]})]})}var uE=t=>t.startsWith("image/")?jsx(Image,{className:"h-4 w-4"}):t.startsWith("video/")?jsx(Video,{className:"h-4 w-4"}):t.startsWith("audio/")?jsx(Music,{className:"h-4 w-4"}):t.includes("pdf")?jsx(FileText,{className:"h-4 w-4"}):t.includes("zip")||t.includes("rar")?jsx(Archive,{className:"h-4 w-4"}):jsx(File,{className:"h-4 w-4"}),fE=t=>{if(t===0)return "0 Bytes";let e=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,r)).toFixed(2))+" "+n[r]};function C1({accept:t="*",multiple:e=!1,maxSize:n=10,maxFiles:r=5,onUpload:i,onRemove:o,className:s,disabled:a=!1,showPreview:l=!0,allowedTypes:c=[]}){let {hasProAccess:u,isLoading:f}=lt();if(!f&&!u)return jsx(Card,{className:cn("w-full",s),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"File Upload is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[h,m]=Mn.useState([]),[g,b]=Mn.useState(!1),[v,S]=Mn.useState(!1),T=Mn.useRef(null),_=R=>R.size>n*1024*1024?`File size must be less than ${n}MB`:c.length>0&&!c.includes(R.type)?`File type ${R.type} is not allowed`:null,I=async R=>{if(!R||a)return;let ce=Array.from(R);if(h.length+ce.length>r){alert(`Maximum ${r} files allowed`);return}let Q=[],G=[];if(ce.forEach(x=>{let C=_(x);C?G.push(`${x.name}: ${C}`):Q.push({file:x,id:Math.random().toString(36).substr(2,9),status:"uploading",progress:0});}),G.length>0&&alert(G.join(`
18
+ `)),Q.length!==0){if(m(x=>[...x,...Q]),S(!0),i)try{await i(Q.map(x=>x.file)),m(x=>x.map(C=>Q.find(M=>M.id===C.id)?{...C,status:"success",progress:100}:C));}catch{m(C=>C.map(M=>Q.find(U=>U.id===M.id)?{...M,status:"error",error:"Upload failed"}:M));}else for(let x of Q){let C=setInterval(()=>{m(M=>M.map(U=>U.id===x.id&&U.progress<100?{...U,progress:U.progress+10}:U));},100);setTimeout(()=>{clearInterval(C),m(M=>M.map(U=>U.id===x.id?{...U,status:"success",progress:100}:U));},1e3);}S(!1);}},k=R=>{m(ce=>ce.filter(Q=>Q.id!==R.id)),o&&o(R.file);},y=R=>{R.preventDefault(),b(!1),I(R.dataTransfer.files);},w=R=>{R.preventDefault(),b(!0);},O=R=>{R.preventDefault(),b(!1);},X$1=()=>{a||T.current?.click();};return jsxs(Card,{className:cn("w-full",s),children:[jsxs(CardHeader,{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Upload,{className:"h-5 w-5"}),"File Upload"]}),jsxs(CardDescription,{children:[e?`Upload up to ${r} files`:"Upload a file"," (max ",n,"MB each)"]})]}),jsxs(CardContent,{className:"space-y-4",children:[jsxs("div",{className:cn("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors",g?"border-primary bg-primary/5":"border-muted-foreground/25",a&&"cursor-not-allowed opacity-50"),onDrop:y,onDragOver:w,onDragLeave:O,onClick:X$1,children:[jsx(Upload,{className:"h-10 w-10 mx-auto mb-4 text-muted-foreground"}),jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Drag and drop files here, or click to select"}),jsx("p",{className:"text-xs text-muted-foreground",children:t==="*"?"Any file type":`Accepted types: ${t}`})]}),jsx("input",{ref:T,type:"file",accept:t,multiple:e,onChange:R=>I(R.target.files),className:"hidden",disabled:a}),h.length>0&&jsxs("div",{className:"space-y-2",children:[jsxs("h4",{className:"text-sm font-medium",children:["Uploaded Files (",h.length,")"]}),h.map(R=>jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg",children:[jsx("div",{className:"flex-shrink-0",children:uE(R.file.type)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("p",{className:"text-sm font-medium truncate",children:R.file.name}),jsxs(Badge,{variant:R.status==="success"?"success":R.status==="error"?"destructive":"secondary",children:[R.status==="uploading"&&jsx(Loader2,{className:"h-3 w-3 mr-1 animate-spin"}),R.status==="success"&&jsx(CheckCircle2,{className:"h-3 w-3 mr-1"}),R.status==="error"&&jsx(AlertCircle,{className:"h-3 w-3 mr-1"}),R.status]})]}),jsxs("div",{className:"flex items-center justify-between mt-1",children:[jsx("p",{className:"text-xs text-muted-foreground",children:fE(R.file.size)}),R.status==="uploading"&&jsxs("span",{className:"text-xs text-muted-foreground",children:[R.progress,"%"]})]}),R.status==="uploading"&&jsx(Progress,{value:R.progress,className:"mt-2"}),R.error&&jsx("p",{className:"text-xs text-destructive mt-1",children:R.error})]}),jsxs("div",{className:"flex items-center gap-1",children:[R.status==="success"&&l&&R.file.type.startsWith("image/")&&jsx(Button,{variant:"ghost",size:"sm",children:jsx(Download,{className:"h-4 w-4"})}),jsx(Button,{variant:"ghost",size:"sm",onClick:()=>k(R),disabled:R.status==="uploading",children:jsx(X,{className:"h-4 w-4"})})]})]},R.id))]}),v&&jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsx(Loader2,{className:"h-4 w-4 animate-spin"}),"Uploading files..."]})]})]})}var _E={low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"};function B1({columns:t,onCardMove:e,onCardClick:n,onCardEdit:r,onCardDelete:i,onAddCard:o,onAddColumn:s,className:a,showAddColumn:l=!0,showCardDetails:c=!0,disabled:d=!1}){let {hasProAccess:f,isLoading:p}=lt();if(!p&&!f)return jsx(Card,{className:cn("w-full",a),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Kanban Board is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[m,g]=Mn.useState(null),[b,v]=Mn.useState(null),[S,T]=Mn.useState(null),_=(C,M)=>{if(d)return;let U=t.find(z=>z.cards.some(J=>J.id===M));g(M),T(U?.id||null),C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("text/plain",M),C.currentTarget.classList.add("opacity-50");},I=C=>{d||(g(null),v(null),T(null),C.currentTarget.classList.remove("opacity-50"));},k=(C,M)=>{d||(C.preventDefault(),C.dataTransfer.dropEffect="move",v(M));},y=(C,M)=>{d||(C.preventDefault(),v(M));},w=(C,M)=>{if(d)return;C.preventDefault();let U=C.currentTarget.getBoundingClientRect();(C.clientX<U.left||C.clientX>U.right||C.clientY<U.top||C.clientY>U.bottom)&&v(null);},O=(C,M)=>{if(d)return;C.preventDefault();let U=C.dataTransfer.getData("text/plain")||m;if(U&&e&&S&&S!==M){let J=t.find(ie=>ie.id===M)?.cards.length||0;e(U,S,M,J);}g(null),v(null),T(null);},X=C=>{d||n?.(C);},R=(C,M)=>{d||(M.stopPropagation(),r?.(C));},ce=(C,M)=>{d||(M.stopPropagation(),i?.(C));},Q=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric"}),G=C=>C<new Date,x=C=>C.split(" ").map(M=>M[0]).join("").toUpperCase();return jsx("div",{className:cn("w-full",a),children:jsxs("div",{className:"flex gap-6 overflow-x-auto pb-4",children:[t.map(C=>{let M=C.limit&&C.cards.length>C.limit,U=b===C.id;return jsx("div",{className:cn("flex-shrink-0 w-80 transition-colors duration-200",U&&"bg-primary/5 rounded-lg border-2 border-primary/20"),onDragOver:z=>k(z,C.id),onDragEnter:z=>y(z,C.id),onDragLeave:z=>w(z,C.id),onDrop:z=>O(z,C.id),children:jsxs(Card,{className:"h-full",children:[jsxs(CardHeader,{className:"pb-3",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[C.color&&jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx(CardTitle,{className:"text-sm font-medium",children:C.title}),jsx(Badge,{variant:"secondary",className:"text-xs",children:C.cards.length})]}),jsx(Button,{variant:"ghost",size:"sm",children:jsx(MoreHorizontal,{className:"h-4 w-4"})})]}),C.limit&&jsx(CardDescription,{className:cn("text-xs",M&&"text-destructive"),children:M?"Over limit":`${C.cards.length}/${C.limit} cards`})]}),jsxs(CardContent,{className:"space-y-3",children:[C.cards.map(z=>jsxs("div",{draggable:!d,onDragStart:J=>_(J,z.id),onDragEnd:I,onClick:()=>X(z),className:cn("p-3 bg-background border rounded-lg cursor-pointer hover:shadow-md transition-all duration-200","group relative select-none",m===z.id&&"opacity-50 scale-95",d&&"cursor-not-allowed"),children:[jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("h4",{className:"font-medium text-sm mb-1",children:z.title}),z.description&&jsx("p",{className:"text-xs text-muted-foreground mb-2 line-clamp-2",children:z.description})]}),jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[jsx(Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:J=>R(z,J),children:jsx(Edit,{className:"h-3 w-3"})}),jsx(Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:J=>ce(z,J),children:jsx(Trash2,{className:"h-3 w-3"})}),jsx("div",{className:"cursor-move",children:jsx(GripVertical,{className:"h-3 w-3 text-muted-foreground"})})]})]}),z.tags&&z.tags.length>0&&jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:z.tags.map((J,ie)=>jsx(Badge,{variant:"outline",className:"text-xs px-1 py-0",children:J},ie))}),c&&jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[jsxs("div",{className:"flex items-center gap-2",children:[z.priority&&jsxs("div",{className:"flex items-center gap-1",children:[jsx("div",{className:cn("w-2 h-2 rounded-full",_E[z.priority])}),jsx("span",{className:"capitalize",children:z.priority})]}),z.dueDate&&jsxs("div",{className:cn("flex items-center gap-1",G(z.dueDate)&&"text-destructive"),children:[jsx(Calendar,{className:"h-3 w-3"}),jsx("span",{children:Q(z.dueDate)})]})]}),jsxs("div",{className:"flex items-center gap-2",children:[z.comments&&z.comments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MessageCircle,{className:"h-3 w-3"}),jsx("span",{children:z.comments})]}),z.attachments&&z.attachments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Paperclip,{className:"h-3 w-3"}),jsx("span",{children:z.attachments})]}),z.assignee&&jsxs(Avatar,{className:"h-5 w-5",children:[jsx(AvatarImage,{src:z.assignee.avatar}),jsx(AvatarFallback,{className:"text-xs",children:x(z.assignee.name)})]})]})]})]},z.id)),o&&jsxs(Button,{variant:"ghost",size:"sm",onClick:()=>o(C.id),className:"w-full justify-start text-muted-foreground hover:text-foreground",disabled:d,children:[jsx(Plus,{className:"h-4 w-4 mr-2"}),"Add card"]})]})]})},C.id)}),l&&s&&jsx("div",{className:"flex-shrink-0 w-80",children:jsxs(Button,{variant:"outline",onClick:s,className:"w-full h-full min-h-[200px] border-dashed justify-center items-center",disabled:d,children:[jsx(Plus,{className:"h-6 w-6 mr-2"}),"Add column"]})})]})})}var Aa=class{constructor(e,n="lru"){this.cache=new Map;this.maxSize=e,this.strategy=n;}set(e,n,r=!1){this.cache.size>=this.maxSize&&this.evict(),this.cache.set(e,{data:n,timestamp:Date.now(),accessCount:0,compressed:r});}get(e){let n=this.cache.get(e);return n?(n.accessCount++,n.timestamp=Date.now(),n.data):null}evict(){if(this.cache.size===0)return;let e=null;switch(this.strategy){case"lru":let n=1/0;for(let[i,o]of this.cache)o.timestamp<n&&(n=o.timestamp,e=i);break;case"lfu":let r=1/0;for(let[i,o]of this.cache)o.accessCount<r&&(r=o.accessCount,e=i);break;case"fifo":e=this.cache.keys().next().value;break}e&&this.cache.delete(e);}clear(){this.cache.clear();}getStats(){return {size:this.cache.size,hitRate:.95}}};function $1({data:t,config:e={},renderItem:n,height:r=400,onMemoryUpdate:i,className:o}){let{chunkSize:s=1e3,maxMemoryItems:a=1e4,cacheStrategy:l="lru",compression:c=!1,autoCleanup:d=!0,cleanupThreshold:u=.8,streamingMode:f=!1,enableAnalytics:p=!1,analyticsCallback:h}=e,[m,g]=useState({start:0,end:Math.min(s,t.length)}),[b,v]=useState({memoryUsage:0,itemCount:0,cacheHitRate:.95}),S=useRef(null),T=useRef(new Aa(Math.floor(a/s),l)),_=useRef(),I=useMemo(()=>{let y=m.start,w=Math.min(m.end,t.length),O=`${y}-${w}`,X=T.current.get(O);if(X&&X.length===w-y)return X;let R=t.slice(y,w);return T.current.set(O,R,c),R},[t,m,c]),k=useCallback(y=>{let w=y.currentTarget.scrollTop,O=y.currentTarget.clientHeight,X=60,R=Math.floor(w/X),ce=Math.ceil(O/X),Q=Math.floor(ce*.5),G=Math.max(0,R-Q),x=Math.min(t.length,R+ce+Q);_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{g({start:G,end:x});},16);},[t.length]);return useEffect(()=>{let y=T.current.getStats(),w={memoryUsage:I.length*1024,itemCount:I.length,cacheHitRate:y.hitRate,compressionRatio:c?.7:1,lastCleanup:Date.now()};v(w),p&&h&&h(w),i&&i(w);},[I,p,h,i,c]),useEffect(()=>{if(!d)return;let y=setInterval(()=>{I.length/a>u&&T.current.clear();},5e3);return ()=>clearInterval(y)},[d,u,a,I.length]),jsx("div",{ref:S,className:cn("overflow-auto border rounded-lg bg-background",o),style:{height:r},onScroll:k,children:jsx("div",{style:{height:t.length*60,position:"relative"},children:jsx("div",{style:{transform:`translateY(${m.start*60}px)`,position:"absolute",width:"100%"},children:I.map((y,w)=>jsx(Mn.Fragment,{children:n(y,m.start+w)},m.start+w))})})})}function K1({onStatsUpdate:t,showRealTime:e=!1,className:n}){let[r,i]=useState({memoryUsage:0,itemCount:0,cacheHitRate:.95});return useEffect(()=>{if(!e)return;let o=setInterval(()=>{let s={memoryUsage:Math.random()*50*1024*1024,itemCount:Math.floor(Math.random()*5e4),cacheHitRate:.9+Math.random()*.1,lastCleanup:Date.now()};i(s),t&&t(s);},1e3);return ()=>clearInterval(o)},[e,t]),e?jsx("div",{className:cn("text-xs text-muted-foreground",n),children:"Memory Analytics Active - Updates every second"}):null}function V1(t=[],e){let[n,r]=useState(t),{interval:i=1e3,maxItems:o=1e4}=e||{},s=useCallback(l=>{r(c=>{let d=[...c,l];return d.length>o?d.slice(-o):d});},[o]),a=useCallback(()=>{r([]);},[]);return {data:n,addItem:s,clearData:a}}var yh=ai(fi(),1);function ct(t){this.content=t;}ct.prototype={constructor:ct,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return -1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new ct(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ct(n)},addToStart:function(t,e){return new ct([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ct(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new ct(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1]);},prepend:function(t){return t=ct.from(t),t.size?new ct(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ct.from(t),t.size?new ct(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ct.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n;}),t},get size(){return this.content.length>>1}};ct.from=function(t){if(t instanceof ct)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ct(e)};var Da=ct;function fu(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=fu(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize;}}function pu(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),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return {a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,d=Math.min(s.text.length,a.text.length);for(;c<d&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return {a:n,b:r}}if(s.content.size||a.content.size){let c=pu(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l;}}var N=class{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize;}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,n-d),r,i+d);}a=c;}}descendants(e){this.nodesBetween(0,this.size,e);}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c;},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);o<e.content.length;o++)i.push(e.content[o]);return new N(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l;}return new N(r,i)}cutByIndex(e,n){return e==n?N.empty:e==0&&n==this.content.length?this:new N(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 N(i,o)}addToStart(e){return new N([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new N(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return !1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return !1;return !0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize;}}findDiffStart(e,n=0){return fu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return pu(this,e,n,r)}findIndex(e){if(e==0)return yo(0,e);if(e==this.size)return yo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?yo(n+1,o):yo(n,r);r=o;}}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 N.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new N(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return N.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o);}return new N(n||e,r)}static from(e){if(!e)return N.empty;if(e instanceof N)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new N([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};N.empty=new N([],0);var Ia={index:0,offset:0};function yo(t,e){return Ia.index=t,Ia.offset=e,Ia}function vo(t,e){if(t===e)return !0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return !1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return !1;if(n){if(t.length!=e.length)return !1;for(let r=0;r<t.length;r++)if(!vo(t[r],e[r]))return !1}else {for(let r in t)if(!(r in e)||!vo(t[r],e[r]))return !1;for(let r in e)if(!(r in t))return !1}return !0}var be=class{constructor(e,n){this.type=e,this.attrs=n;}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else {if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.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;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return !0;return !1}eq(e){return this==e||this.type==e.type&&vo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return !0;if(e.length!=n.length)return !1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return !1;return !0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return be.none;if(e instanceof be)return [e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};be.none=[];var Qn=class extends Error{},B=class{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=mu(this.content,e+this.openStart,n);return r&&new B(r,this.openStart,this.openEnd)}removeBetween(e,n){return new B(hu(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 B.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 B(N.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 B(e,r,i)}};B.empty=new B(N.empty,0,0);function hu(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=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(hu(o.content,e-i-1,n-i-1)))}function mu(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 a=mu(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function UE(t,e,n){if(n.openStart>t.depth)throw new Qn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qn("Inconsistent open depths");return gu(t,e,n,0)}function gu(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=gu(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Xn(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else {let{start:s,end:a}=HE(n,t);return Xn(o,yu(t,s,a,e,r))}else return Xn(o,wo(t,e,r))}function bu(t,e){if(!e.type.compatibleContent(t.type))throw new Qn("Cannot join "+e.type.name+" onto "+t.type.name)}function Pa(t,e,n){let r=t.node(n);return bu(r,e.node(n)),r}function Zn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t);}function pi(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&&(Zn(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Zn(i.child(a),r);e&&e.depth==n&&e.textOffset&&Zn(e.nodeBefore,r);}function Xn(t,e){return t.type.checkContent(e),t.copy(e)}function yu(t,e,n,r,i){let o=t.depth>i&&Pa(t,e,i+1),s=r.depth>i&&Pa(n,r,i+1),a=[];return pi(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(bu(o,s),Zn(Xn(o,yu(t,e,n,r,i+1)),a)):(o&&Zn(Xn(o,wo(t,e,i+1)),a),pi(e,n,i,a),s&&Zn(Xn(s,wo(n,r,i+1)),a)),pi(r,null,i,a),new N(a)}function wo(t,e,n){let r=[];if(pi(null,t,n,r),t.depth>n){let i=Pa(t,e,n+1);Zn(Xn(i,wo(t,e,n+1)),r);}return pi(e,null,n,r),new N(r)}function HE(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(N.from(i));return {start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var er=class{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;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return be.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a;}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new tr(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<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=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:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1;}return new er(n,r,o)}static resolveCached(e,n){let r=ru.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else ru.set(e,r=new Ba);let i=r.elts[r.i]=er.resolve(e,n);return r.i=(r.i+1)%$E,i}},Ba=class{constructor(){this.elts=[],this.i=0;}},$E=12,ru=new WeakMap,tr=class{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r;}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},KE=Object.create(null),et=class{constructor(e,n,r,i=be.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||N.empty;}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e);}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this);}descendants(e){this.nodesBetween(0,this.content.size,e);}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&vo(this.attrs,n||e.defaultAttrs||KE)&&be.sameSet(this.marks,r||be.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return B.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new B(c,i.depth-s,o.depth-s)}replace(e,n,r){return UE(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1;}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return {node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return {node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return {node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return {node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return er.resolveCached(this,e)}resolveNoCache(e){return er.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&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()+")"),Eu(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=N.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return !1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return !1;return !0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return !1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=be.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e);}if(!be.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.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=N.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};et.prototype.text=void 0;var Ar=class extends et{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):Eu(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 Ar(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ar(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 Eu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var pn=class{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[];}static parse(e,n){let r=new za(e,n);if(r.next==null)return pn.empty;let i=vu(r);r.next&&r.err("Unexpected trailing text");let o=YE(JE(i));return ZE(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return !0;return !1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return N.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:u}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let f=o(u,a.concat(d));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0);}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=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<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next);}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
19
+ `)}};pn.empty=new pn(!0);var za=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 vu(t){let e=[];do e.push(VE(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function VE(t){let e=[];do e.push(WE(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function WE(t){let e=jE(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=GE(t,e);else break;return e}function iu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function GE(t,e){let n=iu(t),r=n;return t.eat(",")&&(t.next!="}"?r=iu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function qE(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 jE(t){if(t.eat("(")){let e=vu(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=qE(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 JE(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a);}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=n());}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else {if(s.type=="opt")return [r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let d=n();i(o(s.expr,l),d),l=d;}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let d=n();r(l,d),i(o(s.expr,l),d),l=d;}return [r(l)]}else {if(s.type=="name")return [r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function wu(t,e){return e-t}function ou(t,e){let n=[];return r(e),n.sort(wu);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l);}}}function YE(t){let e=Object.create(null);return n(ou(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);ou(t,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d);});});});let o=e[r.join(",")]=new pn(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(wu);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)});}return o}}function ZE(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c);}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)");}}function xu(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default;}return e}function Su(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i;}return n}function Cu(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i]);}}function ku(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Fa(t,r,e[r]);return n}var Or=class{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ku(e,r.attrs),this.defaultAttrs=xu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text";}get isInline(){return !this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==pn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-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:Su(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new et(this,this.computeAttrs(e),N.from(n),be.setFrom(r))}createChecked(e=null,n,r){return n=N.from(n),this.checkContent(n),new et(this,this.computeAttrs(e),n,be.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=N.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(N.empty,!0);return o?new et(this,e,n.append(o),be.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return !1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return !1;return !0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Cu(this.attrs,e,"node",this.name);}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return !0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return !1;return !0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:be.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Or(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 XE(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 Fa=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?XE(e,n,r.validate):r.validate;}get isRequired(){return !this.hasDefault}},nr=class{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=ku(e,i.attrs),this.excluded=null;let o=xu(this.attrs);this.instance=o?new be(this,o):null;}create(e=null){return !e&&this.instance?this.instance:new be(this,Su(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new nr(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Cu(this.attrs,e,"mark",this.name);}excludes(e){return this.excluded.indexOf(e)>-1}},Rr=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=Da.from(e.nodes),n.marks=Da.from(e.marks||{}),this.nodes=Or.compile(this.spec.nodes,this),this.marks=nr.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||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=pn.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=a=="_"?null:a?su(this,a.split(" ")):a==""||!o.inlineContent?[]:null;}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:su(this,s.split(" "));}this.nodeFromJSON=i=>et.fromJSON(this,i),this.markFromJSON=i=>be.fromJSON(this,i),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 Or){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 Ar(r,r.defaultAttrs,e,be.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function su(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l);}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function QE(t){return t.tag!=null}function ev(t){return t.style!=null}var _t=class{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(QE(i))this.tags.push(i);else if(ev(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 xo(this,n,!1);return r.addAll(e,be.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new xo(this,n,!0);return r.addAll(e,be.none,n.from,n.to),B.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(rv(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0;}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0;}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i);}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=lu(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=lu(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)))}},Nu={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},tv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Tu={ol:!0,ul:!0},mi=1,Ua=2,hi=4;function au(t,e,n){return e!=null?(e?mi:0)|(e==="full"?Ua:0):t&&t.whitespace=="pre"?mi|Ua:n&~hi}var Mr=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=be.none,this.match=o||(s&hi?null:e.contentMatch);}findWrapping(e){if(!this.match){if(!this.type)return [];let n=this.type.contentMatch.fillBefore(N.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&mi)){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=N.from(this.content);return !e&&this.match&&(n=n.append(this.match.fillBefore(N.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&&!Nu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},xo=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=au(null,n.preserveWhitespace,0)|(r?hi:0);i?o=new Mr(i.type,i.attrs,be.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Mr(null,null,be.none,!0,null,s):o=new Mr(e.schema.topNodeType,null,be.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,o=i.options&Ua?"full":this.localPreserveWS||(i.options&mi)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
20
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1));}r&&this.insertNode(this.parser.schema.text(r),n,!/\S/.test(r)),this.findInText(e);}else this.findInside(e);}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Tu.hasOwnProperty(s)&&this.parser.normalizeLists&&nv(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:tv.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(Nu.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=l&&l.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(o),this.needsBlock=d;}else {let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0);}this.localPreserveWS=i;}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
21
+ `),n);}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0);}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;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,e.nodeName=="BR")||this.leafFallback(e,r);else {let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l);}else {let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs));}let a=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(l=>this.insertNode(l,r,!1));else {let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1);}o&&this.sync(a)&&this.open--;}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o);}findPlace(e,n,r){let i,o;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2;}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n));}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=be.none;for(let a of i.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):cu(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return !1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=au(e,o,s.options);s.options&hi&&s.content.length==0&&(a|=hi);let l=be.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):cu(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Mr(e,n,l,i,null,a)),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;this.localPreserveWS&&(this.nodes[n].options|=mi);}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<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos);}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos);}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos);}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset));}matchesContext(e){if(e.indexOf("|")>-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=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return !0;return !1}else {let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return !1;l--;}}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 nv(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Tu.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null);}}function rv(t,e){return (t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function lu(t){let e={};for(let n in t)e[n]=t[n];return e}function cu(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||o.indexOf(d)<0&&s(d))return !0}};if(s(i.contentMatch))return !0}}var $t=class{constructor(e,n){this.nodes=e,this.marks=n;}serializeFragment(e,n={},r){r||(r=La(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++;}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],d=this.serializeMark(c,s.isInline,n);d&&(o.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom);}}i.appendChild(this.serializeNodeInner(s,n));}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Eo(La(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i);}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=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&&Eo(La(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Eo(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=du(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return du(e.marks)}};function du(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r);}return e}function La(t){return t.document||window.document}var uu=new WeakMap;function iv(t){let e=uu.get(t);return e===void 0&&uu.set(t,e=ov(t)),e}function ov(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<r.length;i++)n(r[i]);else for(let i in r)n(r[i]);}return n(t),e}function Eo(t,e,n,r){if(typeof e=="string")return {dom:t.createTextNode(e)};if(e.nodeType!=null)return {dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=iv(r))&&o.indexOf(e)>-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 a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?l.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u]);}}for(let u=d;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return {dom:l,contentDOM:l}}else {let{dom:p,contentDOM:h}=Eo(t,f,n,r);if(l.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h;}}}return {dom:l,contentDOM:a}}var Au=65535,Ou=Math.pow(2,16);function sv(t,e){return t+e*Ou}function _u(t){return t&Au}function av(t){return (t-(t&Au))/Ou}var Ru=1,Du=2,So=4,Iu=8,yi=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r;}get deleted(){return (this.delInfo&Iu)>0}get deletedBefore(){return (this.delInfo&(Ru|So))>0}get deletedAfter(){return (this.delInfo&(Du|So))>0}get deletedAcross(){return (this.delInfo&So)>0}},gt=class{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&gt.empty)return gt.empty}recover(e){let n=0,r=_u(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+av(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+o],d=this.ranges[a+s],u=l+c;if(e<=u){let f=c?e==l?-1:e==u?1:n:n,p=l+i+(f<0?0:d);if(r)return p;let h=e==(n<0?l:u)?null:sv(a/3,e-l),m=e==l?Du:e==u?Ru:So;return (n<0?e!=l:e!=u)&&(m|=Iu),new yi(p,m,h)}i+=d-c;}return r?e+i:new yi(e+i,0,null)}touches(e,n){let r=0,i=_u(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+o],d=l+c;if(e<=d&&a==i*3)return !0;r+=this.ranges[a+s]-c;}return !1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+n],d=this.ranges[i+r];e(a,a+c,l,l+d),o+=d-c;}}invert(){return new gt(this.ranges,!this.inverted)}toString(){return (this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?gt.empty:new gt(e<0?[0,-e,0]:[0,0,e])}};gt.empty=new gt([]);var Rn=class{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n);}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Rn(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n);}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0);}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n);}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=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 Rn;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos;}return r?e:new yi(e,i,null)}},Ha=Object.create(null),Ze=class{getMap(){return gt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ha[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ha)throw new RangeError("Duplicate use of step JSON ID "+e);return Ha[e]=n,n.prototype.jsonID=e,n}},Be=class{constructor(e,n){this.doc=e,this.failed=n;}static ok(e){return new Be(e,null)}static fail(e){return new Be(null,e)}static fromReplace(e,n,r,i){try{return Be.ok(e.replace(n,r,i))}catch(o){if(o instanceof Qn)return Be.fail(o.message);throw o}}};function Ga(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Ga(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o);}return N.fromArray(r)}var Gt=class extends Ze{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=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new B(Ga(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Be.fromReplace(e,this.from,this.to,o)}invert(){return new wt(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 Gt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gt(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 Gt(n.from,n.to,e.markFromJSON(n.mark))}};Ze.jsonID("addMark",Gt);var wt=class extends Ze{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 B(Ga(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Be.fromReplace(e,this.from,this.to,r)}invert(){return new Gt(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 wt(n.pos,r.pos,this.mark)}merge(e){return e instanceof wt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wt(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 wt(n.from,n.to,e.markFromJSON(n.mark))}};Ze.jsonID("removeMark",wt);var qt=class extends Ze{constructor(e,n){super(),this.pos=e,this.mark=n;}apply(e){let n=e.nodeAt(this.pos);if(!n)return Be.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Be.fromReplace(e,this.pos,this.pos+1,new B(N.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;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new qt(this.pos,n.marks[i]);return new qt(this.pos,this.mark)}}return new hn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qt(n.pos,this.mark)}toJSON(){return {stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new qt(n.pos,e.markFromJSON(n.mark))}};Ze.jsonID("addNodeMark",qt);var hn=class extends Ze{constructor(e,n){super(),this.pos=e,this.mark=n;}apply(e){let n=e.nodeAt(this.pos);if(!n)return Be.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Be.fromReplace(e,this.pos,this.pos+1,new B(N.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return !n||!this.mark.isInSet(n.marks)?this:new qt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new hn(n.pos,this.mark)}toJSON(){return {stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new hn(n.pos,e.markFromJSON(n.mark))}};Ze.jsonID("removeNodeMark",hn);var De=class extends Ze{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i;}apply(e){return this.structure&&Va(e,this.from,this.to)?Be.fail("Structure replace would overwrite content"):Be.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new gt([this.from,this.to-this.from,this.slice.size])}invert(e){return new De(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new De(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof De)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?B.empty:new B(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new De(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?B.empty:new B(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new De(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};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")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new De(n.from,n.to,B.fromJSON(e,n.slice),!!n.structure)}};Ze.jsonID("replace",De);var Me=class extends Ze{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a;}apply(e){if(this.structure&&(Va(e,this.from,this.gapFrom)||Va(e,this.gapTo,this.to)))return Be.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Be.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Be.fromReplace(e,this.from,this.to,r):Be.fail("Content does not fit in gap")}getMap(){return new gt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Me(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Me(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 Me(n.from,n.to,n.gapFrom,n.gapTo,B.fromJSON(e,n.slice),n.insert,!!n.structure)}};Ze.jsonID("replaceAround",Me);function Va(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 lv(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,n),h=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(h)||(s&&s.to==f&&s.mark.eq(u[m])?s.to=p:i.push(s=new wt(f,p,u[m])));a&&a.to==f?a.to=p:o.push(a=new Gt(f,p,r));}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l));}function cv(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof nr){let c=s.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c);}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let d=0;d<l.length;d++){let u=l[d],f;for(let p=0;p<i.length;p++){let h=i[p];h.step==o-1&&u.eq(i[p].style)&&(f=h);}f?(f.to=c,f.step=o):i.push({style:u,from:Math.max(a,e),to:c,step:o});}}}),i.forEach(s=>t.step(new wt(s.from,s.to,s.style)));}function qa(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new De(a,d,B.empty));else {r=u;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new wt(a,d,c.marks[f]));if(i&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(c.text);)h||(h=new B(N.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new De(a+f.index,a+f.index+f[0].length,h));}}a=d;}if(!r.validEnd){let l=r.fillBefore(N.empty,!0);t.replace(a,a,new B(l,0,0));}for(let l=s.length-1;l>=0;l--)t.step(s[l]);}function dv(t,e,n){return (e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function mn(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(r<t.depth&&i.canReplace(o,s,n))return r;if(r==0||i.type.spec.isolating||!dv(i,o,s))break}return null}function uv(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,c=a,d=N.empty,u=0;for(let h=o,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,d=N.from(r.node(h).copy(d)),u++):l--;let f=N.empty,p=0;for(let h=o,m=!1;h>n;h--)m||i.after(h+1)<i.end(h)?(m=!0,f=N.from(i.node(h).copy(f)),p++):c++;t.step(new Me(l,c,s,a,new B(d.append(f),u,p),d.size-u,!0));}function Ir(t,e,n=null,r=t){let i=fv(t,e),o=i&&pv(r,e);return o?i.map(Mu).concat({type:e,attrs:n}).concat(o.map(Mu)):null}function Mu(t){return {type:t,attrs:null}}function fv(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function pv(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return !l||!l.validEnd?null:s}function hv(t,e,n){let r=N.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=N.from(n[s].type.create(n[s].attrs,r));}let i=e.start,o=e.end;t.step(new Me(i,o,i,o,new B(r,0,0),n.length,!0));}function mv(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,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&gv(t.doc,t.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0);}c===!1&&Pu(t,s,a,o),qa(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let d=t.mapping.slice(o),u=d.map(a,1),f=d.map(a+s.nodeSize,1);return t.step(new Me(u,f,u+1,f-1,new B(N.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Lu(t,s,a,o),!1}});}function Lu(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create());}}});}function Pu(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(`
22
+ `));}});}function gv(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function bv(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 Me(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new B(N.from(s),0,0),1,!0));}function Mt(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 c=i.depth-1,d=n-2;c>o;c--,d--){let u=i.node(c),f=i.index(c);if(u.type.spec.isolating)return !1;let p=u.content.cutByIndex(f,u.childCount),h=r&&r[d+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!m.type.validContent(p))return !1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function yv(t,e,n=1,r){let i=t.doc.resolve(e),o=N.empty,s=N.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){o=N.from(i.node(a).copy(o));let d=r&&r[c];s=N.from(d?d.type.create(d.attrs,s):i.node(a).copy(s));}t.step(new De(e,e,new B(o.append(s),n,n),!0));}function Rt(t,e){let n=t.resolve(e),r=n.index();return Bu(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ev(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;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return !1}return n.validEnd}function Bu(t,e){return !!(t&&e&&!t.isLeaf&&Ev(t,e))}function ir(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&Bu(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i);}}function vv(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 d=s.whitespace=="pre",u=!!s.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0);}let a=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);Pu(t,d.node(),d.before(),a);}s.inlineContent&&qa(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new De(c,l.map(e+n,-1),B.empty,!0)),r===!0){let d=t.doc.resolve(c);Lu(t,d.node(),d.before(),t.steps.length);}return t}function wv(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<r.node(i).childCount)return null}return null}function Co(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),d=!1;if(o==1)d=c.canReplace(l,l,i);else {let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0]);}if(d)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Ei(t,e,n=e,r=B.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return zu(i,o,r)?new De(e,n,r):new Wa(i,o,r).fit()}function zu(t,e,n){return !n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var Wa=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=N.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=N.from(e.node(i).copy(this.placed));}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):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,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new B(o,s,a);return e>-1?new Me(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new De(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(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=$a(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(n==1&&(s?c.matchType(s.type)||(u=c.fillBefore(N.from(s),!1)):o&&l.compatibleContent(o.type)))return {sliceDepth:r,frontierDepth:a,parent:o,inject:u};if(n==2&&s&&(d=c.findWrapping(s.type)))return {sliceDepth:r,frontierDepth:a,parent:o,wrap:d};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=$a(e,n);return !i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new B(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=$a(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new B(gi(e,n-1,1),n-1,o?n-1:r);}else this.unplaced=new B(gi(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 m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,d=[],{match:u,type:f}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)d.push(i.child(m));u=u.matchFragment(i);}let p=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let m=a.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(u=g,d.push(Fu(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?p:-1)));}let h=c==a.childCount;h||(p=-1),this.placed=bi(this.placed,n,N.from(d)),this.frontier[n].match=u,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<p;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content;}this.unplaced=h?e==0?B.empty:new B(gi(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new B(gi(s.content,e,c),s.openStart,s.openEnd);}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ka(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return -1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&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<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Ka(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=Ka(e,a,c,l,!0);if(!d||d.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=bi(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=bi(this.placed,this.depth,N.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch});}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(N.empty,!0);n.childCount&&(this.placed=bi(this.placed,this.frontier.length,n));}};function gi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(gi(t.firstChild.content,e-1,n)))}function bi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(bi(t.lastChild.content,e-1,n)))}function $a(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Fu(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Fu(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(N.empty,!0)))),t.copy(r)}function Ka(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 a=r.fillBefore(o.content,!0,s);return a&&!xv(n,o.content,s)?a:null}function xv(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return !0;return !1}function Sv(t){return t.spec.defining||t.spec.definingForContent}function Cv(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(zu(i,o,r))return t.step(new De(e,n,r));let s=Hu(i,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let f=i.depth,p=i.pos-1;f>0;f--,p--){let h=i.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?a=f:i.before(f)==p&&s.splice(1,0,-f);}let l=s.indexOf(a),c=[],d=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content;}for(let f=d-1;f>=0;f--){let p=c[f],h=Sv(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(a)-1)))d=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+d+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let g=s[(m+l)%s.length],b=!0;g<0&&(b=!1,g=-g);let v=i.node(g-1),S=i.index(g-1);if(v.canReplaceWith(S,S,h.type,h.marks))return t.replace(i.before(g),b?o.after(g):n,new B(Uu(r.content,0,r.openStart,p),p,r.openEnd))}}let u=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>u));f--){let p=s[f];p<0||(e=i.before(p),n=o.after(p));}}function Uu(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Uu(o.content,e+1,n,r,o)));}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(N.empty,!0));}return t}function kv(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=wv(t.doc,e,r.type);i!=null&&(e=n=i);}t.replaceRange(e,n,new B(N.from(r),0,0));}function Nv(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Hu(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}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 Hu(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.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 On=class extends Ze{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 Be.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 Be.fromReplace(e,this.pos,this.pos+1,new B(N.from(i),0,n.isLeaf?0:1))}getMap(){return gt.empty}invert(e){return new On(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 On(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 On(n.pos,n.attr,n.value)}};Ze.jsonID("attr",On);var rr=class extends Ze{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 Be.ok(r)}getMap(){return gt.empty}invert(e){return new rr(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 rr(n.attr,n.value)}};Ze.jsonID("docAttr",rr);var Dr=class extends Error{};Dr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Dr.prototype=Object.create(Error.prototype);Dr.prototype.constructor=Dr;Dr.prototype.name="TransformError";var Dn=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Rn;}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Dr(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=B.empty){let i=Ei(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new B(N.from(r),0,0))}delete(e,n){return this.replace(e,n,B.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Cv(this,e,n,r),this}replaceRangeWith(e,n,r){return kv(this,e,n,r),this}deleteRange(e,n){return Nv(this,e,n),this}lift(e,n){return uv(this,e,n),this}join(e,n=1){return vv(this,e,n),this}wrap(e,n){return hv(this,e,n),this}setBlockType(e,n=e,r,i=null){return mv(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return bv(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new On(e,n,r)),this}setDocAttribute(e,n){return this.step(new rr(e,n)),this}addNodeMark(e,n){return this.step(new qt(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof be)n.isInSet(r.marks)&&this.step(new hn(e,n));else {let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new hn(e,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a]);}return this}split(e,n=1,r){return yv(this,e,n,r),this}addMark(e,n,r){return lv(this,e,n,r),this}removeMark(e,n,r){return cv(this,e,n,r),this}clearIncompatible(e,n,r){return qa(this,e,n,r),this}};var ja=Object.create(null),q=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Pr(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<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return !1;return !0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=B.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],d=e.mapping.slice(o);e.replaceRange(d.map(l.pos),d.map(c.pos),a?B.empty:n),a==0&&Vu(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1);}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),c=l.map(s.pos),d=l.map(a.pos);o?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),Vu(e,r,n.isInline?-1:1));}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new H(e):Lr(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Lr(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Lr(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 je(e.node(0))}static atStart(e){return Lr(e,e,0,0,1)||new je(e)}static atEnd(e){return Lr(e,e,e.content.size,e.childCount,-1)||new je(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ja[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 ja)throw new RangeError("Duplicate use of selection JSON ID "+e);return ja[e]=n,n.prototype.jsonID=e,n}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}};q.prototype.visible=!0;var Pr=class{constructor(e,n){this.$from=e,this.$to=n;}},$u=!1;function Ku(t){!$u&&!t.parent.inlineContent&&($u=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"));}var H=class extends q{constructor(e,n=e){Ku(e),Ku(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 q.near(r);let i=e.resolve(n.map(this.anchor));return new H(i.parent.inlineContent?i:r,r)}replace(e,n=B.empty){if(super.replace(e,n),n==B.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r);}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Br(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 H(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=q.findFrom(n,r,!0)||q.findFrom(n,-r,!0);if(o)n=o.$head;else return q.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(q.findFrom(e,-r,!0)||q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new H(e,n)}};q.jsonID("text",H);var Br=class{constructor(e,n){this.anchor=e,this.head=n;}map(e){return new Br(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}},W=class extends q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n;}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?q.near(o):new W(o)}content(){return new B(N.from(this.node),0,0)}eq(e){return e instanceof W&&e.anchor==this.anchor}toJSON(){return {type:"node",anchor:this.anchor}}getBookmark(){return new wi(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new W(e.resolve(n.anchor))}static create(e,n){return new W(e.resolve(n))}static isSelectable(e){return !e.isText&&e.type.spec.selectable!==!1}};W.prototype.visible=!1;q.jsonID("node",W);var wi=class{constructor(e){this.anchor=e;}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Br(r,r):new wi(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&W.isSelectable(r)?new W(n):q.near(n)}},je=class extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size));}replace(e,n=B.empty){if(n==B.empty){e.delete(0,e.doc.content.size);let r=q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r);}else super.replace(e,n);}toJSON(){return {type:"all"}}static fromJSON(e){return new je(e)}map(e){return new je(e)}eq(e){return e instanceof je}getBookmark(){return Tv}};q.jsonID("all",je);var Tv={map(){return this},resolve(t){return new je(t)}};function Lr(t,e,n,r,i,o=!1){if(e.inlineContent)return H.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&W.isSelectable(a))return W.create(t,n-(i<0?a.nodeSize:0))}else {let l=Lr(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i;}return null}function Vu(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof De||i instanceof Me))return;let o=t.mapping.maps[r],s;o.forEach((a,l,c,d)=>{s==null&&(s=d);}),t.setSelection(q.near(t.doc.resolve(s),n));}var Wu=1,ko=2,Gu=4,Ya=class extends Dn{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.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Wu)&~ko,this.storedMarks=null,this}get selectionSet(){return (this.updated&Wu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ko,this}ensureMarks(e){return be.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&ko)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ko,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)||be.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(q.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|=Gu,this}get scrolledIntoView(){return (this.updated&Gu)>0}};function qu(t,e){return !e||!t?t:t.bind(e)}var or=class{constructor(e,n,r){this.name=e,this.init=qu(n.init,r),this.apply=qu(n.apply,r);}},_v=[new or("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new or("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new or("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new or("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],vi=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=_v.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 or(r.key,r.spec.state,r));});}},gn=class{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;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return !1}return !0}applyTransaction(e){if(!this.filterTransaction(e))return {state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,c=i?i[s].state:this,d=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(d&&r.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<s?{state:r,n:n.length}:{state:this,n:0});}n.push(d),r=r.applyInner(d),o=!0;}i&&(i[s]={state:r,n:n.length});}}if(!o)return {state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new gn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n);}return n}get tr(){return new Ya(this)}static create(e){let n=new vi(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new gn(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new vi(this.schema,e.plugins),r=n.fields,i=new gn(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i);}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.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 vi(e.schema,e.plugins),o=new gn(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=et.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=q.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 a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=c.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o);}}),o}};function ju(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ju(i,e,{})),n[r]=i;}return n}var Z=class{constructor(e){this.spec=e,this.props={},e.props&&ju(e.props,this,this.props),this.key=e.key?e.key.key:Ju("plugin");}getState(e){return e[this.key]}},Ja=Object.create(null);function Ju(t){return t in Ja?t+"$"+ ++Ja[t]:(Ja[t]=0,t+"$")}var re=class{constructor(e="key"){this.key=Ju(e);}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var tt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},$r=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},nl=null,yn=function(t,e,n){let r=nl||(nl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Mv=function(){nl=null;},ur=function(t,e,n,r){return n&&(Yu(t,e,n,r,-1)||Yu(t,e,n,r,1))},Av=/^(img|br|input|textarea|hr)$/i;function Yu(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return !0;if(e==(i<0?0:It(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Ai(t)||Av.test(t.nodeName)||t.contentEditable=="false")return !1;e=tt(t)+(i<0?0:1),t=s;}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return !1;else t=s,e=i<0?It(t):0;}else return !1}}function It(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ov(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=It(t);}else if(t.parentNode&&!Ai(t))e=tt(t),t=t.parentNode;else return null}}function Rv(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0;}else if(t.parentNode&&!Ai(t))e=tt(t)+1,t=t.parentNode;else return null}}function Dv(t,e,n){for(let r=e==0,i=e==It(t);r||i;){if(t==n)return !0;let o=tt(t);if(t=t.parentNode,!t)return !1;r=r&&o==0,i=i&&o==It(t);}}function Ai(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Do=function(t){return t.focusNode&&ur(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function sr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Iv(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Lv(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return {node:r.offsetNode,offset:Math.min(It(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return {node:r.startContainer,offset:Math.min(It(r.startContainer),r.startOffset)}}}var Zt=typeof navigator<"u"?navigator:null,Zu=typeof document<"u"?document:null,zn=Zt&&Zt.userAgent||"",rl=/Edge\/(\d+)/.exec(zn),Af=/MSIE \d/.exec(zn),il=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zn),xt=!!(Af||il||rl),Bn=Af?document.documentMode:il?+il[1]:rl?+rl[1]:0,Kt=!xt&&/gecko\/(\d+)/i.test(zn);Kt&&+(/Firefox\/(\d+)/.exec(zn)||[0,0])[1];var ol=!xt&&/Chrome\/(\d+)/.exec(zn),ut=!!ol,Of=ol?+ol[1]:0,bt=!xt&&!!Zt&&/Apple Computer/.test(Zt.vendor),Kr=bt&&(/Mobile\/\w+/.test(zn)||!!Zt&&Zt.maxTouchPoints>2),Dt=Kr||(Zt?/Mac/.test(Zt.platform):!1),Pv=Zt?/Win/.test(Zt.platform):!1,En=/Android \d/.test(zn),Oi=!!Zu&&"webkitFontSmoothing"in Zu.documentElement.style,Bv=Oi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function zv(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 bn(t,e){return typeof t=="number"?t:t[e]}function Fv(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 Xu(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;){if(s.nodeType!=1){s=$r(s);continue}let a=s,l=a==o.body,c=l?zv(o):Fv(a),d=0,u=0;if(e.top<c.top+bn(r,"top")?u=-(c.top-e.top+bn(i,"top")):e.bottom>c.bottom-bn(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+bn(i,"top")-c.top:e.bottom-c.bottom+bn(i,"bottom")),e.left<c.left+bn(r,"left")?d=-(c.left-e.left+bn(i,"left")):e.right>c.right-bn(r,"right")&&(d=e.right-c.right+bn(i,"right")),d||u)if(l)o.defaultView.scrollBy(d,u);else {let p=a.scrollLeft,h=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let m=a.scrollLeft-p,g=a.scrollTop-h;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g};}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:$r(s);}}function Uv(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<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(o,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return {refDOM:r,refTop:i,stack:Rf(t.dom)}}function Rf(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=$r(r));return e}function Hv({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Df(n,r==0?0:r-e);}function Df(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o);}}var zr=null;function $v(t){if(t.setActive)return t.setActive();if(zr)return t.focus(zr);let e=Rf(t);t.focus(zr==null?{get preventScroll(){return zr={preventScroll:!0},!0}}:void 0),zr||(zr=!1,Df(e,0));}function If(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,l,c;for(let d=t.firstChild,u=0;d;d=d.nextSibling,u++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=yn(d).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){n=d,r=m,i=m&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,d.nodeType==1&&m&&(o=u+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=d,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(o=u+1);}}return !n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?Kv(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:If(n,i)}function Kv(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=In(r,1);if(o.top!=o.bottom&&El(e,o))return {node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return {node:t,offset:0}}function El(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Vv(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Wv(t,e,n){let{node:r,offset:i}=If(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1;}return t.docView.posFromDOM(r,i,o)}function Gv(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText))return (a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;o=a.dom.parentNode;}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Lf(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(El(e,c))return Lf(s,e,c)}}if((o=(o+1)%r)==i)break}return t}function qv(t,e){let n=t.dom.ownerDocument,r,i=0,o=Lv(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!El(e,c)||(s=Lf(t.dom,e,c),!s))return null}if(bt)for(let c=s;r&&c;c=$r(c))c.draggable&&(r=void 0);if(s=Vv(s,e),r){if(Kt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++;}let c;Oi&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Gv(t,r,i,e));}a==null&&(a=Wv(t,s,e));let l=t.docView.nearestDesc(s,!0);return {pos:a,inside:l?l.posAtStart-l.border:-1}}function Qu(t){return t.top<t.bottom||t.left<t.right}function In(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Qu(r))return r}return Array.prototype.find.call(n,Qu)||t.getBoundingClientRect()}var jv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Pf(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Oi||Kt;if(r.nodeType==3)if(s&&(jv.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=In(yn(r,i,i),n);if(Kt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=In(yn(r,i-1,i-1),-1);if(c.top==l.top){let d=In(yn(r,i,i+1),-1);if(d.top!=l.top)return xi(d,d.left<c.left)}}return l}else {let l=i,c=i,d=n<0?1:-1;return n<0&&!i?(c++,d=-1):n>=0&&i==r.nodeValue.length?(l--,d=1):n<0?l--:c++,xi(In(yn(r,l,c),d),d<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==It(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Za(l.getBoundingClientRect(),!1)}if(o==null&&i<It(r)){let l=r.childNodes[i];if(l.nodeType==1)return Za(l.getBoundingClientRect(),!0)}return Za(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==It(r))){let l=r.childNodes[i-1],c=l.nodeType==3?yn(l,It(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return xi(In(c,1),!1)}if(o==null&&i<It(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?yn(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return xi(In(c,-1),!0)}return xi(In(r.nodeType==3?yn(r):r,-n),n>=0)}function xi(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 Za(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 Bf(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 Jv(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Bf(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode;}let s=Pf(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=yn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(n=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return !1}}return !0})}var Yv=/[\u0590-\u08ac]/;function Zv(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,a=t.domSelection();return a?!Yv.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Bf(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==m;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c);}catch{}return f!=null&&(a.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}var ef=null,tf=null,nf=!1;function Xv(t,e,n){return ef==e&&tf==n?nf:(ef=e,tf=n,nf=n=="up"||n=="down"?Jv(t,e,n):Zv(t,e,n))}var Lt=0,rf=1,ar=2,Xt=3,fr=class{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Lt,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;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy();}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size;}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else {for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling;}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else {let o,s;if(e==this.contentDOM)o=e.childNodes[n];else {for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling;}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>tt(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;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let a=i.children[s];if(a.size){i=a;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o;}}domFromPos(e,n){if(!this.contentDOM)return {node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof To){i=e-o;break}o=a;}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 No&&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?tt(o.dom)+1:0}}else {let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?tt(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return {node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(i==-1&&e<=c){let d=s+l.border;if(e>=d&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,d);e=s;for(let u=a;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=tt(f.dom)+1;break}e-=f.size;}i==-1&&(i=0);}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){o=tt(u.dom);break}n+=u.size;}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c;}return {node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return !1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let p=0,h=0;p<this.children.length;p++){let m=this.children[p],g=h+m.size;if(o>h&&s<g)return m.setSelection(e-h-m.border,n-h-m.border,r,i);h=g;}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((Kt||bt)&&e==n){let{node:p,offset:h}=a;if(p.nodeType==3){if(u=!!(h&&p.nodeValue[h-1]==`
23
+ `),u&&h==p.nodeValue.length)for(let m=p,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:tt(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else {let m=p.childNodes[h-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false");}}if(Kt&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0);}if(!(i||u&&bt)&&ur(a.node,a.offset,d.anchorNode,d.anchorOffset)&&ur(l.node,l.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==n)&&!u){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0;}catch{}}if(!f){if(e>n){let h=a;a=l,l=h;}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p);}}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<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?ar:rf,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Xt:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?ar:Xt;}r=s;}this.dirty=ar;}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ar:rf;n.dirty<r&&(n.dirty=r);}}get domAtom(){return !1}get ignoreForCoords(){return !1}get ignoreForSelection(){return !1}isText(e){return !1}},No=class extends fr{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a;}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==Lt&&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 ignoreForSelection(){return !!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},sl=class extends fr{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}},wn=class extends fr{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=$t.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new wn(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Xt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Xt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Lt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Lt;}}slice(e,n,r){let i=wn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=dl(o,n,s,r)),e>0&&(o=dl(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy();}},Jt=class extends fr{constructor(e,n,r,i,o,s,a,l,c){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a;}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],l,c=a&&a(n,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=$t.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!u&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=Uf(d,r,n),c?l=new al(e,n,r,i,d,u||null,f,c,o,s+1):n.isText?new Vr(e,n,r,i,d,f,o):new Jt(e,n,r,i,d,u||null,f,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=()=>N.empty);}return e}matchesNode(e,n,r){return this.dirty==Lt&&e.eq(this.node)&&_o(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,a=o&&o.pos<0,l=new cl(this,s&&s.node,e);nw(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?be.none:this.node.child(d).marks,r,e),l.placeWidget(c,e,i);},(c,d,u,f)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,d,u,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,d,u,p,e)||l.updateNextNode(c,d,u,e,f,i)||l.addNode(c,d,u,e,i),i+=c.nodeSize;}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ar)&&(s&&this.protectLocalComposition(e,s),zf(this.contentDOM,this.children,e),Kr&&rw(this.dom));}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof H)||r<n||i>n+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,a=iw(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,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 sl(this,o,n,i);e.input.compositionNodes.push(s),this.children=dl(this.children,r,r+i.length,e,s);}update(e,n,r,i){return this.dirty==Xt||!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=Lt;}updateOuterDeco(e){if(_o(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ff(this.dom,this.nodeDOM,ll(this.outerDeco,this.node,n),ll(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 of(t,e,n,r,i){Uf(r,e,t);let o=new Jt(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}var Vr=class extends Jt{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,a,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==Xt||this.dirty!=Lt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Lt||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=Lt,!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 Vr(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=Xt);}get domAtom(){return !1}isText(e){return this.node.text==e}},To=class extends fr{parseRule(){return {ignore:!0}}matchesHack(e){return this.dirty==Lt&&this.dom.nodeName==e}get domAtom(){return !0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},al=class extends Jt{constructor(e,n,r,i,o,s,a,l,c,d){super(e,n,r,i,o,s,a,c,d),this.spec=l;}update(e,n,r,i){if(this.dirty==Xt)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.root):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 zf(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=sf(r),i=!0;r=r.nextSibling;}else i=!0,t.insertBefore(a,r);if(s instanceof wn){let l=r?r.previousSibling:t.lastChild;zf(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild;}}for(;r;)r=sf(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null);}var Si=function(t){t&&(this.nodeName=t);};Si.prototype=Object.create(null);var lr=[new Si];function ll(t,e,n){if(t.length==0)return lr;let r=n?lr[0]:new Si,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Si(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new Si(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l));}}}return i}function Ff(t,e,n,r){if(n==lr&&r==lr)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=lr[0]),i=l;}Qv(i,a||lr[0],s);}return i}function Qv(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class");}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1]);}n.style&&(t.style.cssText+=n.style);}}function Uf(t,e,n){return Ff(t,t,lr,ll(e,n,t.nodeType!=1))}function _o(t,e){if(t.length!=e.length)return !1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return !1;return !0}function sf(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}var cl=class{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ew(e.node.content,e);}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0;}}destroyRest(){this.destroyBetween(this.index,this.top.children.length);}syncToMarks(e,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Lt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[o])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else {let l=wn.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,l),this.top=l,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 a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==Xt&&s.dom==s.contentDOM&&(s.dirty=ar),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return -1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return -1}e=n;}}updateNextNode(e,n,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Jt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return !1;let d=l.dom,u,f=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Xt&&_o(n,l.outerDeco));if(!f&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(l,e,n,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=ar,u.updateChildren(i,s+1),u.dirty=Lt),this.changed=!0,this.index++,!0;break}}return !1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!_o(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Jt.create(this.top,n,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a;}return e.destroy(),a}addNode(e,n,r,i,o){let s=Jt.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0;}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else {let o=new No(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0;}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof wn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Vr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((bt||ut)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top));}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else {let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new To(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0;}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function ew(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof wn)n=c,r=c.children.length;else {a=c,r--;break}}else {if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent;}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,o.set(a,i),s.push(a);}}return {index:i,matched:o,matches:s.reverse()}}function tw(t,e){return t.type.side-e.type.side}function nw(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);r(d,i,e.forChild(o,d),c),o+=d.nodeSize;}return}let s=0,a=[],l=null;for(let c=0;;){let d,u;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(d?(u||(u=[d])).push(g):d=g);}if(d)if(u){u.sort(tw);for(let g=0;g<u.length;g++)n(u[g],c,!!l);}else n(d,c,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(c<t.childCount)p=c,f=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=o&&a.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let h=o+f.nodeSize;if(f.isText){let g=h;s<i.length&&i[s].from<g&&(g=i[s].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<h&&(l=f.cut(g-o),f=f.cut(0,g-o),h=g,p=-1);}else for(;s<i.length&&i[s].to<h;)s++;let m=f.isInline&&!f.isLeaf?a.filter(g=>!g.inline):a.slice();r(f,m,e.forChild(o,f),p),o=h;}}function rw(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 iw(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<t.childCount;){let c=t.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text;}if(o>=n){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return -1}function dl(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,d=a+=l.size;c>=n||d<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(l.slice(n-c,l.size,r)));}return o}function vl(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 a=r.resolve(s),l,c;if(Do(n)){for(l=s;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&W.isSelectable(u)&&i.parent&&!(u.isInline&&Dv(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new W(s==f?a:r.resolve(f));}}else {if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let u=s,f=s;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);u=Math.min(u,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(h.endContainer,h.endOffset,-1));}if(u<0)return null;[l,s]=f==t.state.selection.anchor?[f,u]:[u,f],a=r.resolve(s);}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let u=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;c=wl(t,d,a,u);}return c}function Hf(t){return t.editable?t.hasFocus():Kf(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function vn(t,e=!1){let n=t.state.selection;if($f(t,n),!!Hf(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ut){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ur(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)sw(t);else {let{anchor:r,head:i}=n,o,s;af&&!(n instanceof H)&&(n.$from.parent.inlineContent||(o=lf(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=lf(t,n.to))),t.docView.setSelection(r,i,t,e),af&&(o&&cf(o),s&&cf(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ow(t));}t.domObserver.setCurSelection(),t.domObserver.connectSelection();}}var af=bt||ut&&Of<63;function lf(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(bt&&i&&i.contentEditable=="false")return Xa(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Xa(i);if(o)return Xa(o)}}function Xa(t){return t.contentEditable="true",bt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function cf(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null);}function ow(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Hf(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection");},20));});}function sw(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,tt(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&xt&&Bn<=11&&(r.disabled=!0,r.disabled=!1);}function $f(t,e){if(e instanceof W){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(df(t),n&&n.selectNode(),t.lastSelectedViewDesc=n);}else df(t);}function df(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0);}function wl(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||H.between(e,n,r)}function uf(t){return t.editable&&!t.hasFocus()?!1:Kf(t)}function Kf(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 aw(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ur(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ul(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&&q.findFrom(o,e)}function Ln(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function ff(t,e,n){let r=t.state.selection;if(r instanceof H)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 Ln(t,new H(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=ul(t.state,e);return i&&i instanceof W?Ln(t,i):!1}else if(!(Dt&&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 a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?W.isSelectable(o)?Ln(t,new W(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Oi?Ln(t,new H(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return !1;else {if(r instanceof W&&r.node.isInline)return Ln(t,new H(e>0?r.$to:r.$from));{let i=ul(t.state,e);return i?Ln(t,i):!1}}}function Mo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ci(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Fr(t,e){return e<0?lw(t):cw(t)}function lw(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(Kt&&n.nodeType==1&&r<Mo(n)&&Ci(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Ci(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else {if(Vf(n))break;{let a=n.previousSibling;for(;a&&Ci(a,-1);)i=n.parentNode,o=tt(a),a=a.previousSibling;if(a)n=a,r=Mo(n);else {if(n=n.parentNode,n==t.dom)break;r=0;}}}s?fl(t,n,r):i&&fl(t,i,o);}function cw(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Mo(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Ci(a,1))o=n,s=++r;else break}else {if(Vf(n))break;{let a=n.nextSibling;for(;a&&Ci(a,1);)o=a.parentNode,s=tt(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Mo(n);else {if(n=n.parentNode,n==t.dom)break;r=i=0;}}}o&&fl(t,o,s);}function Vf(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function dw(t,e){for(;t&&e==t.childNodes.length&&!Ai(t);)e=tt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0;}}function uw(t,e){for(;t&&!e&&!Ai(t);)e=tt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length;}}function fl(t,e,n){if(e.nodeType!=3){let o,s;(s=dw(e,n))?(e=s,n=0):(o=uw(e,n))&&(e=o,n=o.nodeValue.length);}let r=t.domSelection();if(!r)return;if(Do(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o);}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&vn(t);},50);}function pf(t,e){let n=t.state.doc.resolve(e);if(!(ut||Pv)&&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&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function hf(t,e,n){let r=t.state.selection;if(r instanceof H&&!r.empty||n.indexOf("s")>-1||Dt&&n.indexOf("m")>-1)return !1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=ul(t.state,e);if(s&&s instanceof W)return Ln(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof je?q.near(s,e):q.findFrom(s,e);return a?Ln(t,a):!1}return !1}function mf(t,e){if(!(t.state.selection instanceof H))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 gf(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start();}function fw(t){if(!bt||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;gf(t,r,"true"),setTimeout(()=>gf(t,r,"false"),20);}return !1}function pw(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function hw(t,e){let n=e.keyCode,r=pw(e);if(n==8||Dt&&n==72&&r=="c")return mf(t,-1)||Fr(t,-1);if(n==46&&!e.shiftKey||Dt&&n==68&&r=="c")return mf(t,1)||Fr(t,1);if(n==13||n==27)return !0;if(n==37||Dt&&n==66&&r=="c"){let i=n==37?pf(t,t.state.selection.from)=="ltr"?-1:1:-1;return ff(t,i,r)||Fr(t,i)}else if(n==39||Dt&&n==70&&r=="c"){let i=n==39?pf(t,t.state.selection.from)=="ltr"?1:-1:1;return ff(t,i,r)||Fr(t,i)}else {if(n==38||Dt&&n==80&&r=="c")return hf(t,-1,r)||Fr(t,-1);if(n==40||Dt&&n==78&&r=="c")return fw(t)||hf(t,1,r)||Fr(t,1);if(r==(Dt?"m":"c")&&(n==66||n==73||n==89||n==90))return !0}return !1}function xl(t,e){t.someProp("transformCopied",p=>{e=p(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 p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content;}let s=t.someProp("clipboardSerializer")||$t.fromSchema(t.state.schema),a=Yf(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Jf[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let h=a.createElement(d[p]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),u++;}c=l.firstChild;}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
24
+
25
+ `);return {dom:l,text:f,slice:e}}function Wf(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,o||r,t);}),o)return e?new B(N.from(t.state.schema.text(e.replace(/\r\n?/g,`
26
+ `))),0,0):B.empty;let u=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(u)a=u;else {let f=i.marks(),{schema:p}=t.state,h=$t.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,f)));});}}else t.someProp("transformPastedHTML",u=>{n=u(n,t);}),s=yw(n),Oi&&Ew(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f;}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||_t.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!mw.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)a=vw(bf(a,+d[1],+d[2]),d[4]);else if(a=B.maxOpen(gw(a.content,i),!0),a.openStart||a.openEnd){let u=0,f=0;for(let p=a.content.firstChild;u<a.openStart&&!p.type.spec.isolating;u++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=bf(a,u,f);}return t.someProp("transformPasted",u=>{a=u(a,t);}),a}var mw=/^(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 gw(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(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&qf(l,o,a,s[s.length-1],0))s[s.length-1]=c;else {s.length&&(s[s.length-1]=jf(s[s.length-1],o.length));let d=Gf(a,l);s.push(d),i=i.matchType(d.type),o=l;}}),s)return N.from(s)}return t}function Gf(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,N.from(t));return t}function qf(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=qf(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(N.from(Gf(n,t,i+1))))}}function jf(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,jf(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(N.empty,!0);return t.copy(n.append(r))}function pl(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=pl(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(N.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function bf(t,e,n){return e<t.openStart&&(t=new B(pl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new B(pl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var Jf={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},yf=null;function Yf(){return yf||(yf=document.implementation.createHTMLDocument("title"))}var Qa=null;function bw(t){let e=window.trustedTypes;return e?(Qa||(Qa=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Qa.createHTML(t)):t}function yw(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Yf().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Jf[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=bw(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function Ew(t){let e=t.querySelectorAll(ut?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r);}}function vw(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e);}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=N.from(l.create(r[a+1],i)),o++,s++;}return new B(i,o,s)}var yt={},Et={},ww={touchstart:!0,touchmove:!0},hl=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=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 xw(t){for(let e in yt){let n=yt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Cw(t,r)&&!Sl(t,r)&&(t.editable||!(r.type in Et))&&n(t,r);},ww[e]?{passive:!0}:void 0);}bt&&t.dom.addEventListener("input",()=>null),ml(t);}function Pn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now();}function Sw(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 ml(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Sl(t,r));});}function Sl(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Cw(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 kw(t,e){!Sl(t,e)&&yt[e.type]&&(t.editable||!(e.type in Et))&&yt[e.type](t,e);}Et.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Xf(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(En&&ut&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Kr&&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,sr(13,"Enter"))),t.input.lastIOSEnter=0);},200);}else t.someProp("handleKeyDown",r=>r(t,n))||hw(t,n)?n.preventDefault():Pn(t,"key");};Et.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1);};Et.keypress=(t,e)=>{let n=e;if(Xf(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Dt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault();}};function Io(t){return {left:t.clientX,top:t.clientY}}function Nw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Cl(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,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return !0;return !1}function Hr(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 Tw(t,e){if(e==-1)return !1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&W.isSelectable(r)?(Hr(t,new W(n),"pointer"),!0):!1}function _w(t,e){if(e==-1)return !1;let n=t.state.selection,r,i;n instanceof W&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(W.isSelectable(a)){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?(Hr(t,W.create(t.state.doc,i),"pointer"),!0):!1}function Mw(t,e,n,r,i){return Cl(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?_w(t,n):Tw(t,n))}function Aw(t,e,n,r){return Cl(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Ow(t,e,n,r){return Cl(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Rw(t,n,r)}function Rw(t,e,n){if(n.button!=0)return !1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Hr(t,H.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),a=i.before(o);if(s.inlineContent)Hr(t,H.create(r,a+1,a+1+s.content.size),"pointer");else if(W.isSelectable(s))Hr(t,W.create(r,a),"pointer");else continue;return !0}}function kl(t){return Ao(t)}var Zf=Dt?"metaKey":"ctrlKey";yt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=kl(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&Nw(n,t.input.lastClick)&&!n[Zf]&&t.input.lastClick.button==n.button&&(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,button:n.button};let s=t.posAtCoords(Io(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new gl(t,s,n,!!r)):(o=="doubleClick"?Aw:Ow)(t,s.pos,s.inside,n)?n.preventDefault():Pn(t,"pointer"));};var gl=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[Zf],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else {let d=e.state.doc.resolve(n.pos);o=d.parent,s=d.depth?d.before():0;}let a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof W&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Kt&&!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)),Pn(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(()=>vn(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(Io(e))),this.updateAllowDefault(e),this.allowDefault||!n?Pn(this.view,"pointer"):Mw(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||bt&&this.mightDrag&&!this.mightDrag.node.isAtom||ut&&!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)?(Hr(this.view,q.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):Pn(this.view,"pointer");}move(e){this.updateAllowDefault(e),Pn(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);}};yt.touchstart=t=>{t.input.lastTouch=Date.now(),kl(t),Pn(t,"pointer");};yt.touchmove=t=>{t.input.lastTouch=Date.now(),Pn(t,"pointer");};yt.contextmenu=t=>kl(t);function Xf(t,e){return t.composing?!0:bt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var Dw=En?5e3:-1;Et.compositionstart=Et.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Ao(t,!0),t.markCursor=null;else if(Ao(t,!e.selection.empty),Kt&&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 a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1;}}t.input.composing=!0;}Qf(t,Dw);};Et.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++,Qf(t,20));};function Qf(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ao(t),e));}function ep(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Lw());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty();}function Iw(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Ov(e.focusNode,e.focusOffset),r=Rv(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 Lw(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ao(t,e=!1){if(!(En&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ep(t),e||t.docView&&t.docView.dirty){let n=vl(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return !1}}function Pw(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 ki=xt&&Bn<15||Kr&&Bv<604;yt.copy=Et.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=ki?null:n.clipboardData,s=r.content(),{dom:a,text:l}=xl(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Pw(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"));};function Bw(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function zw(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?Ni(t,r.value,null,i,e):Ni(t,r.textContent,r.innerHTML,i,e);},50);}function Ni(t,e,n,r,i){let o=Wf(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||B.empty)))return !0;if(!o)return !1;let s=Bw(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function tp(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," "):""}Et.paste=(t,e)=>{let n=e;if(t.composing&&!En)return;let r=ki?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ni(t,tp(r),r.getData("text/html"),i,n)?n.preventDefault():zw(t,n);};var Oo=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r;}},Fw=Dt?"altKey":"ctrlKey";function np(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[Fw]}yt.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(Io(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof W?i.to-1:i.to))){if(r&&r.mightDrag)s=W.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let u=t.docView.nearestDesc(n.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&(s=W.create(t.state.doc,u.posBefore));}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:d}=xl(t,a);(!n.dataTransfer.files.length||!ut||Of>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ki?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ki||n.dataTransfer.setData("text/plain",c),t.dragging=new Oo(d,np(t,n),s);};yt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null);},50);};Et.dragover=Et.dragenter=(t,e)=>e.preventDefault();Et.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Io(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",h=>{s=h(s,t);}):s=Wf(t,tp(n.dataTransfer),ki?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&np(t,n));if(t.someProp("handleDrop",h=>h(t,n,s||B.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?Co(t.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let c=t.state.tr;if(a){let{node:h}=r;h?h.replace(c):c.deleteSelection();}let d=c.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&W.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new W(p));else {let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,v)=>h=v),c.setSelection(wl(t,p,c.doc.resolve(h)));}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"));};yt.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())&&vn(t);},20));};yt.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);};yt.beforeinput=(t,e)=>{if(ut&&En&&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,sr(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 Et)yt[t]=Et[t];function Ti(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 Wr=class{constructor(e,n){this.toDOM=e,this.spec=n||cr,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 Ce(o-r,o-r,this)}valid(){return !0}eq(e){return this==e||e instanceof Wr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ti(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e);}},Yt=class{constructor(e,n){this.attrs=e,this.spec=n||cr;}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 Ce(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Yt&&Ti(this.attrs,e.attrs)&&Ti(this.spec,e.spec)}static is(e){return e.type instanceof Yt}destroy(){}},_i=class{constructor(e,n){this.attrs=e,this.spec=n||cr;}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Ce(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof _i&&Ti(this.attrs,e.attrs)&&Ti(this.spec,e.spec)}destroy(){}},Ce=class{constructor(e,n,r){this.from=e,this.to=n,this.type=r;}copy(e,n){return new Ce(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ce(e,e,new Wr(n,r))}static inline(e,n,r,i){return new Ce(e,n,new Yt(r,i))}static node(e,n,r,i){return new Ce(e,n,new _i(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Yt}get widget(){return this.type instanceof Wr}},Ur=[],cr={},me=class{constructor(e,n){this.local=e.length?e:Ur,this.children=n.length?n:Ur;}static create(e,n){return n.length?Ro(n,e,0,cr):dt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i));}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o);}}map(e,n,r){return this==dt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||cr)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec);}return this.children.length?Uw(this.children,s||[],e,n,r,i,o):s?new me(s.sort(dr),Ur):dt}add(e,n){return n.length?this==dt?me.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,l)=>{let c=l+r,d;if(d=ip(n,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,d,c+1):i.splice(o,0,l,l+a.nodeSize,Ro(d,a,c+1,cr)),o+=3;}});let s=rp(o?op(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new me(s.length?this.local.concat(s).sort(dr):this.local,i||this.children)}remove(e){return e.length==0||this==dt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+n,l=r[o+1]+n;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(s||(s=[])).push(u));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,a+1);c!=dt?r[o+2]=c:(r.splice(o,3),o-=3);}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1));}return r==this.children&&i==this.local?this:i.length||r.length?new me(i,r):dt}forChild(e,n){if(this==dt)return this;if(n.isLeaf)return me.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof Yt){let c=Math.max(o,l.from)-o,d=Math.min(s,l.to)-o;c<d&&(i||(i=[])).push(l.copy(c,d));}}if(i){let a=new me(i.sort(dr),Ur);return r?new jt([a,r]):a}return r||dt}eq(e){if(this==e)return !0;if(!(e instanceof me)||this.local.length!=e.local.length||this.children.length!=e.children.length)return !1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return !1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return !1;return !0}locals(e){return Nl(this.localsInner(e))}localsInner(e){if(this==dt)return Ur;if(e.inlineContent||!this.local.some(Yt.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Yt||n.push(this.local[r]);return n}forEachSet(e){e(this);}};me.empty=new me([],[]);me.removeOverlap=Nl;var dt=me.empty,jt=class{constructor(e){this.members=e;}map(e,n){let r=this.members.map(i=>i.map(e,n,cr));return jt.from(r)}forChild(e,n){if(n.isLeaf)return me.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=dt&&(o instanceof jt?r=r.concat(o.members):r.push(o));}return jt.from(r)}eq(e){if(!(e instanceof jt)||e.members.length!=this.members.length)return !1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return !1;return !0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else {r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s]);}}return n?Nl(r?n:n.sort(dr)):Ur}static from(e){switch(e.length){case 0:return dt;case 1:return e[0];default:return new jt(e.every(n=>n instanceof me)?e:e.reduce((n,r)=>n.concat(r instanceof me?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e);}};function Uw(t,e,n,r,i,o,s){let a=t.slice();for(let c=0,d=o;c<n.maps.length;c++){let u=0;n.maps[c].forEach((f,p,h,m)=>{let g=m-h-(p-f);for(let b=0;b<a.length;b+=3){let v=a[b+1];if(v<0||f>v+d-u)continue;let S=a[b]+d-u;p>=S?a[b+1]=f<=S?-2:-1:f>=d&&g&&(a[b]+=g,a[b+1]+=g);}u+=g;}),d=n.maps[c].map(d,-1);}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=n.map(t[c]+o),u=d-i;if(u<0||u>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+o,-1),p=f-i,{index:h,offset:m}=r.content.findIndex(u),g=r.maybeChild(h);if(g&&m==u&&m+g.nodeSize==p){let b=a[c+2].mapInner(n,g,d+1,t[c]+o+1,s);b!=dt?(a[c]=u,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0);}else l=!0;}if(l){let c=Hw(a,t,e,n,i,o,s),d=Ro(c,r,0,s);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,f=0;u<d.children.length;u+=3){let p=d.children[u];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,d.children[u],d.children[u+1],d.children[u+2]);}}return new me(e.sort(dr),a)}function rp(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Ce(i.from+e,i.to+e,i.type));}return n}function Hw(t,e,n,r,i,o,s){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,i,c);u?n.push(u):s.onRemove&&s.onRemove(l.local[d].spec);}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1);}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return n}function ip(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function op(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ro(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let c=ip(t,a,l+n);if(c){o=!0;let d=Ro(c,a,n+l+1,r);d!=dt&&i.push(l,l+a.nodeSize,d);}});let s=rp(o?op(t):t,-n).sort(dr);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new me(s,i):dt}function dr(t,e){return t.from-e.from||t.to-e.to}function Nl(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),Ef(e,i+1,o.copy(r.to,o.to)));continue}else {o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),Ef(e,i,r.copy(o.from,r.to)));break}}}return e}function Ef(t,e,n){for(;e<t.length&&dr(n,t[e])>0;)e++;t.splice(e,0,n);}function el(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=dt&&e.push(r);}),t.cursorWrapper&&e.push(me.create(t.state.doc,[t.cursorWrapper.deco])),jt.from(e)}var $w={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Kw=xt&&Bn<=11,bl=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}},yl=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bl,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);xt&&Bn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush();}),Kw&&(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,$w)),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;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.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(uf(this.view)){if(this.suppressingSelectionUpdates)return vn(this.view);if(xt&&Bn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ur(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=$r(o))n.add(o);for(let o=e.anchorNode;o;o=$r(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)&&uf(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let d=0;d<n.length;d++){let u=this.registerMutation(n[d],l);u&&(o=o<0?u.from:Math.min(u.from,o),s=s<0?u.to:Math.max(u.to,s),u.typeOver&&(a=!0));}if(Kt&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove();}else {let{focusNode:u}=this.currentSelection;for(let f of d){let p=f.parentNode;p&&p.nodeName=="LI"&&(!u||Gw(e,u)!=p)&&f.remove();}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Do(r)&&(c=vl(e))&&c.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,vn(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Vw(e)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||vn(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 d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];n.push(u),u.nodeType==3&&(this.lastChangedTextNode=u);}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return {from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(xt&&Bn<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:f}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f);}let s=i&&i.parentNode==e.target?tt(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?tt(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return {from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},vf=new WeakMap,wf=!1;function Vw(t){if(!vf.has(t)&&(vf.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Kt,wf)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),wf=!0;}}function xf(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ur(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function Ww(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return xf(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0];}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?xf(t,n):null}function Gw(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function qw(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,d=l.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Do(l)||c.push({node:l.focusNode,offset:l.focusOffset})),ut&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let b=r.childNodes[g-1],v=b.pmViewDesc;if(b.nodeName=="BR"&&!v){o=g;break}if(!v||v.size)break}let u=t.state.doc,f=t.someProp("domParser")||_t.fromSchema(t.state.schema),p=u.resolve(s),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:jw,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),h={anchor:g+s,head:b+s};}return {doc:m,sel:h,from:s,to:a}}function jw(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(bt&&/^(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||bt&&/^(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 Jw=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Yw(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let y=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,w=vl(t,y);if(w&&!t.state.selection.eq(w)){if(ut&&En&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",X=>X(t,sr(13,"Enter"))))return;let O=t.state.tr.setSelection(w);y=="pointer"?O.setMeta("pointer",!0):y=="key"&&O.scrollIntoView(),o&&O.setMeta("composition",o),t.dispatch(O);}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=qw(t,e,n),d=t.state.doc,u=d.slice(c.from,c.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=Qw(u.content,c.doc.content,c.from,f,p);if(h&&t.input.domChangeCount++,(Kr&&t.input.lastIOSEnter>Date.now()-225||En)&&i.some(y=>y.nodeType==1&&!Jw.test(y.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",y=>y(t,sr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof H&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else {if(c.sel){let y=Sf(t,t.state.doc,c.sel);if(y&&!y.eq(t.state.selection)){let w=t.state.tr.setSelection(y);o&&w.setMeta("composition",o),t.dispatch(w);}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof H&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),xt&&Bn<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" \xA0"&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),g=c.doc.resolveNoCache(h.endB-c.from),b=d.resolve(h.start),v=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=h.endA,S;if((Kr&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(y=>y.nodeName=="DIV"||y.nodeName=="P"))||!v&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"",""))&&(S=q.findFrom(c.doc.resolve(m.pos+1),1,!0))&&S.head>m.pos)&&t.someProp("handleKeyDown",y=>y(t,sr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&Xw(d,h.start,h.endA,m,g)&&t.someProp("handleKeyDown",y=>y(t,sr(8,"Backspace")))){En&&ut&&t.domObserver.suppressSelectionUpdates();return}ut&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),En&&!v&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(y){return y(t,sr(13,"Enter"))});},20));let T=h.start,_=h.endA,I=y=>{let w=y||t.state.tr.replace(T,_,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let O=Sf(t,w.doc,c.sel);O&&!(ut&&t.composing&&O.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==T||O.head==w.mapping.map(_)-1)||xt&&O.empty&&O.head==T)&&w.setSelection(O);}return o&&w.setMeta("composition",o),w.scrollIntoView()},k;if(v){if(m.pos==g.pos){xt&&Bn<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>vn(t),20));let y=I(t.state.tr.delete(T,_)),w=d.resolve(h.start).marksAcross(d.resolve(h.endA));w&&y.ensureMarks(w),t.dispatch(y);}else if(h.endA==h.endB&&(k=Zw(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,h.endA-b.start())))){let y=I(t.state.tr);k.type=="add"?y.addMark(T,_,k.mark):y.removeMark(T,_,k.mark),t.dispatch(y);}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let y=m.parent.textBetween(m.parentOffset,g.parentOffset),w=()=>I(t.state.tr.insertText(y,T,_));t.someProp("handleTextInput",O=>O(t,T,_,y,w))||t.dispatch(w());}}else t.dispatch(I());}function Sf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:wl(t,e.resolve(n.anchor),e.resolve(n.head))}function Zw(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<n.length;d++)o=n[d].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(N.from(c).eq(t))return {mark:a,type:s}}function Xw(t,e,n,r,i){if(n-e<=i.pos-r.pos||tl(r,!0,!1)<i.pos)return !1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return !1;let s=t.resolve(tl(o,!0,!0));return !s.parent.isTextblock||s.pos>n||tl(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function tl(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>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 Qw(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o;}if(s<o&&t.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&Cf(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o;}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<t.size&&Cf(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o;}return {start:o,endA:s,endB:a}}function Cf(t){if(t.length!=2)return !1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}var Mi=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 hl,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Mf),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=Tf(this),Nf(this),this.nodeViews=_f(this),this.docView=of(this.state.doc,kf(this),el(this),this.dom,this),this.domObserver=new yl(this,(r,i,o,s)=>Yw(this,r,i,o,s)),this.domObserver.start(),xw(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&&ml(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Mf),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&&(ep(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=_f(this);tx(p,this.nodeViews)&&(this.nodeViews=p,o=!0);}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ml(this),this.editable=Tf(this),Nf(this);let l=el(this),c=kf(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=o||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(i.selection))&&(s=!0);let f=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Uv(this);if(s){this.domObserver.stop();let p=u&&(xt||ut)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ex(i.selection,e.selection);if(u){let h=ut?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Iw(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=of(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(p=!0);}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&aw(this))?vn(this,p):($f(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&Hv(f);}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof W){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Xu(this,n.getBoundingClientRect(),e);}else Xu(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;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this));}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this));}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e);}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else {let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o);}this.dragging=new Oo(e.slice,e.move,i<0?void 0:W.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;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(xt){let e=this.root.activeElement;if(e==this.dom)return !0;if(!e||!this.dom.contains(e))return !1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return !1;e=e.parentElement;}return !0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&$v(this.dom),vn(this),this.domObserver.start();}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null;}posAtCoords(e){return qv(this,e)}coordsAtPos(e,n=1){return Pf(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 Xv(this,n||this.state,e)}pasteHTML(e,n){return Ni(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ni(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return xl(this,e)}destroy(){this.docView&&(Sw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],el(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Mv());}get isDestroyed(){return this.docView==null}dispatchEvent(e){return kw(this,e)}domSelectionRange(){let e=this.domSelection();return e?bt&&this.root.nodeType===11&&Iv(this.dom.ownerDocument)==this.dom&&Ww(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Mi.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t));};function kf(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"),[Ce.node(0,t.state.doc.content.size,e)]}function Nf(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:Ce.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})};}else t.cursorWrapper=null;}function Tf(t){return !t.someProp("editable",e=>e(t.state)===!1)}function ex(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 _f(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 tx(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 Mf(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 xn={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:"'"},Po={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nx=typeof navigator<"u"&&/Mac/.test(navigator.platform),rx=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ve=0;Ve<10;Ve++)xn[48+Ve]=xn[96+Ve]=String(Ve);var Ve;for(Ve=1;Ve<=24;Ve++)xn[Ve+111]="F"+Ve;var Ve;for(Ve=65;Ve<=90;Ve++)xn[Ve]=String.fromCharCode(Ve+32),Po[Ve]=String.fromCharCode(Ve);var Ve;for(Lo in xn)Po.hasOwnProperty(Lo)||(Po[Lo]=xn[Lo]);var Lo;function sp(t){var e=nx&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||rx&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Po:xn)[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 ix=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ox=typeof navigator<"u"&&/Win/.test(navigator.platform);function sx(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))ix?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function ax(t){let e=Object.create(null);for(let n in t)e[sx(n)]=t[n];return e}function Tl(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ap(t){return new Z({props:{handleKeyDown:Ri(t)}})}function Ri(t){let e=ax(t);return function(n,r){let i=sp(r),o,s=e[Tl(i,r)];if(s&&s(n.state,n.dispatch,n))return !0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Tl(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return !0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(ox&&r.ctrlKey&&r.altKey)&&(o=xn[r.keyCode])&&o!=i){let a=e[Tl(o,r)];if(a&&a(n.state,n.dispatch,n))return !0}}return !1}}var Bo=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function cp(t,e){let{$cursor:n}=t.selection;return !n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Ml=(t,e,n)=>{let r=cp(t,n);if(!r)return !1;let i=Ol(r);if(!i){let s=r.blockRange(),a=s&&mn(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(yp(t,i,e,-1))return !0;if(r.parent.content.size==0&&(Gr(o,"end")||W.isSelectable(o)))for(let s=r.depth;;s--){let a=Ei(t.doc,r.before(s),r.after(s),B.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Gr(o,"end")?q.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):W.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView());}return !0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},dp=(t,e,n)=>{let r=cp(t,n);if(!r)return !1;let i=Ol(r);return i?fp(t,i,e):!1},up=(t,e,n)=>{let r=pp(t,n);if(!r)return !1;let i=Il(r);return i?fp(t,i,e):!1};function fp(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 d=i.lastChild;if(!d)return !1;i=d;}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return !1;let d=a.firstChild;if(!d)return !1;a=d;}let c=Ei(t.doc,o,l,B.empty);if(!c||c.from!=o||c instanceof De&&c.slice.size>=l-o)return !1;if(n){let d=t.tr.step(c);d.setSelection(H.create(d.doc,o)),n(d.scrollIntoView());}return !0}function Gr(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 Al=(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=Ol(r);}let s=o&&o.nodeBefore;return !s||!W.isSelectable(s)?!1:(e&&e(t.tr.setSelection(W.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Ol(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 pp(t,e){let{$cursor:n}=t.selection;return !n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}var Rl=(t,e,n)=>{let r=pp(t,n);if(!r)return !1;let i=Il(r);if(!i)return !1;let o=i.nodeAfter;if(yp(t,i,e,1))return !0;if(r.parent.content.size==0&&(Gr(o,"start")||W.isSelectable(o))){let s=Ei(t.doc,r.before(),r.after(),B.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(Gr(o,"start")?q.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):W.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView());}return !0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Dl=(t,e,n)=>{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<r.parent.content.size)return !1;o=Il(r);}let s=o&&o.nodeAfter;return !s||!W.isSelectable(s)?!1:(e&&e(t.tr.setSelection(W.create(t.doc,o.pos)).scrollIntoView()),!0)};function Il(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}var hp=(t,e)=>{let n=t.selection,r=n instanceof W,i;if(r){if(n.node.isTextblock||!Rt(t.doc,n.from))return !1;i=n.from;}else if(i=ir(t.doc,n.from,-1),i==null)return !1;if(e){let o=t.tr.join(i);r&&o.setSelection(W.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView());}return !0},mp=(t,e)=>{let n=t.selection,r;if(n instanceof W){if(n.node.isTextblock||!Rt(t.doc,n.to))return !1;r=n.to;}else if(r=ir(t.doc,n.to,1),r==null)return !1;return e&&e(t.tr.join(r).scrollIntoView()),!0},gp=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&mn(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},Ll=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return !n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
27
+ `).scrollIntoView()),!0)};function Pl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var Bl=(t,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=Pl(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return !1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(q.near(l.doc.resolve(a),1)),e(l.scrollIntoView());}return !0},zl=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof je||r.parent.inlineContent||i.parent.inlineContent)return !1;let o=Pl(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return !1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection(H.create(a.doc,s+1)),e(a.scrollIntoView());}return !0},Fl=(t,e)=>{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(Mt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&mn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};var bp=(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(W.create(t.doc,i))),!0)};function ux(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||Rt(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function yp(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&ux(t,e,n))return !0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let p=e.pos+o.nodeSize,h=N.empty;for(let b=s.length-1;b>=0;b--)h=N.from(s[b].create(null,h));h=N.from(i.copy(h));let m=t.tr.step(new Me(e.pos-1,p,e.pos,p,new B(h,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Rt(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView());}return !0}let d=o.type.spec.isolating||r>0&&l?null:q.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&mn(u);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(u,f).scrollIntoView()),!0;if(c&&Gr(o,"start",!0)&&Gr(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let b=N.empty;for(let S=h.length-1;S>=0;S--)b=N.from(h[S].copy(b));let v=t.tr.step(new Me(e.pos-h.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new B(b,h.length,0),0,!0));n(v.scrollIntoView());}return !0}}return !1}function Ep(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(H.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}var Ul=Ep(-1),Hl=Ep(1);function vp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&Ir(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function $l(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(l,c)=>{if(i)return !1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else {let d=n.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,t);}});}if(!i)return !1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];o.setBlockType(a,l,t,e);}r(o.scrollIntoView());}return !0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1;function wp(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return !1;let a=r?n.tr:null;return px(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function px(t,e,n,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return !1;let l=s.resolve(e.start-2);o=new tr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new tr(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0;}let a=Ir(o,n,r,e);return a?(t&&hx(t,e,a,i,n),!0):!1}function hx(t,e,n,r,i){let o=N.empty;for(let d=n.length-1;d>=0;d--)o=N.from(n[d].type.create(n[d].attrs,o));t.step(new Me(e.start-(r?2:0),e.end,e.start,e.end,new B(o,0,0),n.length,!0));let s=0;for(let d=0;d<n.length;d++)n[d].type==i&&(s=d+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,f=!0;d<u;d++,f=!1)!f&&Mt(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return t}function xp(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?mx(e,n,t,o):gx(e,n,o):!0:!1}}function mx(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new Me(o-1,s,o,s,new B(N.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new tr(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));let a=mn(r);if(a==null)return !1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(o,-1)-1);return Rt(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function gx(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+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 a=n.startIndex==0,l=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+(a?0:1),d+1,s.content.append(l?N.empty:N.from(i))))return !1;let u=o.pos,f=u+s.nodeSize;return r.step(new Me(u-(a?1:0),f+(l?1:0),u+1,f-1,new B((a?N.empty:N.from(i.copy(N.empty))).append(l?N.empty:N.from(i.copy(N.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Sp(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return !1;let s=o.startIndex;if(s==0)return !1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return !1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,d=N.from(c?t.create():null),u=new B(N.from(t.create(null,N.from(a.type.create(null,d)))),c?3:1,0),f=o.start,p=o.end;n(e.tr.step(new Me(f-(c?3:1),p,f,p,u,1,!0)).scrollIntoView());}return !0}}var bx=Object.defineProperty,Op=(t,e)=>{for(var n in e)bx(t,n,{get:e[n],enumerable:!0});};function Wo(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 Go=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state;}get hasCustomState(){return !!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,(...c)=>{let d=a(...c)(o);return !i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return ()=>this.createChain()}get can(){return ()=>this.createCan()}createChain(t,e=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],a=!!t,l=t||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),s.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(n).map(([u,f])=>[u,(...h)=>{let m=this.buildProps(l,e),g=f(...h)(m);return s.push(g),d}])),run:c};return d}createCan(t){let{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,o=this.buildProps(i,r);return {...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:t,editor:r,view:o,state:Wo({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(s)]))}};return s}},yx=class{constructor(){this.callbacks={};}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){let n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){let n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){let n=(...r)=>{this.off(t,n),e.apply(this,r);};return this.on(t,n)}removeAllListeners(){this.callbacks={};}};function Jl(t,e){let n=new Dn(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i);});}),n}var Rp=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&&Rp(r);}return t};function zo(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Rp(n)}function Di(t,e,n){if(t instanceof et||t instanceof N)return t;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 N.fromArray(t.map(a=>e.nodeFromJSON(a)));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),Di("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,a="",l=new Rr({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:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?_t.fromSchema(l).parseSlice(zo(t),n.parseOptions):_t.fromSchema(l).parse(zo(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}let o=_t.fromSchema(e);return n.slice?o.parseSlice(zo(t),n.parseOptions).content:o.parse(zo(t),n.parseOptions)}return Di("",e,n)}function ql(t,e,n={},r={}){return Di(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function Ex(t){for(let e=0;e<t.edgeCount;e+=1){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function qo(t,e){let n=[];return t.descendants((r,i)=>{e(r)&&n.push({node:r,pos:i});}),n}function Dp(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o});}),r}function Yl(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 jo(t){return e=>Yl(e.$from,t)}function j(t,e,n){return t.config[e]===void 0&&t.parent?j(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?j(t.parent,e,n):null}):t.config[e]}function Zl(t){return t.map(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=j(e,"addExtensions",n);return r?[e,...Zl(r())]:e}).flat(10)}function Xl(t,e){let n=$t.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function Ip(t){return typeof t=="function"}function Se(t,e=void 0,...n){return Ip(t)?e?t.bind(e)(...n):t(...n):t}function vx(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Ii(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 Lp(t){let e=[],{nodeExtensions:n,markExtensions:r}=Ii(t),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=j(s,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([f,p])=>{e.push({type:u,name:f,attribute:{...o,...p}});});});});}),i.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage},l=j(s,"addAttributes",a);if(!l)return;let c=l();Object.entries(c).forEach(([d,u])=>{let f={...o,...u};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:s.name,name:d,attribute:f});});}),e}function te(...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 a=o?String(o).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(d=>!l.includes(d));r[i]=[...l,...c].join(" ");}else if(i==="style"){let a=o?o.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{let[u,f]=d.split(":").map(p=>p.trim());c.set(u,f);}),a.forEach(d=>{let[u,f]=d.split(":").map(p=>p.trim());c.set(u,f);}),r[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ");}else r[i]=o;}),r},{})}function Ko(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)=>te(n,r),{})}function wx(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Cp(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 a=s.attribute.parseHTML?s.attribute.parseHTML(n):wx(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return {...r,...i}}}}function kp(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&vx(n)?!1:n!=null))}function xx(t,e){var n;let r=Lp(t),{nodeExtensions:i,markExtensions:o}=Ii(t),s=(n=i.find(c=>j(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(i.map(c=>{let d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((b,v)=>{let S=j(v,"extendNodeSchema",u);return {...b,...S?S(c):{}}},{}),p=kp({...f,content:Se(j(c,"content",u)),marks:Se(j(c,"marks",u)),group:Se(j(c,"group",u)),inline:Se(j(c,"inline",u)),atom:Se(j(c,"atom",u)),selectable:Se(j(c,"selectable",u)),draggable:Se(j(c,"draggable",u)),code:Se(j(c,"code",u)),whitespace:Se(j(c,"whitespace",u)),linebreakReplacement:Se(j(c,"linebreakReplacement",u)),defining:Se(j(c,"defining",u)),isolating:Se(j(c,"isolating",u)),attrs:Object.fromEntries(d.map(b=>{var v,S;return [b.name,{default:(v=b?.attribute)==null?void 0:v.default,validate:(S=b?.attribute)==null?void 0:S.validate}]}))}),h=Se(j(c,"parseHTML",u));h&&(p.parseDOM=h.map(b=>Cp(b,d)));let m=j(c,"renderHTML",u);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:Ko(b,d)}));let g=j(c,"renderText",u);return g&&(p.toText=g),[c.name,p]})),l=Object.fromEntries(o.map(c=>{let d=r.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((g,b)=>{let v=j(b,"extendMarkSchema",u);return {...g,...v?v(c):{}}},{}),p=kp({...f,inclusive:Se(j(c,"inclusive",u)),excludes:Se(j(c,"excludes",u)),group:Se(j(c,"group",u)),spanning:Se(j(c,"spanning",u)),code:Se(j(c,"code",u)),attrs:Object.fromEntries(d.map(g=>{var b,v;return [g.name,{default:(b=g?.attribute)==null?void 0:b.default,validate:(v=g?.attribute)==null?void 0:v.validate}]}))}),h=Se(j(c,"parseHTML",u));h&&(p.parseDOM=h.map(g=>Cp(g,d)));let m=j(c,"renderHTML",u);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:Ko(g,d)})),[c.name,p]}));return new Rr({topNode:s,nodes:a,marks:l})}function Sx(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Ql(t){return t.sort((n,r)=>{let i=j(n,"priority")||100,o=j(r,"priority")||100;return i>o?-1:i<o?1:0})}function Pp(t){let e=Ql(Zl(t)),n=Sx(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Bp(t,e,n){let{from:r,to:i}=e,{blockSeparator:o=`
28
+
29
+ `,textSerializers:s={}}=n||{},a="";return t.nodesBetween(r,i,(l,c,d,u)=>{var f;l.isBlock&&c>r&&(a+=o);let p=s?.[l.type.name];if(p)return d&&(a+=p({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,i-c));}),a}function Cx(t,e){let n={from:0,to:t.content.size};return Bp(t,n,e)}function zp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Sn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}function Fp(t,e){let n=Sn(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,l=>{s.push(...l.marks);});let a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function ze(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 kx(t,e){let n=ze(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a);});let s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function Jo(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ec(t,e){let n=Jo(typeof e=="string"?e:e.name,t.schema);return n==="node"?kx(t,e):n==="mark"?Fp(t,e):{}}function Nx(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 Tx(t){let e=Nx(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 tc(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{let s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l});});else {let{from:a,to:l}=n[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l});}s.forEach(({from:a,to:l})=>{let c=e.slice(o).map(a,-1),d=e.slice(o).map(l),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}});});}),Tx(r)}function nc(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Vo(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:nc(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Up(t,e,n={}){return t.find(r=>r.type===e&&Vo(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Np(t,e,n={}){return !!Up(t,e,n)}function rc(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!Up([...i.node.marks],e,n)))return;let s=i.index,a=t.start()+i.offset,l=s+1,c=a+i.node.nodeSize;for(;s>0&&Np([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&Np([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return {from:a,to:c}}function Yo(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(i=>{let o=n.resolve(t),s=rc(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}var Hp=(t,e,n,r=20)=>{let i=t.doc.resolve(n),o=r,s=null;for(;o>0&&s===null;){let a=i.node(o);a?.type.name===e?s=a:o-=1;}return [s,o]};function Vl(t,e){return e.nodes[t]||e.marks[t]||null}function $o(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}))}var _x=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var l,c;let d=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-o));}),n};function jl(t,e,n={}){let{empty:r,ranges:i}=t.selection,o=e?Sn(e,t.schema):null;if(r)return !!(t.storedMarks||t.selection.$from.marks()).filter(u=>o?o.name===u.type.name:!0).find(u=>Vo(u.attrs,n,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:u,$to:f})=>{let p=u.pos,h=f.pos;t.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;let b=Math.max(p,g),v=Math.min(h,g+m.nodeSize),S=v-b;s+=S,a.push(...m.marks.map(T=>({mark:T,from:b,to:v})));});}),s===0)return !1;let l=a.filter(u=>o?o.name===u.mark.type.name:!0).filter(u=>Vo(u.mark.attrs,n,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=a.filter(u=>o?u.mark.type!==o&&u.mark.type.excludes(o):!0).reduce((u,f)=>u+f.to-f.from,0);return (l>0?l+c:l)>=s}function Qt(t,e,n={}){let{from:r,to:i,empty:o}=t.selection,s=e?ze(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(u,f)=>{if(u.isText)return;let p=Math.max(r,f),h=Math.min(i,f+u.nodeSize);a.push({node:u,from:p,to:h});});let l=i-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Vo(u.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=l}function Mx(t,e,n={}){if(!e)return Qt(t,null,n)||jl(t,null,n);let r=Jo(e,t.schema);return r==="node"?Qt(t,e,n):r==="mark"?jl(t,e,n):!1}var $p=(t,e)=>{let{$from:n,$to:r,$anchor:i}=t.selection;if(e){let o=jo(a=>a.type.name===e)(t.selection);if(!o)return !1;let s=t.doc.resolve(o.pos+1);return i.pos+1===s.end()}return !(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Kp=t=>{let{$from:e,$to:n}=t.selection;return !(e.parentOffset>0||e.pos!==n.pos)};function Tp(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function _p(t,e){let{nodeExtensions:n}=Ii(e),r=n.find(s=>s.name===t);if(!r)return !1;let i={name:r.name,options:r.options,storage:r.storage},o=Se(j(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Li(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:"")}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&&(Li(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1));}),i}return !1}function Zo(t){return t instanceof W}function Vp(t){return t instanceof H}function pr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Wp(t,e=null){if(!e)return null;let n=q.atStart(t),r=q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;let i=n.from,o=r.to;return e==="all"?H.create(t,pr(0,i,o),pr(t.content.size,i,o)):H.create(t,pr(e,i,o),pr(e,i,o))}function Ax(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof De||i instanceof Me))return;let o=t.mapping.maps[r],s=0;o.forEach((a,l,c,d)=>{s===0&&(s=d);}),t.setSelection(q.near(t.doc.resolve(s),n));}var Pi=class{constructor(t){this.find=t.find,this.handler=t.handler;}},Ox=(t,e)=>{if(nc(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 Fo(t){var e;let{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return !1;let c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return !1;let d=!1,u=_x(c)+o;return s.forEach(f=>{if(d)return;let p=Ox(u,f.find);if(!p)return;let h=l.state.tr,m=Wo({state:l.state,transaction:h}),g={from:r-(p[0].length-o.length),to:i},{commands:b,chain:v,can:S}=new Go({editor:n,state:m});f.handler({state:m,range:g,match:p,commands:b,chain:v,can:S})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:r,to:i,text:o}),l.dispatch(h),d=!0);}),d}function Rx(t){let{editor:e,rules:n}=t,r=new Z({state:{init(){return null},apply(i,o,s){let a=i.getMeta(r);if(a)return a;let l=i.getMeta("applyInputRules");return !!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=Xl(N.from(d),s.schema);let{from:u}=l,f=u+d.length;Fo({editor:e,from:u,to:f,text:d,rules:n,plugin:r});}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return Fo({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&Fo({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?Fo({editor:e,from:s.pos,to:s.pos,text:`
30
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Dx(t){return Object.prototype.toString.call(t).slice(8,-1)}function Uo(t){return Dx(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Gp(t,e){let n={...t};return Uo(t)&&Uo(e)&&Object.keys(e).forEach(r=>{Uo(e[r])&&Uo(t[r])?n[r]=Gp(t[r],e[r]):n[r]=e[r];}),n}var ic=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name;}get options(){return {...Se(j(this,"addOptions",{name:this.name}))||{}}}get storage(){return {...Se(j(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){let e=this.extend({...this.config,addOptions:()=>Gp(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){let e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},nt=class qp extends ic{constructor(){super(...arguments),this.type="mark";}static create(e={}){let n=typeof e=="function"?e():e;return new qp(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(c=>c?.type.name===n.name))return !1;let l=s.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return !1}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}};function Ix(t){return typeof t=="number"}var Lx=class{constructor(t){this.find=t.find,this.handler=t.handler;}},Px=(t,e,n)=>{if(nc(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 Bx(t){let{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:d}=new Go({editor:e,state:n}),u=[];return n.doc.nodesBetween(r,i,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;let m=Math.max(r,h),g=Math.min(i,h+p.content.size),b=p.textBetween(m-h,g-h,void 0,"\uFFFC");Px(b,o.find,s).forEach(S=>{if(S.index===void 0)return;let T=m+S.index+1,_=T+S[0].length,I={from:n.tr.mapping.map(T),to:n.tr.mapping.map(_)},k=o.handler({state:n,range:I,match:S,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(k);});}),u.every(p=>p!==null)}var Ho=null,zx=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return (e=n.clipboardData)==null||e.setData("text/html",t),n};function Fx(t){let{editor:e,rules:n}=t,r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null;}catch{a=null;}let l=({state:d,from:u,to:f,rule:p,pasteEvt:h})=>{let m=d.tr,g=Wo({state:d,transaction:m});if(!(!Bx({editor:e,state:g,from:Math.max(u-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null;}catch{a=null;}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(d=>new Z({view(u){let f=h=>{var m;r=(m=u.dom.parentElement)!=null&&m.contains(h.target)?u.dom.parentElement:null,r&&(Ho=e);},p=()=>{Ho&&(Ho=null);};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p);}}},props:{handleDOMEvents:{drop:(u,f)=>{if(o=r===u.dom.parentElement,a=f,!o){let p=Ho;p?.isEditable&&setTimeout(()=>{let h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to});},10);}return !1},paste:(u,f)=>{var p;let h=(p=f.clipboardData)==null?void 0:p.getData("text/html");return s=f,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(u,f,p)=>{let h=u[0],m=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!o,b=h.getMeta("applyPasteRules"),v=!!b;if(!m&&!g&&!v)return;if(v){let{text:_}=b;typeof _=="string"?_=_:_=Xl(N.from(_),p.schema);let{from:I}=b,k=I+_.length,y=zx(_);return l({rule:d,state:p,from:I,to:{b:k},pasteEvt:y})}let S=f.doc.content.findDiffStart(p.doc.content),T=f.doc.content.findDiffEnd(p.doc.content);if(!(!Ix(S)||!T||S===T.b))return l({rule:d,state:p,from:S,to:T,pasteEvt:s})}}))}var Xo=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=Pp(t),this.schema=xx(this.extensions,e),this.setupExtensions();}get commands(){return this.extensions.reduce((t,e)=>{let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vl(e.name,this.schema)},r=j(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){let{editor:t}=this,e=Ql([...this.extensions].reverse()),n=[],r=[],i=e.map(o=>{let s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:t,type:Vl(o.name,this.schema)},a=[],l=j(o,"addKeyboardShortcuts",s),c={};if(o.type==="mark"&&j(o,"exitable",s)&&(c.ArrowRight=()=>nt.handleExit({editor:t,mark:o})),l){let h=Object.fromEntries(Object.entries(l()).map(([m,g])=>[m,()=>g({editor:t})]));c={...c,...h};}let d=ap(c);a.push(d);let u=j(o,"addInputRules",s);Tp(o,t.options.enableInputRules)&&u&&n.push(...u());let f=j(o,"addPasteRules",s);Tp(o,t.options.enablePasteRules)&&f&&r.push(...f());let p=j(o,"addProseMirrorPlugins",s);if(p){let h=p();a.push(...h);}return a}).flat();return [Rx({editor:t,rules:n}),...Fx({editor:t,rules:r}),...i]}get attributes(){return Lp(this.extensions)}get nodeViews(){let{editor:t}=this,{nodeExtensions:e}=Ii(this.extensions);return Object.fromEntries(e.filter(n=>!!j(n,"addNodeView")).map(n=>{let r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ze(n.name,this.schema)},o=j(n,"addNodeView",i);if(!o)return [];let s=(a,l,c,d,u)=>{let f=Ko(a,r);return o()({node:a,view:l,getPos:c,decorations:d,innerDecorations:u,editor:t,extension:n,HTMLAttributes:f})};return [n.name,s]}))}get markViews(){let{editor:t}=this,{markExtensions:e}=Ii(this.extensions);return Object.fromEntries(e.filter(n=>!!j(n,"addMarkView")).map(n=>{let r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Sn(n.name,this.schema)},o=j(n,"addMarkView",i);if(!o)return [];let s=(a,l,c)=>{let d=Ko(a,r);return o()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:d,updateAttributes:u=>{XS(a,t,u);}})};return [n.name,s]}))}setupExtensions(){let t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;let r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vl(e.name,this.schema)};e.type==="mark"&&((n=Se(j(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);let i=j(e,"onBeforeCreate",r),o=j(e,"onCreate",r),s=j(e,"onUpdate",r),a=j(e,"onSelectionUpdate",r),l=j(e,"onTransaction",r),c=j(e,"onFocus",r),d=j(e,"onBlur",r),u=j(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u);});}};Xo.resolve=Pp;Xo.sort=Ql;Xo.flatten=Zl;var Ux={};Op(Ux,{ClipboardTextSerializer:()=>Jp,Commands:()=>Xp,Delete:()=>Qp,Drop:()=>eh,Editable:()=>th,FocusEvents:()=>rh,Keymap:()=>ih,Paste:()=>oh,Tabindex:()=>sh,focusEventsPluginKey:()=>nh});var ne=class jp extends ic{constructor(){super(...arguments),this.type="extension";}static create(e={}){let n=typeof e=="function"?e():e;return new jp(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},Jp=ne.create({name:"clipboardTextSerializer",addOptions(){return {blockSeparator:void 0}},addProseMirrorPlugins(){return [new Z({key:new re("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(d=>d.$from.pos)),a=Math.max(...o.map(d=>d.$to.pos)),l=zp(n);return Bp(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Yp={};Op(Yp,{blur:()=>Hx,clearContent:()=>$x,clearNodes:()=>Kx,command:()=>Vx,createParagraphNear:()=>Wx,cut:()=>Gx,deleteCurrentNode:()=>qx,deleteNode:()=>jx,deleteRange:()=>Jx,deleteSelection:()=>Yx,enter:()=>Zx,exitCode:()=>Xx,extendMarkRange:()=>Qx,first:()=>eS,focus:()=>nS,forEach:()=>rS,insertContent:()=>iS,insertContentAt:()=>sS,joinBackward:()=>cS,joinDown:()=>lS,joinForward:()=>dS,joinItemBackward:()=>uS,joinItemForward:()=>fS,joinTextblockBackward:()=>pS,joinTextblockForward:()=>hS,joinUp:()=>aS,keyboardShortcut:()=>gS,lift:()=>bS,liftEmptyBlock:()=>yS,liftListItem:()=>ES,newlineInCode:()=>vS,resetAttributes:()=>wS,scrollIntoView:()=>xS,selectAll:()=>SS,selectNodeBackward:()=>CS,selectNodeForward:()=>kS,selectParentNode:()=>NS,selectTextblockEnd:()=>TS,selectTextblockStart:()=>_S,setContent:()=>MS,setMark:()=>OS,setMeta:()=>RS,setNode:()=>DS,setNodeSelection:()=>IS,setTextSelection:()=>LS,sinkListItem:()=>PS,splitBlock:()=>BS,splitListItem:()=>zS,toggleList:()=>FS,toggleMark:()=>US,toggleNode:()=>HS,toggleWrap:()=>$S,undoInputRule:()=>KS,unsetAllMarks:()=>VS,unsetMark:()=>WS,updateAttributes:()=>GS,wrapIn:()=>qS,wrapInList:()=>jS});var Hx=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges());}),!0),$x=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Kx=()=>({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,(a,l)=>{if(a.type.isText)return;let{doc:c,mapping:d}=e,u=c.resolve(d.map(l)),f=c.resolve(d.map(l+a.nodeSize)),p=u.blockRange(f);if(!p)return;let h=mn(p);if(a.type.isTextblock){let{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(p.start,m);}(h||h===0)&&e.lift(p,h);});}),!0},Vx=t=>e=>t(e),Wx=()=>({state:t,dispatch:e})=>zl(t,e),Gx=(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 H(r.doc.resolve(Math.max(s-1,0)))),!0},qx=()=>({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 a=i.before(o),l=i.after(o);t.delete(a,l).scrollIntoView();}return !0}return !1},jx=t=>({tr:e,state:n,dispatch:r})=>{let i=ze(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 l=o.before(s),c=o.after(s);e.delete(l,c).scrollIntoView();}return !0}return !1},Jx=t=>({tr:e,dispatch:n})=>{let{from:r,to:i}=t;return n&&e.delete(r,i),!0},Yx=()=>({state:t,dispatch:e})=>Bo(t,e),Zx=()=>({commands:t})=>t.keyboardShortcut("Enter"),Xx=()=>({state:t,dispatch:e})=>Bl(t,e),Qx=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=Sn(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(i){let u=rc(l,o,e);if(u&&u.from<=c&&u.to>=d){let f=H.create(s,u.from,u.to);n.setSelection(f);}}return !0},eS=t=>e=>{let n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return !0;return !1};function tS(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function oc(){return ["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var nS=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};let s=()=>{(oc()||tS())&&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&&!Vp(n.state.selection))return s(),!0;let a=Wp(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},rS=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),iS=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),oS=t=>!("type"in t),sS=(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 a,{selection:l}=o.state,c=b=>{o.emit("contentError",{editor:o,error:b,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0);}});},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Di(e,o.schema,{parseOptions:d,errorOnInvalidContent:!0});}catch(b){c(b);}try{a=Di(e,o.schema,{parseOptions:d,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:o.options.enableContentCheck});}catch(b){return c(b),!1}let{from:u,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,h=!0;if((oS(a)?a:[a]).forEach(b=>{b.check(),p=p?b.isText&&b.marks.length===0:!1,h=h?b.isBlock:!1;}),u===f&&h){let{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,f+=1);}let g;if(p){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof N){let b="";e.forEach(v=>{v.text&&(b+=v.text);}),g=b;}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f);}else {g=a;let b=l.$from.parentOffset===0,v=l.$from.node().isText||l.$from.node().isTextblock,S=l.$from.node().content.size>0;b&&v&&S&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g);}n.updateSelection&&Ax(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g});}return !0},aS=()=>({state:t,dispatch:e})=>hp(t,e),lS=()=>({state:t,dispatch:e})=>mp(t,e),cS=()=>({state:t,dispatch:e})=>Ml(t,e),dS=()=>({state:t,dispatch:e})=>Rl(t,e),uS=()=>({state:t,dispatch:e,tr:n})=>{try{let r=ir(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return !1}},fS=()=>({state:t,dispatch:e,tr:n})=>{try{let r=ir(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return !1}},pS=()=>({state:t,dispatch:e})=>dp(t,e),hS=()=>({state:t,dispatch:e})=>up(t,e);function Zp(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function mS(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))oc()||Zp()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}var gS=t=>({editor:e,view:n,tr:r,dispatch:i})=>{let o=mS(t).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=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}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a));});return l?.steps.forEach(c=>{let d=c.map(r.mapping);d&&i&&r.maybeStep(d);}),!0},bS=(t,e={})=>({state:n,dispatch:r})=>{let i=ze(t,n.schema);return Qt(n,i,e)?gp(n,r):!1},yS=()=>({state:t,dispatch:e})=>Fl(t,e),ES=t=>({state:e,dispatch:n})=>{let r=ze(t,e.schema);return xp(r)(e,n)},vS=()=>({state:t,dispatch:e})=>Ll(t,e);function Mp(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 wS=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=Jo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=ze(t,r.schema)),a==="mark"&&(s=Sn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{o&&o===c.type&&n.setNodeMarkup(d,void 0,Mp(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(u=>{s===u.type&&n.addMark(d,d+c.nodeSize,s.create(Mp(u.attrs,e)));});});}),!0):!1},xS=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),SS=()=>({tr:t,dispatch:e})=>{if(e){let n=new je(t.doc);t.setSelection(n);}return !0},CS=()=>({state:t,dispatch:e})=>Al(t,e),kS=()=>({state:t,dispatch:e})=>Dl(t,e),NS=()=>({state:t,dispatch:e})=>bp(t,e),TS=()=>({state:t,dispatch:e})=>Hl(t,e),_S=()=>({state:t,dispatch:e})=>Ul(t,e),MS=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{let{doc:l}=o;if(r.preserveWhitespace!=="full"){let c=ql(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function AS(t,e,n){var r;let{selection:i}=e,o=null;if(Vp(i)&&(o=i.$cursor),o){let a=(r=t.storedMarks)!=null?r:o.marks();return !!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}let{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(d,u,f)=>{if(c)return !1;if(d.isInline){let p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(n));c=p&&h;}return !c}),c})}var OS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=Sn(t,r.schema);if(i)if(s){let c=Fp(r,l);n.addStoredMark(l.create({...c,...e}));}else a.forEach(c=>{let d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(f,p)=>{let h=Math.max(p,d),m=Math.min(p+f.nodeSize,u);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&n.addMark(h,m,l.create({...b.attrs,...e}));}):n.addMark(h,m,l.create(e));});});return AS(r,n,l)},RS=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),DS=(t,e={})=>({state:n,dispatch:r,chain:i})=>{let o=ze(t,n.schema),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>$l(o,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>$l(o,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},IS=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,i=pr(t,0,r.content.size),o=W.create(r,i);e.setSelection(o);}return !0},LS=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=H.atStart(r).from,a=H.atEnd(r).to,l=pr(i,s,a),c=pr(o,s,a),d=H.create(r,l,c);e.setSelection(d);}return !0},PS=t=>({state:e,dispatch:n})=>{let r=ze(t,e.schema);return Sp(r)(e,n)};function Ap(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 BS=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=e,{$from:a,$to:l}=o,c=i.extensionManager.attributes,d=$o(c,a.node().type.name,a.node().attrs);if(o instanceof W&&o.node.isBlock)return !a.parentOffset||!Mt(s,a.pos)?!1:(r&&(t&&Ap(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return !1;let u=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Ex(a.node(-1).contentMatchAt(a.indexAfter(-1))),p=u&&f?[{type:f,attrs:d}]:void 0,h=Mt(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&Mt(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:d}]:void 0),r){if(h&&(o instanceof H&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!u&&!a.parentOffset&&a.parent.type!==f)){let m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f);}t&&Ap(n,i.extensionManager.splittableMarks),e.scrollIntoView();}return h},zS=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let a=ze(t,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return !1;let u=l.node(-1);if(u.type!==a)return !1;let f=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return !1;if(i){let b=N.empty,v=l.index(-1)?1:l.index(-2)?2:3;for(let y=l.depth-v;y>=l.depth-3;y-=1)b=N.from(l.node(y).copy(b));let S=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,T={...$o(f,l.node().type.name,l.node().attrs),...e},_=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(T))||void 0;b=b.append(N.from(a.createAndFill(null,_)||void 0));let I=l.before(l.depth-(v-1));n.replace(I,l.after(-S),new B(b,4-v,0));let k=-1;n.doc.nodesBetween(I,n.doc.content.size,(y,w)=>{if(k>-1)return !1;y.isTextblock&&y.content.size===0&&(k=w+1);}),k>-1&&n.setSelection(H.near(n.doc.resolve(k))),n.scrollIntoView();}return !0}let p=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,h={...$o(f,u.type.name,u.attrs),...e},m={...$o(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);let g=p?[{type:a,attrs:h},{type:p,attrs:m}]:[{type:a,attrs:h}];if(!Mt(n.doc,l.pos,2))return !1;if(i){let{selection:b,storedMarks:v}=r,{splittableMarks:S}=o.extensionManager,T=v||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!T||!i)return !0;let _=T.filter(I=>S.includes(I.type.name));n.ensureMarks(_);}return !0},Wl=(t,e)=>{let n=jo(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&&Rt(t.doc,n.pos)&&t.join(n.pos),!0},Gl=(t,e)=>{let n=jo(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&&Rt(t.doc,r)&&t.join(r),!0},FS=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:d})=>{let{extensions:u,splittableMarks:f}=i.extensionManager,p=ze(t,s.schema),h=ze(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:v}=m,S=b.blockRange(v),T=g||m.$to.parentOffset&&m.$from.marks();if(!S)return !1;let _=jo(I=>_p(I.type.name,u))(m);if(S.depth>=1&&_&&S.depth-_.depth<=1){if(_.node.type===p)return c.liftListItem(h);if(_p(_.node.type.name,u)&&p.validContent(_.node.content)&&a)return l().command(()=>(o.setNodeMarkup(_.pos,p),!0)).command(()=>Wl(o,p)).command(()=>Gl(o,p)).run()}return !n||!T||!a?l().command(()=>d().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Wl(o,p)).command(()=>Gl(o,p)).run():l().command(()=>{let I=d().wrapInList(p,r),k=T.filter(y=>f.includes(y.type.name));return o.ensureMarks(k),I?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Wl(o,p)).command(()=>Gl(o,p)).run()},US=(t,e={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=Sn(t,r.schema);return jl(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},HS=(t,e,n={})=>({state:r,commands:i})=>{let o=ze(t,r.schema),s=ze(e,r.schema),a=Qt(r,o,n),l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...n})},$S=(t,e={})=>({state:n,commands:r})=>{let i=ze(t,n.schema);return Qt(n,i,e)?r.lift(i):r.wrapIn(i,e)},KS=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){let s=t.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){let l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,l));}else s.delete(o.from,o.to);}return !0}}return !1},VS=()=>({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},WS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Sn(t,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return !0;if(d&&s){let{from:f,to:p}=a,h=(o=c.marks().find(g=>g.type===l))==null?void 0:o.attrs,m=rc(c,l,h);m&&(f=m.from,p=m.to),n.removeMark(f,p,l);}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l);});return n.removeStoredMark(l),!0},GS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=Jo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=ze(t,r.schema)),a==="mark"&&(s=Sn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{let c=l.$from.pos,d=l.$to.pos,u,f,p,h;n.selection.empty?r.doc.nodesBetween(c,d,(m,g)=>{o&&o===m.type&&(p=Math.max(g,c),h=Math.min(g+m.nodeSize,d),u=g,f=m);}):r.doc.nodesBetween(c,d,(m,g)=>{g<c&&o&&o===m.type&&(p=Math.max(g,c),h=Math.min(g+m.nodeSize,d),u=g,f=m),g>=c&&g<=d&&(o&&o===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){let v=Math.max(g,c),S=Math.min(g+m.nodeSize,d);n.addMark(v,S,s.create({...b.attrs,...e}));}}));}),f&&(u!==void 0&&n.setNodeMarkup(u,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&n.addMark(p,h,s.create({...m.attrs,...e}));}));}),!0):!1},qS=(t,e={})=>({state:n,dispatch:r})=>{let i=ze(t,n.schema);return vp(i,e)(n,r)},jS=(t,e={})=>({state:n,dispatch:r})=>{let i=ze(t,n.schema);return wp(i,e)(n,r)},Xp=ne.create({name:"commands",addCommands(){return {...Yp}}}),Qp=ne.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;let o=()=>{var s,a,l,c;if((c=(l=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;let d=Jl(t.before,[t,...e]);tc(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,m)=>{let g=m+h.nodeSize-2,b=p.oldRange.from<=m&&g<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:g,newFrom:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:p.oldRange,newRange:p.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:d});});});let f=d.mapping;d.steps.forEach((p,h)=>{var m,g;if(p instanceof wt){let b=f.slice(h).map(p.from,-1),v=f.slice(h).map(p.to),S=f.invert().map(b,-1),T=f.invert().map(v),_=(m=d.doc.nodeAt(b-1))==null?void 0:m.marks.some(k=>k.eq(p.mark)),I=(g=d.doc.nodeAt(v))==null?void 0:g.marks.some(k=>k.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:S,to:T},newRange:{from:b,to:v},partial:!!(I||_),editor:this.editor,transaction:t,combinedTransform:d});}});};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o();}}),eh=ne.create({name:"drop",addProseMirrorPlugins(){return [new Z({key:new re("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r});}}})]}}),th=ne.create({name:"editable",addProseMirrorPlugins(){return [new Z({key:new re("editable"),props:{editable:()=>this.editor.options.editable}})]}}),nh=new re("focusEvents"),rh=ne.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return [new Z({key:nh,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}}}})]}}),ih=ne.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{let{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:f,parent:p}=u,h=u.parent.isTextblock&&f>0?a.doc.resolve(f-1):u,m=h.parent.type.spec.isolating,g=u.pos-u.parentOffset,b=m&&h.parent.childCount===1?g===u.pos:q.atStart(c).from===f;return !d||!p.type.isTextblock||p.textContent.length||!b||b&&u.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 oc()||Zp()?o:i},addProseMirrorPlugins(){return [new Z({key:new re("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;let r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:a}=e.selection,l=q.atStart(e.doc).from,c=q.atEnd(e.doc).to;if(o||!(s===l&&a===c)||!Li(n.doc))return;let f=n.tr,p=Wo({state:n,transaction:f}),{commands:h}=new Go({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),oh=ne.create({name:"paste",addProseMirrorPlugins(){return [new Z({key:new re("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n});}}})]}}),sh=ne.create({name:"tabindex",addProseMirrorPlugins(){return [new Z({key:new re("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),JS=class qr{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 name(){return this.node.type.name}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: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 qr(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 qr(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 qr(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);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;let l=new qr(a,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new qr(a,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 a=0;a<s.length;a+=1){let l=s[a];if(o[l]!==n[l])break}}else r=i;i=i.parent;}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;let o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(l=>n[l]===s.node.attrs[l])&&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);}},YS=`.ProseMirror {
31
+ position: relative;
32
+ }
33
+
34
+ .ProseMirror {
35
+ word-wrap: break-word;
36
+ white-space: pre-wrap;
37
+ white-space: break-spaces;
38
+ -webkit-font-variant-ligatures: none;
39
+ font-variant-ligatures: none;
40
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
41
+ }
42
+
43
+ .ProseMirror [contenteditable="false"] {
44
+ white-space: normal;
45
+ }
46
+
47
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
48
+ white-space: pre-wrap;
49
+ }
50
+
51
+ .ProseMirror pre {
52
+ white-space: pre-wrap;
226
53
  }
227
54
 
228
- // src/hooks/use-data-table.ts
229
- import React2 from "react";
230
- function useDataTable(options) {
231
- const {
232
- data,
233
- searchable = true,
234
- pageSize = 10,
235
- enableRowSelection = false,
236
- enableMultiRowSelection = true
237
- } = options;
238
- const [searchQuery, setSearchQuery] = React2.useState("");
239
- const [currentPage, setCurrentPage] = React2.useState(1);
240
- const [selectedRows, setSelectedRows] = React2.useState([]);
241
- const filteredData = React2.useMemo(() => {
242
- if (!searchable || !searchQuery.trim()) {
243
- return data;
244
- }
245
- return data.filter((row) => {
246
- return Object.values(row).some((value) => {
247
- if (value == null)
248
- return false;
249
- return String(value).toLowerCase().includes(searchQuery.toLowerCase());
250
- });
251
- });
252
- }, [data, searchQuery, searchable]);
253
- const totalPages = Math.ceil(filteredData.length / pageSize);
254
- const paginatedData = React2.useMemo(() => {
255
- const startIndex = (currentPage - 1) * pageSize;
256
- const endIndex = startIndex + pageSize;
257
- return filteredData.slice(startIndex, endIndex);
258
- }, [filteredData, currentPage, pageSize]);
259
- const selectRow = React2.useCallback((row) => {
260
- if (!enableRowSelection)
261
- return;
262
- setSelectedRows((prev) => {
263
- if (!enableMultiRowSelection) {
264
- return [row];
265
- }
266
- const isSelected = prev.some(
267
- (selectedRow) => JSON.stringify(selectedRow) === JSON.stringify(row)
268
- );
269
- if (isSelected) {
270
- return prev.filter(
271
- (selectedRow) => JSON.stringify(selectedRow) !== JSON.stringify(row)
272
- );
273
- } else {
274
- return [...prev, row];
275
- }
276
- });
277
- }, [enableRowSelection, enableMultiRowSelection]);
278
- const selectAllRows = React2.useCallback(() => {
279
- if (!enableRowSelection)
280
- return;
281
- setSelectedRows((prev) => {
282
- if (prev.length === filteredData.length) {
283
- return [];
284
- } else {
285
- return [...filteredData];
286
- }
287
- });
288
- }, [enableRowSelection, filteredData]);
289
- const clearSelection = React2.useCallback(() => {
290
- setSelectedRows([]);
291
- }, []);
292
- const isRowSelected = React2.useCallback((row) => {
293
- return selectedRows.some(
294
- (selectedRow) => JSON.stringify(selectedRow) === JSON.stringify(row)
295
- );
296
- }, [selectedRows]);
297
- const exportData = React2.useCallback((format = "csv") => {
298
- const dataToExport = selectedRows.length > 0 ? selectedRows : filteredData;
299
- if (format === "csv") {
300
- const headers = Object.keys(dataToExport[0] || {});
301
- const csvContent = [
302
- headers.join(","),
303
- ...dataToExport.map(
304
- (row) => headers.map((header) => {
305
- const value = row[header];
306
- if (typeof value === "string" && (value.includes(",") || value.includes('"'))) {
307
- return `"${value.replace(/"/g, '""')}"`;
308
- }
309
- return value;
310
- }).join(",")
311
- )
312
- ].join("\n");
313
- const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
314
- const link = document.createElement("a");
315
- link.href = URL.createObjectURL(blob);
316
- link.download = "data.csv";
317
- link.click();
318
- } else if (format === "json") {
319
- const jsonContent = JSON.stringify(dataToExport, null, 2);
320
- const blob = new Blob([jsonContent], { type: "application/json;charset=utf-8;" });
321
- const link = document.createElement("a");
322
- link.href = URL.createObjectURL(blob);
323
- link.download = "data.json";
324
- link.click();
325
- }
326
- }, [selectedRows, filteredData]);
327
- const getRowCount = React2.useCallback(() => filteredData.length, [filteredData]);
328
- const getSelectedCount = React2.useCallback(() => selectedRows.length, [selectedRows]);
329
- React2.useEffect(() => {
330
- setCurrentPage(1);
331
- }, [searchQuery]);
332
- return {
333
- filteredData: paginatedData,
334
- selectedRows,
335
- searchQuery,
336
- currentPage,
337
- totalPages,
338
- setSearchQuery,
339
- setCurrentPage,
340
- selectRow,
341
- selectAllRows,
342
- clearSelection,
343
- exportData,
344
- getRowCount,
345
- getSelectedCount,
346
- isRowSelected
347
- };
55
+ img.ProseMirror-separator {
56
+ display: inline !important;
57
+ border: none !important;
58
+ margin: 0 !important;
59
+ width: 0 !important;
60
+ height: 0 !important;
348
61
  }
349
62
 
350
- // src/index.ts
351
- import {
352
- cn as cn2,
353
- Button as Button2,
354
- Input as Input2,
355
- Card,
356
- Badge,
357
- Avatar,
358
- Alert,
359
- Toast,
360
- Tooltip,
361
- Dialog,
362
- Select,
363
- Switch,
364
- Tabs
365
- } from "@moontra/moonui";
63
+ .ProseMirror-gapcursor {
64
+ display: none;
65
+ pointer-events: none;
66
+ position: absolute;
67
+ margin: 0;
68
+ }
366
69
 
367
- // src/utils/data-processing.ts
368
- function createDataProcessor() {
369
- return {
370
- filter: (data, predicate) => {
371
- return data.filter(predicate);
372
- },
373
- sort: (data, key, direction = "asc") => {
374
- return [...data].sort((a, b) => {
375
- const aVal = a[key];
376
- const bVal = b[key];
377
- if (aVal === bVal)
378
- return 0;
379
- const comparison = aVal < bVal ? -1 : 1;
380
- return direction === "asc" ? comparison : -comparison;
381
- });
382
- },
383
- group: (data, key) => {
384
- return data.reduce((groups, item) => {
385
- const groupKey = String(item[key]);
386
- if (!groups[groupKey]) {
387
- groups[groupKey] = [];
388
- }
389
- groups[groupKey].push(item);
390
- return groups;
391
- }, {});
392
- },
393
- aggregate: (data, key, operation) => {
394
- const values = data.map((item) => Number(item[key])).filter((val) => !isNaN(val));
395
- if (values.length === 0)
396
- return 0;
397
- switch (operation) {
398
- case "sum":
399
- return values.reduce((sum, val) => sum + val, 0);
400
- case "avg":
401
- return values.reduce((sum, val) => sum + val, 0) / values.length;
402
- case "min":
403
- return Math.min(...values);
404
- case "max":
405
- return Math.max(...values);
406
- case "count":
407
- return values.length;
408
- default:
409
- return 0;
410
- }
411
- },
412
- paginate: (data, page, pageSize) => {
413
- const startIndex = (page - 1) * pageSize;
414
- const endIndex = startIndex + pageSize;
415
- return data.slice(startIndex, endIndex);
416
- },
417
- search: (data, query, searchKeys) => {
418
- if (!query.trim())
419
- return data;
420
- const lowerQuery = query.toLowerCase();
421
- return data.filter((item) => {
422
- const keysToSearch = searchKeys || Object.keys(item);
423
- return keysToSearch.some((key) => {
424
- const value = item[key];
425
- if (value == null)
426
- return false;
427
- return String(value).toLowerCase().includes(lowerQuery);
428
- });
429
- });
430
- },
431
- transform: (data, transformer) => {
432
- return data.map(transformer);
433
- }
434
- };
70
+ .ProseMirror-gapcursor:after {
71
+ content: "";
72
+ display: block;
73
+ position: absolute;
74
+ top: -2px;
75
+ width: 20px;
76
+ border-top: 1px solid black;
77
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
435
78
  }
436
- export {
437
- Alert,
438
- Avatar,
439
- Badge,
440
- Button2 as Button,
441
- Card,
442
- DataTable,
443
- Dialog,
444
- Input2 as Input,
445
- Select,
446
- Switch,
447
- Tabs,
448
- Toast,
449
- Tooltip,
450
- cn2 as cn,
451
- createDataProcessor,
452
- useDataTable
453
- };
79
+
80
+ @keyframes ProseMirror-cursor-blink {
81
+ to {
82
+ visibility: hidden;
83
+ }
84
+ }
85
+
86
+ .ProseMirror-hideselection *::selection {
87
+ background: transparent;
88
+ }
89
+
90
+ .ProseMirror-hideselection *::-moz-selection {
91
+ background: transparent;
92
+ }
93
+
94
+ .ProseMirror-hideselection * {
95
+ caret-color: transparent;
96
+ }
97
+
98
+ .ProseMirror-focused .ProseMirror-gapcursor {
99
+ display: block;
100
+ }`;function ZS(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 ah=class extends yx{constructor(t={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),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:r,slice:i,moved:o})=>this.options.onDrop(r,i,o)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);let e=this.createDoc(),n=Wp(e,this.options.autofocus);this.editorState=gn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element);}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0);},0);}unmount(){var t;if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy();}this.editorView=null,this.isInitialized=!1,(t=this.css)==null||t.remove(),this.css=null;}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&&typeof document<"u"&&(this.css=ZS(YS,this.options.injectNonce));}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state));}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]});}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t;},dispatch:t=>{this.editorState=this.state.apply(t);},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){let n=Ip(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;let e=this.state.plugins,n=e;if([].concat(t).forEach(i=>{let o=typeof i=="string"?`${i}$`:i.key;n=n.filter(s=>!s.key.startsWith(o));}),e.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;let r=[...this.options.enableCoreExtensions?[th,Jp.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Xp,rh,ih,sh,eh,oh,Qp].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new Xo(r,this);}createCommandManager(){this.commandManager=new Go({editor:this});}createSchema(){this.schema=this.extensionManager.schema;}createDoc(){let t;try{t=ql(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck});}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager();}}),t=ql(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});}return t}createView(t){var e;this.editorView=new Mi(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState});let n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass(),this.injectCSS();let r=this.view.dom;r.editor=this;}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`;}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;let e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var d;return (d=this.capturedTransaction)==null?void 0:d.step(c)});return}let{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});let s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=s?.getMeta("focus"),l=s?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)});}getAttributes(t){return ec(this.state,t)}isActive(t,e){let n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Mx(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Xl(this.state.doc.content,this.schema)}getText(t){let{blockSeparator:e=`
101
+
102
+ `,textSerializers:n={}}=t||{};return Cx(this.state.doc,{blockSeparator:e,textSerializers:{...zp(this.schema),...n}})}get isEmpty(){return Li(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners();}get isDestroyed(){var t,e;return (e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return ((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return ((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){let e=this.state.doc.resolve(t);return new JS(e,this)}get $doc(){return this.$pos(0)}};function Pt(t){return new Pi({find:t.find,handler:({state:e,range:n,match:r})=>{let i=Se(t.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:o}=e,s=r[r.length-1],a=r[0];if(s){let l=a.search(/\S/),c=n.from+a.indexOf(s),d=c+s.length;if(Yo(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>c).length)return null;d<n.to&&o.delete(d,n.to),c>n.from&&o.delete(n.from+l,c);let f=n.from+l+s.length;o.addMark(n.from+l,f,t.type.create(i||{})),o.removeStoredMark(t.type);}}})}function Qo(t){return new Pi({find:t.find,handler:({state:e,range:n,match:r})=>{let i=Se(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from,a=n.to,l=t.type.create(i);if(r[1]){let c=r[0].lastIndexOf(r[1]),d=s+c;d>a?d=a:a=d+r[1].length;let u=r[0][r[0].length-1];o.insertText(u,s+r[0].length-1),o.replaceWith(d,a,l);}else if(r[0]){let c=t.type.isInline?s:s-1;o.insert(c,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a));}o.scrollIntoView();}})}function Bi(t){return new Pi({find:t.find,handler:({state:e,range:n,match:r})=>{let i=e.doc.resolve(n.from),o=Se(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 Ie(t){return new Pi({find:t.find,handler:({state:e,range:n,match:r})=>{let i=t.replace,o=n.from,s=n.to;if(r[1]){let a=r[0].lastIndexOf(r[1]);i+=r[0].slice(a+r[1].length),o+=a;let l=o-s;l>0&&(i=r[0].slice(a-l,a)+i,o=s);}e.tr.insertText(i,o,s);}})}function en(t){return new Pi({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{let o=Se(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&Ir(l,t.type,o);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){let{selection:u,storedMarks:f}=e,{splittableMarks:p}=t.editor.extensionManager,h=f||u.$to.parentOffset&&u.$from.marks();if(h){let m=h.filter(g=>p.includes(g.type.name));s.ensureMarks(m);}}if(t.keepAttributes){let u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,o).run();}let d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&Rt(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&s.join(n.from-1);}})}function lh(t,e){let{selection:n}=t,{$from:r}=n;if(n instanceof W){let o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){let o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return !0;i-=1;}return !1}function XS(t,e,n={}){let{state:r}=e,{doc:i,tr:o}=r,s=t;i.descendants((a,l)=>{let c=o.mapping.map(l),d=o.mapping.map(l)+a.nodeSize,u=null;if(a.marks.forEach(p=>{if(p!==s)return !1;u=p;}),!u)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==u.attrs[p]&&(f=!0);}),f){let p=t.type.create({...t.attrs,...n});o.removeMark(c,d,t.type),o.addMark(c,d,p);}}),o.docChanged&&e.view.dispatch(o);}var ge=class ch extends ic{constructor(){super(...arguments),this.type="node";}static create(e={}){let n=typeof e=="function"?e():e;return new ch(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}};function St(t){return new Lx({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{let o=Se(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;let{tr:s}=e,a=r[r.length-1],l=r[0],c=n.to;if(a){let d=l.search(/\S/),u=n.from+l.indexOf(a),f=u+a.length;if(Yo(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;f<n.to&&s.delete(f,n.to),u>n.from&&s.delete(n.from+d,u),c=n.from+d+a.length,s.addMark(n.from+d,c,t.type.create(o||{})),s.removeStoredMark(t.type);}}})}var wh=ai(fi(),1),xh=ai(uh(),1),Sh=ai(gh(),1);var uC=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e);});},fC=({contentComponent:t})=>{let e=(0, yh.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getServerSnapshot);return jsx(Fragment,{children:Object.values(e)})};function pC(){let t=new Set,e={};return {subscribe(n){return t.add(n),()=>{t.delete(n);}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:cC.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i());},removeRenderer(n){let r={...e};delete r[n],e=r,t.forEach(i=>i());}}}var hC=class extends Mn.Component{constructor(t){var e;super(t),this.editorContentRef=Mn.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)};}componentDidMount(){this.init();}componentDidUpdate(){this.init();}init(){let t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;let e=this.editorContentRef.current;e.append(...t.options.element.childNodes),t.setOptions({element:e}),t.contentComponent=pC(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent();})),t.createNodeViews(),this.initialized=!0;}}componentWillUnmount(){var t;let e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!((t=e.options.element)!=null&&t.firstChild)))return;let n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n});}render(){let{editor:t,innerRef:e,...n}=this.props;return jsxs(Fragment,{children:[jsx("div",{ref:uC(e,this.editorContentRef),...n}),t?.contentComponent&&jsx(fC,{contentComponent:t.contentComponent})]})}},mC=forwardRef((t,e)=>{let n=Mn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Mn.createElement(hC,{key:n,innerRef:e,...t})}),vh=Mn.memo(mC),CC=typeof window<"u"?useLayoutEffect:useEffect,kC=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this);}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return {editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t);}}watch(t){if(this.editor=t,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r());},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e);}}}};function NC(t){var e;let[n]=useState(()=>new kC(t.editor)),r=(0, Sh.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:xh.default);return CC(()=>n.watch(t.editor),[t.editor,n]),useDebugValue(r),r}var bh=process.env.NODE_ENV!=="production",lc=typeof window>"u",TC=lc||!!(typeof window<"u"&&window.next),_C=class Ch{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this);}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n());}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(lc||TC){if(bh)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&lc&&bh)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){let e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return (o=(i=this.options.current).onBeforeCreate)==null?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return (o=(i=this.options.current).onBlur)==null?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return (o=(i=this.options.current).onCreate)==null?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return (o=(i=this.options.current).onDestroy)==null?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return (o=(i=this.options.current).onFocus)==null?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return (o=(i=this.options.current).onSelectionUpdate)==null?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return (o=(i=this.options.current).onTransaction)==null?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return (o=(i=this.options.current).onUpdate)==null?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return (o=(i=this.options.current).onContentError)==null?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return (o=(i=this.options.current).onDrop)==null?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return (o=(i=this.options.current).onPaste)==null?void 0:o.call(i,...r)},onDelete:(...r)=>{var i,o;return (o=(i=this.options.current).onDelete)==null?void 0:o.call(i,...r)}};return new ah(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e);}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,o)=>{var s;return i===((s=n.extensions)==null?void 0:s[o])}):e[r]===n[r])}onRender(e){return ()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Ch.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy();})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e;}scheduleDestroy(){let e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null));},1);}};function kh(t={},e=[]){let n=useRef(t);n.current=t;let[r]=useState(()=>new _C(n)),i=(0, wh.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return useDebugValue(i),useEffect(r.onRender(e)),NC({editor:i,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&o===0?0:o+1}),i}var MC=createContext({editor:null});MC.Consumer;var RC=createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});var DC=()=>useContext(RC);Mn.forwardRef((t,e)=>{let{onDragStart:n}=DC(),r=t.as||"div";return jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Mn.createContext({markViewContentRef:()=>{}});var jr=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);let{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return [t,r,n]};var BC=/^\s*>\s$/,Nh=ge.create({name:"blockquote",addOptions(){return {HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return [{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return jr("blockquote",{...te(this.options.HTMLAttributes,t),children:jr("slot",{})})},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 [en({find:BC,type:this.type})]}});var zC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,FC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,UC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,HC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Th=nt.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 jr("strong",{...te(this.options.HTMLAttributes,t),children:jr("slot",{})})},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 [Pt({find:zC,type:this.type}),Pt({find:UC,type:this.type})]},addPasteRules(){return [St({find:FC,type:this.type}),St({find:HC,type:this.type})]}});var $C=/(^|[^`])`([^`]+)`(?!`)/,KC=/(^|[^`])`([^`]+)`(?!`)/g,_h=nt.create({name:"code",addOptions(){return {HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return [{tag:"code"}]},renderHTML({HTMLAttributes:t}){return ["code",te(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 [Pt({find:$C,type:this.type})]},addPasteRules(){return [St({find:KC,type:this.type})]}});var VC=/^```([a-z]+)?[\s\n]$/,WC=/^~~~([a-z]+)?[\s\n]$/,cc=ge.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?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",te(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(`
103
+
104
+ `);return !o||!s?!1:t.chain().command(({tr:a})=>(a.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 a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(q.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return [Bi({find:VC,type:this.type,getAttributes:t=>({language:t[1]})}),Bi({find:WC,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return [new Z({key:new re("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:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
105
+ `));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(H.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),Mh=cc;var Ah=ge.create({name:"doc",topNode:!0,content:"block+"});var Oh=ge.create({name:"hardBreak",addOptions(){return {keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return [{tag:"br"}]},renderHTML({HTMLAttributes:t}){return ["br",te(this.options.HTMLAttributes,t)]},renderText(){return `
106
+ `},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:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&s){let u=l.filter(f=>a.includes(f.type.name));c.ensureMarks(u);}return !0}).run()})])}},addKeyboardShortcuts(){return {"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Rh=ge.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]}`,te(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=>Bi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Dh=ge.create({name:"horizontalRule",addOptions(){return {HTMLAttributes:{}}},group:"block",parseHTML(){return [{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return ["hr",te(this.options.HTMLAttributes,t)]},addCommands(){return {setHorizontalRule:()=>({chain:t,state:e})=>{if(!lh(e,e.schema.nodes[this.name]))return !1;let{selection:n}=e,{$to:r}=n,i=t();return Zo(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:o,dispatch:s})=>{var a;if(s){let{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(H.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(W.create(o.doc,l.pos)):o.setSelection(H.create(o.doc,l.pos));else {let d=(a=l.parent.type.contentMatch.defaultType)==null?void 0:a.create();d&&(o.insert(c,d),o.setSelection(H.create(o.doc,c+1)));}o.scrollIntoView();}return !0}).run()}}},addInputRules(){return [Qo({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var GC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,qC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,jC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,JC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ih=nt.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",te(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 [Pt({find:GC,type:this.type}),Pt({find:jC,type:this.type})]},addPasteRules(){return [St({find:qC,type:this.type}),St({find:JC,type:this.type})]}});var YC="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",ZC="\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",Yr=(t,e)=>{for(let n in e)t[n]=e[n];return t},gc="numeric",bc="ascii",yc="alpha",Hi="asciinumeric",Ui="alphanumeric",Ec="domain",Hh="emoji",XC="scheme",QC="slashscheme",dc="whitespace";function ek(t,e){return t in e||(e[t]=[]),e[t]}function hr(t,e,n){e[gc]&&(e[Hi]=!0,e[Ui]=!0),e[bc]&&(e[Hi]=!0,e[yc]=!0),e[Hi]&&(e[Ui]=!0),e[yc]&&(e[Ui]=!0),e[Ui]&&(e[Ec]=!0),e[Hh]&&(e[Ec]=!0);for(let r in e){let i=ek(r,n);i.indexOf(t)<0&&i.push(t);}}function tk(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Ct(t=null){this.j={},this.jr=[],this.jd=null,this.t=t;}Ct.groups={};Ct.prototype={accepts(){return !!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){let i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r);},tr(t,e,n,r){r=r||Ct.groups;let i;return e&&e.j?i=e:(i=new Ct(e),n&&r&&hr(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this,o=t.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(t[s]);return i.tt(t[o-1],e,n,r)},tt(t,e,n,r){r=r||Ct.groups;let i=this;if(e&&e.j)return i.j[t]=e,e;let o=e,s,a=i.go(t);if(a?(s=new Ct,Yr(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Ct,o){if(r)if(s.t&&typeof s.t=="string"){let l=Yr(tk(s.t,r),n);hr(o,l,r);}else n&&hr(o,n,r);s.t=o;}return i.j[t]=s,s}};var pe=(t,e,n,r,i)=>t.ta(e,n,r,i),Fe=(t,e,n,r,i)=>t.tr(e,n,r,i),Lh=(t,e,n,r,i)=>t.ts(e,n,r,i),P=(t,e,n,r,i)=>t.tt(e,n,r,i),Nn="WORD",vc="UWORD",$h="ASCIINUMERICAL",Kh="ALPHANUMERICAL",qi="LOCALHOST",wc="TLD",xc="UTLD",is="SCHEME",Jr="SLASH_SCHEME",Cc="NUM",Sc="WS",kc="NL",$i="OPENBRACE",Ki="CLOSEBRACE",ss="OPENBRACKET",as="CLOSEBRACKET",ls="OPENPAREN",cs="CLOSEPAREN",ds="OPENANGLEBRACKET",us="CLOSEANGLEBRACKET",fs="FULLWIDTHLEFTPAREN",ps="FULLWIDTHRIGHTPAREN",hs="LEFTCORNERBRACKET",ms="RIGHTCORNERBRACKET",gs="LEFTWHITECORNERBRACKET",bs="RIGHTWHITECORNERBRACKET",ys="FULLWIDTHLESSTHAN",Es="FULLWIDTHGREATERTHAN",vs="AMPERSAND",ws="APOSTROPHE",xs="ASTERISK",Hn="AT",Ss="BACKSLASH",Cs="BACKTICK",ks="CARET",$n="COLON",Nc="COMMA",Ns="DOLLAR",tn="DOT",Ts="EQUALS",Tc="EXCLAMATION",zt="HYPHEN",Vi="PERCENT",_s="PIPE",Ms="PLUS",As="POUND",Wi="QUERY",_c="QUOTE",Vh="FULLWIDTHMIDDLEDOT",Mc="SEMI",nn="SLASH",Gi="TILDE",Os="UNDERSCORE",Wh="EMOJI",Rs="SYM",Gh=Object.freeze({__proto__:null,ALPHANUMERICAL:Kh,AMPERSAND:vs,APOSTROPHE:ws,ASCIINUMERICAL:$h,ASTERISK:xs,AT:Hn,BACKSLASH:Ss,BACKTICK:Cs,CARET:ks,CLOSEANGLEBRACKET:us,CLOSEBRACE:Ki,CLOSEBRACKET:as,CLOSEPAREN:cs,COLON:$n,COMMA:Nc,DOLLAR:Ns,DOT:tn,EMOJI:Wh,EQUALS:Ts,EXCLAMATION:Tc,FULLWIDTHGREATERTHAN:Es,FULLWIDTHLEFTPAREN:fs,FULLWIDTHLESSTHAN:ys,FULLWIDTHMIDDLEDOT:Vh,FULLWIDTHRIGHTPAREN:ps,HYPHEN:zt,LEFTCORNERBRACKET:hs,LEFTWHITECORNERBRACKET:gs,LOCALHOST:qi,NL:kc,NUM:Cc,OPENANGLEBRACKET:ds,OPENBRACE:$i,OPENBRACKET:ss,OPENPAREN:ls,PERCENT:Vi,PIPE:_s,PLUS:Ms,POUND:As,QUERY:Wi,QUOTE:_c,RIGHTCORNERBRACKET:ms,RIGHTWHITECORNERBRACKET:bs,SCHEME:is,SEMI:Mc,SLASH:nn,SLASH_SCHEME:Jr,SYM:Rs,TILDE:Gi,TLD:wc,UNDERSCORE:Os,UTLD:xc,UWORD:vc,WORD:Nn,WS:Sc}),Cn=/[a-z]/,Fi=/\p{L}/u,uc=/\p{Emoji}/u;var kn=/\d/,fc=/\s/;var Ph="\r",pc=`
107
+ `,nk="\uFE0F",rk="\u200D",hc="\uFFFC",ts=null,ns=null;function ik(t=[]){let e={};Ct.groups=e;let n=new Ct;ts==null&&(ts=Bh(YC)),ns==null&&(ns=Bh(ZC)),P(n,"'",ws),P(n,"{",$i),P(n,"}",Ki),P(n,"[",ss),P(n,"]",as),P(n,"(",ls),P(n,")",cs),P(n,"<",ds),P(n,">",us),P(n,"\uFF08",fs),P(n,"\uFF09",ps),P(n,"\u300C",hs),P(n,"\u300D",ms),P(n,"\u300E",gs),P(n,"\u300F",bs),P(n,"\uFF1C",ys),P(n,"\uFF1E",Es),P(n,"&",vs),P(n,"*",xs),P(n,"@",Hn),P(n,"`",Cs),P(n,"^",ks),P(n,":",$n),P(n,",",Nc),P(n,"$",Ns),P(n,".",tn),P(n,"=",Ts),P(n,"!",Tc),P(n,"-",zt),P(n,"%",Vi),P(n,"|",_s),P(n,"+",Ms),P(n,"#",As),P(n,"?",Wi),P(n,'"',_c),P(n,"/",nn),P(n,";",Mc),P(n,"~",Gi),P(n,"_",Os),P(n,"\\",Ss),P(n,"\u30FB",Vh);let r=Fe(n,kn,Cc,{[gc]:!0});Fe(r,kn,r);let i=Fe(r,Cn,$h,{[Hi]:!0}),o=Fe(r,Fi,Kh,{[Ui]:!0}),s=Fe(n,Cn,Nn,{[bc]:!0});Fe(s,kn,i),Fe(s,Cn,s),Fe(i,kn,i),Fe(i,Cn,i);let a=Fe(n,Fi,vc,{[yc]:!0});Fe(a,Cn),Fe(a,kn,o),Fe(a,Fi,a),Fe(o,kn,o),Fe(o,Cn),Fe(o,Fi,o);let l=P(n,pc,kc,{[dc]:!0}),c=P(n,Ph,Sc,{[dc]:!0}),d=Fe(n,fc,Sc,{[dc]:!0});P(n,hc,d),P(c,pc,l),P(c,hc,d),Fe(c,fc,d),P(d,Ph),P(d,pc),Fe(d,fc,d),P(d,hc,d);let u=Fe(n,uc,Wh,{[Hh]:!0});P(u,"#"),Fe(u,uc,u),P(u,nk,u);let f=P(u,rk);P(f,"#"),Fe(f,uc,u);let p=[[Cn,s],[kn,i]],h=[[Cn,null],[Fi,a],[kn,o]];for(let m=0;m<ts.length;m++)Un(n,ts[m],wc,Nn,p);for(let m=0;m<ns.length;m++)Un(n,ns[m],xc,vc,h);hr(wc,{tld:!0,ascii:!0},e),hr(xc,{utld:!0,alpha:!0},e),Un(n,"file",is,Nn,p),Un(n,"mailto",is,Nn,p),Un(n,"http",Jr,Nn,p),Un(n,"https",Jr,Nn,p),Un(n,"ftp",Jr,Nn,p),Un(n,"ftps",Jr,Nn,p),hr(is,{scheme:!0,ascii:!0},e),hr(Jr,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){let g=t[m][0],v=t[m][1]?{[XC]:!0}:{[QC]:!0};g.indexOf("-")>=0?v[Ec]=!0:Cn.test(g)?kn.test(g)?v[Hi]=!0:v[bc]=!0:v[gc]=!0,Lh(n,g,g,v);}return Lh(n,"localhost",qi,{ascii:!0}),n.jd=new Ct(Rs),{start:n,tokens:Yr({groups:e},Gh)}}function qh(t,e){let n=ok(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s<r;){let a=t,l=null,c=0,d=null,u=-1,f=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(u=0,f=0,d=a):u>=0&&(u+=n[s].length,f++),c+=n[s].length,o+=n[s].length,s++;o-=u,s-=f,c-=u,i.push({t:d.t,v:e.slice(o-c,o),s:o-c,e:o});}return i}function ok(t){let e=[],n=t.length,r=0;for(;r<n;){let i=t.charCodeAt(r),o,s=i<55296||i>56319||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 Un(t,e,n,r,i){let o,s=e.length;for(let a=0;a<s-1;a++){let l=e[a];t.j[l]?o=t.j[l]:(o=new Ct(r),o.jr=i.slice(),t.j[l]=o),t=o;}return o=new Ct(n),o.jr=i.slice(),t.j[e[s-1]]=o,o}function Bh(t){let e=[],n=[],r=0,i="0123456789";for(;r<t.length;){let o=0;for(;i.indexOf(t[r+o])>=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 ji={defaultProtocol:"http",events:null,format:zh,formatHref:zh,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ac(t,e=null){let n=Yr({},ji);t&&(n=Yr(n,t instanceof Ac?t.o:t));let r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i;}Ac.prototype={o:ji,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){let r=e!=null,i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:ji[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){let e=t.render(this);return (this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function zh(t){return t}function jh(t,e){this.t="token",this.v=t,this.tk=e;}jh.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){let e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?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=ji.defaultProtocol){return {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={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),d=t.getObj("attributes",n,e),u=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&Yr(s,d),{tagName:i,attributes:s,content:o,eventListeners:u}}};function Ds(t,e){class n extends jh{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 Fh=Ds("email",{isLink:!0,toHref(){return "mailto:"+this.toString()}}),Uh=Ds("text"),sk=Ds("nl"),rs=Ds("url",{isLink:!0,toHref(t=ji.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==qi&&t[1].t===$n}});var Bt=t=>new Ct(t);function ak({groups:t}){let e=t.domain.concat([vs,xs,Hn,Ss,Cs,ks,Ns,Ts,zt,Cc,Vi,_s,Ms,As,nn,Rs,Gi,Os]),n=[ws,$n,Nc,tn,Tc,Vi,Wi,_c,Mc,ds,us,$i,Ki,as,ss,ls,cs,fs,ps,hs,ms,gs,bs,ys,Es],r=[vs,ws,xs,Ss,Cs,ks,Ns,Ts,zt,$i,Ki,Vi,_s,Ms,As,Wi,nn,Rs,Gi,Os],i=Bt(),o=P(i,Gi);pe(o,r,o),pe(o,t.domain,o);let s=Bt(),a=Bt(),l=Bt();pe(i,t.domain,s),pe(i,t.scheme,a),pe(i,t.slashscheme,l),pe(s,r,o),pe(s,t.domain,s);let c=P(s,Hn);P(o,Hn,c),P(a,Hn,c),P(l,Hn,c);let d=P(o,tn);pe(d,r,o),pe(d,t.domain,o);let u=Bt();pe(c,t.domain,u),pe(u,t.domain,u);let f=P(u,tn);pe(f,t.domain,u);let p=Bt(Fh);pe(f,t.tld,p),pe(f,t.utld,p),P(c,qi,p);let h=P(u,zt);P(h,zt,h),pe(h,t.domain,u),pe(p,t.domain,u),P(p,tn,f),P(p,zt,h);let m=P(p,$n);pe(m,t.numeric,Fh);let g=P(s,zt),b=P(s,tn);P(g,zt,g),pe(g,t.domain,s),pe(b,r,o),pe(b,t.domain,s);let v=Bt(rs);pe(b,t.tld,v),pe(b,t.utld,v),pe(v,t.domain,s),pe(v,r,o),P(v,tn,b),P(v,zt,g),P(v,Hn,c);let S=P(v,$n),T=Bt(rs);pe(S,t.numeric,T);let _=Bt(rs),I=Bt();pe(_,e,_),pe(_,n,I),pe(I,e,_),pe(I,n,I),P(v,nn,_),P(T,nn,_);let k=P(a,$n),y=P(l,$n),w=P(y,nn),O=P(w,nn);pe(a,t.domain,s),P(a,tn,b),P(a,zt,g),pe(l,t.domain,s),P(l,tn,b),P(l,zt,g),pe(k,t.domain,_),P(k,nn,_),P(k,Wi,_),pe(O,t.domain,_),pe(O,e,_),P(O,nn,_);let X=[[$i,Ki],[ss,as],[ls,cs],[ds,us],[fs,ps],[hs,ms],[gs,bs],[ys,Es]];for(let R=0;R<X.length;R++){let[ce,Q]=X[R],G=P(_,ce);P(I,ce,G),P(G,Q,_);let x=Bt(rs);pe(G,e,x);let C=Bt();pe(G,n),pe(x,e,x),pe(x,n,C),pe(C,e,x),pe(C,n,C),P(x,Q,_),P(C,Q,_);}return P(i,qi,v),P(i,kc,sk),{start:i,tokens:Gh}}function lk(t,e,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let a=t,l=null,c=null,d=0,u=null,f=-1;for(;i<r&&!(l=a.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=l||a.go(n[i].t));)l=null,a=c,a.accepts()?(f=0,u=a):f>=0&&f++,i++,d++;if(f<0)i-=d,i<r&&(s.push(n[i]),i++);else {s.length>0&&(o.push(mc(Uh,e,s)),s=[]),i-=f,d-=f;let p=u.t,h=n.slice(i-d,i);o.push(mc(p,e,h));}}return s.length>0&&o.push(mc(Uh,e,s)),o}function mc(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 ck=typeof console<"u"&&console&&console.warn||(()=>{}),dk="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Te={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Jh(){return Ct.groups={},Te.scanner=null,Te.parser=null,Te.tokenQueue=[],Te.pluginQueue=[],Te.customSchemes=[],Te.initialized=!1,Te}function Oc(t,e=!1){if(Te.initialized&&ck(`linkifyjs: already initialized - will not register custom scheme "${t}" ${dk}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
108
+ 1. Must only contain digits, lowercase ASCII letters or "-"
109
+ 2. Cannot start or end with "-"
110
+ 3. "-" cannot repeat`);Te.customSchemes.push([t,e]);}function uk(){Te.scanner=ik(Te.customSchemes);for(let t=0;t<Te.tokenQueue.length;t++)Te.tokenQueue[t][1]({scanner:Te.scanner});Te.parser=ak(Te.scanner.tokens);for(let t=0;t<Te.pluginQueue.length;t++)Te.pluginQueue[t][1]({scanner:Te.scanner,parser:Te.parser});return Te.initialized=!0,Te}function Is(t){return Te.initialized||uk(),lk(Te.parser.start,t,qh(Te.scanner.start,t))}Is.scan=qh;function Ls(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null;}let r=new Ac(n),i=Is(t),o=[];for(let s=0;s<i.length;s++){let a=i[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&o.push(a.toFormattedObject(r));}return o}var Rc="[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]",fk=new RegExp(Rc),pk=new RegExp(`${Rc}$`),hk=new RegExp(Rc,"g");function mk(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function gk(t){return new Z({key:new re("autolink"),appendTransaction:(e,n,r)=>{let i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r,a=Jl(n.doc,[...e]);if(tc(a).forEach(({newRange:c})=>{let d=Dp(r.doc,c,p=>p.isTextblock),u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){let p=r.doc.textBetween(c.from,c.to," "," ");if(!pk.test(p))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ");}if(u&&f){let p=f.split(fk).filter(Boolean);if(p.length<=0)return !1;let h=p[p.length-1],m=u.pos+f.lastIndexOf(h);if(!h)return !1;let g=Is(h).map(b=>b.toObject(t.defaultProtocol));if(!mk(g))return !1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Yo(b.from,b.to,r.doc).some(v=>v.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}));});}}),!!s.steps.length)return s}})}function bk(t){return new Z({key:new re("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return !1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else {let d=r.target,u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;s=u.find(f=>f.nodeName==="A");}if(!s)return !1;let a=ec(e.state,t.type.name),l=(i=s?.href)!=null?i:a.href,c=(o=s?.target)!=null?o:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),s&&l?(window.open(l,c),!0):!1}}})}function yk(t){return new Z({key:new re("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{state:i}=e,{selection:o}=i,{empty:s}=o;if(s)return !1;let a="";r.content.forEach(c=>{a+=c.textContent;});let l=Ls(a,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===a);return !a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function mr(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(hk,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Dc=nt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Oc(t);return}Oc(t.scheme,t.optionalSlashes);});},onDestroy(){Jh();},inclusive(){return this.options.autolink},addOptions(){return {openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!mr(t,e.protocols),validate:t=>!!t,shouldAutoLink: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||!this.options.isAllowedUri(e,{defaultValidate:n=>!!mr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!mr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",te(this.options.HTMLAttributes,t),0]:["a",te(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return {setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!mr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{let{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!mr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1: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 [St({find:t=>{let e=[];if(t){let{protocols:n,defaultProtocol:r}=this.options,i=Ls(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!mr(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}));}return e},type:this.type,getAttributes:t=>{var e;return {href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(gk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!mr(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(bk({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(yk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),Yh=Dc;var Ek=Object.defineProperty,vk=(t,e)=>{for(var n in e)Ek(t,n,{get:e[n],enumerable:!0});},wk="listItem",Zh="textStyle",Xh=/^\s*([-+*])\s$/,Pc=ge.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",te(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(wk,this.editor.getAttributes(Zh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return {"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=en({find:Xh,type:this.type});return (this.options.keepMarks||this.options.keepAttributes)&&(t=en({find:Xh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Zh),editor:this.editor})),[t]}}),Bc=ge.create({name:"listItem",addOptions(){return {HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return [{tag:"li"}]},renderHTML({HTMLAttributes:t}){return ["li",te(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)}}}),xk={};vk(xk,{findListItemPos:()=>Ji,getNextListDepth:()=>zc,handleBackspace:()=>Ic,handleDelete:()=>Lc,hasListBefore:()=>tm,hasListItemAfter:()=>Sk,hasListItemBefore:()=>nm,listItemHasSubList:()=>rm,nextListIsDeeper:()=>im,nextListIsHigher:()=>om});var Ji=(t,e)=>{let{$from:n}=e.selection,r=ze(t,e.schema),i=null,o=n.depth,s=n.pos,a=null;for(;o>0&&a===null;)i=n.node(o),i.type===r?a=o:(o-=1,s-=1);return a===null?null:{$pos:e.doc.resolve(s),depth:a}},zc=(t,e)=>{let n=Ji(t,e);if(!n)return !1;let[,r]=Hp(e,t,n.$pos.pos+4);return r},tm=(t,e,n)=>{let{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),o=t.doc.resolve(i).node();return !(!o||!n.includes(o.type.name))},nm=(t,e)=>{var n;let{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return !(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},rm=(t,e,n)=>{if(!n)return !1;let r=ze(t,e.schema),i=!1;return n.descendants(o=>{o.type===r&&(i=!0);}),i},Ic=(t,e,n)=>{if(t.commands.undoInputRule())return !0;if(t.state.selection.from!==t.state.selection.to)return !1;if(!Qt(t.state,e)&&tm(t.state,e,n)){let{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,p)=>{f.type.name===e&&c.push({node:f,pos:p});});let d=c.at(-1);if(!d)return !1;let u=t.state.doc.resolve(l.start()+d.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!Qt(t.state,e)||!Kp(t.state))return !1;let r=Ji(e,t.state);if(!r)return !1;let o=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=rm(e,t.state,o);return nm(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},im=(t,e)=>{let n=zc(t,e),r=Ji(t,e);return !r||!n?!1:n>r.depth},om=(t,e)=>{let n=zc(t,e),r=Ji(t,e);return !r||!n?!1:n<r.depth},Lc=(t,e)=>{if(!Qt(t.state,e)||!$p(t.state,e))return !1;let{selection:n}=t.state,{$from:r,$to:i}=n;return !n.empty&&r.sameParent(i)?!1:im(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():om(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Sk=(t,e)=>{var n;let{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return !(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},Fc=ne.create({name:"listKeymap",addOptions(){return {listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return {Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Lc(t,n)&&(e=!0);}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Lc(t,n)&&(e=!0);}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Ic(t,n,r)&&(e=!0);}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Ic(t,n,r)&&(e=!0);}),e}}}}),Ck="listItem",Qh="textStyle",em=/^(\d+)\.\s$/,Uc=ge.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:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return [{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,...n}=t;return e===1?["ol",te(this.options.HTMLAttributes,n),0]:["ol",te(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(Ck,this.editor.getAttributes(Qh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return {"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=en({find:em,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=en({find:em,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Qh)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),kk=/^\s*(\[([( |x])?\])\s$/,Ps=ge.create({name:"taskItem",addOptions(){return {nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return {checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return [{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return ["li",te(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return ({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=()=>{var d,u;a.ariaLabel=((u=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:u.call(d,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`;};return c(),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:u}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{let p=n();if(typeof p!="number")return !1;let h=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...h?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(a.checked=!a.checked));}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{i.setAttribute(d,u);}),i.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,o.append(a,s),i.append(o,l),Object.entries(e).forEach(([d,u])=>{i.setAttribute(d,u);}),{dom:i,contentDOM:l,update:d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(),!0)}}},addInputRules(){return [en({find:kk,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Bs=ge.create({name:"taskList",addOptions(){return {itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return `${this.options.itemTypeName}+`},parseHTML(){return [{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return ["ul",te(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return {toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return {"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ne.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push(Pc.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Bc.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Fc.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Uc.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Ps.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Bs.configure(this.options.taskList)),t}});var sm=ge.create({name:"paragraph",priority:1e3,addOptions(){return {HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return [{tag:"p"}]},renderHTML({HTMLAttributes:t}){return ["p",te(this.options.HTMLAttributes,t),0]},addCommands(){return {setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return {"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Nk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Tk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,am=nt.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",te(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 [Pt({find:Nk,type:this.type})]},addPasteRules(){return [St({find:Tk,type:this.type})]}});var lm=ge.create({name:"text",group:"inline"});var Hc=nt.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",te(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()}}}),cm=Hc;function dm(t={}){return new Z({view(e){return new $c(e,t)}})}var $c=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,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let p=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(p){let h=p.getBoundingClientRect(),m=u?h.bottom:h.top;u&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:h.left,right:h.right,top:m-g,bottom:m+g};}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom};}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else {let u=l.getBoundingClientRect(),f=u.width/l.offsetWidth,p=u.height/l.offsetHeight;c=u.left-l.scrollLeft*f,d=u.top-l.scrollTop*p;}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"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 a=Co(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a);}this.setCursor(s),this.scheduleRemoval(5e3);}}dragend(){this.scheduleRemoval(20);}drop(){this.scheduleRemoval(20);}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null);}};var Ae=class extends q{constructor(e){super(e,e);}map(e,n){let r=e.resolve(n.map(this.head));return Ae.valid(r)?new Ae(r):q.near(r)}content(){return B.empty}eq(e){return e instanceof Ae&&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 Ae(e.resolve(n.pos))}getBookmark(){return new Yi(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!_k(e)||!Mk(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&&Ae.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let l=e.doc.resolve(i);if(Ae.valid(l))return l}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!W.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let a=e.doc.resolve(i);if(Ae.valid(a))return a}return null}}};Ae.prototype.visible=!1;Ae.findFrom=Ae.findGapCursorFrom;q.jsonID("gapcursor",Ae);var Yi=class{constructor(e){this.pos=e;}map(e){return new Yi(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ae.valid(n)?new Ae(n):q.near(n)}};function _k(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 Mk(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 um(){return new Z({props:{decorations:Dk,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ae.valid(n)?new Ae(n):null},handleClick:Ok,handleKeyDown:Ak,handleDOMEvents:{beforeinput:Rk}}})}var Ak=Ri({ArrowLeft:zs("horiz",-1),ArrowRight:zs("horiz",1),ArrowUp:zs("vert",-1),ArrowDown:zs("vert",1)});function zs(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof H){if(!o.endOfTextblock(n)||a.depth==0)return !1;l=!1,a=r.doc.resolve(e>0?a.after():a.before());}let c=Ae.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new Ae(c))),!0):!1}}function Ok(t,e,n){if(!t||!t.editable)return !1;let r=t.state.doc.resolve(e);if(!Ae.valid(r))return !1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&W.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ae(r))),!0)}function Rk(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ae))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=N.empty;for(let s=r.length-1;s>=0;s--)i=N.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new B(i,0,0));return o.setSelection(H.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function Dk(t){if(!(t.selection instanceof Ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",me.create(t.doc,[Ce.widget(t.selection.head,e,{key:"gapcursor"})])}var Fs=200,rt=function(){};rt.prototype.append=function(e){return e.length?(e=rt.from(e),!this.length&&e||e.length<Fs&&this.leafAppend(e)||this.length<Fs&&e.leafPrepend(this)||this.appendInner(e)):this};rt.prototype.prepend=function(e){return e.length?rt.from(e).append(this):this};rt.prototype.appendInner=function(e){return new Ik(this,e)};rt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?rt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};rt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};rt.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);};rt.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};rt.from=function(e){return e instanceof rt?e:e&&e.length?new fm(e):rt.empty};var fm=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,a){for(var l=o;l<s;l++)if(i(this.values[l],a+l)===!1)return !1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var l=o-1;l>=s;l--)if(i(this.values[l],a+l)===!1)return !1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Fs)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Fs)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}(rt);rt.empty=new fm([]);var Ik=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 r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return !1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),o,s)===!1)return !1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=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}(rt),Kc=rt;var Lk=500,At=class{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,a,l,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,d.push(u);return}if(i){d.push(new Ft(u.map));let p=u.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ft(h,void 0,void 0,c.length+d.length))),o--,h&&i.appendMap(h,o);}else s.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(o)):u.selection,l=new At(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new Ft(e.mapping.maps[d],u,n),p;(p=l&&l.merge(f))&&(f=p,d?o.pop():a=a.slice(0,a.length-1)),o.push(f),n&&(s++,n=void 0),i||(l=f);}let c=s-r.depth;return c>Bk&&(a=Pk(a,c),s-=c),new At(a.append(o),s)}remapping(e,n){let r=new Rn;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 At(this.items.append(e.map(n=>new Ft(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,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--;},i);let l=n;this.items.forEach(f=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(o.slice(l+1,p));g&&a++,r.push(new Ft(h,m,g));}else r.push(new Ft(h));},i);let c=[];for(let f=n;f<s;f++)c.push(new Ft(o.maps[f]));let d=this.items.slice(0,i).append(c).append(r),u=new At(d,a);return u.emptyItemCount()>Lk&&(u=u.compress(this.items.length-r.length)),u}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,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let d=s.selection&&s.selection.map(n.slice(r));d&&o++;let u=new Ft(c.invert(),l,d),f,p=i.length-1;(f=i.length&&i[p].merge(u))?i[p]=f:i.push(u);}}else s.map&&r--;},this.items.length,0),new At(Kc.from(i.reverse()),o)}};At.empty=new At(Kc.empty,0);function Pk(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}var Ft=class{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 Ft(n.getMap().invert(),n,this.selection)}}},rn=class{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o;}},Bk=20;function zk(t,e,n,r){let i=n.getMeta(gr),o;if(i)return i.historyState;n.getMeta(Hk)&&(t=new rn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(gr))return s.getMeta(gr).redo?new rn(t.done.addTransform(n,void 0,r,Us(e)),t.undone,pm(n.mapping.maps),t.prevTime,t.prevComposition):new rn(t.done,t.undone.addTransform(n,void 0,r,Us(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Fk(n,t.prevRanges)),c=s?Vc(t.prevRanges,n.mapping):pm(n.mapping.maps);return new rn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Us(e)),At.empty,c,n.time,a??t.prevComposition)}else return (o=n.getMeta("rebased"))?new rn(t.done.rebased(n,o),t.undone.rebased(n,o),Vc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new rn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Vc(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Fk(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.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0);}),n}function pm(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 Vc(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o);}return n}function Uk(t,e,n){let r=Us(e),i=gr.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new rn(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(gr,{redo:n,historyState:l})}var Wc=!1,hm=null;function Us(t){let e=t.plugins;if(hm!=e){Wc=!1,hm=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Wc=!0;break}}return Wc}var gr=new re("history"),Hk=new re("closeHistory");function mm(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Z({key:gr,state:{init(){return new rn(At.empty,At.empty,null,0,-1)},apply(e,n,r){return zk(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Gc:r=="historyRedo"?qc:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Hs(t,e){return (n,r)=>{let i=gr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return !1;if(r){let o=Uk(i,n,t);o&&r(e?o.scrollIntoView():o);}return !0}}var Gc=Hs(!1,!0),qc=Hs(!0,!0);ne.create({name:"characterCount",addOptions(){return {limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return {characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{let e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){let r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{let e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)};},addProseMirrorPlugins(){let t=!1;return [new Z({key:new re("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;let i=this.options.limit;if(i==null||i===0){t=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let s=o-i,a=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let c=r.tr.deleteRange(a,l);return t=!0,c}t=!0;},filterTransaction:(e,n)=>{let r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return !0;let i=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return !0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return !1;let a=e.selection.$head.pos,l=o-r,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var bm=ne.create({name:"dropCursor",addOptions(){return {color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return [dm(this.options)]}});ne.create({name:"focus",addOptions(){return {className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return [new Z({key:new re("focus"),props:{decorations:({doc:t,selection:e})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!n||!r)return me.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return !1;s+=1;});let a=0;return t.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return !1;if(a+=1,this.options.mode==="deepest"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(Ce.node(c,c+l.nodeSize,{class:this.options.className}));}),me.create(t,o)}}})]}});var Zi=ne.create({name:"gapCursor",addProseMirrorPlugins(){return [um()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return {allowGapCursor:(e=Se(j(t,"allowGapCursor",n)))!=null?e:null}}}),jc=ne.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 Z({key:new re("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,a)=>{let l=r>=a&&r<=a+s.nodeSize,c=!s.isLeaf&&Li(s);if((l||!this.options.showOnlyCurrent)&&c){let d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);let u=Ce.node(a,a+s.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});i.push(u);}return this.options.includeChildren}),me.create(t,i)}}})]}});ne.create({name:"selection",addOptions(){return {className:"selection"}},addProseMirrorPlugins(){let{editor:t,options:e}=this;return [new Z({key:new re("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Zo(n.selection)||t.view.dragging?null:me.create(n.doc,[Ce.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function gm({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var ym=ne.create({name:"trailingNode",addOptions(){return {node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){let t=new re(this.name),e=Object.entries(this.editor.schema.nodes).map(([,n])=>n).filter(n=>(this.options.notAfter||[]).concat(this.options.node).includes(n.name));return [new Z({key:t,appendTransaction:(n,r,i)=>{let{doc:o,tr:s,schema:a}=i,l=t.getState(i),c=o.content.size,d=a.nodes[this.options.node];if(l)return s.insert(c,d.create())},state:{init:(n,r)=>{let i=r.tr.doc.lastChild;return !gm({node:i,types:e})},apply:(n,r)=>{if(!n.docChanged)return r;let i=n.doc.lastChild;return !gm({node:i,types:e})}}})]}}),Em=ne.create({name:"undoRedo",addOptions(){return {depth:100,newGroupDelay:500}},addCommands(){return {undo:()=>({state:t,dispatch:e})=>Gc(t,e),redo:()=>({state:t,dispatch:e})=>qc(t,e)}},addProseMirrorPlugins(){return [mm(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 $k=ne.create({name:"starterKit",addExtensions(){var t,e,n,r;let i=[];return this.options.bold!==!1&&i.push(Th.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Nh.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Pc.configure(this.options.bulletList)),this.options.code!==!1&&i.push(_h.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(cc.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Ah.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(bm.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Zi.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Oh.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Rh.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Em.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(Dh.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(Ih.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Bc.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Fc.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(Dc.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Uc.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(sm.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(am.configure(this.options.strike)),this.options.text!==!1&&i.push(lm.configure(this.options.text)),this.options.underline!==!1&&i.push(Hc.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(ym.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),vm=$k;var wm=jc;var Kk=ne.create({name:"textAlign",addOptions(){return {types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return [{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{let e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return {setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return {"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),xm=Kk;var Vk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Wk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Gk=nt.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",te(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 [Pt({find:Vk,type:this.type})]},addPasteRules(){return [St({find:Wk,type:this.type})]}}),Sm=Gk;var qk=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,jk=ge.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},width:{default:null},height:{default:null}}},parseHTML(){return [{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return ["img",te(this.options.HTMLAttributes,t)]},addCommands(){return {setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return [Qo({find:qk,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return {src:n,alt:e,title:r}}})]}}),Cm=jk;var Yc,Zc;if(typeof WeakMap<"u"){let t=new WeakMap;Yc=e=>t.get(e),Zc=(e,n)=>(t.set(e,n),n);}else {let t=[],n=0;Yc=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Zc=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i);}var Ue=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<this.map.length;e++){let n=this.map[e];if(n!=t)continue;let r=e%this.width,i=e/this.width|0,o=r+1,s=i+1;for(let a=1;o<this.width&&this.map[e+a]==n;a++)o++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return {left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){let{left:r,right:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){let{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:a,top:l,bottom:c}=this.findCell(e);return {left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(t){let e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){let o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s));}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){let o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width,a=(t+1)*this.width;for(;s<a&&this.map[s]<i;)s++;return s==a?o-1:this.map[s]}i=o;}}static get(t){return Yc(t)||Zc(t,Jk(t))}};function Jk(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);let e=Yk(t),n=t.childCount,r=[],i=0,o=null,s=[];for(let c=0,d=e*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){let u=t.child(c);d++;for(let h=0;;h++){for(;i<r.length&&r[i]!=0;)i++;if(h==u.childCount)break;let m=u.child(h),{colspan:g,rowspan:b,colwidth:v}=m.attrs;for(let S=0;S<b;S++){if(S+c>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:d,n:b-S});break}let T=i+S*e;for(let _=0;_<g;_++){r[T+_]==0?r[T+_]=d:(o||(o=[])).push({type:"collision",row:c,pos:d,n:g-_});let I=v&&v[_];if(I){let k=(T+_)%e*2,y=s[k];y==null||y!=I&&s[k+1]==1?(s[k]=I,s[k+1]=1):y==I&&s[k+1]++;}}}i+=g,d+=m.nodeSize;}let f=(c+1)*e,p=0;for(;i<f;)r[i++]==0&&p++;p&&(o||(o=[])).push({type:"missing",row:c,n:p}),d++;}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});let a=new Ue(e,n,r,o),l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(l=!0);return l&&Zk(a,s,t),a}function Yk(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){let i=t.child(r),o=0;if(n)for(let s=0;s<r;s++){let a=t.child(s);for(let l=0;l<a.childCount;l++){let c=a.child(l);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan);}}for(let s=0;s<i.childCount;s++){let a=i.child(s);o+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0);}e==-1?e=o:e!=o&&(e=Math.max(e,o));}return e}function Zk(t,e,n){t.problems||(t.problems=[]);let r={};for(let i=0;i<t.map.length;i++){let o=t.map[i];if(r[o])continue;r[o]=!0;let s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null,l=s.attrs;for(let c=0;c<l.colspan;c++){let d=(i+c)%t.width,u=e[d*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=Xk(l)))[c]=u);}a&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a});}}function Xk(t){if(t.colwidth)return t.colwidth.slice();let e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function ft(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(let n in t.nodes){let r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r);}}return e}var Kn=new re("selectingCells");function Zr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Qk(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 Vt(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 qs(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=Zr(e.$head)||eN(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function eN(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 Xc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function tN(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function td(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Im(t,e,n){let r=t.node(-1),i=Ue.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 br(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 Lm(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0);}return r}function nN(t,e,n){let r=ft(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return !1;return !0}var ke=class Tn extends q{constructor(e,n=e){let r=e.node(-1),i=Ue.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),a=e.node(0),l=i.cellsInRect(s).filter(d=>d!=n.pos-o);l.unshift(n.pos-o);let c=l.map(d=>{let u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);let f=o+d+1;return new Pr(a.resolve(f),a.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),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(Xc(r)&&Xc(i)&&td(r,i)){let o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Tn.rowSelection(r,i):o&&this.isColSelection()?Tn.colSelection(r,i):new Tn(r,i)}return H.between(r,i)}content(){let e=this.$anchorCell.node(-1),n=Ue.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l<i.bottom;l++){let c=[];for(let d=l*n.width+i.left,u=i.left;u<i.right;u++,d++){let f=n.map[d];if(o[f])continue;o[f]=!0;let p=n.findCell(f),h=e.nodeAt(f);if(!h)throw RangeError(`No cell with offset ${f} found`);let m=i.left-p.left,g=p.right-i.right;if(m>0||g>0){let b=h.attrs;if(m>0&&(b=br(b,0,m)),g>0&&(b=br(b,b.colspan-g,g)),p.left<i.left){if(h=h.type.createAndFill(b),!h)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else h=h.type.create(b,h.content);}if(p.top<i.top||p.bottom>i.bottom){let b={...h.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?h=h.type.createAndFill(b):h=h.type.create(b,h.content);}c.push(h);}s.push(e.child(l).copy(N.from(c)));}let a=this.isColSelection()&&this.isRowSelection()?e:s;return new B(N.from(a),1,1)}replace(e,n=B.empty){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),s?B.empty:n);}let o=q.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o);}replaceWith(e,n){this.replace(e,new B(N.from(n),0,0));}forEachCell(e){let n=this.$anchorCell.node(-1),r=Ue.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[s]);}isColSelection(){let e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)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=Ue.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(e=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Tn(e,n)}isRowSelection(){let e=this.$anchorCell.node(-1),n=Ue.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return !1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Tn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),i=Ue.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(e=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new Tn(e,n)}toJSON(){return {type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Tn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Tn(e.resolve(n),e.resolve(r))}getBookmark(){return new rN(this.$anchorCell.pos,this.$headCell.pos)}};ke.prototype.visible=!1;q.jsonID("cell",ke);var rN=class Pm{constructor(e,n){this.anchor=e,this.head=n;}map(e){return new Pm(e.map(this.anchor),e.map(this.head))}resolve(e){let n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&td(n,r)?new ke(n,r):q.near(r,1)}};function iN(t){if(!(t.selection instanceof ke))return null;let e=[];return t.selection.forEachCell((n,r)=>{e.push(Ce.node(r,r+n.nodeSize,{class:"selectedCell"}));}),me.create(t.doc,e)}function oN({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return !1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function sN({$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 aN(t,e,n){let r=(e||t).selection,i=(e||t).doc,o,s;if(r instanceof W&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=ke.create(i,r.from);else if(s=="row"){let a=i.resolve(r.from+1);o=ke.rowSelection(a,a);}else if(!n){let a=Ue.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];o=ke.create(i,l+1,c);}}else r instanceof H&&oN(r)?o=H.create(i,r.from):r instanceof H&&sN(r)&&(o=H.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var lN=new re("fix-tables");function Bm(t,e,n,r){let i=t.childCount,o=e.childCount;e:for(let s=0,a=0;s<o;s++){let l=e.child(s);for(let c=a,d=Math.min(i,s+3);c<d;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?Bm(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize;}}function nd(t,e){let n,r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=cN(t,i,o,n));};return e?e.doc!=t.doc&&Bm(e.doc,t.doc,0,r):t.doc.descendants(r),n}function cN(t,e,n,r){let i=Ue.get(e);if(!i.problems)return r;r||(r=t.tr);let o=[];for(let l=0;l<i.height;l++)o.push(0);for(let l=0;l<i.problems.length;l++){let c=i.problems[l];if(c.type=="collision"){let d=e.nodeAt(c.pos);if(!d)continue;let u=d.attrs;for(let f=0;f<u.rowspan;f++)o[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,br(u,u.colspan-c.n,c.n));}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n});}else if(c.type=="colwidth mismatch"){let d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth});}else if(c.type=="zero_sized"){let d=r.mapping.map(n);r.delete(d,d+e.nodeSize);}}let s,a;for(let l=0;l<o.length;l++)o[l]&&(s==null&&(s=l),a=l);for(let l=0,c=n+1;l<i.height;l++){let d=e.child(l),u=c+d.nodeSize,f=o[l];if(f>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);let h=[];for(let g=0;g<f;g++){let b=ft(t.schema)[p].createAndFill();b&&h.push(b);}let m=(l==0||s==l-1)&&a==l?c+1:u-1;r.insert(r.mapping.map(m),h);}c=u;}return r.setMeta(lN,{fixTables:!0})}function on(t){let e=t.selection,n=qs(t),r=n.node(-1),i=n.start(-1),o=Ue.get(r);return {...e instanceof ke?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function zm(t,{map:e,tableStart:n,table:r},i){let o=i>0?-1:0;nN(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){let a=s*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){let l=e.map[a],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,Lm(c.attrs,i-e.colCount(l))),s+=c.attrs.rowspan-1;}else {let l=o==null?ft(r.type.schema).cell:r.nodeAt(e.map[a+o]).type,c=e.positionAt(s,i,r);t.insert(t.mapping.map(n+c),l.createAndFill());}}return t}function Fm(t,e){if(!Vt(t))return !1;if(e){let n=on(t);e(zm(t.tr,n,n.left));}return !0}function Um(t,e){if(!Vt(t))return !1;if(e){let n=on(t);e(zm(t.tr,n,n.right));}return !0}function dN(t,{map:e,table:n,tableStart:r},i){let o=t.mapping.maps.length;for(let s=0;s<e.height;){let a=s*e.width+i,l=e.map[a],c=n.nodeAt(l),d=c.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(o).map(r+l),null,br(d,i-e.colCount(l)));else {let u=t.mapping.slice(o).map(r+l);t.delete(u,u+c.nodeSize);}s+=d.rowspan;}}function Hm(t,e){if(!Vt(t))return !1;if(e){let n=on(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return !1;for(let i=n.right-1;dN(r,n,i),i!=n.left;i--){let o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw RangeError("No table found");n.table=o,n.map=Ue.get(o);}e(r);}return !0}function uN(t,e,n){var r;let i=ft(e.type.schema).header_cell;for(let o=0;o<t.width;o++)if(((r=e.nodeAt(t.map[o+n*t.width]))==null?void 0:r.type)!=i)return !1;return !0}function $m(t,{map:e,tableStart:n,table:r},i){var o;let s=n;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;let a=[],l=i>0?-1:0;uN(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let c=0,d=e.width*i;c<e.width;c++,d++)if(i>0&&i<e.height&&e.map[d]==e.map[d-e.width]){let u=e.map[d],f=r.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1;}else {let u=l==null?ft(r.type.schema).cell:(o=r.nodeAt(e.map[d+l*e.width]))==null?void 0:o.type,f=u?.createAndFill();f&&a.push(f);}return t.insert(s,ft(r.type.schema).row.create(null,a)),t}function Km(t,e){if(!Vt(t))return !1;if(e){let n=on(t);e($m(t.tr,n,n.top));}return !0}function Vm(t,e){if(!Vt(t))return !1;if(e){let n=on(t);e($m(t.tr,n,n.bottom));}return !0}function fN(t,{map:e,table:n,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=n.child(c).nodeSize;let s=o+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(o+r,s+r);let l=new Set;for(let c=0,d=i*e.width;c<e.width;c++,d++){let u=e.map[d];if(!l.has(u)){if(l.add(u),i>0&&u==e.map[d-e.width]){let f=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(a).map(u+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1;}else if(i<e.height&&u==e.map[d+e.width]){let f=n.nodeAt(u),p=f.attrs,h=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(a).map(r+m),h),c+=p.colspan-1;}}}}function Wm(t,e){if(!Vt(t))return !1;if(e){let n=on(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return !1;for(let i=n.bottom-1;fN(r,n,i),i!=n.top;i--){let o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw RangeError("No table found");n.table=o,n.map=Ue.get(n.table);}e(r);}return !0}function km(t){let e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function pN({width:t,height:e,map:n},r){let i=r.top*t+r.left,o=i,s=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[o]==n[o-1]||r.right<t&&n[a]==n[a+1])return !0;o+=t,a+=t;}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[s]==n[s+t])return !0;i++,s++;}return !1}function rd(t,e){let n=t.selection;if(!(n instanceof ke)||n.$anchorCell.pos==n.$headCell.pos)return !1;let r=on(t),{map:i}=r;if(pN(i,r))return !1;if(e){let o=t.tr,s={},a=N.empty,l,c;for(let d=r.top;d<r.bottom;d++)for(let u=r.left;u<r.right;u++){let f=i.map[d*i.width+u],p=r.table.nodeAt(f);if(!(s[f]||!p))if(s[f]=!0,l==null)l=f,c=p;else {km(p)||(a=a.append(p.content));let h=o.mapping.map(f+r.tableStart);o.delete(h,h+p.nodeSize);}}if(l==null||c==null)return !0;if(o.setNodeMarkup(l+r.tableStart,null,{...Lm(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size){let d=l+1+c.content.size,u=km(c)?l+1:d;o.replaceWith(u+r.tableStart,d+r.tableStart,a);}o.setSelection(new ke(o.doc.resolve(l+r.tableStart))),e(o);}return !0}function id(t,e){let n=ft(t.schema);return hN(({node:r})=>n[r.type.spec.tableRole])(t,e)}function hN(t){return (e,n)=>{var r;let i=e.selection,o,s;if(i instanceof ke){if(i.$anchorCell.pos!=i.$headCell.pos)return !1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos;}else {if(o=Qk(i.$from),!o)return !1;s=(r=Zr(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 a=o.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=on(e),u=e.tr;for(let p=0;p<d.right-d.left;p++)l.push(c?{...a,colwidth:c&&c[p]?[c[p]]:null}:a);let f;for(let p=d.top;p<d.bottom;p++){let h=d.map.positionAt(p,d.left,d.table);p==d.top&&(h+=o.nodeSize);for(let m=d.left,g=0;m<d.right;m++,g++)m==d.left&&p==d.top||u.insert(f=u.mapping.map(h+d.tableStart,1),t({node:o,row:p,col:m}).createAndFill(l[g]));}u.setNodeMarkup(s,t({node:o,row:d.top,col:d.left}),l[0]),i instanceof ke&&u.setSelection(new ke(u.doc.resolve(i.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u);}return !0}}function Gm(t,e){return function(n,r){if(!Vt(n))return !1;let i=qs(n);if(i.nodeAfter.attrs[t]===e)return !1;if(r){let o=n.tr;n.selection instanceof ke?n.selection.forEachCell((s,a)=>{s.attrs[t]!==e&&o.setNodeMarkup(a,null,{...s.attrs,[t]:e});}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o);}return !0}}function mN(t){return function(e,n){if(!Vt(e))return !1;if(n){let r=ft(e.schema),i=on(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),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[l],r.cell,a[l].attrs);if(o.steps.length==0)for(let l=0;l<s.length;l++)o.setNodeMarkup(i.tableStart+s[l],r.header_cell,a[l].attrs);n(o);}return !0}}function Nm(t,e,n){let r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){let o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return !1}return !0}function Xr(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?mN(t):function(n,r){if(!Vt(n))return !1;if(r){let i=ft(n.schema),o=on(n),s=n.tr,a=Nm("row",o,i),l=Nm("column",o,i),d=(t==="column"?a:t==="row"?l:!1)?1:0,u=t=="column"?{left:0,top:d,right:1,bottom:o.map.height}:t=="row"?{left:d,top:0,right:o.map.width,bottom:1}:o,f=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(p=>{let h=p+o.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs);}),r(s);}return !0}}Xr("row",{useDeprecatedLogic:!0});Xr("column",{useDeprecatedLogic:!0});var qm=Xr("cell",{useDeprecatedLogic:!0});function gN(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()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;let n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){let o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize;}}return null}function od(t){return function(e,n){if(!Vt(e))return !1;let r=gN(qs(e),t);if(r==null)return !1;if(n){let i=e.doc.resolve(r);n(e.tr.setSelection(H.between(i,tN(i))).scrollIntoView());}return !0}}function jm(t,e){let n=t.selection.$anchor;for(let r=n.depth;r>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 $s(t,e){let n=t.selection;if(!(n instanceof ke))return !1;if(e){let r=t.tr,i=ft(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 B(i,0,0));}),r.docChanged&&e(r);}return !0}function bN(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,a=[];if(o=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content,d=l?0:Math.max(0,n-1),u=l<e.childCount-1?0:Math.max(0,r-1);(d||u)&&(c=Qc(ft(s).row,new B(c,d,u)).content),a.push(c);}else if(o=="cell"||o=="header_cell")a.push(n||r?Qc(ft(s).row,new B(e,n,r)).content:e);else return null;return yN(s,a)}function yN(t,e){let n=[];for(let i=0;i<e.length;i++){let o=e[i];for(let s=o.childCount-1;s>=0;s--){let{rowspan:a,colspan:l}=o.child(s).attrs;for(let c=i;c<i+a;c++)n[c]=(n[c]||0)+l;}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(N.empty),n[i]<r){let o=ft(t).cell.createAndFill(),s=[];for(let a=n[i];a<r;a++)s.push(o);e[i]=e[i].append(N.from(s));}return {height:e.length,width:r,rows:e}}function Qc(t,e){let n=t.createAndFill();return new Dn(n).replace(0,n.content.size,e).doc}function EN({width:t,height:e,rows:n},r,i){if(t!=r){let o=[],s=[];for(let a=0;a<n.length;a++){let l=n[a],c=[];for(let d=o[a]||0,u=0;d<r;u++){let f=l.child(u%l.childCount);d+f.attrs.colspan>r&&(f=f.type.createChecked(br(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),c.push(f),d+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)o[a+p]=(o[a+p]||0)+f.attrs.colspan;}s.push(N.from(c));}n=s,t=r;}if(e!=i){let o=[];for(let s=0,a=0;s<i;s++,a++){let l=[],c=n[a%e];for(let d=0;d<c.childCount;d++){let u=c.child(d);s+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),l.push(u);}o.push(N.from(l));}n=o,e=i;}return {width:t,height:e,rows:n}}function vN(t,e,n,r,i,o,s){let a=t.doc.type.schema,l=ft(a),c,d;if(i>e.width)for(let u=0,f=0;u<e.height;u++){let p=n.child(u);f+=p.nodeSize;let h=[],m;p.lastChild==null||p.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=d||(d=l.header_cell.createAndFill());for(let g=e.width;g<i;g++)h.push(m);t.insert(t.mapping.slice(s).map(f-1+r),h);}if(o>e.height){let u=[];for(let h=0,m=(e.height-1)*e.width;h<Math.max(e.width,i);h++){let g=h>=e.width?!1:n.nodeAt(e.map[m+h]).type==l.header_cell;u.push(g?d||(d=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()));}let f=l.row.create(null,N.from(u)),p=[];for(let h=e.height;h<o;h++)p.push(f);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),p);}return !!(c||d)}function Tm(t,e,n,r,i,o,s,a){if(s==0||s==e.height)return !1;let l=!1;for(let c=i;c<o;c++){let d=s*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){l=!0;let f=n.nodeAt(u),{top:p,left:h}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(a).map(u+r),null,{...f.attrs,rowspan:s-p}),t.insert(t.mapping.slice(a).map(e.positionAt(s,h,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-s})),c+=f.attrs.colspan-1;}}return l}function _m(t,e,n,r,i,o,s,a){if(s==0||s==e.width)return !1;let l=!1;for(let c=i;c<o;c++){let d=c*e.width+s,u=e.map[d];if(e.map[d-1]==u){l=!0;let f=n.nodeAt(u),p=e.colCount(u),h=t.mapping.slice(a).map(u+r);t.setNodeMarkup(h,null,br(f.attrs,s-p,f.attrs.colspan-(s-p))),t.insert(h+f.nodeSize,f.type.createAndFill(br(f.attrs,0,s-p))),c+=f.attrs.rowspan-1;}}return l}function Mm(t,e,n,r,i){let o=n?t.doc.nodeAt(n-1):t.doc;if(!o)throw new Error("No table found");let s=Ue.get(o),{top:a,left:l}=r,c=l+i.width,d=a+i.height,u=t.tr,f=0;function p(){if(o=n?u.doc.nodeAt(n-1):u.doc,!o)throw new Error("No table found");s=Ue.get(o),f=u.mapping.maps.length;}vN(u,s,o,n,c,d,f)&&p(),Tm(u,s,o,n,l,c,a,f)&&p(),Tm(u,s,o,n,l,c,d,f)&&p(),_m(u,s,o,n,a,d,l,f)&&p(),_m(u,s,o,n,a,d,c,f)&&p();for(let h=a;h<d;h++){let m=s.positionAt(h,l,o),g=s.positionAt(h,c,o);u.replace(u.mapping.slice(f).map(m+n),u.mapping.slice(f).map(g+n),new B(i.rows[h-a],0,0));}p(),u.setSelection(new ke(u.doc.resolve(n+s.positionAt(a,l,o)),u.doc.resolve(n+s.positionAt(d-1,c-1,o)))),e(u);}var wN=Ri({ArrowLeft:Ks("horiz",-1),ArrowRight:Ks("horiz",1),ArrowUp:Ks("vert",-1),ArrowDown:Ks("vert",1),"Shift-ArrowLeft":Vs("horiz",-1),"Shift-ArrowRight":Vs("horiz",1),"Shift-ArrowUp":Vs("vert",-1),"Shift-ArrowDown":Vs("vert",1),Backspace:$s,"Mod-Backspace":$s,Delete:$s,"Mod-Delete":$s});function Ws(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Ks(t,e){return (n,r,i)=>{if(!i)return !1;let o=n.selection;if(o instanceof ke)return Ws(n,r,q.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return !1;let s=Jm(i,t,e);if(s==null)return !1;if(t=="horiz")return Ws(n,r,q.near(n.doc.resolve(o.head+e),e));{let a=n.doc.resolve(s),l=Im(a,t,e),c;return l?c=q.near(l,1):e<0?c=q.near(n.doc.resolve(a.before(-1)),-1):c=q.near(n.doc.resolve(a.after(-1)),1),Ws(n,r,c)}}}function Vs(t,e){return (n,r,i)=>{if(!i)return !1;let o=n.selection,s;if(o instanceof ke)s=o;else {let l=Jm(i,t,e);if(l==null)return !1;s=new ke(n.doc.resolve(l));}let a=Im(s.$headCell,t,e);return a?Ws(n,r,new ke(s.$anchorCell,a)):!1}}function xN(t,e){let n=t.state.doc,r=Zr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new ke(r))),!0):!1}function SN(t,e,n){if(!Vt(t.state))return !1;let r=bN(n),i=t.state.selection;if(i instanceof ke){r||(r={width:1,height:1,rows:[N.from(Qc(ft(t.state.schema).cell,n))]});let o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=Ue.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=EN(r,a.right-a.left,a.bottom-a.top),Mm(t.state,t.dispatch,s,a,r),!0}else if(r){let o=qs(t.state),s=o.start(-1);return Mm(t.state,t.dispatch,s,Ue.get(o.node(-1)).findCell(o.pos-s),r),!0}else return !1}function CN(t,e){var n;if(e.ctrlKey||e.metaKey)return;let r=Am(t,e.target),i;if(e.shiftKey&&t.state.selection instanceof ke)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Zr(t.state.selection.$anchor))!=null&&((n=Jc(t,e))==null?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(l,c){let d=Jc(t,c),u=Kn.getState(t.state)==null;if(!d||!td(l,d))if(u)d=l;else return;let f=new ke(l,d);if(u||!t.state.selection.eq(f)){let p=t.state.tr.setSelection(f);u&&p.setMeta(Kn,l.pos),t.dispatch(p);}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),Kn.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Kn,-1));}function a(l){let c=l,d=Kn.getState(t.state),u;if(d!=null)u=t.state.doc.resolve(d);else if(Am(t,c.target)!=r&&(u=Jc(t,e),!u))return s();u&&o(u,c);}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a);}function Jm(t,e,n){if(!(t.state.selection instanceof H))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 a=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}function Am(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Jc(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Zr(t.state.doc.resolve(n.pos)):null}var kN=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")),ed(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,ed(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function ed(t,e,n,r,i,o){var s;let a=0,l=!0,c=e.firstChild,d=t.firstChild;if(d){for(let u=0,f=0;u<d.childCount;u++){let{colspan:p,colwidth:h}=d.child(u).attrs;for(let m=0;m<p;m++,f++){let g=i==f?o:h&&h[m],b=g?g+"px":"";if(a+=g||r,g||(l=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else {let v=document.createElement("col");v.style.width=b,e.appendChild(v);}}}for(;c;){let u=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=u;}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px");}}var Ot=new re("tableColumnResizing");function Ym({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=kN,lastColumnResizable:i=!0}={}){let o=new Z({key:Ot,state:{init(s,a){var l,c;let d=(c=(l=o.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,u=ft(a.schema).table.name;return r&&d&&(d[u]=(f,p)=>new r(f,n,p)),new NN(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{let a=Ot.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{TN(s,a,t,i);},mouseleave:s=>{_N(s);},mousedown:(s,a)=>{MN(s,a,e,n);}},decorations:s=>{let a=Ot.getState(s);if(a&&a.activeHandle>-1)return IN(s,a.activeHandle)},nodeViews:{}}});return o}var NN=class Gs{constructor(e,n){this.activeHandle=e,this.dragging=n;}apply(e){let n=this,r=e.getMeta(Ot);if(r&&r.setHandle!=null)return new Gs(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Gs(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Xc(e.doc.resolve(i))||(i=-1),new Gs(i,n.dragging)}return n}};function TN(t,e,n,r){if(!t.editable)return;let i=Ot.getState(t.state);if(i&&!i.dragging){let o=ON(e.target),s=-1;if(o){let{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=Om(t,e,"left",n):l-e.clientX<=n&&(s=Om(t,e,"right",n));}if(s!=i.activeHandle){if(!r&&s!==-1){let a=t.state.doc.resolve(s),l=a.node(-1),c=Ue.get(l),d=a.start(-1);if(c.colCount(a.pos-d)+a.nodeAfter.attrs.colspan-1==c.width-1)return}Zm(t,s);}}}function _N(t){if(!t.editable)return;let e=Ot.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Zm(t,-1);}function MN(t,e,n,r){var i;if(!t.editable)return !1;let o=(i=t.dom.ownerDocument.defaultView)!=null?i:window,s=Ot.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return !1;let a=t.state.doc.nodeAt(s.activeHandle),l=AN(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Ot,{setDragging:{startX:e.clientX,startWidth:l}}));function c(u){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",d);let f=Ot.getState(t.state);f?.dragging&&(RN(t,f.activeHandle,Rm(f.dragging,u,n)),t.dispatch(t.state.tr.setMeta(Ot,{setDragging:null})));}function d(u){if(!u.which)return c(u);let f=Ot.getState(t.state);if(f&&f.dragging){let p=Rm(f.dragging,u,n);Dm(t,f.activeHandle,p,r);}}return Dm(t,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",d),e.preventDefault(),!0}function AN(t,e,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=t.domAtPos(e),a=o.node.childNodes[o.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],l--);return a/l}function ON(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Om(t,e,n,r){let i=n=="right"?-r:r,o=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return -1;let{pos:s}=o,a=Zr(t.state.doc.resolve(s));if(!a)return -1;if(n=="right")return a.pos;let l=Ue.get(a.node(-1)),c=a.start(-1),d=l.map.indexOf(a.pos-c);return d%l.width==0?-1:c+l.map[d-1]}function Rm(t,e,n){let r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Zm(t,e){t.dispatch(t.state.tr.setMeta(Ot,{setHandle:e}));}function RN(t,e,n){let r=t.state.doc.resolve(e),i=r.node(-1),o=Ue.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<o.height;c++){let d=c*o.width+a;if(c&&o.map[d]==o.map[d-o.width])continue;let u=o.map[d],f=i.nodeAt(u).attrs,p=f.colspan==1?0:a-o.colCount(u);if(f.colwidth&&f.colwidth[p]==n)continue;let h=f.colwidth?f.colwidth.slice():DN(f.colspan);h[p]=n,l.setNodeMarkup(s+u,null,{...f,colwidth:h});}l.docChanged&&t.dispatch(l);}function Dm(t,e,n,r){let i=t.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),a=Ue.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&ed(o,l.firstChild,l,r,a,n);}function DN(t){return Array(t).fill(0)}function IN(t,e){var n;let r=[],i=t.doc.resolve(e),o=i.node(-1);if(!o)return me.empty;let s=Ue.get(o),a=i.start(-1),l=s.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){let d=l+c*s.width;if((l==s.width-1||s.map[d]!=s.map[d+1])&&(c==0||s.map[d]!=s.map[d-s.width])){let u=s.map[d],f=a+u+o.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=Ot.getState(t))!=null&&n.dragging&&r.push(Ce.node(a+u,a+u+o.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),r.push(Ce.widget(f,p));}}return me.create(t.doc,r)}function Xm({allowTableNodeSelection:t=!1}={}){return new Z({key:Kn,state:{init(){return null},apply(e,n){let r=e.getMeta(Kn);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;let{deleted:i,pos:o}=e.mapping.mapResult(n);return i?null:o}},props:{decorations:iN,handleDOMEvents:{mousedown:CN},createSelectionBetween(e){return Kn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:xN,handleKeyDown:wN,handlePaste:SN},appendTransaction(e,n,r){return aN(r,nd(r,n),t)}})}var Js=ge.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",te(this.options.HTMLAttributes,t),0]}}),Ys=ge.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",te(this.options.HTMLAttributes,t),0]}}),Zs=ge.create({name:"tableRow",addOptions(){return {HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return [{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return ["tr",te(this.options.HTMLAttributes,t),0]}});function sd(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Qm(t,e,n,r,i,o){var s;let a=0,l=!0,c=e.firstChild,d=t.firstChild;if(d!==null)for(let u=0,f=0;u<d.childCount;u+=1){let{colspan:p,colwidth:h}=d.child(u).attrs;for(let m=0;m<p;m+=1,f+=1){let g=i===f?o:h&&h[m],b=g?`${g}px`:"";if(a+=g||r,g||(l=!1),c){if(c.style.width!==b){let[v,S]=sd(r,g);c.style.setProperty(v,S);}c=c.nextSibling;}else {let v=document.createElement("col"),[S,T]=sd(r,g);v.style.setProperty(S,T),e.appendChild(v);}}}for(;c;){let u=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=u;}l?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`);}var LN=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qm(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,Qm(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}};function PN(t,e,n,r){let i=0,o=!0,s=[],a=t.firstChild;if(!a)return {};for(let u=0,f=0;u<a.childCount;u+=1){let{colspan:p,colwidth:h}=a.child(u).attrs;for(let m=0;m<p;m+=1,f+=1){let g=n===f?r:h&&h[m];i+=g||e,g||(o=!1);let[b,v]=sd(e,g);s.push(["col",{style:`${b}: ${v}`}]);}}let l=o?`${i}px`:"",c=o?"":`${i}px`;return {colgroup:["colgroup",{},...s],tableWidth:l,tableMinWidth:c}}function eg(t,e){return e?t.createChecked(null,e):t.createAndFill()}function BN(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r);}),t.cached.tableNodeTypes=e,e}function zN(t,e,n,r,i){let o=BN(t),s=[],a=[];for(let c=0;c<n;c+=1){let d=eg(o.cell,i);if(d&&a.push(d),r){let u=eg(o.header_cell,i);u&&s.push(u);}}let l=[];for(let c=0;c<e;c+=1)l.push(o.row.createChecked(null,r&&c===0?s:a));return o.table.createChecked(null,l)}function FN(t){return t instanceof ke}var js=({editor:t})=>{let{selection:e}=t.state;if(!FN(e))return !1;let n=0,r=Yl(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},ad=ge.create({name:"table",addOptions(){return {HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:LN,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}=PN(t,this.options.cellMinWidth);return ["table",te(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=zN(o.schema,t,e,n);if(i){let a=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(H.near(r.doc.resolve(a)));}return !0},addColumnBefore:()=>({state:t,dispatch:e})=>Fm(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Um(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Hm(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Km(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Vm(t,e),deleteRow:()=>({state:t,dispatch:e})=>Wm(t,e),deleteTable:()=>({state:t,dispatch:e})=>jm(t,e),mergeCells:()=>({state:t,dispatch:e})=>rd(t,e),splitCell:()=>({state:t,dispatch:e})=>id(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Xr("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Xr("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>qm(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>rd(t,e)?!0:id(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Gm(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>od(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>od(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&nd(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=ke.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:js,"Mod-Backspace":js,Delete:js,"Mod-Delete":js}},addProseMirrorPlugins(){return [...this.options.resizable&&this.editor.isEditable?[Ym({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Xm({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return {tableRole:Se(j(t,"tableRole",e))}}});ne.create({name:"tableKit",addExtensions(){let t=[];return this.options.table!==!1&&t.push(ad.configure(this.options.table)),this.options.tableCell!==!1&&t.push(Js.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Ys.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(Zs.configure(this.options.tableRow)),t}});var tg=Zs;var ng=Js;var rg=Ys;var UN=t=>{if(!t.children.length)return;let e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,i;let o=n.getAttribute("style"),s=(i=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");n.setAttribute("style",`${s};${o}`);});},ld=nt.create({name:"textStyle",priority:101,addOptions(){return {HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return [{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&UN(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return ["span",te(this.options.HTMLAttributes,t),0]},addCommands(){return {toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{let{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return !0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(r,r+n.nodeSize,this.type);}),!0}}}}),HN=ne.create({name:"backgroundColor",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;return (e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return {setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),cd=ne.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?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()}}}),$N=ne.create({name:"fontFamily",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return {setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),KN=ne.create({name:"fontSize",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return {setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),VN=ne.create({name:"lineHeight",addOptions(){return {types:["textStyle"]}},addGlobalAttributes(){return [{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return {setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ne.create({name:"textStyleKit",addExtensions(){let t=[];return this.options.backgroundColor!==!1&&t.push(HN.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(cd.configure(this.options.color)),this.options.fontFamily!==!1&&t.push($N.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(KN.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(VN.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(ld.configure(this.options.textStyle)),t}});var ig=cd;var og=Zi;var sg=Bs;var ag=Ps;var WN=t=>Ie({find:/--$/,replace:t??"\u2014"}),GN=t=>Ie({find:/\.\.\.$/,replace:t??"\u2026"}),qN=t=>Ie({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"\u201C"}),jN=t=>Ie({find:/"$/,replace:t??"\u201D"}),JN=t=>Ie({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"\u2018"}),YN=t=>Ie({find:/'$/,replace:t??"\u2019"}),ZN=t=>Ie({find:/<-$/,replace:t??"\u2190"}),XN=t=>Ie({find:/->$/,replace:t??"\u2192"}),QN=t=>Ie({find:/\(c\)$/,replace:t??"\xA9"}),eT=t=>Ie({find:/\(tm\)$/,replace:t??"\u2122"}),tT=t=>Ie({find:/\(sm\)$/,replace:t??"\u2120"}),nT=t=>Ie({find:/\(r\)$/,replace:t??"\xAE"}),rT=t=>Ie({find:/(?:^|\s)(1\/2)\s$/,replace:t??"\xBD"}),iT=t=>Ie({find:/\+\/-$/,replace:t??"\xB1"}),oT=t=>Ie({find:/!=$/,replace:t??"\u2260"}),sT=t=>Ie({find:/<<$/,replace:t??"\xAB"}),aT=t=>Ie({find:/>>$/,replace:t??"\xBB"}),lT=t=>Ie({find:/\d+\s?([*x])\s?\d+$/,replace:t??"\xD7"}),cT=t=>Ie({find:/\^2$/,replace:t??"\xB2"}),dT=t=>Ie({find:/\^3$/,replace:t??"\xB3"}),uT=t=>Ie({find:/(?:^|\s)(1\/4)\s$/,replace:t??"\xBC"}),fT=t=>Ie({find:/(?:^|\s)(3\/4)\s$/,replace:t??"\xBE"}),pT=ne.create({name:"typography",addOptions(){return {closeDoubleQuote:"\u201D",closeSingleQuote:"\u2019",copyright:"\xA9",ellipsis:"\u2026",emDash:"\u2014",laquo:"\xAB",leftArrow:"\u2190",multiplication:"\xD7",notEqual:"\u2260",oneHalf:"\xBD",oneQuarter:"\xBC",openDoubleQuote:"\u201C",openSingleQuote:"\u2018",plusMinus:"\xB1",raquo:"\xBB",registeredTrademark:"\xAE",rightArrow:"\u2192",servicemark:"\u2120",superscriptThree:"\xB3",superscriptTwo:"\xB2",threeQuarters:"\xBE",trademark:"\u2122"}},addInputRules(){let t=[];return this.options.emDash!==!1&&t.push(WN(this.options.emDash)),this.options.ellipsis!==!1&&t.push(GN(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(qN(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(jN(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(JN(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(YN(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(ZN(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(XN(this.options.rightArrow)),this.options.copyright!==!1&&t.push(QN(this.options.copyright)),this.options.trademark!==!1&&t.push(eT(this.options.trademark)),this.options.servicemark!==!1&&t.push(tT(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(nT(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(rT(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(iT(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(oT(this.options.notEqual)),this.options.laquo!==!1&&t.push(sT(this.options.laquo)),this.options.raquo!==!1&&t.push(aT(this.options.raquo)),this.options.multiplication!==!1&&t.push(lT(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(cT(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(dT(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(uT(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(fT(this.options.threeQuarters)),t}}),lg=pT;var Mg=ai(_g(),1);var na=Mg.default;function Rg(t,e=[]){return t.map(n=>{let r=[...e,...n.properties?n.properties.className:[]];return n.children?Rg(n.children,r):{text:n.value,classes:r}}).flat()}function Ag(t){return t.value||t.children||[]}function r_(t){return !!na.getLanguage(t)}function Og({doc:t,name:e,lowlight:n,defaultLanguage:r}){let i=[];return qo(t,o=>o.type.name===e).forEach(o=>{var s;let a=o.pos+1,l=o.node.attrs.language||r,c=n.listLanguages(),d=l&&(c.includes(l)||r_(l)||(s=n.registered)!=null&&s.call(n,l))?Ag(n.highlight(l,o.node.textContent)):Ag(n.highlightAuto(o.node.textContent));Rg(d).forEach(u=>{let f=a+u.text.length;if(u.classes.length){let p=Ce.inline(a,f,{class:u.classes.join(" ")});i.push(p);}a=f;});}),me.create(t,i)}function i_(t){return typeof t=="function"}function o_({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(i=>i_(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new Z({key:new re("lowlight"),state:{init:(i,{doc:o})=>Og({doc:o,name:t,lowlight:e,defaultLanguage:n}),apply:(i,o,s,a)=>{let l=s.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,d=qo(s.doc,f=>f.type.name===t),u=qo(a.doc,f=>f.type.name===t);return i.docChanged&&([l,c].includes(t)||u.length!==d.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)))?Og({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 s_=Mh.extend({addOptions(){var t;return {...(t=this.parent)==null?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return [...((t=this.parent)==null?void 0:t.call(this))||[],o_({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),Dg=s_;function a_(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="<[^<>]+>",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(o)+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={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(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",h=["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"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","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"],b=["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:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},_={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},I=[_,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:I.concat([{begin:/\(/,end:/\)/,keywords:T,contains:I.concat(["self"]),relevance:0}]),relevance:0},y={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return {name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(k,y,_,I,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:T,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Ig(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=a_(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 Lg(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=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(a);let l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=t.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),h={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],b={match:/(\/[a-z._-]+)+/},v=["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","sudo","type","typeset","ulimit","unalias"],T=["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"],_=["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","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:g,built_in:[...v,...S,"set","shopt",...T,..._]},contains:[p,t.SHEBANG(),h,u,o,s,b,a,l,c,d,n]}}function Pg(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="<[^<>]+>",s="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(o)+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","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","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","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"},b=[u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,contains:b.concat(["self"]),relevance:0}]),relevance:0},S={begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:p,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return {name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"</",contains:[].concat(v,S,b,[u,{begin:t.IDENT_RE+"::",keywords:g},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:u,strings:c,keywords:g}}}function Bg(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="<[^<>]+>",s="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(o)+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={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(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},p=e.optional(i)+t.IDENT_RE+"\\s*\\(",h=["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"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","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"],b=["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:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},_={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},I=[_,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:T,contains:I.concat([{begin:/\(/,end:/\)/,keywords:T,contains:I.concat(["self"]),relevance:0}]),relevance:0},y={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:T,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:T,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:T,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,u]};return {name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:T,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(k,y,_,I,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:T,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:T},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function zg(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","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],s={keyword:i.concat(o),built_in:e,literal:r},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={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},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=t.inherit(d,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:s},p=t.inherit(f,{illegal:/\n/}),h={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,p]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},g=t.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});f.contains=[m,h,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],p.contains=[g,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let b={variants:[c,m,h,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},v={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},S=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",T={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:"</?",end:">"}]}]}),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"}},b,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,v,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,v,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:"("+S+"\\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,v],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[b,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},T]}}var l_=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_-]*/}}),c_=["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","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],d_=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],u_=[...c_,...d_],f_=["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"].sort().reverse(),p_=["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"].sort().reverse(),h_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),m_=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","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-end-end-radius","border-end-start-radius","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-start-end-radius","border-start-start-radius","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-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","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","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","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","margin-trim","marker","marker-end","marker-mid","marker-start","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","masonry-auto-flow","math-depth","math-shift","math-style","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","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-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","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","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","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Fg(t){let e=t.regex,n=l_(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_-]*",a=[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:":("+p_.join("|")+")"},{begin:":(:)?("+h_.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+m_.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{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:f_.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+u_.join("|")+")\\b"}]}}function Ug(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 Hg(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:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:o,illegal:/["']/}]}]}}function $g(t){let e=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return {name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(n,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function Kg(t){let e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},o={className:"literal",begin:/\bon|off|true|false|yes|no\b/},s={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,o,i,s,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,d=/'[^']*'/,u=e.either(l,c,d),f=e.concat(u,"(\\s*\\.\\s*",u,")*",e.lookahead(/\s*=\s*[^#\s]/));return {name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[r,a,o,i,s,n]}}]}}var ti="[0-9](_*[0-9])*",ra=`\\.(${ti})`,ia="[0-9a-fA-F](_*[0-9a-fA-F])*",Vg={className:"number",variants:[{begin:`(\\b(${ti})((${ra})|\\.)?|(${ra}))[eE][+-]?(${ti})[fFdD]?\\b`},{begin:`\\b(${ti})((${ra})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${ra})[fFdD]?\\b`},{begin:`\\b(${ti})[fFdD]\\b`},{begin:`\\b0[xX]((${ia})\\.?|(${ia})?\\.(${ia}))[pP][+-]?(${ti})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ia})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Wg(t,e,n){return n===-1?"":t.replace(e,r=>Wg(t,e,n-1))}function Gg(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+Wg("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={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","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return {name:"Java",aliases:["jsp"],keywords:l,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:[d,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:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Vg,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Vg,c]}}var qg="[A-Za-z$_][0-9A-Za-z$_]*",g_=["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","using"],b_=["true","false","null","undefined","NaN","Infinity"],jg=["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"],Jg=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Yg=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],y_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],E_=[].concat(Yg,jg,Jg);function Zg(t){let e=t.regex,n=(M,{after:U})=>{let z="</"+M[0].slice(1);return M.input.indexOf(z,U)!==-1},r=qg,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,U)=>{let z=M[0].length+M.index,J=M.input[z];if(J==="<"||J===","){U.ignoreMatch();return}J===">"&&(n(M,{after:z})||U.ignoreMatch());let ie,$=M.input.substring(z);if(ie=$.match(/^\s*=/)){U.ignoreMatch();return}if((ie=$.match(/^\s+extends\s+/))&&ie.index===0){U.ignoreMatch();return}}},a={$pattern:qg,keyword:g_,literal:b_,built_in:E_,"variable.language":y_},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\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},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},v={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]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},u];f.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});let T=[].concat(v,f.contains),_=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_},k={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"}}]},y={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:{_:[...jg,...Jg]}},w={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(M){return e.concat("(?!",M.join("|"),")")}let ce={match:e.concat(/\b/,R([...Yg,"super","import"].map(M=>`${M}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Q={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",C={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return {name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:y},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),w,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,v,{match:/\$\d+/},u,y,{scope:"attr",match:r+e.lookahead(":"),relevance:0},C,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,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"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Q,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},ce,X,k,G,{match:/\$[(.]/}]}}function Xg(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",aliases:["jsonc"],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 ni="[0-9](_*[0-9])*",oa=`\\.(${ni})`,sa="[0-9a-fA-F](_*[0-9a-fA-F])*",v_={className:"number",variants:[{begin:`(\\b(${ni})((${oa})|\\.)?|(${oa}))[eE][+-]?(${ni})[fFdD]?\\b`},{begin:`\\b(${ni})((${oa})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${oa})[fFdD]?\\b`},{begin:`\\b(${ni})[fFdD]\\b`},{begin:`\\b0[xX]((${sa})\\.?|(${sa})?\\.(${sa}))[pP][+-]?(${ni})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${sa})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Qg(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 a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(s,{className:"string"}),"self"]}]},c=v_,d=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),u={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=u;return f.variants[1].contains=[u],u.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,d,n,r,a,l,{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:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[u,t.C_LINE_COMMENT_MODE,d],relevance:0},t.C_LINE_COMMENT_MODE,d,a,l,s,t.C_NUMBER_MODE]},d]},{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:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
111
+ `},c]}}var w_=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_-]*/}}),x_=["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","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],S_=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],C_=[...x_,...S_],k_=["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"].sort().reverse(),eb=["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"].sort().reverse(),tb=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),N_=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","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-end-end-radius","border-end-start-radius","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-start-end-radius","border-start-start-radius","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-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","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","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","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","margin-trim","marker","marker-end","marker-mid","marker-start","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","masonry-auto-flow","math-depth","math-shift","math-style","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","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-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","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","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","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),T_=eb.concat(tb).sort().reverse();function nb(t){let e=w_(t),n=T_,r="and or not only",i="[\\w-]+",o="("+i+"|@\\{"+i+"\\})",s=[],a=[],l=function(S){return {className:"string",begin:"~?"+S+".*?"+S}},c=function(S,T,_){return {className:S,begin:T,relevance:_}},d={$pattern:/[a-z-]+/,keyword:r,attribute:k_.join(" ")},u={begin:"\\(",end:"\\)",contains:a,keywords:d,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,u,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);let f=a.concat({begin:/\{/,end:/\}/,contains:s}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},h={begin:o+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+N_.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},m={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:a,relevance:0}},g={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:f}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:o,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,p,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+C_.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",o,0),c("selector-id","#"+o),c("selector-class","\\."+o,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+eb.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+tb.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},v={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,m,g,v,h,b,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function rb(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",aliases:["pluto"],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 ib(t){let e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},i={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},o={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},s={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return {name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,r,i,o,s]}}function ob(t){let e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",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}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),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}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=t.inherit(c,{contains:[]}),f=t.inherit(d,{contains:[]});c.contains.push(f),d.contains.push(u);let p=[n,l];return [c,d,u,f].forEach(b=>{b.contains=b.contains.concat(p);}),p=p.concat(c,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,o,c,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,r,l,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function sb(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_]*/,a={"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"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return {name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function ab(t){let e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","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","field","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","method","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:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[t.BACKSLASH_ESCAPE,o,l],u=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(m,g,b="\\1")=>{let v=b==="\\1"?b:e.concat(b,g);return e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,v,/(?:\\.|[^\\\/])*?/,b,r)},p=(m,g,b)=>e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,b,r),h=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),s,{className:"string",contains:d,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}]},c,{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(...u,{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:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",e.either(...u,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return o.contains=h,s.contains=h,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:h}}function lb(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=e.concat(/[A-Z]+/,n),s={scope:"variable",match:"\\$+"+r},a={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)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(Q,G)=>{G.data._beginMatch=Q[1]||Q[2];},"on:end":(Q,G)=>{G.data._beginMatch!==Q[1]&&G.ignoreMatch();}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
112
+ ]`,h={scope:"string",variants:[d,c,u,f]},m={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},g=["false","null","true"],b=["__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"],v=["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"],T={keyword:b,literal:(Q=>{let G=[];return Q.forEach(x=>{G.push(x),x.toLowerCase()===x?G.push(x.toUpperCase()):G.push(x.toLowerCase());}),G})(g),built_in:v},_=Q=>Q.map(G=>G.replace(/\|\d+$/,"")),I={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",_(v).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=e.concat(r,"\\b(?!\\()"),y={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),k],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"}}]},w={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},O={relevance:0,begin:/\(/,end:/\)/,keywords:T,contains:[w,s,y,t.C_BLOCK_COMMENT_MODE,h,m,I]},X={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",_(b).join("\\b|"),"|",_(v).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[O]};O.contains.push(X);let R=[w,y,t.C_BLOCK_COMMENT_MODE,h,m,I],ce={begin:e.concat(/#\[\s*\\?/,e.either(i,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...R]},...R,{scope:"meta",variants:[{match:i},{match:o}]}]};return {case_insensitive:!1,keywords:T,contains:[ce,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}]}},a,{scope:"variable.language",match:/\$this\b/},s,X,y,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},I,{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:T,contains:["self",ce,s,y,t.C_BLOCK_COMMENT_MODE,h,m]}]},{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]},h,m]}}function cb(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 db(t){return {name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function ub(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"],a={$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"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},d={begin:/\{\{/,relevance:0},u={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,d,c]},{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,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,d,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,h=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${h})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${h})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${h})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${h})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${h})`},{begin:`\\b(${f})[jJ](?=${h})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,u,t.HASH_COMMENT_MODE]}]};return c.contains=[u,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,g,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{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:[m,b,u]}]}}function fb(t){return {aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function pb(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 hb(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"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:s},u={className:"string",contains:[t.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{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,d]})]}]},f="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",h={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${p}))?([eE][+-]?(${p})|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"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},I=[u,{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:[m]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:n}],relevance:0},h,{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,d],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(l,c),relevance:0}].concat(l,c);d.contains=I,m.contains=I;let k="[>?]>",y="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",w="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",O=[{begin:/^\s*=>/,starts:{end:"$",contains:I}},{className:"meta.prompt",begin:"^("+k+"|"+y+"|"+w+")(?=[ ])",starts:{end:"$",keywords:s,contains:I}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(O).concat(c).concat(I)}}function mb(t){let e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),o={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},s="([ui](8|16|32|64|128|size)|f(32|64))?",a=["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","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["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!","eprintln!","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!"],d=["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:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},o]}}var __=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_-]*/}}),M_=["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","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],A_=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],O_=[...M_,...A_],R_=["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"].sort().reverse(),D_=["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"].sort().reverse(),I_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),L_=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","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-end-end-radius","border-end-start-radius","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-start-end-radius","border-start-start-radius","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-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","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","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","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","margin-trim","marker","marker-end","marker-mid","marker-start","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","masonry-auto-flow","math-depth","math-shift","math-style","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","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-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","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","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","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function gb(t){let e=__(t),n=I_,r=D_,i="@[a-z-]+",o="and or not only",a={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("+O_.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+L_.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,a,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:R_.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function bb(t){return {name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function yb(t){let e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},o=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],a=["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"],l=["add","asc","collation","desc","final","first","last","view"],c=["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"],d=["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"],u=["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"],f=["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"],p=d,h=[...c,...l].filter(_=>!d.includes(_)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(_){return e.concat(/\b/,e.either(..._.map(I=>I.replace(/\s+/,"\\s+"))),/\b/)}let S={scope:"keyword",match:v(f),relevance:0};function T(_,{exceptions:I,when:k}={}){let y=k;return I=I||[],_.map(w=>w.match(/\|\d+$/)||I.includes(w)?w:y(w)?`${w}|0`:w)}return {name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:T(h,{when:_=>_.length<3}),literal:o,type:a,built_in:u},contains:[{scope:"type",match:v(s)},S,b,m,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}function xb(t){return t?typeof t=="string"?t:t.source:null}function to(t){return Ne("(?=",t,")")}function Ne(...t){return t.map(n=>xb(n)).join("")}function P_(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function vt(...t){return "("+(P_(t).capture?"":"?:")+t.map(r=>xb(r)).join("|")+")"}var Ed=t=>Ne(/\b/,t,/\w$/.test(t)?/\b/:/\B/),B_=["Protocol","Type"].map(Ed),Eb=["init","self"].map(Ed),z_=["Any","Self"],bd=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","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","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","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"],vb=["false","nil","true"],F_=["assignment","associativity","higherThan","left","lowerThan","none","right"],U_=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],wb=["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"],Sb=vt(/[/=\-+!*%<>&|^~?]/,/[\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]/),Cb=vt(Sb,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),yd=Ne(Sb,Cb,"*"),kb=vt(/[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]/),la=vt(kb,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),sn=Ne(kb,la,"*"),aa=Ne(/[A-Z]/,la,"*"),H_=["attached","autoclosure",Ne(/convention\(/,vt("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ne(/objc\(/,sn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],$_=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Nb(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,vt(...B_,...Eb)],className:{2:"keyword"}},o={match:Ne(/\./,vt(...bd)),relevance:0},s=bd.filter(ve=>typeof ve=="string").concat(["_|0"]),a=bd.filter(ve=>typeof ve!="string").concat(z_).map(Ed),l={variants:[{className:"keyword",match:vt(...a,...Eb)}]},c={$pattern:vt(/\b\w+/,/#\w+/),keyword:s.concat(U_),literal:vb},d=[i,o,l],u={match:Ne(/\./,vt(...wb)),relevance:0},f={className:"built_in",match:Ne(/\b/,vt(...wb),/(?=\()/)},p=[u,f],h={match:/->/,relevance:0},m={className:"operator",relevance:0,variants:[{match:yd},{match:`\\.(\\.|${Cb})+`}]},g=[h,m],b="([0-9]_*)+",v="([0-9a-fA-F]_*)+",S={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(ve="")=>({className:"subst",variants:[{match:Ne(/\\/,ve,/[0\\tnr"']/)},{match:Ne(/\\/,ve,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(ve="")=>({className:"subst",match:Ne(/\\/,ve,/[\t ]*(?:[\r\n]|\r\n)/)}),I=(ve="")=>({className:"subst",label:"interpol",begin:Ne(/\\/,ve,/\(/),end:/\)/}),k=(ve="")=>({begin:Ne(ve,/"""/),end:Ne(/"""/,ve),contains:[T(ve),_(ve),I(ve)]}),y=(ve="")=>({begin:Ne(ve,/"/),end:Ne(/"/,ve),contains:[T(ve),I(ve)]}),w={className:"string",variants:[k(),k("#"),k("##"),k("###"),y(),y("#"),y("##"),y("###")]},O=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],X={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:O},R=ve=>{let Nt=Ne(ve,/\//),A=Ne(/\//,ve);return {begin:Nt,end:A,contains:[...O,{scope:"comment",begin:`#(?!.*${A})`,end:/$/}]}},ce={scope:"regexp",variants:[R("###"),R("##"),R("#"),X]},Q={match:Ne(/`/,sn,/`/)},G={className:"variable",match:/\$\d+/},x={className:"variable",match:`\\$${la}+`},C=[Q,G,x],M={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:$_,contains:[...g,S,w]}]}},U={scope:"keyword",match:Ne(/@/,vt(...H_),to(vt(/\(/,/\s+/)))},z={scope:"meta",match:Ne(/@/,sn)},J=[M,U,z],ie={match:to(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ne(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,la,"+")},{className:"type",match:aa,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ne(/\s+&\s+/,to(aa)),relevance:0}]},$={begin:/</,end:/>/,keywords:c,contains:[...r,...d,...J,h,ie]};ie.contains.push($);let ae={match:Ne(sn,/\s*:/),keywords:"_|0",relevance:0},_e={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",ae,...r,ce,...d,...p,...g,S,w,...C,...J,ie]},$e={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,ie]},it={begin:vt(to(Ne(sn,/\s*:/)),to(Ne(sn,/\s+/,sn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:sn}]},ln={begin:/\(/,end:/\)/,keywords:c,contains:[it,...r,...d,...g,S,w,...J,ie,_e],endsParent:!0,illegal:/["']/},ht={match:[/(func|macro)/,/\s+/,vt(Q.match,sn,yd)],className:{1:"keyword",3:"title.function"},contains:[$e,ln,e],illegal:[/\[/,/%/]},Wt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[$e,ln,e],illegal:/\[|%/},mt={match:[/operator/,/\s+/,yd],className:{1:"keyword",3:"title"}},jn={begin:[/precedencegroup/,/\s+/,aa],className:{1:"keyword",3:"title"},contains:[ie],keywords:[...F_,...vb],end:/}/},Ut={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},cn={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ot={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,sn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[$e,...d,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:aa},...d],relevance:0}]};for(let ve of w.variants){let Nt=ve.contains.find(ee=>ee.label==="interpol");Nt.keywords=c;let A=[...d,...p,...g,S,w,...C];Nt.contains=[...A,{begin:/\(/,end:/\)/,contains:["self",...A]}];}return {name:"Swift",keywords:c,contains:[...r,ht,Wt,Ut,cn,ot,mt,jn,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},ce,...d,...p,...g,S,w,...C,...J,ie,_e]}}var ca="[A-Za-z$_][0-9A-Za-z$_]*",Tb=["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","using"],_b=["true","false","null","undefined","NaN","Infinity"],Mb=["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"],Ab=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ob=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Rb=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Db=[].concat(Ob,Mb,Ab);function K_(t){let e=t.regex,n=(M,{after:U})=>{let z="</"+M[0].slice(1);return M.input.indexOf(z,U)!==-1},r=ca,i={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(M,U)=>{let z=M[0].length+M.index,J=M.input[z];if(J==="<"||J===","){U.ignoreMatch();return}J===">"&&(n(M,{after:z})||U.ignoreMatch());let ie,$=M.input.substring(z);if(ie=$.match(/^\s*=/)){U.ignoreMatch();return}if((ie=$.match(/^\s+extends\s+/))&&ie.index===0){U.ignoreMatch();return}}},a={$pattern:ca,keyword:Tb,literal:_b,built_in:Db,"variable.language":Rb},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\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},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},v={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]},S=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},u];f.contains=S.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(S)});let T=[].concat(v,f.contains),_=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(T)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_},k={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"}}]},y={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:{_:[...Mb,...Ab]}},w={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(M){return e.concat("(?!",M.join("|"),")")}let ce={match:e.concat(/\b/,R([...Ob,"super","import"].map(M=>`${M}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Q={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},G={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",C={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return {name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:y},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),w,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,h,m,g,v,{match:/\$\d+/},u,y,{scope:"attr",match:r+e.lookahead(":"),relevance:0},C,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,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"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Q,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},ce,X,k,G,{match:/\$[(.]/}]}}function Ib(t){let e=t.regex,n=K_(t),r=ca,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:ca,keyword:Tb.concat(l),literal:_b,built_in:Db.concat(i),"variable.language":Rb},d={className:"meta",begin:"@"+r},u=(m,g,b)=>{let v=m.contains.findIndex(S=>S.label===g);if(v===-1)throw new Error("can not find mode to replace");m.contains.splice(v,1,b);};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);let f=n.contains.find(m=>m.scope==="attr"),p=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,p]),n.contains=n.contains.concat([d,o,s,p]),u(n,"shebang",t.SHEBANG()),u(n,"use_strict",a);let h=n.contains.find(m=>m.label==="func.def");return h.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Lb(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)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(o,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(o,i),/ +/,e.either(s,a),/ *#/)}]},c={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])|[%&])?/}]},d={className:"label",begin:/^\w+:/},u=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=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,l,c,d,u,f,{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:[f]}]}}function Pb(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},a={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/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={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,l,c,a]}}function Bb(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:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return {name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[o,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[o,s,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function zb(t){let e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},o={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},a=t.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),l="[0-9]{4}(-[0-9][0-9]){0,2}",c="([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?",d="(\\.[0-9]*)?",u="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",f={className:"number",begin:"\\b"+l+c+d+u+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},h={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},g=[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}},f,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},h,m,o,s],b=[...g];return b.pop(),b.push(a),p.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}var vd={arduino:Ig,bash:Lg,c:Pg,cpp:Bg,csharp:zg,css:Fg,diff:Ug,go:Hg,graphql:$g,ini:Kg,java:Gg,javascript:Zg,json:Xg,kotlin:Qg,less:nb,lua:rb,makefile:ib,markdown:ob,objectivec:sb,perl:ab,php:lb,"php-template":cb,plaintext:db,python:ub,"python-repl":fb,r:pb,ruby:hb,rust:mb,scss:gb,shell:bb,sql:yb,swift:Nb,typescript:Ib,vbnet:Lb,wasm:Pb,xml:Bb,yaml:zb};var Fb={},V_="hljs-";function xd(t){let e=na.newInstance();return t&&o(t),{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:s,registered:a};function n(l,c,d){let u=d||Fb,f=typeof u.prefix=="string"?u.prefix:V_;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:wd,classPrefix:f});let p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});let h=p._emitter.root,m=h.data;return m.language=p.language,m.relevance=p.relevance,h}function r(l,c){let u=(c||Fb).subset||i(),f=-1,p=0,h;for(;++f<u.length;){let m=u[f];if(!e.getLanguage(m))continue;let g=n(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>p&&(p=g.data.relevance,h=g);}return h||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return e.listLanguages()}function o(l,c){if(typeof l=="string")e.registerLanguage(l,c);else {let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d]);}}function s(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else {let d;for(d in l)if(Object.hasOwn(l,d)){let u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d});}}}function a(l){return !!e.getLanguage(l)}}var wd=class{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},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=this,r=e.split(".").map(function(s,a){return a?s+"_".repeat(a):n.options.classPrefix+s}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o);}closeNode(){this.stack.pop();}finalize(){}toHTML(){return ""}};var an=new re("slashCommands"),Ub=ne.create({name:"slashCommands",addOptions(){return {commands:[],onSelectCommand:()=>{}}},addCommands(){return {selectSlashCommand:t=>({editor:e})=>{let n=an.getState(e.state);if(n&&n.active&&n.filteredCommands[t]){let r=n.filteredCommands[t],{from:i,to:o}=n.range;return e.chain().deleteRange({from:i,to:o}).focus().run(),this.options.onSelectCommand(r),!0}return !1}}},addKeyboardShortcuts(){return {ArrowUp:({editor:t})=>{let e=an.getState(t.state);if(e&&e.active){let n=e.selectedIndex>0?e.selectedIndex-1:e.filteredCommands.length-1;return t.view.dispatch(t.state.tr.setMeta(an,{selectedIndex:n})),!0}return !1},ArrowDown:({editor:t})=>{let e=an.getState(t.state);if(e&&e.active){let n=e.selectedIndex<e.filteredCommands.length-1?e.selectedIndex+1:0;return t.view.dispatch(t.state.tr.setMeta(an,{selectedIndex:n})),!0}return !1},Enter:({editor:t})=>{let e=an.getState(t.state);return e&&e.active?(t.commands.selectSlashCommand(e.selectedIndex),!0):!1},Escape:({editor:t})=>{let e=an.getState(t.state);return e&&e.active?(t.view.dispatch(t.state.tr.setMeta(an,{active:!1})),!0):!1}}},addProseMirrorPlugins(){return [new Z({key:an,state:{init(){return {active:!1,range:{from:0,to:0},query:"",filteredCommands:[],selectedIndex:0}},apply(t,e,n,r){let i=t.getMeta(an);if(i)return {...e,...i};let{selection:o}=r,{empty:s,$from:a}=o;if(!s)return {...e,active:!1};let c=a.parent.textBetween(Math.max(0,a.parentOffset-50),a.parentOffset,null,"\uFFFC").match(/\/(\w*)$/);if(c){let d=c[1].toLowerCase(),u=this.options.commands.filter(f=>f.command.toLowerCase().includes(d)||f.description.toLowerCase().includes(d));return {active:!0,range:{from:a.pos-c[0].length,to:a.pos},query:d,filteredCommands:u,selectedIndex:0}}return {...e,active:!1}}},props:{decorations(t){let e=this.getState(t);if(!e.active)return me.empty;let{from:n}=e.range,r=Ce.widget(n,()=>{let i=document.createElement("div");if(i.className="slash-commands-menu",e.filteredCommands.forEach((o,s)=>{let a=document.createElement("div");if(a.className=`slash-command-item ${s===e.selectedIndex?"selected":""}`,o.icon){let u=document.createElement("div");u.innerHTML=o.icon,a.appendChild(u);}let l=document.createElement("div"),c=document.createElement("div");c.className="command-name",c.textContent=`/${o.command}`,l.appendChild(c);let d=document.createElement("div");d.className="command-description",d.textContent=o.description,l.appendChild(d),a.appendChild(l),a.addEventListener("click",()=>{t.editor.commands.selectSlashCommand(s);}),i.appendChild(a);}),e.filteredCommands.length===0){let o=document.createElement("div");o.className="text-gray-500 p-3 text-sm",o.textContent="No commands found",i.appendChild(o);}return i});return me.create(t.doc,[r])}}})]}});var q_=xd(vd),OM={generateText:async()=>"AI feature is not available in standalone package",isAvailable:!1},jb=({onColorSelect:t,currentColor:e="#000000"})=>jsx(ColorPicker,{value:e,onChange:t,showInput:!0,showPresets:!0,size:"sm",presets:["#000000","#ffffff","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff","#88ff00","#0088ff","#ff0088","#00ff88","#888888","#f87171","#fb923c","#fbbf24","#facc15","#a3e635","#4ade80","#34d399","#2dd4bf","#22d3ee","#38bdf8","#60a5fa","#818cf8","#a78bfa","#c084fc","#e879f9","#f472b6","#fb7185","#f43f5e","#ef4444","#dc2626"]}),We=({active:t,disabled:e,onClick:n,children:r,tooltip:i})=>{let o=jsx("button",{type:"button",onClick:n,disabled:e,className:cn("p-2 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",t&&"bg-gray-100 dark:bg-gray-800",e&&"opacity-50 cursor-not-allowed"),children:r});return i?jsxs(Tooltip$1,{children:[jsx(TooltipTrigger,{asChild:!0,children:o}),jsx(TooltipContent,{children:jsx("p",{children:i})})]}):o};function jz({placeholder:t="Start writing...",className:e,height:n=300,features:r={bold:!0,italic:!0,underline:!0,strike:!0,heading:!0,lists:!0,blockquote:!0,code:!0,link:!0,image:!0,table:!0,align:!0,color:!0,ai:!0},aiConfig:i={provider:"openai",apiKey:"",model:"gpt-4",temperature:.7,maxTokens:1e3}}){let {hasProAccess:s,isLoading:a}=lt();if(!a&&!s)return jsx(Card,{className:cn("w-full",e),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Advanced Rich Text Editor is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[c,d]=useState({provider:i.provider||"openai",apiKey:i.apiKey||"",model:i.model||"gpt-4",temperature:i.temperature||.7,maxTokens:i.maxTokens||1e3}),[u,f]=useState(!1),[p,h]=useState(!1),[m,g]=useState(!1),[b,v]=useState(""),[S,T]=useState("#000000"),[_,I]=useState("#ffffff"),k=[{id:"rewrite",command:"rewrite",description:"Rewrite selected text",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.3"/></svg>',action:async A=>{let ee=await w("rewrite",A);return {text:ee||"",error:ee?void 0:"Failed to rewrite"}}},{id:"expand",command:"expand",description:"Expand text with more details",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m21 21-6-6m6 6v-4.8m0 4.8h-4.8"/><path d="M3 16.2V21m0 0h4.8M3 21l6-6"/><path d="M21 7.8V3m0 0h-4.8M21 3l-6 6"/><path d="M3 7.8V3m0 0h4.8M3 3l6 6"/></svg>',action:async A=>{let ee=await w("expand",A);return {text:ee||"",error:ee?void 0:"Failed to expand"}}},{id:"summarize",command:"summarize",description:"Summarize text",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 11H3"/><path d="M9 7H3"/><path d="M9 15H3"/><path d="M16 10V3"/><path d="M16 10l3-3"/><path d="M13 10l3 3"/><path d="M9 19h12"/></svg>',action:async A=>{let ee=await w("summarize",A);return {text:ee||"",error:ee?void 0:"Failed to summarize"}}},{id:"continue",command:"continue",description:"Continue writing from here",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>',action:async A=>{let ee=await w("continue",A);return {text:ee||"",error:ee?void 0:"Failed to continue"}}},{id:"improve",command:"improve",description:"Improve writing quality",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>',action:async A=>{let ee=await w("improve",A);return {text:ee||"",error:ee?void 0:"Failed to improve"}}},{id:"fix",command:"fix",description:"Fix grammar and spelling",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m6 9 6 6 6-6"/></svg>',action:async A=>{let ee=await w("fix",A);return {text:ee||"",error:ee?void 0:"Failed to fix"}}},{id:"translate",command:"translate",description:"Translate to Turkish",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2v3"/><path d="m22 22-5-10-5 10"/><path d="m14 18 6 0"/></svg>',action:async A=>{let ee=await w("translate",A);return {text:ee||"",error:ee?void 0:"Failed to translate"}}},{id:"ideas",command:"ideas",description:"Generate writing ideas",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v20"/><path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/></svg>',action:async A=>{let ee=await w("ideas",A);return {text:ee||"",error:ee?void 0:"Failed to generate ideas"}}}],y=kh({extensions:[vm.configure({heading:{levels:[1,2,3]},codeBlock:!1}),wm.configure({placeholder:t}),xm.configure({types:["heading","paragraph"]}),Sm.configure({multicolor:!0}),Yh.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),Cm.configure({inline:!0,allowBase64:!0}),ad.configure({resizable:!0}),tg,rg,ng,ld,ig,cm,og,sg,ag.configure({nested:!0}),lg,Dg.configure({lowlight:q_}),Ub.configure({commands:k,onSelectCommand:async A=>{if(!y)return;let{from:ee,to:de}=y.state.selection,Y=y.state.doc.textBetween(ee,de," ");h(!0);try{let st=await A.action(Y||y.getText());st.text?y.chain().focus().insertContent(st.text).run():st.error&&toast({title:"AI Error",description:st.error,variant:"destructive"});}catch{toast({title:"Error",description:"Failed to execute command",variant:"destructive"});}finally{h(!1);}}})],content:"",editorProps:{attributes:{class:cn("prose prose-sm sm:prose lg:prose-lg xl:prose-xl focus:outline-none min-h-[200px] p-4 max-w-none","[&_h1]:text-3xl [&_h1]:font-bold [&_h1]:mb-4","[&_h2]:text-2xl [&_h2]:font-bold [&_h2]:mb-3","[&_h3]:text-xl [&_h3]:font-bold [&_h3]:mb-2","[&_h4]:text-lg [&_h4]:font-bold [&_h4]:mb-2","[&_h5]:text-base [&_h5]:font-bold [&_h5]:mb-1","[&_h6]:text-sm [&_h6]:font-bold [&_h6]:mb-1","[&_ul]:list-disc [&_ul]:pl-6 [&_ul]:mb-4","[&_ol]:list-decimal [&_ol]:pl-6 [&_ol]:mb-4","[&_li]:mb-1","[&_table]:border-collapse-collapse [&_table]:w-full [&_table]:mb-4","[&_table_td]:border [&_table_td]:border-gray-300 [&_table_td]:p-2","[&_table_th]:border [&_table_th]:border-gray-300 [&_table_th]:p-2 [&_table_th]:bg-gray-50 [&_table_th]:font-semibold","[&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:pl-4 [&_blockquote]:italic","[&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-4 [&_pre]:rounded [&_pre]:overflow-x-auto")}},immediatelyRender:!1}),w=async(A,ee)=>{if(!c.apiKey)return toast({title:"API Key Required",description:"Please configure your AI settings first.",variant:"destructive"}),f(!0),null;h(!0);try{let de=OM,Y;switch(A){case"rewrite":Y=await de.rewrite(ee);break;case"expand":Y=await de.expand(ee);break;case"summarize":Y=await de.summarize(ee);break;case"fix":Y=await de.fixGrammar(ee);break;case"translate":Y=await de.translate(ee,"Turkish");break;case"tone_professional":Y=await de.changeTone(ee,"professional");break;case"tone_casual":Y=await de.changeTone(ee,"casual");break;case"tone_friendly":Y=await de.changeTone(ee,"friendly");break;case"tone_formal":Y=await de.changeTone(ee,"formal");break;case"continue":Y=await de.continueWriting(ee);break;case"improve":Y=await de.improveWriting(ee);break;case"ideas":Y=await de.generateIdeas(ee,5);break;default:Y=await de.complete(A,ee);}return Y.error?(toast({title:"AI Error",description:Y.error,variant:"destructive"}),null):Y.text}catch{return toast({title:"AI Error",description:"Failed to process with AI. Please check your settings.",variant:"destructive"}),null}finally{h(!1);}},O=async A=>{if(!y)return;let ee=y.state.selection,de=y.state.doc.textBetween(ee.from,ee.to," ");if(!de&&A!=="complete"){toast({title:"No text selected",description:"Please select some text first.",variant:"destructive"});return}let Y=await w(A,de||y.getText());Y&&(de?y.chain().focus().deleteSelection().insertContent(Y).run():y.chain().focus().insertContent(Y).run());},[X,R]=useState(""),[ce,Q]=useState(""),[G,x]=useState(!1),[C,M]=useState(!1),[U,z]=useState(!1),[J,ie]=useState(3),[$,ae]=useState(3),[_e,$e]=useState(!1),[it,ln]=useState(1),[ht,Wt]=useState("#000000"),[mt,jn]=useState("solid"),Ut=()=>{ce&&y&&(y.chain().focus().setImage({src:ce}).run(),Q(""),M(!1));},cn$1=()=>{X&&y&&(y.state.selection.empty?y.chain().focus().insertContent(`<a href="${X}">${X}</a>`).run():y.chain().focus().extendMarkRange("link").setLink({href:X}).run(),R(""),x(!1));},ot=()=>{y?.chain().focus().unsetLink().run();},ve=()=>{y&&J>0&&$>0&&(y.chain().focus().insertTable({rows:J,cols:$,withHeaderRow:!0}).run(),setTimeout(()=>{Nt(it,ht,mt);},100),z(!1));},Nt=(A,ee,de)=>{if(!y)return;let Y=`${A}px ${de} ${ee}`;y.view.dom.querySelectorAll(".ProseMirror table").forEach(st=>{st instanceof HTMLElement&&(st.style.borderCollapse="collapse",st.style.border=Y,st.querySelectorAll("td, th").forEach(Tt=>{Tt instanceof HTMLElement&&(Tt.style.border=Y,Tt.style.padding="8px");}));});};return y?jsxs("div",{className:cn("border rounded-lg overflow-hidden bg-white dark:bg-gray-950",e),children:[jsx(TooltipProvider,{children:jsx("div",{className:"border-b bg-gray-50 dark:bg-gray-900 p-3",children:jsxs("div",{className:"flex items-center flex-wrap gap-1",children:[(r.bold||r.italic||r.underline||r.strike||r.code)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.bold&&jsx(We,{active:y.isActive("bold"),onClick:()=>y.chain().focus().toggleBold().run(),tooltip:"Bold (Cmd+B)",disabled:m,children:jsx(Bold,{className:"w-4 h-4"})}),r.italic&&jsx(We,{active:y.isActive("italic"),onClick:()=>y.chain().focus().toggleItalic().run(),tooltip:"Italic (Cmd+I)",disabled:m,children:jsx(Italic,{className:"w-4 h-4"})}),r.underline&&jsx(We,{active:y.isActive("underline"),onClick:()=>y.chain().focus().toggleUnderline().run(),tooltip:"Underline (Cmd+U)",disabled:m,children:jsx(Underline,{className:"w-4 h-4"})}),r.strike&&jsx(We,{active:y.isActive("strike"),onClick:()=>y.chain().focus().toggleStrike().run(),tooltip:"Strikethrough",disabled:m,children:jsx(Strikethrough,{className:"w-4 h-4"})}),r.code&&jsx(We,{active:y.isActive("code"),onClick:()=>y.chain().focus().toggleCode().run(),tooltip:"Inline code",disabled:m,children:jsx(Code,{className:"w-4 h-4"})})]}),(r.bold||r.italic||r.underline||r.strike||r.code)&&(r.heading||r.align)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.heading||r.align)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.heading&&jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsxs(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,children:[jsx(Type,{className:"w-4 h-4 mr-1"}),jsx(ChevronDown,{className:"w-3 h-3"})]})}),jsxs(DropdownMenuContent,{children:[jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().setParagraph().run(),children:"Paragraph"}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:1}).run(),children:[jsx(Heading1,{className:"w-4 h-4 mr-2"})," Heading 1"]}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:2}).run(),children:[jsx(Heading2,{className:"w-4 h-4 mr-2"})," Heading 2"]}),jsxs(DropdownMenuItem,{onClick:()=>y.chain().focus().toggleHeading({level:3}).run(),children:[jsx(Heading3,{className:"w-4 h-4 mr-2"})," Heading 3"]})]})]}),r.align&&jsxs(Fragment,{children:[jsx(We,{active:y.isActive({textAlign:"left"}),onClick:()=>y.chain().focus().setTextAlign("left").run(),tooltip:"Align left",disabled:m,children:jsx(AlignLeft,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"center"}),onClick:()=>y.chain().focus().setTextAlign("center").run(),tooltip:"Align center",disabled:m,children:jsx(AlignCenter,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"right"}),onClick:()=>y.chain().focus().setTextAlign("right").run(),tooltip:"Align right",disabled:m,children:jsx(AlignRight,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive({textAlign:"justify"}),onClick:()=>y.chain().focus().setTextAlign("justify").run(),tooltip:"Justify",disabled:m,children:jsx(AlignJustify,{className:"w-4 h-4"})})]})]}),(r.heading||r.align)&&(r.lists||r.blockquote)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.lists||r.blockquote)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.lists&&jsxs(Fragment,{children:[jsx(We,{active:y.isActive("bulletList"),onClick:()=>y.chain().focus().toggleBulletList().run(),tooltip:"Bullet list",disabled:m,children:jsx(List,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive("orderedList"),onClick:()=>y.chain().focus().toggleOrderedList().run(),tooltip:"Numbered list",disabled:m,children:jsx(ListOrdered,{className:"w-4 h-4"})}),jsx(We,{active:y.isActive("taskList"),onClick:()=>y.chain().focus().toggleTaskList().run(),tooltip:"Task list",disabled:m,children:jsx(CheckSquare,{className:"w-4 h-4"})})]}),r.blockquote&&jsx(We,{active:y.isActive("blockquote"),onClick:()=>y.chain().focus().toggleBlockquote().run(),tooltip:"Quote",disabled:m,children:jsx(Quote,{className:"w-4 h-4"})})]}),(r.lists||r.blockquote)&&r.color&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),r.color&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[jsxs(Popover,{children:[jsx(PopoverTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,title:"Text Color",children:jsx(Palette,{className:"w-4 h-4"})})}),jsx(PopoverContent,{className:"w-auto p-0",children:jsx(jb,{currentColor:S,onColorSelect:A=>{T(A),y.chain().focus().setColor(A).run();}})})]}),jsxs(Popover,{children:[jsx(PopoverTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m,title:"Background Color",children:jsx(Highlighter,{className:"w-4 h-4"})})}),jsx(PopoverContent,{className:"w-auto p-0",children:jsx(jb,{currentColor:_,onColorSelect:A=>{I(A),y.chain().focus().toggleHighlight({color:A}).run();}})})]})]}),r.color&&(r.link||r.image||r.table)&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),(r.link||r.image||r.table)&&jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.link&&jsxs(Dialog,{open:G,onOpenChange:x,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{active:y.isActive("link"),tooltip:"Add link",disabled:m,children:jsx(Link2,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Add Link"}),jsx(DialogDescription,{children:"Enter the URL for the link."})]}),jsx("div",{className:"grid gap-4 py-4",children:jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"url",children:"URL"}),jsx(Input,{id:"url",value:X,onChange:A=>R(A.target.value),placeholder:"https://example.com",onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),cn$1());}})]})}),jsxs("div",{className:"flex justify-between",children:[y.isActive("link")&&jsx(Button,{variant:"destructive",onClick:()=>{ot(),x(!1);},children:"Remove Link"}),jsxs("div",{className:"ml-auto flex gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),jsx(Button,{onClick:cn$1,children:"Add Link"})]})]})]})]}),r.image&&jsxs(Dialog,{open:C,onOpenChange:M,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"Add image",disabled:m,children:jsx(Image,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Add Image"}),jsx(DialogDescription,{children:"Enter the URL for the image."})]}),jsx("div",{className:"grid gap-4 py-4",children:jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"image-url",children:"Image URL"}),jsx(Input,{id:"image-url",value:ce,onChange:A=>Q(A.target.value),placeholder:"https://example.com/image.jpg",onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),Ut());}})]})}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),jsx(Button,{onClick:Ut,children:"Add Image"})]})]})]}),r.table&&jsxs(Fragment,{children:[jsxs(Dialog,{open:U,onOpenChange:z,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"Create table",disabled:m,children:jsx(Table,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Create Table"}),jsx(DialogDescription,{children:"Choose the size for your new table."})]}),jsxs("div",{className:"grid gap-4 py-4",children:[jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"rows",children:"Rows"}),jsx(Input,{id:"rows",type:"number",min:"1",max:"20",value:J,onChange:A=>ie(parseInt(A.target.value)||3)})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"cols",children:"Columns"}),jsx(Input,{id:"cols",type:"number",min:"1",max:"10",value:$,onChange:A=>ae(parseInt(A.target.value)||3)})]})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"headerRow",defaultChecked:!0,className:"rounded border-gray-300"}),jsx(Label,{htmlFor:"headerRow",className:"text-sm font-normal",children:"Include header row"})]})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>z(!1),children:"Cancel"}),jsx(Button,{onClick:ve,children:"Create Table"})]})]})]}),jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsx(Button,{variant:"ghost",size:"sm",className:"h-8 px-1",children:jsx(ChevronDown,{className:"w-3 h-3"})})}),jsxs(DropdownMenuContent,{children:[jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addColumnBefore().run(),children:"Add column before"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addColumnAfter().run(),children:"Add column after"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteColumn().run(),children:"Delete column"}),jsx(DropdownMenuSeparator,{}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addRowBefore().run(),children:"Add row before"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().addRowAfter().run(),children:"Add row after"}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteRow().run(),children:"Delete row"}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>$e(!0),children:[jsx(Settings,{className:"w-4 h-4 mr-2"}),"Table Borders"]}),jsx(DropdownMenuSeparator,{}),jsx(DropdownMenuItem,{onClick:()=>y.chain().focus().deleteTable().run(),children:"Delete table"})]})]})]})]}),(r.link||r.image||r.table)&&!0&&jsx("div",{className:"w-px h-6 bg-border mx-1 shrink-0"}),jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[jsx(We,{onClick:()=>y.chain().focus().undo().run(),disabled:!y.can().undo()||m,tooltip:"Undo (Cmd+Z)",children:jsx(Undo,{className:"w-4 h-4"})}),jsx(We,{onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo()||m,tooltip:"Redo (Cmd+Shift+Z)",children:jsx(Redo,{className:"w-4 h-4"})}),jsx(We,{active:m,onClick:()=>{m?y.commands.setContent(b):v(y.getHTML()),g(!m);},tooltip:m?"Visual Mode":"Source Code",children:m?jsx(Edit,{className:"w-4 h-4"}):jsx(Eye,{className:"w-4 h-4"})}),r.ai&&jsxs(Fragment,{children:[jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{asChild:!0,children:jsxs(Button,{variant:"ghost",size:"sm",className:"h-8 px-3 bg-purple-100 hover:bg-purple-200 dark:bg-purple-900 dark:hover:bg-purple-800",disabled:p,children:[p?jsx(RefreshCw,{className:"w-4 h-4 mr-1 animate-spin"}):jsx(Wand2,{className:"w-4 h-4 mr-1"}),"AI Tools"]})}),jsxs(DropdownMenuContent,{className:"w-56",children:[jsxs(DropdownMenuItem,{onClick:()=>O("rewrite"),children:[jsx(RefreshCw,{className:"w-4 h-4 mr-2"}),"Rewrite Selection"]}),jsxs(DropdownMenuItem,{onClick:()=>O("improve"),children:[jsx(Wand2,{className:"w-4 h-4 mr-2"}),"Improve Writing"]}),jsxs(DropdownMenuItem,{onClick:()=>O("expand"),children:[jsx(Maximize,{className:"w-4 h-4 mr-2"}),"Expand Text"]}),jsxs(DropdownMenuItem,{onClick:()=>O("summarize"),children:[jsx(FileText,{className:"w-4 h-4 mr-2"}),"Summarize"]}),jsxs(DropdownMenuItem,{onClick:()=>O("continue"),children:[jsx(Plus,{className:"w-4 h-4 mr-2"}),"Continue Writing"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("fix"),children:[jsx(Check,{className:"w-4 h-4 mr-2"}),"Fix Grammar & Spelling"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_professional"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Professional"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_casual"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Casual"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_friendly"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Friendly"]}),jsxs(DropdownMenuItem,{onClick:()=>O("tone_formal"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Formal"]}),jsx(DropdownMenuSeparator,{}),jsxs(DropdownMenuItem,{onClick:()=>O("translate"),children:[jsx(Languages,{className:"w-4 h-4 mr-2"}),"Translate to Turkish"]}),jsxs(DropdownMenuItem,{onClick:()=>O("ideas"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Generate Ideas"]})]})]}),jsxs(Dialog,{open:u,onOpenChange:f,children:[jsx(DialogTrigger,{asChild:!0,children:jsx(We,{tooltip:"AI Settings - Configure your API keys here",disabled:m,children:jsx(Settings,{className:"w-4 h-4"})})}),jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"AI Settings"}),jsx(DialogDescription,{children:"Configure your AI provider and API settings."})]}),jsxs("div",{className:"grid gap-4 py-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"provider",children:"Provider"}),jsxs(Select,{value:c.provider,onValueChange:A=>d({...c,provider:A}),children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[jsx(SelectItem,{value:"openai",children:"OpenAI"}),jsx(SelectItem,{value:"claude",children:"Claude (Anthropic)"}),jsx(SelectItem,{value:"gemini",children:"Gemini (Google)"}),jsx(SelectItem,{value:"cohere",children:"Cohere"})]})]})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"apiKey",children:"API Key"}),jsx(Input,{id:"apiKey",type:"password",value:c.apiKey,onChange:A=>d({...c,apiKey:A.target.value}),placeholder:"sk-..."})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"model",children:"Model"}),jsxs(Select,{value:c.model,onValueChange:A=>d({...c,model:A}),children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[c.provider==="openai"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"gpt-4",children:"GPT-4"}),jsx(SelectItem,{value:"gpt-3.5-turbo",children:"GPT-3.5 Turbo"})]}),c.provider==="claude"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"claude-3-opus",children:"Claude 3 Opus"}),jsx(SelectItem,{value:"claude-3-sonnet",children:"Claude 3 Sonnet"}),jsx(SelectItem,{value:"claude-3-haiku",children:"Claude 3 Haiku"})]}),c.provider==="gemini"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"gemini-pro",children:"Gemini Pro"}),jsx(SelectItem,{value:"gemini-pro-vision",children:"Gemini Pro Vision"})]}),c.provider==="cohere"&&jsxs(Fragment,{children:[jsx(SelectItem,{value:"command",children:"Command"}),jsx(SelectItem,{value:"command-light",children:"Command Light"})]})]})]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"temperature",children:"Temperature"}),jsx(Input,{id:"temperature",type:"number",min:"0",max:"2",step:"0.1",value:c.temperature,onChange:A=>d({...c,temperature:parseFloat(A.target.value)})})]}),jsxs("div",{className:"grid gap-2",children:[jsx(Label,{htmlFor:"maxTokens",children:"Max Tokens"}),jsx(Input,{id:"maxTokens",type:"number",min:"1",max:"4000",value:c.maxTokens,onChange:A=>d({...c,maxTokens:parseInt(A.target.value)})})]})]})]}),jsx("div",{className:"flex justify-end",children:jsx(Button,{onClick:()=>{f(!1),toast({title:"Settings saved",description:"Your AI settings have been updated."});},children:"Save Settings"})})]})]})]})]})]})})}),jsx(Dialog,{open:_e,onOpenChange:$e,children:jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxs(DialogHeader,{children:[jsx(DialogTitle,{children:"Table Border Settings"}),jsx(DialogDescription,{children:"Customize the appearance of table borders."})]}),jsxs("div",{className:"grid gap-6 py-4",children:[jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-width",children:"Border Width"}),jsxs("div",{className:"flex items-center gap-4",children:[jsx(Slider,{id:"border-width",min:0,max:5,step:1,value:[it],onValueChange:A=>ln(A[0]),className:"flex-1"}),jsxs("span",{className:"text-sm font-medium w-8",children:[it,"px"]})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-color",children:"Border Color"}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(ColorPicker,{value:ht,onChange:Wt,showInput:!0,showPresets:!1,size:"sm"}),jsx("span",{className:"text-sm text-muted-foreground",children:ht})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{htmlFor:"border-style",children:"Border Style"}),jsxs(Select,{value:mt,onValueChange:jn,children:[jsx(SelectTrigger,{children:jsx(SelectValue,{})}),jsxs(SelectContent,{children:[jsx(SelectItem,{value:"solid",children:"Solid"}),jsx(SelectItem,{value:"dashed",children:"Dashed"}),jsx(SelectItem,{value:"dotted",children:"Dotted"}),jsx(SelectItem,{value:"double",children:"Double"}),jsx(SelectItem,{value:"groove",children:"Groove"}),jsx(SelectItem,{value:"ridge",children:"Ridge"}),jsx(SelectItem,{value:"inset",children:"Inset"}),jsx(SelectItem,{value:"outset",children:"Outset"})]})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(Label,{children:"Preview"}),jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg",children:jsxs("table",{className:"w-full text-sm",style:{borderCollapse:"collapse",border:`${it}px ${mt} ${ht}`},children:[jsx("thead",{children:jsxs("tr",{children:[jsx("th",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px",textAlign:"left"},children:"Header 1"}),jsx("th",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px",textAlign:"left"},children:"Header 2"})]})}),jsx("tbody",{children:jsxs("tr",{children:[jsx("td",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px"},children:"Cell 1"}),jsx("td",{style:{border:`${it}px ${mt} ${ht}`,padding:"8px"},children:"Cell 2"})]})})]})})]})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(Button,{variant:"outline",onClick:()=>$e(!1),children:"Cancel"}),jsx(Button,{onClick:()=>{Nt(it,ht,mt),$e(!1),toast({title:"Borders applied",description:"Table borders have been updated."});},children:"Apply Borders"})]})]})}),jsx("div",{className:"overflow-auto",style:{height:typeof n=="number"?`${n}px`:n},children:m?jsx("textarea",{value:b,onChange:A=>v(A.target.value),className:"w-full h-full p-4 font-mono text-sm resize-none focus:outline-none bg-gray-50 dark:bg-gray-900",placeholder:"HTML source code..."}):jsx(vh,{editor:y})})]}):null}var JM={success:"bg-green-500 border-green-500",warning:"bg-yellow-500 border-yellow-500",error:"bg-red-500 border-red-500",info:"bg-blue-500 border-blue-500",pending:"bg-gray-400 border-gray-400"},YM={success:jsx(CheckCircle2,{className:"h-4 w-4 text-white"}),warning:jsx(AlertCircle,{className:"h-4 w-4 text-white"}),error:jsx(XCircle,{className:"h-4 w-4 text-white"}),info:jsx(Circle,{className:"h-4 w-4 text-white"}),pending:jsx(Clock,{className:"h-4 w-4 text-white"})},ZM={success:"text-green-700",warning:"text-yellow-700",error:"text-red-700",info:"text-blue-700",pending:"text-gray-700"};function sF({events:t,onEventClick:e,className:n,showUserInfo:r=!0,showMetadata:i=!0,showRelativeTime:o=!0,groupByDate:s=!1,orientation:a="vertical",compact:l=!1,interactive:c=!0}){let {hasProAccess:u,isLoading:f}=lt();if(!f&&!u)return jsx(Card,{className:cn("w-full",n),children:jsx(CardContent,{className:"py-12 text-center",children:jsxs("div",{className:"max-w-md mx-auto space-y-4",children:[jsx("div",{className:"rounded-full bg-purple-100 dark:bg-purple-900/30 p-3 w-fit mx-auto",children:jsx(Lock,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-lg mb-2",children:"Pro Feature"}),jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Timeline is available exclusively to MoonUI Pro subscribers."}),jsx("div",{className:"flex gap-3 justify-center",children:jsx("a",{href:"/pricing",children:jsxs(Button,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let h=[...t].sort((k,y)=>y.date.getTime()-k.date.getTime()),m=k=>k.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),g=k=>k.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),b=k=>{let w=Math.floor((new Date().getTime()-k.getTime())/1e3);if(w<60)return "Just now";if(w<3600){let O=Math.floor(w/60);return `${O} minute${O>1?"s":""} ago`}else if(w<86400){let O=Math.floor(w/3600);return `${O} hour${O>1?"s":""} ago`}else if(w<2592e3){let O=Math.floor(w/86400);return `${O} day${O>1?"s":""} ago`}else return m(k)},v=k=>k.split(" ").map(y=>y[0]).join("").toUpperCase(),S=k=>{let y={};return k.forEach(w=>{let O=m(w.date);y[O]||(y[O]=[]),y[O].push(w);}),y},T=k=>{c&&e&&e(k);},_=(k,y,w)=>{let O=k.color||JM[k.type],X=k.icon||YM[k.type],R=ZM[k.type];return jsxs("div",{className:cn("relative flex gap-4",l?"pb-4":"pb-8",c&&"cursor-pointer hover:bg-muted/50 rounded-lg p-2 -m-2 transition-colors"),onClick:()=>T(k),children:[a==="vertical"&&jsxs("div",{className:"flex flex-col items-center",children:[jsx("div",{className:cn("flex items-center justify-center w-8 h-8 rounded-full border-2 bg-background",O),children:X}),!w&&jsx("div",{className:"w-0.5 h-full bg-border mt-2"})]}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("h4",{className:cn("font-medium text-sm",l?"mb-1":"mb-2"),children:k.title}),k.description&&jsx("p",{className:cn("text-muted-foreground text-sm",l?"mb-1":"mb-2"),children:k.description})]}),jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o?jsx("span",{children:b(k.date)}):jsx("span",{children:g(k.date)}),jsx(Badge,{variant:"outline",className:cn("text-xs",R),children:k.type})]})]}),r&&k.user&&jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs(Avatar,{className:"h-6 w-6",children:[jsx(AvatarImage,{src:k.user.avatar}),jsx(AvatarFallback,{className:"text-xs",children:v(k.user.name)})]}),jsx("span",{className:"text-sm text-muted-foreground",children:k.user.name})]}),i&&k.metadata&&jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[k.metadata.duration&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.duration})]}),k.metadata.location&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Calendar,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.location})]}),k.metadata.comments&&k.metadata.comments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MessageCircle,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.comments})]}),k.metadata.attachments&&k.metadata.attachments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Paperclip,{className:"h-3 w-3"}),jsx("span",{children:k.metadata.attachments})]}),k.metadata.externalLink&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(ExternalLink,{className:"h-3 w-3"}),jsx("span",{children:"View details"})]})]}),k.metadata?.tags&&k.metadata.tags.length>0&&jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:k.metadata.tags.map((ce,Q)=>jsx(Badge,{variant:"secondary",className:"text-xs",children:ce},Q))})]})]},k.id)},I=()=>{let k=S(h);return Object.entries(k).map(([y,w],O)=>jsxs("div",{className:"mb-8",children:[jsx("div",{className:"sticky top-0 bg-background/80 backdrop-blur-sm border-b p-2 mb-4",children:jsx("h3",{className:"font-medium text-sm text-muted-foreground",children:y})}),w.map((X,R)=>_(X,R,R===w.length-1))]},y))};return jsxs(Card,{className:cn("w-full",n),children:[jsxs(CardHeader,{children:[jsxs(CardTitle,{className:"flex items-center gap-2",children:[jsx(Clock,{className:"h-5 w-5"}),"Timeline"]}),jsxs(CardDescription,{children:[h.length," event",h.length!==1?"s":""," tracked"]})]}),jsx(CardContent,{children:h.length>0?jsx("div",{className:cn("space-y-0",a==="horizontal"&&"flex overflow-x-auto gap-6"),children:s?I():h.map((k,y)=>_(k,y,y===h.length-1))}):jsxs("div",{className:"text-center py-8",children:[jsx(Clock,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),jsx("p",{className:"text-muted-foreground",children:"No events to display"})]})})]})}function XM({items:t,height:e,itemHeight:n=50,estimatedItemHeight:r=50,variableHeight:i=!1,overscan:o=5,renderItem:s,onScroll:a,className:l}){let[c,d]=useState(0),[u,f]=useState(!1),[p,h]=useState(new Map),m=useRef(null),g=useRef(null),b=useRef(),v=useRef(),S=useMemo(()=>{let y=[],w=0;for(let O=0;O<t.length;O++){let X=i?p.get(O)||r:n;y.push({index:O,height:X,top:w}),w+=X;}return y},[t.length,n,r,i,p]),T=useMemo(()=>S.length>0?S[S.length-1].top+S[S.length-1].height:0,[S]),_=useMemo(()=>{let y=S.findIndex(R=>R.top+R.height>=c),w=S.findIndex(R=>R.top>c+e),O=Math.max(0,y-o),X=w===-1?Math.min(t.length-1,y+Math.ceil(e/n)+o):Math.min(t.length-1,w+o);return {start:O,end:X}},[c,e,S,o,t.length,n]),I=useMemo(()=>{let y=[];for(let w=_.start;w<=_.end;w++)if(w>=0&&w<t.length&&S[w]){let O=S[w];y.push({item:t[w],index:w,style:{position:"absolute",top:O.top,left:0,right:0,height:i?"auto":O.height,minHeight:i?O.height:void 0}});}return y},[t,_,S,i]),k=useCallback(y=>{let w=y.currentTarget.scrollTop;d(w),f(!0),a&&a(w),b.current&&clearTimeout(b.current),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{f(!1);},150);},[a]);return useEffect(()=>{if(!i||!m.current)return;let y=new ResizeObserver(O=>{let X=new Map(p),R=!1;O.forEach(ce=>{let G=ce.target.getAttribute("data-index");if(G){let x=parseInt(G,10),C=ce.contentRect.height;X.get(x)!==C&&(X.set(x,C),R=!0);}}),R&&h(X);});return m.current.querySelectorAll("[data-index]").forEach(O=>y.observe(O)),()=>y.disconnect()},[i,p,I]),useEffect(()=>{let y=O=>{if(m.current)switch(O.key){case"ArrowUp":O.preventDefault(),g.current?.scrollBy({top:-n,behavior:"smooth"});break;case"ArrowDown":O.preventDefault(),g.current?.scrollBy({top:n,behavior:"smooth"});break;case"PageUp":O.preventDefault(),g.current?.scrollBy({top:-e,behavior:"smooth"});break;case"PageDown":O.preventDefault(),g.current?.scrollBy({top:e,behavior:"smooth"});break;case"Home":O.preventDefault(),g.current?.scrollTo({top:0,behavior:"smooth"});break;case"End":O.preventDefault(),g.current?.scrollTo({top:T,behavior:"smooth"});break}},w=m.current;if(w)return w.addEventListener("keydown",y),()=>w.removeEventListener("keydown",y)},[n,e,T]),jsxs("div",{ref:m,className:cn("relative overflow-hidden border rounded-lg bg-background focus:outline-none focus:ring-2 focus:ring-ring",l),style:{height:e},tabIndex:0,role:"listbox","aria-label":`Virtual list with ${t.length} items`,children:[jsx("div",{ref:g,className:"h-full overflow-auto scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent",onScroll:k,children:jsx("div",{style:{height:T,position:"relative"},children:I.map(({item:y,index:w,style:O})=>jsx("div",{"data-index":w,style:O,role:"option","aria-selected":"false",className:"outline-none",children:s(y,w)},w))})}),u&&jsx("div",{className:"absolute top-2 right-2 bg-muted/80 text-muted-foreground px-2 py-1 rounded text-xs",children:"Scrolling..."}),t.length>100&&jsxs("div",{className:"absolute bottom-2 right-2 bg-muted/80 text-muted-foreground px-2 py-1 rounded text-xs",children:[Math.round(c/Math.max(T-e,1)*100),"%"]})]})}function fF(t,e={}){let[n,r]=useState(e),[i,o]=useState(new Set),s=useCallback(d=>{r(u=>({...u,...d}));},[]),a=useCallback(d=>{o(u=>new Set([...u,d]));},[]),l=useCallback(d=>{o(u=>{let f=new Set(u);return f.delete(d),f});},[]),c=useCallback(()=>{o(new Set);},[]);return {config:n,updateConfig:s,selectedItems:i,selectItem:a,deselectItem:l,clearSelection:c}}function pF({selectable:t=!1,multiSelect:e=!1,selectedItems:n=new Set,onSelectionChange:r,renderItem:i,...o}){let s=useCallback(l=>{if(!t||!r)return;let c=new Set(n);e?c.has(l)?c.delete(l):c.add(l):(c.clear(),c.add(l)),r(c);},[t,e,n,r]),a=useCallback((l,c)=>{let d=n.has(c);return jsx("div",{className:cn("transition-colors",t&&"cursor-pointer hover:bg-muted/50",d&&"bg-primary/10 border-l-4 border-primary"),onClick:()=>t&&s(c),children:i(l,c)})},[i,t,n,s]);return jsx(XM,{...o,renderItem:a})}/*! Bundled license information:
113
+
114
+ use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
115
+ (**
116
+ * @license React
117
+ * use-sync-external-store-shim.production.js
118
+ *
119
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
120
+ *
121
+ * This source code is licensed under the MIT license found in the
122
+ * LICENSE file in the root directory of this source tree.
123
+ *)
124
+
125
+ use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
126
+ (**
127
+ * @license React
128
+ * use-sync-external-store-shim.development.js
129
+ *
130
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
131
+ *
132
+ * This source code is licensed under the MIT license found in the
133
+ * LICENSE file in the root directory of this source tree.
134
+ *)
135
+
136
+ use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js:
137
+ (**
138
+ * @license React
139
+ * use-sync-external-store-shim/with-selector.production.js
140
+ *
141
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
142
+ *
143
+ * This source code is licensed under the MIT license found in the
144
+ * LICENSE file in the root directory of this source tree.
145
+ *)
146
+
147
+ use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
148
+ (**
149
+ * @license React
150
+ * use-sync-external-store-shim/with-selector.development.js
151
+ *
152
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
153
+ *
154
+ * This source code is licensed under the MIT license found in the
155
+ * LICENSE file in the root directory of this source tree.
156
+ *)
157
+ */
158
+
159
+ export { uA as AdvancedChart, BA as Calendar, YA as Dashboard, f1 as DataTable, C1 as FileUpload, B1 as Kanban, K1 as MemoryAnalytics, $1 as MemoryEfficientData, jz as RichTextEditor, pF as SelectableVirtualList, sF as Timeline, XM as VirtualList, V1 as useStreamingData, fF as useVirtualList };