@moontra/moonui-pro 2.0.1 → 2.0.3
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.js +116 -49
- package/dist/index.mjs +87 -33
- package/package.json +22 -8
- package/dist/index.css +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
1
|
+
import * as ee from 'react';
|
|
2
|
+
import ee__default, { forwardRef, Children, isValidElement, createElement, cloneElement, createContext, useEffect, useContext, useState, useRef, useCallback, Fragment, useMemo, useLayoutEffect, useDebugValue } from 'react';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { motion, useMotionValue, useTransform, animate } from 'framer-motion';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
8
|
+
import { Loader2, ChevronDown, ChevronUp, Check, X as X$1, ChevronRight, Circle, Lock, Sparkles, Calendar, ChevronLeft, Edit, Trash2, Clock, MapPin, User, Plus, MoreHorizontal, GripVertical, MessageCircle, Paperclip, Bold, Italic, Underline, Strikethrough, Code, Type, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, CheckSquare, Quote, Palette, Highlighter, Link2, Image, Table, Settings, Undo, Redo, Eye, RefreshCw, Wand2, Maximize, FileText, Languages } from 'lucide-react';
|
|
9
|
+
import * as Dg from 'react-dom';
|
|
10
|
+
import Dg__default, { createPortal, flushSync } from 'react-dom';
|
|
11
|
+
import * as Nr from '@radix-ui/react-avatar';
|
|
12
|
+
import * as Ln from '@radix-ui/react-tooltip';
|
|
13
|
+
import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd';
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
* @moontra/moonui-pro v1.0.0
|
|
@@ -12,22 +18,68 @@ import cC from 'react-dom';
|
|
|
12
18
|
* (c) 2025 MoonUI. All rights reserved.
|
|
13
19
|
* @license Commercial - https://moonui.dev/license
|
|
14
20
|
*/
|
|
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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}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`),
|
|
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
|
-
`)
|
|
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&>.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
|
-
`)
|
|
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
|
-
|
|
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 {
|
|
21
|
+
var sN=Object.create;var yg=Object.defineProperty;var aN=Object.getOwnPropertyDescriptor;var lN=Object.getOwnPropertyNames;var cN=Object.getPrototypeOf,dN=Object.prototype.hasOwnProperty;var tl=(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 qr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var uN=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of lN(e))!dN.call(t,o)&&o!==n&&yg(t,o,{get:()=>e[o],enumerable:!(r=aN(e,o))||r.enumerable});return t};var Es=(t,e,n)=>(n=t!=null?sN(cN(t)):{},uN(e||!t||!t.__esModule?yg(n,"default",{value:t,enumerable:!0}):n,t));var i0=qr(o0=>{var zi=tl("react");function AO(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var OO=typeof Object.is=="function"?Object.is:AO,DO=zi.useState,PO=zi.useEffect,IO=zi.useLayoutEffect,LO=zi.useDebugValue;function $O(t,e){var n=e(),r=DO({inst:{value:n,getSnapshot:e}}),o=r[0].inst,i=r[1];return IO(function(){o.value=n,o.getSnapshot=e,Sf(o)&&i({inst:o});},[t,n,e]),PO(function(){return Sf(o)&&i({inst:o}),t(function(){Sf(o)&&i({inst:o});})},[t]),LO(n),n}function Sf(t){var e=t.getSnapshot;t=t.value;try{var n=e();return !OO(t,n)}catch{return !0}}function BO(t,e){return e()}var FO=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?BO:$O;o0.useSyncExternalStore=zi.useSyncExternalStore!==void 0?zi.useSyncExternalStore:FO;});var a0=qr(s0=>{process.env.NODE_ENV!=="production"&&function(){function t(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}function e(p,m){d||o.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 h=m();if(!u){var g=m();i(h,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0);}g=s({inst:{value:h,getSnapshot:m}});var b=g[0].inst,y=g[1];return l(function(){b.value=h,b.getSnapshot=m,n(b)&&y({inst:b});},[p,h,m]),a(function(){return n(b)&&y({inst:b}),p(function(){n(b)&&y({inst:b});})},[p]),c(h),h}function n(p){var m=p.getSnapshot;p=p.value;try{var h=m();return !i(p,h)}catch{return !0}}function r(p,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=tl("react"),i=typeof Object.is=="function"?Object.is:t,s=o.useState,a=o.useEffect,l=o.useLayoutEffect,c=o.useDebugValue,d=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;s0.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());}();});var js=qr((b7,Cf)=>{process.env.NODE_ENV==="production"?Cf.exports=i0():Cf.exports=a0();});var hE=qr((xG,mE)=>{mE.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,o,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return !1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return !1;return !0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return !1;for(o of e.entries())if(!n.has(o[0]))return !1;for(o of e.entries())if(!t(o[1],n.get(o[0])))return !1;return !0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return !1;for(o of e.entries())if(!n.has(o[0]))return !1;return !0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return !1;for(o=r;o--!==0;)if(e[o]!==n[o])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(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return !1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return !1;for(o=r;o--!==0;){var s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return !1}return !0}return e!==e&&n!==n};});var bE=qr(gE=>{var _c=tl("react"),QL=js();function e$(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var t$=typeof Object.is=="function"?Object.is:e$,n$=QL.useSyncExternalStore,r$=_c.useRef,o$=_c.useEffect,i$=_c.useMemo,s$=_c.useDebugValue;gE.useSyncExternalStoreWithSelector=function(t,e,n,r,o){var i=r$(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s;}else s=i.current;i=i$(function(){function l(p){if(!c){if(c=!0,d=p,p=r(p),o!==void 0&&s.hasValue){var m=s.value;if(o(m,p))return u=m}return u=p}if(m=u,t$(d,p))return m;var h=r(p);return o!==void 0&&o(m,h)?(d=p,m):(d=p,u=h)}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,o]);var a=n$(t,i[0],i[1]);return o$(function(){s.hasValue=!0,s.value=a;},[a]),s$(a),a};});var vE=qr(yE=>{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=tl("react"),n=js(),r=typeof Object.is=="function"?Object.is:t,o=n.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;yE.useSyncExternalStoreWithSelector=function(c,d,u,f,p){var m=i(null);if(m.current===null){var h={hasValue:!1,value:null};m.current=h;}else h=m.current;m=a(function(){function b(C){if(!y){if(y=!0,v=C,C=f(C),p!==void 0&&h.hasValue){var T=h.value;if(p(T,C))return x=T}return x=C}if(T=x,r(v,C))return T;var w=f(C);return p!==void 0&&p(T,w)?(v=C,T):(v=C,x=w)}var y=!1,v,x,E=u===void 0?null:u;return [function(){return b(d())},E===null?void 0:function(){return b(E())}]},[d,u,f,p]);var g=o(c,m[0],m[1]);return s(function(){h.hasValue=!0,h.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 wE=qr((CG,Zp)=>{process.env.NODE_ENV==="production"?Zp.exports=bE():Zp.exports=vE();});var OC=qr((HX,AC)=>{function vC(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)&&vC(n);}),t}var kd=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1;}ignoreMatch(){this.isMatchIgnored=!0;}};function wC(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function bo(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let o in r)n[o]=r[o];}),n}var mF="</span>",pC=t=>!!t.scope,hF=(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,o)=>`${r}${"_".repeat(o+1)}`)].join(" ")}return `${e}${t}`},rh=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this);}addText(e){this.buffer+=wC(e);}openNode(e){if(!pC(e))return;let n=hF(e.scope,{prefix:this.classPrefix});this.span(n);}closeNode(e){pC(e)&&(this.buffer+=mF);}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`;}},mC=(t={})=>{let e={children:[]};return Object.assign(e,t),e},Pa=class{constructor(){this.rootNode=mC(),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=mC({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=>{Pa._collapse(n);}));}},oh=class extends Pa{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 rh(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Ia(t){return t?typeof t=="string"?t:t.source:null}function xC(t){return pi("(?=",t,")")}function gF(t){return pi("(?:",t,")*")}function bF(t){return pi("(?:",t,")?")}function pi(...t){return t.map(n=>Ia(n)).join("")}function yF(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function sh(...t){return "("+(yF(t).capture?"":"?:")+t.map(r=>Ia(r)).join("|")+")"}function EC(t){return new RegExp(t.toString()+"|").exec("").length-1}function vF(t,e){let n=t&&t.exec(e);return n&&n.index===0}var wF=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function ah(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let o=n,i=Ia(r),s="";for(;i.length>0;){let a=wF.exec(i);if(!a){s+=i;break}s+=i.substring(0,a.index),i=i.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?s+="\\"+String(Number(a[1])+o):(s+=a[0],a[0]==="("&&n++);}return s}).map(r=>`(${r})`).join(e)}var xF=/\b\B/,SC="[a-zA-Z]\\w*",lh="[a-zA-Z_]\\w*",CC="\\b\\d+(\\.\\d+)?",RC="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",TC="\\b(0b[01]+)",EF="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SF=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=pi(e,/.*\b/,t.binary,/\b.*/)),bo({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch();}},t)},La={begin:"\\\\[\\s\\S]",relevance:0},CF={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[La]},RF={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[La]},TF={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/},_d=function(t,e,n={}){let r=bo({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 o=sh("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:pi(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},kF=_d("//","$"),NF=_d("/\\*","\\*/"),_F=_d("#","$"),MF={scope:"number",begin:CC,relevance:0},AF={scope:"number",begin:RC,relevance:0},OF={scope:"number",begin:TC,relevance:0},DF={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[La,{begin:/\[/,end:/\]/,relevance:0,contains:[La]}]},PF={scope:"title",begin:SC,relevance:0},IF={scope:"title",begin:lh,relevance:0},LF={begin:"\\.\\s*"+lh,relevance:0},$F=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();}})},Td=Object.freeze({__proto__:null,APOS_STRING_MODE:CF,BACKSLASH_ESCAPE:La,BINARY_NUMBER_MODE:OF,BINARY_NUMBER_RE:TC,COMMENT:_d,C_BLOCK_COMMENT_MODE:NF,C_LINE_COMMENT_MODE:kF,C_NUMBER_MODE:AF,C_NUMBER_RE:RC,END_SAME_AS_BEGIN:$F,HASH_COMMENT_MODE:_F,IDENT_RE:SC,MATCH_NOTHING_RE:xF,METHOD_GUARD:LF,NUMBER_MODE:MF,NUMBER_RE:CC,PHRASAL_WORDS_MODE:TF,QUOTE_STRING_MODE:RF,REGEXP_MODE:DF,RE_STARTERS_RE:EF,SHEBANG:SF,TITLE_MODE:PF,UNDERSCORE_IDENT_RE:lh,UNDERSCORE_TITLE_MODE:IF});function BF(t,e){t.input[t.index-1]==="."&&e.ignoreMatch();}function FF(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className);}function zF(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=BF,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0));}function HF(t,e){Array.isArray(t.illegal)&&(t.illegal=sh(...t.illegal));}function UF(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 VF(t,e){t.relevance===void 0&&(t.relevance=1);}var KF=(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=pi(n.beforeMatch,xC(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch;},WF=["of","and","for","in","not","or","if","then","parent","list","value"],GF="keyword";function kC(t,e,n=GF){let r=Object.create(null);return typeof t=="string"?o(n,t.split(" ")):Array.isArray(t)?o(n,t):Object.keys(t).forEach(function(i){Object.assign(r,kC(t[i],e,i));}),r;function o(i,s){e&&(s=s.map(a=>a.toLowerCase())),s.forEach(function(a){let l=a.split("|");r[l[0]]=[i,qF(l[0],l[1])];});}}function qF(t,e){return e?Number(e):jF(t)?0:1}function jF(t){return WF.includes(t.toLowerCase())}var hC={},fi=t=>{console.error(t);},gC=(t,...e)=>{console.log(`WARN: ${t}`,...e);},fs=(t,e)=>{hC[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),hC[`${t}/${e}`]=!0);},Nd=new Error;function NC(t,e,{key:n}){let r=0,o=t[n],i={},s={};for(let a=1;a<=e.length;a++)s[a+r]=o[a],i[a+r]=!0,r+=EC(e[a-1]);t[n]=s,t[n]._emit=i,t[n]._multi=!0;}function YF(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw fi("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Nd;if(typeof t.beginScope!="object"||t.beginScope===null)throw fi("beginScope must be object"),Nd;NC(t,t.begin,{key:"beginScope"}),t.begin=ah(t.begin,{joinWith:""});}}function XF(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw fi("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Nd;if(typeof t.endScope!="object"||t.endScope===null)throw fi("endScope must be object"),Nd;NC(t,t.end,{key:"endScope"}),t.end=ah(t.end,{joinWith:""});}}function JF(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope);}function ZF(t){JF(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),YF(t),XF(t);}function QF(t){function e(s,a){return new RegExp(Ia(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+=EC(a)+1;}compile(){this.regexes.length===0&&(this.exec=()=>null);let a=this.regexes.map(l=>l[1]);this.matcherRe=e(ah(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 o(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 i(s,a){let l=s;if(s.isCompiled)return l;[FF,UF,ZF,KF].forEach(d=>d(s,a)),t.compilerExtensions.forEach(d=>d(s,a)),s.__beforeBegin=null,[zF,HF,VF].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=kC(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=Ia(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 e3(d==="self"?s:d)})),s.contains.forEach(function(d){i(d,l);}),s.starts&&i(s.starts,a),l.matcher=o(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=bo(t.classNameAliases||{}),i(t)}function _C(t){return t?t.endsWithParent||_C(t.starts):!1}function e3(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return bo(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:_C(t)?bo(t,{starts:t.starts?bo(t.starts):null}):Object.isFrozen(t)?bo(t):t}var t3="11.11.1",ih=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n;}},nh=wC,bC=bo,yC=Symbol("nomatch"),n3=7,MC=function(t){let e=Object.create(null),n=Object.create(null),r=[],o=!0,i="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:oh};function l(R){return a.noHighlightRe.test(R)}function c(R){let k=R.className+" ";k+=R.parentNode?R.parentNode.className:"";let _=a.languageDetectRe.exec(k);if(_){let A=w(_[1]);return A||(gC(i.replace("{}",_[1])),gC("Falling back to no-highlight mode for this block.",R)),A?_[1]:"no-highlight"}return k.split(/\s+/).find(A=>l(A)||w(A))}function d(R,k,_){let A="",L="";typeof k=="object"?(A=R,_=k.ignoreIllegals,L=k.language):(fs("10.7.0","highlight(lang, code, ...args) has been deprecated."),fs("10.7.0",`Please use highlight(code, options) instead.
|
|
22
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),L=R,A=k),_===void 0&&(_=!0);let Y={code:A,language:L};P("before:highlight",Y);let te=Y.result?Y.result:u(Y.language,Y.code,_);return te.code=Y.code,P("after:highlight",te),te}function u(R,k,_,A){let L=Object.create(null);function Y($,j){return $.keywords[j]}function te(){if(!D.keywords){ce.addText(re);return}let $=0;D.keywordPatternRe.lastIndex=0;let j=D.keywordPatternRe.exec(re),ye="";for(;j;){ye+=re.substring($,j.index);let De=rt.case_insensitive?j[0].toLowerCase():j[0],Rt=Y(D,De);if(Rt){let[$n,Mt]=Rt;if(ce.addText(ye),ye="",L[De]=(L[De]||0)+1,L[De]<=n3&&($t+=Mt),$n.startsWith("_"))ye+=j[0];else {let yr=rt.classNameAliases[$n]||$n;ke(j[0],yr);}}else ye+=j[0];$=D.keywordPatternRe.lastIndex,j=D.keywordPatternRe.exec(re);}ye+=re.substring($),ce.addText(ye);}function Se(){if(re==="")return;let $=null;if(typeof D.subLanguage=="string"){if(!e[D.subLanguage]){ce.addText(re);return}$=u(D.subLanguage,re,!0,ne[D.subLanguage]),ne[D.subLanguage]=$._top;}else $=p(re,D.subLanguage.length?D.subLanguage:null);D.relevance>0&&($t+=$.relevance),ce.__addSublanguage($._emitter,$.language);}function he(){D.subLanguage!=null?Se():te(),re="";}function ke($,j){$!==""&&(ce.startScope(j),ce.addText($),ce.endScope());}function Ae($,j){let ye=1,De=j.length-1;for(;ye<=De;){if(!$._emit[ye]){ye++;continue}let Rt=rt.classNameAliases[$[ye]]||$[ye],$n=j[ye];Rt?ke($n,Rt):(re=$n,te(),re=""),ye++;}}function W($,j){return $.scope&&typeof $.scope=="string"&&ce.openNode(rt.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(ke(re,rt.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),re=""):$.beginScope._multi&&(Ae($.beginScope,j),re="")),D=Object.create($,{parent:{value:D}}),D}function ue($,j,ye){let De=vF($.endRe,ye);if(De){if($["on:end"]){let Rt=new kd($);$["on:end"](j,Rt),Rt.isMatchIgnored&&(De=!1);}if(De){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return ue($.parent,j,ye)}function Oe($){return D.matcher.regexIndex===0?(re+=$[0],1):(G=!0,0)}function Ce($){let j=$[0],ye=$.rule,De=new kd(ye),Rt=[ye.__beforeBegin,ye["on:begin"]];for(let $n of Rt)if($n&&($n($,De),De.isMatchIgnored))return Oe(j);return ye.skip?re+=j:(ye.excludeBegin&&(re+=j),he(),!ye.returnBegin&&!ye.excludeBegin&&(re=j)),W(ye,$),ye.returnBegin?0:j.length}function le($){let j=$[0],ye=k.substring($.index),De=ue(D,$,ye);if(!De)return yC;let Rt=D;D.endScope&&D.endScope._wrap?(he(),ke(j,D.endScope._wrap)):D.endScope&&D.endScope._multi?(he(),Ae(D.endScope,$)):Rt.skip?re+=j:(Rt.returnEnd||Rt.excludeEnd||(re+=j),he(),Rt.excludeEnd&&(re=j));do D.scope&&ce.closeNode(),!D.skip&&!D.subLanguage&&($t+=D.relevance),D=D.parent;while(D!==De.parent);return De.starts&&W(De.starts,$),Rt.returnEnd?0:j.length}function Re(){let $=[];for(let j=D;j!==rt;j=j.parent)j.scope&&$.unshift(j.scope);$.forEach(j=>ce.openNode(j));}let $e={};function Ke($,j){let ye=j&&j[0];if(re+=$,ye==null)return he(),0;if($e.type==="begin"&&j.type==="end"&&$e.index===j.index&&ye===""){if(re+=k.slice(j.index,j.index+1),!o){let De=new Error(`0 width match regex (${R})`);throw De.languageName=R,De.badRule=$e.rule,De}return 1}if($e=j,j.type==="begin")return Ce(j);if(j.type==="illegal"&&!_){let De=new Error('Illegal lexeme "'+ye+'" for mode "'+(D.scope||"<unnamed>")+'"');throw De.mode=D,De}else if(j.type==="end"){let De=le(j);if(De!==yC)return De}if(j.type==="illegal"&&ye==="")return re+=`
|
|
23
|
+
`,1;if(xs>1e5&&xs>j.index*3)throw new Error("potential infinite loop, way more iterations than matches");return re+=ye,ye.length}let rt=w(R);if(!rt)throw fi(i.replace("{}",R)),new Error('Unknown language: "'+R+'"');let Te=QF(rt),wt="",D=A||Te,ne={},ce=new a.__emitter(a);Re();let re="",$t=0,mn=0,xs=0,G=!1;try{if(rt.__emitTokens)rt.__emitTokens(k,ce);else {for(D.matcher.considerAll();;){xs++,G?G=!1:D.matcher.considerAll(),D.matcher.lastIndex=mn;let $=D.matcher.exec(k);if(!$)break;let j=k.substring(mn,$.index),ye=Ke(j,$);mn=$.index+ye;}Ke(k.substring(mn));}return ce.finalize(),wt=ce.toHTML(),{language:R,value:wt,relevance:$t,illegal:!1,_emitter:ce,_top:D}}catch($){if($.message&&$.message.includes("Illegal"))return {language:R,value:nh(k),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:mn,context:k.slice(mn-100,mn+100),mode:$.mode,resultSoFar:wt},_emitter:ce};if(o)return {language:R,value:nh(k),illegal:!1,relevance:0,errorRaised:$,_emitter:ce,_top:D};throw $}}function f(R){let k={value:nh(R),illegal:!1,relevance:0,_top:s,_emitter:new a.__emitter(a)};return k._emitter.addText(R),k}function p(R,k){k=k||a.languages||Object.keys(e);let _=f(R),A=k.filter(w).filter(M).map(he=>u(he,R,!1));A.unshift(_);let L=A.sort((he,ke)=>{if(he.relevance!==ke.relevance)return ke.relevance-he.relevance;if(he.language&&ke.language){if(w(he.language).supersetOf===ke.language)return 1;if(w(ke.language).supersetOf===he.language)return -1}return 0}),[Y,te]=L,Se=Y;return Se.secondBest=te,Se}function m(R,k,_){let A=k&&n[k]||_;R.classList.add("hljs"),R.classList.add(`language-${A}`);}function h(R){let k=null,_=c(R);if(l(_))return;if(P("before:highlightElement",{el:R,language:_}),R.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",R);return}if(R.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(R)),a.throwUnescapedHTML))throw new ih("One of your code blocks includes unescaped HTML.",R.innerHTML);k=R;let A=k.textContent,L=_?d(A,{language:_,ignoreIllegals:!0}):p(A);R.innerHTML=L.value,R.dataset.highlighted="yes",m(R,_,L.language),R.result={language:L.language,re:L.relevance,relevance:L.relevance},L.secondBest&&(R.secondBest={language:L.secondBest.language,relevance:L.secondBest.relevance}),P("after:highlightElement",{el:R,result:L,text:A});}function g(R){a=bC(a,R);}let b=()=>{x(),fs("10.6.0","initHighlighting() deprecated. Use highlightAll() now.");};function y(){x(),fs("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.");}let v=!1;function x(){function R(){x();}if(document.readyState==="loading"){v||window.addEventListener("DOMContentLoaded",R,!1),v=!0;return}document.querySelectorAll(a.cssSelector).forEach(h);}function E(R,k){let _=null;try{_=k(t);}catch(A){if(fi("Language definition for '{}' could not be registered.".replace("{}",R)),o)fi(A);else throw A;_=s;}_.name||(_.name=R),e[R]=_,_.rawDefinition=k.bind(null,t),_.aliases&&N(_.aliases,{languageName:R});}function C(R){delete e[R];for(let k of Object.keys(n))n[k]===R&&delete n[k];}function T(){return Object.keys(e)}function w(R){return R=(R||"").toLowerCase(),e[R]||e[n[R]]}function N(R,{languageName:k}){typeof R=="string"&&(R=[R]),R.forEach(_=>{n[_.toLowerCase()]=k;});}function M(R){let k=w(R);return k&&!k.disableAutodetect}function B(R){R["before:highlightBlock"]&&!R["before:highlightElement"]&&(R["before:highlightElement"]=k=>{R["before:highlightBlock"](Object.assign({block:k.el},k));}),R["after:highlightBlock"]&&!R["after:highlightElement"]&&(R["after:highlightElement"]=k=>{R["after:highlightBlock"](Object.assign({block:k.el},k));});}function U(R){B(R),r.push(R);}function K(R){let k=r.indexOf(R);k!==-1&&r.splice(k,1);}function P(R,k){let _=R;r.forEach(function(A){A[_]&&A[_](k);});}function V(R){return fs("10.7.0","highlightBlock will be removed entirely in v12.0"),fs("10.7.0","Please use highlightElement now."),h(R)}Object.assign(t,{highlight:d,highlightAuto:p,highlightAll:x,highlightElement:h,highlightBlock:V,configure:g,initHighlighting:b,initHighlightingOnLoad:y,registerLanguage:E,unregisterLanguage:C,listLanguages:T,getLanguage:w,registerAliases:N,autoDetection:M,inherit:bC,addPlugin:U,removePlugin:K}),t.debugMode=function(){o=!1;},t.safeMode=function(){o=!0;},t.versionString=t3,t.regex={concat:pi,lookahead:xC,either:sh,optional:bF,anyNumberOfTimes:gF};for(let R in Td)typeof Td[R]=="object"&&vC(Td[R]);return Object.assign(t,Td),t},ps=MC({});ps.newInstance=()=>MC({});AC.exports=ps;ps.HighlightJS=ps;ps.default=ps;});function I(...t){return twMerge(clsx(t))}cva("",{variants:{hover:{lift:["transition-all duration-200 ease-out","hover:-translate-y-0.5","hover:shadow-md"],glow:["transition-all duration-300 ease-out","hover:shadow-lg","hover:shadow-primary/20"],scale:["transition-transform duration-200 ease-out","hover:scale-105","active:scale-95"],brightness:["transition-all duration-200 ease-out","hover:brightness-110","active:brightness-95"],border:["transition-all duration-200 ease-out","hover:border-primary/50"]},focus:{ring:["focus:outline-none","focus-visible:ring-2","focus-visible:ring-primary/50","focus-visible:ring-offset-2"],glow:["focus:outline-none","focus-visible:shadow-lg","focus-visible:shadow-primary/30"],border:["focus:outline-none","focus-visible:border-primary","focus-visible:border-2"]},active:{scale:["active:scale-95","transition-transform duration-100"],darken:["active:brightness-90","transition-all duration-100"],depress:["active:translate-y-0.5","active:shadow-sm","transition-all duration-100"]},cursor:{pointer:"cursor-pointer",grab:"cursor-grab active:cursor-grabbing",text:"cursor-text",wait:"cursor-wait",help:"cursor-help",notAllowed:"cursor-not-allowed"}},defaultVariants:{hover:"lift",focus:"ring",active:"scale",cursor:"pointer"}});var Bn={smooth:{type:"spring",stiffness:260,damping:20},bouncy:{type:"spring",stiffness:300,damping:15},stiff:{type:"spring",stiffness:400,damping:25},gentle:{type:"spring",stiffness:150,damping:15}},nl={lift:{y:-2,transition:Bn.smooth},scale:{scale:1.05,transition:Bn.smooth},glow:{boxShadow:"0 0 20px rgba(var(--primary), 0.3)",transition:Bn.smooth},rotate:{rotate:2,transition:Bn.bouncy}},xg={scale:{scale:.95,transition:{duration:.1}},depress:{y:1,transition:{duration:.1}}};var Eg=cva("rounded-lg border bg-card text-card-foreground shadow-sm dark:shadow-gray-900/20 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-100 transition-all duration-200",{variants:{variant:{default:"",outline:"border border-border shadow-none bg-transparent dark:border-gray-700 dark:bg-transparent dark:text-gray-200",filled:"border-none bg-secondary dark:bg-gray-800 dark:text-gray-100 dark:shadow-inner dark:shadow-gray-950/10",elevated:"border-none shadow-md dark:shadow-lg dark:shadow-gray-900/30 dark:bg-gray-850 dark:text-gray-100",gradient:"border-none bg-gradient-to-br from-primary/5 to-primary/10 dark:from-primary/10 dark:to-primary/20",glass:"border border-white/20 bg-white/10 backdrop-blur-md dark:border-gray-700/30 dark:bg-gray-800/10"},size:{default:"p-6",sm:"p-4",lg:"p-8",xl:"p-10"},radius:{default:"rounded-lg",sm:"rounded-md",lg:"rounded-xl",full:"rounded-3xl",none:"rounded-none"},interactive:{true:"cursor-pointer hover:shadow-lg hover:border-primary/20 dark:hover:border-primary/30 hover:-translate-y-0.5 active:translate-y-0 active:shadow-sm",false:""}},defaultVariants:{variant:"default",size:"default",radius:"default"}}),vr=ee.forwardRef(({className:t,variant:e,size:n,radius:r,interactive:o,microInteraction:i="lift",...s},a)=>{if(o&&i!=="none"){let l={whileHover:i==="scale"?nl.scale:i==="glow"?nl.glow:nl.lift,whileTap:xg.scale};return jsx(motion.div,{ref:a,className:I(Eg({variant:e,size:n,radius:r,interactive:o,className:t})),...l,...s})}return jsx("div",{ref:a,className:I(Eg({variant:e,size:n,radius:r,interactive:o,className:t})),...s})});vr.displayName="Card";var Ss=ee.forwardRef(({className:t,...e},n)=>jsx("div",{ref:n,className:I("flex flex-col space-y-1.5",t),...e}));Ss.displayName="CardHeader";var Cs=ee.forwardRef(({className:t,...e},n)=>jsx("h3",{ref:n,className:I("text-lg font-semibold leading-none tracking-tight",t),...e}));Cs.displayName="CardTitle";var Rs=ee.forwardRef(({className:t,...e},n)=>jsx("p",{ref:n,className:I("text-sm text-muted-foreground",t),...e}));Rs.displayName="CardDescription";var wr=ee.forwardRef(({className:t,...e},n)=>jsx("div",{ref:n,className:I("pt-0",t),...e}));wr.displayName="CardContent";var bN=ee.forwardRef(({className:t,...e},n)=>jsx("div",{ref:n,className:I("flex items-center pt-4",t),...e}));bN.displayName="CardFooter";var wN=cva(["inline-flex items-center justify-center gap-2 whitespace-nowrap","font-medium relative","transition-all duration-200 ease-out","premium-hover","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none"],{variants:{variant:{primary:["bg-primary text-primary-foreground","hover:bg-primary-hover dark:hover:bg-primary/90","active:bg-primary-active dark:active:bg-primary/80","shadow-sm dark:shadow-primary/20 dark:shadow-md","focus-visible:ring-primary/50 dark:focus-visible:ring-primary/30","dark:bg-primary dark:text-white","transition-all duration-200"],secondary:["bg-secondary text-secondary-foreground","hover:bg-gray-200 dark:hover:bg-gray-700/90","active:bg-gray-300 dark:active:bg-gray-600/90","border border-transparent dark:border-gray-700","focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40","dark:bg-gray-800 dark:text-gray-100","dark:shadow-sm dark:shadow-gray-900/20"],outline:["bg-background text-foreground","border border-gray-300 dark:border-gray-700","hover:border-gray-400 dark:hover:border-gray-500","hover:bg-gray-50 dark:hover:bg-gray-800/80","active:bg-gray-100 dark:active:bg-gray-800/90","focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40","dark:text-gray-200 dark:bg-gray-900/50","dark:shadow-sm dark:shadow-gray-950/10"],ghost:["text-foreground","hover:bg-gray-100 dark:hover:bg-gray-800/90","active:bg-gray-200 dark:active:bg-gray-700/90","focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40","dark:text-gray-200","transition-colors duration-200"],destructive:["bg-error text-white","hover:bg-error/90 dark:hover:bg-error/80","active:bg-error/80 dark:active:bg-error/70","shadow-sm dark:shadow-error/10 dark:shadow-md","focus-visible:ring-error/50 dark:focus-visible:ring-error/30","dark:text-white dark:border-error/20","transition-colors duration-200"],success:["bg-success text-white","hover:bg-success/90 dark:hover:bg-success/80","active:bg-success/80 dark:active:bg-success/70","shadow-sm dark:shadow-success/10 dark:shadow-md","focus-visible:ring-success/50 dark:focus-visible:ring-success/30","dark:text-white dark:border-success/20","transition-colors duration-200"],link:["text-primary bg-transparent","underline-offset-4 hover:underline","hover:text-primary-hover active:text-primary-active","p-0 h-auto","dark:text-blue-400 dark:hover:text-blue-300","dark:active:text-blue-500","transition-colors duration-200"],gradient:["bg-gradient-to-r from-blue-600 to-purple-600 text-white","hover:from-blue-700 hover:to-purple-700","active:from-blue-800 active:to-purple-800","shadow-lg shadow-purple-500/25","focus-visible:ring-purple-500/50","transition-all duration-300"],glow:["bg-primary text-primary-foreground","shadow-lg shadow-primary/50","hover:shadow-xl hover:shadow-primary/60","active:shadow-md active:shadow-primary/40","focus-visible:ring-primary/50","transition-all duration-300"],soft:["bg-primary/10 text-primary","hover:bg-primary/20","active:bg-primary/30","focus-visible:ring-primary/50","dark:bg-primary/20 dark:text-primary-foreground","dark:hover:bg-primary/30 dark:active:bg-primary/40","transition-colors duration-200"],glass:["bg-white/10 backdrop-blur-md text-foreground","border border-white/20","hover:bg-white/20 hover:border-white/30","active:bg-white/30","shadow-lg","focus-visible:ring-white/50","dark:bg-gray-800/10 dark:border-gray-700/20","dark:hover:bg-gray-800/20 dark:hover:border-gray-700/30","transition-all duration-200"],neon:["bg-transparent text-primary","border-2 border-primary","hover:bg-primary hover:text-primary-foreground","hover:shadow-[0_0_20px_rgba(var(--primary),0.5)]","active:shadow-[0_0_10px_rgba(var(--primary),0.3)]","focus-visible:ring-primary/50","transition-all duration-300"]},size:{xs:"h-7 px-2.5 text-xs rounded",sm:"h-8 px-3 text-sm rounded",md:"h-10 px-4 text-base rounded-md",lg:"h-12 px-6 text-lg rounded-lg",xl:"h-14 px-8 text-xl rounded-lg",icon:"h-10 w-10 p-2 rounded-md","icon-sm":"h-8 w-8 p-1.5 rounded","icon-lg":"h-12 w-12 p-3 rounded-lg"},rounded:{default:"",full:"rounded-full",none:"rounded-none"},fullWidth:{true:"w-full"}},defaultVariants:{variant:"primary",size:"md",rounded:"default",fullWidth:!1}}),xe=ee.forwardRef(({className:t,variant:e,size:n,rounded:r,fullWidth:o,asChild:i=!1,loading:s=!1,leftIcon:a,rightIcon:l,children:c,disabled:d,...u},f)=>jsxs("button",{className:I(wN({variant:e,size:n,rounded:r,fullWidth:o,className:t})),ref:f,disabled:d||s,"data-loading":s?"":void 0,...u,children:[s&&jsx(Loader2,{className:"w-4 h-4 animate-spin","aria-hidden":"true"}),!s&&a,c,!s&&l]}));xe.displayName="Button";var CN=cva(["inline-flex items-center gap-1.5","font-medium transition-colors duration-200","border focus:outline-none","focus-visible:ring-2 focus-visible:ring-offset-1"],{variants:{variant:{primary:["border-transparent bg-primary text-primary-foreground","hover:bg-primary-hover dark:hover:bg-primary/90","focus-visible:ring-primary/30 dark:focus-visible:ring-primary/40","dark:bg-primary/90 dark:text-white dark:shadow-inner dark:shadow-primary/10"],secondary:["border-transparent bg-secondary text-secondary-foreground","hover:bg-gray-200 dark:hover:bg-gray-700/90","focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40","dark:bg-gray-800 dark:text-gray-100 dark:shadow-inner dark:shadow-gray-950/10"],outline:["border-gray-200 dark:border-gray-700","bg-transparent text-foreground","hover:border-gray-300 dark:hover:border-gray-600","focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40","dark:text-gray-200 dark:bg-transparent dark:backdrop-blur-sm"],destructive:["border-transparent bg-error text-white","hover:bg-error/90 dark:hover:bg-error/80","focus-visible:ring-error/30 dark:focus-visible:ring-error/25","dark:bg-error/90 dark:text-white dark:shadow-inner dark:shadow-error/10"],success:["border-transparent bg-success text-white","hover:bg-success/90 dark:hover:bg-success/80","focus-visible:ring-success/30 dark:focus-visible:ring-success/25","dark:bg-success/90 dark:text-white dark:shadow-inner dark:shadow-success/10"],warning:["border-transparent bg-warning text-white","hover:bg-warning/90 dark:hover:bg-warning/80","focus-visible:ring-warning/30 dark:focus-visible:ring-warning/25","dark:bg-warning/90 dark:text-gray-900 dark:shadow-inner dark:shadow-warning/10"],ghost:["border-transparent bg-transparent text-foreground","hover:bg-gray-100 dark:hover:bg-gray-800/80","focus-visible:ring-gray-400/30 dark:focus-visible:ring-gray-500/40","dark:text-gray-200 dark:backdrop-blur-sm","transition-colors duration-200"],pro:["border-transparent bg-gradient-to-r from-purple-600 to-pink-600 text-white","hover:from-purple-700 hover:to-pink-700","focus-visible:ring-purple-400/30 dark:focus-visible:ring-purple-500/40","shadow-md dark:shadow-lg dark:shadow-purple-500/10"],admin:["border-transparent bg-gradient-to-r from-purple-600 to-pink-600 text-white","hover:from-purple-700 hover:to-pink-700","focus-visible:ring-purple-400/30 dark:focus-visible:ring-purple-500/40","shadow-md dark:shadow-lg dark:shadow-purple-500/10"]},size:{sm:"h-5 px-2 text-xs",md:"h-6 px-3 text-sm",lg:"h-8 px-4 text-base"},radius:{default:"rounded-full",sm:"rounded-md",lg:"rounded-xl",none:"rounded-none"}},defaultVariants:{variant:"primary",size:"md",radius:"default"}});function Ts({className:t,variant:e,size:n,radius:r,withDot:o,dotColor:i,removable:s,onRemove:a,leftIcon:l,rightIcon:c,children:d,...u}){let f=l,p=d;return e==="pro"&&(f=l||jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",children:[jsx("path",{d:"M12 0L13.09 8.26L22 9L13.09 9.74L12 18L10.91 9.74L2 9L10.91 8.26L12 0Z",fill:"currentColor"}),jsx("path",{d:"M19 5L19.5 7L21 7.5L19.5 8L19 10L18.5 8L17 7.5L18.5 7L19 5Z",fill:"currentColor"}),jsx("path",{d:"M19 15L19.5 17L21 17.5L19.5 18L19 20L18.5 18L17 17.5L18.5 17L19 15Z",fill:"currentColor"})]}),p=d||"Pro"),e==="admin"&&(f=l||jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-3 h-3",children:jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",fill:"currentColor"})}),p=d||"Admin Pro"),jsxs("div",{className:I(CN({variant:e,size:n,radius:r}),t),"data-removable":s?"":void 0,...u,children:[o&&jsx("span",{className:I("h-2 w-2 rounded-full",i||(e==="destructive"||e==="success"||e==="warning"?"bg-white":e==="secondary"?"bg-secondary-foreground":e==="outline"||e==="ghost"?"bg-foreground":e==="pro"||e==="admin"?"bg-white":"bg-primary-foreground")),"aria-hidden":"true"}),f&&jsx("span",{className:"inline-flex shrink-0",children:f}),jsx("span",{className:"truncate",children:p}),c&&jsx("span",{className:"inline-flex shrink-0",children:c}),s&&a&&jsx("button",{type:"button",className:"ml-1 -mr-1 h-3.5 w-3.5 rounded-full inline-flex items-center justify-center hover:bg-black/10 dark:hover:bg-white/10",onClick:m=>{m.stopPropagation(),a();},"aria-label":"Remove badge",children:jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"opacity-70","aria-hidden":"true",children:jsx("path",{d:"M0.799988 7.19999L7.19999 0.799988M0.799988 0.799988L7.19999 7.19999",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function wi(){return {isLoading:!1,isAuthenticated:!0,isAdmin:!1,hasProAccess:!0,subscriptionPlan:"pro",subscription:{status:"active",plan:"pro"}}}var RN=cva("group relative flex items-center w-full transition-colors",{variants:{size:{sm:"",md:"",lg:""}},defaultVariants:{size:"md"}}),TN=cva(["w-full bg-background transition-all duration-200","text-foreground placeholder:text-muted-foreground dark:placeholder:text-gray-500","disabled:cursor-not-allowed disabled:opacity-50","file:border-0 file:bg-transparent file:font-medium","focus-visible:outline-none dark:text-gray-200"],{variants:{variant:{standard:"border border-gray-300 dark:border-gray-700 rounded-md px-3 py-2 hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:bg-gray-900/60 dark:shadow-inner dark:shadow-gray-950/10",filled:"border border-transparent bg-gray-100 dark:bg-gray-800/90 rounded-md px-3 py-2 hover:bg-gray-200 dark:hover:bg-gray-700/90 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/20 dark:shadow-inner dark:shadow-gray-950/10",ghost:"border-none bg-transparent shadow-none px-1 dark:text-gray-300 dark:placeholder:text-gray-500 hover:bg-gray-100/50 dark:hover:bg-gray-800/30 focus-visible:bg-transparent",underline:"border-t-0 border-l-0 border-r-0 border-b border-gray-300 dark:border-gray-600 rounded-none px-0 py-2 hover:border-gray-400 dark:hover:border-gray-500 focus-visible:ring-0 focus-visible:border-b-2 focus-visible:border-primary dark:focus-visible:border-primary/80 dark:text-gray-300"},size:{sm:"h-8 text-xs",md:"h-10 text-sm",lg:"h-12 text-base"},hasLeftIcon:{true:"pl-10",false:""},hasRightIcon:{true:"pr-10",false:""},hasRightButton:{true:"pr-10",false:""},isError:{true:"border-error focus-visible:ring-error/30 focus-visible:border-error hover:border-error/80 dark:hover:border-error/80",false:""},isSuccess:{true:"border-success focus-visible:ring-success/30 focus-visible:border-success hover:border-success/80 dark:hover:border-success/80",false:""},isDisabled:{true:"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-800/50 pointer-events-none",false:""}},defaultVariants:{variant:"standard",size:"md",isError:!1,isSuccess:!1,isDisabled:!1,hasLeftIcon:!1,hasRightIcon:!1,hasRightButton:!1}}),Ft=ee.forwardRef(({className:t,wrapperClassName:e,messageClassName:n,variant:r,size:o,isError:i,disabled:s,error:a,success:l,loading:c,leftIcon:d,rightIcon:u,rightButton:f,alwaysShowMessage:p=!1,...m},h)=>{let g=p||a||l,b=a?"error":l?"success":"normal";return jsxs("div",{className:"space-y-1.5 w-full",children:[jsxs("div",{className:I(RN({size:o}),e),children:[d&&jsx("div",{className:"absolute left-3 text-gray-500 flex items-center justify-center pointer-events-none",children:c?jsx(Loader2,{className:"h-4 w-4 animate-spin"}):d}),jsx("input",{className:I(TN({variant:r,size:o,isError:!!a||i,isSuccess:!!l,isDisabled:s||c,hasLeftIcon:!!d||c,hasRightIcon:!!u,hasRightButton:!!f}),t),ref:h,disabled:s||c,"data-loading":c?"":void 0,"data-error":a?"":void 0,"data-success":l?"":void 0,"aria-invalid":!!a||!!i||void 0,"aria-describedby":a?`${m.id||""}-error`:l?`${m.id||""}-success`:void 0,...m}),u&&!c&&jsx("div",{className:"absolute right-3 text-gray-500 flex items-center justify-center pointer-events-none",children:u}),f&&jsx("div",{className:"absolute right-3",children:f}),c&&!d&&jsx("div",{className:"absolute left-3 text-gray-500 flex items-center justify-center pointer-events-none",children:jsx(Loader2,{className:"h-4 w-4 animate-spin","aria-hidden":"true"})})]}),g&&jsx("p",{className:I("text-xs transition-all",b==="error"&&"text-error",b==="success"&&"text-success",b==="normal"&&"text-muted-foreground",n),id:a?`${m.id||""}-error`:l?`${m.id||""}-success`:void 0,children:a||l||""})]})});Ft.displayName="Input";function _g(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e);}function Ro(...t){return e=>{let n=!1,r=t.map(o=>{let i=_g(o,e);return !n&&typeof i=="function"&&(n=!0),i});if(n)return ()=>{for(let o=0;o<r.length;o++){let i=r[o];typeof i=="function"?i():_g(t[o],null);}}}}function Le(...t){return ee.useCallback(Ro(...t),t)}function Fn(t){let e=kN(t),n=ee.forwardRef((r,o)=>{let{children:i,...s}=r,a=ee.Children.toArray(i),l=a.find(_N);if(l){let c=l.props.children,d=a.map(u=>u===l?ee.Children.count(c)>1?ee.Children.only(null):ee.isValidElement(c)?c.props.children:null:u);return jsx(e,{...s,ref:o,children:ee.isValidElement(c)?ee.cloneElement(c,void 0,d):null})}return jsx(e,{...s,ref:o,children:i})});return n.displayName=`${t}.Slot`,n}function kN(t){let e=ee.forwardRef((n,r)=>{let{children:o,...i}=n;if(ee.isValidElement(o)){let s=AN(o),a=MN(i,o.props);return o.type!==ee.Fragment&&(a.ref=r?Ro(r,s):s),ee.cloneElement(o,a)}return ee.Children.count(o)>1?ee.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var NN=Symbol("radix.slottable");function _N(t){return ee.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===NN}function MN(t,e){let n={...e};for(let r in e){let o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{let l=i(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "));}return {...t,...n}}function AN(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var DN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fe=DN.reduce((t,e)=>{let n=Fn(`Primitive.${e}`),r=ee.forwardRef((o,i)=>{let{asChild:s,...a}=o,l=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function xi(t,e){t&&Dg.flushSync(()=>t.dispatchEvent(e));}var IN="Label",Ig=ee.forwardRef((t,e)=>jsx(fe.label,{...t,ref:e,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault());}}));Ig.displayName=IN;var cu=Ig;var BN=cva("text-sm font-medium leading-none text-gray-900 dark:text-gray-200 peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:peer-disabled:opacity-60 transition-colors duration-200"),He=ee.forwardRef(({className:t,...e},n)=>jsx(cu,{ref:n,className:I(BN(),t),...e}));He.displayName=cu.displayName;var du=ee__default.forwardRef(({className:t,...e},n)=>jsx("textarea",{className:I("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));du.displayName="Textarea";function pe(){return pe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r]);}return t},pe.apply(null,arguments)}function uu(t,[e,n]){return Math.min(n,Math.max(e,t))}function ht(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function Ei(t,e=[]){let n=[];function r(i,s){let a=createContext(s),l=n.length;n=[...n,s];function c(u){let{scope:f,children:p,...m}=u,h=f?.[t][l]||a,g=useMemo(()=>m,Object.values(m));return createElement(h.Provider,{value:g},p)}function d(u,f){let p=f?.[t][l]||a,m=useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${u}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,d]}let o=()=>{let i=n.map(s=>createContext(s));return function(a){let l=a?.[t]||i;return useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,KN(o,...e)]}function KN(...t){let e=t[0];if(t.length===1)return e;let n=()=>{let r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let s=r.reduce((a,{useScope:l,scopeName:c})=>{let u=l(i)[`__scope${c}`];return {...a,...u}},{});return useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function GN(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e);}function pu(...t){return e=>t.forEach(n=>GN(n,e))}function dt(...t){return useCallback(pu(...t),t)}var Yr=forwardRef((t,e)=>{let{children:n,...r}=t,o=Children.toArray(n),i=o.find(YN);if(i){let s=i.props.children,a=o.map(l=>l===i?Children.count(s)>1?Children.only(null):isValidElement(s)?s.props.children:null:l);return createElement(hu,pe({},r,{ref:e}),isValidElement(s)?cloneElement(s,void 0,a):null)}return createElement(hu,pe({},r,{ref:e}),n)});Yr.displayName="Slot";var hu=forwardRef((t,e)=>{let{children:n,...r}=t;return isValidElement(n)?cloneElement(n,{...XN(r,n.props),ref:e?pu(e,n.ref):n.ref}):Children.count(n)>1?Children.only(null):null});hu.displayName="SlotClone";var jN=({children:t})=>createElement(Fragment,null,t);function YN(t){return isValidElement(t)&&t.type===jN}function XN(t,e){let n={...e};for(let r in e){let o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a);}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "));}return {...t,...n}}function zg(t){let e=t+"CollectionProvider",[n,r]=Ei(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{let{scope:m,children:h}=p,g=ee__default.useRef(null),b=ee__default.useRef(new Map).current;return ee__default.createElement(o,{scope:m,itemMap:b,collectionRef:g},h)},a=t+"CollectionSlot",l=ee__default.forwardRef((p,m)=>{let{scope:h,children:g}=p,b=i(a,h),y=dt(m,b.collectionRef);return ee__default.createElement(Yr,{ref:y},g)}),c=t+"CollectionItemSlot",d="data-radix-collection-item",u=ee__default.forwardRef((p,m)=>{let{scope:h,children:g,...b}=p,y=ee__default.useRef(null),v=dt(m,y),x=i(c,h);return ee__default.useEffect(()=>(x.itemMap.set(y,{ref:y,...b}),()=>void x.itemMap.delete(y))),ee__default.createElement(Yr,{[d]:"",ref:v},g)});function f(p){let m=i(t+"CollectionConsumer",p);return ee__default.useCallback(()=>{let g=m.collectionRef.current;if(!g)return [];let b=Array.from(g.querySelectorAll(`[${d}]`));return Array.from(m.itemMap.values()).sort((x,E)=>b.indexOf(x.ref.current)-b.indexOf(E.ref.current))},[m.collectionRef,m.itemMap])}return [{Provider:s,Slot:l,ItemSlot:u},f,r]}var QN=createContext(void 0);function Hg(t){let e=useContext(QN);return t||e||"ltr"}var o_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ut=o_.reduce((t,e)=>{let n=forwardRef((r,o)=>{let{asChild:i,...s}=r,a=i?Yr:e;return useEffect(()=>{window[Symbol.for("radix-ui")]=!0;},[]),createElement(a,pe({},s,{ref:o}))});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function Ug(t,e){t&&flushSync(()=>t.dispatchEvent(e));}function Yt(t){let e=useRef(t);return useEffect(()=>{e.current=t;}),useMemo(()=>(...n)=>{var r;return (r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function Vg(t,e=globalThis?.document){let n=Yt(t);useEffect(()=>{let r=o=>{o.key==="Escape"&&n(o);};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[n,e]);}var bu="dismissableLayer.update",p_="dismissableLayer.pointerDownOutside",m_="dismissableLayer.focusOutside",Wg,h_=createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qg=forwardRef((t,e)=>{var n;let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=t,d=useContext(h_),[u,f]=useState(null),p=(n=u?.ownerDocument)!==null&&n!==void 0?n:globalThis?.document,[,m]=useState({}),h=dt(e,w=>f(w)),g=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(b),v=u?g.indexOf(u):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,E=v>=y,C=g_(w=>{let N=w.target,M=[...d.branches].some(B=>B.contains(N));!E||M||(i?.(w),a?.(w),w.defaultPrevented||l?.());},p),T=b_(w=>{let N=w.target;[...d.branches].some(B=>B.contains(N))||(s?.(w),a?.(w),w.defaultPrevented||l?.());},p);return Vg(w=>{v===d.layers.size-1&&(o?.(w),!w.defaultPrevented&&l&&(w.preventDefault(),l()));},p),useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Wg=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),Gg(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Wg);}},[u,p,r,d]),useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),Gg());},[u,d]),useEffect(()=>{let w=()=>m({});return document.addEventListener(bu,w),()=>document.removeEventListener(bu,w)},[]),createElement(ut.div,pe({},c,{ref:h,style:{pointerEvents:x?E?"auto":"none":void 0,...t.style},onFocusCapture:ht(t.onFocusCapture,T.onFocusCapture),onBlurCapture:ht(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:ht(t.onPointerDownCapture,C.onPointerDownCapture)}))});function g_(t,e=globalThis?.document){let n=Yt(t),r=useRef(!1),o=useRef(()=>{});return useEffect(()=>{let i=a=>{if(a.target&&!r.current){let c=function(){jg(p_,n,l,{discrete:!0});},l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=c,e.addEventListener("click",o.current,{once:!0})):c();}r.current=!1;},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i);},0);return ()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current);}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function b_(t,e=globalThis?.document){let n=Yt(t),r=useRef(!1);return useEffect(()=>{let o=i=>{i.target&&!r.current&&jg(m_,n,{originalEvent:i},{discrete:!1});};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Gg(){let t=new CustomEvent(bu);document.dispatchEvent(t);}function jg(t,e,n,{discrete:r}){let o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?Ug(o,i):o.dispatchEvent(i);}var yu=0;function Xg(){useEffect(()=>{var t,e;let n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=n[0])!==null&&t!==void 0?t:Yg()),document.body.insertAdjacentElement("beforeend",(e=n[1])!==null&&e!==void 0?e:Yg()),yu++,()=>{yu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),yu--;}},[]);}function Yg(){let t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}var vu="focusScope.autoFocusOnMount",wu="focusScope.autoFocusOnUnmount",Qg={bubbles:!1,cancelable:!0};var rb=forwardRef((t,e)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=t,[a,l]=useState(null),c=Yt(o),d=Yt(i),u=useRef(null),f=dt(e,h=>l(h)),p=useRef({paused:!1,pause(){this.paused=!0;},resume(){this.paused=!1;}}).current;useEffect(()=>{if(r){let h=function(v){if(p.paused||!a)return;let x=v.target;a.contains(x)?u.current=x:Xr(u.current,{select:!0});},g=function(v){if(p.paused||!a)return;let x=v.relatedTarget;x!==null&&(a.contains(x)||Xr(u.current,{select:!0}));},b=function(v){let x=document.activeElement;for(let E of v)E.removedNodes.length>0&&(a!=null&&a.contains(x)||Xr(a));};document.addEventListener("focusin",h),document.addEventListener("focusout",g);let y=new MutationObserver(b);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",g),y.disconnect();}}},[r,a,p.paused]),useEffect(()=>{if(a){tb.add(p);let h=document.activeElement;if(!a.contains(h)){let b=new CustomEvent(vu,Qg);a.addEventListener(vu,c),a.dispatchEvent(b),b.defaultPrevented||(S_(N_(ob(a)),{select:!0}),document.activeElement===h&&Xr(a));}return ()=>{a.removeEventListener(vu,c),setTimeout(()=>{let b=new CustomEvent(wu,Qg);a.addEventListener(wu,d),a.dispatchEvent(b),b.defaultPrevented||Xr(h??document.body,{select:!0}),a.removeEventListener(wu,d),tb.remove(p);},0);}}},[a,c,d,p]);let m=useCallback(h=>{if(!n&&!r||p.paused)return;let g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(g&&b){let y=h.currentTarget,[v,x]=C_(y);v&&x?!h.shiftKey&&b===x?(h.preventDefault(),n&&Xr(v,{select:!0})):h.shiftKey&&b===v&&(h.preventDefault(),n&&Xr(x,{select:!0})):b===y&&h.preventDefault();}},[n,r,p.paused]);return createElement(ut.div,pe({tabIndex:-1},s,{ref:f,onKeyDown:m}))});function S_(t,{select:e=!1}={}){let n=document.activeElement;for(let r of t)if(Xr(r,{select:e}),document.activeElement!==n)return}function C_(t){let e=ob(t),n=eb(e,t),r=eb(e.reverse(),t);return [n,r]}function ob(t){let e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{let o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function eb(t,e){for(let n of t)if(!R_(n,{upTo:e}))return n}function R_(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return !0;for(;t;){if(e!==void 0&&t===e)return !1;if(getComputedStyle(t).display==="none")return !0;t=t.parentElement;}return !1}function T_(t){return t instanceof HTMLInputElement&&"select"in t}function Xr(t,{select:e=!1}={}){if(t&&t.focus){let n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&T_(t)&&e&&t.select();}}var tb=k_();function k_(){let t=[];return {add(e){let n=t[0];e!==n&&n?.pause(),t=nb(t,e),t.unshift(e);},remove(e){var n;t=nb(t,e),(n=t[0])===null||n===void 0||n.resume();}}}function nb(t,e){let n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function N_(t){return t.filter(e=>e.tagName!=="A")}var zt=globalThis?.document?useLayoutEffect:()=>{};var M_=ee["useId".toString()]||(()=>{}),A_=0;function Eu(t){let[e,n]=ee.useState(M_());return zt(()=>{t||n(r=>r??String(A_++));},[t]),t||(e?`radix-${e}`:"")}var ab=["top","right","bottom","left"];var Xn=Math.min,Xt=Math.max,Ms=Math.round,As=Math.floor,zn=t=>({x:t,y:t}),O_={left:"right",right:"left",bottom:"top",top:"bottom"},D_={start:"end",end:"start"};function il(t,e,n){return Xt(t,Xn(e,n))}function Jn(t,e){return typeof t=="function"?t(e):t}function Zn(t){return t.split("-")[0]}function To(t){return t.split("-")[1]}function sl(t){return t==="x"?"y":"x"}function al(t){return t==="y"?"height":"width"}var P_=new Set(["top","bottom"]);function Hn(t){return P_.has(Zn(t))?"y":"x"}function ll(t){return sl(Hn(t))}function lb(t,e,n){n===void 0&&(n=!1);let r=To(t),o=ll(t),i=al(o),s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=_s(s)),[s,_s(s)]}function cb(t){let e=_s(t);return [ol(t),e,ol(e)]}function ol(t){return t.replace(/start|end/g,e=>D_[e])}var ib=["left","right"],sb=["right","left"],I_=["top","bottom"],L_=["bottom","top"];function $_(t,e,n){switch(t){case"top":case"bottom":return n?e?sb:ib:e?ib:sb;case"left":case"right":return e?I_:L_;default:return []}}function db(t,e,n,r){let o=To(t),i=$_(Zn(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(ol)))),i}function _s(t){return t.replace(/left|right|bottom|top/g,e=>O_[e])}function B_(t){return {top:0,right:0,bottom:0,left:0,...t}}function Su(t){return typeof t!="number"?B_(t):{top:t,right:t,bottom:t,left:t}}function ko(t){let{x:e,y:n,width:r,height:o}=t;return {width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function ub(t,e,n){let{reference:r,floating:o}=t,i=Hn(e),s=ll(e),a=al(s),l=Zn(e),c=i==="y",d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2,p;switch(l){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y};}switch(To(e)){case"start":p[s]-=f*(n&&c?-1:1);break;case"end":p[s]+=f*(n&&c?-1:1);break}return p}var mb=async(t,e,n)=>{let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e)),c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:d,y:u}=ub(c,r,l),f=r,p={},m=0;for(let h=0;h<a.length;h++){let{name:g,fn:b}=a[h],{x:y,y:v,data:x,reset:E}=await b({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:s,elements:{reference:t,floating:e}});d=y??d,u=v??u,p={...p,[g]:{...p[g],...x}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):E.rects),{x:d,y:u}=ub(c,f,l)),h=-1);}return {x:d,y:u,placement:f,strategy:o,middlewareData:p}};async function Si(t,e){var n;e===void 0&&(e={});let{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Jn(e,t),m=Su(p),g=a[f?u==="floating"?"reference":"floating":u],b=ko(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(g)))==null||n?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),y=u==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},E=ko(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:l}):y);return {top:(b.top-E.top+m.top)/x.y,bottom:(E.bottom-b.bottom+m.bottom)/x.y,left:(b.left-E.left+m.left)/x.x,right:(E.right-b.right+m.right)/x.x}}var hb=t=>({name:"arrow",options:t,async fn(e){let{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=Jn(t,e)||{};if(c==null)return {};let u=Su(d),f={x:n,y:r},p=ll(o),m=al(p),h=await s.getDimensions(c),g=p==="y",b=g?"top":"left",y=g?"bottom":"right",v=g?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-f[p]-i.floating[m],E=f[p]-i.reference[p],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),T=C?C[v]:0;(!T||!await(s.isElement==null?void 0:s.isElement(C)))&&(T=a.floating[v]||i.floating[m]);let w=x/2-E/2,N=T/2-h[m]/2-1,M=Xn(u[b],N),B=Xn(u[y],N),U=M,K=T-h[m]-B,P=T/2-h[m]/2+w,V=il(U,P,K),R=!l.arrow&&To(o)!=null&&P!==V&&i.reference[m]/2-(P<U?M:B)-h[m]/2<0,k=R?P<U?P-U:P-K:0;return {[p]:f[p]+k,data:{[p]:V,centerOffset:P-V-k,...R&&{alignmentOffset:k}},reset:R}}});var gb=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;let{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=Jn(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return {};let b=Zn(o),y=Hn(a),v=Zn(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=f||(v||!h?[_s(a)]:cb(a)),C=m!=="none";!f&&C&&E.push(...db(a,h,m,x));let T=[a,...E],w=await Si(e,g),N=[],M=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&N.push(w[b]),u){let P=lb(o,s,x);N.push(w[P[0]],w[P[1]]);}if(M=[...M,{placement:o,overflows:N}],!N.every(P=>P<=0)){var B,U;let P=(((B=i.flip)==null?void 0:B.index)||0)+1,V=T[P];if(V&&(!(u==="alignment"?y!==Hn(V):!1)||M.every(_=>_.overflows[0]>0&&Hn(_.placement)===y)))return {data:{index:P,overflows:M},reset:{placement:V}};let R=(U=M.filter(k=>k.overflows[0]<=0).sort((k,_)=>k.overflows[1]-_.overflows[1])[0])==null?void 0:U.placement;if(!R)switch(p){case"bestFit":{var K;let k=(K=M.filter(_=>{if(C){let A=Hn(_.placement);return A===y||A==="y"}return !0}).map(_=>[_.placement,_.overflows.filter(A=>A>0).reduce((A,L)=>A+L,0)]).sort((_,A)=>_[1]-A[1])[0])==null?void 0:K[0];k&&(R=k);break}case"initialPlacement":R=a;break}if(o!==R)return {reset:{placement:R}}}return {}}}};function fb(t,e){return {top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function pb(t){return ab.some(e=>t[e]>=0)}var bb=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n}=e,{strategy:r="referenceHidden",...o}=Jn(t,e);switch(r){case"referenceHidden":{let i=await Si(e,{...o,elementContext:"reference"}),s=fb(i,n.reference);return {data:{referenceHiddenOffsets:s,referenceHidden:pb(s)}}}case"escaped":{let i=await Si(e,{...o,altBoundary:!0}),s=fb(i,n.floating);return {data:{escapedOffsets:s,escaped:pb(s)}}}default:return {}}}}};var yb=new Set(["left","top"]);async function F_(t,e){let{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Zn(n),a=To(n),l=Hn(n)==="y",c=yb.has(s)?-1:1,d=i&&l?-1:1,u=Jn(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}var vb=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;let{x:o,y:i,placement:s,middlewareData:a}=e,l=await F_(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},wb=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:b,y}=g;return {x:b,y}}},...l}=Jn(t,e),c={x:n,y:r},d=await Si(e,l),u=Hn(Zn(o)),f=sl(u),p=c[f],m=c[u];if(i){let g=f==="y"?"top":"left",b=f==="y"?"bottom":"right",y=p+d[g],v=p-d[b];p=il(y,p,v);}if(s){let g=u==="y"?"top":"left",b=u==="y"?"bottom":"right",y=m+d[g],v=m-d[b];m=il(y,m,v);}let h=a.fn({...e,[f]:p,[u]:m});return {...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:i,[u]:s}}}}}},xb=function(t){return t===void 0&&(t={}),{options:t,fn(e){let{x:n,y:r,placement:o,rects:i,middlewareData:s}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Jn(t,e),d={x:n,y:r},u=Hn(o),f=sl(u),p=d[f],m=d[u],h=Jn(a,e),g=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){let v=f==="y"?"height":"width",x=i.reference[f]-i.floating[v]+g.mainAxis,E=i.reference[f]+i.reference[v]-g.mainAxis;p<x?p=x:p>E&&(p=E);}if(c){var b,y;let v=f==="y"?"width":"height",x=yb.has(Zn(o)),E=i.reference[u]-i.floating[v]+(x&&((b=s.offset)==null?void 0:b[u])||0)+(x?0:g.crossAxis),C=i.reference[u]+i.reference[v]+(x?0:((y=s.offset)==null?void 0:y[u])||0)-(x?g.crossAxis:0);m<E?m=E:m>C&&(m=C);}return {[f]:p,[u]:m}}}},Eb=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;let{placement:o,rects:i,platform:s,elements:a}=e,{apply:l=()=>{},...c}=Jn(t,e),d=await Si(e,c),u=Zn(o),f=To(o),p=Hn(o)==="y",{width:m,height:h}=i.floating,g,b;u==="top"||u==="bottom"?(g=u,b=f===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,g=f==="end"?"top":"bottom");let y=h-d.top-d.bottom,v=m-d.left-d.right,x=Xn(h-d[g],y),E=Xn(m-d[b],v),C=!e.middlewareData.shift,T=x,w=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(w=v),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(T=y),C&&!f){let M=Xt(d.left,0),B=Xt(d.right,0),U=Xt(d.top,0),K=Xt(d.bottom,0);p?w=m-2*(M!==0||B!==0?M+B:Xt(d.left,d.right)):T=h-2*(U!==0||K!==0?U+K:Xt(d.top,d.bottom));}await l({...e,availableWidth:w,availableHeight:T});let N=await s.getDimensions(a.floating);return m!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function cl(){return typeof window<"u"}function _o(t){return Cb(t)?(t.nodeName||"").toLowerCase():"#document"}function on(t){var e;return (t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Un(t){var e;return (e=(Cb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Cb(t){return cl()?t instanceof Node||t instanceof on(t).Node:!1}function En(t){return cl()?t instanceof Element||t instanceof on(t).Element:!1}function Vn(t){return cl()?t instanceof HTMLElement||t instanceof on(t).HTMLElement:!1}function Sb(t){return !cl()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof on(t).ShadowRoot}var z_=new Set(["inline","contents"]);function Ci(t){let{overflow:e,overflowX:n,overflowY:r,display:o}=Sn(t);return /auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!z_.has(o)}var H_=new Set(["table","td","th"]);function Rb(t){return H_.has(_o(t))}var U_=[":popover-open",":modal"];function Os(t){return U_.some(e=>{try{return t.matches(e)}catch{return !1}})}var V_=["transform","translate","scale","rotate","perspective"],K_=["transform","translate","scale","rotate","perspective","filter"],W_=["paint","layout","strict","content"];function dl(t){let e=ul(),n=En(t)?Sn(t):t;return V_.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||K_.some(r=>(n.willChange||"").includes(r))||W_.some(r=>(n.contain||"").includes(r))}function Tb(t){let e=xr(t);for(;Vn(e)&&!Mo(e);){if(dl(e))return e;if(Os(e))return null;e=xr(e);}return null}function ul(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var G_=new Set(["html","body","#document"]);function Mo(t){return G_.has(_o(t))}function Sn(t){return on(t).getComputedStyle(t)}function Ds(t){return En(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xr(t){if(_o(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Sb(t)&&t.host||Un(t);return Sb(e)?e.host:e}function kb(t){let e=xr(t);return Mo(e)?t.ownerDocument?t.ownerDocument.body:t.body:Vn(e)&&Ci(e)?e:kb(e)}function No(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let o=kb(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=on(o);if(i){let a=fl(s);return e.concat(s,s.visualViewport||[],Ci(o)?o:[],a&&n?No(a):[])}return e.concat(o,No(o,[],n))}function fl(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Mb(t){let e=Sn(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,o=Vn(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,a=Ms(n)!==i||Ms(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Ru(t){return En(t)?t:t.contextElement}function Ri(t){let e=Ru(t);if(!Vn(e))return zn(1);let n=e.getBoundingClientRect(),{width:r,height:o,$:i}=Mb(e),s=(i?Ms(n.width):n.width)/r,a=(i?Ms(n.height):n.height)/o;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var q_=zn(0);function Ab(t){let e=on(t);return !ul()||!e.visualViewport?q_:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function j_(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==on(t)?!1:e}function Ao(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let o=t.getBoundingClientRect(),i=Ru(t),s=zn(1);e&&(r?En(r)&&(s=Ri(r)):s=Ri(t));let a=j_(i,n,r)?Ab(i):zn(0),l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,d=o.width/s.x,u=o.height/s.y;if(i){let f=on(i),p=r&&En(r)?on(r):r,m=f,h=fl(m);for(;h&&r&&p!==m;){let g=Ri(h),b=h.getBoundingClientRect(),y=Sn(h),v=b.left+(h.clientLeft+parseFloat(y.paddingLeft))*g.x,x=b.top+(h.clientTop+parseFloat(y.paddingTop))*g.y;l*=g.x,c*=g.y,d*=g.x,u*=g.y,l+=v,c+=x,m=on(h),h=fl(m);}}return ko({width:d,height:u,x:l,y:c})}function Tu(t,e){let n=Ds(t).scrollLeft;return e?e.left+n:Ao(Un(t)).left+n}function Ob(t,e,n){n===void 0&&(n=!1);let r=t.getBoundingClientRect(),o=r.left+e.scrollLeft-(n?0:Tu(t,r)),i=r.top+e.scrollTop;return {x:o,y:i}}function Y_(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t,i=o==="fixed",s=Un(r),a=e?Os(e.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=zn(1),d=zn(0),u=Vn(r);if((u||!u&&!i)&&((_o(r)!=="body"||Ci(s))&&(l=Ds(r)),Vn(r))){let p=Ao(r);c=Ri(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop;}let f=s&&!u&&!i?Ob(s,l,!0):zn(0);return {width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-l.scrollTop*c.y+d.y+f.y}}function X_(t){return Array.from(t.getClientRects())}function J_(t){let e=Un(t),n=Ds(t),r=t.ownerDocument.body,o=Xt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Xt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+Tu(t),a=-n.scrollTop;return Sn(r).direction==="rtl"&&(s+=Xt(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function Z_(t,e){let n=on(t),r=Un(t),o=n.visualViewport,i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;let c=ul();(!c||c&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop);}return {width:i,height:s,x:a,y:l}}var Q_=new Set(["absolute","fixed"]);function eM(t,e){let n=Ao(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=Vn(t)?Ri(t):zn(1),s=t.clientWidth*i.x,a=t.clientHeight*i.y,l=o*i.x,c=r*i.y;return {width:s,height:a,x:l,y:c}}function Nb(t,e,n){let r;if(e==="viewport")r=Z_(t,n);else if(e==="document")r=J_(Un(t));else if(En(e))r=eM(e,n);else {let o=Ab(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height};}return ko(r)}function Db(t,e){let n=xr(t);return n===e||!En(n)||Mo(n)?!1:Sn(n).position==="fixed"||Db(n,e)}function tM(t,e){let n=e.get(t);if(n)return n;let r=No(t,[],!1).filter(a=>En(a)&&_o(a)!=="body"),o=null,i=Sn(t).position==="fixed",s=i?xr(t):t;for(;En(s)&&!Mo(s);){let a=Sn(s),l=dl(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&Q_.has(o.position)||Ci(s)&&!l&&Db(t,s))?r=r.filter(d=>d!==s):o=a,s=xr(s);}return e.set(t,r),r}function nM(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t,s=[...n==="clippingAncestors"?Os(e)?[]:tM(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,d)=>{let u=Nb(e,d,o);return c.top=Xt(u.top,c.top),c.right=Xn(u.right,c.right),c.bottom=Xn(u.bottom,c.bottom),c.left=Xt(u.left,c.left),c},Nb(e,a,o));return {width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function rM(t){let{width:e,height:n}=Mb(t);return {width:e,height:n}}function oM(t,e,n){let r=Vn(e),o=Un(e),i=n==="fixed",s=Ao(t,!0,i,e),a={scrollLeft:0,scrollTop:0},l=zn(0);function c(){l.x=Tu(o);}if(r||!r&&!i)if((_o(e)!=="body"||Ci(o))&&(a=Ds(e)),r){let p=Ao(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop;}else o&&c();i&&!r&&o&&c();let d=o&&!r&&!i?Ob(o,a):zn(0),u=s.left+a.scrollLeft-l.x-d.x,f=s.top+a.scrollTop-l.y-d.y;return {x:u,y:f,width:s.width,height:s.height}}function Cu(t){return Sn(t).position==="static"}function _b(t,e){if(!Vn(t)||Sn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Un(t)===n&&(n=n.ownerDocument.body),n}function Pb(t,e){let n=on(t);if(Os(t))return n;if(!Vn(t)){let o=xr(t);for(;o&&!Mo(o);){if(En(o)&&!Cu(o))return o;o=xr(o);}return n}let r=_b(t,e);for(;r&&Rb(r)&&Cu(r);)r=_b(r,e);return r&&Mo(r)&&Cu(r)&&!dl(r)?n:r||Tb(t)||n}var iM=async function(t){let e=this.getOffsetParent||Pb,n=this.getDimensions,r=await n(t.floating);return {reference:oM(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sM(t){return Sn(t).direction==="rtl"}var Ib={convertOffsetParentRelativeRectToViewportRelativeRect:Y_,getDocumentElement:Un,getClippingRect:nM,getOffsetParent:Pb,getElementRects:iM,getClientRects:X_,getDimensions:rM,getScale:Ri,isElement:En,isRTL:sM};function Lb(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function aM(t,e){let n=null,r,o=Un(t);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null;}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();let c=t.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(a||e(),!f||!p)return;let m=As(u),h=As(o.clientWidth-(d+f)),g=As(o.clientHeight-(u+p)),b=As(d),v={rootMargin:-m+"px "+-h+"px "+-g+"px "+-b+"px",threshold:Xt(0,Xn(1,l))||1},x=!0;function E(C){let T=C[0].intersectionRatio;if(T!==l){if(!x)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7);},1e3);}T===1&&!Lb(c,t.getBoundingClientRect())&&s(),x=!1;}try{n=new IntersectionObserver(E,{...v,root:o.ownerDocument});}catch{n=new IntersectionObserver(E,v);}n.observe(t);}return s(!0),i}function Ps(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Ru(t),d=o||i?[...c?No(c):[],...No(e)]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n);});let u=c&&a?aM(c,n):null,f=-1,p=null;s&&(p=new ResizeObserver(b=>{let[y]=b;y&&y.target===c&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var v;(v=p)==null||v.observe(e);})),n();}),c&&!l&&p.observe(c),p.observe(e));let m,h=l?Ao(t):null;l&&g();function g(){let b=Ao(t);h&&!Lb(h,b)&&n(),h=b,m=requestAnimationFrame(g);}return n(),()=>{var b;d.forEach(y=>{o&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n);}),u?.(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(m);}}var $b=vb;var Bb=wb,Fb=gb,zb=Eb,Hb=bb,ku=hb;var Ub=xb,Nu=(t,e,n)=>{let r=new Map,o={platform:Ib,...n},i={...o.platform,_c:r};return mb(t,e,{...o,platform:i})};var cM=typeof document<"u",dM=function(){},pl=cM?useLayoutEffect:dM;function ml(t,e){if(t===e)return !0;if(typeof t!=typeof e)return !1;if(typeof t=="function"&&t.toString()===e.toString())return !0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return !1;for(r=n;r--!==0;)if(!ml(t[r],e[r]))return !1;return !0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return !1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return !1;for(r=n;r--!==0;){let i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!ml(t[i],e[i]))return !1}return !0}return t!==t&&e!==e}function Wb(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Vb(t,e){let n=Wb(t);return Math.round(e*n)/n}function _u(t){let e=ee.useRef(t);return pl(()=>{e.current=t;}),e}function hl(t){t===void 0&&(t={});let{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[d,u]=ee.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=ee.useState(r);ml(f,r)||p(r);let[m,h]=ee.useState(null),[g,b]=ee.useState(null),y=ee.useCallback(_=>{_!==C.current&&(C.current=_,h(_));},[]),v=ee.useCallback(_=>{_!==T.current&&(T.current=_,b(_));},[]),x=i||m,E=s||g,C=ee.useRef(null),T=ee.useRef(null),w=ee.useRef(d),N=l!=null,M=_u(l),B=_u(o),U=_u(c),K=ee.useCallback(()=>{if(!C.current||!T.current)return;let _={placement:e,strategy:n,middleware:f};B.current&&(_.platform=B.current),Nu(C.current,T.current,_).then(A=>{let L={...A,isPositioned:U.current!==!1};P.current&&!ml(w.current,L)&&(w.current=L,Dg.flushSync(()=>{u(L);}));});},[f,e,n,B,U]);pl(()=>{c===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,u(_=>({..._,isPositioned:!1})));},[c]);let P=ee.useRef(!1);pl(()=>(P.current=!0,()=>{P.current=!1;}),[]),pl(()=>{if(x&&(C.current=x),E&&(T.current=E),x&&E){if(M.current)return M.current(x,E,K);K();}},[x,E,K,M,N]);let V=ee.useMemo(()=>({reference:C,floating:T,setReference:y,setFloating:v}),[y,v]),R=ee.useMemo(()=>({reference:x,floating:E}),[x,E]),k=ee.useMemo(()=>{let _={position:n,left:0,top:0};if(!R.floating)return _;let A=Vb(R.floating,d.x),L=Vb(R.floating,d.y);return a?{..._,transform:"translate("+A+"px, "+L+"px)",...Wb(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:L}},[n,a,R.floating,d.x,d.y]);return ee.useMemo(()=>({...d,update:K,refs:V,elements:R,floatingStyles:k}),[d,K,V,R,k])}var uM=t=>{function e(n){return {}.hasOwnProperty.call(n,"current")}return {name:"arrow",options:t,fn(n){let{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?ku({element:r.current,padding:o}).fn(n):{}:r?ku({element:r,padding:o}).fn(n):{}}}},gl=(t,e)=>({...$b(t),options:[t,e]}),bl=(t,e)=>({...Bb(t),options:[t,e]}),yl=(t,e)=>({...Ub(t),options:[t,e]}),vl=(t,e)=>({...Fb(t),options:[t,e]}),wl=(t,e)=>({...zb(t),options:[t,e]});var xl=(t,e)=>({...Hb(t),options:[t,e]});var El=(t,e)=>({...uM(t),options:[t,e]});function Gb(t){let[e,n]=useState(void 0);return zt(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});let r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],s,a;if("borderBoxSize"in i){let l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize;}else s=t.offsetWidth,a=t.offsetHeight;n({width:s,height:a});});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0);},[t]),e}var jb="Popper",[Yb,Mu]=Ei(jb),[hM,Xb]=Yb(jb),gM=t=>{let{__scopePopper:e,children:n}=t,[r,o]=useState(null);return createElement(hM,{scope:e,anchor:r,onAnchorChange:o},n)},bM="PopperAnchor",yM=forwardRef((t,e)=>{let{__scopePopper:n,virtualRef:r,...o}=t,i=Xb(bM,n),s=useRef(null),a=dt(e,s);return useEffect(()=>{i.onAnchorChange(r?.current||s.current);}),r?null:createElement(ut.div,pe({},o,{ref:a}))}),Jb="PopperContent",[vM,LU]=Yb(Jb),wM=forwardRef((t,e)=>{var n,r,o,i,s,a,l,c;let{__scopePopper:d,side:u="bottom",sideOffset:f=0,align:p="center",alignOffset:m=0,arrowPadding:h=0,collisionBoundary:g=[],collisionPadding:b=0,sticky:y="partial",hideWhenDetached:v=!1,avoidCollisions:x=!0,onPlaced:E,...C}=t,T=Xb(Jb,d),[w,N]=useState(null),M=dt(e,Ke=>N(Ke)),[B,U]=useState(null),K=Gb(B),P=(n=K?.width)!==null&&n!==void 0?n:0,V=(r=K?.height)!==null&&r!==void 0?r:0,R=u+(p!=="center"?"-"+p:""),k=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},_=Array.isArray(g)?g:[g],A=_.length>0,L={padding:k,boundary:_.filter(xM),altBoundary:A},{refs:Y,floatingStyles:te,placement:Se,isPositioned:he,middlewareData:ke}=hl({strategy:"fixed",placement:R,whileElementsMounted:Ps,elements:{reference:T.anchor},middleware:[gl({mainAxis:f+V,alignmentAxis:m}),x&&bl({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?yl():void 0,...L}),x&&vl({...L}),wl({...L,apply:({elements:Ke,rects:rt,availableWidth:Te,availableHeight:wt})=>{let{width:D,height:ne}=rt.reference,ce=Ke.floating.style;ce.setProperty("--radix-popper-available-width",`${Te}px`),ce.setProperty("--radix-popper-available-height",`${wt}px`),ce.setProperty("--radix-popper-anchor-width",`${D}px`),ce.setProperty("--radix-popper-anchor-height",`${ne}px`);}}),B&&El({element:B,padding:h}),EM({arrowWidth:P,arrowHeight:V}),v&&xl({strategy:"referenceHidden"})]}),[Ae,W]=Zb(Se),ue=Yt(E);zt(()=>{he&&ue?.();},[he,ue]);let Oe=(o=ke.arrow)===null||o===void 0?void 0:o.x,Ce=(i=ke.arrow)===null||i===void 0?void 0:i.y,le=((s=ke.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[Re,$e]=useState();return zt(()=>{w&&$e(window.getComputedStyle(w).zIndex);},[w]),createElement("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:{...te,transform:he?te.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Re,["--radix-popper-transform-origin"]:[(a=ke.transformOrigin)===null||a===void 0?void 0:a.x,(l=ke.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:t.dir},createElement(vM,{scope:d,placedSide:Ae,onArrowChange:U,arrowX:Oe,arrowY:Ce,shouldHideArrow:le},createElement(ut.div,pe({"data-side":Ae,"data-align":W},C,{ref:M,style:{...C.style,animation:he?void 0:"none",opacity:(c=ke.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function xM(t){return t!==null}var EM=t=>({name:"transformOrigin",options:t,fn(e){var n,r,o,i,s;let{placement:a,rects:l,middlewareData:c}=e,u=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,f=u?0:t.arrowWidth,p=u?0:t.arrowHeight,[m,h]=Zb(a),g={start:"0%",center:"50%",end:"100%"}[h],b=((r=(o=c.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+f/2,y=((i=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+p/2,v="",x="";return m==="bottom"?(v=u?g:`${b}px`,x=`${-p}px`):m==="top"?(v=u?g:`${b}px`,x=`${l.floating.height+p}px`):m==="right"?(v=`${-p}px`,x=u?g:`${y}px`):m==="left"&&(v=`${l.floating.width+p}px`,x=u?g:`${y}px`),{data:{x:v,y:x}}}});function Zb(t){let[e,n="center"]=t.split("-");return [e,n]}var Qb=gM,ey=yM,ty=wM;var ny=forwardRef((t,e)=>{var n;let{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=t;return r?Dg__default.createPortal(createElement(ut.div,pe({},o,{ref:e})),r):null});function Au({prop:t,defaultProp:e,onChange:n=()=>{}}){let[r,o]=MM({defaultProp:e,onChange:n}),i=t!==void 0,s=i?t:r,a=Yt(n),l=useCallback(c=>{if(i){let u=typeof c=="function"?c(t):c;u!==t&&a(u);}else o(c);},[i,t,o,a]);return [s,l]}function MM({defaultProp:t,onChange:e}){let n=useState(t),[r]=n,o=useRef(r),i=Yt(e);return useEffect(()=>{o.current!==r&&(i(r),o.current=r);},[r,o,i]),n}function ry(t){let e=useRef({value:t,previous:t});return useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function DM(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e);}function oy(...t){return e=>t.forEach(n=>DM(n,e))}var Pu=forwardRef((t,e)=>{let{children:n,...r}=t,o=Children.toArray(n),i=o.find(LM);if(i){let s=i.props.children,a=o.map(l=>l===i?Children.count(s)>1?Children.only(null):isValidElement(s)?s.props.children:null:l);return createElement(Du,pe({},r,{ref:e}),isValidElement(s)?cloneElement(s,void 0,a):null)}return createElement(Du,pe({},r,{ref:e}),n)});Pu.displayName="Slot";var Du=forwardRef((t,e)=>{let{children:n,...r}=t;return isValidElement(n)?cloneElement(n,{...$M(r,n.props),ref:e?oy(e,n.ref):n.ref}):Children.count(n)>1?Children.only(null):null});Du.displayName="SlotClone";var IM=({children:t})=>createElement(Fragment,null,t);function LM(t){return isValidElement(t)&&t.type===IM}function $M(t,e){let n={...e};for(let r in e){let o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a);}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "));}return {...t,...n}}var HM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ay=HM.reduce((t,e)=>{let n=forwardRef((r,o)=>{let{asChild:i,...s}=r,a=i?Pu:e;return useEffect(()=>{window[Symbol.for("radix-ui")]=!0;},[]),createElement(a,pe({},s,{ref:o}))});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var ly=forwardRef((t,e)=>createElement(ay.span,pe({},t,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}})));var KM=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ti=new WeakMap,Rl=new WeakMap,Tl={},Iu=0,cy=function(t){return t&&(t.host||cy(t.parentNode))},WM=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=cy(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return !!n})},GM=function(t,e,n,r){var o=WM(e,Array.isArray(t)?t:[t]);Tl[n]||(Tl[n]=new WeakMap);var i=Tl[n],s=[],a=new Set,l=new Set(o),c=function(u){!u||a.has(u)||(a.add(u),c(u.parentNode));};o.forEach(c);var d=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(f){if(a.has(f))d(f);else try{var p=f.getAttribute(r),m=p!==null&&p!=="false",h=(Ti.get(f)||0)+1,g=(i.get(f)||0)+1;Ti.set(f,h),i.set(f,g),s.push(f),h===1&&m&&Rl.set(f,!0),g===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true");}catch(b){console.error("aria-hidden: cannot operate on ",f,b);}});};return d(e),a.clear(),Iu++,function(){s.forEach(function(u){var f=Ti.get(u)-1,p=i.get(u)-1;Ti.set(u,f),i.set(u,p),f||(Rl.has(u)||u.removeAttribute(r),Rl.delete(u)),p||u.removeAttribute(n);}),Iu--,Iu||(Ti=new WeakMap,Ti=new WeakMap,Rl=new WeakMap,Tl={});}},Jr=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=e||KM(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),GM(r,o,n,"aria-hidden")):function(){return null}};var ot=function(){return ot=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);}return e},ot.apply(this,arguments)};function ki(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function kl(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Er="right-scroll-bar-position",Sr="width-before-scroll-bar",Lu="with-scroll-bars-hidden",$u="--removed-body-scroll-bar-size";function Nl(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function dy(t,e){var n=useState(function(){return {value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o));}}}})[0];return n.callback=e,n.facade}var jM=typeof window<"u"?ee.useLayoutEffect:ee.useEffect,uy=new WeakMap;function $s(t,e){var n=dy(e||null,function(r){return t.forEach(function(o){return Nl(o,r)})});return jM(function(){var r=uy.get(n);if(r){var o=new Set(r),i=new Set(t),s=n.current;o.forEach(function(a){i.has(a)||Nl(a,null);}),i.forEach(function(a){o.has(a)||Nl(a,s);});}uy.set(n,t);},[t]),n}function YM(t){return t}function XM(t,e){e===void 0&&(e=YM);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var s=e(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s});}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i);}n={push:function(a){return i(a)},filter:function(){return n}};},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n;}var l=function(){var d=s;s=[],d.forEach(i);},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){s.push(d),c();},filter:function(d){return s=s.filter(d),n}};}};return o}function Bs(t){t===void 0&&(t={});var e=XM(null);return e.options=ot({async:!0,ssr:!1},t),e}var py=function(t){var e=t.sideCar,n=ki(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return ee.createElement(r,ot({},n))};py.isSideCarExport=!0;function Fs(t,e){return t.useMedium(e),py}var Ml=Bs();var Bu=function(){},zs=ee.forwardRef(function(t,e){var n=ee.useRef(null),r=ee.useState({onScrollCapture:Bu,onWheelCapture:Bu,onTouchMoveCapture:Bu}),o=r[0],i=r[1],s=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,d=t.enabled,u=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,g=t.as,b=g===void 0?"div":g,y=ki(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),v=f,x=$s([n,e]),E=ot(ot({},y),o);return ee.createElement(ee.Fragment,null,d&&ee.createElement(v,{sideCar:Ml,removeScrollBar:c,shards:u,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:n}),s?ee.cloneElement(ee.Children.only(a),ot(ot({},E),{ref:x})):ee.createElement(b,ot({},E,{className:l,ref:x}),a))});zs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};zs.classNames={fullWidth:Sr,zeroRight:Er};var hy=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JM(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=hy();return e&&t.setAttribute("nonce",e),t}function ZM(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e));}function QM(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t);}var Fu=function(){var t=0,e=null;return {add:function(n){t==0&&(e=JM())&&(ZM(e,n),QM(e)),t++;},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null);}}};var zu=function(){var t=Fu();return function(e,n){ee.useEffect(function(){return t.add(e),function(){t.remove();}},[e&&n]);}};var Oo=function(){var t=zu(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e};var eA={left:0,top:0,right:0,gap:0},Hu=function(t){return parseInt(t||"",10)||0},tA=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return [Hu(n),Hu(r),Hu(o)]},Uu=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return eA;var e=tA(t),n=document.documentElement.clientWidth,r=window.innerWidth;return {left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}};var nA=Oo(),Ni="data-scroll-locked",rA=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,a=t.gap;return n===void 0&&(n="margin"),`
|
|
24
|
+
.`.concat(Lu,` {
|
|
25
|
+
overflow: hidden `).concat(r,`;
|
|
26
|
+
padding-right: `).concat(a,"px ").concat(r,`;
|
|
27
|
+
}
|
|
28
|
+
body[`).concat(Ni,`] {
|
|
29
|
+
overflow: hidden `).concat(r,`;
|
|
30
|
+
overscroll-behavior: contain;
|
|
31
|
+
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
32
|
+
padding-left: `.concat(o,`px;
|
|
33
|
+
padding-top: `).concat(i,`px;
|
|
34
|
+
padding-right: `).concat(s,`px;
|
|
35
|
+
margin-left:0;
|
|
36
|
+
margin-top:0;
|
|
37
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
38
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.`).concat(Er,` {
|
|
42
|
+
right: `).concat(a,"px ").concat(r,`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.`).concat(Sr,` {
|
|
46
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.`).concat(Er," .").concat(Er,` {
|
|
50
|
+
right: 0 `).concat(r,`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.`).concat(Sr," .").concat(Sr,` {
|
|
54
|
+
margin-right: 0 `).concat(r,`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
body[`).concat(Ni,`] {
|
|
58
|
+
`).concat($u,": ").concat(a,`px;
|
|
59
|
+
}
|
|
60
|
+
`)},by=function(){var t=parseInt(document.body.getAttribute(Ni)||"0",10);return isFinite(t)?t:0},oA=function(){ee.useEffect(function(){return document.body.setAttribute(Ni,(by()+1).toString()),function(){var t=by()-1;t<=0?document.body.removeAttribute(Ni):document.body.setAttribute(Ni,t.toString());}},[]);},Hs=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;oA();var i=ee.useMemo(function(){return Uu(o)},[o]);return ee.createElement(nA,{styles:rA(i,!e,o,n?"":"!important")})};var Vu=!1;if(typeof window<"u")try{Us=Object.defineProperty({},"passive",{get:function(){return Vu=!0,!0}}),window.addEventListener("test",Us,Us),window.removeEventListener("test",Us,Us);}catch{Vu=!1;}var Us,Do=Vu?{passive:!1}:!1;var iA=function(t){return t.tagName==="TEXTAREA"},yy=function(t,e){var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!iA(t)&&n[e]==="visible")},sA=function(t){return yy(t,"overflowY")},aA=function(t){return yy(t,"overflowX")},Ku=function(t,e){var n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=vy(t,n);if(r){var o=wy(t,n),i=o[1],s=o[2];if(i>s)return !0}n=n.parentNode;}while(n&&n!==document.body);return !1},lA=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return [e,n,r]},cA=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return [e,n,r]},vy=function(t,e){return t==="v"?sA(e):aA(e)},wy=function(t,e){return t==="v"?lA(e):cA(e)},dA=function(t,e){return t==="h"&&e==="rtl"?-1:1},xy=function(t,e,n,r,o){var i=dA(t,window.getComputedStyle(e).direction),s=i*r,a=n.target,l=e.contains(a),c=!1,d=s>0,u=0,f=0;do{var p=wy(t,a),m=p[0],h=p[1],g=p[2],b=h-g-i*m;(m||b)&&vy(t,a)&&(u+=b,f+=m),a=a.parentNode;}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return (d&&(o&&u===0||!o&&s>u)||!d&&(o&&f===0||!o&&-s>f))&&(c=!0),c};var Al=function(t){return "changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Ey=function(t){return [t.deltaX,t.deltaY]},Sy=function(t){return t&&"current"in t?t.current:t},uA=function(t,e){return t[0]===e[0]&&t[1]===e[1]},fA=function(t){return `
|
|
61
|
+
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
62
|
+
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
63
|
+
`)},pA=0,Mi=[];function Cy(t){var e=ee.useRef([]),n=ee.useRef([0,0]),r=ee.useRef(),o=ee.useState(pA++)[0],i=ee.useState(function(){return Oo()})[0],s=ee.useRef(t);ee.useEffect(function(){s.current=t;},[t]),ee.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=kl([t.lockRef.current],(t.shards||[]).map(Sy),!0).filter(Boolean);return h.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))});}}},[t.inert,t.lockRef.current,t.shards]);var a=ee.useCallback(function(h,g){if("touches"in h&&h.touches.length===2)return !s.current.allowPinchZoom;var b=Al(h),y=n.current,v="deltaX"in h?h.deltaX:y[0]-b[0],x="deltaY"in h?h.deltaY:y[1]-b[1],E,C=h.target,T=Math.abs(v)>Math.abs(x)?"h":"v";if("touches"in h&&T==="h"&&C.type==="range")return !1;var w=Ku(T,C);if(!w)return !0;if(w?E=T:(E=T==="v"?"h":"v",w=Ku(T,C)),!w)return !1;if(!r.current&&"changedTouches"in h&&(v||x)&&(r.current=E),!E)return !0;var N=r.current||E;return xy(N,g,h,N==="h"?v:x,!0)},[]),l=ee.useCallback(function(h){var g=h;if(!(!Mi.length||Mi[Mi.length-1]!==i)){var b="deltaY"in g?Ey(g):Al(g),y=e.current.filter(function(E){return E.name===g.type&&E.target===g.target&&uA(E.delta,b)})[0];if(y&&y.should){g.cancelable&&g.preventDefault();return}if(!y){var v=(s.current.shards||[]).map(Sy).filter(Boolean).filter(function(E){return E.contains(g.target)}),x=v.length>0?a(g,v[0]):!s.current.noIsolation;x&&g.cancelable&&g.preventDefault();}}},[]),c=ee.useCallback(function(h,g,b,y){var v={name:h,delta:g,target:b,should:y};e.current.push(v),setTimeout(function(){e.current=e.current.filter(function(x){return x!==v});},1);},[]),d=ee.useCallback(function(h){n.current=Al(h),r.current=void 0;},[]),u=ee.useCallback(function(h){c(h.type,Ey(h),h.target,a(h,t.lockRef.current));},[]),f=ee.useCallback(function(h){c(h.type,Al(h),h.target,a(h,t.lockRef.current));},[]);ee.useEffect(function(){return Mi.push(i),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Do),document.addEventListener("touchmove",l,Do),document.addEventListener("touchstart",d,Do),function(){Mi=Mi.filter(function(h){return h!==i}),document.removeEventListener("wheel",l,Do),document.removeEventListener("touchmove",l,Do),document.removeEventListener("touchstart",d,Do);}},[]);var p=t.removeScrollBar,m=t.inert;return ee.createElement(ee.Fragment,null,m?ee.createElement(i,{styles:fA(o)}):null,p?ee.createElement(Hs,{gapMode:"margin"}):null)}var Ry=Fs(Ml,Cy);var Ty=ee.forwardRef(function(t,e){return ee.createElement(zs,ot({},t,{ref:e,sideCar:Ry}))});Ty.classNames=zs.classNames;var Wu=Ty;var hA=[" ","Enter","ArrowUp","ArrowDown"],gA=[" ","Enter"],Pl="Select",[Il,Ll,bA]=zg(Pl),[Oi,GK]=Ei(Pl,[bA,Mu]),qu=Mu(),[yA,Io]=Oi(Pl),[vA,wA]=Oi(Pl),xA=t=>{let{__scopeSelect:e,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:d,autoComplete:u,disabled:f,required:p}=t,m=qu(e),[h,g]=useState(null),[b,y]=useState(null),[v,x]=useState(!1),E=Hg(c),[C=!1,T]=Au({prop:r,defaultProp:o,onChange:i}),[w,N]=Au({prop:s,defaultProp:a,onChange:l}),M=useRef(null),B=h?!!h.closest("form"):!0,[U,K]=useState(new Set),P=Array.from(U).map(V=>V.props.value).join(";");return createElement(Qb,m,createElement(yA,{required:p,scope:e,trigger:h,onTriggerChange:g,valueNode:b,onValueNodeChange:y,valueNodeHasChildren:v,onValueNodeHasChildrenChange:x,contentId:Eu(),value:w,onValueChange:N,open:C,onOpenChange:T,dir:E,triggerPointerDownPosRef:M,disabled:f},createElement(Il.Provider,{scope:e},createElement(vA,{scope:t.__scopeSelect,onNativeOptionAdd:useCallback(V=>{K(R=>new Set(R).add(V));},[]),onNativeOptionRemove:useCallback(V=>{K(R=>{let k=new Set(R);return k.delete(V),k});},[])},n)),B?createElement(Ly,{key:P,"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:u,value:w,onChange:V=>N(V.target.value),disabled:f},w===void 0?createElement("option",{value:""}):null,Array.from(U)):null))},EA="SelectTrigger",SA=forwardRef((t,e)=>{let{__scopeSelect:n,disabled:r=!1,...o}=t,i=qu(n),s=Io(EA,n),a=s.disabled||r,l=dt(e,s.onTriggerChange),c=Ll(n),[d,u,f]=$y(m=>{let h=c().filter(y=>!y.disabled),g=h.find(y=>y.value===s.value),b=By(h,m,g);b!==void 0&&s.onValueChange(b.value);}),p=()=>{a||(s.onOpenChange(!0),f());};return createElement(ey,pe({asChild:!0},i),createElement(ut.button,pe({type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":s.value===void 0?"":void 0},o,{ref:l,onClick:ht(o.onClick,m=>{m.currentTarget.focus();}),onPointerDown:ht(o.onPointerDown,m=>{let h=m.target;h.hasPointerCapture(m.pointerId)&&h.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&(p(),s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)},m.preventDefault());}),onKeyDown:ht(o.onKeyDown,m=>{let h=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&u(m.key),!(h&&m.key===" ")&&hA.includes(m.key)&&(p(),m.preventDefault());})})))}),CA="SelectValue",RA=forwardRef((t,e)=>{let{__scopeSelect:n,className:r,style:o,children:i,placeholder:s,...a}=t,l=Io(CA,n),{onValueNodeHasChildrenChange:c}=l,d=i!==void 0,u=dt(e,l.onValueNodeChange);return zt(()=>{c(d);},[c,d]),createElement(ut.span,pe({},a,{ref:u,style:{pointerEvents:"none"}}),l.value===void 0&&s!==void 0?s:i)});var TA=forwardRef((t,e)=>{let{__scopeSelect:n,children:r,...o}=t;return createElement(ut.span,pe({"aria-hidden":!0},o,{ref:e}),r||"\u25BC")});var kA=t=>createElement(ny,pe({asChild:!0},t)),Ai="SelectContent",NA=forwardRef((t,e)=>{let n=Io(Ai,t.__scopeSelect),[r,o]=useState();if(zt(()=>{o(new DocumentFragment);},[]),!n.open){let i=r;return i?createPortal(createElement(Dy,{scope:t.__scopeSelect},createElement(Il.Slot,{scope:t.__scopeSelect},createElement("div",null,t.children))),i):null}return createElement(_A,pe({},t,{ref:e}))}),Cr=10,[Dy,Lo]=Oi(Ai);var _A=forwardRef((t,e)=>{let{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...b}=t,y=Io(Ai,n),[v,x]=useState(null),[E,C]=useState(null),T=dt(e,W=>x(W)),[w,N]=useState(null),[M,B]=useState(null),U=Ll(n),[K,P]=useState(!1),V=useRef(!1);useEffect(()=>{if(v)return Jr(v)},[v]),Xg();let R=useCallback(W=>{let[ue,...Oe]=U().map(Re=>Re.ref.current),[Ce]=Oe.slice(-1),le=document.activeElement;for(let Re of W)if(Re===le||(Re?.scrollIntoView({block:"nearest"}),Re===ue&&E&&(E.scrollTop=0),Re===Ce&&E&&(E.scrollTop=E.scrollHeight),Re?.focus(),document.activeElement!==le))return},[U,E]),k=useCallback(()=>R([w,v]),[R,w,v]);useEffect(()=>{K&&k();},[K,k]);let{onOpenChange:_,triggerPointerDownPosRef:A}=y;useEffect(()=>{if(v){let W={x:0,y:0},ue=Ce=>{var le,Re,$e,Ke;W={x:Math.abs(Math.round(Ce.pageX)-((le=(Re=A.current)===null||Re===void 0?void 0:Re.x)!==null&&le!==void 0?le:0)),y:Math.abs(Math.round(Ce.pageY)-(($e=(Ke=A.current)===null||Ke===void 0?void 0:Ke.y)!==null&&$e!==void 0?$e:0))};},Oe=Ce=>{W.x<=10&&W.y<=10?Ce.preventDefault():v.contains(Ce.target)||_(!1),document.removeEventListener("pointermove",ue),A.current=null;};return A.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",Oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",Oe,{capture:!0});}}},[v,_,A]),useEffect(()=>{let W=()=>_(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W);}},[_]);let[L,Y]=$y(W=>{let ue=U().filter(le=>!le.disabled),Oe=ue.find(le=>le.ref.current===document.activeElement),Ce=By(ue,W,Oe);Ce&&setTimeout(()=>Ce.ref.current.focus());}),te=useCallback((W,ue,Oe)=>{let Ce=!V.current&&!Oe;(y.value!==void 0&&y.value===ue||Ce)&&(N(W),Ce&&(V.current=!0));},[y.value]),Se=useCallback(()=>v?.focus(),[v]),he=useCallback((W,ue,Oe)=>{let Ce=!V.current&&!Oe;(y.value!==void 0&&y.value===ue||Ce)&&B(W);},[y.value]),ke=r==="popper"?ky:MA,Ae=ke===ky?{side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return createElement(Dy,{scope:n,content:v,viewport:E,onViewportChange:C,itemRefCallback:te,selectedItem:w,onItemLeave:Se,itemTextRefCallback:he,focusSelectedItem:k,selectedItemText:M,position:r,isPositioned:K,searchRef:L},createElement(Wu,{as:Yr,allowPinchZoom:!0},createElement(rb,{asChild:!0,trapped:y.open,onMountAutoFocus:W=>{W.preventDefault();},onUnmountAutoFocus:ht(o,W=>{var ue;(ue=y.trigger)===null||ue===void 0||ue.focus({preventScroll:!0}),W.preventDefault();})},createElement(qg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>y.onOpenChange(!1)},createElement(ke,pe({role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:W=>W.preventDefault()},b,Ae,{onPlaced:()=>P(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ht(b.onKeyDown,W=>{let ue=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!ue&&W.key.length===1&&Y(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let Ce=U().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(W.key)&&(Ce=Ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){let le=W.target,Re=Ce.indexOf(le);Ce=Ce.slice(Re+1);}setTimeout(()=>R(Ce)),W.preventDefault();}})}))))))});var MA=forwardRef((t,e)=>{let{__scopeSelect:n,onPlaced:r,...o}=t,i=Io(Ai,n),s=Lo(Ai,n),[a,l]=useState(null),[c,d]=useState(null),u=dt(e,T=>d(T)),f=Ll(n),p=useRef(!1),m=useRef(!0),{viewport:h,selectedItem:g,selectedItemText:b,focusSelectedItem:y}=s,v=useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&h&&g&&b){let T=i.trigger.getBoundingClientRect(),w=c.getBoundingClientRect(),N=i.valueNode.getBoundingClientRect(),M=b.getBoundingClientRect();if(i.dir!=="rtl"){let le=M.left-w.left,Re=N.left-le,$e=T.left-Re,Ke=T.width+$e,rt=Math.max(Ke,w.width),Te=window.innerWidth-Cr,wt=uu(Re,[Cr,Te-rt]);a.style.minWidth=Ke+"px",a.style.left=wt+"px";}else {let le=w.right-M.right,Re=window.innerWidth-N.right-le,$e=window.innerWidth-T.right-Re,Ke=T.width+$e,rt=Math.max(Ke,w.width),Te=window.innerWidth-Cr,wt=uu(Re,[Cr,Te-rt]);a.style.minWidth=Ke+"px",a.style.right=wt+"px";}let B=f(),U=window.innerHeight-Cr*2,K=h.scrollHeight,P=window.getComputedStyle(c),V=parseInt(P.borderTopWidth,10),R=parseInt(P.paddingTop,10),k=parseInt(P.borderBottomWidth,10),_=parseInt(P.paddingBottom,10),A=V+R+K+_+k,L=Math.min(g.offsetHeight*5,A),Y=window.getComputedStyle(h),te=parseInt(Y.paddingTop,10),Se=parseInt(Y.paddingBottom,10),he=T.top+T.height/2-Cr,ke=U-he,Ae=g.offsetHeight/2,W=g.offsetTop+Ae,ue=V+R+W,Oe=A-ue;if(ue<=he){let le=g===B[B.length-1].ref.current;a.style.bottom="0px";let Re=c.clientHeight-h.offsetTop-h.offsetHeight,$e=Math.max(ke,Ae+(le?Se:0)+Re+k),Ke=ue+$e;a.style.height=Ke+"px";}else {let le=g===B[0].ref.current;a.style.top="0px";let $e=Math.max(he,V+h.offsetTop+(le?te:0)+Ae)+Oe;a.style.height=$e+"px",h.scrollTop=ue-he+h.offsetTop;}a.style.margin=`${Cr}px 0`,a.style.minHeight=L+"px",a.style.maxHeight=U+"px",r?.(),requestAnimationFrame(()=>p.current=!0);}},[f,i.trigger,i.valueNode,a,c,h,g,b,i.dir,r]);zt(()=>v(),[v]);let[x,E]=useState();zt(()=>{c&&E(window.getComputedStyle(c).zIndex);},[c]);let C=useCallback(T=>{T&&m.current===!0&&(v(),y?.(),m.current=!1);},[v,y]);return createElement(AA,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:C},createElement("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x}},createElement(ut.div,pe({},o,{ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))});var ky=forwardRef((t,e)=>{let{__scopeSelect:n,align:r="start",collisionPadding:o=Cr,...i}=t,s=qu(n);return createElement(ty,pe({},s,i,{ref:e,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[AA,ju]=Oi(Ai,{}),Ny="SelectViewport",OA=forwardRef((t,e)=>{let{__scopeSelect:n,...r}=t,o=Lo(Ny,n),i=ju(Ny,n),s=dt(e,o.onViewportChange),a=useRef(0);return createElement(Fragment,null,createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),createElement(Il.Slot,{scope:n},createElement(ut.div,pe({"data-radix-select-viewport":"",role:"presentation"},r,{ref:s,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:ht(r.onScroll,l=>{let c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:u}=i;if(u!=null&&u.current&&d){let f=Math.abs(a.current-c.scrollTop);if(f>0){let p=window.innerHeight-Cr*2,m=parseFloat(d.style.minHeight),h=parseFloat(d.style.height),g=Math.max(m,h);if(g<p){let b=g+f,y=Math.min(p,b),v=b-y;d.style.height=y+"px",d.style.bottom==="0px"&&(c.scrollTop=v>0?v:0,d.style.justifyContent="flex-end");}}}a.current=c.scrollTop;})}))))}),DA="SelectGroup",[qK,PA]=Oi(DA);var IA="SelectLabel",LA=forwardRef((t,e)=>{let{__scopeSelect:n,...r}=t,o=PA(IA,n);return createElement(ut.div,pe({id:o.id},r,{ref:e}))}),Gu="SelectItem",[$A,Py]=Oi(Gu),BA=forwardRef((t,e)=>{let{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=t,a=Io(Gu,n),l=Lo(Gu,n),c=a.value===r,[d,u]=useState(i??""),[f,p]=useState(!1),m=dt(e,b=>{var y;return (y=l.itemRefCallback)===null||y===void 0?void 0:y.call(l,b,r,o)}),h=Eu(),g=()=>{o||(a.onValueChange(r),a.onOpenChange(!1));};return createElement($A,{scope:n,value:r,disabled:o,textId:h,isSelected:c,onItemTextChange:useCallback(b=>{u(y=>{var v;return y||((v=b?.textContent)!==null&&v!==void 0?v:"").trim()});},[])},createElement(Il.ItemSlot,{scope:n,value:r,disabled:o,textValue:d},createElement(ut.div,pe({role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1},s,{ref:m,onFocus:ht(s.onFocus,()=>p(!0)),onBlur:ht(s.onBlur,()=>p(!1)),onPointerUp:ht(s.onPointerUp,g),onPointerMove:ht(s.onPointerMove,b=>{if(o){var y;(y=l.onItemLeave)===null||y===void 0||y.call(l);}else b.currentTarget.focus({preventScroll:!0});}),onPointerLeave:ht(s.onPointerLeave,b=>{if(b.currentTarget===document.activeElement){var y;(y=l.onItemLeave)===null||y===void 0||y.call(l);}}),onKeyDown:ht(s.onKeyDown,b=>{var y;((y=l.searchRef)===null||y===void 0?void 0:y.current)!==""&&b.key===" "||(gA.includes(b.key)&&g(),b.key===" "&&b.preventDefault());})}))))}),Dl="SelectItemText",FA=forwardRef((t,e)=>{let{__scopeSelect:n,className:r,style:o,...i}=t,s=Io(Dl,n),a=Lo(Dl,n),l=Py(Dl,n),c=wA(Dl,n),[d,u]=useState(null),f=dt(e,b=>u(b),l.onItemTextChange,b=>{var y;return (y=a.itemTextRefCallback)===null||y===void 0?void 0:y.call(a,b,l.value,l.disabled)}),p=d?.textContent,m=useMemo(()=>createElement("option",{key:l.value,value:l.value,disabled:l.disabled},p),[l.disabled,l.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=c;return zt(()=>(h(m),()=>g(m)),[h,g,m]),createElement(Fragment,null,createElement(ut.span,pe({id:l.textId},i,{ref:f})),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?createPortal(i.children,s.valueNode):null)}),zA="SelectItemIndicator",HA=forwardRef((t,e)=>{let{__scopeSelect:n,...r}=t;return Py(zA,n).isSelected?createElement(ut.span,pe({"aria-hidden":!0},r,{ref:e})):null}),_y="SelectScrollUpButton",UA=forwardRef((t,e)=>{let n=Lo(_y,t.__scopeSelect),r=ju(_y,t.__scopeSelect),[o,i]=useState(!1),s=dt(e,r.onScrollButtonChange);return zt(()=>{if(n.viewport&&n.isPositioned){let l=function(){let c=a.scrollTop>0;i(c);},a=n.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?createElement(Iy,pe({},t,{ref:s,onAutoScroll:()=>{let{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight);}})):null}),My="SelectScrollDownButton",VA=forwardRef((t,e)=>{let n=Lo(My,t.__scopeSelect),r=ju(My,t.__scopeSelect),[o,i]=useState(!1),s=dt(e,r.onScrollButtonChange);return zt(()=>{if(n.viewport&&n.isPositioned){let l=function(){let c=a.scrollHeight-a.clientHeight,d=Math.ceil(a.scrollTop)<c;i(d);},a=n.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?createElement(Iy,pe({},t,{ref:s,onAutoScroll:()=>{let{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight);}})):null}),Iy=forwardRef((t,e)=>{let{__scopeSelect:n,onAutoScroll:r,...o}=t,i=Lo("SelectScrollButton",n),s=useRef(null),a=Ll(n),l=useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null);},[]);return useEffect(()=>()=>l(),[l]),zt(()=>{var c;let d=a().find(u=>u.ref.current===document.activeElement);d==null||(c=d.ref.current)===null||c===void 0||c.scrollIntoView({block:"nearest"});},[a]),createElement(ut.div,pe({"aria-hidden":!0},o,{ref:e,style:{flexShrink:0,...o.style},onPointerDown:ht(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50));}),onPointerMove:ht(o.onPointerMove,()=>{var c;(c=i.onItemLeave)===null||c===void 0||c.call(i),s.current===null&&(s.current=window.setInterval(r,50));}),onPointerLeave:ht(o.onPointerLeave,()=>{l();})}))});var KA=forwardRef((t,e)=>{let{__scopeSelect:n,...r}=t;return createElement(ut.div,pe({"aria-hidden":!0},r,{ref:e}))});var Ly=forwardRef((t,e)=>{let{value:n,...r}=t,o=useRef(null),i=dt(e,o),s=ry(n);return useEffect(()=>{let a=o.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&d){let u=new Event("change",{bubbles:!0});d.call(a,n),a.dispatchEvent(u);}},[s,n]),createElement(ly,{asChild:!0},createElement("select",pe({},r,{ref:i,defaultValue:n})))});Ly.displayName="BubbleSelect";function $y(t){let e=Yt(t),n=useRef(""),r=useRef(0),o=useCallback(s=>{let a=n.current+s;e(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3));}(a);},[e]),i=useCallback(()=>{n.current="",window.clearTimeout(r.current);},[]);return useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function By(t,e,n){let o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1,s=WA(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));let l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function WA(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Fy=xA,Yu=SA,zy=RA,Hy=TA,Uy=kA,Xu=NA,Vy=OA;var Ju=LA,Zu=BA,Ky=FA,Wy=HA,Qu=UA,ef=VA,tf=KA;var $o=Fy;$o.displayName="Select";var Di=zy,Bo=ee.forwardRef(({className:t,children:e,variant:n="standard",size:r="md",error:o,success:i,loading:s,leftIcon:a,rightIcon:l,...c},d)=>jsxs(Yu,{ref:d,className:I("flex w-full items-center justify-between gap-1 rounded-md transition-all duration-200","disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1","focus-visible:outline-none",o&&"border-error focus-visible:ring-error/30 focus-visible:border-error",i&&"border-success focus-visible:ring-success/30 focus-visible:border-success",r==="sm"&&"h-8 text-xs px-2",r==="md"&&"h-10 text-sm px-3",r==="lg"&&"h-12 text-base px-4",n==="standard"&&"border border-gray-300 dark:border-gray-700 bg-background dark:bg-gray-900 hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/50 focus-visible:border-primary dark:focus-visible:border-primary",n==="outline"&&"border border-gray-300 dark:border-gray-700 bg-transparent hover:border-gray-400 dark:hover:border-gray-600 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/50 focus-visible:border-primary dark:focus-visible:border-primary",n==="ghost"&&"border-none bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 focus-visible:ring-2 focus-visible:ring-primary/30 dark:focus-visible:ring-primary/50",n==="underline"&&"border-t-0 border-l-0 border-r-0 border-b border-gray-300 dark:border-gray-600 rounded-none px-0 hover:border-gray-400 dark:hover:border-gray-500 focus-visible:ring-0 focus-visible:border-b-2 focus-visible:border-primary dark:focus-visible:border-primary",t),...c,disabled:c.disabled||s,"data-error":o?!0:void 0,"data-success":i?!0:void 0,"data-loading":s?!0:void 0,children:[jsxs("div",{className:"flex items-center flex-1 gap-2",children:[a&&jsx("span",{className:"flex items-center justify-center text-gray-500 dark:text-gray-400",children:a}),s?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Loader2,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground dark:text-gray-400"}),jsx("span",{className:"text-muted-foreground dark:text-gray-400",children:"Loading..."})]}):e]}),!s&&jsx(Hy,{asChild:!0,children:l?jsx("span",{className:"opacity-60",children:l}):jsx(ChevronDown,{className:"h-4 w-4 opacity-60 transition-transform duration-200 ease-out group-data-[state=open]:rotate-180"})})]}));Bo.displayName=Yu.displayName;var qy=ee.forwardRef(({className:t,...e},n)=>jsx(Qu,{ref:n,className:I("flex cursor-default items-center justify-center py-1 text-muted-foreground hover:text-foreground transition-colors",t),...e,children:jsx(ChevronUp,{className:"h-4 w-4"})}));qy.displayName=Qu.displayName;var jy=ee.forwardRef(({className:t,...e},n)=>jsx(ef,{ref:n,className:I("flex cursor-default items-center justify-center py-1 text-muted-foreground hover:text-foreground transition-colors",t),...e,children:jsx(ChevronDown,{className:"h-4 w-4"})}));jy.displayName=ef.displayName;var Fo=ee.forwardRef(({className:t,children:e,position:n="item-aligned",...r},o)=>jsx(Uy,{children:jsxs(Xu,{ref:o,className:I(["relative z-50 max-h-96 min-w-[8rem] overflow-hidden","rounded-md border border-gray-200 dark:border-gray-700","bg-white dark:bg-gray-900 text-foreground","shadow-lg dark:shadow-gray-900/20","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=open]:duration-150"],n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[jsx(qy,{}),jsx(Vy,{className:I("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),jsx(jy,{})]})}));Fo.displayName=Xu.displayName;var XA=ee.forwardRef(({className:t,...e},n)=>jsx(Ju,{ref:n,className:I("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));XA.displayName=Ju.displayName;var Ge=ee.forwardRef(({className:t,children:e,variant:n="default",size:r="md",rightIcon:o,customIndicator:i,...s},a)=>jsxs(Zu,{ref:a,className:I("relative flex w-full cursor-default select-none items-center rounded-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r==="sm"&&"py-1 pl-7 pr-2 text-xs",r==="md"&&"py-1.5 pl-8 pr-2 text-sm",r==="lg"&&"py-2 pl-9 pr-3 text-base",n==="default"&&"focus:bg-accent focus:text-accent-foreground dark:focus:bg-gray-700 dark:focus:text-gray-100",n==="subtle"&&"focus:bg-gray-100 dark:focus:bg-gray-800 focus:text-foreground dark:focus:text-gray-200",n==="destructive"&&"text-error dark:text-red-400 focus:bg-error/10 dark:focus:bg-red-900/20 focus:text-error dark:focus:text-red-300",n==="success"&&"text-success dark:text-green-400 focus:bg-success/10 dark:focus:bg-green-900/20 focus:text-success dark:focus:text-green-300",n==="warning"&&"text-warning dark:text-yellow-400 focus:bg-warning/10 dark:focus:bg-yellow-900/20 focus:text-warning dark:focus:text-yellow-300",t),...s,children:[jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsx(Wy,{children:i||jsx(Check,{className:"h-4 w-4"})})}),jsx(Ky,{children:e}),o&&jsx("span",{className:"ml-auto pl-2 opacity-70",children:o})]}));Ge.displayName=Zu.displayName;var JA=ee.forwardRef(({className:t,...e},n)=>jsx(tf,{ref:n,className:I("-mx-1 my-1 h-px bg-muted dark:bg-gray-700",t),...e}));JA.displayName=tf.displayName;function J(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function Xy(t,e){let n=ee.createContext(e),r=i=>{let{children:s,...a}=i,l=ee.useMemo(()=>a,Object.values(a));return jsx(n.Provider,{value:l,children:s})};r.displayName=t+"Provider";function o(i){let s=ee.useContext(n);if(s)return s;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return [r,o]}function Ut(t,e=[]){let n=[];function r(i,s){let a=ee.createContext(s),l=n.length;n=[...n,s];let c=u=>{let{scope:f,children:p,...m}=u,h=f?.[t]?.[l]||a,g=ee.useMemo(()=>m,Object.values(m));return jsx(h.Provider,{value:g,children:p})};c.displayName=i+"Provider";function d(u,f){let p=f?.[t]?.[l]||a,m=ee.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${u}\` must be used within \`${i}\``)}return [c,d]}let o=()=>{let i=n.map(s=>ee.createContext(s));return function(a){let l=a?.[t]||i;return ee.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,ZA(o,...e)]}function ZA(...t){let e=t[0];if(t.length===1)return e;let n=()=>{let r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let s=r.reduce((a,{useScope:l,scopeName:c})=>{let u=l(i)[`__scope${c}`];return {...a,...u}},{});return ee.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var Vt=globalThis?.document?ee.useLayoutEffect:()=>{};var QA=ee[" useId ".trim().toString()]||(()=>{}),e1=0;function sn(t){let[e,n]=ee.useState(QA());return Vt(()=>{t||n(r=>r??String(e1++));},[t]),t||(e?`radix-${e}`:"")}var t1=ee[" useInsertionEffect ".trim().toString()]||Vt;function Qn({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){let[o,i,s]=n1({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:o;{let d=ee.useRef(t!==void 0);ee.useEffect(()=>{let u=d.current;u!==a&&console.warn(`${r} is changing from ${u?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a;},[a,r]);}let c=ee.useCallback(d=>{if(a){let u=r1(d)?d(t):d;u!==t&&s.current?.(u);}else i(d);},[a,t,i,s]);return [l,c]}function n1({defaultProp:t,onChange:e}){let[n,r]=ee.useState(t),o=ee.useRef(n),i=ee.useRef(e);return t1(()=>{i.current=e;},[e]),ee.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n);},[n,o]),[n,r,i]}function r1(t){return typeof t=="function"}function pt(t){let e=ee.useRef(t);return ee.useEffect(()=>{e.current=t;}),ee.useMemo(()=>(...n)=>e.current?.(...n),[])}function Qy(t,e=globalThis?.document){let n=pt(t);ee.useEffect(()=>{let r=o=>{o.key==="Escape"&&n(o);};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e]);}var o1="DismissableLayer",rf="dismissableLayer.update",i1="dismissableLayer.pointerDownOutside",s1="dismissableLayer.focusOutside",ev,rv=ee.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qr=ee.forwardRef((t,e)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=t,c=ee.useContext(rv),[d,u]=ee.useState(null),f=d?.ownerDocument??globalThis?.document,[,p]=ee.useState({}),m=Le(e,T=>u(T)),h=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(g),y=d?h.indexOf(d):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,x=y>=b,E=l1(T=>{let w=T.target,N=[...c.branches].some(M=>M.contains(w));!x||N||(o?.(T),s?.(T),T.defaultPrevented||a?.());},f),C=c1(T=>{let w=T.target;[...c.branches].some(M=>M.contains(w))||(i?.(T),s?.(T),T.defaultPrevented||a?.());},f);return Qy(T=>{y===c.layers.size-1&&(r?.(T),!T.defaultPrevented&&a&&(T.preventDefault(),a()));},f),ee.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(ev=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),tv(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=ev);}},[d,f,n,c]),ee.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),tv());},[d,c]),ee.useEffect(()=>{let T=()=>p({});return document.addEventListener(rf,T),()=>document.removeEventListener(rf,T)},[]),jsx(fe.div,{...l,ref:m,style:{pointerEvents:v?x?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,C.onFocusCapture),onBlurCapture:J(t.onBlurCapture,C.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,E.onPointerDownCapture)})});Qr.displayName=o1;var a1="DismissableLayerBranch",ov=ee.forwardRef((t,e)=>{let n=ee.useContext(rv),r=ee.useRef(null),o=Le(e,r);return ee.useEffect(()=>{let i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i);}},[n.branches]),jsx(fe.div,{...t,ref:o})});ov.displayName=a1;function l1(t,e=globalThis?.document){let n=pt(t),r=ee.useRef(!1),o=ee.useRef(()=>{});return ee.useEffect(()=>{let i=a=>{if(a.target&&!r.current){let c=function(){iv(i1,n,d,{discrete:!0});};let d={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=c,e.addEventListener("click",o.current,{once:!0})):c();}else e.removeEventListener("click",o.current);r.current=!1;},s=window.setTimeout(()=>{e.addEventListener("pointerdown",i);},0);return ()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current);}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function c1(t,e=globalThis?.document){let n=pt(t),r=ee.useRef(!1);return ee.useEffect(()=>{let o=i=>{i.target&&!r.current&&iv(s1,n,{originalEvent:i},{discrete:!1});};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tv(){let t=new CustomEvent(rf);document.dispatchEvent(t);}function iv(t,e,n,{discrete:r}){let o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?xi(o,i):o.dispatchEvent(i);}var sv=Qr,av=ov;var of="focusScope.autoFocusOnMount",sf="focusScope.autoFocusOnUnmount",lv={bubbles:!1,cancelable:!0},f1="FocusScope",zo=ee.forwardRef((t,e)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=t,[a,l]=ee.useState(null),c=pt(o),d=pt(i),u=ee.useRef(null),f=Le(e,h=>l(h)),p=ee.useRef({paused:!1,pause(){this.paused=!0;},resume(){this.paused=!1;}}).current;ee.useEffect(()=>{if(r){let y=function(C){if(p.paused||!a)return;let T=C.target;a.contains(T)?u.current=T:eo(u.current,{select:!0});},v=function(C){if(p.paused||!a)return;let T=C.relatedTarget;T!==null&&(a.contains(T)||eo(u.current,{select:!0}));},x=function(C){if(document.activeElement===document.body)for(let w of C)w.removedNodes.length>0&&eo(a);};document.addEventListener("focusin",y),document.addEventListener("focusout",v);let E=new MutationObserver(x);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",v),E.disconnect();}}},[r,a,p.paused]),ee.useEffect(()=>{if(a){dv.add(p);let h=document.activeElement;if(!a.contains(h)){let b=new CustomEvent(of,lv);a.addEventListener(of,c),a.dispatchEvent(b),b.defaultPrevented||(p1(y1(fv(a)),{select:!0}),document.activeElement===h&&eo(a));}return ()=>{a.removeEventListener(of,c),setTimeout(()=>{let b=new CustomEvent(sf,lv);a.addEventListener(sf,d),a.dispatchEvent(b),b.defaultPrevented||eo(h??document.body,{select:!0}),a.removeEventListener(sf,d),dv.remove(p);},0);}}},[a,c,d,p]);let m=ee.useCallback(h=>{if(!n&&!r||p.paused)return;let g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(g&&b){let y=h.currentTarget,[v,x]=m1(y);v&&x?!h.shiftKey&&b===x?(h.preventDefault(),n&&eo(v,{select:!0})):h.shiftKey&&b===v&&(h.preventDefault(),n&&eo(x,{select:!0})):b===y&&h.preventDefault();}},[n,r,p.paused]);return jsx(fe.div,{tabIndex:-1,...s,ref:f,onKeyDown:m})});zo.displayName=f1;function p1(t,{select:e=!1}={}){let n=document.activeElement;for(let r of t)if(eo(r,{select:e}),document.activeElement!==n)return}function m1(t){let e=fv(t),n=cv(e,t),r=cv(e.reverse(),t);return [n,r]}function fv(t){let e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{let o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function cv(t,e){for(let n of t)if(!h1(n,{upTo:e}))return n}function h1(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return !0;for(;t;){if(e!==void 0&&t===e)return !1;if(getComputedStyle(t).display==="none")return !0;t=t.parentElement;}return !1}function g1(t){return t instanceof HTMLInputElement&&"select"in t}function eo(t,{select:e=!1}={}){if(t&&t.focus){let n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&g1(t)&&e&&t.select();}}var dv=b1();function b1(){let t=[];return {add(e){let n=t[0];e!==n&&n?.pause(),t=uv(t,e),t.unshift(e);},remove(e){t=uv(t,e),t[0]?.resume();}}}function uv(t,e){let n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function y1(t){return t.filter(e=>e.tagName!=="A")}var x1="Portal",Tr=ee.forwardRef((t,e)=>{let{container:n,...r}=t,[o,i]=ee.useState(!1);Vt(()=>i(!0),[]);let s=n||o&&globalThis?.document?.body;return s?Dg__default.createPortal(jsx(fe.div,{...r,ref:e}),s):null});Tr.displayName=x1;function E1(t,e){return ee.useReducer((n,r)=>e[n][r]??n,t)}var Jt=t=>{let{present:e,children:n}=t,r=S1(e),o=typeof n=="function"?n({present:r.isPresent}):ee.Children.only(n),i=Le(r.ref,C1(o));return typeof n=="function"||r.isPresent?ee.cloneElement(o,{ref:i}):null};Jt.displayName="Presence";function S1(t){let[e,n]=ee.useState(),r=ee.useRef(null),o=ee.useRef(t),i=ee.useRef("none"),s=t?"mounted":"unmounted",[a,l]=E1(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ee.useEffect(()=>{let c=Fl(r.current);i.current=a==="mounted"?c:"none";},[a]),Vt(()=>{let c=r.current,d=o.current;if(d!==t){let f=i.current,p=Fl(c);t?l("MOUNT"):p==="none"||c?.display==="none"?l("UNMOUNT"):l(d&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t;}},[t,l]),Vt(()=>{if(e){let c,d=e.ownerDocument.defaultView??window,u=p=>{let h=Fl(r.current).includes(p.animationName);if(p.target===e&&h&&(l("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g);});}},f=p=>{p.target===e&&(i.current=Fl(r.current));};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u);}}else l("ANIMATION_END");},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:ee.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c);},[])}}function Fl(t){return t?.animationName||"none"}function C1(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var af=0;function Ii(){ee.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??mv()),document.body.insertAdjacentElement("beforeend",t[1]??mv()),af++,()=>{af===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),af--;}},[]);}function mv(){let t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var zl=Bs();var lf=function(){},Ks=ee.forwardRef(function(t,e){var n=ee.useRef(null),r=ee.useState({onScrollCapture:lf,onWheelCapture:lf,onTouchMoveCapture:lf}),o=r[0],i=r[1],s=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,d=t.enabled,u=t.shards,f=t.sideCar,p=t.noRelative,m=t.noIsolation,h=t.inert,g=t.allowPinchZoom,b=t.as,y=b===void 0?"div":b,v=t.gapMode,x=ki(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,C=$s([n,e]),T=ot(ot({},x),o);return ee.createElement(ee.Fragment,null,d&&ee.createElement(E,{sideCar:zl,removeScrollBar:c,shards:u,noRelative:p,noIsolation:m,inert:h,setCallbacks:i,allowPinchZoom:!!g,lockRef:n,gapMode:v}),s?ee.cloneElement(ee.Children.only(a),ot(ot({},T),{ref:C})):ee.createElement(y,ot({},T,{className:l,ref:C}),a))});Ks.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ks.classNames={fullWidth:Sr,zeroRight:Er};var cf=!1;if(typeof window<"u")try{Ws=Object.defineProperty({},"passive",{get:function(){return cf=!0,!0}}),window.addEventListener("test",Ws,Ws),window.removeEventListener("test",Ws,Ws);}catch{cf=!1;}var Ws,Ho=cf?{passive:!1}:!1;var R1=function(t){return t.tagName==="TEXTAREA"},gv=function(t,e){if(!(t instanceof Element))return !1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!R1(t)&&n[e]==="visible")},T1=function(t){return gv(t,"overflowY")},k1=function(t){return gv(t,"overflowX")},df=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=bv(t,r);if(o){var i=yv(t,r),s=i[1],a=i[2];if(s>a)return !0}r=r.parentNode;}while(r&&r!==n.body);return !1},N1=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return [e,n,r]},_1=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return [e,n,r]},bv=function(t,e){return t==="v"?T1(e):k1(e)},yv=function(t,e){return t==="v"?N1(e):_1(e)},M1=function(t,e){return t==="h"&&e==="rtl"?-1:1},vv=function(t,e,n,r,o){var i=M1(t,window.getComputedStyle(e).direction),s=i*r,a=n.target,l=e.contains(a),c=!1,d=s>0,u=0,f=0;do{if(!a)break;var p=yv(t,a),m=p[0],h=p[1],g=p[2],b=h-g-i*m;(m||b)&&bv(t,a)&&(u+=b,f+=m);var y=a.parentNode;a=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y;}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return (d&&(o&&Math.abs(u)<1||!o&&s>u)||!d&&(o&&Math.abs(f)<1||!o&&-s>f))&&(c=!0),c};var Hl=function(t){return "changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},wv=function(t){return [t.deltaX,t.deltaY]},xv=function(t){return t&&"current"in t?t.current:t},A1=function(t,e){return t[0]===e[0]&&t[1]===e[1]},O1=function(t){return `
|
|
64
|
+
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
65
|
+
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
66
|
+
`)},D1=0,Li=[];function Ev(t){var e=ee.useRef([]),n=ee.useRef([0,0]),r=ee.useRef(),o=ee.useState(D1++)[0],i=ee.useState(Oo)[0],s=ee.useRef(t);ee.useEffect(function(){s.current=t;},[t]),ee.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=kl([t.lockRef.current],(t.shards||[]).map(xv),!0).filter(Boolean);return h.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))});}}},[t.inert,t.lockRef.current,t.shards]);var a=ee.useCallback(function(h,g){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return !s.current.allowPinchZoom;var b=Hl(h),y=n.current,v="deltaX"in h?h.deltaX:y[0]-b[0],x="deltaY"in h?h.deltaY:y[1]-b[1],E,C=h.target,T=Math.abs(v)>Math.abs(x)?"h":"v";if("touches"in h&&T==="h"&&C.type==="range")return !1;var w=df(T,C);if(!w)return !0;if(w?E=T:(E=T==="v"?"h":"v",w=df(T,C)),!w)return !1;if(!r.current&&"changedTouches"in h&&(v||x)&&(r.current=E),!E)return !0;var N=r.current||E;return vv(N,g,h,N==="h"?v:x,!0)},[]),l=ee.useCallback(function(h){var g=h;if(!(!Li.length||Li[Li.length-1]!==i)){var b="deltaY"in g?wv(g):Hl(g),y=e.current.filter(function(E){return E.name===g.type&&(E.target===g.target||g.target===E.shadowParent)&&A1(E.delta,b)})[0];if(y&&y.should){g.cancelable&&g.preventDefault();return}if(!y){var v=(s.current.shards||[]).map(xv).filter(Boolean).filter(function(E){return E.contains(g.target)}),x=v.length>0?a(g,v[0]):!s.current.noIsolation;x&&g.cancelable&&g.preventDefault();}}},[]),c=ee.useCallback(function(h,g,b,y){var v={name:h,delta:g,target:b,should:y,shadowParent:P1(b)};e.current.push(v),setTimeout(function(){e.current=e.current.filter(function(x){return x!==v});},1);},[]),d=ee.useCallback(function(h){n.current=Hl(h),r.current=void 0;},[]),u=ee.useCallback(function(h){c(h.type,wv(h),h.target,a(h,t.lockRef.current));},[]),f=ee.useCallback(function(h){c(h.type,Hl(h),h.target,a(h,t.lockRef.current));},[]);ee.useEffect(function(){return Li.push(i),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Ho),document.addEventListener("touchmove",l,Ho),document.addEventListener("touchstart",d,Ho),function(){Li=Li.filter(function(h){return h!==i}),document.removeEventListener("wheel",l,Ho),document.removeEventListener("touchmove",l,Ho),document.removeEventListener("touchstart",d,Ho);}},[]);var p=t.removeScrollBar,m=t.inert;return ee.createElement(ee.Fragment,null,m?ee.createElement(i,{styles:O1(o)}):null,p?ee.createElement(Hs,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function P1(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var Sv=Fs(zl,Ev);var Cv=ee.forwardRef(function(t,e){return ee.createElement(Ks,ot({},t,{ref:e,sideCar:Sv}))});Cv.classNames=Ks.classNames;var Uo=Cv;var Kl="Dialog",[kv,bW]=Ut(Kl),[I1,Kn]=kv(Kl),Nv=t=>{let{__scopeDialog:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=t,a=ee.useRef(null),l=ee.useRef(null),[c,d]=Qn({prop:r,defaultProp:o??!1,onChange:i,caller:Kl});return jsx(I1,{scope:e,triggerRef:a,contentRef:l,contentId:sn(),titleId:sn(),descriptionId:sn(),open:c,onOpenChange:d,onOpenToggle:ee.useCallback(()=>d(u=>!u),[d]),modal:s,children:n})};Nv.displayName=Kl;var _v="DialogTrigger",Mv=ee.forwardRef((t,e)=>{let{__scopeDialog:n,...r}=t,o=Kn(_v,n),i=Le(e,o.triggerRef);return jsx(fe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":pf(o.open),...r,ref:i,onClick:J(t.onClick,o.onOpenToggle)})});Mv.displayName=_v;var uf="DialogPortal",[L1,Av]=kv(uf,{forceMount:void 0}),Ov=t=>{let{__scopeDialog:e,forceMount:n,children:r,container:o}=t,i=Kn(uf,e);return jsx(L1,{scope:e,forceMount:n,children:ee.Children.map(r,s=>jsx(Jt,{present:n||i.open,children:jsx(Tr,{asChild:!0,container:o,children:s})}))})};Ov.displayName=uf;var Vl="DialogOverlay",Dv=ee.forwardRef((t,e)=>{let n=Av(Vl,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,i=Kn(Vl,t.__scopeDialog);return i.modal?jsx(Jt,{present:r||i.open,children:jsx(B1,{...o,ref:e})}):null});Dv.displayName=Vl;var $1=Fn("DialogOverlay.RemoveScroll"),B1=ee.forwardRef((t,e)=>{let{__scopeDialog:n,...r}=t,o=Kn(Vl,n);return jsx(Uo,{as:$1,allowPinchZoom:!0,shards:[o.contentRef],children:jsx(fe.div,{"data-state":pf(o.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Vo="DialogContent",Pv=ee.forwardRef((t,e)=>{let n=Av(Vo,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,i=Kn(Vo,t.__scopeDialog);return jsx(Jt,{present:r||i.open,children:i.modal?jsx(F1,{...o,ref:e}):jsx(z1,{...o,ref:e})})});Pv.displayName=Vo;var F1=ee.forwardRef((t,e)=>{let n=Kn(Vo,t.__scopeDialog),r=ee.useRef(null),o=Le(e,n.contentRef,r);return ee.useEffect(()=>{let i=r.current;if(i)return Jr(i)},[]),jsx(Iv,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus();}),onPointerDownOutside:J(t.onPointerDownOutside,i=>{let s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault();}),onFocusOutside:J(t.onFocusOutside,i=>i.preventDefault())})}),z1=ee.forwardRef((t,e)=>{let n=Kn(Vo,t.__scopeDialog),r=ee.useRef(!1),o=ee.useRef(!1);return jsx(Iv,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1;},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));let s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault();}})}),Iv=ee.forwardRef((t,e)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=t,a=Kn(Vo,n),l=ee.useRef(null),c=Le(e,l);return Ii(),jsxs(Fragment$1,{children:[jsx(zo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:jsx(Qr,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":pf(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),jsxs(Fragment$1,{children:[jsx(H1,{titleId:a.titleId}),jsx(V1,{contentRef:l,descriptionId:a.descriptionId})]})]})}),ff="DialogTitle",Lv=ee.forwardRef((t,e)=>{let{__scopeDialog:n,...r}=t,o=Kn(ff,n);return jsx(fe.h2,{id:o.titleId,...r,ref:e})});Lv.displayName=ff;var $v="DialogDescription",Bv=ee.forwardRef((t,e)=>{let{__scopeDialog:n,...r}=t,o=Kn($v,n);return jsx(fe.p,{id:o.descriptionId,...r,ref:e})});Bv.displayName=$v;var Fv="DialogClose",zv=ee.forwardRef((t,e)=>{let{__scopeDialog:n,...r}=t,o=Kn(Fv,n);return jsx(fe.button,{type:"button",...r,ref:e,onClick:J(t.onClick,()=>o.onOpenChange(!1))})});zv.displayName=Fv;function pf(t){return t?"open":"closed"}var Hv="DialogTitleWarning",[yW,Uv]=Xy(Hv,{contentName:Vo,titleName:ff,docsSlug:"dialog"}),H1=({titleId:t})=>{let e=Uv(Hv),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
67
|
+
|
|
68
|
+
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
69
|
+
|
|
70
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return ee.useEffect(()=>{t&&(document.getElementById(t)||console.error(n));},[n,t]),null},U1="DialogDescriptionWarning",V1=({contentRef:t,descriptionId:e})=>{let r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Uv(U1).contentName}}.`;return ee.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(r));},[r,t,e]),null},Vv=Nv,Kv=Mv,Wv=Ov,mf=Dv,hf=Pv,gf=Lv,bf=Bv,Gv=zv;var to=Vv,Gs=Kv,j1=Wv;var Y1=cva("fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",{variants:{variant:{default:"bg-black/80",subtle:"bg-black/60",blur:"bg-black/40 backdrop-blur-md",minimal:"bg-black/20 backdrop-blur-sm"},animation:{default:"duration-200",slow:"duration-300",fast:"duration-100"}},defaultVariants:{variant:"default",animation:"default"}}),jv=ee.forwardRef(({className:t,variant:e,animation:n,...r},o)=>jsx(mf,{ref:o,className:I(Y1({variant:e,animation:n}),t),...r}));jv.displayName=mf.displayName;var X1=cva("fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg",{variants:{variant:{default:"border-gray-200 dark:border-gray-700",primary:"border-primary/20 dark:border-primary/30",secondary:"border-gray-300 dark:border-gray-600",ghost:"border-transparent shadow-xl",destructive:"border-error/20 dark:border-error/30"},size:{xs:"max-w-xs p-4",sm:"max-w-sm p-5",default:"max-w-lg p-6",md:"max-w-md p-6",lg:"max-w-2xl p-7",xl:"max-w-4xl p-8",full:"max-w-[95vw] max-h-[95vh] p-6"},radius:{none:"rounded-none",sm:"rounded-md",default:"rounded-lg",lg:"rounded-xl",xl:"rounded-2xl",full:"rounded-3xl"},animation:{default:"duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",fade:"duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",zoom:"duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",slide:"duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",none:""},position:{default:"top-[50%]",top:"top-[5%]",bottom:"bottom-[5%] top-auto translate-y-0"}},defaultVariants:{variant:"default",size:"default",radius:"default",animation:"default",position:"default"}}),kr=ee.forwardRef(({className:t,children:e,variant:n,size:r,radius:o,animation:i,position:s,overlayVariant:a="default",overlayAnimation:l="default",hideCloseButton:c=!1,title:d,description:u,icon:f,loading:p=!1,success:m=!1,onClose:h,...g},b)=>{let y=()=>{h&&h();};return jsxs(j1,{children:[jsx(jv,{variant:a,animation:l,onClick:c?void 0:y}),jsxs(hf,{ref:b,onEscapeKeyDown:c?void 0:y,onInteractOutside:c?void 0:y,className:I(X1({variant:n,size:r,radius:o,animation:i,position:s}),"outline-none",p&&"pointer-events-none",m&&"border-success/40",t),...g,children:[(d||u||f)&&jsxs(er,{className:"flex gap-4",children:[(f||p||m)&&jsxs("div",{className:"flex shrink-0 items-center justify-center",children:[p&&jsx(Loader2,{className:"h-5 w-5 animate-spin text-primary"}),m&&jsx(Check,{className:"h-5 w-5 text-success"}),!p&&!m&&f&&jsx("span",{className:"text-primary",children:f})]}),jsxs("div",{className:"flex-1",children:[d&&jsx(tr,{children:d}),u&&jsx(nr,{children:u})]})]}),e,!c&&jsxs(Gv,{onClick:y,className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:ring-offset-2 disabled:pointer-events-none dark:text-gray-300 dark:hover:text-white",children:[jsx(X$1,{className:"h-4 w-4"}),jsx("span",{className:"sr-only",children:"Close"})]})]})]})});kr.displayName=hf.displayName;var er=({className:t,...e})=>jsx("div",{className:I("flex flex-col space-y-2 text-center sm:text-left",t),...e});er.displayName="DialogHeader";var yf=({className:t,...e})=>jsx("div",{className:I("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end sm:space-x-2 mt-6",t),...e});yf.displayName="DialogFooter";var tr=ee.forwardRef(({className:t,...e},n)=>jsx(gf,{ref:n,className:I("text-xl font-semibold leading-snug tracking-tight dark:text-white",t),...e}));tr.displayName=gf.displayName;var nr=ee.forwardRef(({className:t,...e},n)=>jsx(bf,{ref:n,className:I("text-sm text-muted-foreground leading-normal dark:text-gray-400",t),...e}));nr.displayName=bf.displayName;var J1=ee.forwardRef(({className:t,...e},n)=>jsx("form",{ref:n,className:I("flex flex-col gap-4",t),...e}));J1.displayName="DialogForm";var eO=["#000000","#374151","#EF4444","#F97316","#F59E0B","#EAB308","#22C55E","#10B981","#06B6D4","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899","#F43F5E"],Fi=ee__default.forwardRef(({value:t="#000000",onChange:e,className:n,showInput:r=!1,showPresets:o=!0,size:i="default",presets:s=eO},a)=>{let[l,c]=useState(t),d=u=>{c(u),e?.(u);};return jsxs("div",{ref:a,className:I("space-y-2",n),children:[r&&jsx("input",{type:"color",value:l,onChange:u=>d(u.target.value),className:"w-full h-8 rounded border cursor-pointer"}),o&&jsx("div",{className:I("grid gap-2 p-2",i==="small"?"grid-cols-6":"grid-cols-4"),children:s.map(u=>jsx("button",{className:I("rounded border-2 hover:scale-110 transition-transform",i==="small"?"w-6 h-6":"w-8 h-8",l===u?"border-foreground":"border-muted"),style:{backgroundColor:u},onClick:()=>d(u),title:u},u))})]})});Fi.displayName="ColorPicker";var Yv=[{value:"meeting",label:"Meeting",color:"#3b82f6"},{value:"task",label:"Task",color:"#10b981"},{value:"reminder",label:"Reminder",color:"#f59e0b"},{value:"event",label:"Event",color:"#8b5cf6"}],aO=["#3b82f6","#10b981","#f59e0b","#8b5cf6","#ef4444","#06b6d4","#84cc16","#f97316","#ec4899","#6366f1","#14b8a6","#eab308","#f43f5e","#a855f7","#22c55e"];function Xv({open:t,onOpenChange:e,event:n,selectedDate:r,onSave:o,onDelete:i,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},m=async b=>{if(b.preventDefault(),!!p()){f(!0);try{let y={...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(v=>v.trim()).filter(Boolean):void 0};await o(y),e(!1);}catch(y){console.error("Error saving event:",y);}finally{f(!1);}}},h=()=>{n&&i&&(i(n.id),e(!1));},g=b=>{let y=Yv.find(v=>v.value===b);l(v=>({...v,type:b,color:y?.color||v.color}));};return jsx(to,{open:t,onOpenChange:e,children:jsxs(kr,{className:"sm:max-w-[500px]",children:[jsxs(er,{children:[jsxs(tr,{className:"flex items-center gap-2",children:[jsx(Calendar,{className:"w-5 h-5"}),s==="create"?"Create Event":"Edit Event"]}),jsx(nr,{children:s==="create"?"Add a new event to your calendar.":"Edit the event details."})]}),jsxs("form",{onSubmit:m,className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx(He,{htmlFor:"title",children:"Title *"}),jsx(Ft,{id:"title",value:a.title,onChange:b=>l(y=>({...y,title:b.target.value})),placeholder:"Event title",className:I(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(He,{htmlFor:"description",children:"Description"}),jsx(du,{id:"description",value:a.description,onChange:b=>l(y=>({...y,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(He,{htmlFor:"date",children:"Date *"}),jsx(Ft,{id:"date",type:"date",value:a.date,onChange:b=>l(y=>({...y,date:b.target.value})),className:I(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(He,{htmlFor:"startTime",children:"Start Time"}),jsx(Ft,{id:"startTime",type:"time",value:a.startTime,onChange:b=>l(y=>({...y,startTime:b.target.value})),placeholder:"09:00"})]}),jsxs("div",{className:"space-y-2",children:[jsx(He,{htmlFor:"endTime",children:"End Time"}),jsx(Ft,{id:"endTime",type:"time",value:a.endTime,onChange:b=>l(y=>({...y,endTime:b.target.value})),placeholder:"10:00",className:I(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(He,{htmlFor:"location",className:"flex items-center gap-2",children:[jsx(MapPin,{className:"w-4 h-4"}),"Location"]}),jsx(Ft,{id:"location",value:a.location,onChange:b=>l(y=>({...y,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(He,{className:"flex items-center gap-2",children:[jsx(Type,{className:"w-4 h-4"}),"Type"]}),jsxs($o,{value:a.type,onValueChange:g,children:[jsx(Bo,{children:jsx(Di,{})}),jsx(Fo,{children:Yv.map(b=>jsx(Ge,{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(He,{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(Fi,{value:a.color,onChange:b=>l(y=>({...y,color:b})),presets:aO,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(He,{htmlFor:"attendees",children:"Attendees"}),jsx(Ft,{id:"attendees",value:a.attendees,onChange:b=>l(y=>({...y,attendees:b.target.value})),placeholder:"John Doe, Jane Smith (comma-separated)"})]}),jsxs(yf,{className:"gap-2",children:[s==="edit"&&i&&jsx(xe,{type:"button",variant:"destructive",onClick:h,className:"mr-auto",children:"Delete Event"}),jsx(xe,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:u,children:"Cancel"}),jsx(xe,{type:"submit",disabled:u,children:u?s==="create"?"Creating...":"Saving...":s==="create"?"Create Event":"Save Changes"})]})]})]})})}var e0=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],gO=["January","February","March","April","May","June","July","August","September","October","November","December"],t0={meeting:"bg-blue-500",task:"bg-green-500",reminder:"bg-yellow-500",event:"bg-purple-500"};function XW({events:t=[],onEventClick:e,onEventAdd:n,onEventEdit:r,onEventDelete:o,className:i,showWeekends:s=!0,showEventDetails:a=!0,disabled:l=!1,minDate:c,maxDate:d,highlightToday:u=!0,height:f}){let p={hasAccess:!0},{hasProAccess:m,isLoading:h}=wi();if(!p.isDocsMode&&!h&&!m)return jsx(vr,{className:I("w-full",i),children:jsx(wr,{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(xe,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let [b,y]=ee__default.useState(new Date),[v,x]=ee__default.useState(null);ee__default.useState("month");let [T,w]=ee__default.useState(!1),[N,M]=ee__default.useState("create"),[B,U]=ee__default.useState(null),[K,P]=ee__default.useState(null),[V,R]=ee__default.useState(null),k=new Date,_=b.getMonth(),A=b.getFullYear(),L=new Date(A,_,1),Y=new Date(A,_+1,0),te=new Date(L);te.setDate(te.getDate()-te.getDay());let Se=new Date(Y);Se.setDate(Se.getDate()+(6-Se.getDay()));let he=[],ke=new Date(te);for(;ke<=Se;)he.push(new Date(ke)),ke.setDate(ke.getDate()+1);let Ae=G=>t.filter($=>new Date($.date).toDateString()===G.toDateString()),W=G=>G.toDateString()===k.toDateString(),ue=G=>G.getMonth()===_,Oe=G=>v&&G.toDateString()===v.toDateString(),Ce=G=>!!(l||c&&G<c||d&&G>d),le=G=>{let $=new Date(b);G==="prev"?$.setMonth(_-1):$.setMonth(_+1),y($);},Re=G=>{if(Ce(G))return;x(G);let $=Ae(G);$.length===0?(M("create"),U(null),w(!0)):$.length===1&&e?.($[0]);},$e=(G,$)=>{$.stopPropagation(),e?.(G);},Ke=(G,$)=>{P(G),$.dataTransfer.effectAllowed="move",$.dataTransfer.setData("text/plain",G.id);let j=$.target;j.style.opacity="0.5";},rt=G=>{P(null),R(null);let $=G.target;$.style.opacity="1";},Te=(G,$)=>{Ce(G)||!K||($.preventDefault(),$.dataTransfer.dropEffect="move",R(G));},wt=(G,$)=>{if($.preventDefault(),!(!K||Ce(G))){if(K.date.toDateString()!==G.toDateString()){let j={...K,date:G};r?.(j);}P(null),R(null);}},D=(G,$)=>{$.stopPropagation(),M("edit"),U(G),w(!0);},ne=(G,$)=>{$.stopPropagation(),o?.(G.id);},ce=G=>{N==="create"?n?.(G):N==="edit"&&G.id&&r?.(G);},re=G=>{o?.(G);},$t=()=>{y(new Date),x(new Date);},mn=s?he:he.filter(G=>{let $=G.getDay();return $!==0&&$!==6}),xs=s?e0:e0.slice(1,6);return jsxs(Fragment$1,{children:[jsxs(vr,{className:I("w-full max-w-full overflow-hidden",i),style:{height:f?`${f}px`:void 0},children:[jsx(Ss,{children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsxs(Cs,{className:"flex items-center gap-2",children:[jsx(Calendar,{className:"h-5 w-5"}),"Calendar"]}),jsxs(Rs,{children:[gO[_]," ",A]})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(xe,{variant:"outline",size:"sm",onClick:$t,children:"Today"}),jsx(xe,{variant:"outline",size:"sm",onClick:()=>le("prev"),disabled:l,children:jsx(ChevronLeft,{className:"h-4 w-4"})}),jsx(xe,{variant:"outline",size:"sm",onClick:()=>le("next"),disabled:l,children:jsx(ChevronRight,{className:"h-4 w-4"})})]})]})}),jsx(wr,{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:[xs.map(G=>jsx("div",{className:"p-1 text-center text-xs font-medium text-muted-foreground min-w-[70px]",children:G},G)),mn.map((G,$)=>{let j=Ae(G),ye=ue(G),De=W(G),Rt=Oe(G),$n=Ce(G);return jsxs("div",{className:I("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",!ye&&"text-muted-foreground bg-muted/20",De&&u&&"bg-primary/10 border-primary/50",Rt&&"bg-primary/20 border-primary",$n&&"cursor-not-allowed opacity-50",V&&V.toDateString()===G.toDateString()&&"bg-primary/30 border-primary"),onClick:()=>Re(G),onDragOver:Mt=>Te(G,Mt),onDrop:Mt=>wt(G,Mt),children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:I("text-sm font-medium",De&&"text-primary font-bold"),children:G.getDate()}),j.length>0&&jsx(Ts,{variant:"secondary",className:"text-xs px-1",children:j.length})]}),jsxs("div",{className:"flex-1 space-y-1 overflow-hidden",children:[j.slice(0,3).map(Mt=>jsxs("div",{className:I("text-xs p-1 mb-1 rounded text-white cursor-move group relative select-none block w-full truncate",Mt.color||t0[Mt.type||"event"]),draggable:!l,onClick:yr=>$e(Mt,yr),onDragStart:yr=>Ke(Mt,yr),onDragEnd:rt,style:{backgroundColor:Mt.color||void 0},children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"truncate flex-1",children:Mt.title}),a&&jsxs("div",{className:"hidden group-hover:flex items-center gap-1 ml-1",children:[jsx(xe,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 text-white/80 hover:text-white",onClick:yr=>D(Mt,yr),children:jsx(Edit,{className:"h-3 w-3"})}),jsx(xe,{variant:"ghost",size:"sm",className:"h-4 w-4 p-0 text-white/80 hover:text-white",onClick:yr=>ne(Mt,yr),children:jsx(Trash2,{className:"h-3 w-3"})})]})]}),Mt.startTime&&jsxs("div",{className:"flex items-center gap-1 mt-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsx("span",{children:Mt.startTime})]})]},Mt.id)),j.length>3&&jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["+",j.length-3," more"]})]})]},$)})]}),v&&jsxs("div",{className:"border rounded-lg p-4 bg-muted/50",children:[jsx("h4",{className:"font-medium mb-2",children:v.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsxs("div",{className:"space-y-2",children:[Ae(v).map(G=>jsxs("div",{className:"flex items-start gap-3 p-2 border rounded",children:[jsx("div",{className:I("w-3 h-3 rounded-full mt-1 flex-shrink-0",G.color||t0[G.type||"event"])}),jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h5",{className:"font-medium",children:G.title}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(xe,{variant:"ghost",size:"sm",onClick:$=>D(G,$),children:jsx(Edit,{className:"h-4 w-4"})}),jsx(xe,{variant:"ghost",size:"sm",onClick:$=>ne(G,$),children:jsx(Trash2,{className:"h-4 w-4"})})]})]}),G.description&&jsx("p",{className:"text-sm text-muted-foreground mt-1",children:G.description}),jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-2",children:[G.startTime&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Clock,{className:"h-3 w-3"}),jsxs("span",{children:[G.startTime," - ",G.endTime]})]}),G.location&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MapPin,{className:"h-3 w-3"}),jsx("span",{children:G.location})]}),G.attendees&&G.attendees.length>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(User,{className:"h-3 w-3"}),jsxs("span",{children:[G.attendees.length," attendees"]})]})]})]})]},G.id)),Ae(v).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(xe,{variant:"outline",size:"sm",onClick:()=>{M("create"),U(null),w(!0);},children:[jsx(Plus,{className:"h-4 w-4 mr-1"}),"Add Event"]})]})]})]})]})})]}),jsx(Xv,{open:T,onOpenChange:w,event:B,selectedDate:v,onSave:ce,onDelete:re,mode:N})]})}var vO=cva("relative flex shrink-0 overflow-hidden",{variants:{size:{default:"h-10 w-10",xs:"h-6 w-6",sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12",xl:"h-16 w-16","2xl":"h-20 w-20"},radius:{default:"rounded-full",sm:"rounded-md",lg:"rounded-xl",full:"rounded-full",none:"rounded-none"},variant:{default:"",ring:"ring-2 ring-gray-300 dark:ring-gray-600",ringOffset:"ring-2 ring-gray-300 dark:ring-gray-600 ring-offset-2 ring-offset-background dark:ring-offset-gray-950",border:"border-2 border-gray-200 dark:border-gray-800"}},defaultVariants:{size:"default",radius:"default",variant:"default"}}),Wl=ee.forwardRef(({className:t,size:e,radius:n,variant:r,...o},i)=>jsx(Nr.Root,{ref:i,className:I(vO({size:e,radius:n,variant:r}),t),...o}));Wl.displayName=Nr.Root.displayName;var xf=ee.forwardRef(({className:t,...e},n)=>jsx(Nr.Image,{ref:n,className:I("aspect-square h-full w-full",t),...e}));xf.displayName=Nr.Image.displayName;var Gl=ee.forwardRef(({className:t,...e},n)=>jsx(Nr.Fallback,{ref:n,className:I("flex h-full w-full items-center justify-center bg-muted",t),...e}));Gl.displayName=Nr.Fallback.displayName;var wO=ee.forwardRef(({className:t,limit:e,avatars:n,overlapOffset:r=-8,...o},i)=>{let s=e?n.slice(0,e):n,a=e?Math.max(0,n.length-e):0;return jsx("div",{ref:i,className:I("flex items-center",t),...o,children:jsxs("div",{className:"flex",children:[s.map((l,c)=>jsx("div",{className:"relative",style:{marginLeft:c===0?0:`${r}px`,zIndex:s.length-c},children:l},c)),a>0&&jsx("div",{className:"relative z-0",style:{marginLeft:`${r}px`},children:jsx(Wl,{variant:"border",children:jsxs(Gl,{children:["+",a]})})})]})})});wO.displayName="AvatarGroup";var MO={low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"};function f7({columns:t,onCardMove:e,onCardClick:n,onCardEdit:r,onCardDelete:o,onAddCard:i,onAddColumn:s,className:a,showAddColumn:l=!0,showCardDetails:c=!0,disabled:d=!1}){let u={hasAccess:!0},{hasProAccess:f,isLoading:p}=wi();if(!u.isDocsMode&&!p&&!f)return jsx(vr,{className:I("w-full",a),children:jsx(wr,{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(xe,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[h,g]=ee__default.useState(null),[b,y]=ee__default.useState(null),[v,x]=ee__default.useState(null),E=(k,_)=>{if(d)return;let A=t.find(L=>L.cards.some(Y=>Y.id===_));g(_),x(A?.id||null),k.dataTransfer.effectAllowed="move",k.dataTransfer.setData("text/plain",_),k.currentTarget.classList.add("opacity-50");},C=k=>{d||(g(null),y(null),x(null),k.currentTarget.classList.remove("opacity-50"));},T=(k,_)=>{d||(k.preventDefault(),k.dataTransfer.dropEffect="move",y(_));},w=(k,_)=>{d||(k.preventDefault(),y(_));},N=(k,_)=>{if(d)return;k.preventDefault();let A=k.currentTarget.getBoundingClientRect();(k.clientX<A.left||k.clientX>A.right||k.clientY<A.top||k.clientY>A.bottom)&&y(null);},M=(k,_)=>{if(d)return;k.preventDefault();let A=k.dataTransfer.getData("text/plain")||h;if(A&&e&&v&&v!==_){let Y=t.find(te=>te.id===_)?.cards.length||0;e(A,v,_,Y);}g(null),y(null),x(null);},B=k=>{d||n?.(k);},U=(k,_)=>{d||(_.stopPropagation(),r?.(k));},K=(k,_)=>{d||(_.stopPropagation(),o?.(k));},P=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric"}),V=k=>k<new Date,R=k=>k.split(" ").map(_=>_[0]).join("").toUpperCase();return jsx("div",{className:I("w-full",a),children:jsxs("div",{className:"flex gap-6 overflow-x-auto pb-4",children:[t.map(k=>{let _=k.limit&&k.cards.length>k.limit,A=b===k.id;return jsx("div",{className:I("flex-shrink-0 w-80 transition-colors duration-200",A&&"bg-primary/5 rounded-lg border-2 border-primary/20"),onDragOver:L=>T(L,k.id),onDragEnter:L=>w(L,k.id),onDragLeave:L=>N(L,k.id),onDrop:L=>M(L,k.id),children:jsxs(vr,{className:"h-full",children:[jsxs(Ss,{className:"pb-3",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[k.color&&jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.color}}),jsx(Cs,{className:"text-sm font-medium",children:k.title}),jsx(Ts,{variant:"secondary",className:"text-xs",children:k.cards.length})]}),jsx(xe,{variant:"ghost",size:"sm",children:jsx(MoreHorizontal,{className:"h-4 w-4"})})]}),k.limit&&jsx(Rs,{className:I("text-xs",_&&"text-destructive"),children:_?"Over limit":`${k.cards.length}/${k.limit} cards`})]}),jsxs(wr,{className:"space-y-3",children:[k.cards.map(L=>jsxs("div",{draggable:!d,onDragStart:Y=>E(Y,L.id),onDragEnd:C,onClick:()=>B(L),className:I("p-3 bg-background border rounded-lg cursor-pointer hover:shadow-md transition-all duration-200","group relative select-none",h===L.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:L.title}),L.description&&jsx("p",{className:"text-xs text-muted-foreground mb-2 line-clamp-2",children:L.description})]}),jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[jsx(xe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:Y=>U(L,Y),children:jsx(Edit,{className:"h-3 w-3"})}),jsx(xe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:Y=>K(L,Y),children:jsx(Trash2,{className:"h-3 w-3"})}),jsx("div",{className:"cursor-move",children:jsx(GripVertical,{className:"h-3 w-3 text-muted-foreground"})})]})]}),L.tags&&L.tags.length>0&&jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:L.tags.map((Y,te)=>jsx(Ts,{variant:"outline",className:"text-xs px-1 py-0",children:Y},te))}),c&&jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[jsxs("div",{className:"flex items-center gap-2",children:[L.priority&&jsxs("div",{className:"flex items-center gap-1",children:[jsx("div",{className:I("w-2 h-2 rounded-full",MO[L.priority])}),jsx("span",{className:"capitalize",children:L.priority})]}),L.dueDate&&jsxs("div",{className:I("flex items-center gap-1",V(L.dueDate)&&"text-destructive"),children:[jsx(Calendar,{className:"h-3 w-3"}),jsx("span",{children:P(L.dueDate)})]})]}),jsxs("div",{className:"flex items-center gap-2",children:[L.comments&&L.comments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(MessageCircle,{className:"h-3 w-3"}),jsx("span",{children:L.comments})]}),L.attachments&&L.attachments>0&&jsxs("div",{className:"flex items-center gap-1",children:[jsx(Paperclip,{className:"h-3 w-3"}),jsx("span",{children:L.attachments})]}),L.assignee&&jsxs(Wl,{className:"h-5 w-5",children:[jsx(xf,{src:L.assignee.avatar}),jsx(Gl,{className:"text-xs",children:R(L.assignee.name)})]})]})]})]},L.id)),i&&jsxs(xe,{variant:"ghost",size:"sm",onClick:()=>i(k.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"]})]})]})},k.id)}),l&&s&&jsx("div",{className:"flex-shrink-0 w-80",children:jsxs(xe,{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 EE=Es(js(),1);function Wt(t){this.content=t;}Wt.prototype={constructor:Wt,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,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Wt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Wt(n)},addToStart:function(t,e){return new Wt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Wt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Wt(o)},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=Wt.from(t),t.size?new Wt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Wt.from(t),t.size?new Wt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Wt.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}};Wt.from=function(t){if(t instanceof Wt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Wt(e)};var Rf=Wt;function b0(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=b0(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize;}}function y0(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),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=y0(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l;}}var O=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,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,o+a,i||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,o+d);}a=c;}}descendants(e){this.nodesBetween(0,this.size,e);}textBetween(e,n,r,o){let i="",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?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c;},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new O(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],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),o+=a.nodeSize),s=l;}return new O(r,o)}cutByIndex(e,n){return e==n?O.empty:e==0&&n==this.content.length?this:new O(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new O(o,i)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(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 o=this.content[n];e(o,r,n),r+=o.nodeSize;}}findDiffStart(e,n=0){return b0(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return y0(this,e,n,r)}findIndex(e){if(e==0)return ql(0,e);if(e==this.size)return ql(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 o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?ql(n+1,i):ql(n,r);r=i;}}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 O.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i);}return new O(n||e,r)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};O.empty=new O([],0);var Tf={index:0,offset:0};function ql(t,e){return Tf.index=t,Tf.offset=e,Tf}function Yl(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(!Yl(t[r],e[r]))return !1}else {for(let r in t)if(!(r in e)||!Yl(t[r],e[r]))return !1;for(let r in e)if(!(r in t))return !1}return !0}var _e=class{constructor(e,n){this.type=e,this.attrs=n;}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else {if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i);}}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&&Yl(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 o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}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 _e.none;if(e instanceof _e)return [e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};_e.none=[];var qo=class extends Error{},H=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=w0(this.content,e+this.openStart,n);return r&&new H(r,this.openStart,this.openEnd)}removeBetween(e,n){return new H(v0(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 H.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(O.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new H(e,r,o)}};H.empty=new H(O.empty,0,0);function v0(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.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,i.copy(v0(i.content,e-o-1,n-o-1)))}function w0(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=w0(s.content,e-i-1,n);return a&&t.replaceChild(o,s.copy(a))}function zO(t,e,n){if(n.openStart>t.depth)throw new qo("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new qo("Inconsistent open depths");return x0(t,e,n,0)}function x0(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=x0(t,e,n,r+1);return i.copy(i.content.replaceChild(o,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 Go(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else {let{start:s,end:a}=HO(n,t);return Go(i,S0(t,s,a,e,r))}else return Go(i,Xl(t,e,r))}function E0(t,e){if(!e.type.compatibleContent(t.type))throw new qo("Cannot join "+e.type.name+" onto "+t.type.name)}function Nf(t,e,n){let r=t.node(n);return E0(r,e.node(n)),r}function Wo(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 Ys(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Wo(t.nodeAfter,r),i++));for(let a=i;a<s;a++)Wo(o.child(a),r);e&&e.depth==n&&e.textOffset&&Wo(e.nodeBefore,r);}function Go(t,e){return t.type.checkContent(e),t.copy(e)}function S0(t,e,n,r,o){let i=t.depth>o&&Nf(t,e,o+1),s=r.depth>o&&Nf(n,r,o+1),a=[];return Ys(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(E0(i,s),Wo(Go(i,S0(t,e,n,r,o+1)),a)):(i&&Wo(Go(i,Xl(t,e,o+1)),a),Ys(e,n,o,a),s&&Wo(Go(s,Xl(n,r,o+1)),a)),Ys(r,null,o,a),new O(a)}function Xl(t,e,n){let r=[];if(Ys(null,t,n,r),t.depth>n){let o=Nf(t,e,n+1);Wo(Go(o,Xl(t,e,n+1)),r);}return Ys(e,null,n,r),new O(r)}function HO(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(O.from(o));return {start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var jo=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],o=e.child(n);return r?e.child(n).cut(r):o}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],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a;}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].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 Yo(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=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1;}return new jo(n,r,i)}static resolveCached(e,n){let r=l0.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else l0.set(e,r=new _f);let o=r.elts[r.i]=jo.resolve(e,n);return r.i=(r.i+1)%UO,o}},_f=class{constructor(){this.elts=[],this.i=0;}},UO=12,l0=new WeakMap,Yo=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)}},VO=Object.create(null),Ot=class{constructor(e,n,r,o=_e.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||O.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,o=0){this.content.nodesBetween(e,n,r,o,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,o){return this.content.textBetween(e,n,r,o)}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&&Yl(this.attrs,n||e.defaultAttrs||VO)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new Ot(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ot(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 H.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new H(c,o.depth-s,i.depth-s)}replace(e,n,r){return zO(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+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 o=this.content.child(n-1);return {node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return jo.resolveCached(this,e)}resolveNoCache(e){return jo.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),C0(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=O.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return !1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return !1;return !0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return !1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.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=_e.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(!_e.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 o=O.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Ot.prototype.text=void 0;var Ui=class extends Ot{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r;}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):C0(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 Ui(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ui(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 C0(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var _r=class{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[];}static parse(e,n){let r=new Mf(e,n);if(r.next==null)return _r.empty;let o=R0(r);r.next&&r.err("Unexpected trailing text");let i=XO(YO(o));return JO(i,r),i}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 o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}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 o=[this];function i(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return O.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())&&o.indexOf(u)==-1){o.push(u);let f=i(u,a.concat(d));if(f)return f}}return null}return i(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 o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),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 o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next);}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
71
|
+
`)}};_r.empty=new _r(!0);var Mf=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 R0(t){let e=[];do e.push(KO(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function KO(t){let e=[];do e.push(WO(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function WO(t){let e=jO(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=GO(t,e);else break;return e}function c0(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function GO(t,e){let n=c0(t),r=n;return t.eat(",")&&(t.next!="}"?r=c0(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function qO(t,e){let n=t.nodeTypes,r=n[e];if(r)return [r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s);}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function jO(t){if(t.eat("(")){let e=R0(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=qO(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 YO(t){let e=[[]];return o(i(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 o(s,a){s.forEach(l=>l.to=a);}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n());}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else {if(s.type=="opt")return [r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let d=n();o(i(s.expr,l),d),l=d;}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let d=n();r(l,d),o(i(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 T0(t,e){return e-t}function d0(t,e){let n=[];return r(e),n.sort(T0);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l);}}}function XO(t){let e=Object.create(null);return n(d0(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<o.length;d++)o[d][0]==a&&(c=o[d][1]);d0(t,l).forEach(d=>{c||o.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d);});});});let i=e[r.join(",")]=new _r(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(T0);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)});}return i}}function JO(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c);}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)");}}function k0(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 N0(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o;}return n}function _0(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o]);}}function M0(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Af(t,r,e[r]);return n}var Vi=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=M0(e,r.attrs),this.defaultAttrs=k0(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==_r.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:N0(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ot(this,this.computeAttrs(e),O.from(n),_e.setFrom(r))}createChecked(e=null,n,r){return n=O.from(n),this.checkContent(n),new Ot(this,this.computeAttrs(e),n,_e.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=O.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n);}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(O.empty,!0);return i?new Ot(this,e,n.append(i),_e.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){_0(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:_e.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Vi(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function ZO(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}var Af=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?ZO(e,n,r.validate):r.validate;}get isRequired(){return !this.hasDefault}},Xo=class{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=M0(e,o.attrs),this.excluded=null;let i=k0(this.attrs);this.instance=i?new _e(this,i):null;}create(e=null){return !e&&this.instance?this.instance:new _e(this,N0(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Xo(i,o++,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){_0(this.attrs,e,"mark",this.name);}excludes(e){return this.excluded.indexOf(e)>-1}},Ki=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Rf.from(e.nodes),n.marks=Rf.from(e.marks||{}),this.nodes=Vi.compile(this.spec.nodes,this),this.marks=Xo.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=_r.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i;}i.markSet=a=="_"?null:a?u0(this,a.split(" ")):a==""||!i.inlineContent?[]:null;}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:u0(this,s.split(" "));}this.nodeFromJSON=o=>Ot.fromJSON(this,o),this.markFromJSON=o=>_e.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null);}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Vi){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,o)}text(e,n){let r=this.nodes.text;return new Ui(r,r.defaultAttrs,e,_e.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 u0(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l);}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function QO(t){return t.tag!=null}function eD(t){return t.style!=null}var gn=class{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(QO(o))this.tags.push(o);else if(eD(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o);}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return !1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)});}parse(e,n={}){let r=new Jl(this,n,!1);return r.addAll(e,_e.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Jl(this,n,!0);return r.addAll(e,_e.none,n.from,n.to),H.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(rD(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0;}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],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(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o);}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=p0(s)),s.mark||s.ignore||s.clearMark||(s.mark=o);});}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=p0(s)),s.node||s.ignore||s.mark||(s.node=o);});}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gn(e,gn.schemaRules(e)))}},A0={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},tD={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},O0={ol:!0,ul:!0},Js=1,Of=2,Xs=4;function f0(t,e,n){return e!=null?(e?Js:0)|(e==="full"?Of:0):t&&t.whitespace=="pre"?Js|Of:n&~Xs}var Hi=class{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=_e.none,this.match=i||(s&Xs?null:e.contentMatch);}findWrapping(e){if(!this.match){if(!this.type)return [];let n=this.type.contentMatch.fillBefore(O.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else {let r=this.type.contentMatch,o;return (o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Js)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length));}}let n=O.from(this.content);return !e&&this.match&&(n=n.append(this.match.fillBefore(O.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&&!A0.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Jl=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=f0(null,n.preserveWhitespace,0)|(r?Xs:0);o?i=new Hi(o.type,o.attrs,_e.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Hi(null,null,_e.none,!0,null,s):i=new Hi(e.schema.topNodeType,null,_e.none,!0,null,s),this.nodes=[i],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,o=this.top,i=o.options&Of?"full":this.localPreserveWS||(o.options&Js)>0;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)i!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
72
|
+
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=o.content[o.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 o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;O0.hasOwnProperty(s)&&this.parser.normalizeLists&&nD(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:tD.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(A0.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.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(i),this.needsBlock=d;}else {let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0);}this.localPreserveWS=o;}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
73
|
+
`),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 o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,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,o){let i,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&&(i=!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(o)this.addElement(e,r,o);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);}i&&this.sync(a)&&this.open--;}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i);}findPlace(e,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2;}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n));}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=_e.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):m0(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return !1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=f0(e,i,s.options);s.options&Xs&&s.content.length==0&&(a|=Xs);let l=_e.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):m0(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Hi(e,n,l,o,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|=Js);}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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?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>=i;l--)if(s(a-1,l))return !0;return !1}else {let d=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).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 nD(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&O0.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null);}}function rD(t,e){return (t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function p0(t){let e={};for(let n in t)e[n]=t[n];return e}function m0(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||i.indexOf(d)<0&&s(d))return !0}};if(s(o.contentMatch))return !0}}var Wn=class{constructor(e,n){this.nodes=e,this.marks=n;}serializeFragment(e,n={},r){r||(r=kf(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++;}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],d=this.serializeMark(c,s.isInline,n);d&&(i.push([c,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom);}}o.appendChild(this.serializeNodeInner(s,n));}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=jl(kf(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o);}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom);}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&jl(kf(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return jl(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=h0(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return h0(e.marks)}};function h0(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r);}return e}function kf(t){return t.document||window.document}var g0=new WeakMap;function oD(t){let e=g0.get(t);return e===void 0&&g0.set(t,e=iD(t)),e}function iD(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 o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o]);}return n(t),e}function jl(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 o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=oD(r))&&i.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=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),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:m}=jl(t,f,n,r);if(l.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m;}}}return {dom:l,contentDOM:a}}var I0=65535,L0=Math.pow(2,16);function sD(t,e){return t+e*L0}function D0(t){return t&I0}function aD(t){return (t-(t&I0))/L0}var $0=1,B0=2,Zl=4,F0=8,ea=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r;}get deleted(){return (this.delInfo&F0)>0}get deletedBefore(){return (this.delInfo&($0|Zl))>0}get deletedAfter(){return (this.delInfo&(B0|Zl))>0}get deletedAcross(){return (this.delInfo&Zl)>0}},Zt=class{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Zt.empty)return Zt.empty}recover(e){let n=0,r=D0(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+aD(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 o=0,i=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?o:0);if(l>e)break;let c=this.ranges[a+i],d=this.ranges[a+s],u=l+c;if(e<=u){let f=c?e==l?-1:e==u?1:n:n,p=l+o+(f<0?0:d);if(r)return p;let m=e==(n<0?l:u)?null:sD(a/3,e-l),h=e==l?B0:e==u?$0:Zl;return (n<0?e!=l:e!=u)&&(h|=F0),new ea(p,h,m)}o+=d-c;}return r?e+o:new ea(e+o,0,null)}touches(e,n){let r=0,o=D0(n),i=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+i],d=l+c;if(e<=d&&a==o*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 o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],d=this.ranges[o+r];e(a,a+c,l,l+d),i+=d-c;}}invert(){return new Zt(this.ranges,!this.inverted)}toString(){return (this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Zt.empty:new Zt(e<0?[0,-e,0]:[0,0,e])}};Zt.empty=new Zt([]);var oo=class{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n);}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new oo(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 o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o: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 o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0);}}invert(){let e=new oo;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 o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos;}return r?e:new ea(e,o,null)}},Df=Object.create(null),kt=class{getMap(){return Zt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Df[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 Df)throw new RangeError("Duplicate use of step JSON ID "+e);return Df[e]=n,n.prototype.jsonID=e,n}},st=class{constructor(e,n){this.doc=e,this.failed=n;}static ok(e){return new st(e,null)}static fail(e){return new st(null,e)}static fromReplace(e,n,r,o){try{return st.ok(e.replace(n,r,o))}catch(i){if(i instanceof qo)return st.fail(i.message);throw i}}};function Bf(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Bf(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i);}return O.fromArray(r)}var rr=class extends kt{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),o=r.node(r.sharedDepth(this.to)),i=new H(Bf(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,i)}invert(){return new cn(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 rr(n.pos,r.pos,this.mark)}merge(e){return e instanceof rr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new rr(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 rr(n.from,n.to,e.markFromJSON(n.mark))}};kt.jsonID("addMark",rr);var cn=class extends kt{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 H(Bf(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,r)}invert(){return new rr(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 cn(n.pos,r.pos,this.mark)}merge(e){return e instanceof cn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new cn(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 cn(n.from,n.to,e.markFromJSON(n.mark))}};kt.jsonID("removeMark",cn);var or=class extends kt{constructor(e,n){super(),this.pos=e,this.mark=n;}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return st.fromReplace(e,this.pos,this.pos+1,new H(O.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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new or(this.pos,n.marks[o]);return new or(this.pos,this.mark)}}return new Mr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new or(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 or(n.pos,e.markFromJSON(n.mark))}};kt.jsonID("addNodeMark",or);var Mr=class extends kt{constructor(e,n){super(),this.pos=e,this.mark=n;}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return st.fromReplace(e,this.pos,this.pos+1,new H(O.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return !n||!this.mark.isInSet(n.marks)?this:new or(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mr(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 Mr(n.pos,e.markFromJSON(n.mark))}};kt.jsonID("removeNodeMark",Mr);var et=class extends kt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o;}apply(e){return this.structure&&Lf(e,this.from,this.to)?st.fail("Structure replace would overwrite content"):st.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Zt([this.from,this.to-this.from,this.slice.size])}invert(e){return new et(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 et(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof et)||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?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new et(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?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new et(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 et(n.from,n.to,H.fromJSON(e,n.slice),!!n.structure)}};kt.jsonID("replace",et);var Ye=class extends kt{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a;}apply(e){if(this.structure&&(Lf(e,this.from,this.gapFrom)||Lf(e,this.gapTo,this.to)))return st.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return st.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?st.fromReplace(e,this.from,this.to,r):st.fail("Content does not fit in gap")}getMap(){return new Zt([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 Ye(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),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new Ye(n.pos,r.pos,o,i,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 Ye(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}};kt.jsonID("replaceAround",Ye);function Lf(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return !0;s=s.firstChild,o--;}}return !1}function lD(t,e,n,r){let o=[],i=[],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),m=r.addToSet(u);for(let h=0;h<u.length;h++)u[h].isInSet(m)||(s&&s.to==f&&s.mark.eq(u[h])?s.to=p:o.push(s=new cn(f,p,u[h])));a&&a.to==f?a.to=p:i.push(a=new rr(f,p,r));}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l));}function cD(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Xo){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<o.length;p++){let m=o[p];m.step==i-1&&u.eq(o[p].style)&&(f=m);}f?(f.to=c,f.step=i):o.push({style:u,from:Math.max(a,e),to:c,step:i});}}}),o.forEach(s=>t.step(new cn(s.from,s.to,s.style)));}function Ff(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new et(a,d,H.empty));else {r=u;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new cn(a,d,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,m;for(;f=p.exec(c.text);)m||(m=new H(O.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new et(a+f.index,a+f.index+f[0].length,m));}}a=d;}if(!r.validEnd){let l=r.fillBefore(O.empty,!0);t.replace(a,a,new H(l,0,0));}for(let l=s.length-1;l>=0;l--)t.step(s[l]);}function dD(t,e,n){return (e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ar(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),i=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!dD(o,i,s))break}return null}function uD(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,c=a,d=O.empty,u=0;for(let m=i,h=!1;m>n;m--)h||r.index(m)>0?(h=!0,d=O.from(r.node(m).copy(d)),u++):l--;let f=O.empty,p=0;for(let m=i,h=!1;m>n;m--)h||o.after(m+1)<o.end(m)?(h=!0,f=O.from(o.node(m).copy(f)),p++):c++;t.step(new Ye(l,c,s,a,new H(d.append(f),u,p),d.size-u,!0));}function Gi(t,e,n=null,r=t){let o=fD(t,e),i=o&&pD(r,e);return i?o.map(P0).concat({type:e,attrs:n}).concat(i.map(P0)):null}function P0(t){return {type:t,attrs:null}}function fD(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function pD(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return !l||!l.validEnd?null:s}function mD(t,e,n){let r=O.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=O.from(n[s].type.create(n[s].attrs,r));}let o=e.start,i=e.end;t.step(new Ye(o,i,o,i,new H(r,0,0),n.length,!0));}function hD(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&gD(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0);}c===!1&&H0(t,s,a,i),Ff(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let d=t.mapping.slice(i),u=d.map(a,1),f=d.map(a+s.nodeSize,1);return t.step(new Ye(u,f,u+1,f-1,new H(O.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&z0(t,s,a,i),!1}});}function z0(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create());}}});}function H0(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
74
|
+
`));}});}function gD(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function bD(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ye(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new H(O.from(s),0,0),1,!0));}function bn(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return !1;for(let c=o.depth-1,d=n-2;c>i;c--,d--){let u=o.node(c),f=o.index(c);if(u.type.spec.isolating)return !1;let p=u.content.cutByIndex(f,u.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let h=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!h.type.validContent(p))return !1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function yD(t,e,n=1,r){let o=t.doc.resolve(e),i=O.empty,s=O.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=O.from(o.node(a).copy(i));let d=r&&r[c];s=O.from(d?d.type.create(d.attrs,s):o.node(a).copy(s));}t.step(new et(e,e,new H(i.append(s),n,n),!0));}function kn(t,e){let n=t.resolve(e),r=n.index();return U0(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function vD(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return !1}return n.validEnd}function U0(t,e){return !!(t&&e&&!t.isLeaf&&vD(t,e))}function Zo(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&U0(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o);}}function wD(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let d=s.whitespace=="pre",u=!!s.contentMatch.matchType(o);d&&!u?r=!1:!d&&u&&(r=!0);}let a=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);H0(t,d.node(),d.before(),a);}s.inlineContent&&Ff(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new et(c,l.map(e+n,-1),H.empty,!0)),r===!0){let d=t.doc.resolve(c);z0(t,d.node(),d.before(),t.steps.length);}return t}function xD(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 o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Ql(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)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(i==1)d=c.canReplace(l,l,o);else {let u=c.contentMatchAt(l).findWrapping(o.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 ta(t,e,n=e,r=H.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return V0(o,i,r)?new et(e,n,r):new $f(o,i,r).fit()}function V0(t,e,n){return !n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var $f=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=O.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))});}for(let o=e.depth;o>0;o--)this.placed=O.from(e.node(o).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,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new H(i,s,a);return e>-1?new Ye(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new et(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content;}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Pf(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.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(O.from(s),!1)):i&&l.compatibleContent(i.type)))return {sliceDepth:r,frontierDepth:a,parent:i,inject:u};if(n==2&&s&&(d=c.findWrapping(s.type)))return {sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Pf(e,n);return !o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new H(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Pf(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new H(Zs(e,n-1,1),n-1,i?n-1:r);}else this.unplaced=new H(Zs(e,n,1),n,r);}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let h=0;h<i.length;h++)this.openFrontierNode(i[h]);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(o){for(let h=0;h<o.childCount;h++)d.push(o.child(h));u=u.matchFragment(o);}let p=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let h=a.child(c),g=u.matchType(h.type);if(!g)break;c++,(c>1||l==0||h.content.size)&&(u=g,d.push(K0(h.mark(f.allowedMarks(h.marks)),c==1?l:0,c==a.childCount?p:-1)));}let m=c==a.childCount;m||(p=-1),this.placed=Qs(this.placed,n,O.from(d)),this.frontier[n].match=u,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let h=0,g=a;h<p;h++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content;}this.unplaced=m?e==0?H.empty:new H(Zs(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new H(Zs(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||!If(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,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=If(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=If(e,a,c,l,!0);if(!d||d.childCount)continue e}return {depth:n,fit:s,move:i?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=Qs(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i);}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Qs(this.placed,this.depth,O.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch});}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(O.empty,!0);n.childCount&&(this.placed=Qs(this.placed,this.frontier.length,n));}};function Zs(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Zs(t.firstChild.content,e-1,n)))}function Qs(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Qs(t.lastChild.content,e-1,n)))}function Pf(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function K0(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,K0(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(O.empty,!0)))),t.copy(r)}function If(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!ED(n,i.content,s)?a:null}function ED(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return !0;return !1}function SD(t){return t.spec.defining||t.spec.definingForContent}function CD(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(V0(o,i,r))return t.step(new et(e,n,r));let s=G0(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let m=o.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(f)>-1?a=f:o.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 m=f.firstChild;if(c.push(m),p==r.openStart)break;f=m.content;}for(let f=d-1;f>=0;f--){let p=c[f],m=SD(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(a)-1)))d=f;else if(m||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+d+1)%(r.openStart+1),m=c[p];if(m)for(let h=0;h<s.length;h++){let g=s[(h+l)%s.length],b=!0;g<0&&(b=!1,g=-g);let y=o.node(g-1),v=o.index(g-1);if(y.canReplaceWith(v,v,m.type,m.marks))return t.replace(o.before(g),b?i.after(g):n,new H(W0(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=o.before(p),n=i.after(p));}}function W0(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(W0(i.content,e+1,n,r,i)));}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(O.empty,!0));}return t}function RD(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=xD(t.doc,e,r.type);o!=null&&(e=n=o);}t.replaceRange(e,n,new H(O.from(r),0,0));}function TD(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=G0(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n);}function G0(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o);}return n}var ro=class extends kt{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 st.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return st.fromReplace(e,this.pos,this.pos+1,new H(O.from(o),0,n.isLeaf?0:1))}getMap(){return Zt.empty}invert(e){return new ro(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 ro(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 ro(n.pos,n.attr,n.value)}};kt.jsonID("attr",ro);var Jo=class extends kt{constructor(e,n){super(),this.attr=e,this.value=n;}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return st.ok(r)}getMap(){return Zt.empty}invert(e){return new Jo(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 Jo(n.attr,n.value)}};kt.jsonID("docAttr",Jo);var Wi=class extends Error{};Wi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Wi.prototype=Object.create(Error.prototype);Wi.prototype.constructor=Wi;Wi.prototype.name="TransformError";var io=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new oo;}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Wi(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=H.empty){let o=ta(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new H(O.from(r),0,0))}delete(e,n){return this.replace(e,n,H.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return CD(this,e,n,r),this}replaceRangeWith(e,n,r){return RD(this,e,n,r),this}deleteRange(e,n){return TD(this,e,n),this}lift(e,n){return uD(this,e,n),this}join(e,n=1){return wD(this,e,n),this}wrap(e,n){return mD(this,e,n),this}setBlockType(e,n=e,r,o=null){return hD(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return bD(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new ro(e,n,r)),this}setDocAttribute(e,n){return this.step(new Jo(e,n)),this}addNodeMark(e,n){return this.step(new or(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 _e)n.isInSet(r.marks)&&this.step(new Mr(e,n));else {let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new Mr(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a]);}return this}split(e,n=1,r){return yD(this,e,n,r),this}addMark(e,n,r){return lD(this,e,n,r),this}removeMark(e,n,r){return cD(this,e,n,r),this}clearIncompatible(e,n,r){return Ff(this,e,n,r),this}};var zf=Object.create(null),Z=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new ji(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=H.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=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(i);e.replaceRange(d.map(l.pos),d.map(c.pos),a?H.empty:n),a==0&&Y0(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1);}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=e.mapping.slice(r),c=l.map(s.pos),d=l.map(a.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),Y0(e,r,n.isInline?-1:1));}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new q(e):qi(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?qi(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):qi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Et(e.node(0))}static atStart(e){return qi(e,e,0,0,1)||new Et(e)}static atEnd(e){return qi(e,e,e.content.size,e.childCount,-1)||new Et(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=zf[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 zf)throw new RangeError("Duplicate use of selection JSON ID "+e);return zf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return q.between(this.$anchor,this.$head).getBookmark()}};Z.prototype.visible=!0;var ji=class{constructor(e,n){this.$from=e,this.$to=n;}},q0=!1;function j0(t){!q0&&!t.parent.inlineContent&&(q0=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"));}var q=class extends Z{constructor(e,n=e){j0(e),j0(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 Z.near(r);let o=e.resolve(n.map(this.anchor));return new q(o.parent.inlineContent?o:r,r)}replace(e,n=H.empty){if(super.replace(e,n),n==H.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r);}}eq(e){return e instanceof q&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Yi(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 q(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Z.findFrom(n,r,!0)||Z.findFrom(n,-r,!0);if(i)n=i.$head;else return Z.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Z.findFrom(e,-r,!0)||Z.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new q(e,n)}};Z.jsonID("text",q);var Yi=class{constructor(e,n){this.anchor=e,this.head=n;}map(e){return new Yi(e.map(this.anchor),e.map(this.head))}resolve(e){return q.between(e.resolve(this.anchor),e.resolve(this.head))}},X=class extends Z{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:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?Z.near(i):new X(i)}content(){return new H(O.from(this.node),0,0)}eq(e){return e instanceof X&&e.anchor==this.anchor}toJSON(){return {type:"node",anchor:this.anchor}}getBookmark(){return new ra(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new X(e.resolve(n.anchor))}static create(e,n){return new X(e.resolve(n))}static isSelectable(e){return !e.isText&&e.type.spec.selectable!==!1}};X.prototype.visible=!1;Z.jsonID("node",X);var ra=class{constructor(e){this.anchor=e;}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Yi(r,r):new ra(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&X.isSelectable(r)?new X(n):Z.near(n)}},Et=class extends Z{constructor(e){super(e.resolve(0),e.resolve(e.content.size));}replace(e,n=H.empty){if(n==H.empty){e.delete(0,e.doc.content.size);let r=Z.atStart(e.doc);r.eq(e.selection)||e.setSelection(r);}else super.replace(e,n);}toJSON(){return {type:"all"}}static fromJSON(e){return new Et(e)}map(e){return new Et(e)}eq(e){return e instanceof Et}getBookmark(){return kD}};Z.jsonID("all",Et);var kD={map(){return this},resolve(t){return new Et(t)}};function qi(t,e,n,r,o,i=!1){if(e.inlineContent)return q.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&X.isSelectable(a))return X.create(t,n-(o<0?a.nodeSize:0))}else {let l=qi(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o;}return null}function Y0(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof et||o instanceof Ye))return;let i=t.mapping.maps[r],s;i.forEach((a,l,c,d)=>{s==null&&(s=d);}),t.setSelection(Z.near(t.doc.resolve(s),n));}var X0=1,ec=2,J0=4,Uf=class extends io{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|X0)&~ec,this.storedMarks=null,this}get selectionSet(){return (this.updated&X0)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ec,this}ensureMarks(e){return _e.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&ec)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ec,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)||_e.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r));}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(Z.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|=J0,this}get scrolledIntoView(){return (this.updated&J0)>0}};function Z0(t,e){return !e||!t?t:t.bind(e)}var Qo=class{constructor(e,n,r){this.name=e,this.init=Z0(n.init,r),this.apply=Z0(n.apply,r);}},ND=[new Qo("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Qo("selection",{init(t,e){return t.selection||Z.atStart(e.doc)},apply(t){return t.selection}}),new Qo("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Qo("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],na=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ND.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 Qo(r.key,r.spec.state,r));});}},Or=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 o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return !1}return !0}applyTransaction(e){if(!this.filterTransaction(e))return {state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[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),!o){o=[];for(let u=0;u<this.config.plugins.length;u++)o.push(u<s?{state:r,n:n.length}:{state:this,n:0});}n.push(d),r=r.applyInner(d),i=!0;}o&&(o[s]={state:r,n:n.length});}}if(!i)return {state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Or(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n);}return n}get tr(){return new Uf(this)}static create(e){let n=new na(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Or(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new na(this.schema,e.plugins),r=n.fields,o=new Or(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o);}return o}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 o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.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 o=new na(e.schema,e.plugins),i=new Or(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Ot.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Z.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.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)){i[s.name]=c.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i);}}),i}};function Q0(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Q0(o,e,{})),n[r]=o;}return n}var oe=class{constructor(e){this.spec=e,this.props={},e.props&&Q0(e.props,this,this.props),this.key=e.key?e.key.key:ew("plugin");}getState(e){return e[this.key]}},Hf=Object.create(null);function ew(t){return t in Hf?t+"$"+ ++Hf[t]:(Hf[t]=0,t+"$")}var ae=class{constructor(e="key"){this.key=ew(e);}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var Dt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},es=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},jf=null,Pr=function(t,e,n){let r=jf||(jf=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},_D=function(){jf=null;},ii=function(t,e,n,r){return n&&(tw(t,e,n,r,-1)||tw(t,e,n,r,1))},MD=/^(img|br|input|textarea|hr)$/i;function tw(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return !0;if(e==(o<0?0:_n(t))){let s=t.parentNode;if(!s||s.nodeType!=1||fa(t)||MD.test(t.nodeName)||t.contentEditable=="false")return !1;e=Dt(t)+(o<0?0:1),t=s;}else if(t.nodeType==1){let s=t.childNodes[e+(o<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return !1;else t=s,e=o<0?_n(t):0;}else return !1}}function _n(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function AD(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=_n(t);}else if(t.parentNode&&!fa(t))e=Dt(t),t=t.parentNode;else return null}}function OD(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&&!fa(t))e=Dt(t)+1,t=t.parentNode;else return null}}function DD(t,e,n){for(let r=e==0,o=e==_n(t);r||o;){if(t==n)return !0;let i=Dt(t);if(t=t.parentNode,!t)return !1;r=r&&i==0,o=o&&i==_n(t);}}function fa(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 lc=function(t){return t.focusNode&&ii(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ei(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function PD(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function ID(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return {node:r.offsetNode,offset:Math.min(_n(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return {node:r.startContainer,offset:Math.min(_n(r.startContainer),r.startOffset)}}}var lr=typeof navigator<"u"?navigator:null,nw=typeof document<"u"?document:null,uo=lr&&lr.userAgent||"",Yf=/Edge\/(\d+)/.exec(uo),Pw=/MSIE \d/.exec(uo),Xf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(uo),dn=!!(Pw||Xf||Yf),co=Pw?document.documentMode:Xf?+Xf[1]:Yf?+Yf[1]:0,Gn=!dn&&/gecko\/(\d+)/i.test(uo);Gn&&+(/Firefox\/(\d+)/.exec(uo)||[0,0])[1];var Jf=!dn&&/Chrome\/(\d+)/.exec(uo),qt=!!Jf,Iw=Jf?+Jf[1]:0,Qt=!dn&&!!lr&&/Apple Computer/.test(lr.vendor),ts=Qt&&(/Mobile\/\w+/.test(uo)||!!lr&&lr.maxTouchPoints>2),Nn=ts||(lr?/Mac/.test(lr.platform):!1),LD=lr?/Win/.test(lr.platform):!1,Ir=/Android \d/.test(uo),pa=!!nw&&"webkitFontSmoothing"in nw.documentElement.style,$D=pa?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function BD(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 Dr(t,e){return typeof t=="number"?t:t[e]}function FD(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 rw(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=es(s);continue}let a=s,l=a==i.body,c=l?BD(i):FD(a),d=0,u=0;if(e.top<c.top+Dr(r,"top")?u=-(c.top-e.top+Dr(o,"top")):e.bottom>c.bottom-Dr(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+Dr(o,"top")-c.top:e.bottom-c.bottom+Dr(o,"bottom")),e.left<c.left+Dr(r,"left")?d=-(c.left-e.left+Dr(o,"left")):e.right>c.right-Dr(r,"right")&&(d=e.right-c.right+Dr(o,"right")),d||u)if(l)i.defaultView.scrollBy(d,u);else {let p=a.scrollLeft,m=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let h=a.scrollLeft-p,g=a.scrollTop-m;e={left:e.left-h,top:e.top-g,right:e.right-h,bottom:e.bottom-g};}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:es(s);}}function zD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(i,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return {refDOM:r,refTop:o,stack:Lw(t.dom)}}function Lw(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=es(r));return e}function HD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;$w(n,r==0?0:r-e);}function $w(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i);}}var Xi=null;function UD(t){if(t.setActive)return t.setActive();if(Xi)return t.focus(Xi);let e=Lw(t);t.focus(Xi==null?{get preventScroll(){return Xi={preventScroll:!0},!0}}:void 0),Xi||(Xi=!1,$w(e,0));}function Bw(t,e){let n,r=2e8,o,i=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=Pr(d).getClientRects();else continue;for(let p=0;p<f.length;p++){let m=f[p];if(m.top<=s&&m.bottom>=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let h=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(h<r){n=d,r=h,o=h&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&h&&(i=u+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=u+1);}}return !n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?VD(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:Bw(n,o)}function VD(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let i=so(r,1);if(i.top!=i.bottom&&up(e,i))return {node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return {node:t,offset:0}}function up(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function KD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function WD(t,e,n){let{node:r,offset:o}=Bw(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1;}return t.docView.posFromDOM(r,o,i)}function GD(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!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?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<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;i=a.dom.parentNode;}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function Fw(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(up(e,c))return Fw(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function qD(t,e){let n=t.dom.ownerDocument,r,o=0,i=ID(n,e.left,e.top);i&&({node:r,offset:o}=i);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(!up(e,c)||(s=Fw(t.dom,e,c),!s))return null}if(Qt)for(let c=s;r&&c;c=es(c))c.draggable&&(r=void 0);if(s=KD(s,e),r){if(Gn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let d=r.childNodes[o],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&o++;}let c;pa&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=GD(t,r,o,e));}a==null&&(a=WD(t,s,e));let l=t.docView.nearestDesc(s,!0);return {pos:a,inside:l?l.posAtStart-l.border:-1}}function ow(t){return t.top<t.bottom||t.left<t.right}function so(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(ow(r))return r}return Array.prototype.find.call(n,ow)||t.getBoundingClientRect()}var jD=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function zw(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=pa||Gn;if(r.nodeType==3)if(s&&(jD.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=so(Pr(r,o,o),n);if(Gn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=so(Pr(r,o-1,o-1),-1);if(c.top==l.top){let d=so(Pr(r,o,o+1),-1);if(d.top!=l.top)return oa(d,d.left<c.left)}}return l}else {let l=o,c=o,d=n<0?1:-1;return n<0&&!o?(c++,d=-1):n>=0&&o==r.nodeValue.length?(l--,d=1):n<0?l--:c++,oa(so(Pr(r,l,c),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==_n(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Vf(l.getBoundingClientRect(),!1)}if(i==null&&o<_n(r)){let l=r.childNodes[o];if(l.nodeType==1)return Vf(l.getBoundingClientRect(),!0)}return Vf(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==_n(r))){let l=r.childNodes[o-1],c=l.nodeType==3?Pr(l,_n(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return oa(so(c,1),!1)}if(i==null&&o<_n(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Pr(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return oa(so(c,-1),!0)}return oa(so(r.nodeType==3?Pr(r):r,-n),n>=0)}function oa(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 Vf(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 Hw(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus();}}function YD(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return Hw(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode;}let s=zw(t,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Pr(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 XD=/[\u0590-\u08ac]/;function JD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return !1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.domSelection();return a?!XD.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:Hw(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:m,focusOffset:h}=t.domSelectionRange(),g=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==h;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 iw=null,sw=null,aw=!1;function ZD(t,e,n){return iw==e&&sw==n?aw:(iw=e,sw=n,aw=n=="up"||n=="down"?YD(t,e,n):JD(t,e,n))}var Mn=0,lw=1,ti=2,cr=3,si=class{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Mn,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 o=this.children[n];if(o==e)return r;r+=o.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 i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else {for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling;}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else {let i,s;if(e==this.contentDOM)i=e.childNodes[n];else {for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling;}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Dt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}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 o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return -1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let a=o.children[s];if(a.size){o=a;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i;}}domFromPos(e,n){if(!this.contentDOM)return {node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>e||s instanceof nc){o=e-i;break}i=a;}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof tc&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Dt(i.dom)+1:0}}else {let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Dt(i.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 o=-1,i=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(o==-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)){o=Dt(f.dom)+1;break}e-=f.size;}o==-1&&(o=0);}if(o>-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)){i=Dt(u.dom);break}n+=u.size;}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c;}return {node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}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,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let h=this.children[p],g=m+h.size;if(i>m&&s<g)return h.setSelection(e-m-h.border,n-m-h.border,r,o);m=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((Gn||Qt)&&e==n){let{node:p,offset:m}=a;if(p.nodeType==3){if(u=!!(m&&p.nodeValue[m-1]==`
|
|
75
|
+
`),u&&m==p.nodeValue.length)for(let h=p,g;h;h=h.parentNode){if(g=h.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Dt(g)+1});break}let b=h.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else {let h=p.childNodes[m-1];u=h&&(h.nodeName=="BR"||h.contentEditable=="false");}}if(Gn&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(o=!0);}if(!(o||u&&Qt)&&ii(a.node,a.offset,d.anchorNode,d.anchorOffset)&&ii(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 m=a;a=l,l=m;}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,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+i.border,l=s-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?ti:lw,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=cr:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ti:cr;}r=s;}this.dirty=ti;}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ti:lw;n.dirty<r&&(n.dirty=r);}}get domAtom(){return !1}get ignoreForCoords(){return !1}get ignoreForSelection(){return !1}isText(e){return !1}},tc=class extends si{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!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,i=this;}matchesWidget(e){return this.dirty==Mn&&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}},Zf=class extends si{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o;}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}},$r=class extends si{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i;}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return (!s||!s.dom)&&(s=Wn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new $r(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&cr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=cr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Mn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Mn;}}slice(e,n,r){let o=$r.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=np(i,n,s,r)),e>0&&(i=np(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy();}},sr=class extends si{constructor(e,n,r,o,i,s,a,l,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a;}static create(e,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),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}=Wn.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=Kw(d,r,n),c?l=new Qf(e,n,r,o,d,u||null,f,c,i,s+1):n.isText?new ns(e,n,r,o,d,f,i):new sr(e,n,r,o,d,u||null,f,i,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=()=>O.empty);}return e}matchesNode(e,n,r){return this.dirty==Mn&&e.eq(this.node)&&rc(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,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new tp(this,s&&s.node,e);nP(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?_e.none:this.node.child(d).marks,r,e),l.placeWidget(c,e,o);},(c,d,u,f)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,d,u,f)||a&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,d,u,p,e)||l.updateNextNode(c,d,u,e,f,o)||l.addNode(c,d,u,e,o),o+=c.nodeSize;}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ti)&&(s&&this.protectLocalComposition(e,s),Uw(this.contentDOM,this.children,e),ts&&rP(this.dom));}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof q)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=oP(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return {node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0);}let s=new Zf(this,i,n,o);e.input.compositionNodes.push(s),this.children=np(this.children,r,r+o.length,e,s);}update(e,n,r,o){return this.dirty==cr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Mn;}updateOuterDeco(e){if(rc(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Vw(this.dom,this.nodeDOM,ep(this.outerDeco,this.node,n),ep(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 cw(t,e,n,r,o){Kw(r,e,t);let i=new sr(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}var ns=class extends sr{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,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,o){return this.dirty==cr||this.dirty!=Mn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Mn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Mn,!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 o=this.node.cut(e,n),i=document.createTextNode(o.text);return new ns(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=cr);}get domAtom(){return !1}isText(e){return this.node.text==e}},nc=class extends si{parseRule(){return {ignore:!0}}matchesHack(e){return this.dirty==Mn&&this.dom.nodeName==e}get domAtom(){return !0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},Qf=class extends sr{constructor(e,n,r,o,i,s,a,l,c,d){super(e,n,r,o,i,s,a,c,d),this.spec=l;}update(e,n,r,o){if(this.dirty==cr)return !1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return !this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode();}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode();}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o);}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 Uw(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=dw(r),o=!0;r=r.nextSibling;}else o=!0,t.insertBefore(a,r);if(s instanceof $r){let l=r?r.previousSibling:t.lastChild;Uw(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild;}}for(;r;)r=dw(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null);}var ia=function(t){t&&(this.nodeName=t);};ia.prototype=Object.create(null);var ni=[new ia];function ep(t,e,n){if(t.length==0)return ni;let r=n?ni[0]:new ia,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new ia(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new ia(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 o}function Vw(t,e,n,r){if(n==ni&&r==ni)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=t&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=ni[0]),o=l;}QD(o,a||ni[0],s);}return o}function QD(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):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class");}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1]);}n.style&&(t.style.cssText+=n.style);}}function Kw(t,e,n){return Vw(t,t,ni,ep(e,n,t.nodeType!=1))}function rc(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 dw(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}var tp=class{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=eP(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 o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=Mn,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<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[i])&&!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=$r.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0;}this.index=0,i++;}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=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)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==cr&&s.dom==s.contentDOM&&(s.dirty=ti),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),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 o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return -1}e=n;}}updateNextNode(e,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof sr){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)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!=cr&&rc(n,l.outerDeco));if(!f&&l.update(e,n,r,o))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(l,e,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=ti,u.updateChildren(o,s+1),u.dirty=Mn),this.changed=!0,this.index++,!0;break}}return !1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!rc(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=sr.create(this.top,n,r,o,i,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,o,i){let s=sr.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0;}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else {let i=new tc(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0;}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof $r;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof ns)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Qt||qt)&&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 o=new nc(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0;}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function eP(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof $r)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(o-1))break;--o,i.set(a,o),s.push(a);}}return {index:o,matched:i,matches:s.reverse()}}function tP(t,e){return t.type.side-e.type.side}function nP(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);r(d,o,e.forChild(i,d),c),i+=d.nodeSize;}return}let s=0,a=[],l=null;for(let c=0;;){let d,u;for(;s<o.length&&o[s].to==i;){let g=o[s++];g.widget&&(d?(u||(u=[d])).push(g):d=g);}if(d)if(u){u.sort(tP);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<=i&&a.splice(g--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let m=i+f.nodeSize;if(f.isText){let g=m;s<o.length&&o[s].from<g&&(g=o[s].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<m&&(l=f.cut(g-i),f=f.cut(0,g-i),m=g,p=-1);}else for(;s<o.length&&o[s].to<m;)s++;let h=f.isInline&&!f.isLeaf?a.filter(g=>!g.inline):a.slice();r(f,h,e.forChild(i,f),p),i=m;}}function rP(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 oP(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text;}if(i>=n){if(i>=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 np(t,e,n,r,o){let i=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,d=a+=l.size;c>=n||d<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(l.slice(n-c,l.size,r)));}return i}function fp(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(lc(n)){for(l=s;o&&!o.node;)o=o.parent;let u=o.node;if(o&&u.isAtom&&X.isSelectable(u)&&o.parent&&!(u.isInline&&DD(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new X(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 m=n.getRangeAt(p);u=Math.min(u,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.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&&!i?1:-1;c=pp(t,d,a,u);}return c}function Ww(t){return t.editable?t.hasFocus():qw(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Lr(t,e=!1){let n=t.state.selection;if(Gw(t,n),!!Ww(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&qt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&ii(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)sP(t);else {let{anchor:r,head:o}=n,i,s;uw&&!(n instanceof q)&&(n.$from.parent.inlineContent||(i=fw(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=fw(t,n.to))),t.docView.setSelection(r,o,t,e),uw&&(i&&pw(i),s&&pw(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&iP(t));}t.domObserver.setCurSelection(),t.domObserver.connectSelection();}}var uw=Qt||qt&&Iw<63;function fw(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Qt&&o&&o.contentEditable=="false")return Kf(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Kf(o);if(i)return Kf(i)}}function Kf(t){return t.contentEditable="true",Qt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function pw(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null);}function iP(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Ww(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection");},20));});}function sP(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,Dt(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&dn&&co<=11&&(r.disabled=!0,r.disabled=!1);}function Gw(t,e){if(e instanceof X){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(mw(t),n&&n.selectNode(),t.lastSelectedViewDesc=n);}else mw(t);}function mw(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0);}function pp(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||q.between(e,n,r)}function hw(t){return t.editable&&!t.hasFocus()?!1:qw(t)}function qw(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 aP(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ii(e.node,e.offset,n.anchorNode,n.anchorOffset)}function rp(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&Z.findFrom(i,e)}function ao(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function gw(t,e,n){let r=t.state.selection;if(r instanceof q)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return !1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return ao(t,new q(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=rp(t.state,e);return o&&o instanceof X?ao(t,o):!1}else if(!(Nn&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return !1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?X.isSelectable(i)?ao(t,new X(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):pa?ao(t,new q(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return !1;else {if(r instanceof X&&r.node.isInline)return ao(t,new q(e>0?r.$to:r.$from));{let o=rp(t.state,e);return o?ao(t,o):!1}}}function oc(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function sa(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ji(t,e){return e<0?lP(t):cP(t)}function lP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Gn&&n.nodeType==1&&r<oc(n)&&sa(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(sa(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else {if(jw(n))break;{let a=n.previousSibling;for(;a&&sa(a,-1);)o=n.parentNode,i=Dt(a),a=a.previousSibling;if(a)n=a,r=oc(n);else {if(n=n.parentNode,n==t.dom)break;r=0;}}}s?op(t,n,r):o&&op(t,o,i);}function cP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=oc(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(sa(a,1))i=n,s=++r;else break}else {if(jw(n))break;{let a=n.nextSibling;for(;a&&sa(a,1);)i=a.parentNode,s=Dt(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=oc(n);else {if(n=n.parentNode,n==t.dom)break;r=o=0;}}}i&&op(t,i,s);}function jw(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function dP(t,e){for(;t&&e==t.childNodes.length&&!fa(t);)e=Dt(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 uP(t,e){for(;t&&!e&&!fa(t);)e=Dt(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 op(t,e,n){if(e.nodeType!=3){let i,s;(s=dP(e,n))?(e=s,n=0):(i=uP(e,n))&&(e=i,n=i.nodeValue.length);}let r=t.domSelection();if(!r)return;if(lc(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i);}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&Lr(t);},50);}function bw(t,e){let n=t.state.doc.resolve(e);if(!(qt||LD)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function yw(t,e,n){let r=t.state.selection;if(r instanceof q&&!r.empty||n.indexOf("s")>-1||Nn&&n.indexOf("m")>-1)return !1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=rp(t.state,e);if(s&&s instanceof X)return ao(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof Et?Z.near(s,e):Z.findFrom(s,e);return a?ao(t,a):!1}return !1}function vw(t,e){if(!(t.state.selection instanceof q))return !0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return !0;if(!o)return !1;if(t.endOfTextblock(e>0?"forward":"backward"))return !0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return !1}function ww(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start();}function fP(t){if(!Qt||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;ww(t,r,"true"),setTimeout(()=>ww(t,r,"false"),20);}return !1}function pP(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function mP(t,e){let n=e.keyCode,r=pP(e);if(n==8||Nn&&n==72&&r=="c")return vw(t,-1)||Ji(t,-1);if(n==46&&!e.shiftKey||Nn&&n==68&&r=="c")return vw(t,1)||Ji(t,1);if(n==13||n==27)return !0;if(n==37||Nn&&n==66&&r=="c"){let o=n==37?bw(t,t.state.selection.from)=="ltr"?-1:1:-1;return gw(t,o,r)||Ji(t,o)}else if(n==39||Nn&&n==70&&r=="c"){let o=n==39?bw(t,t.state.selection.from)=="ltr"?1:-1:1;return gw(t,o,r)||Ji(t,o)}else {if(n==38||Nn&&n==80&&r=="c")return yw(t,-1,r)||Ji(t,-1);if(n==40||Nn&&n==78&&r=="c")return fP(t)||yw(t,1,r)||Ji(t,1);if(r==(Nn?"m":"c")&&(n==66||n==73||n==89||n==90))return !0}return !1}function mp(t,e){t.someProp("transformCopied",p=>{e=p(e,t);});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;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")||Wn.fromSchema(t.state.schema),a=ex(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Qw[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=a.createElement(d[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),u++;}c=l.firstChild;}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
76
|
+
|
|
77
|
+
`);return {dom:l,text:f,slice:e}}function Yw(t,e,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t);}),i)return e?new H(O.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
78
|
+
`))),0,0):H.empty;let u=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(u)a=u;else {let f=o.marks(),{schema:p}=t.state,m=Wn.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(h=>{let g=s.appendChild(document.createElement("p"));h&&g.appendChild(m.serializeNode(p.text(h,f)));});}}else t.someProp("transformPastedHTML",u=>{n=u(n,t);}),s=yP(n),pa&&vP(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")||gn.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!hP.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)a=wP(xw(a,+d[1],+d[2]),d[4]);else if(a=H.maxOpen(gP(a.content,o),!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=xw(a,u,f);}return t.someProp("transformPasted",u=>{a=u(a,t);}),a}var hP=/^(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 gP(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&Jw(l,i,a,s[s.length-1],0))s[s.length-1]=c;else {s.length&&(s[s.length-1]=Zw(s[s.length-1],i.length));let d=Xw(a,l);s.push(d),o=o.matchType(d.type),i=l;}}),s)return O.from(s)}return t}function Xw(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,O.from(t));return t}function Jw(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=Jw(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(O.from(Xw(n,t,o+1))))}}function Zw(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Zw(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(O.empty,!0);return t.copy(n.append(r))}function ip(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),o<r-1&&(a=ip(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(O.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function xw(t,e,n){return e<t.openStart&&(t=new H(ip(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new H(ip(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var Qw={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},Ew=null;function ex(){return Ew||(Ew=document.implementation.createHTMLDocument("title"))}var Wf=null;function bP(t){let e=window.trustedTypes;return e?(Wf||(Wf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Wf.createHTML(t)):t}function yP(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=ex().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Qw[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=bP(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function vP(t){let e=t.querySelectorAll(qt?"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 wP(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:o,openStart:i,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=O.from(l.create(r[a+1],o)),i++,s++;}return new H(o,i,s)}var en={},tn={},xP={touchstart:!0,touchmove:!0},sp=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 EP(t){for(let e in en){let n=en[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{CP(t,r)&&!hp(t,r)&&(t.editable||!(r.type in tn))&&n(t,r);},xP[e]?{passive:!0}:void 0);}Qt&&t.dom.addEventListener("input",()=>null),ap(t);}function lo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now();}function SP(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 ap(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>hp(t,r));});}function hp(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function CP(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 RP(t,e){!hp(t,e)&&en[e.type]&&(t.editable||!(e.type in tn))&&en[e.type](t,e);}tn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!nx(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ir&&qt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ts&&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",o=>o(t,ei(13,"Enter"))),t.input.lastIOSEnter=0);},200);}else t.someProp("handleKeyDown",r=>r(t,n))||mP(t,n)?n.preventDefault():lo(t,"key");};tn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1);};tn.keypress=(t,e)=>{let n=e;if(nx(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Nn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof q)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault();}};function cc(t){return {left:t.clientX,top:t.clientY}}function TP(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function gp(t,e,n,r,o){if(r==-1)return !1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return !0;return !1}function Qi(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 kP(t,e){if(e==-1)return !1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&X.isSelectable(r)?(Qi(t,new X(n),"pointer"),!0):!1}function NP(t,e){if(e==-1)return !1;let n=t.state.selection,r,o;n instanceof X&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(X.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Qi(t,X.create(t.state.doc,o),"pointer"),!0):!1}function _P(t,e,n,r,o){return gp(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?NP(t,n):kP(t,n))}function MP(t,e,n,r){return gp(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function AP(t,e,n,r){return gp(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||OP(t,n,r)}function OP(t,e,n){if(n.button!=0)return !1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Qi(t,q.create(r,0,r.content.size),"pointer"),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Qi(t,q.create(r,a+1,a+1+s.content.size),"pointer");else if(X.isSelectable(s))Qi(t,X.create(r,a),"pointer");else continue;return !0}}function bp(t){return ic(t)}var tx=Nn?"metaKey":"ctrlKey";en.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=bp(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&TP(n,t.input.lastClick)&&!n[tx]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(cc(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new lp(t,s,n,!!r)):(i=="doubleClick"?MP:AP)(t,s.pos,s.inside,n)?n.preventDefault():lo(t,"pointer"));};var lp=class{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[tx],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else {let d=e.state.doc.resolve(n.pos);i=d.parent,s=d.depth?d.before():0;}let a=o?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&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof X&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Gn&&!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)),lo(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(()=>Lr(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(cc(e))),this.updateAllowDefault(e),this.allowDefault||!n?lo(this.view,"pointer"):_P(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qt&&this.mightDrag&&!this.mightDrag.node.isAtom||qt&&!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)?(Qi(this.view,Z.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):lo(this.view,"pointer");}move(e){this.updateAllowDefault(e),lo(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);}};en.touchstart=t=>{t.input.lastTouch=Date.now(),bp(t),lo(t,"pointer");};en.touchmove=t=>{t.input.lastTouch=Date.now(),lo(t,"pointer");};en.contextmenu=t=>bp(t);function nx(t,e){return t.composing?!0:Qt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var DP=Ir?5e3:-1;tn.compositionstart=tn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof q&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),ic(t,!0),t.markCursor=null;else if(ic(t,!e.selection.empty),Gn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1;}}t.input.composing=!0;}rx(t,DP);};tn.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++,rx(t,20));};function rx(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ic(t),e));}function ox(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=IP());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty();}function PP(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=AD(e.focusNode,e.focusOffset),r=OD(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.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 IP(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ic(t,e=!1){if(!(Ir&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ox(t),e||t.docView&&t.docView.dirty){let n=fp(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 LP(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(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus();},50);}var aa=dn&&co<15||ts&&$D<604;en.copy=tn.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=aa?null:n.clipboardData,s=r.content(),{dom:a,text:l}=mp(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):LP(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"));};function $P(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function BP(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 o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?la(t,r.value,null,o,e):la(t,r.textContent,r.innerHTML,o,e);},50);}function la(t,e,n,r,o){let i=Yw(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,i||H.empty)))return !0;if(!i)return !1;let s=$P(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ix(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," "):""}tn.paste=(t,e)=>{let n=e;if(t.composing&&!Ir)return;let r=aa?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&la(t,ix(r),r.getData("text/html"),o,n)?n.preventDefault():BP(t,n);};var sc=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r;}},FP=Nn?"altKey":"ctrlKey";function sx(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[FP]}en.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(cc(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof X?o.to-1:o.to))){if(r&&r.mightDrag)s=X.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=X.create(t.state.doc,u.posBefore));}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:d}=mp(t,a);(!n.dataTransfer.files.length||!qt||Iw>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(aa?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",aa||n.dataTransfer.setData("text/plain",c),t.dragging=new sc(d,sx(t,n),s);};en.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null);},50);};tn.dragover=tn.dragenter=(t,e)=>e.preventDefault();tn.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(cc(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",m=>{s=m(s,t);}):s=Yw(t,ix(n.dataTransfer),aa?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&sx(t,n));if(t.someProp("handleDrop",m=>m(t,n,s||H.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?Ql(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=t.state.tr;if(a){let{node:m}=r;m?m.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&&X.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new X(p));else {let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((h,g,b,y)=>m=y),c.setSelection(pp(t,p,c.doc.resolve(m)));}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"));};en.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())&&Lr(t);},20));};en.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);};en.beforeinput=(t,e)=>{if(qt&&Ir&&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",i=>i(t,ei(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView());},50);}};for(let t in tn)en[t]=tn[t];function ca(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 rs=class{constructor(e,n){this.toDOM=e,this.spec=n||ri,this.side=this.spec.side||0;}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Be(i-r,i-r,this)}valid(){return !0}eq(e){return this==e||e instanceof rs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ca(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e);}},ar=class{constructor(e,n){this.attrs=e,this.spec=n||ri;}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Be(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ar&&ca(this.attrs,e.attrs)&&ca(this.spec,e.spec)}static is(e){return e.type instanceof ar}destroy(){}},da=class{constructor(e,n){this.attrs=e,this.spec=n||ri;}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Be(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof da&&ca(this.attrs,e.attrs)&&ca(this.spec,e.spec)}destroy(){}},Be=class{constructor(e,n,r){this.from=e,this.to=n,this.type=r;}copy(e,n){return new Be(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 Be(e,e,new rs(n,r))}static inline(e,n,r,o){return new Be(e,n,new ar(r,o))}static node(e,n,r,o){return new Be(e,n,new da(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ar}get widget(){return this.type instanceof rs}},Zi=[],ri={},Ee=class{constructor(e,n){this.local=e.length?e:Zi,this.children=n.length?n:Zi;}static create(e,n){return n.length?ac(n,e,0,ri):Gt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o));}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,o+a,i);}}map(e,n,r){return this==Gt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ri)}mapInner(e,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec);}return this.children.length?zP(this.children,s||[],e,n,r,o,i):s?new Ee(s.sort(oi),Zi):Gt}add(e,n){return n.length?this==Gt?Ee.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((a,l)=>{let c=l+r,d;if(d=lx(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,d,c+1):o.splice(i,0,l,l+a.nodeSize,ac(d,a,c+1,ri)),i+=3;}});let s=ax(i?cx(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Ee(s.length?this.local.concat(s).sort(oi):this.local,o||this.children)}remove(e){return e.length==0||this==Gt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+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[i+2].removeInner(s,a+1);c!=Gt?r[i+2]=c:(r.splice(i,3),i-=3);}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1));}return r==this.children&&o==this.local?this:o.length||r.length?new Ee(o,r):Gt}forChild(e,n){if(this==Gt)return this;if(n.isLeaf)return Ee.empty;let r,o;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 i=e+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof ar){let c=Math.max(i,l.from)-i,d=Math.min(s,l.to)-i;c<d&&(o||(o=[])).push(l.copy(c,d));}}if(o){let a=new Ee(o.sort(oi),Zi);return r?new ir([a,r]):a}return r||Gt}eq(e){if(this==e)return !0;if(!(e instanceof Ee)||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 yp(this.localsInner(e))}localsInner(e){if(this==Gt)return Zi;if(e.inlineContent||!this.local.some(ar.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ar||n.push(this.local[r]);return n}forEachSet(e){e(this);}};Ee.empty=new Ee([],[]);Ee.removeOverlap=yp;var Gt=Ee.empty,ir=class{constructor(e){this.members=e;}map(e,n){let r=this.members.map(o=>o.map(e,n,ri));return ir.from(r)}forChild(e,n){if(n.isLeaf)return Ee.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Gt&&(i instanceof ir?r=r.concat(i.members):r.push(i));}return ir.from(r)}eq(e){if(!(e instanceof ir)||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 o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else {r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s]);}}return n?yp(r?n:n.sort(oi)):Zi}static from(e){switch(e.length){case 0:return Gt;case 1:return e[0];default:return new ir(e.every(n=>n instanceof Ee)?e:e.reduce((n,r)=>n.concat(r instanceof Ee?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e);}};function zP(t,e,n,r,o,i,s){let a=t.slice();for(let c=0,d=i;c<n.maps.length;c++){let u=0;n.maps[c].forEach((f,p,m,h)=>{let g=h-m-(p-f);for(let b=0;b<a.length;b+=3){let y=a[b+1];if(y<0||f>y+d-u)continue;let v=a[b]+d-u;p>=v?a[b+1]=f<=v?-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]+i),u=d-o;if(u<0||u>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+i,-1),p=f-o,{index:m,offset:h}=r.content.findIndex(u),g=r.maybeChild(m);if(g&&h==u&&h+g.nodeSize==p){let b=a[c+2].mapInner(n,g,d+1,t[c]+i+1,s);b!=Gt?(a[c]=u,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0);}else l=!0;}if(l){let c=HP(a,t,e,n,o,i,s),d=ac(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 Ee(e.sort(oi),a)}function ax(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Be(o.from+e,o.to+e,o.type));}return n}function HP(t,e,n,r,o,i,s){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,o,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]+i+1);return n}function lx(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function cx(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ac(t,e,n,r){let o=[],i=!1;e.forEach((a,l)=>{let c=lx(t,a,l+n);if(c){i=!0;let d=ac(c,a,n+l+1,r);d!=Gt&&o.push(l,l+a.nodeSize,d);}});let s=ax(i?cx(t):t,-n).sort(oi);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||o.length?new Ee(s,o):Gt}function oi(t,e){return t.from-e.from||t.to-e.to}function yp(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Sw(e,o+1,i.copy(r.to,i.to)));continue}else {i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Sw(e,o,r.copy(i.from,r.to)));break}}}return e}function Sw(t,e,n){for(;e<t.length&&oi(n,t[e])>0;)e++;t.splice(e,0,n);}function Gf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Gt&&e.push(r);}),t.cursorWrapper&&e.push(Ee.create(t.state.doc,[t.cursorWrapper.deco])),ir.from(e)}var UP={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},VP=dn&&co<=11,cp=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}},dp=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cp,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);dn&&co<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush();}),VP&&(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,UP)),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(hw(this.view)){if(this.suppressingSelectionUpdates)return Lr(this.view);if(dn&&co<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ii(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 i=e.focusNode;i;i=es(i))n.add(i);for(let i=e.anchorNode;i;i=es(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.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(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&hw(e)&&!this.ignoreSelectionChange(r),i=-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&&(i=i<0?u.from:Math.min(u.from,i),s=s<0?u.to:Math.max(u.to,s),u.typeOver&&(a=!0));}if(Gn&&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||GP(e,u)!=p)&&f.remove();}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&lc(r)&&(c=fp(e))&&c.eq(Z.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Lr(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),KP(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Lr(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 o=e.previousSibling,i=e.nextSibling;if(dn&&co<=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)&&(o=u),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f);}let s=o&&o.parentNode==e.target?Dt(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?Dt(i):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})}},Cw=new WeakMap,Rw=!1;function KP(t){if(!Cw.has(t)&&(Cw.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Gn,Rw)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."),Rw=!0;}}function Tw(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ii(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function WP(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return Tw(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0];}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Tw(t,n):null}function GP(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 qP(t,e,n){let{node:r,fromOffset:o,toOffset:i,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}],lc(l)||c.push({node:l.focusNode,offset:l.focusOffset})),qt&&t.input.lastKeyCode===8)for(let g=i;g>o;g--){let b=r.childNodes[g-1],y=b.pmViewDesc;if(b.nodeName=="BR"&&!y){i=g;break}if(!y||y.size)break}let u=t.state.doc,f=t.someProp("domParser")||gn.fromSchema(t.state.schema),p=u.resolve(s),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:jP,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),m={anchor:g+s,head:b+s};}return {doc:h,sel:m,from:s,to:a}}function jP(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Qt&&/^(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||Qt&&/^(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 YP=/^(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 XP(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let w=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=fp(t,w);if(N&&!t.state.selection.eq(N)){if(qt&&Ir&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",B=>B(t,ei(13,"Enter"))))return;let M=t.state.tr.setSelection(N);w=="pointer"?M.setMeta("pointer",!0):w=="key"&&M.scrollIntoView(),i&&M.setMeta("composition",i),t.dispatch(M);}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=qP(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 m=QP(u.content,c.doc.content,c.from,f,p);if(m&&t.input.domChangeCount++,(ts&&t.input.lastIOSEnter>Date.now()-225||Ir)&&o.some(w=>w.nodeType==1&&!YP.test(w.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",w=>w(t,ei(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof q&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else {if(c.sel){let w=kw(t,t.state.doc,c.sel);if(w&&!w.eq(t.state.selection)){let N=t.state.tr.setSelection(w);i&&N.setMeta("composition",i),t.dispatch(N);}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof q&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),dn&&co<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" \xA0"&&(m.start--,m.endA--,m.endB--);let h=c.doc.resolveNoCache(m.start-c.from),g=c.doc.resolveNoCache(m.endB-c.from),b=d.resolve(m.start),y=h.sameParent(g)&&h.parent.inlineContent&&b.end()>=m.endA,v;if((ts&&t.input.lastIOSEnter>Date.now()-225&&(!y||o.some(w=>w.nodeName=="DIV"||w.nodeName=="P"))||!y&&h.pos<c.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(h.pos,g.pos,"",""))&&(v=Z.findFrom(c.doc.resolve(h.pos+1),1,!0))&&v.head>h.pos)&&t.someProp("handleKeyDown",w=>w(t,ei(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&ZP(d,m.start,m.endA,h,g)&&t.someProp("handleKeyDown",w=>w(t,ei(8,"Backspace")))){Ir&&qt&&t.domObserver.suppressSelectionUpdates();return}qt&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),Ir&&!y&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,g=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(w){return w(t,ei(13,"Enter"))});},20));let x=m.start,E=m.endA,C=w=>{let N=w||t.state.tr.replace(x,E,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let M=kw(t,N.doc,c.sel);M&&!(qt&&t.composing&&M.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(M.head==x||M.head==N.mapping.map(E)-1)||dn&&M.empty&&M.head==x)&&N.setSelection(M);}return i&&N.setMeta("composition",i),N.scrollIntoView()},T;if(y){if(h.pos==g.pos){dn&&co<=11&&h.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Lr(t),20));let w=C(t.state.tr.delete(x,E)),N=d.resolve(m.start).marksAcross(d.resolve(m.endA));N&&w.ensureMarks(N),t.dispatch(w);}else if(m.endA==m.endB&&(T=JP(h.parent.content.cut(h.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let w=C(t.state.tr);T.type=="add"?w.addMark(x,E,T.mark):w.removeMark(x,E,T.mark),t.dispatch(w);}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-(g.textOffset?0:1)){let w=h.parent.textBetween(h.parentOffset,g.parentOffset),N=()=>C(t.state.tr.insertText(w,x,E));t.someProp("handleTextInput",M=>M(t,x,E,w,N))||t.dispatch(N());}}else t.dispatch(C());}function kw(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:pp(t,e.resolve(n.anchor),e.resolve(n.head))}function JP(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,l;for(let d=0;d<r.length;d++)o=r[d].removeFromSet(o);for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=d=>d.mark(a.addToSet(d.marks));else if(o.length==0&&i.length==1)a=i[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(O.from(c).eq(t))return {mark:a,type:s}}function ZP(t,e,n,r,o){if(n-e<=o.pos-r.pos||qf(r,!0,!1)<o.pos)return !1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return !1;let s=t.resolve(qf(i,!0,!0));return !s.parent.isTextblock||s.pos>n||qf(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function qf(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++;}return o}function QP(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i;}if(s<i&&t.size<e.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<e.size&&Nw(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i;}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<t.size&&Nw(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i;}return {start:i,endA:s,endB:a}}function Nw(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 ua=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 sp,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Dw),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=Aw(this),Mw(this),this.nodeViews=Ow(this),this.docView=cw(this.state.doc,_w(this),Gf(this),this.dom,this),this.domObserver=new dp(this,(r,o,i,s)=>XP(this,r,o,i,s)),this.domObserver.start(),EP(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&&ap(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Dw),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 o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(ox(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Ow(this);tI(p,this.nodeViews)&&(this.nodeViews=p,i=!0);}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ap(this),this.editable=Aw(this),Mw(this);let l=Gf(this),c=_w(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(o.selection))&&(s=!0);let f=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&zD(this);if(s){this.domObserver.stop();let p=u&&(dn||qt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&eI(o.selection,e.selection);if(u){let m=qt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=PP(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=cw(e.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0);}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&aP(this))?Lr(this,p):(Gw(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start();}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&HD(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 X){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&rw(this,n.getBoundingClientRect(),e);}else rw(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,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else {let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i);}this.dragging=new sc(e.slice,e.move,o<0?void 0:X.create(this.state.doc,o));}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(dn){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&&UD(this.dom),Lr(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 qD(this,e)}coordsAtPos(e,n=1){return zw(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 o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return ZD(this,n||this.state,e)}pasteHTML(e,n){return la(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return la(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return mp(this,e)}destroy(){this.docView&&(SP(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Gf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_D());}get isDestroyed(){return this.docView==null}dispatchEvent(e){return RP(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qt&&this.root.nodeType===11&&PD(this.dom.ownerDocument)==this.dom&&WP(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};ua.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t));};function _w(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"),[Be.node(0,t.state.doc.content.size,e)]}function Mw(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:Be.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})};}else t.cursorWrapper=null;}function Aw(t){return !t.someProp("editable",e=>e(t.state)===!1)}function eI(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Ow(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o]);}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function tI(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return !0;n++;}for(let o in e)r++;return n!=r}function Dw(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 Br={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:"'"},uc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nI=typeof navigator<"u"&&/Mac/.test(navigator.platform),rI=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(bt=0;bt<10;bt++)Br[48+bt]=Br[96+bt]=String(bt);var bt;for(bt=1;bt<=24;bt++)Br[bt+111]="F"+bt;var bt;for(bt=65;bt<=90;bt++)Br[bt]=String.fromCharCode(bt+32),uc[bt]=String.fromCharCode(bt);var bt;for(dc in Br)uc.hasOwnProperty(dc)||(uc[dc]=Br[dc]);var dc;function dx(t){var e=nI&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||rI&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?uc:Br)[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 oI=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),iI=typeof navigator<"u"&&/Win/.test(navigator.platform);function sI(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,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))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))oI?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function aI(t){let e=Object.create(null);for(let n in t)e[sI(n)]=t[n];return e}function vp(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 ux(t){return new oe({props:{handleKeyDown:ma(t)}})}function ma(t){let e=aI(t);return function(n,r){let o=dx(r),i,s=e[vp(o,r)];if(s&&s(n.state,n.dispatch,n))return !0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[vp(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return !0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(iI&&r.ctrlKey&&r.altKey)&&(i=Br[r.keyCode])&&i!=o){let a=e[vp(i,r)];if(a&&a(n.state,n.dispatch,n))return !0}}return !1}}var fc=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function px(t,e){let{$cursor:n}=t.selection;return !n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var xp=(t,e,n)=>{let r=px(t,n);if(!r)return !1;let o=Sp(r);if(!o){let s=r.blockRange(),a=s&&Ar(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(Ex(t,o,e,-1))return !0;if(r.parent.content.size==0&&(is(i,"end")||X.isSelectable(i)))for(let s=r.depth;;s--){let a=ta(t.doc,r.before(s),r.after(s),H.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(is(i,"end")?Z.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):X.create(l.doc,o.pos-i.nodeSize)),e(l.scrollIntoView());}return !0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},mx=(t,e,n)=>{let r=px(t,n);if(!r)return !1;let o=Sp(r);return o?gx(t,o,e):!1},hx=(t,e,n)=>{let r=bx(t,n);if(!r)return !1;let o=Tp(r);return o?gx(t,o,e):!1};function gx(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return !1;let d=o.lastChild;if(!d)return !1;o=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=ta(t.doc,i,l,H.empty);if(!c||c.from!=i||c instanceof et&&c.slice.size>=l-i)return !1;if(n){let d=t.tr.step(c);d.setSelection(q.create(d.doc,i)),n(d.scrollIntoView());}return !0}function is(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 Ep=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return !1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return !1;i=Sp(r);}let s=i&&i.nodeBefore;return !s||!X.isSelectable(s)?!1:(e&&e(t.tr.setSelection(X.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Sp(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 bx(t,e){let{$cursor:n}=t.selection;return !n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}var Cp=(t,e,n)=>{let r=bx(t,n);if(!r)return !1;let o=Tp(r);if(!o)return !1;let i=o.nodeAfter;if(Ex(t,o,e,1))return !0;if(r.parent.content.size==0&&(is(i,"start")||X.isSelectable(i))){let s=ta(t.doc,r.before(),r.after(),H.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(is(i,"start")?Z.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):X.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView());}return !0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},Rp=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return !1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return !1;i=Tp(r);}let s=i&&i.nodeAfter;return !s||!X.isSelectable(s)?!1:(e&&e(t.tr.setSelection(X.create(t.doc,i.pos)).scrollIntoView()),!0)};function Tp(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 yx=(t,e)=>{let n=t.selection,r=n instanceof X,o;if(r){if(n.node.isTextblock||!kn(t.doc,n.from))return !1;o=n.from;}else if(o=Zo(t.doc,n.from,-1),o==null)return !1;if(e){let i=t.tr.join(o);r&&i.setSelection(X.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView());}return !0},vx=(t,e)=>{let n=t.selection,r;if(n instanceof X){if(n.node.isTextblock||!kn(t.doc,n.to))return !1;r=n.to;}else if(r=Zo(t.doc,n.to,1),r==null)return !1;return e&&e(t.tr.join(r).scrollIntoView()),!0},wx=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&Ar(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},kp=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return !n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
79
|
+
`).scrollIntoView()),!0)};function Np(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 _p=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return !1;let o=n.node(-1),i=n.indexAfter(-1),s=Np(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return !1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Z.near(l.doc.resolve(a),1)),e(l.scrollIntoView());}return !0},Mp=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Et||r.parent.inlineContent||o.parent.inlineContent)return !1;let i=Np(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return !1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(q.create(a.doc,s+1)),e(a.scrollIntoView());}return !0},Ap=(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 i=n.before();if(bn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ar(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};var xx=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(X.create(t.doc,o))),!0)};function uI(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return !r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||kn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Ex(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&uI(t,e,n))return !0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,m=O.empty;for(let b=s.length-1;b>=0;b--)m=O.from(s[b].create(null,m));m=O.from(o.copy(m));let h=t.tr.step(new Ye(e.pos-1,p,e.pos,p,new H(m,1,0),s.length,!0)),g=h.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==o.type&&kn(h.doc,g.pos)&&h.join(g.pos),n(h.scrollIntoView());}return !0}let d=i.type.spec.isolating||r>0&&l?null:Z.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&Ar(u);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(u,f).scrollIntoView()),!0;if(c&&is(i,"start",!0)&&is(o,"end")){let p=o,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let h=i,g=1;for(;!h.isTextblock;h=h.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,h.content)){if(n){let b=O.empty;for(let v=m.length-1;v>=0;v--)b=O.from(m[v].copy(b));let y=t.tr.step(new Ye(e.pos-m.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new H(b,m.length,0),0,!0));n(y.scrollIntoView());}return !0}}return !1}function Sx(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return !1;i--;}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(q.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}var Op=Sx(-1),Dp=Sx(1);function Cx(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&Gi(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Pp(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(l,c)=>{if(o)return !1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else {let d=n.doc.resolve(c),u=d.index();o=d.parent.canReplaceWith(u,u+1,t);}});}if(!o)return !1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(a,l,t,e);}r(i.scrollIntoView());}return !0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1;function Rx(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return !1;let a=r?n.tr:null;return pI(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function pI(t,e,n,r=null){let o=!1,i=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);i=new Yo(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Yo(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0;}let a=Gi(i,n,r,e);return a?(t&&mI(t,e,a,o,n),!0):!1}function mI(t,e,n,r,o){let i=O.empty;for(let d=n.length-1;d>=0;d--)i=O.from(n[d].type.create(n[d].attrs,i));t.step(new Ye(e.start-(r?2:0),e.end,e.start,e.end,new H(i,0,0),n.length,!0));let s=0;for(let d=0;d<n.length;d++)n[d].type==o&&(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&&bn(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return t}function Tx(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?hI(e,n,t,i):gI(e,n,i):!0:!1}}function hI(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Ye(i-1,s,i,s,new H(O.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Yo(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));let a=Ar(r);if(a==null)return !1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return kn(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function gI(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,m=n.endIndex-1,h=n.startIndex;m>h;m--)p-=o.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return !1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(a?0:1),d+1,s.content.append(l?O.empty:O.from(o))))return !1;let u=i.pos,f=u+s.nodeSize;return r.step(new Ye(u-(a?1:0),f+(l?1:0),u+1,f-1,new H((a?O.empty:O.from(o.copy(O.empty))).append(l?O.empty:O.from(o.copy(O.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function kx(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return !1;let s=i.startIndex;if(s==0)return !1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return !1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,d=O.from(c?t.create():null),u=new H(O.from(t.create(null,O.from(a.type.create(null,d)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new Ye(f-(c?3:1),p,f,p,u,1,!0)).scrollIntoView());}return !0}}var bI=Object.defineProperty,Ix=(t,e)=>{for(var n in e)bI(t,n,{get:e[n],enumerable:!0});};function wc(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:o}=n,{storedMarks:i}=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 i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var xc=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:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,(...c)=>{let d=a(...c)(i);return !o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),d}]))}get chain(){return ()=>this.createChain()}get can(){return ()=>this.createCan()}createChain(t,e=!0){let{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!t,l=t||o.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),s.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(n).map(([u,f])=>[u,(...m)=>{let h=this.buildProps(l,e),g=f(...m)(h);return s.push(g),d}])),run:c};return d}createCan(t){let{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return {...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){let{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:wc({state:o,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}},yI=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 Hp(t,e){let n=new io(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o);});}),n}var Lx=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&&Lx(r);}return t};function pc(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 Lx(n)}function ha(t,e,n){if(t instanceof Ot||t instanceof O)return t;n={slice:!0,parseOptions:{},...n};let r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return O.fromArray(t.map(a=>e.nodeFromJSON(a)));let s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),ha("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="",l=new Ki({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?gn.fromSchema(l).parseSlice(pc(t),n.parseOptions):gn.fromSchema(l).parse(pc(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}let i=gn.fromSchema(e);return n.slice?i.parseSlice(pc(t),n.parseOptions).content:i.parse(pc(t),n.parseOptions)}return ha("",e,n)}function Fp(t,e,n={},r={}){return ha(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function vI(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 Ec(t,e){let n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o});}),n}function $x(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i});}),r}function Up(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 Sc(t){return e=>Up(e.$from,t)}function Q(t,e,n){return t.config[e]===void 0&&t.parent?Q(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Q(t.parent,e,n):null}):t.config[e]}function Vp(t){return t.map(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=Q(e,"addExtensions",n);return r?[e,...Vp(r())]:e}).flat(10)}function Kp(t,e){let n=Wn.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Bx(t){return typeof t=="function"}function Ie(t,e=void 0,...n){return Bx(t)?e?t.bind(e)(...n):t(...n):t}function wI(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ga(t){let e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return {baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Fx(t){let e=[],{nodeExtensions:n,markExtensions:r}=ga(t),o=[...n,...r],i={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:o},l=Q(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:{...i,...p}});});});});}),o.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage},l=Q(s,"addAttributes",a);if(!l)return;let c=l();Object.entries(c).forEach(([d,u])=>{let f={...i,...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 ie(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){let a=i?String(i).split(" "):[],l=r[o]?r[o].split(" "):[],c=a.filter(d=>!l.includes(d));r[o]=[...l,...c].join(" ");}else if(o==="style"){let a=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[o]?r[o].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[o]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ");}else r[o]=i;}),r},{})}function yc(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)=>ie(n,r),{})}function xI(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Nx(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 o=e.reduce((i,s)=>{let a=s.attribute.parseHTML?s.attribute.parseHTML(n):xI(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return {...r,...o}}}}function _x(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&wI(n)?!1:n!=null))}function EI(t,e){var n;let r=Fx(t),{nodeExtensions:o,markExtensions:i}=ga(t),s=(n=o.find(c=>Q(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(o.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,y)=>{let v=Q(y,"extendNodeSchema",u);return {...b,...v?v(c):{}}},{}),p=_x({...f,content:Ie(Q(c,"content",u)),marks:Ie(Q(c,"marks",u)),group:Ie(Q(c,"group",u)),inline:Ie(Q(c,"inline",u)),atom:Ie(Q(c,"atom",u)),selectable:Ie(Q(c,"selectable",u)),draggable:Ie(Q(c,"draggable",u)),code:Ie(Q(c,"code",u)),whitespace:Ie(Q(c,"whitespace",u)),linebreakReplacement:Ie(Q(c,"linebreakReplacement",u)),defining:Ie(Q(c,"defining",u)),isolating:Ie(Q(c,"isolating",u)),attrs:Object.fromEntries(d.map(b=>{var y,v;return [b.name,{default:(y=b?.attribute)==null?void 0:y.default,validate:(v=b?.attribute)==null?void 0:v.validate}]}))}),m=Ie(Q(c,"parseHTML",u));m&&(p.parseDOM=m.map(b=>Nx(b,d)));let h=Q(c,"renderHTML",u);h&&(p.toDOM=b=>h({node:b,HTMLAttributes:yc(b,d)}));let g=Q(c,"renderText",u);return g&&(p.toText=g),[c.name,p]})),l=Object.fromEntries(i.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 y=Q(b,"extendMarkSchema",u);return {...g,...y?y(c):{}}},{}),p=_x({...f,inclusive:Ie(Q(c,"inclusive",u)),excludes:Ie(Q(c,"excludes",u)),group:Ie(Q(c,"group",u)),spanning:Ie(Q(c,"spanning",u)),code:Ie(Q(c,"code",u)),attrs:Object.fromEntries(d.map(g=>{var b,y;return [g.name,{default:(b=g?.attribute)==null?void 0:b.default,validate:(y=g?.attribute)==null?void 0:y.validate}]}))}),m=Ie(Q(c,"parseHTML",u));m&&(p.parseDOM=m.map(g=>Nx(g,d)));let h=Q(c,"renderHTML",u);return h&&(p.toDOM=g=>h({mark:g,HTMLAttributes:yc(g,d)})),[c.name,p]}));return new Ki({topNode:s,nodes:a,marks:l})}function SI(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Wp(t){return t.sort((n,r)=>{let o=Q(n,"priority")||100,i=Q(r,"priority")||100;return o>i?-1:o<i?1:0})}function zx(t){let e=Wp(Vp(t)),n=SI(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 Hx(t,e,n){let{from:r,to:o}=e,{blockSeparator:i=`
|
|
80
|
+
|
|
81
|
+
`,textSerializers:s={}}=n||{},a="";return t.nodesBetween(r,o,(l,c,d,u)=>{var f;l.isBlock&&c>r&&(a+=i);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,o-c));}),a}function CI(t,e){let n={from:0,to:t.content.size};return Hx(t,n,e)}function Ux(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Fr(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 Vx(t,e){let n=Fr(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,l=>{s.push(...l.marks);});let a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function at(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 RI(t,e){let n=at(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,a=>{i.push(a);});let s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function Cc(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Gp(t,e){let n=Cc(typeof e=="string"?e:e.name,t.schema);return n==="node"?RI(t,e):n==="mark"?Vx(t,e):{}}function TI(t,e=JSON.stringify){let n={};return t.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function kI(t){let e=TI(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function qp(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{let s=[];if(o.ranges.length)o.forEach((a,l)=>{s.push({from:a,to:l});});else {let{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;s.push({from:a,to:l});}s.forEach(({from:a,to:l})=>{let c=e.slice(i).map(a,-1),d=e.slice(i).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}});});}),kI(r)}function jp(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function vc(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:jp(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Kx(t,e,n={}){return t.find(r=>r.type===e&&vc(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function Mx(t,e,n={}){return !!Kx(t,e,n)}function Yp(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(d=>d.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(d=>d.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!Kx([...o.node.marks],e,n)))return;let s=o.index,a=t.start()+o.offset,l=s+1,c=a+o.node.nodeSize;for(;s>0&&Mx([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&Mx([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return {from:a,to:c}}function Rc(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(o=>{let i=n.resolve(t),s=Yp(i,o.type);s&&r.push({mark:o,...s});}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})));}),r}var Wx=(t,e,n,r=20)=>{let o=t.doc.resolve(n),i=r,s=null;for(;i>0&&s===null;){let a=o.node(i);a?.type.name===e?s=a:i-=1;}return [s,i]};function Lp(t,e){return e.nodes[t]||e.marks[t]||null}function bc(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var NI=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{var l,c;let d=((c=(l=o.type.spec).toText)==null?void 0:c.call(l,{node:o,pos:i,parent:s,index:a}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?d:d.slice(0,Math.max(0,r-i));}),n};function zp(t,e,n={}){let{empty:r,ranges:o}=t.selection,i=e?Fr(e,t.schema):null;if(r)return !!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>vc(u.attrs,n,{strict:!1}));let s=0,a=[];if(o.forEach(({$from:u,$to:f})=>{let p=u.pos,m=f.pos;t.doc.nodesBetween(p,m,(h,g)=>{if(!h.isText&&!h.marks.length)return;let b=Math.max(p,g),y=Math.min(m,g+h.nodeSize),v=y-b;s+=v,a.push(...h.marks.map(x=>({mark:x,from:b,to:y})));});}),s===0)return !1;let l=a.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>vc(u.mark.attrs,n,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=a.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,f)=>u+f.to-f.from,0);return (l>0?l+c:l)>=s}function dr(t,e,n={}){let{from:r,to:o,empty:i}=t.selection,s=e?at(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(u,f)=>{if(u.isText)return;let p=Math.max(r,f),m=Math.min(o,f+u.nodeSize);a.push({node:u,from:p,to:m});});let l=o-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>vc(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=l}function _I(t,e,n={}){if(!e)return dr(t,null,n)||zp(t,null,n);let r=Cc(e,t.schema);return r==="node"?dr(t,e,n):r==="mark"?zp(t,e,n):!1}var Gx=(t,e)=>{let{$from:n,$to:r,$anchor:o}=t.selection;if(e){let i=Sc(a=>a.type.name===e)(t.selection);if(!i)return !1;let s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return !(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},qx=t=>{let{$from:e,$to:n}=t.selection;return !(e.parentOffset>0||e.pos!==n.pos)};function Ax(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Ox(t,e){let{nodeExtensions:n}=ga(e),r=n.find(s=>s.name===t);if(!r)return !1;let o={name:r.name,options:r.options,storage:r.storage},i=Ie(Q(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function ba(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 o=!0;return t.content.forEach(i=>{o!==!1&&(ba(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1));}),o}return !1}function Tc(t){return t instanceof X}function jx(t){return t instanceof q}function ai(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Yx(t,e=null){if(!e)return null;let n=Z.atStart(t),r=Z.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;let o=n.from,i=r.to;return e==="all"?q.create(t,ai(0,o,i),ai(t.content.size,o,i)):q.create(t,ai(e,o,i),ai(e,o,i))}function MI(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof et||o instanceof Ye))return;let i=t.mapping.maps[r],s=0;i.forEach((a,l,c,d)=>{s===0&&(s=d);}),t.setSelection(Z.near(t.doc.resolve(s),n));}var ya=class{constructor(t){this.find=t.find,this.handler=t.handler;}},AI=(t,e)=>{if(jp(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 mc(t){var e;let{editor:n,from:r,to:o,text:i,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=NI(c)+i;return s.forEach(f=>{if(d)return;let p=AI(u,f.find);if(!p)return;let m=l.state.tr,h=wc({state:l.state,transaction:m}),g={from:r-(p[0].length-i.length),to:o},{commands:b,chain:y,can:v}=new xc({editor:n,state:h});f.handler({state:h,range:g,match:p,commands:b,chain:y,can:v})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:o,text:i}),l.dispatch(m),d=!0);}),d}function OI(t){let{editor:e,rules:n}=t,r=new oe({state:{init(){return null},apply(o,i,s){let a=o.getMeta(r);if(a)return a;let l=o.getMeta("applyInputRules");return !!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=Kp(O.from(d),s.schema);let{from:u}=l,f=u+d.length;mc({editor:e,from:u,to:f,text:d,rules:n,plugin:r});}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,a){return mc({editor:e,from:i,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{let{$cursor:i}=o.state.selection;i&&mc({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r});}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return !1;let{$cursor:s}=o.state.selection;return s?mc({editor:e,from:s.pos,to:s.pos,text:`
|
|
82
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function DI(t){return Object.prototype.toString.call(t).slice(8,-1)}function hc(t){return DI(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Xx(t,e){let n={...t};return hc(t)&&hc(e)&&Object.keys(e).forEach(r=>{hc(e[r])&&hc(t[r])?n[r]=Xx(t[r],e[r]):n[r]=e[r];}),n}var Xp=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 {...Ie(Q(this,"addOptions",{name:this.name}))||{}}}get storage(){return {...Ie(Q(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){let e=this.extend({...this.config,addOptions:()=>Xx(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}},Pt=class Jx extends Xp{constructor(){super(...arguments),this.type="mark";}static create(e={}){let n=typeof e=="function"?e():e;return new Jx(n)}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){let s=o.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(" ",o.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 PI(t){return typeof t=="number"}var II=class{constructor(t){this.find=t.find,this.handler=t.handler;}},LI=(t,e,n)=>{if(jp(e))return [...t.matchAll(e)];let r=e(t,n);return r?r.map(o=>{let i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function $I(t){let{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:d}=new xc({editor:e,state:n}),u=[];return n.doc.nodesBetween(r,o,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;let h=Math.max(r,m),g=Math.min(o,m+p.content.size),b=p.textBetween(h-m,g-m,void 0,"\uFFFC");LI(b,i.find,s).forEach(v=>{if(v.index===void 0)return;let x=h+v.index+1,E=x+v[0].length,C={from:n.tr.mapping.map(x),to:n.tr.mapping.map(E)},T=i.handler({state:n,range:C,match:v,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(T);});}),u.every(p=>p!==null)}var gc=null,BI=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return (e=n.clipboardData)==null||e.setData("text/html",t),n};function FI(t){let{editor:e,rules:n}=t,r=null,o=!1,i=!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:m})=>{let h=d.tr,g=wc({state:d,transaction:h});if(!(!$I({editor:e,state:g,from:Math.max(u-1,0),to:f.b-1,rule:p,pasteEvent:m,dropEvent:a})||!h.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null;}catch{a=null;}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,h}};return n.map(d=>new oe({view(u){let f=m=>{var h;r=(h=u.dom.parentElement)!=null&&h.contains(m.target)?u.dom.parentElement:null,r&&(gc=e);},p=()=>{gc&&(gc=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(i=r===u.dom.parentElement,a=f,!i){let p=gc;p?.isEditable&&setTimeout(()=>{let m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to});},10);}return !1},paste:(u,f)=>{var p;let m=(p=f.clipboardData)==null?void 0:p.getData("text/html");return s=f,o=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(u,f,p)=>{let m=u[0],h=m.getMeta("uiEvent")==="paste"&&!o,g=m.getMeta("uiEvent")==="drop"&&!i,b=m.getMeta("applyPasteRules"),y=!!b;if(!h&&!g&&!y)return;if(y){let{text:E}=b;typeof E=="string"?E=E:E=Kp(O.from(E),p.schema);let{from:C}=b,T=C+E.length,w=BI(E);return l({rule:d,state:p,from:C,to:{b:T},pasteEvt:w})}let v=f.doc.content.findDiffStart(p.doc.content),x=f.doc.content.findDiffEnd(p.doc.content);if(!(!PI(v)||!x||v===x.b))return l({rule:d,state:p,from:v,to:x,pasteEvt:s})}}))}var kc=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=zx(t),this.schema=EI(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:Lp(e.name,this.schema)},r=Q(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){let{editor:t}=this,e=Wp([...this.extensions].reverse()),n=[],r=[],o=e.map(i=>{let s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:Lp(i.name,this.schema)},a=[],l=Q(i,"addKeyboardShortcuts",s),c={};if(i.type==="mark"&&Q(i,"exitable",s)&&(c.ArrowRight=()=>Pt.handleExit({editor:t,mark:i})),l){let m=Object.fromEntries(Object.entries(l()).map(([h,g])=>[h,()=>g({editor:t})]));c={...c,...m};}let d=ux(c);a.push(d);let u=Q(i,"addInputRules",s);Ax(i,t.options.enableInputRules)&&u&&n.push(...u());let f=Q(i,"addPasteRules",s);Ax(i,t.options.enablePasteRules)&&f&&r.push(...f());let p=Q(i,"addProseMirrorPlugins",s);if(p){let m=p();a.push(...m);}return a}).flat();return [OI({editor:t,rules:n}),...FI({editor:t,rules:r}),...o]}get attributes(){return Fx(this.extensions)}get nodeViews(){let{editor:t}=this,{nodeExtensions:e}=ga(this.extensions);return Object.fromEntries(e.filter(n=>!!Q(n,"addNodeView")).map(n=>{let r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:at(n.name,this.schema)},i=Q(n,"addNodeView",o);if(!i)return [];let s=(a,l,c,d,u)=>{let f=yc(a,r);return i()({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}=ga(this.extensions);return Object.fromEntries(e.filter(n=>!!Q(n,"addMarkView")).map(n=>{let r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Fr(n.name,this.schema)},i=Q(n,"addMarkView",o);if(!i)return [];let s=(a,l,c)=>{let d=yc(a,r);return i()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:d,updateAttributes:u=>{ZL(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:Lp(e.name,this.schema)};e.type==="mark"&&((n=Ie(Q(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);let o=Q(e,"onBeforeCreate",r),i=Q(e,"onCreate",r),s=Q(e,"onUpdate",r),a=Q(e,"onSelectionUpdate",r),l=Q(e,"onTransaction",r),c=Q(e,"onFocus",r),d=Q(e,"onBlur",r),u=Q(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),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);});}};kc.resolve=zx;kc.sort=Wp;kc.flatten=Vp;var zI={};Ix(zI,{ClipboardTextSerializer:()=>Qx,Commands:()=>nE,Delete:()=>rE,Drop:()=>oE,Editable:()=>iE,FocusEvents:()=>aE,Keymap:()=>lE,Paste:()=>cE,Tabindex:()=>dE,focusEventsPluginKey:()=>sE});var se=class Zx extends Xp{constructor(){super(...arguments),this.type="extension";}static create(e={}){let n=typeof e=="function"?e():e;return new Zx(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},Qx=se.create({name:"clipboardTextSerializer",addOptions(){return {blockSeparator:void 0}},addProseMirrorPlugins(){return [new oe({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(d=>d.$from.pos)),a=Math.max(...i.map(d=>d.$to.pos)),l=Ux(n);return Hx(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),eE={};Ix(eE,{blur:()=>HI,clearContent:()=>UI,clearNodes:()=>VI,command:()=>KI,createParagraphNear:()=>WI,cut:()=>GI,deleteCurrentNode:()=>qI,deleteNode:()=>jI,deleteRange:()=>YI,deleteSelection:()=>XI,enter:()=>JI,exitCode:()=>ZI,extendMarkRange:()=>QI,first:()=>eL,focus:()=>nL,forEach:()=>rL,insertContent:()=>oL,insertContentAt:()=>sL,joinBackward:()=>cL,joinDown:()=>lL,joinForward:()=>dL,joinItemBackward:()=>uL,joinItemForward:()=>fL,joinTextblockBackward:()=>pL,joinTextblockForward:()=>mL,joinUp:()=>aL,keyboardShortcut:()=>gL,lift:()=>bL,liftEmptyBlock:()=>yL,liftListItem:()=>vL,newlineInCode:()=>wL,resetAttributes:()=>xL,scrollIntoView:()=>EL,selectAll:()=>SL,selectNodeBackward:()=>CL,selectNodeForward:()=>RL,selectParentNode:()=>TL,selectTextblockEnd:()=>kL,selectTextblockStart:()=>NL,setContent:()=>_L,setMark:()=>AL,setMeta:()=>OL,setNode:()=>DL,setNodeSelection:()=>PL,setTextSelection:()=>IL,sinkListItem:()=>LL,splitBlock:()=>$L,splitListItem:()=>BL,toggleList:()=>FL,toggleMark:()=>zL,toggleNode:()=>HL,toggleWrap:()=>UL,undoInputRule:()=>VL,unsetAllMarks:()=>KL,unsetMark:()=>WL,updateAttributes:()=>GL,wrapIn:()=>qL,wrapInList:()=>jL});var HI=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges());}),!0),UI=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),VI=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.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 m=Ar(p);if(a.type.isTextblock){let{defaultType:h}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(p.start,h);}(m||m===0)&&e.lift(p,m);});}),!0},KI=t=>e=>t(e),WI=()=>({state:t,dispatch:e})=>Mp(t,e),GI=(t,e)=>({editor:n,tr:r})=>{let{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new q(r.doc.resolve(Math.max(s-1,0)))),!0},qI=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return !1;let o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){let a=o.before(i),l=o.after(i);t.delete(a,l).scrollIntoView();}return !0}return !1},jI=t=>({tr:e,state:n,dispatch:r})=>{let o=at(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){let l=i.before(s),c=i.after(s);e.delete(l,c).scrollIntoView();}return !0}return !1},YI=t=>({tr:e,dispatch:n})=>{let{from:r,to:o}=t;return n&&e.delete(r,o),!0},XI=()=>({state:t,dispatch:e})=>fc(t,e),JI=()=>({commands:t})=>t.keyboardShortcut("Enter"),ZI=()=>({state:t,dispatch:e})=>_p(t,e),QI=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=Fr(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(o){let u=Yp(l,i,e);if(u&&u.from<=c&&u.to>=d){let f=q.create(s,u.from,u.to);n.setSelection(f);}}return !0},eL=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 tL(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Jp(){return ["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var nL=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};let s=()=>{(Jp()||tL())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView());});};if(r.hasFocus()&&t===null||t===!1)return !0;if(i&&t===null&&!jx(n.state.selection))return s(),!0;let a=Yx(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},rL=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),oL=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),iL=t=>!("type"in t),sL=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a,{selection:l}=i.state,c=b=>{i.emit("contentError",{editor:i,error:b,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0);}});},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ha(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0});}catch(b){c(b);}try{a=ha(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.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,m=!0;if((iL(a)?a:[a]).forEach(b=>{b.check(),p=p?b.isText&&b.marks.length===0:!1,m=m?b.isBlock:!1;}),u===f&&m){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 O){let b="";e.forEach(y=>{y.text&&(b+=y.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,y=l.$from.node().isText||l.$from.node().isTextblock,v=l.$from.node().content.size>0;b&&y&&v&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g);}n.updateSelection&&MI(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},aL=()=>({state:t,dispatch:e})=>yx(t,e),lL=()=>({state:t,dispatch:e})=>vx(t,e),cL=()=>({state:t,dispatch:e})=>xp(t,e),dL=()=>({state:t,dispatch:e})=>Cp(t,e),uL=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Zo(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return !1}},fL=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Zo(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return !1}},pL=()=>({state:t,dispatch:e})=>mx(t,e),mL=()=>({state:t,dispatch:e})=>hx(t,e);function tE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function hL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,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))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Jp()||tE()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var gL=t=>({editor:e,view:n,tr:r,dispatch:o})=>{let i=hL(t).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.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&&o&&r.maybeStep(d);}),!0},bL=(t,e={})=>({state:n,dispatch:r})=>{let o=at(t,n.schema);return dr(n,o,e)?wx(n,r):!1},yL=()=>({state:t,dispatch:e})=>Ap(t,e),vL=t=>({state:e,dispatch:n})=>{let r=at(t,e.schema);return Tx(r)(e,n)},wL=()=>({state:t,dispatch:e})=>kp(t,e);function Dx(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var xL=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,a=Cc(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=at(t,r.schema)),a==="mark"&&(s=Fr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{i&&i===c.type&&n.setNodeMarkup(d,void 0,Dx(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(u=>{s===u.type&&n.addMark(d,d+c.nodeSize,s.create(Dx(u.attrs,e)));});});}),!0):!1},EL=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),SL=()=>({tr:t,dispatch:e})=>{if(e){let n=new Et(t.doc);t.setSelection(n);}return !0},CL=()=>({state:t,dispatch:e})=>Ep(t,e),RL=()=>({state:t,dispatch:e})=>Rp(t,e),TL=()=>({state:t,dispatch:e})=>xx(t,e),kL=()=>({state:t,dispatch:e})=>Dp(t,e),NL=()=>({state:t,dispatch:e})=>Op(t,e),_L=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{let{doc:l}=i;if(r.preserveWhitespace!=="full"){let c=Fp(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function ML(t,e,n){var r;let{selection:o}=e,i=null;if(jx(o)&&(i=o.$cursor),i){let a=(r=t.storedMarks)!=null?r:i.marks();return !!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}let{ranges:s}=o;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),m=!!n.isInSet(d.marks)||!d.marks.some(h=>h.type.excludes(n));c=p&&m;}return !c}),c})}var AL=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=n,{empty:s,ranges:a}=i,l=Fr(t,r.schema);if(o)if(s){let c=Vx(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 m=Math.max(p,d),h=Math.min(p+f.nodeSize,u);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&n.addMark(m,h,l.create({...b.attrs,...e}));}):n.addMark(m,h,l.create(e));});});return ML(r,n,l)},OL=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),DL=(t,e={})=>({state:n,dispatch:r,chain:o})=>{let i=at(t,n.schema),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:a})=>Pp(i,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Pp(i,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},PL=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,o=ai(t,0,r.content.size),i=X.create(r,o);e.setSelection(i);}return !0},IL=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=q.atStart(r).from,a=q.atEnd(r).to,l=ai(o,s,a),c=ai(i,s,a),d=q.create(r,l,c);e.setSelection(d);}return !0},LL=t=>({state:e,dispatch:n})=>{let r=at(t,e.schema);return kx(r)(e,n)};function Px(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r);}}var $L=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{let{selection:i,doc:s}=e,{$from:a,$to:l}=i,c=o.extensionManager.attributes,d=bc(c,a.node().type.name,a.node().attrs);if(i instanceof X&&i.node.isBlock)return !a.parentOffset||!bn(s,a.pos)?!1:(r&&(t&&Px(n,o.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:vI(a.node(-1).contentMatchAt(a.indexAfter(-1))),p=u&&f?[{type:f,attrs:d}]:void 0,m=bn(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&bn(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:d}]:void 0),r){if(m&&(i instanceof q&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!u&&!a.parentOffset&&a.parent.type!==f)){let h=e.mapping.map(a.before()),g=e.doc.resolve(h);a.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f);}t&&Px(n,o.extensionManager.splittableMarks),e.scrollIntoView();}return m},BL=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;let a=at(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=i.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(o){let b=O.empty,y=l.index(-1)?1:l.index(-2)?2:3;for(let w=l.depth-y;w>=l.depth-3;w-=1)b=O.from(l.node(w).copy(b));let v=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...bc(f,l.node().type.name,l.node().attrs),...e},E=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(x))||void 0;b=b.append(O.from(a.createAndFill(null,E)||void 0));let C=l.before(l.depth-(y-1));n.replace(C,l.after(-v),new H(b,4-y,0));let T=-1;n.doc.nodesBetween(C,n.doc.content.size,(w,N)=>{if(T>-1)return !1;w.isTextblock&&w.content.size===0&&(T=N+1);}),T>-1&&n.setSelection(q.near(n.doc.resolve(T))),n.scrollIntoView();}return !0}let p=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,m={...bc(f,u.type.name,u.attrs),...e},h={...bc(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);let g=p?[{type:a,attrs:m},{type:p,attrs:h}]:[{type:a,attrs:m}];if(!bn(n.doc,l.pos,2))return !1;if(o){let{selection:b,storedMarks:y}=r,{splittableMarks:v}=i.extensionManager,x=y||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!x||!o)return !0;let E=x.filter(C=>v.includes(C.type.name));n.ensureMarks(E);}return !0},$p=(t,e)=>{let n=Sc(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 o=t.doc.nodeAt(r);return n.node.type===o?.type&&kn(t.doc,n.pos)&&t.join(n.pos),!0},Bp=(t,e)=>{let n=Sc(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 o=t.doc.nodeAt(r);return n.node.type===o?.type&&kn(t.doc,r)&&t.join(r),!0},FL=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:d})=>{let{extensions:u,splittableMarks:f}=o.extensionManager,p=at(t,s.schema),m=at(e,s.schema),{selection:h,storedMarks:g}=s,{$from:b,$to:y}=h,v=b.blockRange(y),x=g||h.$to.parentOffset&&h.$from.marks();if(!v)return !1;let E=Sc(C=>Ox(C.type.name,u))(h);if(v.depth>=1&&E&&v.depth-E.depth<=1){if(E.node.type===p)return c.liftListItem(m);if(Ox(E.node.type.name,u)&&p.validContent(E.node.content)&&a)return l().command(()=>(i.setNodeMarkup(E.pos,p),!0)).command(()=>$p(i,p)).command(()=>Bp(i,p)).run()}return !n||!x||!a?l().command(()=>d().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>$p(i,p)).command(()=>Bp(i,p)).run():l().command(()=>{let C=d().wrapInList(p,r),T=x.filter(w=>f.includes(w.type.name));return i.ensureMarks(T),C?!0:c.clearNodes()}).wrapInList(p,r).command(()=>$p(i,p)).command(()=>Bp(i,p)).run()},zL=(t,e={},n={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=n,s=Fr(t,r.schema);return zp(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},HL=(t,e,n={})=>({state:r,commands:o})=>{let i=at(t,r.schema),s=at(e,r.schema),a=dr(r,i,n),l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},UL=(t,e={})=>({state:n,commands:r})=>{let o=at(t,n.schema);return dr(n,o,e)?r.lift(o):r.wrapIn(o,e)},VL=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r<n.length;r+=1){let o=n[r],i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){let s=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){let l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l));}else s.delete(i.from,i.to);}return !0}}return !1},KL=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos);}),!0},WL=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;let{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Fr(t,r.schema),{$from:c,empty:d,ranges:u}=a;if(!o)return !0;if(d&&s){let{from:f,to:p}=a,m=(i=c.marks().find(g=>g.type===l))==null?void 0:i.attrs,h=Yp(c,l,m);h&&(f=h.from,p=h.to),n.removeMark(f,p,l);}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l);});return n.removeStoredMark(l),!0},GL=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,a=Cc(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=at(t,r.schema)),a==="mark"&&(s=Fr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{let c=l.$from.pos,d=l.$to.pos,u,f,p,m;n.selection.empty?r.doc.nodesBetween(c,d,(h,g)=>{i&&i===h.type&&(p=Math.max(g,c),m=Math.min(g+h.nodeSize,d),u=g,f=h);}):r.doc.nodesBetween(c,d,(h,g)=>{g<c&&i&&i===h.type&&(p=Math.max(g,c),m=Math.min(g+h.nodeSize,d),u=g,f=h),g>=c&&g<=d&&(i&&i===h.type&&n.setNodeMarkup(g,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(b=>{if(s===b.type){let y=Math.max(g,c),v=Math.min(g+h.nodeSize,d);n.addMark(y,v,s.create({...b.attrs,...e}));}}));}),f&&(u!==void 0&&n.setNodeMarkup(u,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(h=>{s===h.type&&n.addMark(p,m,s.create({...h.attrs,...e}));}));}),!0):!1},qL=(t,e={})=>({state:n,dispatch:r})=>{let o=at(t,n.schema);return Cx(o,e)(n,r)},jL=(t,e={})=>({state:n,dispatch:r})=>{let o=at(t,n.schema);return Rx(o,e)(n,r)},nE=se.create({name:"commands",addCommands(){return {...eE}}}),rE=se.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;let i=()=>{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=Hp(t.before,[t,...e]);qp(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,(m,h)=>{let g=h+m.nodeSize-2,b=p.oldRange.from<=h&&g<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:h,to:g,newFrom:d.mapping.map(h),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,m)=>{var h,g;if(p instanceof cn){let b=f.slice(m).map(p.from,-1),y=f.slice(m).map(p.to),v=f.invert().map(b,-1),x=f.invert().map(y),E=(h=d.doc.nodeAt(b-1))==null?void 0:h.marks.some(T=>T.eq(p.mark)),C=(g=d.doc.nodeAt(y))==null?void 0:g.marks.some(T=>T.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:x},newRange:{from:b,to:y},partial:!!(C||E),editor:this.editor,transaction:t,combinedTransform:d});}});};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i();}}),oE=se.create({name:"drop",addProseMirrorPlugins(){return [new oe({key:new ae("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r});}}})]}}),iE=se.create({name:"editable",addProseMirrorPlugins(){return [new oe({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),sE=new ae("focusEvents"),aE=se.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return [new oe({key:sE,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}}}})]}}),lE=se.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,m=u.parent.isTextblock&&f>0?a.doc.resolve(f-1):u,h=m.parent.type.spec.isolating,g=u.pos-u.parentOffset,b=h&&m.parent.childCount===1?g===u.pos:Z.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()},o={...r},i={...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 Jp()||tE()?i:o},addProseMirrorPlugins(){return [new oe({key:new ae("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;let r=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),o=t.some(h=>h.getMeta("preventClearDocument"));if(!r||o)return;let{empty:i,from:s,to:a}=e.selection,l=Z.atStart(e.doc).from,c=Z.atEnd(e.doc).to;if(i||!(s===l&&a===c)||!ba(n.doc))return;let f=n.tr,p=wc({state:n,transaction:f}),{commands:m}=new xc({editor:this.editor,state:p});if(m.clearNodes(),!!f.steps.length)return f}})]}}),cE=se.create({name:"paste",addProseMirrorPlugins(){return [new oe({key:new ae("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n});}}})]}}),dE=se.create({name:"tabindex",addProseMirrorPlugins(){return [new oe({key:new ae("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),YL=class ss{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o;}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 ss(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 ss(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 ss(e,this.editor)}get children(){let e=[];return this.node.content.forEach((n,r)=>{let o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(s);if(!o&&a.depth<=this.depth)return;let l=new ss(a,this.editor,o,o?n:null);o&&(l.actualDepth=this.depth+1),e.push(new ss(a,this.editor,o,o?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,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){let i=o.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){let l=s[a];if(i[l]!==n[l])break}}else r=o;o=o.parent;}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;let i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(l=>n[l]===s.node.attrs[l])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))));}),o}setAttribute(e){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n);}},XL=`.ProseMirror {
|
|
31
83
|
position: relative;
|
|
32
84
|
}
|
|
33
85
|
|
|
@@ -97,19 +149,21 @@ img.ProseMirror-separator {
|
|
|
97
149
|
|
|
98
150
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
99
151
|
display: block;
|
|
100
|
-
}`;function
|
|
152
|
+
}`;function JL(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var uE=class extends yI{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:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);let e=this.createDoc(),n=Yx(e,this.options.autofocus);this.editorState=Or.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=JL(XL,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=Bx(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(o=>{let i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i));}),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?[iE,Qx.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),nE,aE,lE,dE,oE,cE,rE].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new kc(r,this);}createCommandManager(){this.commandManager=new xc({editor:this});}createSchema(){this.schema=this.extensionManager.schema;}createDoc(){let t;try{t=Fp(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=Fp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});}return t}createView(t){var e;this.editorView=new ua(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),o=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)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)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)});}getAttributes(t){return Gp(this.state,t)}isActive(t,e){let n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return _I(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Kp(this.state.doc.content,this.schema)}getText(t){let{blockSeparator:e=`
|
|
101
153
|
|
|
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(`
|
|
154
|
+
`,textSerializers:n={}}=t||{};return CI(this.state.doc,{blockSeparator:e,textSerializers:{...Ux(this.schema),...n}})}get isEmpty(){return ba(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 YL(e,this)}get $doc(){return this.$pos(0)}};function An(t){return new ya({find:t.find,handler:({state:e,range:n,match:r})=>{let o=Ie(t.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=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(Rc(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(h=>h===t.type&&h!==p.mark.type)).filter(p=>p.to>c).length)return null;d<n.to&&i.delete(d,n.to),c>n.from&&i.delete(n.from+l,c);let f=n.from+l+s.length;i.addMark(n.from+l,f,t.type.create(o||{})),i.removeStoredMark(t.type);}}})}function Nc(t){return new ya({find:t.find,handler:({state:e,range:n,match:r})=>{let o=Ie(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from,a=n.to,l=t.type.create(o);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];i.insertText(u,s+r[0].length-1),i.replaceWith(d,a,l);}else if(r[0]){let c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a));}i.scrollIntoView();}})}function va(t){return new ya({find:t.find,handler:({state:e,range:n,match:r})=>{let o=e.doc.resolve(n.from),i=Ie(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i);}})}function tt(t){return new ya({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from,s=n.to;if(r[1]){let a=r[0].lastIndexOf(r[1]);o+=r[0].slice(a+r[1].length),i+=a;let l=i-s;l>0&&(o=r[0].slice(a-l,a)+o,i=s);}e.tr.insertText(o,i,s);}})}function ur(t){return new ya({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{let i=Ie(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&Gi(l,t.type,i);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){let{selection:u,storedMarks:f}=e,{splittableMarks:p}=t.editor.extensionManager,m=f||u.$to.parentOffset&&u.$from.marks();if(m){let h=m.filter(g=>p.includes(g.type.name));s.ensureMarks(h);}}if(t.keepAttributes){let u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(u,i).run();}let d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&kn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&s.join(n.from-1);}})}function fE(t,e){let{selection:n}=t,{$from:r}=n;if(n instanceof X){let i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){let i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return !0;o-=1;}return !1}function ZL(t,e,n={}){let{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((a,l)=>{let c=i.mapping.map(l),d=i.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});i.removeMark(c,d,t.type),i.addMark(c,d,p);}}),i.docChanged&&e.view.dispatch(i);}var Ne=class pE extends Xp{constructor(){super(...arguments),this.type="node";}static create(e={}){let n=typeof e=="function"?e():e;return new pE(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}};function un(t){return new II({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{let i=Ie(t.getAttributes,void 0,r,o);if(i===!1||i===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(Rc(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(g=>g===t.type&&g!==m.mark.type)).filter(m=>m.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(i||{})),s.removeStoredMark(t.type);}}})}var RE=Es(js(),1),TE=Es(hE(),1),kE=Es(wE(),1);var u$=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e);});},f$=({contentComponent:t})=>{let e=(0, EE.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getServerSnapshot);return jsx(Fragment$1,{children:Object.values(e)})};function p$(){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]:Dg__default.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o());},removeRenderer(n){let r={...e};delete r[n],e=r,t.forEach(o=>o());}}}var m$=class extends ee__default.Component{constructor(t){var e;super(t),this.editorContentRef=ee__default.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=p$(),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$1,{children:[jsx("div",{ref:u$(e,this.editorContentRef),...n}),t?.contentComponent&&jsx(f$,{contentComponent:t.contentComponent})]})}},h$=forwardRef((t,e)=>{let n=ee__default.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ee__default.createElement(m$,{key:n,innerRef:e,...t})}),CE=ee__default.memo(h$),C$=typeof window<"u"?useLayoutEffect:useEffect,R$=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 T$(t){var e;let[n]=useState(()=>new R$(t.editor)),r=(0, kE.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:TE.default);return C$(()=>n.watch(t.editor),[t.editor,n]),useDebugValue(r),r}var xE=process.env.NODE_ENV!=="production",em=typeof window>"u",k$=em||!!(typeof window<"u"&&window.next),N$=class NE{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(em||k$){if(xE)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&&em&&xE)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 o,i;return (i=(o=this.options.current).onBeforeCreate)==null?void 0:i.call(o,...r)},onBlur:(...r)=>{var o,i;return (i=(o=this.options.current).onBlur)==null?void 0:i.call(o,...r)},onCreate:(...r)=>{var o,i;return (i=(o=this.options.current).onCreate)==null?void 0:i.call(o,...r)},onDestroy:(...r)=>{var o,i;return (i=(o=this.options.current).onDestroy)==null?void 0:i.call(o,...r)},onFocus:(...r)=>{var o,i;return (i=(o=this.options.current).onFocus)==null?void 0:i.call(o,...r)},onSelectionUpdate:(...r)=>{var o,i;return (i=(o=this.options.current).onSelectionUpdate)==null?void 0:i.call(o,...r)},onTransaction:(...r)=>{var o,i;return (i=(o=this.options.current).onTransaction)==null?void 0:i.call(o,...r)},onUpdate:(...r)=>{var o,i;return (i=(o=this.options.current).onUpdate)==null?void 0:i.call(o,...r)},onContentError:(...r)=>{var o,i;return (i=(o=this.options.current).onContentError)==null?void 0:i.call(o,...r)},onDrop:(...r)=>{var o,i;return (i=(o=this.options.current).onDrop)==null?void 0:i.call(o,...r)},onPaste:(...r)=>{var o,i;return (i=(o=this.options.current).onPaste)==null?void 0:i.call(o,...r)},onDelete:(...r)=>{var o,i;return (i=(o=this.options.current).onDelete)==null?void 0:i.call(o,...r)}};return new uE(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((o,i)=>{var s;return o===((s=n.extensions)==null?void 0:s[i])}):e[r]===n[r])}onRender(e){return ()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?NE.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,o)=>r===e[o]))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 _E(t={},e=[]){let n=useRef(t);n.current=t;let[r]=useState(()=>new N$(n)),o=(0, RE.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return useDebugValue(o),useEffect(r.onRender(e)),T$({editor:o,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),o}var _$=createContext({editor:null});_$.Consumer;var O$=createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});var D$=()=>useContext(O$);ee__default.forwardRef((t,e)=>{let{onDragStart:n}=D$(),r=t.as||"div";return jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});ee__default.createContext({markViewContentRef:()=>{}});var as=(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 $$=/^\s*>\s$/,ME=Ne.create({name:"blockquote",addOptions(){return {HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return [{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return as("blockquote",{...ie(this.options.HTMLAttributes,t),children:as("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 [ur({find:$$,type:this.type})]}});var B$=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,F$=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,z$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,H$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,AE=Pt.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 as("strong",{...ie(this.options.HTMLAttributes,t),children:as("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 [An({find:B$,type:this.type}),An({find:z$,type:this.type})]},addPasteRules(){return [un({find:F$,type:this.type}),un({find:H$,type:this.type})]}});var U$=/(^|[^`])`([^`]+)`(?!`)/,V$=/(^|[^`])`([^`]+)`(?!`)/g,OE=Pt.create({name:"code",addOptions(){return {HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return [{tag:"code"}]},renderHTML({HTMLAttributes:t}){return ["code",ie(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 [An({find:U$,type:this.type})]},addPasteRules(){return [un({find:V$,type:this.type})]}});var K$=/^```([a-z]+)?[\s\n]$/,W$=/^~~~([a-z]+)?[\s\n]$/,tm=Ne.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,i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return [{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return ["pre",ie(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:o}=n;if(!o||r.parent.type!==this.type)return !1;let i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
|
|
103
155
|
|
|
104
|
-
`);return !
|
|
105
|
-
`));return s.replaceSelectionWith(this.type.create({language:
|
|
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
|
-
`,
|
|
156
|
+
`);return !i||!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:o,empty:i}=n;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return !1;let a=o.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(Z.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return [va({find:K$,type:this.type,getAttributes:t=>({language:t[1]})}),va({find:W$,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return [new oe({key:new ae("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"),o=r?JSON.parse(r):void 0,i=o?.mode;if(!n||!i)return !1;let{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
|
|
157
|
+
`));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(q.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),DE=tm;var PE=Ne.create({name:"doc",topNode:!0,content:"block+"});var IE=Ne.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",ie(this.options.HTMLAttributes,t)]},renderText(){return `
|
|
158
|
+
`},addCommands(){return {setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return !1;let{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=i||o.$to.parentOffset&&o.$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 LE=Ne.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]}`,ie(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=>va({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var $E=Ne.create({name:"horizontalRule",addOptions(){return {HTMLAttributes:{}}},group:"block",parseHTML(){return [{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return ["hr",ie(this.options.HTMLAttributes,t)]},addCommands(){return {setHorizontalRule:()=>({chain:t,state:e})=>{if(!fE(e,e.schema.nodes[this.name]))return !1;let{selection:n}=e,{$to:r}=n,o=t();return Tc(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:i,dispatch:s})=>{var a;if(s){let{$to:l}=i.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(q.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(X.create(i.doc,l.pos)):i.setSelection(q.create(i.doc,l.pos));else {let d=(a=l.parent.type.contentMatch.defaultType)==null?void 0:a.create();d&&(i.insert(c,d),i.setSelection(q.create(i.doc,c+1)));}i.scrollIntoView();}return !0}).run()}}},addInputRules(){return [Nc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var G$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,q$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,j$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Y$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,BE=Pt.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",ie(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 [An({find:G$,type:this.type}),An({find:j$,type:this.type})]},addPasteRules(){return [un({find:q$,type:this.type}),un({find:Y$,type:this.type})]}});var X$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",J$="\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",cs=(t,e)=>{for(let n in e)t[n]=e[n];return t},lm="numeric",cm="ascii",dm="alpha",Sa="asciinumeric",Ea="alphanumeric",um="domain",WE="emoji",Z$="scheme",Q$="slashscheme",nm="whitespace";function e2(t,e){return t in e||(e[t]=[]),e[t]}function li(t,e,n){e[lm]&&(e[Sa]=!0,e[Ea]=!0),e[cm]&&(e[Sa]=!0,e[dm]=!0),e[Sa]&&(e[Ea]=!0),e[dm]&&(e[Ea]=!0),e[Ea]&&(e[um]=!0),e[WE]&&(e[um]=!0);for(let r in e){let o=e2(r,n);o.indexOf(t)<0&&o.push(t);}}function t2(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function fn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t;}fn.groups={};fn.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 o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r);},tr(t,e,n,r){r=r||fn.groups;let o;return e&&e.j?o=e:(o=new fn(e),n&&r&&li(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this,i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||fn.groups;let o=this;if(e&&e.j)return o.j[t]=e,e;let i=e,s,a=o.go(t);if(a?(s=new fn,cs(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new fn,i){if(r)if(s.t&&typeof s.t=="string"){let l=cs(t2(s.t,r),n);li(i,l,r);}else n&&li(i,n,r);s.t=i;}return o.j[t]=s,s}};var we=(t,e,n,r,o)=>t.ta(e,n,r,o),lt=(t,e,n,r,o)=>t.tr(e,n,r,o),FE=(t,e,n,r,o)=>t.ts(e,n,r,o),z=(t,e,n,r,o)=>t.tt(e,n,r,o),Ur="WORD",fm="UWORD",GE="ASCIINUMERICAL",qE="ALPHANUMERICAL",_a="LOCALHOST",pm="TLD",mm="UTLD",Dc="SCHEME",ls="SLASH_SCHEME",gm="NUM",hm="WS",bm="NL",Ca="OPENBRACE",Ra="CLOSEBRACE",Pc="OPENBRACKET",Ic="CLOSEBRACKET",Lc="OPENPAREN",$c="CLOSEPAREN",Bc="OPENANGLEBRACKET",Fc="CLOSEANGLEBRACKET",zc="FULLWIDTHLEFTPAREN",Hc="FULLWIDTHRIGHTPAREN",Uc="LEFTCORNERBRACKET",Vc="RIGHTCORNERBRACKET",Kc="LEFTWHITECORNERBRACKET",Wc="RIGHTWHITECORNERBRACKET",Gc="FULLWIDTHLESSTHAN",qc="FULLWIDTHGREATERTHAN",jc="AMPERSAND",Yc="APOSTROPHE",Xc="ASTERISK",mo="AT",Jc="BACKSLASH",Zc="BACKTICK",Qc="CARET",ho="COLON",ym="COMMA",ed="DOLLAR",fr="DOT",td="EQUALS",vm="EXCLAMATION",Dn="HYPHEN",Ta="PERCENT",nd="PIPE",rd="PLUS",od="POUND",ka="QUERY",wm="QUOTE",jE="FULLWIDTHMIDDLEDOT",xm="SEMI",pr="SLASH",Na="TILDE",id="UNDERSCORE",YE="EMOJI",sd="SYM",XE=Object.freeze({__proto__:null,ALPHANUMERICAL:qE,AMPERSAND:jc,APOSTROPHE:Yc,ASCIINUMERICAL:GE,ASTERISK:Xc,AT:mo,BACKSLASH:Jc,BACKTICK:Zc,CARET:Qc,CLOSEANGLEBRACKET:Fc,CLOSEBRACE:Ra,CLOSEBRACKET:Ic,CLOSEPAREN:$c,COLON:ho,COMMA:ym,DOLLAR:ed,DOT:fr,EMOJI:YE,EQUALS:td,EXCLAMATION:vm,FULLWIDTHGREATERTHAN:qc,FULLWIDTHLEFTPAREN:zc,FULLWIDTHLESSTHAN:Gc,FULLWIDTHMIDDLEDOT:jE,FULLWIDTHRIGHTPAREN:Hc,HYPHEN:Dn,LEFTCORNERBRACKET:Uc,LEFTWHITECORNERBRACKET:Kc,LOCALHOST:_a,NL:bm,NUM:gm,OPENANGLEBRACKET:Bc,OPENBRACE:Ca,OPENBRACKET:Pc,OPENPAREN:Lc,PERCENT:Ta,PIPE:nd,PLUS:rd,POUND:od,QUERY:ka,QUOTE:wm,RIGHTCORNERBRACKET:Vc,RIGHTWHITECORNERBRACKET:Wc,SCHEME:Dc,SEMI:xm,SLASH:pr,SLASH_SCHEME:ls,SYM:sd,TILDE:Na,TLD:pm,UNDERSCORE:id,UTLD:mm,UWORD:fm,WORD:Ur,WS:hm}),zr=/[a-z]/,xa=/\p{L}/u,rm=/\p{Emoji}/u;var Hr=/\d/,om=/\s/;var zE="\r",im=`
|
|
159
|
+
`,n2="\uFE0F",r2="\u200D",sm="\uFFFC",Mc=null,Ac=null;function o2(t=[]){let e={};fn.groups=e;let n=new fn;Mc==null&&(Mc=HE(X$)),Ac==null&&(Ac=HE(J$)),z(n,"'",Yc),z(n,"{",Ca),z(n,"}",Ra),z(n,"[",Pc),z(n,"]",Ic),z(n,"(",Lc),z(n,")",$c),z(n,"<",Bc),z(n,">",Fc),z(n,"\uFF08",zc),z(n,"\uFF09",Hc),z(n,"\u300C",Uc),z(n,"\u300D",Vc),z(n,"\u300E",Kc),z(n,"\u300F",Wc),z(n,"\uFF1C",Gc),z(n,"\uFF1E",qc),z(n,"&",jc),z(n,"*",Xc),z(n,"@",mo),z(n,"`",Zc),z(n,"^",Qc),z(n,":",ho),z(n,",",ym),z(n,"$",ed),z(n,".",fr),z(n,"=",td),z(n,"!",vm),z(n,"-",Dn),z(n,"%",Ta),z(n,"|",nd),z(n,"+",rd),z(n,"#",od),z(n,"?",ka),z(n,'"',wm),z(n,"/",pr),z(n,";",xm),z(n,"~",Na),z(n,"_",id),z(n,"\\",Jc),z(n,"\u30FB",jE);let r=lt(n,Hr,gm,{[lm]:!0});lt(r,Hr,r);let o=lt(r,zr,GE,{[Sa]:!0}),i=lt(r,xa,qE,{[Ea]:!0}),s=lt(n,zr,Ur,{[cm]:!0});lt(s,Hr,o),lt(s,zr,s),lt(o,Hr,o),lt(o,zr,o);let a=lt(n,xa,fm,{[dm]:!0});lt(a,zr),lt(a,Hr,i),lt(a,xa,a),lt(i,Hr,i),lt(i,zr),lt(i,xa,i);let l=z(n,im,bm,{[nm]:!0}),c=z(n,zE,hm,{[nm]:!0}),d=lt(n,om,hm,{[nm]:!0});z(n,sm,d),z(c,im,l),z(c,sm,d),lt(c,om,d),z(d,zE),z(d,im),lt(d,om,d),z(d,sm,d);let u=lt(n,rm,YE,{[WE]:!0});z(u,"#"),lt(u,rm,u),z(u,n2,u);let f=z(u,r2);z(f,"#"),lt(f,rm,u);let p=[[zr,s],[Hr,o]],m=[[zr,null],[xa,a],[Hr,i]];for(let h=0;h<Mc.length;h++)po(n,Mc[h],pm,Ur,p);for(let h=0;h<Ac.length;h++)po(n,Ac[h],mm,fm,m);li(pm,{tld:!0,ascii:!0},e),li(mm,{utld:!0,alpha:!0},e),po(n,"file",Dc,Ur,p),po(n,"mailto",Dc,Ur,p),po(n,"http",ls,Ur,p),po(n,"https",ls,Ur,p),po(n,"ftp",ls,Ur,p),po(n,"ftps",ls,Ur,p),li(Dc,{scheme:!0,ascii:!0},e),li(ls,{slashscheme:!0,ascii:!0},e),t=t.sort((h,g)=>h[0]>g[0]?1:-1);for(let h=0;h<t.length;h++){let g=t[h][0],y=t[h][1]?{[Z$]:!0}:{[Q$]:!0};g.indexOf("-")>=0?y[um]=!0:zr.test(g)?Hr.test(g)?y[Sa]=!0:y[cm]=!0:y[lm]=!0,FE(n,g,g,y);}return FE(n,"localhost",_a,{ascii:!0}),n.jd=new fn(sd),{start:n,tokens:cs({groups:e},XE)}}function JE(t,e){let n=i2(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[],i=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,i+=n[s].length,s++;i-=u,s-=f,c-=u,o.push({t:d.t,v:e.slice(i-c,i),s:i-c,e:i});}return o}function i2(t){let e=[],n=t.length,r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length;}return e}function po(t,e,n,r,o){let i,s=e.length;for(let a=0;a<s-1;a++){let l=e[a];t.j[l]?i=t.j[l]:(i=new fn(r),i.jr=o.slice(),t.j[l]=i),t=i;}return i=new fn(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function HE(t){let e=[],n=[],r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i;}else n.push(t[r]),r++;}return e}var Ma={defaultProtocol:"http",events:null,format:UE,formatHref:UE,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Em(t,e=null){let n=cs({},Ma);t&&(n=cs(n,t instanceof Em?t.o:t));let r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o;}Em.prototype={o:Ma,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){let r=e!=null,o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Ma[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},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 UE(t){return t}function ZE(t,e){this.t="token",this.v=t,this.tk=e;}ZE.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=Ma.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),o=t.get("tagName",n,e),i=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&&cs(s,d),{tagName:o,attributes:s,content:i,eventListeners:u}}};function ad(t,e){class n extends ZE{constructor(o,i){super(o,i),this.t=t;}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var VE=ad("email",{isLink:!0,toHref(){return "mailto:"+this.toString()}}),KE=ad("text"),s2=ad("nl"),Oc=ad("url",{isLink:!0,toHref(t=Ma.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==_a&&t[1].t===ho}});var On=t=>new fn(t);function a2({groups:t}){let e=t.domain.concat([jc,Xc,mo,Jc,Zc,Qc,ed,td,Dn,gm,Ta,nd,rd,od,pr,sd,Na,id]),n=[Yc,ho,ym,fr,vm,Ta,ka,wm,xm,Bc,Fc,Ca,Ra,Ic,Pc,Lc,$c,zc,Hc,Uc,Vc,Kc,Wc,Gc,qc],r=[jc,Yc,Xc,Jc,Zc,Qc,ed,td,Dn,Ca,Ra,Ta,nd,rd,od,ka,pr,sd,Na,id],o=On(),i=z(o,Na);we(i,r,i),we(i,t.domain,i);let s=On(),a=On(),l=On();we(o,t.domain,s),we(o,t.scheme,a),we(o,t.slashscheme,l),we(s,r,i),we(s,t.domain,s);let c=z(s,mo);z(i,mo,c),z(a,mo,c),z(l,mo,c);let d=z(i,fr);we(d,r,i),we(d,t.domain,i);let u=On();we(c,t.domain,u),we(u,t.domain,u);let f=z(u,fr);we(f,t.domain,u);let p=On(VE);we(f,t.tld,p),we(f,t.utld,p),z(c,_a,p);let m=z(u,Dn);z(m,Dn,m),we(m,t.domain,u),we(p,t.domain,u),z(p,fr,f),z(p,Dn,m);let h=z(p,ho);we(h,t.numeric,VE);let g=z(s,Dn),b=z(s,fr);z(g,Dn,g),we(g,t.domain,s),we(b,r,i),we(b,t.domain,s);let y=On(Oc);we(b,t.tld,y),we(b,t.utld,y),we(y,t.domain,s),we(y,r,i),z(y,fr,b),z(y,Dn,g),z(y,mo,c);let v=z(y,ho),x=On(Oc);we(v,t.numeric,x);let E=On(Oc),C=On();we(E,e,E),we(E,n,C),we(C,e,E),we(C,n,C),z(y,pr,E),z(x,pr,E);let T=z(a,ho),w=z(l,ho),N=z(w,pr),M=z(N,pr);we(a,t.domain,s),z(a,fr,b),z(a,Dn,g),we(l,t.domain,s),z(l,fr,b),z(l,Dn,g),we(T,t.domain,E),z(T,pr,E),z(T,ka,E),we(M,t.domain,E),we(M,e,E),z(M,pr,E);let B=[[Ca,Ra],[Pc,Ic],[Lc,$c],[Bc,Fc],[zc,Hc],[Uc,Vc],[Kc,Wc],[Gc,qc]];for(let U=0;U<B.length;U++){let[K,P]=B[U],V=z(E,K);z(C,K,V),z(V,P,E);let R=On(Oc);we(V,e,R);let k=On();we(V,n),we(R,e,R),we(R,n,k),we(k,e,R),we(k,n,k),z(R,P,E),z(k,P,E);}return z(o,_a,y),z(o,bm,s2),{start:o,tokens:XE}}function l2(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,c=null,d=0,u=null,f=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(f=0,u=a):f>=0&&f++,o++,d++;if(f<0)o-=d,o<r&&(s.push(n[o]),o++);else {s.length>0&&(i.push(am(KE,e,s)),s=[]),o-=f,d-=f;let p=u.t,m=n.slice(o-d,o);i.push(am(p,e,m));}}return s.length>0&&i.push(am(KE,e,s)),i}function am(t,e,n){let r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}var c2=typeof console<"u"&&console&&console.warn||(()=>{}),d2="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",je={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function QE(){return fn.groups={},je.scanner=null,je.parser=null,je.tokenQueue=[],je.pluginQueue=[],je.customSchemes=[],je.initialized=!1,je}function Sm(t,e=!1){if(je.initialized&&c2(`linkifyjs: already initialized - will not register custom scheme "${t}" ${d2}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
108
160
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
109
161
|
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:
|
|
162
|
+
3. "-" cannot repeat`);je.customSchemes.push([t,e]);}function u2(){je.scanner=o2(je.customSchemes);for(let t=0;t<je.tokenQueue.length;t++)je.tokenQueue[t][1]({scanner:je.scanner});je.parser=a2(je.scanner.tokens);for(let t=0;t<je.pluginQueue.length;t++)je.pluginQueue[t][1]({scanner:je.scanner,parser:je.parser});return je.initialized=!0,je}function ld(t){return je.initialized||u2(),l2(je.parser.start,t,JE(je.scanner.start,t))}ld.scan=JE;function cd(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 Em(n),o=ld(t),i=[];for(let s=0;s<o.length;s++){let a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r));}return i}var Cm="[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]",f2=new RegExp(Cm),p2=new RegExp(`${Cm}$`),m2=new RegExp(Cm,"g");function h2(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function g2(t){return new oe({key:new ae("autolink"),appendTransaction:(e,n,r)=>{let o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,a=Hp(n.doc,[...e]);if(qp(a).forEach(({newRange:c})=>{let d=$x(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(!p2.test(p))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ");}if(u&&f){let p=f.split(f2).filter(Boolean);if(p.length<=0)return !1;let m=p[p.length-1],h=u.pos+f.lastIndexOf(m);if(!m)return !1;let g=ld(m).map(b=>b.toObject(t.defaultProtocol));if(!h2(g))return !1;g.filter(b=>b.isLink).map(b=>({...b,from:h+b.start+1,to:h+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=>{Rc(b.from,b.to,r.doc).some(y=>y.mark.type===t.type)||s.addMark(b.from,b.to,t.type.create({href:b.href}));});}}),!!s.steps.length)return s}})}function b2(t){return new oe({key:new ae("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;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=Gp(e.state,t.type.name),l=(o=s?.href)!=null?o:a.href,c=(i=s?.target)!=null?i:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),s&&l?(window.open(l,c),!0):!1}}})}function y2(t){return new oe({key:new ae("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return !1;let a="";r.content.forEach(c=>{a+=c.textContent;});let l=cd(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 ci(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?r:r.scheme;o&&n.push(o);}),!t||t.replace(m2,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Rm=Pt.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"){Sm(t);return}Sm(t.scheme,t.optionalSlashes);});},onDestroy(){QE();},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)=>!!ci(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=>!!ci(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=>!!ci(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ie(this.options.HTMLAttributes,t),0]:["a",ie(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return {setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!ci(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=>!!ci(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 [un({find:t=>{let e=[];if(t){let{protocols:n,defaultProtocol:r}=this.options,o=cd(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!ci(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}));}return e},type:this.type,getAttributes:t=>{var e;return {href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(g2({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!ci(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(b2({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(y2({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),eS=Rm;var v2=Object.defineProperty,w2=(t,e)=>{for(var n in e)v2(t,n,{get:e[n],enumerable:!0});},x2="listItem",tS="textStyle",nS=/^\s*([-+*])\s$/,Nm=Ne.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",ie(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(x2,this.editor.getAttributes(tS)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return {"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ur({find:nS,type:this.type});return (this.options.keepMarks||this.options.keepAttributes)&&(t=ur({find:nS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(tS),editor:this.editor})),[t]}}),_m=Ne.create({name:"listItem",addOptions(){return {HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return [{tag:"li"}]},renderHTML({HTMLAttributes:t}){return ["li",ie(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)}}}),E2={};w2(E2,{findListItemPos:()=>Aa,getNextListDepth:()=>Mm,handleBackspace:()=>Tm,handleDelete:()=>km,hasListBefore:()=>iS,hasListItemAfter:()=>S2,hasListItemBefore:()=>sS,listItemHasSubList:()=>aS,nextListIsDeeper:()=>lS,nextListIsHigher:()=>cS});var Aa=(t,e)=>{let{$from:n}=e.selection,r=at(t,e.schema),o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&a===null;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return a===null?null:{$pos:e.doc.resolve(s),depth:a}},Mm=(t,e)=>{let n=Aa(t,e);if(!n)return !1;let[,r]=Wx(e,t,n.$pos.pos+4);return r},iS=(t,e,n)=>{let{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),i=t.doc.resolve(o).node();return !(!i||!n.includes(i.type.name))},sS=(t,e)=>{var n;let{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return !(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},aS=(t,e,n)=>{if(!n)return !1;let r=at(t,e.schema),o=!1;return n.descendants(i=>{i.type===r&&(o=!0);}),o},Tm=(t,e,n)=>{if(t.commands.undoInputRule())return !0;if(t.state.selection.from!==t.state.selection.to)return !1;if(!dr(t.state,e)&&iS(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(!dr(t.state,e)||!qx(t.state))return !1;let r=Aa(e,t.state);if(!r)return !1;let i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),s=aS(e,t.state,i);return sS(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},lS=(t,e)=>{let n=Mm(t,e),r=Aa(t,e);return !r||!n?!1:n>r.depth},cS=(t,e)=>{let n=Mm(t,e),r=Aa(t,e);return !r||!n?!1:n<r.depth},km=(t,e)=>{if(!dr(t.state,e)||!Gx(t.state,e))return !1;let{selection:n}=t.state,{$from:r,$to:o}=n;return !n.empty&&r.sameParent(o)?!1:lS(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():cS(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},S2=(t,e)=>{var n;let{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return !(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},Am=se.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&&km(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&&km(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&&Tm(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&&Tm(t,n,r)&&(e=!0);}),e}}}}),C2="listItem",rS="textStyle",oS=/^(\d+)\.\s$/,Om=Ne.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",ie(this.options.HTMLAttributes,n),0]:["ol",ie(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(C2,this.editor.getAttributes(rS)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return {"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ur({find:oS,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=ur({find:oS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(rS)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),R2=/^\s*(\[([( |x])?\])\s$/,dd=Ne.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",ie(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 o=document.createElement("li"),i=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(),i.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 m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m?.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])=>{o.setAttribute(d,u);}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([d,u])=>{o.setAttribute(d,u);}),{dom:o,contentDOM:l,update:d=>d.type!==this.type?!1:(o.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(),!0)}}},addInputRules(){return [ur({find:R2,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),ud=Ne.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",ie(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()}}});se.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push(Nm.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(_m.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Am.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Om.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(dd.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(ud.configure(this.options.taskList)),t}});var dS=Ne.create({name:"paragraph",priority:1e3,addOptions(){return {HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return [{tag:"p"}]},renderHTML({HTMLAttributes:t}){return ["p",ie(this.options.HTMLAttributes,t),0]},addCommands(){return {setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return {"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var T2=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,k2=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,uS=Pt.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",ie(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 [An({find:T2,type:this.type})]},addPasteRules(){return [un({find:k2,type:this.type})]}});var fS=Ne.create({name:"text",group:"inline"});var Dm=Pt.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",ie(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()}}}),pS=Dm;function mS(t={}){return new oe({view(e){return new Pm(e,t)}})}var Pm=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(o=>{let i=s=>{this[o](s);};return e.dom.addEventListener(o,i),{name:o,handler:i}});}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,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,a=i.height/o.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 m=p.getBoundingClientRect(),h=u?m.bottom:m.top;u&&f&&(h=(h+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:m.left,right:m.right,top:h-g,bottom:h+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),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Ql(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 Xe=class extends Z{constructor(e){super(e,e);}map(e,n){let r=e.resolve(n.map(this.head));return Xe.valid(r)?new Xe(r):Z.near(r)}content(){return H.empty}eq(e){return e instanceof Xe&&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 Xe(e.resolve(n.pos))}getBookmark(){return new Oa(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!N2(e)||!_2(e))return !1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Xe.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let l=e.doc.resolve(o);if(Xe.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!X.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if(Xe.valid(a))return a}return null}}};Xe.prototype.visible=!1;Xe.findFrom=Xe.findGapCursorFrom;Z.jsonID("gapcursor",Xe);var Oa=class{constructor(e){this.pos=e;}map(e){return new Oa(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Xe.valid(n)?new Xe(n):Z.near(n)}};function N2(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 o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return !0;if(o.inlineContent)return !1}}return !0}function _2(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 o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return !0;if(o.inlineContent)return !1}}return !0}function hS(){return new oe({props:{decorations:D2,createSelectionBetween(t,e,n){return e.pos==n.pos&&Xe.valid(n)?new Xe(n):null},handleClick:A2,handleKeyDown:M2,handleDOMEvents:{beforeinput:O2}}})}var M2=ma({ArrowLeft:fd("horiz",-1),ArrowRight:fd("horiz",1),ArrowUp:fd("vert",-1),ArrowDown:fd("vert",1)});function fd(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof q){if(!i.endOfTextblock(n)||a.depth==0)return !1;l=!1,a=r.doc.resolve(e>0?a.after():a.before());}let c=Xe.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new Xe(c))),!0):!1}}function A2(t,e,n){if(!t||!t.editable)return !1;let r=t.state.doc.resolve(e);if(!Xe.valid(r))return !1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&X.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Xe(r))),!0)}function O2(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Xe))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 o=O.empty;for(let s=r.length-1;s>=0;s--)o=O.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new H(o,0,0));return i.setSelection(q.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function D2(t){if(!(t.selection instanceof Xe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ee.create(t.doc,[Be.widget(t.selection.head,e,{key:"gapcursor"})])}var pd=200,It=function(){};It.prototype.append=function(e){return e.length?(e=It.from(e),!this.length&&e||e.length<pd&&this.leafAppend(e)||this.length<pd&&e.leafPrepend(this)||this.appendInner(e)):this};It.prototype.prepend=function(e){return e.length?It.from(e).append(this):this};It.prototype.appendInner=function(e){return new P2(this,e)};It.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?It.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};It.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};It.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);};It.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};It.from=function(e){return e instanceof It?e:e&&e.length?new gS(e):It.empty};var gS=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(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return !1},e.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return !1},e.prototype.leafAppend=function(o){if(this.length+o.length<=pd)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=pd)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(It);It.empty=new gS([]);var P2=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,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return !1},e.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return !1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,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}(It),Im=It;var I2=500,yn=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 o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,l,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,d.push(u);return}if(o){d.push(new Pn(u.map));let p=u.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new Pn(m,void 0,void 0,c.length+d.length))),i--,m&&o.appendMap(m,i);}else s.maybeStep(u.step);if(u.selection)return a=o?u.selection.map(o.slice(i)):u.selection,l=new yn(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,o){let i=[],s=this.eventCount,a=this.items,l=!o&&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 Pn(e.mapping.maps[d],u,n),p;(p=l&&l.merge(f))&&(f=p,d?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),o||(l=f);}let c=s-r.depth;return c>$2&&(a=L2(a,c),s-=c),new yn(a.append(i),s)}remapping(e,n){let r=new oo;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s);},e,n),r}addMaps(e){return this.eventCount==0?this:new yn(this.items.append(e.map(n=>new Pn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--;},o);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(f.step){let h=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(i.slice(l+1,p));g&&a++,r.push(new Pn(m,h,g));}else r.push(new Pn(m));},o);let c=[];for(let f=n;f<s;f++)c.push(new Pn(i.maps[f]));let d=this.items.slice(0,o).append(c).append(r),u=new yn(d,a);return u.emptyItemCount()>I2&&(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,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;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&&i++;let u=new Pn(c.invert(),l,d),f,p=o.length-1;(f=o.length&&o[p].merge(u))?o[p]=f:o.push(u);}}else s.map&&r--;},this.items.length,0),new yn(Im.from(o.reverse()),i)}};yn.empty=new yn(Im.empty,0);function L2(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}var Pn=class{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o;}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Pn(n.getMap().invert(),n,this.selection)}}},mr=class{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i;}},$2=20;function B2(t,e,n,r){let o=n.getMeta(di),i;if(o)return o.historyState;n.getMeta(H2)&&(t=new mr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(di))return s.getMeta(di).redo?new mr(t.done.addTransform(n,void 0,r,md(e)),t.undone,bS(n.mapping.maps),t.prevTime,t.prevComposition):new mr(t.done,t.undone.addTransform(n,void 0,r,md(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||!F2(n,t.prevRanges)),c=s?Lm(t.prevRanges,n.mapping):bS(n.mapping.maps);return new mr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,md(e)),yn.empty,c,n.time,a??t.prevComposition)}else return (i=n.getMeta("rebased"))?new mr(t.done.rebased(n,i),t.undone.rebased(n,i),Lm(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new mr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Lm(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function F2(t,e){if(!e)return !1;if(!t.docChanged)return !0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0);}),n}function bS(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function Lm(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i);}return n}function z2(t,e,n){let r=md(e),o=di.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),l=new mr(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(di,{redo:n,historyState:l})}var $m=!1,yS=null;function md(t){let e=t.plugins;if(yS!=e){$m=!1,yS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){$m=!0;break}}return $m}var di=new ae("history"),H2=new ae("closeHistory");function vS(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new oe({key:di,state:{init(){return new mr(yn.empty,yn.empty,null,0,-1)},apply(e,n,r){return B2(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Bm:r=="historyRedo"?Fm:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function hd(t,e){return (n,r)=>{let o=di.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return !1;if(r){let i=z2(o,n,t);i&&r(e?i.scrollIntoView():i);}return !0}}var Bm=hd(!1,!0),Fm=hd(!0,!0);se.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 oe({key:new ae("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;let o=this.options.limit;if(o==null||o===0){t=!0;return}let i=this.storage.characters({node:r.doc});if(i>o){let s=i-o,a=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} 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 o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return !0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return !1;let a=e.selection.$head.pos,l=i-r,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var xS=se.create({name:"dropCursor",addOptions(){return {color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return [mS(this.options)]}});se.create({name:"focus",addOptions(){return {className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return [new oe({key:new ae("focus"),props:{decorations:({doc:t,selection:e})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return Ee.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(o>=c&&o<=c+l.nodeSize-1))return !1;s+=1;});let a=0;return t.descendants((l,c)=>{if(l.isText||!(o>=c&&o<=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";i.push(Be.node(c,c+l.nodeSize,{class:this.options.className}));}),Ee.create(t,i)}}})]}});var Da=se.create({name:"gapCursor",addProseMirrorPlugins(){return [hS()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return {allowGapCursor:(e=Ie(Q(t,"allowGapCursor",n)))!=null?e:null}}}),zm=se.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 oe({key:new ae("placeholder"),props:{decorations:({doc:t,selection:e})=>{let n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;let i=this.editor.isEmpty;return t.descendants((s,a)=>{let l=r>=a&&r<=a+s.nodeSize,c=!s.isLeaf&&ba(s);if((l||!this.options.showOnlyCurrent)&&c){let d=[this.options.emptyNodeClass];i&&d.push(this.options.emptyEditorClass);let u=Be.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});o.push(u);}return this.options.includeChildren}),Ee.create(t,o)}}})]}});se.create({name:"selection",addOptions(){return {className:"selection"}},addProseMirrorPlugins(){let{editor:t,options:e}=this;return [new oe({key:new ae("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Tc(n.selection)||t.view.dragging?null:Ee.create(n.doc,[Be.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function wS({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var ES=se.create({name:"trailingNode",addOptions(){return {node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){let t=new ae(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 oe({key:t,appendTransaction:(n,r,o)=>{let{doc:i,tr:s,schema:a}=o,l=t.getState(o),c=i.content.size,d=a.nodes[this.options.node];if(l)return s.insert(c,d.create())},state:{init:(n,r)=>{let o=r.tr.doc.lastChild;return !wS({node:o,types:e})},apply:(n,r)=>{if(!n.docChanged)return r;let o=n.doc.lastChild;return !wS({node:o,types:e})}}})]}}),SS=se.create({name:"undoRedo",addOptions(){return {depth:100,newGroupDelay:500}},addCommands(){return {undo:()=>({state:t,dispatch:e})=>Bm(t,e),redo:()=>({state:t,dispatch:e})=>Fm(t,e)}},addProseMirrorPlugins(){return [vS(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 U2=se.create({name:"starterKit",addExtensions(){var t,e,n,r;let o=[];return this.options.bold!==!1&&o.push(AE.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(ME.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(Nm.configure(this.options.bulletList)),this.options.code!==!1&&o.push(OE.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(tm.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(PE.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(xS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Da.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(IE.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(LE.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(SS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push($E.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(BE.configure(this.options.italic)),this.options.listItem!==!1&&o.push(_m.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Am.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(Rm.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Om.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(dS.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(uS.configure(this.options.strike)),this.options.text!==!1&&o.push(fS.configure(this.options.text)),this.options.underline!==!1&&o.push(Dm.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(ES.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),CS=U2;var RS=zm;var V2=se.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")}}}),TS=V2;var K2=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,W2=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,G2=Pt.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",ie(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 [An({find:K2,type:this.type})]},addPasteRules(){return [un({find:W2,type:this.type})]}}),kS=G2;var q2=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,j2=Ne.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",ie(this.options.HTMLAttributes,t)]},addCommands(){return {setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return [Nc({find:q2,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return {src:n,alt:e,title:r}}})]}}),NS=j2;var Um,Vm;if(typeof WeakMap<"u"){let t=new WeakMap;Um=e=>t.get(e),Vm=(e,n)=>(t.set(e,n),n);}else {let t=[],n=0;Um=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},Vm=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o);}var ct=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,o=e/this.width|0,i=r+1,s=o+1;for(let a=1;i<this.width&&this.map[e+a]==n;a++)i++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return {left:r,top:o,right:i,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:o,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(t,e){let{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:s,right:a,top:l,bottom:c}=this.findCell(e);return {left:Math.min(n,s),top:Math.min(o,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(t){let e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){let i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,!(o==t.left&&o&&this.map[i-1]==s||r==t.top&&r&&this.map[i-this.width]==s)&&e.push(s));}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){let i=o+n.child(r).nodeSize;if(r==t){let s=e+t*this.width,a=(t+1)*this.width;for(;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i;}}static get(t){return Um(t)||Vm(t,Y2(t))}};function Y2(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);let e=X2(t),n=t.childCount,r=[],o=0,i=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 m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==u.childCount)break;let h=u.child(m),{colspan:g,rowspan:b,colwidth:y}=h.attrs;for(let v=0;v<b;v++){if(v+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-v});break}let x=o+v*e;for(let E=0;E<g;E++){r[x+E]==0?r[x+E]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:g-E});let C=y&&y[E];if(C){let T=(x+E)%e*2,w=s[T];w==null||w!=C&&s[T+1]==1?(s[T]=C,s[T+1]=1):w==C&&s[T+1]++;}}}o+=g,d+=h.nodeSize;}let f=(c+1)*e,p=0;for(;o<f;)r[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),d++;}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});let a=new ct(e,n,r,i),l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(l=!0);return l&&J2(a,s,t),a}function X2(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){let o=t.child(r),i=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&&(i+=c.attrs.colspan);}}for(let s=0;s<o.childCount;s++){let a=o.child(s);i+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0);}e==-1?e=i:e!=i&&(e=Math.max(e,i));}return e}function J2(t,e,n){t.problems||(t.problems=[]);let r={};for(let o=0;o<t.map.length;o++){let i=t.map[o];if(r[i])continue;r[i]=!0;let s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null,l=s.attrs;for(let c=0;c<l.colspan;c++){let d=(o+c)%t.width,u=e[d*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=Z2(l)))[c]=u);}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a});}}function Z2(t){if(t.colwidth)return t.colwidth.slice();let e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function jt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(let n in t.nodes){let r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r);}}return e}var go=new ae("selectingCells");function ds(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 Q2(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 qn(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 xd(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=ds(e.$head)||eB(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function eB(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 Km(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function tB(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function qm(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function BS(t,e,n){let r=t.node(-1),o=ct.get(r),i=t.start(-1),s=o.nextCell(t.pos-i,e,n);return s==null?null:t.node(0).resolve(i+s)}function ui(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(o=>o>0)||(r.colwidth=null)),r}function FS(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0);}return r}function nB(t,e,n){let r=jt(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return !1;return !0}var Fe=class Vr extends Z{constructor(e,n=e){let r=e.node(-1),o=ct.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,n.pos-i),a=e.node(0),l=o.cellsInRect(s).filter(d=>d!=n.pos-i);l.unshift(n.pos-i);let c=l.map(d=>{let u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);let f=i+d+1;return new ji(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)),o=e.resolve(n.map(this.$headCell.pos));if(Km(r)&&Km(o)&&qm(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Vr.rowSelection(r,o):i&&this.isColSelection()?Vr.colSelection(r,o):new Vr(r,o)}return q.between(r,o)}content(){let e=this.$anchorCell.node(-1),n=ct.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let l=o.top;l<o.bottom;l++){let c=[];for(let d=l*n.width+o.left,u=o.left;u<o.right;u++,d++){let f=n.map[d];if(i[f])continue;i[f]=!0;let p=n.findCell(f),m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);let h=o.left-p.left,g=p.right-o.right;if(h>0||g>0){let b=m.attrs;if(h>0&&(b=ui(b,0,h)),g>0&&(b=ui(b,b.colspan-g,g)),p.left<o.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content);}if(p.top<o.top||p.bottom>o.bottom){let b={...m.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content);}c.push(m);}s.push(e.child(l).copy(O.from(c)));}let a=this.isColSelection()&&this.isRowSelection()?e:s;return new H(O.from(a),1,1)}replace(e,n=H.empty){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),s?H.empty:n);}let i=Z.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i);}replaceWith(e,n){this.replace(e,new H(O.from(n),0,0));}forEachCell(e){let n=this.$anchorCell.node(-1),r=ct.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(n.nodeAt(i[s]),o+i[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,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=e.node(-1),o=ct.get(r),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(n.pos-i),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(e=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new Vr(e,n)}isRowSelection(){let e=this.$anchorCell.node(-1),n=ct.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return !1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Vr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),o=ct.get(r),i=e.start(-1),s=o.findCell(e.pos-i),a=o.findCell(n.pos-i),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(n=l.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(e=l.resolve(i+o.map[o.width*(s.top+1)-1]))),new Vr(e,n)}toJSON(){return {type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Vr(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Vr(e.resolve(n),e.resolve(r))}getBookmark(){return new rB(this.$anchorCell.pos,this.$headCell.pos)}};Fe.prototype.visible=!1;Z.jsonID("cell",Fe);var rB=class zS{constructor(e,n){this.anchor=e,this.head=n;}map(e){return new zS(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&&qm(n,r)?new Fe(n,r):Z.near(r,1)}};function oB(t){if(!(t.selection instanceof Fe))return null;let e=[];return t.selection.forEachCell((n,r)=>{e.push(Be.node(r,r+n.nodeSize,{class:"selectedCell"}));}),Ee.create(t.doc,e)}function iB({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return !1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function sB({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){let i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function aB(t,e,n){let r=(e||t).selection,o=(e||t).doc,i,s;if(r instanceof X&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Fe.create(o,r.from);else if(s=="row"){let a=o.resolve(r.from+1);i=Fe.rowSelection(a,a);}else if(!n){let a=ct.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=Fe.create(o,l+1,c);}}else r instanceof q&&iB(r)?i=q.create(o,r.from):r instanceof q&&sB(r)&&(i=q.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var lB=new ae("fix-tables");function HS(t,e,n,r){let o=t.childCount,i=e.childCount;e:for(let s=0,a=0;s<i;s++){let l=e.child(s);for(let c=a,d=Math.min(o,s+3);c<d;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<o&&t.child(a).sameMarkup(l)?HS(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize;}}function jm(t,e){let n,r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=cB(t,o,i,n));};return e?e.doc!=t.doc&&HS(e.doc,t.doc,0,r):t.doc.descendants(r),n}function cB(t,e,n,r){let o=ct.get(e);if(!o.problems)return r;r||(r=t.tr);let i=[];for(let l=0;l<o.height;l++)i.push(0);for(let l=0;l<o.problems.length;l++){let c=o.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++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,ui(u,u.colspan-c.n,c.n));}else if(c.type=="missing")i[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<i.length;l++)i[l]&&(s==null&&(s=l),a=l);for(let l=0,c=n+1;l<o.height;l++){let d=e.child(l),u=c+d.nodeSize,f=i[l];if(f>0){let p="cell";d.firstChild&&(p=d.firstChild.type.spec.tableRole);let m=[];for(let g=0;g<f;g++){let b=jt(t.schema)[p].createAndFill();b&&m.push(b);}let h=(l==0||s==l-1)&&a==l?c+1:u-1;r.insert(r.mapping.map(h),m);}c=u;}return r.setMeta(lB,{fixTables:!0})}function hr(t){let e=t.selection,n=xd(t),r=n.node(-1),o=n.start(-1),i=ct.get(r);return {...e instanceof Fe?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function US(t,{map:e,tableStart:n,table:r},o){let i=o>0?-1:0;nB(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){let a=s*e.width+o;if(o>0&&o<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,FS(c.attrs,o-e.colCount(l))),s+=c.attrs.rowspan-1;}else {let l=i==null?jt(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,c=e.positionAt(s,o,r);t.insert(t.mapping.map(n+c),l.createAndFill());}}return t}function VS(t,e){if(!qn(t))return !1;if(e){let n=hr(t);e(US(t.tr,n,n.left));}return !0}function KS(t,e){if(!qn(t))return !1;if(e){let n=hr(t);e(US(t.tr,n,n.right));}return !0}function dB(t,{map:e,table:n,tableStart:r},o){let i=t.mapping.maps.length;for(let s=0;s<e.height;){let a=s*e.width+o,l=e.map[a],c=n.nodeAt(l),d=c.attrs;if(o>0&&e.map[a-1]==l||o<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(i).map(r+l),null,ui(d,o-e.colCount(l)));else {let u=t.mapping.slice(i).map(r+l);t.delete(u,u+c.nodeSize);}s+=d.rowspan;}}function WS(t,e){if(!qn(t))return !1;if(e){let n=hr(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return !1;for(let o=n.right-1;dB(r,n,o),o!=n.left;o--){let i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=ct.get(i);}e(r);}return !0}function uB(t,e,n){var r;let o=jt(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))==null?void 0:r.type)!=o)return !1;return !0}function GS(t,{map:e,tableStart:n,table:r},o){var i;let s=n;for(let c=0;c<o;c++)s+=r.child(c).nodeSize;let a=[],l=o>0?-1:0;uB(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let c=0,d=e.width*o;c<e.width;c++,d++)if(o>0&&o<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?jt(r.type.schema).cell:(i=r.nodeAt(e.map[d+l*e.width]))==null?void 0:i.type,f=u?.createAndFill();f&&a.push(f);}return t.insert(s,jt(r.type.schema).row.create(null,a)),t}function qS(t,e){if(!qn(t))return !1;if(e){let n=hr(t);e(GS(t.tr,n,n.top));}return !0}function jS(t,e){if(!qn(t))return !1;if(e){let n=hr(t);e(GS(t.tr,n,n.bottom));}return !0}function fB(t,{map:e,table:n,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=n.child(c).nodeSize;let s=i+n.child(o).nodeSize,a=t.mapping.maps.length;t.delete(i+r,s+r);let l=new Set;for(let c=0,d=o*e.width;c<e.width;c++,d++){let u=e.map[d];if(!l.has(u)){if(l.add(u),o>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(o<e.height&&u==e.map[d+e.width]){let f=n.nodeAt(u),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),h=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(a).map(r+h),m),c+=p.colspan-1;}}}}function YS(t,e){if(!qn(t))return !1;if(e){let n=hr(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return !1;for(let o=n.bottom-1;fB(r,n,o),o!=n.top;o--){let i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=ct.get(n.table);}e(r);}return !0}function _S(t){let e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function pB({width:t,height:e,map:n},r){let o=r.top*t+r.left,i=o,s=(r.bottom-1)*t+r.left,a=o+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[a]==n[a+1])return !0;i+=t,a+=t;}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[s]==n[s+t])return !0;o++,s++;}return !1}function Ym(t,e){let n=t.selection;if(!(n instanceof Fe)||n.$anchorCell.pos==n.$headCell.pos)return !1;let r=hr(t),{map:o}=r;if(pB(o,r))return !1;if(e){let i=t.tr,s={},a=O.empty,l,c;for(let d=r.top;d<r.bottom;d++)for(let u=r.left;u<r.right;u++){let f=o.map[d*o.width+u],p=r.table.nodeAt(f);if(!(s[f]||!p))if(s[f]=!0,l==null)l=f,c=p;else {_S(p)||(a=a.append(p.content));let m=i.mapping.map(f+r.tableStart);i.delete(m,m+p.nodeSize);}}if(l==null||c==null)return !0;if(i.setNodeMarkup(l+r.tableStart,null,{...FS(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=_S(c)?l+1:d;i.replaceWith(u+r.tableStart,d+r.tableStart,a);}i.setSelection(new Fe(i.doc.resolve(l+r.tableStart))),e(i);}return !0}function Xm(t,e){let n=jt(t.schema);return mB(({node:r})=>n[r.type.spec.tableRole])(t,e)}function mB(t){return (e,n)=>{var r;let o=e.selection,i,s;if(o instanceof Fe){if(o.$anchorCell.pos!=o.$headCell.pos)return !1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos;}else {if(i=Q2(o.$from),!i)return !1;s=(r=ds(o.$from))==null?void 0:r.pos;}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return !1;if(n){let a=i.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=hr(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 m=d.map.positionAt(p,d.left,d.table);p==d.top&&(m+=i.nodeSize);for(let h=d.left,g=0;h<d.right;h++,g++)h==d.left&&p==d.top||u.insert(f=u.mapping.map(m+d.tableStart,1),t({node:i,row:p,col:h}).createAndFill(l[g]));}u.setNodeMarkup(s,t({node:i,row:d.top,col:d.left}),l[0]),o instanceof Fe&&u.setSelection(new Fe(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u);}return !0}}function XS(t,e){return function(n,r){if(!qn(n))return !1;let o=xd(n);if(o.nodeAfter.attrs[t]===e)return !1;if(r){let i=n.tr;n.selection instanceof Fe?n.selection.forEachCell((s,a)=>{s.attrs[t]!==e&&i.setNodeMarkup(a,null,{...s.attrs,[t]:e});}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(i);}return !0}}function hB(t){return function(e,n){if(!qn(e))return !1;if(n){let r=jt(e.schema),o=hr(e),i=e.tr,s=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(l=>o.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[l],r.cell,a[l].attrs);if(i.steps.length==0)for(let l=0;l<s.length;l++)i.setNodeMarkup(o.tableStart+s[l],r.header_cell,a[l].attrs);n(i);}return !0}}function MS(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 o=0;o<r.length;o++){let i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return !1}return !0}function us(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?hB(t):function(n,r){if(!qn(n))return !1;if(r){let o=jt(n.schema),i=hr(n),s=n.tr,a=MS("row",i,o),l=MS("column",i,o),d=(t==="column"?a:t==="row"?l:!1)?1:0,u=t=="column"?{left:0,top:d,right:1,bottom:i.map.height}:t=="row"?{left:d,top:0,right:i.map.width,bottom:1}:i,f=t=="column"?l?o.cell:o.header_cell:t=="row"?a?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(p=>{let m=p+i.tableStart,h=s.doc.nodeAt(m);h&&s.setNodeMarkup(m,f,h.attrs);}),r(s);}return !0}}us("row",{useDeprecatedLogic:!0});us("column",{useDeprecatedLogic:!0});var JS=us("cell",{useDeprecatedLogic:!0});function gB(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){let i=t.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.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),o=t.after();r<n.childCount;r++){let i=n.child(r);if(i.childCount)return o+1;o+=i.nodeSize;}}return null}function Jm(t){return function(e,n){if(!qn(e))return !1;let r=gB(xd(e),t);if(r==null)return !1;if(n){let o=e.doc.resolve(r);n(e.tr.setSelection(q.between(o,tB(o))).scrollIntoView());}return !0}}function ZS(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 gd(t,e){let n=t.selection;if(!(n instanceof Fe))return !1;if(e){let r=t.tr,o=jt(t.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new H(o,0,0));}),r.docChanged&&e(r);}return !0}function bB(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 o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,a=[];if(i=="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=Wm(jt(s).row,new H(c,d,u)).content),a.push(c);}else if(i=="cell"||i=="header_cell")a.push(n||r?Wm(jt(s).row,new H(e,n,r)).content:e);else return null;return yB(s,a)}function yB(t,e){let n=[];for(let o=0;o<e.length;o++){let i=e[o];for(let s=i.childCount-1;s>=0;s--){let{rowspan:a,colspan:l}=i.child(s).attrs;for(let c=o;c<o+a;c++)n[c]=(n[c]||0)+l;}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(O.empty),n[o]<r){let i=jt(t).cell.createAndFill(),s=[];for(let a=n[o];a<r;a++)s.push(i);e[o]=e[o].append(O.from(s));}return {height:e.length,width:r,rows:e}}function Wm(t,e){let n=t.createAndFill();return new io(n).replace(0,n.content.size,e).doc}function vB({width:t,height:e,rows:n},r,o){if(t!=r){let i=[],s=[];for(let a=0;a<n.length;a++){let l=n[a],c=[];for(let d=i[a]||0,u=0;d<r;u++){let f=l.child(u%l.childCount);d+f.attrs.colspan>r&&(f=f.type.createChecked(ui(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++)i[a+p]=(i[a+p]||0)+f.attrs.colspan;}s.push(O.from(c));}n=s,t=r;}if(e!=o){let i=[];for(let s=0,a=0;s<o;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>o&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,o-u.attrs.rowspan)},u.content)),l.push(u);}i.push(O.from(l));}n=i,e=o;}return {width:t,height:e,rows:n}}function wB(t,e,n,r,o,i,s){let a=t.doc.type.schema,l=jt(a),c,d;if(o>e.width)for(let u=0,f=0;u<e.height;u++){let p=n.child(u);f+=p.nodeSize;let m=[],h;p.lastChild==null||p.lastChild.type==l.cell?h=c||(c=l.cell.createAndFill()):h=d||(d=l.header_cell.createAndFill());for(let g=e.width;g<o;g++)m.push(h);t.insert(t.mapping.slice(s).map(f-1+r),m);}if(i>e.height){let u=[];for(let m=0,h=(e.height-1)*e.width;m<Math.max(e.width,o);m++){let g=m>=e.width?!1:n.nodeAt(e.map[h+m]).type==l.header_cell;u.push(g?d||(d=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()));}let f=l.row.create(null,O.from(u)),p=[];for(let m=e.height;m<i;m++)p.push(f);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),p);}return !!(c||d)}function AS(t,e,n,r,o,i,s,a){if(s==0||s==e.height)return !1;let l=!1;for(let c=o;c<i;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:m}=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,m,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-s})),c+=f.attrs.colspan-1;}}return l}function OS(t,e,n,r,o,i,s,a){if(s==0||s==e.width)return !1;let l=!1;for(let c=o;c<i;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),m=t.mapping.slice(a).map(u+r);t.setNodeMarkup(m,null,ui(f.attrs,s-p,f.attrs.colspan-(s-p))),t.insert(m+f.nodeSize,f.type.createAndFill(ui(f.attrs,0,s-p))),c+=f.attrs.rowspan-1;}}return l}function DS(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=ct.get(i),{top:a,left:l}=r,c=l+o.width,d=a+o.height,u=t.tr,f=0;function p(){if(i=n?u.doc.nodeAt(n-1):u.doc,!i)throw new Error("No table found");s=ct.get(i),f=u.mapping.maps.length;}wB(u,s,i,n,c,d,f)&&p(),AS(u,s,i,n,l,c,a,f)&&p(),AS(u,s,i,n,l,c,d,f)&&p(),OS(u,s,i,n,a,d,l,f)&&p(),OS(u,s,i,n,a,d,c,f)&&p();for(let m=a;m<d;m++){let h=s.positionAt(m,l,i),g=s.positionAt(m,c,i);u.replace(u.mapping.slice(f).map(h+n),u.mapping.slice(f).map(g+n),new H(o.rows[m-a],0,0));}p(),u.setSelection(new Fe(u.doc.resolve(n+s.positionAt(a,l,i)),u.doc.resolve(n+s.positionAt(d-1,c-1,i)))),e(u);}var xB=ma({ArrowLeft:bd("horiz",-1),ArrowRight:bd("horiz",1),ArrowUp:bd("vert",-1),ArrowDown:bd("vert",1),"Shift-ArrowLeft":yd("horiz",-1),"Shift-ArrowRight":yd("horiz",1),"Shift-ArrowUp":yd("vert",-1),"Shift-ArrowDown":yd("vert",1),Backspace:gd,"Mod-Backspace":gd,Delete:gd,"Mod-Delete":gd});function vd(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function bd(t,e){return (n,r,o)=>{if(!o)return !1;let i=n.selection;if(i instanceof Fe)return vd(n,r,Z.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return !1;let s=QS(o,t,e);if(s==null)return !1;if(t=="horiz")return vd(n,r,Z.near(n.doc.resolve(i.head+e),e));{let a=n.doc.resolve(s),l=BS(a,t,e),c;return l?c=Z.near(l,1):e<0?c=Z.near(n.doc.resolve(a.before(-1)),-1):c=Z.near(n.doc.resolve(a.after(-1)),1),vd(n,r,c)}}}function yd(t,e){return (n,r,o)=>{if(!o)return !1;let i=n.selection,s;if(i instanceof Fe)s=i;else {let l=QS(o,t,e);if(l==null)return !1;s=new Fe(n.doc.resolve(l));}let a=BS(s.$headCell,t,e);return a?vd(n,r,new Fe(s.$anchorCell,a)):!1}}function EB(t,e){let n=t.state.doc,r=ds(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Fe(r))),!0):!1}function SB(t,e,n){if(!qn(t.state))return !1;let r=bB(n),o=t.state.selection;if(o instanceof Fe){r||(r={width:1,height:1,rows:[O.from(Wm(jt(t.state.schema).cell,n))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),a=ct.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=vB(r,a.right-a.left,a.bottom-a.top),DS(t.state,t.dispatch,s,a,r),!0}else if(r){let i=xd(t.state),s=i.start(-1);return DS(t.state,t.dispatch,s,ct.get(i.node(-1)).findCell(i.pos-s),r),!0}else return !1}function CB(t,e){var n;if(e.ctrlKey||e.metaKey)return;let r=PS(t,e.target),o;if(e.shiftKey&&t.state.selection instanceof Fe)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=ds(t.state.selection.$anchor))!=null&&((n=Hm(t,e))==null?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(l,c){let d=Hm(t,c),u=go.getState(t.state)==null;if(!d||!qm(l,d))if(u)d=l;else return;let f=new Fe(l,d);if(u||!t.state.selection.eq(f)){let p=t.state.tr.setSelection(f);u&&p.setMeta(go,l.pos),t.dispatch(p);}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),go.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(go,-1));}function a(l){let c=l,d=go.getState(t.state),u;if(d!=null)u=t.state.doc.resolve(d);else if(PS(t,c.target)!=r&&(u=Hm(t,e),!u))return s();u&&i(u,c);}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a);}function QS(t,e,n){if(!(t.state.selection instanceof q))return null;let{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let a=r.before(o),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}function PS(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Hm(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?ds(t.state.doc.resolve(n.pos)):null}var RB=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")),Gm(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,Gm(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Gm(t,e,n,r,o,i){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:m}=d.child(u).attrs;for(let h=0;h<p;h++,f++){let g=o==f?i:m&&m[h],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 y=document.createElement("col");y.style.width=b,e.appendChild(y);}}}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 vn=new ae("tableColumnResizing");function eC({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=RB,lastColumnResizable:o=!0}={}){let i=new oe({key:vn,state:{init(s,a){var l,c;let d=(c=(l=i.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,u=jt(a.schema).table.name;return r&&d&&(d[u]=(f,p)=>new r(f,n,p)),new TB(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{let a=vn.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{kB(s,a,t,o);},mouseleave:s=>{NB(s);},mousedown:(s,a)=>{_B(s,a,e,n);}},decorations:s=>{let a=vn.getState(s);if(a&&a.activeHandle>-1)return PB(s,a.activeHandle)},nodeViews:{}}});return i}var TB=class wd{constructor(e,n){this.activeHandle=e,this.dragging=n;}apply(e){let n=this,r=e.getMeta(vn);if(r&&r.setHandle!=null)return new wd(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new wd(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Km(e.doc.resolve(o))||(o=-1),new wd(o,n.dragging)}return n}};function kB(t,e,n,r){if(!t.editable)return;let o=vn.getState(t.state);if(o&&!o.dragging){let i=AB(e.target),s=-1;if(i){let{left:a,right:l}=i.getBoundingClientRect();e.clientX-a<=n?s=IS(t,e,"left",n):l-e.clientX<=n&&(s=IS(t,e,"right",n));}if(s!=o.activeHandle){if(!r&&s!==-1){let a=t.state.doc.resolve(s),l=a.node(-1),c=ct.get(l),d=a.start(-1);if(c.colCount(a.pos-d)+a.nodeAfter.attrs.colspan-1==c.width-1)return}tC(t,s);}}}function NB(t){if(!t.editable)return;let e=vn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&tC(t,-1);}function _B(t,e,n,r){var o;if(!t.editable)return !1;let i=(o=t.dom.ownerDocument.defaultView)!=null?o:window,s=vn.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return !1;let a=t.state.doc.nodeAt(s.activeHandle),l=MB(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(vn,{setDragging:{startX:e.clientX,startWidth:l}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);let f=vn.getState(t.state);f?.dragging&&(OB(t,f.activeHandle,LS(f.dragging,u,n)),t.dispatch(t.state.tr.setMeta(vn,{setDragging:null})));}function d(u){if(!u.which)return c(u);let f=vn.getState(t.state);if(f&&f.dragging){let p=LS(f.dragging,u,n);$S(t,f.activeHandle,p,r);}}return $S(t,s.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function MB(t,e,{colspan:n,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=t.domAtPos(e),a=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],l--);return a/l}function AB(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function IS(t,e,n,r){let o=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return -1;let{pos:s}=i,a=ds(t.state.doc.resolve(s));if(!a)return -1;if(n=="right")return a.pos;let l=ct.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 LS(t,e,n){let r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function tC(t,e){t.dispatch(t.state.tr.setMeta(vn,{setHandle:e}));}function OB(t,e,n){let r=t.state.doc.resolve(e),o=r.node(-1),i=ct.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<i.height;c++){let d=c*i.width+a;if(c&&i.map[d]==i.map[d-i.width])continue;let u=i.map[d],f=o.nodeAt(u).attrs,p=f.colspan==1?0:a-i.colCount(u);if(f.colwidth&&f.colwidth[p]==n)continue;let m=f.colwidth?f.colwidth.slice():DB(f.colspan);m[p]=n,l.setNodeMarkup(s+u,null,{...f,colwidth:m});}l.docChanged&&t.dispatch(l);}function $S(t,e,n,r){let o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),a=ct.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,l=t.domAtPos(o.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Gm(i,l.firstChild,l,r,a,n);}function DB(t){return Array(t).fill(0)}function PB(t,e){var n;let r=[],o=t.doc.resolve(e),i=o.node(-1);if(!i)return Ee.empty;let s=ct.get(i),a=o.start(-1),l=s.colCount(o.pos-a)+o.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+i.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=vn.getState(t))!=null&&n.dragging&&r.push(Be.node(a+u,a+u+i.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),r.push(Be.widget(f,p));}}return Ee.create(t.doc,r)}function nC({allowTableNodeSelection:t=!1}={}){return new oe({key:go,state:{init(){return null},apply(e,n){let r=e.getMeta(go);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;let{deleted:o,pos:i}=e.mapping.mapResult(n);return o?null:i}},props:{decorations:oB,handleDOMEvents:{mousedown:CB},createSelectionBetween(e){return go.getState(e.state)!=null?e.state.selection:null},handleTripleClick:EB,handleKeyDown:xB,handlePaste:SB},appendTransaction(e,n,r){return aB(r,jm(r,n),t)}})}var Sd=Ne.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",ie(this.options.HTMLAttributes,t),0]}}),Cd=Ne.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",ie(this.options.HTMLAttributes,t),0]}}),Rd=Ne.create({name:"tableRow",addOptions(){return {HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return [{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return ["tr",ie(this.options.HTMLAttributes,t),0]}});function Zm(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function rC(t,e,n,r,o,i){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:m}=d.child(u).attrs;for(let h=0;h<p;h+=1,f+=1){let g=o===f?i:m&&m[h],b=g?`${g}px`:"";if(a+=g||r,g||(l=!1),c){if(c.style.width!==b){let[y,v]=Zm(r,g);c.style.setProperty(y,v);}c=c.nextSibling;}else {let y=document.createElement("col"),[v,x]=Zm(r,g);y.style.setProperty(v,x),e.appendChild(y);}}}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 IB=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")),rC(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,rC(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}};function LB(t,e,n,r){let o=0,i=!0,s=[],a=t.firstChild;if(!a)return {};for(let u=0,f=0;u<a.childCount;u+=1){let{colspan:p,colwidth:m}=a.child(u).attrs;for(let h=0;h<p;h+=1,f+=1){let g=n===f?r:m&&m[h];o+=g||e,g||(i=!1);let[b,y]=Zm(e,g);s.push(["col",{style:`${b}: ${y}`}]);}}let l=i?`${o}px`:"",c=i?"":`${o}px`;return {colgroup:["colgroup",{},...s],tableWidth:l,tableMinWidth:c}}function oC(t,e){return e?t.createChecked(null,e):t.createAndFill()}function $B(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 BB(t,e,n,r,o){let i=$B(t),s=[],a=[];for(let c=0;c<n;c+=1){let d=oC(i.cell,o);if(d&&a.push(d),r){let u=oC(i.header_cell,o);u&&s.push(u);}}let l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?s:a));return i.table.createChecked(null,l)}function FB(t){return t instanceof Fe}var Ed=({editor:t})=>{let{selection:e}=t.state;if(!FB(e))return !1;let n=0,r=Up(e.ranges[0].$from,i=>i.type.name==="table");return r?.node.descendants(i=>{if(i.type.name==="table")return !1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1);}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Qm=Ne.create({name:"table",addOptions(){return {HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:IB,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:o}=LB(t,this.options.cellMinWidth);return ["table",ie(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),n,["tbody",0]]},addCommands(){return {insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=BB(i.schema,t,e,n);if(o){let a=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(q.near(r.doc.resolve(a)));}return !0},addColumnBefore:()=>({state:t,dispatch:e})=>VS(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>KS(t,e),deleteColumn:()=>({state:t,dispatch:e})=>WS(t,e),addRowBefore:()=>({state:t,dispatch:e})=>qS(t,e),addRowAfter:()=>({state:t,dispatch:e})=>jS(t,e),deleteRow:()=>({state:t,dispatch:e})=>YS(t,e),deleteTable:()=>({state:t,dispatch:e})=>ZS(t,e),mergeCells:()=>({state:t,dispatch:e})=>Ym(t,e),splitCell:()=>({state:t,dispatch:e})=>Xm(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>us("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>us("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>JS(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Ym(t,e)?!0:Xm(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>XS(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Jm(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Jm(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&jm(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=Fe.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:Ed,"Mod-Backspace":Ed,Delete:Ed,"Mod-Delete":Ed}},addProseMirrorPlugins(){return [...this.options.resizable&&this.editor.isEditable?[eC({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],nC({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return {tableRole:Ie(Q(t,"tableRole",e))}}});se.create({name:"tableKit",addExtensions(){let t=[];return this.options.table!==!1&&t.push(Qm.configure(this.options.table)),this.options.tableCell!==!1&&t.push(Sd.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Cd.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(Rd.configure(this.options.tableRow)),t}});var iC=Rd;var sC=Sd;var aC=Cd;var zB=t=>{if(!t.children.length)return;let e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,o;let i=n.getAttribute("style"),s=(o=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");n.setAttribute("style",`${s};${i}`);});},eh=Pt.create({name:"textStyle",priority:101,addOptions(){return {HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return [{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&zB(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return ["span",ie(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(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type);}),!0}}}}),HB=se.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()}}}),th=se.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()}}}),UB=se.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()}}}),VB=se.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()}}}),KB=se.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()}}});se.create({name:"textStyleKit",addExtensions(){let t=[];return this.options.backgroundColor!==!1&&t.push(HB.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(th.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(UB.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(VB.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(KB.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(eh.configure(this.options.textStyle)),t}});var lC=th;var cC=Da;var dC=ud;var uC=dd;var WB=t=>tt({find:/--$/,replace:t??"\u2014"}),GB=t=>tt({find:/\.\.\.$/,replace:t??"\u2026"}),qB=t=>tt({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:t??"\u201C"}),jB=t=>tt({find:/"$/,replace:t??"\u201D"}),YB=t=>tt({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:t??"\u2018"}),XB=t=>tt({find:/'$/,replace:t??"\u2019"}),JB=t=>tt({find:/<-$/,replace:t??"\u2190"}),ZB=t=>tt({find:/->$/,replace:t??"\u2192"}),QB=t=>tt({find:/\(c\)$/,replace:t??"\xA9"}),eF=t=>tt({find:/\(tm\)$/,replace:t??"\u2122"}),tF=t=>tt({find:/\(sm\)$/,replace:t??"\u2120"}),nF=t=>tt({find:/\(r\)$/,replace:t??"\xAE"}),rF=t=>tt({find:/(?:^|\s)(1\/2)\s$/,replace:t??"\xBD"}),oF=t=>tt({find:/\+\/-$/,replace:t??"\xB1"}),iF=t=>tt({find:/!=$/,replace:t??"\u2260"}),sF=t=>tt({find:/<<$/,replace:t??"\xAB"}),aF=t=>tt({find:/>>$/,replace:t??"\xBB"}),lF=t=>tt({find:/\d+\s?([*x])\s?\d+$/,replace:t??"\xD7"}),cF=t=>tt({find:/\^2$/,replace:t??"\xB2"}),dF=t=>tt({find:/\^3$/,replace:t??"\xB3"}),uF=t=>tt({find:/(?:^|\s)(1\/4)\s$/,replace:t??"\xBC"}),fF=t=>tt({find:/(?:^|\s)(3\/4)\s$/,replace:t??"\xBE"}),pF=se.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(WB(this.options.emDash)),this.options.ellipsis!==!1&&t.push(GB(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&t.push(qB(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&t.push(jB(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&t.push(YB(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&t.push(XB(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&t.push(JB(this.options.leftArrow)),this.options.rightArrow!==!1&&t.push(ZB(this.options.rightArrow)),this.options.copyright!==!1&&t.push(QB(this.options.copyright)),this.options.trademark!==!1&&t.push(eF(this.options.trademark)),this.options.servicemark!==!1&&t.push(tF(this.options.servicemark)),this.options.registeredTrademark!==!1&&t.push(nF(this.options.registeredTrademark)),this.options.oneHalf!==!1&&t.push(rF(this.options.oneHalf)),this.options.plusMinus!==!1&&t.push(oF(this.options.plusMinus)),this.options.notEqual!==!1&&t.push(iF(this.options.notEqual)),this.options.laquo!==!1&&t.push(sF(this.options.laquo)),this.options.raquo!==!1&&t.push(aF(this.options.raquo)),this.options.multiplication!==!1&&t.push(lF(this.options.multiplication)),this.options.superscriptTwo!==!1&&t.push(cF(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&t.push(dF(this.options.superscriptThree)),this.options.oneQuarter!==!1&&t.push(uF(this.options.oneQuarter)),this.options.threeQuarters!==!1&&t.push(fF(this.options.threeQuarters)),t}}),fC=pF;var DC=Es(OC(),1);var Md=DC.default;function LC(t,e=[]){return t.map(n=>{let r=[...e,...n.properties?n.properties.className:[]];return n.children?LC(n.children,r):{text:n.value,classes:r}}).flat()}function PC(t){return t.value||t.children||[]}function r3(t){return !!Md.getLanguage(t)}function IC({doc:t,name:e,lowlight:n,defaultLanguage:r}){let o=[];return Ec(t,i=>i.type.name===e).forEach(i=>{var s;let a=i.pos+1,l=i.node.attrs.language||r,c=n.listLanguages(),d=l&&(c.includes(l)||r3(l)||(s=n.registered)!=null&&s.call(n,l))?PC(n.highlight(l,i.node.textContent)):PC(n.highlightAuto(i.node.textContent));LC(d).forEach(u=>{let f=a+u.text.length;if(u.classes.length){let p=Be.inline(a,f,{class:u.classes.join(" ")});o.push(p);}a=f;});}),Ee.create(t,o)}function o3(t){return typeof t=="function"}function i3({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(o=>o3(e[o])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");let r=new oe({key:new ae("lowlight"),state:{init:(o,{doc:i})=>IC({doc:i,name:t,lowlight:e,defaultLanguage:n}),apply:(o,i,s,a)=>{let l=s.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,d=Ec(s.doc,f=>f.type.name===t),u=Ec(a.doc,f=>f.type.name===t);return o.docChanged&&([l,c].includes(t)||u.length!==d.length||o.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)))?IC({doc:o.doc,name:t,lowlight:e,defaultLanguage:n}):i.map(o.mapping,o.doc)}},props:{decorations(o){return r.getState(o)}}});return r}var s3=DE.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))||[],i3({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),$C=s3;function a3(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",i="<[^<>]+>",s="(?!struct)("+r+"|"+e.optional(o)+"[a-zA-Z_]\\w*"+e.optional(i)+")",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(o)+t.IDENT_RE,relevance:0},p=e.optional(o)+t.IDENT_RE+"\\s*\\(",m=["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"],h=["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"],x={type:h,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},E={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[E,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:C.concat([{begin:/\(/,end:/\)/,keywords:x,contains:C.concat(["self"]),relevance:0}]),relevance:0},w={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,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:x,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:x,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:x,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(T,w,E,C,[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:x,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:x},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function BC(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=a3(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 FC(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 o={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},i=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,o]};o.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}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},h=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],b={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],v=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],x=["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"],E=["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:h,literal:g,built_in:[...y,...v,"set","shopt",...x,...E]},contains:[p,t.SHEBANG(),m,u,i,s,b,a,l,c,d,n]}}function zC(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",i="<[^<>]+>",s="("+r+"|"+e.optional(o)+"[a-zA-Z_]\\w*"+e.optional(i)+")",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(o)+t.IDENT_RE,relevance:0},p=e.optional(o)+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],y={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},v={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(y,v,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 HC(t){let e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",o="[a-zA-Z_]\\w*::",i="<[^<>]+>",s="(?!struct)("+r+"|"+e.optional(o)+"[a-zA-Z_]\\w*"+e.optional(i)+")",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(o)+t.IDENT_RE,relevance:0},p=e.optional(o)+t.IDENT_RE+"\\s*\\(",m=["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"],h=["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"],x={type:h,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},E={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},C=[E,u,a,n,t.C_BLOCK_COMMENT_MODE,d,c],T={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:C.concat([{begin:/\(/,end:/\)/,keywords:x,contains:C.concat(["self"]),relevance:0}]),relevance:0},w={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,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:x,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:x,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:x,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(T,w,E,C,[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:x,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:x},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function UC(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"],o=["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"],i=["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:o.concat(i),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/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,p]},h={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},g=t.inherit(h,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});f.contains=[h,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],p.contains=[g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let b={variants:[c,h,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},y={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},v=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",x={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,y,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,y,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:"("+v+"\\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,y],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]},x]}}var l3=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_-]*/}}),c3=["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"],d3=["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"],u3=[...c3,...d3],f3=["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(),p3=["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(),m3=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h3=["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 VC(t){let e=t.regex,n=l3(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},o="and or not only",i=/@-?\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:":("+p3.join("|")+")"},{begin:":(:)?("+m3.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h3.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:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:f3.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+u3.join("|")+")\\b"}]}}function KC(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 WC(t){let i={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:i,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:i,illegal:/["']/}]}]}}function GC(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 qC(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 o={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={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,i,o,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,i,o,s,n]}}]}}var ms="[0-9](_*[0-9])*",Ad=`\\.(${ms})`,Od="[0-9a-fA-F](_*[0-9a-fA-F])*",jC={className:"number",variants:[{begin:`(\\b(${ms})((${Ad})|\\.)?|(${Ad}))[eE][+-]?(${ms})[fFdD]?\\b`},{begin:`\\b(${ms})((${Ad})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Ad})[fFdD]?\\b`},{begin:`\\b(${ms})[fFdD]\\b`},{begin:`\\b0[xX]((${Od})\\.?|(${Od})?\\.(${Od}))[pP][+-]?(${ms})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Od})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function YC(t,e,n){return n===-1?"":t.replace(e,r=>YC(t,e,n-1))}function XC(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+YC("(?:<"+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,jC,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},jC,c]}}var JC="[A-Za-z$_][0-9A-Za-z$_]*",g3=["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"],b3=["true","false","null","undefined","NaN","Infinity"],ZC=["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"],QC=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],eR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],y3=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],v3=[].concat(eR,ZC,QC);function tR(t){let e=t.regex,n=(_,{after:A})=>{let L="</"+_[0].slice(1);return _.input.indexOf(L,A)!==-1},r=JC,o={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(_,A)=>{let L=_[0].length+_.index,Y=_.input[L];if(Y==="<"||Y===","){A.ignoreMatch();return}Y===">"&&(n(_,{after:L})||A.ignoreMatch());let te,Se=_.input.substring(L);if(te=Se.match(/^\s*=/)){A.ignoreMatch();return}if((te=Se.match(/^\s+extends\s+/))&&te.index===0){A.ignoreMatch();return}}},a={$pattern:JC,keyword:g3,literal:b3,built_in:v3,"variable.language":y3},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"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},h={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},y={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]},v=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},u];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});let x=[].concat(y,f.contains),E=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:E},T={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"}}]},w={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:{_:[...ZC,...QC]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},B={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(_){return e.concat("(?!",_.join("|"),")")}let K={match:e.concat(/\b/,U([...eR,"super","import"].map(_=>`${_}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},V={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",k={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return {name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:w},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),N,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,h,g,y,{match:/\$\d+/},u,w,{scope:"attr",match:r+e.lookahead(":"),relevance:0},k,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,t.REGEXP_MODE,{className:"function",begin:R,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:E}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},K,B,T,V,{match:/\$[(.]/}]}}function nR(t){let e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],o={scope:"literal",beginKeywords:r.join(" ")};return {name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,o,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var hs="[0-9](_*[0-9])*",Dd=`\\.(${hs})`,Pd="[0-9a-fA-F](_*[0-9a-fA-F])*",w3={className:"number",variants:[{begin:`(\\b(${hs})((${Dd})|\\.)?|(${Dd}))[eE][+-]?(${hs})[fFdD]?\\b`},{begin:`\\b(${hs})((${Dd})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Dd})[fFdD]?\\b`},{begin:`\\b(${hs})[fFdD]\\b`},{begin:`\\b0[xX]((${Pd})\\.?|(${Pd})?\\.(${Pd}))[pP][+-]?(${hs})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Pd})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function rR(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+"@"},o={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,o]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,i,o]}]};o.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=w3,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:`
|
|
163
|
+
`},c]}}var x3=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_-]*/}}),E3=["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"],S3=["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"],C3=[...E3,...S3],R3=["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(),oR=["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(),iR=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),T3=["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(),k3=oR.concat(iR).sort().reverse();function sR(t){let e=x3(t),n=k3,r="and or not only",o="[\\w-]+",i="("+o+"|@\\{"+o+"\\})",s=[],a=[],l=function(v){return {className:"string",begin:"~?"+v+".*?"+v}},c=function(v,x,E){return {className:v,begin:x,relevance:E}},d={$pattern:/[a-z-]+/,keyword:r,attribute:R3.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","@@?"+o,10),c("variable","@\\{"+o+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:o+"\\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)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+T3.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},h={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:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:f}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,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","@\\{"+o+"\\}"),{begin:"\\b("+C3.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",i,0),c("selector-id","#"+i),c("selector-class","\\."+i,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+oR.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+iR.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},y={begin:o+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,h,g,y,m,b,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:s}}function aR(t){let e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},o=[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:o.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:o}].concat(o)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function lR(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]},o={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={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,o,i,s]}}function cR(t){let e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},o={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}]},i={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,i,c,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},o,r,l,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function dR(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 uR(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}/,o={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:o},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,i,l],u=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(h,g,b="\\1")=>{let y=b==="\\1"?b:e.concat(b,g);return e.concat(e.concat("(?:",h,")"),g,/(?:\\.|[^\\\/])*?/,y,/(?:\\.|[^\\\/])*?/,b,r)},p=(h,g,b)=>e.concat(e.concat("(?:",h,")"),g,/(?:\\.|[^\\\/])*?/,b,r),m=[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 i.contains=m,s.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:o,contains:m}}function fR(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),o=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=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":(P,V)=>{V.data._beginMatch=P[1]||P[2];},"on:end":(P,V)=>{V.data._beginMatch!==P[1]&&V.ignoreMatch();}},f=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
|
|
164
|
+
]`,m={scope:"string",variants:[d,c,u,f]},h={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"],y=["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"],x={keyword:b,literal:(P=>{let V=[];return P.forEach(R=>{V.push(R),R.toLowerCase()===R?V.push(R.toUpperCase()):V.push(R.toLowerCase());}),V})(g),built_in:y},E=P=>P.map(V=>V.replace(/\|\d+$/,"")),C={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",E(y).join("\\b|"),"\\b)"),o],scope:{1:"keyword",4:"title.class"}}]},T=e.concat(r,"\\b(?!\\()"),w={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),T],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[o,e.concat(/::/,e.lookahead(/(?!class\b)/)),T],scope:{1:"title.class",3:"variable.constant"}},{match:[o,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[o,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},N={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},M={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[N,s,w,t.C_BLOCK_COMMENT_MODE,m,h,C]},B={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",E(b).join("\\b|"),"|",E(y).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[M]};M.contains.push(B);let U=[N,w,t.C_BLOCK_COMMENT_MODE,m,h,C],K={begin:e.concat(/#\[\s*\\?/,e.either(o,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...U]},...U,{scope:"meta",variants:[{match:o},{match:i}]}]};return {case_insensitive:!1,keywords:x,contains:[K,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,B,w,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},C,{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:x,contains:["self",K,s,w,t.C_BLOCK_COMMENT_MODE,m,h]}]},{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]},m,h]}}function pR(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 mR(t){return {name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function hR(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})\\.`,m=`\\b|${r.join("|")}`,h={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${f})[jJ](?=${m})`}]},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,h,u,t.HASH_COMMENT_MODE]}]};return c.contains=[u,h,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,h,{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:[h,b,u]}]}}function gR(t){return {aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function bR(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]?/),o=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=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:[o,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:o},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function yR(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]+/),o=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])*",m={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"}]},h={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},C=[u,{variants:[{match:[/class\s+/,o,/\s+<\s+/,o]},{match:[/\b(class|module)\s+/,o]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,o],scope:{2:"title.class"},keywords:s},{relevance:0,match:[o,/\.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:[h]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:n}],relevance:0},m,{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=C,h.contains=C;let T="[>?]>",w="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",N="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",M=[{begin:/^\s*=>/,starts:{end:"$",contains:C}},{className:"meta.prompt",begin:"^("+T+"|"+w+"|"+N+")(?=[ ])",starts:{end:"$",keywords:s,contains:C}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(M).concat(c).concat(C)}}function vR(t){let e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),o=e.concat(n,t.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,o,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:"->"},i]}}var N3=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_-]*/}}),_3=["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"],M3=["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"],A3=[..._3,...M3],O3=["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(),D3=["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(),P3=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),I3=["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 wR(t){let e=N3(t),n=P3,r=D3,o="@[a-z-]+",i="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("+A3.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("+I3.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:o,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:O3.join(" ")},contains:[{begin:o,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 xR(t){return {name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function ER(t){let e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},o={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["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,m=[...c,...l].filter(E=>!d.includes(E)),h={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 y(E){return e.concat(/\b/,e.either(...E.map(C=>C.replace(/\s+/,"\\s+"))),/\b/)}let v={scope:"keyword",match:y(f),relevance:0};function x(E,{exceptions:C,when:T}={}){let w=T;return C=C||[],E.map(N=>N.match(/\|\d+$/)||C.includes(N)?N:w(N)?`${N}|0`:N)}return {name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:x(m,{when:E=>E.length<3}),literal:i,type:a,built_in:u},contains:[{scope:"type",match:y(s)},v,b,h,r,o,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,g]}}function TR(t){return t?typeof t=="string"?t:t.source:null}function $a(t){return ze("(?=",t,")")}function ze(...t){return t.map(n=>TR(n)).join("")}function L3(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function nn(...t){return "("+(L3(t).capture?"":"?:")+t.map(r=>TR(r)).join("|")+")"}var uh=t=>ze(/\b/,t,/\w$/.test(t)?/\b/:/\B/),$3=["Protocol","Type"].map(uh),SR=["init","self"].map(uh),B3=["Any","Self"],ch=["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"],CR=["false","nil","true"],F3=["assignment","associativity","higherThan","left","lowerThan","none","right"],z3=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],RR=["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"],kR=nn(/[/=\-+!*%<>&|^~?]/,/[\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]/),NR=nn(kR,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),dh=ze(kR,NR,"*"),_R=nn(/[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]/),Ld=nn(_R,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),gr=ze(_R,Ld,"*"),Id=ze(/[A-Z]/,Ld,"*"),H3=["attached","autoclosure",ze(/convention\(/,nn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ze(/objc\(/,gr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],U3=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function MR(t){let e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],o={match:[/\./,nn(...$3,...SR)],className:{2:"keyword"}},i={match:ze(/\./,nn(...ch)),relevance:0},s=ch.filter(Te=>typeof Te=="string").concat(["_|0"]),a=ch.filter(Te=>typeof Te!="string").concat(B3).map(uh),l={variants:[{className:"keyword",match:nn(...a,...SR)}]},c={$pattern:nn(/\b\w+/,/#\w+/),keyword:s.concat(z3),literal:CR},d=[o,i,l],u={match:ze(/\./,nn(...RR)),relevance:0},f={className:"built_in",match:ze(/\b/,nn(...RR),/(?=\()/)},p=[u,f],m={match:/->/,relevance:0},h={className:"operator",relevance:0,variants:[{match:dh},{match:`\\.(\\.|${NR})+`}]},g=[m,h],b="([0-9]_*)+",y="([0-9a-fA-F]_*)+",v={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${y})(\\.(${y}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},x=(Te="")=>({className:"subst",variants:[{match:ze(/\\/,Te,/[0\\tnr"']/)},{match:ze(/\\/,Te,/u\{[0-9a-fA-F]{1,8}\}/)}]}),E=(Te="")=>({className:"subst",match:ze(/\\/,Te,/[\t ]*(?:[\r\n]|\r\n)/)}),C=(Te="")=>({className:"subst",label:"interpol",begin:ze(/\\/,Te,/\(/),end:/\)/}),T=(Te="")=>({begin:ze(Te,/"""/),end:ze(/"""/,Te),contains:[x(Te),E(Te),C(Te)]}),w=(Te="")=>({begin:ze(Te,/"/),end:ze(/"/,Te),contains:[x(Te),C(Te)]}),N={className:"string",variants:[T(),T("#"),T("##"),T("###"),w(),w("#"),w("##"),w("###")]},M=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],B={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:M},U=Te=>{let wt=ze(Te,/\//),D=ze(/\//,Te);return {begin:wt,end:D,contains:[...M,{scope:"comment",begin:`#(?!.*${D})`,end:/$/}]}},K={scope:"regexp",variants:[U("###"),U("##"),U("#"),B]},P={match:ze(/`/,gr,/`/)},V={className:"variable",match:/\$\d+/},R={className:"variable",match:`\\$${Ld}+`},k=[P,V,R],_={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:U3,contains:[...g,v,N]}]}},A={scope:"keyword",match:ze(/@/,nn(...H3),$a(nn(/\(/,/\s+/)))},L={scope:"meta",match:ze(/@/,gr)},Y=[_,A,L],te={match:$a(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ze(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ld,"+")},{className:"type",match:Id,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ze(/\s+&\s+/,$a(Id)),relevance:0}]},Se={begin:/</,end:/>/,keywords:c,contains:[...r,...d,...Y,m,te]};te.contains.push(Se);let he={match:ze(gr,/\s*:/),keywords:"_|0",relevance:0},ke={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",he,...r,K,...d,...p,...g,v,N,...k,...Y,te]},Ae={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,te]},W={begin:nn($a(ze(gr,/\s*:/)),$a(ze(gr,/\s+/,gr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:gr}]},ue={begin:/\(/,end:/\)/,keywords:c,contains:[W,...r,...d,...g,v,N,...Y,te,ke],endsParent:!0,illegal:/["']/},Oe={match:[/(func|macro)/,/\s+/,nn(P.match,gr,dh)],className:{1:"keyword",3:"title.function"},contains:[Ae,ue,e],illegal:[/\[/,/%/]},Ce={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Ae,ue,e],illegal:/\[|%/},le={match:[/operator/,/\s+/,dh],className:{1:"keyword",3:"title"}},Re={begin:[/precedencegroup/,/\s+/,Id],className:{1:"keyword",3:"title"},contains:[te],keywords:[...F3,...CR],end:/}/},$e={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Ke={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},rt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,gr,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[Ae,...d,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Id},...d],relevance:0}]};for(let Te of N.variants){let wt=Te.contains.find(ne=>ne.label==="interpol");wt.keywords=c;let D=[...d,...p,...g,v,N,...k];wt.contains=[...D,{begin:/\(/,end:/\)/,contains:["self",...D]}];}return {name:"Swift",keywords:c,contains:[...r,Oe,Ce,$e,Ke,rt,le,Re,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},K,...d,...p,...g,v,N,...k,...Y,te,ke]}}var $d="[A-Za-z$_][0-9A-Za-z$_]*",AR=["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"],OR=["true","false","null","undefined","NaN","Infinity"],DR=["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"],PR=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],IR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],LR=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],$R=[].concat(IR,DR,PR);function V3(t){let e=t.regex,n=(_,{after:A})=>{let L="</"+_[0].slice(1);return _.input.indexOf(L,A)!==-1},r=$d,o={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(_,A)=>{let L=_[0].length+_.index,Y=_.input[L];if(Y==="<"||Y===","){A.ignoreMatch();return}Y===">"&&(n(_,{after:L})||A.ignoreMatch());let te,Se=_.input.substring(L);if(te=Se.match(/^\s*=/)){A.ignoreMatch();return}if((te=Se.match(/^\s+extends\s+/))&&te.index===0){A.ignoreMatch();return}}},a={$pattern:$d,keyword:AR,literal:OR,built_in:$R,"variable.language":LR},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"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},h={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},y={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]},v=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},u];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});let x=[].concat(y,f.contains),E=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(x)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:E},T={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"}}]},w={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:{_:[...DR,...PR]}},N={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},M={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},B={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(_){return e.concat("(?!",_.join("|"),")")}let K={match:e.concat(/\b/,U([...IR,"super","import"].map(_=>`${_}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},V={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",k={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return {name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:E,CLASS_REFERENCE:w},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),N,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,h,g,y,{match:/\$\d+/},u,w,{scope:"attr",match:r+e.lookahead(":"),relevance:0},k,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,t.REGEXP_MODE,{className:"function",begin:R,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:E}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},M,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},K,B,T,V,{match:/\$[(.]/}]}}function BR(t){let e=t.regex,n=V3(t),r=$d,o=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:o},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:$d,keyword:AR.concat(l),literal:OR,built_in:$R.concat(o),"variable.language":LR},d={className:"meta",begin:"@"+r},u=(h,g,b)=>{let y=h.contains.findIndex(v=>v.label===g);if(y===-1)throw new Error("can not find mode to replace");h.contains.splice(y,1,b);};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);let f=n.contains.find(h=>h.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,i,s,p]),u(n,"shebang",t.SHEBANG()),u(n,"use_strict",a);let m=n.contains.find(h=>h.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function FR(t){let e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},o=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\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(i,o),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,s,/ *#/)},{begin:e.concat(/# */,e.either(i,o),/ +/,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 zR(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"],o={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={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"}},i,s,o,t.QUOTE_STRING_MODE,l,c,a]}}function HR(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,o={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=t.inherit(i,{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:[o]},{begin:/'/,end:/'/,contains:[o]},{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:[i,l,a,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,s,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},o,{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 UR(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]|$)/}]},o={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={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,o]},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},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},h={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},m,h,i,s],b=[...g];return b.pop(),b.push(a),p.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}var fh={arduino:BC,bash:FC,c:zC,cpp:HC,csharp:UC,css:VC,diff:KC,go:WC,graphql:GC,ini:qC,java:XC,javascript:tR,json:nR,kotlin:rR,less:sR,lua:aR,makefile:lR,markdown:cR,objectivec:dR,perl:uR,php:fR,"php-template":pR,plaintext:mR,python:hR,"python-repl":gR,r:bR,ruby:yR,rust:vR,scss:wR,shell:xR,sql:ER,swift:MR,typescript:BR,vbnet:FR,wasm:zR,xml:HR,yaml:UR};var VR={},K3="hljs-";function mh(t){let e=Md.newInstance();return t&&i(t),{highlight:n,highlightAuto:r,listLanguages:o,register:i,registerAlias:s,registered:a};function n(l,c,d){let u=d||VR,f=typeof u.prefix=="string"?u.prefix:K3;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:ph,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 m=p._emitter.root,h=m.data;return h.language=p.language,h.relevance=p.relevance,m}function r(l,c){let u=(c||VR).subset||o(),f=-1,p=0,m;for(;++f<u.length;){let h=u[f];if(!e.getLanguage(h))continue;let g=n(h,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>p&&(p=g.data.relevance,m=g);}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function o(){return e.listLanguages()}function i(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 ph=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],o=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:o}):r.children.push(...o);}openNode(e){let n=this,r=e.split(".").map(function(s,a){return a?s+"_".repeat(a):n.options.classPrefix+s}),o=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};o.children.push(i),this.stack.push(i);}closeNode(){this.stack.pop();}finalize(){}toHTML(){return ""}};var br=new ae("slashCommands"),KR=se.create({name:"slashCommands",addOptions(){return {commands:[],onSelectCommand:()=>{}}},addCommands(){return {selectSlashCommand:t=>({editor:e})=>{let n=br.getState(e.state);if(n&&n.active&&n.filteredCommands[t]){let r=n.filteredCommands[t],{from:o,to:i}=n.range;return e.chain().deleteRange({from:o,to:i}).focus().run(),this.options.onSelectCommand(r),!0}return !1}}},addKeyboardShortcuts(){return {ArrowUp:({editor:t})=>{let e=br.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(br,{selectedIndex:n})),!0}return !1},ArrowDown:({editor:t})=>{let e=br.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(br,{selectedIndex:n})),!0}return !1},Enter:({editor:t})=>{let e=br.getState(t.state);return e&&e.active?(t.commands.selectSlashCommand(e.selectedIndex),!0):!1},Escape:({editor:t})=>{let e=br.getState(t.state);return e&&e.active?(t.view.dispatch(t.state.tr.setMeta(br,{active:!1})),!0):!1}}},addProseMirrorPlugins(){return [new oe({key:br,state:{init(){return {active:!1,range:{from:0,to:0},query:"",filteredCommands:[],selectedIndex:0}},apply(t,e,n,r){let o=t.getMeta(br);if(o)return {...e,...o};let{selection:i}=r,{empty:s,$from:a}=i;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 Ee.empty;let{from:n}=e.range,r=Be.widget(n,()=>{let o=document.createElement("div");if(o.className="slash-commands-menu",e.filteredCommands.forEach((i,s)=>{let a=document.createElement("div");if(a.className=`slash-command-item ${s===e.selectedIndex?"selected":""}`,i.icon){let u=document.createElement("div");u.innerHTML=i.icon,a.appendChild(u);}let l=document.createElement("div"),c=document.createElement("div");c.className="command-name",c.textContent=`/${i.command}`,l.appendChild(c);let d=document.createElement("div");d.className="command-description",d.textContent=i.description,l.appendChild(d),a.appendChild(l),a.addEventListener("click",()=>{t.editor.commands.selectSlashCommand(s);}),o.appendChild(a);}),e.filteredCommands.length===0){let i=document.createElement("div");i.className="text-gray-500 p-3 text-sm",i.textContent="No commands found",o.appendChild(i);}return o});return Ee.create(t.doc,[r])}}})]}});function gs(t){let e=t+"CollectionProvider",[n,r]=Ut(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=h=>{let{scope:g,children:b}=h,y=ee__default.useRef(null),v=ee__default.useRef(new Map).current;return jsx(o,{scope:g,itemMap:v,collectionRef:y,children:b})};s.displayName=e;let a=t+"CollectionSlot",l=Fn(a),c=ee__default.forwardRef((h,g)=>{let{scope:b,children:y}=h,v=i(a,b),x=Le(g,v.collectionRef);return jsx(l,{ref:x,children:y})});c.displayName=a;let d=t+"CollectionItemSlot",u="data-radix-collection-item",f=Fn(d),p=ee__default.forwardRef((h,g)=>{let{scope:b,children:y,...v}=h,x=ee__default.useRef(null),E=Le(g,x),C=i(d,b);return ee__default.useEffect(()=>(C.itemMap.set(x,{ref:x,...v}),()=>void C.itemMap.delete(x))),jsx(f,{[u]:"",ref:E,children:y})});p.displayName=d;function m(h){let g=i(t+"CollectionConsumer",h);return ee__default.useCallback(()=>{let y=g.collectionRef.current;if(!y)return [];let v=Array.from(y.querySelectorAll(`[${u}]`));return Array.from(g.itemMap.values()).sort((C,T)=>v.indexOf(C.ref.current)-v.indexOf(T.ref.current))},[g.collectionRef,g.itemMap])}return [{Provider:s,Slot:c,ItemSlot:p},m,r]}var G3=ee.createContext(void 0);function Fd(t){let e=ee.useContext(G3);return t||e||"ltr"}var q3="Arrow",YR=ee.forwardRef((t,e)=>{let{children:n,width:r=10,height:o=5,...i}=t;return jsx(fe.svg,{...i,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:jsx("polygon",{points:"0,0 30,0 15,10"})})});YR.displayName=q3;var XR=YR;function ZR(t){let[e,n]=ee.useState(void 0);return Vt(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});let r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],s,a;if("borderBoxSize"in i){let l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize;}else s=t.offsetWidth,a=t.offsetHeight;n({width:s,height:a});});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0);},[t]),e}var bh="Popper",[QR,bs]=Ut(bh),[Y3,eT]=QR(bh),tT=t=>{let{__scopePopper:e,children:n}=t,[r,o]=ee.useState(null);return jsx(Y3,{scope:e,anchor:r,onAnchorChange:o,children:n})};tT.displayName=bh;var nT="PopperAnchor",rT=ee.forwardRef((t,e)=>{let{__scopePopper:n,virtualRef:r,...o}=t,i=eT(nT,n),s=ee.useRef(null),a=Le(e,s);return ee.useEffect(()=>{i.onAnchorChange(r?.current||s.current);}),r?null:jsx(fe.div,{...o,ref:a})});rT.displayName=nT;var yh="PopperContent",[X3,J3]=QR(yh),oT=ee.forwardRef((t,e)=>{let{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,g=eT(yh,n),[b,y]=ee.useState(null),v=Le(e,W=>y(W)),[x,E]=ee.useState(null),C=ZR(x),T=C?.width??0,w=C?.height??0,N=r+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},B=Array.isArray(c)?c:[c],U=B.length>0,K={padding:M,boundary:B.filter(Q3),altBoundary:U},{refs:P,floatingStyles:V,placement:R,isPositioned:k,middlewareData:_}=hl({strategy:"fixed",placement:N,whileElementsMounted:(...W)=>Ps(...W,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[gl({mainAxis:o+w,alignmentAxis:s}),l&&bl({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?yl():void 0,...K}),l&&vl({...K}),wl({...K,apply:({elements:W,rects:ue,availableWidth:Oe,availableHeight:Ce})=>{let{width:le,height:Re}=ue.reference,$e=W.floating.style;$e.setProperty("--radix-popper-available-width",`${Oe}px`),$e.setProperty("--radix-popper-available-height",`${Ce}px`),$e.setProperty("--radix-popper-anchor-width",`${le}px`),$e.setProperty("--radix-popper-anchor-height",`${Re}px`);}}),x&&El({element:x,padding:a}),ez({arrowWidth:T,arrowHeight:w}),f&&xl({strategy:"referenceHidden",...K})]}),[A,L]=aT(R),Y=pt(m);Vt(()=>{k&&Y?.();},[k,Y]);let te=_.arrow?.x,Se=_.arrow?.y,he=_.arrow?.centerOffset!==0,[ke,Ae]=ee.useState();return Vt(()=>{b&&Ae(window.getComputedStyle(b).zIndex);},[b]),jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:k?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ke,["--radix-popper-transform-origin"]:[_.transformOrigin?.x,_.transformOrigin?.y].join(" "),..._.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:jsx(X3,{scope:n,placedSide:A,onArrowChange:E,arrowX:te,arrowY:Se,shouldHideArrow:he,children:jsx(fe.div,{"data-side":A,"data-align":L,...h,ref:v,style:{...h.style,animation:k?void 0:"none"}})})})});oT.displayName=yh;var iT="PopperArrow",Z3={top:"bottom",right:"left",bottom:"top",left:"right"},sT=ee.forwardRef(function(e,n){let{__scopePopper:r,...o}=e,i=J3(iT,r),s=Z3[i.placedSide];return jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:jsx(XR,{...o,ref:n,style:{...o.style,display:"block"}})})});sT.displayName=iT;function Q3(t){return t!==null}var ez=t=>({name:"transformOrigin",options:t,fn(e){let{placement:n,rects:r,middlewareData:o}=e,s=o.arrow?.centerOffset!==0,a=s?0:t.arrowWidth,l=s?0:t.arrowHeight,[c,d]=aT(n),u={start:"0%",center:"50%",end:"100%"}[d],f=(o.arrow?.x??0)+a/2,p=(o.arrow?.y??0)+l/2,m="",h="";return c==="bottom"?(m=s?u:`${f}px`,h=`${-l}px`):c==="top"?(m=s?u:`${f}px`,h=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,h=s?u:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,h=s?u:`${p}px`),{data:{x:m,y:h}}}});function aT(t){let[e,n="center"]=t.split("-");return [e,n]}var Ba=tT,Fa=rT,zd=oT,Hd=sT;var vh="rovingFocusGroup.onEntryFocus",tz={bubbles:!1,cancelable:!0},za="RovingFocusGroup",[wh,cT,nz]=gs(za),[rz,xh]=Ut(za,[nz]),[oz,iz]=rz(za),dT=ee.forwardRef((t,e)=>jsx(wh.Provider,{scope:t.__scopeRovingFocusGroup,children:jsx(wh.Slot,{scope:t.__scopeRovingFocusGroup,children:jsx(sz,{...t,ref:e})})}));dT.displayName=za;var sz=ee.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=t,f=ee.useRef(null),p=Le(e,f),m=Fd(i),[h,g]=Qn({prop:s,defaultProp:a??null,onChange:l,caller:za}),[b,y]=ee.useState(!1),v=pt(c),x=cT(n),E=ee.useRef(!1),[C,T]=ee.useState(0);return ee.useEffect(()=>{let w=f.current;if(w)return w.addEventListener(vh,v),()=>w.removeEventListener(vh,v)},[v]),jsx(oz,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:h,onItemFocus:ee.useCallback(w=>g(w),[g]),onItemShiftTab:ee.useCallback(()=>y(!0),[]),onFocusableItemAdd:ee.useCallback(()=>T(w=>w+1),[]),onFocusableItemRemove:ee.useCallback(()=>T(w=>w-1),[]),children:jsx(fe.div,{tabIndex:b||C===0?-1:0,"data-orientation":r,...u,ref:p,style:{outline:"none",...t.style},onMouseDown:J(t.onMouseDown,()=>{E.current=!0;}),onFocus:J(t.onFocus,w=>{let N=!E.current;if(w.target===w.currentTarget&&N&&!b){let M=new CustomEvent(vh,tz);if(w.currentTarget.dispatchEvent(M),!M.defaultPrevented){let B=x().filter(R=>R.focusable),U=B.find(R=>R.active),K=B.find(R=>R.id===h),V=[U,K,...B].filter(Boolean).map(R=>R.ref.current);pT(V,d);}}E.current=!1;}),onBlur:J(t.onBlur,()=>y(!1))})})}),uT="RovingFocusGroupItem",fT=ee.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=t,l=sn(),c=i||l,d=iz(uT,n),u=d.currentTabStopId===c,f=cT(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=d;return ee.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),jsx(wh.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:jsx(fe.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...a,ref:e,onMouseDown:J(t.onMouseDown,g=>{r?d.onItemFocus(c):g.preventDefault();}),onFocus:J(t.onFocus,()=>d.onItemFocus(c)),onKeyDown:J(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;let b=cz(g,d.orientation,d.dir);if(b!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let v=f().filter(x=>x.focusable).map(x=>x.ref.current);if(b==="last")v.reverse();else if(b==="prev"||b==="next"){b==="prev"&&v.reverse();let x=v.indexOf(g.currentTarget);v=d.loop?dz(v,x+1):v.slice(x+1);}setTimeout(()=>pT(v));}}),children:typeof s=="function"?s({isCurrentTabStop:u,hasTabStop:h!=null}):s})})});fT.displayName=uT;var az={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function lz(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function cz(t,e,n){let r=lz(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return az[r]}function pT(t,e=!1){let n=document.activeElement;for(let r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function dz(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var mT=dT,hT=fT;var Eh=["Enter"," "],fz=["ArrowDown","PageUp","Home"],bT=["ArrowUp","PageDown","End"],pz=[...fz,...bT],mz={ltr:[...Eh,"ArrowRight"],rtl:[...Eh,"ArrowLeft"]},hz={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ka="Menu",[Ua,gz,bz]=gs(Ka),[bi,Sh]=Ut(Ka,[bz,bs,xh]),Wa=bs(),yT=xh(),[vT,yo]=bi(Ka),[yz,Ga]=bi(Ka),wT=t=>{let{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,a=Wa(e),[l,c]=ee.useState(null),d=ee.useRef(!1),u=pt(i),f=Fd(o);return ee.useEffect(()=>{let p=()=>{d.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0});},m=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0});}},[]),jsx(Ba,{...a,children:jsx(vT,{scope:e,open:n,onOpenChange:u,content:l,onContentChange:c,children:jsx(yz,{scope:e,onClose:ee.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:f,modal:s,children:r})})})};wT.displayName=Ka;var vz="MenuAnchor",Ch=ee.forwardRef((t,e)=>{let{__scopeMenu:n,...r}=t,o=Wa(n);return jsx(Fa,{...o,...r,ref:e})});Ch.displayName=vz;var Rh="MenuPortal",[wz,xT]=bi(Rh,{forceMount:void 0}),ET=t=>{let{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=yo(Rh,e);return jsx(wz,{scope:e,forceMount:n,children:jsx(Jt,{present:n||i.open,children:jsx(Tr,{asChild:!0,container:o,children:r})})})};ET.displayName=Rh;var In="MenuContent",[xz,Th]=bi(In),ST=ee.forwardRef((t,e)=>{let n=xT(In,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=yo(In,t.__scopeMenu),s=Ga(In,t.__scopeMenu);return jsx(Ua.Provider,{scope:t.__scopeMenu,children:jsx(Jt,{present:r||i.open,children:jsx(Ua.Slot,{scope:t.__scopeMenu,children:s.modal?jsx(Ez,{...o,ref:e}):jsx(Sz,{...o,ref:e})})})})}),Ez=ee.forwardRef((t,e)=>{let n=yo(In,t.__scopeMenu),r=ee.useRef(null),o=Le(e,r);return ee.useEffect(()=>{let i=r.current;if(i)return Jr(i)},[]),jsx(kh,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Sz=ee.forwardRef((t,e)=>{let n=yo(In,t.__scopeMenu);return jsx(kh,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Cz=Fn("MenuContent.ScrollLock"),kh=ee.forwardRef((t,e)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=t,g=yo(In,n),b=Ga(In,n),y=Wa(n),v=yT(n),x=gz(n),[E,C]=ee.useState(null),T=ee.useRef(null),w=Le(e,T,g.onContentChange),N=ee.useRef(0),M=ee.useRef(""),B=ee.useRef(0),U=ee.useRef(null),K=ee.useRef("right"),P=ee.useRef(0),V=m?Uo:ee.Fragment,R=m?{as:Cz,allowPinchZoom:!0}:void 0,k=A=>{let L=M.current+A,Y=x().filter(W=>!W.disabled),te=document.activeElement,Se=Y.find(W=>W.ref.current===te)?.textValue,he=Y.map(W=>W.textValue),ke=$z(he,L,Se),Ae=Y.find(W=>W.textValue===ke)?.ref.current;((function W(ue){M.current=ue,window.clearTimeout(N.current),ue!==""&&(N.current=window.setTimeout(()=>W(""),1e3));}))(L),Ae&&setTimeout(()=>Ae.focus());};ee.useEffect(()=>()=>window.clearTimeout(N.current),[]),Ii();let _=ee.useCallback(A=>K.current===U.current?.side&&Fz(A,U.current?.area),[]);return jsx(xz,{scope:n,searchRef:M,onItemEnter:ee.useCallback(A=>{_(A)&&A.preventDefault();},[_]),onItemLeave:ee.useCallback(A=>{_(A)||(T.current?.focus(),C(null));},[_]),onTriggerLeave:ee.useCallback(A=>{_(A)&&A.preventDefault();},[_]),pointerGraceTimerRef:B,onPointerGraceIntentChange:ee.useCallback(A=>{U.current=A;},[]),children:jsx(V,{...R,children:jsx(zo,{asChild:!0,trapped:o,onMountAutoFocus:J(i,A=>{A.preventDefault(),T.current?.focus({preventScroll:!0});}),onUnmountAutoFocus:s,children:jsx(Qr,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:p,children:jsx(mT,{asChild:!0,...v,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:C,onEntryFocus:J(l,A=>{b.isUsingKeyboardRef.current||A.preventDefault();}),preventScrollOnEntryFocus:!0,children:jsx(zd,{role:"menu","aria-orientation":"vertical","data-state":FT(g.open),"data-radix-menu-content":"",dir:b.dir,...y,...h,ref:w,style:{outline:"none",...h.style},onKeyDown:J(h.onKeyDown,A=>{let Y=A.target.closest("[data-radix-menu-content]")===A.currentTarget,te=A.ctrlKey||A.altKey||A.metaKey,Se=A.key.length===1;Y&&(A.key==="Tab"&&A.preventDefault(),!te&&Se&&k(A.key));let he=T.current;if(A.target!==he||!pz.includes(A.key))return;A.preventDefault();let Ae=x().filter(W=>!W.disabled).map(W=>W.ref.current);bT.includes(A.key)&&Ae.reverse(),Iz(Ae);}),onBlur:J(t.onBlur,A=>{A.currentTarget.contains(A.target)||(window.clearTimeout(N.current),M.current="");}),onPointerMove:J(t.onPointerMove,Va(A=>{let L=A.target,Y=P.current!==A.clientX;if(A.currentTarget.contains(L)&&Y){let te=A.clientX>P.current?"right":"left";K.current=te,P.current=A.clientX;}}))})})})})})})});ST.displayName=In;var Rz="MenuGroup",Nh=ee.forwardRef((t,e)=>{let{__scopeMenu:n,...r}=t;return jsx(fe.div,{role:"group",...r,ref:e})});Nh.displayName=Rz;var Tz="MenuLabel",CT=ee.forwardRef((t,e)=>{let{__scopeMenu:n,...r}=t;return jsx(fe.div,{...r,ref:e})});CT.displayName=Tz;var Ud="MenuItem",gT="menu.itemSelect",Kd=ee.forwardRef((t,e)=>{let{disabled:n=!1,onSelect:r,...o}=t,i=ee.useRef(null),s=Ga(Ud,t.__scopeMenu),a=Th(Ud,t.__scopeMenu),l=Le(e,i),c=ee.useRef(!1),d=()=>{let u=i.current;if(!n&&u){let f=new CustomEvent(gT,{bubbles:!0,cancelable:!0});u.addEventListener(gT,p=>r?.(p),{once:!0}),xi(u,f),f.defaultPrevented?c.current=!1:s.onClose();}};return jsx(RT,{...o,ref:l,disabled:n,onClick:J(t.onClick,d),onPointerDown:u=>{t.onPointerDown?.(u),c.current=!0;},onPointerUp:J(t.onPointerUp,u=>{c.current||u.currentTarget?.click();}),onKeyDown:J(t.onKeyDown,u=>{let f=a.searchRef.current!=="";n||f&&u.key===" "||Eh.includes(u.key)&&(u.currentTarget.click(),u.preventDefault());})})});Kd.displayName=Ud;var RT=ee.forwardRef((t,e)=>{let{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=t,s=Th(Ud,n),a=yT(n),l=ee.useRef(null),c=Le(e,l),[d,u]=ee.useState(!1),[f,p]=ee.useState("");return ee.useEffect(()=>{let m=l.current;m&&p((m.textContent??"").trim());},[i.children]),jsx(Ua.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:jsx(hT,{asChild:!0,...a,focusable:!r,children:jsx(fe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:J(t.onPointerMove,Va(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}));})),onPointerLeave:J(t.onPointerLeave,Va(m=>s.onItemLeave(m))),onFocus:J(t.onFocus,()=>u(!0)),onBlur:J(t.onBlur,()=>u(!1))})})})}),kz="MenuCheckboxItem",TT=ee.forwardRef((t,e)=>{let{checked:n=!1,onCheckedChange:r,...o}=t;return jsx(AT,{scope:t.__scopeMenu,checked:n,children:jsx(Kd,{role:"menuitemcheckbox","aria-checked":Vd(n)?"mixed":n,...o,ref:e,"data-state":Ah(n),onSelect:J(o.onSelect,()=>r?.(Vd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});TT.displayName=kz;var kT="MenuRadioGroup",[Nz,_z]=bi(kT,{value:void 0,onValueChange:()=>{}}),NT=ee.forwardRef((t,e)=>{let{value:n,onValueChange:r,...o}=t,i=pt(r);return jsx(Nz,{scope:t.__scopeMenu,value:n,onValueChange:i,children:jsx(Nh,{...o,ref:e})})});NT.displayName=kT;var _T="MenuRadioItem",MT=ee.forwardRef((t,e)=>{let{value:n,...r}=t,o=_z(_T,t.__scopeMenu),i=n===o.value;return jsx(AT,{scope:t.__scopeMenu,checked:i,children:jsx(Kd,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Ah(i),onSelect:J(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});MT.displayName=_T;var _h="MenuItemIndicator",[AT,Mz]=bi(_h,{checked:!1}),OT=ee.forwardRef((t,e)=>{let{__scopeMenu:n,forceMount:r,...o}=t,i=Mz(_h,n);return jsx(Jt,{present:r||Vd(i.checked)||i.checked===!0,children:jsx(fe.span,{...o,ref:e,"data-state":Ah(i.checked)})})});OT.displayName=_h;var Az="MenuSeparator",DT=ee.forwardRef((t,e)=>{let{__scopeMenu:n,...r}=t;return jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});DT.displayName=Az;var Oz="MenuArrow",PT=ee.forwardRef((t,e)=>{let{__scopeMenu:n,...r}=t,o=Wa(n);return jsx(Hd,{...o,...r,ref:e})});PT.displayName=Oz;var Mh="MenuSub",[Dz,IT]=bi(Mh);var Ha="MenuSubTrigger",LT=ee.forwardRef((t,e)=>{let n=yo(Ha,t.__scopeMenu),r=Ga(Ha,t.__scopeMenu),o=IT(Ha,t.__scopeMenu),i=Th(Ha,t.__scopeMenu),s=ee.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:t.__scopeMenu},d=ee.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null;},[]);return ee.useEffect(()=>d,[d]),ee.useEffect(()=>{let u=a.current;return ()=>{window.clearTimeout(u),l(null);}},[a,l]),jsx(Ch,{asChild:!0,...c,children:jsx(RT,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":FT(n.open),...t,ref:Ro(e,o.onTriggerChange),onClick:u=>{t.onClick?.(u),!(t.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0));},onPointerMove:J(t.onPointerMove,Va(u=>{i.onItemEnter(u),!u.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d();},100));})),onPointerLeave:J(t.onPointerLeave,Va(u=>{d();let f=n.content?.getBoundingClientRect();if(f){let p=n.content?.dataset.side,m=p==="right",h=m?-5:5,g=f[m?"left":"right"],b=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:u.clientX+h,y:u.clientY},{x:g,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:g,y:f.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300);}else {if(i.onTriggerLeave(u),u.defaultPrevented)return;i.onPointerGraceIntentChange(null);}})),onKeyDown:J(t.onKeyDown,u=>{let f=i.searchRef.current!=="";t.disabled||f&&u.key===" "||mz[r.dir].includes(u.key)&&(n.onOpenChange(!0),n.content?.focus(),u.preventDefault());})})})});LT.displayName=Ha;var $T="MenuSubContent",BT=ee.forwardRef((t,e)=>{let n=xT(In,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=yo(In,t.__scopeMenu),s=Ga(In,t.__scopeMenu),a=IT($T,t.__scopeMenu),l=ee.useRef(null),c=Le(e,l);return jsx(Ua.Provider,{scope:t.__scopeMenu,children:jsx(Jt,{present:r||i.open,children:jsx(Ua.Slot,{scope:t.__scopeMenu,children:jsx(kh,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{s.isUsingKeyboardRef.current&&l.current?.focus(),d.preventDefault();},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:J(t.onFocusOutside,d=>{d.target!==a.trigger&&i.onOpenChange(!1);}),onEscapeKeyDown:J(t.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault();}),onKeyDown:J(t.onKeyDown,d=>{let u=d.currentTarget.contains(d.target),f=hz[s.dir].includes(d.key);u&&f&&(i.onOpenChange(!1),a.trigger?.focus(),d.preventDefault());})})})})})});BT.displayName=$T;function FT(t){return t?"open":"closed"}function Vd(t){return t==="indeterminate"}function Ah(t){return Vd(t)?"indeterminate":t?"checked":"unchecked"}function Iz(t){let e=document.activeElement;for(let n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Lz(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function $z(t,e,n){let o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1,s=Lz(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));let l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function Bz(t,e){let{x:n,y:r}=t,o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let a=e[i],l=e[s],c=a.x,d=a.y,u=l.x,f=l.y;d>r!=f>r&&n<(u-c)*(r-d)/(f-d)+c&&(o=!o);}return o}function Fz(t,e){if(!e)return !1;let n={x:t.clientX,y:t.clientY};return Bz(n,e)}function Va(t){return e=>e.pointerType==="mouse"?t(e):void 0}var zT=wT,HT=Ch,UT=ET,VT=ST,KT=Nh,WT=CT,GT=Kd,qT=TT,jT=NT,YT=MT,XT=OT,JT=DT,ZT=PT;var QT=LT,ek=BT;var Wd="DropdownMenu",[Hz,LQ]=Ut(Wd,[Sh]),rn=Sh(),[Uz,tk]=Hz(Wd),nk=t=>{let{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,l=rn(e),c=ee.useRef(null),[d,u]=Qn({prop:o,defaultProp:i??!1,onChange:s,caller:Wd});return jsx(Uz,{scope:e,triggerId:sn(),triggerRef:c,contentId:sn(),open:d,onOpenChange:u,onOpenToggle:ee.useCallback(()=>u(f=>!f),[u]),modal:a,children:jsx(zT,{...l,open:d,onOpenChange:u,dir:r,modal:a,children:n})})};nk.displayName=Wd;var rk="DropdownMenuTrigger",ok=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,i=tk(rk,n),s=rn(n);return jsx(HT,{asChild:!0,...s,children:jsx(fe.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:Ro(e,i.triggerRef),onPointerDown:J(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault());}),onKeyDown:J(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault());})})})});ok.displayName=rk;var Vz="DropdownMenuPortal",ik=t=>{let{__scopeDropdownMenu:e,...n}=t,r=rn(e);return jsx(UT,{...r,...n})};ik.displayName=Vz;var sk="DropdownMenuContent",ak=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=tk(sk,n),i=rn(n),s=ee.useRef(!1);return jsx(VT,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:e,onCloseAutoFocus:J(t.onCloseAutoFocus,a=>{s.current||o.triggerRef.current?.focus(),s.current=!1,a.preventDefault();}),onInteractOutside:J(t.onInteractOutside,a=>{let l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!o.modal||d)&&(s.current=!0);}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ak.displayName=sk;var Kz="DropdownMenuGroup",Wz=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(KT,{...o,...r,ref:e})});Wz.displayName=Kz;var Gz="DropdownMenuLabel",lk=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(WT,{...o,...r,ref:e})});lk.displayName=Gz;var qz="DropdownMenuItem",ck=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(GT,{...o,...r,ref:e})});ck.displayName=qz;var jz="DropdownMenuCheckboxItem",dk=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(qT,{...o,...r,ref:e})});dk.displayName=jz;var Yz="DropdownMenuRadioGroup",Xz=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(jT,{...o,...r,ref:e})});Xz.displayName=Yz;var Jz="DropdownMenuRadioItem",uk=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(YT,{...o,...r,ref:e})});uk.displayName=Jz;var Zz="DropdownMenuItemIndicator",fk=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(XT,{...o,...r,ref:e})});fk.displayName=Zz;var Qz="DropdownMenuSeparator",pk=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(JT,{...o,...r,ref:e})});pk.displayName=Qz;var e5="DropdownMenuArrow",t5=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(ZT,{...o,...r,ref:e})});t5.displayName=e5;var n5="DropdownMenuSubTrigger",mk=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(QT,{...o,...r,ref:e})});mk.displayName=n5;var r5="DropdownMenuSubContent",hk=ee.forwardRef((t,e)=>{let{__scopeDropdownMenu:n,...r}=t,o=rn(n);return jsx(ek,{...o,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});hk.displayName=r5;var gk=nk,bk=ok,yk=ik,Oh=ak;var Dh=lk,Ph=ck,Ih=dk;var Lh=uk,$h=fk,Bh=pk;var Fh=mk,zh=hk;var Gd=gk,qd=bk;var l5=ee.forwardRef(({className:t,inset:e,children:n,...r},o)=>jsxs(Fh,{ref:o,className:I("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,jsx(ChevronRight,{className:"ml-auto h-4 w-4"})]}));l5.displayName=Fh.displayName;var c5=ee.forwardRef(({className:t,...e},n)=>jsx(zh,{ref:n,className:I("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));c5.displayName=zh.displayName;var qa=ee.forwardRef(({className:t,sideOffset:e=4,...n},r)=>jsx(yk,{children:jsx(Oh,{ref:r,sideOffset:e,className:I("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));qa.displayName=Oh.displayName;var Ve=ee.forwardRef(({className:t,inset:e,...n},r)=>jsx(Ph,{ref:r,className:I("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Ve.displayName=Ph.displayName;var d5=ee.forwardRef(({className:t,children:e,checked:n,...r},o)=>jsxs(Ih,{ref:o,className:I("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsx($h,{children:jsx(Check,{className:"h-4 w-4"})})}),e]}));d5.displayName=Ih.displayName;var u5=ee.forwardRef(({className:t,children:e,...n},r)=>jsxs(Lh,{ref:r,className:I("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsx($h,{children:jsx(Circle,{className:"h-2 w-2 fill-current"})})}),e]}));u5.displayName=Lh.displayName;var f5=ee.forwardRef(({className:t,inset:e,...n},r)=>jsx(Dh,{ref:r,className:I("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));f5.displayName=Dh.displayName;var vo=ee.forwardRef(({className:t,...e},n)=>jsx(Bh,{ref:n,className:I("-mx-1 my-1 h-px bg-muted",t),...e}));vo.displayName=Bh.displayName;var vk=Ln.Provider,h5=cva("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",{variants:{variant:{default:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",success:"bg-green-500 text-white border-green-600",warning:"bg-yellow-500 text-white border-yellow-600",destructive:"bg-destructive text-destructive-foreground",info:"bg-blue-500 text-white border-blue-600"},size:{sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"}},defaultVariants:{variant:"default",size:"md"}}),Uh=Ln.Root,Vh=Ln.Trigger,wk=ee.forwardRef(({className:t,...e},n)=>jsx(Ln.Arrow,{ref:n,className:I("fill-current",t),...e}));wk.displayName=Ln.Arrow.displayName;var Xd=ee.forwardRef(({className:t,variant:e,size:n,showArrow:r=!1,sideOffset:o=4,...i},s)=>jsxs(Ln.Content,{ref:s,sideOffset:o,className:I(h5({variant:e,size:n}),t),...i,children:[i.children,r&&jsx(wk,{})]}));Xd.displayName=Ln.Content.displayName;var g5=ee.forwardRef(({children:t,content:e,variant:n="default",size:r="md",side:o="top",align:i="center",delayDuration:s=400,skipDelayDuration:a=300,sideOffset:l=4,showArrow:c=!1,className:d,open:u,defaultOpen:f,onOpenChange:p,...m},h)=>jsxs(Uh,{open:u,defaultOpen:f,onOpenChange:p,delayDuration:s,skipDelayDuration:a,children:[jsx(Vh,{asChild:!0,children:t}),jsx(Xd,{ref:h,side:o,align:i,variant:n,size:r,sideOffset:l,showArrow:c,className:d,...m,children:e})]}));g5.displayName="SimpleTooltip";var Jd="Popover",[Ek,dee]=Ut(Jd,[bs]),ja=bs(),[b5,wo]=Ek(Jd),Sk=t=>{let{__scopePopover:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=t,a=ja(e),l=ee.useRef(null),[c,d]=ee.useState(!1),[u,f]=Qn({prop:r,defaultProp:o??!1,onChange:i,caller:Jd});return jsx(Ba,{...a,children:jsx(b5,{scope:e,contentId:sn(),triggerRef:l,open:u,onOpenChange:f,onOpenToggle:ee.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:c,onCustomAnchorAdd:ee.useCallback(()=>d(!0),[]),onCustomAnchorRemove:ee.useCallback(()=>d(!1),[]),modal:s,children:n})})};Sk.displayName=Jd;var Ck="PopoverAnchor",y5=ee.forwardRef((t,e)=>{let{__scopePopover:n,...r}=t,o=wo(Ck,n),i=ja(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return ee.useEffect(()=>(s(),()=>a()),[s,a]),jsx(Fa,{...i,...r,ref:e})});y5.displayName=Ck;var Rk="PopoverTrigger",Tk=ee.forwardRef((t,e)=>{let{__scopePopover:n,...r}=t,o=wo(Rk,n),i=ja(n),s=Le(e,o.triggerRef),a=jsx(fe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Mk(o.open),...r,ref:s,onClick:J(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:jsx(Fa,{asChild:!0,...i,children:a})});Tk.displayName=Rk;var Kh="PopoverPortal",[v5,w5]=Ek(Kh,{forceMount:void 0});var ys="PopoverContent",kk=ee.forwardRef((t,e)=>{let n=w5(ys,t.__scopePopover),{forceMount:r=n.forceMount,...o}=t,i=wo(ys,t.__scopePopover);return jsx(Jt,{present:r||i.open,children:i.modal?jsx(S5,{...o,ref:e}):jsx(C5,{...o,ref:e})})});kk.displayName=ys;var E5=Fn("PopoverContent.RemoveScroll"),S5=ee.forwardRef((t,e)=>{let n=wo(ys,t.__scopePopover),r=ee.useRef(null),o=Le(e,r),i=ee.useRef(!1);return ee.useEffect(()=>{let s=r.current;if(s)return Jr(s)},[]),jsx(Uo,{as:E5,allowPinchZoom:!0,children:jsx(Nk,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,s=>{s.preventDefault(),i.current||n.triggerRef.current?.focus();}),onPointerDownOutside:J(t.onPointerDownOutside,s=>{let a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c;},{checkForDefaultPrevented:!1}),onFocusOutside:J(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),C5=ee.forwardRef((t,e)=>{let n=wo(ys,t.__scopePopover),r=ee.useRef(!1),o=ee.useRef(!1);return jsx(Nk,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1;},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));let s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault();}})}),Nk=ee.forwardRef((t,e)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...u}=t,f=wo(ys,n),p=ja(n);return Ii(),jsx(zo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:jsx(Qr,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:jsx(zd,{"data-state":Mk(f.open),role:"dialog",id:f.contentId,...p,...u,ref:e,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_k="PopoverClose",R5=ee.forwardRef((t,e)=>{let{__scopePopover:n,...r}=t,o=wo(_k,n);return jsx(fe.button,{type:"button",...r,ref:e,onClick:J(t.onClick,()=>o.onOpenChange(!1))})});R5.displayName=_k;var T5="PopoverArrow",k5=ee.forwardRef((t,e)=>{let{__scopePopover:n,...r}=t,o=ja(n);return jsx(Hd,{...o,...r,ref:e})});k5.displayName=T5;function Mk(t){return t?"open":"closed"}var Ak=Sk;var Ok=Tk;var Wh=kk;var M5=cva("z-50 w-72 rounded-md border border-border bg-background p-4 shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",{variants:{variant:{default:"",destructive:"border-destructive bg-destructive/5",outline:"border-border bg-transparent",subtle:"border-transparent bg-muted/50"},size:{sm:"w-48 p-3",default:"w-72 p-4",lg:"w-96 p-5"},side:{top:"data-[side=top]:slide-in-from-bottom-2",right:"data-[side=right]:slide-in-from-left-2",bottom:"data-[side=bottom]:slide-in-from-top-2",left:"data-[side=left]:slide-in-from-right-2"},position:{pointerEventsNone:"pointer-events-none",default:""},radius:{none:"rounded-none",sm:"rounded-sm",default:"rounded-md",lg:"rounded-lg",full:"rounded-full"},shadow:{none:"shadow-none",sm:"shadow-sm",default:"shadow-md",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"}},defaultVariants:{variant:"default",size:"default",radius:"default",shadow:"default"}}),Gh=Ak,qh=Ok;var Zd=ee.forwardRef(({className:t,variant:e,size:n,side:r,position:o,radius:i,shadow:s,backdrop:a=!1,closeOnInteractOutside:l=!0,overlayBackdrop:c=!1,sideOffset:d=4,...u},f)=>jsxs(Fragment$1,{children:[c&&jsx("div",{className:"fixed inset-0 z-40 bg-overlay opacity-30"}),jsx(Wh,{ref:f,sideOffset:d,collisionPadding:8,onInteractOutside:p=>{l||p.preventDefault();},className:I(M5({variant:e,size:n,side:r,position:o,radius:i,shadow:s}),a&&"backdrop-blur-md bg-opacity-80",t),...u})]}));Zd.displayName=Wh.displayName;var L5=cva("relative flex w-full touch-none select-none items-center",{variants:{size:{sm:"h-5",default:"h-6",md:"h-8",lg:"h-10"}},defaultVariants:{size:"default"}}),$5=cva("relative h-1.5 w-full grow overflow-hidden rounded-full",{variants:{variant:{default:"bg-muted",primary:"bg-primary/20",secondary:"bg-secondary/20",accent:"bg-accent/20",success:"bg-success/20",warning:"bg-warning/20",error:"bg-error/20"}},defaultVariants:{variant:"default"}}),B5=cva("absolute h-full",{variants:{variant:{default:"bg-foreground",primary:"bg-primary",secondary:"bg-secondary",accent:"bg-accent",success:"bg-success",warning:"bg-warning",error:"bg-error"}},defaultVariants:{variant:"primary"}}),F5=cva("block rounded-full border-2 ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"border-foreground bg-background",primary:"border-primary bg-background",secondary:"border-secondary bg-background",accent:"border-accent bg-background",success:"border-success bg-background",warning:"border-warning bg-background",error:"border-error bg-background"},size:{sm:"h-3 w-3",default:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"}},defaultVariants:{variant:"primary",size:"default"}}),Yh=ee.forwardRef(({className:t,size:e,trackVariant:n,rangeVariant:r,thumbVariant:o,thumbSize:i,showValueLabel:s=!1,valueLabelFormat:a,valueLabelClassName:l,value:c,defaultValue:d=[0],onValueChange:u,disabled:f,...p},m)=>{let[h,g]=ee.useState(c||d||[0]);ee.useEffect(()=>{c!==void 0&&g(c);},[c]);let b=M=>a?a(M):`${Math.round(M*100)/100}`,y=(M,B,U)=>(M-B)/(U-B)*100,v=ee.useRef(null),x=p.min||0,E=p.max||100,C=p.step||1,T=M=>{let B=M.map(U=>{if(C<1){let K=C.toString().split(".")[1]?.length||0;return Math.round(U*Math.pow(10,K))/Math.pow(10,K)}return Math.round(U)});g(B),u&&u(B);},w=M=>{if(f)return;let B=v.current;if(!B)return;let U=B.getBoundingClientRect(),K=(M.clientX-U.left)/U.width,P=x+K*(E-x),V=Math.round(P/C)*C,R=Math.max(x,Math.min(E,V)),k=[...h];k[0]=R,T(k);},N=M=>B=>{if(f)return;B.preventDefault();let U=P=>{let V=v.current;if(!V)return;let R=V.getBoundingClientRect(),k=(P.clientX-R.left)/R.width,_=x+k*(E-x),A=Math.round(_/C)*C,L=Math.max(x,Math.min(E,A)),Y=[...h];Y[M]=L,T(Y);},K=()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",K);};document.addEventListener("mousemove",U),document.addEventListener("mouseup",K);};return jsxs("div",{className:"w-full",ref:m,...p,children:[s&&jsx("div",{className:I("flex justify-end mb-1 text-sm text-muted-foreground",l),children:h.length===1?jsx("span",{children:b(h[0])}):jsxs("span",{children:[b(h[0])," - ",b(h[h.length-1])]})}),jsxs("div",{className:I(L5({size:e}),t),"data-disabled":f?!0:void 0,children:[jsx("div",{ref:v,className:I($5({variant:n||o||"default"})),onClick:w,children:jsx("div",{className:I(B5({variant:r||o||"primary"})),style:{left:"0%",width:`${y(h[0],x,E)}%`}})}),h.map((M,B)=>jsx("div",{className:I(F5({variant:o||"primary",size:i})),style:{left:`${y(M,x,E)}%`,transform:"translateX(-50%)",position:"absolute",top:"50%",marginTop:i==="sm"?"-6px":i==="lg"?"-12px":"-8px",cursor:f?"not-allowed":"pointer"},onMouseDown:N(B),"aria-label":`Thumb ${B+1}`,tabIndex:f?-1:0,role:"slider","aria-valuemin":x,"aria-valuemax":E,"aria-valuenow":M,"aria-disabled":f},B))]})]})});Yh.displayName="Slider";var H5=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),U5="VisuallyHidden",eu=ee.forwardRef((t,e)=>jsx(fe.span,{...t,ref:e,style:{...H5,...t.style}}));eu.displayName=U5;var tg="ToastProvider",[ng,V5,K5]=gs("Toast"),[Bk,Lee]=Ut("Toast",[K5]),[W5,nu]=Bk(tg);var Fk="ToastViewport",q5=["F8"],Jh="toast.viewportPause",Zh="toast.viewportResume",zk=ee.forwardRef((t,e)=>{let{__scopeToast:n,hotkey:r=q5,label:o="Notifications ({hotkey})",...i}=t,s=nu(Fk,n),a=V5(n),l=ee.useRef(null),c=ee.useRef(null),d=ee.useRef(null),u=ee.useRef(null),f=Le(e,u,s.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=s.toastCount>0;ee.useEffect(()=>{let g=b=>{r.length!==0&&r.every(v=>b[v]||b.code===v)&&u.current?.focus();};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]),ee.useEffect(()=>{let g=l.current,b=u.current;if(m&&g&&b){let y=()=>{if(!s.isClosePausedRef.current){let C=new CustomEvent(Jh);b.dispatchEvent(C),s.isClosePausedRef.current=!0;}},v=()=>{if(s.isClosePausedRef.current){let C=new CustomEvent(Zh);b.dispatchEvent(C),s.isClosePausedRef.current=!1;}},x=C=>{!g.contains(C.relatedTarget)&&v();},E=()=>{g.contains(document.activeElement)||v();};return g.addEventListener("focusin",y),g.addEventListener("focusout",x),g.addEventListener("pointermove",y),g.addEventListener("pointerleave",E),window.addEventListener("blur",y),window.addEventListener("focus",v),()=>{g.removeEventListener("focusin",y),g.removeEventListener("focusout",x),g.removeEventListener("pointermove",y),g.removeEventListener("pointerleave",E),window.removeEventListener("blur",y),window.removeEventListener("focus",v);}}},[m,s.isClosePausedRef]);let h=ee.useCallback(({tabbingDirection:g})=>{let y=a().map(v=>{let x=v.ref.current,E=[x,...s4(x)];return g==="forwards"?E:E.reverse()});return (g==="forwards"?y.reverse():y).flat()},[a]);return ee.useEffect(()=>{let g=u.current;if(g){let b=y=>{let v=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!v){let E=document.activeElement,C=y.shiftKey;if(y.target===g&&C){c.current?.focus();return}let N=h({tabbingDirection:C?"backwards":"forwards"}),M=N.findIndex(B=>B===E);Xh(N.slice(M+1))?y.preventDefault():C?c.current?.focus():d.current?.focus();}};return g.addEventListener("keydown",b),()=>g.removeEventListener("keydown",b)}},[a,h]),jsxs(av,{ref:l,role:"region","aria-label":o.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:m?void 0:"none"},children:[m&&jsx(Qh,{ref:c,onFocusFromOutsideViewport:()=>{let g=h({tabbingDirection:"forwards"});Xh(g);}}),jsx(ng.Slot,{scope:n,children:jsx(fe.ol,{tabIndex:-1,...i,ref:f})}),m&&jsx(Qh,{ref:d,onFocusFromOutsideViewport:()=>{let g=h({tabbingDirection:"backwards"});Xh(g);}})]})});zk.displayName=Fk;var Hk="ToastFocusProxy",Qh=ee.forwardRef((t,e)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=t,i=nu(Hk,n);return jsx(eu,{"aria-hidden":!0,tabIndex:0,...o,ref:e,style:{position:"fixed"},onFocus:s=>{let a=s.relatedTarget;!i.viewport?.contains(a)&&r();}})});Qh.displayName=Hk;var Ja="Toast",j5="toast.swipeStart",Y5="toast.swipeMove",X5="toast.swipeCancel",J5="toast.swipeEnd",Uk=ee.forwardRef((t,e)=>{let{forceMount:n,open:r,defaultOpen:o,onOpenChange:i,...s}=t,[a,l]=Qn({prop:r,defaultProp:o??!0,onChange:i,caller:Ja});return jsx(Jt,{present:n||a,children:jsx(e4,{open:a,...s,ref:e,onClose:()=>l(!1),onPause:pt(t.onPause),onResume:pt(t.onResume),onSwipeStart:J(t.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start");}),onSwipeMove:J(t.onSwipeMove,c=>{let{x:d,y:u}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`);}),onSwipeCancel:J(t.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");}),onSwipeEnd:J(t.onSwipeEnd,c=>{let{x:d,y:u}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1);})})})});Uk.displayName=Ja;var[Z5,Q5]=Bk(Ja,{onClose(){}}),e4=ee.forwardRef((t,e)=>{let{__scopeToast:n,type:r="foreground",duration:o,open:i,onClose:s,onEscapeKeyDown:a,onPause:l,onResume:c,onSwipeStart:d,onSwipeMove:u,onSwipeCancel:f,onSwipeEnd:p,...m}=t,h=nu(Ja,n),[g,b]=ee.useState(null),y=Le(e,P=>b(P)),v=ee.useRef(null),x=ee.useRef(null),E=o||h.duration,C=ee.useRef(0),T=ee.useRef(E),w=ee.useRef(0),{onToastAdd:N,onToastRemove:M}=h,B=pt(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),s();}),U=ee.useCallback(P=>{!P||P===1/0||(window.clearTimeout(w.current),C.current=new Date().getTime(),w.current=window.setTimeout(B,P));},[B]);ee.useEffect(()=>{let P=h.viewport;if(P){let V=()=>{U(T.current),c?.();},R=()=>{let k=new Date().getTime()-C.current;T.current=T.current-k,window.clearTimeout(w.current),l?.();};return P.addEventListener(Jh,R),P.addEventListener(Zh,V),()=>{P.removeEventListener(Jh,R),P.removeEventListener(Zh,V);}}},[h.viewport,E,l,c,U]),ee.useEffect(()=>{i&&!h.isClosePausedRef.current&&U(E);},[i,E,h.isClosePausedRef,U]),ee.useEffect(()=>(N(),()=>M()),[N,M]);let K=ee.useMemo(()=>g?Yk(g):null,[g]);return h.viewport?jsxs(Fragment$1,{children:[K&&jsx(t4,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:K}),jsx(Z5,{scope:n,onClose:B,children:Dg.createPortal(jsx(ng.ItemSlot,{scope:n,children:jsx(sv,{asChild:!0,onEscapeKeyDown:J(a,()=>{h.isFocusedToastEscapeKeyDownRef.current||B(),h.isFocusedToastEscapeKeyDownRef.current=!1;}),children:jsx(fe.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":h.swipeDirection,...m,ref:y,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:J(t.onKeyDown,P=>{P.key==="Escape"&&(a?.(P.nativeEvent),P.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,B()));}),onPointerDown:J(t.onPointerDown,P=>{P.button===0&&(v.current={x:P.clientX,y:P.clientY});}),onPointerMove:J(t.onPointerMove,P=>{if(!v.current)return;let V=P.clientX-v.current.x,R=P.clientY-v.current.y,k=!!x.current,_=["left","right"].includes(h.swipeDirection),A=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,L=_?A(0,V):0,Y=_?0:A(0,R),te=P.pointerType==="touch"?10:2,Se={x:L,y:Y},he={originalEvent:P,delta:Se};k?(x.current=Se,tu(Y5,u,he,{discrete:!1})):Ik(Se,h.swipeDirection,te)?(x.current=Se,tu(j5,d,he,{discrete:!1}),P.target.setPointerCapture(P.pointerId)):(Math.abs(V)>te||Math.abs(R)>te)&&(v.current=null);}),onPointerUp:J(t.onPointerUp,P=>{let V=x.current,R=P.target;if(R.hasPointerCapture(P.pointerId)&&R.releasePointerCapture(P.pointerId),x.current=null,v.current=null,V){let k=P.currentTarget,_={originalEvent:P,delta:V};Ik(V,h.swipeDirection,h.swipeThreshold)?tu(J5,p,_,{discrete:!0}):tu(X5,f,_,{discrete:!0}),k.addEventListener("click",A=>A.preventDefault(),{once:!0});}})})})}),h.viewport)})]}):null}),t4=t=>{let{__scopeToast:e,children:n,...r}=t,o=nu(Ja,e),[i,s]=ee.useState(!1),[a,l]=ee.useState(!1);return o4(()=>s(!0)),ee.useEffect(()=>{let c=window.setTimeout(()=>l(!0),1e3);return ()=>window.clearTimeout(c)},[]),a?null:jsx(Tr,{asChild:!0,children:jsx(eu,{...r,children:i&&jsxs(Fragment$1,{children:[o.label," ",n]})})})},n4="ToastTitle",Vk=ee.forwardRef((t,e)=>{let{__scopeToast:n,...r}=t;return jsx(fe.div,{...r,ref:e})});Vk.displayName=n4;var r4="ToastDescription",Kk=ee.forwardRef((t,e)=>{let{__scopeToast:n,...r}=t;return jsx(fe.div,{...r,ref:e})});Kk.displayName=r4;var Wk="ToastAction",Gk=ee.forwardRef((t,e)=>{let{altText:n,...r}=t;return n.trim()?jsx(jk,{altText:n,asChild:!0,children:jsx(rg,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${Wk}\`. Expected non-empty \`string\`.`),null)});Gk.displayName=Wk;var qk="ToastClose",rg=ee.forwardRef((t,e)=>{let{__scopeToast:n,...r}=t,o=Q5(qk,n);return jsx(jk,{asChild:!0,children:jsx(fe.button,{type:"button",...r,ref:e,onClick:J(t.onClick,o.onClose)})})});rg.displayName=qk;var jk=ee.forwardRef((t,e)=>{let{__scopeToast:n,altText:r,...o}=t;return jsx(fe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:e})});function Yk(t){let e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),i4(r)){let o=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!o)if(i){let s=r.dataset.radixToastAnnounceAlt;s&&e.push(s);}else e.push(...Yk(r));}}),e}function tu(t,e,n,{discrete:r}){let o=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?xi(o,i):o.dispatchEvent(i);}var Ik=(t,e,n=0)=>{let r=Math.abs(t.x),o=Math.abs(t.y),i=r>o;return e==="left"||e==="right"?i&&r>n:!i&&o>n};function o4(t=()=>{}){let e=pt(t);Vt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r);}},[e]);}function i4(t){return t.nodeType===t.ELEMENT_NODE}function s4(t){let e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{let o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Xh(t){let e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var og=zk,ig=Uk,sg=Vk,ag=Kk,lg=Gk,cg=rg;var d4=ee.forwardRef(({className:t,...e},n)=>jsx(og,{ref:n,className:I("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));d4.displayName=og.displayName;var u4=cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-8 shadow-sm transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground",success:"border-green-200 bg-green-50 text-green-900 dark:border-green-800 dark:bg-green-900/20 dark:text-green-100",warning:"border-orange-200 bg-orange-50 text-orange-900 dark:border-orange-800 dark:bg-orange-900/20 dark:text-orange-100",info:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-900/20 dark:text-blue-100"}},defaultVariants:{variant:"default"}}),f4=ee.forwardRef(({className:t,variant:e,...n},r)=>jsx(ig,{ref:r,className:I(u4({variant:e}),t),...n}));f4.displayName=ig.displayName;var p4=ee.forwardRef(({className:t,...e},n)=>jsx(lg,{ref:n,className:I("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));p4.displayName=lg.displayName;var m4=ee.forwardRef(({className:t,...e},n)=>jsx(cg,{ref:n,className:I("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:jsx(X$1,{className:"h-4 w-4"})}));m4.displayName=cg.displayName;var h4=ee.forwardRef(({className:t,...e},n)=>jsx(sg,{ref:n,className:I("text-sm font-semibold [&+div]:text-xs",t),...e}));h4.displayName=sg.displayName;var g4=ee.forwardRef(({className:t,...e},n)=>jsx(ag,{ref:n,className:I("text-sm opacity-90",t),...e}));g4.displayName=ag.displayName;var b4=5,y4=1e6,dg=new Map,Xk=t=>{if(dg.has(t))return;let e=setTimeout(()=>{dg.delete(t),ru({type:"REMOVE_TOAST",toastId:t});},y4);dg.set(t,e);},v4=(t,e)=>{switch(e.type){case"ADD_TOAST":return {...t,toasts:[e.toast,...t.toasts].slice(0,b4)};case"UPDATE_TOAST":return {...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{let{toastId:n}=e;return n?Xk(n):t.toasts.forEach(r=>{Xk(r.id);}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},w4=[],ug={toasts:[]},x4=0;function ru(t){ug=v4(ug,t),w4.forEach(e=>{e(ug);});}function Gr({...t}){let e=`toast-${Date.now()}-${++x4}`,n=o=>ru({type:"UPDATE_TOAST",toast:{...o,id:e}}),r=()=>ru({type:"DISMISS_TOAST",toastId:e});return ru({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:o=>{o||r();}}}),{id:e,dismiss:r,update:n}}function Za(t,{insertAt:e}={}){if(!t||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t));}Za(`.slash-commands-menu{border-radius:var(--radius);border-width:1px;--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.slash-commands-menu:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.slash-commands-menu{max-height:20rem;min-width:280px;overflow-y:auto;padding:.5rem}.slash-command-item{display:flex;cursor:pointer;align-items:center;gap:.75rem;border-radius:calc(var(--radius) - 2px);padding:.5rem .75rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.slash-command-item:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.slash-command-item:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.slash-command-item.selected{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.slash-command-item.selected:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.slash-command-item svg{height:1rem;width:1rem;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.slash-command-item svg:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.slash-command-item>div{flex:1 1 0%}.slash-command-item .command-name{font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.slash-command-item .command-name:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.slash-command-item .command-description{margin-top:.125rem;font-size:.75rem;line-height:1rem;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.slash-command-item .command-description:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark .slash-commands-menu{box-shadow:0 10px 15px -3px #0000004d,0 4px 6px -2px #0003}
|
|
165
|
+
`);Za(`.ProseMirror table{border-collapse:collapse;margin:0;overflow:hidden;table-layout:fixed;width:100%;border:1px solid #d1d5db}.ProseMirror table td,.ProseMirror table th{border:1px solid #d1d5db;box-sizing:border-box;min-width:1em;padding:6px 8px;position:relative;vertical-align:top}.ProseMirror table th{background-color:#f9fafb;font-weight:600;text-align:left}.ProseMirror table .selectedCell:after{background-color:#3b82f61a;content:"";inset:0;pointer-events:none;position:absolute;z-index:2}.ProseMirror table .column-resize-handle{background-color:#3b82f6;bottom:-2px;position:absolute;right:-2px;top:0;width:4px;pointer-events:none}.dark .ProseMirror table,.dark .ProseMirror table td,.dark .ProseMirror table th{border:1px solid #374151}.dark .ProseMirror table th{background-color:#111827}.dark .ProseMirror table .selectedCell:after{background-color:#3b82f633}
|
|
166
|
+
`);var E4=mh(fh),tH=t=>({generateText:async e=>"AI functionality requires proper API configuration"}),tN=({onColorSelect:t,currentColor:e="#000000"})=>jsx(Fi,{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"]}),vt=({active:t,disabled:e,onClick:n,children:r,tooltip:o})=>{let i=jsx("button",{type:"button",onClick:n,disabled:e,className:I("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 o?jsxs(Uh,{children:[jsx(Vh,{asChild:!0,children:i}),jsx(Xd,{children:jsx("p",{children:o})})]}):i};function Dte({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:o={provider:"openai",apiKey:"",model:"gpt-4",temperature:.7,maxTokens:1e3}}){let i={hasAccess:!0},{hasProAccess:s,isLoading:a}=wi();if(!i.isDocsMode&&!a&&!s)return jsx(vr,{className:I("w-full",e),children:jsx(wr,{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(xe,{size:"sm",children:[jsx(Sparkles,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})})})]})]})})});let[c,d]=useState({provider:o.provider||"openai",apiKey:o.apiKey||"",model:o.model||"gpt-4",temperature:o.temperature||.7,maxTokens:o.maxTokens||1e3}),[u,f]=useState(!1),[p,m]=useState(!1),[h,g]=useState(!1),[b,y]=useState(""),[v,x]=useState("#000000"),[E,C]=useState("#ffffff"),T=[{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 D=>{let ne=await N("rewrite",D);return {text:ne||"",error:ne?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 D=>{let ne=await N("expand",D);return {text:ne||"",error:ne?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 D=>{let ne=await N("summarize",D);return {text:ne||"",error:ne?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 D=>{let ne=await N("continue",D);return {text:ne||"",error:ne?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 D=>{let ne=await N("improve",D);return {text:ne||"",error:ne?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 D=>{let ne=await N("fix",D);return {text:ne||"",error:ne?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 D=>{let ne=await N("translate",D);return {text:ne||"",error:ne?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 D=>{let ne=await N("ideas",D);return {text:ne||"",error:ne?void 0:"Failed to generate ideas"}}}],w=_E({extensions:[CS.configure({heading:{levels:[1,2,3]},codeBlock:!1}),RS.configure({placeholder:t}),TS.configure({types:["heading","paragraph"]}),kS.configure({multicolor:!0}),eS.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),NS.configure({inline:!0,allowBase64:!0}),Qm.configure({resizable:!0}),iC,aC,sC,eh,lC,pS,cC,dC,uC.configure({nested:!0}),fC,$C.configure({lowlight:E4}),KR.configure({commands:T,onSelectCommand:async D=>{if(!w)return;let{from:ne,to:ce}=w.state.selection,re=w.state.doc.textBetween(ne,ce," ");m(!0);try{let $t=await D.action(re||w.getText());$t.text?w.chain().focus().insertContent($t.text).run():$t.error&&Gr({title:"AI Error",description:$t.error,variant:"destructive"});}catch{Gr({title:"Error",description:"Failed to execute command",variant:"destructive"});}finally{m(!1);}}})],content:"",editorProps:{attributes:{class:I("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}),N=async(D,ne)=>{if(!c.apiKey)return Gr({title:"API Key Required",description:"Please configure your AI settings first.",variant:"destructive"}),f(!0),null;m(!0);try{let ce=tH(c),re;switch(D){case"rewrite":re=await ce.rewrite(ne);break;case"expand":re=await ce.expand(ne);break;case"summarize":re=await ce.summarize(ne);break;case"fix":re=await ce.fixGrammar(ne);break;case"translate":re=await ce.translate(ne,"Turkish");break;case"tone_professional":re=await ce.changeTone(ne,"professional");break;case"tone_casual":re=await ce.changeTone(ne,"casual");break;case"tone_friendly":re=await ce.changeTone(ne,"friendly");break;case"tone_formal":re=await ce.changeTone(ne,"formal");break;case"continue":re=await ce.continueWriting(ne);break;case"improve":re=await ce.improveWriting(ne);break;case"ideas":re=await ce.generateIdeas(ne,5);break;default:re=await ce.complete(D,ne);}return re.error?(Gr({title:"AI Error",description:re.error,variant:"destructive"}),null):re.text}catch{return Gr({title:"AI Error",description:"Failed to process with AI. Please check your settings.",variant:"destructive"}),null}finally{m(!1);}},M=async D=>{if(!w)return;let ne=w.state.selection,ce=w.state.doc.textBetween(ne.from,ne.to," ");if(!ce&&D!=="complete"){Gr({title:"No text selected",description:"Please select some text first.",variant:"destructive"});return}let re=await N(D,ce||w.getText());re&&(ce?w.chain().focus().deleteSelection().insertContent(re).run():w.chain().focus().insertContent(re).run());},[B,U]=useState(""),[K,P]=useState(""),[V,R]=useState(!1),[k,_]=useState(!1),[A,L]=useState(!1),[Y,te]=useState(3),[Se,he]=useState(3),[ke,Ae]=useState(!1),[W,ue]=useState(1),[Oe,Ce]=useState("#000000"),[le,Re]=useState("solid"),$e=()=>{K&&w&&(w.chain().focus().setImage({src:K}).run(),P(""),_(!1));},Ke=()=>{B&&w&&(w.state.selection.empty?w.chain().focus().insertContent(`<a href="${B}">${B}</a>`).run():w.chain().focus().extendMarkRange("link").setLink({href:B}).run(),U(""),R(!1));},rt=()=>{w?.chain().focus().unsetLink().run();},Te=()=>{w&&Y>0&&Se>0&&(w.chain().focus().insertTable({rows:Y,cols:Se,withHeaderRow:!0}).run(),setTimeout(()=>{wt(W,Oe,le);},100),L(!1));},wt=(D,ne,ce)=>{if(!w)return;let re=`${D}px ${ce} ${ne}`;w.view.dom.querySelectorAll(".ProseMirror table").forEach($t=>{$t instanceof HTMLElement&&($t.style.borderCollapse="collapse",$t.style.border=re,$t.querySelectorAll("td, th").forEach(mn=>{mn instanceof HTMLElement&&(mn.style.border=re,mn.style.padding="8px");}));});};return w?jsxs("div",{className:I("border rounded-lg overflow-hidden bg-white dark:bg-gray-950",e),children:[jsx(vk,{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(vt,{active:w.isActive("bold"),onClick:()=>w.chain().focus().toggleBold().run(),tooltip:"Bold (Cmd+B)",disabled:h,children:jsx(Bold,{className:"w-4 h-4"})}),r.italic&&jsx(vt,{active:w.isActive("italic"),onClick:()=>w.chain().focus().toggleItalic().run(),tooltip:"Italic (Cmd+I)",disabled:h,children:jsx(Italic,{className:"w-4 h-4"})}),r.underline&&jsx(vt,{active:w.isActive("underline"),onClick:()=>w.chain().focus().toggleUnderline().run(),tooltip:"Underline (Cmd+U)",disabled:h,children:jsx(Underline,{className:"w-4 h-4"})}),r.strike&&jsx(vt,{active:w.isActive("strike"),onClick:()=>w.chain().focus().toggleStrike().run(),tooltip:"Strikethrough",disabled:h,children:jsx(Strikethrough,{className:"w-4 h-4"})}),r.code&&jsx(vt,{active:w.isActive("code"),onClick:()=>w.chain().focus().toggleCode().run(),tooltip:"Inline code",disabled:h,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(Gd,{children:[jsx(qd,{asChild:!0,children:jsxs(xe,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:h,children:[jsx(Type,{className:"w-4 h-4 mr-1"}),jsx(ChevronDown,{className:"w-3 h-3"})]})}),jsxs(qa,{children:[jsx(Ve,{onClick:()=>w.chain().focus().setParagraph().run(),children:"Paragraph"}),jsxs(Ve,{onClick:()=>w.chain().focus().toggleHeading({level:1}).run(),children:[jsx(Heading1,{className:"w-4 h-4 mr-2"})," Heading 1"]}),jsxs(Ve,{onClick:()=>w.chain().focus().toggleHeading({level:2}).run(),children:[jsx(Heading2,{className:"w-4 h-4 mr-2"})," Heading 2"]}),jsxs(Ve,{onClick:()=>w.chain().focus().toggleHeading({level:3}).run(),children:[jsx(Heading3,{className:"w-4 h-4 mr-2"})," Heading 3"]})]})]}),r.align&&jsxs(Fragment$1,{children:[jsx(vt,{active:w.isActive({textAlign:"left"}),onClick:()=>w.chain().focus().setTextAlign("left").run(),tooltip:"Align left",disabled:h,children:jsx(AlignLeft,{className:"w-4 h-4"})}),jsx(vt,{active:w.isActive({textAlign:"center"}),onClick:()=>w.chain().focus().setTextAlign("center").run(),tooltip:"Align center",disabled:h,children:jsx(AlignCenter,{className:"w-4 h-4"})}),jsx(vt,{active:w.isActive({textAlign:"right"}),onClick:()=>w.chain().focus().setTextAlign("right").run(),tooltip:"Align right",disabled:h,children:jsx(AlignRight,{className:"w-4 h-4"})}),jsx(vt,{active:w.isActive({textAlign:"justify"}),onClick:()=>w.chain().focus().setTextAlign("justify").run(),tooltip:"Justify",disabled:h,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$1,{children:[jsx(vt,{active:w.isActive("bulletList"),onClick:()=>w.chain().focus().toggleBulletList().run(),tooltip:"Bullet list",disabled:h,children:jsx(List,{className:"w-4 h-4"})}),jsx(vt,{active:w.isActive("orderedList"),onClick:()=>w.chain().focus().toggleOrderedList().run(),tooltip:"Numbered list",disabled:h,children:jsx(ListOrdered,{className:"w-4 h-4"})}),jsx(vt,{active:w.isActive("taskList"),onClick:()=>w.chain().focus().toggleTaskList().run(),tooltip:"Task list",disabled:h,children:jsx(CheckSquare,{className:"w-4 h-4"})})]}),r.blockquote&&jsx(vt,{active:w.isActive("blockquote"),onClick:()=>w.chain().focus().toggleBlockquote().run(),tooltip:"Quote",disabled:h,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(Gh,{children:[jsx(qh,{asChild:!0,children:jsx(xe,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:h,title:"Text Color",children:jsx(Palette,{className:"w-4 h-4"})})}),jsx(Zd,{className:"w-auto p-0",children:jsx(tN,{currentColor:v,onColorSelect:D=>{x(D),w.chain().focus().setColor(D).run();}})})]}),jsxs(Gh,{children:[jsx(qh,{asChild:!0,children:jsx(xe,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:h,title:"Background Color",children:jsx(Highlighter,{className:"w-4 h-4"})})}),jsx(Zd,{className:"w-auto p-0",children:jsx(tN,{currentColor:E,onColorSelect:D=>{C(D),w.chain().focus().toggleHighlight({color:D}).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(to,{open:V,onOpenChange:R,children:[jsx(Gs,{asChild:!0,children:jsx(vt,{active:w.isActive("link"),tooltip:"Add link",disabled:h,children:jsx(Link2,{className:"w-4 h-4"})})}),jsxs(kr,{className:"sm:max-w-[425px]",children:[jsxs(er,{children:[jsx(tr,{children:"Add Link"}),jsx(nr,{children:"Enter the URL for the link."})]}),jsx("div",{className:"grid gap-4 py-4",children:jsxs("div",{className:"grid gap-2",children:[jsx(He,{htmlFor:"url",children:"URL"}),jsx(Ft,{id:"url",value:B,onChange:D=>U(D.target.value),placeholder:"https://example.com",onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),Ke());}})]})}),jsxs("div",{className:"flex justify-between",children:[w.isActive("link")&&jsx(xe,{variant:"destructive",onClick:()=>{rt(),R(!1);},children:"Remove Link"}),jsxs("div",{className:"ml-auto flex gap-2",children:[jsx(xe,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),jsx(xe,{onClick:Ke,children:"Add Link"})]})]})]})]}),r.image&&jsxs(to,{open:k,onOpenChange:_,children:[jsx(Gs,{asChild:!0,children:jsx(vt,{tooltip:"Add image",disabled:h,children:jsx(Image,{className:"w-4 h-4"})})}),jsxs(kr,{className:"sm:max-w-[425px]",children:[jsxs(er,{children:[jsx(tr,{children:"Add Image"}),jsx(nr,{children:"Enter the URL for the image."})]}),jsx("div",{className:"grid gap-4 py-4",children:jsxs("div",{className:"grid gap-2",children:[jsx(He,{htmlFor:"image-url",children:"Image URL"}),jsx(Ft,{id:"image-url",value:K,onChange:D=>P(D.target.value),placeholder:"https://example.com/image.jpg",onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),$e());}})]})}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(xe,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),jsx(xe,{onClick:$e,children:"Add Image"})]})]})]}),r.table&&jsxs(Fragment$1,{children:[jsxs(to,{open:A,onOpenChange:L,children:[jsx(Gs,{asChild:!0,children:jsx(vt,{tooltip:"Create table",disabled:h,children:jsx(Table,{className:"w-4 h-4"})})}),jsxs(kr,{className:"sm:max-w-[425px]",children:[jsxs(er,{children:[jsx(tr,{children:"Create Table"}),jsx(nr,{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(He,{htmlFor:"rows",children:"Rows"}),jsx(Ft,{id:"rows",type:"number",min:"1",max:"20",value:Y,onChange:D=>te(parseInt(D.target.value)||3)})]}),jsxs("div",{className:"grid gap-2",children:[jsx(He,{htmlFor:"cols",children:"Columns"}),jsx(Ft,{id:"cols",type:"number",min:"1",max:"10",value:Se,onChange:D=>he(parseInt(D.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(He,{htmlFor:"headerRow",className:"text-sm font-normal",children:"Include header row"})]})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(xe,{variant:"outline",onClick:()=>L(!1),children:"Cancel"}),jsx(xe,{onClick:Te,children:"Create Table"})]})]})]}),jsxs(Gd,{children:[jsx(qd,{asChild:!0,children:jsx(xe,{variant:"ghost",size:"sm",className:"h-8 px-1",children:jsx(ChevronDown,{className:"w-3 h-3"})})}),jsxs(qa,{children:[jsx(Ve,{onClick:()=>w.chain().focus().addColumnBefore().run(),children:"Add column before"}),jsx(Ve,{onClick:()=>w.chain().focus().addColumnAfter().run(),children:"Add column after"}),jsx(Ve,{onClick:()=>w.chain().focus().deleteColumn().run(),children:"Delete column"}),jsx(vo,{}),jsx(Ve,{onClick:()=>w.chain().focus().addRowBefore().run(),children:"Add row before"}),jsx(Ve,{onClick:()=>w.chain().focus().addRowAfter().run(),children:"Add row after"}),jsx(Ve,{onClick:()=>w.chain().focus().deleteRow().run(),children:"Delete row"}),jsx(vo,{}),jsxs(Ve,{onClick:()=>Ae(!0),children:[jsx(Settings,{className:"w-4 h-4 mr-2"}),"Table Borders"]}),jsx(vo,{}),jsx(Ve,{onClick:()=>w.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(vt,{onClick:()=>w.chain().focus().undo().run(),disabled:!w.can().undo()||h,tooltip:"Undo (Cmd+Z)",children:jsx(Undo,{className:"w-4 h-4"})}),jsx(vt,{onClick:()=>w.chain().focus().redo().run(),disabled:!w.can().redo()||h,tooltip:"Redo (Cmd+Shift+Z)",children:jsx(Redo,{className:"w-4 h-4"})}),jsx(vt,{active:h,onClick:()=>{h?w.commands.setContent(b):y(w.getHTML()),g(!h);},tooltip:h?"Visual Mode":"Source Code",children:h?jsx(Edit,{className:"w-4 h-4"}):jsx(Eye,{className:"w-4 h-4"})}),r.ai&&jsxs(Fragment$1,{children:[jsxs(Gd,{children:[jsx(qd,{asChild:!0,children:jsxs(xe,{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(qa,{className:"w-56",children:[jsxs(Ve,{onClick:()=>M("rewrite"),children:[jsx(RefreshCw,{className:"w-4 h-4 mr-2"}),"Rewrite Selection"]}),jsxs(Ve,{onClick:()=>M("improve"),children:[jsx(Wand2,{className:"w-4 h-4 mr-2"}),"Improve Writing"]}),jsxs(Ve,{onClick:()=>M("expand"),children:[jsx(Maximize,{className:"w-4 h-4 mr-2"}),"Expand Text"]}),jsxs(Ve,{onClick:()=>M("summarize"),children:[jsx(FileText,{className:"w-4 h-4 mr-2"}),"Summarize"]}),jsxs(Ve,{onClick:()=>M("continue"),children:[jsx(Plus,{className:"w-4 h-4 mr-2"}),"Continue Writing"]}),jsx(vo,{}),jsxs(Ve,{onClick:()=>M("fix"),children:[jsx(Check,{className:"w-4 h-4 mr-2"}),"Fix Grammar & Spelling"]}),jsx(vo,{}),jsxs(Ve,{onClick:()=>M("tone_professional"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Professional"]}),jsxs(Ve,{onClick:()=>M("tone_casual"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Casual"]}),jsxs(Ve,{onClick:()=>M("tone_friendly"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Friendly"]}),jsxs(Ve,{onClick:()=>M("tone_formal"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Make Formal"]}),jsx(vo,{}),jsxs(Ve,{onClick:()=>M("translate"),children:[jsx(Languages,{className:"w-4 h-4 mr-2"}),"Translate to Turkish"]}),jsxs(Ve,{onClick:()=>M("ideas"),children:[jsx(Sparkles,{className:"w-4 h-4 mr-2"}),"Generate Ideas"]})]})]}),jsxs(to,{open:u,onOpenChange:f,children:[jsx(Gs,{asChild:!0,children:jsx(vt,{tooltip:"AI Settings - Configure your API keys here",disabled:h,children:jsx(Settings,{className:"w-4 h-4"})})}),jsxs(kr,{className:"sm:max-w-[425px]",children:[jsxs(er,{children:[jsx(tr,{children:"AI Settings"}),jsx(nr,{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(He,{htmlFor:"provider",children:"Provider"}),jsxs($o,{value:c.provider,onValueChange:D=>d({...c,provider:D}),children:[jsx(Bo,{children:jsx(Di,{})}),jsxs(Fo,{children:[jsx(Ge,{value:"openai",children:"OpenAI"}),jsx(Ge,{value:"claude",children:"Claude (Anthropic)"}),jsx(Ge,{value:"gemini",children:"Gemini (Google)"}),jsx(Ge,{value:"cohere",children:"Cohere"})]})]})]}),jsxs("div",{className:"grid gap-2",children:[jsx(He,{htmlFor:"apiKey",children:"API Key"}),jsx(Ft,{id:"apiKey",type:"password",value:c.apiKey,onChange:D=>d({...c,apiKey:D.target.value}),placeholder:"sk-..."})]}),jsxs("div",{className:"grid gap-2",children:[jsx(He,{htmlFor:"model",children:"Model"}),jsxs($o,{value:c.model,onValueChange:D=>d({...c,model:D}),children:[jsx(Bo,{children:jsx(Di,{})}),jsxs(Fo,{children:[c.provider==="openai"&&jsxs(Fragment$1,{children:[jsx(Ge,{value:"gpt-4",children:"GPT-4"}),jsx(Ge,{value:"gpt-3.5-turbo",children:"GPT-3.5 Turbo"})]}),c.provider==="claude"&&jsxs(Fragment$1,{children:[jsx(Ge,{value:"claude-3-opus",children:"Claude 3 Opus"}),jsx(Ge,{value:"claude-3-sonnet",children:"Claude 3 Sonnet"}),jsx(Ge,{value:"claude-3-haiku",children:"Claude 3 Haiku"})]}),c.provider==="gemini"&&jsxs(Fragment$1,{children:[jsx(Ge,{value:"gemini-pro",children:"Gemini Pro"}),jsx(Ge,{value:"gemini-pro-vision",children:"Gemini Pro Vision"})]}),c.provider==="cohere"&&jsxs(Fragment$1,{children:[jsx(Ge,{value:"command",children:"Command"}),jsx(Ge,{value:"command-light",children:"Command Light"})]})]})]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"grid gap-2",children:[jsx(He,{htmlFor:"temperature",children:"Temperature"}),jsx(Ft,{id:"temperature",type:"number",min:"0",max:"2",step:"0.1",value:c.temperature,onChange:D=>d({...c,temperature:parseFloat(D.target.value)})})]}),jsxs("div",{className:"grid gap-2",children:[jsx(He,{htmlFor:"maxTokens",children:"Max Tokens"}),jsx(Ft,{id:"maxTokens",type:"number",min:"1",max:"4000",value:c.maxTokens,onChange:D=>d({...c,maxTokens:parseInt(D.target.value)})})]})]})]}),jsx("div",{className:"flex justify-end",children:jsx(xe,{onClick:()=>{f(!1),Gr({title:"Settings saved",description:"Your AI settings have been updated."});},children:"Save Settings"})})]})]})]})]})]})})}),jsx(to,{open:ke,onOpenChange:Ae,children:jsxs(kr,{className:"sm:max-w-[425px]",children:[jsxs(er,{children:[jsx(tr,{children:"Table Border Settings"}),jsx(nr,{children:"Customize the appearance of table borders."})]}),jsxs("div",{className:"grid gap-6 py-4",children:[jsxs("div",{className:"grid gap-3",children:[jsx(He,{htmlFor:"border-width",children:"Border Width"}),jsxs("div",{className:"flex items-center gap-4",children:[jsx(Yh,{id:"border-width",min:0,max:5,step:1,value:[W],onValueChange:D=>ue(D[0]),className:"flex-1"}),jsxs("span",{className:"text-sm font-medium w-8",children:[W,"px"]})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(He,{htmlFor:"border-color",children:"Border Color"}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Fi,{value:Oe,onChange:Ce,showInput:!0,showPresets:!1,size:"sm"}),jsx("span",{className:"text-sm text-muted-foreground",children:Oe})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(He,{htmlFor:"border-style",children:"Border Style"}),jsxs($o,{value:le,onValueChange:Re,children:[jsx(Bo,{children:jsx(Di,{})}),jsxs(Fo,{children:[jsx(Ge,{value:"solid",children:"Solid"}),jsx(Ge,{value:"dashed",children:"Dashed"}),jsx(Ge,{value:"dotted",children:"Dotted"}),jsx(Ge,{value:"double",children:"Double"}),jsx(Ge,{value:"groove",children:"Groove"}),jsx(Ge,{value:"ridge",children:"Ridge"}),jsx(Ge,{value:"inset",children:"Inset"}),jsx(Ge,{value:"outset",children:"Outset"})]})]})]}),jsxs("div",{className:"grid gap-3",children:[jsx(He,{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:`${W}px ${le} ${Oe}`},children:[jsx("thead",{children:jsxs("tr",{children:[jsx("th",{style:{border:`${W}px ${le} ${Oe}`,padding:"8px",textAlign:"left"},children:"Header 1"}),jsx("th",{style:{border:`${W}px ${le} ${Oe}`,padding:"8px",textAlign:"left"},children:"Header 2"})]})}),jsx("tbody",{children:jsxs("tr",{children:[jsx("td",{style:{border:`${W}px ${le} ${Oe}`,padding:"8px"},children:"Cell 1"}),jsx("td",{style:{border:`${W}px ${le} ${Oe}`,padding:"8px"},children:"Cell 2"})]})})]})})]})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx(xe,{variant:"outline",onClick:()=>Ae(!1),children:"Cancel"}),jsx(xe,{onClick:()=>{wt(W,Oe,le),Ae(!1),Gr({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:h?jsx("textarea",{value:b,onChange:D=>y(D.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(CE,{editor:w})})]}):null}var hg=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[o,i]of this.cache)i.timestamp<n&&(n=i.timestamp,e=o);break;case"lfu":let r=1/0;for(let[o,i]of this.cache)i.accessCount<r&&(r=i.accessCount,e=o);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 Bte({data:t,config:e={},renderItem:n,height:r=400,onMemoryUpdate:o,className:i}){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:m}=e,[h,g]=useState({start:0,end:Math.min(s,t.length)}),[b,y]=useState({memoryUsage:0,itemCount:0,cacheHitRate:.95}),v=useRef(null),x=useRef(new hg(Math.floor(a/s),l)),E=useRef(),C=useMemo(()=>{let w=h.start,N=Math.min(h.end,t.length),M=`${w}-${N}`,B=x.current.get(M);if(B&&B.length===N-w)return B;let U=t.slice(w,N);return x.current.set(M,U,c),U},[t,h,c]),T=useCallback(w=>{let N=w.currentTarget.scrollTop,M=w.currentTarget.clientHeight,B=60,U=Math.floor(N/B),K=Math.ceil(M/B),P=Math.floor(K*.5),V=Math.max(0,U-P),R=Math.min(t.length,U+K+P);E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{g({start:V,end:R});},16);},[t.length]);return useEffect(()=>{let w=x.current.getStats(),N={memoryUsage:C.length*1024,itemCount:C.length,cacheHitRate:w.hitRate,compressionRatio:c?.7:1,lastCleanup:Date.now()};y(N),p&&m&&m(N),o&&o(N);},[C,p,m,o,c]),useEffect(()=>{if(!d)return;let w=setInterval(()=>{C.length/a>u&&x.current.clear();},5e3);return ()=>clearInterval(w)},[d,u,a,C.length]),jsx("div",{ref:v,className:I("overflow-auto border rounded-lg bg-background",i),style:{height:r},onScroll:T,children:jsx("div",{style:{height:t.length*60,position:"relative"},children:jsx("div",{style:{transform:`translateY(${h.start*60}px)`,position:"absolute",width:"100%"},children:C.map((w,N)=>jsx(ee__default.Fragment,{children:n(w,h.start+N)},h.start+N))})})})}function Fte({onStatsUpdate:t,showRealTime:e=!1,className:n}){let[r,o]=useState({memoryUsage:0,itemCount:0,cacheHitRate:.95});return useEffect(()=>{if(!e)return;let i=setInterval(()=>{let s={memoryUsage:Math.random()*50*1024*1024,itemCount:Math.floor(Math.random()*5e4),cacheHitRate:.9+Math.random()*.1,lastCleanup:Date.now()};o(s),t&&t(s);},1e3);return ()=>clearInterval(i)},[e,t]),e?jsx("div",{className:I("text-xs text-muted-foreground",n),children:"Memory Analytics Active - Updates every second"}):null}function zte(t=[],e){let[n,r]=useState(t),{interval:o=1e3,maxItems:i=1e4}=e||{},s=useCallback(l=>{r(c=>{let d=[...c,l];return d.length>i?d.slice(-i):d});},[i]),a=useCallback(()=>{r([]);},[]);return {data:n,addItem:s,clearData:a}}function oH({items:t,height:e,itemHeight:n=50,estimatedItemHeight:r=50,variableHeight:o=!1,overscan:i=5,renderItem:s,onScroll:a,className:l}){let[c,d]=useState(0),[u,f]=useState(!1),[p,m]=useState(new Map),h=useRef(null),g=useRef(null),b=useRef(),y=useRef(),v=useMemo(()=>{let w=[],N=0;for(let M=0;M<t.length;M++){let B=o?p.get(M)||r:n;w.push({index:M,height:B,top:N}),N+=B;}return w},[t.length,n,r,o,p]),x=useMemo(()=>v.length>0?v[v.length-1].top+v[v.length-1].height:0,[v]),E=useMemo(()=>{let w=v.findIndex(U=>U.top+U.height>=c),N=v.findIndex(U=>U.top>c+e),M=Math.max(0,w-i),B=N===-1?Math.min(t.length-1,w+Math.ceil(e/n)+i):Math.min(t.length-1,N+i);return {start:M,end:B}},[c,e,v,i,t.length,n]),C=useMemo(()=>{let w=[];for(let N=E.start;N<=E.end;N++)if(N>=0&&N<t.length&&v[N]){let M=v[N];w.push({item:t[N],index:N,style:{position:"absolute",top:M.top,left:0,right:0,height:o?"auto":M.height,minHeight:o?M.height:void 0}});}return w},[t,E,v,o]),T=useCallback(w=>{let N=w.currentTarget.scrollTop;d(N),f(!0),a&&a(N),b.current&&clearTimeout(b.current),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{f(!1);},150);},[a]);return useEffect(()=>{if(!o||!h.current)return;let w=new ResizeObserver(M=>{let B=new Map(p),U=!1;M.forEach(K=>{let V=K.target.getAttribute("data-index");if(V){let R=parseInt(V,10),k=K.contentRect.height;B.get(R)!==k&&(B.set(R,k),U=!0);}}),U&&m(B);});return h.current.querySelectorAll("[data-index]").forEach(M=>w.observe(M)),()=>w.disconnect()},[o,p,C]),useEffect(()=>{let w=M=>{if(h.current)switch(M.key){case"ArrowUp":M.preventDefault(),g.current?.scrollBy({top:-n,behavior:"smooth"});break;case"ArrowDown":M.preventDefault(),g.current?.scrollBy({top:n,behavior:"smooth"});break;case"PageUp":M.preventDefault(),g.current?.scrollBy({top:-e,behavior:"smooth"});break;case"PageDown":M.preventDefault(),g.current?.scrollBy({top:e,behavior:"smooth"});break;case"Home":M.preventDefault(),g.current?.scrollTo({top:0,behavior:"smooth"});break;case"End":M.preventDefault(),g.current?.scrollTo({top:x,behavior:"smooth"});break}},N=h.current;if(N)return N.addEventListener("keydown",w),()=>N.removeEventListener("keydown",w)},[n,e,x]),jsxs("div",{ref:h,className:I("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:T,children:jsx("div",{style:{height:x,position:"relative"},children:C.map(({item:w,index:N,style:M})=>jsx("div",{"data-index":N,style:M,role:"option","aria-selected":"false",className:"outline-none",children:s(w,N)},N))})}),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(x-e,1)*100),"%"]})]})}function Gte(t,e={}){let[n,r]=useState(e),[o,i]=useState(new Set),s=useCallback(d=>{r(u=>({...u,...d}));},[]),a=useCallback(d=>{i(u=>new Set([...u,d]));},[]),l=useCallback(d=>{i(u=>{let f=new Set(u);return f.delete(d),f});},[]),c=useCallback(()=>{i(new Set);},[]);return {config:n,updateConfig:s,selectedItems:o,selectItem:a,deselectItem:l,clearSelection:c}}function qte({selectable:t=!1,multiSelect:e=!1,selectedItems:n=new Set,onSelectionChange:r,renderItem:o,...i}){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:I("transition-colors",t&&"cursor-pointer hover:bg-muted/50",d&&"bg-primary/10 border-l-4 border-primary"),onClick:()=>t&&s(c),children:o(l,c)})},[o,t,n,s]);return jsx(oH,{...i,renderItem:a})}var aH=ee__default.forwardRef(({children:t,onSwipeLeft:e,onSwipeRight:n,onSwipeStart:r,onSwipeEnd:o,threshold:i=100,disabled:s=!1,className:a,style:l,...c},d)=>{let u=useMotionValue(0),f=useTransform(u,[-200,200],[-30,30]),p=useTransform(u,[0,i],[0,1]),m=useTransform(u,[-i,0],[1,0]),h=()=>{s||r?.();},g=(b,y)=>{if(!s)if(o?.(),Math.abs(y.offset.x)>i){let v=y.offset.x>0?"right":"left",x=y.offset.x>0?400:-400;animate(u,x,{duration:.3}),v==="right"&&n?n():v==="left"&&e&&e();}else animate(u,0,{type:"spring",stiffness:300,damping:20});};return jsxs(motion.div,{ref:d,drag:s?!1:"x",dragConstraints:{left:-300,right:300},style:{x:u,rotate:f,...l},onDragStart:h,onDragEnd:g,className:I("relative cursor-grab active:cursor-grabbing select-none",s&&"cursor-default",a),...c,children:[jsx(motion.div,{style:{opacity:p},className:"absolute top-4 right-4 bg-green-500 text-white px-3 py-1 rounded-lg font-bold text-lg rotate-[15deg] pointer-events-none z-10",children:"LIKE"}),jsx(motion.div,{style:{opacity:m},className:"absolute top-4 left-4 bg-red-500 text-white px-3 py-1 rounded-lg font-bold text-lg rotate-[-15deg] pointer-events-none z-10",children:"NOPE"}),t]})});aH.displayName="SwipeableCard";function sne({items:t,onReorder:e,renderItem:n,keyExtractor:r,direction:o="vertical",className:i,droppableId:s="draggable-list",disabled:a=!1}){return jsx(DragDropContext,{onDragEnd:c=>{if(!c.destination||a)return;let d=c.source.index,u=c.destination.index;if(d===u)return;let f=Array.from(t),[p]=f.splice(d,1);f.splice(u,0,p),e(f);},children:jsx(Droppable,{droppableId:s,direction:o,isDropDisabled:a,children:(c,d)=>jsxs("div",{...c.droppableProps,ref:c.innerRef,className:I("space-y-2",o==="horizontal"&&"flex space-y-0 space-x-2",d.isDraggingOver&&"bg-muted/50 rounded-lg",i),children:[t.map((u,f)=>jsx(Draggable,{draggableId:r(u),index:f,isDragDisabled:a,children:(p,m)=>jsx("div",{ref:p.innerRef,...p.draggableProps,...p.dragHandleProps,className:I("transition-all duration-200",m.isDragging&&"rotate-2 scale-105 shadow-lg z-50",a&&"cursor-not-allowed opacity-50"),style:{...p.draggableProps.style,transform:m.isDragging?p.draggableProps.style?.transform:"none"},children:n(u,f)})},r(u))),c.placeholder]})})})}/*! Bundled license information:
|
|
113
167
|
|
|
114
168
|
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
|
115
169
|
(**
|
|
@@ -156,4 +210,4 @@ use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.developme
|
|
|
156
210
|
*)
|
|
157
211
|
*/
|
|
158
212
|
|
|
159
|
-
export {
|
|
213
|
+
export { XW as Calendar, sne as DraggableList, f7 as Kanban, Fte as MemoryAnalytics, Bte as MemoryEfficientData, Dte as RichTextEditor, qte as SelectableVirtualList, aH as SwipeableCard, oH as VirtualList, zte as useStreamingData, Gte as useVirtualList };
|